script: Consolidate more logic into ScriptThread::spawn_pipeline (#40586)

Have more of the code follow the same path calling
`ScriptThread::spawn_pipeline`. Somewhat tricky was that the `origin` of
the new Pipeline was being determined in several different places, but
all in a consistent way for different types of page loads. This change
makes it is so that the origin is always determined in the same place.

This change is preparation for splitting out the creation of a new
`ScriptThread` and the spawning of its first pipeline.

Testing: This should not change observable behavior, so is covered by
existing tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson
2025-11-12 16:37:25 +01:00
committed by GitHub
parent a5db5953e0
commit ab0f818583
4 changed files with 57 additions and 116 deletions

View File

@@ -49,7 +49,7 @@ use crate::dom::trustedhtml::TrustedHTML;
use crate::dom::virtualmethods::VirtualMethods;
use crate::dom::windowproxy::WindowProxy;
use crate::script_runtime::CanGc;
use crate::script_thread::ScriptThread;
use crate::script_thread::{ScriptThread, with_script_thread};
use crate::script_window_proxies::ScriptWindowProxies;
#[derive(PartialEq)]
@@ -228,10 +228,9 @@ impl HTMLIFrameElement {
};
self.pipeline_id.set(Some(new_pipeline_id));
ScriptThread::spawn_pipeline_in_current(
new_pipeline_info,
document.origin().clone(),
);
with_script_thread(|script_thread| {
script_thread.spawn_pipeline(new_pipeline_info);
});
},
PipelineType::Navigation => {
let load_info = IFrameLoadInfoWithData {