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

Unified Diff: chrome/content/ui/sidebar.js

Issue 6519778499887104: Issue 2010 - Remove some uses of "for each" with "for of" (Closed)
Patch Set: Created Feb. 26, 2015, 11:50 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 | « chrome/content/ui/sendReport.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/ui/sidebar.js
===================================================================
--- a/chrome/content/ui/sidebar.js
+++ b/chrome/content/ui/sidebar.js
@@ -150,22 +150,22 @@ function reloadDisabledFilters()
function reloadDisabledFiltersInternal()
{
reloadDisabledScheduled = false;
disabledMatcher.clear();
if (Prefs.enabled)
{
- for each (let subscription in FilterStorage.subscriptions)
+ for (let subscription of FilterStorage.subscriptions)
{
if (subscription.disabled)
continue;
- for each (let filter in subscription.filters)
+ for (let filter of subscription.filters)
if (filter instanceof RegExpFilter && filter.disabled)
disabledMatcher.add(filter);
}
}
treeView.updateFilters();
}
@@ -471,17 +471,17 @@ function handleDblClick(event)
}
/**
* Opens the item in a new tab.
*/
function openInTab(item, /**Event*/ event)
{
let items = (item ? [item] : treeView.getAllSelectedItems());
- for each (let item in items)
+ for (let item of items)
{
if (item && item.typeDescr != "ELEMHIDE")
UI.loadInBrowser(item.location, mainWin, event);
}
}
function doBlock() {
var item = treeView.getSelectedItem();
@@ -667,17 +667,17 @@ function detach(doDetach)
}
// Returns items size in the document if available
function getItemSize(item)
{
if (item.filter && !item.filter.disabled && item.filter instanceof BlockingFilter)
return null;
- for each (let node in item.nodes)
+ for (let node of item.nodes)
{
if (node instanceof HTMLImageElement && (node.naturalWidth || node.naturalHeight))
return [node.naturalWidth, node.naturalHeight];
else if (node instanceof HTMLElement && (node.offsetWidth || node.offsetHeight))
return [node.offsetWidth, node.offsetHeight];
}
return null;
}
@@ -797,19 +797,19 @@ var treeView = {
return;
this.boxObject = boxObject;
this.itemsDummy = boxObject.treeBody.getAttribute("noitemslabel");
this.whitelistDummy = boxObject.treeBody.getAttribute("whitelistedlabel");
var stringAtoms = ["col-address", "col-type", "col-filter", "col-state", "col-size", "col-docDomain", "col-filterSource", "state-regular", "state-filtered", "state-whitelisted", "state-hidden", "state-hiddenexception"];
var boolAtoms = ["selected", "dummy", "filter-disabled"];
var atomService = Cc["@mozilla.org/atom-service;1"].getService(Ci.nsIAtomService);
this.atoms = {};
- for each (let atom in stringAtoms)
+ for (let atom of stringAtoms)
this.atoms[atom] = atomService.getAtom(atom);
- for each (let atom in boolAtoms)
+ for (let atom of boolAtoms)
{
this.atoms[atom + "-true"] = atomService.getAtom(atom + "-true");
this.atoms[atom + "-false"] = atomService.getAtom(atom + "-false");
}
this.itemsDummyTooltip = Utils.getString("no_blocking_suggestions");
this.whitelistDummyTooltip = Utils.getString("whitelisted_page");
@@ -1139,17 +1139,17 @@ var treeView = {
this.itemToSelect = null;
}
else if (!scanComplete && this.selection.currentIndex >= 0) // Keep selected row visible while scanning
this.boxObject.ensureRowIsVisible(this.selection.currentIndex);
},
updateFilters: function()
{
- for each (let item in this.allData)
+ for (let item of this.allData)
{
if (item.filter instanceof RegExpFilter && item.filter.disabled)
delete item.filter;
if (!item.filter)
item.filter = disabledMatcher.matchesAny(item.location, item.typeDescr, item.docDomain, item.thirdParty);
}
this.refilter();
},
« no previous file with comments | « chrome/content/ui/sendReport.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld