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

Issue 8437093: Make PostMessageToJavaScript use new WebKit API instead of script. (Closed)

Created:
9 years, 1 month ago by dmichael (off chromium)
Modified:
9 years, 1 month ago
CC:
chromium-reviews, darin-cc_chromium.org
Visibility:
Public.

Description

Make PostMessageToJavaScript use new WebKit API instead of script. I added some JavaScript code to test_case.html that previously would have made PostMessage not function (which I verified). This depends on the following WebKit issue: https://bugs.webkit.org/show_bug.cgi?id=71478 BUG=82604 TEST=N/A Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=110513

Patch Set 1 #

Patch Set 2 : Add nefarious code to test_case.html to test the change. #

Total comments: 2

Patch Set 3 : Convert directly from PP_Var to v8::Value #

Total comments: 7

Patch Set 4 : Fix include order #

Total comments: 2

Patch Set 5 : Fixes based on review comments. #

Patch Set 6 : One more review fix. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+89 lines, -108 lines) Patch
M ppapi/tests/test_case.html View 1 2 1 chunk +22 lines, -0 lines 0 comments Download
M webkit/plugins/ppapi/message_channel.h View 2 chunks +5 lines, -10 lines 0 comments Download
M webkit/plugins/ppapi/message_channel.cc View 1 2 3 4 5 5 chunks +62 lines, -98 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
dmichael (off chromium)
9 years, 1 month ago (2011-11-03 21:55:37 UTC) #1
viettrungluu
It looks okay to me, though I'm not qualified to approve this change. You should ...
9 years, 1 month ago (2011-11-04 20:29:05 UTC) #2
dmichael (off chromium)
Don't worry, I'm probably not qualified to write this, either ;-) http://codereview.chromium.org/8437093/diff/2001/webkit/plugins/ppapi/message_channel.cc File webkit/plugins/ppapi/message_channel.cc (right): ...
9 years, 1 month ago (2011-11-04 20:50:32 UTC) #3
dmichael (off chromium)
+piman, since viettrungluu wasn't comfortable reviewing. I now directly convert from PP_Var to v8::Value (there ...
9 years, 1 month ago (2011-11-16 21:57:50 UTC) #4
darin (slow to review)
http://codereview.chromium.org/8437093/diff/12001/webkit/plugins/ppapi/message_channel.cc File webkit/plugins/ppapi/message_channel.cc (right): http://codereview.chromium.org/8437093/diff/12001/webkit/plugins/ppapi/message_channel.cc#newcode324 webkit/plugins/ppapi/message_channel.cc:324: WebKit::WebDOMEvent event = element.document().createEvent("MessageEvent"); nit: add a 'using WebKit::WebDOMEvent' ...
9 years, 1 month ago (2011-11-16 22:14:11 UTC) #5
piman
http://codereview.chromium.org/8437093/diff/8001/webkit/plugins/ppapi/message_channel.cc File webkit/plugins/ppapi/message_channel.cc (right): http://codereview.chromium.org/8437093/diff/8001/webkit/plugins/ppapi/message_channel.cc#newcode322 webkit/plugins/ppapi/message_channel.cc:322: const WebKit::WebElement& element = instance_->container()->element(); container() can be NULL ...
9 years, 1 month ago (2011-11-16 22:17:10 UTC) #6
dmichael (off chromium)
Thanks! Fixed based on comments. Note: It works locally, but I need to wait to ...
9 years, 1 month ago (2011-11-16 23:17:31 UTC) #7
piman
9 years, 1 month ago (2011-11-16 23:37:26 UTC) #8
lgtm

http://codereview.chromium.org/8437093/diff/8001/webkit/plugins/ppapi/message...
File webkit/plugins/ppapi/message_channel.cc (right):

http://codereview.chromium.org/8437093/diff/8001/webkit/plugins/ppapi/message...
webkit/plugins/ppapi/message_channel.cc:322: const WebKit::WebElement& element =
instance_->container()->element();
On 2011/11/16 23:17:31, dmichael wrote:
> On 2011/11/16 22:17:10, piman wrote:
> > container() can be NULL after the plugin has been removed from the DOM (but
> the
> > instance is not destroyed yet). I could see getting into that case if one
> sends
> > PostMessage from DidDestroyInstance. Well, to be safe, I think we should
> > (silently?) fail if container is NULL.
> Done. Agree it should be silent if it's a real possibility.
> 
> It's a little scary to me if we can lose the container and still have the
> PluginInstance;

It is expected because of re-entrancy cases. I guess they may only happen with
synchronous scriting, but the case is real: browser calls plugin which calls
back browser to remove self from the DOM.
The instance can't go away because it's on the stack. But the container has to
go away because the plugin isn't in the DOM any more.
PluginInstance is ref-counted, so you can't have any control over its lifetime,
however the WebPluginContainer is not (and is reset in PluginInstance::Delete),
so unless you control all references to PluginInstance, you can't guarantee that
it won't outlive the container.

> this is bound to bite us in other places. Here, I was careful to
> ensure that if the PluginInstance goes away, its MessageChannel goes away, and
> all tasks will not fire (due to using a WeakPtr in MessageChannel). I thought
> that was 'safe enough'. :-(

Powered by Google App Engine
This is Rietveld 408576698