Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 993235b

Browse files
Alexandru Marcamarc-mozilla
authored andcommitted
Revert "Bug 1948752 - Part 1: Throw TypeError when failing to create notification r=asuth" for causing mochitest failures @ test_notification_browser_failure.html
This reverts commit ab35f7e.
1 parent ff48926 commit 993235b

File tree

5 files changed

+7
-55
lines changed

5 files changed

+7
-55
lines changed

dom/notification/NotificationParent.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,9 @@ nsresult NotificationParent::HandleAlertTopic(AlertTopic aTopic) {
183183
// alertshow happens first before alertfinished, and it should have
184184
// nullified mResolver. If not it means it failed to show and is bailing
185185
// out.
186-
// NOTE(krosylight): The spec does not define what to do when a
187-
// permission-granted notification fails to open, we throw TypeError here
188-
// as that's the error for when permission is denied.
189-
CopyableErrorResult rv;
190-
rv.ThrowTypeError(
191-
"Failed to show notification, potentially because the browser did "
192-
"not have the corresponding OS-level permission."_ns);
193-
mResolver.take().value()(rv);
186+
// XXX: Apparently XUL manual do not disturb mode does this without firing
187+
// alertshow at all.
188+
mResolver.take().value()(CopyableErrorResult(NS_ERROR_FAILURE));
194189
}
195190

196191
// Unpersisted already and being unregistered already by nsIAlertsService

dom/notification/test/mochitest/MockAlertsService.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ function mockServicesChromeScript() {
2929
// fake async alert show event
3030
if (listener) {
3131
setTimeout(() => {
32-
if (this.mockFailure) {
33-
listener.observe(null, "alertfinished", alert.cookie);
34-
return;
35-
}
36-
3732
listener.observe(null, "alertshow", alert.cookie);
3833
if (this.autoClick) {
3934
let subject;
@@ -147,10 +142,6 @@ function mockServicesChromeScript() {
147142
mockAlertsService.autoClick = action || true;
148143
});
149144

150-
addMessageListener("mock-alert-service:mock-failure", action => {
151-
mockAlertsService.mockFailure = action || true;
152-
});
153-
154145
addMessageListener("mock-alert-service:get-notification-ids", () =>
155146
Object.keys(activeNotifications)
156147
);
@@ -215,12 +206,6 @@ const MockAlertsService = {
215206
action
216207
);
217208
},
218-
async mockFailure(action) {
219-
await this._chromeScript.sendQuery(
220-
"mock-alert-service:mock-failure",
221-
action
222-
);
223-
},
224209
async getNotificationIds() {
225210
return await this._chromeScript.sendQuery(
226211
"mock-alert-service:get-notification-ids"

dom/notification/test/mochitest/NotificationTest.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ async function setupServiceWorker(src, scope) {
101101
SimpleTest.registerCleanupFunction(async () => {
102102
await registration.unregister();
103103
});
104-
return registration;
105104
}
106105

107106
async function testFrame(src, args) {

dom/notification/test/mochitest/mochitest.toml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ prefs = [
1111
["test_notification_basics.html"]
1212
skip-if = [
1313
"xorigin", # Bug 1792790
14-
"os == 'android'", # Bug 1948752, Notification.onshow/close are broken on Android
15-
]
16-
17-
["test_notification_browser_failure.html"]
18-
support-files = ["notification_empty_sw.js"]
19-
skip-if = [
20-
"os == 'android'", # Bug 1948752, Notification.onshow/close are broken on Android
14+
"os == 'android'", # Bug 1816427, Notification.onshow/close are broken on Android
2115
]
2216

2317
["test_notification_crossorigin_iframe.html"]
@@ -99,13 +93,13 @@ support-files = ["create_notification.html"]
9993

10094
["test_notification_worker.html"]
10195
skip-if = [
102-
"os == 'android'", # Bug 1948752, Notification.onshow/close are broken on Android
96+
"os == 'android'", # Bug 1816427, Notification.onshow/close are broken on Android
10397
]
10498
support-files = ["notification_worker.js"]
10599

106100
["test_notification_worker_child.html"]
107101
skip-if = [
108-
"os == 'android'", # Bug 1948752, Notification.onshow/close are broken on Android
102+
"os == 'android'", # Bug 1816427, Notification.onshow/close are broken on Android
109103
]
110104
support-files = [
111105
"notification_worker_child-child.js",
@@ -114,7 +108,7 @@ support-files = [
114108

115109
["test_notification_worker_click.html"]
116110
skip-if = [
117-
"os == 'android'", # Bug 1948752, Notification.onshow/close are broken on Android
111+
"os == 'android'", # Bug 1816427, Notification.onshow/close are broken on Android
118112
]
119113

120114
["test_notification_worker_permission.html"]

dom/notification/test/mochitest/test_notification_browser_failure.html

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)