Bug 1498410 - Part 5 - Fix tests broken by Screenshots migration to pure webextension; r=aswan
☠☠ backed out by f17dfd86498e ☠ ☠
authorJared Hirsch <ohai@6a68.net>
Fri, 12 Oct 2018 23:42:54 +0000
changeset 499418 4842c9240ccf7002a4139b85fab77af48b512571
parent 499417 9ba0249790042f3db5fe31fa1a46c0a607bc1434
child 499419 6beac5dc489916e57c24d79465c99085663f2cd0
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1498410
milestone64.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 1498410 - Part 5 - Fix tests broken by Screenshots migration to pure webextension; r=aswan * Explicitly disable Screenshots in PageActions and context menu tests * Update browser_preferences_usage test to accommodate Screenshots as a webextension (Moving Screenshots from legacy bootstrap to webextension seems to require reducing the minimum number of values in the `extensions.getAddons.cache.enabled` pref by one) MozReview-Commit-ID: LCNaaXSE8w0 Differential Revision: https://phabricator.services.mozilla.com/D8507
browser/base/content/test/general/browser_contextmenu.js
browser/base/content/test/general/browser_contextmenu_input.js
browser/base/content/test/general/contextmenu_common.js
browser/base/content/test/performance/browser_preferences_usage.js
browser/modules/test/browser/browser_PageActions.js
--- a/browser/base/content/test/general/browser_contextmenu.js
+++ b/browser/base/content/test/general/browser_contextmenu.js
@@ -14,16 +14,22 @@ let hasPocket = Services.prefs.getBoolPr
 let hasContainers = Services.prefs.getBoolPref("privacy.userContext.enabled");
 
 const example_base = "http://example.com/browser/browser/base/content/test/general/";
 const chrome_base = "chrome://mochitests/content/browser/browser/base/content/test/general/";
 
 /* import-globals-from contextmenu_common.js */
 Services.scriptloader.loadSubScript(chrome_base + "contextmenu_common.js", this);
 
