OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>Service Worker: ServiceWorkerRegistration.update() error.</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 promise_test(function(t) { | |
nhiroki
2015/08/06 09:57:28
How about merging this test into serviceworker/upd
jungkees
2015/08/06 10:53:12
Okay. I'll upload a new snapshot when I'm ready wi
| |
8 var scope = 'resources/scope/update'; | |
9 var worker_url = 'resources/update-worker-error.php'; | |
10 var expected_url = normalizeURL(worker_url); | |
11 var registration; | |
12 | |
13 return service_worker_unregister_and_register(t, worker_url, scope) | |
14 .then(function(r) { | |
15 registration = r; | |
16 return wait_for_state(t, registration.installing, 'activated'); | |
17 }) | |
18 .then(function() { | |
19 assert_equals(registration.installing, null, | |
20 'installing should be null in the initial state.'); | |
21 assert_equals(registration.waiting, null, | |
22 'waiting should be null in the initial state.'); | |
23 assert_equals(registration.active.scriptURL, expected_url, | |
24 'active should exist in the initial state.'); | |
25 | |
26 // A new worker(generated by update-worker-error.php) should be found. | |
27 // The returned promise should reject as update-worker-error.php sets | |
28 // the mimetype to disallowed value. | |
29 return registration.update(); | |
30 }) | |
31 .catch(function(e) { | |
32 assert_throws("SecurityError", function() { throw e; }, | |
33 'Using a disallowed mimetype should make update() ' + | |
34 'promise reject with a SecurityError.'); | |
35 }); | |
36 }, 'Update a registration caught an error.'); | |
37 </script> | |
OLD | NEW |