Bug 1770137 - Part 2, r=Gijs, a=dsmith DEVEDITION_101_0b9_BUILD1 DEVEDITION_101_0b9_RELEASE FIREFOX_101_0b9_BUILD1 FIREFOX_101_0b9_RELEASE
authorNika Layzell <nika@thelayzells.com>
Thu, 19 May 2022 21:51:15 +0000
changeset 690863 49f60cc53ea397e89dc10f2a3989e0f25a6a4374
parent 690837 6db78ef7521a9909df9a9cd63f573e605479fe0b
child 690880 6cd5efcfce36500dbad9611569d8d55f26f7e836
push id295384
push userdsmith@mozilla.com
push dateThu, 19 May 2022 22:03:22 +0000
reviewersGijs, dsmith
bugs1770137
milestone101.0
Bug 1770137 - Part 2, r=Gijs, a=dsmith Differential Revision: https://phabricator.services.mozilla.com/D146851
dom/notification/old/NotificationDB.jsm
--- a/dom/notification/old/NotificationDB.jsm
+++ b/dom/notification/old/NotificationDB.jsm
@@ -70,36 +70,37 @@ var NotificationDB = {
     if (aTopic == "xpcom-shutdown") {
       this._shutdownInProgress = true;
       Services.obs.removeObserver(this, "xpcom-shutdown");
       this.unregisterListeners();
     }
   },
 
   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) {
         if (DEBUG) {
           debug(
             "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.
   load() {
     var promise = OS.File.read(NOTIFICATION_STORE_PATH, { encoding: "utf-8" });
     return promise.then(
       data => {
         if (data.length > 0) {