Title: [134991] branches/safari-536.28-branch

Diff

Modified: branches/safari-536.28-branch/LayoutTests/ChangeLog (134990 => 134991)


--- branches/safari-536.28-branch/LayoutTests/ChangeLog	2012-11-16 21:01:00 UTC (rev 134990)
+++ branches/safari-536.28-branch/LayoutTests/ChangeLog	2012-11-16 21:29:30 UTC (rev 134991)
@@ -1,3 +1,17 @@
+2012-11-16  Lucas Forschler  <lforsch...@apple.com>
+
+        Merge r128088
+
+    2012-09-10  Brady Eidson  <beid...@apple.com>
+
+            _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.
+
+            * 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.
+
 2012-11-15  Andy Estes  <aes...@apple.com>
 
         Merge r130266.

Copied: branches/safari-536.28-branch/LayoutTests/platform/mac-wk2/plugins/script-object-access-fails-during-slow-initialization-expected.txt (from rev 128088, trunk/LayoutTests/platform/mac-wk2/plugins/script-object-access-fails-during-slow-initialization-expected.txt) (0 => 134991)


--- branches/safari-536.28-branch/LayoutTests/platform/mac-wk2/plugins/script-object-access-fails-during-slow-initialization-expected.txt	                        (rev 0)
+++ branches/safari-536.28-branch/LayoutTests/platform/mac-wk2/plugins/script-object-access-fails-during-slow-initialization-expected.txt	2012-11-16 21:29:30 UTC (rev 134991)
@@ -0,0 +1,8 @@
+
+Tests that accessing the script object of a plug-in that hasn't been initialized fails instead of waiting for initialization to finish.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Accessing the property took less than 550ms, meaning the plug-in had not finished initializing after our call to the plug-in script object returned.
+

Copied: branches/safari-536.28-branch/LayoutTests/platform/mac-wk2/plugins/script-object-access-fails-during-slow-initialization.html (from rev 128088, trunk/LayoutTests/platform/mac-wk2/plugins/script-object-access-fails-during-slow-initialization.html) (0 => 134991)


--- branches/safari-536.28-branch/LayoutTests/platform/mac-wk2/plugins/script-object-access-fails-during-slow-initialization.html	                        (rev 0)
+++ branches/safari-536.28-branch/LayoutTests/platform/mac-wk2/plugins/script-object-access-fails-during-slow-initialization.html	2012-11-16 21:29:30 UTC (rev 134991)
@@ -0,0 +1,47 @@
+<head>
+<script src=""
+<script>
+
+var startTime = new Date;
+
+if (window.testRunner) {
+    testRunner.overridePreference("WebKit2AsynchronousPluginInitializationEnabled", "1");
+    testRunner.overridePreference("WebKit2AsynchronousPluginInitializationEnabledForAllPlugins", "1");
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function runTest() 
+{
+    if (!window.testRunner) {
+        debug("This test can only run from within DumpRenderTree because it requires test runner internals.\n");
+        return;
+    }
+    
+    var pluginElement = document.getElementById("TestElement");
+    var testProperty = pluginElement.fooBar;
+    
+    if (testProperty)
+        testFailed("testProperty should not have returned anything, but it returned " + testProperty);
+
+    var endTime = new Date;
+    if (endTime - startTime > 549)
+        testFailed("This test took over 549ms meaning the plug-in with a 550ms startup delay was actually initialized.  It never should've been initialized.");
+    else
+        testPassed("Accessing the property took less than 550ms, meaning the plug-in had not finished initializing after our call to the plug-in script object returned.");
+
+    testRunner.notifyDone();
+}
+</script>
+
+</head>
+<body _onload_="setTimeout('runTest()', 0)">
+<embed id="TestElement" type="application/x-webkit-test-netscape" test="slow-npp-new"></embed>
+<p id="description"></p>
+<div id="console"></div>
+</body>
+
+<script>
+description("Tests that accessing the script object of a plug-in that hasn't been initialized fails instead of waiting for initialization to finish.");
+var unused = document.body.offsetTop;
+</script>

Modified: branches/safari-536.28-branch/Source/WebKit2/ChangeLog (134990 => 134991)


--- branches/safari-536.28-branch/Source/WebKit2/ChangeLog	2012-11-16 21:01:00 UTC (rev 134990)
+++ branches/safari-536.28-branch/Source/WebKit2/ChangeLog	2012-11-16 21:29:30 UTC (rev 134991)
@@ -1,3 +1,36 @@
+2012-11-16  Lucas Forschler  <lforsch...@apple.com>
+
+        Merge r128088
+
+    2012-09-10  Brady Eidson  <beid...@apple.com>
+
+            _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.
+
+            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):
+
 2012-11-15  Lucas Forschler  <lforsch...@apple.com>
 
         Merge r130347

Modified: branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (134990 => 134991)


--- branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2012-11-16 21:01:00 UTC (rev 134990)
+++ branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2012-11-16 21:29:30 UTC (rev 134991)
@@ -53,7 +53,6 @@
     static PassRefPtr<NetscapePlugin> fromNPP(NPP);
 
     // In-process NetscapePlugins don't support asynchronous initialization.
-    virtual void waitForAsynchronousInitialization() { }
     virtual bool isBeingAsynchronouslyInitialized() const { return false; }
 
 #if PLATFORM(MAC)

Modified: branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h (134990 => 134991)


--- branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2012-11-16 21:01:00 UTC (rev 134990)
+++ branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2012-11-16 21:29:30 UTC (rev 134991)
@@ -51,7 +51,6 @@
     static WebCore::PluginInfo pluginInfo();
 
     // In-process PDFViews don't support asynchronous initialization.
