1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
6 async function addNotification(box, label, value, priorityName) {
7 let added = BrowserTestUtils.waitForNotificationInNotificationBox(box, value);
9 gHighPriorityNotificationBox[`PRIORITY_${priorityName}_MEDIUM`];
10 let notification = box.appendNotification(label, value, null, priority);
15 add_task(async function setup() {
16 await SpecialPowers.pushPrefEnv({
17 set: [["browser.proton.enabled", true]],
21 add_task(async function testStackingOrder() {
22 const tabNotificationBox = gBrowser.getNotificationBox();
24 gHighPriorityNotificationBox.stack.hasAttribute("prepend-notifications"),
25 "Browser stack will prepend"
28 !tabNotificationBox.stack.hasAttribute("prepend-notifications"),
29 "Tab stack will append"
32 let browserOne = await addNotification(
33 gHighPriorityNotificationBox,
34 "My first browser notification",
39 let tabOne = await addNotification(
41 "My first tab notification",
46 let browserTwo = await addNotification(
47 gHighPriorityNotificationBox,
48 "My second browser notification",
52 let browserThree = await addNotification(
53 gHighPriorityNotificationBox,
54 "My third browser notification",
59 let tabTwo = await addNotification(
61 "My second tab notification",
65 let tabThree = await addNotification(
67 "My third tab notification",
73 [browserThree, browserTwo, browserOne],
74 [...gHighPriorityNotificationBox.stack.children],
75 "Browser notifications prepended"
78 [tabOne, tabTwo, tabThree],
79 [...tabNotificationBox.stack.children],
80 "Tab notifications appended"
83 gHighPriorityNotificationBox.removeAllNotifications(true);
84 tabNotificationBox.removeAllNotifications(true);