Title: [143815] trunk/Source
Revision
143815
Author
[email protected]
Date
2013-02-22 16:43:38 -0800 (Fri, 22 Feb 2013)

Log Message

pluginLoadStrategy should take a WKDictionaryRef for extensibility
https://bugs.webkit.org/show_bug.cgi?id=110656
<rdar://problem/13265303>

Reviewed by Jessie Berlin.

Source/WebCore:

Export a symbol needed by WebKit2.

* WebCore.exp.in:

Source/WebKit2:

Change pluginLoadStrategy to take a WKDictionaryRef instead of a number of parameters;
this lets us add more plug-in information if needed. Also add the page URL and rename documentURL to frameURL.

* UIProcess/API/C/WKPage.cpp:
(WKPageGetPluginInformationBundleIdentifierKey):
(WKPageGetPluginInformationBundleVersionKey):
(WKPageGetPluginInformationDisplayNameKey):
(WKPageGetPluginInformationFrameURLKey):
(WKPageGetPluginInformationMIMETypeKey):
(WKPageGetPluginInformationPageURLKey):
* UIProcess/API/C/WKPage.h:
* UIProcess/WebLoaderClient.cpp:
(WebKit):
(WebKit::WebLoaderClient::pluginLoadPolicy):
* UIProcess/WebLoaderClient.h:
(WebLoaderClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::getPluginPath):
(WebKit::WebPageProxy::pluginInformationBundleIdentifierKey):
(WebKit):
(WebKit::WebPageProxy::pluginInformationBundleVersionKey):
(WebKit::WebPageProxy::pluginInformationDisplayNameKey):
(WebKit::WebPageProxy::pluginInformationFrameURLKey):
(WebKit::WebPageProxy::pluginInformationMIMETypeKey):
(WebKit::WebPageProxy::pluginInformationPageURLKey):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin):
(WebKit::WebPage::canPluginHandleResponse):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143814 => 143815)


--- trunk/Source/WebCore/ChangeLog	2013-02-23 00:35:54 UTC (rev 143814)
+++ trunk/Source/WebCore/ChangeLog	2013-02-23 00:43:38 UTC (rev 143815)
@@ -1,3 +1,15 @@
+2013-02-22  Anders Carlsson  <[email protected]>
+
+        pluginLoadStrategy should take a WKDictionaryRef for extensibility
+        https://bugs.webkit.org/show_bug.cgi?id=110656
+        <rdar://problem/13265303>
+
+        Reviewed by Jessie Berlin.
+
+        Export a symbol needed by WebKit2.
+
+        * WebCore.exp.in:
+
 2013-02-22  Levi Weintraub  <[email protected]>
 
         Add descriptive names for different addMidpoint use cases

Modified: trunk/Source/WebCore/WebCore.exp.in (143814 => 143815)


--- trunk/Source/WebCore/WebCore.exp.in	2013-02-23 00:35:54 UTC (rev 143814)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-02-23 00:43:38 UTC (rev 143815)
@@ -1259,6 +1259,7 @@
 __ZNK7WebCore13ResourceErrorcvP7NSErrorEv
 __ZNK7WebCore14DocumentLoader10requestURLEv
 __ZNK7WebCore14DocumentLoader11frameLoaderEv
+__ZNK7WebCore14DocumentLoader11responseURLEv
 __ZNK7WebCore14DocumentLoader11subresourceERKNS_4KURLE
 __ZNK7WebCore14DocumentLoader12mainResourceEv
 __ZNK7WebCore14DocumentLoader13urlForHistoryEv

Modified: trunk/Source/WebKit2/ChangeLog (143814 => 143815)


--- trunk/Source/WebKit2/ChangeLog	2013-02-23 00:35:54 UTC (rev 143814)
+++ trunk/Source/WebKit2/ChangeLog	2013-02-23 00:43:38 UTC (rev 143815)
@@ -1,5 +1,45 @@
 2013-02-22  Anders Carlsson  <[email protected]>
 
