OLD | NEW |
1 var SCOPE = 'resources/fetch-access-control-iframe.html'; | 1 var SCOPE = 'resources/fetch-access-control-iframe.html'; |
2 var BASE_URL = 'http://127.0.0.1:8000/serviceworker/resources/fetch-access-contr
ol.php?'; | 2 var BASE_URL = 'http://127.0.0.1:8000/serviceworker/resources/fetch-access-contr
ol.php?'; |
3 var OTHER_BASE_URL = 'http://localhost:8000/serviceworker/resources/fetch-access
-control.php?'; | 3 var OTHER_BASE_URL = 'http://localhost:8000/serviceworker/resources/fetch-access
-control.php?'; |
4 var REDIRECT_URL = 'http://127.0.0.1:8000/serviceworker/resources/redirect.php?R
edirect='; | 4 var REDIRECT_URL = 'http://127.0.0.1:8000/serviceworker/resources/redirect.php?R
edirect='; |
5 var IFRAME_URL = 'http://127.0.0.1:8000/serviceworker/resources/fetch-access-con
trol-iframe.html'; | 5 var IFRAME_URL = 'http://127.0.0.1:8000/serviceworker/resources/fetch-access-con
trol-iframe.html'; |
6 var WORKER_URL = 'http://127.0.0.1:8000/serviceworker/resources/fetch-access-con
trol-worker.js'; | 6 var WORKER_URL = 'http://127.0.0.1:8000/serviceworker/resources/fetch-access-con
trol-worker.js'; |
7 var IFRAME_ORIGIN = 'http://127.0.0.1:8000'; | 7 var IFRAME_ORIGIN = 'http://127.0.0.1:8000'; |
8 | 8 |
9 // Functions to check the result from the ServiceWorker. | 9 // Functions to check the result from the ServiceWorker. |
10 var checkFetchResult = function(expected, url, data) { | 10 var checkFetchResult = function(expected, url, data) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 var counter = 0; | 128 var counter = 0; |
129 window.addEventListener('message', test.step_func(onMessage), false); | 129 window.addEventListener('message', test.step_func(onMessage), false); |
130 | 130 |
131 Promise.all([login1, login2]) | 131 Promise.all([login1, login2]) |
132 .then(function() { | 132 .then(function() { |
133 return service_worker_unregister_and_register(test, | 133 return service_worker_unregister_and_register(test, |
134 workerScript, | 134 workerScript, |
135 SCOPE); | 135 SCOPE); |
136 }) | 136 }) |
137 .then(function(registration) { | 137 .then(function(registration) { |
138 return wait_for_update(test, registration); | 138 worker = registration.installing; |
139 }) | |
140 .then(function(sw) { | |
141 worker = sw; | |
142 var messageChannel = new MessageChannel(); | 139 var messageChannel = new MessageChannel(); |
143 messageChannel.port1.onmessage = test.step_func(onWorkerMessage); | 140 messageChannel.port1.onmessage = test.step_func(onWorkerMessage); |
144 sw.postMessage( | 141 worker.postMessage( |
145 {port: messageChannel.port2}, [messageChannel.port2]); | 142 {port: messageChannel.port2}, [messageChannel.port2]); |
146 return wait_for_state(test, sw, 'activated'); | 143 return wait_for_state(test, worker, 'activated'); |
147 }) | 144 }) |
148 .then(function() { | 145 .then(function() { |
149 return with_iframe(SCOPE); | 146 return with_iframe(SCOPE); |
150 }) | 147 }) |
151 .then(function(frame) { | 148 .then(function(frame) { |
152 frameWindow = frame.contentWindow; | 149 frameWindow = frame.contentWindow; |
153 // Start tests. | 150 // Start tests. |
154 loadNext(); | 151 loadNext(); |
155 }) | 152 }) |
156 .catch(unreached_rejection(test)); | 153 .catch(unreached_rejection(test)); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 worker.postMessage({msg: 'START TEST CASE'}); | 206 worker.postMessage({msg: 'START TEST CASE'}); |
210 })) | 207 })) |
211 .then(test.step_func(function() { | 208 .then(test.step_func(function() { |
212 frameWindow.postMessage( | 209 frameWindow.postMessage( |
213 {url: TEST_TARGETS[counter][0]}, | 210 {url: TEST_TARGETS[counter][0]}, |
214 IFRAME_ORIGIN); | 211 IFRAME_ORIGIN); |
215 })); | 212 })); |
216 } | 213 } |
217 }); | 214 }); |
218 } | 215 } |
OLD | NEW |