WebKit Bugzilla
Attachment 371750 Details for
Bug 198720
: Update WPT service workers test up to 0df7c68
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198720-20190610085816.patch (text/plain), 437.77 KB, created by
youenn fablet
on 2019-06-10 08:58:17 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-06-10 08:58:17 PDT
Size:
437.77 KB
patch
obsolete
>Subversion Revision: 246170 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 5e0ccb80c296a290055d734eb5ad3874a548704c..adba7def91ae53573ef0bf80ad6003c7ce94a20f 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2019-06-10 Youenn Fablet <youenn@apple.com> >+ >+ Update WPT service workers test up to 0df7c68 >+ https://bugs.webkit.org/show_bug.cgi?id=198720 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestExpectations: >+ * tests-options.json: >+ > 2019-06-07 Youenn Fablet <youenn@apple.com> > > Update cached-svg-image-with-css-cross-domain.html and svg-image-with-css-cross-domain.html to use square instead of circle >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 9bee994fafa06780b986e9cb072101fe2ea2ff1f..ab6360a8b6f66b76ec0c76f80094f6bf493174a2 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,12 @@ >+2019-06-10 Youenn Fablet <youenn@apple.com> >+ >+ Update WPT service workers test up to 0df7c68 >+ https://bugs.webkit.org/show_bug.cgi?id=198720 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/service-workers: Resynced. >+ > 2019-06-05 Antoine Quint <graouts@apple.com> > > [Pointer Events] Fire pointerout and pointerleave events after firing pointercancel >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index 893f2ad8ef689861c99d766c835cbc9be73b9ba3..04d94cdb495b4e8476241ffc80da20e830e23ffe 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -2253,6 +2253,7 @@ webkit.org/b/179851 imported/w3c/web-platform-tests/html/browsers/offline/manife > webkit.org/b/182177 imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/module/errorhandling.html [ Pass Failure ] > > webkit.org/b/182311 imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect.https.html [ Skip ] >+imported/w3c/web-platform-tests/service-workers/service-worker/svg-target-reftest.https.html [ ImageOnlyFailure ] > > webkit.org/b/90980 fast/forms/textarea/textarea-state-restore.html [ Pass Timeout ] > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/script-tests/cache-match.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/script-tests/cache-match.js >index ba359fed142cb4a3ff281a44e8a2b9ec8a7a656a..8bf7fda30967fbb4ed25325d49e0cd99fc16df55 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/script-tests/cache-match.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/script-tests/cache-match.js >@@ -144,6 +144,25 @@ cache_test(function(cache) { > }); > }, 'Cache.match supports ignoreVary'); > >+cache_test(function(cache) { >+ let has_cache_name = false; >+ const opts = { >+ get cacheName() { >+ has_cache_name = true; >+ return undefined; >+ } >+ }; >+ return self.caches.open('foo') >+ .then(function() { >+ return cache.match('bar', opts); >+ }) >+ .then(function() { >+ assert_false(has_cache_name, >+ 'Cache.match does not support cacheName option ' + >+ 'which was removed in CacheQueryOptions.'); >+ }); >+ }, 'Cache.match does not support cacheName option'); >+ > prepopulated_cache_test(simple_entries, function(cache, entries) { > return cache.match(entries.cat.request.url + '#mouse') > .then(function(result) { >@@ -337,4 +356,62 @@ cache_test(async (cache) => { > assert_equals(headers.get('set-cookie'), null); > }, 'cors-exposed header should be stored correctly.'); > >+cache_test(async (cache) => { >+ // A URL that should load a resource with a known mime type. >+ const url = '/service-workers/cache-storage/resources/blank.html'; >+ const expected_mime_type = 'text/html'; >+ >+ // Verify we get the expected mime type from the network. Note, >+ // we cannot use an exact match here since some browsers append >+ // character encoding information to the blob.type value. >+ const net_response = await fetch(url); >+ const net_mime_type = (await net_response.blob()).type; >+ assert_true(net_mime_type.includes(expected_mime_type), >+ 'network response should include the expected mime type'); >+ >+ // Verify we get the exact same mime type when reading the same >+ // URL resource back out of the cache. >+ await cache.add(url); >+ const cache_response = await cache.match(url); >+ const cache_mime_type = (await cache_response.blob()).type; >+ assert_equals(cache_mime_type, net_mime_type, >+ 'network and cache response mime types should match'); >+ }, 'MIME type should be set from content-header correctly.'); >+ >+cache_test(async (cache) => { >+ const url = '/dummy'; >+ const original_type = 'text/html'; >+ const init_with_headers = { >+ headers: { >+ 'content-type': original_type >+ } >+ } >+ >+ // Verify constructing a synthetic response with a content-type header >+ // gets the correct mime type. >+ const response = new Response('hello world', init_with_headers); >+ const original_response_type = (await response.blob()).type; >+ assert_true(original_response_type.includes(original_type), >+ 'original response should include the expected mime type'); >+ >+ // Verify overwriting the content-type header does not change the mime >+ // type. It should be fixed at Response construction time. >+ const overwritten_response = new Response('hello world', init_with_headers); >+ overwritten_response.headers.set('content-type', 'text/plain'); >+ const overwritten_response_type = (await overwritten_response.blob()).type; >+ assert_equals(overwritten_response_type, original_response_type, >+ 'original and overwritten response mime types should match'); >+ >+ // Verify the Response read from Cache uses the original mime type >+ // computed when it was first constructed. >+ const tmp = new Response('hello world', init_with_headers); >+ tmp.headers.set('content-type', 'text/plain'); >+ await cache.put(url, tmp); >+ const cache_response = await cache.match(url); >+ const cache_mime_type = (await cache_response.blob()).type; >+ assert_equals(cache_mime_type, original_response_type, >+ 'original and cached overwritten response mime types ' + >+ 'should match'); >+ }, 'MIME type should be frozen at response construction.'); >+ > done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https-expected.txt >index 53a4a1e6425ce008ae33d8afaefc922c63c8dab6..76ba4e5bbff297b3a22644f03008d569ebf56627 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https-expected.txt >@@ -10,6 +10,7 @@ PASS Cache.match with ignoreSearch option (request with no search parameters) > PASS Cache.match with ignoreSearch option (request with search parameter) > PASS Cache.match supports ignoreMethod > PASS Cache.match supports ignoreVary >+FAIL Cache.match does not support cacheName option assert_false: Cache.match does not support cacheName option which was removed in CacheQueryOptions. expected false got true > PASS Cache.match with URL containing fragment > PASS Cache.match with string fragment "http" as query > PASS Cache.match with responses containing "Vary" header >@@ -21,4 +22,6 @@ PASS Cache.match with a non-2xx Response > PASS Cache.match with a network error Response > PASS Cache produces large Responses that can be cloned and read correctly. > FAIL cors-exposed header should be stored correctly. assert_equals: expected (string) "bar" but got (object) null >+FAIL MIME type should be set from content-header correctly. assert_equals: network and cache response mime types should match expected "text/html" but got "" >+FAIL MIME type should be frozen at response construction. assert_equals: original and cached overwritten response mime types should match expected "text/html" but got "" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-match.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-match.https-expected.txt >index dff99fa824d4001660ccfeb0839e27a5c3580973..564096ab5b7b2f5de1d77d5a4307a1706ec91a26 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-match.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-match.https-expected.txt >@@ -9,6 +9,7 @@ PASS Cache.match with ignoreSearch option (request with no search parameters) > PASS Cache.match with ignoreSearch option (request with search parameter) > PASS Cache.match supports ignoreMethod > PASS Cache.match supports ignoreVary >+FAIL Cache.match does not support cacheName option assert_false: Cache.match does not support cacheName option which was removed in CacheQueryOptions. expected false got true > PASS Cache.match with URL containing fragment > PASS Cache.match with string fragment "http" as query > PASS Cache.match with responses containing "Vary" header >@@ -20,4 +21,6 @@ PASS Cache.match with a non-2xx Response > PASS Cache.match with a network error Response > PASS Cache produces large Responses that can be cloned and read correctly. > FAIL cors-exposed header should be stored correctly. assert_equals: expected (string) "bar" but got (object) null >+FAIL MIME type should be set from content-header correctly. assert_equals: network and cache response mime types should match expected "text/html" but got "" >+FAIL MIME type should be frozen at response construction. assert_equals: original and cached overwritten response mime types should match expected "text/html" but got "" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-match.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-match.https-expected.txt >index dff99fa824d4001660ccfeb0839e27a5c3580973..564096ab5b7b2f5de1d77d5a4307a1706ec91a26 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-match.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-match.https-expected.txt >@@ -9,6 +9,7 @@ PASS Cache.match with ignoreSearch option (request with no search parameters) > PASS Cache.match with ignoreSearch option (request with search parameter) > PASS Cache.match supports ignoreMethod > PASS Cache.match supports ignoreVary >+FAIL Cache.match does not support cacheName option assert_false: Cache.match does not support cacheName option which was removed in CacheQueryOptions. expected false got true > PASS Cache.match with URL containing fragment > PASS Cache.match with string fragment "http" as query > PASS Cache.match with responses containing "Vary" header >@@ -20,4 +21,6 @@ PASS Cache.match with a non-2xx Response > PASS Cache.match with a network error Response > PASS Cache produces large Responses that can be cloned and read correctly. > FAIL cors-exposed header should be stored correctly. assert_equals: expected (string) "bar" but got (object) null >+FAIL MIME type should be set from content-header correctly. assert_equals: network and cache response mime types should match expected "text/html" but got "" >+FAIL MIME type should be frozen at response construction. assert_equals: original and cached overwritten response mime types should match expected "text/html" but got "" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/Service-Worker-Allowed-header.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/Service-Worker-Allowed-header.https-expected.txt >index e1759e083d315515be071c1b18423b0b200ea9a4..618b92d9ead2075dd38325ae66635e3f51ab4769 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/Service-Worker-Allowed-header.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/Service-Worker-Allowed-header.https-expected.txt >@@ -4,7 +4,7 @@ PASS Registering within Service-Worker-Allowed path (absolute URL) > PASS Registering within Service-Worker-Allowed path with parent reference > PASS Registering outside Service-Worker-Allowed path > PASS Registering outside Service-Worker-Allowed path with parent reference >-PASS Service-Worker-Allowed is cross-origin to script, registering on a normally allowed scope >-PASS Service-Worker-Allowed is cross-origin to script, registering on a normally disallowed scope >+FAIL Service-Worker-Allowed is cross-origin to script, registering on a normally allowed scope assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL Service-Worker-Allowed is cross-origin to script, registering on a normally disallowed scope assert_unreached: Should have rejected: undefined Reached unreachable code > PASS Service-Worker-Allowed is cross-origin to page, same-origin to script > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/Service-Worker-Allowed-header.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/Service-Worker-Allowed-header.https.html >index 316067cc06679570866cd1ccf67f273cce57a15b..9045c0f4e791192c432d99156666292f8df42ab3 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/Service-Worker-Allowed-header.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/Service-Worker-Allowed-header.https.html >@@ -17,88 +17,72 @@ function build_script_url(allowed_path, origin) { > return `${url}?pipe=header(Service-Worker-Allowed,${allowed_path})`; > } > >-promise_test(async t => { >- const script = build_script_url('/allowed-path'); >- const scope = '/allowed-path'; >- const registration = await service_worker_unregister_and_register( >- t, script, scope); >- assert_true(registration instanceof ServiceWorkerRegistration, 'registered'); >- assert_equals(registration.scope, normalizeURL(scope)); >- return registration.unregister(); >-}, 'Registering within Service-Worker-Allowed path'); >+// register_test is a promise_test that registers a service worker. >+function register_test(script, scope, description) { >+ promise_test(async t => { >+ t.add_cleanup(() => { >+ return service_worker_unregister(t, scope); >+ }); > >-promise_test(async t => { >- const script = build_script_url(new URL('/allowed-path', document.location)); >- const scope = '/allowed-path'; >- const registration = await service_worker_unregister_and_register( >- t, script, scope); >- assert_true(registration instanceof ServiceWorkerRegistration, 'registered'); >- assert_equals(registration.scope, normalizeURL(scope)); >- return registration.unregister(); >-}, 'Registering within Service-Worker-Allowed path (absolute URL)'); >+ const registration = await service_worker_unregister_and_register( >+ t, script, scope); >+ assert_true(registration instanceof ServiceWorkerRegistration, 'registered'); >+ assert_equals(registration.scope, normalizeURL(scope)); >+ }, description); >+} >+ >+// register_fail_test is like register_test but expects a SecurityError. >+function register_fail_test(script, scope, description) { >+ promise_test(async t => { >+ t.add_cleanup(() => { >+ return service_worker_unregister(t, scope); >+ }); >+ >+ await service_worker_unregister(t, scope); >+ await promise_rejects(t, >+ 'SecurityError', >+ navigator.serviceWorker.register(script, {scope})); >+ }, description); >+} >+ >+register_test( >+ build_script_url('/allowed-path'), >+ '/allowed-path', >+ 'Registering within Service-Worker-Allowed path'); > >-promise_test(async t => { >- const script = build_script_url('../allowed-path-with-parent'); >- const scope = 'allowed-path-with-parent'; >- const registration = await service_worker_unregister_and_register( >- t, script, scope); >- assert_true(registration instanceof ServiceWorkerRegistration, 'registered'); >- assert_equals(registration.scope, normalizeURL(scope)); >- return registration.unregister(); >-}, 'Registering within Service-Worker-Allowed path with parent reference'); >+register_test( >+ build_script_url(new URL('/allowed-path', document.location)), >+ '/allowed-path', >+ 'Registering within Service-Worker-Allowed path (absolute URL)'); > >-promise_test(async t => { >- const script = build_script_url('../allowed-path'); >- const scope = '/disallowed-path'; >- await service_worker_unregister(t, scope); >- return promise_rejects(t, >- 'SecurityError', >- navigator.serviceWorker.register(script, {scope: scope}), >- 'register should fail'); >-}, 'Registering outside Service-Worker-Allowed path'); >+register_test( >+ build_script_url('../allowed-path-with-parent'), >+ 'allowed-path-with-parent', >+ 'Registering within Service-Worker-Allowed path with parent reference'); > >-promise_test(async t => { >- const script = build_script_url('../allowed-path-with-parent'); >- const scope = '/allowed-path-with-parent'; >- await service_worker_unregister(t, scope); >- return promise_rejects(t, >- 'SecurityError', >- navigator.serviceWorker.register(script, {scope: scope}), >- 'register should fail'); >-}, 'Registering outside Service-Worker-Allowed path with parent reference'); >+register_fail_test( >+ build_script_url('../allowed-path'), >+ '/disallowed-path', >+ 'Registering outside Service-Worker-Allowed path'), > >-promise_test(async t => { >- const script = build_script_url( >- host_info.HTTPS_REMOTE_ORIGIN + '/'); >- const scope = 'resources/this-scope-is-normally-allowed' >- const registration = await service_worker_unregister_and_register( >- t, script, scope); >- assert_true(registration instanceof ServiceWorkerRegistration, 'registered'); >- assert_equals(registration.scope, normalizeURL(scope)); >- return registration.unregister(); >-}, 'Service-Worker-Allowed is cross-origin to script, registering on a normally allowed scope'); >+register_fail_test( >+ build_script_url('../allowed-path-with-parent'), >+ '/allowed-path-with-parent', >+ 'Registering outside Service-Worker-Allowed path with parent reference'); > >-promise_test(async t => { >- const script = build_script_url( >- host_info.HTTPS_REMOTE_ORIGIN + '/'); >- const scope = '/this-scope-is-normally-disallowed' >- const registration = await service_worker_unregister_and_register( >- t, script, scope); >- assert_true(registration instanceof ServiceWorkerRegistration, 'registered'); >- assert_equals(registration.scope, normalizeURL(scope)); >- return registration.unregister(); >-}, 'Service-Worker-Allowed is cross-origin to script, registering on a normally disallowed scope'); >+register_fail_test( >+ build_script_url(host_info.HTTPS_REMOTE_ORIGIN + '/'), >+ 'resources/this-scope-is-normally-allowed', >+ 'Service-Worker-Allowed is cross-origin to script, registering on a normally allowed scope'); > >-promise_test(async t => { >- const script = build_script_url( >- host_info.HTTPS_REMOTE_ORIGIN + '/cross-origin/', >- host_info.HTTPS_REMOTE_ORIGIN); >- const scope = '/cross-origin/'; >- await service_worker_unregister(t, scope); >- return promise_rejects(t, >- 'SecurityError', >- navigator.serviceWorker.register(script, {scope: scope}), >- 'register should fail'); >-}, 'Service-Worker-Allowed is cross-origin to page, same-origin to script'); >+register_fail_test( >+ build_script_url(host_info.HTTPS_REMOTE_ORIGIN + '/'), >+ '/this-scope-is-normally-disallowed', >+ 'Service-Worker-Allowed is cross-origin to script, registering on a normally disallowed scope'); > >+register_fail_test( >+ build_script_url(host_info.HTTPS_REMOTE_ORIGIN + '/cross-origin/', >+ host_info.HTTPS_REMOTE_ORIGIN), >+ '/cross-origin/', >+ 'Service-Worker-Allowed is cross-origin to page, same-origin to script'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/postmessage.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/postmessage.https.html >index 17046eedc6bd2529b452fe03a0e9e2d52c0b2d70..99dedebf2e56c744528fd168c05b4fe734563c57 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/postmessage.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/postmessage.https.html >@@ -12,7 +12,12 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, script, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > registration = r; >+ > return wait_for_state(t, registration.installing, 'activated'); > }) > .then(function() { >@@ -28,7 +33,6 @@ promise_test(function(t) { > }) > .then(function(result) { > assert_equals(result, 'OK'); >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Post loopback messages'); > >@@ -41,6 +45,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, script1, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > registration = r; > return wait_for_state(t, registration.installing, 'activated'); > }) >@@ -69,7 +77,6 @@ promise_test(function(t) { > .then(function(result) { > assert_equals(result, 'OK'); > frame.remove(); >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Post messages among service workers'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/unregister.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/unregister.https.html >index 313309188071747fb139d6dc0dbe2019d0e72748..1a124d727687ecfc62bb1443bed2313312762997 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/unregister.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/unregister.https.html >@@ -11,6 +11,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, script, scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, registration.installing, 'redundant'); > }) > .then(function() { >@@ -21,7 +25,6 @@ promise_test(function(t) { > result, > undefined, > 'After unregister(), the registration should not found'); >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Unregister on script evaluation'); > >@@ -31,6 +34,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, script, scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, registration.installing, 'redundant'); > }) > .then(function() { >@@ -41,7 +48,6 @@ promise_test(function(t) { > result, > undefined, > 'After unregister(), the registration should not found'); >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Unregister on installing event'); > >@@ -51,6 +57,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, script, scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, registration.installing, 'redundant'); > }) > .then(function() { >@@ -61,7 +71,6 @@ promise_test(function(t) { > result, > undefined, > 'After unregister(), the registration should not found'); >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Unregister on activate event'); > >@@ -74,6 +83,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, script, scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, registration.installing, 'activated'); > }) > .then(function() { return with_iframe(scope); }) >@@ -120,7 +133,6 @@ promise_test(function(t) { > > frame.remove(); > new_frame.remove(); >- return service_worker_unregister_and_done(t, scope); > }) > }, 'Unregister controlling service worker'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/update.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/update.https.html >index a9285a1c9e2dbfc38c547e3030af8ad9ba292e42..a7dde2233972cb3c1b8250f3b0a184413cd7c5a5 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/update.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/update.https.html >@@ -13,6 +13,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, script, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > registration = r; > return wait_for_state(t, registration.installing, 'activated'); > }) >@@ -38,7 +42,6 @@ promise_test(function(t) { > 'events seen by the worker'); > frame1.remove(); > frame2.remove(); >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Update a registration on ServiceWorkerGlobalScope'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html >index e1fefaf290fe521590a460942d4c3f6c0022c75f..b6efe3ec5620d1c83deb305f2c1ebe008a6a23e2 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html >@@ -60,6 +60,9 @@ function getClientIdByURL(worker, url) { > > async function doAsyncTest(t, scope) { > let reg = await service_worker_unregister_and_register(t, worker, scope); >+ >+ t.add_cleanup(() => service_worker_unregister(t, scope)); >+ > await wait_for_state(t, reg.installing, 'activated'); > > // Load the scope as a frame. We expect this in turn to have a nested >@@ -96,7 +99,6 @@ async function doAsyncTest(t, scope) { > } > > frame.remove(); >- await service_worker_unregister_and_done(t, scope); > } > > promise_test(async function(t) { >@@ -126,6 +128,9 @@ promise_test(async function(t) { > const scope = 'resources/about-blank-replacement-uncontrolled-nested-frame.html'; > > let reg = await service_worker_unregister_and_register(t, worker, scope); >+ >+ t.add_cleanup(() => service_worker_unregister(t, scope)); >+ > await wait_for_state(t, reg.installing, 'activated'); > > // Load the scope as a frame. We expect this in turn to have a nested >@@ -147,7 +152,6 @@ promise_test(async function(t) { > 'nested frame should not be controlled'); > > frame.remove(); >- await service_worker_unregister_and_done(t, scope); > }, 'Initial about:blank is controlled, exposed to clients.matchAll(), and ' + > 'final Client is not controlled by a service worker.'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/activate-event-after-install-state-change.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/activate-event-after-install-state-change.https.html >index 57fccf13712d97c316874746f770fd7e76f5e897..016a52c13c82ebbfb36d48830446b79b4e72f13e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/activate-event-after-install-state-change.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/activate-event-after-install-state-change.https.html >@@ -11,6 +11,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, script, scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > var sw = registration.installing; > > return new Promise(t.step_func(function(resolve) { >@@ -23,9 +27,6 @@ promise_test(function(t) { > }); > })); > }) >- .then(function() { >- return service_worker_unregister_and_done(t, scope); >- }) > .catch(unreached_rejection(t)); > }, 'installed event should be fired before activating service worker'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/appcache-ordering-main.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/appcache-ordering-main.https.html >index 921dae015cb55cf805ad960e902bbb22890f80bc..a86671c1fe4ec94cec84d63bb7e30922b03cf11a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/appcache-ordering-main.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/appcache-ordering-main.https.html >@@ -5,7 +5,6 @@ > <body> > <script> > >-var INSTALL_APPCACHE_URL = "resources/appcache-ordering.install.html"; > var IS_APPCACHED_URL = "resources/appcache-ordering.is-appcached.html"; > var SERVICE_WORKER_SCOPE = "resources/appcache-ordering"; > var SERVICE_WORKER_SCRIPT = "resources/empty-worker.js"; >@@ -15,31 +14,6 @@ var reject_install_appcache = undefined; > > var frames = []; > >-// Called by the INSTALL_APPCACHE_URL child frame. >-function notify_appcache_installed(success) { >- if (success) >- resolve_install_appcache(); >- else >- reject_install_appcache(); >-} >- >-function install_appcache() { >- return new Promise(function(resolve, reject) { >- var frame = document.createElement('iframe'); >- frames.push(frame); >- frame.src = INSTALL_APPCACHE_URL; >- document.body.appendChild(frame); >- resolve_install_appcache = function() { >- document.body.removeChild(frame); >- resolve(); >- }; >- reject_install_appcache = function() { >- document.body.removeChild(frame); >- reject(); >- }; >- }); >-} >- > var resolve_is_appcached = undefined; > > // Called by the IS_APPCACHED_URL child frame. >@@ -63,7 +37,7 @@ function is_appcached() { > promise_test(function(t) { > return service_worker_unregister(t, SERVICE_WORKER_SCOPE) > .then(function() { >- return install_appcache(); >+ return install_appcache_ordering_manifest(); > }) > .then(function() { > return is_appcached(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch-with-appcache.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch-with-appcache.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8f2c39ee39e3254d25351d50dcd98960025f9639 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch-with-appcache.https-expected.txt >@@ -0,0 +1,4 @@ >+CONSOLE MESSAGE: line 1: ApplicationCache is deprecated. Please use ServiceWorkers instead. >+ >+PASS fetch() should be intercepted after the client is claimed. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch-with-appcache.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch-with-appcache.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4890a84ba10fa186e2e213d66d58a4937d2c8609 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch-with-appcache.https.html >@@ -0,0 +1,81 @@ >+<!doctype html> >+<meta charset=utf-8> >+<title></title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="resources/test-helpers.sub.js"></script> >+<body> >+<script> >+ >+// This test makes a frame controlled by AppCache, then registers a service >+// worker that calls claim() to control the frame. AppCache should be completely >+// bypassed once the service worker claims the frame. >+ >+const fetch_text = async frame => { >+ const response = await >+ frame.contentWindow.fetch('appcache-ordering.is-appcached.js'); >+ return await response.text(); >+}; >+ >+const check_is_appcached = async frame => { >+ // This should FALLBACK to ordering.is_appcached.js as in the manifest >+ // if the appcache is effective. >+ const response = await >+ frame.contentWindow.fetch('appcache-ordering.is-appcached404.js'); >+ return await response.ok; >+}; >+ >+promise_test(async t => { >+ const scope = 'resources/'; >+ const script = 'resources/claim-worker.js'; >+ >+ await install_appcache_ordering_manifest(); >+ >+ // Create the test iframe. >+ const frame = await with_iframe('resources/blank.html'); >+ t.add_cleanup(async () => { >+ if (frame) frame.remove(); >+ return service_worker_unregister(t, scope); >+ }); >+ >+ // Check that the appcache controls the frame. >+ assert_equals(await check_is_appcached(frame), true, >+ 'AppCache should be present'); >+ >+ // Check the controller and test with fetch. >+ assert_equals(frame.contentWindow.navigator.controller, undefined, >+ 'Should have no controller.'); >+ assert_equals(await fetch_text(frame), 'var is_appcached = true;\n', >+ 'fetch() should not be intercepted.'); >+ >+ // Register a service worker. >+ let registration = await service_worker_unregister_and_register(t, script, scope); >+ const worker = registration.installing; >+ await wait_for_state(t, worker, 'activated'); >+ >+ // Let the service worker claim the iframe. >+ const channel = new MessageChannel(); >+ const check_message = new Promise(resolve => { >+ channel.port1.onmessage = async e => { >+ assert_equals(e.data, 'PASS', 'Worker call to claim() should fulfill.'); >+ resolve(); >+ }; >+ }); >+ worker.postMessage({port: channel.port2}, [channel.port2]); >+ await check_message; >+ >+ // Check that the appcache does NOT control the frame. >+ assert_equals(await check_is_appcached(frame), false, >+ 'AppCache should not be present'); >+ >+ // Check the controller and test with fetch. >+ registration = await >+ frame.contentWindow.navigator.serviceWorker.getRegistration(scope); >+ assert_equals(frame.contentWindow.navigator.serviceWorker.controller, >+ registration.active, 'iframe should be claimed.'); >+ assert_equals(await fetch_text(frame), 'Intercepted!', >+ 'fetch() should be intercepted.'); >+}, 'fetch() should be intercepted after the client is claimed.') >+ >+</script> >+</body> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch.https.html >index 050c1ea92ef60b8215fad9cab504647256ad728a..400b593ac961942f6e9274aee98bac22856eaf22 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch.https.html >@@ -7,63 +7,80 @@ > <body> > <script> > >-promise_test(function(t) { >- var frame; >- var resource = 'simple.txt'; >+async function try_fetch(fetch_func, path) { >+ let response; >+ try { >+ response = await fetch_func(path); >+ } catch (err) { >+ throw (`fetch() threw: ${err}`); >+ } > >- var worker; >- var scope = 'resources/'; >- var script = 'resources/claim-worker.js'; >+ let response_text; >+ try { >+ response_text = await response.text(); >+ } catch (err) { >+ throw (`text() threw: ${err}`); >+ } > >- return Promise.resolve() >- // Create the test iframe. >- .then(() => with_iframe('resources/blank.html')) >- .then(f => frame = f) >+ return response_text; >+} > >- // Check the controller and test with fetch. >- .then(() => assert_equals(frame.contentWindow.navigator.controller, >- undefined, >- 'Should have no controller.')) >- .then(() => frame.contentWindow.fetch(resource)) >- .then(response => response.text()) >- .then(response_text => assert_equals(response_text, >- 'a simple text file\n', >- 'fetch() should not be intercepted.')) >+promise_test(async function(t) { >+ let frame; >+ const scope = 'resources/'; >+ const script = 'resources/claim-worker.js'; >+ t.add_cleanup(async () => { >+ if (frame) >+ frame.remove(); >+ return service_worker_unregister(t, scope); >+ }); > >- // Register a service worker. >- .then(() => service_worker_unregister_and_register(t, script, scope)) >- .then(r => worker = r.installing) >- .then(() => wait_for_state(t, worker, 'activated')) >+ const resource = 'simple.txt'; > >- // Let the service worker claim the iframe. >- .then(() => { >- var channel = new MessageChannel(); >- var saw_message = new Promise(function(resolve) { >- channel.port1.onmessage = t.step_func(function(e) { >- assert_equals(e.data, 'PASS', >- 'Worker call to claim() should fulfill.'); >- resolve(); >- }); >- }); >- worker.postMessage({port: channel.port2}, [channel.port2]); >- return saw_message; >- }) >+ // Create the test frame. >+ await service_worker_unregister(t, scope); >+ frame = await with_iframe('resources/blank.html'); > >- // Check the controller and test with fetch. >- .then(() => frame.contentWindow.navigator.serviceWorker.getRegistration(scope)) >- .then(r => assert_equals(frame.contentWindow.navigator.serviceWorker.controller, >- r.active, >- 'Test iframe should be claimed.')) >- .then(() => frame.contentWindow.fetch(resource)) >- .then(response => response.text()) >- .then(response_text => assert_equals(response_text, >- 'Intercepted!', >- 'fetch() should be intercepted.')) >+ // Check the controller and test with fetch. >+ assert_equals(frame.contentWindow.navigator.controller, undefined, >+ 'Should have no controller.'); >+ let response; >+ try { >+ response = await try_fetch(frame.contentWindow.fetch, resource); >+ } catch (err) { >+ assert_unreached(`uncontrolled fetch failed: ${err}`); >+ } >+ assert_equals(response, 'a simple text file\n', >+ 'fetch() should not be intercepted.'); > >- // Cleanup this testcase. >- .then(() => frame.remove()) >- .then(() => service_worker_unregister_and_done(t, scope)); >-}, 'fetch() should be intercepted after the client is claimed.') >+ // Register a service worker. >+ const registration = await navigator.serviceWorker.register(script, {scope}); >+ const worker = registration.installing; >+ await wait_for_state(t, worker, 'activated'); >+ >+ // Tell the service worker to claim the iframe. >+ const saw_message = new Promise((resolve) => { >+ const channel = new MessageChannel(); >+ channel.port1.onmessage = t.step_func((event) => { >+ resolve(event.data); >+ }); >+ worker.postMessage({port: channel.port2}, [channel.port2]); >+ }); >+ const data = await saw_message; >+ assert_equals(data, 'PASS', 'Worker call to claim() should fulfill.'); >+ >+ // Check the controller and test with fetch. >+ const controller = frame.contentWindow.navigator.serviceWorker.controller; >+ assert_true(controller instanceof frame.contentWindow.ServiceWorker, >+ 'iframe should be controlled.'); >+ try { >+ response = await try_fetch(frame.contentWindow.fetch, resource); >+ } catch (err) { >+ assert_unreached(`controlled fetch failed: ${err}`); >+ } >+ assert_equals(response, 'Intercepted!', >+ 'fetch() should be intercepted.'); >+}, 'fetch() should be intercepted after the client is claimed.'); > > </script> > </body> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-not-using-registration.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-not-using-registration.https.html >index 1138b7419cfaa78d99f114196fb6870afdf8bd67..fd61d05ba4ea8a1c416eb6d4b1128f7b65b4b35c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-not-using-registration.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-not-using-registration.https.html >@@ -15,6 +15,10 @@ promise_test(function(t) { > return service_worker_unregister_and_register( > t, init_worker_url, init_scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, init_scope); >+ }); >+ > return wait_for_state(t, registration.installing, 'activated'); > }) > .then(function() { >@@ -35,6 +39,10 @@ promise_test(function(t) { > {scope: claim_scope}); > }) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, claim_scope); >+ }); >+ > claim_worker = registration.installing; > claim_registration = registration; > return wait_for_state(t, registration.installing, 'activated'); >@@ -67,9 +75,6 @@ promise_test(function(t) { > frame1.remove(); > frame2.remove(); > return claim_registration.unregister(); >- }) >- .then(function() { >- return service_worker_unregister_and_done(t, init_scope); > }); > }, 'Test claim client which is not using registration'); > >@@ -86,6 +91,10 @@ promise_test(function(t) { > claim_worker_url, {scope: claim_scope}); > }) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, claim_scope); >+ }); >+ > claim_worker = registration.installing; > return wait_for_state(t, registration.installing, 'activated'); > }) >@@ -94,6 +103,10 @@ promise_test(function(t) { > installing_worker_url, {scope: scope}); > }) > .then(function() { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > var channel = new MessageChannel(); > var saw_message = new Promise(function(resolve) { > channel.port1.onmessage = t.step_func(function(e) { >@@ -111,10 +124,6 @@ promise_test(function(t) { > 'Frame should not be claimed when a longer-matched ' + > 'registration exists'); > frame.remove(); >- return service_worker_unregister(t, claim_scope); >- }) >- .then(function() { >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Test claim client when there\'s a longer-matched registration not ' + > 'already used by the page'); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-shared-worker-fetch.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-shared-worker-fetch.https.html >index a07db7b75c7a4c29e9ce756152cd0d4e269e8912..f5f44886baa2bff3bc7b7e013a856a6d90ceb26c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-shared-worker-fetch.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-shared-worker-fetch.https.html >@@ -30,9 +30,13 @@ promise_test(function(t) { > 'fetch() should not be intercepted.')) > // Register a service worker. > .then(() => service_worker_unregister_and_register(t, script, scope)) >- .then(r => worker = r.installing) >- .then(() => wait_for_state(t, worker, 'activated')) >+ .then(r => { >+ t.add_cleanup(() => service_worker_unregister(t, scope)); > >+ worker = r.installing; >+ >+ return wait_for_state(t, worker, 'activated') >+ }) > // Let the service worker claim the iframe and the shared worker. > .then(() => { > var channel = new MessageChannel(); >@@ -60,8 +64,7 @@ promise_test(function(t) { > 'fetch() in the shared worker should be intercepted.')) > > // Cleanup this testcase. >- .then(() => frame.remove()) >- .then(() => service_worker_unregister_and_done(t, scope)); >+ .then(() => frame.remove()); > }, 'fetch() in SharedWorker should be intercepted after the client is claimed.') > > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-using-registration.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-using-registration.https.html >index 7d77d384837d3c41278bea6f414a6719e80dc520..8a2a6ff25c82d8d6de26cca521da99f8ef6d5fbf 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-using-registration.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-using-registration.https.html >@@ -13,6 +13,10 @@ promise_test(function(t) { > var worker, sw_registration, frame; > return service_worker_unregister_and_register(t, url1, scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, registration.installing, 'activated'); > }) > .then(function() { >@@ -50,9 +54,6 @@ promise_test(function(t) { > 'Frame1 controller scriptURL should be changed to url2'); > frame.remove(); > return sw_registration.unregister(); >- }) >- .then(function() { >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Test worker claims client which is using another registration'); > >@@ -63,6 +64,10 @@ promise_test(function(t) { > var frame, worker; > return service_worker_unregister_and_register(t, url1, scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, registration.installing, 'activated'); > }) > .then(function() { >@@ -91,7 +96,6 @@ promise_test(function(t) { > }) > .then(function() { > frame.remove(); >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Test for the waiting worker claims a client which is using the the ' + > 'same registration'); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-resultingClientId.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-resultingClientId.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8274586e807f2c2d7f84bdf55d61ec187f863005 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-resultingClientId.https-expected.txt >@@ -0,0 +1,8 @@ >+ >+PASS global setup >+FAIL get(resultingClientId) for same-origin document assert_equals: promiseValue expected "client" but got "undefinedValue" >+FAIL get(resultingClientId) on cross-origin redirect assert_equals: get(event.resultingClientId) in the fetch event should fulfill expected (string) "fulfilled" but got (undefined) undefined >+FAIL get(resultingClientId) for document sandboxed by CSP header assert_equals: get(event.resultingClientId) in the fetch event should fulfill expected (string) "fulfilled" but got (undefined) undefined >+FAIL get(resultingClientId) for document sandboxed by CSP header with allow-same-origin assert_equals: get(event.resultingClientId) in the fetch event should fulfill expected (string) "fulfilled" but got (undefined) undefined >+PASS global cleanup >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-resultingClientId.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-resultingClientId.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..3419cf14b523db41af70c7896d4aaa497441fb9b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-resultingClientId.https.html >@@ -0,0 +1,177 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Test clients.get(resultingClientId)</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="/common/get-host-info.sub.js"></script> >+<script src="resources/test-helpers.sub.js"></script> >+<script> >+const scope = "resources/"; >+let worker; >+ >+// Setup. Keep this as the first promise_test. >+promise_test(async (t) => { >+ const registration = await service_worker_unregister_and_register( >+ t, 'resources/get-resultingClientId-worker.js', >+ scope); >+ worker = registration.installing; >+ await wait_for_state(t, worker, 'activated'); >+}, 'global setup'); >+ >+// Sends |command| to the worker and returns a promise that resolves to its >+// response. There should only be one inflight command at a time. >+async function sendCommand(command) { >+ const saw_message = new Promise((resolve) => { >+ navigator.serviceWorker.onmessage = (event) => { >+ resolve(event.data); >+ }; >+ }); >+ worker.postMessage(command); >+ return saw_message; >+} >+ >+// Wrapper for 'startTest' command. Tells the worker a test is starting, >+// so it resets state and keeps itself alive until 'finishTest'. >+async function startTest(t) { >+ const result = await sendCommand({command: 'startTest'}); >+ assert_equals(result, 'ok', 'startTest'); >+ >+ t.add_cleanup(async () => { >+ return finishTest(); >+ }); >+} >+ >+// Wrapper for 'finishTest' command. >+async function finishTest() { >+ const result = await sendCommand({command: 'finishTest'}); >+ assert_equals(result, 'ok', 'finishTest'); >+} >+ >+// Wrapper for 'getResultingClient' command. Tells the worker to return >+// clients.get(event.resultingClientId) for the navigation that occurs >+// during this test. >+// >+// The return value describes how clients.get() settled. It also includes >+// |queriedId| which is the id passed to clients.get() (the resultingClientId >+// in this case). >+// >+// Example value: >+// { >+// queriedId: 'abc', >+// promiseState: fulfilled, >+// promiseValue: client, >+// client: { >+// id: 'abc', >+// url: '//example.com/client' >+// } >+// } >+async function getResultingClient() { >+ return sendCommand({command: 'getResultingClient'}); >+} >+ >+// Wrapper for 'getClient' command. Tells the worker to return >+// clients.get(|id|). The return value is as in the getResultingClient() >+// documentation. >+async function getClient(id) { >+ return sendCommand({command: 'getClient', id: id}); >+} >+ >+// Navigates to |url|. Returns the result of clients.get() on the >+// resultingClientId. >+async function navigateAndGetResultingClient(t, url) { >+ const resultPromise = getResultingClient(); >+ const frame = await with_iframe(url); >+ t.add_cleanup(() => { >+ frame.remove(); >+ }); >+ const result = await resultPromise; >+ const resultingClientId = result.queriedId; >+ >+ // First test clients.get(event.resultingClientId) inside the fetch event. The >+ // behavior of this is subtle due to the use of iframes and about:blank >+ // replacement. The spec probably requires that it resolve to the original >+ // about:blank client, and that later that client should be discarded after >+ // load if the load was to another origin. Implementations might differ. For >+ // now, this test just asserts that the promise resolves. See >+ // https://github.com/w3c/ServiceWorker/issues/1385. >+ assert_equals(result.promiseState, 'fulfilled', >+ 'get(event.resultingClientId) in the fetch event should fulfill'); >+ >+ // Test clients.get() on the previous resultingClientId again. By this >+ // time the load finished, so it's more straightforward how this promise >+ // should settle. Return the result of this promise. >+ return await getClient(resultingClientId); >+} >+ >+// Test get(resultingClientId) in the basic same-origin case. >+promise_test(async (t) => { >+ await startTest(t); >+ >+ const url = new URL('resources/empty.html', window.location); >+ const result = await navigateAndGetResultingClient(t, url); >+ assert_equals(result.promiseState, 'fulfilled', 'promiseState'); >+ assert_equals(result.promiseValue, 'client', 'promiseValue'); >+ assert_equals(result.client.url, url.href, 'client.url',); >+ assert_equals(result.client.id, result.queriedId, 'client.id'); >+}, 'get(resultingClientId) for same-origin document'); >+ >+// Test get(resultingClientId) when the response redirects to another origin. >+promise_test(async (t) => { >+ await startTest(t); >+ >+ // Navigate to a URL that redirects to another origin. >+ const base_url = new URL('.', window.location); >+ const host_info = get_host_info(); >+ const other_origin_url = new URL(base_url.pathname + 'resources/empty.html', >+ host_info['HTTPS_REMOTE_ORIGIN']); >+ const url = new URL('resources/empty.html', window.location); >+ const pipe = `status(302)|header(Location, ${other_origin_url})`; >+ url.searchParams.set('pipe', pipe); >+ >+ // The original reserved client should have been discarded on cross-origin >+ // redirect. >+ const result = await navigateAndGetResultingClient(t, url); >+ assert_equals(result.promiseState, 'fulfilled', 'promiseState'); >+ assert_equals(result.promiseValue, 'undefinedValue', 'promiseValue'); >+}, 'get(resultingClientId) on cross-origin redirect'); >+ >+// Test get(resultingClientId) when the document is sandboxed to a unique >+// origin using a CSP HTTP response header. >+promise_test(async (t) => { >+ await startTest(t); >+ >+ // Navigate to a URL that has CSP sandboxing set in the HTTP response header. >+ const url = new URL('resources/empty.html', window.location); >+ const pipe = 'header(Content-Security-Policy, sandbox)'; >+ url.searchParams.set('pipe', pipe); >+ >+ // The original reserved client should have been discarded upon loading >+ // the sandboxed document. >+ const result = await navigateAndGetResultingClient(t, url); >+ assert_equals(result.promiseState, 'fulfilled', 'promiseState'); >+ assert_equals(result.promiseValue, 'undefinedValue', 'promiseValue'); >+}, 'get(resultingClientId) for document sandboxed by CSP header'); >+ >+// Test get(resultingClientId) when the document is sandboxed with >+// allow-same-origin. >+promise_test(async (t) => { >+ await startTest(t); >+ >+ // Navigate to a URL that has CSP sandboxing set in the HTTP response header. >+ const url = new URL('resources/empty.html', window.location); >+ const pipe = 'header(Content-Security-Policy, sandbox allow-same-origin)'; >+ url.searchParams.set('pipe', pipe); >+ >+ // The client should be the original reserved client, as it's same-origin. >+ const result = await navigateAndGetResultingClient(t, url); >+ assert_equals(result.promiseState, 'fulfilled', 'promiseState'); >+ assert_equals(result.promiseValue, 'client', 'promiseValue'); >+ assert_equals(result.client.url, url.href, 'client.url',); >+ assert_equals(result.client.id, result.queriedId, 'client.id'); >+}, 'get(resultingClientId) for document sandboxed by CSP header with allow-same-origin'); >+ >+// Cleanup. Keep this as the last promise_test. >+promise_test(async (t) => { >+ return service_worker_unregister(t, scope); >+}, 'global cleanup'); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https.html >index 24967172a84ca0bfea7db337fb5d95d9cd4ff114..a2a56816a650fa54d6075055a64e0f009e5829ac 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https.html >@@ -54,6 +54,10 @@ promise_test(function(t) { > return service_worker_unregister_and_register( > t, 'resources/clients-matchall-worker.js', scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, registration.installing, 'activated'); > }) > .then(function() { return with_iframe(iframe_url); }) >@@ -66,9 +70,7 @@ promise_test(function(t) { > }) > .then(function() { > frame.remove(); >- return service_worker_unregister_and_done(t, scope); >- }) >- .catch(unreached_rejection(t)); >+ }); > }, 'Verify matchAll() with window client type'); > > promise_test(function(t) { >@@ -76,6 +78,10 @@ promise_test(function(t) { > return service_worker_unregister_and_register( > t, 'resources/clients-matchall-worker.js', scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, registration.installing, 'activated'); > }) > .then(function() { return with_iframe(iframe_url); }) >@@ -112,7 +118,6 @@ promise_test(function(t) { > }) > .then(function() { > frame.remove(); >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Verify matchAll() with {window, sharedworker, worker} client types'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-order.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-order.https.html >index 0596050c24af4e275ebfe3e040918c115797f2e8..ec650f2264df530bd34b11737c4b1d9ed87f4b56 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-order.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-order.https.html >@@ -123,6 +123,8 @@ function matchAllOrderTest(t, opts) { > let frameResultList; > let extraWindowResult; > return service_worker_unregister_and_register(t, script, opts.scope).then(swr => { >+ t.add_cleanup(() => service_worker_unregister(t, opts.scope)); >+ > worker = swr.installing; > return wait_for_state(t, worker, 'activated'); > }).then(_ => { >@@ -143,8 +145,6 @@ function matchAllOrderTest(t, opts) { > }).then(_ => { > frameResultList.forEach(result => result.top.remove()); > extraWindowResult.top.remove(); >- }).then(_ => { >- return service_worker_unregister_and_done(t, opts.scope); > }).catch(e => { > if (frameResultList) { > frameResultList.forEach(result => result.top.remove()); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controller-on-reload.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controller-on-reload.https.html >index e0beb7260be11608439aa16bce0c16a025f24858..2e966d425788c0a02b1bb25a4c045089fede5ce7 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controller-on-reload.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controller-on-reload.https.html >@@ -13,6 +13,10 @@ promise_test(function(t) { > var controller; > return service_worker_unregister(t, scope) > .then(function() { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return with_iframe(scope); > }) > .then(function(f) { >@@ -48,7 +52,6 @@ promise_test(function(t) { > .then(function(frameRegistration) { > assert_equals(frameRegistration.active, controller); > frame.remove(); >- service_worker_unregister_and_done(t, scope); > }); > }, 'controller is set upon reload after registration'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/data-transfer-files.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/data-transfer-files.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..59340fc966c6594f8e7798ef893e0012926125c0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/data-transfer-files.https-expected.txt >@@ -0,0 +1,5 @@ >+ >+ >+ >+FAIL Posting a File in a navigation handled by a service worker promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new DataTransfer()')" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/data-transfer-files.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/data-transfer-files.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..cc8ab6e672726e168b44dfee5b4720012fffee0a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/data-transfer-files.https.html >@@ -0,0 +1,41 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Post a file in a navigation controlled by a service worker</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="resources/test-helpers.sub.js"></script> >+<body> >+<iframe id=testframe name=testframe></iframe> >+<form id=testform method=post action="/html/semantics/forms/form-submission-0/resources/file-submission.py" target=testframe enctype="multipart/form-data"> >+<input name=testinput id=testinput type=file> >+</form> >+<script> >+// Test that DataTransfer with a File entry works when posted to a >+// service worker that falls back to network. Regression test for >+// https://crbug.com/944145. >+promise_test(async (t) => { >+ const scope = '/html/semantics/forms/form-submission-0/resources/'; >+ const header = `pipe=header(Service-Worker-Allowed,${scope})`; >+ const script = `resources/fetch-event-network-fallback-worker.js?${header}`; >+ >+ const registration = await service_worker_unregister_and_register( >+ t, script, scope); >+ await wait_for_state(t, registration.installing, 'activated'); >+ >+ const dataTransfer = new DataTransfer(); >+ dataTransfer.items.add(new File(['foobar'], 'name')); >+ assert_equals(1, dataTransfer.files.length); >+ >+ testinput.files = dataTransfer.files; >+ testform.submit(); >+ >+ const data = await new Promise(resolve => { >+ onmessage = e => { >+ if (e.source !== testframe) return; >+ resolve(e.data); >+ }; >+ }); >+ assert_equals(data, "FieldStorage('testinput', 'name', 'foobar')"); >+}, 'Posting a File in a navigation handled by a service worker'); >+</script> >+</body> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https-expected.txt >index 3110d3eb3bb4b97c3b683b4ad2e0b714681a7e3b..f757055484de38d8e57d239bd11865bc7ebe523c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https-expected.txt >@@ -1,13 +1,17 @@ > > >-PASS Test calling waitUntil in a different task without an existing extension throws >-FAIL Test calling waitUntil in a different microtask without an existing extension throws assert_equals: expected "InvalidStateError" but got "OK" >-PASS Test calling waitUntil in a different task with an existing extension succeeds >-PASS Test calling waitUntil with an existing extension promise handler succeeds >-FAIL Test calling waitUntil at the end of the microtask turn throws assert_equals: expected "InvalidStateError" but got "OK" >+PASS Test calling waitUntil in a task at the end of the event handler without an existing extension throws >+PASS Test calling waitUntil in a microtask at the end of the event handler without an existing extension suceeds >+PASS Test calling waitUntil in a different task an existing extension succeeds >+PASS Test calling waitUntil at the end of an existing extension promise handler succeeds (event is still being dispatched) >+PASS Test calling waitUntil in a microtask at the end of an existing extension promise handler succeeds (event is still being dispatched) >+PASS Test calling waitUntil in an existing extension promise handler succeeds (event is not being dispatched) >+PASS Test calling waitUntil in a microtask at the end of an existing extension promise handler throws (event is not being dispatched) > PASS Test calling waitUntil after the current extension expired in a different task fails > PASS Test calling waitUntil on a script constructed ExtendableEvent throws exception > PASS Test calling waitUntil asynchronously with pending respondWith promise. >-PASS Test calling waitUntil synchronously inside microtask of respondWith promise. >-FAIL Test calling waitUntil asynchronously inside microtask of respondWith promise. assert_equals: expected "InvalidStateError" but got "OK" >+PASS Test calling waitUntil synchronously inside microtask of respondWith promise (event is being dispatched). >+PASS Test calling waitUntil asynchronously inside microtask of respondWith promise (event is being dispatched). >+PASS Test calling waitUntil synchronously inside microtask of respondWith promise (event is not being dispatched). >+PASS Test calling waitUntil asynchronously inside microtask of respondWith promise (event is not being dispatched). > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https.html >index cb4ed30a37fdfd07fd8b34181f073c6de2e165b9..04e98266b4f1a0b6ec572e1c317ab852fc2e4480 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https.html >@@ -1,4 +1,5 @@ > <!DOCTYPE html> >+<meta name="timeout" content="long"> > <script src="/resources/testharness.js"></script> > <script src="resources/testharness-helpers.js"></script> > <script src="/resources/testharnessreport.js"></script> >@@ -56,21 +57,25 @@ function msg_event_test(scope, test) { > } > > promise_test(msg_event_test.bind(this, 'no-current-extension-different-task'), >- 'Test calling waitUntil in a different task without an existing extension throws'); >+ 'Test calling waitUntil in a task at the end of the event handler without an existing extension throws'); > > promise_test(msg_event_test.bind(this, 'no-current-extension-different-microtask'), >- 'Test calling waitUntil in a different microtask without an existing extension throws'); >+ 'Test calling waitUntil in a microtask at the end of the event handler without an existing extension suceeds'); > > promise_test(msg_event_test.bind(this, 'current-extension-different-task'), >- 'Test calling waitUntil in a different task with an existing extension succeeds'); >+ 'Test calling waitUntil in a different task an existing extension succeeds'); > >-promise_test(msg_event_test.bind(this, 'current-extension-expired-same-microtask-turn'), >- 'Test calling waitUntil with an existing extension promise handler succeeds'); >+promise_test(msg_event_test.bind(this, 'during-event-dispatch-current-extension-expired-same-microtask-turn'), >+ 'Test calling waitUntil at the end of an existing extension promise handler succeeds (event is still being dispatched)'); > >-// The promise handler will queue a new microtask after the check for new >-// extensions was performed. >-promise_test(msg_event_test.bind(this, 'current-extension-expired-same-microtask-turn-extra'), >- 'Test calling waitUntil at the end of the microtask turn throws'); >+promise_test(msg_event_test.bind(this, 'during-event-dispatch-current-extension-expired-same-microtask-turn-extra'), >+ 'Test calling waitUntil in a microtask at the end of an existing extension promise handler succeeds (event is still being dispatched)'); >+ >+promise_test(msg_event_test.bind(this, 'after-event-dispatch-current-extension-expired-same-microtask-turn'), >+ 'Test calling waitUntil in an existing extension promise handler succeeds (event is not being dispatched)'); >+ >+promise_test(msg_event_test.bind(this, 'after-event-dispatch-current-extension-expired-same-microtask-turn-extra'), >+ 'Test calling waitUntil in a microtask at the end of an existing extension promise handler throws (event is not being dispatched)'); > > promise_test(msg_event_test.bind(this, 'current-extension-expired-different-task'), > 'Test calling waitUntil after the current extension expired in a different task fails'); >@@ -80,24 +85,36 @@ promise_test(msg_event_test.bind(this, 'script-extendable-event'), > > promise_test(function(t) { > var testBody = function(worker) { >- return with_iframe('./resources/pending-respondwith-async-waituntil/dummy.html'); >+ return with_iframe('./resources/pending-respondwith-async-waituntil'); > } > return runTest(t, 'pending-respondwith-async-waituntil', testBody); > }, 'Test calling waitUntil asynchronously with pending respondWith promise.'); > > promise_test(function(t) { > var testBody = function(worker) { >- return with_iframe('./resources/respondwith-microtask-sync-waituntil/dummy.html'); >+ return with_iframe('./resources/during-event-dispatch-respondwith-microtask-sync-waituntil'); > } >- return runTest(t, 'respondwith-microtask-sync-waituntil', testBody); >- }, 'Test calling waitUntil synchronously inside microtask of respondWith promise.'); >+ return runTest(t, 'during-event-dispatch-respondwith-microtask-sync-waituntil', testBody); >+ }, 'Test calling waitUntil synchronously inside microtask of respondWith promise (event is being dispatched).'); > > promise_test(function(t) { > var testBody = function(worker) { >- return with_iframe('./resources/respondwith-microtask-async-waituntil/dummy.html'); >+ return with_iframe('./resources/during-event-dispatch-respondwith-microtask-async-waituntil'); > } >- return runTest(t, 'respondwith-microtask-async-waituntil', testBody); >- }, 'Test calling waitUntil asynchronously inside microtask of respondWith promise.'); >+ return runTest(t, 'during-event-dispatch-respondwith-microtask-async-waituntil', testBody); >+ }, 'Test calling waitUntil asynchronously inside microtask of respondWith promise (event is being dispatched).'); > >+promise_test(function(t) { >+ var testBody = function(worker) { >+ return with_iframe('./resources/after-event-dispatch-respondwith-microtask-sync-waituntil'); >+ } >+ return runTest(t, 'after-event-dispatch-respondwith-microtask-sync-waituntil', testBody); >+ }, 'Test calling waitUntil synchronously inside microtask of respondWith promise (event is not being dispatched).'); > >+promise_test(function(t) { >+ var testBody = function(worker) { >+ return with_iframe('./resources/after-event-dispatch-respondwith-microtask-async-waituntil'); >+ } >+ return runTest(t, 'after-event-dispatch-respondwith-microtask-async-waituntil', testBody); >+ }, 'Test calling waitUntil asynchronously inside microtask of respondWith promise (event is not being dispatched).'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video-cache.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video-cache.https.html >index ef3d12bbe4982c64992b3cd0f4ed092eaa72507b..c37e8e562448793d7da4f4722893ca7bbe19f3ac 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video-cache.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video-cache.https.html >@@ -1,6 +1,7 @@ > <!DOCTYPE html> > <meta charset="utf-8"> > <title>Service Worker: canvas tainting of the fetched video using cache responses</title> >+<meta name="timeout" content="long"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="/common/get-host-info.sub.js"></script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video.https.html >index 577650881c15fa9a95c43dcb955bd5818ba8a8ed..e8c23a2edd63c55a77ea8484fafae2b3c52d15a0 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video.https.html >@@ -1,6 +1,7 @@ > <!DOCTYPE html> > <meta charset="utf-8"> > <title>Service Worker: canvas tainting of the fetched video</title> >+<meta name="timeout" content="long"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="/common/get-host-info.sub.js"></script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-csp.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-csp.https.html >index 91a774a133fd6a1e942e00034c7c05115ee0dea2..4f176220d6100c4efb1bfda817b84cf5f53a4f3d 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-csp.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-csp.https.html >@@ -32,6 +32,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, SCRIPT, SCOPE) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, SCOPE); >+ }); >+ > return wait_for_state(t, registration.installing, 'activated'); > }) > .then(function() { >@@ -105,7 +109,6 @@ promise_test(function(t) { > }) > .then(function() { > frame.remove(); >- service_worker_unregister_and_done(t, SCOPE); > }); > }, 'Verify CSP control of fetch() in a Service Worker'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-after-navigation-within-page.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-after-navigation-within-page.https.html >index dce1f794fabed81761a83cfa68c23920168f99fb..4812d8a91551edae84b5e2805804fc9d8899f3e9 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-after-navigation-within-page.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-after-navigation-within-page.https.html >@@ -15,6 +15,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, worker, scope) > .then(function(reg) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, reg.installing, 'activated'); > }) > .then(function() { return with_iframe(scope); }) >@@ -30,7 +34,6 @@ promise_test(function(t) { > .then(function(response) { > assert_equals(response, 'intercepted by service worker'); > frame.remove(); >- return service_worker_unregister_and_done(t, scope); > }) > }, 'Service Worker should respond to fetch event after the hash changes'); > >@@ -43,6 +46,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, worker, scope) > .then(function(reg) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, reg.installing, 'activated'); > }) > .then(function() { return with_iframe(scope); }) >@@ -58,7 +65,6 @@ promise_test(function(t) { > .then(function(response) { > assert_equals(response, 'intercepted by service worker'); > frame.remove(); >- return service_worker_unregister_and_done(t, scope); > }) > }, 'Service Worker should respond to fetch event after the pushState'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https-expected.txt >index 7e11bced6f852fe8abf7a5b2d818d65d3ca42be6..e3da13c10d3c388c9059f9cfdd4fc02d84b89402 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https-expected.txt >@@ -1,3 +1,9 @@ >+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: cancelled > >-PASS Calling respondWith asynchronously throws an exception >+Harness Error (FAIL), message = cancelled >+ >+PASS global setup >+PASS respondWith in a task throws InvalidStateError >+PASS respondWith in a microtask does not throw >+PASS global cleanup > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https.html >index a2b93acfc5b240a148f07a33bd1a0d2a6ca75715..ae64fcb9a5445843afb75679d0dafa45a3366677 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https.html >@@ -1,33 +1,71 @@ > <!DOCTYPE html> >+<html> >+<title>respondWith cannot be called asynchronously</title> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="resources/test-helpers.sub.js"></script> > <script> >-promise_test(function(t) { >- var script = 'resources/fetch-event-async-respond-with-worker.js'; >- var scope = 'resources/simple.html'; >- >- return service_worker_unregister_and_register(t, script, scope) >- .then(function(registration) { >- return wait_for_state(t, registration.installing, 'activated'); >- }) >- .then(function() { >- return with_iframe(scope); >- }) >- .then(function(frame) { >- add_completion_callback(function() { frame.remove(); }); >- var channel = new MessageChannel(); >- var saw_message = new Promise(function(resolve) { >- channel.port1.onmessage = function(e) { resolve(e.data); } >- }); >- var worker = frame.contentWindow.navigator.serviceWorker.controller; >- >- worker.postMessage({port: channel.port2}, [channel.port2]); >- return saw_message; >- }) >- .then(function(message) { >- assert_equals(message, 'PASS'); >- return service_worker_unregister_and_done(t, scope); >- }) >- }, 'Calling respondWith asynchronously throws an exception'); >+// This file has tests that call respondWith() asynchronously. >+ >+let frame; >+let worker; >+const script = 'resources/fetch-event-async-respond-with-worker.js'; >+const scope = 'resources/simple.html'; >+ >+// Global setup: this must be the first promise_test. >+promise_test(async (t) => { >+ const registration = >+ await service_worker_unregister_and_register(t, script, scope); >+ worker = registration.installing; >+ await wait_for_state(t, worker, 'activated'); >+ frame = await with_iframe(scope); >+}, 'global setup'); >+ >+// Waits for a single message from the service worker and then removes the >+// message handler. Not safe for concurrent use. >+function wait_for_message() { >+ return new Promise((resolve) => { >+ const handler = (event) => { >+ navigator.serviceWorker.removeEventListener('message', handler); >+ resolve(event.data); >+ }; >+ navigator.serviceWorker.addEventListener('message', handler); >+ }); >+} >+ >+// Does one test case. It fetches |url|. The service worker gets a fetch event >+// for |url| and attempts to call respondWith() asynchronously. It reports back >+// to the test whether an exception was thrown. >+async function do_test(url) { >+ // Send a message to tell the worker a new test case is starting. >+ const message = wait_for_message(); >+ worker.postMessage('initializeMessageHandler'); >+ const response = await message; >+ assert_equals(response, 'messageHandlerInitialized'); >+ >+ // Start a fetch. >+ frame.contentWindow.fetch(url); >+ >+ // Receive the test result from the service worker. >+ return wait_for_message(); >+}; >+ >+promise_test(async (t) => { >+ const result = await do_test('respondWith-in-task'); >+ assert_true(result.didThrow, 'should throw'); >+ assert_equals(result.error, 'InvalidStateError'); >+}, 'respondWith in a task throws InvalidStateError'); >+ >+promise_test(async (t) => { >+ const result = await do_test('respondWith-in-microtask'); >+ assert_equals(result.didThrow, false, 'should not throw'); >+}, 'respondWith in a microtask does not throw'); >+ >+// Global cleanup: the final promise_test. >+promise_test(async (t) => { >+ if (frame) >+ frame.remove(); >+ await service_worker_unregister(t, scope); >+}, 'global cleanup'); > </script> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-network-error.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-network-error.https.html >index 254919e92327aefd16eb57855f83221cbe8d7ea6..fea2ad1e3c26effcc9fd7c8d7a66917e420606b4 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-network-error.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-network-error.https.html >@@ -22,6 +22,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, script, scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, registration.installing, 'activated'); > }) > .then(function() { >@@ -34,7 +38,6 @@ promise_test(function(t) { > .then(function(result) { > frame.remove(); > assert_equals(result, 'PASS'); >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Rejecting the fetch event or using preventDefault() causes a network ' + > 'error'); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https-expected.txt >index c33b7d9b2c37dfbf4285233ba72a28c8e27c39e5..82aa5e00e89111b73e75f7648c2b41188569375e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https-expected.txt >@@ -1,76 +1,10 @@ >-CONSOLE MESSAGE: line 32: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >+CONSOLE MESSAGE: line 29: [blocked] The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was not allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. > >-CONSOLE MESSAGE: line 54: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >+CONSOLE MESSAGE: line 29: Not allowed to request resource >+CONSOLE MESSAGE: line 29: Fetch API cannot load http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull due to access control checks. > >-CONSOLE MESSAGE: line 76: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. > >-CONSOLE MESSAGE: line 98: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >-CONSOLE MESSAGE: line 120: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >-CONSOLE MESSAGE: line 132: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >-CONSOLE MESSAGE: line 197: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >-CONSOLE MESSAGE: line 231: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >-CONSOLE MESSAGE: line 32: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >-CONSOLE MESSAGE: line 54: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >-CONSOLE MESSAGE: line 76: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >-CONSOLE MESSAGE: line 98: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >-CONSOLE MESSAGE: line 120: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >-CONSOLE MESSAGE: line 132: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >-CONSOLE MESSAGE: line 197: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >-CONSOLE MESSAGE: line 231: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html was allowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull. >- >- >-PASS Service Worker responds to fetch event with the referrer policy >+FAIL Service Worker responds to fetch event with the referrer policy promise_test: Unhandled rejection with value: object "TypeError: Not allowed to request resource" > PASS Service Worker should respond to fetch with the default referrer policy > PASS Service Worker should respond to fetch with the referrer URL when a member of RequestInit is present - Default Referrer >-PASS Service Worker should respond to fetch with no referrer when a member of RequestInit is present with an HTTP request - Default Referrer >-PASS Service Worker should respond to fetch with the referrer with "" - Default Referrer >-PASS Service Worker should respond to fetch with no referrer with "" - Default Referrer >-PASS Service Worker should respond to fetch with the referrer origin with "origin" and a same origin request - Default Referrer >-PASS Service Worker should respond to fetch with the referrer origin with "origin" and a cross origin request - Default Referrer >-PASS Service Worker should respond to fetch with the referrer URL with "origin-when-cross-origin" and a same origin request - Default Referrer >-PASS Service Worker should respond to fetch with the referrer origin with "origin-when-cross-origin" and a cross origin request - Default Referrer >-PASS Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and a same origin request - Default Referrer >-PASS Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and an HTTP request - Default Referrer >-PASS Service Worker should respond to fetch with no referrer with "unsafe-url" - Default Referrer >-PASS Service Worker should respond to fetch with no referrer URL with "no-referrer" - Default Referrer >-PASS Service Worker should respond to fetch with referrer URL with "same-origin" and a same origin request - Default Referrer >-PASS Service Worker should respond to fetch with no referrer with "same-origin" and cross origin request - Default Referrer >-PASS Service Worker should respond to fetch with the referrer origin with "strict-origin" and a HTTPS cross origin request - Default Referrer >-PASS Service Worker should respond to fetch with the referrer origin with "strict-origin" and a same origin request - Default Referrer >-PASS Service Worker should respond to fetch with no referrer with "strict-origin" and a HTTP request - Default Referrer >-PASS Service Worker should respond to fetch with the referrer URL with "strict-origin-when-cross-origin" and a same origin request - Default Referrer >-PASS Service Worker should respond to fetch with the referrer origin with "strict-origin-when-cross-origin" and a HTTPS cross origin request - Default Referrer >-PASS Service Worker should respond to fetch with no referrer with "strict-origin-when-cross-origin" and a HTTP request - Default Referrer >-PASS Service Worker should respond to fetch with the referrer URL when a member of RequestInit is present - Custom Referrer >-PASS Service Worker should respond to fetch with no referrer when a member of RequestInit is present with an HTTP request - Custom Referrer >-PASS Service Worker should respond to fetch with the referrer with "" - Custom Referrer >-PASS Service Worker should respond to fetch with no referrer with "" - Custom Referrer >-PASS Service Worker should respond to fetch with the referrer origin with "origin" and a same origin request - Custom Referrer >-PASS Service Worker should respond to fetch with the referrer origin with "origin" and a cross origin request - Custom Referrer >-PASS Service Worker should respond to fetch with the referrer URL with "origin-when-cross-origin" and a same origin request - Custom Referrer >-PASS Service Worker should respond to fetch with the referrer origin with "origin-when-cross-origin" and a cross origin request - Custom Referrer >-PASS Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and a same origin request - Custom Referrer >-PASS Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and an HTTP request - Custom Referrer >-PASS Service Worker should respond to fetch with no referrer with "unsafe-url" - Custom Referrer >-PASS Service Worker should respond to fetch with no referrer URL with "no-referrer" - Custom Referrer >-PASS Service Worker should respond to fetch with referrer URL with "same-origin" and a same origin request - Custom Referrer >-PASS Service Worker should respond to fetch with no referrer with "same-origin" and cross origin request - Custom Referrer >-PASS Service Worker should respond to fetch with the referrer origin with "strict-origin" and a HTTPS cross origin request - Custom Referrer >-PASS Service Worker should respond to fetch with the referrer origin with "strict-origin" and a same origin request - Custom Referrer >-PASS Service Worker should respond to fetch with no referrer with "strict-origin" and a HTTP request - Custom Referrer >-PASS Service Worker should respond to fetch with the referrer URL with "strict-origin-when-cross-origin" and a same origin request - Custom Referrer >-PASS Service Worker should respond to fetch with the referrer origin with "strict-origin-when-cross-origin" and a HTTPS cross origin request - Custom Referrer >-PASS Service Worker should respond to fetch with no referrer with "strict-origin-when-cross-origin" and a HTTP request - Custom Referrer > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https.html >index 3846c5b1dde2bb7b11f9980671cc996c0f09a769..804fd9b4204c4224cb15267e279d74e8770ef7c9 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https.html >@@ -7,9 +7,6 @@ > <script> > var worker = 'resources/fetch-event-test-worker.js'; > >-if (window.internals && window.internals.settings) >- internals.settings.setAllowDisplayOfInsecureContent(true); >- > function do_test(referrer, value, expected, name) > { > test(() => { >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-argument.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-argument.https.html >index c78fb784a2f7e4135c2b4429082dc157d9300ffb..05e22105243f710273f56e21502659ad1781e28c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-argument.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-argument.https.html >@@ -22,6 +22,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, script, scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, registration.installing, 'activated'); > }) > .then(function() { >@@ -34,7 +38,6 @@ promise_test(function(t) { > .then(function(result) { > frame.remove(); > assert_equals(result, 'PASS'); >- return service_worker_unregister_and_done(t, scope); > }); > }, 'respondWith() takes either a Response or a promise that resolves ' + > 'with a Response. Other values should raise a network error.'); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html >index 824b6f3217be47fcbd556264fef0c37e2f5bc570..932f9030c51ce6e09d4dba08f0dab19dec6e8b15 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html >@@ -1,6 +1,7 @@ > <!DOCTYPE html> > <meta charset="utf-8"> > <title>respondWith with a response whose body is being loaded from the network by chunks</title> >+<meta name="timeout" content="long"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="resources/test-helpers.sub.js"></script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html >index cd6861a9d45361a9cbaab3ea639257a14accb349..31fd616b6d6f509b7dcb6b56f45e9c2e12e9b8e6 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html >@@ -10,6 +10,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, script, scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, registration.installing, 'activated'); > }) > .then(function() { >@@ -28,7 +32,6 @@ promise_test(function(t) { > }) > .then(function(message) { > assert_equals(message, 'PASS'); >- return service_worker_unregister_and_done(t, scope); > }) > }, 'respondWith() invokes stopImmediatePropagation()'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-throws-after-respond-with.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-throws-after-respond-with.https.html >index 969a3c9d08fb66bf01c1fa2b514b4646e2613b30..d98fb22ff423271dd84460200ebdb60573ed6371 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-throws-after-respond-with.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-throws-after-respond-with.https.html >@@ -12,6 +12,10 @@ promise_test(function(t) { > var iframe; > return service_worker_unregister_and_register(t, workerscript, scope) > .then(function(reg) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, reg.installing, 'activated') > .then(() => reg.active); > }) >@@ -27,7 +31,6 @@ promise_test(function(t) { > }) > .then(function(frame) { > assert_true(frame.contentDocument.body.innerHTML.includes("intercepted")); >- service_worker_unregister_and_done(t, scope); > }) > }, 'Fetch event handler throws after a successful respondWith()'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https-expected.txt >index 62aea66186503503004166be5c13e4311fcd075d..2a731e4e7879a7a2f469e39676114a837755c19c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https-expected.txt >@@ -1,4 +1,6 @@ > >- >-FAIL CSS's base URL must be the request URL even when fetched from other URL. assert_equals: The base URL while loading the images referred from CSS must be the request URL of CSS. expected "https://localhost:9443/service-workers/service-worker/resources/dummy.png" but got "https://127.0.0.1:9443/service-workers/service-worker/resources/dummy.png" >+PASS global setup >+FAIL base URL when service worker does respondWith(fetch(responseUrl)). assert_equals: referrer expected "https://localhost:9443/service-workers/service-worker/resources/fetch-request-css-base-url-style.css?fetch" but got "https://localhost:9443/service-workers/service-worker/resources/fetch-request-css-base-url-iframe.html?fetch" >+FAIL base URL when service worker does respondWith(new Response()). assert_equals: referrer expected "https://localhost:9443/service-workers/service-worker/resources/request-url-path/fetch-request-css-base-url-style.css?newResponse" but got "https://localhost:9443/service-workers/service-worker/resources/fetch-request-css-base-url-iframe.html?newResponse" >+PASS cleanup global state > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https.html >index 7feccfb98c56fa29eae0c204791ec90e67e5dd5c..a08e0c74881364f7fd29d3e6ac332a7e1d94bf7a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https.html >@@ -1,58 +1,87 @@ > <!DOCTYPE html> >-<title>Service Worker: CSS's base URL must be the request URL even when fetched from other URL</title> >+<title>Service Worker: CSS's base URL must be the response URL</title> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> >-<script src="/common/get-host-info.sub.js"></script> > <script src="resources/test-helpers.sub.js?pipe=sub"></script> > <script> >-promise_test(function(t) { >- var SCOPE = 'resources/fetch-request-css-base-url-iframe.html'; >- var SCRIPT = 'resources/fetch-request-css-base-url-worker.js'; >- var worker; >- var testDonePromise; >- >- return service_worker_unregister_and_register(t, SCRIPT, SCOPE) >- .then(function(registration) { >- t.add_cleanup(function() { >- return service_worker_unregister(t, SCOPE); >- }); >- >- worker = registration.installing; >- return wait_for_state(t, worker, 'activated'); >- }) >- .then(function() { >- return new Promise(function(resolve) { >- var channel = new MessageChannel(); >- testDonePromise = new Promise(function(resolveTestDone) { >- channel.port1.onmessage = t.step_func(function(msg) { >- if (msg.data.ready) { >- resolve(); >- return; >- } >- var result = msg.data; >- var base = get_host_info()['HTTPS_ORIGIN'] + base_path(); >- assert_equals( >- result.url, >- base + 'resources/dummy.png', >- 'The base URL while loading the images referred from CSS ' + >- 'must be the request URL of CSS.'); >- assert_equals( >- result.referrer, >- base + 'resources/fetch-request-css-base-url-style.css', >- 'While loading the image defined in CSS the referrer must ' + >- 'be the request URL of CSS.'); >- resolveTestDone(); >- }); >- }); >- worker.postMessage( >- {port: channel.port2}, [channel.port2]); >- }); >- }) >- .then(function() { return with_iframe(SCOPE); }) >- .then(function(f) { >- return testDonePromise.then(function() { >- f.remove(); >- }); >- }); >- }, 'CSS\'s base URL must be the request URL even when fetched from other URL.'); >+const SCOPE = 'resources/fetch-request-css-base-url-iframe.html'; >+const SCRIPT = 'resources/fetch-request-css-base-url-worker.js'; >+let worker; >+ >+var signalMessage; >+function getNextMessage() { >+ return new Promise(resolve => { signalMessage = resolve; }); >+} >+ >+promise_test(async (t) => { >+ const registration = await service_worker_unregister_and_register( >+ t, SCRIPT, SCOPE); >+ worker = registration.installing; >+ await wait_for_state(t, worker, 'activated'); >+}, 'global setup'); >+ >+// Creates a test concerning the base URL of a stylesheet. It loads a >+// stylesheet from a controlled page. The stylesheet makes a subresource >+// request for an image. The service worker messages back the details of the >+// image request in order to test the base URL. >+// >+// The request URL for the stylesheet is under "resources/request-url-path/". >+// The service worker may respond in a way such that the response URL is >+// different to the request URL. >+function base_url_test(params) { >+ promise_test(async (t) => { >+ let frame; >+ t.add_cleanup(() => { >+ if (frame) >+ frame.remove(); >+ }); >+ >+ // Ask the service worker to message this page once it gets the request >+ // for the image. >+ let channel = new MessageChannel(); >+ const sawPong = getNextMessage(); >+ channel.port1.onmessage = (event) => { >+ signalMessage(event.data); >+ }; >+ worker.postMessage({port:channel.port2},[channel.port2]); >+ >+ // It sends a pong back immediately. This ping/pong protocol helps deflake >+ // the test for browsers where message/fetch ordering isn't guaranteed. >+ assert_equals('pong', await sawPong); >+ >+ // Load the frame which will load the stylesheet that makes the image >+ // request. >+ const sawResult = getNextMessage(); >+ frame = await with_iframe(params.framePath); >+ const result = await sawResult; >+ >+ // Test the image request. >+ const base = new URL('.', document.location).href; >+ assert_equals(result.url, >+ base + params.expectImageRequestPath, >+ 'request'); >+ assert_equals(result.referrer, >+ base + params.expectImageRequestReferrer, >+ 'referrer'); >+ }, params.description); >+} >+ >+const cssFile = 'fetch-request-css-base-url-style.css'; >+ >+base_url_test({ >+ framePath: SCOPE + '?fetch', >+ expectImageRequestPath: 'resources/dummy.png', >+ expectImageRequestReferrer: `resources/${cssFile}?fetch`, >+ description: 'base URL when service worker does respondWith(fetch(responseUrl)).'}); >+ >+base_url_test({ >+ framePath: SCOPE + '?newResponse', >+ expectImageRequestPath: 'resources/request-url-path/dummy.png', >+ expectImageRequestReferrer: `resources/request-url-path/${cssFile}?newResponse`, >+ description: 'base URL when service worker does respondWith(new Response()).'}); >+ >+// Cleanup step: this must be the last promise_test. >+promise_test(async (t) => { >+ return service_worker_unregister(t, SCOPE); >+}, 'cleanup global state'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-redirect.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-redirect.https.html >index e8e90cf1eb37cfce98f802a0dd25c2702938ccb2..57fb8eb4c95d54b20d674728270e140db0f6b473 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-redirect.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-redirect.https.html >@@ -74,6 +74,8 @@ promise_test(function(t) { > var frame; > return service_worker_unregister_and_register(t, SCRIPT, SCOPE) > .then(function(registration) { >+ t.add_cleanup(() => service_worker_unregister(t, SCOPE)); >+ > worker = registration.installing; > return wait_for_state(t, worker, 'activated'); > }) >@@ -181,7 +183,6 @@ promise_test(function(t) { > }) > .then(function() { > frame.remove(); >- service_worker_unregister_and_done(t, SCOPE); > }); > }, 'Verify redirect mode of Fetch API and ServiceWorker FetchEvent.'); > >@@ -208,6 +209,8 @@ promise_test(function(t) { > var frame; > return service_worker_unregister_and_register(t, SCRIPT, SCOPE) > .then(function(registration) { >+ t.add_cleanup(() => service_worker_unregister(t, SCOPE)); >+ > worker = registration.installing; > return wait_for_state(t, worker, 'activated'); > }) >@@ -275,7 +278,6 @@ promise_test(function(t) { > }) > .then(function() { > frame.remove(); >- service_worker_unregister_and_done(t, SCOPE); > }); > }, 'Verify redirected of Response(Fetch API) and ServiceWorker FetchEvent.'); > >@@ -302,6 +304,8 @@ promise_test(function(t) { > var frame; > return service_worker_unregister_and_register(t, SCRIPT, SCOPE) > .then(function(registration) { >+ t.add_cleanup(() => service_worker_unregister(t, SCOPE)); >+ > worker = registration.installing; > return wait_for_state(t, worker, 'activated'); > }) >@@ -375,7 +379,6 @@ promise_test(function(t) { > }) > .then(function() { > frame.remove(); >- service_worker_unregister_and_done(t, SCOPE); > }); > }, 'Verify redirected of Response(Fetch API), Cache API and ServiceWorker ' + > 'FetchEvent.'); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https-expected.txt >index 9396662e941739edaf949d32dee7146ece0e81cd..25135dd19809ac45fb47bfb491c08e576f1db81b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https-expected.txt >@@ -4,4 +4,5 @@ PASS Register then getRegistration > PASS Register then getRegistration with a URL having a fragment > PASS getRegistration with a cross origin URL > PASS Register then Unregister then getRegistration >+PASS Register then Unregister then getRegistration in controlled iframe > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https.html >index 72a2c25379cd0c04d605a8d42bebfd7cb4e5d44e..634c2efa12461a811d8e46345ece0298086f64b2 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https.html >@@ -88,4 +88,21 @@ async_test(function(t) { > .catch(unreached_rejection(t)); > }, 'Register then Unregister then getRegistration'); > >+ >+promise_test(async function(t) { >+ const scope = 'resources/scope/getregistration/register-unregister'; >+ const registration = await service_worker_unregister_and_register( >+ t, 'resources/empty-worker.js', scope >+ ); >+ >+ const frame = await with_iframe(scope); >+ t.add_cleanup(() => frame.remove()); >+ >+ const frameNav = frame.contentWindow.navigator; >+ await registration.unregister(); >+ const value = await frameNav.serviceWorker.getRegistration(scope); >+ >+ assert_equals(value, undefined, 'getRegistration should resolve with undefined'); >+}, 'Register then Unregister then getRegistration in controlled iframe'); >+ > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-scripts-resource-map.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-scripts-resource-map.https-expected.txt >index 2d957f1db4f90f95dbc42ba52e3d72af3cfa4be5..f831a8ed74decbd1e2c7e250c241e938e431ffd9 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-scripts-resource-map.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-scripts-resource-map.https-expected.txt >@@ -1,3 +1,4 @@ > > PASS import the same script URL multiple times >+PASS call importScripts() with multiple arguments > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-scripts-resource-map.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-scripts-resource-map.https.html >index a5e26785fac4aa1267762ff58c48969dc8acb017..4742bd01268360477bf6061f8505fe9a3b7cadb7 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-scripts-resource-map.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-scripts-resource-map.https.html >@@ -1,23 +1,34 @@ > <!DOCTYPE html> >-<meta charset="utf-8"> >+<meta charset="utf-8" /> > <title>Tests for importScripts: script resource map</title> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="resources/test-helpers.sub.js"></script> > <body> >-<script> >-// This test registers a worker that imports a script multiple times. The >-// script should be stored on the first import and thereafter that stored >-// script should be loaded. The worker asserts that the stored script was >-// loaded; if the assert fails then registration fails. >-promise_test(t => { >- const scope = 'resources/import-scripts-resource-map'; >- return service_worker_unregister(t, scope) >- .then(() => { >- return navigator.serviceWorker.register( >- 'resources/import-scripts-resource-map-worker.js', {scope: scope}); >- }) >- .then(r => r.unregister()); >- }, 'import the same script URL multiple times'); >-</script> >+ <script> >+ // This test registers a worker that imports a script multiple times. The >+ // script should be stored on the first import and thereafter that stored >+ // script should be loaded. The worker asserts that the stored script was >+ // loaded; if the assert fails then registration fails. >+ >+ promise_test(async t => { >+ const SCOPE = "resources/import-scripts-resource-map"; >+ const SCRIPT = "resources/import-scripts-resource-map-worker.js"; >+ await service_worker_unregister(t, SCOPE); >+ const registration = await navigator.serviceWorker.register(SCRIPT, { >+ scope: SCOPE >+ }); >+ await registration.unregister(); >+ }, "import the same script URL multiple times"); >+ >+ promise_test(async t => { >+ const SCOPE = "resources/import-scripts-diff-resource-map"; >+ const SCRIPT = "resources/import-scripts-diff-resource-map-worker.js"; >+ await service_worker_unregister(t, SCOPE); >+ const registration = await navigator.serviceWorker.register(SCRIPT, { >+ scope: SCOPE >+ }); >+ await registration.unregister(); >+ }, "call importScripts() with multiple arguments"); >+ </script> > </body> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/interfaces-window.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/interfaces-window.https.html >index 2c131b3c93a600c65abd5d6193343262126e808f..f70cf40931db88350c5fb0f5ebb1fbd10f917dba 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/interfaces-window.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/interfaces-window.https.html >@@ -1,5 +1,6 @@ > <!DOCTYPE html> > <title>Service Worker: Interfaces</title> >+<meta name="timeout" content="long"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="/resources/WebIDLParser.js"></script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/multiple-update.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/multiple-update.https.html >index 84aac9583b90b1caa8f08b636b9994942304efeb..6a83f73a054f8a50284ae9b55bba9cde4d74c108 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/multiple-update.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/multiple-update.https.html >@@ -15,6 +15,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, expected_url, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > registration = r; > return wait_for_state(t, registration.installing, 'activated'); > }) >@@ -85,8 +89,6 @@ promise_test(function(t) { > 'waiting should be null after activated.'); > assert_equals(registration.active.scriptURL, expected_url, > 'active should still exist after update found.'); >- >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Trigger multiple updates.'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect.https.html >index e8b8e9afd5820acf9422d11f4410c0158fa31732..d7d3d5259a454d923d1e89004fcf55ce7e2e6bda 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect.https.html >@@ -668,6 +668,24 @@ redirect_test( > 'SW-fetched redirect to other-origin in-scope.'); > > >+// SW responds with a fetch from a different url. >+// SW: event.respondWith(fetch(params['url'])); >+url2 = SCOPE1; >+url1 = SCOPE1 + 'sw=fetch-url&url=' + encodeURIComponent(url2); >+redirect_test( >+ url1, >+ url1, >+ [ >+ [ >+ {url: url1, resultingClientIdTag: 'x'} >+ ], >+ [], >+ [] >+ ], >+ 'x', >+ 'SW-fetched response from different URL, same-origin same-scope.'); >+ >+ > // Opaque redirect. > // SW: event.respondWith(fetch( > // new Request(event.request.url, {redirect: 'manual'}))); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/performance-timeline.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/performance-timeline.https.html >index b66d4a821861b6e6e37e47b652f32756c8062058..1fe19da53be6c460cae5f069794bbdee3f4a0da8 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/performance-timeline.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/performance-timeline.https.html >@@ -17,7 +17,11 @@ promise_test(t => { > let slowURL = url + '&slow'; > let frame; > return service_worker_unregister_and_register(t, script, scope) >- .then(reg => wait_for_state(t, reg.installing, 'activated')) >+ .then(reg => { >+ t.add_cleanup(() => service_worker_unregister(t, scope)); >+ >+ return wait_for_state(t, reg.installing, 'activated'); >+ }) > .then(_ => with_iframe(scope)) > .then(f => { > frame = f; >@@ -39,7 +43,6 @@ promise_test(t => { > assert_greater_than(slowURLTime, urlTime + 1000, > 'Slow service worker request should measure increased delay.'); > frame.remove(); >- return service_worker_unregister_and_done(t, scope); > }) > }, 'empty service worker fetch event included in performance timings'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage-to-client-message-queue.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage-to-client-message-queue.https.html >index caa4f9445d3d8ad0ab92ba73713da17a33af185c..83e5f4540d1411e2a215ebe59d2037f369c48616 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage-to-client-message-queue.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage-to-client-message-queue.https.html >@@ -141,12 +141,12 @@ function client_message_queue_enable_test( > earliest_dispatch, > description) > { >- function later_state(state1, state2) { >+ function assert_state_less_than_equal(state1, state2, explanation) { > const states = ['init', 'install', 'start', 'finish', 'loaded']; > const index1 = states.indexOf(state1); > const index2 = states.indexOf(state2); >- const max_index = Math.max(index1, index2); >- return states[max_index]; >+ if (index1 > index2) >+ assert_unreached(explanation); > } > > client_message_queue_test('enable-client-message-queue.html', async t => { >@@ -161,12 +161,13 @@ function client_message_queue_enable_test( > > // Wait for all messages to get dispatched on the child's > // ServiceWorkerContainer and then verify that each message >- // was dispatched while the child was in the correct state. >+ // was dispatched after |earliest_dispatch|. > const report = await t.frame.report; > ['init', 'install', 'start'].forEach(state => { >- const dispatch = later_state(state, earliest_dispatch); >- assert_equals(report[state], dispatch, >- `Message sent in state '${state}' dispatched in state '${dispatch}'`); >+ const explanation = `Message sent in state '${state}' was dispatched in '${report[state]}', should be dispatched no earlier than '${earliest_dispatch}'`; >+ assert_state_less_than_equal(earliest_dispatch, >+ report[state], >+ explanation); > }); > }, description); > } >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage.https-expected.txt >index 561541b677dc64963581aec302953acc0dc9cdce..79abe422764989d1d1510adb6bda26c71c01ea01 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage.https-expected.txt >@@ -3,4 +3,5 @@ PASS postMessage to a ServiceWorker (and back via MessagePort) > PASS postMessage a transferable ArrayBuffer between ServiceWorker and Client > PASS postMessage a transferable ArrayBuffer between ServiceWorker and Client over MessagePort > FAIL postMessage with dictionary a transferable ArrayBuffer between ServiceWorker and Client promise_test: Unhandled rejection with value: object "TypeError: Type error" >+FAIL postMessage to a redundant worker promise_test: Unhandled rejection with value: object "InvalidStateError: Service Worker state is redundant" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage.https.html >index b1f3342a8c14e707097bf6c90e5f4fee5fd19a4a..7abb3022f91a8daa5bf0f98fa0d4793780f4844c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage.https.html >@@ -39,15 +39,6 @@ promise_test(t => { > .then(e => { > assert_equals(e.data, 'quit'); > return registration.unregister(scope); >- }) >- .then(() => { return wait_for_state(t, worker, 'redundant'); }) >- .then(() => { >- assert_equals(worker.state, 'redundant'); >- assert_throws( >- {name:'InvalidStateError'}, >- function() { worker.postMessage(''); }, >- 'Calling postMessage on a redundant ServiceWorker should ' + >- 'throw InvalidStateError.'); > }); > }, 'postMessage to a ServiceWorker (and back via MessagePort)'); > >@@ -178,4 +169,34 @@ promise_test(t => { > }); > }, 'postMessage with dictionary a transferable ArrayBuffer between ServiceWorker and Client'); > >+ promise_test(async t => { >+ const firstScript = 'resources/postmessage-echo-worker.js?one'; >+ const secondScript = 'resources/postmessage-echo-worker.js?two'; >+ const scope = 'resources/'; >+ >+ const registration = await service_worker_unregister_and_register(t, firstScript, scope); >+ t.add_cleanup(() => registration.unregister()); >+ const firstWorker = registration.installing; >+ >+ const messagePromise = new Promise(resolve => { >+ navigator.serviceWorker.addEventListener('message', (event) => { >+ resolve(event.data); >+ }, {once: true}); >+ }); >+ >+ await wait_for_state(t, firstWorker, 'activated'); >+ await navigator.serviceWorker.register(secondScript, {scope}); >+ const secondWorker = registration.installing; >+ await wait_for_state(t, firstWorker, 'redundant'); >+ >+ // postMessage() to a redundant worker should be dropped silently. >+ // Historically, this threw an exception. >+ firstWorker.postMessage('firstWorker'); >+ >+ // To test somewhat that it was not received, send a message to another >+ // worker and check that we get a reply for that one. >+ secondWorker.postMessage('secondWorker'); >+ const data = await messagePromise; >+ assert_equals(data, 'secondWorker'); >+ }, 'postMessage to a redundant worker'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https-expected.txt >index aaee3de0a6024019856d27e3eb897be0ce8295a2..cd413633915ef2af7ff1fae1e1c861dd4ca97439 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https-expected.txt >@@ -9,5 +9,6 @@ PASS ready on an iframe whose parent registers a new service worker > PASS ready on an iframe that installs a new service worker > PASS ready after a longer matched registration registered > PASS access ready after it has been resolved >-PASS access ready on uninstalling registration that is resurrected >+FAIL resolve ready after unregistering and reregistering assert_not_equals: Registrations should be different got disallowed value object "[object ServiceWorkerRegistration]" >+FAIL resolve ready before unregistering and reregistering assert_equals: Resolves with the first registration expected "https://localhost:9443/service-workers/service-worker/resources/empty-worker.js" but got "https://localhost:9443/service-workers/service-worker/resources/empty-worker.js?2" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html >index ff5c793f2c2208e9ac298e6b82adf745ae4c65e9..6c1ed822a8778c84ff151a680ed0b4c4fbdb53ca 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html >@@ -250,51 +250,68 @@ promise_test(function(t) { > }, 'access ready after it has been resolved'); > > promise_test(async function(t) { >- var url = 'resources/empty-worker.js'; >- var matched_scope = 'resources/blank.html?ready-after-resurrect'; >- >- let reg1 = await service_worker_unregister_and_register(t, url, matched_scope); >- add_completion_callback(function() { >- reg1.unregister(); >- }); >- await wait_for_state(t, reg1.installing, 'activated'); >- >- // Hold the worker alive with a controlled worker >- let frame = await with_iframe(matched_scope); >- add_completion_callback(function() { >- frame.remove(); >- }); >- >- // Doom the registration as uninstalling. >- await reg1.unregister(); >- >- // Access the ready promise while the registration is doomed. >- let readyPromise = frame.contentWindow.navigator.serviceWorker.ready; >- >- // Resurrect the doomed registration; >- let reg2 = await service_worker_unregister_and_register(t, url, matched_scope); >- assert_equals(reg1, reg2, 'existing registration should be resurrected'); >- >- // We are trying to test if the ready promise ever resolves here. Use >- // an explicit timeout check here rather than forcing a full infrastructure >- // level timeout. >- let timeoutId; >- let timeoutPromise = new Promise(resolve => { >- timeoutId = setTimeout(_ => { >- timeoutId = null; >- resolve(); >- }, 500); >- }); >- >- // This should resolve immediately since there is an alive registration >- // with an active promise for the matching scope. >- await Promise.race([readyPromise, timeoutPromise]); >- >- assert_not_equals(timeoutId, null, >- 'ready promise should resolve before timeout'); >- clearTimeout(timeoutId); >- >- // We should get here and not time out. >- >- }, 'access ready on uninstalling registration that is resurrected'); >+ const url1 = 'resources/empty-worker.js'; >+ const url2 = url1 + '?2'; >+ const matched_scope = 'resources/blank.html?ready-after-unregister'; >+ >+ const reg1 = await service_worker_unregister_and_register(t, url1, matched_scope); >+ t.add_cleanup(() => reg1.unregister()); >+ >+ await wait_for_state(t, reg1.installing, 'activating'); >+ // This registration will resolve all ready promises in clients that match the scope. >+ // But there are no clients. >+ >+ const frame = await with_iframe(matched_scope); >+ t.add_cleanup(() => frame.remove()); >+ >+ await reg1.unregister(); >+ >+ // Access the ready promise while the registration is unregistering. >+ const readyPromise = frame.contentWindow.navigator.serviceWorker.ready; >+ >+ // Create a new registration. >+ const reg2 = await navigator.serviceWorker.register(url2, { scope: matched_scope }); >+ t.add_cleanup(() => reg2.unregister()); >+ // This registration will resolve all ready promises in clients that match the scope. >+ // That includes frame's client. >+ >+ const readyReg = await readyPromise; >+ >+ assert_equals(readyReg.active.scriptURL, reg2.active.scriptURL, 'Resolves with the second registration'); >+ assert_not_equals(reg1, reg2, 'Registrations should be different'); >+}, 'resolve ready after unregistering and reregistering'); >+ >+promise_test(async function(t) { >+ const url1 = 'resources/empty-worker.js'; >+ const url2 = url1 + '?2'; >+ const matched_scope = 'resources/blank.html?ready-after-unregister'; >+ >+ const frame = await with_iframe(matched_scope); >+ t.add_cleanup(() => frame.remove()); >+ >+ const reg1 = await service_worker_unregister_and_register(t, url1, matched_scope); >+ t.add_cleanup(() => reg1.unregister()); >+ >+ await wait_for_state(t, reg1.installing, 'activated'); >+ // This registration will resolve all ready promises in clients that match the scope. >+ // That includes frame's client. >+ >+ const reg1Active = reg1.active; >+ >+ await reg1.unregister(); >+ >+ // Access the ready promise while the registration is unregistering. >+ const readyPromise = frame.contentWindow.navigator.serviceWorker.ready; >+ >+ // Create a new registration. >+ const reg2 = await navigator.serviceWorker.register(url2, { scope: matched_scope }); >+ t.add_cleanup(() => reg2.unregister()); >+ // This registration will resolve all ready promises in clients that match the scope. >+ // That includes frame's client, but its ready promise has already resolved. >+ >+ const readyReg = await readyPromise; >+ >+ assert_equals(readyReg.active.scriptURL, reg1Active.scriptURL, 'Resolves with the first registration'); >+ assert_not_equals(reg1, reg2, 'Registrations should be different'); >+}, 'resolve ready before unregistering and reregistering'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https.html >index dc136d4e8dd74d3f851880a2bc4ff5f215caf256..1d86548eb5eeb5754ca111dd4c55843202216b2d 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https.html >@@ -52,8 +52,11 @@ promise_test(function(t) { > }) > .then( > function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, registration.scope); >+ }); >+ > assert_unreached('register should fail'); >- service_worker_unregister_and_done(t, registration.scope); > }, > function(error) { > assert_equals(error.name, 'SecurityError', >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-wait-forever-in-install-worker.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-wait-forever-in-install-worker.https.html >index e23f9f4fc8e3807ad60c90b055f74c38d383c24d..0920b5cb223d50e31d044a9323f55c1e77b18857 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-wait-forever-in-install-worker.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-wait-forever-in-install-worker.https.html >@@ -16,6 +16,10 @@ promise_test(function(t) { > > return navigator.serviceWorker.register(bad_script, {scope: scope}) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > registration = r; > assert_equals(registration.installing.scriptURL, > normalizeURL(bad_script)); >@@ -47,9 +51,6 @@ promise_test(function(t) { > normalizeURL(good_script)); > return wait_for_state(t, registration.installing, 'activated'); > }) >- .then(function() { >- return service_worker_unregister_and_done(t, scope); >- }) > }, 'register worker that calls waitUntil with a promise that never ' + > 'resolves in oninstall'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-end-to-end.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-end-to-end.https.html >index e92b6502f09b1a9308b96e43c6dc95f825fac692..1af4582d387412f47d82a94b2fe7050a5994644a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-end-to-end.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-end-to-end.https.html >@@ -11,16 +11,11 @@ t.step(function() { > var serviceWorkerStates = []; > var lastServiceWorkerState = ''; > var receivedMessageFromPort = ''; >- var currentChangeCount = 0; > > assert_true(navigator.serviceWorker instanceof ServiceWorkerContainer); > assert_equals(typeof navigator.serviceWorker.register, 'function'); > assert_equals(typeof navigator.serviceWorker.getRegistration, 'function'); > >- navigator.serviceWorker.oncurrentchange = function() { >- ++currentChangeCount; >- }; >- > service_worker_unregister_and_register( > t, 'resources/end-to-end-worker.js', scope) > .then(onRegister) >@@ -75,9 +70,6 @@ t.step(function() { > ['installing', 'installed', 'activating', 'activated'], > 'Service worker should pass through all states'); > >- assert_equals(currentChangeCount, 0, >- 'Should not see current changes since document is out of scope'); >- > assert_equals(receivedMessageFromPort, 'Ack for: registering doc'); > > var sawRedundant = new Promise(t.step_func(function(resolve) { >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-mime-types.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-mime-types.https.html >index 9ae5f0956fbaff5c2d94c27e3efd5d402acac36a..aa9d38cedc989c61c7267acd4150b889744855e2 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-mime-types.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-mime-types.https.html >@@ -1,5 +1,6 @@ > <!DOCTYPE html> > <title>Service Worker: Registration (MIME types)</title> >+<meta name="timeout" content="long"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="resources/test-helpers.sub.js"></script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-schedule-job.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-schedule-job.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b169bcf1dc860485511cd7e4fae3063abd2d29d3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-schedule-job.https-expected.txt >@@ -0,0 +1,4 @@ >+ >+FAIL different scriptURL and updateViaCache promise_test: Unhandled rejection with value: object "TypeError: null is not an object (evaluating 'registration.installing.scriptURL')" >+FAIL different type assert_equals: expected (string) "classic" but got (undefined) undefined >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-schedule-job.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-schedule-job.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..18589e0aa0b32e130934a65b1b065d5c7f79e36e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-schedule-job.https.html >@@ -0,0 +1,67 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Service Worker: Schedule Job algorithm</title> >+<script src="/resources/testharness.js"></script> >+<script src="resources/testharness-helpers.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+// Tests for https://w3c.github.io/ServiceWorker/#schedule-job-algorithm >+// Non-equivalent register jobs should not be coalesced. >+const scope = 'resources/'; >+const script1 = 'resources/empty.js'; >+const script2 = 'resources/empty.js?change'; >+ >+async function cleanup() { >+ const registration = await navigator.serviceWorker.getRegistration(scope); >+ if (registration) >+ await registration.unregister(); >+} >+ >+function absolute_url(url) { >+ return new URL(url, self.location).toString(); >+} >+ >+// Test scriptURL and updateViaCache. >+promise_test(async t => { >+ await cleanup(); >+ t.add_cleanup(cleanup); >+ >+ // Check defaults. >+ const registration = await >+ navigator.serviceWorker.register(script1, {scope}); >+ assert_equals(registration.updateViaCache, 'imports'); >+ >+ // Schedule several register jobs. >+ navigator.serviceWorker.register(script1, {scope}); >+ navigator.serviceWorker.register(script2, {scope}); >+ await navigator.serviceWorker.register(script2, >+ {scope, updateViaCache: 'none'}); >+ >+ // None of the changes should have been coalesced. >+ assert_equals(registration.installing.scriptURL, absolute_url(script2)); >+ assert_equals(registration.updateViaCache, 'none'); >+}, 'different scriptURL and updateViaCache'); >+ >+// Test |type| in another test case because most browsers don't support it. >+promise_test(async t => { >+ const script1 = 'resources/empty.js'; >+ const script2 = 'resources/empty.js?change'; >+ >+ await cleanup(); >+ t.add_cleanup(cleanup); >+ >+ // Check defaults. >+ const registration = await >+ navigator.serviceWorker.register(script1, {scope}); >+ assert_equals(registration.installing.type, 'classic'); >+ >+ // Schedule several register jobs. >+ navigator.serviceWorker.register(script1, {scope}); >+ navigator.serviceWorker.register(script2, {scope}); >+ await navigator.serviceWorker.register(script2, {scope, type: 'module'}); >+ >+ // None of the changes should have been coalesced. >+ assert_equals(registration.installing.scriptURL, absolute_url(script2)); >+ assert_equals(registration.installing.type, 'module'); >+}, 'different type'); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https-expected.txt >index c90d0942d4d46621e1e5dbcaa5110ec82009e659..c6e86756c0835b88a6888bd015da445526b81ac4 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https-expected.txt >@@ -23,4 +23,5 @@ PASS access-updateViaCache-after-unregister-undefined > PASS access-updateViaCache-after-unregister-imports > PASS access-updateViaCache-after-unregister-all > PASS access-updateViaCache-after-unregister-none >+FAIL updateViaCache is not updated if register() rejects assert_equals: after update attempt expected "imports" but got "none" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https.html >index dbcc6eab1f82a6b33ed7d889cba51be5b984b610..423908db0e428d65b48b8b8d16162a5ebcf87268 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https.html >@@ -184,4 +184,21 @@ > }, testName); > } > >+ promise_test(async t => { >+ await cleanup(); >+ t.add_cleanup(cleanup); >+ >+ const registration = await navigator.serviceWorker.register( >+ 'resources/empty.js', >+ {scope: SCOPE}); >+ assert_equals(registration.updateViaCache, 'imports', >+ 'before update attempt'); >+ >+ const fail = navigator.serviceWorker.register( >+ 'resources/malformed-worker.py?parse-error', >+ {scope: SCOPE, updateViaCache: 'none'}); >+ await promise_rejects(t, new TypeError(), fail); >+ assert_equals(registration.updateViaCache, 'imports', >+ 'after update attempt'); >+ }, 'updateViaCache is not updated if register() rejects'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https.html >index a9f89d300d5d373ab329eb665f1b72262f8447c1..f0502cac727896ce674f3b93a9dd4cfcbf54b41b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https.html >@@ -14,7 +14,7 @@ function crossOriginUrl(path) { > function verify(options) { > const url = options.mode === 'cross-origin' ? crossOriginUrl(options.resource) > : resourceUrl(options.resource); >- const entryList = options.performance.getEntriesByName(url); >+ const entryList = options.performance.getEntriesByName(url, 'resource'); > if (options.should_no_performance_entry) { > // The performance timeline may not have an entry for a resource > // which failed to load. >@@ -136,7 +136,7 @@ promise_test(function(t) { > > test(() => { > const url = resourceUrl('resources/test-helpers.sub.js'); >- const entry = window.performance.getEntriesByName(url)[0]; >+ const entry = window.performance.getEntriesByName(url, 'resource')[0]; > assert_equals(entry.workerStart, 0, 'Non-controlled'); > }, 'Non-controlled resource loads'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/appcache-ordering.manifest b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/appcache-ordering.manifest >index 0deed0e91a80214520673c188a3090ebb657f6c0..e6597ccb8acb0dceb4a990c3148debe3c4ff8f21 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/appcache-ordering.manifest >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/appcache-ordering.manifest >@@ -1,6 +1,7 @@ > CACHE MANIFEST > > appcache-ordering.is-appcached.html >+blank.html > > FALLBACK: > appcache-ordering.is-appcached404.js appcache-ordering.is-appcached.js >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/claim-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/claim-worker.js >index 53f210cf7634993f86310cdefec9a15fd6b699a0..18004079475e2bbd9d1a8d25ae4b26c7638de58e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/claim-worker.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/claim-worker.js >@@ -14,5 +14,6 @@ self.addEventListener('message', function(event) { > }); > > self.addEventListener('fetch', function(event) { >- event.respondWith(new Response('Intercepted!')); >-}); >+ if (!/404/.test(event.request.url)) >+ event.respondWith(new Response('Intercepted!')); >+ }); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/extendable-event-async-waituntil.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/extendable-event-async-waituntil.js >index abf54934a3b42e18908a730bdfa140e6b692c7ae..8a975b0d2e9b0789ce7ab7b05757b6d93f2ec400 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/extendable-event-async-waituntil.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/extendable-event-async-waituntil.js >@@ -1,4 +1,12 @@ >-// controlled by 'init'/'done' messages. >+// This worker calls waitUntil() and respondWith() asynchronously and >+// reports back to the test whether they threw. >+// >+// These test cases are confusing. Bear in mind that the event is active >+// (calling waitUntil() is allowed) if: >+// * The pending promise count is not 0, or >+// * The event dispatch flag is set. >+ >+// Controlled by 'init'/'done' messages. > var resolveLockPromise; > var port; > >@@ -14,34 +22,72 @@ self.addEventListener('message', function(event) { > case 'done': > resolveLockPromise(); > break; >+ >+ // Throws because waitUntil() is called in a task after event dispatch >+ // finishes. > case 'no-current-extension-different-task': > async_task_waituntil(event).then(reportResultExpecting('InvalidStateError')); > break; >+ >+ // OK because waitUntil() is called in a microtask that runs after the >+ // event handler runs, while the event dispatch flag is still set. > case 'no-current-extension-different-microtask': >- async_microtask_waituntil(event).then(reportResultExpecting('InvalidStateError')); >+ async_microtask_waituntil(event).then(reportResultExpecting('OK')); > break; >+ >+ // OK because the second waitUntil() is called while the first waitUntil() >+ // promise is still pending. > case 'current-extension-different-task': > event.waitUntil(new Promise((res) => { resolveTestPromise = res; })); > async_task_waituntil(event).then(reportResultExpecting('OK')).then(resolveTestPromise); > break; >- case 'current-extension-expired-same-microtask-turn': >+ >+ // OK because all promises involved resolve "immediately", so the second >+ // waitUntil() is called during the microtask checkpoint at the end of >+ // event dispatching, when the event dispatch flag is still set. >+ case 'during-event-dispatch-current-extension-expired-same-microtask-turn': > waitPromise = Promise.resolve(); > event.waitUntil(waitPromise); > waitPromise.then(() => { return sync_waituntil(event); }) > .then(reportResultExpecting('OK')) > break; >- case 'current-extension-expired-same-microtask-turn-extra': >- // The promise handler queues a new microtask *after* the check for new >- // extensions was performed. >+ >+ // OK for the same reason as above. >+ case 'during-event-dispatch-current-extension-expired-same-microtask-turn-extra': > waitPromise = Promise.resolve(); > event.waitUntil(waitPromise); >+ waitPromise.then(() => { return async_microtask_waituntil(event); }) >+ .then(reportResultExpecting('OK')) >+ break; >+ >+ >+ // OK because the pending promise count is decremented in a microtask >+ // queued upon fulfillment of the first waitUntil() promise, so the second >+ // waitUntil() is called while the pending promise count is still >+ // positive. >+ case 'after-event-dispatch-current-extension-expired-same-microtask-turn': >+ waitPromise = makeNewTaskPromise(); >+ event.waitUntil(waitPromise); >+ waitPromise.then(() => { return sync_waituntil(event); }) >+ .then(reportResultExpecting('OK')) >+ break; >+ >+ // Throws because the second waitUntil() is called after the pending >+ // promise count was decremented to 0. >+ case 'after-event-dispatch-current-extension-expired-same-microtask-turn-extra': >+ waitPromise = makeNewTaskPromise(); >+ event.waitUntil(waitPromise); > waitPromise.then(() => { return async_microtask_waituntil(event); }) > .then(reportResultExpecting('InvalidStateError')) > break; >+ >+ // Throws because the second waitUntil() is called in a new task, after >+ // first waitUntil() promise settled and the event dispatch flag is unset. > case 'current-extension-expired-different-task': > event.waitUntil(Promise.resolve()); > async_task_waituntil(event).then(reportResultExpecting('InvalidStateError')); > break; >+ > case 'script-extendable-event': > self.dispatchEvent(new ExtendableEvent('nontrustedevent')); > break; >@@ -51,25 +97,62 @@ self.addEventListener('message', function(event) { > }); > > self.addEventListener('fetch', function(event) { >- if (event.request.url.indexOf('pending-respondwith-async-waituntil') != -1) { >+ const path = new URL(event.request.url).pathname; >+ const step = path.substring(path.lastIndexOf('/') + 1); >+ let response; >+ switch (step) { >+ // OK because waitUntil() is called while the respondWith() promise is still >+ // unsettled, so the pending promise count is positive. >+ case 'pending-respondwith-async-waituntil': > var resolveFetch; >- let response = new Promise((res) => { resolveFetch = res; }); >+ response = new Promise((res) => { resolveFetch = res; }); > event.respondWith(response); > async_task_waituntil(event) > .then(reportResultExpecting('OK')) > .then(() => { resolveFetch(new Response('OK')); }); >- } else if (event.request.url.indexOf('respondwith-microtask-sync-waituntil') != -1) { >+ break; >+ >+ // OK because all promises involved resolve "immediately", so waitUntil() is >+ // called during the microtask checkpoint at the end of event dispatching, >+ // when the event dispatch flag is still set. >+ case 'during-event-dispatch-respondwith-microtask-sync-waituntil': > response = Promise.resolve(new Response('RESP')); > event.respondWith(response); > response.then(() => { return sync_waituntil(event); }) >- .then(reportResultExpecting('OK')) >- } else if (event.request.url.indexOf('respondwith-microtask-async-waituntil') != -1) { >+ .then(reportResultExpecting('OK')); >+ break; >+ >+ // OK because all promises involved resolve "immediately", so waitUntil() is >+ // called during the microtask checkpoint at the end of event dispatching, >+ // when the event dispatch flag is still set. >+ case 'during-event-dispatch-respondwith-microtask-async-waituntil': > response = Promise.resolve(new Response('RESP')); > event.respondWith(response); >+ response.then(() => { return async_microtask_waituntil(event); }) >+ .then(reportResultExpecting('OK')); >+ break; >+ >+ // OK because the pending promise count is decremented in a microtask queued >+ // upon fulfillment of the respondWith() promise, so waitUntil() is called >+ // while the pending promise count is still positive. >+ case 'after-event-dispatch-respondwith-microtask-sync-waituntil': >+ response = makeNewTaskPromise().then(() => {return new Response('RESP');}); >+ event.respondWith(response); >+ response.then(() => { return sync_waituntil(event); }) >+ .then(reportResultExpecting('OK')); >+ break; >+ >+ >+ // Throws because waitUntil() is called after the pending promise count was >+ // decremented to 0. >+ case 'after-event-dispatch-respondwith-microtask-async-waituntil': >+ response = makeNewTaskPromise().then(() => {return new Response('RESP');}); >+ event.respondWith(response); > response.then(() => { return async_microtask_waituntil(event); }) > .then(reportResultExpecting('InvalidStateError')) >- } >- }); >+ break; >+ } >+}); > > self.addEventListener('nontrustedevent', function(event) { > sync_waituntil(event).then(reportResultExpecting('InvalidStateError')); >@@ -118,3 +201,10 @@ function async_task_waituntil(event) { > }, 0); > }); > } >+ >+// Returns a promise that settles in a separate task. >+function makeNewTaskPromise() { >+ return new Promise(resolve => { >+ setTimeout(resolve, 0); >+ }); >+} >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-async-respond-with-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-async-respond-with-worker.js >index 7f66d20dfc2dff0af01dfa07f823c660b7a1ec1b..dc3f1a1e98563ad1b5924c8315c0d64d17ffbbfd 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-async-respond-with-worker.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-async-respond-with-worker.js >@@ -1,19 +1,66 @@ >-var result; >+// This worker attempts to call respondWith() asynchronously after the >+// fetch event handler finished. It reports back to the test whether >+// an exception was thrown. > >-self.addEventListener('message', function(event) { >- event.data.port.postMessage(result); >+// These get reset at the start of a test case. >+let reportResult; >+ >+// The test page sends a message to tell us that a new test case is starting. >+// We expect a fetch event after this. >+self.addEventListener('message', (event) => { >+ // Ensure tests run mutually exclusive. >+ if (reportResult) { >+ event.source.postMessage('testAlreadyRunning'); >+ return; >+ } >+ >+ const resultPromise = new Promise((resolve) => { >+ reportResult = resolve; >+ // Tell the client that everything is initialized and that it's safe to >+ // proceed with the test without relying on the order of events (which some >+ // browsers like Chrome may not guarantee). >+ event.source.postMessage('messageHandlerInitialized'); > }); > >-self.addEventListener('fetch', function(event) { >- setTimeout(function() { >- try { >- event.respondWith(new Response()); >- result = 'FAIL: did not throw'; >- } catch (error) { >- if (error.name == 'InvalidStateError') >- result = 'PASS'; >- else >- result = 'FAIL: Unexpected exception: ' + error; >- } >- }, 0); >+ // Keep the worker alive until the test case finishes, and report >+ // back the result to the test page. >+ event.waitUntil(resultPromise.then(result => { >+ reportResult = null; >+ event.source.postMessage(result); >+ })); >+}); >+ >+// Calls respondWith() and reports back whether an exception occurred. >+function tryRespondWith(event) { >+ try { >+ event.respondWith(new Response()); >+ reportResult({didThrow: false}); >+ } catch (error) { >+ reportResult({didThrow: true, error: error.name}); >+ } >+} >+ >+function respondWithInTask(event) { >+ setTimeout(() => { >+ tryRespondWith(event); >+ }, 0); >+} >+ >+function respondWithInMicrotask(event) { >+ Promise.resolve().then(() => { >+ tryRespondWith(event); > }); >+} >+ >+self.addEventListener('fetch', function(event) { >+ const path = new URL(event.request.url).pathname; >+ const test = path.substring(path.lastIndexOf('/') + 1); >+ >+ // If this is a test case, try respondWith() and report back to the test page >+ // the result. >+ if (test == 'respondWith-in-task') { >+ respondWithInTask(event); >+ } else if (test == 'respondWith-in-microtask') { >+ respondWithInMicrotask(event); >+ } >+}); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-network-fallback-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-network-fallback-worker.js >index daa200c2badb82964cc350699832a730b52c91a4..376bdbed05e186f7a125c2ef7ce296b6ddb8beae 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-network-fallback-worker.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-network-fallback-worker.js >@@ -1,3 +1,3 @@ > self.addEventListener('fetch', () => { >- // Do nothing. >- }); >+ // Do nothing. >+}); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-request-css-base-url-iframe.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-request-css-base-url-iframe.html >index 0edf2e7f9659a5ba2b204c76ec04503eacac14a7..504e10435642330fbeb2334855bb9d3966276469 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-request-css-base-url-iframe.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-request-css-base-url-iframe.html >@@ -1 +1,20 @@ >-<link href="./fetch-request-css-base-url-style.css" rel="stylesheet" type="text/css"> >+<html> >+<head> >+<title>iframe for css base url test</title> >+</head> >+<body> >+<script> >+// Load a stylesheet. Create it dynamically so we can construct the href URL >+// dynamically. >+const link = document.createElement('link'); >+link.rel = 'stylesheet'; >+link.type = 'text/css'; >+// Add "request-url-path" to the path to help distinguish the request URL from >+// the response URL. Add |document.location.search| (chosen by the test main >+// page) to tell the service worker how to respond to the request. >+link.href = 'request-url-path/fetch-request-css-base-url-style.css' + >+ document.location.search; >+document.head.appendChild(link); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-request-css-base-url-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-request-css-base-url-worker.js >index 91c325998a3b8d6a6106a834903e20559e0f0055..e8dbd2725c68f9326c41ae5e7bde65158970a272 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-request-css-base-url-worker.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-request-css-base-url-worker.js >@@ -1,27 +1,45 @@ >-importScripts('/common/get-host-info.sub.js'); >-importScripts('test-helpers.sub.js'); >+let source; >+let resolveDone; >+let done = new Promise(resolve => resolveDone = resolve); > >-var port = undefined; >+// The page messages this worker to ask for the result. Keep the worker alive >+// via waitUntil() until the result is sent. >+self.addEventListener('message', event => { >+ source = event.data.port; >+ source.postMessage('pong'); >+ event.waitUntil(done); >+}); > >-self.onmessage = function(e) { >- var message = e.data; >- if ('port' in message) { >- port = message.port; >- port.postMessage({ready: true}); >- } >-}; >+self.addEventListener('fetch', event => { >+ const url = new URL(event.request.url); > >-self.addEventListener('fetch', function(event) { >- var url = event.request.url; >- if (url.indexOf('fetch-request-css-base-url-style.css') != -1) { >- event.respondWith(fetch( >- get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() + >- 'fetch-request-css-base-url-style.css', >- {mode: 'no-cors'})); >- } else if (url.indexOf('dummy.png') != -1) { >- port.postMessage({ >- url: event.request.url, >- referrer: event.request.referrer >- }); >+ // For the CSS file, respond in a way that may change the response URL, >+ // depending on |url.search|. >+ const cssPath = 'request-url-path/fetch-request-css-base-url-style.css'; >+ if (url.pathname.indexOf(cssPath) != -1) { >+ // Respond with a different URL, deleting "request-url-path/". >+ if (url.search == '?fetch') { >+ event.respondWith(fetch('fetch-request-css-base-url-style.css')); >+ } >+ // Respond with new Response(). >+ else if (url.search == '?newResponse') { >+ const styleString = 'body { background-image: url("./dummy.png");}'; >+ const headers = {'content-type': 'text/css'}; >+ event.respondWith(new Response(styleString, headers)); > } >- }); >+ } >+ >+ // The image request indicates what the base URL of the CSS was. Message the >+ // result back to the test page. >+ else if (url.pathname.indexOf('dummy.png') != -1) { >+ // For some reason |source| is undefined here when running the test manually >+ // in Firefox. The test author experimented with both using Client >+ // (event.source) and MessagePort to try to get the test to pass, but >+ // failed. >+ source.postMessage({ >+ url: event.request.url, >+ referrer: event.request.referrer >+ }); >+ resolveDone(); >+ } >+}); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/get-resultingClientId-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/get-resultingClientId-worker.js >new file mode 100644 >index 0000000000000000000000000000000000000000..f0e6c7becab6126496fefa3f40a5e788dc64775b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/get-resultingClientId-worker.js >@@ -0,0 +1,107 @@ >+// This worker expects a fetch event for a navigation and messages back the >+// result of clients.get(event.resultingClientId). >+ >+// Resolves when the test finishes. >+let testFinishPromise; >+let resolveTestFinishPromise; >+let rejectTestFinishPromise; >+ >+// Resolves to clients.get(event.resultingClientId) from the fetch event. >+let getPromise; >+let resolveGetPromise; >+let rejectGetPromise; >+ >+let resultingClientId; >+ >+function startTest() { >+ testFinishPromise = new Promise((resolve, reject) => { >+ resolveTestFinishPromise = resolve; >+ rejectTestFinishPromise = reject; >+ }); >+ >+ getPromise = new Promise((resolve, reject) => { >+ resolveGetPromise = resolve; >+ rejectGetPromise = reject; >+ }); >+} >+ >+async function describeGetPromiseResult(promise) { >+ const result = {}; >+ >+ await promise.then( >+ (client) => { >+ result.promiseState = 'fulfilled'; >+ if (client === undefined) { >+ result.promiseValue = 'undefinedValue'; >+ } else if (client instanceof Client) { >+ result.promiseValue = 'client'; >+ result.client = { >+ id: client.id, >+ url: client.url >+ }; >+ } else { >+ result.promiseValue = 'unknown'; >+ } >+ }, >+ (error) => { >+ result.promiseState = 'rejected'; >+ }); >+ >+ return result; >+} >+ >+async function handleGetResultingClient(event) { >+ // Note that this message can arrive before |resultingClientId| is populated. >+ const result = await describeGetPromiseResult(getPromise); >+ // |resultingClientId| must be populated by now. >+ result.queriedId = resultingClientId; >+ event.source.postMessage(result); >+}; >+ >+async function handleGetClient(event) { >+ const id = event.data.id; >+ const result = await describeGetPromiseResult(self.clients.get(id)); >+ result.queriedId = id; >+ event.source.postMessage(result); >+}; >+ >+self.addEventListener('message', (event) => { >+ if (event.data.command == 'startTest') { >+ startTest(); >+ event.waitUntil(testFinishPromise); >+ event.source.postMessage('ok'); >+ return; >+ } >+ >+ if (event.data.command == 'finishTest') { >+ resolveTestFinishPromise(); >+ event.source.postMessage('ok'); >+ return; >+ } >+ >+ if (event.data.command == 'getResultingClient') { >+ event.waitUntil(handleGetResultingClient(event)); >+ return; >+ } >+ >+ if (event.data.command == 'getClient') { >+ event.waitUntil(handleGetClient(event)); >+ return; >+ } >+}); >+ >+async function handleFetch(event) { >+ try { >+ resultingClientId = event.resultingClientId; >+ const client = await self.clients.get(resultingClientId); >+ resolveGetPromise(client); >+ } catch (error) { >+ rejectGetPromise(error); >+ } >+} >+ >+self.addEventListener('fetch', (event) => { >+ if (event.request.mode != 'navigate') >+ return; >+ event.waitUntil(handleFetch(event)); >+}); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-relative.xsl b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-relative.xsl >new file mode 100644 >index 0000000000000000000000000000000000000000..063a62d03143a32f44365bf1e7b08d283ae52895 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-relative.xsl >@@ -0,0 +1,5 @@ >+<?xml version="1.0" encoding="utf-8"?> >+ >+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> >+ <xsl:import href="xslt-pass.xsl"/> >+</xsl:stylesheet> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-diff-resource-map-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-diff-resource-map-worker.js >new file mode 100644 >index 0000000000000000000000000000000000000000..0fdcb0fcf80ad7f0dffa284c5b77178bdad95ef6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-diff-resource-map-worker.js >@@ -0,0 +1,10 @@ >+importScripts('/resources/testharness.js'); >+ >+let echo1 = null; >+let echo2 = null; >+let arg1 = 'import-scripts-get.py?output=echo1&msg=test1'; >+let arg2 = 'import-scripts-get.py?output=echo2&msg=test2'; >+ >+importScripts(arg1, arg2); >+assert_equals(echo1, 'test1'); >+assert_equals(echo2, 'test2'); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-get.py b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-get.py >new file mode 100644 >index 0000000000000000000000000000000000000000..9e376bc092889f1b231628ec7c17339674d284f4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-get.py >@@ -0,0 +1,6 @@ >+def main(req, res): >+ return ([ >+ ('Cache-Control', 'no-cache, must-revalidate'), >+ ('Pragma', 'no-cache'), >+ ('Content-Type', 'application/javascript')], >+ '%s = "%s";\n' % (req.GET['output'], req.GET['msg'])) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-echo-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-echo-worker.js >new file mode 100644 >index 0000000000000000000000000000000000000000..f088ad127804297cf981e61acb1c33ea7b0620c4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-echo-worker.js >@@ -0,0 +1,3 @@ >+self.addEventListener('message', event => { >+ event.source.postMessage(event.data); >+}); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/service-worker-csp-worker.py b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/service-worker-csp-worker.py >index 5f06454f144d584dbbec4ec2457f5b5bdd161fe6..9d2b1f2d834f523447b2cfd373bb176f2e0e8573 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/service-worker-csp-worker.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/service-worker-csp-worker.py >@@ -17,6 +17,15 @@ test(function() { > 'Importing the other origins script should fail.'); > }, 'importScripts test for default-src'); > >+test(function() { >+ assert_throws(EvalError(), >+ function() { eval('1 + 1'); }, >+ 'eval() should throw EvalError.') >+ assert_throws(EvalError(), >+ function() { new Function('1 + 1'); }, >+ 'new Function() should throw EvalError.') >+ }, 'eval test for default-src'); >+ > async_test(function(t) { > fetch(host_info.HTTPS_REMOTE_ORIGIN + > base_path() + 'fetch-access-control.py?ACAOrigin=*', >@@ -63,6 +72,15 @@ test(function() { > 'Importing the other origins script should fail.'); > }, 'importScripts test for script-src'); > >+test(function() { >+ assert_throws(EvalError(), >+ function() { eval('1 + 1'); }, >+ 'eval() should throw EvalError.') >+ assert_throws(EvalError(), >+ function() { new Function('1 + 1'); }, >+ 'new Function() should throw EvalError.') >+ }, 'eval test for script-src'); >+ > async_test(function(t) { > fetch(host_info.HTTPS_REMOTE_ORIGIN + > base_path() + 'fetch-access-control.py?ACAOrigin=*', >@@ -109,6 +127,18 @@ test(function() { > 'Importing the other origins script should not fail.'); > }, 'importScripts test for connect-src'); > >+test(function() { >+ var eval_failed = false; >+ try { >+ eval('1 + 1'); >+ new Function('1 + 1'); >+ } catch(e) { >+ eval_failed = true; >+ } >+ assert_false(eval_failed, >+ 'connect-src without unsafe-eval should not block eval().'); >+ }, 'eval test for connect-src'); >+ > async_test(function(t) { > fetch(host_info.HTTPS_REMOTE_ORIGIN + > base_path() + 'fetch-access-control.py?ACAOrigin=*', >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-helpers.sub.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-helpers.sub.js >index 7efde354a8f9b3b157972dca8e5a3c5b5eb4116a..af8dad3a5be8aa831900b183ad7ee9a10417ba1a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-helpers.sub.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-helpers.sub.js >@@ -75,9 +75,11 @@ function wait_for_update(test, registration) { > } > > return new Promise(test.step_func(function(resolve) { >- registration.addEventListener('updatefound', test.step_func(function() { >- resolve(registration.installing); >- })); >+ var handler = test.step_func(function() { >+ registration.removeEventListener('updatefound', handler); >+ resolve(registration.installing); >+ }); >+ registration.addEventListener('updatefound', handler); > })); > } > >@@ -276,3 +278,33 @@ async function wait_for_activation_on_dummy_scope(t, window_or_workerglobalscope > await wait_for_state(t, registration.installing, 'activated'); > await registration.unregister(); > } >+ >+// This installs resources/appcache-ordering.manifest. >+function install_appcache_ordering_manifest() { >+ let resolve_install_appcache; >+ let reject_install_appcache; >+ >+ // This is notified by the child iframe, i.e. appcache-ordering.install.html, >+ // that's to be created below. >+ window.notify_appcache_installed = success => { >+ if (success) >+ resolve_install_appcache(); >+ else >+ reject_install_appcache(); >+ }; >+ >+ return new Promise((resolve, reject) => { >+ const frame = document.createElement('iframe'); >+ frame.src = 'resources/appcache-ordering.install.html'; >+ document.body.appendChild(frame); >+ resolve_install_appcache = function() { >+ document.body.removeChild(frame); >+ resolve(); >+ }; >+ reject_install_appcache = function() { >+ document.body.removeChild(frame); >+ reject(); >+ }; >+ }); >+} >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-request-headers-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-request-headers-worker.js >new file mode 100644 >index 0000000000000000000000000000000000000000..71aff5e503745faa1376dfb359119023cb1bcfc1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-request-headers-worker.js >@@ -0,0 +1,7 @@ >+// The server injects the request headers here as a JSON string. >+const headersAsJson = `%HEADERS%`; >+const headers = JSON.parse(headersAsJson); >+ >+self.addEventListener('message', async (e) => { >+ e.source.postMessage(headers); >+}); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-request-headers-worker.py b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-request-headers-worker.py >new file mode 100644 >index 0000000000000000000000000000000000000000..5666f19e7904b007ac5c3e4ed95617d9affa92ce >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-request-headers-worker.py >@@ -0,0 +1,16 @@ >+import json >+import os >+ >+def main(request, response): >+ path = os.path.join(os.path.dirname(__file__), >+ "test-request-headers-worker.js") >+ body = open(path, "rb").read() >+ >+ data = {key:request.headers[key] for key,value in request.headers.iteritems()} >+ body = body.replace("%HEADERS%", json.dumps(data)) >+ >+ headers = [] >+ headers.append(("ETag", "etag")) >+ headers.append(("Content-Type", 'text/javascript')) >+ >+ return headers, body >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-during-installation-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-during-installation-worker.js >index dabeec077f77d5e8d1924eb5f3bd5d8667b129f5..3f89881c04384590b8b132c392977256bfb847ed 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-during-installation-worker.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-during-installation-worker.js >@@ -1,23 +1,57 @@ > 'use strict'; > >-const installMayFinish = new Promise(resolve => { >- self.finishInstall = resolve; >+const installEventFired = new Promise(resolve => { >+ self.fireInstallEvent = resolve; > }); > >-let report = { installEventFired: false }; >+const installFinished = new Promise(resolve => { >+ self.finishInstall = resolve; >+}); > > addEventListener('install', event => { >- report.installEventFired = true; >- let attemptUpdate = registration.update().catch(exception => { >- report.exception = exception.name; >- }); >- event.waitUntil(Promise.all([installMayFinish, attemptUpdate])); >+ fireInstallEvent(); >+ event.waitUntil(installFinished); > }); > > addEventListener('message', event => { >- if (event.data === 'finishInstall') { >+ // Use a dedicated MessageChannel for every request so senders can wait for >+ // individual requests to finish, and concurrent requests (to different >+ // workers) don't cause race conditions. >+ const port = event.data; >+ port.onmessage = (event) => { >+ switch (event.data) { >+ case 'awaitInstallEvent': >+ installEventFired.then(() => { >+ port.postMessage('installEventFired'); >+ }); >+ break; >+ >+ case 'finishInstall': >+ installFinished.then(() => { >+ port.postMessage('installFinished'); >+ }); > finishInstall(); >- } else { >- event.source.postMessage(report); >+ break; >+ >+ case 'callUpdate': { >+ const channel = new MessageChannel(); >+ registration.update().then(() => { >+ channel.port2.postMessage({ >+ success: true, >+ }); >+ }).catch((exception) => { >+ channel.port2.postMessage({ >+ success: false, >+ exception: exception.name, >+ }); >+ }); >+ port.postMessage(channel.port1, [channel.port1]); >+ break; >+ } >+ >+ default: >+ port.postMessage('Unexpected command ' + event.data); >+ break; > } >+ }; > }); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-during-installation-worker.py b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-during-installation-worker.py >new file mode 100644 >index 0000000000000000000000000000000000000000..95e4522007c1d2be14045f7582ebe2b5347abd87 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-during-installation-worker.py >@@ -0,0 +1,11 @@ >+import time >+ >+def main(request, response): >+ headers = [('Content-Type', 'application/javascript'), >+ ('Cache-Control', 'max-age=0')] >+ # Add timestamp to the worker so update() finds a new worker every time. >+ body = ''' >+// %s >+importScripts('update-during-installation-worker.js'); >+ '''.strip() % time.clock() >+ return headers, body >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/w3c-import.log >index c4028ea07f7034d0a945c634dff856b17868a806..9ebc8bc31ffccde77363e9861173d25e75a2d202 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/w3c-import.log >@@ -146,11 +146,15 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-rewrite-worker.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-waits-for-activate-worker.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/frame-for-getregistrations.html >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/get-resultingClientId-worker.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/http-to-https-redirect-and-register-iframe.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/iframe-with-image.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/immutable-prototype-serviceworker.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-mime-type-worker.py >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-relative.xsl >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-diff-resource-map-worker.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-echo.py >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-get.py > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-mime-types-worker.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-redirect-import.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-redirect-worker.js >@@ -221,6 +225,7 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/performance-timeline-worker.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-blob-url.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-dictionary-transferables-worker.js >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-echo-worker.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-msgport-to-client-worker.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-to-client-worker.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-transferables-worker.js >@@ -274,10 +279,15 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/stalling-service-worker.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/success.py > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-helpers.sub.js >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-request-headers-worker.js >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-request-headers-worker.py > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/testharness-helpers.js >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/trickle.py > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/unregister-controller-page.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-claim-worker.py > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-during-installation-worker.js >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-during-installation-worker.py >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-fetch-worker.py > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-max-aged-worker-imported-script.py > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-max-aged-worker.py > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-missing-import-scripts-imported-worker.py >@@ -300,3 +310,8 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-load-interceptor.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-testharness.js > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker_interception_redirect_webworker.py >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xhr-iframe.html >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xhr-response-url-worker.js >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xsl-base-url-iframe.xml >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xsl-base-url-worker.js >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xslt-pass.xsl >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html >index ab10a078f3d67a8c213b8511b8ff5ffcde92375b..84204a3ee5df1fc3a71784215071b14f0c65f9f2 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html >@@ -1,4 +1,5 @@ > <script src="/common/get-host-info.sub.js"></script> >+<script src="/resources/testharness.js"></script> > <script src="test-helpers.sub.js?pipe=sub"></script> > <script> > var host_info = get_host_info(); >@@ -11,7 +12,7 @@ function boilerplate_test(url, msg) { > worker.postMessage(msg); > }) > .then(function(data) { >- window.parent.postMessage({results: data}, host_info['HTTPS_ORIGIN']); >+ assert_equals(data, "This load was successfully intercepted."); > }); > } > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-load-interceptor.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-load-interceptor.js >index 695777a514f65628b25f76549970ddfbc854fee3..a5f65c3216e44632ff052bac0448316f25d443c6 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-load-interceptor.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-load-interceptor.js >@@ -8,6 +8,8 @@ self.onfetch = function(event) { > if (url.indexOf("synthesized-response.txt") != -1) { > event.respondWith(new Response(response_text)); > } else if (url.indexOf("synthesized-response.js") != -1) { >- event.respondWith(new Response(response_script)); >+ event.respondWith(new Response( >+ response_script, >+ {headers: {'Content-Type': 'application/javascript'}})); > } > }; >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xhr-iframe.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xhr-iframe.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4c57bbbc6589d9738924b0acb91b440efc141622 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xhr-iframe.html >@@ -0,0 +1,23 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>iframe for xhr tests</title> >+<script> >+async function xhr(url, options) { >+ return new Promise((resolve, reject) => { >+ const xhr = new XMLHttpRequest(); >+ const opts = options ? options : {}; >+ xhr.onload = () => { >+ resolve(xhr); >+ }; >+ xhr.onerror = () => { >+ reject('xhr failed'); >+ }; >+ >+ xhr.open('GET', url); >+ if (opts.responseType) { >+ xhr.responseType = opts.responseType; >+ } >+ xhr.send(); >+ }); >+} >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xhr-response-url-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xhr-response-url-worker.js >new file mode 100644 >index 0000000000000000000000000000000000000000..906ad5005b59a11305237fc590fdf38407b76379 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xhr-response-url-worker.js >@@ -0,0 +1,32 @@ >+// Service worker for the xhr-response-url test. >+ >+self.addEventListener('fetch', event => { >+ const url = new URL(event.request.url); >+ const respondWith = url.searchParams.get('respondWith'); >+ if (!respondWith) >+ return; >+ >+ if (respondWith == 'fetch') { >+ const target = url.searchParams.get('url'); >+ event.respondWith(fetch(target)); >+ return; >+ } >+ >+ if (respondWith == 'string') { >+ const headers = {'content-type': 'text/plain'}; >+ event.respondWith(new Response('hello', {headers})); >+ return; >+ } >+ >+ if (respondWith == 'document') { >+ const doc = ` >+ <!DOCTYPE html> >+ <html> >+ <title>hi</title> >+ <body>hello</body> >+ </html>`; >+ const headers = {'content-type': 'text/html'}; >+ event.respondWith(new Response(doc, {headers})); >+ return; >+ } >+}); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xsl-base-url-iframe.xml b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xsl-base-url-iframe.xml >new file mode 100644 >index 0000000000000000000000000000000000000000..065a07acb284821dde1cbea8680781a524f21bc2 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xsl-base-url-iframe.xml >@@ -0,0 +1,5 @@ >+<?xml version="1.0"?> >+<?xml-stylesheet type="text/xsl" href="resources/request-url-path/import-relative.xsl"?> >+<stylesheet-test> >+This tests a stylesheet which has a xsl:import with a relative URL. >+</stylesheet-test> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xsl-base-url-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xsl-base-url-worker.js >new file mode 100644 >index 0000000000000000000000000000000000000000..50e2b1842ffc7f2ef2017846406eb67ed9491ead >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xsl-base-url-worker.js >@@ -0,0 +1,12 @@ >+self.addEventListener('fetch', event => { >+ const url = new URL(event.request.url); >+ >+ // For the import-relative.xsl file, respond in a way that changes the >+ // response URL. This is expected to change the base URL and allow the import >+ // from the file to succeed. >+ const path = 'request-url-path/import-relative.xsl'; >+ if (url.pathname.indexOf(path) != -1) { >+ // Respond with a different URL, deleting "request-url-path/". >+ event.respondWith(fetch('import-relative.xsl')); >+ } >+}); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xslt-pass.xsl b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xslt-pass.xsl >new file mode 100644 >index 0000000000000000000000000000000000000000..2cd7f2f8f86a23d464b30feab0939931134810cc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xslt-pass.xsl >@@ -0,0 +1,11 @@ >+<?xml version="1.0" encoding="utf-8"?> >+ >+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> >+ <xsl:template match="/"> >+ <html> >+ <body> >+ <p>PASS</p> >+ </body> >+ </html> >+ </xsl:template> >+</xsl:stylesheet> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-connect.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-connect.https-expected.txt >index f61d26270b361b9a20d909923d3c3566ffa8c0de..e6f5a52443130224f987da18d9a77362eceef088 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-connect.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-connect.https-expected.txt >@@ -1,6 +1,7 @@ > > PASS CSP test for connect-src in ServiceWorkerGlobalScope > PASS importScripts test for connect-src >+PASS eval test for connect-src > PASS Fetch test for connect-src > PASS Redirected fetch test for connect-src > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-default.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-default.https-expected.txt >index f418cb835bcadeab3d8e4590f6ef0beb49c46abe..76f9186cf9be0c36da72bc3bc04ed56dc643d8c2 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-default.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-default.https-expected.txt >@@ -1,6 +1,7 @@ > > PASS CSP test for default-src in ServiceWorkerGlobalScope > PASS importScripts test for default-src >+PASS eval test for default-src > PASS Fetch test for default-src > PASS Redirected fetch test for default-src > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-script.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-script.https-expected.txt >index d37a7b5d7b3e31bbf50f6eca1ecdbaefeb85e87a..153388a80cbfbc26309befe58206056ae61724d6 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-script.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-script.https-expected.txt >@@ -1,6 +1,7 @@ > > PASS CSP test for script-src in ServiceWorkerGlobalScope > PASS importScripts test for script-src >+PASS eval test for script-src > PASS Fetch test for script-src > PASS Redirected fetch test for script-src > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/serviceworker-message-event-historical.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/serviceworker-message-event-historical.https.html >index 2f780a604282dc281ebe75a964ed24f832a24e3a..fac8f2076fb64870550236dd27470902cdbe040c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/serviceworker-message-event-historical.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/serviceworker-message-event-historical.https.html >@@ -10,6 +10,10 @@ promise_test(function(t) { > var url = 'resources/postmessage-to-client-worker.js'; > return service_worker_unregister_and_register(t, url, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, r.installing, 'activated'); > }) > .then(function() { >@@ -35,9 +39,6 @@ promise_test(function(t) { > }); > worker.postMessage('PING'); > }); >- }) >- .then(function() { >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Test MessageEvent supplants ServiceWorkerMessageEvent.'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/shared-worker-controlled.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/shared-worker-controlled.https.html >index 33d52e01199c2bdc0e85df7d8106ddd970aae082..0320c02a4fa2b8066bc6f603bf7abc3eefe1c3b3 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/shared-worker-controlled.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/shared-worker-controlled.https.html >@@ -12,6 +12,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, service_worker, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, r.installing, 'activated'); > }) > .then(function() { >@@ -24,7 +28,6 @@ promise_test(function(t) { > }) > .then(function(data) { > assert_equals(data, 'intercepted by service worker'); >- service_worker_unregister_and_done(t, scope); > }); > }, 'Verify subresource loads in SharedWorker are controlled by a Service Worker'); > >@@ -35,6 +38,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, service_worker, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, r.installing, 'activated'); > }) > .then(function() { >@@ -47,7 +54,6 @@ promise_test(function(t) { > }) > .then(function(data) { > assert_equals(data, 'worker loading intercepted by service worker'); >- service_worker_unregister_and_done(t, scope); > }); > }, 'Verify SharedWorker construction is controlled by a Service Worker'); > >@@ -58,6 +64,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, service_worker, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, r.installing, 'activated'); > }) > .then(function() { >@@ -70,7 +80,6 @@ promise_test(function(t) { > }) > .then(function(data) { > assert_equals(data, 'worker loading intercepted by service worker'); >- service_worker_unregister_and_done(t, scope); > }); > }, 'Verify importScripts from SharedWorker is controlled by a Service Worker'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-installed.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-installed.https.html >index 21e26be5128454ee05143b10b8039ceb95a48cd5..b604f651b3c1deb38d891c77394a8f175a19c34e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-installed.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-installed.https.html >@@ -33,6 +33,10 @@ promise_test(function(t) { > }); > return service_worker_unregister_and_register(t, url1, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, r.installing, 'activated'); > }) > .then(function() { >@@ -60,7 +64,6 @@ promise_test(function(t) { > }) > .then(function() { > frame.remove(); >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Test skipWaiting when a installed worker is waiting'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-using-registration.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-using-registration.https.html >index 67838acff46698576936fb33b22c594cb3cd10d0..412ee2a4438e2328f69337893465c4a66c671ce6 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-using-registration.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-using-registration.https.html >@@ -1,5 +1,6 @@ > <!DOCTYPE html> > <title>Service Worker: Skip waiting using registration</title> >+<meta name="timeout" content="long"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="resources/test-helpers.sub.js"></script> >@@ -58,7 +59,7 @@ promise_test(function(t) { > .then(function() { > assert_not_equals(sw_registration.active, null, > 'Registration active worker should not be null'); >- fetch_tests_from_worker(sw_registration.active); >+ return fetch_tests_from_worker(sw_registration.active); > }); > }, 'Test skipWaiting while a client is using the registration'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-without-using-registration.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-without-using-registration.https.html >index 705fe8355e125c99c04abd7dfb899d8536ed6851..ced64e5f67fb667e5c233055ad920dbda0336336 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-without-using-registration.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-without-using-registration.https.html >@@ -1,5 +1,6 @@ > <!DOCTYPE html> > <title>Service Worker: Skip waiting without using registration</title> >+<meta name="timeout" content="long"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="resources/test-helpers.sub.js"></script> >@@ -36,7 +37,7 @@ promise_test(function(t) { > 'Document controller should still be null'); > assert_not_equals(sw_registration.active, null, > 'Registration active worker should not be null'); >- fetch_tests_from_worker(sw_registration.active); >+ return fetch_tests_from_worker(sw_registration.active); > }); > }, 'Test skipWaiting while a client is not being controlled'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting.https.html >index 48b5a8c9aeeb40648c4d295492d4a44b957d788f..f8392fc955b46cdd9f1deb5a7319b8f3f35d91dd 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting.https.html >@@ -14,6 +14,10 @@ promise_test(function(t) { > var sw_registration, activated_worker, waiting_worker; > return service_worker_unregister_and_register(t, url1, scope) > .then(function(registration) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > sw_registration = registration; > return wait_for_state(t, registration.installing, 'activated'); > }) >@@ -48,7 +52,6 @@ promise_test(function(t) { > 'Worker with url2 should be redundant'); > assert_equals(sw_registration.active.scriptURL, normalizeURL(url3), > 'Worker with url3 should be activated'); >- return service_worker_unregister_and_done(t, scope); > }); > }, 'Test skipWaiting with both active and waiting workers'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/svg-target-reftest.https-expected.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/svg-target-reftest.https-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..9a93d3b37047560a1b686266932c039968683fce >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/svg-target-reftest.https-expected.html >@@ -0,0 +1,5 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Green svg box reference file</title> >+<p>Pass if you see a green box below.</p> >+<iframe src="svg-target-reftest-001-frame.html"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/svg-target-reftest.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/svg-target-reftest.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..3710ee61d85fe5f7272e949e33622f3592e65436 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/svg-target-reftest.https.html >@@ -0,0 +1,28 @@ >+<!DOCTYPE html> >+<html class="reftest-wait"> >+<meta charset="utf-8"> >+<title>Service worker interception does not break SVG fragment targets</title> >+<meta name="assert" content="SVG with link fragment should render correctly when intercepted by a service worker."> >+<script src="resources/test-helpers.sub.js"></script> >+<link rel="match" href="resources/svg-target-reftest-001.html"> >+<p>Pass if you see a green box below.</p> >+<script> >+// We want to use utility functions designed for testharness.js where >+// there is a test object. We don't have a test object in reftests >+// so fake one for now. >+const fake_test = { step_func: f => f }; >+ >+async function runTest() { >+ const script = './resources/pass-through-worker.js'; >+ const scope = './resources/svg-target-reftest-frame.html'; >+ let reg = await navigator.serviceWorker.register(script, { scope }); >+ await wait_for_state(fake_test, reg.installing, 'activated'); >+ let f = await with_iframe(scope); >+ document.documentElement.classList.remove('reftest-wait'); >+ await reg.unregister(); >+ // Note, we cannot remove the frame explicitly because we can't >+ // tell when the reftest completes. >+} >+runTest(); >+</script> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https-expected.txt >index 90b7cae31c86e31044fe30ec9487272692237996..44bc5c7354993cb0b9fc0cbd5a0349ab0096425e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https-expected.txt >@@ -1,5 +1,5 @@ > > PASS Registering a new script URL while an unregistered registration is in use >-PASS Registering a new script URL that 404s does resurrect an unregistered registration >-PASS Registering a new script URL that fails to install does resurrect an unregistered registration >+FAIL Registering a new script URL that 404s does not resurrect unregistered registration assert_equals: Document should not be controlled expected null but got object "[object ServiceWorker]" >+FAIL Registering a new script URL that fails to install does not resurrect unregistered registration assert_equals: registration.active expected null but got object "[object ServiceWorker]" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https.html >index 582132a742fc9bb0fba62ee025356f983938da1b..a07da7d398fa686952e9b7e00df62a07d07fde7b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https.html >@@ -5,180 +5,131 @@ > <script> > var worker_url = 'resources/empty-worker.js'; > >-async_test(function(t) { >- var scope = 'resources/scope/unregister-then-register-new-script-that-exists'; >- var new_worker_url = worker_url + '?new'; >- var iframe; >- var registration; >- var new_registration; >- >- service_worker_unregister_and_register(t, worker_url, scope) >- .then(function(r) { >- registration = r; >- return wait_for_state(t, r.installing, 'activated'); >- }) >- .then(function() { >- return with_iframe(scope); >- }) >- .then(function(frame) { >- iframe = frame; >- return registration.unregister(); >- }) >- .then(function() { >- return navigator.serviceWorker.register(new_worker_url, >- { scope: scope }); >- }) >- .then(function(r) { >- new_registration = r; >- assert_equals(registration.installing.scriptURL, >- normalizeURL(new_worker_url), >- 'before activated registration.installing'); >- assert_equals(registration.waiting, null, >- 'before activated registration.waiting'); >- assert_equals(registration.active.scriptURL, normalizeURL(worker_url), >- 'before activated registration.active'); >- assert_equals(new_registration.installing.scriptURL, >- normalizeURL(new_worker_url), >- 'before activated new_registration.installing'); >- assert_equals(new_registration.waiting, null, >- 'before activated new_registration.waiting'); >- assert_equals(new_registration.active.scriptURL, >- normalizeURL(worker_url), >- 'before activated new_registration.active'); >- iframe.remove(); >- return wait_for_state(t, registration.installing, 'activated'); >- }) >- .then(function() { >- assert_equals(new_registration.installing, null, >- 'after activated new_registration.installing'); >- assert_equals(new_registration.waiting, null, >- 'after activated new_registration.waiting'); >- assert_equals(new_registration.active.scriptURL, >- normalizeURL(new_worker_url), >- 'after activated new_registration.active'); >- return with_iframe(scope); >- }) >- .then(function(frame) { >- assert_equals( >- frame.contentWindow.navigator.serviceWorker.controller.scriptURL, >- normalizeURL(new_worker_url), >- 'the new worker should control a new document'); >- frame.remove(); >- return registration.unregister(); >- }) >- .then(function() { >- t.done(); >- }) >- .catch(unreached_rejection(t)); >+promise_test(async function(t) { >+ const scope = 'resources/scope/unregister-then-register-new-script-that-exists'; >+ const registration = await service_worker_unregister_and_register(t, worker_url, scope); >+ t.add_cleanup(() => registration.unregister()); >+ >+ const newWorkerURL = worker_url + '?new'; >+ await wait_for_state(t, registration.installing, 'activated'); >+ >+ const iframe = await with_iframe(scope); >+ t.add_cleanup(() => iframe.remove()); >+ >+ await registration.unregister(); >+ >+ const newRegistration = await navigator.serviceWorker.register(newWorkerURL, { scope }); >+ t.add_cleanup(() => newRegistration.unregister()); >+ >+ assert_equals( >+ registration.installing.scriptURL, >+ normalizeURL(newWorkerURL), >+ 'before activated registration.installing' >+ ); >+ assert_equals( >+ registration.waiting, >+ null, >+ 'before activated registration.waiting' >+ ); >+ assert_equals( >+ registration.active.scriptURL, >+ normalizeURL(worker_url), >+ 'before activated registration.active' >+ ); >+ assert_equals( >+ newRegistration.installing.scriptURL, >+ normalizeURL(newWorkerURL), >+ 'before activated newRegistration.installing' >+ ); >+ assert_equals( >+ newRegistration.waiting, >+ null, >+ 'before activated newRegistration.waiting' >+ ); >+ assert_equals( >+ newRegistration.active.scriptURL, >+ normalizeURL(worker_url), >+ 'before activated newRegistration.active' >+ ); >+ iframe.remove(); >+ >+ await wait_for_state(t, registration.installing, 'activated'); >+ >+ assert_equals( >+ newRegistration.installing, >+ null, >+ 'after activated newRegistration.installing' >+ ); >+ assert_equals( >+ newRegistration.waiting, >+ null, >+ 'after activated newRegistration.waiting' >+ ); >+ assert_equals( >+ newRegistration.active.scriptURL, >+ normalizeURL(newWorkerURL), >+ 'after activated newRegistration.active' >+ ); >+ >+ const newIframe = await with_iframe(scope); >+ t.add_cleanup(() => newIframe.remove()); >+ >+ assert_equals( >+ newIframe.contentWindow.navigator.serviceWorker.controller.scriptURL, >+ normalizeURL(newWorkerURL), >+ 'the new worker should control a new document' >+ ); > }, 'Registering a new script URL while an unregistered registration is in use'); > >-async_test(function(t) { >- var scope = 'resources/scope/unregister-then-register-new-script-that-404s'; >- var iframe; >- var registration; >- >- service_worker_unregister_and_register(t, worker_url, scope) >- .then(function(r) { >- registration = r; >- return wait_for_state(t, r.installing, 'activated'); >- }) >- .then(function() { >- return with_iframe(scope); >- }) >- .then(function(frame) { >- iframe = frame; >- return registration.unregister(); >- }) >- .then(function() { >- // Step 5.1 of Register clears the uninstall flag before fetching >- // the script: >- // >- // https://w3c.github.io/ServiceWorker/#register-algorithm >- var promise = navigator.serviceWorker.register('this-will-404', >- { scope: scope }); >- return promise; >- }) >- .then( >- function() { >- assert_unreached('register should reject the promise'); >- }, >- function() { >- assert_equals(registration.installing, null, >- 'registration.installing'); >- assert_equals(registration.waiting, null, >- 'registration.waiting'); >- assert_equals(registration.active.scriptURL, normalizeURL(worker_url), >- 'registration.active'); >- iframe.remove(); >- return with_iframe(scope); >- }) >- .then(function(frame) { >- assert_equals( >- frame.contentWindow.navigator.serviceWorker.controller.scriptURL, >- normalizeURL(worker_url), >- 'the original worker should control a new document'); >- frame.remove(); >- return registration.unregister(); >- }) >- .then(function() { >- t.done(); >- }) >- .catch(unreached_rejection(t)); >-}, 'Registering a new script URL that 404s does resurrect an ' + >- 'unregistered registration'); >- >-async_test(function(t) { >- var scope = 'resources/scope/unregister-then-register-reject-install-worker'; >- var iframe; >- var registration; >- >- service_worker_unregister_and_register(t, worker_url, scope) >- .then(function(r) { >- registration = r; >- return wait_for_state(t, r.installing, 'activated'); >- }) >- .then(function() { >- return with_iframe(scope); >- }) >- .then(function(frame) { >- iframe = frame; >- return registration.unregister(); >- }) >- .then(function() { >- // Step 5.1 of Register clears the uninstall flag before firing >- // the install event: >- // >- // https://w3c.github.io/ServiceWorker/#register-algorithm >- var promise = navigator.serviceWorker.register( >- 'resources/reject-install-worker.js', { scope: scope }); >- return promise; >- }) >- .then(function(r) { >- registration = r; >- return wait_for_state(t, r.installing, 'redundant'); >- }) >- .then(function() { >- assert_equals(registration.installing, null, >- 'registration.installing'); >- assert_equals(registration.waiting, null, >- 'registration.waiting'); >- assert_equals(registration.active.scriptURL, normalizeURL(worker_url), >- 'registration.active'); >- iframe.remove(); >- return with_iframe(scope); >- }) >- .then(function(frame) { >- assert_equals( >- frame.contentWindow.navigator.serviceWorker.controller.scriptURL, >- normalizeURL(worker_url), >- 'the original worker should control a new document'); >- frame.remove(); >- return registration.unregister(); >- }) >- .then(function() { >- t.done(); >- }) >- .catch(unreached_rejection(t)); >- }, 'Registering a new script URL that fails to install does resurrect ' + >- 'an unregistered registration'); >+promise_test(async function(t) { >+ const scope = 'resources/scope/unregister-then-register-new-script-that-404s'; >+ const registration = await service_worker_unregister_and_register(t, worker_url, scope); >+ t.add_cleanup(() => registration.unregister()); >+ >+ await wait_for_state(t, registration.installing, 'activated'); >+ >+ const iframe = await with_iframe(scope); >+ t.add_cleanup(() => iframe.remove()); >+ >+ await registration.unregister(); >+ >+ await promise_rejects( >+ t, new TypeError(), >+ navigator.serviceWorker.register('this-will-404', { scope }) >+ ); >+ >+ assert_equals(registration.installing, null, 'registration.installing'); >+ assert_equals(registration.waiting, null, 'registration.waiting'); >+ assert_equals(registration.active.scriptURL, normalizeURL(worker_url), 'registration.active'); >+ >+ const newIframe = await with_iframe(scope); >+ t.add_cleanup(() => newIframe.remove()); >+ >+ assert_equals(newIframe.contentWindow.navigator.serviceWorker.controller, null, 'Document should not be controlled'); >+}, 'Registering a new script URL that 404s does not resurrect unregistered registration'); >+ >+promise_test(async function(t) { >+ const scope = 'resources/scope/unregister-then-register-reject-install-worker'; >+ const registration = await service_worker_unregister_and_register(t, worker_url, scope); >+ t.add_cleanup(() => registration.unregister()); >+ >+ await wait_for_state(t, registration.installing, 'activated'); >+ >+ const iframe = await with_iframe(scope); >+ t.add_cleanup(() => iframe.remove()); >+ >+ await registration.unregister(); >+ >+ const newRegistration = await navigator.serviceWorker.register( >+ 'resources/reject-install-worker.js', { scope } >+ ); >+ t.add_cleanup(() => newRegistration.unregister()); >+ >+ await wait_for_state(t, newRegistration.installing, 'redundant'); >+ >+ assert_equals(registration.installing, null, 'registration.installing'); >+ assert_equals(registration.waiting, null, 'registration.waiting'); >+ assert_equals(registration.active, null, 'registration.active'); >+ assert_not_equals(registration, newRegistration, 'New registration is different'); >+}, 'Registering a new script URL that fails to install does not resurrect unregistered registration'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register.https-expected.txt >index 5e6c2be566c3ba71d82685bbac95dfa18e20bec6..e350cb038a0f0ec84727c313b4ffdb24361a19fc 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register.https-expected.txt >@@ -1,8 +1,6 @@ > >- > PASS Unregister then register resolves to a new value >-PASS Unregister then register resolves to the original value if the registration is in use. >-PASS Reloading the last controlled iframe after unregistration should ensure the deletion of the registration >+FAIL Unregister then register does not resolve to the original value even if the registration is in use. assert_not_equals: Unregister and register should always create a new registration got disallowed value object "[object ServiceWorkerRegistration]" > PASS Unregister then register does not affect existing controllee >-PASS Unregister then register resurrects the registration >+FAIL Unregister then register does not resurrect the registration assert_equals: Registration is new expected null but got object "[object ServiceWorker]" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register.https.html >index 303b2be2b7d1dca0d69d84ae561a582421061622..5fd2cf970950bf94968867c75c41e0aa97205f76 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register.https.html >@@ -5,100 +5,40 @@ > <script> > var worker_url = 'resources/empty-worker.js'; > >-promise_test(function(t) { >- var scope = 'resources/scope/re-register-resolves-to-new-value'; >- var registration; >+promise_test(async function(t) { >+ const scope = 'resources/scope/re-register-resolves-to-new-value'; >+ const registration = await service_worker_unregister_and_register(t, worker_url, scope); >+ t.add_cleanup(() => registration.unregister()); > >- return service_worker_unregister_and_register(t, worker_url, scope) >- .then(function(r) { >- t.add_cleanup(function() { >- return service_worker_unregister(t, scope); >- }); >+ await wait_for_state(t, registration.installing, 'activated'); >+ await registration.unregister(); >+ const newRegistration = await navigator.serviceWorker.register(worker_url, { scope }); >+ t.add_cleanup(() => newRegistration.unregister()); > >- registration = r; >- return wait_for_state(t, r.installing, 'activated'); >- }) >- .then(function() { >- return registration.unregister(); >- }) >- .then(function() { >- return navigator.serviceWorker.register(worker_url, { scope: scope }); >- }) >- .then(function(new_registration) { >- assert_not_equals(registration, new_registration, >- 'register should resolve to a new value'); >- }); >+ assert_not_equals( >+ registration, newRegistration, >+ 'register should resolve to a new value' >+ ); > }, 'Unregister then register resolves to a new value'); > >-promise_test(function(t) { >- var scope = 'resources/scope/re-register-while-old-registration-in-use'; >- var registration; >+promise_test(async function(t) { >+ const scope = 'resources/scope/re-register-while-old-registration-in-use'; >+ const registration = await service_worker_unregister_and_register(t, worker_url, scope); >+ t.add_cleanup(() => registration.unregister()); > >- return service_worker_unregister_and_register(t, worker_url, scope) >- .then(function(r) { >- t.add_cleanup(function() { >- return service_worker_unregister(t, scope); >- }); >+ await wait_for_state(t, registration.installing, 'activated'); >+ const frame = await with_iframe(scope); >+ t.add_cleanup(() => frame.remove()); > >- registration = r; >- return wait_for_state(t, r.installing, 'activated'); >- }) >- .then(function() { >- return with_iframe(scope); >- }) >- .then(function(frame) { >- return registration.unregister(); >- }) >- .then(function() { >- return navigator.serviceWorker.register(worker_url, { scope: scope }); >- }) >- .then(function(new_registration) { >- assert_equals(registration, new_registration, >- 'new registration should resolve to the same registration'); >- }); >- }, 'Unregister then register resolves to the original value if the ' + >- 'registration is in use.'); >+ await registration.unregister(); >+ const newRegistration = await navigator.serviceWorker.register(worker_url, { scope }); >+ t.add_cleanup(() => newRegistration.unregister()); > >-promise_test(function(t) { >- var scope = 'resources/scope/complete-unregistration-followed-by-' + >- 'reloading-controllee-iframe'; >- var registration; >- var frame; >- var service_worker; >- return service_worker_unregister_and_register(t, worker_url, scope) >- .then(function(r) { >- t.add_cleanup(function() { >- return service_worker_unregister(t, scope); >- }); >- >- registration = r; >- return wait_for_state(t, r.installing, 'activated'); >- }) >- .then(function() { >- return with_iframe(scope); >- }) >- .then(function(f) { >- frame = f; >- return registration.unregister(); >- }) >- .then(function() { >- return new Promise(function(resolve) { >- frame.onload = resolve; >- frame.contentWindow.location.reload(); >- }); >- }) >- .then(function() { >- var c = frame.contentWindow.navigator.serviceWorker.controller; >- assert_equals(c, null, 'a page after unregistration should not be ' + >- 'controlled by service worker'); >- return navigator.serviceWorker.getRegistration(scope); >- }) >- .then(function(r) { >- assert_equals(r, undefined, 'getRegistration should return ' + >- 'undefined after unregistration'); >- }); >-}, 'Reloading the last controlled iframe after unregistration should ensure ' + >- 'the deletion of the registration'); >+ assert_not_equals( >+ registration, newRegistration, >+ 'Unregister and register should always create a new registration' >+ ); >+}, 'Unregister then register does not resolve to the original value even if the registration is in use.'); > > promise_test(function(t) { > var scope = 'resources/scope/re-register-does-not-affect-existing-controllee'; >@@ -109,8 +49,8 @@ promise_test(function(t) { > return service_worker_unregister_and_register(t, worker_url, scope) > .then(function(r) { > t.add_cleanup(function() { >- return service_worker_unregister(t, scope); >- }); >+ return service_worker_unregister(t, scope); >+ }); > > registration = r; > return wait_for_state(t, r.installing, 'activated'); >@@ -138,39 +78,30 @@ promise_test(function(t) { > }); > }, 'Unregister then register does not affect existing controllee'); > >-promise_test(function(t) { >- var scope = 'resources/scope/resurrection'; >- var iframe; >- var registration; >+promise_test(async function(t) { >+ const scope = 'resources/scope/resurrection'; >+ const altWorkerURL = worker_url + '?alt'; >+ const registration = await service_worker_unregister_and_register(t, worker_url, scope); >+ t.add_cleanup(() => registration.unregister()); > >- return service_worker_unregister_and_register(t, worker_url, scope) >- .then(function(r) { >- t.add_cleanup(function() { >- return service_worker_unregister(t, scope); >- }); >+ await wait_for_state(t, registration.installing, 'activating'); >+ const iframe = await with_iframe(scope); >+ t.add_cleanup(() => iframe.remove()); > >- registration = r; >- return wait_for_state(t, r.installing, 'activated'); >- }) >- .then(function() { >- return with_iframe(scope); >- }) >- .then(function(frame) { >- iframe = frame; >- return registration.unregister(); >- }) >- .then(function() { >- return navigator.serviceWorker.register(worker_url, { scope: scope }); >- }) >- .then(function() { >- iframe.remove(); >- return with_iframe(scope); >- }) >- .then(function(frame) { >- assert_not_equals( >- frame.contentWindow.navigator.serviceWorker.controller, null, >- 'document should have a controller'); >- frame.remove(); >- }); >- }, 'Unregister then register resurrects the registration'); >+ await registration.unregister(); >+ const newRegistration = await navigator.serviceWorker.register(altWorkerURL, { scope }); >+ t.add_cleanup(() => newRegistration.unregister()); >+ >+ assert_equals(newRegistration.active, null, 'Registration is new'); >+ >+ await wait_for_state(t, newRegistration.installing, 'activating'); >+ >+ const newIframe = await with_iframe(scope); >+ t.add_cleanup(() => newIframe.remove()); >+ >+ const iframeController = iframe.contentWindow.navigator.serviceWorker.controller; >+ const newIframeController = newIframe.contentWindow.navigator.serviceWorker.controller; >+ >+ assert_not_equals(iframeController, newIframeController, 'iframes have different controllers'); >+}, 'Unregister then register does not resurrect the registration'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-redirect.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-redirect.https.html >index 321e40ca945e72a51d6f4994def2b1d1aef99751..6e821fe479f273f7b17fd8d91e681ecd283a933d 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-redirect.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-redirect.https.html >@@ -1,6 +1,7 @@ > <!DOCTYPE html> > <meta charset="utf-8"> > <title>Service Worker: Update should be triggered after redirects during navigation</title> >+<meta name="timeout" content="long"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="resources/test-helpers.sub.js"></script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-after-oneday.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-after-oneday.https.html >index 08065d22ce46cc8a3b5916f1c053f477f4414698..d9b9fcfb8db37ea3b0d571250b22b88ca7354772 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-after-oneday.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-after-oneday.https.html >@@ -17,6 +17,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, expected_url, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > registration = r; > return wait_for_state(t, registration.installing, 'activated'); > }) >@@ -41,7 +45,6 @@ promise_test(function(t) { > }) > .then(function() { > frame.remove(); >- return service_worker_unregister_and_done(t, scope); > }) > }, 'Update should be triggered after a functional event when last update time is over 24 hours'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-bytecheck.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-bytecheck.https.html >index ec3d15abec09ca5f5e3db9e2c8ac2e9040ffe7fe..6628dba6ee7d11ae0cd45941c726df017afb9336 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-bytecheck.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-bytecheck.https.html >@@ -1,6 +1,7 @@ > <!doctype html> > <meta charset=utf-8> > <title></title> >+<meta name="timeout" content="long"> > <script src="/resources/testharness.js"></script> > <script src="resources/testharness-helpers.js"></script> > <script src="/resources/testharnessreport.js"></script> >@@ -43,8 +44,11 @@ settings.reduce((p, s) => { > return Promise.resolve() > // Register a service worker. > .then(_ => service_worker_unregister_and_register(t, script, scope)) >- .then(r => swr = r) >- .then(_ => wait_for_update(t, swr)) >+ .then(r => { >+ t.add_cleanup(() => service_worker_unregister(t, scope)); >+ swr = r; >+ return wait_for_update(t, swr); >+ }) > .then(w => sw = w) > .then(_ => wait_for_state(t, sw, 'activated')) > .then(_ => assert_array_equals([swr.active, >@@ -64,10 +68,7 @@ settings.reduce((p, s) => { > swr.waiting, > swr.installing], > [sw, null, null]); >- }) >- >- // Unregister the service worker. >- .then(_ => service_worker_unregister_and_done(t, scope)); >+ }); > }, `Test(cors: ${s.cors}, main: ${s.main}, imported: ${s.imported})`)); > }, Promise.resolve()); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-no-cache-request-headers.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-no-cache-request-headers.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b5516d64611d9a29e12fe6eacefce1a6cfe0b402 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-no-cache-request-headers.https-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS headers in no-cache mode >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-no-cache-request-headers.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-no-cache-request-headers.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..6ebad4b7b10bcdf176c1543fd711aee31d5547b7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-no-cache-request-headers.https.html >@@ -0,0 +1,48 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Test that cache is being bypassed/validated in no-cache mode on update</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="resources/test-helpers.sub.js"></script> >+<script> >+// Tests a service worker script fetch during an update check which >+// bypasses/validates the browser cache. The fetch should have the >+// 'if-none-match' request header. >+// >+// This tests the Update step: >+// "Set request’s cache mode to "no-cache" if any of the following are true..." >+// https://w3c.github.io/ServiceWorker/#update-algorithm >+// >+// The test works by registering a service worker with |updateViaCache| >+// set to "none". It then does an update. The test server responds with >+// an updated worker script that remembers the http request headers. >+// The updated worker reports back these headers to the test page. >+promise_test(async (t) => { >+ const script = "resources/test-request-headers-worker.py"; >+ const scope = "resources/"; >+ >+ // Register the service worker. >+ await service_worker_unregister(t, scope); >+ const registration = await navigator.serviceWorker.register( >+ script, {scope, updateViaCache: 'none'}); >+ await wait_for_state(t, registration.installing, 'activated'); >+ >+ // Do an update. >+ await registration.update(); >+ >+ // Ask the new worker what the request headers were. >+ const newWorker = registration.installing; >+ const sawMessage = new Promise((resolve) => { >+ navigator.serviceWorker.onmessage = (event) => { >+ resolve(event.data); >+ }; >+ }); >+ newWorker.postMessage('getHeaders'); >+ const result = await sawMessage; >+ >+ // Test the result. >+ assert_equals(result['service-worker'], 'script'); >+ assert_equals(result['if-none-match'], 'etag'); >+}, 'headers in no-cache mode'); >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-not-allowed.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-not-allowed.https.html >index 71fe1730e0d68e4e7e0949cfa408d3c2d4ed9d39..0a54aa9350382bb082f407a1ea30b265575baae9 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-not-allowed.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-not-allowed.https.html >@@ -5,54 +5,136 @@ > <script> > 'use strict'; > >+function send_message_to_worker_and_wait_for_response(worker, message) { >+ return new Promise(resolve => { >+ // Use a dedicated channel for every request to avoid race conditions on >+ // concurrent requests. >+ const channel = new MessageChannel(); >+ worker.postMessage(channel.port1, [channel.port1]); >+ >+ let messageReceived = false; >+ channel.port2.onmessage = event => { >+ assert_false(messageReceived, 'Already received response for ' + message); >+ messageReceived = true; >+ resolve(event.data); >+ }; >+ channel.port2.postMessage(message); >+ }); >+} >+ >+async function ensure_install_event_fired(worker) { >+ const response = await send_message_to_worker_and_wait_for_response(worker, 'awaitInstallEvent'); >+ assert_equals('installEventFired', response); >+ assert_equals('installing', worker.state, 'Expected worker to be installing.'); >+} >+ >+async function finish_install(worker) { >+ await ensure_install_event_fired(worker); >+ const response = await send_message_to_worker_and_wait_for_response(worker, 'finishInstall'); >+ assert_equals('installFinished', response); >+} >+ >+async function activate_service_worker(t, worker) { >+ await finish_install(worker); >+ // By waiting for both states at the same time, the test fails >+ // quickly if the installation fails, avoiding a timeout. >+ await Promise.race([wait_for_state(t, worker, 'activated'), >+ wait_for_state(t, worker, 'redundant')]); >+ assert_equals('activated', worker.state, 'Service worker should be activated.'); >+} >+ >+async function update_within_service_worker(worker) { >+ // This function returns a Promise that resolves when update() >+ // has been called but is not necessarily finished yet. >+ // Call finish() on the returned object to wait for update() settle. >+ const port = await send_message_to_worker_and_wait_for_response(worker, 'callUpdate'); >+ let messageReceived = false; >+ return { >+ finish: () => { >+ return new Promise(resolve => { >+ port.onmessage = event => { >+ assert_false(messageReceived, 'Update already finished.'); >+ messageReceived = true; >+ resolve(event.data); >+ }; >+ }); >+ }, >+ }; >+} >+ >+async function update_from_client_and_await_installing_version(test, registration) { >+ const updatefound = wait_for_update(test, registration); >+ registration.update(); >+ await updatefound; >+ return registration.installing; >+} >+ > async function spin_up_service_worker(test) { >- const script = 'resources/update-during-installation-worker.js'; >- const scope = 'resources/blank.html'; >- >- let registration = await service_worker_unregister_and_register(test, script, scope); >- test.add_cleanup(() => { >- if (registration.installing) { >- registration.installing.postMessage('finishInstall'); >- } >- registration.unregister(); >- }); >- >- return registration; >+ const script = 'resources/update-during-installation-worker.py'; >+ const scope = 'resources/blank.html'; >+ >+ const registration = await service_worker_unregister_and_register(test, script, scope); >+ test.add_cleanup(async () => { >+ if (registration.installing) { >+ // If there is an installing worker, we need to finish installing it. >+ // Otherwise, the tests fails with an timeout because unregister() blocks >+ // until the install-event-handler finishes. >+ const worker = registration.installing; >+ await send_message_to_worker_and_wait_for_response(worker, 'awaitInstallEvent'); >+ await send_message_to_worker_and_wait_for_response(worker, 'finishInstall'); >+ } >+ return registration.unregister(); >+ }); >+ >+ return registration; > } > > promise_test(async t => { >- const registration = await spin_up_service_worker(t); >- const worker = registration.installing; >+ const registration = await spin_up_service_worker(t); >+ const worker = registration.installing; >+ await ensure_install_event_fired(worker); > >- // spin_up_service_worker installs a cleanup hook that ensures the >- // worker finished its installation by sending it a >- // 'finishInstall' message, thus making sure that the registration >- // will be cleanly removed at the end of the test. >- assert_equals(worker.state, 'installing'); >- promise_rejects(t, 'InvalidStateError', registration.update()); >-}, 'ServiceWorkerRegistration.update() from client throws while installing service worker.') >+ const result = registration.update(); >+ await activate_service_worker(t, worker); >+ return result; >+}, 'ServiceWorkerRegistration.update() from client succeeds while installing service worker.'); > > promise_test(async t => { >- const registration = await spin_up_service_worker(t); >- const worker = registration.installing; >- worker.postMessage('finishInstall'); >- >- // By waiting for both states at the same time, the test fails >- // quickly if the installation fails, avoiding a timeout. >- await Promise.race([wait_for_state(t, worker, 'activated'), >- wait_for_state(t, worker, 'redundant')]); >- assert_equals(worker.state, 'activated', 'Service worker should be activated.'); >- >- const response = await new Promise(resolve => { >- navigator.serviceWorker.onmessage = event => { resolve(event.data); }; >- worker.postMessage('PING'); >- }); >- >- // We check that the service worker instance that replied to the >- // message is the same one that received the 'install' event since >- // it's possible for them to be two distinct execution >- // environments. >- assert_true(response.installEventFired, 'Service worker should have been installed.'); >- assert_equals(response.exception, 'InvalidStateError', 'update() should have thrown.'); >+ const registration = await spin_up_service_worker(t); >+ const worker = registration.installing; >+ await ensure_install_event_fired(worker); >+ >+ // Add event listener to fail the test if update() succeeds. >+ const updatefound = t.step_func(async () => { >+ registration.removeEventListener('updatefound', updatefound); >+ // Activate new worker so non-compliant browsers don't fail with timeout. >+ await activate_service_worker(t, registration.installing); >+ assert_unreached("update() should have failed"); >+ }); >+ registration.addEventListener('updatefound', updatefound); >+ >+ const update = await update_within_service_worker(worker); >+ // Activate worker to ensure update() finishes and the test doesn't timeout >+ // in non-compliant browsers. >+ await activate_service_worker(t, worker); >+ >+ const response = await update.finish(); >+ assert_false(response.success, 'update() should have failed.'); >+ assert_equals('InvalidStateError', response.exception, 'update() should have thrown InvalidStateError.'); > }, 'ServiceWorkerRegistration.update() from installing service worker throws.'); >+ >+promise_test(async t => { >+ const registration = await spin_up_service_worker(t); >+ const worker1 = registration.installing; >+ await activate_service_worker(t, worker1); >+ >+ const worker2 = await update_from_client_and_await_installing_version(t, registration); >+ await ensure_install_event_fired(worker2); >+ >+ const update = await update_within_service_worker(worker1); >+ // Activate the new version so that update() finishes and the test doesn't timeout. >+ await activate_service_worker(t, worker2); >+ const response = await update.finish(); >+ assert_true(response.success, 'update() from active service worker should have succeeded.'); >+}, 'ServiceWorkerRegistration.update() from active service worker succeeds while installing service worker.'); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https-expected.txt >index c1cc737a0f8347bf14550909a2de6fe4859c7737..327b770704feb76a1e4a378fffc57d619f8152e5 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https-expected.txt >@@ -1,6 +1,6 @@ > >-FAIL Update the registration with a different script type (classic => module). promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: guid" >-FAIL Update the registration with a different script type (module => classic). promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: guid" >+FAIL Update the registration with a different script type (classic => module). promise_test: Unhandled rejection with value: object "TypeError: null is not an object (evaluating 'secondWorker.postMessage')" >+FAIL Update the registration with a different script type (module => classic). promise_test: Unhandled rejection with value: object "TypeError: SyntaxError: Unexpected token '*'. import call expects exactly one argument." > PASS Update the registration with a different script type (classic => module) and with a same main script. > PASS Update the registration with a different script type (module => classic) and with a same main script. > PASS Does not update the registration with the same script type and the same main script. >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https.html >index b712c30f71e9a81a2832c0cd5afe7f5630e34071..e7d3692812eb8a24f253b87e157f4a4366e3098e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https.html >@@ -2,7 +2,7 @@ > <meta charset="utf-8"> > <title>Service Worker: Update the registration with a different script type.</title> > <!-- common.js is for guid() --> >-<script src="/mixed-content/generic/common.js"></script> >+<script src="/common/security-features/resources/common.js"></script> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="resources/test-helpers.sub.js"></script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/w3c-import.log >index 185d577742c8c381dce34d0596261ae2c5dd7431..a33ef05b4bc07728b198763fe9bff14493de8a0f 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/w3c-import.log >@@ -22,6 +22,7 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/active.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/appcache-ordering-main.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-affect-other-registration.https.html >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch-with-appcache.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-not-using-registration.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-shared-worker-fetch.https.html >@@ -32,6 +33,7 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/client-navigate.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-client-types.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-cross-origin.https.html >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-resultingClientId.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-exact-controller.https.html >@@ -43,6 +45,7 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controller-on-load.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controller-on-reload.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controller-with-no-fetch-event-handler.https.html >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/data-transfer-files.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/dedicated-worker-service-worker-interception.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/detached-context.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/embed-and-object-are-not-intercepted.https.html >@@ -147,6 +150,7 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-events.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-iframe.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-mime-types.https.html >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-schedule-job.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-scope.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-script-url.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-script.https.html >@@ -156,7 +160,7 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/rejections.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/request-end-to-end.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing-cross-origin.https.html >-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.https.html >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/respond-with-body-accessed-response.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-navigator-serviceworker.https.html >@@ -186,7 +190,9 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-after-oneday.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-bytecheck.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-missing-import-scripts.https.html >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-no-cache-request-headers.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-not-allowed.https.html >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-on-navigation.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-recovery.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-result.https.html >@@ -200,3 +206,5 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-in-sandboxed-iframe-by-csp-fetch-event.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception-redirect.https.html > /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception.https.html >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xhr-response-url.https.html >+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xsl-base-url.https.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/websocket.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/websocket.https-expected.txt >index f1af46834dbcca9eff757bb4de4d8f9c9c769b36..ccd376fbd140e6cc251a520642730dc1a9e8678f 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/websocket.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/websocket.https-expected.txt >@@ -2,5 +2,5 @@ CONSOLE MESSAGE: WebSocket network error: OSStatus Error -9807: Invalid certific > CONSOLE MESSAGE: WebSocket network error: OSStatus Error -9807: Invalid certificate chain > > >-FAIL Verify WebSocket handshake channel does not get intercepted assert_unreached: unexpected rejection: [object Event] Reached unreachable code >+FAIL Verify WebSocket handshake channel does not get intercepted promise_test: Unhandled rejection with value: object "[object Event]" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/windowclient-navigate.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/windowclient-navigate.https.html >index 8ea279ef075e5e6c8904966b005f0baf0d75bca9..e62c1ac3aa40e0c412a736e79a77515348398a2c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/windowclient-navigate.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/windowclient-navigate.https.html >@@ -109,7 +109,7 @@ function navigate_test(override_parameters) { > }); > } > >- var cleanup = function() { >+ test.add_cleanup(function() { > if (client_frame && client_frame) { > client_frame.remove(); > } >@@ -127,9 +127,9 @@ function navigate_test(override_parameters) { > if (registration) { > return registration.unregister(); > } >- }; >+ }); > >- var test_body = with_iframe(parameters.src_url) >+ return with_iframe(parameters.src_url) > .then(function(frame) { > client_frame = frame; > return service_worker_unregister_and_register( >@@ -161,17 +161,6 @@ function navigate_test(override_parameters) { > .then(function(response) { > assert_equals(response.data, parameters.expected); > }); >- >- // Ensure that test "clean up" is deferred until after the test body >- // executes. `Test#add_cleanup` cannot be used for this purpose because the >- // operation is asynchronous, and `add_cleanup` does not support >- // asynchronous operations at the time of this writing. See >- // https://github.com/web-platform-tests/wpt/issues/6075 >- // Ensure also that test failure is not hidden by successful cleanup >- // operation. >- return test_body >- .then(cleanup, cleanup) >- .then(function() { return test_body; }); > }, parameters.description); > } > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception.https-expected.txt >index 45e229e7281ce0e10ad376e8d5ce2e4820759209..b4ed4ee9a1745ec32816adc1dcdcbbfa8f71c029 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception.https-expected.txt >@@ -1,8 +1,8 @@ >- >+CONSOLE MESSAGE: line 1: ReferenceError: Can't find variable: Worker > > FAIL Verify worker script from uncontrolled document is intercepted by Service Worker promise_test: Unhandled rejection with value: undefined > FAIL Verify worker script intercepted by same-origin response succeeds promise_test: Unhandled rejection with value: undefined > PASS Verify worker script intercepted by cors response fails > PASS Verify worker script intercepted by no-cors cross-origin response fails >-PASS Verify worker loads from controlled document are intercepted by Service Worker >+FAIL Verify worker loads from controlled document are intercepted by Service Worker assert_equals: expected "finish" but got "failure:[object ErrorEvent]" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception.https.html >index bf976a29c48a3810ef4ff20b5c7e8b70dec2b219..7b2941263bf756c33e6d15b36ed96548f886c6c2 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception.https.html >@@ -12,6 +12,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, service_worker, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, r.installing, 'activated'); > }) > .then(function() { >@@ -28,7 +32,6 @@ promise_test(function(t) { > }) > .then(function(data) { > assert_equals(data, 'worker loading intercepted by service worker'); >- service_worker_unregister_and_done(t, scope); > }); > }, 'Verify worker script from uncontrolled document is intercepted by Service Worker'); > >@@ -39,6 +42,10 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, service_worker, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, r.installing, 'activated'); > }) > .then(function() { >@@ -55,7 +62,6 @@ promise_test(function(t) { > }) > .then(function(data) { > assert_equals(data, 'dummy-worker-script loaded'); >- service_worker_unregister_and_done(t, scope); > }); > }, 'Verify worker script intercepted by same-origin response succeeds'); > >@@ -72,10 +78,7 @@ promise_test(function(t) { > var w = new Worker(worker_url); > var watcher = new EventWatcher(t, w, ['message', 'error']); > return watcher.wait_for('error'); >- }) >- .then(function() { >- service_worker_unregister_and_done(t, scope); >- }); >+ }); > }, 'Verify worker script intercepted by cors response fails'); > > promise_test(function(t) { >@@ -85,16 +88,17 @@ promise_test(function(t) { > > return service_worker_unregister_and_register(t, service_worker, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, r.installing, 'activated'); > }) > .then(function() { > var w = new Worker(worker_url); > var watcher = new EventWatcher(t, w, ['message', 'error']); > return watcher.wait_for('error'); >- }) >- .then(function() { >- service_worker_unregister_and_done(t, scope); >- }); >+ }); > }, 'Verify worker script intercepted by no-cors cross-origin response fails'); > > promise_test(function(t) { >@@ -102,14 +106,12 @@ promise_test(function(t) { > var service_worker = 'resources/worker-load-interceptor.js'; > var scope = 'resources/'; > >- window.addEventListener('message', t.step_func(on_message), false); >- function on_message(e) { >- assert_equals(e.data.results, "This load was successfully intercepted."); >- t.done(); >- } >- > return service_worker_unregister_and_register(t, service_worker, scope) > .then(function(r) { >+ t.add_cleanup(function() { >+ return service_worker_unregister(t, scope); >+ }); >+ > return wait_for_state(t, r.installing, 'activated'); > }) > .then(function() { return with_iframe(subdoc_url); }) >@@ -126,7 +128,6 @@ promise_test(function(t) { > }) > .then(function(data) { > assert_equals(data.results, 'finish'); >- service_worker_unregister_and_done(t, scope); > }); > }, 'Verify worker loads from controlled document are intercepted by Service Worker'); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xhr-response-url.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xhr-response-url.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c31fc556a50f86ec24296835a6ffc1de3fe6f503 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xhr-response-url.https-expected.txt >@@ -0,0 +1,8 @@ >+ >+PASS global setup >+PASS XHR responseURL should be the response URL >+PASS XHR responseURL should be the response URL (generated response) >+FAIL XHR Document should use the response URL assert_equals: responseXML.URL expected "https://localhost:9443/service-workers/service-worker/resources/blank.html" but got "https://localhost:9443/service-workers/service-worker/test?respondWith=fetch&url=https%3A%2F%2Flocalhost%3A9443%2Fservice-workers%2Fservice-worker%2Fresources%2Fblank.html" >+PASS XHR Document should use the response URL (generated response) >+PASS global cleanup >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xhr-response-url.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xhr-response-url.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1ad2ce3851cc7bce24120dd80bdf54662781ac66 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xhr-response-url.https.html >@@ -0,0 +1,103 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Service Worker: XHR responseURL uses the response url</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="resources/test-helpers.sub.js"></script> >+<script> >+const scope = 'resources/xhr-iframe.html'; >+const script = 'resources/xhr-response-url-worker.js'; >+let iframe; >+ >+function build_url(options) { >+ const url = new URL('test', window.location); >+ const opts = options ? options : {}; >+ if (opts.respondWith) >+ url.searchParams.set('respondWith', opts.respondWith); >+ if (opts.url) >+ url.searchParams.set('url', opts.url.href); >+ return url.href; >+} >+ >+promise_test(async (t) => { >+ const registration = >+ await service_worker_unregister_and_register(t, script, scope); >+ await wait_for_state(t, registration.installing, 'activated'); >+ iframe = await with_iframe(scope); >+}, 'global setup'); >+ >+// Test that XMLHttpRequest.responseURL uses the response URL from the service >+// worker. >+promise_test(async (t) => { >+ // Build a URL that tells the service worker to respondWith(fetch(|target|)). >+ const target = new URL('resources/dummy.txt', window.location); >+ const url = build_url({ >+ respondWith: 'fetch', >+ url: target >+ }); >+ >+ // Perform the XHR. >+ const xhr = await iframe.contentWindow.xhr(url); >+ assert_equals(xhr.responseURL, target.href, 'responseURL'); >+}, 'XHR responseURL should be the response URL'); >+ >+// Same as above with a generated response. >+promise_test(async (t) => { >+ // Build a URL that tells the service worker to respondWith(new Response()). >+ const url = build_url({respondWith: 'string'}); >+ >+ // Perform the XHR. >+ const xhr = await iframe.contentWindow.xhr(url); >+ assert_equals(xhr.responseURL, url, 'responseURL'); >+}, 'XHR responseURL should be the response URL (generated response)'); >+ >+// Test that XMLHttpRequest.responseXML is a Document whose URL is the >+// response URL from the service worker. >+promise_test(async (t) => { >+ // Build a URL that tells the service worker to respondWith(fetch(|target|)). >+ const target = new URL('resources/blank.html', window.location); >+ const url = build_url({ >+ respondWith: 'fetch', >+ url: target >+ }); >+ >+ // Perform the XHR. >+ const xhr = await iframe.contentWindow.xhr(url, {responseType: 'document'}); >+ assert_equals(xhr.responseURL, target.href, 'responseURL'); >+ >+ // The document's URL uses the response URL: >+ // "Set |document|’s URL to |response|’s url." >+ // https://xhr.spec.whatwg.org/#document-response >+ assert_equals(xhr.responseXML.URL, target.href, 'responseXML.URL'); >+ >+ // The document's base URL falls back to the document URL: >+ // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url >+ assert_equals(xhr.responseXML.baseURI, target.href, 'responseXML.baseURI'); >+}, 'XHR Document should use the response URL'); >+ >+// Same as above with a generated response from the service worker. >+promise_test(async (t) => { >+ // Build a URL that tells the service worker to >+ // respondWith(new Response()) with a document response. >+ const url = build_url({respondWith: 'document'}); >+ >+ // Perform the XHR. >+ const xhr = await iframe.contentWindow.xhr(url, {responseType: 'document'}); >+ assert_equals(xhr.responseURL, url, 'responseURL'); >+ >+ // The document's URL uses the response URL, which is the request URL: >+ // "Set |document|’s URL to |response|’s url." >+ // https://xhr.spec.whatwg.org/#document-response >+ assert_equals(xhr.responseXML.URL, url, 'responseXML.URL'); >+ >+ // The document's base URL falls back to the document URL: >+ // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url >+ assert_equals(xhr.responseXML.baseURI, url, 'responseXML.baseURI'); >+}, 'XHR Document should use the response URL (generated response)'); >+ >+promise_test(async (t) => { >+ if (iframe) >+ iframe.remove(); >+ await service_worker_unregister(t, scope); >+}, 'global cleanup'); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xsl-base-url.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xsl-base-url.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b59be6912d34fd8e102adccd904e14249708691f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xsl-base-url.https-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS base URL when service worker does respondWith(fetch(responseUrl)) >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xsl-base-url.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xsl-base-url.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1d3c36408a66a7785b884c9cdc39dcd2820f9af0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xsl-base-url.https.html >@@ -0,0 +1,32 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Service Worker: XSL's base URL must be the response URL</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="resources/test-helpers.sub.js?pipe=sub"></script> >+<script> >+// This test loads an XML document which is controlled a service worker. The >+// document loads a stylesheet and a service worker responds with another URL. >+// The stylesheet imports a relative URL to test that the base URL is the >+// response URL from the service worker. >+promise_test(async (t) => { >+ const SCOPE = 'resources/xsl-base-url-iframe.xml'; >+ const SCRIPT = 'resources/xsl-base-url-worker.js'; >+ let worker; >+ let frame; >+ >+ t.add_cleanup(() => { >+ if (frame) >+ frame.remove(); >+ service_worker_unregister(t, SCOPE); >+ }); >+ >+ const registration = await service_worker_unregister_and_register( >+ t, SCRIPT, SCOPE); >+ worker = registration.installing; >+ await wait_for_state(t, worker, 'activated'); >+ >+ frame = await with_iframe(SCOPE); >+ assert_equals(frame.contentDocument.body.textContent, 'PASS'); >+}, 'base URL when service worker does respondWith(fetch(responseUrl))'); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1-service-worker-obj-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1-service-worker-obj-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..791b1a1ff72db568b26259d5c009fb364a77adc1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1-service-worker-obj-expected.txt >@@ -0,0 +1,25 @@ >+CONSOLE MESSAGE: line 867: Invalid object member name ServiceWorkerState >+ >+Harness Error (FAIL), message = Invalid object member name ServiceWorkerState >+ >+FAIL ServiceWorker interface: existence and properties of interface object assert_equals: prototype of ServiceWorker is not Worker expected function "function Worker() { >+ [native code] >+}" but got function "function EventTarget() { >+ [native code] >+}" >+PASS ServiceWorker interface object length >+PASS ServiceWorker interface object name >+FAIL ServiceWorker interface: existence and properties of interface prototype object assert_equals: prototype of ServiceWorker.prototype is not Worker.prototype expected object "[object WorkerPrototype]" but got object "[object EventTargetPrototype]" >+PASS ServiceWorker interface: existence and properties of interface prototype object's "constructor" property >+PASS ServiceWorker interface: existence and properties of interface prototype object's @@unscopables property >+FAIL ServiceWorker interface: attribute scope assert_true: The prototype object must have a property "scope" expected true got false >+FAIL ServiceWorker interface: attribute url assert_true: The prototype object must have a property "url" expected true got false >+PASS ServiceWorker interface: attribute state >+PASS ServiceWorker interface: attribute onstatechange >+FAIL ServiceWorker must be primary interface of throw new Error ('No object defined for the ServiceWorker interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorker interface" >+FAIL Stringification of throw new Error ('No object defined for the ServiceWorker interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorker interface" >+FAIL ServiceWorker interface: throw new Error ('No object defined for the ServiceWorker interface') must inherit property "scope" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorker interface" >+FAIL ServiceWorker interface: throw new Error ('No object defined for the ServiceWorker interface') must inherit property "url" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorker interface" >+FAIL ServiceWorker interface: throw new Error ('No object defined for the ServiceWorker interface') must inherit property "state" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorker interface" >+FAIL ServiceWorker interface: throw new Error ('No object defined for the ServiceWorker interface') must inherit property "onstatechange" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorker interface" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1-service-worker-obj.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1-service-worker-obj.html >new file mode 100644 >index 0000000000000000000000000000000000000000..99c2cbe8597d7391defdd2057ef466a2445cec73 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1-service-worker-obj.html >@@ -0,0 +1,63 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: ServiceWorker</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-obj"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ <script src=/resources/WebIDLParser.js></script> >+ <script src=/resources/idlharness.js></script> >+ >+ </head> >+ <body> >+ >+<script type=text/plain id="idl_0"> >+[Constructor()] // no-op constructor >+interface ServiceWorker : Worker { >+ readonly attribute DOMString scope; >+ readonly attribute DOMString url; >+ readonly attribute ServiceWorkerState state; >+ >+ // event >+ attribute EventHandler onstatechange; >+}; >+ >+enum ServiceWorkerState { >+ "installing", >+ "installed", >+ "activating", >+ "activated", >+ "redundant" >+}; >+</script> >+ >+<!-- >+The `ServiceWorker` interface represents the document-side view of a Service >+Worker. This object provides a no-op constructor. Callers should note that only >+`ServiceWorker` objects created by the user agent (see >+`navigator.serviceWorker.installing`, `navigator.serviceWorker.waiting`, >+`navigator.serviceWorker.active` and `navigator.serviceWorker.controller`) will >+provide meaningful functionality. >+--> >+ >+ >+ <script type=text/plain id="untested_idls"> >+ interface EventHandler {}; >+ interface Worker {}; >+ </script> >+ >+ <script> >+ var idl_array = new IdlArray(); >+ idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); >+ idl_array.add_idls(document.getElementById("idl_0").textContent); >+ idl_array.add_objects({ >+ ServiceWorker: ["throw new Error ('No object defined for the ServiceWorker interface')"], >+ ServiceWorkerState: ["throw new Error ('No object defined for the ServiceWorkerState enum')"] >+ }); >+ idl_array.test(); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.1-service-worker-scope-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.1-service-worker-scope-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1101e195972a92286379a9fbd4bdfd4cd788e0fc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.1-service-worker-scope-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section scope so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.1-service-worker-scope.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.1-service-worker-scope.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8c75c608297a3dcf14d03d60ebc624ea233b6427 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.1-service-worker-scope.html >@@ -0,0 +1,46 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: scope</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-scope"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+The `scope` of a `ServiceWorker` object reflects the [URL scope][1] of the >+associated Service Worker [registration][2]. The `scope` attribute must return >+the [serialization][3] of the URL representing the [URL scope][1] of the >+associated Service Worker [registration][2]. >+ >+For example, consider a document created by a navigation to >+`https://example.com/app.html` which [matches][4] via the following >+registration call which has been previously executed: >+// Script on the page https://example.com/app.html >+navigator.serviceWorker.register("/service_worker.js", { scope: "/*" }); >+The value of `navigator.serviceWorker.controller.scope` will be >+`"https://example.com/*"`. >+ >+ >+ >+[1]: #url-scope >+[2]: #registration >+[3]: http://url.spec.whatwg.org/#concept-url-serializer >+[4]: #on-fetch-request-algorithm >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section scope so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.2-service-worker-url-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.2-service-worker-url-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..87e9123f47441138acdfa8eab5f05f2ac23f8f67 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.2-service-worker-url-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section url so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.2-service-worker-url.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.2-service-worker-url.html >new file mode 100644 >index 0000000000000000000000000000000000000000..5674df7fc8d9ac493251a6c51a3d7ca34674a71d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.2-service-worker-url.html >@@ -0,0 +1,43 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: url</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-url"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+The `url` attribute must return the [serialization][1] of the URL of the script >+of the Service Worker, identified by its [URL scope][2], that is associated >+with the [ServiceWorkerGlobalScope][3] object. The `url` attribute is always an >+[absolute URL][4] corresponding to the script file which the Service Worker >+evaluates. >+ >+In the example in section 3.1.1, the value of >+`navigator.serviceWorker.controller.url` will be >+`"https://example.com/service_worker.js"`. >+ >+ >+ >+[1]: http://url.spec.whatwg.org/#concept-url-serializer >+[2]: #url-scope >+[3]: #service-worker-global-scope-interface >+[4]: http://url.spec.whatwg.org/#concept-absolute-url >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section url so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.3-service-worker-state-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.3-service-worker-state-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..d9ecc612fb690ac9d52ce70c329e5d3ae5e721b3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.3-service-worker-state-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section state so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.3-service-worker-state.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.3-service-worker-state.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8e729baf89f5e786e715ecadd071b06b00a43eaf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.3-service-worker-state.html >@@ -0,0 +1,76 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: state</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-state"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+The [ServiceWorker][1] object can be in several states. The `state` attribute >+must return the current state, which must be one of the following values >+defined in the [ServiceWorkerState][2] enumeration: >+ >+`"installing"`: >+ The Service Worker represented by the [ServiceWorker][1] object has entered >+ and is running the steps in the [installation process][3]. During this >+ state, `e.waitUntil(p)` can be called inside the `oninstall` event handler >+ of the associcated [ServiceWorkerGloberScope][4] object to extend the life >+ of the [installing worker][5] until the passed [Promise][6] resolves >+ successfully. This is primarily used to ensure that the Service Worker is >+ not active until all of the core caches are populated. >+`"installed"`: >+ The Service Worker represented by the [ServiceWorker][1] object has >+ completed the steps in the [installation process][3]. The Service Worker in >+ this state is considered the [worker in waiting][7]. >+`"activating"`: >+ The Service Worker represented by the [ServiceWorker][1] object has entered >+ and is running the steps in the [activation process][8]. During this state, >+ `e.waitUntil(p)` can be called inside the `onactivate` event handler of the >+ associated [ServiceWorkerGloberScope][9] object to extend the life of the >+ activating [active worker][10] until the passed [Promise][6] resolves >+ successfully. Note that no [functional events][11] are dispatched until the >+ state becomes `"activated"`. >+`"activated"`: >+ The Service Worker represented by the [ServiceWorker][1] object has >+ completed the steps in the [activation process][8]. The Service Worker in >+ this state is considered the [active worker][10] ready to [control][12] the >+ documents in matching scope upon subsequence [navigation][13]. >+`"redundant"`: >+ A newly created Service Worker [registration][14] is replacing the current >+ [registration][14] of the Service Worker. >+ >+ >+ >+[1]: #service-worker-interface >+[2]: #service-worker-state-enum >+[3]: #installation-process >+[4]: #service-worker-glober-scope-interface >+[5]: #installing-worker >+[6]: http://goo.gl/3TobQS >+[7]: #worker-in-waiting >+[8]: #activation-process >+[9]: #service-worker-global-scope-interface >+[10]: #active-worker >+[11]: #functional-events >+[12]: #document-control >+[13]: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigate >+[14]: #registration >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section state so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.4-service-worker-on-state-change-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.4-service-worker-on-state-change-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b526845145e4072f38fa1684f3c4afa878c11ffa >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.4-service-worker-on-state-change-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section onstatechange so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.4-service-worker-on-state-change.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.4-service-worker-on-state-change.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c87dce60163242a8d271bbc61f61d1c985afcb5d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.1.4-service-worker-on-state-change.html >@@ -0,0 +1,35 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: onstatechange</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-on-state-change"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`onstatechange` is the [event handler][1] that must be supported as attribute >+by the `[ServiceWorker][2]` object. A `statechange` event using the >+`[Event][3]` interface is dispatched on `[ServiceWorker][2]` object when the >+`state` attribute of the `ServiceWorker` object is changed. >+ >+[1]: http://goo.gl/rBfiz0 >+[2]: #service-worker-interface >+[3]: http://goo.gl/Mzv7Dv >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section onstatechange so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2-navigator-service-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2-navigator-service-worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..10f3a754282068851de915814fd7d7c69120ee25 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2-navigator-service-worker-expected.txt >@@ -0,0 +1,36 @@ >+CONSOLE MESSAGE: line 867: Invalid object member name RegistrationOptionList >+ >+Harness Error (FAIL), message = Invalid object member name RegistrationOptionList >+ >+FAIL Partial interface Navigator: original interface defined assert_true: Original interface should be defined expected true got false >+PASS ServiceWorkerContainer interface: existence and properties of interface object >+PASS ServiceWorkerContainer interface object length >+PASS ServiceWorkerContainer interface object name >+PASS ServiceWorkerContainer interface: existence and properties of interface prototype object >+PASS ServiceWorkerContainer interface: existence and properties of interface prototype object's "constructor" property >+PASS ServiceWorkerContainer interface: existence and properties of interface prototype object's @@unscopables property >+PASS ServiceWorkerContainer interface: attribute ready >+FAIL ServiceWorkerContainer interface: operation getAll() assert_own_property: interface prototype object missing non-static operation expected property "getAll" missing >+PASS ServiceWorkerContainer interface: operation register(DOMString, RegistrationOptionList) >+FAIL ServiceWorkerContainer interface: operation unregister(DOMString) assert_own_property: interface prototype object missing non-static operation expected property "unregister" missing >+FAIL ServiceWorkerContainer interface: attribute onupdatefound assert_true: The prototype object must have a property "onupdatefound" expected true got false >+PASS ServiceWorkerContainer interface: attribute oncontrollerchange >+FAIL ServiceWorkerContainer interface: attribute onreloadpage assert_true: The prototype object must have a property "onreloadpage" expected true got false >+FAIL ServiceWorkerContainer interface: attribute onerror assert_true: The prototype object must have a property "onerror" expected true got false >+FAIL ServiceWorkerContainer must be primary interface of throw new Error ('No object defined for the ServiceWorkerContainer interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL Stringification of throw new Error ('No object defined for the ServiceWorkerContainer interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: throw new Error ('No object defined for the ServiceWorkerContainer interface') must have own property "installing" assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: throw new Error ('No object defined for the ServiceWorkerContainer interface') must have own property "waiting" assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: throw new Error ('No object defined for the ServiceWorkerContainer interface') must have own property "active" assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: throw new Error ('No object defined for the ServiceWorkerContainer interface') must have own property "controller" assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: throw new Error ('No object defined for the ServiceWorkerContainer interface') must inherit property "ready" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: throw new Error ('No object defined for the ServiceWorkerContainer interface') must inherit property "getAll()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: throw new Error ('No object defined for the ServiceWorkerContainer interface') must inherit property "register(DOMString, RegistrationOptionList)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: calling register(DOMString, RegistrationOptionList) on throw new Error ('No object defined for the ServiceWorkerContainer interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: throw new Error ('No object defined for the ServiceWorkerContainer interface') must inherit property "unregister(DOMString)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: calling unregister(DOMString) on throw new Error ('No object defined for the ServiceWorkerContainer interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: throw new Error ('No object defined for the ServiceWorkerContainer interface') must inherit property "onupdatefound" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: throw new Error ('No object defined for the ServiceWorkerContainer interface') must inherit property "oncontrollerchange" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: throw new Error ('No object defined for the ServiceWorkerContainer interface') must inherit property "onreloadpage" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+FAIL ServiceWorkerContainer interface: throw new Error ('No object defined for the ServiceWorkerContainer interface') must inherit property "onerror" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerContainer interface" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2-navigator-service-worker.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2-navigator-service-worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d5b51475aa8c19f4e747fc39fbef3315ddb8c6c9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2-navigator-service-worker.html >@@ -0,0 +1,84 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: navigator.serviceWorker</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ <script src=/resources/WebIDLParser.js></script> >+ <script src=/resources/idlharness.js></script> >+ >+ </head> >+ <body> >+ >+<!-- >+The `serviceWorker` attribute of the [Navigator][1] interface must return an >+instance of the `ServiceWorkerContainer` interface, which provides access to >+registration, removal, upgrade, and communication with Service Workers that are >+(or will become) active for the current document. Communication with these >+workers is provided via standard [HTML5 messaging APIs][2], and [messaging >+occurs as per usual with Web Workers][3]. >+--> >+<script type=text/plain id="idl_0"> >+partial interface Navigator { >+ readonly attribute ServiceWorkerContainer serviceWorker; >+}; >+ >+interface ServiceWorkerContainer : EventTarget { >+ [Unforgeable] readonly attribute ServiceWorker? installing; >+ [Unforgeable] readonly attribute ServiceWorker? waiting; >+ [Unforgeable] readonly attribute ServiceWorker? active; >+ [Unforgeable] readonly attribute ServiceWorker? controller; >+ readonly attribute Promise<ServiceWorker> ready; >+ >+ Promise<sequence<ServiceWorker>?> getAll(); >+ Promise<ServiceWorker> register(DOMString url, optional RegistrationOptionList options); >+ Promise<any> unregister(DOMString? scope); >+ >+ // events >+ attribute EventHandler onupdatefound; >+ attribute EventHandler oncontrollerchange; >+ attribute EventHandler onreloadpage; >+ attribute EventHandler onerror; >+}; >+ >+dictionary RegistrationOptionList { >+ DOMString scope = "/*"; >+}; >+ >+interface ReloadPageEvent : Event { >+ void waitUntil(Promise<any> f); >+}; >+</script> >+ >+<!-- >+[1]: http://goo.gl/I7WAhg >+[2]: http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html >+[3]: http://www.w3.org/TR/workers/#dom-worker-postmessage >+--> >+ >+ >+ <script type=text/plain id="untested_idls"> >+ interface ServiceWorker {}; >+ interface EventHandler {}; >+ interface EventTarget {}; >+ interface Event {}; >+ </script> >+ >+ <script> >+ var idl_array = new IdlArray(); >+ idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); >+ idl_array.add_idls(document.getElementById("idl_0").textContent); >+ idl_array.add_objects({ >+ Navigator: ["throw new Error ('No object defined for the Navigator interface')"], >+ ServiceWorkerContainer: ["throw new Error ('No object defined for the ServiceWorkerContainer interface')"], >+ RegistrationOptionList: ["throw new Error ('No object defined for the RegistrationOptionList dictionary')"], >+ ReloadPageEvent: ["throw new Error ('No object defined for the ReloadPageEvent interface')"] >+ }); >+ idl_array.test(); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.1-navigator-service-worker-installing-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.1-navigator-service-worker-installing-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6a4d8d20a9ff21035e7c45a9f1a4e2ef3f6103e7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.1-navigator-service-worker-installing-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section installing so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.1-navigator-service-worker-installing.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.1-navigator-service-worker-installing.html >new file mode 100644 >index 0000000000000000000000000000000000000000..59e4f3d6a0d3bfa3c928c921fdcc8f756d314c90 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.1-navigator-service-worker-installing.html >@@ -0,0 +1,43 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: installing</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker-installing"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`navigator.serviceWorker.installing` must return a [ServiceWorker][1] object >+representing the [installing worker][2] that is currently undergoing the >+installation process (from step 1 to step 7 of the [_Installation >+algorithm][3]) for the given [URL scope][4] in which the document may be >+[controlled][5] when the Service Worker becomes the [active worker][6]. >+`navigator.serviceWorker.installing` returns `null` if no Service Worker >+[registration][7] is in the [installation process][8]. >+ >+[1]: #service-worker-interface >+[2]: #installing-worker >+[3]: #installation-algorithm >+[4]: #url-scope >+[5]: #document-control >+[6]: #active-worker >+[7]: #service-worker-registration-internal-interface >+[8]: #installation-process >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section installing so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.10-navigator-service-worker-oncontrollerchange-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.10-navigator-service-worker-oncontrollerchange-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..18cbe63c743aa3acc8623abbbb540790532fc46d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.10-navigator-service-worker-oncontrollerchange-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section oncontrollerchange so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.10-navigator-service-worker-oncontrollerchange.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.10-navigator-service-worker-oncontrollerchange.html >new file mode 100644 >index 0000000000000000000000000000000000000000..478860146dcecb174bfb4b59d6c9db8d05315a01 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.10-navigator-service-worker-oncontrollerchange.html >@@ -0,0 +1,45 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: oncontrollerchange</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker-oncontrollerchange"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`navigator.serviceWorker.oncontrollerchange` is the [event handler][1] that >+must be supported as attribute by the `[ServiceWorkerContainer][2]` object. A >+`controllerchange` event using the `[Event][3]` interface is dispatched on >+`[ServiceWorkerContainer][2]` object (See step 7 of the [_Activation >+algorithm][4]) when the associated Service Worker [registration][5] for the >+document enters the [activation process][6]. When the [activation process][6] >+is triggered by `replace()` method call within the event handler of the >+`install` event, `navigator.serviceWorker.controller` immediately reflects the >+[active worker][7] as the Service Worker that [controls][8] the document. >+ >+[1]: http://goo.gl/rBfiz0 >+[2]: #service-worker-container-interface >+[3]: http://goo.gl/Mzv7Dv >+[4]: #activation-algorithm >+[5]: #registration >+[6]: #activation-process >+[7]: #active-worker >+[8]: #document-control >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section oncontrollerchange so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.11-navigator-service-worker-onreloadpage-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.11-navigator-service-worker-onreloadpage-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6640e72dc880391f3e3dc88e088668cac9b0df23 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.11-navigator-service-worker-onreloadpage-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section onreloadpage so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.11-navigator-service-worker-onreloadpage.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.11-navigator-service-worker-onreloadpage.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e2207db100a21a8f8f53c72a2cd8f86ae7f510a1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.11-navigator-service-worker-onreloadpage.html >@@ -0,0 +1,41 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: onreloadpage</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker-onreloadpage"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`navigator.serviceWorker.onreloadpage` is the [event handler][1] that must be >+supported as attribute by the `[ServiceWorkerContainer][2]` object. An event >+named `reloadpage` using the `[ReloadPageEvent][3]` interface is dispatched on >+`[ServiceWorkerContainer][2]` object when the page reload is triggered by the >+`[self.clients.reloadAll()][4]` method call from the [active worker][5], >+represented by its associated [ServiceWorkerGlobalScope][6] object, for the >+document. >+ >+[1]: http://goo.gl/rBfiz0 >+[2]: #service-worker-container-interface >+[3]: #reload-page-event-interface >+[4]: #reloadall-method >+[5]: #active-worker >+[6]: #service-worker-global-scope-interface >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section onreloadpage so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.12-navigator-service-worker-onerror-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.12-navigator-service-worker-onerror-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c74517df266e09225ee949795f882da335476319 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.12-navigator-service-worker-onerror-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section onerror so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.12-navigator-service-worker-onerror.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.12-navigator-service-worker-onerror.html >new file mode 100644 >index 0000000000000000000000000000000000000000..313f0bdfcd500a725bfaf5a59045ec7721f8c674 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.12-navigator-service-worker-onerror.html >@@ -0,0 +1,37 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: onerror</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker-onerror"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`navigator.serviceWorker.onerror` is the [event handler][1] that must be >+supported as attribute by the `[ServiceWorkerContainer][2]` object. An event >+named `error` using the `[ErrorEvent][3]` interface is dispatched on >+`[ServiceWorkerContainer][2]` object for any error from the associated >+`[ServiceWorker][4]` objects. >+ >+[1]: http://goo.gl/rBfiz0 >+[2]: #service-worker-container-interface >+[3]: http://goo.gl/FKuWgu >+[4]: #service-worker-interface >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section onerror so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.2-navigator-service-worker-waiting-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.2-navigator-service-worker-waiting-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..45bce087a995171ded2c55374e430c6950b713c9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.2-navigator-service-worker-waiting-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section waiting so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.2-navigator-service-worker-waiting.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.2-navigator-service-worker-waiting.html >new file mode 100644 >index 0000000000000000000000000000000000000000..663ce82f9685858451bea7129106376b054b6fba >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.2-navigator-service-worker-waiting.html >@@ -0,0 +1,34 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: waiting</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker-waiting"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`navigator.serviceWorker.waiting` must return a [ServiceWorker][1] object >+representing the waiting Service Worker that is considered the [worker in >+waiting][2] for the document. `navigator.serviceWorker.waiting` returns `null` >+if there is no [worker in waiting][2] for the document. >+ >+[1]: #service-worker-interface >+[2]: #worker-in-waiting >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section waiting so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.3-navigator-service-worker-active-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.3-navigator-service-worker-active-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ebd1abae969860ac002e2a556c74580ab2d7386f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.3-navigator-service-worker-active-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section active so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.3-navigator-service-worker-active.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.3-navigator-service-worker-active.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f7406f59012fc8e197177e1c37e43d045a1fd70b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.3-navigator-service-worker-active.html >@@ -0,0 +1,40 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: active</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker-active"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`navigator.serviceWorker.active` must return a [ServiceWorker][1] object >+representing the [active worker][2] that is currently undergoing or completed >+the activation process (from step 4 to step 9 of the [_Activation >+algorithm][3]) for the given [URL scope][4] in which the document is controlled >+(or to be controlled). `navigator.serviceWorker.active` returns `null` if no >+Service Worker [registration][5] is in the [activation process][6]. >+ >+[1]: #service-worker-interface >+[2]: #active-worker >+[3]: #activation-algorithm >+[4]: #url-scope >+[5]: #service-worker-registration-internal-interface >+[6]: #activation-process >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section active so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.4-navigator-service-worker-controller-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.4-navigator-service-worker-controller-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..970fbe926fef41f6c9ab2e3d4af53318503c2b7f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.4-navigator-service-worker-controller-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section controller so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.4-navigator-service-worker-controller.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.4-navigator-service-worker-controller.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1a26cce6d4edc2c9130f28069e4d9664bf8a6d9d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.4-navigator-service-worker-controller.html >@@ -0,0 +1,37 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: controller</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker-controller"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`navigator.serviceWorker.controller` must return a [ServiceWorker][1] object >+representing the [active worker][2] that currently handles resource requests >+for the document. `navigator.serviceWorker.controller` returns `null` if the >+current document was not [created under a Service Worker][3] (See step 6-1 of >+[_OnFetchRequest][3] algorithm) or the request is a force refresh >+(shift+refresh). >+ >+[1]: #service-worker-interface >+[2]: #active-worker >+[3]: #on-fetch-request-algorithm >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section controller so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.5-navigator-service-worker-ready-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.5-navigator-service-worker-ready-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..58f0b73d2fb9c51bce7fce8d1bae171440888c70 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.5-navigator-service-worker-ready-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section ready so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.5-navigator-service-worker-ready.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.5-navigator-service-worker-ready.html >new file mode 100644 >index 0000000000000000000000000000000000000000..67a690ddc5b2d40c1c21a0bf021a49fbddb0c760 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.5-navigator-service-worker-ready.html >@@ -0,0 +1,67 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: ready</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker-ready"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`navigator.serviceWorker.ready` attribute must return the result of running >+these steps: >+ >+1. Let `promise` be a newly-created [promise][1]. >+2. Return `promise`. >+3. Run the following steps asynchronously: >+ 1. Let `registration` be the result of running [_ScopeMatch >+ algorithm][2] with document's url as its argument. >+ 2. If `registration` is null, then: >+ 1. Wait for the document to have a matching [registration][3]. >+ 3. If the [registration][3], represented by `registration`, for the >+ document has an [active worker][4], then: >+ 1. Resolve `promise` with the [ServiceWorker][5] object associated >+ with the [active worker][4]. >+ 2. Abort these steps. >+ 4. If the [registration][3], represented by `registration`, for the >+ document has a [worker in waiting][6], then: >+ 1. Resolve `promise` with the [ServiceWorker][5] object associated >+ with the [worker in waiting][6]. >+ 2. Abort these steps. >+ 5. Wait until the [registration][3], represented by `registration`, >+ for the document acquires a [worker in waiting][6] through a new >+ [installation process][7]. >+ 6. Resolve `promise` with the [ServiceWorker][5] object associated >+ with the [worker in waiting][6]. >+Note that `ready` attribute is desinged in a way that the returned [promise][1] >+will never reject. Instead, it waits until the [promise][1] resolves with a >+newly installed [worker in waiting][6]. Hence, the `state` of the acquired >+[`ServiceWorker`][8] object is either `installed`, `activating` or `activated`. >+ >+ >+ >+[1]: http://goo.gl/3TobQS >+[2]: #scope-match-algorithm >+[3]: #registration >+[4]: #active-worker >+[5]: #service-worker-interface >+[6]: #worker-in-waiting >+[7]: #installation-process >+[8]: #service-worker >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section ready so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.6-navigator-service-worker-getAll-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.6-navigator-service-worker-getAll-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..008c23e8e24fe207e0867da7ed0e3d026e3ce9f0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.6-navigator-service-worker-getAll-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section getAll() so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.6-navigator-service-worker-getAll.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.6-navigator-service-worker-getAll.html >new file mode 100644 >index 0000000000000000000000000000000000000000..3c2afe99cbb492554522912c265f243902f74134 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.6-navigator-service-worker-getAll.html >@@ -0,0 +1,30 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: getAll()</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker-getAll"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`navigator.serviceWorker.getAll()` method must return a promise that resolves >+with the array of the ServiceWorker objects in `installing`, `installed`, >+`activating` and `activated` states. >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section getAll() so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.7-navigator-service-worker-register-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.7-navigator-service-worker-register-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6ded38b1a3982823a0a77d6e524a0eeebe7a31ab >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.7-navigator-service-worker-register-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section register() so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.7-navigator-service-worker-register.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.7-navigator-service-worker-register.html >new file mode 100644 >index 0000000000000000000000000000000000000000..df469de42af5ea5868de91df77164dbf5af28a3e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.7-navigator-service-worker-register.html >@@ -0,0 +1,32 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: register()</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker-register"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`navigator.serviceWorker.register(url, options)` method must run the >+[Registration algorithm][1] passing `url` and `options`.`scope` as the >+arguments. >+ >+[1]: #registration-algorithm >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section register() so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.8-navigator-service-worker-unregister-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.8-navigator-service-worker-unregister-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..581e5e6638f0102938f07350c83c8f6a220e22db >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.8-navigator-service-worker-unregister-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section unregister() so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.8-navigator-service-worker-unregister.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.8-navigator-service-worker-unregister.html >new file mode 100644 >index 0000000000000000000000000000000000000000..6f1b43b6bdee80d5da06b4f3786f068c8a7648f9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.8-navigator-service-worker-unregister.html >@@ -0,0 +1,31 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: unregister()</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker-unregister"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`navigator.serviceWorker.unregister(scope)` method must run the [Unregistration >+algorithm][1] passing `scope` as the argument. >+ >+[1]: #unregistration-algorithm >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section unregister() so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.9-navigator-service-worker-onupdatefound-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.9-navigator-service-worker-onupdatefound-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1db9ccbdad60b506fb08cbcfdb423efa8c244b74 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.9-navigator-service-worker-onupdatefound-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section onupdatefound so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.9-navigator-service-worker-onupdatefound.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.9-navigator-service-worker-onupdatefound.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7babe7c245681870c3559baca65d976aaa437723 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-3.2.9-navigator-service-worker-onupdatefound.html >@@ -0,0 +1,42 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: onupdatefound</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-service-worker-onupdatefound"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`navigator.serviceWorker.onupdatefound` is the [event handler][1] that must be >+supported as attribute by the `[ServiceWorkerContainer][2]` object. An >+`updatefound` event using the `[Event][3]` interface is dispatched on >+`[ServiceWorkerContainer][2]` object (See step 4 of the [_Installation >+algorithm][4]) when the associated Service Worker [registration][5] for the >+document enters the [installation process][6] such that >+`navigator.serviceWorker.installing` becomes the new [installing worker][7]. >+ >+[1]: http://goo.gl/rBfiz0 >+[2]: #service-worker-container-interface >+[3]: http://goo.gl/Mzv7Dv >+[4]: #installation-algorithm >+[5]: #registration >+[6]: #installation-process >+[7]: #installing-worker >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section onupdatefound so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1-service-worker-global-scope-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1-service-worker-global-scope-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..081de4b33875711b75f9f175b4a2e3c3f9675ce0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1-service-worker-global-scope-expected.txt >@@ -0,0 +1,9 @@ >+CONSOLE MESSAGE: line 1821: TypeError: undefined is not an object (evaluating 'self[this.name].prototype') >+ >+Harness Error (FAIL), message = TypeError: undefined is not an object (evaluating 'self[this.name].prototype') >+ >+FAIL ServiceWorkerGlobalScope interface: existence and properties of interface object assert_own_property: self does not have own property "ServiceWorkerGlobalScope" expected property "ServiceWorkerGlobalScope" missing >+FAIL ServiceWorkerGlobalScope interface object length assert_own_property: self does not have own property "ServiceWorkerGlobalScope" expected property "ServiceWorkerGlobalScope" missing >+FAIL ServiceWorkerGlobalScope interface object name assert_own_property: self does not have own property "ServiceWorkerGlobalScope" expected property "ServiceWorkerGlobalScope" missing >+FAIL ServiceWorkerGlobalScope interface: existence and properties of interface prototype object assert_own_property: self does not have own property "ServiceWorkerGlobalScope" expected property "ServiceWorkerGlobalScope" missing >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1-service-worker-global-scope.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1-service-worker-global-scope.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c11feaca4c832bb90562868a6d78d4ac0ee017fc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1-service-worker-global-scope.html >@@ -0,0 +1,75 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: ServiceWorkerGlobalScope</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-global-scope"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ <script src=/resources/WebIDLParser.js></script> >+ <script src=/resources/idlharness.js></script> >+ >+ </head> >+ <body> >+ >+<script type=text/plain id="idl_0"> >+[Global] >+interface ServiceWorkerGlobalScope : WorkerGlobalScope { >+ readonly attribute CacheStorage caches; >+ // A container for a list of window objects, identifiable by ID, that >+ // correspond to windows (or workers) that are "controlled" by this SW >+ readonly attribute ServiceWorkerClients clients; >+ [Unforgeable] readonly attribute DOMString scope; >+ >+ Promise<any> fetch((Request or ScalarValueString) request); >+ >+ void update(); >+ void unregister(); >+ >+ attribute EventHandler oninstall; >+ attribute EventHandler onactivate; >+ attribute EventHandler onfetch; >+ attribute EventHandler onbeforeevicted; >+ attribute EventHandler onevicted; >+ >+ // The event.source of these MessageEvents are instances of Client >+ attribute EventHandler onmessage; >+ >+ // close() method inherited from WorkerGlobalScope is not exposed. >+}; >+</script> >+ >+<!-- >+The `ServiceWorkerGlobalScope` interface represents the global execution >+context of a Service Worker. `ServiceWorkerGlobalScope` object provides >+generic, event-driven, time-limited script execution contexts that run at an >+origin. Once successfully [registered][1], a Service Worker is started, kept >+alive and killed by their relationship to events, not documents. Any type of >+synchronous requests MUST NOT be initiated inside of a Service Worker. >+ >+[1]: #navigator-service-worker-register >+--> >+ >+ >+ <script type=text/plain id="untested_idls"> >+ interface CacheStorage {}; >+ interface ServiceWorkerClients {}; >+ interface Request {}; >+ interface ScalarValueString {}; >+ interface EventHandler {}; >+ interface WorkerGlobalScope {}; >+ </script> >+ >+ <script> >+ var idl_array = new IdlArray(); >+ idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); >+ idl_array.add_idls(document.getElementById("idl_0").textContent); >+ idl_array.add_objects({ >+ ServiceWorkerGlobalScope: ["throw new Error ('No object defined for the ServiceWorkerGlobalScope interface')"] >+ }); >+ idl_array.test(); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.1-service-worker-global-scope-caches-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.1-service-worker-global-scope-caches-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..337bd358baf4b38e0ee453505f9c029cb0467622 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.1-service-worker-global-scope-caches-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section caches so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.1-service-worker-global-scope-caches.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.1-service-worker-global-scope-caches.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f1fce5036a100e4e0fa324d647502a67e5d00a2b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.1-service-worker-global-scope-caches.html >@@ -0,0 +1,36 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: caches</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-global-scope-caches"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`self.caches` must return the `[CacheStorage][1]` object that is the global >+asynchronous map object for the `[ServiceWorkerGlobalScope][2]` execution >+context containing the cache objects keyed by the name of the caches. Caches >+are always enumerable via `self.caches` in insertion order (per [ECMAScript 6 >+Map objects][3].) >+ >+[1]: #cache-storage-interface >+[2]: #service-worker-global-scope-interface >+[3]: http://goo.gl/gNnDPO >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section caches so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.2-service-worker-global-scope-clients-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.2-service-worker-global-scope-clients-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f2660a26e23943f43b096257e16a376628bd6e79 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.2-service-worker-global-scope-clients-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section clients so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.2-service-worker-global-scope-clients.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.2-service-worker-global-scope-clients.html >new file mode 100644 >index 0000000000000000000000000000000000000000..cd5d28353a29634d75ed951316d740989582c98b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.2-service-worker-global-scope-clients.html >@@ -0,0 +1,33 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: clients</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-global-scope-clients"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`self.clients` must return the `[ServiceWorkerClients][1]` object containing a >+list of client objects, identifiable by ID, that correspond to windows or >+workers that are [controlled][2] by this Service Worker. >+ >+[1]: #service-worker-clients-interface >+[2]: #document-control >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section clients so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.3-service-worker-global-scope-scope-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.3-service-worker-global-scope-scope-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1101e195972a92286379a9fbd4bdfd4cd788e0fc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.3-service-worker-global-scope-scope-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section scope so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.3-service-worker-global-scope-scope.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.3-service-worker-global-scope-scope.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7b6ce78fa909730fe80c4b8c6c93825962d23ba7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.3-service-worker-global-scope-scope.html >@@ -0,0 +1,36 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: scope</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-global-scope-scope"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+The `scope` attribute of a [ServiceWorkerGlobalScope][1] object reflects the >+[URL scope][2] of the associated Service Worker [registration][3]. The `scope` >+attribute must return the [serialization][4] of the URL representing the [URL >+scope][2] of the associated Service Worker [registration][3]. >+ >+[1]: #service-worker-global-scope-interface >+[2]: #url-scope >+[3]: #registration >+[4]: http://url.spec.whatwg.org/#concept-url-serializer >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section scope so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.4-service-worker-global-scope-fetch-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.4-service-worker-global-scope-fetch-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..04e834141fdaea6a737fa9d3ebdcbcf0cf978109 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.4-service-worker-global-scope-fetch-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section fetch(request) so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.4-service-worker-global-scope-fetch.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.4-service-worker-global-scope-fetch.html >new file mode 100644 >index 0000000000000000000000000000000000000000..98345471f3b8f708850d019e897f7baf277cf793 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.4-service-worker-global-scope-fetch.html >@@ -0,0 +1,55 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: fetch(request)</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-global-scope-fetch"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`self.fetch(request)` method must run these steps: >+ >+1. Let `request` be a [request][1] represented by `request`. >+2. Set [`client`][2] of `request` to the [JavaScript global >+ environment][3] represented by `self` object. >+3. Let `promise` be a newly-created [promise][4]. >+4. Return `promise.` >+5. Run the following steps asynchronously: >+ 1. Let `response` be the result of running [fetch algorithm][5] with >+ `request` as its argument. >+ 2. If `response` is a [network error][6], then: >+ 1. Reject `promise` with a new [DOMException][7] whose name is >+ "[NetworkError][8]". >+ 3. Else, >+ 1. Resolve `promise` with a new [Response][9] object associated >+ with `response`. >+ >+ >+ >+[1]: http://goo.gl/ucOuXl >+[2]: http://goo.gl/Oxj4xQ >+[3]: http://goo.gl/ifwwCC >+[4]: http://goo.gl/3TobQS >+[5]: http://goo.gl/fGMifs >+[6]: http://goo.gl/jprjjc >+[7]: http://goo.gl/A0U8qC >+[8]: http://goo.gl/lud5HB >+[9]: http://goo.gl/Deazjv >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section fetch(request) so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.5-service-worker-global-scope-update-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.5-service-worker-global-scope-update-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..363963b9a4b778cc25fa375d429afcc14dde9573 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.5-service-worker-global-scope-update-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section update() so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.5-service-worker-global-scope-update.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.5-service-worker-global-scope-update.html >new file mode 100644 >index 0000000000000000000000000000000000000000..26e255dd4a0209f9492bfd327183f6915359ca36 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.5-service-worker-global-scope-update.html >@@ -0,0 +1,36 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: update()</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-global-scope-update"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`update()` pings the server for an updated version of this script without >+consulting caches. `self.update()` method must run the [_SoftUpdate >+algorithm][1] passing its serviceWorkerRegistration object as the argument >+which is the result of running the [_GetRegistration algorithm][2] with >+`self.scope` as the argument. (This is conceptually the same operation that UA >+does maximum once per every 24 hours.) >+ >+[1]: #soft-update-algorithm >+[2]: #get-registration-algorithm >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section update() so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.6-service-worker-global-scope-unregister-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.6-service-worker-global-scope-unregister-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..581e5e6638f0102938f07350c83c8f6a220e22db >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.6-service-worker-global-scope-unregister-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section unregister() so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.6-service-worker-global-scope-unregister.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.6-service-worker-global-scope-unregister.html >new file mode 100644 >index 0000000000000000000000000000000000000000..de1d64a6e45c45480a7eab230ddb33ba7f006444 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.6-service-worker-global-scope-unregister.html >@@ -0,0 +1,31 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: unregister()</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-global-scope-unregister"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`self.unregister()` method must run the [Unregistration algorithm][1] >+implicitly passing `self.scope` as the argument. >+ >+[1]: #unregistration-algorithm >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section unregister() so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.7-service-worker-global-scope-onmessage-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.7-service-worker-global-scope-onmessage-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..da7648b5619c70c6ad28eeae9d5e93ff81b3e6a6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.7-service-worker-global-scope-onmessage-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section onmessage so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.7-service-worker-global-scope-onmessage.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.7-service-worker-global-scope-onmessage.html >new file mode 100644 >index 0000000000000000000000000000000000000000..b930439486efab516cd33807064d907a535fafde >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.1.7-service-worker-global-scope-onmessage.html >@@ -0,0 +1,45 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: onmessage</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-global-scope-onmessage"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`self.onmessage` is the [event handler][1] that must be supported as attribute >+by the `ServiceWorkerGlobalScope` object. `ServiceWorkerGlobalScope` objects >+act as if they had an implicit `[MessagePort][2]` associated with them. This >+port is part of a channel that is set up when the worker is created, but it is >+not exposed. This object must never be garbage collected before the >+`ServiceWorkerGlobalScope` object. >+ >+All messages received by that port must immediately be retargeted at the >+`ServiceWorkerGlobalScope` object. That is, an event named `message` using the >+`[MessageEvent][3]` interface is dispatched on ServiceWorkerGlobalScope object. >+The `event.source` of these `[MessageEvent][3]`s are instances of `[Client][4]`. >+ >+ >+ >+[1]: http://goo.gl/rBfiz0 >+[2]: http://goo.gl/tHBrI6 >+[3]: http://goo.gl/S5e0b6 >+[4]: #client-interface >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section onmessage so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.2-client-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.2-client-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9f749818ea87b9ab29efc3621f6ca154243fa043 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.2-client-expected.txt >@@ -0,0 +1,15 @@ >+ >+FAIL Client interface: existence and properties of interface object assert_own_property: self does not have own property "Client" expected property "Client" missing >+FAIL Client interface object length assert_own_property: self does not have own property "Client" expected property "Client" missing >+FAIL Client interface object name assert_own_property: self does not have own property "Client" expected property "Client" missing >+FAIL Client interface: existence and properties of interface prototype object assert_own_property: self does not have own property "Client" expected property "Client" missing >+FAIL Client interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "Client" expected property "Client" missing >+FAIL Client interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "Client" expected property "Client" missing >+FAIL Client interface: attribute id assert_own_property: self does not have own property "Client" expected property "Client" missing >+FAIL Client interface: operation postMessage(any, DOMString, [object Object]) assert_own_property: self does not have own property "Client" expected property "Client" missing >+FAIL Client must be primary interface of throw new Error ('No object defined for the Client interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Client interface" >+FAIL Stringification of throw new Error ('No object defined for the Client interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Client interface" >+FAIL Client interface: throw new Error ('No object defined for the Client interface') must inherit property "id" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Client interface" >+FAIL Client interface: throw new Error ('No object defined for the Client interface') must inherit property "postMessage(any, DOMString, [object Object])" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Client interface" >+FAIL Client interface: calling postMessage(any, DOMString, [object Object]) on throw new Error ('No object defined for the Client interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Client interface" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.2-client.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.2-client.html >new file mode 100644 >index 0000000000000000000000000000000000000000..fda0e298f5e7f1c55a619e3858682d850844b5ef >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.2-client.html >@@ -0,0 +1,61 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: Client</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#client"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ <script src=/resources/WebIDLParser.js></script> >+ <script src=/resources/idlharness.js></script> >+ >+ </head> >+ <body> >+ >+<script type=text/plain id="idl_0"> >+[Constructor()] // no-op constructor >+interface Client { >+ readonly attribute unsigned long id; >+ void postMessage(any message, DOMString targetOrigin, >+ optional sequence<Transferable> transfer); >+}; >+</script> >+ >+<!-- >+The `Client` interface represents the window or the worker (defined as client) >+that is [controlled][1] by the Service Worker. This object provides a no-op >+constructor. Callers should note that only `Client` objects created by the user >+agent (see [`this.clients.getServiced()`][2]) will provide meaningful >+functionality. >+ >+The `id` of a `Client` identifies the specific client object from the list of >+client objects serviced by the Service Worker. The `postMessage(message, >+targetOrigin, transfer)` method of a `[Client][3]`, when called, causes a >+`[MessageEvent][4]` to be dispatched at the client object. >+ >+ >+ >+[1]: #document-control >+[2]: #get-serviced-method >+[3]: #client-interface >+[4]: http://goo.gl/4SLWiH >+--> >+ >+ >+ <script type=text/plain id="untested_idls"> >+ interface Transferable {}; >+ </script> >+ >+ <script> >+ var idl_array = new IdlArray(); >+ idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); >+ idl_array.add_idls(document.getElementById("idl_0").textContent); >+ idl_array.add_objects({ >+ Client: ["throw new Error ('No object defined for the Client interface')"] >+ }); >+ idl_array.test(); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3-service-worker-clients-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3-service-worker-clients-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..4c7f630c60f3709944acf7d19278b974cd78ea8b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3-service-worker-clients-expected.txt >@@ -0,0 +1,14 @@ >+ >+FAIL ServiceWorkerClients interface: existence and properties of interface object assert_own_property: self does not have own property "ServiceWorkerClients" expected property "ServiceWorkerClients" missing >+FAIL ServiceWorkerClients interface object length assert_own_property: self does not have own property "ServiceWorkerClients" expected property "ServiceWorkerClients" missing >+FAIL ServiceWorkerClients interface object name assert_own_property: self does not have own property "ServiceWorkerClients" expected property "ServiceWorkerClients" missing >+FAIL ServiceWorkerClients interface: existence and properties of interface prototype object assert_own_property: self does not have own property "ServiceWorkerClients" expected property "ServiceWorkerClients" missing >+FAIL ServiceWorkerClients interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "ServiceWorkerClients" expected property "ServiceWorkerClients" missing >+FAIL ServiceWorkerClients interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "ServiceWorkerClients" expected property "ServiceWorkerClients" missing >+FAIL ServiceWorkerClients interface: operation getServiced() assert_own_property: self does not have own property "ServiceWorkerClients" expected property "ServiceWorkerClients" missing >+FAIL ServiceWorkerClients interface: operation reloadAll() assert_own_property: self does not have own property "ServiceWorkerClients" expected property "ServiceWorkerClients" missing >+FAIL ServiceWorkerClients must be primary interface of throw new Error ('No object defined for the ServiceWorkerClients interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerClients interface" >+FAIL Stringification of throw new Error ('No object defined for the ServiceWorkerClients interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerClients interface" >+FAIL ServiceWorkerClients interface: throw new Error ('No object defined for the ServiceWorkerClients interface') must inherit property "getServiced()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerClients interface" >+FAIL ServiceWorkerClients interface: throw new Error ('No object defined for the ServiceWorkerClients interface') must inherit property "reloadAll()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the ServiceWorkerClients interface" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3-service-worker-clients.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3-service-worker-clients.html >new file mode 100644 >index 0000000000000000000000000000000000000000..475df1952fba671b5a4f8a3b3a05d8dcc39c4f6c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3-service-worker-clients.html >@@ -0,0 +1,48 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: ServiceWorkerClients</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#service-worker-clients"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ <script src=/resources/WebIDLParser.js></script> >+ <script src=/resources/idlharness.js></script> >+ >+ </head> >+ <body> >+ >+<script type=text/plain id="idl_0"> >+interface ServiceWorkerClients { >+ // A list of client objects, identifiable by ID, that correspond to windows >+ // (or workers) that are "controlled" by this SW >+ Promise<sequence<Client>?> getServiced(); >+ Promise<any> reloadAll(); >+}; >+</script> >+ >+<!-- >+The `ServiceWorkerClients` interface represents a container for a list of >+`[Client][1]` objects. >+ >+[1]: #client-interface >+--> >+ >+ >+ <script type=text/plain id="untested_idls"> >+ interface Client {}; >+ </script> >+ >+ <script> >+ var idl_array = new IdlArray(); >+ idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); >+ idl_array.add_idls(document.getElementById("idl_0").textContent); >+ idl_array.add_objects({ >+ ServiceWorkerClients: ["throw new Error ('No object defined for the ServiceWorkerClients interface')"] >+ }); >+ idl_array.test(); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3.1-get-serviced-method-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3.1-get-serviced-method-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ffc41b03551f39b693b10887292a366d4db15184 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3.1-get-serviced-method-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section getServiced() so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3.1-get-serviced-method.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3.1-get-serviced-method.html >new file mode 100644 >index 0000000000000000000000000000000000000000..b3cd06fdf278f4f4d6a87b3bf97648f0e52528a1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3.1-get-serviced-method.html >@@ -0,0 +1,34 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: getServiced()</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#get-serviced-method"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+The `getServiced()` method of a `ServiceWorkerClients`, when called, returns a >+[Promise][1] that will resolve with a list of `[Client][2]` objects that are >+[controlled][3] by this Service Worker. >+ >+[1]: http://goo.gl/3TobQS >+[2]: #client-interface >+[3]: #document-control >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section getServiced() so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3.2-reloadall-method-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3.2-reloadall-method-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9477d2c968850ccd4455f5cdef4460c979b30db5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3.2-reloadall-method-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section reloadAll() so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3.2-reloadall-method.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3.2-reloadall-method.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c5a9dd45404a52c8175967e340ae04095964c127 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.3.2-reloadall-method.html >@@ -0,0 +1,37 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: reloadAll()</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#reloadall-method"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`reloadAll()` provides a mechanism for the worker to request synchronized >+re-fetch of all documents whose URLs match the registration's [URL scope][1]. >+An event named `reloadpage` is dispatched on the `navigator.serviceWorker` >+object of each document. The in-document handlers may allow the event to >+continue, request an extension (via [`e.waitUntil()`][2]), or cancel the >+collective reload by calling [`e.preventDefault()`][3]. >+ >+[1]: #url-scope >+[2]: #wait-until-method >+[3]: http://goo.gl/2zH6ie >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section reloadAll() so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.4-request-objects-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.4-request-objects-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..65346d7c56620a26412bcf3cb7dc52f4502ae97e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.4-request-objects-expected.txt >@@ -0,0 +1,4 @@ >+CONSOLE MESSAGE: line 59: TypeError: null is not an object (evaluating 'document.getElementById("untested_idls").textContent') >+ >+FAIL Service Workers: Request Objects TypeError: null is not an object (evaluating 'document.getElementById("untested_idls").textContent') >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.4-request-objects.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.4-request-objects.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2f471f80f6074a6a6ce27dde1d88199eb01d8bff >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.4-request-objects.html >@@ -0,0 +1,72 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: Request Objects</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#request-objects"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ <script src=/resources/WebIDLParser.js></script> >+ <script src=/resources/idlharness.js></script> >+ >+ </head> >+ <body> >+ >+<script type=text/plain id="idl_0"> >+[Constructor(optional RequestInit init)] >+interface Request { >+ attribute unsigned long timeout; >+ attribute DOMString url; >+ attribute ByteString method; >+ readonly attribute DOMString origin; >+ readonly attribute Mode mode; >+ attribute boolean synchronous; >+ attribute boolean forcePreflight; >+ attribute boolean omitCredentials; >+ readonly attribute DOMString referrer; >+ readonly attribute HeaderMap headers; // alternative: sequence<Header> headers; >+ attribute any body; >+}; >+ >+dictionary RequestInit { >+ unsigned long timeout = 0; >+ DOMString url; >+ boolean synchronous = false; >+ boolean forcePreflight = false; >+ boolean omitCredentials = false; >+ ByteString method = "GET"; >+ HeaderMap headers; >+ any body; >+}; >+ >+enum Mode { >+ "same origin", >+ "tainted cross-origin", >+ "CORS", >+ "CORS-with-forced-preflight" >+}; >+ >+[MapClass(DOMString, DOMString)] >+interface HeaderMap { >+}; >+</script> >+ >+ >+ >+ >+ <script> >+ var idl_array = new IdlArray(); >+ idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); >+ idl_array.add_idls(document.getElementById("idl_0").textContent); >+ idl_array.add_objects({ >+ Request: ["throw new Error ('No object defined for the Request interface')"], >+ RequestInit: ["throw new Error ('No object defined for the RequestInit dictionary')"], >+ Mode: ["throw new Error ('No object defined for the Mode enum')"], >+ HeaderMap: ["throw new Error ('No object defined for the HeaderMap interface')"] >+ }); >+ idl_array.test(); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5-response-objects-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5-response-objects-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b5258279b116ab15cfa44fbd083d0a3abcddfbd1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5-response-objects-expected.txt >@@ -0,0 +1,62 @@ >+CONSOLE MESSAGE: line 867: Invalid object member name ResponseInit >+ >+Harness Error (FAIL), message = Invalid object member name ResponseInit >+ >+FAIL AbstractResponse interface: existence and properties of interface object assert_own_property: self does not have own property "AbstractResponse" expected property "AbstractResponse" missing >+FAIL AbstractResponse interface object length assert_own_property: self does not have own property "AbstractResponse" expected property "AbstractResponse" missing >+FAIL AbstractResponse interface object name assert_own_property: self does not have own property "AbstractResponse" expected property "AbstractResponse" missing >+FAIL AbstractResponse interface: existence and properties of interface prototype object assert_own_property: self does not have own property "AbstractResponse" expected property "AbstractResponse" missing >+FAIL AbstractResponse interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "AbstractResponse" expected property "AbstractResponse" missing >+FAIL AbstractResponse interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "AbstractResponse" expected property "AbstractResponse" missing >+FAIL AbstractResponse must be primary interface of throw new Error ('No object defined for the AbstractResponse interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the AbstractResponse interface" >+FAIL Stringification of throw new Error ('No object defined for the AbstractResponse interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the AbstractResponse interface" >+FAIL OpaqueResponse interface: existence and properties of interface object assert_own_property: self does not have own property "OpaqueResponse" expected property "OpaqueResponse" missing >+FAIL OpaqueResponse interface object length assert_own_property: self does not have own property "OpaqueResponse" expected property "OpaqueResponse" missing >+FAIL OpaqueResponse interface object name assert_own_property: self does not have own property "OpaqueResponse" expected property "OpaqueResponse" missing >+FAIL OpaqueResponse interface: existence and properties of interface prototype object assert_own_property: self does not have own property "OpaqueResponse" expected property "OpaqueResponse" missing >+FAIL OpaqueResponse interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "OpaqueResponse" expected property "OpaqueResponse" missing >+FAIL OpaqueResponse interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "OpaqueResponse" expected property "OpaqueResponse" missing >+FAIL OpaqueResponse interface: attribute status assert_own_property: self does not have own property "OpaqueResponse" expected property "OpaqueResponse" missing >+FAIL OpaqueResponse interface: attribute statusText assert_own_property: self does not have own property "OpaqueResponse" expected property "OpaqueResponse" missing >+FAIL OpaqueResponse interface: attribute headers assert_own_property: self does not have own property "OpaqueResponse" expected property "OpaqueResponse" missing >+FAIL OpaqueResponse interface: attribute url assert_own_property: self does not have own property "OpaqueResponse" expected property "OpaqueResponse" missing >+FAIL OpaqueResponse must be primary interface of throw new Error ('No object defined for the OpaqueResponse interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the OpaqueResponse interface" >+FAIL Stringification of throw new Error ('No object defined for the OpaqueResponse interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the OpaqueResponse interface" >+FAIL OpaqueResponse interface: throw new Error ('No object defined for the OpaqueResponse interface') must inherit property "status" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the OpaqueResponse interface" >+FAIL OpaqueResponse interface: throw new Error ('No object defined for the OpaqueResponse interface') must inherit property "statusText" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the OpaqueResponse interface" >+FAIL OpaqueResponse interface: throw new Error ('No object defined for the OpaqueResponse interface') must inherit property "headers" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the OpaqueResponse interface" >+FAIL OpaqueResponse interface: throw new Error ('No object defined for the OpaqueResponse interface') must inherit property "url" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the OpaqueResponse interface" >+FAIL CORSResponse interface: existence and properties of interface object assert_own_property: self does not have own property "CORSResponse" expected property "CORSResponse" missing >+FAIL CORSResponse interface object length assert_own_property: self does not have own property "CORSResponse" expected property "CORSResponse" missing >+FAIL CORSResponse interface object name assert_own_property: self does not have own property "CORSResponse" expected property "CORSResponse" missing >+FAIL CORSResponse interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CORSResponse" expected property "CORSResponse" missing >+FAIL CORSResponse interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "CORSResponse" expected property "CORSResponse" missing >+FAIL CORSResponse interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CORSResponse" expected property "CORSResponse" missing >+FAIL CORSResponse interface: attribute headers assert_own_property: self does not have own property "CORSResponse" expected property "CORSResponse" missing >+FAIL CORSResponse must be primary interface of throw new Error ('No object defined for the CORSResponse interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CORSResponse interface" >+FAIL Stringification of throw new Error ('No object defined for the CORSResponse interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CORSResponse interface" >+FAIL CORSResponse interface: throw new Error ('No object defined for the CORSResponse interface') must inherit property "headers" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CORSResponse interface" >+FAIL Response interface: throw new Error ('No object defined for the CORSResponse interface') must inherit property "status" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CORSResponse interface" >+FAIL Response interface: throw new Error ('No object defined for the CORSResponse interface') must inherit property "statusText" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CORSResponse interface" >+FAIL Response interface: throw new Error ('No object defined for the CORSResponse interface') must inherit property "headers" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CORSResponse interface" >+FAIL Response interface: throw new Error ('No object defined for the CORSResponse interface') must inherit property "url" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CORSResponse interface" >+FAIL Response interface: throw new Error ('No object defined for the CORSResponse interface') must inherit property "toBlob()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CORSResponse interface" >+FAIL Response interface: existence and properties of interface object assert_own_property: should inherit from AbstractResponse, but self has no such property expected property "AbstractResponse" missing >+PASS Response interface object length >+PASS Response interface object name >+FAIL Response interface: existence and properties of interface prototype object assert_own_property: should inherit from AbstractResponse, but self has no such property expected property "AbstractResponse" missing >+PASS Response interface: existence and properties of interface prototype object's "constructor" property >+PASS Response interface: existence and properties of interface prototype object's @@unscopables property >+FAIL Response interface: attribute status assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined" >+FAIL Response interface: attribute statusText assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined" >+PASS Response interface: attribute headers >+FAIL Response interface: attribute url assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined" >+FAIL Response interface: operation toBlob() assert_own_property: interface prototype object missing non-static operation expected property "toBlob" missing >+FAIL Response must be primary interface of throw new Error ('No object defined for the Response interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Response interface" >+FAIL Stringification of throw new Error ('No object defined for the Response interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Response interface" >+FAIL Response interface: throw new Error ('No object defined for the Response interface') must inherit property "status" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Response interface" >+FAIL Response interface: throw new Error ('No object defined for the Response interface') must inherit property "statusText" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Response interface" >+FAIL Response interface: throw new Error ('No object defined for the Response interface') must inherit property "headers" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Response interface" >+FAIL Response interface: throw new Error ('No object defined for the Response interface') must inherit property "url" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Response interface" >+FAIL Response interface: throw new Error ('No object defined for the Response interface') must inherit property "toBlob()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Response interface" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5-response-objects.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5-response-objects.html >new file mode 100644 >index 0000000000000000000000000000000000000000..445982f51a3ab083ddb579d96f104452c149af51 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5-response-objects.html >@@ -0,0 +1,75 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: Response Objects</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#response-objects"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ <script src=/resources/WebIDLParser.js></script> >+ <script src=/resources/idlharness.js></script> >+ >+ </head> >+ <body> >+ >+<!-- >+`Response` objects model HTTP responses. >+--> >+<script type=text/plain id="idl_0"> >+[Constructor] >+interface AbstractResponse { >+}; >+ >+interface OpaqueResponse : AbstractResponse { >+ readonly attribute unsigned short status; >+ readonly attribute ByteString statusText; >+ // Returns a filtered list of headers. See prose for details. >+ readonly attribute HeaderMap headers; >+ // No setter for headers >+ readonly attribute DOMString url; >+}; >+ >+interface CORSResponse : Response { >+ readonly attribute HeaderMap headers; >+}; >+ >+[Constructor(optional ResponseInit responseInitDict)] >+interface Response : AbstractResponse { >+ attribute unsigned short status; >+ attribute ByteString statusText; >+ readonly attribute HeaderMap headers; >+ attribute DOMString url; >+ Promise<Blob> toBlob(); >+}; >+ >+dictionary ResponseInit { >+ unsigned short status = 200; >+ ByteString statusText = "OK"; >+ HeaderMap headers; >+}; >+</script> >+ >+ >+ >+ <script type=text/plain id="untested_idls"> >+ interface HeaderMap {}; >+ interface Blob {}; >+ </script> >+ >+ <script> >+ var idl_array = new IdlArray(); >+ idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); >+ idl_array.add_idls(document.getElementById("idl_0").textContent); >+ idl_array.add_objects({ >+ AbstractResponse: ["throw new Error ('No object defined for the AbstractResponse interface')"], >+ OpaqueResponse: ["throw new Error ('No object defined for the OpaqueResponse interface')"], >+ CORSResponse: ["throw new Error ('No object defined for the CORSResponse interface')"], >+ Response: ["throw new Error ('No object defined for the Response interface')"], >+ ResponseInit: ["throw new Error ('No object defined for the ResponseInit dictionary')"] >+ }); >+ idl_array.test(); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5.2-response-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5.2-response-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..832c7e36d295de78327f8065d068b8a0f9719109 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5.2-response-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section Response so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5.2-response.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5.2-response.html >new file mode 100644 >index 0000000000000000000000000000000000000000..fbc72f30ad77c1d5591fcf359b4e4a7eb0263274 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5.2-response.html >@@ -0,0 +1,36 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: Response</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#response"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`Response` objects are mutable and constructable. They model HTTP responses. >+The `fetch()` API returns this type for same-origin responses. >+ >+It may be possible to set the `Location` header of a `Response` object to >+someplace not in the current origin but this is not a security issue. >+Cross-origin response bodies are opaque to script, and since only same-origin >+documents will encounter these responses, the only systems the Service Worker >+can "lie to" are same-origin (and therefore safe from the perspective of other >+origins). >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section Response so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5.4-opaque-response-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5.4-opaque-response-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5fabdd78893ba95ce7b714b0332704f3040ad094 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5.4-opaque-response-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section OpaqueResponse so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5.4-opaque-response.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5.4-opaque-response.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a91306f4c3c85d1b3181e5bb62016157b71e3e14 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.5.4-opaque-response.html >@@ -0,0 +1,36 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: OpaqueResponse</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#opaque-response"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`OpaqueResponse` objects are immutable but constructable. The `fetch()` API >+returns this type for cross-origin responses. >+ >+Their role is to encapsulate the security properties of the web platform. As >+such, their `body` attribute will always be `undefined` and the list of >+readable `headers` is heavily filtered. >+ >+`OpaqueResponse` objects may be forwarded on to rendering documents in exactly >+the same way as mutable `Response` objects. >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section OpaqueResponse so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6-cache-objects-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6-cache-objects-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ab9a5058e8de2a761b3c64433b8c2f12f10fd32f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6-cache-objects-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section Caches so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6-cache-objects.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6-cache-objects.html >new file mode 100644 >index 0000000000000000000000000000000000000000..befd67cb378b0ea3e0f8d45cad3e344a4e2f9610 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6-cache-objects.html >@@ -0,0 +1,37 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: Caches</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#cache-objects"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+To allow authors to fully manage their content caches for offline use, the >+`[ServiceWorkerGlobalScope][1]` execution context provides the caching methods >+largely conforming to [ECMAScript 6 Map objects][2] with additional convenience >+methods. A domain can have multiple, named `[Cache][3]` objects, whose contents >+are entirely under the control of scripts. Caches are not shared across >+domains, and they are completely isolated from the browser's HTTP cache. >+ >+[1]: #service-worker-global-scope-interface >+[2]: http://goo.gl/gNnDPO >+[3]: #cache-interface >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section Caches so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.1-cache-lifetimes-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.1-cache-lifetimes-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..aa13b400aeb7806229404328ebca1d85dc8a4518 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.1-cache-lifetimes-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section Understanding Cache Lifetimes so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.1-cache-lifetimes.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.1-cache-lifetimes.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f6c9ecbd1919553af81429f1e16a6637ccc902f3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.1-cache-lifetimes.html >@@ -0,0 +1,38 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: Understanding Cache Lifetimes</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#cache-lifetimes"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+The `[Cache][1]` instances are not part of the browser's HTTP cache. The >+`[Cache][1]` objects are exactly what authors have to manage themselves. The >+`[Cache][1]` objects do not get updated unless authors explicitly request them >+to be. The `[Cache][1]` objects do not expire unless authors delete the >+entries. The `[Cache][1]` objects do not disappear just because the Service >+Worker script is updated. That is, caches are not updated automatically. >+Updates must be manually managed. This implies that authors should version >+their caches by name and make sure to use the caches only from the version of >+the ServiceWorker that can safely operate on. >+ >+[1]: #cache-interface >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section Understanding Cache Lifetimes so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.2-cache-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.2-cache-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a61649b99c59f6ce5a4151320e89fcc597e00870 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.2-cache-expected.txt >@@ -0,0 +1,31 @@ >+ >+PASS Cache interface: existence and properties of interface object >+PASS Cache interface object length >+PASS Cache interface object name >+PASS Cache interface: existence and properties of interface prototype object >+PASS Cache interface: existence and properties of interface prototype object's "constructor" property >+PASS Cache interface: existence and properties of interface prototype object's @@unscopables property >+PASS Cache interface: operation match(RequestInfo, CacheQueryOptions) >+PASS Cache interface: operation matchAll(RequestInfo, CacheQueryOptions) >+PASS Cache interface: operation add(RequestInfo) >+PASS Cache interface: operation addAll([object Object]) >+PASS Cache interface: operation put(RequestInfo, Response) >+PASS Cache interface: operation delete(RequestInfo, CacheQueryOptions) >+PASS Cache interface: operation keys(RequestInfo, CacheQueryOptions) >+FAIL Cache must be primary interface of throw new Error ('No object defined for the Cache interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Stringification of throw new Error ('No object defined for the Cache interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: throw new Error ('No object defined for the Cache interface') must inherit property "match(RequestInfo, CacheQueryOptions)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: calling match(RequestInfo, CacheQueryOptions) on throw new Error ('No object defined for the Cache interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: throw new Error ('No object defined for the Cache interface') must inherit property "matchAll(RequestInfo, CacheQueryOptions)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: calling matchAll(RequestInfo, CacheQueryOptions) on throw new Error ('No object defined for the Cache interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: throw new Error ('No object defined for the Cache interface') must inherit property "add(RequestInfo)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: calling add(RequestInfo) on throw new Error ('No object defined for the Cache interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: throw new Error ('No object defined for the Cache interface') must inherit property "addAll([object Object])" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: calling addAll([object Object]) on throw new Error ('No object defined for the Cache interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: throw new Error ('No object defined for the Cache interface') must inherit property "put(RequestInfo, Response)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: calling put(RequestInfo, Response) on throw new Error ('No object defined for the Cache interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: throw new Error ('No object defined for the Cache interface') must inherit property "delete(RequestInfo, CacheQueryOptions)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: calling delete(RequestInfo, CacheQueryOptions) on throw new Error ('No object defined for the Cache interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: throw new Error ('No object defined for the Cache interface') must inherit property "keys(RequestInfo, CacheQueryOptions)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+FAIL Cache interface: calling keys(RequestInfo, CacheQueryOptions) on throw new Error ('No object defined for the Cache interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the Cache interface" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.2-cache.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.2-cache.html >new file mode 100644 >index 0000000000000000000000000000000000000000..9270481d1837fb5c2c242de41e6653a26601cc3d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.2-cache.html >@@ -0,0 +1,64 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: Cache</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#cache"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ <script src=/resources/WebIDLParser.js></script> >+ <script src=/resources/idlharness.js></script> >+ >+ </head> >+ <body> >+ >+<script type=text/plain id="idl_0"> >+[Exposed=(Window,Worker)] >+interface Cache { >+ Promise<Response> match(RequestInfo request, optional CacheQueryOptions options); >+ Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options); >+ Promise<void> add(RequestInfo request); >+ Promise<void> addAll(sequence<RequestInfo> requests); >+ Promise<void> put(RequestInfo request, Response response); >+ Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options); >+ Promise<sequence<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options); >+}; >+ >+dictionary CacheQueryOptions { >+ boolean ignoreSearch = false; >+ boolean ignoreMethod = false; >+ boolean ignoreVary = false; >+ DOMString cacheName; >+}; >+ >+dictionary CacheBatchOperation { >+ DOMString type; >+ Request request; >+ Response response; >+ CacheQueryOptions options; >+}; >+</script> >+ >+ >+ >+ <script type=text/plain id="untested_idls"> >+ interface AbstractResponse {}; >+ interface Request {}; >+ interface ScalarValueString {}; >+ </script> >+ >+ <script> >+ var idl_array = new IdlArray(); >+ idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); >+ idl_array.add_idls(document.getElementById("idl_0").textContent); >+ idl_array.add_objects({ >+ Cache: ["throw new Error ('No object defined for the Cache interface')"], >+ QueryParams: ["throw new Error ('No object defined for the QueryParams dictionary')"], >+ CacheIterationCallback: ["throw new Error ('No object defined for the CacheIterationCallback callback')"] >+ }); >+ idl_array.test(); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.3-cache-storage-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.3-cache-storage-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6b118faf107082191a406c421be305e38109a493 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.3-cache-storage-expected.txt >@@ -0,0 +1,39 @@ >+CONSOLE MESSAGE: line 482: callback not yet supported >+ >+PASS CacheStorage interface: existence and properties of interface object >+FAIL CacheStorage interface object length assert_equals: wrong value for CacheStorage.length expected 1 but got 0 >+PASS CacheStorage interface object name >+PASS CacheStorage interface: existence and properties of interface prototype object >+PASS CacheStorage interface: existence and properties of interface prototype object's "constructor" property >+PASS CacheStorage interface: existence and properties of interface prototype object's @@unscopables property >+PASS CacheStorage interface: operation match(ScalarValueString, DOMString) >+FAIL CacheStorage interface: operation get(DOMString) assert_own_property: interface prototype object missing non-static operation expected property "get" missing >+PASS CacheStorage interface: operation has(DOMString) >+FAIL CacheStorage interface: operation set(DOMString, Cache) assert_own_property: interface prototype object missing non-static operation expected property "set" missing >+FAIL CacheStorage interface: operation clear() assert_own_property: interface prototype object missing non-static operation expected property "clear" missing >+PASS CacheStorage interface: operation delete(DOMString) >+FAIL CacheStorage interface: operation forEach(CacheStorageIterationCallback, object) assert_own_property: interface prototype object missing non-static operation expected property "forEach" missing >+FAIL CacheStorage interface: operation entries() assert_own_property: interface prototype object missing non-static operation expected property "entries" missing >+PASS CacheStorage interface: operation keys() >+FAIL CacheStorage interface: operation values() assert_own_property: interface prototype object missing non-static operation expected property "values" missing >+FAIL CacheStorage interface: operation size() assert_own_property: interface prototype object missing non-static operation expected property "size" missing >+FAIL CacheStorage must be primary interface of throw new Error ('No object defined for the CacheStorage interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL Stringification of throw new Error ('No object defined for the CacheStorage interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: throw new Error ('No object defined for the CacheStorage interface') must inherit property "match(ScalarValueString, DOMString)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: calling match(ScalarValueString, DOMString) on throw new Error ('No object defined for the CacheStorage interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: throw new Error ('No object defined for the CacheStorage interface') must inherit property "get(DOMString)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: calling get(DOMString) on throw new Error ('No object defined for the CacheStorage interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: throw new Error ('No object defined for the CacheStorage interface') must inherit property "has(DOMString)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: calling has(DOMString) on throw new Error ('No object defined for the CacheStorage interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: throw new Error ('No object defined for the CacheStorage interface') must inherit property "set(DOMString, Cache)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: calling set(DOMString, Cache) on throw new Error ('No object defined for the CacheStorage interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: throw new Error ('No object defined for the CacheStorage interface') must inherit property "clear()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: throw new Error ('No object defined for the CacheStorage interface') must inherit property "delete(DOMString)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: calling delete(DOMString) on throw new Error ('No object defined for the CacheStorage interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: throw new Error ('No object defined for the CacheStorage interface') must inherit property "forEach(CacheStorageIterationCallback, object)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: calling forEach(CacheStorageIterationCallback, object) on throw new Error ('No object defined for the CacheStorage interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: throw new Error ('No object defined for the CacheStorage interface') must inherit property "entries()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: throw new Error ('No object defined for the CacheStorage interface') must inherit property "keys()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: throw new Error ('No object defined for the CacheStorage interface') must inherit property "values()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+FAIL CacheStorage interface: throw new Error ('No object defined for the CacheStorage interface') must inherit property "size()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the CacheStorage interface" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.3-cache-storage.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.3-cache-storage.html >new file mode 100644 >index 0000000000000000000000000000000000000000..29666d837fc05c0315043c97e7ab4f30efad0771 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.6.3-cache-storage.html >@@ -0,0 +1,62 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: CacheStorage</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#cache-storage"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ <script src=/resources/WebIDLParser.js></script> >+ <script src=/resources/idlharness.js></script> >+ >+ </head> >+ <body> >+ >+<script type=text/plain id="idl_0"> >+[Constructor(sequence<any> iterable)] >+interface CacheStorage { >+ Promise<any> match(ScalarValueString url, optional DOMString cacheName); >+ Promise<Cache> get(DOMString key); >+ Promise<boolean> has(DOMString key); >+ Promise<any> set(DOMString key, Cache val); >+ Promise<any> clear(); >+ Promise<any> delete(DOMString key); >+ void forEach(CacheStorageIterationCallback callback, optional object thisArg); >+ Promise<sequence<any>> entries(); >+ Promise<sequence<DOMString>> keys(); >+ Promise<sequence<Cache>> values(); >+ Promise<unsigned long> size(); >+}; >+ >+callback CacheStorageIterationCallback = void (Cache value, DOMString key, CacheStorage map); >+</script> >+ >+<!-- >+**Note**:[CacheStorage][1]interface is designed to largely conform >+to[ECMAScript 6 Map objects][2]but entirely async, and with additional >+convenience methods. >+ >+[1]: #cache-storage-interface >+[2]: http://goo.gl/gNnDPO >+--> >+ >+ >+ <script type=text/plain id="untested_idls"> >+ interface ScalarValueString {}; >+ interface Cache {}; >+ </script> >+ >+ <script> >+ var idl_array = new IdlArray(); >+ idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); >+ idl_array.add_idls(document.getElementById("idl_0").textContent); >+ idl_array.add_objects({ >+ CacheStorage: ["throw new Error ('No object defined for the CacheStorage interface')"], >+ CacheStorageIterationCallback: ["throw new Error ('No object defined for the CacheStorageIterationCallback callback')"] >+ }); >+ idl_array.test(); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.1-install-phase-event-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.1-install-phase-event-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ee457c448a1c162cdac5580268d8e0aadb2ad75f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.1-install-phase-event-expected.txt >@@ -0,0 +1,13 @@ >+ >+FAIL InstallPhaseEvent interface: existence and properties of interface object assert_own_property: self does not have own property "InstallPhaseEvent" expected property "InstallPhaseEvent" missing >+FAIL InstallPhaseEvent interface object length assert_own_property: self does not have own property "InstallPhaseEvent" expected property "InstallPhaseEvent" missing >+FAIL InstallPhaseEvent interface object name assert_own_property: self does not have own property "InstallPhaseEvent" expected property "InstallPhaseEvent" missing >+FAIL InstallPhaseEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "InstallPhaseEvent" expected property "InstallPhaseEvent" missing >+FAIL InstallPhaseEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "InstallPhaseEvent" expected property "InstallPhaseEvent" missing >+FAIL InstallPhaseEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "InstallPhaseEvent" expected property "InstallPhaseEvent" missing >+FAIL InstallPhaseEvent interface: operation waitUntil([object Object]) assert_own_property: self does not have own property "InstallPhaseEvent" expected property "InstallPhaseEvent" missing >+FAIL InstallPhaseEvent must be primary interface of throw new Error ('No object defined for the InstallPhaseEvent interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the InstallPhaseEvent interface" >+FAIL Stringification of throw new Error ('No object defined for the InstallPhaseEvent interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the InstallPhaseEvent interface" >+FAIL InstallPhaseEvent interface: throw new Error ('No object defined for the InstallPhaseEvent interface') must inherit property "waitUntil([object Object])" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the InstallPhaseEvent interface" >+FAIL InstallPhaseEvent interface: calling waitUntil([object Object]) on throw new Error ('No object defined for the InstallPhaseEvent interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the InstallPhaseEvent interface" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.1-install-phase-event.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.1-install-phase-event.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8b7ab81c5eff4a5ce03cb6939d75a1e38d5290d6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.1-install-phase-event.html >@@ -0,0 +1,51 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: InstallPhaseEvent</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#install-phase-event"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ <script src=/resources/WebIDLParser.js></script> >+ <script src=/resources/idlharness.js></script> >+ >+ </head> >+ <body> >+ >+<script type=text/plain id="idl_0"> >+interface InstallPhaseEvent : Event { >+ Promise<any> waitUntil(Promise<any> f); >+}; >+</script> >+ >+<!-- >+Service Workers have two [Lifecycle events][1], `[install][2]` and >+`[activate][3]`. Service Workers use the `[InstallPhaseEvent][4]` interface for >+`[activate][3]` event and the `[InstallEvent][5]` interface, which inherits >+from the `[InstallPhaseEvent][4]` interface, for `[install][2]` event. >+ >+[1]: #lifecycle-events >+[2]: #install-event >+[3]: #activate-event >+[4]: #install-phase-event-interface >+[5]: #install-event-interface >+--> >+ >+ >+ <script type=text/plain id="untested_idls"> >+ interface Event {}; >+ </script> >+ >+ <script> >+ var idl_array = new IdlArray(); >+ idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); >+ idl_array.add_idls(document.getElementById("idl_0").textContent); >+ idl_array.add_objects({ >+ InstallPhaseEvent: ["throw new Error ('No object defined for the InstallPhaseEvent interface')"] >+ }); >+ idl_array.test(); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.1.1-wait-until-method-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.1.1-wait-until-method-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6857b57d00b94da04c3aadcda9c7b376b7622027 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.1.1-wait-until-method-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section event.waitUntil(f) so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.1.1-wait-until-method.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.1.1-wait-until-method.html >new file mode 100644 >index 0000000000000000000000000000000000000000..318318b13940cd9f5f8ebab8b93b6ec371ffb3ff >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.1.1-wait-until-method.html >@@ -0,0 +1,39 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: event.waitUntil(f)</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#wait-until-method"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`event.waitUntil(f)` method, when called in `oninstall` or `onactivate`, >+extends the lifetime of the event. When called in `oninstall`, it delays >+treating the installing worker until the passed [Promise][1] resolves >+successfully. This is primarily used to ensure that a `ServiceWorker` is not >+active until all of the core caches it depends on are populated. When called in >+`onactivate`, it delays treating the activating worker until the passed >+[Promise][1] resolves successfully. This is primarily used to ensure that any >+[Functional events][2] are not dispatched to the `ServiceWorker` until it >+upgrades database schemas and deletes the outdated cache entries. >+ >+[1]: http://goo.gl/3TobQS >+[2]: #functional-events >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section event.waitUntil(f) so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2-install-event-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2-install-event-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e176016a7228e377d813dfc544ae276d50ed2e0d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2-install-event-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section install Event so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2-install-event.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2-install-event.html >new file mode 100644 >index 0000000000000000000000000000000000000000..77702ed02833c762b3cb12d3144c39844f5f8713 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2-install-event.html >@@ -0,0 +1,35 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: install Event</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#install-event"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+An event named `[install][1]` using the `[InstallEvent][2]` interface is >+dispatched on `ServiceWorkerGlobalScope` object when the state of the >+associated `ServiceWorker` changes its value to `installing`. (See step 3 of >+[_Installation algorithm][3]) >+ >+[1]: #install-event >+[2]: #install-event-interface >+[3]: #installation-algorithm >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section install Event so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2.1-install-event-section-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2.1-install-event-section-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..49afc6826e8f5f74230e065f1ff590970f1edffd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2.1-install-event-section-expected.txt >@@ -0,0 +1,14 @@ >+ >+FAIL InstallEvent interface: existence and properties of interface object assert_own_property: self does not have own property "InstallEvent" expected property "InstallEvent" missing >+FAIL InstallEvent interface object length assert_own_property: self does not have own property "InstallEvent" expected property "InstallEvent" missing >+FAIL InstallEvent interface object name assert_own_property: self does not have own property "InstallEvent" expected property "InstallEvent" missing >+FAIL InstallEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "InstallEvent" expected property "InstallEvent" missing >+FAIL InstallEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "InstallEvent" expected property "InstallEvent" missing >+FAIL InstallEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "InstallEvent" expected property "InstallEvent" missing >+FAIL InstallEvent interface: attribute activeWorker assert_own_property: self does not have own property "InstallEvent" expected property "InstallEvent" missing >+FAIL InstallEvent interface: operation replace() assert_own_property: self does not have own property "InstallEvent" expected property "InstallEvent" missing >+FAIL InstallEvent must be primary interface of throw new Error ('No object defined for the InstallEvent interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the InstallEvent interface" >+FAIL Stringification of throw new Error ('No object defined for the InstallEvent interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the InstallEvent interface" >+FAIL InstallEvent interface: throw new Error ('No object defined for the InstallEvent interface') must inherit property "activeWorker" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the InstallEvent interface" >+FAIL InstallEvent interface: throw new Error ('No object defined for the InstallEvent interface') must inherit property "replace()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the InstallEvent interface" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2.1-install-event-section.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2.1-install-event-section.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d9b47e195af2b35f8d4f803caacd23e00e74f155 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2.1-install-event-section.html >@@ -0,0 +1,47 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: InstallEvent</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#install-event-section"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ <script src=/resources/WebIDLParser.js></script> >+ <script src=/resources/idlharness.js></script> >+ >+ </head> >+ <body> >+ >+<script type=text/plain id="idl_0"> >+interface InstallEvent : InstallPhaseEvent { >+ readonly attribute ServiceWorker? activeWorker; >+ void replace(); >+}; >+</script> >+ >+<!-- >+Service Workers use the `[InstallEvent][1]` interface for `[install][2]` event. >+ >+[1]: #install-event-interface >+[2]: #install-event >+--> >+ >+ >+ <script type=text/plain id="untested_idls"> >+ interface ServiceWorker {}; >+ interface InstallPhaseEvent {}; >+ </script> >+ >+ <script> >+ var idl_array = new IdlArray(); >+ idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); >+ idl_array.add_idls(document.getElementById("idl_0").textContent); >+ idl_array.add_objects({ >+ InstallEvent: ["throw new Error ('No object defined for the InstallEvent interface')"] >+ }); >+ idl_array.test(); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2.2-replace-method-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2.2-replace-method-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..70e56ddb02ff76d4053cd81382dd73c1ff8a5969 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2.2-replace-method-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section event.replace() so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2.2-replace-method.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2.2-replace-method.html >new file mode 100644 >index 0000000000000000000000000000000000000000..6981d3079c3e108d6f4c96a69db719e206d09c75 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.2.2-replace-method.html >@@ -0,0 +1,38 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: event.replace()</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#replace-method"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`replace()` interacts with `waitUntil` method in the following way: >+ >+- Successful installation can be delayed by `waitUntil`, perhaps by >+ subsequent event handlers. >+- Replacement only happens upon successful installation >+- Therefore, replacement of the [active worker][1] (if any) is not >+ immediate, however it may occur as soon as the end of the current turn. >+ >+ >+ >+[1]: #navigator-service-worker-active >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section event.replace() so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.3-activate-event-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.3-activate-event-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3bf3f0dc50870ebcf095cadb326f1e33307e2e8d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.3-activate-event-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section activate Event so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.3-activate-event.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.3-activate-event.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2a0162e5fd3eb48db2905bee9982fbe65e399793 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.3-activate-event.html >@@ -0,0 +1,41 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: activate Event</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#activate-event"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+An event named `[activate][1]` using the `[InstallPhaseEvent][2]` interface is >+dispatched on `ServiceWorkerGlobalScope` object when the state of the >+associated `ServiceWorker` changes its value to `activating`. (See step 6 of >+[_Activation algorithm][3]) >+ >+Service Workers use the `[InstallPhaseEvent][4]` interface for `[activate][1]` >+event. >+ >+ >+ >+[1]: #activate-event >+[2]: #install-phase-event >+[3]: #activation-algorithm >+[4]: #install-phase-event-interface >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section activate Event so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.1-fetch-event-section-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.1-fetch-event-section-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e2deabca5d6bf41d0b6aea574d9c24bb2e0d59ec >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.1-fetch-event-section-expected.txt >@@ -0,0 +1,29 @@ >+CONSOLE MESSAGE: line 867: Invalid object member name Context >+ >+Harness Error (FAIL), message = Invalid object member name Context >+ >+FAIL FetchEvent interface: existence and properties of interface object assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent interface object length assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent interface object name assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent interface: attribute request assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent interface: attribute client assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent interface: attribute context assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent interface: attribute isReload assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent interface: operation respondWith([object Object]) assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent interface: operation forwardTo(ScalarValueString) assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent interface: operation default() assert_own_property: self does not have own property "FetchEvent" expected property "FetchEvent" missing >+FAIL FetchEvent must be primary interface of throw new Error ('No object defined for the FetchEvent interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the FetchEvent interface" >+FAIL Stringification of throw new Error ('No object defined for the FetchEvent interface') assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the FetchEvent interface" >+FAIL FetchEvent interface: throw new Error ('No object defined for the FetchEvent interface') must inherit property "request" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the FetchEvent interface" >+FAIL FetchEvent interface: throw new Error ('No object defined for the FetchEvent interface') must inherit property "client" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the FetchEvent interface" >+FAIL FetchEvent interface: throw new Error ('No object defined for the FetchEvent interface') must inherit property "context" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the FetchEvent interface" >+FAIL FetchEvent interface: throw new Error ('No object defined for the FetchEvent interface') must inherit property "isReload" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the FetchEvent interface" >+FAIL FetchEvent interface: throw new Error ('No object defined for the FetchEvent interface') must inherit property "respondWith([object Object])" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the FetchEvent interface" >+FAIL FetchEvent interface: calling respondWith([object Object]) on throw new Error ('No object defined for the FetchEvent interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the FetchEvent interface" >+FAIL FetchEvent interface: throw new Error ('No object defined for the FetchEvent interface') must inherit property "forwardTo(ScalarValueString)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the FetchEvent interface" >+FAIL FetchEvent interface: calling forwardTo(ScalarValueString) on throw new Error ('No object defined for the FetchEvent interface') with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the FetchEvent interface" >+FAIL FetchEvent interface: throw new Error ('No object defined for the FetchEvent interface') must inherit property "default()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "Error: No object defined for the FetchEvent interface" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.1-fetch-event-section.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.1-fetch-event-section.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ace71967bdf868b11b2cca58e8893523b9121894 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.1-fetch-event-section.html >@@ -0,0 +1,71 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: FetchEvent</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#fetch-event-section"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ <script src=/resources/WebIDLParser.js></script> >+ <script src=/resources/idlharness.js></script> >+ >+ </head> >+ <body> >+ >+<script type=text/plain id="idl_0"> >+[Constructor] >+interface FetchEvent : Event { >+ readonly attribute Request request; >+ readonly attribute Client client; // The window issuing the request. >+ readonly attribute Context context; >+ readonly attribute boolean isReload; >+ >+ void respondWith(Promise<AbstractResponse> r); >+ Promise<any> forwardTo(ScalarValueString url); >+ Promise<any> default(); >+}; >+ >+enum Context { >+ "connect", >+ "font", >+ "img", >+ "object", >+ "script", >+ "style", >+ "worker", >+ "popup", >+ "child", >+ "navigate" >+}; >+</script> >+ >+<!-- >+Service Workers use the `[FetchEvent][1]` interface for `[fetch][2]` event. >+ >+[1]: #fetch-event-interface >+[2]: #fetch-event >+--> >+ >+ >+ <script type=text/plain id="untested_idls"> >+ interface Request {}; >+ interface Client {}; >+ interface AbstractResponse {}; >+ interface ScalarValueString {}; >+ interface Event {}; >+ </script> >+ >+ <script> >+ var idl_array = new IdlArray(); >+ idl_array.add_untested_idls(document.getElementById("untested_idls").textContent); >+ idl_array.add_idls(document.getElementById("idl_0").textContent); >+ idl_array.add_objects({ >+ FetchEvent: ["throw new Error ('No object defined for the FetchEvent interface')"], >+ Context: ["throw new Error ('No object defined for the Context enum')"] >+ }); >+ idl_array.test(); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.2-respond-with-method-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.2-respond-with-method-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9f460c6c94409cca151f11290ea7b0314e4db176 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.2-respond-with-method-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section event.respondWith(r) so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.2-respond-with-method.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.2-respond-with-method.html >new file mode 100644 >index 0000000000000000000000000000000000000000..416b8ef517a85692348058595b27baeae9abe04d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.2-respond-with-method.html >@@ -0,0 +1,46 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: event.respondWith(r)</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#respond-with-method"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`event.respondWith(r)` method must run the steps, from step 10 to step 15, >+defined in the [_OnFetchRequest algorithm][1]. >+ >+The `r` argument must resolve with a [AbstractResponse][2], else a >+[NetworkError][3] is thrown. If the request is a top-level navigation and the >+return value is a [OpaqueResponse][4] (an opaque response body), a >+[NetworkError][3] is thrown. The final URL of all successful (non >+network-error) responses is the [requested][5] URL. Renderer-side security >+checks about tainting for cross-origin content are tied to the transparency (or >+opacity) of the [Response][6] body, not URLs. >+ >+ >+ >+[1]: #on-fetch-request-algorithm >+[2]: #abstract-response-interface >+[3]: http://w3c.github.io/dom/#networkerror >+[4]: #opaque-response-interface >+[5]: #request-objects >+[6]: #response-interface >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section event.respondWith(r) so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.3-default-method-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.3-default-method-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1c7728fa5fad8e5801dfb9382514da1dc68833fb >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.3-default-method-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section event.default() so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.3-default-method.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.3-default-method.html >new file mode 100644 >index 0000000000000000000000000000000000000000..deff7ac4238eac47b82833814fe6f8babf941b5d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.3-default-method.html >@@ -0,0 +1,52 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: event.default()</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#default-method"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+`event.default()` method must run these steps: >+ >+1. Let `promise` be a newly-created [promise][1]. >+2. Return `promise.` >+3. Run the following steps asynchronously: >+ 1. Let `request` be `event`'s `request`. >+ 2. Set `request`'s [skip service worker flag][2]. >+ 3. Let `response` be the result of running [fetch algorithm][3] with >+ `request` as its argument. >+ 4. If `response` is a [network error][4], then: >+ 1. Reject `promise` with a new [DOMException][5] whose name is >+ "[NetworkError][6]". >+ 5. Else, >+ 1. Resolve `promise` with a new [Response][7] object associated >+ with `response`. >+ >+ >+ >+[1]: http://goo.gl/3TobQS >+[2]: http://goo.gl/gP7IWW >+[3]: http://goo.gl/fGMifs >+[4]: http://goo.gl/jprjjc >+[5]: http://goo.gl/A0U8qC >+[6]: http://goo.gl/lud5HB >+[7]: http://goo.gl/Deazjv >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section event.default() so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.4-is-reload-attribute-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.4-is-reload-attribute-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f43f970eab3078e7b7fe79fe36d862a7c9e978be >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.4-is-reload-attribute-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section event.isReload so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.4-is-reload-attribute.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.4-is-reload-attribute.html >new file mode 100644 >index 0000000000000000000000000000000000000000..fffe5d5b29f1cd0bb46f2a2cd3a98a67bcedefd4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-4.7.4.4-is-reload-attribute.html >@@ -0,0 +1,32 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: event.isReload</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#is-reload-attribute"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+Returns true if `event` was dispatched with the user's intention for the page >+reload, and false otherwise. Pressing the refresh button should be considered a >+reload while clicking a link and pressing the back button should not. The >+behavior of the `Ctrl+l enter` is left to the implementations of the user >+agents. >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section event.isReload so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-5.1-origin-relativity-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-5.1-origin-relativity-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5d6e1df58a133579dd18bb8b5d23eca422569d6d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-5.1-origin-relativity-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section Origin Relativity so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-5.1-origin-relativity.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-5.1-origin-relativity.html >new file mode 100644 >index 0000000000000000000000000000000000000000..469ce2975cd5263829e2f9195b366db1c0268471 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-5.1-origin-relativity.html >@@ -0,0 +1,35 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: Origin Relativity</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#origin-relativity"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+One of the advanced concerns that major applications would encounter is whether >+they can be hosted from a CDN. By definition, these are servers in other >+places, often on other domains. Therefore, Service Workers cannot be hosted on >+CDNs. But they can include resources via [importScripts()][1]. The reason for >+this restriction is that Service Workers create the opportunity for a bad actor >+to turn a bad day into a bad eternity. >+ >+[1]: http://goo.gl/Owcfs2 >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section Origin Relativity so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-5.2-cross-origin-resources-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-5.2-cross-origin-resources-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1ac71d562e4950358f38b525b7b084cba646bbfd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-5.2-cross-origin-resources-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS There are no tests for section Cross-Origin Resources & CORS so far. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-5.2-cross-origin-resources.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-5.2-cross-origin-resources.html >new file mode 100644 >index 0000000000000000000000000000000000000000..42c685b1d5525be8c3ed68a9112b2d546e78bcf6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/stub-5.2-cross-origin-resources.html >@@ -0,0 +1,48 @@ >+<!DOCTYPE html> >+<html> >+<title>Service Workers: Cross-Origin Resources & CORS</title> >+ <head> >+ <link rel="help" href="https://w3c.github.io/ServiceWorker/#cross-origin-resources"> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ >+ </head> >+ <body> >+ >+<!-- >+ >+Applications tend to cache items that come from a CDN or other domain. It is >+possible to request many of them directly using <script>, <img>, <video> and >+<link> elements. It would be hugely limiting if this sort of runtime >+collaboration broke when offline. Similarly, it is possible to XHR many sorts >+of off-domain resources when appropriate CORS headers are set. >+ >+ServiceWorkers enable this by allowing `Cache`s to fetch and cache off-origin >+items. Some restrictions apply, however. First, unlike same-origin resources >+which are managed in the `Cache` as `[Promise][1]`s for `Response` instances, >+the objects stored are `[Promise][1]`s for `OpaqueResponse` instances. >+`OpaqueResponse` provides a much less expressive API than `Response`; the >+bodies and headers cannot be read or set, nor many of the other aspects of >+their content inspected. They can be passed to `respondWith()` and >+`forwardTo()` in the same manner as `Response`s, but cannot be meaningfully >+created programmatically. These limitations are necessary to preserve the >+security invariants of the platform. Allowing `Cache`s to store them allows >+applications to avoid re-architecting in most cases. >+ >+ >+ >+[1]: http://goo.gl/3TobQS >+ >+--> >+ >+ >+ >+ <script> >+ test(function() { >+ // not_implemented(); >+ }, "There are no tests for section Cross-Origin Resources & CORS so far."); >+ </script> >+ >+ </body> >+</html> >+ >diff --git a/LayoutTests/tests-options.json b/LayoutTests/tests-options.json >index 63008c24dd8e77d3420039e925e4d99e86fc466a..954e3abc0100f933550ae6bcd1f83d7660f0e831 100644 >--- a/LayoutTests/tests-options.json >+++ b/LayoutTests/tests-options.json >@@ -1661,9 +1661,21 @@ > "imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-order.https.html": [ > "slow" > ], >+ "imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https.html": [ >+ "slow" >+ ], >+ "imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video-cache.https.html": [ >+ "slow" >+ ], >+ "imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video.https.html": [ >+ "slow" >+ ], > "imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-redirect.https.html": [ > "slow" > ], >+ "imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html": [ >+ "slow" >+ ], > "imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https.html": [ > "slow" > ], >@@ -1685,6 +1697,9 @@ > "imported/w3c/web-platform-tests/service-workers/service-worker/fetch-waits-for-activate.https.html": [ > "slow" > ], >+ "imported/w3c/web-platform-tests/service-workers/service-worker/interfaces-window.https.html": [ >+ "slow" >+ ], > "imported/w3c/web-platform-tests/service-workers/service-worker/local-url-inherit-controller.https.html": [ > "slow" > ], >@@ -1694,12 +1709,27 @@ > "imported/w3c/web-platform-tests/service-workers/service-worker/register-closed-window.https.html": [ > "slow" > ], >+ "imported/w3c/web-platform-tests/service-workers/service-worker/registration-mime-types.https.html": [ >+ "slow" >+ ], > "imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https.html": [ > "slow" > ], >+ "imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-using-registration.https.html": [ >+ "slow" >+ ], >+ "imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-without-using-registration.https.html": [ >+ "slow" >+ ], > "imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-fetch-event.https.html": [ > "slow" > ], >+ "imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-redirect.https.html": [ >+ "slow" >+ ], >+ "imported/w3c/web-platform-tests/service-workers/service-worker/update-bytecheck.https.html": [ >+ "slow" >+ ], > "imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-ontonechange-long.html": [ > "slow" > ],
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198720
: 371750