| 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 "bindings/core/v8/ScriptCallStack.h" | 7 #include "bindings/core/v8/ScriptCallStack.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
| 10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 KURL targetUrl = isLocalDOMWindow() ? document()->url() : KURL(KURL(), frame
()->securityContext()->securityOrigin()->toString()); | 205 KURL targetUrl = isLocalDOMWindow() ? document()->url() : KURL(KURL(), frame
()->securityContext()->securityOrigin()->toString()); |
| 206 if (MixedContentChecker::isMixedContent(sourceDocument->securityOrigin(), ta
rgetUrl)) | 206 if (MixedContentChecker::isMixedContent(sourceDocument->securityOrigin(), ta
rgetUrl)) |
| 207 UseCounter::count(frame(), UseCounter::PostMessageFromSecureToInsecure); | 207 UseCounter::count(frame(), UseCounter::PostMessageFromSecureToInsecure); |
| 208 else if (MixedContentChecker::isMixedContent(frame()->securityContext()->sec
urityOrigin(), sourceDocument->url())) | 208 else if (MixedContentChecker::isMixedContent(frame()->securityContext()->sec
urityOrigin(), sourceDocument->url())) |
| 209 UseCounter::count(frame(), UseCounter::PostMessageFromInsecureToSecure); | 209 UseCounter::count(frame(), UseCounter::PostMessageFromInsecureToSecure); |
| 210 | 210 |
| 211 // Give the embedder a chance to intercept this postMessage. If the | 211 // Give the embedder a chance to intercept this postMessage. If the |
| 212 // target is a remote frame, the message will be forwarded through the | 212 // target is a remote frame, the message will be forwarded through the |
| 213 // browser process. | 213 // browser process. |
| 214 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(channels.relea
se(), message, sourceOrigin, String(), source, sourceSuborigin); | 214 RawPtr<MessageEvent> event = MessageEvent::create(channels.release(), messag
e, sourceOrigin, String(), source, sourceSuborigin); |
| 215 bool didHandleMessageEvent = frame()->client()->willCheckAndDispatchMessageE
vent(target.get(), event.get(), source->document()->frame()); | 215 bool didHandleMessageEvent = frame()->client()->willCheckAndDispatchMessageE
vent(target.get(), event.get(), source->document()->frame()); |
| 216 if (!didHandleMessageEvent) { | 216 if (!didHandleMessageEvent) { |
| 217 // Capture stack trace only when inspector front-end is loaded as it may
be time consuming. | 217 // Capture stack trace only when inspector front-end is loaded as it may
be time consuming. |
| 218 RefPtr<ScriptCallStack> stackTrace; | 218 RefPtr<ScriptCallStack> stackTrace; |
| 219 if (InspectorInstrumentation::consoleAgentEnabled(sourceDocument)) | 219 if (InspectorInstrumentation::consoleAgentEnabled(sourceDocument)) |
| 220 stackTrace = ScriptCallStack::capture(); | 220 stackTrace = ScriptCallStack::capture(); |
| 221 | 221 |
| 222 toLocalDOMWindow(this)->schedulePostMessage(event, source, target.get(),
stackTrace.release()); | 222 toLocalDOMWindow(this)->schedulePostMessage(event, source, target.get(),
stackTrace.release()); |
| 223 } | 223 } |
| 224 } | 224 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */
); | 365 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */
); |
| 366 } | 366 } |
| 367 | 367 |
| 368 DEFINE_TRACE(DOMWindow) | 368 DEFINE_TRACE(DOMWindow) |
| 369 { | 369 { |
| 370 visitor->trace(m_location); | 370 visitor->trace(m_location); |
| 371 EventTargetWithInlineData::trace(visitor); | 371 EventTargetWithInlineData::trace(visitor); |
| 372 } | 372 } |
| 373 | 373 |
| 374 } // namespace blink | 374 } // namespace blink |
| OLD | NEW |