Bug 745187 part B - If a plugin is already activated, don't refresh the page.
authorBenjamin Smedberg <benjamin@smedbergs.us>
Thu, 07 Nov 2013 10:14:33 -0500
changeset 166430 95b5e9fcccee5f0b9f571be2edfe6abdba7772f9
parent 166429 91a15288b91125b2b14e3070667185de7ef99c5c
child 166431 033ab73cf295db93d5c010fbb540fa6bd3caaef4
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs745187
milestone27.0a2
Bug 745187 part B - If a plugin is already activated, don't refresh the page.
browser/base/content/browser-plugins.js
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -723,26 +723,28 @@ var gPluginHandler = {
     let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIDOMWindowUtils);
     let plugins = cwu.plugins;
     let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
 
     let pluginFound = false;
     for (let plugin of plugins) {
       plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-      // canActivatePlugin will return false if this isn't a known plugin type,
-      // so the pluginHost.getPermissionStringForType call is protected
-      if (gPluginHandler.canActivatePlugin(plugin) &&
-          aPluginInfo.permissionString == pluginHost.getPermissionStringForType(plugin.actualType)) {
-        let overlay = this.getPluginUI(plugin, "main");
-        if (overlay) {
-          overlay.removeEventListener("click", gPluginHandler._overlayClickListener, true);
+      if (!gPluginHandler.isKnownPlugin(plugin)) {
+        continue;
+      }
+      if (aPluginInfo.permissionString == pluginHost.getPermissionStringForType(plugin.actualType)) {
+        pluginFound = true;
+        if (gPluginHandler.canActivatePlugin(plugin)) {
+          let overlay = this.getPluginUI(plugin, "main");
+          if (overlay) {
+            overlay.removeEventListener("click", gPluginHandler._overlayClickListener, true);
+          }
+          plugin.playPlugin();
         }
-        plugin.playPlugin();
-        pluginFound = true;
       }
     }
 
     // If there are no instances of the plugin on the page any more, what the
     // user probably needs is for us to allow and then refresh.
     if (!pluginFound) {
       browser.reload();
     }