3.0 source code
This commit is contained in:
3
OfficeWeb/vendor/requirejs/tests/error/a.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/error/a.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define({
|
||||
name: 'a'
|
||||
});
|
||||
4
OfficeWeb/vendor/requirejs/tests/error/b.js
vendored
Normal file
4
OfficeWeb/vendor/requirejs/tests/error/b.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
define({
|
||||
name: 'b'
|
||||
});
|
||||
|
||||
6
OfficeWeb/vendor/requirejs/tests/error/c.js
vendored
Normal file
6
OfficeWeb/vendor/requirejs/tests/error/c.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
define(['a'], function (a) {
|
||||
return {
|
||||
name: 'c',
|
||||
a: a
|
||||
};
|
||||
});
|
||||
7
OfficeWeb/vendor/requirejs/tests/error/d.js
vendored
Normal file
7
OfficeWeb/vendor/requirejs/tests/error/d.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
define(['b'], function (b) {
|
||||
return {
|
||||
name: 'd',
|
||||
b: b
|
||||
};
|
||||
});
|
||||
|
||||
6
OfficeWeb/vendor/requirejs/tests/error/defineError.js
vendored
Normal file
6
OfficeWeb/vendor/requirejs/tests/error/defineError.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
define(['a'], function (a) {
|
||||
return {
|
||||
name: 'hasDefineError',
|
||||
broken: a.doesNotExist.blowsUp
|
||||
};
|
||||
});
|
||||
68
OfficeWeb/vendor/requirejs/tests/error/defineErrorLocal.html
vendored
Normal file
68
OfficeWeb/vendor/requirejs/tests/error/defineErrorLocal.html
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Define Error Local 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() {
|
||||
doneCount += 1;
|
||||
if (doneCount == 2) {
|
||||
master.callback(true);
|
||||
}
|
||||
}
|
||||
|
||||
requirejs({
|
||||
waitSeconds: 2
|
||||
}, ['b', 'defineError'], function (b, defineError) {
|
||||
doh.is("shouldNotBeReached", b.name);
|
||||
done();
|
||||
}, function (err) {
|
||||
|
||||
if (err.requireType === 'define') {
|
||||
requirejs(['c', 'd'], function (c, d) {
|
||||
doh.is('c', c.name);
|
||||
doh.is('a', c.a.name);
|
||||
doh.is('d', d.name);
|
||||
doh.is('b', d.b.name);
|
||||
|
||||
setTimeout(function () {
|
||||
//Ask for the broken thing again, should get error
|
||||
//handler still called.
|
||||
requirejs(['defineError'], function (de) {
|
||||
doh.is("shouldNotBeReached", de.name);
|
||||
done();
|
||||
}, function (err) {
|
||||
doh.is("define", err.requireType);
|
||||
done();
|
||||
});
|
||||
}, 10);
|
||||
done();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
doh.register(
|
||||
"defineErrorLocal",
|
||||
[
|
||||
{
|
||||
name: "defineErrorLocal",
|
||||
timeout: 5000,
|
||||
runTest: function () {
|
||||
return master;
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Define Error Local Test</h1>
|
||||
<p>A factory function error calls the local error handler and later loads still work.</p>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
3
OfficeWeb/vendor/requirejs/tests/error/doubleRequire/b.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/error/doubleRequire/b.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define(['myShim'], function (broken) {
|
||||
return { name: 'b' };
|
||||
});
|
||||
3
OfficeWeb/vendor/requirejs/tests/error/doubleRequire/c.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/error/doubleRequire/c.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define(['myShim'], function (broken) {
|
||||
return { name: 'c' };
|
||||
});
|
||||
64
OfficeWeb/vendor/requirejs/tests/error/doubleRequire/doubleRequire.html
vendored
Normal file
64
OfficeWeb/vendor/requirejs/tests/error/doubleRequire/doubleRequire.html
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Double Require Error 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() {
|
||||
doneCount += 1;
|
||||
if (doneCount === 2) {
|
||||
master.callback(true);
|
||||
}
|
||||
}
|
||||
|
||||
require.config({
|
||||
waitSeconds: 2,
|
||||
shim:{
|
||||
myShim: {
|
||||
deps: ['broken'],
|
||||
exports: 'myShim'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
require(['b'], function (b) {
|
||||
throw new Error('Should not reach here 1');
|
||||
}, function (err) {
|
||||
console.log(err);
|
||||
done();
|
||||
setTimeout(function () {
|
||||
requirejs(['c'], function (c) {
|
||||
throw new Error('Should not reach here 2');
|
||||
}, function (err) {
|
||||
console.log(err);
|
||||
done();
|
||||
});
|
||||
}, 100);
|
||||
});
|
||||
|
||||
doh.register(
|
||||
"errorDoubleRequire",
|
||||
[
|
||||
{
|
||||
name: "errorDoubleRequire",
|
||||
timeout: 7000,
|
||||
runTest: function () {
|
||||
return master;
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Double Require Error Test</h1>
|
||||
<p>Make sure two separate require calls to modules that have the same
|
||||
failed dependency properly call the require errbacks.</p>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
61
OfficeWeb/vendor/requirejs/tests/error/errorContinue.html
vendored
Normal file
61
OfficeWeb/vendor/requirejs/tests/error/errorContinue.html
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: 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) {
|
||||
setTimeout(function () {
|
||||
requirejs(['c', 'd'], function (c, d) {
|
||||
doh.is('c', c.name);
|
||||
doh.is('a', c.a.name);
|
||||
doh.is('d', d.name);
|
||||
doh.is('b', d.b.name);
|
||||
done();
|
||||
});
|
||||
}, 100);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
throw err;
|
||||
};
|
||||
|
||||
requirejs({
|
||||
waitSeconds: 2,
|
||||
enforceDefine: true
|
||||
}, ['a', 'b', 'broken'], function (a, b, broken) {
|
||||
doh.is("not-a", a.name);
|
||||
done();
|
||||
});
|
||||
|
||||
doh.register(
|
||||
"errorContinue",
|
||||
[
|
||||
{
|
||||
name: "errorContinue",
|
||||
timeout: 5000,
|
||||
runTest: function () {
|
||||
return master;
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Load Error/Continue Loading Test</h1>
|
||||
<p>A failure of one module does not mean later loads are broken.</p>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
58
OfficeWeb/vendor/requirejs/tests/error/errorContinueLocal.html
vendored
Normal file
58
OfficeWeb/vendor/requirejs/tests/error/errorContinueLocal.html
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Load Error/Continue Loading Local 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({
|
||||
waitSeconds: 2,
|
||||
enforceDefine: true
|
||||
}, ['a', 'b', 'broken'], function (a, b, broken) {
|
||||
doh.is("not-a", a.name);
|
||||
done();
|
||||
}, function (err) {
|
||||
if (err.requireModules) {
|
||||
var id = err.requireModules[0],
|
||||
config = {paths: {}};
|
||||
|
||||
setTimeout(function () {
|
||||
requirejs(['c', 'd'], function (c, d) {
|
||||
doh.is('c', c.name);
|
||||
doh.is('a', c.a.name);
|
||||
doh.is('d', d.name);
|
||||
doh.is('b', d.b.name);
|
||||
done();
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
||||
doh.register(
|
||||
"errorContinueLocal",
|
||||
[
|
||||
{
|
||||
name: "errorContinueLocal",
|
||||
timeout: 5000,
|
||||
runTest: function () {
|
||||
return master;
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Load Error/Continue Loading Local Test</h1>
|
||||
<p>A failure of one module does not mean later loads are broken.</p>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
48
OfficeWeb/vendor/requirejs/tests/error/globalOnError.html
vendored
Normal file
48
OfficeWeb/vendor/requirejs/tests/error/globalOnError.html
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Global onError 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 master = new doh.Deferred(),
|
||||
failed = false;
|
||||
|
||||
requirejs.onError = function (err) {
|
||||
if (!failed) {
|
||||
master.callback(true);
|
||||
}
|
||||
};
|
||||
|
||||
define('a', {name: 'a'});
|
||||
|
||||
require(['a'], function (a) {
|
||||
a.whatever.fail = 'fail';
|
||||
}, function (err) {
|
||||
failed = true;
|
||||
});
|
||||
|
||||
doh.register(
|
||||
"globalOnError",
|
||||
[
|
||||
{
|
||||
name: "globalOnError",
|
||||
timeout: 1000,
|
||||
runTest: function () {
|
||||
return master;
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Global onError Test</h1>
|
||||
<p>If global onError function set up, favor using it even for require
|
||||
callback errors.
|
||||
<a href="https://github.com/jrburke/requirejs/issues/721">More info</a>.</p>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
12
OfficeWeb/vendor/requirejs/tests/error/plug.js
vendored
Normal file
12
OfficeWeb/vendor/requirejs/tests/error/plug.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
define({
|
||||
load: function (id, require, load, config) {
|
||||
'use strict';
|
||||
if (id === 'broken') {
|
||||
var err = new Error('broken');
|
||||
err.plugMessage = id;
|
||||
load.error(err);
|
||||
} else {
|
||||
load(id);
|
||||
}
|
||||
}
|
||||
});
|
||||
65
OfficeWeb/vendor/requirejs/tests/error/pluginErrorContinue.html
vendored
Normal file
65
OfficeWeb/vendor/requirejs/tests/error/pluginErrorContinue.html
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<!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>
|
||||
55
OfficeWeb/vendor/requirejs/tests/error/pluginErrorContinueLocal.html
vendored
Normal file
55
OfficeWeb/vendor/requirejs/tests/error/pluginErrorContinueLocal.html
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Plugin Load Error/Continue Loading Local 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({
|
||||
waitSeconds: 2
|
||||
}, ['a', 'b', 'plug!broken'], function (a, b, broken) {
|
||||
doh.is("not-a", a.name);
|
||||
done();
|
||||
}, function (err) {
|
||||
if (err.requireModules && err.plugMessage === 'broken') {
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
doh.register(
|
||||
"pluginErrorContinue",
|
||||
[
|
||||
{
|
||||
name: "pluginErrorContinue",
|
||||
timeout: 5000,
|
||||
runTest: function () {
|
||||
return master;
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Plugin Load Error/Continue Loading Local Test</h1>
|
||||
<p>A failure of one plugin resource load does not mean later loads are broken.</p>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
48
OfficeWeb/vendor/requirejs/tests/error/requireErrback.html
vendored
Normal file
48
OfficeWeb/vendor/requirejs/tests/error/requireErrback.html
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Require Errback Skip 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 master = new doh.Deferred(),
|
||||
failed = false;
|
||||
|
||||
function done() {
|
||||
if (!failed) {
|
||||
master.callback(true);
|
||||
}
|
||||
}
|
||||
define('a', {name: 'a'});
|
||||
|
||||
require(['a'], function (a) {
|
||||
a.whatever.fail = 'fail';
|
||||
}, function (err) {
|
||||
failed = true;
|
||||
});
|
||||
|
||||
setTimeout(done, 500);
|
||||
|
||||
doh.register(
|
||||
"errorRequireErrback",
|
||||
[
|
||||
{
|
||||
name: "errorRequireErrback",
|
||||
timeout: 1000,
|
||||
runTest: function () {
|
||||
return master;
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Require Errback Skip Test</h1>
|
||||
<p>An error in the require callback should not trigger the errback.
|
||||
<a href="https://github.com/jrburke/requirejs/issues/699">More info</a>.</p>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user