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 a2dafdd2115acfab9ac53f635f4074ce1ddb5cde..e59fd92e24388367e640533f8a3d9c6eeb3d1eb2 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -3171,6 +3171,15 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient& chrome_client, |
if (!GetFrame() || before_unload_event->returnValue().IsNull()) |
return true; |
+ if (!GetFrame()->HasReceivedUserGesture()) { |
+ AddConsoleMessage(ConsoleMessage::Create( |
+ kJSMessageSource, kErrorMessageLevel, |
+ "Blocked attempt to show a 'beforeunload' confirmation panel for a " |
+ "frame that never had a user gesture since its load. " |
+ "https://www.chromestatus.com/feature/5082396709879808")); |
+ return true; |
+ } |
+ |
if (did_allow_navigation) { |
AddConsoleMessage(ConsoleMessage::Create( |
kJSMessageSource, kErrorMessageLevel, |