mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1063859 - Do not iterate on undefined valued when querying notifications. r=mhenretty
When we are performing the getAll/getAllCrossOrigin requests and there is no notifications, then this.notifications[origin] (with a valid origin) is just undefined. We should make sure we do not iterate over in this case.
This commit is contained in:
parent
4b2df54aa2
commit
4a504ef96d
@ -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];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user