Backed out changesets 2e36a398a61f, fd2aafdc34d0, and 8f2cd9cf4d65 (bug 932854) for Windows mochitest-other crashes on a CLOSED TREE.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 12 Nov 2013 16:24:51 -0500
changeset 154620 5fa603642231124db0336e2606a012cab554af6b
parent 154619 290f7607154de2f82fd0686a8f9351a7acf505a6
child 154621 531c1cc429f868607de0586cd73693e782cec6b9
child 154666 7b014f0f3b031ad57e2995d1f9ee04095c82bda5
push id3479
push userryanvm@gmail.com
push dateTue, 12 Nov 2013 21:24:58 +0000
treeherderfx-team@5fa603642231 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs932854
milestone28.0a1
backs out2e36a398a61f46bdd4ab9eea54f8559d757ac557
fd2aafdc34d0e697da01d2bff618825e3f207cc6
8f2cd9cf4d6524e1acb31af3925d64868b53df1b
Backed out changesets 2e36a398a61f, fd2aafdc34d0, and 8f2cd9cf4d65 (bug 932854) for Windows mochitest-other crashes on a CLOSED TREE.
browser/base/content/browser-plugins.js
browser/base/content/test/general/browser_pluginnotification.js
browser/themes/shared/plugin-doorhanger.inc.css
content/base/test/chrome/test_bug391728.html
dom/plugins/test/mochitest/test_bug479979.xul
toolkit/themes/shared/plugins/pluginProblem.css
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -875,36 +875,34 @@ var gPluginHandler = {
     if (!aBrowser.docShell || !aBrowser.contentWindow) {
       return;
     }
 
     let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser);
     if (!notification)
       return;
 
-    // Make a copy of the actions, removing active plugins and checking for
-    // outdated plugins.
-    let haveInsecure = false;
-    let actions = new Map();
-    for (let action of notification.options.centerActions.values()) {
-      switch (action.fallbackType) {
-        // haveInsecure will trigger the red flashing icon and the infobar
-        // styling below
-        case Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE:
-        case Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE:
-          haveInsecure = true;
-          // fall through
+    let iconClasses = document.getElementById("plugins-notification-icon").classList;
+
+    // Make a copy so we can remove visible plugins
+    let actions = new Map(notification.options.centerActions);
 
-        case Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY:
-          actions.set(action.permissionString, action);
-          continue;
+    for (let pluginInfo of actions.values()) {
+      let fallbackType = pluginInfo.fallbackType;
+      if (fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE ||
+          fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE ||
+          fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_BLOCKLISTED) {
+        iconClasses.add("plugin-blocked");
+        iconClasses.remove("plugin-hidden");
+        return;
       }
     }
 
-    // check for hidden plugins
+    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 info = this._getPluginInfo(plugin);
       if (!actions.has(info.permissionString)) {
         continue;
@@ -912,143 +910,32 @@ var gPluginHandler = {
       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 &&
-          fallbackType != Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE &&
-          fallbackType != Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE) {
+      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);
         if (actions.size == 0) {
           break;
         }
       }
     }
 
-    // Set up the icon
-    document.getElementById("plugins-notification-icon").classList.
-      toggle("plugin-blocked", haveInsecure);
-
-    // Now configure the notification bar
-
-    let notificationBox = gBrowser.getNotificationBox(aBrowser);
-
-    function hideNotification() {
-      let n = notificationBox.getNotificationWithValue("plugin-hidden");
-      if (n) {
-        notificationBox.removeNotification(n, true);
-      }
-    }
-
-    // There are three different cases when showing an infobar:
-    // 1.  A single type of plugin is hidden on the page. Show the UI for that
-    //     plugin.
-    // 2a. Multiple types of plugins are hidden on the page. Show the multi-UI
-    //     with the vulnerable styling.
-    // 2b. Multiple types of plugins are hidden on the page, but none are
-    //     vulnerable. Show the nonvulnerable multi-UI.
-    function showNotification() {
-      let n = notificationBox.getNotificationWithValue("plugin-hidden");
-      if (n) {
-        // If something is already shown, just keep it
-        return;
-      }
-
-      let message;
-      // Icons set directly cannot be manipulated using moz-image-region, so
-      // we use CSS classes instead.
-      let host = gPluginHandler._getHostFromPrincipal(aBrowser.contentDocument.nodePrincipal);
-      let brand = document.getElementById("bundle_brand").getString("brandShortName");
-
-      if (actions.size == 1) {
-        let pluginInfo = [...actions.values()][0];
-        let pluginName = pluginInfo.pluginName;
-
-        switch (pluginInfo.fallbackType) {
-          case Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY:
-            message = gNavigatorBundle.getFormattedString(
-              "pluginActivateNew.message",
-              [pluginName, host]);
-            break;
-          case Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE:
-            message = gNavigatorBundle.getFormattedString(
-              "pluginActivateOutdated.message",
-              [pluginName, host, brand]);
-            break;
-          case Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE:
-            message = gNavigatorBundle.getFormattedString(
-              "pluginActivateVulnerable.message",
-              [pluginName, host, brand]);
-        }
-      } else {
-        // Multi-plugin
-        message = gNavigatorBundle.getFormattedString(
-          "pluginActivateMultiple.message", [host]);
-
-        for (let action of actions.values()) {
-          if (action.fallbackType != Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY) {
-            break;
-          }
-        }
-      }
-
-      // These strings are temporary no-string-change for branch uplift
-      let buttons = [
-        {
-          label: gNavigatorBundle.getString("pluginBlockNow.label"),
-          accessKey: gNavigatorBundle.getString("pluginBlockNow.accesskey"),
-          callback: function() {
-            Services.perms.addFromPrincipal(aBrowser.contentDocument.nodePrincipal,
-                                            "plugin-hidden-notification",
-                                            Services.perms.DENY_ACTION);
-          }
-        },
-        {
-          label: gNavigatorBundle.getString("offlineApps.allow"),
-          accessKey: gNavigatorBundle.getString("offlineApps.allowAccessKey"),
-          callback: function() {
-            let curNotification =
-              PopupNotifications.getNotification("click-to-play-plugins",
-                                                 aBrowser);
-            if (curNotification) {
-              curNotification.reshow();
-            }
-          }
-        }
-      ];
-      n = notificationBox.
-        appendNotification(message, "plugin-hidden", null,
-                           notificationBox.PRIORITY_INFO_HIGH, buttons);
-      if (haveInsecure) {
-        n.classList.add('pluginVulnerable');
-      }
-    }
-
-    if (actions.size == 0) {
-      hideNotification();
-    } else {
-      let notificationPermission = Services.perms.testPermissionFromPrincipal(
-        aBrowser.contentDocument.nodePrincipal, "plugin-hidden-notification");
-      if (notificationPermission == Ci.nsIPermissionManager.DENY_ACTION) {
-        hideNotification();
-      } else {
-        showNotification();
-      }
-    }
+    iconClasses.toggle("plugin-hidden", actions.size != 0);
   },
 
   // Crashed-plugin observer. Notified once per plugin crash, before events
   // are dispatched to individual plugin instances.
   pluginCrashed : function(subject, topic, data) {
     let propertyBag = subject;
     if (!(propertyBag instanceof Ci.nsIPropertyBag2) ||
         !(propertyBag instanceof Ci.nsIWritablePropertyBag2))
--- a/browser/base/content/test/general/browser_pluginnotification.js
+++ b/browser/base/content/test/general/browser_pluginnotification.js
@@ -846,30 +846,30 @@ function test25() {
 
   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");
 
-  let notificationBox = gBrowser.getNotificationBox(gTestBrowser);
-
-  waitForCondition(() => notificationBox.getNotificationWithValue("plugin-hidden") !== null,
+  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");
 
-  let notificationBox = gBrowser.getNotificationBox(gTestBrowser);
-
-  waitForCondition(() => notificationBox.getNotificationWithValue("plugin-hidden") === null,
+  waitForCondition(() => !gBrowser.ownerDocument.
+      getElementById("plugins-notification-icon").classList.
+      contains("plugin-hidden"),
     finishTest,
     "Test 27, expected the plugin notification icon to not be highlighted");
 }
--- a/browser/themes/shared/plugin-doorhanger.inc.css
+++ b/browser/themes/shared/plugin-doorhanger.inc.css
@@ -42,24 +42,8 @@
 .click-to-play-plugins-outer-description {
   margin-top: 8px;
 }
 
 .click-to-play-plugins-notification-link,
 .center-item-link {
   margin: 0;
 }
-
-.messageImage[value="plugin-hidden"] {
-  list-style-image: url("chrome://browser/skin/notification-pluginNormal.png");
-  -moz-image-region: rect(0, 16px, 16px, 0);
-}
-
-/* Keep any changes to this style in sync with pluginProblem.css */
-notification.pluginVulnerable {
-  background-color: rgb(72,72,72);
-  background-image: url(chrome://mozapps/skin/plugins/contentPluginStripe.png);
-  color: white;
-}
-
-notification.pluginVulnerable .messageImage {
-  list-style-image: url("chrome://browser/skin/notification-pluginBlocked.png");
-}
--- a/content/base/test/chrome/test_bug391728.html
+++ b/content/base/test/chrome/test_bug391728.html
@@ -92,37 +92,20 @@ function start_test(plugin) {
   ok(!plugin.disabled, "Test plugin should not be disabled");
   ok(!plugin.blocklisted, "Test plugin should not be blocklisted");
 
   var frame = document.getElementById("testframe");
   frame.addEventListener("load", frame_loaded, true);
   load_frame(test_normal, "file_bug391728");
 }
 
-function clearInfobar() {
-  var Ci = SpecialPowers.Ci;
-  var Cc = SpecialPowers.Cc;
-  ok(Ci != null, "Access Ci");
-  ok(Cc != null, "Access Cc");
-
-  var browser = window.top.QueryInterface(Ci.nsIInterfaceRequestor)
-                      .getInterface(Ci.nsIWebNavigation)
-                      .QueryInterface(Ci.nsIDocShell)
-                      .chromeEventHandler;
-  var chromeWin = browser.ownerDocument.defaultView;
-  var notificationBox = chromeWin.gBrowser.getNotificationBox(browser);
-  var notification = notificationBox.getNotificationWithValue("plugin-hidden");
-  notificationBox.removeNotification(notification, true);
-}
-
 function finish_test(plugin) {
   Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
   resetBlocklist();
   plugin.enabledState = Components.interfaces.nsIPluginTag.STATE_ENABLED;
-  clearInfobar();
   SimpleTest.finish();
 }
 
 function load_frame(nextTest, file) {
   gNextTest = nextTest;
   gDisabled = [];
   gUnknown = [];
   gBlocked = [];
@@ -201,17 +184,17 @@ function test_blocked(plugin) {
 function test_unknown(plugin) {
   is(gUnknown.length, PLUGIN_COUNT, "Should have been unknown plugins");
   test_list(gUnknown);
   is(gDisabled.length, 0, "Should not have been any disabled plugins");
   is(gBlocked.length, 0, "Should not have been any blocked plugins");
   test_style("none");
   setAndUpdateBlocklist(gHttpTestRoot + "blockNoPlugins.xml", function() {
     ok(!plugin.blocklisted, "Plugin shouldn't remain blocklisted");
-    SimpleTest.executeSoon(function() { finish_test(plugin); });
+    finish_test(plugin);
   });
 }
 
 SimpleTest.waitForExplicitFinish();
 window.addEventListener("load", init_test, false);
 </script>
 </pre>
 </body>
--- a/dom/plugins/test/mochitest/test_bug479979.xul
+++ b/dom/plugins/test/mochitest/test_bug479979.xul
@@ -23,18 +23,15 @@ function runTests() {
   try {
     rv = pluginElement1.setUndefinedValueTest();
   } catch (e) {
     exceptionThrown = true;
   }
   is(exceptionThrown, false, "Exception thrown setting undefined variable.");
   is(rv, false, "Setting undefined variable succeeded.");
 
-  // give the UI a chance to settle with the current enabled plugin state
-  // before we finish the test and reset the state to disabled. Otherwise
-  // the UI shows the plugin infobar!
-  SimpleTest.executeSoon(SimpleTest.finish);
+  SimpleTest.finish();
 }
 ]]>
 </script>
 <embed id="plugin1" type="application/x-test" width="300" height="300"></embed>
 </body>
 </window>
--- a/toolkit/themes/shared/plugins/pluginProblem.css
+++ b/toolkit/themes/shared/plugins/pluginProblem.css
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 @namespace html url(http://www.w3.org/1999/xhtml);
 
 /* These styles affect only the bound element, not other page content. */
-/* Keep any changes to these styles in sync with plugin-doorhanger.inc.css */
+
 .mainBox {
   font: message-box;
   font-size: 12px;
   text-align: center;
   display: table;
   width: 100%;
   height: 100%;
   background-color: rgb(72,72,72);