Backed out changeset 4c208d905a9d (bug 1343179) for TV failures in toolkit/mozapps/extensions/test/browser/browser_extension_sideloading_permission.js
authorshindli <shindli@mozilla.com>
Sat, 29 Sep 2018 10:55:40 +0300
changeset 494611 87256a1f66d244e80e1cb2e5141a9e0182892019
parent 494610 3266c319db3ba2d2ab831eed88adcef94cf48b87
child 494612 177ee73ca28834715178aebafd19faebf2e1c85a
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1343179
milestone64.0a1
backs out4c208d905a9d49216f0a53c4aaa1ca3f38f3d2e6
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
Backed out changeset 4c208d905a9d (bug 1343179) for TV failures in toolkit/mozapps/extensions/test/browser/browser_extension_sideloading_permission.js
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/test/browser/browser.ini
toolkit/mozapps/extensions/test/browser/browser_bug567127.js
toolkit/mozapps/extensions/test/browser/browser_dragdrop.js
toolkit/mozapps/extensions/test/browser/browser_extension_sideloading_permission.js
toolkit/mozapps/extensions/test/browser/head.js
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -1130,20 +1130,17 @@ var gViewController = {
             let subject = {
               wrappedJSObject: {
                 target: getBrowserElement(),
                 info: {
                   type: "sideload",
                   addon: aAddon,
                   icon: aAddon.iconURL,
                   permissions: perms,
-                  resolve() {
-                    aAddon.markAsSeen();
-                    aAddon.enable();
-                  },
+                  resolve() { aAddon.enable(); },
                   reject() {},
                 },
               },
             };
             Services.obs.notifyObservers(subject, "webextension-permission-prompt");
             return;
           }
         }
--- a/toolkit/mozapps/extensions/test/browser/browser.ini
+++ b/toolkit/mozapps/extensions/test/browser/browser.ini
@@ -52,17 +52,16 @@ skip-if = os == "linux" && !debug # Bug 
 [browser_bug618502.js]
 [browser_bug679604.js]
 [browser_bug590347.js]
 [browser_checkAddonCompatibility.js]
 [browser_details.js]
 [browser_discovery.js]
 [browser_dragdrop.js]
 [browser_dragdrop_incompat.js]
-[browser_extension_sideloading_permission.js]
 [browser_file_xpi_no_process_switch.js]
 skip-if = true # Bug 1449071 - Frequent failures
 [browser_getmorethemes.js]
 [browser_globalwarnings.js]
 [browser_gmpProvider.js]
 skip-if = os == 'linux' && !debug # Bug 1398766
 [browser_inlinesettings_browser.js]
 skip-if = os == 'mac' || os == 'linux' # Bug 1483347
--- a/toolkit/mozapps/extensions/test/browser/browser_bug567127.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug567127.js
@@ -4,16 +4,42 @@
 
 // Tests bug 567127 - Add install button to the add-ons manager
 
 var MockFilePicker = SpecialPowers.MockFilePicker;
 MockFilePicker.init(window);
 
 var gManagerWindow;
 
