xsl-base-url.https.html (1193B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Service Worker: XSL's base URL must be the response URL</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="resources/test-helpers.sub.js?pipe=sub"></script> 7 <script> 8 // This test loads an XML document which is controlled a service worker. The 9 // document loads a stylesheet and a service worker responds with another URL. 10 // The stylesheet imports a relative URL to test that the base URL is the 11 // response URL from the service worker. 12 promise_test(async (t) => { 13 const SCOPE = 'resources/xsl-base-url-iframe.xml'; 14 const SCRIPT = 'resources/xsl-base-url-worker.js'; 15 let worker; 16 let frame; 17 18 t.add_cleanup(() => { 19 if (frame) 20 frame.remove(); 21 service_worker_unregister(t, SCOPE); 22 }); 23 24 const registration = await service_worker_unregister_and_register( 25 t, SCRIPT, SCOPE); 26 worker = registration.installing; 27 await wait_for_state(t, worker, 'activated'); 28 29 frame = await with_iframe(SCOPE); 30 assert_equals(frame.contentDocument.body.textContent, 'PASS'); 31 }, 'base URL when service worker does respondWith(fetch(responseUrl))'); 32 </script>