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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
9 * rights reserved. 9 * rights reserved.
10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 UseCounter::count(&targetFrame, UseCounter::TopNavigationFromSubFrame); 177 UseCounter::count(&targetFrame, UseCounter::TopNavigationFromSubFrame);
178 bool hasUserGesture = 178 bool hasUserGesture =
179 isLocalFrame() 179 isLocalFrame()
180 ? toLocalFrame(this)->document()->hasReceivedUserGesture() 180 ? toLocalFrame(this)->document()->hasReceivedUserGesture()
181 : false; 181 : false;
182 if (hasUserGesture) 182 if (hasUserGesture)
183 framebustParams |= userGestureBit; 183 framebustParams |= userGestureBit;
184 if (isAllowedNavigation) 184 if (isAllowedNavigation)
185 framebustParams |= allowedBit; 185 framebustParams |= allowedBit;
186 framebustHistogram.count(framebustParams); 186 framebustHistogram.count(framebustParams);
187 // Frame-busting used to be generally allowed in most situations, but may
188 // now blocked if there is no user gesture.
189 if (!RuntimeEnabledFeatures::
190 framebustingNeedsSameOriginOrUserGestureEnabled())
191 return true;
192 if (hasUserGesture || isAllowedNavigation) 187 if (hasUserGesture || isAllowedNavigation)
193 return true; 188 return true;
189 // Frame-busting used to be generally allowed in most situations, but may
190 // now blocked if the document initiating the navigation has never received
191 // a user gesture.
192 if (!RuntimeEnabledFeatures::
193 framebustingNeedsSameOriginOrUserGestureEnabled()) {
194 String targetFrameDescription =
195 targetFrame.isLocalFrame()
196 ? "with URL '" +
197 toLocalFrame(targetFrame).document()->url().getString() +
198 "'"
199 : "with origin '" +
200 targetFrame.securityContext()
201 ->getSecurityOrigin()
202 ->toString() +
203 "'";
204 String message = "Frame with URL '" +
205 toLocalFrame(this)->document()->url().getString() +
206 "' attempted to navigate its top-level window " +
207 targetFrameDescription +
208 ". Navigating the top-level window from a cross-origin "
209 "iframe will soon require that the iframe has received "
210 "a user gesture. See "
211 "https://www.chromestatus.com/features/"
212 "5851021045661696.";
213 printNavigationWarning(message);
214 return true;
215 }
194 errorReason = 216 errorReason =
195 "The frame attempting navigation is targeting its top-level window, " 217 "The frame attempting navigation is targeting its top-level window, "
196 "but is neither same-origin with its target nor is it processing a " 218 "but is neither same-origin with its target nor has it received a "
197 "user gesture. See " 219 "user gesture. See "
198 "https://www.chromestatus.com/features/5851021045661696."; 220 "https://www.chromestatus.com/features/5851021045661696.";
199 printNavigationErrorMessage(targetFrame, errorReason.latin1().data()); 221 printNavigationErrorMessage(targetFrame, errorReason.latin1().data());
200 if (isLocalFrame()) { 222 if (isLocalFrame()) {
201 toLocalFrame(this)->navigationScheduler().schedulePageBlock( 223 toLocalFrame(this)->navigationScheduler().schedulePageBlock(
202 toLocalFrame(this)->document(), ResourceError::ACCESS_DENIED); 224 toLocalFrame(this)->document(), ResourceError::ACCESS_DENIED);
203 } 225 }
204 return false; 226 return false;
205 } 227 }
206 if (!isAllowedNavigation && !errorReason.isNull()) 228 if (!isAllowedNavigation && !errorReason.isNull())
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 367
346 ASSERT(page()); 368 ASSERT(page());
347 369
348 if (m_owner) 370 if (m_owner)
349 m_owner->setContentFrame(*this); 371 m_owner->setContentFrame(*this);
350 else 372 else
351 page()->setMainFrame(this); 373 page()->setMainFrame(this);
352 } 374 }
353 375
354 } // namespace blink 376 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698