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

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: Rebase Created 4 years, 1 month 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 30 matching lines...) Expand all
41 #include "core/inspector/InspectorInstrumentation.h" 41 #include "core/inspector/InspectorInstrumentation.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/InstanceCounters.h" 50 #include "platform/InstanceCounters.h"
51 #include "platform/UserGestureIndicator.h"
52 51
53 namespace blink { 52 namespace blink {
54 53
55 using namespace HTMLNames; 54 using namespace HTMLNames;
56 55
57 Frame::~Frame() { 56 Frame::~Frame() {
58 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter); 57 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter);
59 ASSERT(!m_owner); 58 ASSERT(!m_owner);
60 } 59 }
61 60
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 165
167 if (targetFrame != this && 166 if (targetFrame != this &&
168 !securityContext()->isSandboxed(SandboxTopNavigation) && 167 !securityContext()->isSandboxed(SandboxTopNavigation) &&
169 targetFrame == tree().top()) { 168 targetFrame == tree().top()) {
170 DEFINE_STATIC_LOCAL(EnumerationHistogram, framebustHistogram, 169 DEFINE_STATIC_LOCAL(EnumerationHistogram, framebustHistogram,
171 ("WebCore.Framebust", 4)); 170 ("WebCore.Framebust", 4));
172 const unsigned userGestureBit = 0x1; 171 const unsigned userGestureBit = 0x1;
173 const unsigned allowedBit = 0x2; 172 const unsigned allowedBit = 0x2;
174 unsigned framebustParams = 0; 173 unsigned framebustParams = 0;
175 UseCounter::count(&targetFrame, UseCounter::TopNavigationFromSubFrame); 174 UseCounter::count(&targetFrame, UseCounter::TopNavigationFromSubFrame);
176 bool hasUserGesture = UserGestureIndicator::processingUserGesture(); 175 bool hasUserGesture =
176 isLocalFrame()
177 ? toLocalFrame(this)->document()->hasReceivedUserGesture()
178 : false;
177 if (hasUserGesture) 179 if (hasUserGesture)
178 framebustParams |= userGestureBit; 180 framebustParams |= userGestureBit;
179 if (isAllowedNavigation) 181 if (isAllowedNavigation)
180 framebustParams |= allowedBit; 182 framebustParams |= allowedBit;
181 framebustHistogram.count(framebustParams); 183 framebustHistogram.count(framebustParams);
182 // Frame-busting used to be generally allowed in most situations, but may 184 // Frame-busting used to be generally allowed in most situations, but may
183 // now blocked if there is no user gesture. 185 // now blocked if there is no user gesture.
184 if (!RuntimeEnabledFeatures:: 186 if (!RuntimeEnabledFeatures::
185 framebustingNeedsSameOriginOrUserGestureEnabled()) 187 framebustingNeedsSameOriginOrUserGestureEnabled())
186 return true; 188 return true;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 332
331 ASSERT(page()); 333 ASSERT(page());
332 334
333 if (m_owner) 335 if (m_owner)
334 m_owner->setContentFrame(*this); 336 m_owner->setContentFrame(*this);
335 else 337 else
336 page()->setMainFrame(this); 338 page()->setMainFrame(this);
337 } 339 }
338 340
339 } // namespace blink 341 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698