2 <title>Service Worker: FetchEvent for HTMLImports
</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-html-imports-iframe.html';
10 var SCRIPT
= 'resources/fetch-request-html-imports-worker.js';
11 var host_info
= get_host_info();
12 service_worker_unregister_and_register(t
, SCRIPT
, SCOPE
)
13 .then(function(registration
) {
14 return wait_for_state(t
, registration
.installing
, 'activated');
16 .then(function() { return with_iframe(SCOPE
); })
17 .then(function(frame
) {
18 var same
= frame
.contentWindow
.document
.getElementById("same").import;
19 var same_same
= same
.getElementById("same-same").import;
20 var same_other
= same
.getElementById("same-other").import;
22 frame
.contentWindow
.document
.getElementById("other").import;
23 var other_same
= other
.getElementById("other-same").import;
24 var other_other
= other
.getElementById("other-other").import;
28 'mode=cors credentials=include',
29 'The request mode and credentials for same origin HTMLImport ' +
30 'must be set correctly.');
32 same_same
.body
.innerText
,
33 'mode=cors credentials=include',
34 'The request mode and credentials for same origin HTMLImport ' +
35 'from same origin HTMLImports must be set correctly.');
37 same_other
.body
.innerText
,
38 'mode=cors credentials=omit',
39 'The request mode and credentials for other origin HTMLImport ' +
40 'from same origin HTMLImports must be set correctly.');
43 'mode=cors credentials=omit',
44 'The request mode and credentials for other origin HTMLImport ' +
45 'must be set correctly.');
47 other_same
.body
.innerText
,
48 'mode=cors credentials=include',
49 'The request mode and credentials for same origin HTMLImport ' +
50 'from other origin HTMLImports must be set correctly.');
52 other_other
.body
.innerText
,
53 'mode=cors credentials=omit',
54 'The request mode and credentials for other origin HTMLImport ' +
55 'from other origin HTMLImport must be set correctly.');
57 service_worker_unregister_and_done(t
, SCOPE
);
59 .catch(unreached_rejection(t
));
60 }, 'Verify the FetchEvent for HTMLImports');