Threading issues regarding Netscape API plugins in WebKit
Hi, Are plugins implemented by using Netscape APIs in WebKit thread safe? Does Netscape APIs in WebKit have similar APIs like NPN_PluginThreadAsyncCall (refer to <http://developer.mozilla.org/en/docs/NPN_PluginThreadAsyncCall> http://developer.mozilla.org/en/docs/NPN_PluginThreadAsyncCall) in Gecko SDK in Mozilla? Will a new thread pawned from plugin main thread be able to invoke any JavaScript methods in browser? Thanks in advance! /Song
On Sep 28, 2007, at 10:26 AM, Song Yuan wrote:
Does Netscape APIs in WebKit have similar APIs like NPN_PluginThreadAsyncCall (refer to http://developer.mozilla.org/en/docs/NPN_PluginThreadAsyncCall) in Gecko SDK in Mozilla?
No. Is this in shipping versions of Firefox? I had the impression this was just invented and was planned for a future version.
Will a new thread pawned from plugin main thread be able to invoke any JavaScript methods in browser?
This may work, but has not been extensively tested. So it's probably not a good idea to use this in production code, but it's something you could experiment with. The JavaScript engine has support for use from multiple threads because of its use in proxy auto-configuration files. -- Darin
Darin and Timothy, thanks a lot for your reply! On 9/28/07, Darin Adler <darin@apple.com> wrote:
On Sep 28, 2007, at 10:26 AM, Song Yuan wrote:
Does Netscape APIs in WebKit have similar APIs like NPN_PluginThreadAsyncCall (refer to http://developer.mozilla.org/en/docs/NPN_PluginThreadAsyncCall) in Gecko SDK in Mozilla?
No.
That's bad news. Does WebKit have any plan to enclose support for such APIs in future releases?
Is this in shipping versions of Firefox? I had the impression this was just invented and was planned for a future version.
No, it's not shipped yet. You are right that it's only planned in Gecko 1.9 with Firefox 3.0.
Will a new thread pawned from plugin main thread be able to invoke any JavaScript methods in browser?
This may work, but has not been extensively tested. So it's probably not a good idea to use this in production code, but it's something you could experiment with.
The JavaScript engine has support for use from multiple threads because of its use in proxy auto-configuration files.
OK. Another question is whether JavaScript in WebKit can spawn new threads and invoke scriptable APIs of plugin in different context. If yes, that would achieve the same goal. JavaScript in Firefox can make it by using XPCOM like "@mozilla.org/thread", "@mozilla.org/event-queue-service", etc. On 9/28/07, Timothy Hatcher <timothy@hatcher.name> wrote:
WebKit does not implement NPN_PluginThreadAsyncCall. A plugin could spawn another thread, but it can not call JavaScript (or any other API call) from that other thread.
OK. That's definite answer.
WebKit does not implement NPN_PluginThreadAsyncCall. A plugin could spawn another thread, but it can not call JavaScript (or any other API call) from that other thread. On Sep 28, 2007, at 10:26 AM, Song Yuan wrote:
Are plugins implemented by using Netscape APIs in WebKit thread safe? Does Netscape APIs in WebKit have similar APIs like NPN_PluginThreadAsyncCall (refer to http://developer.mozilla.org/en/docs/NPN_PluginThreadAsyncCall) in Gecko SDK in Mozilla? Will a new thread pawned from plugin main thread be able to invoke any JavaScript methods in browser?
— Timothy Hatcher
participants (3)
-
Darin Adler
-
Song Yuan
-
Timothy Hatcher