From 550de491c57895ebd654835cba75989ae1f91656 Mon Sep 17 00:00:00 2001 From: Andreas Farre Date: Thu, 9 Oct 2025 14:48:43 +0000 Subject: [PATCH 1/2] Make push to replace load conversion follow spec. Make sure that navigations from Location and Window.open perform correct conversion of history handling when passed "auto". Differential Revision: https://phabricator.services.mozilla.com/D266519 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1991265 gecko-commit: 7cfd0c1bdc6e5687d42d926893df693f9b8ef994 gecko-reviewers: smaug, webdriver-reviewers --- css/cssom-view/scroll-behavior-smooth-navigation.html | 6 +++++- .../scripted_form_submit_assign_during_load-1.html | 2 +- .../scripted_form_submit_assign_during_load-2.html | 2 +- .../scripted_form_submit_assign_during_load.html | 8 ++++++-- .../browsers/the-window-object/open-close/self-close.html | 2 +- .../navigate-event/navigate-navigation-navigate.html | 2 +- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/css/cssom-view/scroll-behavior-smooth-navigation.html b/css/cssom-view/scroll-behavior-smooth-navigation.html index 11f0d6a2d9e9d7..bc012385c0f1a7 100644 --- a/css/cssom-view/scroll-behavior-smooth-navigation.html +++ b/css/cssom-view/scroll-behavior-smooth-navigation.html @@ -70,7 +70,6 @@ }); location.hash = "foo"; }; - instant(); function smooth() { document.documentElement.className = ""; @@ -110,4 +109,9 @@ }; testContainer.style.display = "none"; + + // Setting location.hash while loading results in a replace load, which we don't want. + window.onload = () => { + step_timeout(instant, 0); + } diff --git a/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html b/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html index ae07ac5cfc2ee1..6ce794ddf61e33 100644 --- a/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html +++ b/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html @@ -1,6 +1,6 @@
diff --git a/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html b/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html index 1bf7f41e00f4be..6149e7e8f5cda7 100644 --- a/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html +++ b/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html @@ -2,6 +2,6 @@

This window should close itself and the test result appear in the original window diff --git a/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html b/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html index 2a6eba63abf533..17a4082afe4ac5 100644 --- a/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html +++ b/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html @@ -10,8 +10,12 @@ var win = window.open("scripted_form_submit_assign_during_load-1.html"); var history_length; -do_test = t.step_func(function(new_length) { - assert_equals(new_length, history_length); +test_initial_history_length = t.step_func(function(new_length) { + history_length = new_length; + assert_equals(history_length, 1, "Should have inital history"); +}); +test_assign_during_load = t.step_func(function(new_length) { + assert_equals(new_length, history_length, "Assigning to Location during load should replace"); t.done(); }); diff --git a/html/browsers/the-window-object/open-close/self-close.html b/html/browsers/the-window-object/open-close/self-close.html index d409e9f423d521..f7d194b2de0d02 100644 --- a/html/browsers/the-window-object/open-close/self-close.html +++ b/html/browsers/the-window-object/open-close/self-close.html @@ -2,7 +2,7 @@

self-close.html?navs=n&channel=name will navigate n times, then close and notify the channel.

diff --git a/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html b/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html index 6ce794ddf61e33..ae07ac5cfc2ee1 100644 --- a/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html +++ b/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html @@ -1,6 +1,6 @@ diff --git a/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html b/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html index 6149e7e8f5cda7..1bf7f41e00f4be 100644 --- a/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html +++ b/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html @@ -2,6 +2,6 @@

This window should close itself and the test result appear in the original window diff --git a/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html b/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html index 17a4082afe4ac5..2a6eba63abf533 100644 --- a/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html +++ b/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html @@ -10,12 +10,8 @@ var win = window.open("scripted_form_submit_assign_during_load-1.html"); var history_length; -test_initial_history_length = t.step_func(function(new_length) { - history_length = new_length; - assert_equals(history_length, 1, "Should have inital history"); -}); -test_assign_during_load = t.step_func(function(new_length) { - assert_equals(new_length, history_length, "Assigning to Location during load should replace"); +do_test = t.step_func(function(new_length) { + assert_equals(new_length, history_length); t.done(); }); diff --git a/html/browsers/the-window-object/open-close/self-close.html b/html/browsers/the-window-object/open-close/self-close.html index f7d194b2de0d02..d409e9f423d521 100644 --- a/html/browsers/the-window-object/open-close/self-close.html +++ b/html/browsers/the-window-object/open-close/self-close.html @@ -2,7 +2,7 @@

self-close.html?navs=n&channel=name will navigate n times, then close and notify the channel.