mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Auto merge of #22999 - jdm:iframe-replace, r=asajeffrey,cbrewster
Fix replacement logic when navigating nested browsing contexts These changes also fix a bug where traversing the session history in a nested browsing context did not update the iframe's contentWindow appropriately. - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #22996 - [x] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22999) <!-- Reviewable:end -->
This commit is contained in:
commit
ac3c002138
10 changed files with 128 additions and 8 deletions
|
@ -278,9 +278,7 @@ impl HTMLIFrameElement {
|
|||
// see https://html.spec.whatwg.org/multipage/#the-iframe-element:about:blank-3
|
||||
let is_about_blank =
|
||||
pipeline_id.is_some() && pipeline_id == self.about_blank_pipeline_id.get();
|
||||
// Replacement enabled also takes into account whether the document is "completely loaded",
|
||||
// see https://html.spec.whatwg.org/multipage/#the-iframe-element:completely-loaded
|
||||
let replace = is_about_blank || !document.is_completely_loaded();
|
||||
let replace = is_about_blank;
|
||||
self.navigate_or_reload_child_browsing_context(
|
||||
Some(load_data),
|
||||
NavigationType::Regular,
|
||||
|
|
|
@ -1429,7 +1429,7 @@ impl ScriptThread {
|
|||
NotifyVisibilityChange(id, ..) => Some(id),
|
||||
Navigate(id, ..) => Some(id),
|
||||
PostMessage { target: id, .. } => Some(id),
|
||||
UpdatePipelineId(_, _, id, _) => Some(id),
|
||||
UpdatePipelineId(_, _, _, id, _) => Some(id),
|
||||
UpdateHistoryState(id, ..) => Some(id),
|
||||
RemoveHistoryStates(id, ..) => Some(id),
|
||||
FocusIFrame(id, ..) => Some(id),
|
||||
|
@ -1617,11 +1617,13 @@ impl ScriptThread {
|
|||
ConstellationControlMsg::UpdatePipelineId(
|
||||
parent_pipeline_id,
|
||||
browsing_context_id,
|
||||
top_level_browsing_context_id,
|
||||
new_pipeline_id,
|
||||
reason,
|
||||
) => self.handle_update_pipeline_id(
|
||||
parent_pipeline_id,
|
||||
browsing_context_id,
|
||||
top_level_browsing_context_id,
|
||||
new_pipeline_id,
|
||||
reason,
|
||||
),
|
||||
|
@ -2153,6 +2155,7 @@ impl ScriptThread {
|
|||
&self,
|
||||
parent_pipeline_id: PipelineId,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
new_pipeline_id: PipelineId,
|
||||
reason: UpdatePipelineIdReason,
|
||||
) {
|
||||
|
@ -2163,6 +2166,21 @@ impl ScriptThread {
|
|||
if let Some(frame_element) = frame_element {
|
||||
frame_element.update_pipeline_id(new_pipeline_id, reason);
|
||||
}
|
||||
|
||||
if let Some(window) = self.documents.borrow().find_window(new_pipeline_id) {
|
||||
// Ensure that the state of any local window proxies accurately reflects
|
||||
// the new pipeline.
|
||||
let _ = self.local_window_proxy(
|
||||
&*window,
|
||||
browsing_context_id,
|
||||
top_level_browsing_context_id,
|
||||
Some(parent_pipeline_id),
|
||||
// Any local window proxy has already been created, so there
|
||||
// is no need to pass along existing opener information that
|
||||
// will be discarded.
|
||||
None,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_update_history_state_msg(
|
||||
|
@ -2870,6 +2888,7 @@ impl ScriptThread {
|
|||
self.handle_update_pipeline_id(
|
||||
parent_pipeline,
|
||||
window_proxy.browsing_context_id(),
|
||||
window_proxy.top_level_browsing_context_id(),
|
||||
incomplete.pipeline_id,
|
||||
UpdatePipelineIdReason::Navigation,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue