Skip to content

Commit

Permalink
Fix dojo/ready to not blindly make calls to methods that might not ex…
Browse files Browse the repository at this point in the history
…ist on the require object. Fixes #15616.

!strict


git-svn-id: http://svn.dojotoolkit.org/src/dojo/trunk@31368 560b804f-0ae3-0310-86f3-f6aa0a117693
  • Loading branch information
csnover committed Apr 28, 2013
1 parent 5ba1169 commit 99f4331
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,18 @@ define(["./_base/kernel", "./has", "require", "./has!host-browser?./domReady", "
// The last step is necessary so that a user defined dojo.ready() callback is delayed until after the
// domReady() calls inside of dojo. Failure can be seen on dijit/tests/robot/Dialog_ally.html on IE8
// because the dijit/focus.js domReady() callback doesn't execute until after the test starts running.
while(isDomReady && (!domReady || domReady._Q.length == 0) && require.idle() && loadQ.length){
while(isDomReady && (!domReady || domReady._Q.length == 0) && (require.idle ? require.idle() : true) && loadQ.length){
var f = loadQ.shift();
try{
f();
}catch(e){
// force the dojo.js on("error") handler do display the message
e.info = e.message;
require.signal("error", e);
if(require.signal){
require.signal("error", e);
}else{
throw e;
}
}
}

Expand All @@ -57,7 +61,7 @@ define(["./_base/kernel", "./has", "require", "./has!host-browser?./domReady", "

// Check if we should run the next queue operation whenever require() finishes loading modules or domReady
// finishes processing it's queue.
require.on("idle", onEvent);
require.on && require.on("idle", onEvent);
if(domReady){
domReady._onQEmpty = onEvent;
}
Expand Down

0 comments on commit 99f4331

Please sign in to comment.