Navigation Menu

Skip to content

Commit

Permalink
Ensure iframe's contentWindow is updated when traversing the session …
Browse files Browse the repository at this point in the history
…history.
  • Loading branch information
jdm committed Mar 7, 2019
1 parent cc131be commit edfd15c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
10 changes: 8 additions & 2 deletions components/constellation/constellation.rs
Expand Up @@ -2640,12 +2640,16 @@ where
},
};

let (old_pipeline_id, parent_pipeline_id) =
let (old_pipeline_id, parent_pipeline_id, top_level_id) =
match self.browsing_contexts.get_mut(&browsing_context_id) {
Some(browsing_context) => {
let old_pipeline_id = browsing_context.pipeline_id;
browsing_context.update_current_entry(new_pipeline_id);
(old_pipeline_id, browsing_context.parent_pipeline_id)
(
old_pipeline_id,
browsing_context.parent_pipeline_id,
browsing_context.top_level_id,
)
},
None => {
return warn!(
Expand All @@ -2662,6 +2666,7 @@ where
let msg = ConstellationControlMsg::UpdatePipelineId(
parent_pipeline_id,
browsing_context_id,
top_level_id,
new_pipeline_id,
UpdatePipelineIdReason::Traversal,
);
Expand Down Expand Up @@ -3581,6 +3586,7 @@ where
let msg = ConstellationControlMsg::UpdatePipelineId(
parent_pipeline_id,
change.browsing_context_id,
change.top_level_browsing_context_id,
pipeline_id,
UpdatePipelineIdReason::Navigation,
);
Expand Down
21 changes: 20 additions & 1 deletion components/script/script_thread.rs
Expand Up @@ -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),
Expand Down Expand Up @@ -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,
),
Expand Down Expand Up @@ -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,
) {
Expand All @@ -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(
Expand Down Expand Up @@ -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,
);
Expand Down
1 change: 1 addition & 0 deletions components/script_traits/lib.rs
Expand Up @@ -303,6 +303,7 @@ pub enum ConstellationControlMsg {
UpdatePipelineId(
PipelineId,
BrowsingContextId,
TopLevelBrowsingContextId,
PipelineId,
UpdatePipelineIdReason,
),
Expand Down

0 comments on commit edfd15c

Please sign in to comment.