Title: [144416] branches/safari-536.29-branch
Revision
144416
Author
[email protected]
Date
2013-02-28 21:59:00 -0800 (Thu, 28 Feb 2013)

Log Message

Merge r141486

    2013-01-30  Brian Weinstein  <[email protected]>

    Add a call to the page UI client to determine if a plug-in should load
    https://bugs.webkit.org/show_bug.cgi?id=108407
    <rdar://problem/13066332>

Source/WebKit2: 

    Reviewed by Anders Carlsson.

    This patch adds a client call to the WKPageUIClient to be called to determine
    whether or not a plug-in should load.

    * UIProcess/API/C/WKPage.h: Add shouldLoadPlugin.
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::getPluginPath): Moved from WebProcessProxy, and added a call to
        m_uiClient.shouldInstantiatePlugin.
    * UIProcess/WebPageProxy.h:
    * UIProcss/WebPageProxy.messages.in: Moved GetPluginPath from WebProcessProxy to WebPageProxy.
    * UIProcess/WebProcessProxy.cpp:
    (WebKit::WebProcessProxy::getPluginPath): Moved to WebPageProxy.
    * UIProcess/WebProcessProxy.h:
    * UIProcess/WebUIClient.cpp:
    (WebKit::WebUIClient::shouldInstantiatePlugin): Return that we should load the plug-in if
        the client function isn't defined, and call the function if it is.
    * UIProcess/WebUIClient.h:
    * UIProcess/mac/WebInspectorProxyMac.mm:
    (WebKit::WebInspectorProxy::platformCreateInspectorPage): Add an entry for the new
        client function.
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::createPlugin): Send the message to the WebPageProxy, not the WebProcessProxy.
    (WebKit::WebPage::canPluginHandleResponse): Made a member function, so it can call sendSync, and
        send the message to the WebPageProxy, not the WebProcessProxy.
    * WebProcess/WebPage/WebPage.h:

Tools: 

    Add entries for the new function in the necessary structs.

    Reviewed by Anders Carlsson.

    * MiniBrowser/mac/WK2BrowserWindowController.m:
    (-[WK2BrowserWindowController awakeFromNib]):
    * WebKitTestRunner/TestController.cpp:
    (WTR::TestController::createOtherPage):
    (WTR::TestController::createWebViewWithOptions):

Modified Paths

Diff

Modified: branches/safari-536.29-branch/Source/WebKit2/ChangeLog (144415 => 144416)


--- branches/safari-536.29-branch/Source/WebKit2/ChangeLog	2013-03-01 05:46:21 UTC (rev 144415)
+++ branches/safari-536.29-branch/Source/WebKit2/ChangeLog	2013-03-01 05:59:00 UTC (rev 144416)
@@ -1,3 +1,40 @@
+2013-02-28  Brady Eidson  <[email protected]>
+
+        Merge r141486
+
+    2013-01-30  Brian Weinstein  <[email protected]>
+
+            Add a call to the page UI client to determine if a plug-in should load
+            https://bugs.webkit.org/show_bug.cgi?id=108407
+            <rdar://problem/13066332>
+
+            Reviewed by Anders Carlsson.
+
+            This patch adds a client call to the WKPageUIClient to be called to determine
+            whether or not a plug-in should load.
+
+            * UIProcess/API/C/WKPage.h: Add shouldLoadPlugin.
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::getPluginPath): Moved from WebProcessProxy, and added a call to
+                m_uiClient.shouldInstantiatePlugin.
+            * UIProcess/WebPageProxy.h:
+            * UIProcss/WebPageProxy.messages.in: Moved GetPluginPath from WebProcessProxy to WebPageProxy.
+            * UIProcess/WebProcessProxy.cpp:
+            (WebKit::WebProcessProxy::getPluginPath): Moved to WebPageProxy.
+            * UIProcess/WebProcessProxy.h:
+            * UIProcess/WebUIClient.cpp:
+            (WebKit::WebUIClient::shouldInstantiatePlugin): Return that we should load the plug-in if
+                the client function isn't defined, and call the function if it is.
+            * UIProcess/WebUIClient.h:
+            * UIProcess/mac/WebInspectorProxyMac.mm:
+            (WebKit::WebInspectorProxy::platformCreateInspectorPage): Add an entry for the new
+                client function.
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::createPlugin): Send the message to the WebPageProxy, not the WebProcessProxy.
+            (WebKit::WebPage::canPluginHandleResponse): Made a member function, so it can call sendSync, and
+                send the message to the WebPageProxy, not the WebProcessProxy.
+            * WebProcess/WebPage/WebPage.h:
+
 2013-01-30  Lucas Forschler  <[email protected]>
 
         Merge r138606

Modified: branches/safari-536.29-branch/Source/WebKit2/UIProcess/API/C/WKPage.h (144415 => 144416)


