Index: third_party/WebKit/Source/core/dom/Document.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
index db999f3fc3671d960408fe3438955f4e2e4c766f..b8a1e14bc921070466db67eafebf11d558ff6017 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -2655,7 +2655,7 @@ void Document::implicitClose() |
accessSVGExtensions().startAnimations(); |
} |
-bool Document::dispatchBeforeUnloadEvent(ChromeClient& chromeClient, bool isReload, bool& didAllowNavigation) |
+bool Document::dispatchBeforeUnloadEvent(ChromeClient& chromeClient, bool isReload, bool& didAllowNavigation, bool& eventListenerCalled) |
{ |
if (!m_domWindow) |
return true; |
@@ -2666,6 +2666,8 @@ bool Document::dispatchBeforeUnloadEvent(ChromeClient& chromeClient, bool isRelo |
if (processingBeforeUnload()) |
return false; |
+ if (m_domWindow->hasEventListeners(EventTypeNames::beforeunload)) |
+ eventListenerCalled = true; |
BeforeUnloadEvent* beforeUnloadEvent = BeforeUnloadEvent::create(); |
m_loadEventProgress = BeforeUnloadEventInProgress; |
m_domWindow->dispatchEvent(beforeUnloadEvent, this); |