Backed out 2 changesets (bug 1516889) for failing browser_storageAccessDoorHanger.js CLOSED TREE
authorCiure Andrei <aciure@mozilla.com>
Mon, 21 Jan 2019 17:48:11 +0200
changeset 514721 03e18916050fe434ef09f7e695d52091f4aa3ee0
parent 514720 1b21d88e45ab32153a049ab03e776072ba910fbe
child 514722 11d24ce31126d1d5b7852eaefbd6dd4fc74f102f
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1516889
milestone66.0a1
backs outfe40c77b54b48f19c629aea383a26af668239402
95fee3425c550b542894e545a365b9e15cd59d7e
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 2 changesets (bug 1516889) for failing browser_storageAccessDoorHanger.js CLOSED TREE Backed out changeset fe40c77b54b4 (bug 1516889) Backed out changeset 95fee3425c55 (bug 1516889)
browser/modules/PermissionUI.jsm
toolkit/components/antitracking/test/browser/browser.ini
toolkit/components/antitracking/test/browser/browser_storageAccessDoorHanger.js
toolkit/modules/PopupNotifications.jsm
--- a/browser/modules/PermissionUI.jsm
+++ b/browser/modules/PermissionUI.jsm
@@ -858,17 +858,16 @@ StorageAccessPermissionPrompt.prototype 
     return host;
   },
 
   get popupOptions() {
     return {
       displayURI: false,
       name: this.prettifyHostPort(this.principal.URI),
       secondName: this.prettifyHostPort(this.topLevelPrincipal.URI),
-      escAction: "buttoncommand",
     };
   },
 
   onShown() {
     let document = this.browser.ownerDocument;
     let label =
       gBrowserBundle.formatStringFromName("storageAccess.description.label",
                                           [this.prettifyHostPort(this.request.principal.URI), "<>"], 2);
--- a/toolkit/components/antitracking/test/browser/browser.ini
+++ b/toolkit/components/antitracking/test/browser/browser.ini
@@ -13,24 +13,23 @@ support-files =
   3rdParty.html
   3rdPartySVG.html
   3rdPartyUI.html
   3rdPartyWO.html
   3rdPartyOpen.html
   3rdPartyOpenUI.html
   empty.js
   popup.html
-  server.sjs
   storageAccessAPIHelpers.js
-  !/browser/modules/test/browser/head.js
 
 [browser_allowListSeparationInPrivateAndNormalWindows.js]
 skip-if = os == "mac" && !debug # Bug 1503778
 [browser_backgroundImageAssertion.js]
 [browser_blockingCookies.js]
+support-files = server.sjs
 [browser_blockingDOMCache.js]
 skip-if = (os == "win" && os_version == "6.1" && bits == 32 && !debug) # Bug 1491937
 [browser_blockingIndexedDb.js]
 [browser_blockingIndexedDbInWorkers.js]
 [browser_blockingLocalStorage.js]
 skip-if = serviceworker_e10s
 [browser_blockingSessionStorage.js]
 skip-if = serviceworker_e10s
--- a/toolkit/components/antitracking/test/browser/browser_storageAccessDoorHanger.js
+++ b/toolkit/components/antitracking/test/browser/browser_storageAccessDoorHanger.js
@@ -4,23 +4,22 @@ ChromeUtils.import("resource://gre/modul
 const CHROME_BASE = "chrome://mochitests/content/browser/browser/modules/test/browser/";
 Services.scriptloader.loadSubScript(CHROME_BASE + "head.js", this);
 /* import-globals-from ../../../../../browser/modules/test/browser/head.js */
 
 const BLOCK = 0;
 const ALLOW = 1;
 const ALLOW_ON_ANY_SITE = 2;
 
-async function testDoorHanger(choice, showPrompt, useEscape, topPage, maxConcurrent) {
+async function testDoorHanger(choice, showPrompt, topPage, maxConcurrent) {
   info(`Running doorhanger test with choice #${choice}, showPrompt: ${showPrompt} and ` +
-       `useEscape: ${useEscape}, topPage: ${topPage}, maxConcurrent: ${maxConcurrent}`);
+       `topPage: ${topPage}, maxConcurrent: ${maxConcurrent}`);
 
   if (!showPrompt) {
     is(choice, ALLOW, "When not showing a prompt, we can only auto-grant");
-    ok(!useEscape, "When not showing a prompt, we should not be trying to use the Esc key");
   }
 
   await SpecialPowers.flushPrefEnv();
   await SpecialPowers.pushPrefEnv({"set": [
     ["browser.contentblocking.allowlist.annotations.enabled", true],
     ["browser.contentblocking.allowlist.storage.enabled", true],
     [ContentBlocking.prefIntroCount, ContentBlocking.MAX_INTROS],
     ["dom.storage_access.auto_grants", true],
@@ -46,17 +45,16 @@ async function testDoorHanger(choice, sh
     // We need to repeat this constant here since runChecks is stringified
     // and sent to the content process.
     const BLOCK = 0;
 
     await new Promise(resolve => {
       addEventListener("message", function onMessage(e) {
         if (e.data.startsWith("choice:")) {
           window.choice = e.data.split(":")[1];
-          window.useEscape = e.data.split(":")[3];
           removeEventListener("message", onMessage);
           resolve();
         }
       }, false);
       parent.postMessage("getchoice", "*");
     });
 
     /* import-globals-from storageAccessAPIHelpers.js */
@@ -128,37 +126,32 @@ async function testDoorHanger(choice, sh
         resolve(notification);
         return;
       }
       setTimeout(poll, 10);
     });
     Assert.ok(notification, "Should have gotten the notification");
 
     if (choice == BLOCK) {
-      if (useEscape) {
-        EventUtils.synthesizeKey("KEY_Escape", {}, window);
-      } else {
-        await clickMainAction();
-      }
+      await clickMainAction();
     } else if (choice == ALLOW) {
       await clickSecondaryAction(choice - 1);
     } else if (choice == ALLOW_ON_ANY_SITE) {
       await clickSecondaryAction(choice - 1);
     }
     if (choice != BLOCK) {
       await permChanged;
     }
   });
 
   let url = TEST_3RD_PARTY_PAGE + "?disableWaitUntilPermission";
   let ct = ContentTask.spawn(browser,
                              { page: url,
                                callback: runChecks.toString(),
                                choice,
-                               useEscape,
                              },
                              async function(obj) {
     await new content.Promise(resolve => {
       let ifr = content.document.createElement("iframe");
       ifr.onload = function() {
         info("Sending code to the 3rd party content");
         ifr.contentWindow.postMessage(obj.callback, "*");
       };
@@ -176,18 +169,17 @@ async function testDoorHanger(choice, sh
         }
 
         if (event.data.type == "info") {
           info(event.data.msg);
           return;
         }
 
         if (event.data == "getchoice") {
-          ifr.contentWindow.postMessage("choice:" + obj.choice +
-                                        ":useEscape:" + obj.useEscape, "*");
+          ifr.contentWindow.postMessage("choice:" + obj.choice, "*");
           return;
         }
 
         ok(false, "Unknown message");
       });
 
       content.document.body.appendChild(ifr);
       ifr.src = obj.page;
@@ -306,29 +298,26 @@ async function cleanUp() {
   await new Promise(resolve => {
     Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
   });
 }
 
 async function runRound(topPage, showPrompt, maxConcurrent) {
   if (showPrompt) {
     await preparePermissionsFromOtherSites(topPage);
-    await testDoorHanger(BLOCK, showPrompt, true, topPage, maxConcurrent);
-    await cleanUp();
-    await preparePermissionsFromOtherSites(topPage);
-    await testDoorHanger(BLOCK, showPrompt, false, topPage, maxConcurrent);
+    await testDoorHanger(BLOCK, showPrompt, topPage, maxConcurrent);
     await cleanUp();
     await preparePermissionsFromOtherSites(topPage);
-    await testDoorHanger(ALLOW, showPrompt, false, topPage, maxConcurrent);
+    await testDoorHanger(ALLOW, showPrompt, topPage, maxConcurrent);
     await cleanUp();
     await preparePermissionsFromOtherSites(topPage);
-    await testDoorHanger(ALLOW_ON_ANY_SITE, showPrompt, false, topPage, maxConcurrent);
+    await testDoorHanger(ALLOW_ON_ANY_SITE, showPrompt, topPage, maxConcurrent);
   } else {
     await preparePermissionsFromOtherSites(topPage);
-    await testDoorHanger(ALLOW, showPrompt, false, topPage, maxConcurrent);
+    await testDoorHanger(ALLOW, showPrompt, topPage, maxConcurrent);
   }
   await cleanUp();
 }
 
 add_task(async function() {
   await runRound(TEST_TOP_PAGE, false, 1);
   await runRound(TEST_TOP_PAGE_2, true, 1);
   await runRound(TEST_TOP_PAGE, false, 5);
--- a/toolkit/modules/PopupNotifications.jsm
+++ b/toolkit/modules/PopupNotifications.jsm
@@ -248,18 +248,17 @@ function PopupNotifications(tabbrowser, 
 
     // If the chrome window has a focused element, let it handle the ESC key instead.
     if (!focusedElement ||
         focusedElement == doc.body ||
         focusedElement == this.tabbrowser.selectedBrowser ||
         // Ignore focused elements inside the notification.
         getNotificationFromElement(focusedElement) == notification ||
         notification.contains(focusedElement)) {
-      let escAction = notification.notification.options.escAction;
-      this._onButtonEvent(aEvent, escAction, "esc-press", notification);
+      this._onButtonEvent(aEvent, "secondarybuttoncommand", "esc-press", notification);
     }
   };
 
   let documentElement = this.window.document.documentElement;
   let locationBarHidden = documentElement.getAttribute("chromehidden").includes("location");
   let isFullscreen = !!this.window.document.fullscreenElement;
 
   this.panel.setAttribute("followanchor", !locationBarHidden && !isFullscreen);
@@ -463,21 +462,16 @@ PopupNotifications.prototype = {
    *                     An optional string formatted to look bold and used in the
    *                     notifiation description header text. Usually a host name or
    *                     addon name.
    *        secondName:
    *                     An optional string formatted to look bold and used in the
    *                     notification description header text. Usually a host name or
    *                     addon name. This is similar to name, and only used in case
    *                     where message contains two "<>" placeholders.
-   *        escAction:
-   *                     An optional string indicating the action to take when the
-   *                     Esc key is pressed. This should be set to the name of the
-   *                     command to run. If not provided, "secondarybuttoncommand"
-   *                     will be used.
    * @returns the Notification object corresponding to the added notification.
    */
   show: function PopupNotifications_show(browser, id, message, anchorID,
                                          mainAction, secondaryActions, options) {
     function isInvalidAction(a) {
       return !a || !(typeof(a.callback) == "function") || !a.label || !a.accessKey;
     }
 
@@ -488,25 +482,16 @@ PopupNotifications.prototype = {
     if (mainAction && isInvalidAction(mainAction))
       throw "PopupNotifications_show: invalid mainAction";
     if (secondaryActions && secondaryActions.some(isInvalidAction))
       throw "PopupNotifications_show: invalid secondaryActions";
 
     let notification = new Notification(id, message, anchorID, mainAction,
                                         secondaryActions, browser, this, options);
 
-    if (options) {
-      let escAction = options.escAction;
-      if (escAction != "buttoncommand" ||
-          escAction != "secondarybuttoncommand") {
-        escAction = "secondarybuttoncommand";
-      }
-      notification.options.escAction = escAction;
-    }
-
     if (options && options.dismissed)
       notification.dismissed = true;
 
     let existingNotification = this.getNotification(id, browser);
     if (existingNotification)
       this._remove(existingNotification);
 
     let notifications = this._getNotificationsForBrowser(browser);
@@ -841,17 +826,17 @@ PopupNotifications.prototype = {
         popupnotification.setAttribute("secondname", desc.secondName);
         popupnotification.setAttribute("secondendlabel", desc.secondEnd);
       }
 
       popupnotification.setAttribute("id", popupnotificationID);
       popupnotification.setAttribute("popupid", n.id);
       popupnotification.setAttribute("oncommand", "PopupNotifications._onCommand(event);");
       if (Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton")) {
-        popupnotification.setAttribute("closebuttoncommand", "PopupNotifications._onButtonEvent(event, '" + n.options.escAction + "', 'esc-press');");
+        popupnotification.setAttribute("closebuttoncommand", "PopupNotifications._onButtonEvent(event, 'secondarybuttoncommand', 'esc-press');");
       } else {
         popupnotification.setAttribute("closebuttoncommand", `PopupNotifications._dismiss(event, ${TELEMETRY_STAT_DISMISSAL_CLOSE_BUTTON});`);
       }
       if (n.mainAction) {
         popupnotification.setAttribute("buttonlabel", n.mainAction.label);
         popupnotification.setAttribute("buttonaccesskey", n.mainAction.accessKey);
         popupnotification.toggleAttribute("buttonhighlight", !n.mainAction.disableHighlight);
         popupnotification.setAttribute("buttoncommand", "PopupNotifications._onButtonEvent(event, 'buttoncommand');");