Bug 934503 - Activated hidden plugins should not show the hidden plugin notification icon, r=jaws
authorBenjamin Smedberg <benjamin@smedbergs.us>
Tue, 05 Nov 2013 16:43:53 -0500
changeset 153716 33fdb96c1ead923bf0b22b22cb048d4b8adbe909
parent 153715 abd3a6ce1eaa9e6b44177f15b2e71b05be8581f3
child 153717 5298090cde0dcd7409f799342d482a5a5c1b5442
push id25604
push usercbook@mozilla.com
push dateWed, 06 Nov 2013 12:09:51 +0000
treeherdermozilla-central@88bc6beaec9d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs934503
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 934503 - Activated hidden plugins should not show the hidden plugin notification icon, r=jaws
browser/base/content/browser-plugins.js
browser/base/content/test/general/browser_pluginnotification.js
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -898,22 +898,29 @@ var gPluginHandler = {
 
     iconClasses.remove("plugin-blocked");
 
     let contentWindow = aBrowser.contentWindow;
     let contentDoc = aBrowser.contentDocument;
     let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIDOMWindowUtils);
     for (let plugin of cwu.plugins) {
-      let fallbackType = plugin.pluginFallbackType;
-      if (fallbackType != Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY) {
+      let info = this._getPluginInfo(plugin);
+      if (!actions.has(info.permissionString)) {
         continue;
       }
-      let info = this._getPluginInfo(plugin);
-      if (!actions.has(info.permissionString)) {
+      let fallbackType = info.fallbackType;
+      if (fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
+        actions.delete(info.permissionString);
+        if (actions.size == 0) {
+          break;
+        }
+        continue;
+      }
+      if (fallbackType != Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY) {
         continue;
       }
       let overlay = this.getPluginUI(plugin, "main");
       if (!overlay) {
         continue;
       }
       if (!this.isTooSmall(plugin, overlay)) {
         actions.delete(info.permissionString);
--- a/browser/base/content/test/general/browser_pluginnotification.js
+++ b/browser/base/content/test/general/browser_pluginnotification.js
@@ -839,10 +839,37 @@ function test24d() {
   });
 }
 
 function test25() {
   let notification = PopupNotifications.getNotification("click-to-play-plugins");
   ok(notification, "Test 25: There should be a plugin notification even if the plugin was immediately removed");
   ok(notification.dismissed, "Test 25: The notification should be dismissed by default");
 
-  finishTest();
+  prepareTest(() => executeSoon(test26), gTestRoot + "plugin_small.html");
 }
+
+function test26() {
+  let notification = PopupNotifications.getNotification("click-to-play-plugins");
+  ok(notification, "Test 26: There should be a plugin notification");
+
+  waitForCondition(() => gBrowser.ownerDocument.
+      getElementById("plugins-notification-icon").classList.
+      contains("plugin-hidden"),
+    () => {
+      // Don't use setTestPluginEnabledState here because we already saved the
+      // prior value
+      getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
+      prepareTest(test27, gTestRoot + "plugin_small.html");
+    },
+    "Test 26, expected the plugin notification icon to be highlighted");
+}
+
+function test27() {
+  let notification = PopupNotifications.getNotification("click-to-play-plugins");
+  ok(notification, "Test 27: There should be a plugin notification");
+
+  waitForCondition(() => !gBrowser.ownerDocument.
+      getElementById("plugins-notification-icon").classList.
+      contains("plugin-hidden"),
+    finishTest,
+    "Test 27, expected the plugin notification icon to not be highlighted");
+}