2 <script src=
"../../resources/testharness.js"></script>
3 <script src=
"../../resources/testharnessreport.js"></script>
6 async_test(function(t
) {
7 var script
= 'no-such-worker';
8 navigator
.serviceWorker
.register(script
, { scope
: script
})
10 assert_unreached('register() should fail');
13 'SecurityError', function() { throw e
; },
14 'register() on local file should fail');
17 'Failed to register a ServiceWorker: The URL protocol of the ' +
18 'current origin (\'file://\') is not supported.',
19 'register() should fail due to unsupported URL protocol');
22 .catch(t
.step_func(function(e
) {
26 }, 'Calling register() on local file');
28 async_test(function(t
) {
29 navigator
.serviceWorker
.getRegistration()
31 assert_unreached('getRegistration() should fail')
34 'SecurityError', function() { throw e
; },
35 'getRegistration() on local file should fail');
38 'Failed to get a ServiceWorkerRegistration: The URL protocol of ' +
39 'the current origin (\'file://\') is not supported.',
40 'getRegistration() should fail due to unsupported URL protocol');
43 .catch(t
.step_func(function(e
) {
47 }, 'Calling getRegistration() on local file');