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"></script>
6 <script src=
"resources/test-helpers.js?pipe=sub"></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';
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');
20 return new Promise(function(resolve
) {
21 var channel
= new MessageChannel();
22 channel
.port1
.onmessage
= t
.step_func(function(msg
) {
27 var result
= msg
.data
;
28 var base
= get_host_info()['HTTP_ORIGIN'] + base_path();
31 base
+ 'resources/dummy.png',
32 'The base URL while loading the images referred from CSS ' +
33 'must be the request URL of CSS.');
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.');
40 service_worker_unregister_and_done(t
, SCOPE
);
43 {port
: channel
.port2
}, [channel
.port2
]);
46 .then(function() { return with_iframe(SCOPE
); })
50 .catch(unreached_rejection(t
));
51 }, 'CSS\'s base URL must be the request URL even when fetched from other URL.');