jrburke/requirejs — Issue #171: Cap setTimeout polling when a define() factory error
Author: jrburke
Created: 2012-01-23 05:11:48+00:00
State: open

If a factory function throws an error, scriptCount does not get cleaned up and everything is marked as "loaded", so setTimeout checking for done fires every 50 ms forever.

Cleanup is not done because that would require a catch, and that will mess up the error reporting in the console (errors can be caught by setting catchError.define = true though).

Do not bother continuing to setTimeout if the expired point has been reached (waitSeconds has elapsed). The setTimeouts will still fire until waitSeconds, but there is an upper bound on them.