blob: ef60ee27ffaaac0d28e956a56e304e27b03c0858 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Worklet</title>
<script type="application/javascript" src="common.js"></script>
</head>
<body>
<script type="application/javascript">
setupTest();
var worklet = window.createWorklet();
ok(!!worklet, "We have a Worklet");
// First loading
worklet.import("common.js")
.then(() => {
ok(true, "Import should load a resource.");
})
// Second loading - same file
.then(() => {
return worklet.import("common.js")
})
.then(() => {
ok(true, "Import should load a resource.");
})
// 3rd loading - a network error
.then(() => {
return worklet.import("404.js");
})
.then(() => {
ok(false, "The loading should fail.");
}, () => {
ok(true, "The loading should fail.");
})
// 4th loading - a network error
.then(() => {
return worklet.import("404.js");
})
.then(() => {
ok(false, "The loading should fail.");
}, () => {
ok(true, "The loading should fail.");
})
// done
.then(() => {
SimpleTest.finish();
});
</script>
</body>
</html>
|