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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 RefPtr<SecurityOrigin> target; | 171 RefPtr<SecurityOrigin> target; |
172 if (targetOrigin == "/") { | 172 if (targetOrigin == "/") { |
173 if (!sourceDocument) | 173 if (!sourceDocument) |
174 return; | 174 return; |
175 target = sourceDocument->getSecurityOrigin(); | 175 target = sourceDocument->getSecurityOrigin(); |
176 } else if (targetOrigin != "*") { | 176 } else if (targetOrigin != "*") { |
177 target = SecurityOrigin::createFromString(targetOrigin); | 177 target = SecurityOrigin::createFromString(targetOrigin); |
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(SyntaxError, |
182 SyntaxError, "Invalid target origin '" + targetOrigin + | 182 "Invalid target origin '" + |
183 "' in a call to 'postMessage'."); | 183 targetOrigin + |
| 184 "' in a call to 'postMessage'."); |
184 return; | 185 return; |
185 } | 186 } |
186 } | 187 } |
187 | 188 |
188 MessagePortChannelArray channels = MessagePort::disentanglePorts( | 189 MessagePortChannelArray channels = MessagePort::disentanglePorts( |
189 getExecutionContext(), ports, exceptionState); | 190 getExecutionContext(), ports, exceptionState); |
190 if (exceptionState.hadException()) | 191 if (exceptionState.hadException()) |
191 return; | 192 return; |
192 | 193 |
193 // Capture the source of the message. We need to do this synchronously | 194 // Capture the source of the message. We need to do this synchronously |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 } | 433 } |
433 | 434 |
434 DEFINE_TRACE(DOMWindow) { | 435 DEFINE_TRACE(DOMWindow) { |
435 visitor->trace(m_frame); | 436 visitor->trace(m_frame); |
436 visitor->trace(m_inputCapabilities); | 437 visitor->trace(m_inputCapabilities); |
437 visitor->trace(m_location); | 438 visitor->trace(m_location); |
438 EventTargetWithInlineData::trace(visitor); | 439 EventTargetWithInlineData::trace(visitor); |
439 } | 440 } |
440 | 441 |
441 } // namespace blink | 442 } // namespace blink |
OLD | NEW |