Hybrid View
-
1 Jul 2012 8:58 PM #1
Ext.Function.createInterceptor can't return false value for intercepted method
Ext.Function.createInterceptor can't return false value for intercepted method
REQUIRED INFORMATION
Ext version tested:- Ext 4.*
Description:
Ext.Function.createInterceptor can't return false value for intercepted method. Because of this compare with false thru === is failed
Steps to reproduce the problem:
Execute code from test case.
The result that was expected:
The result that occurs instead:Code:f0 hello f0Interceptor hello
Test Case:Code:f0 hello f0Interceptor
PHP Code:var hello = function() {
console.log('hello');
},
f0 = function() {
console.log('f0');
return false;
};
if (f0() === false) {
hello();
}
f0 = Ext.Function.createInterceptor(f0, function() {
console.log('f0Interceptor');
return false;
}, this, false);
if (f0() === false) {
hello();
} else {
throw new Error("Interceptor fail");
}
HELPFUL INFORMATION
Possible fix:
PHP Code:Ext.apply(Ext.Function, {
createInterceptor: function(origFn, newFn, scope, returnValue) {
var method = origFn;
if (!Ext.isFunction(newFn)) {
return origFn;
} else {
returnValue = Ext.isDefined(returnValue) ? returnValue : null;
return function() {
var me = this,
args = arguments;
newFn.target = me;
newFn.method = origFn;
return (newFn.apply(scope || me || Ext.global, args) !== false) ? origFn.apply(me || Ext.global, args) : returnValue;
};
}
}
});
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-6714
in
4.1.2.


Reply With Quote