Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /speculation-rules/invalid-rules.https.html?prefetch - WPT Dashboard Interop Dashboard
- /speculation-rules/invalid-rules.https.html?prerender - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script src="/common/dispatcher/dispatcher.js"></script>
<script src="/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js"></script>
<script src="resources/utils.js"></script>
<meta name="variant" content="?prefetch">
<meta name="variant" content="?prerender">
<script>
setup(() => assertSpeculationRulesIsSupported());
const preloadingType = location.search.substring(1);
promise_test(async t => {
const rcHelper = new PreloadingRemoteContextHelper();
const referrerRC = await rcHelper.addWindow();
const destinationRC = await referrerRC.addPreload(preloadingType, {
extrasInSpeculationRule: { invalid_key: "value" }
});
await referrerRC.navigateTo(destinationRC.url);
const headers = await destinationRC.getRequestHeaders();
assert_false(headers.has("Sec-Purpose"));
}, `an unrecognized key in a ${preloadingType} rule should prevent it from being preloaded`);
</script>