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

Unified Diff: lib/contentPolicy.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/antiadblockInit.js ('k') | lib/downloader.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/contentPolicy.js
===================================================================
--- a/lib/contentPolicy.js
+++ b/lib/contentPolicy.js
@@ -89,17 +89,17 @@ let Policy = exports.Policy =
* Called on module startup, initializes various exported properties.
*/
init: function()
{
TimeLine.enter("Entered content policy initialization");
// type constant by type description and type description by type constant
let iface = Ci.nsIContentPolicy;
- for each (let typeName in contentTypes)
+ for (let typeName of contentTypes)
{
if ("TYPE_" + typeName in iface)
{
let id = iface["TYPE_" + typeName];
this.type[typeName] = id;
this.typeDescr[id] = typeName;
this.localizedDescr[id] = Utils.getString("type_label_" + typeName.toLowerCase());
}
@@ -108,21 +108,21 @@ let Policy = exports.Policy =
this.type.ELEMHIDE = 0xFFFD;
this.typeDescr[0xFFFD] = "ELEMHIDE";
this.localizedDescr[0xFFFD] = Utils.getString("type_label_elemhide");
this.type.POPUP = 0xFFFE;
this.typeDescr[0xFFFE] = "POPUP";
this.localizedDescr[0xFFFE] = Utils.getString("type_label_popup");
- for each (let type in nonVisualTypes)
+ for (let type of nonVisualTypes)
this.nonVisual[this.type[type]] = true;
// whitelisted URL schemes
- for each (let scheme in Prefs.whitelistschemes.toLowerCase().split(" "))
+ for (let scheme of Prefs.whitelistschemes.toLowerCase().split(" "))
this.whitelistSchemes[scheme] = true;
TimeLine.log("done initializing types");
// Generate class identifier used to collapse node and register corresponding
// stylesheet.
TimeLine.log("registering global stylesheet");
@@ -337,17 +337,17 @@ let Policy = exports.Policy =
* Asynchronously re-checks filters for given nodes.
*/
refilterNodes: function(/**Node[]*/ nodes, /**RequestEntry*/ entry)
{
// Ignore nodes that have been blocked already
if (entry.filter && !(entry.filter instanceof WhitelistFilter))
return;
- for each (let node in nodes)
+ for (let node of nodes)
Utils.runAsync(refilterNode, this, node, entry);
}
};
Policy.init();
/**
* Actual nsIContentPolicy and nsIChannelEventSink implementation
* @class
@@ -373,17 +373,17 @@ let PolicyImplementation =
{
// See bug 924340 - it might be too early to init now, the old version
// we are replacing didn't finish removing itself yet.
Utils.runAsync(this.init.bind(this));
return;
}
let catMan = Utils.categoryManager;
- for each (let category in this.xpcom_categories)
+ for (let category of this.xpcom_categories)
catMan.addCategoryEntry(category, this.contractID, this.contractID, false, true);
// http-on-opening-request is new in Gecko 18, http-on-modify-request can
// be used in earlier releases.
let httpTopic = "http-on-opening-request";
if (Services.vc.compare(Utils.platformVersion, "18.0") < 0)
httpTopic = "http-on-modify-request";
@@ -396,17 +396,17 @@ let PolicyImplementation =
{
// Our category observers should be removed before changing category
// memberships, just in case.
Services.obs.removeObserver(this, httpTopic);
Services.obs.removeObserver(this, "content-document-global-created");
Services.obs.removeObserver(this, "xpcom-category-entry-removed");
Services.obs.removeObserver(this, "xpcom-category-cleared");
- for each (let category in this.xpcom_categories)
+ for (let category of this.xpcom_categories)
catMan.deleteCategoryEntry(category, this.contractID, false);
// This needs to run asynchronously, see bug 753687
Utils.runAsync(function()
{
registrar.unregisterFactory(this.classID, this);
}.bind(this));
@@ -634,17 +634,17 @@ function schedulePostProcess(/**Element*
/**
* Processes nodes scheduled for post-processing (typically hides them).
*/
function postProcessNodes()
{
let nodes = scheduledNodes;
scheduledNodes = null;
- for each (let node in nodes)
+ for (let node of nodes)
{
// adjust frameset's cols/rows for frames
let parentNode = node.parentNode;
if (parentNode && parentNode instanceof Ci.nsIDOMHTMLFrameSetElement)
{
let hasCols = (parentNode.cols && parentNode.cols.indexOf(",") > 0);
let hasRows = (parentNode.rows && parentNode.rows.indexOf(",") > 0);
if ((hasCols || hasRows) && !(hasCols && hasRows))
« no previous file with comments | « lib/antiadblockInit.js ('k') | lib/downloader.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld