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'; |
| 8 navigator.serviceWorker.register(script, { scope: script }) |
| 9 .then(function() { |
| 10 assert_unreached('register() should fail'); |
| 11 }, function(e) { |
| 12 assert_throws( |
| 13 'SecurityError', function() { throw e; }, |
| 14 'register() on local file should fail'); |
| 15 assert_equals( |
| 16 e.message, |
| 17 'The URL protocol of the current origin is not supported: file', |
| 18 'register() should fail due to unsupported URL protocol'); |
| 19 t.done(); |
| 20 }) |
| 21 .catch(t.step_func(function(e) { |
| 22 assert_unreached(e); |
| 23 t.done(); |
| 24 })); |
| 25 }, 'Calling register() on local file'); |
| 26 |
| 27 async_test(function(t) { |
| 28 navigator.serviceWorker.getRegistration() |
| 29 .then(function() { |
| 30 assert_unreached('getRegistration() should fail') |
| 31 }, function(e) { |
| 32 assert_throws( |
| 33 'SecurityError', function() { throw e; }, |
| 34 'getRegistration() on local file should fail'); |
| 35 assert_equals( |
| 36 e.message, |
| 37 'The URL protocol of the current origin is not supported: file', |
| 38 'getRegistration() should fail due to unsupported URL protocol'); |
| 39 t.done(); |
| 40 }) |
| 41 .catch(t.step_func(function(e) { |
| 42 assert_unreached(e); |
| 43 t.done(); |
| 44 })); |
| 45 }, 'Calling getRegistration() on local file'); |
| 46 |
| 47 </script> |
OLD | NEW |