diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 08925c4ecb894..14945229131f5 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -1178,13 +1178,12 @@ impl Constellation self.mem_profiler_chan.send(mem::ProfilerMsg::Exit); // Close the top-level browsing contexts - let top_level_browsing_context_ids: Vec = self.browsing_contexts.values() + let browsing_context_ids: Vec = self.browsing_contexts.values() .filter(|browsing_context| browsing_context.is_top_level()) - .map(|browsing_context| browsing_context.top_level_id) + .map(|browsing_context| browsing_context.id) .collect(); - for top_level_browsing_context_id in top_level_browsing_context_ids { - debug!("Removing top-level browsing context {}.", top_level_browsing_context_id); - let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id); + for browsing_context_id in browsing_context_ids { + debug!("Removing top-level browsing context {}.", browsing_context_id); self.close_browsing_context(browsing_context_id, ExitPipelineMode::Normal); } @@ -1657,13 +1656,6 @@ impl Constellation return None; } }; - let (top_level_id, window_size, timestamp) = match self.browsing_contexts.get(&browsing_context_id) { - Some(browsing_context) => (browsing_context.top_level_id, browsing_context.size, browsing_context.instant), - None => { - warn!("Browsing context {} loaded after closure.", browsing_context_id); - return None; - } - }; match parent_info { Some((parent_pipeline_id, _)) => { // Find the script thread for the pipeline containing the iframe @@ -1705,6 +1697,13 @@ impl Constellation // changes would be overridden by changing the subframe associated with source_id. // Create the new pipeline + let (top_level_id, window_size, timestamp) = match self.browsing_contexts.get(&browsing_context_id) { + Some(context) => (context.top_level_id, context.size, context.instant), + None => { + warn!("Browsing context {} loaded after closure.", browsing_context_id); + return None; + } + }; let new_pipeline_id = PipelineId::new(); let sandbox = IFrameSandboxState::IFrameUnsandboxed; let replace_instant = if replace { Some(timestamp) } else { None };