wpt / speculation-rules / invalid-rules.https.html?prefetch

Open test on wpt.live | wpt.fyi

Runs: Chrome 158.0.8110.0 (wpt@51af97519, 2026-10-17) | Firefox 160.0a1 (wpt@51af97519, 2026-10-17) | Safari 254 preview (wpt@d6658f1eb, 2026-10-17) | Ladybird 1.0-44fe0 (wpt@831ff48a8, 2026-10-18) | Servo Servo 0.7 (wpt@df642c414, 2026-10-17) | Blitz fb8d6c15e (wpt@cd1d8aa5b, 2026-10-17)

ChromeFirefoxSafariLadybirdServoBlitz
Total1/11/11/10/10/1NOT RUN
SubtestChromeFirefoxSafariLadybirdServoBlitz
an unrecognized key in a prefetch rule should prevent it from being preloadedPASSPASSPASS———

/speculation-rules/invalid-rules.https.html

<!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>