commit 2cc27953b96f69d268fc31fab9a060feefd1d33b
parent 9fd16992d574b9769fa1aacb3e8ae1ae7dc0c457
Author: Sajid Anwar <sajidanwar94@gmail.com>
Date: Mon, 8 Dec 2025 18:08:55 +0000
Bug 2004191 - Update WebDriver navigation to retain URL on navigation-committed event. r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D275361
Diffstat:
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/remote/shared/Navigate.sys.mjs b/remote/shared/Navigate.sys.mjs
@@ -368,9 +368,10 @@ export class ProgressListener {
}
#onNavigationCommitted = (eventName, data) => {
- const { navigationId } = data;
+ const { navigationId, url } = data;
if (this.#resolveWhenCommitted && this.#navigationId === navigationId) {
+ this.#targetURI = Services.io.newURI(url);
this.#trace(
`Received "navigation-committed" event. Stopping the navigation.`
);
diff --git a/remote/shared/test/xpcshell/test_Navigate.js b/remote/shared/test/xpcshell/test_Navigate.js
@@ -30,6 +30,9 @@ const INITIAL_URI = Services.io.newURI("about:blank");
const TARGET_URI = Services.io.newURI("http://foo.cheese/");
const TARGET_URI_ERROR_PAGE = Services.io.newURI("doesnotexist://");
const TARGET_URI_WITH_HASH = Services.io.newURI("http://foo.cheese/#foo");
+const TARGET_URI_FROM_NAVIGATION_COMMITTED = Services.io.newURI(
+ "http://foo.cheese/#bar"
+);
function wait(time) {
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
@@ -694,20 +697,32 @@ add_task(async function test_ProgressListener_resolveWhenCommitted() {
// Emit an unexpected navigation-committed for the other navigation id.
mockNavigationManager.emit("navigation-committed", {
navigationId: navigationId2,
+ url: TARGET_URI_FROM_NAVIGATION_COMMITTED.spec,
});
ok(
!(await hasPromiseResolved(navigated)),
"Listener has not resolved after an unexpected navigation-committed"
);
+ notEqual(
+ progressListener.targetURI.spec,
+ TARGET_URI_FROM_NAVIGATION_COMMITTED.spec,
+ "Expected target URI has not been set from unexpected navigation-committed"
+ );
// Emit the expected navigation-committed event.
mockNavigationManager.emit("navigation-committed", {
navigationId: navigationId1,
+ url: TARGET_URI_FROM_NAVIGATION_COMMITTED.spec,
});
ok(
await hasPromiseResolved(navigated),
"Listener has resolved after receiving the correct navigation-committed"
);
+ equal(
+ progressListener.targetURI.spec,
+ TARGET_URI_FROM_NAVIGATION_COMMITTED.spec,
+ "Expected target URI has been set from navigation-committed"
+ );
});
add_task(
diff --git a/testing/web-platform/meta/webdriver/tests/bidi/browsing_context/navigate/navigate.py.ini b/testing/web-platform/meta/webdriver/tests/bidi/browsing_context/navigate/navigate.py.ini
@@ -2,9 +2,3 @@
[test_same_document_navigation_in_before_unload]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1906051
expected: FAIL
-
- [test_relative_url]
- expected:
- if (display == "x11") and debug and fission and (os == "android") and isolated_process: [FAIL, PASS]
- if (display == "x11") and debug and fission and (os == "android") and not isolated_process: FAIL
- if (display == "wayland") and not debug: [FAIL, PASS]