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

Side by Side Diff: third_party/WebKit/Source/core/frame/Frame.cpp

Issue 2392773002: Reenable framebusting deprecation, change it to allow navigation if iframe has ever had a user gestu (Closed)
Patch Set: TODOs and TouchEventmanager Created 4 years, 2 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 r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 29 matching lines...) Expand all
40 #include "core/inspector/InspectorInstrumentation.h" 40 #include "core/inspector/InspectorInstrumentation.h"
41 #include "core/inspector/InstanceCounters.h" 41 #include "core/inspector/InstanceCounters.h"
42 #include "core/layout/LayoutPart.h" 42 #include "core/layout/LayoutPart.h"
43 #include "core/layout/api/LayoutPartItem.h" 43 #include "core/layout/api/LayoutPartItem.h"
44 #include "core/loader/EmptyClients.h" 44 #include "core/loader/EmptyClients.h"
45 #include "core/loader/FrameLoaderClient.h" 45 #include "core/loader/FrameLoaderClient.h"
46 #include "core/loader/NavigationScheduler.h" 46 #include "core/loader/NavigationScheduler.h"
47 #include "core/page/FocusController.h" 47 #include "core/page/FocusController.h"
48 #include "core/page/Page.h" 48 #include "core/page/Page.h"
49 #include "platform/Histogram.h" 49 #include "platform/Histogram.h"
50 #include "platform/UserGestureIndicator.h"
51 50
52 namespace blink { 51 namespace blink {
53 52
54 using namespace HTMLNames; 53 using namespace HTMLNames;
55 54
56 Frame::~Frame() { 55 Frame::~Frame() {
57 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter); 56 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter);
58 ASSERT(!m_owner); 57 ASSERT(!m_owner);
59 } 58 }
60 59
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 163
165 if (targetFrame != this && 164 if (targetFrame != this &&
166 !securityContext()->isSandboxed(SandboxTopNavigation) && 165 !securityContext()->isSandboxed(SandboxTopNavigation) &&
167 targetFrame == tree().top()) { 166 targetFrame == tree().top()) {
168 DEFINE_STATIC_LOCAL(EnumerationHistogram, framebustHistogram, 167 DEFINE_STATIC_LOCAL(EnumerationHistogram, framebustHistogram,
169 ("WebCore.Framebust", 4)); 168 ("WebCore.Framebust", 4));
170 const unsigned userGestureBit = 0x1; 169 const unsigned userGestureBit = 0x1;
171 const unsigned allowedBit = 0x2; 170 const unsigned allowedBit = 0x2;
172 unsigned framebustParams = 0; 171 unsigned framebustParams = 0;
173 UseCounter::count(&targetFrame, UseCounter::TopNavigationFromSubFrame); 172 UseCounter::count(&targetFrame, UseCounter::TopNavigationFromSubFrame);
174 bool hasUserGesture = UserGestureIndicator::processingUserGesture(); 173 bool hasUserGesture =
174 isLocalFrame()
175 ? toLocalFrame(this)->document()->hasReceivedUserGesture()
Rick Byers 2016/10/06 16:26:47 I've been looking over all the places that take a
176 : false;
175 if (hasUserGesture) 177 if (hasUserGesture)
176 framebustParams |= userGestureBit; 178 framebustParams |= userGestureBit;
177 if (isAllowedNavigation) 179 if (isAllowedNavigation)
178 framebustParams |= allowedBit; 180 framebustParams |= allowedBit;
179 framebustHistogram.count(framebustParams); 181 framebustHistogram.count(framebustParams);
180 // Frame-busting used to be generally allowed in most situations, but may no w blocked if there is no user gesture. 182 // Frame-busting used to be generally allowed in most situations, but may no w blocked if there is no user gesture.
181 if (!RuntimeEnabledFeatures:: 183 if (!RuntimeEnabledFeatures::
182 framebustingNeedsSameOriginOrUserGestureEnabled()) 184 framebustingNeedsSameOriginOrUserGestureEnabled())
183 return true; 185 return true;
184 if (hasUserGesture || isAllowedNavigation) 186 if (hasUserGesture || isAllowedNavigation)
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 328
327 ASSERT(page()); 329 ASSERT(page());
328 330
329 if (m_owner) 331 if (m_owner)
330 m_owner->setContentFrame(*this); 332 m_owner->setContentFrame(*this);
331 else 333 else
332 page()->setMainFrame(this); 334 page()->setMainFrame(this);
333 } 335 }
334 336
335 } // namespace blink 337 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698