mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
prevent overwriting of salvageable state in later prompt/unload steps
This commit is contained in:
parent
a297e8f288
commit
57c0d82944
5 changed files with 101 additions and 5 deletions
|
@ -1654,7 +1654,9 @@ impl Document {
|
|||
);
|
||||
// TODO: Step 6, decrease the event loop's termination nesting level by 1.
|
||||
// Step 7
|
||||
self.salvageable.set(!has_listeners);
|
||||
if has_listeners {
|
||||
self.salvageable.set(false);
|
||||
}
|
||||
let mut can_unload = true;
|
||||
// TODO: Step 8 send a message to embedder to prompt user.
|
||||
// Step 9
|
||||
|
@ -1662,9 +1664,11 @@ impl Document {
|
|||
for iframe in self.iter_iframes() {
|
||||
// TODO: handle the case of cross origin iframes.
|
||||
let document = document_from_node(&*iframe);
|
||||
if !document.prompt_to_unload(true) {
|
||||
self.salvageable.set(document.salvageable());
|
||||
can_unload = false;
|
||||
can_unload = document.prompt_to_unload(true);
|
||||
if !document.salvageable() {
|
||||
self.salvageable.set(false);
|
||||
}
|
||||
if !can_unload {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1715,7 +1719,9 @@ impl Document {
|
|||
);
|
||||
self.fired_unload.set(true);
|
||||
// Step 9
|
||||
self.salvageable.set(!has_listeners);
|
||||
if has_listeners {
|
||||
self.salvageable.set(false);
|
||||
}
|
||||
}
|
||||
// TODO: Step 8, decrease the event loop's termination nesting level by 1.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue