OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
horo
2014/09/25 09:49:00
indent fix
<!DOCTYPE html>
<title>Service Worker
dmurph
2014/09/26 17:42:02
Done.
| |
2 <title>Service Worker: Registration</title> | |
3 <script src="../resources/testharness.js"></script> | |
4 <script src="../resources/testharnessreport.js"></script> | |
5 <script src="resources/test-helpers.js"></script> | |
6 <script> | |
7 function fetch_url(url) { | |
8 return new Promise(function(resolve, reject) { | |
9 var request = new XMLHttpRequest(); | |
10 request.addEventListener('load', function(event) { | |
11 if (request.status == 200) | |
12 resolve(request.response); | |
13 else | |
14 reject(Error(request.statusText)); | |
15 }); | |
16 request.open('GET', url); | |
17 request.send(); | |
18 }); | |
19 } | |
20 var worker = 'resources/fail-on-fetch-worker.js'; | |
21 | |
22 async_test(function(t) { | |
23 var scope = '/'; | |
24 service_worker_unregister_and_register(t, worker, scope) | |
25 .then(function(reg) { return wait_for_activated(t, reg, scope); }) | |
26 .then(function() { | |
27 return fetch_url('/serviceworker/resources/simple.json'); | |
28 }) | |
29 .then(function(json) { | |
30 assert_equals(json, '{ "a" : 1, "b" : 2 }\n'); | |
31 service_worker_unregister_and_done(t, scope); | |
32 }) | |
33 .catch(t.step_func(function(reason) { | |
34 assert_unreached(reason.message); | |
35 })); | |
36 }, 'Fetch events should not go through uncontrolled page.'); | |
37 </script> | |
OLD | NEW |