diff options
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 440de991ceb..b4363f5ada3 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -1973,7 +1973,15 @@ impl ScriptThread { let window = self.documents.borrow().find_window(pipeline_id); let window = match window { - Some(w) => w, + Some(w) => { + if w.Closed() { + return warn!( + "Received fire timer msg for a discarded browsing context whose pipeline is pending exit {}.", + pipeline_id + ); + } + w + }, None => { return warn!( "Received fire timer msg for a closed pipeline {}.", @@ -2848,7 +2856,7 @@ impl ScriptThread { // to avoid running layout on detached iframes. let window = document.window(); if discard_bc == DiscardBrowsingContext::Yes { - window.window_proxy().discard_browsing_context(); + window.discard_browsing_context(); } window.clear_js_runtime(); } @@ -3378,9 +3386,26 @@ impl ScriptThread { /// /// TODO: Actually perform DOM event dispatch. fn handle_event(&self, pipeline_id: PipelineId, event: CompositorEvent) { + // Do not handle events if the pipeline exited. + let window = match { self.documents.borrow().find_window(pipeline_id) } { + Some(win) => win, + None => { + return warn!( + "Compositor event sent to a pipeline that already exited {}.", + pipeline_id + ) + }, + }; + // Do not handle events if the BC has been, or is being, discarded + if window.Closed() { + return warn!( + "Compositor event sent to a pipeline with a closed window {}.", + pipeline_id + ); + } + // Assuming all CompositionEvent are generated by user interactions. ScriptThread::set_user_interacting(true); - match event { ResizeEvent(new_size, size_type) => { self.handle_resize_event(pipeline_id, new_size, size_type); |