Bug 1217316 - Remove for-each from netwerk/. r=jduell

This commit is contained in:
Tooru Fujisawa 2015-10-19 02:19:02 +09:00
parent 318150b4f6
commit 49108e7b28
9 changed files with 21 additions and 21 deletions

View File

@ -34,7 +34,7 @@ function launchConnection(socks_vers, socks_port, dest_host, dest_port, dns)
output.close();
}
for each (var arg in arguments) {
for (var arg of arguments) {
print('client: running test', arg);
test = arg.split('|');
launchConnection(test[0], parseInt(test[1]), test[2],

View File

@ -35,7 +35,7 @@ function check_for_exception(spec)
}
function run_test() {
for each (spec in specs) {
for (var spec of specs) {
check_for_exception(spec);
}
}

View File

@ -14,7 +14,7 @@ function run_test() {
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
for each (spec in specs) {
for (var spec of specs) {
var uri = ios.newURI(spec, null, null);
if (uri.spec.indexOf("..") != -1)
do_throw("resource: traversal remains: '"+spec+"' ==> '"+uri.spec+"'");

View File

@ -43,7 +43,7 @@ function run_test() {
// Make sure our prefs are set such that this test actually means something
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
for each (var pref in prefData) {
for (var pref of prefData) {
try {
pref.oldVal = prefs.getBoolPref(pref.name);
} catch(e) {
@ -63,7 +63,7 @@ function run_test() {
do_check_eq(uri4.host, uri5.host);
do_check_eq(uri4.asciiHost, uri5.asciiHost);
} finally {
for each (var pref in prefData) {
for (var pref of prefData) {
if (prefs.prefHasUserValue(pref.name))
prefs.clearUserPref(pref.name);
}

View File

@ -146,7 +146,7 @@ function test_binary_portion(start, length) {
test_seek_then_read,
];
for each(test in streamTests) {
for (var test of streamTests) {
let fileStream = new_file_input_stream(subFile);
let partialStream = new_partial_file_input_stream(do_get_file(binary_test_file_name),
start, length);
@ -207,7 +207,7 @@ function test_seek(dummy, partialFileStream, size) {
partialFileStream.QueryInterface(Ci.nsISeekableStream);
tests = [
var tests = [
[SET, 0],
[SET, 5],
[SET, 1000],
@ -259,7 +259,7 @@ function test_seek(dummy, partialFileStream, size) {
];
let pos = 0;
for each(test in tests) {
for (var test of tests) {
let didThrow = false;
try {
partialFileStream.seek(test[0], test[1]);
@ -298,7 +298,7 @@ function test_seek_then_read(fileStreamA, fileStreamB, size) {
let read = {};
tests = [
var tests = [
[SET, 0],
[read, 1000],
[read, 1000],
@ -324,7 +324,7 @@ function test_seek_then_read(fileStreamA, fileStreamB, size) {
[read, 100],
];
for each(test in tests) {
for (var test of tests) {
if (test[0] === read) {
let didThrowA = false;
@ -364,7 +364,7 @@ function test_text_portion(start, length) {
test_seek_then_readline,
];
for each(test in streamTests) {
for (var test of streamTests) {
let fileStream = new_file_input_stream(subFile)
.QueryInterface(Ci.nsILineInputStream);
let partialStream = new_partial_file_input_stream(do_get_file(binary_test_file_name),
@ -400,7 +400,7 @@ function test_seek_then_readline(fileStreamA, fileStreamB, size) {
let read = {};
tests = [
var tests = [
[SET, 0],
[read, 5],
[read, 5],
@ -430,7 +430,7 @@ function test_seek_then_readline(fileStreamA, fileStreamB, size) {
[read, 1],
];
for each(test in tests) {
for (var test of tests) {
if (test[0] === read) {
for (let i = 0; i < test[1]; ++i) {

View File

@ -30,6 +30,6 @@ function check_file(file) {
}
function run_test() {
for each(let file in ["ua.css"])
for (let file of ["ua.css"])
check_file(file)
}

View File

@ -34,13 +34,13 @@ function err(file, lineNo, msg) {
function run_test()
{
for each (var test in test_array) {
for (var test of test_array) {
var lineStream = new_line_input_stream(test.file);
var lineNo = 0;
var more = false;
var line = {};
more = lineStream.readLine(line);
for each (var check in test.lines) {
for (var check of test.lines) {
++lineNo;
if (lineNo == test.lines.length) {
if (more) err(test.file, lineNo, "There should be no more data after the last line");

View File

@ -428,7 +428,7 @@ SocksTestServer.prototype = {
var argv = [];
// marshaled: socks_ver|server_port|dest_host|dest_port|<remote|local>
for each (var test in this.test_cases) {
for (var test of this.test_cases) {
var arg = test.type + '|' +
String(socks_listen_port) + '|' +
test.host + '|' + test.port + '|';
@ -467,7 +467,7 @@ SocksTestServer.prototype = {
}
this.client_subprocess = null;
}
for each (var client in this.client_connections)
for (var client of this.client_connections)
client.close();
this.client_connections = [];
if (this.listener) {

View File

@ -50,7 +50,7 @@ function test_setEmptyPath()
["http://example.com:80/a", "http://example.com/tests/dom/tests"],
].map(pairToURLs);
for each (var [provided, target] in pairs)
for (var [provided, target] of pairs)
{
symmetricEquality(false, target, provided);
@ -77,7 +77,7 @@ function test_setQuery()
["http://example.com/?f", "http://example.com/?foo"],
].map(pairToURLs);
for each (var [provided, target] in pairs) {
for (var [provided, target] of pairs) {
symmetricEquality(false, provided, target);
provided.query = "foo";
@ -135,7 +135,7 @@ function test_setRef()
["http://example.com:80/a", "xxxxxxxxxxxxxx", "http://example.com:80/a#xxxxxxxxxxxxxx"],
];
for each (var [before, ref, result] in tests)
for (var [before, ref, result] of tests)
{
/* Test1: starting with empty ref */
var a = stringToURL(before);