Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: callParent() breaks Firefox when using js strict mode

    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

    Default 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 Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448

    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 @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User Jacky Nguyen's Avatar
    Join Date
    Jul 2009
    Location
    Palo Alto, California
    Posts
    469

    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

    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

    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

    Default

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

  7. #7
    Ext JS Premium Member
    Join Date
    Sep 2009
    Posts
    83

    Default

    +1 for "strict mode"

  8. #8
    Sencha User
    Join Date
    Sep 2009
    Posts
    10

    Default 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

    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

    Default

    Please add this to the roadmap. +1

Page 1 of 2 12 LastLast

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •