Index: Source/core/frame/LocalDOMWindow.cpp |
diff --git a/Source/core/frame/LocalDOMWindow.cpp b/Source/core/frame/LocalDOMWindow.cpp |
index ee80a05b0ddfa044471e6f6a30942a0f01963611..f1b8ebc6bc82ac8507f303beabca82b9a0626671 100644 |
--- a/Source/core/frame/LocalDOMWindow.cpp |
+++ b/Source/core/frame/LocalDOMWindow.cpp |
@@ -231,6 +231,8 @@ static void addUnloadEventListener(LocalDOMWindow* domWindow) |
if (set.isEmpty()) |
disableSuddenTermination(); |
set.add(domWindow); |
+ domWindow->frame()->loader().client()->suddenTerminationDisablerChanged( |
+ 1, FrameLoaderClient::UnloadHandler); |
} |
static void removeUnloadEventListener(LocalDOMWindow* domWindow) |
@@ -242,6 +244,8 @@ static void removeUnloadEventListener(LocalDOMWindow* domWindow) |
set.remove(it); |
if (set.isEmpty()) |
enableSuddenTermination(); |
Nate Chapin
2015/01/20 18:46:49
Will we eventually be able to remove these enable/
clamy
2015/01/21 13:46:31
Yes, when the chromium side patch lands we should
Nate Chapin
2015/01/21 19:51:42
Interesting, I would have thought that local stora
|
+ domWindow->frame()->loader().client()->suddenTerminationDisablerChanged( |
Nate Chapin
2015/01/20 18:46:49
Is this safe? domWindow->frame() can be null at ve
clamy
2015/01/21 13:46:31
In that case I added a check for domWindow->frame(
Nate Chapin
2015/01/21 19:51:42
I did a quick look and didn't see anything that wo
|
+ -1, FrameLoaderClient::UnloadHandler); |
} |
static void removeAllUnloadEventListeners(LocalDOMWindow* domWindow) |
@@ -250,9 +254,12 @@ static void removeAllUnloadEventListeners(LocalDOMWindow* domWindow) |
DOMWindowSet::iterator it = set.find(domWindow); |
if (it == set.end()) |
return; |
+ int numHandlers = set.count(domWindow); |
set.removeAll(it); |
if (set.isEmpty()) |
enableSuddenTermination(); |
+ domWindow->frame()->loader().client()->suddenTerminationDisablerChanged( |
+ -numHandlers, FrameLoaderClient::UnloadHandler); |
} |
static void addBeforeUnloadEventListener(LocalDOMWindow* domWindow) |
@@ -261,6 +268,8 @@ static void addBeforeUnloadEventListener(LocalDOMWindow* domWindow) |
if (set.isEmpty()) |
disableSuddenTermination(); |
set.add(domWindow); |
+ domWindow->frame()->loader().client()->suddenTerminationDisablerChanged( |
+ 1, FrameLoaderClient::BeforeUnloadHandler); |
} |
static void removeBeforeUnloadEventListener(LocalDOMWindow* domWindow) |
@@ -272,6 +281,8 @@ static void removeBeforeUnloadEventListener(LocalDOMWindow* domWindow) |
set.remove(it); |
if (set.isEmpty()) |
enableSuddenTermination(); |
+ domWindow->frame()->loader().client()->suddenTerminationDisablerChanged( |
+ -1, FrameLoaderClient::BeforeUnloadHandler); |
} |
static void removeAllBeforeUnloadEventListeners(LocalDOMWindow* domWindow) |
@@ -280,9 +291,12 @@ static void removeAllBeforeUnloadEventListeners(LocalDOMWindow* domWindow) |
DOMWindowSet::iterator it = set.find(domWindow); |
if (it == set.end()) |
return; |
+ int numHandlers = set.count(domWindow); |
set.removeAll(it); |
if (set.isEmpty()) |
enableSuddenTermination(); |
+ domWindow->frame()->loader().client()->suddenTerminationDisablerChanged( |
+ -numHandlers, FrameLoaderClient::BeforeUnloadHandler); |
} |
static bool allowsBeforeUnloadListeners(LocalDOMWindow* window) |