Bug 1471403 - Part 1 - Stop using notificationsHidden and children that are not notifications in most places. r=dao,bgrins
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Mon, 05 Nov 2018 12:31:45 +0000
changeset 445532 6c594f12cc041379fe976eb53f82bce34f7a84c9
parent 445531 3dd2018ed59a855b06eb7e8404fccc8e499ea4b9
child 445533 a2a92421b50f91f29ed416eafd8f86f62dfdab45
push id35020
push usershindli@mozilla.com
push dateSat, 10 Nov 2018 21:37:25 +0000
treeherdermozilla-central@39dba5141dd9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao, bgrins
bugs1471403
milestone65.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 1471403 - Part 1 - Stop using notificationsHidden and children that are not notifications in most places. r=dao,bgrins This also removes testing for the unused PRIORITY_CRITICAL_BLOCK behavior, and simplifies how Print Preview hides the chrome while removing leftover code. The only theme-specific mochitest that ever existed checked an overflow scenario that is no longer relevant, so the test and its build folder are removed as well. Differential Revision: https://phabricator.services.mozilla.com/D10578
browser/base/content/browser.js
toolkit/content/tests/chrome/test_notificationbox.xul
toolkit/themes/osx/mochitests/.eslintrc.js
toolkit/themes/osx/mochitests/chrome.ini
toolkit/themes/osx/mochitests/test_bug510426.xul
toolkit/themes/osx/moz.build
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3493,50 +3493,34 @@ var PrintPreviewListener = {
   },
   _hideChrome() {
     this._chromeState = {};
 
     this._chromeState.sidebarOpen = SidebarUI.isOpen;
     this._sidebarCommand = SidebarUI.currentID;
     SidebarUI.hide();
 
-    var notificationBox = gBrowser.getNotificationBox();
-    this._chromeState.notificationsOpen = !notificationBox.notificationsHidden;
-    notificationBox.notificationsHidden = true;
-
     this._chromeState.findOpen = gFindBarInitialized && !gFindBar.hidden;
     if (gFindBarInitialized)
       gFindBar.close();
 
-    var globalNotificationBox = document.getElementById("global-notificationbox");
-    this._chromeState.globalNotificationsOpen = !globalNotificationBox.notificationsHidden;
-    globalNotificationBox.notificationsHidden = true;
-
-    this._chromeState.syncNotificationsOpen = false;
-    var syncNotifications = document.getElementById("sync-notifications");
-    if (syncNotifications) {
-      this._chromeState.syncNotificationsOpen = !syncNotifications.notificationsHidden;
-      syncNotifications.notificationsHidden = true;
-    }
+    gBrowser.getNotificationBox().hidden = true;
+    document.getElementById("global-notificationbox").hidden = true;
   },
   _showChrome() {
-    if (this._chromeState.notificationsOpen)
-      gBrowser.getNotificationBox().notificationsHidden = false;
-
-    if (this._chromeState.findOpen)
+    document.getElementById("global-notificationbox").hidden = false;
+    gBrowser.getNotificationBox().hidden = false;
+
+    if (this._chromeState.findOpen) {
       gLazyFindCommand("open");
-
-    if (this._chromeState.globalNotificationsOpen)
-      document.getElementById("global-notificationbox").notificationsHidden = false;
-
-    if (this._chromeState.syncNotificationsOpen)
-      document.getElementById("sync-notifications").notificationsHidden = false;
-
-    if (this._chromeState.sidebarOpen)
+    }
+
+    if (this._chromeState.sidebarOpen) {
       SidebarUI.show(this._sidebarCommand);
+    }
   },
 
   activateBrowser(browser) {
     gBrowser.activateBrowserForPrintPreview(browser);
   },
 };
 
 var browserDragAndDrop = {
--- a/toolkit/content/tests/chrome/test_notificationbox.xul
+++ b/toolkit/content/tests/chrome/test_notificationbox.xul
@@ -34,17 +34,16 @@ var NSXUL = "http://www.mozilla.org/keym
 function testtag_notificationbox_buttonpressed(event)
 {
 }
 
 function testtag_notificationbox(nb)
 {
   testtag_notificationbox_State(nb, "initial", null, 0);
 
-  SimpleTest.is(nb.notificationsHidden, false, "initial notificationsHidden");
   SimpleTest.is(nb.removeAllNotifications(false), undefined, "initial removeAllNotifications");
   testtag_notificationbox_State(nb, "initial removeAllNotifications", null, 0);
   SimpleTest.is(nb.removeAllNotifications(true), undefined, "initial removeAllNotifications immediate");
   testtag_notificationbox_State(nb, "initial removeAllNotifications immediate", null, 0);
 
   runTimedTests(tests, -1, nb, null);
 }
 
@@ -377,17 +376,17 @@ var appendPriorityTests = [
     }
   },
   {
     test: function(nb, priority) {
       nb.removeCurrentNotification();
       return priority;
     },
     result: function(nb, priority) {
-      if (priority == nb.PRIORITY_CRITICAL_BLOCK) {
+      if (priority == nb.PRIORITY_CRITICAL_HIGH) {
         let ntf = nb.appendNotification("Notification", "note", "happy.png",
                                         nb.PRIORITY_INFO_LOW, testtag_notificationbox_buttons);
         setTimeout(checkPopupTest, 50, nb, ntf);
       }
       else {
         runTimedTests(appendPriorityTests, -1, nb, ++priority);
       }
     }
@@ -419,17 +418,16 @@ function testtag_notification_State(nb, 
     case nb.PRIORITY_WARNING_LOW:
     case nb.PRIORITY_WARNING_MEDIUM:
     case nb.PRIORITY_WARNING_HIGH:
       type = "warning";
       break;
     case nb.PRIORITY_CRITICAL_LOW:
     case nb.PRIORITY_CRITICAL_MEDIUM:
     case nb.PRIORITY_CRITICAL_HIGH:
-    case nb.PRIORITY_CRITICAL_BLOCK:
       type = "critical";
       break;
   }
 
   SimpleTest.is(ntf.type, type, testid + " notification.type");
 }
 
 function checkPopupTest(nb, ntf)
deleted file mode 100644
--- a/toolkit/themes/osx/mochitests/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
-  "extends": [
-    "plugin:mozilla/chrome-test"
-  ]
-};
deleted file mode 100644
--- a/toolkit/themes/osx/mochitests/chrome.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[DEFAULT]
-
-[test_bug510426.xul]
deleted file mode 100644
--- a/toolkit/themes/osx/mochitests/test_bug510426.xul
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=510426
--->
-<window title="Mozilla Bug 510426"
-  xmlns:html="http://www.w3.org/1999/xhtml"
-  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-  align="start">
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-
-<body  xmlns="http://www.w3.org/1999/xhtml">
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=510426">Mozilla Bug 510426</a>
-</body>
-
-<notificationbox id="nb" width="300" height="100">
-  <box width="100" height="100" id="overflowGenerator"/>
-</notificationbox>
-
-<script class="testbody" type="application/javascript">
-<![CDATA[
-
-/** Test for Bug 510426 **/
-SimpleTest.waitForExplicitFinish();
-
-function openNotification() {
-  var nb = document.getElementById("nb");
-  var n = nb.appendNotification("Notification", "", null,
-                                nb.PRIORITY_WARNING_LOW, [{
-                                  label: "Button",
-                                  accesskey: "u",
-                                  callback: null,
-                                  popup: null
-                                }]);
-  n.addEventListener("transitionend", function (event) {
-    if (event.propertyName == "margin-top") {
-      setTimeout(function () {
-        is(n.getBoundingClientRect().height, 27, "notification bar has wrong height");
-        SimpleTest.finish();
-      }, 0);
-    }
-  }, false);
-}
-
-window.onload = openNotification;
-
-]]>
-</script>
-</window>
--- a/toolkit/themes/osx/moz.build
+++ b/toolkit/themes/osx/moz.build
@@ -1,9 +1,8 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += ['global', 'mozapps']
 
-MOCHITEST_CHROME_MANIFESTS += ['mochitests/chrome.ini']