summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_cross_realm_method.html
blob: d8852b9f6f51e21e04af05fe493bea336d557ad9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!doctype html>
<meta charset="utf-8">
<title>history.go() uses this's associated document's browsing context to determine if navigation is allowed</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/history.html#dom-history-go">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<iframe id="sandboxedIframe" srcdoc="hello" sandbox="allow-scripts allow-same-origin"></iframe>
<script>
const t = async_test();

t.step(() => {
  history.pushState({}, null, "?prev=2");
  history.pushState({}, null, "?prev=1");
  history.pushState({}, null, "?current");

  sandboxedIframe.contentWindow.history.go.call(history, -2);
});

window.onpopstate = t.step_func_done(() => {
  assert_equals(location.search, "?prev=2");
});
</script>