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 "core/frame/DOMWindow.h" | 5 #include "core/frame/DOMWindow.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return this; | 62 return this; |
63 } | 63 } |
64 | 64 |
65 Location* DOMWindow::location() const { | 65 Location* DOMWindow::location() const { |
66 if (!m_location) | 66 if (!m_location) |
67 m_location = Location::create(const_cast<DOMWindow*>(this)); | 67 m_location = Location::create(const_cast<DOMWindow*>(this)); |
68 return m_location.get(); | 68 return m_location.get(); |
69 } | 69 } |
70 | 70 |
71 bool DOMWindow::closed() const { | 71 bool DOMWindow::closed() const { |
72 return m_windowIsClosing || !frame() || !frame()->host(); | 72 return m_windowIsClosing || !frame() || !frame()->page(); |
73 } | 73 } |
74 | 74 |
75 unsigned DOMWindow::length() const { | 75 unsigned DOMWindow::length() const { |
76 return frame() ? frame()->tree().scopedChildCount() : 0; | 76 return frame() ? frame()->tree().scopedChildCount() : 0; |
77 } | 77 } |
78 | 78 |
79 DOMWindow* DOMWindow::self() const { | 79 DOMWindow* DOMWindow::self() const { |
80 if (!frame()) | 80 if (!frame()) |
81 return nullptr; | 81 return nullptr; |
82 | 82 |
(...skipping 28 matching lines...) Expand all Loading... |
111 if (!frame()) | 111 if (!frame()) |
112 return nullptr; | 112 return nullptr; |
113 | 113 |
114 Frame* child = frame()->tree().scopedChild(index); | 114 Frame* child = frame()->tree().scopedChild(index); |
115 return child ? child->domWindow() : nullptr; | 115 return child ? child->domWindow() : nullptr; |
116 } | 116 } |
117 | 117 |
118 bool DOMWindow::isCurrentlyDisplayedInFrame() const { | 118 bool DOMWindow::isCurrentlyDisplayedInFrame() const { |
119 if (frame()) | 119 if (frame()) |
120 SECURITY_CHECK(frame()->domWindow() == this); | 120 SECURITY_CHECK(frame()->domWindow() == this); |
121 return frame() && frame()->host(); | 121 return frame() && frame()->page(); |
122 } | 122 } |
123 | 123 |
124 bool DOMWindow::isInsecureScriptAccess(LocalDOMWindow& callingWindow, | 124 bool DOMWindow::isInsecureScriptAccess(LocalDOMWindow& callingWindow, |
125 const KURL& url) { | 125 const KURL& url) { |
126 if (!url.protocolIsJavaScript()) | 126 if (!url.protocolIsJavaScript()) |
127 return false; | 127 return false; |
128 | 128 |
129 // If this DOMWindow isn't currently active in the Frame, then there's no | 129 // If this DOMWindow isn't currently active in the Frame, then there's no |
130 // way we should allow the access. | 130 // way we should allow the access. |
131 if (isCurrentlyDisplayedInFrame()) { | 131 if (isCurrentlyDisplayedInFrame()) { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 } | 422 } |
423 | 423 |
424 DEFINE_TRACE(DOMWindow) { | 424 DEFINE_TRACE(DOMWindow) { |
425 visitor->trace(m_frame); | 425 visitor->trace(m_frame); |
426 visitor->trace(m_inputCapabilities); | 426 visitor->trace(m_inputCapabilities); |
427 visitor->trace(m_location); | 427 visitor->trace(m_location); |
428 EventTargetWithInlineData::trace(visitor); | 428 EventTargetWithInlineData::trace(visitor); |
429 } | 429 } |
430 | 430 |
431 } // namespace blink | 431 } // namespace blink |
OLD | NEW |