web-apps/vendor/requirejs/tests/error/pluginErrorContinue.html
Maxim Kadushkin 741b10515d webapps added
2016-03-10 21:48:53 -03:00

66 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>require.js: Plugin Load Error/Continue Loading Test</title>
<script type="text/javascript" src="../../require.js"></script>
<script type="text/javascript" src="../doh/runner.js"></script>
<script type="text/javascript" src="../doh/_browserRunner.js"></script>
<script type="text/javascript">
var doneCount = 0;
var master = new doh.Deferred();
function done() {
master.callback(true);
}
requirejs.onError = function (err) {
if (err.requireModules && err.plugMessage === 'broken') {
var id = err.requireModules[0],
config = {paths: {}};
setTimeout(function () {
requirejs(['c', 'd', 'plug!nested'], function (c, d, nested) {
doh.is('c', c.name);
doh.is('a', c.a.name);
doh.is('d', d.name);
doh.is('b', d.b.name);
doh.is('nested', nested);
done();
});
}, 100);
return;
}
throw err;
};
requirejs({
waitSeconds: 2
}, ['a', 'b', 'plug!broken'], function (a, b, broken) {
doh.is("not-a", a.name);
done();
});
doh.register(
"pluginErrorContinue",
[
{
name: "pluginErrorContinue",
timeout: 5000,
runTest: function () {
return master;
}
}
]
);
doh.run();
</script>
</head>
<body>
<h1>require.js: Plugin Load Error/Continue Loading Test</h1>
<p>A failure of one plugin loaded resource does not mean later loads are broken.</p>
<p>Check console for messages</p>
</body>
</html>