diff --git a/dom/notification/NotificationDB.jsm b/dom/notification/NotificationDB.jsm index 7c9d8ad39a2..fa5d54db6fb 100644 --- a/dom/notification/NotificationDB.jsm +++ b/dom/notification/NotificationDB.jsm @@ -293,8 +293,10 @@ let NotificationDB = { var origin = data.origin; var notifications = []; // Grab only the notifications for specified origin. - for (var i in this.notifications[origin]) { - notifications.push(this.notifications[origin][i]); + if (this.notifications[origin]) { + for (var i in this.notifications[origin]) { + notifications.push(this.notifications[origin][i]); + } } return Promise.resolve(notifications); }, @@ -303,6 +305,10 @@ let NotificationDB = { if (DEBUG) { debug("Task, getting all whatever origin"); } var notifications = []; for (var origin in this.notifications) { + if (!this.notifications[origin]) { + continue; + } + for (var i in this.notifications[origin]) { var notification = this.notifications[origin][i];