Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: Source/core/frame/LocalDOMWindow.cpp

Issue 861773003: Inform the WebFrameClient of BeforeUnload/Unload handlers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/LocalDOMWindow.cpp
diff --git a/Source/core/frame/LocalDOMWindow.cpp b/Source/core/frame/LocalDOMWindow.cpp
index ee80a05b0ddfa044471e6f6a30942a0f01963611..af25054a292930e24335fe758a1e235ba3199b84 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();
clamy 2015/01/20 16:47:01 Note: this call as well as the equivalent ones dow
set.add(domWindow);
+ domWindow->frame()->loader().client()->suddenTerminationDisablerChanged(
+ true, FrameLoaderClient::UnloadHandler);
}
static void removeUnloadEventListener(LocalDOMWindow* domWindow)
@@ -242,6 +244,8 @@ static void removeUnloadEventListener(LocalDOMWindow* domWindow)
set.remove(it);
if (set.isEmpty())
enableSuddenTermination();
+ domWindow->frame()->loader().client()->suddenTerminationDisablerChanged(
+ false, FrameLoaderClient::UnloadHandler);
}
static void removeAllUnloadEventListeners(LocalDOMWindow* domWindow)
@@ -253,6 +257,7 @@ static void removeAllUnloadEventListeners(LocalDOMWindow* domWindow)
set.removeAll(it);
if (set.isEmpty())
enableSuddenTermination();
+ // TODO: remove the right number here
}
static void addBeforeUnloadEventListener(LocalDOMWindow* domWindow)
@@ -261,6 +266,8 @@ static void addBeforeUnloadEventListener(LocalDOMWindow* domWindow)
if (set.isEmpty())
disableSuddenTermination();
set.add(domWindow);
+ domWindow->frame()->loader().client()->suddenTerminationDisablerChanged(
+ true, FrameLoaderClient::BeforeUnloadHandler);
}
static void removeBeforeUnloadEventListener(LocalDOMWindow* domWindow)
@@ -272,6 +279,8 @@ static void removeBeforeUnloadEventListener(LocalDOMWindow* domWindow)
set.remove(it);
if (set.isEmpty())
enableSuddenTermination();
+ domWindow->frame()->loader().client()->suddenTerminationDisablerChanged(
+ false, FrameLoaderClient::BeforeUnloadHandler);
}
static void removeAllBeforeUnloadEventListeners(LocalDOMWindow* domWindow)
@@ -283,6 +292,7 @@ static void removeAllBeforeUnloadEventListeners(LocalDOMWindow* domWindow)
set.removeAll(it);
if (set.isEmpty())
enableSuddenTermination();
+ // TODO: remove the right number here
}
static bool allowsBeforeUnloadListeners(LocalDOMWindow* window)
« no previous file with comments | « no previous file | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698