-    virtual void waitForAsynchronousInitialization() { }
     virtual bool isBeingAsynchronouslyInitialized() const { return false; }
 
 private:

Modified: branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h (134990 => 134991)


--- branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h	2012-11-16 21:01:00 UTC (rev 134990)
+++ branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h	2012-11-16 21:29:30 UTC (rev 134991)
@@ -83,8 +83,6 @@
     // Sets the active plug-in controller and initializes the plug-in.
     bool initialize(PluginController*, const Parameters&);
 
-    // Forces synchronous initialization of a plugin previously initialized asynchronously.
-    virtual void waitForAsynchronousInitialization() = 0;
     virtual bool isBeingAsynchronouslyInitialized() const = 0;
 
     // Destroys the plug-in.

Modified: branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (134990 => 134991)


--- branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2012-11-16 21:01:00 UTC (rev 134990)
+++ branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2012-11-16 21:29:30 UTC (rev 134991)
@@ -123,14 +123,6 @@
     return controller()->asynchronousPluginInitializationEnabled() && (m_connection->supportsAsynchronousPluginInitialization() || controller()->asynchronousPluginInitializationEnabledForAllPlugins());
 }
 
-void PluginProxy::waitForAsynchronousInitialization()
-{
-    ASSERT(!m_isStarted);
-    ASSERT(m_waitingOnAsynchronousInitialization);
-
-    initializeSynchronously();
-}
-
 bool PluginProxy::initializeSynchronously()
 {
     ASSERT(m_pendingPluginCreationParameters);

Modified: branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h (134990 => 134991)


--- branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2012-11-16 21:01:00 UTC (rev 134990)
+++ branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2012-11-16 21:29:30 UTC (rev 134991)
@@ -71,7 +71,6 @@
     virtual bool initialize(const Parameters&);
     bool initializeSynchronously();
 
-    virtual void waitForAsynchronousInitialization();
     virtual void destroy();
     virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect);
     virtual PassRefPtr<ShareableBitmap> snapshot();

Modified: branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (134990 => 134991)


--- branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-11-16 21:01:00 UTC (rev 134990)
+++ branches/safari-536.28-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-11-16 21:29:30 UTC (rev 134991)
@@ -545,19 +545,8 @@
     if (m_isWaitingForSynchronousInitialization)
         return 0;
 
-    // The plug-in can be null here if it failed to initialize previously.
-    if (!m_plugin)
-        return 0;
-
-    // If the plug-in exists but is not initialized then we're still initializing asynchronously.
-    // We need to wait here until initialization has either succeeded or failed.
-    if (m_plugin->isBeingAsynchronouslyInitialized()) {
-        m_isWaitingForSynchronousInitialization = true;
-        m_plugin->waitForAsynchronousInitialization();
-        m_isWaitingForSynchronousInitialization = false;
-    }
-
-    // The plug-in can be null here if it still failed to initialize.
+    // We might not have started initialization of the plug-in yet, the plug-in might be in the middle
+    // of being initializing asynchronously, or initialization might have previously failed.
     if (!m_isInitialized || !m_plugin)
         return 0;
 

Modified: branches/safari-536.28-branch/Tools/ChangeLog (134990 => 134991)


--- branches/safari-536.28-branch/Tools/ChangeLog	2012-11-16 21:01:00 UTC (rev 134990)
+++ branches/safari-536.28-branch/Tools/ChangeLog	2012-11-16 21:29:30 UTC (rev 134991)
@@ -1,3 +1,25 @@
+2012-11-16  Lucas Forschler  <lforsch...@apple.com>
+
+        Merge r128088
+
+    2012-09-10  Brady Eidson  <beid...@apple.com>
+
+            _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.
+
+            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):
+
 2012-11-15  Lucas Forschler  <lforsch...@apple.com>
 
         Merge r127595

Modified: branches/safari-536.28-branch/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/SlowNPPNew.cpp (134990 => 134991)


--- branches/safari-536.28-branch/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/SlowNPPNew.cpp	2012-11-16 21:01:00 UTC (rev 134990)
+++ branches/safari-536.28-branch/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/SlowNPPNew.cpp	2012-11-16 21:29:30 UTC (rev 134991)
@@ -37,7 +37,46 @@
     }
     
 private:
+    class PluginObject : public Object<PluginObject> {
+    public:
+        PluginObject()
+        {
+        }
+
+        ~PluginObject()
+        {
+        }
+
+        bool hasProperty(NPIdentifier propertyName)
+        {
+            return true;
+        }
+
+        bool getProperty(NPIdentifier propertyName, NPVariant* result)
+        {
+            static const char* message = "My name is ";
+            char* propertyString = pluginTest()->NPN_UTF8FromIdentifier(propertyName);
+            
+            int bufferLength = strlen(propertyString) + strlen(message) + 1;
+            char* resultBuffer = static_cast<char*>(pluginTest()->NPN_MemAlloc(bufferLength));
+            snprintf(resultBuffer, bufferLength, "%s%s", message, propertyString);
+            
+            STRINGZ_TO_NPVARIANT(resultBuffer, *result);
+
+            return true;
+        }
+    };
     
+    virtual NPError NPP_GetValue(NPPVariable variable, void *value)
+    {
+        if (variable != NPPVpluginScriptableNPObject)
+            return NPERR_GENERIC_ERROR;
+        
+        *(NPObject**)value = PluginObject::create(this);
+        
+        return NPERR_NO_ERROR;
+    }
+
     virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *saved)
     {
         usleep(550000);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to