OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <title>Service Worker: CSS's base URL must be the request URL even when fetched
from other URL</title> | |
3 <script src="../resources/testharness.js"></script> | |
4 <script src="../resources/testharnessreport.js"></script> | |
5 <script src="../resources/get-host-info.js?pipe=sub"></script> | |
6 <script src="resources/test-helpers.js"></script> | |
7 <script> | |
8 async_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 frame; | |
13 | |
14 return service_worker_unregister_and_register(t, SCRIPT, SCOPE) | |
15 .then(function(registration) { | |
16 worker = registration.installing; | |
17 return wait_for_state(t, worker, 'activated'); | |
18 }) | |
19 .then(function() { | |
20 return new Promise(function(resolve) { | |
21 var channel = new MessageChannel(); | |
22 channel.port1.onmessage = t.step_func(function(msg) { | |
23 if (msg.data.ready) { | |
24 resolve(); | |
25 return; | |
26 } | |
27 var result = msg.data; | |
28 var base = get_host_info()['HTTP_ORIGIN'] + base_path(); | |
29 assert_equals( | |
30 result.url, | |
31 base + 'resources/dummy.png', | |
32 'The base URL while loading the images referred from CSS ' + | |
33 'must be the request URL of CSS.'); | |
34 assert_equals( | |
35 result.referrer, | |
36 base + 'resources/fetch-request-css-base-url-style.css', | |
37 'While loading the image defined in CSS the referrer must ' + | |
38 'be the request URL of CSS.'); | |
39 service_worker_unregister_and_done(t, SCOPE); | |
40 }); | |
41 worker.postMessage( | |
42 {port: channel.port2}, [channel.port2]); | |
43 }); | |
44 }) | |
45 .then(function() { return with_iframe(SCOPE); }) | |
46 .then(function(f) { | |
47 frame = f; | |
48 }) | |
49 .catch(unreached_rejection(t)); | |
50 }, 'CSS\'s base URL must be the request URL even when fetched from other URL.'
); | |
51 </script> | |
OLD | NEW |