Skip to content

Commit

Permalink
Sync navigation-api from WPT
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=273815

Reviewed by Tim Nguyen.

Based on WPT SHA f409c99393.

* LayoutTests/imported/w3c/web-platform-tests/navigation-api/WEB_FEATURES.yml: Added.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/cross-origin-traversal-redirect.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/event-constructor.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-anchor-cross-origin.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-anchor-download-userInitiated.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-anchor-download.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-anchor-fragment-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-anchor-fragment.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-anchor-same-origin-cross-document.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-anchor-userInitiated-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-anchor-userInitiated.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-anchor-with-target.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-destination-getState-back-forward.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-destination-getState-navigate.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-destination-getState-reload.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-form-get.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-form-reload.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-form-traverse.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-form-userInitiated.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-form-with-target.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-form.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-history-back-after-fragment.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-history-back-after-pushState.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-history-back-bfcache.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-history-back-cross-document.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-history-go-0.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-history-pushState.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-history-replaceState.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-iframe-location.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-location.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-meta-refresh.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-navigation-back-cross-document.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-navigation-back-same-document-in-iframe.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-navigation-back-same-document.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-navigation-navigate.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-svg-anchor-fragment-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-svg-anchor-fragment.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-to-srcdoc.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-window-open-self.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/navigate-window-open.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/resources/cross-origin-redirect-on-second-visit.py: Added.
(redirect_response):
(ok_response):
(main):
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/resources/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/back-204-205-download.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/navigate-pagehide.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/navigate-unload.html.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/navigate-rejection-order-invalidurl-pagehide.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/navigate-rejection-order-invalidurl-unload.html.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/navigate-rejection-order-invalidurl-unload-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/navigate-rejection-order-pagehide-unserializablestate.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/navigate-rejection-order-unload-unserializablestate.html.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/navigate-rejection-order-unload-unserializablestate-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/navigate-unload-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/reload-pagehide.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/reload-unload.html.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/reload-rejection-order-pagehide-unserializablestate.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/reload-rejection-order-unload-unserializablestate.html.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/reload-rejection-order-unload-unserializablestate-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/reload-unload-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/return-value/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/ordering-and-transition/back-cross-document-event-order.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/ordering-and-transition/navigate-cross-document-event-order.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/ordering-and-transition/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/scroll-behavior/after-transition-intercept-handler-modifies.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-api/w3c-import.log:

Canonical link: https://commits.webkit.org/278449@main
  • Loading branch information
rwlbuis committed May 7, 2024
1 parent 6a2c5a3 commit b6ec312
Show file tree
Hide file tree
Showing 60 changed files with 232 additions and 91 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
features:
- name: navigation
files: "**"
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!doctype html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script>
promise_test(async t => {
let i = document.createElement("iframe");
i.src = "resources/cross-origin-redirect-on-second-visit.py?key=" + token();
document.body.appendChild(i);

// Wait for after the load event so that the navigation doesn't get converted
// into a replace navigation.
await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0));

let original_iframe_url = i.contentWindow.location.href;

// Do a cross-document push navigation in the iframe.
i.contentWindow.navigation.navigate("/common/blank.html");
await new Promise(resolve => i.onload = resolve);

// Go back. This will trigger a cross-origin redirect, but the navigate event
// should still fire, and the event url should be the pre-redirect url (which
// is same-origin).
history.back();
let navigate_event_url = await new Promise(resolve => i.contentWindow.navigation.onnavigate = e => {
resolve(e.destination.url);
});
await new Promise(resolve => i.onload = resolve);
assert_equals(navigate_event_url, original_iframe_url);
}, "A traversal that redirects from same-origin to cross-origin fires the navigate event");
</script>
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
assert_equals(event.downloadRequest, downloadRequest);
assert_equals(event.info, info);
assert_equals(event.hasUAVisualTransition, hasUAVisualTransition);
assert_equals(event.sourceElement, sourceElement);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(event.sourceElement, sourceElement);
});
history.pushState(2, null, "#2");
}, "all properties are reflected back");
Expand All @@ -98,7 +99,8 @@
assert_equals(event.formData, null);
assert_equals(event.downloadRequest, null);
assert_equals(event.info, undefined);
assert_equals(event.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(event.sourceElement, null);
});
history.pushState(3, null, "#3");
}, "defaults are as expected");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
assert_equals(e.destination.key, "");
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.sourceElement, document.getElementById("a"));
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, document.getElementById("a"));
e.preventDefault();
});
a.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
assert_equals(e.destination.key, "");
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.sourceElement, document.getElementById("a"));
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, document.getElementById("a"));
e.preventDefault();
t.step_timeout(t.step_func_done(() => assert_equals(location.hash, "")), 0);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
assert_equals(e.destination.key, "");
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.sourceElement, a);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, a);
e.preventDefault();
});
a.click();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

FAIL Fragment <a> click fires navigate event assert_equals: expected (object) Element node <a id="a" href="#1"></a> but got (undefined) undefined
PASS Fragment <a> click fires navigate event

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
assert_equals(e.destination.key, "");
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.sourceElement, document.getElementById("a"));
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, document.getElementById("a"));
e.preventDefault();
t.step_timeout(t.step_func_done(() => assert_equals(location.hash, "")), 0);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
assert_equals(e.destination.key, "");
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.sourceElement, document.getElementById("a"));
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, document.getElementById("a"));
e.preventDefault();
});
a.click();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Click me

