From 8d312b0f0cb424b03de7f476f60517187f81564e Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Thu, 8 Oct 2015 11:38:19 +1000 Subject: [PATCH] Convert RemoveIFrame message to use pipeline id. --- components/compositing/constellation.rs | 9 +++---- components/msg/constellation_msg.rs | 2 +- components/script/dom/htmliframeelement.rs | 29 ++++++++++------------ 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index fc9dd951a84..edc19ce07a5 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -512,9 +512,9 @@ impl Constellation { let is_ready = self.handle_is_ready_to_save_image(pipeline_states); self.compositor_proxy.send(CompositorMsg::IsReadyToSaveImageReply(is_ready)); } - ConstellationMsg::RemoveIFrame(containing_pipeline_id, subpage_id) => { + ConstellationMsg::RemoveIFrame(pipeline_id) => { debug!("constellation got remove iframe message"); - self.handle_remove_iframe_msg(containing_pipeline_id, subpage_id); + self.handle_remove_iframe_msg(pipeline_id); } ConstellationMsg::NewFavicon(url) => { debug!("constellation got new favicon message"); @@ -947,10 +947,7 @@ impl Constellation { self.focus_parent_pipeline(pipeline_id); } - fn handle_remove_iframe_msg(&mut self, - containing_pipeline_id: PipelineId, - subpage_id: SubpageId) { - let pipeline_id = self.find_subpage(containing_pipeline_id, subpage_id).id; + fn handle_remove_iframe_msg(&mut self, pipeline_id: PipelineId) { let frame_id = self.pipeline_to_frame_map.get(&pipeline_id).map(|id| *id); match frame_id { Some(frame_id) => { diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index 857161c316d..81701bc92b9 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -276,7 +276,7 @@ pub enum Msg { /// Query the constellation to see if the current compositor output is stable IsReadyToSaveImage(HashMap), /// Notification that this iframe should be removed. - RemoveIFrame(PipelineId, SubpageId), + RemoveIFrame(PipelineId), /// Favicon detected NewFavicon(Url), /// tag finished parsing diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index a29beac4107..88ffc7a6981 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -431,24 +431,21 @@ impl VirtualMethods for HTMLIFrameElement { } // https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded - match (self.containing_page_pipeline_id(), self.subpage_id()) { - (Some(containing_pipeline_id), Some(subpage_id)) => { - let window = window_from_node(self); - let window = window.r(); + if let Some(pipeline_id) = self.pipeline_id.get() { + let window = window_from_node(self); + let window = window.r(); - let ConstellationChan(ref chan) = window.constellation_chan(); - let msg = ConstellationMsg::RemoveIFrame(containing_pipeline_id, - subpage_id); - chan.send(msg).unwrap(); + let ConstellationChan(ref chan) = window.constellation_chan(); + let msg = ConstellationMsg::RemoveIFrame(pipeline_id); + chan.send(msg).unwrap(); - // Resetting the subpage id to None is required here so that - // if this iframe is subsequently re-added to the document - // the load doesn't think that it's a navigation, but instead - // a new iframe. Without this, the constellation gets very - // confused. - self.subpage_id.set(None); - } - _ => {} + // Resetting the subpage id to None is required here so that + // if this iframe is subsequently re-added to the document + // the load doesn't think that it's a navigation, but instead + // a new iframe. Without this, the constellation gets very + // confused. + self.subpage_id.set(None); + self.pipeline_id.set(None); } } }