If the Apple Java plug-in is blocked and no runtime is installed, don't load it
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Aug 2012 20:42:01 +0000 (20:42 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Aug 2012 20:42:01 +0000 (20:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=93289
<rdar://problem/11730092>

Reviewed by Dan Bernstein.

Source/WebKit2:

If the Apple Java plug-in is blocked, but there's no Java runtime installed (or the Java plug-in is disabled),
don't even include it in the plug-in info store.

* UIProcess/Plugins/PluginInfoStore.cpp:
(WebKit::PluginInfoStore::shouldBlockPlugin):
Since this is static now, it shouldn't be const.

* UIProcess/Plugins/PluginInfoStore.h:
(PluginInfoStore):
shouldBlockPlugin can be static.

* UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
(WebKit::PluginInfoStore::shouldUsePlugin):
Return false if the Apple Java plug-in is blocked but Java isn't installed or enabled.

(WebKit::PluginInfoStore::shouldBlockPlugin):
Since this is static now, it shouldn't be const.

WebKitLibraries:

Add WKJLIsRuntimeAndWebComponentsInstalled().

* WebKitSystemInterface.h:
* libWebKitSystemInterfaceLion.a:
* libWebKitSystemInterfaceMountainLion.a:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@124799 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h
Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
WebKitLibraries/ChangeLog
WebKitLibraries/WebKitSystemInterface.h
WebKitLibraries/libWebKitSystemInterfaceLion.a
WebKitLibraries/libWebKitSystemInterfaceMountainLion.a
WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a

index 93005b6..ae6a6ff 100644 (file)
@@ -1,3 +1,29 @@
+2012-08-06  Anders Carlsson  <andersca@apple.com>
+
+        If the Apple Java plug-in is blocked and no runtime is installed, don't load it
+        https://bugs.webkit.org/show_bug.cgi?id=93289
+        <rdar://problem/11730092>
+
+        Reviewed by Dan Bernstein.
+
+        If the Apple Java plug-in is blocked, but there's no Java runtime installed (or the Java plug-in is disabled),
+        don't even include it in the plug-in info store.
+
+        * UIProcess/Plugins/PluginInfoStore.cpp:
+        (WebKit::PluginInfoStore::shouldBlockPlugin):
+        Since this is static now, it shouldn't be const.
+
+        * UIProcess/Plugins/PluginInfoStore.h:
+        (PluginInfoStore):
+        shouldBlockPlugin can be static.
+
+        * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
+        (WebKit::PluginInfoStore::shouldUsePlugin):
+        Return false if the Apple Java plug-in is blocked but Java isn't installed or enabled.
+
+        (WebKit::PluginInfoStore::shouldBlockPlugin):
+        Since this is static now, it shouldn't be const.
+
 2012-08-06  Mario Sanchez Prada  <msanchez@igalia.com>
 
         [WK2][GTK] Improvements for the new spell-checking API
index 37ff060..bff8fa9 100644 (file)
@@ -187,7 +187,7 @@ static inline String pathExtension(const KURL& url)
 }
 
 #if !PLATFORM(MAC)
-bool PluginInfoStore::shouldBlockPlugin(const PluginModuleInfo&) const
+bool PluginInfoStore::shouldBlockPlugin(const PluginModuleInfo&)
 {
     return false;
 }
index 42df69b..1b2082d 100644 (file)
@@ -56,7 +56,7 @@ public:
 
     // Return whether this plug-in should be blocked from being instantiated.
     // Note that the plug-in will still be seen by e.g. navigator.plugins
-    bool shouldBlockPlugin(const PluginModuleInfo&) const;
+    static bool shouldBlockPlugin(const PluginModuleInfo&);
 
 private:
     PluginModuleInfo findPluginForMIMEType(const String& mimeType) const;
index 2af818d..9b86aae 100644 (file)
@@ -123,10 +123,17 @@ bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlu
     if (!checkForPreferredPlugin(alreadyLoadedPlugins, plugin, "com.apple.java.JavaAppletPlugin", "com.oracle.java.JavaAppletPlugin"))
         return false;
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
+    if (plugin.bundleIdentifier == "com.apple.java.JavaAppletPlugin" && shouldBlockPlugin(plugin) && !WKJLIsRuntimeAndWebComponentsInstalled()) {
+        // If the Apple Java plug-in is blocked and there's no Java runtime installed, just pretend that the plug-in doesn't exist.
+        return false;
+    }
+#endif
+
     return true;
 }
 
-bool PluginInfoStore::shouldBlockPlugin(const PluginModuleInfo& plugin) const
+bool PluginInfoStore::shouldBlockPlugin(const PluginModuleInfo& plugin)
 {
     return WKShouldBlockPlugin(plugin.bundleIdentifier, plugin.versionString);
 }
index 44df9f9..a5dd4a4 100644 (file)
@@ -1,3 +1,17 @@
+2012-08-06  Anders Carlsson  <andersca@apple.com>
+
+        If the Apple Java plug-in is blocked and no runtime is installed, don't load it
+        https://bugs.webkit.org/show_bug.cgi?id=93289
+        <rdar://problem/11730092>
+
+        Reviewed by Dan Bernstein.
+
+        Add WKJLIsRuntimeAndWebComponentsInstalled().
+
+        * WebKitSystemInterface.h:
+        * libWebKitSystemInterfaceLion.a:
+        * libWebKitSystemInterfaceMountainLion.a:
+
 2012-08-01  Jon Lee  <jonlee@apple.com>
 
         Update WKSI.
index 0d7727f..6e99ca5 100644 (file)
@@ -501,6 +501,10 @@ CGFloat WKNSElasticDeltaForReboundDelta(CGFloat delta);
 CGFloat WKNSReboundDeltaForElasticDelta(CGFloat delta);
 #endif
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
+Boolean WKJLIsRuntimeAndWebComponentsInstalled(void);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
index 02ea334..846cb2d 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceLion.a and b/WebKitLibraries/libWebKitSystemInterfaceLion.a differ
index 3f6a2c0..0c24ce0 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a and b/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a differ
index 7df8e22..875beef 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a differ