Skip to content

Commit

Permalink
Fix an issue where 3 text plugin files were loaded after initial page…
Browse files Browse the repository at this point in the history
… load. The reset of the timeout time was only done in the normal require.load function not in the load functions for plugins, so essentially a timeout happened on the 3 files. However, the timeout block did not actually throw the timeout error, so the normal callback paths were followed leading to weird behavior. This issues affects anything where just plugin resources are loaded after page load. If just one normal JS resource is loaded things are OK.
  • Loading branch information
jrburke committed Aug 3, 2010
1 parent e6bc01c commit d12935b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion require.js
Expand Up @@ -562,6 +562,9 @@ var require;
if (!context.specified[dep.fullName]) {
context.specified[dep.fullName] = true;

//Reset the start time to use for timeouts
context.startTime = (new Date()).getTime();

//If a plugin, call its load method.
if (dep.prefix) {
//>>excludeStart("requireExcludePlugin", pragmas.requireExcludePlugin);
Expand Down Expand Up @@ -709,7 +712,6 @@ var require;
require.attach(url, contextName, moduleName);
urlFetched[url] = true;
}
context.startTime = (new Date()).getTime();
//>>excludeStart("requireExcludeContext", pragmas.requireExcludeContext);
}
//>>excludeEnd("requireExcludeContext");
Expand Down Expand Up @@ -913,6 +915,7 @@ var require;
err = new Error("require.js load timeout for modules: " + noLoads);
err.requireType = "timeout";
err.requireModules = noLoads;
throw err;
}
if (stillLoading) {
//Something is still waiting to load. Wait for it.
Expand Down

0 comments on commit d12935b

Please sign in to comment.