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 "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 11 matching lines...) Expand all Loading... |
22 #include "core/inspector/ConsoleMessageStorage.h" | 22 #include "core/inspector/ConsoleMessageStorage.h" |
23 #include "core/inspector/InspectorInstrumentation.h" | 23 #include "core/inspector/InspectorInstrumentation.h" |
24 #include "core/loader/FrameLoaderClient.h" | 24 #include "core/loader/FrameLoaderClient.h" |
25 #include "core/loader/MixedContentChecker.h" | 25 #include "core/loader/MixedContentChecker.h" |
26 #include "core/page/ChromeClient.h" | 26 #include "core/page/ChromeClient.h" |
27 #include "core/page/FocusController.h" | 27 #include "core/page/FocusController.h" |
28 #include "core/page/Page.h" | 28 #include "core/page/Page.h" |
29 #include "platform/weborigin/KURL.h" | 29 #include "platform/weborigin/KURL.h" |
30 #include "platform/weborigin/SecurityOrigin.h" | 30 #include "platform/weborigin/SecurityOrigin.h" |
31 #include "platform/weborigin/Suborigin.h" | 31 #include "platform/weborigin/Suborigin.h" |
32 #include <memory> | |
33 | 32 |
34 namespace blink { | 33 namespace blink { |
35 | 34 |
36 DOMWindow::DOMWindow() | 35 DOMWindow::DOMWindow() |
37 : m_windowIsClosing(false) | 36 : m_windowIsClosing(false) |
38 { | 37 { |
39 } | 38 } |
40 | 39 |
41 DOMWindow::~DOMWindow() | 40 DOMWindow::~DOMWindow() |
42 { | 41 { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } else if (targetOrigin != "*") { | 190 } else if (targetOrigin != "*") { |
192 target = SecurityOrigin::createFromString(targetOrigin); | 191 target = SecurityOrigin::createFromString(targetOrigin); |
193 // It doesn't make sense target a postMessage at a unique origin | 192 // It doesn't make sense target a postMessage at a unique origin |
194 // because there's no way to represent a unique origin in a string. | 193 // because there's no way to represent a unique origin in a string. |
195 if (target->isUnique()) { | 194 if (target->isUnique()) { |
196 exceptionState.throwDOMException(SyntaxError, "Invalid target origin
'" + targetOrigin + "' in a call to 'postMessage'."); | 195 exceptionState.throwDOMException(SyntaxError, "Invalid target origin
'" + targetOrigin + "' in a call to 'postMessage'."); |
197 return; | 196 return; |
198 } | 197 } |
199 } | 198 } |
200 | 199 |
201 std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentangle
Ports(getExecutionContext(), ports, exceptionState); | 200 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(get
ExecutionContext(), ports, exceptionState); |
202 if (exceptionState.hadException()) | 201 if (exceptionState.hadException()) |
203 return; | 202 return; |
204 | 203 |
205 // Capture the source of the message. We need to do this synchronously | 204 // Capture the source of the message. We need to do this synchronously |
206 // in order to capture the source of the message correctly. | 205 // in order to capture the source of the message correctly. |
207 if (!sourceDocument) | 206 if (!sourceDocument) |
208 return; | 207 return; |
209 | 208 |
210 const SecurityOrigin* securityOrigin = sourceDocument->getSecurityOrigin(); | 209 const SecurityOrigin* securityOrigin = sourceDocument->getSecurityOrigin(); |
211 bool hasSuborigin = sourceDocument->getSecurityOrigin()->hasSuborigin(); | 210 bool hasSuborigin = sourceDocument->getSecurityOrigin()->hasSuborigin(); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */
); | 367 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */
); |
369 } | 368 } |
370 | 369 |
371 DEFINE_TRACE(DOMWindow) | 370 DEFINE_TRACE(DOMWindow) |
372 { | 371 { |
373 visitor->trace(m_location); | 372 visitor->trace(m_location); |
374 EventTargetWithInlineData::trace(visitor); | 373 EventTargetWithInlineData::trace(visitor); |
375 } | 374 } |
376 | 375 |
377 } // namespace blink | 376 } // namespace blink |
OLD | NEW |