| 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/ExecutionContext.h" |
| 11 #include "core/dom/SecurityContext.h" | 12 #include "core/dom/SecurityContext.h" |
| 12 #include "core/events/MessageEvent.h" | 13 #include "core/events/MessageEvent.h" |
| 13 #include "core/frame/Frame.h" | 14 #include "core/frame/Frame.h" |
| 14 #include "core/frame/FrameClient.h" | 15 #include "core/frame/FrameClient.h" |
| 15 #include "core/frame/FrameConsole.h" | 16 #include "core/frame/FrameConsole.h" |
| 16 #include "core/frame/LocalDOMWindow.h" | 17 #include "core/frame/LocalDOMWindow.h" |
| 17 #include "core/frame/Location.h" | 18 #include "core/frame/Location.h" |
| 18 #include "core/frame/Settings.h" | 19 #include "core/frame/Settings.h" |
| 19 #include "core/frame/UseCounter.h" | 20 #include "core/frame/UseCounter.h" |
| 20 #include "core/inspector/ConsoleMessageStorage.h" | 21 #include "core/inspector/ConsoleMessageStorage.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 void DOMWindow::resetLocation() | 149 void DOMWindow::resetLocation() |
| 149 { | 150 { |
| 150 // Location needs to be reset manually because it doesn't inherit from DOMWi
ndowProperty. | 151 // Location needs to be reset manually because it doesn't inherit from DOMWi
ndowProperty. |
| 151 // DOMWindowProperty is local-only, and Location needs to support remote win
dows, too. | 152 // DOMWindowProperty is local-only, and Location needs to support remote win
dows, too. |
| 152 if (m_location) { | 153 if (m_location) { |
| 153 m_location->reset(); | 154 m_location->reset(); |
| 154 m_location = nullptr; | 155 m_location = nullptr; |
| 155 } | 156 } |
| 156 } | 157 } |
| 157 | 158 |
| 159 bool DOMWindow::isSecureContext() const |
| 160 { |
| 161 if (!frame()) |
| 162 return false; |
| 163 |
| 164 String unusedErrorMessage; |
| 165 return document()->isSecureContext(unusedErrorMessage, ExecutionContext::Sta
ndardSecureContextCheck); |
| 166 } |
| 167 |
| 158 void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const Mes
sagePortArray* ports, const String& targetOrigin, LocalDOMWindow* source, Except
ionState& exceptionState) | 168 void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const Mes
sagePortArray* ports, const String& targetOrigin, LocalDOMWindow* source, Except
ionState& exceptionState) |
| 159 { | 169 { |
| 160 if (!isCurrentlyDisplayedInFrame()) | 170 if (!isCurrentlyDisplayedInFrame()) |
| 161 return; | 171 return; |
| 162 | 172 |
| 163 Document* sourceDocument = source->document(); | 173 Document* sourceDocument = source->document(); |
| 164 | 174 |
| 165 // Compute the target origin. We need to do this synchronously in order | 175 // Compute the target origin. We need to do this synchronously in order |
| 166 // to generate the SyntaxError exception correctly. | 176 // to generate the SyntaxError exception correctly. |
| 167 RefPtr<SecurityOrigin> target; | 177 RefPtr<SecurityOrigin> target; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 m_windowIsClosing = true; | 338 m_windowIsClosing = true; |
| 329 } | 339 } |
| 330 | 340 |
| 331 DEFINE_TRACE(DOMWindow) | 341 DEFINE_TRACE(DOMWindow) |
| 332 { | 342 { |
| 333 visitor->trace(m_location); | 343 visitor->trace(m_location); |
| 334 EventTargetWithInlineData::trace(visitor); | 344 EventTargetWithInlineData::trace(visitor); |
| 335 } | 345 } |
| 336 | 346 |
| 337 } // namespace blink | 347 } // namespace blink |
| OLD | NEW |