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/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
9 #include "core/dom/SecurityContext.h" | 9 #include "core/dom/SecurityContext.h" |
10 #include "core/events/MessageEvent.h" | 10 #include "core/events/MessageEvent.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // It doesn't make sense target a postMessage at a unique origin | 177 // It doesn't make sense target a postMessage at a unique origin |
178 // because there's no way to represent a unique origin in a string. | 178 // because there's no way to represent a unique origin in a string. |
179 if (target->isUnique()) { | 179 if (target->isUnique()) { |
180 exceptionState.throwDOMException( | 180 exceptionState.throwDOMException( |
181 SyntaxError, "Invalid target origin '" + targetOrigin + | 181 SyntaxError, "Invalid target origin '" + targetOrigin + |
182 "' in a call to 'postMessage'."); | 182 "' in a call to 'postMessage'."); |
183 return; | 183 return; |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 std::unique_ptr<MessagePortChannelArray> channels = | 187 MessagePortChannelArray channels = MessagePort::disentanglePorts( |
188 MessagePort::disentanglePorts(getExecutionContext(), ports, | 188 getExecutionContext(), ports, exceptionState); |
189 exceptionState); | |
190 if (exceptionState.hadException()) | 189 if (exceptionState.hadException()) |
191 return; | 190 return; |
192 | 191 |
193 // Capture the source of the message. We need to do this synchronously | 192 // Capture the source of the message. We need to do this synchronously |
194 // in order to capture the source of the message correctly. | 193 // in order to capture the source of the message correctly. |
195 if (!sourceDocument) | 194 if (!sourceDocument) |
196 return; | 195 return; |
197 | 196 |
198 const SecurityOrigin* securityOrigin = sourceDocument->getSecurityOrigin(); | 197 const SecurityOrigin* securityOrigin = sourceDocument->getSecurityOrigin(); |
199 bool hasSuborigin = sourceDocument->getSecurityOrigin()->hasSuborigin(); | 198 bool hasSuborigin = sourceDocument->getSecurityOrigin()->hasSuborigin(); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); | 424 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); |
426 } | 425 } |
427 | 426 |
428 DEFINE_TRACE(DOMWindow) { | 427 DEFINE_TRACE(DOMWindow) { |
429 visitor->trace(m_frame); | 428 visitor->trace(m_frame); |
430 visitor->trace(m_location); | 429 visitor->trace(m_location); |
431 EventTargetWithInlineData::trace(visitor); | 430 EventTargetWithInlineData::trace(visitor); |
432 } | 431 } |
433 | 432 |
434 } // namespace blink | 433 } // namespace blink |
OLD | NEW |