mirror of
https://github.com/servo/servo.git
synced 2025-06-10 09:33:13 +00:00
improve spec compliance of discarding BCs
do not handle compositor input events when BC is being discarded prevent firing of timers for discarded BCs return null for opener is BC has been discarded bundle discard BC steps into window method return null in window.opener, if BC has already been discarded move the window closed check pre-event to script-thread
This commit is contained in:
parent
4fe8238b14
commit
45ec250b0a
7 changed files with 133 additions and 53 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue