PDA

View Full Version : Ext.require stops calling callbacks after first failure



dmitry_vk
10 Oct 2013, 3:25 AM
REQUIRED INFORMATION Ext version tested:

Ext 4.2.1

Browser versions tested against:

Google Chrome 32.0.1664.3

DOCTYPE tested against:

html5

Description:

When Ext.require encounters 404 on injected script, subsequent Ext.require calls (even when script loads without 404) will not call callbacks.

Steps to reproduce the problem:

call
Ext.require('UndefinedClass',function(){})
after browser returns 404, call
Ext.require('Ext.Action',function(){console.log('Ext.Action callback');}) The result that was expected:


Ext.Action callback is printed on browser console

The result that occurs instead:

nothing is printed on browser console

Test Case:
<!DOCTYPE html5>
<html>
<head>
<script type="text/javascript" src="ext-debug.js"></script>
<script type="text/javascript">
// This will not print to console:
Ext.require('UndefinedClass', function () {
console.log('Ext.require(UndefinedClass) callback');
});
setTimeout(function () {
// This will not print to console:
Ext.require('Ext.Action', function () {
console.log('Ext.require(Ext.Action) callback');
});
}, 1000);
</script>
</head>
<body>
</body>
</html>

HELPFUL INFORMATION Possible fix:
Ext.Loader.numPendingFiles equals 1 after first Ext.require. It should be decremented to 0 by Ext.Loader.onFileLoadError. This function is not called because call to onError inside Ext.Loader.loadScriptFile is stripped away because it is contained in debug comment:
//<debug>
...
//</debug> (e.g., see line 6363 of ext-debug.js - the body onScriptError is empty.



The fix is to remove those debug comments
so that error-handling code is not stripped.

Additional CSS used: No CSS was used Operating System:

Windows 7

eric.cook
10 Oct 2013, 9:34 AM
For what it's worth, you should consider testing issues on a stable browser version before reporting them. The latest stable release of Chrome is 30.0.1599.69.

Gary Schlosberg
10 Oct 2013, 11:12 AM
I haven't been able to reproduce this issue. I tried it in Windows 7 with Chrome 29.0.1547.76 and Chrome 30.0.1599.69 (the latest offered to me by Chrome). Here's a fiddle of your test case.
https://fiddle.sencha.com/#fiddle/tl

Does it happen in Chrome 30 for you?

LesJ
10 Oct 2013, 12:06 PM
I'm not able to reproduce it as well.

Env:
OS X + Win7
Chrome 31.0.1650.16 beta