+add_task(async function init() {
+  // Ensure screenshots is really disabled (bug 1498738)
+  const addon = await AddonManager.getAddonByID("screenshots@mozilla.org");
+  await addon.disable({allowSystemAddons: true});
+});
+
 // Below are test cases for XUL element
 add_task(async function test_xul_text_link_label() {
   let url = chrome_base + "subtst_contextmenu_xul.xul";
 
   await BrowserTestUtils.openNewForegroundTab({
     gBrowser,
     url,
     waitForLoad: true,
--- a/browser/base/content/test/general/browser_contextmenu_input.js
+++ b/browser/base/content/test/general/browser_contextmenu_input.js
@@ -7,16 +7,20 @@ add_task(async function test_setup() {
   const example_base = "http://example.com/browser/browser/base/content/test/general/";
   const url = example_base + "subtst_contextmenu_input.html";
   await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
 
   const chrome_base = "chrome://mochitests/content/browser/browser/base/content/test/general/";
   const contextmenu_common = chrome_base + "contextmenu_common.js";
   /* import-globals-from contextmenu_common.js */
   Services.scriptloader.loadSubScript(contextmenu_common, this);
+
+  // Ensure screenshots is really disabled (bug 1498738)
+  const addon = await AddonManager.getAddonByID("screenshots@mozilla.org");
+  await addon.disable({allowSystemAddons: true});
 });
 
 add_task(async function test_text_input() {
   await test_contextmenu("#input_text",
     ["context-undo",        false,
      "---",                 null,
      "context-cut",         true,
      "context-copy",        true,
@@ -170,20 +174,16 @@ add_task(async function test_tel_email_u
       ["context-undo",        false,
        "---",                 null,
        "context-cut",         true,
        "context-copy",        true,
        "context-paste",       null, // ignore clipboard state
        "context-delete",      false,
        "---",                 null,
        "context-selectall",   null], {
-      // XXX Bug 1345081. Currently the Screenshots menu option is shown for
-      // various text elements even though it is set to type "page". That bug
-      // should remove the need for next line.
-      maybeScreenshotsPresent: true,
       skipFocusChange: true,
     });
   }
 });
 
 add_task(async function test_date_time_color_range_month_week_datetimelocal_input() {
   for (let selector of ["#input_date", "#input_time", "#input_color",
                         "#input_range", "#input_month", "#input_week",
--- a/browser/base/content/test/general/contextmenu_common.js
+++ b/browser/base/content/test/general/contextmenu_common.js
@@ -67,17 +67,17 @@ function getVisibleMenuItems(aMenu, aDat
             } else if (item.id.indexOf("spell-check-dictionary-") != 0 &&
                        item.id != "spell-no-suggestions" &&
                        item.id != "spell-add-dictionaries-main" &&
                        item.id != "context-savelinktopocket" &&
                        item.id != "fill-login-saved-passwords" &&
                        item.id != "fill-login-no-logins" &&
                        // XXX Screenshots doesn't have an access key. This needs
                        // at least bug 1320462 fixing first.
-                       item.id != "screenshots_mozilla_org_create-screenshot") {
+                       item.id != "screenshots_mozilla_org-menuitem-_create-screenshot") {
               ok(key, "menuitem " + item.id + " has an access key");
               if (accessKeys[key])
                   ok(false, "menuitem " + item.id + " has same accesskey as " + accessKeys[key]);
               else
                   accessKeys[key] = item.id;
             }
             if (!isGenerated && !isPageMenuItem) {
               items.push(item.id);
@@ -326,17 +326,17 @@ async function test_contextmenu(selector
       let inspectA11YItems = ["context-inspect-a11y", true];
       menuItems = menuItems.concat(inspectA11YItems);
     }
 
     if (options.maybeScreenshotsPresent &&
         !Services.prefs.getBoolPref("extensions.screenshots.disabled", false)) {
       let screenshotItems = [
         "---", null,
-        "screenshots_mozilla_org_create-screenshot", true,
+        "screenshots_mozilla_org-menuitem-_create-screenshot", true,
       ];
 
       menuItems = menuItems.concat(screenshotItems);
     }
 
     checkContextMenu(menuItems);
   }
 
--- a/browser/base/content/test/performance/browser_preferences_usage.js
+++ b/browser/base/content/test/performance/browser_preferences_usage.js
@@ -93,28 +93,19 @@ add_task(async function startup() {
     "layout.css.dpi": {
       min: 45,
       max: 75,
     },
     "network.loadinfo.skip_type_assertion": {
       // This is accessed in debug only.
     },
     "extensions.getAddons.cache.enabled": {
-      min: 6,
+      min: 5,
       max: 55,
     },
-
-    // Disabling screenshots in the default test profile triggers some
-    // work in the chrome registry that reads this pref.  This can be removed
-    // when bootstrapped extensions are gone, or even when screenshots
-    // moves away from bootstrap (bug 1422437)
-    "chrome.override_package.global": {
-      min: 0,
-      max: 50,
-    },
   };
 
   let startupRecorder = Cc["@mozilla.org/test/startuprecorder;1"].getService().wrappedJSObject;
   await startupRecorder.done;
 
   ok(startupRecorder.data.prefStats, "startupRecorder has prefStats");
 
   checkPrefGetters(startupRecorder.data.prefStats, max, whitelist);
--- a/browser/modules/test/browser/browser_PageActions.js
+++ b/browser/modules/test/browser/browser_PageActions.js
@@ -13,16 +13,20 @@ add_task(async function init() {
     gBrowser,
     url: "http://example.com/",
   });
 
   await disableNonReleaseActions();
   registerCleanupFunction(async () => {
     BrowserTestUtils.removeTab(tab);
   });
+
+  // Ensure screenshots is really disabled (bug 1498738)
+  const addon = await AddonManager.getAddonByID("screenshots@mozilla.org");
+  await addon.disable({allowSystemAddons: true});
 });
 
 
 // Tests a simple non-built-in action without an iframe or subview.  Also
 // thoroughly checks most of the action's properties, methods, and DOM nodes, so
 // it's not necessary to do that in general in other test tasks.
 add_task(async function simple() {
   let iconURL = "chrome://browser/skin/mail.svg";