script: Make same-origin iframes inherit encoding from their container document (#41450)

Testing: new tests start to pass
Part of https://github.com/servo/servo/issues/6414

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker
2025-12-21 12:03:30 +01:00
committed by GitHub
parent a58d9727f9
commit b0734b7f2d
17 changed files with 60 additions and 124 deletions

View File

@@ -366,6 +366,7 @@ impl HTMLIFrameElement {
None
};
let propagate_encoding_to_child_document = url.origin().same_origin(window.origin());
let mut load_data = LoadData::new(
LoadOrigin::Script(document.origin().immutable().clone()),
url,
@@ -379,6 +380,9 @@ impl HTMLIFrameElement {
);
load_data.destination = Destination::IFrame;
load_data.policy_container = Some(window.as_global_scope().policy_container());
if propagate_encoding_to_child_document {
load_data.container_document_encoding = Some(document.encoding());
}
let pipeline_id = self.pipeline_id();
// If the initial `about:blank` page is the current page, load with replacement enabled,
@@ -420,6 +424,7 @@ impl HTMLIFrameElement {
);
load_data.destination = Destination::IFrame;
load_data.policy_container = Some(window.as_global_scope().policy_container());
let browsing_context_id = BrowsingContextId::new();
let webview_id = window.window_proxy().webview_id();
self.pipeline_id.set(None);