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