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

Side by Side Diff: Source/core/frame/LocalFrame.cpp

Issue 1085973003: Make error messages for cross-domain access OOPIF-friendly. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase (pull in CL to print errors on calling window) Created 5 years, 8 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 m_supplements.clear(); 280 m_supplements.clear();
281 } 281 }
282 282
283 SecurityContext* LocalFrame::securityContext() const 283 SecurityContext* LocalFrame::securityContext() const
284 { 284 {
285 return document(); 285 return document();
286 } 286 }
287 287
288 void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const cha r* reason) 288 void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const cha r* reason)
289 { 289 {
290 if (!targetFrame.isLocalFrame()) 290 // URLs aren't available for RemoteFrames, so the error message uses their
291 return; 291 // origin instead.
292 292 String targetFrameDescription = targetFrame.isLocalFrame() ? "with URL '" + toLocalFrame(targetFrame).document()->url().string() + "'" : "with origin '" + t argetFrame.securityContext()->securityOrigin()->toString() + "'";
293 const LocalFrame& targetLocalFrame = toLocalFrameTemporary(targetFrame); 293 String message = "Unsafe JavaScript attempt to initiate navigation for frame " + targetFrameDescription + " from frame with URL '" + document()->url().strin g() + "'. " + reason + "\n";
294 String message = "Unsafe JavaScript attempt to initiate navigation for frame with URL '" + targetLocalFrame.document()->url().string() + "' from frame with URL '" + document()->url().string() + "'. " + reason + "\n";
295 294
296 localDOMWindow()->printErrorMessage(message); 295 localDOMWindow()->printErrorMessage(message);
297 } 296 }
298 297
299 bool LocalFrame::isLoadingAsChild() const 298 bool LocalFrame::isLoadingAsChild() const
300 { 299 {
301 return isLoading() || !document()->isLoadCompleted(); 300 return isLoading() || !document()->isLoadCompleted();
302 } 301 }
303 302
304 WindowProxyManager* LocalFrame::windowProxyManager() const 303 WindowProxyManager* LocalFrame::windowProxyManager() const
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 , m_textZoomFactor(parentTextZoomFactor(this)) 814 , m_textZoomFactor(parentTextZoomFactor(this))
816 , m_inViewSourceMode(false) 815 , m_inViewSourceMode(false)
817 { 816 {
818 if (isLocalRoot()) 817 if (isLocalRoot())
819 m_instrumentingAgents = InstrumentingAgents::create(); 818 m_instrumentingAgents = InstrumentingAgents::create();
820 else 819 else
821 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 820 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
822 } 821 }
823 822
824 } // namespace blink 823 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698