--- branches/safari-536.29-branch/Source/WebKit2/UIProcess/API/C/WKPage.h	2013-03-01 05:46:21 UTC (rev 144415)
+++ branches/safari-536.29-branch/Source/WebKit2/UIProcess/API/C/WKPage.h	2013-03-01 05:59:00 UTC (rev 144416)
@@ -219,6 +219,7 @@
 typedef bool (*WKPageShouldInterruptJavaScriptCallback)(WKPageRef page, const void *clientInfo);
 typedef void (*WKPageDecidePolicyForNotificationPermissionRequestCallback)(WKPageRef page, WKSecurityOriginRef origin, WKNotificationPermissionRequestRef permissionRequest, const void *clientInfo);
 typedef void (*WKPageUnavailablePluginButtonClickedCallback)(WKPageRef page, WKPluginUnavailabilityReason pluginUnavailabilityReason, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo);
+typedef bool (*WKPageShouldInstantiatePluginCallback)(WKPageRef page, WKStringRef identifier, WKStringRef displayName, const void* clientInfo);
 
 // Deprecated    
 typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV0)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
@@ -275,6 +276,7 @@
     WKPageMouseDidMoveOverElementCallback                               mouseDidMoveOverElement;
     WKPageDecidePolicyForNotificationPermissionRequestCallback          decidePolicyForNotificationPermissionRequest;
     WKPageUnavailablePluginButtonClickedCallback                        unavailablePluginButtonClicked;
+    WKPageShouldInstantiatePluginCallback                               shouldInstantiatePlugin;
 };
 typedef struct WKPageUIClient WKPageUIClient;
 

Modified: branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (144415 => 144416)


--- branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-03-01 05:46:21 UTC (rev 144415)
+++ branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-03-01 05:59:00 UTC (rev 144416)
@@ -1121,6 +1121,30 @@
         process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
 }
 
+#if ENABLE(NETSCAPE_PLUGIN_API)
+void WebPageProxy::getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, uint32_t& pluginLoadPolicy)
+{
+    MESSAGE_CHECK_URL(urlString);
+
+    String newMimeType = mimeType.lower();
+
+    pluginLoadPolicy = PluginModuleLoadNormally;
+    PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), urlString));
+    if (!plugin.path)
+        return;
+
+    pluginLoadPolicy = PluginInfoStore::policyForPlugin(plugin);
+    if (pluginLoadPolicy != PluginModuleLoadNormally)
+        return;
+
+    pluginLoadPolicy = m_uiClient.shouldInstantiatePlugin(this, plugin.bundleIdentifier, plugin.info.name) ? PluginModuleLoadNormally : PluginModuleBlocked;
+    if (pluginLoadPolicy != PluginModuleLoadNormally)
+        return;
+
+    pluginPath = plugin.path;
+}
+#endif // ENABLE(NETSCAPE_PLUGIN_API)
+
 #if ENABLE(GESTURE_EVENTS)
 void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
 {

Modified: branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebPageProxy.h (144415 => 144416)


--- branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2013-03-01 05:46:21 UTC (rev 144415)
+++ branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2013-03-01 05:59:00 UTC (rev 144416)
@@ -920,6 +920,10 @@
     void processNextQueuedWheelEvent();
     void sendWheelEvent(const WebWheelEvent&);
 
+#if ENABLE(NETSCAPE_PLUGIN_API)
+    void getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, uint32_t& pluginLoadPolicy);
+#endif
+
     PageClient* m_pageClient;
     WebLoaderClient m_loaderClient;
     WebPolicyClient m_policyClient;

Modified: branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (144415 => 144416)


--- branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-03-01 05:46:21 UTC (rev 144415)
+++ branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-03-01 05:59:00 UTC (rev 144416)
@@ -304,3 +304,8 @@
     SaveRecentSearches(WTF::String name, Vector<String> searchItems)
     LoadRecentSearches(WTF::String name) -> (Vector<String> result)
 }
+
+#if ENABLE(NETSCAPE_PLUGIN_API)
+GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath, uint32_t pluginLoadPolicy)
+#endif
+

Modified: branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebUIClient.cpp (144415 => 144416)


--- branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebUIClient.cpp	2013-03-01 05:46:21 UTC (rev 144415)
+++ branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebUIClient.cpp	2013-03-01 05:59:00 UTC (rev 144416)
@@ -417,4 +417,12 @@
     return m_client.shouldInterruptJavaScript(toAPI(page), m_client.clientInfo);
 }
 
+bool WebUIClient::shouldInstantiatePlugin(WebPageProxy* page, const String& identifier, const String& displayName)
+{
+    if (!m_client.shouldInstantiatePlugin)
+        return true;
+
+    return m_client.shouldInstantiatePlugin(toAPI(page), toAPI(identifier.impl()), toAPI(displayName.impl()), m_client.clientInfo);
+}
+
 } // namespace WebKit

Modified: branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebUIClient.h (144415 => 144416)


--- branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebUIClient.h	2013-03-01 05:46:21 UTC (rev 144415)
+++ branches/safari-536.29-branch/Source/WebKit2/UIProcess/WebUIClient.h	2013-03-01 05:59:00 UTC (rev 144416)
@@ -115,6 +115,8 @@
     void saveDataToFileInDownloadsFolder(WebPageProxy*, const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData*);
 
     bool shouldInterruptJavaScript(WebPageProxy*);
+
+    bool shouldInstantiatePlugin(WebPageProxy*, const String& identifier, const String& displayName);
 };
 
 } // namespace WebKit

Modified: branches/safari-536.29-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (144415 => 144416)


--- branches/safari-536.29-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-03-01 05:46:21 UTC (rev 144415)
+++ branches/safari-536.29-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-03-01 05:59:00 UTC (rev 144416)
@@ -391,9 +391,9 @@
 {
     String pluginPath;
     uint32_t pluginLoadPolicy;
-    if (!WebProcess::shared().connection()->sendSync(
-            Messages::WebContext::GetPluginPath(parameters.mimeType, parameters.url.string()), 
-            Messages::WebContext::GetPluginPath::Reply(pluginPath, pluginLoadPolicy), 0)) {
+    if (!sendSync(
+            Messages::WebPageProxy::GetPluginPath(parameters.mimeType, parameters.url.string()),
+            Messages::WebPageProxy::GetPluginPath::Reply(pluginPath, pluginLoadPolicy))) {
         return 0;
     }
 

Modified: branches/safari-536.29-branch/Tools/ChangeLog (144415 => 144416)


--- branches/safari-536.29-branch/Tools/ChangeLog	2013-03-01 05:46:21 UTC (rev 144415)
+++ branches/safari-536.29-branch/Tools/ChangeLog	2013-03-01 05:59:00 UTC (rev 144416)
@@ -1,3 +1,23 @@
+2013-02-28  Brady Eidson  <[email protected]>
+
+        Merge r141486
+
+    2013-01-30  Brian Weinstein  <[email protected]>
+
+            Add a call to the page UI client to determine if a plug-in should load
+            https://bugs.webkit.org/show_bug.cgi?id=108407
+            <rdar://problem/13066332>
+
+            Add entries for the new function in the necessary structs.
+
+            Reviewed by Anders Carlsson.
+
+            * MiniBrowser/mac/WK2BrowserWindowController.m:
+            (-[WK2BrowserWindowController awakeFromNib]):
+            * WebKitTestRunner/TestController.cpp:
+            (WTR::TestController::createOtherPage):
+            (WTR::TestController::createWebViewWithOptions):
+
 2012-12-13  Lucas Forschler  <[email protected]>
 
     Rollout r133942 & 133943

Modified: branches/safari-536.29-branch/Tools/MiniBrowser/mac/BrowserWindowController.m (144415 => 144416)


--- branches/safari-536.29-branch/Tools/MiniBrowser/mac/BrowserWindowController.m	2013-03-01 05:46:21 UTC (rev 144415)
+++ branches/safari-536.29-branch/Tools/MiniBrowser/mac/BrowserWindowController.m	2013-03-01 05:59:00 UTC (rev 144416)
@@ -671,6 +671,7 @@
         mouseDidMoveOverElement,
         0, // decidePolicyForNotificationPermissionRequest
         0, // unavailablePluginButtonClicked
+        0, // shouldInstantiatePlugin
     };
     WKPageSetPageUIClient(_webView.pageRef, &uiClient);
 }

Modified: branches/safari-536.29-branch/Tools/WebKitTestRunner/TestController.cpp (144415 => 144416)


--- branches/safari-536.29-branch/Tools/WebKitTestRunner/TestController.cpp	2013-03-01 05:46:21 UTC (rev 144415)
+++ branches/safari-536.29-branch/Tools/WebKitTestRunner/TestController.cpp	2013-03-01 05:59:00 UTC (rev 144416)
@@ -213,6 +213,7 @@
         0, // mouseDidMoveOverElement
         0, // decidePolicyForNotificationPermissionRequest
         0, // unavailablePluginButtonClicked
+        0, // shouldInstantiatePlugin
     };
     WKPageSetPageUIClient(newPage, &otherPageUIClient);
 
@@ -373,6 +374,7 @@
         0, // mouseDidMoveOverElement
         0, // decidePolicyForNotificationPermissionRequest
         0, // unavailablePluginButtonClicked
+        0, // shouldInstantiatePlugin
     };
     WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to