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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2801813005: Only show a beforeunload dialog if a frame has had a user gesture since its load. (Closed)
Patch Set: aw Created 3 years, 8 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
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 2f2611587cd266c7d2a511d7d9522b7051e41614..3e0b81300fc9e19cc75c3e1f86d26de2afb6c99c 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -3071,6 +3071,15 @@ bool Document::dispatchBeforeUnloadEvent(ChromeClient& chromeClient,
if (!frame() || beforeUnloadEvent->returnValue().isNull())
return true;
+ if (!frame()->hasReceivedUserGesture()) {
Charlie Reis 2017/04/10 06:20:11 Sanity check: Does this mean the frame has receive
Avi (use Gerrit) 2017/05/05 15:30:04 This is actually about the document, not the frame
+ addConsoleMessage(ConsoleMessage::create(
+ JSMessageSource, ErrorMessageLevel,
+ "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 (didAllowNavigation) {
addConsoleMessage(ConsoleMessage::create(
JSMessageSource, ErrorMessageLevel,

Powered by Google App Engine
This is Rietveld 408576698