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

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

Issue 2425663002: Add an error page for resources blocked via XSS Auditor. (Closed)
Patch Set: frameNavigation test. 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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" 51 #include "platform/UserGestureIndicator.h"
52 #include "platform/network/ResourceError.h"
52 53
53 namespace blink { 54 namespace blink {
54 55
55 using namespace HTMLNames; 56 using namespace HTMLNames;
56 57
57 Frame::~Frame() { 58 Frame::~Frame() {
58 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter); 59 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter);
59 ASSERT(!m_owner); 60 ASSERT(!m_owner);
60 } 61 }
61 62
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 framebustingNeedsSameOriginOrUserGestureEnabled()) 186 framebustingNeedsSameOriginOrUserGestureEnabled())
186 return true; 187 return true;
187 if (hasUserGesture || isAllowedNavigation) 188 if (hasUserGesture || isAllowedNavigation)
188 return true; 189 return true;
189 errorReason = 190 errorReason =
190 "The frame attempting navigation is targeting its top-level window, " 191 "The frame attempting navigation is targeting its top-level window, "
191 "but is neither same-origin with its target nor is it processing a " 192 "but is neither same-origin with its target nor is it processing a "
192 "user gesture. See " 193 "user gesture. See "
193 "https://www.chromestatus.com/features/5851021045661696."; 194 "https://www.chromestatus.com/features/5851021045661696.";
194 printNavigationErrorMessage(targetFrame, errorReason.latin1().data()); 195 printNavigationErrorMessage(targetFrame, errorReason.latin1().data());
195 if (isLocalFrame()) 196 if (isLocalFrame()) {
196 toLocalFrame(this)->navigationScheduler().schedulePageBlock( 197 toLocalFrame(this)->navigationScheduler().schedulePageBlock(
197 toLocalFrame(this)->document()); 198 toLocalFrame(this)->document(), ResourceError::ACCESS_DENIED);
199 }
198 return false; 200 return false;
199 } 201 }
200 if (!isAllowedNavigation && !errorReason.isNull()) 202 if (!isAllowedNavigation && !errorReason.isNull())
201 printNavigationErrorMessage(targetFrame, errorReason.latin1().data()); 203 printNavigationErrorMessage(targetFrame, errorReason.latin1().data());
202 return isAllowedNavigation; 204 return isAllowedNavigation;
203 } 205 }
204 206
205 bool Frame::canNavigateWithoutFramebusting(const Frame& targetFrame, 207 bool Frame::canNavigateWithoutFramebusting(const Frame& targetFrame,
206 String& reason) { 208 String& reason) {
207 if (securityContext()->isSandboxed(SandboxNavigation)) { 209 if (securityContext()->isSandboxed(SandboxNavigation)) {
(...skipping 122 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