From 2475dc1d21343e7cdda8b77be87be4484ee0f15a Mon Sep 17 00:00:00 2001 From: David Raifaizen Date: Mon, 25 Jul 2016 20:34:47 -0400 Subject: Removed some sources of panic from script thread and devtools, using Option values instead to indicate when a pipeline context is missing where appropriate. Additionally, removed erroneous method get_browsing_context. --- components/script/script_thread.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'components/script/script_thread.rs') diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index aeed396fbb1..a7d9135b068 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -1108,7 +1108,10 @@ impl ScriptThread { fn handle_resize(&self, id: PipelineId, size: WindowSizeData, size_type: WindowSizeType) { if let Some(ref context) = self.find_child_context(id) { - let window = context.active_window(); + let window = match context.find(id) { + Some(browsing_context) => browsing_context.active_window(), + None => return warn!("Message sent to closed pipeline {}.", id), + }; window.set_resize_event(size, size_type); return; } @@ -2204,15 +2207,6 @@ fn shut_down_layout(context_tree: &BrowsingContext) { } } -// TODO: remove this function, as it's a source of panic. -pub fn get_browsing_context(context: &BrowsingContext, - pipeline_id: PipelineId) - -> Root { - context.find(pipeline_id).expect("ScriptThread: received an event \ - message for a layout channel that is not associated with this script thread.\ - This is a bug.") -} - fn dom_last_modified(tm: &Tm) -> String { tm.to_local().strftime("%m/%d/%Y %H:%M:%S").unwrap().to_string() } -- cgit v1.2.3