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

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

Issue 2644633006: Add KURL::protocolIsJavascript member function (Closed)
Patch Set: 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/DOMWindow.h" 5 #include "core/frame/DOMWindow.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/ExceptionCode.h" 8 #include "core/dom/ExceptionCode.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "core/dom/SecurityContext.h" 10 #include "core/dom/SecurityContext.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return child ? child->domWindow() : nullptr; 125 return child ? child->domWindow() : nullptr;
126 } 126 }
127 127
128 bool DOMWindow::isCurrentlyDisplayedInFrame() const { 128 bool DOMWindow::isCurrentlyDisplayedInFrame() const {
129 if (frame()) 129 if (frame())
130 SECURITY_CHECK(frame()->domWindow() == this); 130 SECURITY_CHECK(frame()->domWindow() == this);
131 return frame() && frame()->host(); 131 return frame() && frame()->host();
132 } 132 }
133 133
134 bool DOMWindow::isInsecureScriptAccess(LocalDOMWindow& callingWindow, 134 bool DOMWindow::isInsecureScriptAccess(LocalDOMWindow& callingWindow,
135 const String& urlString) { 135 const KURL& url) {
136 if (!protocolIsJavaScript(urlString)) 136 if (!url.protocolIsJavaScript())
137 return false; 137 return false;
138 138
139 // If this DOMWindow isn't currently active in the Frame, then there's no 139 // If this DOMWindow isn't currently active in the Frame, then there's no
140 // way we should allow the access. 140 // way we should allow the access.
141 if (isCurrentlyDisplayedInFrame()) { 141 if (isCurrentlyDisplayedInFrame()) {
142 // FIXME: Is there some way to eliminate the need for a separate 142 // FIXME: Is there some way to eliminate the need for a separate
143 // "callingWindow == this" check? 143 // "callingWindow == this" check?
144 if (&callingWindow == this) 144 if (&callingWindow == this)
145 return false; 145 return false;
146 146
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); 436 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */);
437 } 437 }
438 438
439 DEFINE_TRACE(DOMWindow) { 439 DEFINE_TRACE(DOMWindow) {
440 visitor->trace(m_frame); 440 visitor->trace(m_frame);
441 visitor->trace(m_location); 441 visitor->trace(m_location);
442 EventTargetWithInlineData::trace(visitor); 442 EventTargetWithInlineData::trace(visitor);
443 } 443 }
444 444
445 } // namespace blink 445 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMWindow.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698