Title: [148860] trunk
Revision
148860
Author
[email protected]
Date
2013-04-22 00:25:12 -0700 (Mon, 22 Apr 2013)

Log Message

[WebKit2] Plugins without a MIME Type fail to load
https://bugs.webkit.org/show_bug.cgi?id=112834

Reviewed by Benjamin Poulain.

Source/WebKit2:

The problem is that when the plugin is created and the MIME Type
is empty, since the MIME Type guessed in the UI process using the
plugin extension is not passed to the WebProcess, when the plugin
is instantiated, the value of NPMIMEType parameter passed to
NPP_New is NULL, and NPERR_INVALID_INSTANCE_ERROR is returned.
GetPluginPath message has been renamed to FindPlugin, since it
doesn't only return the path but also the new MIME Type and load
policy.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::findPlugin): Receive an output newMIMEType
parameter that is passed to PluginModuleInfo::findPlugin() so that
in case of guessing the MIME Type, the new one is passed back to
the WebProcess.
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::createPlugin): Pass the MIME Type
from the parameters to WebPage::createPlugin.
(WebKit::WebFrameLoaderClient::recreatePlugin): Pass a newMIMEType
parameter to WebPage::createPlugin.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin): Add newMIMEType out parameter and
pass it to the FindPlugin message.
(WebKit::WebPage::canPluginHandleResponse): Pass newMIMEType to
FindPlugin message.
* WebProcess/WebPage/WebPage.h:
(WebPage):

LayoutTests:

* platform/wk2/TestExpectations: Unskip
plugins/no-mime-with-valid-extension.html.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (148859 => 148860)


--- trunk/LayoutTests/ChangeLog	2013-04-22 06:54:32 UTC (rev 148859)
+++ trunk/LayoutTests/ChangeLog	2013-04-22 07:25:12 UTC (rev 148860)
@@ -1,5 +1,15 @@
 2013-04-21  Carlos Garcia Campos  <[email protected]>
 
+        [WebKit2] Plugins without a MIME Type fail to load
+        https://bugs.webkit.org/show_bug.cgi?id=112834
+
+        Reviewed by Benjamin Poulain.
+
+        * platform/wk2/TestExpectations: Unskip
+        plugins/no-mime-with-valid-extension.html.
+
+2013-04-21  Carlos Garcia Campos  <[email protected]>
+
         Division by zero in CSSGradientValue::addStops()
         https://bugs.webkit.org/show_bug.cgi?id=114807
 

Modified: trunk/LayoutTests/platform/wk2/TestExpectations (148859 => 148860)


--- trunk/LayoutTests/platform/wk2/TestExpectations	2013-04-22 06:54:32 UTC (rev 148859)
+++ trunk/LayoutTests/platform/wk2/TestExpectations	2013-04-22 07:25:12 UTC (rev 148860)
@@ -650,7 +650,6 @@
 
 # Unexplained plugin failures
 platform/mac/plugins/testplugin-onnew-onpaint.html
-plugins/no-mime-with-valid-extension.html
 
 # Unexplained plugin failures that were formerly in the NPRuntime support for out-of-process plug-ins
 # list.

Modified: trunk/Source/WebKit2/ChangeLog (148859 => 148860)


--- trunk/Source/WebKit2/ChangeLog	2013-04-22 06:54:32 UTC (rev 148859)
+++ trunk/Source/WebKit2/ChangeLog	2013-04-22 07:25:12 UTC (rev 148860)
@@ -1,5 +1,42 @@
 2013-04-21  Carlos Garcia Campos  <[email protected]>
 
+        [WebKit2] Plugins without a MIME Type fail to load
+        https://bugs.webkit.org/show_bug.cgi?id=112834
+
+        Reviewed by Benjamin Poulain.
+
+        The problem is that when the plugin is created and the MIME Type
+        is empty, since the MIME Type guessed in the UI process using the
+        plugin extension is not passed to the WebProcess, when the plugin
+        is instantiated, the value of NPMIMEType parameter passed to
+        NPP_New is NULL, and NPERR_INVALID_INSTANCE_ERROR is returned.
+        GetPluginPath message has been renamed to FindPlugin, since it
+        doesn't only return the path but also the new MIME Type and load
+        policy.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::findPlugin): Receive an output newMIMEType
+        parameter that is passed to PluginModuleInfo::findPlugin() so that
+        in case of guessing the MIME Type, the new one is passed back to
+        the WebProcess.
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::createPlugin): Pass the MIME Type
+        from the parameters to WebPage::createPlugin.
+        (WebKit::WebFrameLoaderClient::recreatePlugin): Pass a newMIMEType
+        parameter to WebPage::createPlugin.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::createPlugin): Add newMIMEType out parameter and
+        pass it to the FindPlugin message.
+        (WebKit::WebPage::canPluginHandleResponse): Pass newMIMEType to
+        FindPlugin message.
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage):
+
+2013-04-21  Carlos Garcia Campos  <[email protected]>
+
         Widget should not depend on AXObjectCache
         https://bugs.webkit.org/show_bug.cgi?id=114514
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (148859 => 148860)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-04-22 06:54:32 UTC (rev 148859)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-04-22 07:25:12 UTC (rev 148860)
@@ -1345,11 +1345,11 @@
 }
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-void WebPageProxy::getPluginPath(const String& mimeType, const String& urlString, const String& frameURLString, const String& pageURLString, String& pluginPath, uint32_t& pluginLoadPolicy)
+void WebPageProxy::findPlugin(const String& mimeType, const String& urlString, const String& frameURLString, const String& pageURLString, String& pluginPath, String& newMimeType, uint32_t& pluginLoadPolicy)
 {
     MESSAGE_CHECK_URL(urlString);
 
-    String newMimeType = mimeType.lower();
+    newMimeType = mimeType.lower();
 
     pluginLoadPolicy = PluginModuleLoadNormally;
     PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), urlString));

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (148859 => 148860)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-04-22 06:54:32 UTC (rev 148859)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-04-22 07:25:12 UTC (rev 148860)
@@ -1051,7 +1051,7 @@
     void sendWheelEvent(const WebWheelEvent&);
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    void getPluginPath(const String& mimeType, const String& urlString, const String& frameURLString, const String& pageURLString, String& pluginPath, uint32_t& pluginLoadPolicy);
+    void findPlugin(const String& mimeType, const String& urlString, const String& frameURLString, const String& pageURLString, String& pluginPath, String& newMIMEType, uint32_t& pluginLoadPolicy);
 #endif
 
     PageClient* m_pageClient;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (148859 => 148860)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-04-22 06:54:32 UTC (rev 148859)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-04-22 07:25:12 UTC (rev 148860)
