-
16 Aug 2011 10:30 PM #1
[CLOSED][EXT 4.0.2] Ext.bind - do not work in FF if function undefined
[CLOSED][EXT 4.0.2] Ext.bind - do not work in FF if function undefined
Hello,
i have js source in which exists next line
this js file loaded by Ext.LoaderCode:Ext.bind(this.formatData, this)
in Firefox(6.0) if formatData undefined i got no errors by script stops to run
but in Chrome i got next error
Uncaught TypeError: Cannot call method 'apply' of undefined
in ext-all-debug-w-comments.js on line 2367
Code:bind: function(fn, scope, args, appendArgs) { var method = fn, slice = Array.prototype.slice; return function() { var callArgs = args || arguments; if (appendArgs === true) { callArgs = slice.call(arguments, 0); callArgs = callArgs.concat(args); } else if (Ext.isNumber(appendArgs)) { callArgs = slice.call(arguments, 0); // copy arguments first Ext.Array.insert(callArgs, appendArgs, args); } return method.apply(scope || window, callArgs); //<---- line 2367
ext-all-debug-w-comments.js:2367Uncaught TypeError: Cannot call method 'apply' of undefined
-
17 Aug 2011 7:23 PM #2
What behavior do you expect?
If your issue is with inconsistent error reporting between browsers, then this is not an Ext issue. Calling a method on a null reference is a standard Javascript error and the browser should report it.
This works for me as expected on FF6 with Firebug 1.8b2 (note that I added brackets to execute the function returned by Ext.bind):
Code:Ext.bind(this.formatData, this)( ) // error msg -> 'method is undefined'
Maybe you would like Ext to throw an exception when calling Ext.bind with a null reference (not just upon execution of the generated function).
Well, personally, I tend to agree. However, I found that parameter checking is hardly ever done in Ext (and Javascript coding in general), and this seems to be 'by design'.
I am not around here long enough to know if error handling has been discussed before. I've seen some improvements in Ext4 what seems to be extended error handling in the 'debug versions' of Ext. But I doubt that there has been a policy change.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote