setup:
anonymous AMD module accessible at /static/compiled/js/tests/fixtures/test_module.js. Doesn't matter what it exports.
var req = requirejs.config({
context: "foobar",
baseUrl: "/static/",
paths: {"tests/fixtures/test_module": "compiled/js/tests/fixtures/test_module"},
waitSeconds: .00001,
})
req.onError = function(e){console.log("local require error", e)};
req(
["tests/fixtures/test_module"],
(a) => console.log("failed. loaded:", a),
(err) => console.log("success", err)
);
Expect: errback to fire; success callback not to fire. window.onError / requirejs.onError / req.onError not to fire (as the errback will have handled things)
Actual (Tested in Chrome 61): the timeout is thrown, and caught by req.onError (Uncaught Error: Timeout for modules: tests/fixtures/test_module). The success callback is called regardless, and with the correctly loaded module (in this synthetic case of absurdly low timeout + working server). I wonder if the success callback would be called if the timeout was actually long enough that the browser itself gave up.
And for bonus points: the following results in two timeouts, but the second has no modules attached: Uncaught Error: Timeout for modules : is the error message.
var req = requirejs.config({
context: "foobar",
baseUrl: "/static/",
paths: {"tests/fixtures/test_module": "compiled/js/tests/fixtures/test_module"},
waitSeconds: .00001,
})
req.onError = function(e){console.log("local require error", e)};
req(
["tests/fixtures/test_module"],
(a) => console.log("failed. loaded:", a),
(err) => console.log("success", err)
);
req(
["tests/fixtures/test_module"],
(a) => console.log("failed. loaded:", a),
(err) => console.log("success", err)
);
setup:
anonymous AMD module accessible at /static/compiled/js/tests/fixtures/test_module.js. Doesn't matter what it exports.
Expect: errback to fire; success callback not to fire. window.onError / requirejs.onError / req.onError not to fire (as the errback will have handled things)
Actual (Tested in Chrome 61): the timeout is thrown, and caught by req.onError (
Uncaught Error: Timeout for modules: tests/fixtures/test_module). The success callback is called regardless, and with the correctly loaded module (in this synthetic case of absurdly low timeout + working server). I wonder if the success callback would be called if the timeout was actually long enough that the browser itself gave up.And for bonus points: the following results in two timeouts, but the second has no modules attached:
Uncaught Error: Timeout for modules :is the error message.