FAIL Fragment <a> click fires navigate event assert_equals: expected (object) Element node <a id="a" href="#1">Click me</a> but got (undefined) undefined
PASS Fragment <a> click fires navigate event

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
assert_equals(e.destination.key, "");
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.sourceElement, document.getElementById("a"));
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, document.getElementById("a"));
e.preventDefault();
t.step_timeout(t.step_func_done(() => assert_equals(location.hash, "")), 0);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
assert_equals(new URL(e.destination.url).pathname,
"/navigation-api/navigate-event/foo.html");
assert_false(e.destination.sameDocument);
assert_equals(e.destination.key, "");
assert_equals(e.destination.id, "");
assert_equals(e.destination.key, "");
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
e.preventDefault();
});
a.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
assert_equals(e.destination.key, "");
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
});
navigation.back();
}), 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
assert_equals(e.destination.key, "");
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
});
navigation.navigate("#foo", { state: navState });
}, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
assert_equals(e.destination.key, "");
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
e.intercept();
});
navigation.updateCurrentEntry({ state: navState });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

// Because it's a GET, not a POST
assert_equals(e.formData, null);
assert_equals(e.sourceElement, form);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, form);
});
window.onload = t.step_func(() => form.submit());
}, "<form> submission with GET method fires navigate event but with formData null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
iframe.contentWindow.navigation.onnavigate = t.step_func(e => {
assert_equals(e.navigationType, "push");
assert_not_equals(e.formData, null);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);

iframe.onload = t.step_func(() => {
iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
iframe.contentWindow.navigation.onnavigate = t.step_func(e => {
assert_equals(e.navigationType, "push");
assert_not_equals(e.formData, null);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);

iframe.onload = t.step_func(() => {
// Avoid the replace behavior that occurs if you navigate during the load handler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_not_equals(e.formData, null);
assert_equals(e.sourceElement, submit);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, submit);
});
window.onload = t.step_func(() => test_driver.click(submit));
}, "<form> submission fires navigate event");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_not_equals(e.formData, null);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
});
form.submit();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_not_equals(e.formData, null);
assert_equals(e.sourceElement, form);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, form);
});
window.onload = t.step_func(() => form.submit());
}, "<form> submission fires navigate event");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
assert_equals(e.destination.id, target_id);
assert_equals(e.destination.index, start_index);
assert_equals(e.formData, null);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
});

history.back();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
assert_equals(e.destination.id, target_id);
assert_equals(e.destination.index, start_index);
assert_equals(e.formData, null);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
});

history.back();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!doctype html>
<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/back-forward-cache/resources/helper.sub.js"></script>

<script>
runBfcacheTest({
targetOrigin: originSameOrigin,
funcBeforeBackNavigation: () => {
window.did_navigate = false;
navigation.onnavigate = () => window.did_navigate = true;
},
async funcAfterAssertion(pageA, pageB) {
// When `funcAfterAssertion` is called, we've already navigated to pageB,
// then gone back to pageA with bfcache. Now go forward to pageB so we can
// observe whether the navigate event fired.
await pageA.execute_script(() => history.forward());
await pageB.execute_script(waitForPageShow);
assert_true(await pageB.execute_script(() => window.did_navigate));
}
}, "navigate event should fire when traversing to a bfcache hit");
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
assert_equals(e.destination.index, 0);
assert_equals(e.formData, null);
assert_equals(e.info, undefined);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
});
assert_true(i.contentWindow.navigation.canGoBack);
i.contentWindow.history.back();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.formData, null);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
e.preventDefault();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.formData, null);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
e.preventDefault();
t.step_timeout(t.step_func_done(() => {
assert_equals(location.hash, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.formData, null);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
e.preventDefault();
t.step_timeout(t.step_func_done(() => {
assert_equals(location.hash, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.formData, null);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
e.preventDefault();
t.step_timeout(t.step_func_done(() => assert_equals(location.hash, "")), 0);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.formData, null);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
});
location.href = "#1";
}, "location API fires navigate event");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.formData, null);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
e.preventDefault();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
assert_equals(e.destination.index, 0);
assert_equals(e.formData, null);
assert_equals(e.info, "hi");
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
});
i.contentWindow.onbeforeunload = () => beforeunload_called = true;
assert_true(i.contentWindow.navigation.canGoBack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
assert_equals(e.destination.index, 0);
assert_equals(e.formData, null);
assert_equals(e.info, "hi");
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
}
await i.contentWindow.navigation.back({ info: "hi" }).finished;
}, "navigate event for navigation.back() - same-document in an iframe");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
assert_equals(e.formData, null);
assert_equals(e.info, "hi");
assert_not_equals(e.hasUAVisualTransition, undefined);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
});
assert_true(navigation.canGoBack);
navigation.back({ info: "hi" });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
assert_equals(e.destination.id, "");
assert_equals(e.destination.index, -1);
assert_equals(e.formData, null);
assert_equals(e.sourceElement, null);
// NavigateEvent sourceElement is still in development, so test whether it is available.
if ("sourceElement" in e) assert_equals(e.sourceElement, null);
});
navigation.navigate("#foo");
}, "navigate event for navigation.navigate()");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

FAIL <svg:a> click fires navigate event assert_equals: expected (object) Element node <a id="a" href="#1"></a> but got (undefined) undefined
PASS <svg:a> click fires navigate event

Loading

0 comments on commit b6ec312

Please sign in to comment.