diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2017-08-10 17:39:03 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-02-21 19:49:55 +0100 |
commit | d8598c1ed3264de0e7b6de21f62d4d5125177677 (patch) | |
tree | 1f257cc80f34905d1db9c9686bff214d3a478643 /toolkit/components | |
parent | d77729916b4b9c2b67abd41181336c2cbb1da968 (diff) | |
download | UXP-d8598c1ed3264de0e7b6de21f62d4d5125177677.tar UXP-d8598c1ed3264de0e7b6de21f62d4d5125177677.tar.gz UXP-d8598c1ed3264de0e7b6de21f62d4d5125177677.tar.lz UXP-d8598c1ed3264de0e7b6de21f62d4d5125177677.tar.xz UXP-d8598c1ed3264de0e7b6de21f62d4d5125177677.zip |
Notifications - Run (Desktop) Notifications twice (and more) in a row does not work
Diffstat (limited to 'toolkit/components')
-rw-r--r-- | toolkit/components/alerts/resources/content/alert.js | 28 | ||||
-rw-r--r-- | toolkit/components/alerts/resources/content/alert.xul | 1 |
2 files changed, 27 insertions, 2 deletions
diff --git a/toolkit/components/alerts/resources/content/alert.js b/toolkit/components/alerts/resources/content/alert.js index 523ec378e..ead4d503f 100644 --- a/toolkit/components/alerts/resources/content/alert.js +++ b/toolkit/components/alerts/resources/content/alert.js @@ -7,7 +7,21 @@ var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; Cu.import("resource://gre/modules/AppConstants.jsm"); Cu.import("resource://gre/modules/Services.jsm"); -// Copied from nsILookAndFeel.h, see comments on eMetric_AlertNotificationOrigin +/* + * This indicates from which corner of the screen alerts slide in, + * and from which direction (horizontal/vertical). + * 0, the default, represents bottom right, sliding vertically. + * Use any bitwise combination of the following constants: + * NS_ALERT_HORIZONTAL (1), NS_ALERT_LEFT (2), NS_ALERT_TOP (4). + * + * 6 4 + * +-----------+ + * 7| |5 + * | | + * 3| |1 + * +-----------+ + * 2 0 + */ const NS_ALERT_HORIZONTAL = 1; const NS_ALERT_LEFT = 2; const NS_ALERT_TOP = 4; @@ -41,6 +55,8 @@ function prefillAlertInfo() { // arguments[11] -> the nsIURI.hostPort of the origin, optional // arguments[12] -> the alert icon URL, optional + document.getElementById('alertTime').setAttribute('value', (new Date).getTime()); + switch (window.arguments.length) { default: case 13: { @@ -235,7 +251,15 @@ function moveWindowToEnd() { let windows = Services.wm.getEnumerator("alert:alert"); while (windows.hasMoreElements()) { let alertWindow = windows.getNext(); - if (alertWindow != window) { + let alertWindowTime = Number( + alertWindow.document.getElementById('alertTime').getAttribute('value')); + let windowTime = Number( + window.document.getElementById('alertTime').getAttribute('value')); + // The time of window creation. + // Otherwise calling the notification twice (and more) in a row + // does not work. + // See https://bugzilla.mozilla.org/show_bug.cgi?id=1263155 + if ((alertWindow != window) && (alertWindowTime <= windowTime)) { if (gOrigin & NS_ALERT_TOP) { y = Math.max(y, alertWindow.screenY + alertWindow.outerHeight - WINDOW_SHADOW_SPREAD); } else { diff --git a/toolkit/components/alerts/resources/content/alert.xul b/toolkit/components/alerts/resources/content/alert.xul index 8597d9954..1549f4530 100644 --- a/toolkit/components/alerts/resources/content/alert.xul +++ b/toolkit/components/alerts/resources/content/alert.xul @@ -24,6 +24,7 @@ <script type="application/javascript" src="chrome://global/content/alerts/alert.js"/> <vbox id="alertBox" class="alertBox"> + <label id="alertTime" value="" hidden="true"/> <box id="alertTitleBox"> <image id="alertIcon"/> <label id="alertTitleLabel" class="alertTitle plain" crop="end"/> |