Delay setting the constellation's active browser id until the context exists.

This commit is contained in:
Josh Matthews 2018-12-10 18:43:26 -05:00
parent db786a4399
commit b62a1ca662

View file

@ -4034,17 +4034,16 @@ where
/// Send the current frame tree to compositor
fn send_frame_tree(&mut self, top_level_browsing_context_id: TopLevelBrowsingContextId) {
self.active_browser_id = Some(top_level_browsing_context_id);
let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id);
// Note that this function can panic, due to ipc-channel creation failure.
// avoiding this panic would require a mechanism for dealing
// with low-resource scenarios.
debug!(
"Sending frame tree for browsing context {}.",
browsing_context_id
);
let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id);
if let Some(frame_tree) = self.browsing_context_to_sendable(browsing_context_id) {
debug!(
"Sending frame tree for browsing context {}.",
browsing_context_id
);
self.active_browser_id = Some(top_level_browsing_context_id);
self.compositor_proxy
.send(ToCompositorMsg::SetFrameTree(frame_tree));
}