Stop overwriting prevent_default if default wasn't prevented
This didn't actually cause any issues because there is only one listener for the affected methods right now. Should we have added more, the last called observer would have overwritten `prevent_default`. Lets only set it when necessary to avoid this footgun in the future.
This commit is contained in:
parent
6c9f3066fd
commit
cd407d1c3f
2 changed files with 21 additions and 7 deletions
|
@ -135,7 +135,9 @@ void TopLevelWindow::InitWith(v8::Isolate* isolate,
|
|||
}
|
||||
|
||||
void TopLevelWindow::WillCloseWindow(bool* prevent_default) {
|
||||
*prevent_default = Emit("close");
|
||||
if (Emit("close")) {
|
||||
*prevent_default = true;
|
||||
}
|
||||
}
|
||||
|
||||
void TopLevelWindow::OnWindowClosed() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue