Bug 1770137 - Part 2, r=Gijs, a=dsmith

Differential Revision: https://phabricator.services.mozilla.com/D146851
This commit is contained in:
Nika Layzell 2022-05-19 21:51:15 +00:00
parent e7bf90ac75
commit 78d17b06b0

View File

@ -75,13 +75,14 @@ var NotificationDB = {
},
filterNonAppNotifications(notifications) {
let result = Object.create(null);
for (let origin in notifications) {
result[origin] = Object.create(null);
let persistentNotificationCount = 0;
for (let id in notifications[origin]) {
if (notifications[origin][id].serviceWorkerRegistrationScope) {
persistentNotificationCount++;
} else {
delete notifications[origin][id];
result[origin][id] = notifications[origin][id];
}
}
if (persistentNotificationCount == 0) {
@ -90,11 +91,11 @@ var NotificationDB = {
"Origin " + origin + " is not linked to an app manifest, deleting."
);
}
delete notifications[origin];
delete result[origin];
}
}
return notifications;
return result;
},
// Attempt to read notification file, if it's not there we will create it.