mirror of
https://github.com/servo/servo
synced 2026-04-27 18:07:52 +02:00
script: Merge Window::load_url with ScriptThread::navigate (#43668)
Both `Window::load_url` and `ScriptThread::navigate` implement parts of the same navigate algorithm from the HTML spec (https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate). `ScriptThread::navigate` had only one caller: `Window::load_url`. This merges both methods into a single `navigate` function in `navigation.rs`, which is the appropriate home for navigation logic. All previous callers of `Window::load_url` now call `navigation::navigate` directly. Testing: This is a pure refactor with no behaviour changes, so no new tests are needed. Existing tests cover the navigation paths affected. Fixes: #43494 --------- Signed-off-by: thebabalola <t.babalolajoseph@gmail.com>
This commit is contained in:
@@ -86,6 +86,7 @@ use crate::dom::types::HTMLIFrameElement;
|
||||
use crate::dom::virtualmethods::VirtualMethods;
|
||||
use crate::dom::window::Window;
|
||||
use crate::links::{LinkRelations, get_element_target, valid_navigable_target_name_or_keyword};
|
||||
use crate::navigation::navigate;
|
||||
use crate::script_runtime::CanGc;
|
||||
use crate::script_thread::ScriptThread;
|
||||
|
||||
@@ -1109,14 +1110,13 @@ impl HTMLFormElement {
|
||||
}
|
||||
|
||||
// 4.2 Navigate targetNavigable to url
|
||||
window
|
||||
.root()
|
||||
.load_url(
|
||||
NavigationHistoryBehavior::Push,
|
||||
false,
|
||||
load_data,
|
||||
CanGc::note(),
|
||||
);
|
||||
navigate(
|
||||
&window.root(),
|
||||
NavigationHistoryBehavior::Push,
|
||||
false,
|
||||
load_data,
|
||||
CanGc::note(),
|
||||
);
|
||||
});
|
||||
|
||||
// 5. Set the form's planned navigation to the just-queued task.
|
||||
|
||||
Reference in New Issue
Block a user