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

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: Test. Created 4 years 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/feature_policy/FeaturePolicy.h" 51 #include "platform/feature_policy/FeaturePolicy.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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 framebustingNeedsSameOriginOrUserGestureEnabled()) 189 framebustingNeedsSameOriginOrUserGestureEnabled())
189 return true; 190 return true;
190 if (hasUserGesture || isAllowedNavigation) 191 if (hasUserGesture || isAllowedNavigation)
191 return true; 192 return true;
192 errorReason = 193 errorReason =
193 "The frame attempting navigation is targeting its top-level window, " 194 "The frame attempting navigation is targeting its top-level window, "
194 "but is neither same-origin with its target nor is it processing a " 195 "but is neither same-origin with its target nor is it processing a "
195 "user gesture. See " 196 "user gesture. See "
196 "https://www.chromestatus.com/features/5851021045661696."; 197 "https://www.chromestatus.com/features/5851021045661696.";
197 printNavigationErrorMessage(targetFrame, errorReason.latin1().data()); 198 printNavigationErrorMessage(targetFrame, errorReason.latin1().data());
198 if (isLocalFrame()) 199 if (isLocalFrame()) {
199 toLocalFrame(this)->navigationScheduler().schedulePageBlock( 200 toLocalFrame(this)->navigationScheduler().schedulePageBlock(
200 toLocalFrame(this)->document()); 201 toLocalFrame(this)->document(), ResourceError::ACCESS_DENIED);
202 }
201 return false; 203 return false;
202 } 204 }
203 if (!isAllowedNavigation && !errorReason.isNull()) 205 if (!isAllowedNavigation && !errorReason.isNull())
204 printNavigationErrorMessage(targetFrame, errorReason.latin1().data()); 206 printNavigationErrorMessage(targetFrame, errorReason.latin1().data());
205 return isAllowedNavigation; 207 return isAllowedNavigation;
206 } 208 }
207 209
208 bool Frame::canNavigateWithoutFramebusting(const Frame& targetFrame, 210 bool Frame::canNavigateWithoutFramebusting(const Frame& targetFrame,
209 String& reason) { 211 String& reason) {
210 if (&targetFrame == this) 212 if (&targetFrame == this)
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 344
343 ASSERT(page()); 345 ASSERT(page());
344 346
345 if (m_owner) 347 if (m_owner)
346 m_owner->setContentFrame(*this); 348 m_owner->setContentFrame(*this);
347 else 349 else
348 page()->setMainFrame(this); 350 page()->setMainFrame(this);
349 } 351 }
350 352
351 } // namespace blink 353 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698