Changeset 246363 in webkit
- Timestamp:
- Jun 12, 2019 10:47:27 AM (5 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 129 added
- 98 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r246362 r246363 1 2019-06-12 Youenn Fablet <youenn@apple.com> 2 3 Update WPT service workers test up to 0df7c68 4 https://bugs.webkit.org/show_bug.cgi?id=198720 5 6 Reviewed by Eric Carlson. 7 8 * TestExpectations: 9 * tests-options.json: 10 1 11 2019-06-12 Truitt Savell <tsavell@apple.com> 2 12 -
trunk/LayoutTests/TestExpectations
r246330 r246363 2453 2453 2454 2454 webkit.org/b/182311 imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect.https.html [ Skip ] 2455 imported/w3c/web-platform-tests/service-workers/service-worker/svg-target-reftest.https.html [ ImageOnlyFailure ] 2455 2456 2456 2457 webkit.org/b/90980 fast/forms/textarea/textarea-state-restore.html [ Pass Timeout ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r246339 r246363 1 2019-06-12 Youenn Fablet <youenn@apple.com> 2 3 Update WPT service workers test up to 0df7c68 4 https://bugs.webkit.org/show_bug.cgi?id=198720 5 6 Reviewed by Eric Carlson. 7 8 * web-platform-tests/service-workers: Resynced. 9 1 10 2019-06-11 Devin Rousso <drousso@apple.com> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/script-tests/cache-match.js
r238592 r246363 144 144 }); 145 145 }, 'Cache.match supports ignoreVary'); 146 147 cache_test(function(cache) { 148 let has_cache_name = false; 149 const opts = { 150 get cacheName() { 151 has_cache_name = true; 152 return undefined; 153 } 154 }; 155 return self.caches.open('foo') 156 .then(function() { 157 return cache.match('bar', opts); 158 }) 159 .then(function() { 160 assert_false(has_cache_name, 161 'Cache.match does not support cacheName option ' + 162 'which was removed in CacheQueryOptions.'); 163 }); 164 }, 'Cache.match does not support cacheName option'); 146 165 147 166 prepopulated_cache_test(simple_entries, function(cache, entries) { … … 338 357 }, 'cors-exposed header should be stored correctly.'); 339 358 359 cache_test(async (cache) => { 360 // A URL that should load a resource with a known mime type. 361 const url = '/service-workers/cache-storage/resources/blank.html'; 362 const expected_mime_type = 'text/html'; 363 364 // Verify we get the expected mime type from the network. Note, 365 // we cannot use an exact match here since some browsers append 366 // character encoding information to the blob.type value. 367 const net_response = await fetch(url); 368 const net_mime_type = (await net_response.blob()).type; 369 assert_true(net_mime_type.includes(expected_mime_type), 370 'network response should include the expected mime type'); 371 372 // Verify we get the exact same mime type when reading the same 373 // URL resource back out of the cache. 374 await cache.add(url); 375 const cache_response = await cache.match(url); 376 const cache_mime_type = (await cache_response.blob()).type; 377 assert_equals(cache_mime_type, net_mime_type, 378 'network and cache response mime types should match'); 379 }, 'MIME type should be set from content-header correctly.'); 380 381 cache_test(async (cache) => { 382 const url = '/dummy'; 383 const original_type = 'text/html'; 384 const init_with_headers = { 385 headers: { 386 'content-type': original_type 387 } 388 } 389 390 // Verify constructing a synthetic response with a content-type header 391 // gets the correct mime type. 392 const response = new Response('hello world', init_with_headers); 393 const original_response_type = (await response.blob()).type; 394 assert_true(original_response_type.includes(original_type), 395 'original response should include the expected mime type'); 396 397 // Verify overwriting the content-type header does not change the mime 398 // type. It should be fixed at Response construction time. 399 const overwritten_response = new Response('hello world', init_with_headers); 400 overwritten_response.headers.set('content-type', 'text/plain'); 401 const overwritten_response_type = (await overwritten_response.blob()).type; 402 assert_equals(overwritten_response_type, original_response_type, 403 'original and overwritten response mime types should match'); 404 405 // Verify the Response read from Cache uses the original mime type 406 // computed when it was first constructed. 407 const tmp = new Response('hello world', init_with_headers); 408 tmp.headers.set('content-type', 'text/plain'); 409 await cache.put(url, tmp); 410 const cache_response = await cache.match(url); 411 const cache_mime_type = (await cache_response.blob()).type; 412 assert_equals(cache_mime_type, original_response_type, 413 'original and cached overwritten response mime types ' + 414 'should match'); 415 }, 'MIME type should be frozen at response construction.'); 416 340 417 done(); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https-expected.txt
r238592 r246363 11 11 PASS Cache.match supports ignoreMethod 12 12 PASS Cache.match supports ignoreVary 13 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 13 14 PASS Cache.match with URL containing fragment 14 15 PASS Cache.match with string fragment "http" as query … … 22 23 PASS Cache produces large Responses that can be cloned and read correctly. 23 24 FAIL cors-exposed header should be stored correctly. assert_equals: expected (string) "bar" but got (object) null 25 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 "" 26 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 "" 24 27 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-match.https-expected.txt
r238592 r246363 10 10 PASS Cache.match supports ignoreMethod 11 11 PASS Cache.match supports ignoreVary 12 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 12 13 PASS Cache.match with URL containing fragment 13 14 PASS Cache.match with string fragment "http" as query … … 21 22 PASS Cache produces large Responses that can be cloned and read correctly. 22 23 FAIL cors-exposed header should be stored correctly. assert_equals: expected (string) "bar" but got (object) null 24 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 "" 25 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 "" 23 26 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-match.https-expected.txt
r238592 r246363 10 10 PASS Cache.match supports ignoreMethod 11 11 PASS Cache.match supports ignoreVary 12 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 12 13 PASS Cache.match with URL containing fragment 13 14 PASS Cache.match with string fragment "http" as query … … 21 22 PASS Cache produces large Responses that can be cloned and read correctly. 22 23 FAIL cors-exposed header should be stored correctly. assert_equals: expected (string) "bar" but got (object) null 24 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 "" 25 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 "" 23 26 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/Service-Worker-Allowed-header.https-expected.txt
r238592 r246363 5 5 PASS Registering outside Service-Worker-Allowed path 6 6 PASS Registering outside Service-Worker-Allowed path with parent reference 7 PASS Service-Worker-Allowed is cross-origin to script, registering on a normally allowed scope 8 PASS Service-Worker-Allowed is cross-origin to script, registering on a normally disallowed scope 7 FAIL Service-Worker-Allowed is cross-origin to script, registering on a normally allowed scope assert_unreached: Should have rejected: undefined Reached unreachable code 8 FAIL Service-Worker-Allowed is cross-origin to script, registering on a normally disallowed scope assert_unreached: Should have rejected: undefined Reached unreachable code 9 9 PASS Service-Worker-Allowed is cross-origin to page, same-origin to script 10 10 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/Service-Worker-Allowed-header.https.html
r238592 r246363 18 18 } 19 19 20 promise_test(async t => { 21 const script = build_script_url('/allowed-path'); 22 const scope = '/allowed-path'; 23 const registration = await service_worker_unregister_and_register( 24 t, script, scope); 25 assert_true(registration instanceof ServiceWorkerRegistration, 'registered'); 26 assert_equals(registration.scope, normalizeURL(scope)); 27 return registration.unregister(); 28 }, 'Registering within Service-Worker-Allowed path'); 20 // register_test is a promise_test that registers a service worker. 21 function register_test(script, scope, description) { 22 promise_test(async t => { 23 t.add_cleanup(() => { 24 return service_worker_unregister(t, scope); 25 }); 29 26 30 promise_test(async t => { 31 const script = build_script_url(new URL('/allowed-path', document.location)); 32 const scope = '/allowed-path'; 33 const registration = await service_worker_unregister_and_register( 34 t, script, scope); 35 assert_true(registration instanceof ServiceWorkerRegistration, 'registered'); 36 assert_equals(registration.scope, normalizeURL(scope)); 37 return registration.unregister(); 38 }, 'Registering within Service-Worker-Allowed path (absolute URL)'); 27 const registration = await service_worker_unregister_and_register( 28 t, script, scope); 29 assert_true(registration instanceof ServiceWorkerRegistration, 'registered'); 30 assert_equals(registration.scope, normalizeURL(scope)); 31 }, description); 32 } 39 33 40 promise_test(async t => { 41 const script = build_script_url('../allowed-path-with-parent'); 42 const scope = 'allowed-path-with-parent'; 43 const registration = await service_worker_unregister_and_register( 44 t, script, scope); 45 assert_true(registration instanceof ServiceWorkerRegistration, 'registered'); 46 assert_equals(registration.scope, normalizeURL(scope)); 47 return registration.unregister(); 48 }, 'Registering within Service-Worker-Allowed path with parent reference'); 34 // register_fail_test is like register_test but expects a SecurityError. 35 function register_fail_test(script, scope, description) { 36 promise_test(async t => { 37 t.add_cleanup(() => { 38 return service_worker_unregister(t, scope); 39 }); 49 40 50 promise_test(async t => { 51 const script = build_script_url('../allowed-path'); 52 const scope = '/disallowed-path'; 53 await service_worker_unregister(t, scope); 54 return promise_rejects(t, 55 'SecurityError', 56 navigator.serviceWorker.register(script, {scope: scope}), 57 'register should fail'); 58 }, 'Registering outside Service-Worker-Allowed path'); 41 await service_worker_unregister(t, scope); 42 await promise_rejects(t, 43 'SecurityError', 44 navigator.serviceWorker.register(script, {scope})); 45 }, description); 46 } 59 47 60 promise_test(async t => { 61 const script = build_script_url('../allowed-path-with-parent'); 62 const scope = '/allowed-path-with-parent'; 63 await service_worker_unregister(t, scope); 64 return promise_rejects(t, 65 'SecurityError', 66 navigator.serviceWorker.register(script, {scope: scope}), 67 'register should fail'); 68 }, 'Registering outside Service-Worker-Allowed path with parent reference'); 48 register_test( 49 build_script_url('/allowed-path'), 50 '/allowed-path', 51 'Registering within Service-Worker-Allowed path'); 69 52 70 promise_test(async t => { 71 const script = build_script_url( 72 host_info.HTTPS_REMOTE_ORIGIN + '/'); 73 const scope = 'resources/this-scope-is-normally-allowed' 74 const registration = await service_worker_unregister_and_register( 75 t, script, scope); 76 assert_true(registration instanceof ServiceWorkerRegistration, 'registered'); 77 assert_equals(registration.scope, normalizeURL(scope)); 78 return registration.unregister(); 79 }, 'Service-Worker-Allowed is cross-origin to script, registering on a normally allowed scope'); 53 register_test( 54 build_script_url(new URL('/allowed-path', document.location)), 55 '/allowed-path', 56 'Registering within Service-Worker-Allowed path (absolute URL)'); 80 57 81 promise_test(async t => { 82 const script = build_script_url( 83 host_info.HTTPS_REMOTE_ORIGIN + '/'); 84 const scope = '/this-scope-is-normally-disallowed' 85 const registration = await service_worker_unregister_and_register( 86 t, script, scope); 87 assert_true(registration instanceof ServiceWorkerRegistration, 'registered'); 88 assert_equals(registration.scope, normalizeURL(scope)); 89 return registration.unregister(); 90 }, 'Service-Worker-Allowed is cross-origin to script, registering on a normally disallowed scope'); 58 register_test( 59 build_script_url('../allowed-path-with-parent'), 60 'allowed-path-with-parent', 61 'Registering within Service-Worker-Allowed path with parent reference'); 91 62 92 promise_test(async t => { 93 const script = build_script_url( 94 host_info.HTTPS_REMOTE_ORIGIN + '/cross-origin/', 95 host_info.HTTPS_REMOTE_ORIGIN); 96 const scope = '/cross-origin/'; 97 await service_worker_unregister(t, scope); 98 return promise_rejects(t, 99 'SecurityError', 100 navigator.serviceWorker.register(script, {scope: scope}), 101 'register should fail'); 102 }, 'Service-Worker-Allowed is cross-origin to page, same-origin to script'); 63 register_fail_test( 64 build_script_url('../allowed-path'), 65 '/disallowed-path', 66 'Registering outside Service-Worker-Allowed path'), 103 67 68 register_fail_test( 69 build_script_url('../allowed-path-with-parent'), 70 '/allowed-path-with-parent', 71 'Registering outside Service-Worker-Allowed path with parent reference'); 72 73 register_fail_test( 74 build_script_url(host_info.HTTPS_REMOTE_ORIGIN + '/'), 75 'resources/this-scope-is-normally-allowed', 76 'Service-Worker-Allowed is cross-origin to script, registering on a normally allowed scope'); 77 78 register_fail_test( 79 build_script_url(host_info.HTTPS_REMOTE_ORIGIN + '/'), 80 '/this-scope-is-normally-disallowed', 81 'Service-Worker-Allowed is cross-origin to script, registering on a normally disallowed scope'); 82 83 register_fail_test( 84 build_script_url(host_info.HTTPS_REMOTE_ORIGIN + '/cross-origin/', 85 host_info.HTTPS_REMOTE_ORIGIN), 86 '/cross-origin/', 87 'Service-Worker-Allowed is cross-origin to page, same-origin to script'); 104 88 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/postmessage.https.html
r220223 r246363 13 13 return service_worker_unregister_and_register(t, script, scope) 14 14 .then(function(r) { 15 t.add_cleanup(function() { 16 return service_worker_unregister(t, scope); 17 }); 18 15 19 registration = r; 20 16 21 return wait_for_state(t, registration.installing, 'activated'); 17 22 }) … … 29 34 .then(function(result) { 30 35 assert_equals(result, 'OK'); 31 return service_worker_unregister_and_done(t, scope);32 36 }); 33 37 }, 'Post loopback messages'); … … 42 46 return service_worker_unregister_and_register(t, script1, scope) 43 47 .then(function(r) { 48 t.add_cleanup(function() { 49 return service_worker_unregister(t, scope); 50 }); 51 44 52 registration = r; 45 53 return wait_for_state(t, registration.installing, 'activated'); … … 70 78 assert_equals(result, 'OK'); 71 79 frame.remove(); 72 return service_worker_unregister_and_done(t, scope);73 80 }); 74 81 }, 'Post messages among service workers'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/unregister.https.html
r202471 r246363 12 12 return service_worker_unregister_and_register(t, script, scope) 13 13 .then(function(registration) { 14 t.add_cleanup(function() { 15 return service_worker_unregister(t, scope); 16 }); 17 14 18 return wait_for_state(t, registration.installing, 'redundant'); 15 19 }) … … 22 26 undefined, 23 27 'After unregister(), the registration should not found'); 24 return service_worker_unregister_and_done(t, scope);25 28 }); 26 29 }, 'Unregister on script evaluation'); … … 32 35 return service_worker_unregister_and_register(t, script, scope) 33 36 .then(function(registration) { 37 t.add_cleanup(function() { 38 return service_worker_unregister(t, scope); 39 }); 40 34 41 return wait_for_state(t, registration.installing, 'redundant'); 35 42 }) … … 42 49 undefined, 43 50 'After unregister(), the registration should not found'); 44 return service_worker_unregister_and_done(t, scope);45 51 }); 46 52 }, 'Unregister on installing event'); … … 52 58 return service_worker_unregister_and_register(t, script, scope) 53 59 .then(function(registration) { 60 t.add_cleanup(function() { 61 return service_worker_unregister(t, scope); 62 }); 63 54 64 return wait_for_state(t, registration.installing, 'redundant'); 55 65 }) … … 62 72 undefined, 63 73 'After unregister(), the registration should not found'); 64 return service_worker_unregister_and_done(t, scope);65 74 }); 66 75 }, 'Unregister on activate event'); … … 75 84 return service_worker_unregister_and_register(t, script, scope) 76 85 .then(function(registration) { 86 t.add_cleanup(function() { 87 return service_worker_unregister(t, scope); 88 }); 89 77 90 return wait_for_state(t, registration.installing, 'activated'); 78 91 }) … … 121 134 frame.remove(); 122 135 new_frame.remove(); 123 return service_worker_unregister_and_done(t, scope);124 136 }) 125 137 }, 'Unregister controlling service worker'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/update.https.html
r202471 r246363 14 14 return service_worker_unregister_and_register(t, script, scope) 15 15 .then(function(r) { 16 t.add_cleanup(function() { 17 return service_worker_unregister(t, scope); 18 }); 19 16 20 registration = r; 17 21 return wait_for_state(t, registration.installing, 'activated'); … … 39 43 frame1.remove(); 40 44 frame2.remove(); 41 return service_worker_unregister_and_done(t, scope);42 45 }); 43 46 }, 'Update a registration on ServiceWorkerGlobalScope'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html
r238592 r246363 61 61 async function doAsyncTest(t, scope) { 62 62 let reg = await service_worker_unregister_and_register(t, worker, scope); 63 64 t.add_cleanup(() => service_worker_unregister(t, scope)); 65 63 66 await wait_for_state(t, reg.installing, 'activated'); 64 67 … … 97 100 98 101 frame.remove(); 99 await service_worker_unregister_and_done(t, scope);100 102 } 101 103 … … 127 129 128 130 let reg = await service_worker_unregister_and_register(t, worker, scope); 131 132 t.add_cleanup(() => service_worker_unregister(t, scope)); 133 129 134 await wait_for_state(t, reg.installing, 'activated'); 130 135 … … 148 153 149 154 frame.remove(); 150 await service_worker_unregister_and_done(t, scope);151 155 }, 'Initial about:blank is controlled, exposed to clients.matchAll(), and ' + 152 156 'final Client is not controlled by a service worker.'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/activate-event-after-install-state-change.https.html
r202471 r246363 12 12 return service_worker_unregister_and_register(t, script, scope) 13 13 .then(function(registration) { 14 t.add_cleanup(function() { 15 return service_worker_unregister(t, scope); 16 }); 17 14 18 var sw = registration.installing; 15 19 … … 24 28 })); 25 29 }) 26 .then(function() {27 return service_worker_unregister_and_done(t, scope);28 })29 30 .catch(unreached_rejection(t)); 30 31 }, 'installed event should be fired before activating service worker'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/appcache-ordering-main.https.html
r238592 r246363 6 6 <script> 7 7 8 var INSTALL_APPCACHE_URL = "resources/appcache-ordering.install.html";9 8 var IS_APPCACHED_URL = "resources/appcache-ordering.is-appcached.html"; 10 9 var SERVICE_WORKER_SCOPE = "resources/appcache-ordering"; … … 15 14 16 15 var frames = []; 17 18 // Called by the INSTALL_APPCACHE_URL child frame.19 function notify_appcache_installed(success) {20 if (success)21 resolve_install_appcache();22 else23 reject_install_appcache();24 }25 26 function install_appcache() {27 return new Promise(function(resolve, reject) {28 var frame = document.createElement('iframe');29 frames.push(frame);30 frame.src = INSTALL_APPCACHE_URL;31 document.body.appendChild(frame);32 resolve_install_appcache = function() {33 document.body.removeChild(frame);34 resolve();35 };36 reject_install_appcache = function() {37 document.body.removeChild(frame);38 reject();39 };40 });41 }42 16 43 17 var resolve_is_appcached = undefined; … … 64 38 return service_worker_unregister(t, SERVICE_WORKER_SCOPE) 65 39 .then(function() { 66 return install_appcache ();40 return install_appcache_ordering_manifest(); 67 41 }) 68 42 .then(function() { -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch.https.html
r220223 r246363 8 8 <script> 9 9 10 promise_test(function(t) { 11 var frame; 12 var resource = 'simple.txt'; 10 async function try_fetch(fetch_func, path) { 11 let response; 12 try { 13 response = await fetch_func(path); 14 } catch (err) { 15 throw (`fetch() threw: ${err}`); 16 } 13 17 14 var worker; 15 var scope = 'resources/'; 16 var script = 'resources/claim-worker.js'; 18 let response_text; 19 try { 20 response_text = await response.text(); 21 } catch (err) { 22 throw (`text() threw: ${err}`); 23 } 17 24 18 return Promise.resolve() 19 // Create the test iframe. 20 .then(() => with_iframe('resources/blank.html')) 21 .then(f => frame = f) 25 return response_text; 26 } 22 27 23 // Check the controller and test with fetch. 24 .then(() => assert_equals(frame.contentWindow.navigator.controller,25 undefined,26 'Should have no controller.'))27 .then(() => frame.contentWindow.fetch(resource))28 .then(response => response.text())29 .then(response_text => assert_equals(response_text,30 'a simple text file\n',31 'fetch() should not be intercepted.'))28 promise_test(async function(t) { 29 let frame; 30 const scope = 'resources/'; 31 const script = 'resources/claim-worker.js'; 32 t.add_cleanup(async () => { 33 if (frame) 34 frame.remove(); 35 return service_worker_unregister(t, scope); 36 }); 32 37 33 // Register a service worker. 34 .then(() => service_worker_unregister_and_register(t, script, scope)) 35 .then(r => worker = r.installing) 36 .then(() => wait_for_state(t, worker, 'activated')) 38 const resource = 'simple.txt'; 37 39 38 // Let the service worker claim the iframe. 39 .then(() => { 40 var channel = new MessageChannel(); 41 var saw_message = new Promise(function(resolve) { 42 channel.port1.onmessage = t.step_func(function(e) { 43 assert_equals(e.data, 'PASS', 44 'Worker call to claim() should fulfill.'); 45 resolve(); 46 }); 47 }); 48 worker.postMessage({port: channel.port2}, [channel.port2]); 49 return saw_message; 50 }) 40 // Create the test frame. 41 await service_worker_unregister(t, scope); 42 frame = await with_iframe('resources/blank.html'); 51 43 52 // Check the controller and test with fetch. 53 .then(() => frame.contentWindow.navigator.serviceWorker.getRegistration(scope)) 54 .then(r => assert_equals(frame.contentWindow.navigator.serviceWorker.controller, 55 r.active, 56 'Test iframe should be claimed.')) 57 .then(() => frame.contentWindow.fetch(resource)) 58 .then(response => response.text()) 59 .then(response_text => assert_equals(response_text, 60 'Intercepted!', 61 'fetch() should be intercepted.')) 44 // Check the controller and test with fetch. 45 assert_equals(frame.contentWindow.navigator.controller, undefined, 46 'Should have no controller.'); 47 let response; 48 try { 49 response = await try_fetch(frame.contentWindow.fetch, resource); 50 } catch (err) { 51 assert_unreached(`uncontrolled fetch failed: ${err}`); 52 } 53 assert_equals(response, 'a simple text file\n', 54 'fetch() should not be intercepted.'); 62 55 63 // Cleanup this testcase. 64 .then(() => frame.remove()) 65 .then(() => service_worker_unregister_and_done(t, scope)); 66 }, 'fetch() should be intercepted after the client is claimed.') 56 // Register a service worker. 57 const registration = await navigator.serviceWorker.register(script, {scope}); 58 const worker = registration.installing; 59 await wait_for_state(t, worker, 'activated'); 60 61 // Tell the service worker to claim the iframe. 62 const saw_message = new Promise((resolve) => { 63 const channel = new MessageChannel(); 64 channel.port1.onmessage = t.step_func((event) => { 65 resolve(event.data); 66 }); 67 worker.postMessage({port: channel.port2}, [channel.port2]); 68 }); 69 const data = await saw_message; 70 assert_equals(data, 'PASS', 'Worker call to claim() should fulfill.'); 71 72 // Check the controller and test with fetch. 73 const controller = frame.contentWindow.navigator.serviceWorker.controller; 74 assert_true(controller instanceof frame.contentWindow.ServiceWorker, 75 'iframe should be controlled.'); 76 try { 77 response = await try_fetch(frame.contentWindow.fetch, resource); 78 } catch (err) { 79 assert_unreached(`controlled fetch failed: ${err}`); 80 } 81 assert_equals(response, 'Intercepted!', 82 'fetch() should be intercepted.'); 83 }, 'fetch() should be intercepted after the client is claimed.'); 67 84 68 85 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-not-using-registration.https.html
r220223 r246363 16 16 t, init_worker_url, init_scope) 17 17 .then(function(registration) { 18 t.add_cleanup(function() { 19 return service_worker_unregister(t, init_scope); 20 }); 21 18 22 return wait_for_state(t, registration.installing, 'activated'); 19 23 }) … … 36 40 }) 37 41 .then(function(registration) { 42 t.add_cleanup(function() { 43 return service_worker_unregister(t, claim_scope); 44 }); 45 38 46 claim_worker = registration.installing; 39 47 claim_registration = registration; … … 68 76 frame2.remove(); 69 77 return claim_registration.unregister(); 70 })71 .then(function() {72 return service_worker_unregister_and_done(t, init_scope);73 78 }); 74 79 }, 'Test claim client which is not using registration'); … … 87 92 }) 88 93 .then(function(registration) { 94 t.add_cleanup(function() { 95 return service_worker_unregister(t, claim_scope); 96 }); 97 89 98 claim_worker = registration.installing; 90 99 return wait_for_state(t, registration.installing, 'activated'); … … 95 104 }) 96 105 .then(function() { 106 t.add_cleanup(function() { 107 return service_worker_unregister(t, scope); 108 }); 109 97 110 var channel = new MessageChannel(); 98 111 var saw_message = new Promise(function(resolve) { … … 112 125 'registration exists'); 113 126 frame.remove(); 114 return service_worker_unregister(t, claim_scope);115 })116 .then(function() {117 return service_worker_unregister_and_done(t, scope);118 127 }); 119 128 }, 'Test claim client when there\'s a longer-matched registration not ' + -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-shared-worker-fetch.https.html
r222307 r246363 31 31 // Register a service worker. 32 32 .then(() => service_worker_unregister_and_register(t, script, scope)) 33 .then(r => worker = r.installing)34 .then(() => wait_for_state(t, worker, 'activated'))33 .then(r => { 34 t.add_cleanup(() => service_worker_unregister(t, scope)); 35 35 36 worker = r.installing; 37 38 return wait_for_state(t, worker, 'activated') 39 }) 36 40 // Let the service worker claim the iframe and the shared worker. 37 41 .then(() => { … … 61 65 62 66 // Cleanup this testcase. 63 .then(() => frame.remove()) 64 .then(() => service_worker_unregister_and_done(t, scope)); 67 .then(() => frame.remove()); 65 68 }, 'fetch() in SharedWorker should be intercepted after the client is claimed.') 66 69 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-using-registration.https.html
r220223 r246363 14 14 return service_worker_unregister_and_register(t, url1, scope) 15 15 .then(function(registration) { 16 t.add_cleanup(function() { 17 return service_worker_unregister(t, scope); 18 }); 19 16 20 return wait_for_state(t, registration.installing, 'activated'); 17 21 }) … … 51 55 frame.remove(); 52 56 return sw_registration.unregister(); 53 })54 .then(function() {55 return service_worker_unregister_and_done(t, scope);56 57 }); 57 58 }, 'Test worker claims client which is using another registration'); … … 64 65 return service_worker_unregister_and_register(t, url1, scope) 65 66 .then(function(registration) { 67 t.add_cleanup(function() { 68 return service_worker_unregister(t, scope); 69 }); 70 66 71 return wait_for_state(t, registration.installing, 'activated'); 67 72 }) … … 92 97 .then(function() { 93 98 frame.remove(); 94 return service_worker_unregister_and_done(t, scope);95 99 }); 96 100 }, 'Test for the waiting worker claims a client which is using the the ' + -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https.html
r222307 r246363 55 55 t, 'resources/clients-matchall-worker.js', scope) 56 56 .then(function(registration) { 57 t.add_cleanup(function() { 58 return service_worker_unregister(t, scope); 59 }); 60 57 61 return wait_for_state(t, registration.installing, 'activated'); 58 62 }) … … 67 71 .then(function() { 68 72 frame.remove(); 69 return service_worker_unregister_and_done(t, scope); 70 }) 71 .catch(unreached_rejection(t)); 73 }); 72 74 }, 'Verify matchAll() with window client type'); 73 75 … … 77 79 t, 'resources/clients-matchall-worker.js', scope) 78 80 .then(function(registration) { 81 t.add_cleanup(function() { 82 return service_worker_unregister(t, scope); 83 }); 84 79 85 return wait_for_state(t, registration.installing, 'activated'); 80 86 }) … … 113 119 .then(function() { 114 120 frame.remove(); 115 return service_worker_unregister_and_done(t, scope);116 121 }); 117 122 }, 'Verify matchAll() with {window, sharedworker, worker} client types'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-order.https.html
r238592 r246363 124 124 let extraWindowResult; 125 125 return service_worker_unregister_and_register(t, script, opts.scope).then(swr => { 126 t.add_cleanup(() => service_worker_unregister(t, opts.scope)); 127 126 128 worker = swr.installing; 127 129 return wait_for_state(t, worker, 'activated'); … … 144 146 frameResultList.forEach(result => result.top.remove()); 145 147 extraWindowResult.top.remove(); 146 }).then(_ => {147 return service_worker_unregister_and_done(t, opts.scope);148 148 }).catch(e => { 149 149 if (frameResultList) { -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controller-on-reload.https.html
r220223 r246363 14 14 return service_worker_unregister(t, scope) 15 15 .then(function() { 16 t.add_cleanup(function() { 17 return service_worker_unregister(t, scope); 18 }); 19 16 20 return with_iframe(scope); 17 21 }) … … 49 53 assert_equals(frameRegistration.active, controller); 50 54 frame.remove(); 51 service_worker_unregister_and_done(t, scope);52 55 }); 53 56 }, 'controller is set upon reload after registration'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https-expected.txt
r238592 r246363 1 1 2 2 3 PASS Test calling waitUntil in a different task without an existing extension throws 4 FAIL Test calling waitUntil in a different microtask without an existing extension throws assert_equals: expected "InvalidStateError" but got "OK" 5 PASS Test calling waitUntil in a different task with an existing extension succeeds 6 PASS Test calling waitUntil with an existing extension promise handler succeeds 7 FAIL Test calling waitUntil at the end of the microtask turn throws assert_equals: expected "InvalidStateError" but got "OK" 3 PASS Test calling waitUntil in a task at the end of the event handler without an existing extension throws 4 PASS Test calling waitUntil in a microtask at the end of the event handler without an existing extension suceeds 5 PASS Test calling waitUntil in a different task an existing extension succeeds 6 PASS Test calling waitUntil at the end of an existing extension promise handler succeeds (event is still being dispatched) 7 PASS Test calling waitUntil in a microtask at the end of an existing extension promise handler succeeds (event is still being dispatched) 8 PASS Test calling waitUntil in an existing extension promise handler succeeds (event is not being dispatched) 9 PASS Test calling waitUntil in a microtask at the end of an existing extension promise handler throws (event is not being dispatched) 8 10 PASS Test calling waitUntil after the current extension expired in a different task fails 9 11 PASS Test calling waitUntil on a script constructed ExtendableEvent throws exception 10 12 PASS Test calling waitUntil asynchronously with pending respondWith promise. 11 PASS Test calling waitUntil synchronously inside microtask of respondWith promise. 12 FAIL Test calling waitUntil asynchronously inside microtask of respondWith promise. assert_equals: expected "InvalidStateError" but got "OK" 13 PASS Test calling waitUntil synchronously inside microtask of respondWith promise (event is being dispatched). 14 PASS Test calling waitUntil asynchronously inside microtask of respondWith promise (event is being dispatched). 15 PASS Test calling waitUntil synchronously inside microtask of respondWith promise (event is not being dispatched). 16 PASS Test calling waitUntil asynchronously inside microtask of respondWith promise (event is not being dispatched). 13 17 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https.html
r238592 r246363 1 1 <!DOCTYPE html> 2 <meta name="timeout" content="long"> 2 3 <script src="/resources/testharness.js"></script> 3 4 <script src="resources/testharness-helpers.js"></script> … … 57 58 58 59 promise_test(msg_event_test.bind(this, 'no-current-extension-different-task'), 59 'Test calling waitUntil in a different taskwithout an existing extension throws');60 'Test calling waitUntil in a task at the end of the event handler without an existing extension throws'); 60 61 61 62 promise_test(msg_event_test.bind(this, 'no-current-extension-different-microtask'), 62 'Test calling waitUntil in a different microtask without an existing extension throws');63 'Test calling waitUntil in a microtask at the end of the event handler without an existing extension suceeds'); 63 64 64 65 promise_test(msg_event_test.bind(this, 'current-extension-different-task'), 65 'Test calling waitUntil in a different task withan existing extension succeeds');66 'Test calling waitUntil in a different task an existing extension succeeds'); 66 67 67 promise_test(msg_event_test.bind(this, ' current-extension-expired-same-microtask-turn'),68 'Test calling waitUntil with an existing extension promise handler succeeds');68 promise_test(msg_event_test.bind(this, 'during-event-dispatch-current-extension-expired-same-microtask-turn'), 69 'Test calling waitUntil at the end of an existing extension promise handler succeeds (event is still being dispatched)'); 69 70 70 // The promise handler will queue a new microtask after the check for new 71 // extensions was performed. 72 promise_test(msg_event_test.bind(this, 'current-extension-expired-same-microtask-turn-extra'), 73 'Test calling waitUntil at the end of the microtask turn throws'); 71 promise_test(msg_event_test.bind(this, 'during-event-dispatch-current-extension-expired-same-microtask-turn-extra'), 72 'Test calling waitUntil in a microtask at the end of an existing extension promise handler succeeds (event is still being dispatched)'); 73 74 promise_test(msg_event_test.bind(this, 'after-event-dispatch-current-extension-expired-same-microtask-turn'), 75 'Test calling waitUntil in an existing extension promise handler succeeds (event is not being dispatched)'); 76 77 promise_test(msg_event_test.bind(this, 'after-event-dispatch-current-extension-expired-same-microtask-turn-extra'), 78 'Test calling waitUntil in a microtask at the end of an existing extension promise handler throws (event is not being dispatched)'); 74 79 75 80 promise_test(msg_event_test.bind(this, 'current-extension-expired-different-task'), … … 81 86 promise_test(function(t) { 82 87 var testBody = function(worker) { 83 return with_iframe('./resources/pending-respondwith-async-waituntil /dummy.html');88 return with_iframe('./resources/pending-respondwith-async-waituntil'); 84 89 } 85 90 return runTest(t, 'pending-respondwith-async-waituntil', testBody); … … 88 93 promise_test(function(t) { 89 94 var testBody = function(worker) { 90 return with_iframe('./resources/ respondwith-microtask-sync-waituntil/dummy.html');95 return with_iframe('./resources/during-event-dispatch-respondwith-microtask-sync-waituntil'); 91 96 } 92 return runTest(t, ' respondwith-microtask-sync-waituntil', testBody);93 }, 'Test calling waitUntil synchronously inside microtask of respondWith promise .');97 return runTest(t, 'during-event-dispatch-respondwith-microtask-sync-waituntil', testBody); 98 }, 'Test calling waitUntil synchronously inside microtask of respondWith promise (event is being dispatched).'); 94 99 95 100 promise_test(function(t) { 96 101 var testBody = function(worker) { 97 return with_iframe('./resources/ respondwith-microtask-async-waituntil/dummy.html');102 return with_iframe('./resources/during-event-dispatch-respondwith-microtask-async-waituntil'); 98 103 } 99 return runTest(t, ' respondwith-microtask-async-waituntil', testBody);100 }, 'Test calling waitUntil asynchronously inside microtask of respondWith promise .');104 return runTest(t, 'during-event-dispatch-respondwith-microtask-async-waituntil', testBody); 105 }, 'Test calling waitUntil asynchronously inside microtask of respondWith promise (event is being dispatched).'); 101 106 107 promise_test(function(t) { 108 var testBody = function(worker) { 109 return with_iframe('./resources/after-event-dispatch-respondwith-microtask-sync-waituntil'); 110 } 111 return runTest(t, 'after-event-dispatch-respondwith-microtask-sync-waituntil', testBody); 112 }, 'Test calling waitUntil synchronously inside microtask of respondWith promise (event is not being dispatched).'); 102 113 114 promise_test(function(t) { 115 var testBody = function(worker) { 116 return with_iframe('./resources/after-event-dispatch-respondwith-microtask-async-waituntil'); 117 } 118 return runTest(t, 'after-event-dispatch-respondwith-microtask-async-waituntil', testBody); 119 }, 'Test calling waitUntil asynchronously inside microtask of respondWith promise (event is not being dispatched).'); 103 120 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video-cache.https.html
r238592 r246363 2 2 <meta charset="utf-8"> 3 3 <title>Service Worker: canvas tainting of the fetched video using cache responses</title> 4 <meta name="timeout" content="long"> 4 5 <script src="/resources/testharness.js"></script> 5 6 <script src="/resources/testharnessreport.js"></script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video.https.html
r238592 r246363 2 2 <meta charset="utf-8"> 3 3 <title>Service Worker: canvas tainting of the fetched video</title> 4 <meta name="timeout" content="long"> 4 5 <script src="/resources/testharness.js"></script> 5 6 <script src="/resources/testharnessreport.js"></script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-csp.https.html
r220223 r246363 33 33 return service_worker_unregister_and_register(t, SCRIPT, SCOPE) 34 34 .then(function(registration) { 35 t.add_cleanup(function() { 36 return service_worker_unregister(t, SCOPE); 37 }); 38 35 39 return wait_for_state(t, registration.installing, 'activated'); 36 40 }) … … 106 110 .then(function() { 107 111 frame.remove(); 108 service_worker_unregister_and_done(t, SCOPE);109 112 }); 110 113 }, 'Verify CSP control of fetch() in a Service Worker'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-after-navigation-within-page.https.html
r202471 r246363 16 16 return service_worker_unregister_and_register(t, worker, scope) 17 17 .then(function(reg) { 18 t.add_cleanup(function() { 19 return service_worker_unregister(t, scope); 20 }); 21 18 22 return wait_for_state(t, reg.installing, 'activated'); 19 23 }) … … 31 35 assert_equals(response, 'intercepted by service worker'); 32 36 frame.remove(); 33 return service_worker_unregister_and_done(t, scope);34 37 }) 35 38 }, 'Service Worker should respond to fetch event after the hash changes'); … … 44 47 return service_worker_unregister_and_register(t, worker, scope) 45 48 .then(function(reg) { 49 t.add_cleanup(function() { 50 return service_worker_unregister(t, scope); 51 }); 52 46 53 return wait_for_state(t, reg.installing, 'activated'); 47 54 }) … … 59 66 assert_equals(response, 'intercepted by service worker'); 60 67 frame.remove(); 61 return service_worker_unregister_and_done(t, scope);62 68 }) 63 69 }, 'Service Worker should respond to fetch event after the pushState'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https-expected.txt
r227425 r246363 1 CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: cancelled 1 2 2 PASS Calling respondWith asynchronously throws an exception 3 Harness Error (FAIL), message = cancelled 3 4 5 PASS global setup 6 PASS respondWith in a task throws InvalidStateError 7 PASS respondWith in a microtask does not throw 8 PASS global cleanup 9 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https.html
r220223 r246363 1 1 <!DOCTYPE html> 2 <html> 3 <title>respondWith cannot be called asynchronously</title> 2 4 <script src="/resources/testharness.js"></script> 3 5 <script src="/resources/testharnessreport.js"></script> 4 6 <script src="resources/test-helpers.sub.js"></script> 5 7 <script> 6 promise_test(function(t) { 7 var script = 'resources/fetch-event-async-respond-with-worker.js'; 8 var scope = 'resources/simple.html'; 8 // This file has tests that call respondWith() asynchronously. 9 9 10 return service_worker_unregister_and_register(t, script, scope) 11 .then(function(registration) { 12 return wait_for_state(t, registration.installing, 'activated'); 13 }) 14 .then(function() { 15 return with_iframe(scope); 16 }) 17 .then(function(frame) { 18 add_completion_callback(function() { frame.remove(); }); 19 var channel = new MessageChannel(); 20 var saw_message = new Promise(function(resolve) { 21 channel.port1.onmessage = function(e) { resolve(e.data); } 22 }); 23 var worker = frame.contentWindow.navigator.serviceWorker.controller; 10 let frame; 11 let worker; 12 const script = 'resources/fetch-event-async-respond-with-worker.js'; 13 const scope = 'resources/simple.html'; 24 14 25 worker.postMessage({port: channel.port2}, [channel.port2]); 26 return saw_message; 27 }) 28 .then(function(message) { 29 assert_equals(message, 'PASS'); 30 return service_worker_unregister_and_done(t, scope); 31 }) 32 }, 'Calling respondWith asynchronously throws an exception'); 15 // Global setup: this must be the first promise_test. 16 promise_test(async (t) => { 17 const registration = 18 await service_worker_unregister_and_register(t, script, scope); 19 worker = registration.installing; 20 await wait_for_state(t, worker, 'activated'); 21 frame = await with_iframe(scope); 22 }, 'global setup'); 23 24 // Waits for a single message from the service worker and then removes the 25 // message handler. Not safe for concurrent use. 26 function wait_for_message() { 27 return new Promise((resolve) => { 28 const handler = (event) => { 29 navigator.serviceWorker.removeEventListener('message', handler); 30 resolve(event.data); 31 }; 32 navigator.serviceWorker.addEventListener('message', handler); 33 }); 34 } 35 36 // Does one test case. It fetches |url|. The service worker gets a fetch event 37 // for |url| and attempts to call respondWith() asynchronously. It reports back 38 // to the test whether an exception was thrown. 39 async function do_test(url) { 40 // Send a message to tell the worker a new test case is starting. 41 const message = wait_for_message(); 42 worker.postMessage('initializeMessageHandler'); 43 const response = await message; 44 assert_equals(response, 'messageHandlerInitialized'); 45 46 // Start a fetch. 47 frame.contentWindow.fetch(url); 48 49 // Receive the test result from the service worker. 50 return wait_for_message(); 51 }; 52 53 promise_test(async (t) => { 54 const result = await do_test('respondWith-in-task'); 55 assert_true(result.didThrow, 'should throw'); 56 assert_equals(result.error, 'InvalidStateError'); 57 }, 'respondWith in a task throws InvalidStateError'); 58 59 promise_test(async (t) => { 60 const result = await do_test('respondWith-in-microtask'); 61 assert_equals(result.didThrow, false, 'should not throw'); 62 }, 'respondWith in a microtask does not throw'); 63 64 // Global cleanup: the final promise_test. 65 promise_test(async (t) => { 66 if (frame) 67 frame.remove(); 68 await service_worker_unregister(t, scope); 69 }, 'global cleanup'); 33 70 </script> 71 </html> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-network-error.https.html
r220223 r246363 23 23 return service_worker_unregister_and_register(t, script, scope) 24 24 .then(function(registration) { 25 t.add_cleanup(function() { 26 return service_worker_unregister(t, scope); 27 }); 28 25 29 return wait_for_state(t, registration.installing, 'activated'); 26 30 }) … … 35 39 frame.remove(); 36 40 assert_equals(result, 'PASS'); 37 return service_worker_unregister_and_done(t, scope);38 41 }); 39 42 }, 'Rejecting the fetch event or using preventDefault() causes a network ' + -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https-expected.txt
r226397 r246363 1 CONSOLE MESSAGE: line 32: The page at https://localhost:9443/service-workers/service-worker/fetch-event-referrer-policy.https.html wasallowed to display insecure content from http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull.1 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. 2 2 3 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. 4 5 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. 6 7 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. 8 9 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. 10 11 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. 12 13 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. 14 15 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. 16 17 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. 18 19 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. 20 21 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. 22 23 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. 24 25 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. 26 27 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. 28 29 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. 30 31 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. 3 CONSOLE MESSAGE: line 29: Not allowed to request resource 4 CONSOLE MESSAGE: line 29: Fetch API cannot load http://localhost:8800/service-workers/service-worker//resources/simple.html?referrerFull due to access control checks. 32 5 33 6 34 PASS Service Worker responds to fetch event with the referrer policy 7 FAIL Service Worker responds to fetch event with the referrer policy promise_test: Unhandled rejection with value: object "TypeError: Not allowed to request resource" 35 8 PASS Service Worker should respond to fetch with the default referrer policy 36 9 PASS Service Worker should respond to fetch with the referrer URL when a member of RequestInit is present - Default Referrer 37 PASS Service Worker should respond to fetch with no referrer when a member of RequestInit is present with an HTTP request - Default Referrer38 PASS Service Worker should respond to fetch with the referrer with "" - Default Referrer39 PASS Service Worker should respond to fetch with no referrer with "" - Default Referrer40 PASS Service Worker should respond to fetch with the referrer origin with "origin" and a same origin request - Default Referrer41 PASS Service Worker should respond to fetch with the referrer origin with "origin" and a cross origin request - Default Referrer42 PASS Service Worker should respond to fetch with the referrer URL with "origin-when-cross-origin" and a same origin request - Default Referrer43 PASS Service Worker should respond to fetch with the referrer origin with "origin-when-cross-origin" and a cross origin request - Default Referrer44 PASS Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and a same origin request - Default Referrer45 PASS Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and an HTTP request - Default Referrer46 PASS Service Worker should respond to fetch with no referrer with "unsafe-url" - Default Referrer47 PASS Service Worker should respond to fetch with no referrer URL with "no-referrer" - Default Referrer48 PASS Service Worker should respond to fetch with referrer URL with "same-origin" and a same origin request - Default Referrer49 PASS Service Worker should respond to fetch with no referrer with "same-origin" and cross origin request - Default Referrer50 PASS Service Worker should respond to fetch with the referrer origin with "strict-origin" and a HTTPS cross origin request - Default Referrer51 PASS Service Worker should respond to fetch with the referrer origin with "strict-origin" and a same origin request - Default Referrer52 PASS Service Worker should respond to fetch with no referrer with "strict-origin" and a HTTP request - Default Referrer53 PASS Service Worker should respond to fetch with the referrer URL with "strict-origin-when-cross-origin" and a same origin request - Default Referrer54 PASS Service Worker should respond to fetch with the referrer origin with "strict-origin-when-cross-origin" and a HTTPS cross origin request - Default Referrer55 PASS Service Worker should respond to fetch with no referrer with "strict-origin-when-cross-origin" and a HTTP request - Default Referrer56 PASS Service Worker should respond to fetch with the referrer URL when a member of RequestInit is present - Custom Referrer57 PASS Service Worker should respond to fetch with no referrer when a member of RequestInit is present with an HTTP request - Custom Referrer58 PASS Service Worker should respond to fetch with the referrer with "" - Custom Referrer59 PASS Service Worker should respond to fetch with no referrer with "" - Custom Referrer60 PASS Service Worker should respond to fetch with the referrer origin with "origin" and a same origin request - Custom Referrer61 PASS Service Worker should respond to fetch with the referrer origin with "origin" and a cross origin request - Custom Referrer62 PASS Service Worker should respond to fetch with the referrer URL with "origin-when-cross-origin" and a same origin request - Custom Referrer63 PASS Service Worker should respond to fetch with the referrer origin with "origin-when-cross-origin" and a cross origin request - Custom Referrer64 PASS Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and a same origin request - Custom Referrer65 PASS Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and an HTTP request - Custom Referrer66 PASS Service Worker should respond to fetch with no referrer with "unsafe-url" - Custom Referrer67 PASS Service Worker should respond to fetch with no referrer URL with "no-referrer" - Custom Referrer68 PASS Service Worker should respond to fetch with referrer URL with "same-origin" and a same origin request - Custom Referrer69 PASS Service Worker should respond to fetch with no referrer with "same-origin" and cross origin request - Custom Referrer70 PASS Service Worker should respond to fetch with the referrer origin with "strict-origin" and a HTTPS cross origin request - Custom Referrer71 PASS Service Worker should respond to fetch with the referrer origin with "strict-origin" and a same origin request - Custom Referrer72 PASS Service Worker should respond to fetch with no referrer with "strict-origin" and a HTTP request - Custom Referrer73 PASS Service Worker should respond to fetch with the referrer URL with "strict-origin-when-cross-origin" and a same origin request - Custom Referrer74 PASS Service Worker should respond to fetch with the referrer origin with "strict-origin-when-cross-origin" and a HTTPS cross origin request - Custom Referrer75 PASS Service Worker should respond to fetch with no referrer with "strict-origin-when-cross-origin" and a HTTP request - Custom Referrer76 10 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https.html
r238592 r246363 7 7 <script> 8 8 var worker = 'resources/fetch-event-test-worker.js'; 9 10 if (window.internals && window.internals.settings)11 internals.settings.setAllowDisplayOfInsecureContent(true);12 9 13 10 function do_test(referrer, value, expected, name) -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-argument.https.html
r220223 r246363 23 23 return service_worker_unregister_and_register(t, script, scope) 24 24 .then(function(registration) { 25 t.add_cleanup(function() { 26 return service_worker_unregister(t, scope); 27 }); 28 25 29 return wait_for_state(t, registration.installing, 'activated'); 26 30 }) … … 35 39 frame.remove(); 36 40 assert_equals(result, 'PASS'); 37 return service_worker_unregister_and_done(t, scope);38 41 }); 39 42 }, 'respondWith() takes either a Response or a promise that resolves ' + -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html
r227870 r246363 2 2 <meta charset="utf-8"> 3 3 <title>respondWith with a response whose body is being loaded from the network by chunks</title> 4 <meta name="timeout" content="long"> 4 5 <script src="/resources/testharness.js"></script> 5 6 <script src="/resources/testharnessreport.js"></script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html
r220223 r246363 11 11 return service_worker_unregister_and_register(t, script, scope) 12 12 .then(function(registration) { 13 t.add_cleanup(function() { 14 return service_worker_unregister(t, scope); 15 }); 16 13 17 return wait_for_state(t, registration.installing, 'activated'); 14 18 }) … … 29 33 .then(function(message) { 30 34 assert_equals(message, 'PASS'); 31 return service_worker_unregister_and_done(t, scope);32 35 }) 33 36 }, 'respondWith() invokes stopImmediatePropagation()'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-throws-after-respond-with.https.html
r220223 r246363 13 13 return service_worker_unregister_and_register(t, workerscript, scope) 14 14 .then(function(reg) { 15 t.add_cleanup(function() { 16 return service_worker_unregister(t, scope); 17 }); 18 15 19 return wait_for_state(t, reg.installing, 'activated') 16 20 .then(() => reg.active); … … 28 32 .then(function(frame) { 29 33 assert_true(frame.contentDocument.body.innerHTML.includes("intercepted")); 30 service_worker_unregister_and_done(t, scope);31 34 }) 32 35 }, 'Fetch event handler throws after a successful respondWith()'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https-expected.txt
r227425 r246363 1 1 2 PASS global setup 3 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" 4 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" 5 PASS cleanup global state 2 6 3 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"4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https.html
r238592 r246363 1 1 <!DOCTYPE html> 2 <title>Service Worker: CSS's base URL must be the re quest URL even when fetched from otherURL</title>2 <title>Service Worker: CSS's base URL must be the response URL</title> 3 3 <script src="/resources/testharness.js"></script> 4 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/common/get-host-info.sub.js"></script>6 5 <script src="resources/test-helpers.sub.js?pipe=sub"></script> 7 6 <script> 8 promise_test(function(t) { 9 var SCOPE = 'resources/fetch-request-css-base-url-iframe.html'; 10 var SCRIPT = 'resources/fetch-request-css-base-url-worker.js'; 11 var worker; 12 var testDonePromise; 7 const SCOPE = 'resources/fetch-request-css-base-url-iframe.html'; 8 const SCRIPT = 'resources/fetch-request-css-base-url-worker.js'; 9 let worker; 13 10 14 return service_worker_unregister_and_register(t, SCRIPT, SCOPE) 15 .then(function(registration) { 16 t.add_cleanup(function() { 17 return service_worker_unregister(t, SCOPE); 18 }); 11 var signalMessage; 12 function getNextMessage() { 13 return new Promise(resolve => { signalMessage = resolve; }); 14 } 19 15 20 worker = registration.installing; 21 return wait_for_state(t, worker, 'activated'); 22 }) 23 .then(function() { 24 return new Promise(function(resolve) { 25 var channel = new MessageChannel(); 26 testDonePromise = new Promise(function(resolveTestDone) { 27 channel.port1.onmessage = t.step_func(function(msg) { 28 if (msg.data.ready) { 29 resolve(); 30 return; 31 } 32 var result = msg.data; 33 var base = get_host_info()['HTTPS_ORIGIN'] + base_path(); 34 assert_equals( 35 result.url, 36 base + 'resources/dummy.png', 37 'The base URL while loading the images referred from CSS ' + 38 'must be the request URL of CSS.'); 39 assert_equals( 40 result.referrer, 41 base + 'resources/fetch-request-css-base-url-style.css', 42 'While loading the image defined in CSS the referrer must ' + 43 'be the request URL of CSS.'); 44 resolveTestDone(); 45 }); 46 }); 47 worker.postMessage( 48 {port: channel.port2}, [channel.port2]); 49 }); 50 }) 51 .then(function() { return with_iframe(SCOPE); }) 52 .then(function(f) { 53 return testDonePromise.then(function() { 54 f.remove(); 55 }); 56 }); 57 }, 'CSS\'s base URL must be the request URL even when fetched from other URL.'); 16 promise_test(async (t) => { 17 const registration = await service_worker_unregister_and_register( 18 t, SCRIPT, SCOPE); 19 worker = registration.installing; 20 await wait_for_state(t, worker, 'activated'); 21 }, 'global setup'); 22 23 // Creates a test concerning the base URL of a stylesheet. It loads a 24 // stylesheet from a controlled page. The stylesheet makes a subresource 25 // request for an image. The service worker messages back the details of the 26 // image request in order to test the base URL. 27 // 28 // The request URL for the stylesheet is under "resources/request-url-path/". 29 // The service worker may respond in a way such that the response URL is 30 // different to the request URL. 31 function base_url_test(params) { 32 promise_test(async (t) => { 33 let frame; 34 t.add_cleanup(() => { 35 if (frame) 36 frame.remove(); 37 }); 38 39 // Ask the service worker to message this page once it gets the request 40 // for the image. 41 let channel = new MessageChannel(); 42 const sawPong = getNextMessage(); 43 channel.port1.onmessage = (event) => { 44 signalMessage(event.data); 45 }; 46 worker.postMessage({port:channel.port2},[channel.port2]); 47 48 // It sends a pong back immediately. This ping/pong protocol helps deflake 49 // the test for browsers where message/fetch ordering isn't guaranteed. 50 assert_equals('pong', await sawPong); 51 52 // Load the frame which will load the stylesheet that makes the image 53 // request. 54 const sawResult = getNextMessage(); 55 frame = await with_iframe(params.framePath); 56 const result = await sawResult; 57 58 // Test the image request. 59 const base = new URL('.', document.location).href; 60 assert_equals(result.url, 61 base + params.expectImageRequestPath, 62 'request'); 63 assert_equals(result.referrer, 64 base + params.expectImageRequestReferrer, 65 'referrer'); 66 }, params.description); 67 } 68 69 const cssFile = 'fetch-request-css-base-url-style.css'; 70 71 base_url_test({ 72 framePath: SCOPE + '?fetch', 73 expectImageRequestPath: 'resources/dummy.png', 74 expectImageRequestReferrer: `resources/${cssFile}?fetch`, 75 description: 'base URL when service worker does respondWith(fetch(responseUrl)).'}); 76 77 base_url_test({ 78 framePath: SCOPE + '?newResponse', 79 expectImageRequestPath: 'resources/request-url-path/dummy.png', 80 expectImageRequestReferrer: `resources/request-url-path/${cssFile}?newResponse`, 81 description: 'base URL when service worker does respondWith(new Response()).'}); 82 83 // Cleanup step: this must be the last promise_test. 84 promise_test(async (t) => { 85 return service_worker_unregister(t, SCOPE); 86 }, 'cleanup global state'); 58 87 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-redirect.https.html
r226792 r246363 75 75 return service_worker_unregister_and_register(t, SCRIPT, SCOPE) 76 76 .then(function(registration) { 77 t.add_cleanup(() => service_worker_unregister(t, SCOPE)); 78 77 79 worker = registration.installing; 78 80 return wait_for_state(t, worker, 'activated'); … … 182 184 .then(function() { 183 185 frame.remove(); 184 service_worker_unregister_and_done(t, SCOPE);185 186 }); 186 187 }, 'Verify redirect mode of Fetch API and ServiceWorker FetchEvent.'); … … 209 210 return service_worker_unregister_and_register(t, SCRIPT, SCOPE) 210 211 .then(function(registration) { 212 t.add_cleanup(() => service_worker_unregister(t, SCOPE)); 213 211 214 worker = registration.installing; 212 215 return wait_for_state(t, worker, 'activated'); … … 276 279 .then(function() { 277 280 frame.remove(); 278 service_worker_unregister_and_done(t, SCOPE);279 281 }); 280 282 }, 'Verify redirected of Response(Fetch API) and ServiceWorker FetchEvent.'); … … 303 305 return service_worker_unregister_and_register(t, SCRIPT, SCOPE) 304 306 .then(function(registration) { 307 t.add_cleanup(() => service_worker_unregister(t, SCOPE)); 308 305 309 worker = registration.installing; 306 310 return wait_for_state(t, worker, 'activated'); … … 376 380 .then(function() { 377 381 frame.remove(); 378 service_worker_unregister_and_done(t, SCOPE);379 382 }); 380 383 }, 'Verify redirected of Response(Fetch API), Cache API and ServiceWorker ' + -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https-expected.txt
r224453 r246363 5 5 PASS getRegistration with a cross origin URL 6 6 PASS Register then Unregister then getRegistration 7 PASS Register then Unregister then getRegistration in controlled iframe 7 8 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https.html
r238592 r246363 89 89 }, 'Register then Unregister then getRegistration'); 90 90 91 92 promise_test(async function(t) { 93 const scope = 'resources/scope/getregistration/register-unregister'; 94 const registration = await service_worker_unregister_and_register( 95 t, 'resources/empty-worker.js', scope 96 ); 97 98 const frame = await with_iframe(scope); 99 t.add_cleanup(() => frame.remove()); 100 101 const frameNav = frame.contentWindow.navigator; 102 await registration.unregister(); 103 const value = await frameNav.serviceWorker.getRegistration(scope); 104 105 assert_equals(value, undefined, 'getRegistration should resolve with undefined'); 106 }, 'Register then Unregister then getRegistration in controlled iframe'); 107 91 108 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-scripts-resource-map.https-expected.txt
r224132 r246363 1 1 2 2 PASS import the same script URL multiple times 3 PASS call importScripts() with multiple arguments 3 4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-scripts-resource-map.https.html
r220223 r246363 1 1 <!DOCTYPE html> 2 <meta charset="utf-8" >2 <meta charset="utf-8" /> 3 3 <title>Tests for importScripts: script resource map</title> 4 4 <script src="/resources/testharness.js"></script> … … 6 6 <script src="resources/test-helpers.sub.js"></script> 7 7 <body> 8 <script> 9 // This test registers a worker that imports a script multiple times. The 10 // script should be stored on the first import and thereafter that stored 11 // script should be loaded. The worker asserts that the stored script was 12 // loaded; if the assert fails then registration fails. 13 promise_test(t => { 14 const scope = 'resources/import-scripts-resource-map'; 15 return service_worker_unregister(t, scope) 16 .then(() => { 17 return navigator.serviceWorker.register( 18 'resources/import-scripts-resource-map-worker.js', {scope: scope}); 19 }) 20 .then(r => r.unregister()); 21 }, 'import the same script URL multiple times'); 22 </script> 8 <script> 9 // This test registers a worker that imports a script multiple times. The 10 // script should be stored on the first import and thereafter that stored 11 // script should be loaded. The worker asserts that the stored script was 12 // loaded; if the assert fails then registration fails. 13 14 promise_test(async t => { 15 const SCOPE = "resources/import-scripts-resource-map"; 16 const SCRIPT = "resources/import-scripts-resource-map-worker.js"; 17 await service_worker_unregister(t, SCOPE); 18 const registration = await navigator.serviceWorker.register(SCRIPT, { 19 scope: SCOPE 20 }); 21 await registration.unregister(); 22 }, "import the same script URL multiple times"); 23 24 promise_test(async t => { 25 const SCOPE = "resources/import-scripts-diff-resource-map"; 26 const SCRIPT = "resources/import-scripts-diff-resource-map-worker.js"; 27 await service_worker_unregister(t, SCOPE); 28 const registration = await navigator.serviceWorker.register(SCRIPT, { 29 scope: SCOPE 30 }); 31 await registration.unregister(); 32 }, "call importScripts() with multiple arguments"); 33 </script> 23 34 </body> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/interfaces-window.https.html
r238592 r246363 1 1 <!DOCTYPE html> 2 2 <title>Service Worker: Interfaces</title> 3 <meta name="timeout" content="long"> 3 4 <script src="/resources/testharness.js"></script> 4 5 <script src="/resources/testharnessreport.js"></script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/multiple-update.https.html
r223273 r246363 16 16 return service_worker_unregister_and_register(t, expected_url, scope) 17 17 .then(function(r) { 18 t.add_cleanup(function() { 19 return service_worker_unregister(t, scope); 20 }); 21 18 22 registration = r; 19 23 return wait_for_state(t, registration.installing, 'activated'); … … 86 90 assert_equals(registration.active.scriptURL, expected_url, 87 91 'active should still exist after update found.'); 88 89 return service_worker_unregister_and_done(t, scope);90 92 }); 91 93 }, 'Trigger multiple updates.'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect.https.html
r238592 r246363 669 669 670 670 671 // SW responds with a fetch from a different url. 672 // SW: event.respondWith(fetch(params['url'])); 673 url2 = SCOPE1; 674 url1 = SCOPE1 + 'sw=fetch-url&url=' + encodeURIComponent(url2); 675 redirect_test( 676 url1, 677 url1, 678 [ 679 [ 680 {url: url1, resultingClientIdTag: 'x'} 681 ], 682 [], 683 [] 684 ], 685 'x', 686 'SW-fetched response from different URL, same-origin same-scope.'); 687 688 671 689 // Opaque redirect. 672 690 // SW: event.respondWith(fetch( -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/performance-timeline.https.html
r220223 r246363 18 18 let frame; 19 19 return service_worker_unregister_and_register(t, script, scope) 20 .then(reg => wait_for_state(t, reg.installing, 'activated')) 20 .then(reg => { 21 t.add_cleanup(() => service_worker_unregister(t, scope)); 22 23 return wait_for_state(t, reg.installing, 'activated'); 24 }) 21 25 .then(_ => with_iframe(scope)) 22 26 .then(f => { … … 40 44 'Slow service worker request should measure increased delay.'); 41 45 frame.remove(); 42 return service_worker_unregister_and_done(t, scope);43 46 }) 44 47 }, 'empty service worker fetch event included in performance timings'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage-to-client-message-queue.https.html
r238592 r246363 142 142 description) 143 143 { 144 function later_state(state1, state2) {144 function assert_state_less_than_equal(state1, state2, explanation) { 145 145 const states = ['init', 'install', 'start', 'finish', 'loaded']; 146 146 const index1 = states.indexOf(state1); 147 147 const index2 = states.indexOf(state2); 148 const max_index = Math.max(index1, index2);149 return states[max_index];148 if (index1 > index2) 149 assert_unreached(explanation); 150 150 } 151 151 … … 162 162 // Wait for all messages to get dispatched on the child's 163 163 // ServiceWorkerContainer and then verify that each message 164 // was dispatched while the child was in the correct state.164 // was dispatched after |earliest_dispatch|. 165 165 const report = await t.frame.report; 166 166 ['init', 'install', 'start'].forEach(state => { 167 const dispatch = later_state(state, earliest_dispatch); 168 assert_equals(report[state], dispatch, 169 `Message sent in state '${state}' dispatched in state '${dispatch}'`); 167 const explanation = `Message sent in state '${state}' was dispatched in '${report[state]}', should be dispatched no earlier than '${earliest_dispatch}'`; 168 assert_state_less_than_equal(earliest_dispatch, 169 report[state], 170 explanation); 170 171 }); 171 172 }, description); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage.https-expected.txt
r238592 r246363 4 4 PASS postMessage a transferable ArrayBuffer between ServiceWorker and Client over MessagePort 5 5 FAIL postMessage with dictionary a transferable ArrayBuffer between ServiceWorker and Client promise_test: Unhandled rejection with value: object "TypeError: Type error" 6 FAIL postMessage to a redundant worker promise_test: Unhandled rejection with value: object "InvalidStateError: Service Worker state is redundant" 6 7 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage.https.html
r238592 r246363 40 40 assert_equals(e.data, 'quit'); 41 41 return registration.unregister(scope); 42 })43 .then(() => { return wait_for_state(t, worker, 'redundant'); })44 .then(() => {45 assert_equals(worker.state, 'redundant');46 assert_throws(47 {name:'InvalidStateError'},48 function() { worker.postMessage(''); },49 'Calling postMessage on a redundant ServiceWorker should ' +50 'throw InvalidStateError.');51 42 }); 52 43 }, 'postMessage to a ServiceWorker (and back via MessagePort)'); … … 179 170 }, 'postMessage with dictionary a transferable ArrayBuffer between ServiceWorker and Client'); 180 171 172 promise_test(async t => { 173 const firstScript = 'resources/postmessage-echo-worker.js?one'; 174 const secondScript = 'resources/postmessage-echo-worker.js?two'; 175 const scope = 'resources/'; 176 177 const registration = await service_worker_unregister_and_register(t, firstScript, scope); 178 t.add_cleanup(() => registration.unregister()); 179 const firstWorker = registration.installing; 180 181 const messagePromise = new Promise(resolve => { 182 navigator.serviceWorker.addEventListener('message', (event) => { 183 resolve(event.data); 184 }, {once: true}); 185 }); 186 187 await wait_for_state(t, firstWorker, 'activated'); 188 await navigator.serviceWorker.register(secondScript, {scope}); 189 const secondWorker = registration.installing; 190 await wait_for_state(t, firstWorker, 'redundant'); 191 192 // postMessage() to a redundant worker should be dropped silently. 193 // Historically, this threw an exception. 194 firstWorker.postMessage('firstWorker'); 195 196 // To test somewhat that it was not received, send a message to another 197 // worker and check that we get a reply for that one. 198 secondWorker.postMessage('secondWorker'); 199 const data = await messagePromise; 200 assert_equals(data, 'secondWorker'); 201 }, 'postMessage to a redundant worker'); 181 202 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https-expected.txt
r225577 r246363 10 10 PASS ready after a longer matched registration registered 11 11 PASS access ready after it has been resolved 12 PASS access ready on uninstalling registration that is resurrected 12 FAIL resolve ready after unregistering and reregistering assert_not_equals: Registrations should be different got disallowed value object "[object ServiceWorkerRegistration]" 13 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" 13 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html
r224156 r246363 251 251 252 252 promise_test(async function(t) { 253 var url = 'resources/empty-worker.js'; 254 var matched_scope = 'resources/blank.html?ready-after-resurrect'; 255 256 let reg1 = await service_worker_unregister_and_register(t, url, matched_scope); 257 add_completion_callback(function() { 258 reg1.unregister(); 259 }); 260 await wait_for_state(t, reg1.installing, 'activated'); 261 262 // Hold the worker alive with a controlled worker 263 let frame = await with_iframe(matched_scope); 264 add_completion_callback(function() { 265 frame.remove(); 266 }); 267 268 // Doom the registration as uninstalling. 269 await reg1.unregister(); 270 271 // Access the ready promise while the registration is doomed. 272 let readyPromise = frame.contentWindow.navigator.serviceWorker.ready; 273 274 // Resurrect the doomed registration; 275 let reg2 = await service_worker_unregister_and_register(t, url, matched_scope); 276 assert_equals(reg1, reg2, 'existing registration should be resurrected'); 277 278 // We are trying to test if the ready promise ever resolves here. Use 279 // an explicit timeout check here rather than forcing a full infrastructure 280 // level timeout. 281 let timeoutId; 282 let timeoutPromise = new Promise(resolve => { 283 timeoutId = setTimeout(_ => { 284 timeoutId = null; 285 resolve(); 286 }, 500); 287 }); 288 289 // This should resolve immediately since there is an alive registration 290 // with an active promise for the matching scope. 291 await Promise.race([readyPromise, timeoutPromise]); 292 293 assert_not_equals(timeoutId, null, 294 'ready promise should resolve before timeout'); 295 clearTimeout(timeoutId); 296 297 // We should get here and not time out. 298 299 }, 'access ready on uninstalling registration that is resurrected'); 253 const url1 = 'resources/empty-worker.js'; 254 const url2 = url1 + '?2'; 255 const matched_scope = 'resources/blank.html?ready-after-unregister'; 256 257 const reg1 = await service_worker_unregister_and_register(t, url1, matched_scope); 258 t.add_cleanup(() => reg1.unregister()); 259 260 await wait_for_state(t, reg1.installing, 'activating'); 261 // This registration will resolve all ready promises in clients that match the scope. 262 // But there are no clients. 263 264 const frame = await with_iframe(matched_scope); 265 t.add_cleanup(() => frame.remove()); 266 267 await reg1.unregister(); 268 269 // Access the ready promise while the registration is unregistering. 270 const readyPromise = frame.contentWindow.navigator.serviceWorker.ready; 271 272 // Create a new registration. 273 const reg2 = await navigator.serviceWorker.register(url2, { scope: matched_scope }); 274 t.add_cleanup(() => reg2.unregister()); 275 // This registration will resolve all ready promises in clients that match the scope. 276 // That includes frame's client. 277 278 const readyReg = await readyPromise; 279 280 assert_equals(readyReg.active.scriptURL, reg2.active.scriptURL, 'Resolves with the second registration'); 281 assert_not_equals(reg1, reg2, 'Registrations should be different'); 282 }, 'resolve ready after unregistering and reregistering'); 283 284 promise_test(async function(t) { 285 const url1 = 'resources/empty-worker.js'; 286 const url2 = url1 + '?2'; 287 const matched_scope = 'resources/blank.html?ready-after-unregister'; 288 289 const frame = await with_iframe(matched_scope); 290 t.add_cleanup(() => frame.remove()); 291 292 const reg1 = await service_worker_unregister_and_register(t, url1, matched_scope); 293 t.add_cleanup(() => reg1.unregister()); 294 295 await wait_for_state(t, reg1.installing, 'activated'); 296 // This registration will resolve all ready promises in clients that match the scope. 297 // That includes frame's client. 298 299 const reg1Active = reg1.active; 300 301 await reg1.unregister(); 302 303 // Access the ready promise while the registration is unregistering. 304 const readyPromise = frame.contentWindow.navigator.serviceWorker.ready; 305 306 // Create a new registration. 307 const reg2 = await navigator.serviceWorker.register(url2, { scope: matched_scope }); 308 t.add_cleanup(() => reg2.unregister()); 309 // This registration will resolve all ready promises in clients that match the scope. 310 // That includes frame's client, but its ready promise has already resolved. 311 312 const readyReg = await readyPromise; 313 314 assert_equals(readyReg.active.scriptURL, reg1Active.scriptURL, 'Resolves with the first registration'); 315 assert_not_equals(reg1, reg2, 'Registrations should be different'); 316 }, 'resolve ready before unregistering and reregistering'); 300 317 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https.html
r202471 r246363 53 53 .then( 54 54 function(registration) { 55 t.add_cleanup(function() { 56 return service_worker_unregister(t, registration.scope); 57 }); 58 55 59 assert_unreached('register should fail'); 56 service_worker_unregister_and_done(t, registration.scope);57 60 }, 58 61 function(error) { -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-wait-forever-in-install-worker.https.html
r202471 r246363 17 17 return navigator.serviceWorker.register(bad_script, {scope: scope}) 18 18 .then(function(r) { 19 t.add_cleanup(function() { 20 return service_worker_unregister(t, scope); 21 }); 22 19 23 registration = r; 20 24 assert_equals(registration.installing.scriptURL, … … 48 52 return wait_for_state(t, registration.installing, 'activated'); 49 53 }) 50 .then(function() {51 return service_worker_unregister_and_done(t, scope);52 })53 54 }, 'register worker that calls waitUntil with a promise that never ' + 54 55 'resolves in oninstall'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-end-to-end.https.html
r202471 r246363 12 12 var lastServiceWorkerState = ''; 13 13 var receivedMessageFromPort = ''; 14 var currentChangeCount = 0;15 14 16 15 assert_true(navigator.serviceWorker instanceof ServiceWorkerContainer); 17 16 assert_equals(typeof navigator.serviceWorker.register, 'function'); 18 17 assert_equals(typeof navigator.serviceWorker.getRegistration, 'function'); 19 20 navigator.serviceWorker.oncurrentchange = function() {21 ++currentChangeCount;22 };23 18 24 19 service_worker_unregister_and_register( … … 76 71 'Service worker should pass through all states'); 77 72 78 assert_equals(currentChangeCount, 0,79 'Should not see current changes since document is out of scope');80 81 73 assert_equals(receivedMessageFromPort, 'Ack for: registering doc'); 82 74 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-mime-types.https.html
r222307 r246363 1 1 <!DOCTYPE html> 2 2 <title>Service Worker: Registration (MIME types)</title> 3 <meta name="timeout" content="long"> 3 4 <script src="/resources/testharness.js"></script> 4 5 <script src="/resources/testharnessreport.js"></script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https-expected.txt
r238592 r246363 24 24 PASS access-updateViaCache-after-unregister-all 25 25 PASS access-updateViaCache-after-unregister-none 26 FAIL updateViaCache is not updated if register() rejects assert_equals: after update attempt expected "imports" but got "none" 26 27 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https.html
r238592 r246363 185 185 } 186 186 187 promise_test(async t => { 188 await cleanup(); 189 t.add_cleanup(cleanup); 190 191 const registration = await navigator.serviceWorker.register( 192 'resources/empty.js', 193 {scope: SCOPE}); 194 assert_equals(registration.updateViaCache, 'imports', 195 'before update attempt'); 196 197 const fail = navigator.serviceWorker.register( 198 'resources/malformed-worker.py?parse-error', 199 {scope: SCOPE, updateViaCache: 'none'}); 200 await promise_rejects(t, new TypeError(), fail); 201 assert_equals(registration.updateViaCache, 'imports', 202 'after update attempt'); 203 }, 'updateViaCache is not updated if register() rejects'); 187 204 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https.html
r244776 r246363 15 15 const url = options.mode === 'cross-origin' ? crossOriginUrl(options.resource) 16 16 : resourceUrl(options.resource); 17 const entryList = options.performance.getEntriesByName(url );17 const entryList = options.performance.getEntriesByName(url, 'resource'); 18 18 if (options.should_no_performance_entry) { 19 19 // The performance timeline may not have an entry for a resource … … 137 137 test(() => { 138 138 const url = resourceUrl('resources/test-helpers.sub.js'); 139 const entry = window.performance.getEntriesByName(url )[0];139 const entry = window.performance.getEntriesByName(url, 'resource')[0]; 140 140 assert_equals(entry.workerStart, 0, 'Non-controlled'); 141 141 }, 'Non-controlled resource loads'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/appcache-ordering.manifest
r202471 r246363 2 2 3 3 appcache-ordering.is-appcached.html 4 blank.html 4 5 5 6 FALLBACK: -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/claim-worker.js
r220223 r246363 15 15 16 16 self.addEventListener('fetch', function(event) { 17 event.respondWith(new Response('Intercepted!')); 18 }); 17 if (!/404/.test(event.request.url)) 18 event.respondWith(new Response('Intercepted!')); 19 }); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/extendable-event-async-waituntil.js
r222307 r246363 1 // controlled by 'init'/'done' messages. 1 // This worker calls waitUntil() and respondWith() asynchronously and 2 // reports back to the test whether they threw. 3 // 4 // These test cases are confusing. Bear in mind that the event is active 5 // (calling waitUntil() is allowed) if: 6 // * The pending promise count is not 0, or 7 // * The event dispatch flag is set. 8 9 // Controlled by 'init'/'done' messages. 2 10 var resolveLockPromise; 3 11 var port; … … 15 23 resolveLockPromise(); 16 24 break; 25 26 // Throws because waitUntil() is called in a task after event dispatch 27 // finishes. 17 28 case 'no-current-extension-different-task': 18 29 async_task_waituntil(event).then(reportResultExpecting('InvalidStateError')); 19 30 break; 31 32 // OK because waitUntil() is called in a microtask that runs after the 33 // event handler runs, while the event dispatch flag is still set. 20 34 case 'no-current-extension-different-microtask': 21 async_microtask_waituntil(event).then(reportResultExpecting('InvalidStateError')); 22 break; 35 async_microtask_waituntil(event).then(reportResultExpecting('OK')); 36 break; 37 38 // OK because the second waitUntil() is called while the first waitUntil() 39 // promise is still pending. 23 40 case 'current-extension-different-task': 24 41 event.waitUntil(new Promise((res) => { resolveTestPromise = res; })); 25 42 async_task_waituntil(event).then(reportResultExpecting('OK')).then(resolveTestPromise); 26 43 break; 27 case 'current-extension-expired-same-microtask-turn': 44 45 // OK because all promises involved resolve "immediately", so the second 46 // waitUntil() is called during the microtask checkpoint at the end of 47 // event dispatching, when the event dispatch flag is still set. 48 case 'during-event-dispatch-current-extension-expired-same-microtask-turn': 28 49 waitPromise = Promise.resolve(); 29 50 event.waitUntil(waitPromise); … … 31 52 .then(reportResultExpecting('OK')) 32 53 break; 33 case 'current-extension-expired-same-microtask-turn-extra': 34 // The promise handler queues a new microtask *after* the check for new35 // extensions was performed.54 55 // OK for the same reason as above. 56 case 'during-event-dispatch-current-extension-expired-same-microtask-turn-extra': 36 57 waitPromise = Promise.resolve(); 58 event.waitUntil(waitPromise); 59 waitPromise.then(() => { return async_microtask_waituntil(event); }) 60 .then(reportResultExpecting('OK')) 61 break; 62 63 64 // OK because the pending promise count is decremented in a microtask 65 // queued upon fulfillment of the first waitUntil() promise, so the second 66 // waitUntil() is called while the pending promise count is still 67 // positive. 68 case 'after-event-dispatch-current-extension-expired-same-microtask-turn': 69 waitPromise = makeNewTaskPromise(); 70 event.waitUntil(waitPromise); 71 waitPromise.then(() => { return sync_waituntil(event); }) 72 .then(reportResultExpecting('OK')) 73 break; 74 75 // Throws because the second waitUntil() is called after the pending 76 // promise count was decremented to 0. 77 case 'after-event-dispatch-current-extension-expired-same-microtask-turn-extra': 78 waitPromise = makeNewTaskPromise(); 37 79 event.waitUntil(waitPromise); 38 80 waitPromise.then(() => { return async_microtask_waituntil(event); }) 39 81 .then(reportResultExpecting('InvalidStateError')) 40 82 break; 83 84 // Throws because the second waitUntil() is called in a new task, after 85 // first waitUntil() promise settled and the event dispatch flag is unset. 41 86 case 'current-extension-expired-different-task': 42 87 event.waitUntil(Promise.resolve()); 43 88 async_task_waituntil(event).then(reportResultExpecting('InvalidStateError')); 44 89 break; 90 45 91 case 'script-extendable-event': 46 92 self.dispatchEvent(new ExtendableEvent('nontrustedevent')); … … 52 98 53 99 self.addEventListener('fetch', function(event) { 54 if (event.request.url.indexOf('pending-respondwith-async-waituntil') != -1) { 100 const path = new URL(event.request.url).pathname; 101 const step = path.substring(path.lastIndexOf('/') + 1); 102 let response; 103 switch (step) { 104 // OK because waitUntil() is called while the respondWith() promise is still 105 // unsettled, so the pending promise count is positive. 106 case 'pending-respondwith-async-waituntil': 55 107 var resolveFetch; 56 letresponse = new Promise((res) => { resolveFetch = res; });108 response = new Promise((res) => { resolveFetch = res; }); 57 109 event.respondWith(response); 58 110 async_task_waituntil(event) 59 111 .then(reportResultExpecting('OK')) 60 112 .then(() => { resolveFetch(new Response('OK')); }); 61 } else if (event.request.url.indexOf('respondwith-microtask-sync-waituntil') != -1) { 113 break; 114 115 // OK because all promises involved resolve "immediately", so waitUntil() is 116 // called during the microtask checkpoint at the end of event dispatching, 117 // when the event dispatch flag is still set. 118 case 'during-event-dispatch-respondwith-microtask-sync-waituntil': 62 119 response = Promise.resolve(new Response('RESP')); 63 120 event.respondWith(response); 64 121 response.then(() => { return sync_waituntil(event); }) 65 .then(reportResultExpecting('OK')) 66 } else if (event.request.url.indexOf('respondwith-microtask-async-waituntil') != -1) { 122 .then(reportResultExpecting('OK')); 123 break; 124 125 // OK because all promises involved resolve "immediately", so waitUntil() is 126 // called during the microtask checkpoint at the end of event dispatching, 127 // when the event dispatch flag is still set. 128 case 'during-event-dispatch-respondwith-microtask-async-waituntil': 67 129 response = Promise.resolve(new Response('RESP')); 130 event.respondWith(response); 131 response.then(() => { return async_microtask_waituntil(event); }) 132 .then(reportResultExpecting('OK')); 133 break; 134 135 // OK because the pending promise count is decremented in a microtask queued 136 // upon fulfillment of the respondWith() promise, so waitUntil() is called 137 // while the pending promise count is still positive. 138 case 'after-event-dispatch-respondwith-microtask-sync-waituntil': 139 response = makeNewTaskPromise().then(() => {return new Response('RESP');}); 140 event.respondWith(response); 141 response.then(() => { return sync_waituntil(event); }) 142 .then(reportResultExpecting('OK')); 143 break; 144 145 146 // Throws because waitUntil() is called after the pending promise count was 147 // decremented to 0. 148 case 'after-event-dispatch-respondwith-microtask-async-waituntil': 149 response = makeNewTaskPromise().then(() => {return new Response('RESP');}); 68 150 event.respondWith(response); 69 151 response.then(() => { return async_microtask_waituntil(event); }) 70 152 .then(reportResultExpecting('InvalidStateError')) 71 } 72 }); 153 break; 154 } 155 }); 73 156 74 157 self.addEventListener('nontrustedevent', function(event) { … … 119 202 }); 120 203 } 204 205 // Returns a promise that settles in a separate task. 206 function makeNewTaskPromise() { 207 return new Promise(resolve => { 208 setTimeout(resolve, 0); 209 }); 210 } -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-async-respond-with-worker.js
r220223 r246363 1 var result; 1 // This worker attempts to call respondWith() asynchronously after the 2 // fetch event handler finished. It reports back to the test whether 3 // an exception was thrown. 2 4 3 self.addEventListener('message', function(event) { 4 event.data.port.postMessage(result); 5 // These get reset at the start of a test case. 6 let reportResult; 7 8 // The test page sends a message to tell us that a new test case is starting. 9 // We expect a fetch event after this. 10 self.addEventListener('message', (event) => { 11 // Ensure tests run mutually exclusive. 12 if (reportResult) { 13 event.source.postMessage('testAlreadyRunning'); 14 return; 15 } 16 17 const resultPromise = new Promise((resolve) => { 18 reportResult = resolve; 19 // Tell the client that everything is initialized and that it's safe to 20 // proceed with the test without relying on the order of events (which some 21 // browsers like Chrome may not guarantee). 22 event.source.postMessage('messageHandlerInitialized'); 5 23 }); 6 24 25 // Keep the worker alive until the test case finishes, and report 26 // back the result to the test page. 27 event.waitUntil(resultPromise.then(result => { 28 reportResult = null; 29 event.source.postMessage(result); 30 })); 31 }); 32 33 // Calls respondWith() and reports back whether an exception occurred. 34 function tryRespondWith(event) { 35 try { 36 event.respondWith(new Response()); 37 reportResult({didThrow: false}); 38 } catch (error) { 39 reportResult({didThrow: true, error: error.name}); 40 } 41 } 42 43 function respondWithInTask(event) { 44 setTimeout(() => { 45 tryRespondWith(event); 46 }, 0); 47 } 48 49 function respondWithInMicrotask(event) { 50 Promise.resolve().then(() => { 51 tryRespondWith(event); 52 }); 53 } 54 7 55 self.addEventListener('fetch', function(event) { 8 setTimeout(function() { 9 try { 10 event.respondWith(new Response()); 11 result = 'FAIL: did not throw'; 12 } catch (error) { 13 if (error.name == 'InvalidStateError') 14 result = 'PASS'; 15 else 16 result = 'FAIL: Unexpected exception: ' + error; 17 } 18 }, 0); 19 }); 56 const path = new URL(event.request.url).pathname; 57 const test = path.substring(path.lastIndexOf('/') + 1); 58 59 // If this is a test case, try respondWith() and report back to the test page 60 // the result. 61 if (test == 'respondWith-in-task') { 62 respondWithInTask(event); 63 } else if (test == 'respondWith-in-microtask') { 64 respondWithInMicrotask(event); 65 } 66 }); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-network-fallback-worker.js
r238592 r246363 1 1 self.addEventListener('fetch', () => { 2 3 2 // Do nothing. 3 }); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-request-css-base-url-iframe.html
r220223 r246363 1 <link href="./fetch-request-css-base-url-style.css" rel="stylesheet" type="text/css"> 1 <html> 2 <head> 3 <title>iframe for css base url test</title> 4 </head> 5 <body> 6 <script> 7 // Load a stylesheet. Create it dynamically so we can construct the href URL 8 // dynamically. 9 const link = document.createElement('link'); 10 link.rel = 'stylesheet'; 11 link.type = 'text/css'; 12 // Add "request-url-path" to the path to help distinguish the request URL from 13 // the response URL. Add |document.location.search| (chosen by the test main 14 // page) to tell the service worker how to respond to the request. 15 link.href = 'request-url-path/fetch-request-css-base-url-style.css' + 16 document.location.search; 17 document.head.appendChild(link); 18 </script> 19 </body> 20 </html> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-request-css-base-url-worker.js
r220223 r246363 1 importScripts('/common/get-host-info.sub.js'); 2 importScripts('test-helpers.sub.js'); 1 let source; 2 let resolveDone; 3 let done = new Promise(resolve => resolveDone = resolve); 3 4 4 var port = undefined; 5 // The page messages this worker to ask for the result. Keep the worker alive 6 // via waitUntil() until the result is sent. 7 self.addEventListener('message', event => { 8 source = event.data.port; 9 source.postMessage('pong'); 10 event.waitUntil(done); 11 }); 5 12 6 self.onmessage = function(e) { 7 var message = e.data; 8 if ('port' in message) { 9 port = message.port; 10 port.postMessage({ready: true}); 13 self.addEventListener('fetch', event => { 14 const url = new URL(event.request.url); 15 16 // For the CSS file, respond in a way that may change the response URL, 17 // depending on |url.search|. 18 const cssPath = 'request-url-path/fetch-request-css-base-url-style.css'; 19 if (url.pathname.indexOf(cssPath) != -1) { 20 // Respond with a different URL, deleting "request-url-path/". 21 if (url.search == '?fetch') { 22 event.respondWith(fetch('fetch-request-css-base-url-style.css')); 23 } 24 // Respond with new Response(). 25 else if (url.search == '?newResponse') { 26 const styleString = 'body { background-image: url("./dummy.png");}'; 27 const headers = {'content-type': 'text/css'}; 28 event.respondWith(new Response(styleString, headers)); 29 } 11 30 } 12 };13 31 14 self.addEventListener('fetch', function(event) { 15 var url = event.request.url;16 if (url.indexOf('fetch-request-css-base-url-style.css') != -1) {17 event.respondWith(fetch(18 get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +19 'fetch-request-css-base-url-style.css',20 {mode: 'no-cors'}));21 } else if (url.indexOf('dummy.png') != -1){22 port.postMessage({23 url: event.request.url,24 referrer: event.request.referrer25 });26 27 32 // The image request indicates what the base URL of the CSS was. Message the 33 // result back to the test page. 34 else if (url.pathname.indexOf('dummy.png') != -1) { 35 // For some reason |source| is undefined here when running the test manually 36 // in Firefox. The test author experimented with both using Client 37 // (event.source) and MessagePort to try to get the test to pass, but 38 // failed. 39 source.postMessage({ 40 url: event.request.url, 41 referrer: event.request.referrer 42 }); 43 resolveDone(); 44 } 45 }); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/service-worker-csp-worker.py
r220223 r246363 17 17 'Importing the other origins script should fail.'); 18 18 }, 'importScripts test for default-src'); 19 20 test(function() { 21 assert_throws(EvalError(), 22 function() { eval('1 + 1'); }, 23 'eval() should throw EvalError.') 24 assert_throws(EvalError(), 25 function() { new Function('1 + 1'); }, 26 'new Function() should throw EvalError.') 27 }, 'eval test for default-src'); 19 28 20 29 async_test(function(t) { … … 64 73 }, 'importScripts test for script-src'); 65 74 75 test(function() { 76 assert_throws(EvalError(), 77 function() { eval('1 + 1'); }, 78 'eval() should throw EvalError.') 79 assert_throws(EvalError(), 80 function() { new Function('1 + 1'); }, 81 'new Function() should throw EvalError.') 82 }, 'eval test for script-src'); 83 66 84 async_test(function(t) { 67 85 fetch(host_info.HTTPS_REMOTE_ORIGIN + … … 110 128 }, 'importScripts test for connect-src'); 111 129 130 test(function() { 131 var eval_failed = false; 132 try { 133 eval('1 + 1'); 134 new Function('1 + 1'); 135 } catch(e) { 136 eval_failed = true; 137 } 138 assert_false(eval_failed, 139 'connect-src without unsafe-eval should not block eval().'); 140 }, 'eval test for connect-src'); 141 112 142 async_test(function(t) { 113 143 fetch(host_info.HTTPS_REMOTE_ORIGIN + -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-helpers.sub.js
r238592 r246363 76 76 77 77 return new Promise(test.step_func(function(resolve) { 78 registration.addEventListener('updatefound', test.step_func(function() { 79 resolve(registration.installing); 80 })); 78 var handler = test.step_func(function() { 79 registration.removeEventListener('updatefound', handler); 80 resolve(registration.installing); 81 }); 82 registration.addEventListener('updatefound', handler); 81 83 })); 82 84 } … … 277 279 await registration.unregister(); 278 280 } 281 282 // This installs resources/appcache-ordering.manifest. 283 function install_appcache_ordering_manifest() { 284 let resolve_install_appcache; 285 let reject_install_appcache; 286 287 // This is notified by the child iframe, i.e. appcache-ordering.install.html, 288 // that's to be created below. 289 window.notify_appcache_installed = success => { 290 if (success) 291 resolve_install_appcache(); 292 else 293 reject_install_appcache(); 294 }; 295 296 return new Promise((resolve, reject) => { 297 const frame = document.createElement('iframe'); 298 frame.src = 'resources/appcache-ordering.install.html'; 299 document.body.appendChild(frame); 300 resolve_install_appcache = function() { 301 document.body.removeChild(frame); 302 resolve(); 303 }; 304 reject_install_appcache = function() { 305 document.body.removeChild(frame); 306 reject(); 307 }; 308 }); 309 } 310 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-during-installation-worker.js
r238592 r246363 1 1 'use strict'; 2 2 3 const install MayFinish= new Promise(resolve => {4 self.finishInstall= resolve;3 const installEventFired = new Promise(resolve => { 4 self.fireInstallEvent = resolve; 5 5 }); 6 6 7 let report = { installEventFired: false }; 7 const installFinished = new Promise(resolve => { 8 self.finishInstall = resolve; 9 }); 8 10 9 11 addEventListener('install', event => { 10 report.installEventFired = true; 11 let attemptUpdate = registration.update().catch(exception => { 12 report.exception = exception.name; 13 }); 14 event.waitUntil(Promise.all([installMayFinish, attemptUpdate])); 12 fireInstallEvent(); 13 event.waitUntil(installFinished); 15 14 }); 16 15 17 16 addEventListener('message', event => { 18 if (event.data === 'finishInstall') { 17 // Use a dedicated MessageChannel for every request so senders can wait for 18 // individual requests to finish, and concurrent requests (to different 19 // workers) don't cause race conditions. 20 const port = event.data; 21 port.onmessage = (event) => { 22 switch (event.data) { 23 case 'awaitInstallEvent': 24 installEventFired.then(() => { 25 port.postMessage('installEventFired'); 26 }); 27 break; 28 29 case 'finishInstall': 30 installFinished.then(() => { 31 port.postMessage('installFinished'); 32 }); 19 33 finishInstall(); 20 } else { 21 event.source.postMessage(report); 34 break; 35 36 case 'callUpdate': { 37 const channel = new MessageChannel(); 38 registration.update().then(() => { 39 channel.port2.postMessage({ 40 success: true, 41 }); 42 }).catch((exception) => { 43 channel.port2.postMessage({ 44 success: false, 45 exception: exception.name, 46 }); 47 }); 48 port.postMessage(channel.port1, [channel.port1]); 49 break; 50 } 51 52 default: 53 port.postMessage('Unexpected command ' + event.data); 54 break; 22 55 } 56 }; 23 57 }); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/w3c-import.log
r238592 r246363 147 147 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-waits-for-activate-worker.js 148 148 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/frame-for-getregistrations.html 149 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/get-resultingClientId-worker.js 149 150 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/http-to-https-redirect-and-register-iframe.html 150 151 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/iframe-with-image.html 151 152 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/immutable-prototype-serviceworker.js 152 153 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-mime-type-worker.py 154 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-relative.xsl 155 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-diff-resource-map-worker.js 153 156 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-echo.py 157 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-get.py 154 158 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-mime-types-worker.js 155 159 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-redirect-import.js … … 222 226 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-blob-url.js 223 227 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-dictionary-transferables-worker.js 228 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-echo-worker.js 224 229 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-msgport-to-client-worker.js 225 230 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/postmessage-to-client-worker.js … … 275 280 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/success.py 276 281 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-helpers.sub.js 282 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-request-headers-worker.js 283 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-request-headers-worker.py 277 284 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/testharness-helpers.js 285 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/trickle.py 278 286 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/unregister-controller-page.html 279 287 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-claim-worker.py 280 288 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-during-installation-worker.js 289 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-during-installation-worker.py 290 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-fetch-worker.py 281 291 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-max-aged-worker-imported-script.py 282 292 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/update-max-aged-worker.py … … 301 311 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-testharness.js 302 312 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker_interception_redirect_webworker.py 313 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xhr-iframe.html 314 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xhr-response-url-worker.js 315 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xsl-base-url-iframe.xml 316 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xsl-base-url-worker.js 317 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/xslt-pass.xsl -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-interception-iframe.https.html
r238592 r246363 1 1 <script src="/common/get-host-info.sub.js"></script> 2 <script src="/resources/testharness.js"></script> 2 3 <script src="test-helpers.sub.js?pipe=sub"></script> 3 4 <script> … … 12 13 }) 13 14 .then(function(data) { 14 window.parent.postMessage({results: data}, host_info['HTTPS_ORIGIN']);15 assert_equals(data, "This load was successfully intercepted."); 15 16 }); 16 17 } -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/worker-load-interceptor.js
r220223 r246363 9 9 event.respondWith(new Response(response_text)); 10 10 } else if (url.indexOf("synthesized-response.js") != -1) { 11 event.respondWith(new Response(response_script)); 11 event.respondWith(new Response( 12 response_script, 13 {headers: {'Content-Type': 'application/javascript'}})); 12 14 } 13 15 }; -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-connect.https-expected.txt
r226628 r246363 2 2 PASS CSP test for connect-src in ServiceWorkerGlobalScope 3 3 PASS importScripts test for connect-src 4 PASS eval test for connect-src 4 5 PASS Fetch test for connect-src 5 6 PASS Redirected fetch test for connect-src -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-default.https-expected.txt
r226628 r246363 2 2 PASS CSP test for default-src in ServiceWorkerGlobalScope 3 3 PASS importScripts test for default-src 4 PASS eval test for default-src 4 5 PASS Fetch test for default-src 5 6 PASS Redirected fetch test for default-src -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-script.https-expected.txt
r226628 r246363 2 2 PASS CSP test for script-src in ServiceWorkerGlobalScope 3 3 PASS importScripts test for script-src 4 PASS eval test for script-src 4 5 PASS Fetch test for script-src 5 6 PASS Redirected fetch test for script-src -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/serviceworker-message-event-historical.https.html
r220223 r246363 11 11 return service_worker_unregister_and_register(t, url, scope) 12 12 .then(function(r) { 13 t.add_cleanup(function() { 14 return service_worker_unregister(t, scope); 15 }); 16 13 17 return wait_for_state(t, r.installing, 'activated'); 14 18 }) … … 36 40 worker.postMessage('PING'); 37 41 }); 38 })39 .then(function() {40 return service_worker_unregister_and_done(t, scope);41 42 }); 42 43 }, 'Test MessageEvent supplants ServiceWorkerMessageEvent.'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/shared-worker-controlled.https.html
r220223 r246363 13 13 return service_worker_unregister_and_register(t, service_worker, scope) 14 14 .then(function(r) { 15 t.add_cleanup(function() { 16 return service_worker_unregister(t, scope); 17 }); 18 15 19 return wait_for_state(t, r.installing, 'activated'); 16 20 }) … … 25 29 .then(function(data) { 26 30 assert_equals(data, 'intercepted by service worker'); 27 service_worker_unregister_and_done(t, scope);28 31 }); 29 32 }, 'Verify subresource loads in SharedWorker are controlled by a Service Worker'); … … 36 39 return service_worker_unregister_and_register(t, service_worker, scope) 37 40 .then(function(r) { 41 t.add_cleanup(function() { 42 return service_worker_unregister(t, scope); 43 }); 44 38 45 return wait_for_state(t, r.installing, 'activated'); 39 46 }) … … 48 55 .then(function(data) { 49 56 assert_equals(data, 'worker loading intercepted by service worker'); 50 service_worker_unregister_and_done(t, scope);51 57 }); 52 58 }, 'Verify SharedWorker construction is controlled by a Service Worker'); … … 59 65 return service_worker_unregister_and_register(t, service_worker, scope) 60 66 .then(function(r) { 67 t.add_cleanup(function() { 68 return service_worker_unregister(t, scope); 69 }); 70 61 71 return wait_for_state(t, r.installing, 'activated'); 62 72 }) … … 71 81 .then(function(data) { 72 82 assert_equals(data, 'worker loading intercepted by service worker'); 73 service_worker_unregister_and_done(t, scope);74 83 }); 75 84 }, 'Verify importScripts from SharedWorker is controlled by a Service Worker'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-installed.https.html
r220223 r246363 34 34 return service_worker_unregister_and_register(t, url1, scope) 35 35 .then(function(r) { 36 t.add_cleanup(function() { 37 return service_worker_unregister(t, scope); 38 }); 39 36 40 return wait_for_state(t, r.installing, 'activated'); 37 41 }) … … 61 65 .then(function() { 62 66 frame.remove(); 63 return service_worker_unregister_and_done(t, scope);64 67 }); 65 68 }, 'Test skipWaiting when a installed worker is waiting'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-using-registration.https.html
r238592 r246363 1 1 <!DOCTYPE html> 2 2 <title>Service Worker: Skip waiting using registration</title> 3 <meta name="timeout" content="long"> 3 4 <script src="/resources/testharness.js"></script> 4 5 <script src="/resources/testharnessreport.js"></script> … … 59 60 assert_not_equals(sw_registration.active, null, 60 61 'Registration active worker should not be null'); 61 fetch_tests_from_worker(sw_registration.active);62 return fetch_tests_from_worker(sw_registration.active); 62 63 }); 63 64 }, 'Test skipWaiting while a client is using the registration'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-without-using-registration.https.html
r238592 r246363 1 1 <!DOCTYPE html> 2 2 <title>Service Worker: Skip waiting without using registration</title> 3 <meta name="timeout" content="long"> 3 4 <script src="/resources/testharness.js"></script> 4 5 <script src="/resources/testharnessreport.js"></script> … … 37 38 assert_not_equals(sw_registration.active, null, 38 39 'Registration active worker should not be null'); 39 fetch_tests_from_worker(sw_registration.active);40 return fetch_tests_from_worker(sw_registration.active); 40 41 }); 41 42 }, 'Test skipWaiting while a client is not being controlled'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting.https.html
r220223 r246363 15 15 return service_worker_unregister_and_register(t, url1, scope) 16 16 .then(function(registration) { 17 t.add_cleanup(function() { 18 return service_worker_unregister(t, scope); 19 }); 20 17 21 sw_registration = registration; 18 22 return wait_for_state(t, registration.installing, 'activated'); … … 49 53 assert_equals(sw_registration.active.scriptURL, normalizeURL(url3), 50 54 'Worker with url3 should be activated'); 51 return service_worker_unregister_and_done(t, scope);52 55 }); 53 56 }, 'Test skipWaiting with both active and waiting workers'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https-expected.txt
r238592 r246363 1 1 2 2 PASS Registering a new script URL while an unregistered registration is in use 3 PASS Registering a new script URL that 404s does resurrect an unregistered registration 4 PASS Registering a new script URL that fails to install does resurrect an unregistered registration 3 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]" 4 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]" 5 5 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https.html
r238592 r246363 6 6 var worker_url = 'resources/empty-worker.js'; 7 7 8 async_test(function(t) { 9 var scope = 'resources/scope/unregister-then-register-new-script-that-exists'; 10 var new_worker_url = worker_url + '?new'; 11 var iframe; 12 var registration; 13 var new_registration; 8 promise_test(async function(t) { 9 const scope = 'resources/scope/unregister-then-register-new-script-that-exists'; 10 const registration = await service_worker_unregister_and_register(t, worker_url, scope); 11 t.add_cleanup(() => registration.unregister()); 14 12 15 service_worker_unregister_and_register(t, worker_url, scope) 16 .then(function(r) { 17 registration = r; 18 return wait_for_state(t, r.installing, 'activated'); 19 }) 20 .then(function() { 21 return with_iframe(scope); 22 }) 23 .then(function(frame) { 24 iframe = frame; 25 return registration.unregister(); 26 }) 27 .then(function() { 28 return navigator.serviceWorker.register(new_worker_url, 29 { scope: scope }); 30 }) 31 .then(function(r) { 32 new_registration = r; 33 assert_equals(registration.installing.scriptURL, 34 normalizeURL(new_worker_url), 35 'before activated registration.installing'); 36 assert_equals(registration.waiting, null, 37 'before activated registration.waiting'); 38 assert_equals(registration.active.scriptURL, normalizeURL(worker_url), 39 'before activated registration.active'); 40 assert_equals(new_registration.installing.scriptURL, 41 normalizeURL(new_worker_url), 42 'before activated new_registration.installing'); 43 assert_equals(new_registration.waiting, null, 44 'before activated new_registration.waiting'); 45 assert_equals(new_registration.active.scriptURL, 46 normalizeURL(worker_url), 47 'before activated new_registration.active'); 48 iframe.remove(); 49 return wait_for_state(t, registration.installing, 'activated'); 50 }) 51 .then(function() { 52 assert_equals(new_registration.installing, null, 53 'after activated new_registration.installing'); 54 assert_equals(new_registration.waiting, null, 55 'after activated new_registration.waiting'); 56 assert_equals(new_registration.active.scriptURL, 57 normalizeURL(new_worker_url), 58 'after activated new_registration.active'); 59 return with_iframe(scope); 60 }) 61 .then(function(frame) { 62 assert_equals( 63 frame.contentWindow.navigator.serviceWorker.controller.scriptURL, 64 normalizeURL(new_worker_url), 65 'the new worker should control a new document'); 66 frame.remove(); 67 return registration.unregister(); 68 }) 69 .then(function() { 70 t.done(); 71 }) 72 .catch(unreached_rejection(t)); 13 const newWorkerURL = worker_url + '?new'; 14 await wait_for_state(t, registration.installing, 'activated'); 15 16 const iframe = await with_iframe(scope); 17 t.add_cleanup(() => iframe.remove()); 18 19 await registration.unregister(); 20 21 const newRegistration = await navigator.serviceWorker.register(newWorkerURL, { scope }); 22 t.add_cleanup(() => newRegistration.unregister()); 23 24 assert_equals( 25 registration.installing.scriptURL, 26 normalizeURL(newWorkerURL), 27 'before activated registration.installing' 28 ); 29 assert_equals( 30 registration.waiting, 31 null, 32 'before activated registration.waiting' 33 ); 34 assert_equals( 35 registration.active.scriptURL, 36 normalizeURL(worker_url), 37 'before activated registration.active' 38 ); 39 assert_equals( 40 newRegistration.installing.scriptURL, 41 normalizeURL(newWorkerURL), 42 'before activated newRegistration.installing' 43 ); 44 assert_equals( 45 newRegistration.waiting, 46 null, 47 'before activated newRegistration.waiting' 48 ); 49 assert_equals( 50 newRegistration.active.scriptURL, 51 normalizeURL(worker_url), 52 'before activated newRegistration.active' 53 ); 54 iframe.remove(); 55 56 await wait_for_state(t, registration.installing, 'activated'); 57 58 assert_equals( 59 newRegistration.installing, 60 null, 61 'after activated newRegistration.installing' 62 ); 63 assert_equals( 64 newRegistration.waiting, 65 null, 66 'after activated newRegistration.waiting' 67 ); 68 assert_equals( 69 newRegistration.active.scriptURL, 70 normalizeURL(newWorkerURL), 71 'after activated newRegistration.active' 72 ); 73 74 const newIframe = await with_iframe(scope); 75 t.add_cleanup(() => newIframe.remove()); 76 77 assert_equals( 78 newIframe.contentWindow.navigator.serviceWorker.controller.scriptURL, 79 normalizeURL(newWorkerURL), 80 'the new worker should control a new document' 81 ); 73 82 }, 'Registering a new script URL while an unregistered registration is in use'); 74 83 75 async_test(function(t) {76 varscope = 'resources/scope/unregister-then-register-new-script-that-404s';77 var iframe;78 var registration;84 promise_test(async function(t) { 85 const scope = 'resources/scope/unregister-then-register-new-script-that-404s'; 86 const registration = await service_worker_unregister_and_register(t, worker_url, scope); 87 t.add_cleanup(() => registration.unregister()); 79 88 80 service_worker_unregister_and_register(t, worker_url, scope) 81 .then(function(r) { 82 registration = r; 83 return wait_for_state(t, r.installing, 'activated'); 84 }) 85 .then(function() { 86 return with_iframe(scope); 87 }) 88 .then(function(frame) { 89 iframe = frame; 90 return registration.unregister(); 91 }) 92 .then(function() { 93 // Step 5.1 of Register clears the uninstall flag before fetching 94 // the script: 95 // 96 // https://w3c.github.io/ServiceWorker/#register-algorithm 97 var promise = navigator.serviceWorker.register('this-will-404', 98 { scope: scope }); 99 return promise; 100 }) 101 .then( 102 function() { 103 assert_unreached('register should reject the promise'); 104 }, 105 function() { 106 assert_equals(registration.installing, null, 107 'registration.installing'); 108 assert_equals(registration.waiting, null, 109 'registration.waiting'); 110 assert_equals(registration.active.scriptURL, normalizeURL(worker_url), 111 'registration.active'); 112 iframe.remove(); 113 return with_iframe(scope); 114 }) 115 .then(function(frame) { 116 assert_equals( 117 frame.contentWindow.navigator.serviceWorker.controller.scriptURL, 118 normalizeURL(worker_url), 119 'the original worker should control a new document'); 120 frame.remove(); 121 return registration.unregister(); 122 }) 123 .then(function() { 124 t.done(); 125 }) 126 .catch(unreached_rejection(t)); 127 }, 'Registering a new script URL that 404s does resurrect an ' + 128 'unregistered registration'); 89 await wait_for_state(t, registration.installing, 'activated'); 129 90 130 async_test(function(t) { 131 var scope = 'resources/scope/unregister-then-register-reject-install-worker'; 132 var iframe; 133 var registration; 91 const iframe = await with_iframe(scope); 92 t.add_cleanup(() => iframe.remove()); 134 93 135 service_worker_unregister_and_register(t, worker_url, scope) 136 .then(function(r) { 137 registration = r; 138 return wait_for_state(t, r.installing, 'activated'); 139 }) 140 .then(function() { 141 return with_iframe(scope); 142 }) 143 .then(function(frame) { 144 iframe = frame; 145 return registration.unregister(); 146 }) 147 .then(function() { 148 // Step 5.1 of Register clears the uninstall flag before firing 149 // the install event: 150 // 151 // https://w3c.github.io/ServiceWorker/#register-algorithm 152 var promise = navigator.serviceWorker.register( 153 'resources/reject-install-worker.js', { scope: scope }); 154 return promise; 155 }) 156 .then(function(r) { 157 registration = r; 158 return wait_for_state(t, r.installing, 'redundant'); 159 }) 160 .then(function() { 161 assert_equals(registration.installing, null, 162 'registration.installing'); 163 assert_equals(registration.waiting, null, 164 'registration.waiting'); 165 assert_equals(registration.active.scriptURL, normalizeURL(worker_url), 166 'registration.active'); 167 iframe.remove(); 168 return with_iframe(scope); 169 }) 170 .then(function(frame) { 171 assert_equals( 172 frame.contentWindow.navigator.serviceWorker.controller.scriptURL, 173 normalizeURL(worker_url), 174 'the original worker should control a new document'); 175 frame.remove(); 176 return registration.unregister(); 177 }) 178 .then(function() { 179 t.done(); 180 }) 181 .catch(unreached_rejection(t)); 182 }, 'Registering a new script URL that fails to install does resurrect ' + 183 'an unregistered registration'); 94 await registration.unregister(); 95 96 await promise_rejects( 97 t, new TypeError(), 98 navigator.serviceWorker.register('this-will-404', { scope }) 99 ); 100 101 assert_equals(registration.installing, null, 'registration.installing'); 102 assert_equals(registration.waiting, null, 'registration.waiting'); 103 assert_equals(registration.active.scriptURL, normalizeURL(worker_url), 'registration.active'); 104 105 const newIframe = await with_iframe(scope); 106 t.add_cleanup(() => newIframe.remove()); 107 108 assert_equals(newIframe.contentWindow.navigator.serviceWorker.controller, null, 'Document should not be controlled'); 109 }, 'Registering a new script URL that 404s does not resurrect unregistered registration'); 110 111 promise_test(async function(t) { 112 const scope = 'resources/scope/unregister-then-register-reject-install-worker'; 113 const registration = await service_worker_unregister_and_register(t, worker_url, scope); 114 t.add_cleanup(() => registration.unregister()); 115 116 await wait_for_state(t, registration.installing, 'activated'); 117 118 const iframe = await with_iframe(scope); 119 t.add_cleanup(() => iframe.remove()); 120 121 await registration.unregister(); 122 123 const newRegistration = await navigator.serviceWorker.register( 124 'resources/reject-install-worker.js', { scope } 125 ); 126 t.add_cleanup(() => newRegistration.unregister()); 127 128 await wait_for_state(t, newRegistration.installing, 'redundant'); 129 130 assert_equals(registration.installing, null, 'registration.installing'); 131 assert_equals(registration.waiting, null, 'registration.waiting'); 132 assert_equals(registration.active, null, 'registration.active'); 133 assert_not_equals(registration, newRegistration, 'New registration is different'); 134 }, 'Registering a new script URL that fails to install does not resurrect unregistered registration'); 184 135 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register.https-expected.txt
r224947 r246363 1 2 1 3 2 PASS Unregister then register resolves to a new value 4 PASS Unregister then register resolves to the original value if the registration is in use. 5 PASS Reloading the last controlled iframe after unregistration should ensure the deletion of the registration 3 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]" 6 4 PASS Unregister then register does not affect existing controllee 7 PASS Unregister then register resurrects the registration 5 FAIL Unregister then register does not resurrect the registration assert_equals: Registration is new expected null but got object "[object ServiceWorker]" 8 6 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register.https.html
r238592 r246363 6 6 var worker_url = 'resources/empty-worker.js'; 7 7 8 promise_test(function(t) { 9 var scope = 'resources/scope/re-register-resolves-to-new-value'; 10 var registration; 8 promise_test(async function(t) { 9 const scope = 'resources/scope/re-register-resolves-to-new-value'; 10 const registration = await service_worker_unregister_and_register(t, worker_url, scope); 11 t.add_cleanup(() => registration.unregister()); 11 12 12 return service_worker_unregister_and_register(t, worker_url, scope) 13 .then(function(r) { 14 t.add_cleanup(function() { 15 return service_worker_unregister(t, scope); 16 }); 13 await wait_for_state(t, registration.installing, 'activated'); 14 await registration.unregister(); 15 const newRegistration = await navigator.serviceWorker.register(worker_url, { scope }); 16 t.add_cleanup(() => newRegistration.unregister()); 17 17 18 registration = r; 19 return wait_for_state(t, r.installing, 'activated'); 20 }) 21 .then(function() { 22 return registration.unregister(); 23 }) 24 .then(function() { 25 return navigator.serviceWorker.register(worker_url, { scope: scope }); 26 }) 27 .then(function(new_registration) { 28 assert_not_equals(registration, new_registration, 29 'register should resolve to a new value'); 30 }); 18 assert_not_equals( 19 registration, newRegistration, 20 'register should resolve to a new value' 21 ); 31 22 }, 'Unregister then register resolves to a new value'); 32 23 33 promise_test(function(t) { 34 var scope = 'resources/scope/re-register-while-old-registration-in-use'; 35 var registration; 24 promise_test(async function(t) { 25 const scope = 'resources/scope/re-register-while-old-registration-in-use'; 26 const registration = await service_worker_unregister_and_register(t, worker_url, scope); 27 t.add_cleanup(() => registration.unregister()); 36 28 37 return service_worker_unregister_and_register(t, worker_url, scope) 38 .then(function(r) { 39 t.add_cleanup(function() { 40 return service_worker_unregister(t, scope); 41 }); 29 await wait_for_state(t, registration.installing, 'activated'); 30 const frame = await with_iframe(scope); 31 t.add_cleanup(() => frame.remove()); 42 32 43 registration = r; 44 return wait_for_state(t, r.installing, 'activated'); 45 }) 46 .then(function() { 47 return with_iframe(scope); 48 }) 49 .then(function(frame) { 50 return registration.unregister(); 51 }) 52 .then(function() { 53 return navigator.serviceWorker.register(worker_url, { scope: scope }); 54 }) 55 .then(function(new_registration) { 56 assert_equals(registration, new_registration, 57 'new registration should resolve to the same registration'); 58 }); 59 }, 'Unregister then register resolves to the original value if the ' + 60 'registration is in use.'); 33 await registration.unregister(); 34 const newRegistration = await navigator.serviceWorker.register(worker_url, { scope }); 35 t.add_cleanup(() => newRegistration.unregister()); 61 36 62 promise_test(function(t) { 63 var scope = 'resources/scope/complete-unregistration-followed-by-' + 64 'reloading-controllee-iframe'; 65 var registration; 66 var frame; 67 var service_worker; 68 return service_worker_unregister_and_register(t, worker_url, scope) 69 .then(function(r) { 70 t.add_cleanup(function() { 71 return service_worker_unregister(t, scope); 72 }); 73 74 registration = r; 75 return wait_for_state(t, r.installing, 'activated'); 76 }) 77 .then(function() { 78 return with_iframe(scope); 79 }) 80 .then(function(f) { 81 frame = f; 82 return registration.unregister(); 83 }) 84 .then(function() { 85 return new Promise(function(resolve) { 86 frame.onload = resolve; 87 frame.contentWindow.location.reload(); 88 }); 89 }) 90 .then(function() { 91 var c = frame.contentWindow.navigator.serviceWorker.controller; 92 assert_equals(c, null, 'a page after unregistration should not be ' + 93 'controlled by service worker'); 94 return navigator.serviceWorker.getRegistration(scope); 95 }) 96 .then(function(r) { 97 assert_equals(r, undefined, 'getRegistration should return ' + 98 'undefined after unregistration'); 99 }); 100 }, 'Reloading the last controlled iframe after unregistration should ensure ' + 101 'the deletion of the registration'); 37 assert_not_equals( 38 registration, newRegistration, 39 'Unregister and register should always create a new registration' 40 ); 41 }, 'Unregister then register does not resolve to the original value even if the registration is in use.'); 102 42 103 43 promise_test(function(t) { … … 110 50 .then(function(r) { 111 51 t.add_cleanup(function() { 112 113 52 return service_worker_unregister(t, scope); 53 }); 114 54 115 55 registration = r; … … 139 79 }, 'Unregister then register does not affect existing controllee'); 140 80 141 promise_test(function(t) { 142 var scope = 'resources/scope/resurrection'; 143 var iframe; 144 var registration; 81 promise_test(async function(t) { 82 const scope = 'resources/scope/resurrection'; 83 const altWorkerURL = worker_url + '?alt'; 84 const registration = await service_worker_unregister_and_register(t, worker_url, scope); 85 t.add_cleanup(() => registration.unregister()); 145 86 146 return service_worker_unregister_and_register(t, worker_url, scope) 147 .then(function(r) { 148 t.add_cleanup(function() { 149 return service_worker_unregister(t, scope); 150 }); 87 await wait_for_state(t, registration.installing, 'activating'); 88 const iframe = await with_iframe(scope); 89 t.add_cleanup(() => iframe.remove()); 151 90 152 registration = r; 153 return wait_for_state(t, r.installing, 'activated'); 154 }) 155 .then(function() { 156 return with_iframe(scope); 157 }) 158 .then(function(frame) { 159 iframe = frame; 160 return registration.unregister(); 161 }) 162 .then(function() { 163 return navigator.serviceWorker.register(worker_url, { scope: scope }); 164 }) 165 .then(function() { 166 iframe.remove(); 167 return with_iframe(scope); 168 }) 169 .then(function(frame) { 170 assert_not_equals( 171 frame.contentWindow.navigator.serviceWorker.controller, null, 172 'document should have a controller'); 173 frame.remove(); 174 }); 175 }, 'Unregister then register resurrects the registration'); 91 await registration.unregister(); 92 const newRegistration = await navigator.serviceWorker.register(altWorkerURL, { scope }); 93 t.add_cleanup(() => newRegistration.unregister()); 94 95 assert_equals(newRegistration.active, null, 'Registration is new'); 96 97 await wait_for_state(t, newRegistration.installing, 'activating'); 98 99 const newIframe = await with_iframe(scope); 100 t.add_cleanup(() => newIframe.remove()); 101 102 const iframeController = iframe.contentWindow.navigator.serviceWorker.controller; 103 const newIframeController = newIframe.contentWindow.navigator.serviceWorker.controller; 104 105 assert_not_equals(iframeController, newIframeController, 'iframes have different controllers'); 106 }, 'Unregister then register does not resurrect the registration'); 176 107 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-redirect.https.html
r238592 r246363 2 2 <meta charset="utf-8"> 3 3 <title>Service Worker: Update should be triggered after redirects during navigation</title> 4 <meta name="timeout" content="long"> 4 5 <script src="/resources/testharness.js"></script> 5 6 <script src="/resources/testharnessreport.js"></script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-after-oneday.https.html
r223273 r246363 18 18 return service_worker_unregister_and_register(t, expected_url, scope) 19 19 .then(function(r) { 20 t.add_cleanup(function() { 21 return service_worker_unregister(t, scope); 22 }); 23 20 24 registration = r; 21 25 return wait_for_state(t, registration.installing, 'activated'); … … 42 46 .then(function() { 43 47 frame.remove(); 44 return service_worker_unregister_and_done(t, scope);45 48 }) 46 49 }, 'Update should be triggered after a functional event when last update time is over 24 hours'); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-bytecheck.https.html
r228255 r246363 2 2 <meta charset=utf-8> 3 3 <title></title> 4 <meta name="timeout" content="long"> 4 5 <script src="/resources/testharness.js"></script> 5 6 <script src="resources/testharness-helpers.js"></script> … … 44 45 // Register a service worker. 45 46 .then(_ => service_worker_unregister_and_register(t, script, scope)) 46 .then(r => swr = r) 47 .then(_ => wait_for_update(t, swr)) 47 .then(r => { 48 t.add_cleanup(() => service_worker_unregister(t, scope)); 49 swr = r; 50 return wait_for_update(t, swr); 51 }) 48 52 .then(w => sw = w) 49 53 .then(_ => wait_for_state(t, sw, 'activated')) … … 65 69 swr.installing], 66 70 [sw, null, null]); 67 }) 68 69 // Unregister the service worker. 70 .then(_ => service_worker_unregister_and_done(t, scope)); 71 }); 71 72 }, `Test(cors: ${s.cors}, main: ${s.main}, imported: ${s.imported})`)); 72 73 }, Promise.resolve()); -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-not-allowed.https.html
r238592 r246363 6 6 'use strict'; 7 7 8 function send_message_to_worker_and_wait_for_response(worker, message) { 9 return new Promise(resolve => { 10 // Use a dedicated channel for every request to avoid race conditions on 11 // concurrent requests. 12 const channel = new MessageChannel(); 13 worker.postMessage(channel.port1, [channel.port1]); 14 15 let messageReceived = false; 16 channel.port2.onmessage = event => { 17 assert_false(messageReceived, 'Already received response for ' + message); 18 messageReceived = true; 19 resolve(event.data); 20 }; 21 channel.port2.postMessage(message); 22 }); 23 } 24 25 async function ensure_install_event_fired(worker) { 26 const response = await send_message_to_worker_and_wait_for_response(worker, 'awaitInstallEvent'); 27 assert_equals('installEventFired', response); 28 assert_equals('installing', worker.state, 'Expected worker to be installing.'); 29 } 30 31 async function finish_install(worker) { 32 await ensure_install_event_fired(worker); 33 const response = await send_message_to_worker_and_wait_for_response(worker, 'finishInstall'); 34 assert_equals('installFinished', response); 35 } 36 37 async function activate_service_worker(t, worker) { 38 await finish_install(worker); 39 // By waiting for both states at the same time, the test fails 40 // quickly if the installation fails, avoiding a timeout. 41 await Promise.race([wait_for_state(t, worker, 'activated'), 42 wait_for_state(t, worker, 'redundant')]); 43 assert_equals('activated', worker.state, 'Service worker should be activated.'); 44 } 45 46 async function update_within_service_worker(worker) { 47 // This function returns a Promise that resolves when update() 48 // has been called but is not necessarily finished yet. 49 // Call finish() on the returned object to wait for update() settle. 50 const port = await send_message_to_worker_and_wait_for_response(worker, 'callUpdate'); 51 let messageReceived = false; 52 return { 53 finish: () => { 54 return new Promise(resolve => { 55 port.onmessage = event => { 56 assert_false(messageReceived, 'Update already finished.'); 57 messageReceived = true; 58 resolve(event.data); 59 }; 60 }); 61 }, 62 }; 63 } 64 65 async function update_from_client_and_await_installing_version(test, registration) { 66 const updatefound = wait_for_update(test, registration); 67 registration.update(); 68 await updatefound; 69 return registration.installing; 70 } 71 8 72 async function spin_up_service_worker(test) { 9 const script = 'resources/update-during-installation-worker.js';10 73 const script = 'resources/update-during-installation-worker.py'; 74 const scope = 'resources/blank.html'; 11 75 12 let registration = await service_worker_unregister_and_register(test, script, scope); 13 test.add_cleanup(() => { 14 if (registration.installing) { 15 registration.installing.postMessage('finishInstall'); 16 } 17 registration.unregister(); 18 }); 76 const registration = await service_worker_unregister_and_register(test, script, scope); 77 test.add_cleanup(async () => { 78 if (registration.installing) { 79 // If there is an installing worker, we need to finish installing it. 80 // Otherwise, the tests fails with an timeout because unregister() blocks 81 // until the install-event-handler finishes. 82 const worker = registration.installing; 83 await send_message_to_worker_and_wait_for_response(worker, 'awaitInstallEvent'); 84 await send_message_to_worker_and_wait_for_response(worker, 'finishInstall'); 85 } 86 return registration.unregister(); 87 }); 19 88 20 89 return registration; 21 90 } 22 91 23 92 promise_test(async t => { 24 const registration = await spin_up_service_worker(t); 25 const worker = registration.installing; 93 const registration = await spin_up_service_worker(t); 94 const worker = registration.installing; 95 await ensure_install_event_fired(worker); 26 96 27 // spin_up_service_worker installs a cleanup hook that ensures the 28 // worker finished its installation by sending it a 29 // 'finishInstall' message, thus making sure that the registration 30 // will be cleanly removed at the end of the test. 31 assert_equals(worker.state, 'installing'); 32 promise_rejects(t, 'InvalidStateError', registration.update()); 33 }, 'ServiceWorkerRegistration.update() from client throws while installing service worker.') 97 const result = registration.update(); 98 await activate_service_worker(t, worker); 99 return result; 100 }, 'ServiceWorkerRegistration.update() from client succeeds while installing service worker.'); 34 101 35 102 promise_test(async t => { 36 37 38 worker.postMessage('finishInstall');103 const registration = await spin_up_service_worker(t); 104 const worker = registration.installing; 105 await ensure_install_event_fired(worker); 39 106 40 // By waiting for both states at the same time, the test fails 41 // quickly if the installation fails, avoiding a timeout. 42 await Promise.race([wait_for_state(t, worker, 'activated'), 43 wait_for_state(t, worker, 'redundant')]); 44 assert_equals(worker.state, 'activated', 'Service worker should be activated.'); 107 // Add event listener to fail the test if update() succeeds. 108 const updatefound = t.step_func(async () => { 109 registration.removeEventListener('updatefound', updatefound); 110 // Activate new worker so non-compliant browsers don't fail with timeout. 111 await activate_service_worker(t, registration.installing); 112 assert_unreached("update() should have failed"); 113 }); 114 registration.addEventListener('updatefound', updatefound); 45 115 46 const response = await new Promise(resolve => {47 navigator.serviceWorker.onmessage = event => { resolve(event.data); };48 worker.postMessage('PING');49 });116 const update = await update_within_service_worker(worker); 117 // Activate worker to ensure update() finishes and the test doesn't timeout 118 // in non-compliant browsers. 119 await activate_service_worker(t, worker); 50 120 51 // We check that the service worker instance that replied to the 52 // message is the same one that received the 'install' event since 53 // it's possible for them to be two distinct execution 54 // environments. 55 assert_true(response.installEventFired, 'Service worker should have been installed.'); 56 assert_equals(response.exception, 'InvalidStateError', 'update() should have thrown.'); 121 const response = await update.finish(); 122 assert_false(response.success, 'update() should have failed.'); 123 assert_equals('InvalidStateError', response.exception, 'update() should have thrown InvalidStateError.'); 57 124 }, 'ServiceWorkerRegistration.update() from installing service worker throws.'); 125 126 promise_test(async t => { 127 const registration = await spin_up_service_worker(t); 128 const worker1 = registration.installing; 129 await activate_service_worker(t, worker1); 130 131 const worker2 = await update_from_client_and_await_installing_version(t, registration); 132 await ensure_install_event_fired(worker2); 133 134 const update = await update_within_service_worker(worker1); 135 // Activate the new version so that update() finishes and the test doesn't timeout. 136 await activate_service_worker(t, worker2); 137 const response = await update.finish(); 138 assert_true(response.success, 'update() from active service worker should have succeeded.'); 139 }, 'ServiceWorkerRegistration.update() from active service worker succeeds while installing service worker.'); 58 140 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https-expected.txt
r238592 r246363 1 1 2 FAIL Update the registration with a different script type (classic => module). promise_test: Unhandled rejection with value: object " ReferenceError: Can't find variable: guid"3 FAIL Update the registration with a different script type (module => classic). promise_test: Unhandled rejection with value: object " ReferenceError: Can't find variable: guid"2 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')" 3 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." 4 4 PASS Update the registration with a different script type (classic => module) and with a same main script. 5 5 PASS Update the registration with a different script type (module => classic) and with a same main script. -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https.html
r238592 r246363 3 3 <title>Service Worker: Update the registration with a different script type.</title> 4 4 <!-- common.js is for guid() --> 5 <script src="/ mixed-content/generic/common.js"></script>5 <script src="/common/security-features/resources/common.js"></script> 6 6 <script src="/resources/testharness.js"></script> 7 7 <script src="/resources/testharnessreport.js"></script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/w3c-import.log
r238592 r246363 23 23 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/appcache-ordering-main.https.html 24 24 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-affect-other-registration.https.html 25 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch-with-appcache.https.html 25 26 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch.https.html 26 27 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-not-using-registration.https.html … … 33 34 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-client-types.https.html 34 35 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-cross-origin.https.html 36 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-resultingClientId.https.html 35 37 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get.https.html 36 38 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https.html … … 44 46 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controller-on-reload.https.html 45 47 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controller-with-no-fetch-event-handler.https.html 48 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/data-transfer-files.https.html 46 49 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/dedicated-worker-service-worker-interception.https.html 47 50 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/detached-context.https.html … … 148 151 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-iframe.https.html 149 152 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-mime-types.https.html 153 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-schedule-job.https.html 150 154 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-scope.https.html 151 155 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-script-url.https.html … … 157 161 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/request-end-to-end.https.html 158 162 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing-cross-origin.https.html 159 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing. https.html163 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.sub.https.html 160 164 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/respond-with-body-accessed-response.https.html 161 165 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html … … 187 191 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-bytecheck.https.html 188 192 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-missing-import-scripts.https.html 193 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-no-cache-request-headers.https.html 189 194 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-not-allowed.https.html 195 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-on-navigation.https.html 190 196 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-recovery.https.html 191 197 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https.html … … 201 207 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception-redirect.https.html 202 208 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception.https.html 209 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xhr-response-url.https.html 210 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/xsl-base-url.https.html -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/websocket.https-expected.txt
r224218 r246363 3 3 4 4 5 FAIL Verify WebSocket handshake channel does not get intercepted assert_unreached: unexpected rejection: [object Event] Reached unreachable code5 FAIL Verify WebSocket handshake channel does not get intercepted promise_test: Unhandled rejection with value: object "[object Event]" 6 6 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/windowclient-navigate.https.html
r238592 r246363 110 110 } 111 111 112 var cleanup =function() {112 test.add_cleanup(function() { 113 113 if (client_frame && client_frame) { 114 114 client_frame.remove(); … … 128 128 return registration.unregister(); 129 129 } 130 } ;130 }); 131 131 132 var test_body =with_iframe(parameters.src_url)132 return with_iframe(parameters.src_url) 133 133 .then(function(frame) { 134 134 client_frame = frame; … … 162 162 assert_equals(response.data, parameters.expected); 163 163 }); 164 165 // Ensure that test "clean up" is deferred until after the test body166 // executes. `Test#add_cleanup` cannot be used for this purpose because the167 // operation is asynchronous, and `add_cleanup` does not support168 // asynchronous operations at the time of this writing. See169 // https://github.com/web-platform-tests/wpt/issues/6075170 // Ensure also that test failure is not hidden by successful cleanup171 // operation.172 return test_body173 .then(cleanup, cleanup)174 .then(function() { return test_body; });175 164 }, parameters.description); 176 165 } -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception.https-expected.txt
r238592 r246363 1 1 CONSOLE MESSAGE: line 1: ReferenceError: Can't find variable: Worker 2 2 3 3 FAIL Verify worker script from uncontrolled document is intercepted by Service Worker promise_test: Unhandled rejection with value: undefined … … 5 5 PASS Verify worker script intercepted by cors response fails 6 6 PASS Verify worker script intercepted by no-cors cross-origin response fails 7 PASS Verify worker loads from controlled document are intercepted by Service Worker 7 FAIL Verify worker loads from controlled document are intercepted by Service Worker assert_equals: expected "finish" but got "failure:[object ErrorEvent]" 8 8 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-interception.https.html
r238592 r246363 13 13 return service_worker_unregister_and_register(t, service_worker, scope) 14 14 .then(function(r) { 15 t.add_cleanup(function() { 16 return service_worker_unregister(t, scope); 17 }); 18 15 19 return wait_for_state(t, r.installing, 'activated'); 16 20 }) … … 29 33 .then(function(data) { 30 34 assert_equals(data, 'worker loading intercepted by service worker'); 31 service_worker_unregister_and_done(t, scope);32 35 }); 33 36 }, 'Verify worker script from uncontrolled document is intercepted by Service Worker'); … … 40 43 return service_worker_unregister_and_register(t, service_worker, scope) 41 44 .then(function(r) { 45 t.add_cleanup(function() { 46 return service_worker_unregister(t, scope); 47 }); 48 42 49 return wait_for_state(t, r.installing, 'activated'); 43 50 }) … … 56 63 .then(function(data) { 57 64 assert_equals(data, 'dummy-worker-script loaded'); 58 service_worker_unregister_and_done(t, scope);59 65 }); 60 66 }, 'Verify worker script intercepted by same-origin response succeeds'); … … 73 79 var watcher = new EventWatcher(t, w, ['message', 'error']); 74 80 return watcher.wait_for('error'); 75 }) 76 .then(function() { 77 service_worker_unregister_and_done(t, scope); 78 }); 81 }); 79 82 }, 'Verify worker script intercepted by cors response fails'); 80 83 … … 86 89 return service_worker_unregister_and_register(t, service_worker, scope) 87 90 .then(function(r) { 91 t.add_cleanup(function() { 92 return service_worker_unregister(t, scope); 93 }); 94 88 95 return wait_for_state(t, r.installing, 'activated'); 89 96 }) … … 92 99 var watcher = new EventWatcher(t, w, ['message', 'error']); 93 100 return watcher.wait_for('error'); 94 }) 95 .then(function() { 96 service_worker_unregister_and_done(t, scope); 97 }); 101 }); 98 102 }, 'Verify worker script intercepted by no-cors cross-origin response fails'); 99 103 … … 103 107 var scope = 'resources/'; 104 108 105 window.addEventListener('message', t.step_func(on_message), false);106 function on_message(e) {107 assert_equals(e.data.results, "This load was successfully intercepted.");108 t.done();109 }110 111 109 return service_worker_unregister_and_register(t, service_worker, scope) 112 110 .then(function(r) { 111 t.add_cleanup(function() { 112 return service_worker_unregister(t, scope); 113 }); 114 113 115 return wait_for_state(t, r.installing, 'activated'); 114 116 }) … … 127 129 .then(function(data) { 128 130 assert_equals(data.results, 'finish'); 129 service_worker_unregister_and_done(t, scope);130 131 }); 131 132 }, 'Verify worker loads from controlled document are intercepted by Service Worker'); -
trunk/LayoutTests/tests-options.json
r246330 r246363 1701 1701 "slow" 1702 1702 ], 1703 "imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https.html": [ 1704 "slow" 1705 ], 1706 "imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video-cache.https.html": [ 1707 "slow" 1708 ], 1709 "imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-video.https.html": [ 1710 "slow" 1711 ], 1703 1712 "imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-redirect.https.html": [ 1704 1713 "slow" 1705 1714 ], 1715 "imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html": [ 1716 "slow" 1717 ], 1706 1718 "imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https.html": [ 1707 1719 "slow" … … 1725 1737 "slow" 1726 1738 ], 1739 "imported/w3c/web-platform-tests/service-workers/service-worker/interfaces-window.https.html": [ 1740 "slow" 1741 ], 1727 1742 "imported/w3c/web-platform-tests/service-workers/service-worker/local-url-inherit-controller.https.html": [ 1728 1743 "slow" … … 1734 1749 "slow" 1735 1750 ], 1751 "imported/w3c/web-platform-tests/service-workers/service-worker/registration-mime-types.https.html": [ 1752 "slow" 1753 ], 1736 1754 "imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https.html": [ 1737 1755 "slow" 1738 1756 ], 1757 "imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-using-registration.https.html": [ 1758 "slow" 1759 ], 1760 "imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-without-using-registration.https.html": [ 1761 "slow" 1762 ], 1739 1763 "imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-fetch-event.https.html": [ 1764 "slow" 1765 ], 1766 "imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-redirect.https.html": [ 1767 "slow" 1768 ], 1769 "imported/w3c/web-platform-tests/service-workers/service-worker/update-bytecheck.https.html": [ 1740 1770 "slow" 1741 1771 ],
Note: See TracChangeset
for help on using the changeset viewer.