Bug 883404 (UI portion) - Disable running plugins on the current page when the user chooses "Block", r=jaws
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 11 Nov 2013 16:11:12 -0500
changeset 154652 aa98a38bf11eb11a50ca8a57a38db8eea8513963
parent 154651 8f2cd9cf4d6524e1acb31af3925d64868b53df1b
child 154653 fd2aafdc34d0e697da01d2bff618825e3f207cc6
push id25652
push userkwierso@gmail.com
push dateWed, 13 Nov 2013 02:43:23 +0000
treeherdermozilla-central@7b014f0f3b03 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs883404
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 883404 (UI portion) - Disable running plugins on the current page when the user chooses "Block", r=jaws
browser/base/content/browser-plugins.js
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -726,20 +726,16 @@ var gPluginHandler = {
     }
 
     let browser = aNotification.browser;
     let contentWindow = browser.contentWindow;
     if (aNewState != "continue") {
       let principal = contentWindow.document.nodePrincipal;
       Services.perms.addFromPrincipal(principal, aPluginInfo.permissionString,
                                       permission, expireType, expireTime);
-
-      if (aNewState == "block") {
-        return;
-      }
     }
 
     // Manually activate the plugins that would have been automatically
     // activated.
     let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIDOMWindowUtils);
     let plugins = cwu.plugins;
     let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
@@ -747,29 +743,33 @@ var gPluginHandler = {
     let pluginFound = false;
     for (let plugin of plugins) {
       plugin.QueryInterface(Ci.nsIObjectLoadingContent);
       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);
+        if (aNewState == "block") {
+          plugin.reload(true);
+        } else {
+          if (gPluginHandler.canActivatePlugin(plugin)) {
+            let overlay = this.getPluginUI(plugin, "main");
+            if (overlay) {
+              overlay.removeEventListener("click", gPluginHandler._overlayClickListener, true);
+            }
+            plugin.playPlugin();
           }
-          plugin.playPlugin();
         }
       }
     }
 
     // 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) {
+    if (aNewState != "block" && !pluginFound) {
       browser.reload();
     }
   },
 
   _showClickToPlayNotification: function PH_showClickToPlayNotification(aBrowser, aPlugin, aShowNow) {
     let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser);
     let plugins = [];