Bug 1236036 - Automatically close native notifications in test_alerts.html. r=MattN

--HG--
extra : commitid : BOsP8r1m102
extra : rebase_source : 8921be5d70616fe056885771e7e7d49450c391c5
This commit is contained in:
Joel Maher 2016-01-15 08:20:10 -07:00
parent ab4c95b522
commit 2599f14659

View File

@ -65,10 +65,14 @@ function runTest() {
false, "foobarcookie", observer, alertName);
ok(true, "showAlertNotification() succeeded. Waiting for notification...");
if (SpecialPowers.Services.appinfo.OS == "Darwin") {
// Notifications are native on OS X 10.8 and later, and when they are they
// persist in the Notification Center. We need to close explicitly to avoid a hang.
// This also works for XUL notifications when running this test on OS X < 10.8.
if ("@mozilla.org/system-alerts-service;1" in Cc) {
// Notifications are native on OS X 10.8 and later, as well as GNOME
// Shell with libnotify (bug 1236036). These notifications persist in the
// Notification Center, and only fire the `alertfinished` event when
// closed. For platforms where native notifications may be used, we need
// to close explicitly to avoid a hang. This also works for XUL
// notifications when running this test on OS X < 10.8, or a window
// manager like Ubuntu Unity with incomplete libnotify support.
notifier.closeAlert(alertName);
}
} catch (ex) {