+        pluginLoadStrategy should take a WKDictionaryRef for extensibility
+        https://bugs.webkit.org/show_bug.cgi?id=110656
+        <rdar://problem/13265303>
+
+        Reviewed by Jessie Berlin.
+
+        Change pluginLoadStrategy to take a WKDictionaryRef instead of a number of parameters;
+        this lets us add more plug-in information if needed. Also add the page URL and rename documentURL to frameURL.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageGetPluginInformationBundleIdentifierKey):
+        (WKPageGetPluginInformationBundleVersionKey):
+        (WKPageGetPluginInformationDisplayNameKey):
+        (WKPageGetPluginInformationFrameURLKey):
+        (WKPageGetPluginInformationMIMETypeKey):
+        (WKPageGetPluginInformationPageURLKey):
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/WebLoaderClient.cpp:
+        (WebKit):
+        (WebKit::WebLoaderClient::pluginLoadPolicy):
+        * UIProcess/WebLoaderClient.h:
+        (WebLoaderClient):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::getPluginPath):
+        (WebKit::WebPageProxy::pluginInformationBundleIdentifierKey):
+        (WebKit):
+        (WebKit::WebPageProxy::pluginInformationBundleVersionKey):
+        (WebKit::WebPageProxy::pluginInformationDisplayNameKey):
+        (WebKit::WebPageProxy::pluginInformationFrameURLKey):
+        (WebKit::WebPageProxy::pluginInformationMIMETypeKey):
+        (WebKit::WebPageProxy::pluginInformationPageURLKey):
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::createPlugin):
+        (WebKit::WebPage::canPluginHandleResponse):
+
+2013-02-22  Anders Carlsson  <[email protected]>
+
         Move pluginLoadPolicy to the page loader client
         https://bugs.webkit.org/show_bug.cgi?id=110635
         <rdar://problem/13265303>

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (143814 => 143815)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2013-02-23 00:35:54 UTC (rev 143814)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2013-02-23 00:43:38 UTC (rev 143815)
@@ -815,3 +815,39 @@
 {
     // FIXME: Remove this function when doing so won't break WebKit nightlies.
 }
+
+WKStringRef WKPageGetPluginInformationBundleIdentifierKey()
+{
+    static WebString* key = WebString::create(WebPageProxy::pluginInformationBundleIdentifierKey()).leakRef();
+    return toAPI(key);
+}
+
+WKStringRef WKPageGetPluginInformationBundleVersionKey()
+{
+    static WebString* key = WebString::create(WebPageProxy::pluginInformationBundleVersionKey()).leakRef();
+    return toAPI(key);
+}
+
+WKStringRef WKPageGetPluginInformationDisplayNameKey()
+{
+    static WebString* key = WebString::create(WebPageProxy::pluginInformationDisplayNameKey()).leakRef();
+    return toAPI(key);
+}
+
+WKStringRef WKPageGetPluginInformationFrameURLKey()
+{
+    static WebString* key = WebString::create(WebPageProxy::pluginInformationFrameURLKey()).leakRef();
+    return toAPI(key);
+}
+
+WKStringRef WKPageGetPluginInformationMIMETypeKey()
+{
+    static WebString* key = WebString::create(WebPageProxy::pluginInformationMIMETypeKey()).leakRef();
+    return toAPI(key);
+}
+
+WKStringRef WKPageGetPluginInformationPageURLKey()
+{
+    static WebString* key = WebString::create(WebPageProxy::pluginInformationPageURLKey()).leakRef();
+    return toAPI(key);
+}

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (143814 => 143815)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2013-02-23 00:35:54 UTC (rev 143814)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2013-02-23 00:43:38 UTC (rev 143815)
@@ -82,7 +82,7 @@
 typedef void (*WKPageWillGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKPagePluginDidFailCallback)(WKPageRef page, WKErrorCode errorCode, WKStringRef mimeType, WKStringRef pluginIdentifier, WKStringRef pluginVersion, const void* clientInfo);
 typedef void (*WKPageDidLayoutCallback)(WKPageRef page, WKLayoutMilestones milestones, WKTypeRef userData, const void *clientInfo);
-typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback)(WKPageRef page, WKStringRef identifier, WKStringRef displayName, WKURLRef documentURL, WKPluginLoadPolicy currentPluginLoadPolicy, const void* clientInfo);
+typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, const void* clientInfo);
 
 // Deprecated
 typedef void (*WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, const void* clientInfo);
@@ -519,6 +519,25 @@
 
 WK_EXPORT void WKPagePostMessageToInjectedBundle(WKPageRef page, WKStringRef messageName, WKTypeRef messageBody);
 
+/* Value type: WKStringRef */
+WK_EXPORT WKStringRef WKPageGetPluginInformationBundleIdentifierKey();
+
+/* Value type: WKStringRef */
+WK_EXPORT WKStringRef WKPageGetPluginInformationBundleVersionKey();
+
+/* Value type: WKStringRef */
+WK_EXPORT WKStringRef WKPageGetPluginInformationDisplayNameKey();
+
+/* Value type: WKURLRef */
+WK_EXPORT WKStringRef WKPageGetPluginInformationFrameURLKey();
+
+/* Value type: WKStringRef */
+WK_EXPORT WKStringRef WKPageGetPluginInformationMIMETypeKey();
+
+/* Value type: WKURLRef */
+WK_EXPORT WKStringRef WKPageGetPluginInformationPageURLKey();
+
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp (143814 => 143815)


--- trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp	2013-02-23 00:35:54 UTC (rev 143814)
+++ trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp	2013-02-23 00:43:38 UTC (rev 143815)
@@ -27,8 +27,10 @@
 #include "WebLoaderClient.h"
 
 #include "ImmutableArray.h"
+#include "ImmutableDictionary.h"
 #include "WKAPICast.h"
 #include "WebBackForwardListItem.h"
+#include "WebPageProxy.h"
 #include <string.h>
 
 using namespace WebCore;
@@ -321,12 +323,19 @@
     return PluginModuleBlocked;
 }
 
-PluginModuleLoadPolicy WebLoaderClient::pluginLoadPolicy(WebPageProxy* page, const String& identifier, const String& displayName, const String& documentURLString, PluginModuleLoadPolicy currentPluginLoadPolicy)
+
+PluginModuleLoadPolicy WebLoaderClient::pluginLoadPolicy(WebPageProxy* page, const String& identifier, const String& displayName, const String& frameURLString, const String& pageURLString, PluginModuleLoadPolicy currentPluginLoadPolicy)
 {
     if (!m_client.pluginLoadPolicy)
         return currentPluginLoadPolicy;
 
-    return toPluginModuleLoadPolicy(m_client.pluginLoadPolicy(toAPI(page), toAPI(identifier.impl()), toAPI(displayName.impl()), toURLRef(documentURLString.impl()), toWKPluginLoadPolicy(currentPluginLoadPolicy), m_client.clientInfo));
+    HashMap<String, RefPtr<APIObject> > pluginInfoMap;
+    pluginInfoMap.set(WebPageProxy::pluginInformationBundleIdentifierKey(), WebString::create(identifier));
+    pluginInfoMap.set(WebPageProxy::pluginInformationDisplayNameKey(), WebString::create(displayName));
+    pluginInfoMap.set(WebPageProxy::pluginInformationFrameURLKey(), WebURL::create(frameURLString));
+    pluginInfoMap.set(WebPageProxy::pluginInformationPageURLKey(), WebURL::create(pageURLString));
+
+    return toPluginModuleLoadPolicy(m_client.pluginLoadPolicy(toAPI(page), toWKPluginLoadPolicy(currentPluginLoadPolicy), toAPI(ImmutableDictionary::adopt(pluginInfoMap).get()), m_client.clientInfo));
 }
 
 

Modified: trunk/Source/WebKit2/UIProcess/WebLoaderClient.h (143814 => 143815)


--- trunk/Source/WebKit2/UIProcess/WebLoaderClient.h	2013-02-23 00:35:54 UTC (rev 143814)
+++ trunk/Source/WebKit2/UIProcess/WebLoaderClient.h	2013-02-23 00:43:38 UTC (rev 143815)
@@ -89,7 +89,7 @@
     bool shouldGoToBackForwardListItem(WebPageProxy*, WebBackForwardListItem*);
     void willGoToBackForwardListItem(WebPageProxy*, WebBackForwardListItem*, APIObject*);
 
-    PluginModuleLoadPolicy pluginLoadPolicy(WebPageProxy*, const String& identifier, const String& displayName, const String& documentURLString, PluginModuleLoadPolicy currentPluginLoadPolicy);
+    PluginModuleLoadPolicy pluginLoadPolicy(WebPageProxy*, const String& bundleIdentifier, const String& displayName, const String& frameURLString, const String& pageURLString, PluginModuleLoadPolicy currentPluginLoadPolicy);
     void didFailToInitializePlugin(WebPageProxy*, const String& mimeType);
     void didBlockInsecurePluginVersion(WebPageProxy*, const String& mimeType, const String& pluginIdentifier, const String& pluginVersion);
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (143814 => 143815)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-02-23 00:35:54 UTC (rev 143814)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-02-23 00:43:38 UTC (rev 143815)
@@ -1241,7 +1241,7 @@
 }
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-void WebPageProxy::getPluginPath(const String& mimeType, const String& urlString, const String& documentURLString, String& pluginPath, uint32_t& pluginLoadPolicy)
+void WebPageProxy::getPluginPath(const String& mimeType, const String& urlString, const String& frameURLString, const String& pageURLString, String& pluginPath, uint32_t& pluginLoadPolicy)
 {
     MESSAGE_CHECK_URL(urlString);
 
@@ -1256,9 +1256,10 @@
 
 #if PLATFORM(MAC)
     PluginModuleLoadPolicy currentPluginLoadPolicy = static_cast<PluginModuleLoadPolicy>(pluginLoadPolicy);
-    pluginLoadPolicy = m_loaderClient.pluginLoadPolicy(this, plugin.bundleIdentifier, plugin.info.name, documentURLString, currentPluginLoadPolicy);
+    pluginLoadPolicy = m_loaderClient.pluginLoadPolicy(this, plugin.bundleIdentifier, plugin.info.name, frameURLString, pageURLString, currentPluginLoadPolicy);
 #else
-    UNUSED_PARAM(documentURLString);
+    UNUSED_PARAM(frameURLString);
+    UNUSED_PARAM(pageURLString);
 #endif
 
     if (pluginLoadPolicy != PluginModuleLoadNormally)
@@ -2544,6 +2545,36 @@
     m_uiClient.mouseDidMoveOverElement(this, hitTestResultData, modifiers, userData.get());
 }
 
