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

--HG--
extra : rebase_source : 93276d403b85dea6bce3b678100328eb66486eaa
extra : source : aaf1a7164c5b4f75882be574edc92fd69e906129
This commit is contained in:
Paolo Amadini 2018-11-05 12:31:45 +00:00
Родитель b30bcf571e
Коммит 76b0d28ec9
6 изменённых файлов: 9 добавлений и 92 удалений

Просмотреть файл

@ -3498,40 +3498,24 @@ var PrintPreviewListener = {
this._sidebarCommand = SidebarUI.currentID; this._sidebarCommand = SidebarUI.currentID;
SidebarUI.hide(); SidebarUI.hide();
var notificationBox = gBrowser.getNotificationBox();
this._chromeState.notificationsOpen = !notificationBox.notificationsHidden;
notificationBox.notificationsHidden = true;
this._chromeState.findOpen = gFindBarInitialized && !gFindBar.hidden; this._chromeState.findOpen = gFindBarInitialized && !gFindBar.hidden;
if (gFindBarInitialized) if (gFindBarInitialized)
gFindBar.close(); gFindBar.close();
var globalNotificationBox = document.getElementById("global-notificationbox"); gBrowser.getNotificationBox().hidden = true;
this._chromeState.globalNotificationsOpen = !globalNotificationBox.notificationsHidden; document.getElementById("global-notificationbox").hidden = true;
globalNotificationBox.notificationsHidden = true;
this._chromeState.syncNotificationsOpen = false;
var syncNotifications = document.getElementById("sync-notifications");
if (syncNotifications) {
this._chromeState.syncNotificationsOpen = !syncNotifications.notificationsHidden;
syncNotifications.notificationsHidden = true;
}
}, },
_showChrome() { _showChrome() {
if (this._chromeState.notificationsOpen) document.getElementById("global-notificationbox").hidden = false;
gBrowser.getNotificationBox().notificationsHidden = false; gBrowser.getNotificationBox().hidden = false;
if (this._chromeState.findOpen) if (this._chromeState.findOpen) {
gLazyFindCommand("open"); gLazyFindCommand("open");
}
if (this._chromeState.globalNotificationsOpen) if (this._chromeState.sidebarOpen) {
document.getElementById("global-notificationbox").notificationsHidden = false;
if (this._chromeState.syncNotificationsOpen)
document.getElementById("sync-notifications").notificationsHidden = false;
if (this._chromeState.sidebarOpen)
SidebarUI.show(this._sidebarCommand); SidebarUI.show(this._sidebarCommand);
}
}, },
activateBrowser(browser) { activateBrowser(browser) {

Просмотреть файл

@ -39,7 +39,6 @@ function testtag_notificationbox(nb)
{ {
testtag_notificationbox_State(nb, "initial", null, 0); testtag_notificationbox_State(nb, "initial", null, 0);
SimpleTest.is(nb.notificationsHidden, false, "initial notificationsHidden");
SimpleTest.is(nb.removeAllNotifications(false), undefined, "initial removeAllNotifications"); SimpleTest.is(nb.removeAllNotifications(false), undefined, "initial removeAllNotifications");
testtag_notificationbox_State(nb, "initial removeAllNotifications", null, 0); testtag_notificationbox_State(nb, "initial removeAllNotifications", null, 0);
SimpleTest.is(nb.removeAllNotifications(true), undefined, "initial removeAllNotifications immediate"); SimpleTest.is(nb.removeAllNotifications(true), undefined, "initial removeAllNotifications immediate");
@ -382,7 +381,7 @@ var appendPriorityTests = [
return priority; return priority;
}, },
result: function(nb, 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", let ntf = nb.appendNotification("Notification", "note", "happy.png",
nb.PRIORITY_INFO_LOW, testtag_notificationbox_buttons); nb.PRIORITY_INFO_LOW, testtag_notificationbox_buttons);
setTimeout(checkPopupTest, 50, nb, ntf); setTimeout(checkPopupTest, 50, nb, ntf);
@ -424,7 +423,6 @@ function testtag_notification_State(nb, ntf, testid, label, value, image, priori
case nb.PRIORITY_CRITICAL_LOW: case nb.PRIORITY_CRITICAL_LOW:
case nb.PRIORITY_CRITICAL_MEDIUM: case nb.PRIORITY_CRITICAL_MEDIUM:
case nb.PRIORITY_CRITICAL_HIGH: case nb.PRIORITY_CRITICAL_HIGH:
case nb.PRIORITY_CRITICAL_BLOCK:
type = "critical"; type = "critical";
break; break;
} }

Просмотреть файл

@ -1,7 +0,0 @@
"use strict";
module.exports = {
"extends": [
"plugin:mozilla/chrome-test"
]
};

Просмотреть файл

@ -1,3 +0,0 @@
[DEFAULT]
[test_bug510426.xul]

Просмотреть файл

@ -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>

Просмотреть файл

@ -6,4 +6,3 @@
DIRS += ['global', 'mozapps'] DIRS += ['global', 'mozapps']
MOCHITEST_CHROME_MANIFESTS += ['mochitests/chrome.ini']