OLD | NEW |
---|---|
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 "config.h" | 5 #include "config.h" |
6 #include "core/frame/DOMWindow.h" | 6 #include "core/frame/DOMWindow.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptCallStackFactory.h" | 8 #include "bindings/core/v8/ScriptCallStackFactory.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 { | 113 { |
114 if (!frame()) | 114 if (!frame()) |
115 return nullptr; | 115 return nullptr; |
116 | 116 |
117 Frame* child = frame()->tree().scopedChild(index); | 117 Frame* child = frame()->tree().scopedChild(index); |
118 return child ? child->domWindow() : nullptr; | 118 return child ? child->domWindow() : nullptr; |
119 } | 119 } |
120 | 120 |
121 bool DOMWindow::isCurrentlyDisplayedInFrame() const | 121 bool DOMWindow::isCurrentlyDisplayedInFrame() const |
122 { | 122 { |
123 return frame() && frame()->domWindow() == this && frame()->host(); | 123 if (frame()) |
124 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(frame()->domWindow() == this); | |
125 return frame() && frame()->host(); | |
Nate Chapin
2015/09/29 21:49:00
Is this host() check necessary? Can a DOMWindow an
dcheng
2015/09/29 21:53:52
This doesn't affect when LocalDOMWindow::frame() b
| |
124 } | 126 } |
125 | 127 |
126 bool DOMWindow::isInsecureScriptAccess(LocalDOMWindow& callingWindow, const Stri ng& urlString) | 128 bool DOMWindow::isInsecureScriptAccess(LocalDOMWindow& callingWindow, const Stri ng& urlString) |
127 { | 129 { |
128 if (!protocolIsJavaScript(urlString)) | 130 if (!protocolIsJavaScript(urlString)) |
129 return false; | 131 return false; |
130 | 132 |
131 // If this DOMWindow isn't currently active in the Frame, then there's no | 133 // If this DOMWindow isn't currently active in the Frame, then there's no |
132 // way we should allow the access. | 134 // way we should allow the access. |
133 if (isCurrentlyDisplayedInFrame()) { | 135 if (isCurrentlyDisplayedInFrame()) { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 m_windowIsClosing = true; | 330 m_windowIsClosing = true; |
329 } | 331 } |
330 | 332 |
331 DEFINE_TRACE(DOMWindow) | 333 DEFINE_TRACE(DOMWindow) |
332 { | 334 { |
333 visitor->trace(m_location); | 335 visitor->trace(m_location); |
334 EventTargetWithInlineData::trace(visitor); | 336 EventTargetWithInlineData::trace(visitor); |
335 } | 337 } |
336 | 338 |
337 } // namespace blink | 339 } // namespace blink |
OLD | NEW |