PDA

View Full Version : [CLOSED] Error on use stric



halcwb
18 Aug 2013, 10:44 AM
REQUIRED INFORMATION

Ext version tested:

Ext 4.2.0 rev 663
Browser versions tested against:

FF 23
Chrome 28
Description:

Use strict mode
Steps to reproduce the problem:

Run the controller without strict mode
No problems
Use strict mode
Fails with: TypeError: access to strict mode caller function is censored
The result that was expected:

No error
The result that occurs instead:

Error
Test Case:



'use strict';


Ext.define('GenPresWebView.controller.override.application.Pdms', {
override: 'GenPresWebView.controller.application.Pdms',


constructor: function (config) {
this.ext = config.ext || Ext;
this.server = config.server || GenPres;


this.initConfig(config);
this.callParent(arguments);
},


init: function(application) {
var me = this,
proc = GenPresWebView.util.EventDeclarationProcessor,
decl = GenPresWebView.eventDeclaration['application.Pdms'];


proc.initFn(me, decl, application);
},


onPdmsDatabaseSelect: function (combo, records, eOpts) {
var me = this, dbconn = records[0];




me.setPDMSDatabase(dbconn.data.Server, dbconn.data.User, dbconn.data.Password, dbconn.data.Database);
},


onPdmsDatabaseComboExpand: function (combo) {
combo.store.load();
},


setPDMSDatabase: function (server, user, password, database) {
this.server.Database.SetPDMSDatabase(server, user, password, database,
function (result) {
Ext.Msg.alert('Set PDMS database to', result.Database);
window.location.reload();
});
}


});


Code in Ext that causes the error:



callParent: function(args) {




var method,
superMethod = (method = this.callParent.caller) && (method.$previous ||
((method = method.$owner ? method : method.caller) &&
method.$owner.superclass[method.$name]));




return superMethod.apply(this, args || noArgs);
},




Specifically, the this.callParent.caller is causing the problem.

evant
18 Aug 2013, 2:00 PM
See: http://www.sencha.com/forum/showthread.php?132503-callParent()-breaks-Firefox-when-using-js-strict-mode&p=968674&viewfull=1#post968674

halcwb
18 Aug 2013, 3:37 PM
See: http://www.sencha.com/forum/showthread.php?132503-callParent()-breaks-Firefox-when-using-js-strict-mode&p=968674&viewfull=1#post968674

Thanks, clear. I found a workaround by applying setter injection instead of constructor injection. Then I am able to use strict mode.