Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: third_party/WebKit/Source/core/frame/DOMWindow.cpp

Issue 1703883002: Eagerly unregister PostMessageTimer as a context observer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile fix Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/DOMWindow.cpp
diff --git a/third_party/WebKit/Source/core/frame/DOMWindow.cpp b/third_party/WebKit/Source/core/frame/DOMWindow.cpp
index 38b136e452995a55192f1820ca9f41103b775471..ebf7826339c91a59678df41fa1104ddb62a5a48a 100644
--- a/third_party/WebKit/Source/core/frame/DOMWindow.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMWindow.cpp
@@ -208,19 +208,19 @@ void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const Mes
else if (MixedContentChecker::isMixedContent(frame()->securityContext()->securityOrigin(), sourceDocument->url()))
UseCounter::count(frame(), UseCounter::PostMessageFromInsecureToSecure);
+ RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(channels.release(), message, sourceOrigin, String(), source, sourceSuborigin);
// Give the embedder a chance to intercept this postMessage. If the
// target is a remote frame, the message will be forwarded through the
// browser process.
- RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(channels.release(), message, sourceOrigin, String(), source, sourceSuborigin);
- bool didHandleMessageEvent = frame()->client()->willCheckAndDispatchMessageEvent(target.get(), event.get(), source->document()->frame());
- if (!didHandleMessageEvent) {
- // Capture stack trace only when inspector front-end is loaded as it may be time consuming.
- RefPtr<ScriptCallStack> stackTrace;
- if (InspectorInstrumentation::consoleAgentEnabled(sourceDocument))
- stackTrace = ScriptCallStack::capture();
-
- toLocalDOMWindow(this)->schedulePostMessage(event, source, target.get(), stackTrace.release());
- }
+ if (frame()->client()->willCheckAndDispatchMessageEvent(target.get(), event.get(), source->document()->frame()))
+ return;
+
+ // Capture stack trace only when inspector front-end is loaded as it may be time consuming.
+ RefPtr<ScriptCallStack> stackTrace;
+ if (InspectorInstrumentation::consoleAgentEnabled(sourceDocument))
+ stackTrace = ScriptCallStack::capture();
+
+ toLocalDOMWindow(this)->schedulePostMessage(event, target.get(), stackTrace.release());
}
// FIXME: Once we're throwing exceptions for cross-origin access violations, we will always sanitize the target

Powered by Google App Engine
This is Rietveld 408576698