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

Unified Diff: third_party/WebKit/Source/core/frame/Frame.cpp

Issue 2617773002: Turn off requirement that cross-origin top navigation be accompanied by a user gesture. (Closed)
Patch Set: Fix tests Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/Frame.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/Frame.cpp
diff --git a/third_party/WebKit/Source/core/frame/Frame.cpp b/third_party/WebKit/Source/core/frame/Frame.cpp
index dcc8df734eb6693a9f4d2bcd51aa64eb649b7175..07074ee4b211b788c787799cc84213484cd7491e 100644
--- a/third_party/WebKit/Source/core/frame/Frame.cpp
+++ b/third_party/WebKit/Source/core/frame/Frame.cpp
@@ -184,16 +184,38 @@ bool Frame::canNavigate(const Frame& targetFrame) {
if (isAllowedNavigation)
framebustParams |= allowedBit;
framebustHistogram.count(framebustParams);
+ if (hasUserGesture || isAllowedNavigation)
+ return true;
// Frame-busting used to be generally allowed in most situations, but may
- // now blocked if there is no user gesture.
+ // now blocked if the document initiating the navigation has never received
+ // a user gesture.
if (!RuntimeEnabledFeatures::
- framebustingNeedsSameOriginOrUserGestureEnabled())
- return true;
- if (hasUserGesture || isAllowedNavigation)
+ framebustingNeedsSameOriginOrUserGestureEnabled()) {
+ String targetFrameDescription =
+ targetFrame.isLocalFrame()
+ ? "with URL '" +
+ toLocalFrame(targetFrame).document()->url().getString() +
+ "'"
+ : "with origin '" +
+ targetFrame.securityContext()
+ ->getSecurityOrigin()
+ ->toString() +
+ "'";
+ String message = "Frame with URL '" +
+ toLocalFrame(this)->document()->url().getString() +
+ "' attempted to navigate its top-level window " +
+ targetFrameDescription +
+ ". Navigating the top-level window from a cross-origin "
+ "iframe will soon require that the iframe has received "
+ "a user gesture. See "
+ "https://www.chromestatus.com/features/"
+ "5851021045661696.";
+ printNavigationWarning(message);
return true;
+ }
errorReason =
"The frame attempting navigation is targeting its top-level window, "
- "but is neither same-origin with its target nor is it processing a "
+ "but is neither same-origin with its target nor has it received a "
"user gesture. See "
"https://www.chromestatus.com/features/5851021045661696.";
printNavigationErrorMessage(targetFrame, errorReason.latin1().data());
« no previous file with comments | « third_party/WebKit/Source/core/frame/Frame.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698