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 43aaf0a8818e7d3dffa5b297bf1756910e408cac..70079aa2cfe24758ac5aebdb69026add88d0fe90 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -3055,6 +3055,14 @@ bool Document::dispatchBeforeUnloadEvent(ChromeClient& chromeClient, |
if (!frame() || beforeUnloadEvent->returnValue().isNull()) |
return true; |
+ if (!frame()->hasReceivedUserGesture()) { |
+ addConsoleMessage(ConsoleMessage::create( |
+ JSMessageSource, ErrorMessageLevel, |
+ "Blocked attempt to show a 'beforeunload' confirmation panel for a " |
+ "frame without a user gesture.")); |
+ return true; |
+ } |
+ |
if (didAllowNavigation) { |
addConsoleMessage(ConsoleMessage::create( |
JSMessageSource, ErrorMessageLevel, |