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

Unified Diff: chrome/content/common.js

Issue 6423769060999168: Issue 301 - adblockplustests: Use for (.. of ..) (Closed)
Patch Set: Created April 12, 2014, 1:48 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 | « no previous file | chrome/content/index.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/common.js
===================================================================
--- a/chrome/content/common.js
+++ b/chrome/content/common.js
@@ -164,17 +164,17 @@ function setupVirtualTime(processTimers)
{
let currentTime = 100000 * MILLIS_IN_HOUR;
let startTime = currentTime;
let scheduledTasks = [];
let modules = Array.prototype.slice.call(arguments, 1);
this._virtualTimeModules = modules;
- for each (let module in this._virtualTimeModules)
+ for (let module of this._virtualTimeModules)
{
let global = Cu.getGlobalForObject(getModuleGlobal(module));
// Replace Date.now() function
this["_origNow" + module] = global.Date.now;
global.Date.now = function() currentTime;
}
@@ -231,17 +231,17 @@ function setupVirtualTime(processTimers)
}
this._runScheduledTasks = function(maxHours)
{
let endTime = currentTime + maxHours * MILLIS_IN_HOUR;
while (true)
{
let nextTask = null;
- for each (let task in scheduledTasks)
+ for (let task of scheduledTasks)
{
if (!nextTask || nextTask.nextExecution > task.nextExecution)
nextTask = task;
}
if (!nextTask || nextTask.nextExecution > endTime)
break;
currentTime = nextTask.nextExecution;
@@ -267,17 +267,17 @@ function setupVirtualTime(processTimers)
currentTime = endTime;
}
this._skipTasks = function(hours)
{
let newTasks = [];
currentTime += hours * MILLIS_IN_HOUR;
- for each (let task in scheduledTasks)
+ for (let task of scheduledTasks)
{
if (task.nextExecution >= currentTime)
newTasks.push(task);
else if (task.type != Components.interfaces.nsITimer.TYPE_ONE_SHOT)
{
task.nextExecution = currentTime;
newTasks.push(task);
}
@@ -287,17 +287,17 @@ function setupVirtualTime(processTimers)
this.getTimeOffset = function() (currentTime - startTime) / MILLIS_IN_HOUR;
this.__defineGetter__("currentTime", function() currentTime);
}
function restoreVirtualTime()
{
- for each (let module in this._virtualTimeModules)
+ for (let module of this._virtualTimeModules)
{
let global = Cu.getGlobalForObject(getModuleGlobal(module));
// Restore Date.now() function
if ("_origNow" + module in this)
{
global.Date.now = this["_origNow" + module];
delete this["_origNow" + module];
@@ -401,17 +401,17 @@ function setupVirtualXMLHttp()
result = [Cr.NS_OK, 0, this._data];
else if (this._path in requestHandlers)
result = requestHandlers[this._path]({method: "GET", path: this._path, queryString: this._queryString});
[this.channel.status, this.channel.responseStatus, this.responseText] = result;
this.status = this.channel.responseStatus;
let eventName = (this.channel.status == Cr.NS_OK ? "load" : "error");
let event = {type: eventName};
- for each (let handler in this["_" + eventName + "Handlers"])
+ for (let handler of this["_" + eventName + "Handlers"])
handler.call(this, event);
}.bind(this));
},
overrideMimeType: function(mime)
{
},
@@ -425,29 +425,29 @@ function setupVirtualXMLHttp()
QueryInterface: function() this
}
}
this.registerHandler = function(path, handler) requestHandlers[path] = handler;
let modules = Array.prototype.slice.call(arguments, 1);
this._virtualXMLHttpModules = modules;
- for each (let module in this._virtualTimeModules)
+ for (let module of this._virtualTimeModules)
{
let global = getModuleGlobal(module);
// Replace XMLHttpRequest constructor
this["_origXMLHttpRequest" + module] = global.XMLHttpRequest;
global.XMLHttpRequest = XMLHttpRequest;
}
}
function restoreVirtualXMLHttp()
{
- for each (let module in this._virtualXMLHttpModules)
+ for (let module of this._virtualXMLHttpModules)
{
let global = getModuleGlobal(module);
// Restore XMLHttpRequest constructor
if ("_origXMLHttpRequest" + module in this)
{
global.XMLHttpRequest = this["_origXMLHttpRequest" + module];
delete this["_origXMLHttpRequest" + module];
@@ -479,17 +479,17 @@ function showProfilingData(debuggerServi
let header = table.insertRow(-1);
header.style.fontWeight = "bold";
header.insertCell(-1).textContent = "Function name";
header.insertCell(-1).textContent = "Call count";
header.insertCell(-1).textContent = "Min execution time (total/own)";
header.insertCell(-1).textContent = "Max execution time (total/own)";
header.insertCell(-1).textContent = "Total execution time (total/own)";
- for each (let script in scripts)
+ for (let script of scripts)
showProfilingDataForScript(script, table);
document.getElementById("display").appendChild(table);
}
function showProfilingDataForScript(script, table)
{
let functionName = script.functionName;
« no previous file with comments | « no previous file | chrome/content/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld