client-url-of-blob-url-worker.https.html (1204B)
1 <!DOCTYPE html> 2 <title>Service Worker: client.url of a worker created from a blob URL</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="resources/test-helpers.sub.js"></script> 6 <script> 7 8 const SCRIPT = 'resources/client-url-of-blob-url-worker.js'; 9 const SCOPE = 'resources/client-url-of-blob-url-worker.html'; 10 11 promise_test(async (t) => { 12 const reg = await service_worker_unregister_and_register(t, SCRIPT, SCOPE); 13 t.add_cleanup(_ => reg.unregister()); 14 await wait_for_state(t, reg.installing, 'activated'); 15 16 const frame = await with_iframe(SCOPE); 17 t.add_cleanup(_ => frame.remove()); 18 assert_not_equals(frame.contentWindow.navigator.serviceWorker.controller, 19 null, 'frame should be controlled'); 20 21 const response = await frame.contentWindow.createAndFetchFromBlobWorker(); 22 23 assert_not_equals(response.result, 'one worker client should exist', 24 'worker client should exist'); 25 assert_equals(response.result, response.expected, 26 'client.url and worker location href should be the same'); 27 28 }, 'Client.url of a blob URL worker should be a blob URL.'); 29 </script>