@@ -315,7 +315,7 @@
 #endif
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    GetPluginPath(WTF::String mimeType, WTF::String urlString, WTF::String frameURLString, WTF::String pageURLString) -> (WTF::String pluginPath, uint32_t pluginLoadPolicy)
+    FindPlugin(WTF::String mimeType, WTF::String urlString, WTF::String frameURLString, WTF::String pageURLString) -> (WTF::String pluginPath, WTF::String newMIMEType, uint32_t pluginLoadPolicy)
 #endif
 
     DidUpdateInWindowState()

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (148859 => 148860)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2013-04-22 06:54:32 UTC (rev 148859)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2013-04-22 07:25:12 UTC (rev 148860)
@@ -1323,7 +1323,7 @@
 #endif
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    RefPtr<Plugin> plugin = m_frame->page()->createPlugin(m_frame, pluginElement, parameters);
+    RefPtr<Plugin> plugin = m_frame->page()->createPlugin(m_frame, pluginElement, parameters, parameters.mimeType);
     if (!plugin)
         return 0;
 
@@ -1340,7 +1340,8 @@
     ASSERT(m_frame->page());
 
     PluginView* pluginView = static_cast<PluginView*>(widget);
-    RefPtr<Plugin> plugin = m_frame->page()->createPlugin(m_frame, pluginView->pluginElement(), pluginView->initialParameters());
+    String newMIMEType;
+    RefPtr<Plugin> plugin = m_frame->page()->createPlugin(m_frame, pluginView->pluginElement(), pluginView->initialParameters(), newMIMEType);
     pluginView->recreateAndInitialize(plugin.release());
 #endif
 }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (148859 => 148860)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-04-22 06:54:32 UTC (rev 148859)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-04-22 07:25:12 UTC (rev 148860)
@@ -517,7 +517,7 @@
 }
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-PassRefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* pluginElement, const Plugin::Parameters& parameters)
+PassRefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* pluginElement, const Plugin::Parameters& parameters, String& newMIMEType)
 {
     String pluginPath;
     uint32_t pluginLoadPolicy;
@@ -525,7 +525,7 @@
     String frameURLString = frame->coreFrame()->loader()->documentLoader()->responseURL().string();
     String pageURLString = m_page->mainFrame()->loader()->documentLoader()->responseURL().string();
 
-    if (!sendSync(Messages::WebPageProxy::GetPluginPath(parameters.mimeType, parameters.url.string(), frameURLString, pageURLString), Messages::WebPageProxy::GetPluginPath::Reply(pluginPath, pluginLoadPolicy))) {
+    if (!sendSync(Messages::WebPageProxy::FindPlugin(parameters.mimeType, parameters.url.string(), frameURLString, pageURLString), Messages::WebPageProxy::FindPlugin::Reply(pluginPath, newMIMEType, pluginLoadPolicy))) {
         return 0;
     }
 
@@ -3716,9 +3716,10 @@
 {
 #if ENABLE(NETSCAPE_PLUGIN_API)
     String pluginPath;
+    String newMIMEType;
     uint32_t pluginLoadPolicy;
     
-    if (!sendSync(Messages::WebPageProxy::GetPluginPath(response.mimeType(), response.url().string(), response.url().string(), response.url().string()), Messages::WebPageProxy::GetPluginPath::Reply(pluginPath, pluginLoadPolicy)))
+    if (!sendSync(Messages::WebPageProxy::FindPlugin(response.mimeType(), response.url().string(), response.url().string(), response.url().string()), Messages::WebPageProxy::FindPlugin::Reply(pluginPath, newMIMEType, pluginLoadPolicy)))
         return false;
 
     return pluginLoadPolicy != PluginModuleBlocked && !pluginPath.isEmpty();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (148859 => 148860)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-04-22 06:54:32 UTC (rev 148859)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-04-22 07:25:12 UTC (rev 148860)
@@ -288,7 +288,7 @@
     PassRefPtr<WebCore::Range> currentSelectionAsRange();
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    PassRefPtr<Plugin> createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&);
+    PassRefPtr<Plugin> createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&, String& newMIMEType);
 #endif
 
     EditorState editorState() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to