serviceworkerobject-scripturl.https.html (934B)
1 <!DOCTYPE html> 2 <title>ServiceWorker object: scriptURL property</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 'use strict'; 8 9 function url_test(name, url) { 10 const scope = 'resources/scope/' + name; 11 const expectedURL = normalizeURL(url); 12 13 promise_test(async t => { 14 const registration = 15 await service_worker_unregister_and_register(t, url, scope); 16 const worker = registration.installing; 17 assert_equals(worker.scriptURL, expectedURL, 'scriptURL'); 18 await registration.unregister(); 19 }, 'Verify the scriptURL property: ' + name); 20 } 21 22 url_test('relative', 'resources/empty-worker.js'); 23 url_test('with-fragment', 'resources/empty-worker.js#ref'); 24 url_test('with-query', 'resources/empty-worker.js?ref'); 25 url_test('absolute', normalizeURL('./resources/empty-worker.js')); 26 </script>