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 6f7a7402da5898e23d8477e1302556579c2b8883..d52abcb5a605860717dc5a5323c37f00bcc83efb 100644 |
--- a/third_party/WebKit/Source/core/frame/Frame.cpp |
+++ b/third_party/WebKit/Source/core/frame/Frame.cpp |
@@ -192,17 +192,25 @@ bool Frame::canNavigate(const Frame& targetFrame) { |
if (hasUserGesture) |
framebustParams |= userGestureBit; |
+ if (isAllowedNavigation) |
+ framebustParams |= allowedBit; |
+ framebustHistogram.count(framebustParams); |
+ |
if (sandboxed) { // Sandboxed with 'allow-top-navigation'. |
UseCounter::count(&targetFrame, UseCounter::TopNavInSandboxWithPerm); |
if (!hasUserGesture) { |
UseCounter::count(&targetFrame, |
UseCounter::TopNavInSandboxWithPermButNoGesture); |
+ String message = |
+ "Navigating the top-level window from a sandboxed iframe with " |
+ "'allow-top-navigation' will soon require that the iframe has " |
+ "received a user gesture. See " |
+ "https://www.chromestatus.com/features/5629582019395584."; |
+ printNavigationWarning(targetFrame, message.latin1().data()); |
} |
+ return true; |
} |
- if (isAllowedNavigation) |
- framebustParams |= allowedBit; |
- framebustHistogram.count(framebustParams); |
if (hasUserGesture || isAllowedNavigation) |
return true; |
// Frame-busting used to be generally allowed in most situations, but may |
@@ -210,26 +218,13 @@ bool Frame::canNavigate(const Frame& targetFrame) { |
// a user gesture. |
if (!RuntimeEnabledFeatures:: |
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); |
+ String message = |
+ "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(targetFrame, message.latin1().data()); |
return true; |
} |
errorReason = |