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

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

Issue 2625773002: Reenable framebusting (Closed)
Patch Set: Fix unit 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 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 return false; 161 return false;
162 } 162 }
163 163
164 bool Frame::canNavigate(const Frame& targetFrame) { 164 bool Frame::canNavigate(const Frame& targetFrame) {
165 String errorReason; 165 String errorReason;
166 const bool isAllowedNavigation = 166 const bool isAllowedNavigation =
167 canNavigateWithoutFramebusting(targetFrame, errorReason); 167 canNavigateWithoutFramebusting(targetFrame, errorReason);
168 const bool sandboxed = securityContext()->getSandboxFlags() != SandboxNone; 168 const bool sandboxed = securityContext()->getSandboxFlags() != SandboxNone;
169 const bool hasUserGesture = 169 const bool hasUserGesture =
170 isLocalFrame() ? toLocalFrame(this)->document()->hasReceivedUserGesture() 170 isLocalFrame() ? toLocalFrame(this)->hasReceivedUserGesture() : false;
171 : false;
172 171
173 // Top navigation in sandbox with or w/o 'allow-top-navigation'. 172 // Top navigation in sandbox with or w/o 'allow-top-navigation'.
174 if (targetFrame != this && sandboxed && targetFrame == tree().top()) { 173 if (targetFrame != this && sandboxed && targetFrame == tree().top()) {
175 UseCounter::count(&targetFrame, UseCounter::TopNavInSandbox); 174 UseCounter::count(&targetFrame, UseCounter::TopNavInSandbox);
176 if (!hasUserGesture) { 175 if (!hasUserGesture) {
177 UseCounter::count(&targetFrame, 176 UseCounter::count(&targetFrame,
178 UseCounter::TopNavInSandboxWithoutGesture); 177 UseCounter::TopNavInSandboxWithoutGesture);
179 } 178 }
180 } 179 }
181 180
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 368
370 void Frame::didChangeVisibilityState() { 369 void Frame::didChangeVisibilityState() {
371 HeapVector<Member<Frame>> childFrames; 370 HeapVector<Member<Frame>> childFrames;
372 for (Frame* child = tree().firstChild(); child; 371 for (Frame* child = tree().firstChild(); child;
373 child = child->tree().nextSibling()) 372 child = child->tree().nextSibling())
374 childFrames.push_back(child); 373 childFrames.push_back(child);
375 for (size_t i = 0; i < childFrames.size(); ++i) 374 for (size_t i = 0; i < childFrames.size(); ++i)
376 childFrames[i]->didChangeVisibilityState(); 375 childFrames[i]->didChangeVisibilityState();
377 } 376 }
378 377
378 void Frame::setDocumentHasReceivedUserGesture() {
379 m_hasReceivedUserGesture = true;
380 if (Frame* parent = tree().parent())
381 parent->setDocumentHasReceivedUserGesture();
382 }
383
379 Frame::Frame(FrameClient* client, FrameHost* host, FrameOwner* owner) 384 Frame::Frame(FrameClient* client, FrameHost* host, FrameOwner* owner)
380 : m_treeNode(this), 385 : m_treeNode(this),
381 m_host(host), 386 m_host(host),
382 m_owner(owner), 387 m_owner(owner),
383 m_client(client), 388 m_client(client),
384 m_isLoading(false) { 389 m_isLoading(false) {
385 InstanceCounters::incrementCounter(InstanceCounters::FrameCounter); 390 InstanceCounters::incrementCounter(InstanceCounters::FrameCounter);
386 391
387 ASSERT(page()); 392 ASSERT(page());
388 393
389 if (m_owner) 394 if (m_owner)
390 m_owner->setContentFrame(*this); 395 m_owner->setContentFrame(*this);
391 else 396 else
392 page()->setMainFrame(this); 397 page()->setMainFrame(this);
393 } 398 }
394 399
395 } // namespace blink 400 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698