OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <script src="../../resources/testharness.js"></script> | |
3 <script src="../../resources/testharnessreport.js"></script> | |
4 <script> | |
5 | |
6 async_test(function(t) { | |
7 var script = 'no-such-worker'; | |
falken
2014/11/12 09:04:41
Doesn't this need to be a "file:///" URL? But then
falken
2014/11/12 09:07:03
Please disregard.
| |
8 navigator.serviceWorker.register(script, { scope: script }) | |
9 .then(function() { | |
10 assert_unreached('A returned promise should be rejected'); | |
falken
2014/11/12 09:04:41
More grammatical is "The returned promise should b
nhiroki
2014/11/12 09:42:09
Done.
| |
11 }, function(e) { | |
falken
2014/11/12 09:04:41
Maybe we should assert on the error message conten
falken
2014/11/12 09:07:03
I still think this may be a good idea, WDYT?
nhiroki
2014/11/12 09:42:09
+1! Added the check.
falken
2014/11/13 08:27:55
Ah, sorry. I just realized this was bad advice sin
| |
12 assert_throws( | |
13 'SecurityError', function() { throw e; }, | |
14 'Calling register() on local file should fail'); | |
15 t.done(); | |
16 }) | |
17 .catch(t.step_func(function(e) { | |
18 assert_unreached(e); | |
19 t.done(); | |
20 })); | |
21 }, 'Calling register() on local file'); | |
22 | |
23 async_test(function(t) { | |
24 navigator.serviceWorker.getRegistration() | |
25 .then(function() { | |
26 assert_unreached('A returned promise should be rejected') | |
27 }, function(e) { | |
28 assert_throws( | |
29 'SecurityError', function() { throw e; }, | |
30 'Calling getRegistration() on local file should fail'); | |
31 t.done(); | |
32 }) | |
33 .catch(t.step_func(function(e) { | |
34 assert_unreached(e); | |
35 t.done(); | |
36 })); | |
37 }, 'Calling getRegistration() on local file'); | |
38 | |
39 </script> | |
OLD | NEW |