2 <title>Service Worker: FetchEvent.request passed to onfetch
</title>
3 <script src=
"../resources/testharness.js"></script>
4 <script src=
"../resources/testharnessreport.js"></script>
5 <script src=
"resources/test-helpers.js"></script>
8 var url
= 'resources/request-end-to-end-worker.js';
9 var scope
= 'resources/blank.html';
10 return service_worker_unregister_and_register(t
, url
, scope
)
12 add_completion_callback(() => { r
.unregister(); });
13 return wait_for_state(t
, r
.installing
, 'activated');
15 .then(() => { return with_iframe(scope
); })
17 add_completion_callback(() => { frame
.remove(); });
19 var result
= JSON
.parse(frame
.contentDocument
.body
.textContent
);
20 assert_equals(result
.url
, frame
.src
, 'request.url');
21 assert_equals(result
.method
, 'GET', 'request.method');
22 assert_equals(result
.referrer
, location
.href
, 'request.referrer');
23 assert_equals(result
.mode
, 'same-origin', 'request.mode');
24 assert_equals(result
.credentials
, 'include', 'request.credentials');
25 assert_equals(result
.redirect
, 'manual', 'request.redirect');
26 assert_equals(result
.headers
['user-agent'], navigator
.userAgent
,
28 assert_equals(result
.append_header_error
, 'TypeError',
29 'Appending a new header to the request must throw a ' +
32 }, 'Test FetchEvent.request passed to onfetch');