diff --git a/dom/notification/Notification.cpp b/dom/notification/Notification.cpp index 91e405437119..04b7f2fdf1c4 100644 --- a/dom/notification/Notification.cpp +++ b/dom/notification/Notification.cpp @@ -384,7 +384,6 @@ NotificationObserver::Observe(nsISupports* aSubject, const char* aTopic, } if (!strcmp("alertclickcallback", aTopic)) { - nsCOMPtr event; NS_NewDOMEvent(getter_AddRefs(event), mNotification, nullptr, nullptr); nsresult rv = event->InitEvent(NS_LITERAL_STRING("click"), false, true); diff --git a/dom/tests/mochitest/notification/mochitest.ini b/dom/tests/mochitest/notification/mochitest.ini index 66719169de37..e568d803d297 100644 --- a/dom/tests/mochitest/notification/mochitest.ini +++ b/dom/tests/mochitest/notification/mochitest.ini @@ -6,9 +6,7 @@ support-files = [test_notification_basics.html] [test_notification_storage.html] -skip-if = toolkit == 'android' || toolkit == 'gonk' #bug 960762 [test_bug931307.html] -skip-if = (toolkit == 'gonk' && debug) #debug-only timeout [test_notification_resend.html] skip-if = e10s # On e10s, faking the app seems to be failing [test_notification_noresend.html] diff --git a/dom/tests/mochitest/notification/test_bug931307.html b/dom/tests/mochitest/notification/test_bug931307.html index 03030114fa7d..bd31c706183e 100644 --- a/dom/tests/mochitest/notification/test_bug931307.html +++ b/dom/tests/mochitest/notification/test_bug931307.html @@ -17,15 +17,16 @@ var notification = new Notification(""); var promise = Notification.get(); promise.then( function onSuccess() { - ok(true, "No crash!"); - notification.close(); - SimpleTest.finish(); + ok(true, "No error when creating a notification without title"); }, function onFailure() { - ok(false, "Should not get an error in promise callback"); - notification.close(); + ok(false, "Should not throw error when creating a notification without title"); } -); +).then(() => { + notification.close(); +}).then(() => { + SimpleTest.finish(); +}); diff --git a/dom/tests/mochitest/notification/test_notification_storage.html b/dom/tests/mochitest/notification/test_notification_storage.html index 185281aafe99..ce5530cb8790 100644 --- a/dom/tests/mochitest/notification/test_notification_storage.html +++ b/dom/tests/mochitest/notification/test_notification_storage.html @@ -15,12 +15,13 @@ SimpleTest.requestFlakyTimeout("untriaged"); - function deleteAllNotifications() { + function deleteAllNotifications(done) { var promise = Notification.get(); promise.then(function (notifications) { notifications.forEach(function(notification) { notification.close(); }); + done(); }); } @@ -120,10 +121,10 @@ var promise = Notification.get(); promise.then(function (notifications) { is(notifications.length, 3, "should return 3 notifications"); - done(); n1.close(); n2.close(); n3.close(); + done(); }); }, @@ -134,13 +135,17 @@ var n = new Notification("test-title" + Math.random()); n.onclose = function() { Notification.get().then(function(notifications) { - is(notifications.length, 0, "should return 0 notifications"); - done(); + is(notifications.length, 0, "should return 0 notifications"); + done(); }); - } - window.setTimeout(function() { + }; + info("Installing 'onshow' for " + n.title); + n.onshow = function() { + info("Triggered 'onshow' for " + n.title); + window.setTimeout(function() { NotificationTest.fireCloseEvent(n.title); - }, 100); + }, 100); + }; } ];