Title: [124921] branches/safari-536.26-branch/Source/WebKit2
Revision
124921
Author
[email protected]
Date
2012-08-07 14:42:05 -0700 (Tue, 07 Aug 2012)

Log Message

Merged r124259.  <rdar://problem/12043772>

Modified Paths

Diff

Modified: branches/safari-536.26-branch/Source/WebKit2/ChangeLog (124920 => 124921)


--- branches/safari-536.26-branch/Source/WebKit2/ChangeLog	2012-08-07 21:36:49 UTC (rev 124920)
+++ branches/safari-536.26-branch/Source/WebKit2/ChangeLog	2012-08-07 21:42:05 UTC (rev 124921)
@@ -1,5 +1,27 @@
 2012-08-06  Lucas Forschler  <[email protected]>
 
+    Merge 124259
+
+    2012-07-31  Anders Carlsson  <[email protected]>
+
+            Prefer the Oracle Java plug-in over the Apple Java plug-in
+            https://bugs.webkit.org/show_bug.cgi?id=92780
+
+            Reviewed by Oliver Hunt.
+
+            * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
+            (WebKit::findPluginWithBundleIdentifier):
+            Add a new helper for finding a plug-in with the given bundle identifier.
+
+            (WebKit::checkForPreferredPlugin):
+            Helper function for making sure that an old plug-in is never loaded if a new plug-in is found, and that the old plug-in
+            is removed from the list of loaded plug-ins if the new plug-in is found.
+
+            (WebKit::PluginInfoStore::shouldUsePlugin):
+            Prefer the Oracle Java plug-in over the Apple Java plug-in.
+
+2012-08-06  Lucas Forschler  <[email protected]>
+
     Merge 123778
 
     2012-07-26  Jer Noble  <[email protected]>

Modified: branches/safari-536.26-branch/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm (124920 => 124921)


--- branches/safari-536.26-branch/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm	2012-08-07 21:36:49 UTC (rev 124920)
+++ branches/safari-536.26-branch/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm	2012-08-07 21:42:05 UTC (rev 124921)
@@ -76,6 +76,33 @@
     return NetscapePluginModule::getPluginInfo(pluginPath, plugin);
 }
 
+static size_t findPluginWithBundleIdentifier(const Vector<PluginModuleInfo>& plugins, const String& bundleIdentifier)
+{
+    for (size_t i = 0; i < plugins.size(); ++i) {
+        if (plugins[i].bundleIdentifier == bundleIdentifier)
+            return i;
+    }
+
+    return notFound;
+}
+
+// Returns true if the given plug-in should be loaded, false otherwise.
+static bool checkForPreferredPlugin(Vector<PluginModuleInfo>& alreadyLoadedPlugins, const PluginModuleInfo& plugin, const String& oldPluginBundleIdentifier, const String& newPluginBundleIdentifier)
+{
+    if (plugin.bundleIdentifier == oldPluginBundleIdentifier) {
+        // If we've already found the new plug-in, we don't want to load the old plug-in.
+        if (findPluginWithBundleIdentifier(alreadyLoadedPlugins, newPluginBundleIdentifier) != notFound)
+            return false;
+    } else if (plugin.bundleIdentifier == newPluginBundleIdentifier) {
+        // If we've already found the old plug-in, remove it from the list of loaded plug-ins.
+        size_t oldPluginIndex = findPluginWithBundleIdentifier(alreadyLoadedPlugins, oldPluginBundleIdentifier);
+        if (oldPluginIndex != notFound)
+            alreadyLoadedPlugins.remove(oldPluginIndex);
+    }
+
+    return true;
+}
+
 bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlugins, const PluginModuleInfo& plugin)
 {
     for (size_t i = 0; i < alreadyLoadedPlugins.size(); ++i) {
@@ -86,6 +113,10 @@
             return false;
     }
 
+    // Prefer the Oracle Java plug-in over the Apple java plug-in.
+    if (!checkForPreferredPlugin(alreadyLoadedPlugins, plugin, "com.apple.java.JavaAppletPlugin", "com.oracle.java.JavaAppletPlugin"))
+        return false;
+
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to