Bug 1757847 [wpt PR 33036] - Update wpt metadata, a=testonly
[gecko.git] / testing / web-platform / tests / app-history / navigate-event / cross-window / click-crossdocument-sameorigin.html
blob928d202045e3427afbd6462ce6cf4b3d58e6e244
1 <!doctype html>
2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
5 <a id="link" href="/common/blank.html?foo" target="windowname">Click me</a>
6 <iframe id="i" name="windowname" src="/common/blank.html"></iframe>
8 <script>
9 async_test(t => {
10 navigation.onnavigate = t.unreached_func("onnavigate must not fire in the source window");
11 window.onload = t.step_func(() => {
12 i.contentWindow.navigation.onnavigate = t.step_func_done(e => {
13 assert_equals(e.navigationType, "push", "navigationType");
14 assert_true(e.cancelable, "cancelable");
15 assert_true(e.canTransition, "canTransition");
16 assert_false(e.userInitiated, "userInitiated");
17 assert_false(e.hashChange, "hashChange");
18 assert_equals(e.formData, null, "formData");
19 assert_equals(e.destination.url, link.href, "destination.url");
20 assert_false(e.destination.sameDocument, "destination.sameDocument");
21 assert_equals(e.destination.key, null, "destination.key");
22 assert_equals(e.destination.id, null, "destination.id");
23 assert_equals(e.destination.index, -1, "destination.index");
24 });
26 link.click();
27 });
28 }, "clicking on an <a> element that navigates cross-document targeting a same-origin window");
29 </script>