2 <script src=
"/resources/testharness.js"></script>
3 <script src=
"/resources/testharnessreport.js"></script>
7 document
.domain
= "{{host}}";
9 const url
= new URL("resources/document-domain-setter.sub.html", location
.href
);
10 url
.hostname
= "{{domains[www1]}}";
11 const iframe
= document
.createElement("iframe");
12 iframe
.name
= "windowname";
14 document
.body
.append(iframe
);
17 const link
= document
.createElement("a");
19 link
.target
= iframe
.name
;
20 document
.body
.append(link
);
22 navigation
.onnavigate
= t
.unreached_func("onnavigate must not fire in the source window");
23 window
.onload
= t
.step_func(() => {
24 iframe
.contentWindow
.navigation
.onnavigate
= t
.step_func_done(e
=> {
25 assert_equals(e
.navigationType
, "push", "navigationType");
26 assert_true(e
.cancelable
, "cancelable");
27 assert_true(e
.canTransition
, "canTransition");
28 assert_false(e
.userInitiated
, "userInitiated");
29 assert_true(e
.hashChange
, "hashChange");
30 assert_equals(e
.formData
, null, "formData");
31 assert_equals(e
.destination
.url
, link
.href
, "destination.url");
32 assert_true(e
.destination
.sameDocument
, "destination.sameDocument");
33 assert_equals(e
.destination
.key
, null, "destination.key");
34 assert_equals(e
.destination
.id
, null, "destination.id");
35 assert_equals(e
.destination
.index
, -1, "destination.index");
40 }, "clicking on an <a> element that navigates same-document targeting a same-origin-domain (but cross-origin) window");