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

Unified Diff: components/html_viewer/html_frame.cc

Issue 1367333002: Remove WebDocument::createEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | components/plugins/renderer/loadable_plugin_placeholder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/html_viewer/html_frame.cc
diff --git a/components/html_viewer/html_frame.cc b/components/html_viewer/html_frame.cc
index edaed4f2c63cd875ffa769a50c1c4d5da377ba7f..968eefde88cc44a95f665e300dbe0f04f79f930b 100644
--- a/components/html_viewer/html_frame.cc
+++ b/components/html_viewer/html_frame.cc
@@ -748,20 +748,6 @@ void HTMLFrame::OnPostMessageEvent(uint32_t source_frame_id,
serialized_script_value = blink::WebSerializedScriptValue::fromString(
serialized_event->data.To<blink::WebString>());
- blink::WebMessagePortChannelArray channels;
-
- // Create an event with the message. The next-to-last parameter to
- // initMessageEvent is the last event ID, which is not used with postMessage.
- blink::WebDOMEvent event =
- target_web_frame->document().createEvent("MessageEvent");
- blink::WebDOMMessageEvent msg_event = event.to<blink::WebDOMMessageEvent>();
- msg_event.initMessageEvent(
- "message",
- // |canBubble| and |cancellable| are always false
- false, false, serialized_script_value,
- serialized_event->source_origin.To<blink::WebString>(),
- source->web_frame_, target_web_frame->document(), "", channels);
-
// We must pass in the target_origin to do the security check on this side,
// since it may have changed since the original postMessage call was made.
blink::WebSecurityOrigin target_origin;
@@ -769,6 +755,13 @@ void HTMLFrame::OnPostMessageEvent(uint32_t source_frame_id,
target_origin = blink::WebSecurityOrigin::createFromString(
serialized_event->target_origin.To<blink::WebString>());
}
+
+ // TODO(esprehn): Shouldn't this also fill in channels like RenderFrameImpl?
+ blink::WebMessagePortChannelArray channels;
+ blink::WebDOMMessageEvent msg_event(serialized_script_value,
+ serialized_event->source_origin.To<blink::WebString>(),
+ source->web_frame_, target_web_frame->document(), channels);
+
target_web_frame->dispatchMessageEventWithOriginCheck(target_origin,
msg_event);
}
« no previous file with comments | « no previous file | components/plugins/renderer/loadable_plugin_placeholder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698