Javascript in foreground tabs should not wait synchronously for plug-ins to load
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Sep 2012 19:08:11 +0000 (19:08 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Sep 2012 19:08:11 +0000 (19:08 +0000)
commit3d88154a7ce79611a22b70de2865516ef474a9fa
tree91ff3dd91b86b995b39596e7fd2693bff0881c27
parent44b90dfb1531fa1702d612def82d5b6855b54dfb
Javascript in foreground tabs should not wait synchronously for plug-ins to load
<rdar://problem/12067415> and https://bugs.webkit.org/show_bug.cgi?id=96167

Reviewed by Geoff Garen.

Source/WebKit2:

Synchronously waiting for initialization to complete when javascript accesses the plug-in script object severely
reduces the effectiveness of having an asynchronous NPP_New.

Such as with background tabs that have never been viewed, we already have cases where JS calls into the plug-in
element fail because we haven't bothered to initialize the plug-in.

We get a huge win by expanding that to foreground tabs that simply haven't finished initializing their plug-ins.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::scriptObject): If initialization is not complete just return 0 - They can get at the script object later.

Remove the notion of "wait for asynchronous initialization" altogether:
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
(NetscapePlugin):
* WebProcess/Plugins/PDF/BuiltInPDFView.h:
(BuiltInPDFView):
* WebProcess/Plugins/Plugin.h:
(Plugin):
* WebProcess/Plugins/PluginProxy.cpp:
* WebProcess/Plugins/PluginProxy.h:
(PluginProxy):

Tools:

Enhance the "Slow NPP_New" plug-in to also be able to return properties to javascript.

* DumpRenderTree/TestNetscapePlugIn/Tests/SlowNPPNew.cpp:
(PluginObject):
(SlowNPPNew::PluginObject::PluginObject):
(SlowNPPNew::PluginObject::~PluginObject):
(SlowNPPNew::PluginObject::hasProperty):
(SlowNPPNew::PluginObject::getProperty):
(SlowNPPNew::NPP_GetValue):
(SlowNPPNew):

LayoutTests:

* platform/mac-wk2/plugins/script-object-access-fails-during-slow-initialization-expected.txt: Added.
* platform/mac-wk2/plugins/script-object-access-fails-during-slow-initialization.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@128088 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/plugins/script-object-access-fails-during-slow-initialization-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/plugins/script-object-access-fails-during-slow-initialization.html [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h
Source/WebKit2/WebProcess/Plugins/Plugin.h
Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
Source/WebKit2/WebProcess/Plugins/PluginProxy.h
Source/WebKit2/WebProcess/Plugins/PluginView.cpp
Tools/ChangeLog
Tools/DumpRenderTree/TestNetscapePlugIn/Tests/SlowNPPNew.cpp