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" |
11 #include "core/dom/SecurityContext.h" | 11 #include "core/dom/SecurityContext.h" |
12 #include "core/events/MessageEvent.h" | 12 #include "core/events/MessageEvent.h" |
13 #include "core/frame/Frame.h" | 13 #include "core/frame/Frame.h" |
14 #include "core/frame/FrameClient.h" | 14 #include "core/frame/FrameClient.h" |
15 #include "core/frame/LocalDOMWindow.h" | 15 #include "core/frame/LocalDOMWindow.h" |
16 #include "core/frame/Location.h" | 16 #include "core/frame/Location.h" |
17 #include "core/frame/UseCounter.h" | 17 #include "core/frame/UseCounter.h" |
18 #include "core/inspector/InspectorInstrumentation.h" | 18 #include "core/inspector/InspectorInstrumentation.h" |
19 #include "core/inspector/ScriptCallStack.h" | 19 #include "core/inspector/ScriptCallStack.h" |
20 #include "core/loader/MixedContentChecker.h" | 20 #include "core/loader/MixedContentChecker.h" |
21 #include "platform/weborigin/KURL.h" | 21 #include "platform/weborigin/KURL.h" |
22 #include "platform/weborigin/SecurityOrigin.h" | 22 #include "platform/weborigin/SecurityOrigin.h" |
23 | 23 |
24 namespace blink { | 24 namespace blink { |
25 | 25 |
26 DOMWindow::DOMWindow() | |
27 : m_windowIsClosing(false) | |
28 { | |
29 } | |
30 | |
26 DOMWindow::~DOMWindow() | 31 DOMWindow::~DOMWindow() |
27 { | 32 { |
28 } | 33 } |
29 | 34 |
30 Location* DOMWindow::location() const | 35 Location* DOMWindow::location() const |
31 { | 36 { |
32 if (!m_location) | 37 if (!m_location) |
33 m_location = Location::create(frame()); | 38 m_location = Location::create(frame()); |
34 return m_location.get(); | 39 return m_location.get(); |
35 } | 40 } |
36 | 41 |
37 bool DOMWindow::closed() const | 42 bool DOMWindow::closed() const |
38 { | 43 { |
39 return !frame() || !frame()->host(); | 44 return m_windowIsClosing || !frame() || !frame()->host(); |
haraken
2015/04/05 15:06:36
Do we still need the '!frame() || !frame()->host()
sof
2015/04/05 15:09:42
Yes, windows.close() is just the programmatic way
| |
40 } | 45 } |
41 | 46 |
42 unsigned DOMWindow::length() const | 47 unsigned DOMWindow::length() const |
43 { | 48 { |
44 return frame() ? frame()->tree().scopedChildCount() : 0; | 49 return frame() ? frame()->tree().scopedChildCount() : 0; |
45 } | 50 } |
46 | 51 |
47 DOMWindow* DOMWindow::self() const | 52 DOMWindow* DOMWindow::self() const |
48 { | 53 { |
49 if (!frame()) | 54 if (!frame()) |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 } | 185 } |
181 } | 186 } |
182 | 187 |
183 DEFINE_TRACE(DOMWindow) | 188 DEFINE_TRACE(DOMWindow) |
184 { | 189 { |
185 visitor->trace(m_location); | 190 visitor->trace(m_location); |
186 EventTargetWithInlineData::trace(visitor); | 191 EventTargetWithInlineData::trace(visitor); |
187 } | 192 } |
188 | 193 |
189 } // namespace blink | 194 } // namespace blink |
OLD | NEW |