From 51ab14086cd635a3d2a7826e25ff96d679e265c7 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 20 Dec 2018 17:12:13 -0500 Subject: [PATCH] Synchronously update the pipeline of same-origin iframe elements as soon as the child document begins parsing. --- components/script/script_thread.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 9ef684b96c4..9247ca6afba 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -2851,6 +2851,21 @@ impl ScriptThread { window.init_document(&document); + // For any similar-origin iframe, ensure that the contentWindow/contentDocument + // APIs resolve to the new window/document as soon as parsing starts. + if let Some(frame) = window_proxy + .frame_element() + .and_then(|e| e.downcast::()) + { + let parent_pipeline = frame.global().pipeline_id(); + self.handle_update_pipeline_id( + parent_pipeline, + window_proxy.browsing_context_id(), + incomplete.pipeline_id, + UpdatePipelineIdReason::Navigation, + ); + } + self.script_sender .send((incomplete.pipeline_id, ScriptMsg::ActivateDocument)) .unwrap();