Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<title>Fetch destination test for compression-dictionary</title>
<meta name="timeout" content="long"/>
<link rel="help" href="http://github.com/whatwg/html/pull/11620">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
<script>
let frame;

// Set up the service worker and the frame.
promise_test(t => {
const kScope = 'resources/empty.https.html';
const kScript = 'resources/fetch-options-worker.js';
return service_worker_unregister_and_register(t, kScript, kScope)
.then(registration => {
add_completion_callback(() => {
registration.unregister();
});

return wait_for_state(t, registration.installing, 'activated');
})
.then(() => {
return with_iframe(kScope);
})
.then(f => {
frame = f;
add_completion_callback(() => { f.remove(); });
});
}, 'Initialize global state');

promise_test(async t => {
await new Promise((resolve, reject) => {
let node = frame.contentWindow.document.createElement("link");
node.rel = "compression-dictionary";
node.onload = resolve;
node.onerror = reject;
node.href = "dummy?destination=compression-dictionary";
frame.contentWindow.document.body.appendChild(node);
}).catch(() => {
assert_unreached("Fetch errored.");
});
}, 'HTMLLinkElement with rel=compression-dictionary fetches with a "compression-dictionary" string Request.destination');

</script>
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ self.addEventListener('fetch', function(event) {
if (event.request.url.includes('dummy')) {
const params = new URL(event.request.url).searchParams;
const credentials = params.get("credentials");
const destination = params.get('destination');
const mode = params.get("mode");
const integrity = params.get('integrity');
const referrer = params.get('referrer');
const referrerPolicy = params.get('referrerPolicy');
if ((credentials === null || credentials == event.request.credentials) &&
(destination === null || destination == event.request.destination) &&
(mode === null || mode == event.request.mode) &&
(integrity === null || integrity == event.request.integrity) &&
(referrer === null || referrer == event.request.referrer) &&
Expand Down
Loading