Bug 1357300 - Enable flash plugin preferences even when set to 'Never Activate'. r=rhelmer
authorPerry Jiang <jiangperry@gmail.com>
Mon, 12 Jun 2017 13:20:03 -0700
changeset 412318 5c652308e569
parent 412317 6977697a2dcf
child 412319 a26040f4d439
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhelmer
bugs1357300
milestone56.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 1357300 - Enable flash plugin preferences even when set to 'Never Activate'. r=rhelmer MozReview-Commit-ID: BSJcWoUFXVb
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/test/browser/browser-common.ini
toolkit/mozapps/extensions/test/browser/browser_CTP_plugins.js
toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js
toolkit/mozapps/extensions/test/browser/browser_pluginprefs_is_not_disabled.js
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -1250,17 +1250,17 @@ var gViewController = {
         gEventManager.delegateAddonEvent("onCheckingUpdate", [aAddon]);
         aAddon.findUpdates(listener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
       }
     },
 
     cmd_showItemPreferences: {
       isEnabled(aAddon) {
         if (!aAddon ||
-            (!aAddon.isActive && !aAddon.isGMPlugin) ||
+            (!aAddon.isActive && aAddon.type !== "plugin") ||
             !aAddon.optionsURL) {
           return false;
         }
         if (gViewController.currentViewObj == gDetailView &&
             (aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE ||
              aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_BROWSER)) {
           return false;
         }
--- a/toolkit/mozapps/extensions/test/browser/browser-common.ini
+++ b/toolkit/mozapps/extensions/test/browser/browser-common.ini
@@ -52,14 +52,15 @@ tags = openwindow
 skip-if = os == 'win' # Disabled on Windows due to intermittent failures (bug 1135866)
 [browser_types.js]
 [browser_inlinesettings.js]
 [browser_inlinesettings_browser.js]
 [browser_inlinesettings_custom.js]
 [browser_inlinesettings_info.js]
 [browser_tabsettings.js]
 [browser_pluginprefs.js]
+[browser_pluginprefs_is_not_disabled.js]
 skip-if = buildapp == 'mulet'
 [browser_CTP_plugins.js]
 tags = blocklist
 skip-if = buildapp == 'mulet'
 [browser_webext_options.js]
 tags = webextensions
--- a/toolkit/mozapps/extensions/test/browser/browser_CTP_plugins.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_CTP_plugins.js
@@ -55,17 +55,17 @@ add_task(async function() {
 
   let testPlugin = await new Promise(resolve => AddonManager.getAddonByID(testPluginId, resolve));
   isnot(testPlugin, null, "part2.1: Test Plug-in should exist");
 
   let pluginEl = get_addon_element(managerWindow, testPluginId);
   pluginEl.parentNode.ensureElementIsVisible(pluginEl);
   let enableButton = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "enable-btn");
   is_element_hidden(enableButton, "part3: enable button should not be visible");
-  let disableButton = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "enable-btn");
+  let disableButton = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "disable-btn");
   is_element_hidden(disableButton, "part3: disable button should not be visible");
   let menu = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "state-menulist");
   is_element_visible(menu, "part3: state menu should be visible");
   let askToActivateItem = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "ask-to-activate-menuitem");
   is(menu.selectedItem, askToActivateItem, "part3: state menu should have 'Ask To Activate' selected");
 
   let pluginTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, gHttpTestRoot + "plugin_test.html");
   let pluginBrowser = pluginTab.linkedBrowser;
--- a/toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js
@@ -34,17 +34,17 @@ add_test(function() {
     ok(testPluginId, "Test Plug-in should exist")
 
     AddonManager.getAddonByID(testPluginId, function(testPlugin) {
       let pluginEl = get_addon_element(gManagerWindow, testPluginId);
       is(pluginEl.mAddon.optionsType, AddonManager.OPTIONS_TYPE_INLINE, "Options should be inline type");
       pluginEl.parentNode.ensureElementIsVisible(pluginEl);
 
       let button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "preferences-btn");
-      is_element_visible(button, "Preferences button should be hidden");
+      is_element_visible(button, "Preferences button should be visible");
 
       button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "details-btn");
       EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
 
       wait_for_view_load(gManagerWindow, function() {
         let pluginLibraries = gManagerWindow.document.getElementById("pluginLibraries");
         ok(pluginLibraries, "Plugin file name row should be displayed");
         // the file name depends on the platform
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/browser/browser_pluginprefs_is_not_disabled.js
@@ -0,0 +1,26 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+// Tests plugin prefs being enabled
+
+function getTestPlugin(aPlugins) {
+  let [testPlugin] = aPlugins.filter(plugin => plugin.name === "Test Plug-in");
+  Assert.ok(testPlugin, "Test Plug-in should exist");
+  return testPlugin;
+}
+
+add_task(async function taskCheckPluginPrefsEnabled() {
+  const [gManagerWindow, plugins] = await Promise.all([open_manager(), AddonManager.getAddonsByTypes(["plugin"])]);
+  const testPlugin = getTestPlugin(plugins);
+  const testPluginTag = getTestPluginTag();
+  Assert.ok(testPluginTag, "Test Plug-in tag should exist");
+  const initialTestPluginState = testPluginTag.enabledState;
+
+  Assert.ok(gManagerWindow.gViewController.commands.cmd_showItemPreferences.isEnabled(testPlugin), "Test Plug-in preferences should be enabled");
+  testPluginTag.enabledState = Ci.nsIPluginTag.STATE_DISABLED;
+  Assert.ok(gManagerWindow.gViewController.commands.cmd_showItemPreferences.isEnabled(testPlugin), "Test Plug-in preferences should be enabled");
+
+  testPluginTag.enabledState = initialTestPluginState;
+  await close_manager(gManagerWindow);
+});