From e8f1f60536b5128dc95d93af2278abf0a20a5fe0 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 12 Nov 2013 16:24:51 -0500 Subject: [PATCH] Backed out changesets 2e36a398a61f, fd2aafdc34d0, and 8f2cd9cf4d65 (bug 932854) for Windows mochitest-other crashes on a CLOSED TREE. --- browser/base/content/browser-plugins.js | 145 ++---------------- .../general/browser_pluginnotification.js | 12 +- .../themes/shared/plugin-doorhanger.inc.css | 16 -- content/base/test/chrome/test_bug391728.html | 19 +-- dom/plugins/test/mochitest/test_bug479979.xul | 5 +- .../themes/shared/plugins/pluginProblem.css | 2 +- 6 files changed, 25 insertions(+), 174 deletions(-) diff --git a/browser/base/content/browser-plugins.js b/browser/base/content/browser-plugins.js index 1e398c163300..212993113164 100644 --- a/browser/base/content/browser-plugins.js +++ b/browser/base/content/browser-plugins.js @@ -880,26 +880,24 @@ var gPluginHandler = { 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; - case Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY: - actions.set(action.permissionString, action); - continue; + // Make a copy so we can remove visible plugins + let actions = new Map(notification.options.centerActions); + + 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) @@ -917,9 +915,7 @@ var gPluginHandler = { } 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"); @@ -934,116 +930,7 @@ var gPluginHandler = { } } - // 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 diff --git a/browser/base/content/test/general/browser_pluginnotification.js b/browser/base/content/test/general/browser_pluginnotification.js index 60ec3328aa64..079ac7542118 100644 --- a/browser/base/content/test/general/browser_pluginnotification.js +++ b/browser/base/content/test/general/browser_pluginnotification.js @@ -851,9 +851,9 @@ 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 @@ -867,9 +867,9 @@ 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"); } diff --git a/browser/themes/shared/plugin-doorhanger.inc.css b/browser/themes/shared/plugin-doorhanger.inc.css index 6a9529554f12..f427eed06449 100644 --- a/browser/themes/shared/plugin-doorhanger.inc.css +++ b/browser/themes/shared/plugin-doorhanger.inc.css @@ -47,19 +47,3 @@ .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"); -} diff --git a/content/base/test/chrome/test_bug391728.html b/content/base/test/chrome/test_bug391728.html index 01fcbf32a313..2842129a26e5 100644 --- a/content/base/test/chrome/test_bug391728.html +++ b/content/base/test/chrome/test_bug391728.html @@ -97,27 +97,10 @@ function start_test(plugin) { 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(); } @@ -206,7 +189,7 @@ function test_unknown(plugin) { 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); }); } diff --git a/dom/plugins/test/mochitest/test_bug479979.xul b/dom/plugins/test/mochitest/test_bug479979.xul index 622f75508bdb..473b299f149c 100644 --- a/dom/plugins/test/mochitest/test_bug479979.xul +++ b/dom/plugins/test/mochitest/test_bug479979.xul @@ -28,10 +28,7 @@ function runTests() { 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(); } ]]> diff --git a/toolkit/themes/shared/plugins/pluginProblem.css b/toolkit/themes/shared/plugins/pluginProblem.css index 7a226e542f10..54d9fb9126ad 100644 --- a/toolkit/themes/shared/plugins/pluginProblem.css +++ b/toolkit/themes/shared/plugins/pluginProblem.css @@ -5,7 +5,7 @@ @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;