testing/web-platform/tests/navigation-api/state/cross-document-location-api.html
author Florian Quèze <florian@queze.net>
Tue, 08 Jul 2025 20:48:53 +0000 (8 hours ago)
changeset 795809 b01190f141a12f4b506acb1f4476561c4b0f2407
parent 758545 eca5abbfcd42786d0c5d98e6d576505d0ff984d1
permissions -rw-r--r--
Bug 1960567 - remove the last C++ and scriptable APIs to accumulate data to legacy telemetry histograms, r=chutten. Differential Revision: https://phabricator.services.mozilla.com/D255582
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/helpers.js"></script>
<meta name="variant" content="?method=navigate">
<meta name="variant" content="?method=updateCurrentEntry">

<iframe id="i" src="/common/blank.html"></iframe>
<script>
async_test(t => {
  window.onload = t.step_func(() => {
    updateStateBasedOnTestVariant(i.contentWindow, { data : "value" });
    assert_equals(i.contentWindow.navigation.entries().length, 1);
    assert_equals(i.contentWindow.navigation.currentEntry.getState().data, "value");

    i.contentWindow.location.href = "?1";
    i.onload = t.step_func_done(() => {
      assert_equals(i.contentWindow.navigation.entries().length, 2);
      assert_equals(i.contentWindow.navigation.currentEntry.index, 1);
      assert_equals(i.contentWindow.navigation.currentEntry.getState(), undefined);
    });
  });
}, "entry.getState() behavior after cross-document location API navigation");
</script>