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

Unified Diff: chrome/content/watcher.js

Issue 29332787: Issue 3420 - Get rid of for each loops in Diagnostics (Closed)
Patch Set: Created Dec. 16, 2015, 11:20 a.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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/watcher.js
===================================================================
--- a/chrome/content/watcher.js
+++ b/chrome/content/watcher.js
@@ -99,17 +99,17 @@ function processQueue()
function stringify(value)
{
if (typeof value == "undefined" || value == null)
return "";
else
return String(value);
}
- for each (let entry in processingQueue)
+ for (let entry of processingQueue)
{
entry.cols = {
address: stringify(entry.location),
type: stringify(entry.type),
result: stringBundle.GetStringFromName(entry.result && entry.result.allow ? "decision.allow" : "decision.block"),
origin: stringify(entry.frames && entry.frames[0] && entry.frames[0].location),
private: stringBundle.GetStringFromName(entry.isPrivate ? "private.yes" : "private.no"),
filter: stringify(entry.filters && entry.filters.join(", ")),
@@ -196,17 +196,17 @@ function setMultilineContent(box, text)
var totalProcessingTime = 0;
function updateProcessingTime(view, operation, entry)
{
if (operation == "add")
totalProcessingTime += entry.processingTime;
else {
totalProcessingTime = 0;
- for each (let entry in view.displayedItems)
+ for (let entry of view.displayedItems)
totalProcessingTime += entry.processingTime;
}
let numItems = view.displayedItems.length;
let summary = document.getElementById("summary");
let template = summary.getAttribute("_template");
summary.textContent = template.replace(/\*NUMITEMS\*/g, numItems).replace(/\*TIME\*/, (totalProcessingTime / 1000).toFixed(3));
@@ -245,22 +245,22 @@ var treeView = {
setTree: function(boxObject)
{
if (!boxObject)
return;
this.boxObject = boxObject;
let atomService = Cc["@mozilla.org/atom-service;1"].getService(Ci.nsIAtomService);
- for each (let col in ["address", "type", "result", "origin", "private", "filter", "time"])
+ for (let col of ["address", "type", "result", "origin", "private", "filter", "time"])
{
let atomStr = "col-" + col;
this.atoms[atomStr] = atomService.getAtom(atomStr);
}
- for each (let flag in ["selected", "blocked"])
+ for (let flag of ["selected", "blocked"])
{
let atomStr = flag + "-true";
this.atoms[atomStr] = atomService.getAtom(atomStr);
atomStr = flag + "-false";
this.atoms[atomStr] = atomService.getAtom(atomStr);
}
@@ -405,17 +405,17 @@ var treeView = {
this.refilter();
},
filter: function(entry)
{
if (this._filterString)
{
let foundMatch = false;
- for each (let label in entry.cols)
+ for (let label of entry.cols)
if (label.toLowerCase().indexOf(this._filterString) >= 0)
foundMatch = true;
if (!foundMatch)
return false;
}
return true;
},
@@ -527,12 +527,12 @@ var treeView = {
removeObserver: function(observer)
{
for (let i = 0; i < this.observers.length; i++)
if (this.observers[i] == observer)
this.observers.splice(i--, 1);
},
notifyObservers: function(operation, entry)
{
- for each (let observer in this.observers)
+ for (let observer of this.observers)
observer(this, operation, entry);
}
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld