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 <memory> | 7 #include <memory> |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // It doesn't make sense target a postMessage at a unique origin | 178 // It doesn't make sense target a postMessage at a unique origin |
179 // because there's no way to represent a unique origin in a string. | 179 // because there's no way to represent a unique origin in a string. |
180 if (target->isUnique()) { | 180 if (target->isUnique()) { |
181 exceptionState.throwDOMException( | 181 exceptionState.throwDOMException( |
182 SyntaxError, "Invalid target origin '" + targetOrigin + | 182 SyntaxError, "Invalid target origin '" + targetOrigin + |
183 "' in a call to 'postMessage'."); | 183 "' in a call to 'postMessage'."); |
184 return; | 184 return; |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 std::unique_ptr<MessagePortChannelArray> channels = | 188 MessagePortChannelArray channels = MessagePort::disentanglePorts( |
189 MessagePort::disentanglePorts(getExecutionContext(), ports, | 189 getExecutionContext(), ports, exceptionState); |
190 exceptionState); | |
191 if (exceptionState.hadException()) | 190 if (exceptionState.hadException()) |
192 return; | 191 return; |
193 | 192 |
194 // Capture the source of the message. We need to do this synchronously | 193 // Capture the source of the message. We need to do this synchronously |
195 // in order to capture the source of the message correctly. | 194 // in order to capture the source of the message correctly. |
196 if (!sourceDocument) | 195 if (!sourceDocument) |
197 return; | 196 return; |
198 | 197 |
199 const SecurityOrigin* securityOrigin = sourceDocument->getSecurityOrigin(); | 198 const SecurityOrigin* securityOrigin = sourceDocument->getSecurityOrigin(); |
200 bool hasSuborigin = sourceDocument->getSecurityOrigin()->hasSuborigin(); | 199 bool hasSuborigin = sourceDocument->getSecurityOrigin()->hasSuborigin(); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 } | 432 } |
434 | 433 |
435 DEFINE_TRACE(DOMWindow) { | 434 DEFINE_TRACE(DOMWindow) { |
436 visitor->trace(m_frame); | 435 visitor->trace(m_frame); |
437 visitor->trace(m_inputCapabilities); | 436 visitor->trace(m_inputCapabilities); |
438 visitor->trace(m_location); | 437 visitor->trace(m_location); |
439 EventTargetWithInlineData::trace(visitor); | 438 EventTargetWithInlineData::trace(visitor); |
440 } | 439 } |
441 | 440 |
442 } // namespace blink | 441 } // namespace blink |
OLD | NEW |