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 29d87cd9bc423ddfed4d97d7774bdf1194e67eaf..4f859da97178eb940fd12f914aece10c98c62e68 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, |