Add (entirely incorrect) fetching of ServiceWorker scripts.
[WebKit-https.git] / LayoutTests / http / tests / workers / service / resources / basic-register-exceptions.js
1 function done()
2 {
3     finishSWTest();
4 }
5
6 navigator.serviceWorker.register("image-mime-type.php", { })
7 .then(function(r) {
8         console.log("Registered! (unexpectedly)");
9 }, function(e) {
10         console.log("Registration failed with error: " + e);
11 })
12 .catch(function(e) {
13         console.log("Exception registering: " + e);
14 });
15
16 navigator.serviceWorker.register("", { })
17 .then(function(r) {
18         console.log("Registered! (unexpectedly)");
19 }, function(e) {
20         console.log("Registration failed with error: " + e);
21 })
22 .catch(function(e) {
23         console.log("Exception registering: " + e);
24 });
25
26 navigator.serviceWorker.register("http://127.0.0.1:abc", { })
27 .then(function(r) {
28         console.log("Registered! (unexpectedly)");
29 }, function(e) {
30         console.log("Registration failed with error: " + e);
31 })
32 .catch(function(e) {
33         console.log("Exception registering: " + e);
34 });
35
36 navigator.serviceWorker.register("somescheme://script.js", { })
37 .then(function(r) {
38         console.log("Registered! (unexpectedly)");
39 }, function(e) {
40         console.log("Registration failed with error: " + e);
41 })
42 .catch(function(e) {
43         console.log("Exception registering: " + e);
44 });
45
46 navigator.serviceWorker.register("resources/%2fscript.js", { })
47 .then(function(r) {
48         console.log("Registered! (unexpectedly)");
49 }, function(e) {
50         console.log("Registration failed with error: " + e);
51 })
52 .catch(function(e) {
53         console.log("Exception registering: " + e);
54 });
55
56 navigator.serviceWorker.register("resources/script.js", { scope: "somescheme://script.js" })
57 .then(function(r) {
58         console.log("Registered! (unexpectedly)");
59 }, function(e) {
60         console.log("Registration failed with error: " + e);
61 })
62 .catch(function(e) {
63         console.log("Exception registering: " + e);
64 });
65
66 navigator.serviceWorker.register("resources/script.js", { scope: "%2fscript.js" })
67 .then(function(r) {
68         console.log("Registered! (unexpectedly)");
69 }, function(e) {
70         console.log("Registration failed with error: " + e);
71 })
72 .catch(function(e) {
73         console.log("Exception registering: " + e);
74 });
75
76 navigator.serviceWorker.register("http://localhost:8000/workers/service/resources/empty-worker.js", { })
77 .then(function(r) {
78         console.log("Registered! (unexpectedly)");
79 }, function(e) {
80         console.log("Registration failed with error: " + e);
81 })
82 .catch(function(e) {
83         console.log("Exception registering: " + e);
84 });
85
86 navigator.serviceWorker.register("resources/empty-worker.js", { scope: "http://localhost:8000/workers/service/" })
87 .then(function(r) {
88         console.log("Registered! (unexpectedly)");
89         done();
90 }, function(e) {
91         console.log("Registration failed with error: " + e);
92         done();
93 })
94 .catch(function(e) {
95         console.log("Exception registering: " + e);
96         done();
97 });