+/**
+ * Wait for the given PopupNotification to display
+ *
+ * @param {string} name
+ *        The name of the notification to wait for.
+ *
+ * @returns {Promise}
+ *          Resolves with the notification window.
+ */
+function promisePopupNotificationShown(name) {
+  return new Promise(resolve => {
+    function popupshown() {
+      let notification = PopupNotifications.getNotification(name);
+      if (!notification) { return; }
+
+      ok(notification, `${name} notification shown`);
+      ok(PopupNotifications.isPanelOpen, "notification panel open");
+
+      PopupNotifications.panel.removeEventListener("popupshown", popupshown);
+      resolve(PopupNotifications.panel.firstChild);
+    }
+
+    PopupNotifications.panel.addEventListener("popupshown", popupshown);
+  });
+}
+
 async function checkInstallConfirmation(...names) {
   let notificationCount = 0;
   let observer = {
     observe(aSubject, aTopic, aData) {
       var installInfo = aSubject.wrappedJSObject;
       isnot(installInfo.browser, null, "Notification should have non-null browser");
       Assert.deepEqual(installInfo.installs[0].installTelemetryInfo, {
         source: "about:addons",
--- a/toolkit/mozapps/extensions/test/browser/browser_dragdrop.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_dragdrop.js
@@ -9,16 +9,42 @@
 // this automatically.
 
 // Instead of loading EventUtils.js into the test scope in browser-test.js for all tests,
 // we only need EventUtils.js for a few files which is why we are using loadSubScript.
 var gManagerWindow;
 var EventUtils = {};
 Services.scriptloader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
 
+/**
+ * Wait for the given PopupNotification to display
+ *
+ * @param {string} name
+ *        The name of the notification to wait for.
+ *
+ * @returns {Promise}
+ *          Resolves with the notification window.
+ */
+function promisePopupNotificationShown(name) {
+  return new Promise(resolve => {
+    function popupshown() {
+      let notification = PopupNotifications.getNotification(name);
+      if (!notification) { return; }
+
+      ok(notification, `${name} notification shown`);
+      ok(PopupNotifications.isPanelOpen, "notification panel open");
+
+      PopupNotifications.panel.removeEventListener("popupshown", popupshown);
+      resolve(PopupNotifications.panel.firstElementChild);
+    }
+
+    PopupNotifications.panel.addEventListener("popupshown", popupshown);
+  });
+}
+
 async function checkInstallConfirmation(...names) {
   let notificationCount = 0;
   let observer = {
     observe(aSubject, aTopic, aData) {
       var installInfo = aSubject.wrappedJSObject;
       isnot(installInfo.browser, null, "Notification should have non-null browser");
 
       is(installInfo.installs.length, 1, "Got one AddonInstall instance as expected");
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_extension_sideloading_permission.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-/*
-* Test Permission Popup for Sideloaded Extensions.
-*/
-const {AddonTestUtils} = ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm", {});
-const ADDON_ID = "addon1@test.mozilla.org";
-
-AddonTestUtils.initMochitest(this);
-
-// Loading extension by sideloading method
-add_task(async function test() {
-
-  await SpecialPowers.pushPrefEnv({
-    set: [
-      ["xpinstall.signatures.required", false],
-      ["extensions.autoDisableScopes", 15],
-      ["extensions.ui.ignoreUnsigned", true],
-    ],
-  });
-
-  let options = {
-    manifest: {
-      applications: {gecko: {id: ADDON_ID}},
-      name: "Test 1",
-      permissions: ["history", "https://*/*"],
-      icons: {"64": "foo-icon.png"},
-    },
-  };
-
-  let xpi = AddonTestUtils.createTempWebExtensionFile(options);
-  await AddonTestUtils.manuallyInstall(xpi);
-
-  let changePromise = new Promise(resolve => ExtensionsUI.once("change", resolve));
-  ExtensionsUI._checkForSideloaded();
-  await changePromise;
-
-  // Test click event on permission cancel option.
-  let manager = await open_manager("addons://list/extension");
-  let addon = get_addon_element(manager, ADDON_ID);
-
-  Assert.notEqual(addon, null, "Found sideloaded addon in about:addons");
-  let el = addon.ownerDocument.getAnonymousElementByAttribute(addon, "anonid", "disable-btn");
-  is_element_hidden(el, "Disable button not visible.");
-  el = addon.ownerDocument.getAnonymousElementByAttribute(addon, "anonid", "enable-btn");
-  is_element_visible(el, "Enable button visible");
-
-  let popupPromise = promisePopupNotificationShown("addon-webext-permissions");
-  EventUtils.synthesizeMouseAtCenter(
-    el,
-    { clickCount: 1 },
-    manager
-  );
-
-  let panel = await popupPromise;
-  ok(PopupNotifications.isPanelOpen, "Permission popup should be visible");
-  panel.secondaryButton.click();
-  ok(!PopupNotifications.isPanelOpen, "Permission popup should be closed / closing");
-
-  addon = await AddonManager.getAddonByID(ADDON_ID);
-  ok(!addon.seen, "Seen flag should remain false after permissions are refused");
-
-  // Test click event on permission accept option.
-  addon = get_addon_element(manager, ADDON_ID);
-  Assert.notEqual(addon, null, "Found sideloaded addon in about:addons");
-
-  el = addon.ownerDocument.getAnonymousElementByAttribute(addon, "anonid", "disable-btn");
-  is_element_hidden(el, "Disable button not visible.");
-  el = addon.ownerDocument.getAnonymousElementByAttribute(addon, "anonid", "enable-btn");
-  is_element_visible(el, "Enable button visible");
-
-  popupPromise = promisePopupNotificationShown("addon-webext-permissions");
-  EventUtils.synthesizeMouseAtCenter(
-    manager.document.getAnonymousElementByAttribute(addon, "anonid", "enable-btn"),
-    { clickCount: 1 },
-    manager
-  );
-
-  panel = await popupPromise;
-  ok(PopupNotifications.isPanelOpen, "Permission popup should be visible");
-  panel.button.click();
-  ok(!PopupNotifications.isPanelOpen, "Permission popup should be closed / closing");
-
-  addon = await AddonManager.getAddonByID(ADDON_ID);
-  ok(addon.seen, "Seen flag should remain false after permissions are refused");
-
-  // Test addon permission popup is not shown after accepting permission.
-  addon = get_addon_element(manager, ADDON_ID);
-  Assert.notEqual(addon, null, "Found sideloaded addon in about:addons");
-  el = addon.ownerDocument.getAnonymousElementByAttribute(addon, "anonid", "enable-btn");
-  is_element_hidden(el, "Enable button not visible.");
-  el = addon.ownerDocument.getAnonymousElementByAttribute(addon, "anonid", "disable-btn");
-  is_element_visible(el, "Disable button visible");
-  EventUtils.synthesizeMouseAtCenter(
-    el,
-    { clickCount: 1 },
-    manager
-  );
-
-  ok(!PopupNotifications.isPanelOpen, "Permission popup should not be visible on disable");
-  addon = get_addon_element(manager, ADDON_ID);
-  el = addon.ownerDocument.getAnonymousElementByAttribute(addon, "anonid", "disable-btn");
-  is_element_hidden(el, "Disable button not visible.");
-  el = addon.ownerDocument.getAnonymousElementByAttribute(addon, "anonid", "enable-btn");
-  is_element_visible(el, "Enable button visible");
-  EventUtils.synthesizeMouseAtCenter(
-    el,
-    { clickCount: 1 },
-    manager
-  );
-
-  ok(!PopupNotifications.isPanelOpen, "Permission popup should not be visible");
-
-  await close_manager(manager);
-});
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -1382,33 +1382,8 @@ function promiseNotification(id = "addon
         PopupNotifications.panel.removeEventListener("popupshown", popupshown);
         PopupNotifications.panel.firstElementChild.button.click();
         resolve();
       }
     }
     PopupNotifications.panel.addEventListener("popupshown", popupshown);
   });
 }
-
-/**
- * Wait for the given PopupNotification to display
- *
- * @param {string} name
- *        The name of the notification to wait for.
- *
- * @returns {Promise}
- *          Resolves with the notification window.
- */
-function promisePopupNotificationShown(name = "addon-webext-permissions") {
-  return new Promise(resolve => {
-    function popupshown() {
-      let notification = PopupNotifications.getNotification(name);
-      if (!notification) { return; }
-
-      ok(notification, `${name} notification shown`);
-      ok(PopupNotifications.isPanelOpen, "notification panel open");
-
-      PopupNotifications.panel.removeEventListener("popupshown", popupshown);
-      resolve(PopupNotifications.panel.firstChild);
-    }
-    PopupNotifications.panel.addEventListener("popupshown", popupshown);
-  });
-}