aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorDavid Raifaizen <d-raif@hotmail.com>2016-07-25 20:34:47 -0400
committerDavid Raifaizen <d-raif@hotmail.com>2016-07-25 22:28:04 -0400
commit2475dc1d21343e7cdda8b77be87be4484ee0f15a (patch)
treeb1a1230b9bfd48d1e85598286061c0d48ed4e755 /components/script/script_thread.rs
parent4b78b9adab916cc4fdde6248e785030b79f406da (diff)
downloadservo-2475dc1d21343e7cdda8b77be87be4484ee0f15a.tar.gz
servo-2475dc1d21343e7cdda8b77be87be4484ee0f15a.zip
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.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs14
1 files changed, 4 insertions, 10 deletions
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<BrowsingContext> {
- 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()
}