+String WebPageProxy::pluginInformationBundleIdentifierKey()
+{
+    return ASCIILiteral("PluginInformationBundleIdentifier");
+}
+
+String WebPageProxy::pluginInformationBundleVersionKey()
+{
+    return ASCIILiteral("PluginInformationBundleVersion");
+}
+
+String WebPageProxy::pluginInformationDisplayNameKey()
+{
+    return ASCIILiteral("PluginInformationDisplayName");
+}
+
+String WebPageProxy::pluginInformationFrameURLKey()
+{
+    return ASCIILiteral("PluginInformationFrameURL");
+}
+
+String WebPageProxy::pluginInformationMIMETypeKey()
+{
+    return ASCIILiteral("PluginInformationMIMEType");
+}
+
+String WebPageProxy::pluginInformationPageURLKey()
+{
+    return ASCIILiteral("PluginInformationPageURL");
+}
+
 void WebPageProxy::unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& url, const String& pluginsPageURL)
 {
     MESSAGE_CHECK_URL(url);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (143814 => 143815)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-02-23 00:35:54 UTC (rev 143814)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-02-23 00:43:38 UTC (rev 143815)
@@ -753,6 +753,13 @@
 
     void didReceiveAuthenticationChallengeProxy(uint64_t frameID, PassRefPtr<AuthenticationChallengeProxy>);
 
+    static String pluginInformationBundleIdentifierKey();
+    static String pluginInformationBundleVersionKey();
+    static String pluginInformationDisplayNameKey();
+    static String pluginInformationFrameURLKey();
+    static String pluginInformationMIMETypeKey();
+    static String pluginInformationPageURLKey();
+
 private:
     WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);
 
@@ -1025,7 +1032,7 @@
     void sendWheelEvent(const WebWheelEvent&);
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    void getPluginPath(const String& mimeType, const String& urlString, const String& documentURLString, String& pluginPath, uint32_t& pluginLoadPolicy);
+    void getPluginPath(const String& mimeType, const String& urlString, const String& frameURLString, const String& pageURLString, String& pluginPath, uint32_t& pluginLoadPolicy);
 #endif
 
     PageClient* m_pageClient;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (143814 => 143815)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-02-23 00:35:54 UTC (rev 143814)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-02-23 00:43:38 UTC (rev 143815)
@@ -313,7 +313,7 @@
 #endif
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-GetPluginPath(WTF::String mimeType, WTF::String urlString, WTF::String documentURLString) -> (WTF::String pluginPath, uint32_t pluginLoadPolicy)
+    GetPluginPath(WTF::String mimeType, WTF::String urlString, WTF::String frameURLString, WTF::String pageURLString) -> (WTF::String pluginPath, uint32_t pluginLoadPolicy)
 #endif
 
 }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (143814 => 143815)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-02-23 00:35:54 UTC (rev 143814)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-02-23 00:43:38 UTC (rev 143815)
@@ -502,8 +502,10 @@
     String pluginPath;
     uint32_t pluginLoadPolicy;
 
-    String documentURLString = pluginElement->document()->url().string();
-    if (!sendSync(Messages::WebPageProxy::GetPluginPath(parameters.mimeType, parameters.url.string(), documentURLString), Messages::WebPageProxy::GetPluginPath::Reply(pluginPath, pluginLoadPolicy))) {
+    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))) {
         return 0;
     }
 
@@ -3658,7 +3660,7 @@
     String pluginPath;
     uint32_t pluginLoadPolicy;
     
-    if (!sendSync(Messages::WebPageProxy::GetPluginPath(response.mimeType(), response.url().string(), response.url().string()), Messages::WebPageProxy::GetPluginPath::Reply(pluginPath, pluginLoadPolicy)))
+    if (!sendSync(Messages::WebPageProxy::GetPluginPath(response.mimeType(), response.url().string(), response.url().string(), response.url().string()), Messages::WebPageProxy::GetPluginPath::Reply(pluginPath, pluginLoadPolicy)))
         return false;
 
     return pluginLoadPolicy != PluginModuleBlocked && !pluginPath.isEmpty();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to