Hybrid View

    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
    37,408
    Vote Rating
    851
    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 User 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
    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

  9. #9
    Ext JS Premium Member
    Join Date
    Nov 2007
    Location
    Cologne, Germany
    Posts
    13
    Vote Rating
    7
    stefan.lotties is on a distinguished road

      1  

    Default


    +1 for strict mode. I hope it was not a design decision to abuse the API and not being able to support strict mode at all.

  10. #10
    Sencha User
    Join Date
    Mar 2010
    Location
    Bay Area
    Posts
    152
    Vote Rating
    1
    mmullany is on a distinguished road

      0  

    Default


    The Ext JS 4 class system relies on arguments.caller and we don't see any way to support strict while retaining our class coding convention. We don't plan to change the API in any significant breaking way within the 4.x line, so this isn't on deck for happening in that code line. We're taking a fresh look for future major releases, but after the breakage from 3.x to 4.x, we're becoming extremely sensitive about changing large parts of the Ext API surface all at once.

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