Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/notification.js

Issue 6341149593698304: Issue 301 - Change for each to for .. of .. in lib/ (Closed)
Patch Set: Created April 10, 2014, 5:02 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/filterStorage.js ('k') | lib/objectTabs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/notification.js
===================================================================
--- a/lib/notification.js
+++ b/lib/notification.js
@@ -123,17 +123,17 @@ let Notification = exports.Notification
saveNotificationData();
},
_onDownloadSuccess: function(downloadable, responseText, errorCallback, redirectCallback)
{
try
{
let data = JSON.parse(responseText);
- for each (let notification in data.notifications)
+ for (let notification of data.notifications)
{
if ("severity" in notification)
{
if (!("type" in notification))
notification.type = notification.severity;
delete notification.severity;
}
}
@@ -186,40 +186,40 @@ let Notification = exports.Notification
}
let notifications = localData.concat(remoteData);
if (notifications.length === 0)
return null;
let {addonName, addonVersion, application, applicationVersion, platform, platformVersion} = require("info");
let notificationToShow = null;
- for each (let notification in notifications)
+ for (let notification of notifications)
{
if ((typeof notification.type === "undefined" || notification.type !== "critical")
&& Prefs.notificationdata.shown.indexOf(notification.id) !== -1)
continue;
if (typeof url === "string" || notification.urlFilters instanceof Array)
{
if (typeof url === "string" && notification.urlFilters instanceof Array)
{
let matcher = new Matcher();
- for each (let urlFilter in notification.urlFilters)
+ for (let urlFilter of notification.urlFilters)
matcher.add(Filter.fromText(urlFilter));
if (!matcher.matchesAny(url, "DOCUMENT", url))
continue;
}
else
continue;
}
if (notification.targets instanceof Array)
{
let match = false;
- for each (let target in notification.targets)
+ for (let target of notification.targets)
{
if (checkTarget(target, "extension", addonName, addonVersion) &&
checkTarget(target, "application", application, applicationVersion) &&
checkTarget(target, "platform", platform, platformVersion))
{
match = true;
break;
}
@@ -258,17 +258,17 @@ let Notification = exports.Notification
* application locale)
* @return {Object} the translated texts
*/
getLocalizedTexts: function(notification, locale)
{
locale = locale || Utils.appLocale;
let textKeys = ["title", "message"];
let localizedTexts = [];
- for each (let key in textKeys)
+ for (let key of textKeys)
{
if (key in notification)
{
if (typeof notification[key] == "string")
localizedTexts[key] = notification[key];
else
localizedTexts[key] = localize(notification[key], locale);
}
@@ -327,13 +327,13 @@ let Notification = exports.Notification
* @param {String} id notification ID
* @param {Boolean} approved indicator whether notification has been approved or not
*/
triggerQuestionListeners: function(id, approved)
{
if (!(id in listeners))
return;
let questionListeners = listeners[id];
- for each (let listener in questionListeners)
+ for (let listener of questionListeners)
listener(approved);
}
};
Notification.init();
« no previous file with comments | « lib/filterStorage.js ('k') | lib/objectTabs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld