Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    65
    Vote Rating
    1
    c089 is on a distinguished road

      1  

    Default callParent() breaks Firefox when using js strict mode

    callParent() breaks Firefox when using js strict mode


    Now this is strange: When I use "use strict"; and then define a class with a custom constructor, calling callParent() breaks Firefox (4 at least) with this error:
    Error: access to strict mode caller function is censored
    . It works in Chrome, though...

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,620
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks, leaving this code here for when we get to this bug.

    Code:
    Ext.define('Test.Panel', {
        extend : 'Ext.panel.Panel',
    
        initComponent: function() {
            "use strict";
            var me = this;
    
            me.html  = 'Hello';
            me.title = 'Test';
    
            me.callParent(arguments);
        }
    });
    Ext.onReady(function() {
        var panel = Ext.create('Test.Panel', {
            renderTo : Ext.getBody(),
            width    : 400,
            height   : 400
        });
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha - Sencha Touch Dev Team Jacky Nguyen's Avatar
    Join Date
    Jul 2009
    Location
    Palo Alto, California
    Posts
    469
    Vote Rating
    14
    Jacky Nguyen has a spectacular aura about Jacky Nguyen has a spectacular aura about

      0  

    Default


    We don't support JavaScript strict mode via "use strict" (not to be confused with HTML strict mode)
    Sencha Touch Lead Architect

  4. #4
    Ext JS Premium Member kent78's Avatar
    Join Date
    Oct 2010
    Location
    Stockholm, Sweden
    Posts
    19
    Vote Rating
    0
    kent78 is on a distinguished road

      0  

    Default


    Do you plan to support "use strict"; in future releases of ExtJS or is it impossible to combine this with the Class Hierarchy approach that is used in ExtJS?

  5. #5
    Ext JS Premium Member johnwilander's Avatar
    Join Date
    Mar 2011
    Location
    Stockholm
    Posts
    12
    Vote Rating
    0
    johnwilander is on a distinguished road

      0  

    Default


    Is this a design decision? Have other extension mechanisms not using parent (caller, callee) been considered?

    EcmaScript strict mode is a very good help for avoiding common pitfalls. It's also a security measure in production and using it allows for further optimization in JavaScript engines.

  6. #6
    Sencha User SunboX's Avatar
    Join Date
    Mar 2010
    Posts
    238
    Vote Rating
    28
    SunboX has a spectacular aura about SunboX has a spectacular aura about

      1  

    Default


    +1 for "strict mode" compatibility in future Versions (faster execution time).

  7. #7
    Ext JS Premium Member
    Join Date
    Sep 2009
    Posts
    83
    Vote Rating
    3
    el.weilando is on a distinguished road

      1  

    Default


    +1 for "strict mode"

  8. #8
    Sencha User
    Join Date
    Sep 2009
    Posts
    10
    Vote Rating
    0
    PerlDiver is on a distinguished road

      0  

    Default Ditto in favor of strict mode

    Ditto in favor of strict mode


    It's a fact of life, and being incompatible with it is tying the hands of the application developers.

  9. #9
    Ext JS Premium Member
    Join Date
    Oct 2010
    Posts
    81
    Vote Rating
    1
    rhamflett is on a distinguished road

      1  

    Default


    I've been working round it by putting all the init code in a separate function which I can use strict mode with. E.g.

    Code:
    initComponent: function () {
      this.strictInitComponent();
      this.callParent(arguments);
    },
    
    strictInitComponent: function () {
      "use strict";
      // setup code goes here
    }

  10. #10
    Ext JS Premium Member
    Join Date
    Sep 2011
    Posts
    5
    Vote Rating
    2
    poweradvocate is on a distinguished road

      1  

    Default


    Please add this to the roadmap. +1

Similar Threads

  1. Replies: 1
    Last Post: 28 Mar 2011, 2:43 PM
  2. Google map in Window, IE7 strict mode
    By dickp in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 26 Oct 2008, 1:37 PM

Thread Participants: 12