Bug 1217093 - Remove for-each from dom/. r=smaug

--HG--
extra : commitid : DcjxshJqlKg
extra : rebase_source : 23bc9a985f1e6d13e13837e31bb9b88b9be24d55
This commit is contained in:
Tooru Fujisawa 2015-10-19 02:00:50 +09:00
Родитель b012410df7
Коммит 24ab66bc98
22 изменённых файлов: 52 добавлений и 47 удалений

Просмотреть файл

@ -591,7 +591,7 @@ this.expandPermissions = function expandPermissions(aPermName, aAccess) {
// Add the same suffix to each of the additions.
if (tableEntry.additional) {
for each (let additional in tableEntry.additional) {
for (let additional of tableEntry.additional) {
permArr = permArr.concat(appendAccessToPermName(additional, requestedSuffixes));
}
}

Просмотреть файл

@ -21,7 +21,7 @@
<script type="application/javascript">
<![CDATA[
var imports = [ "SimpleTest", "is", "isnot", "ok" ];
for each (var name in imports) {
for (var name of imports) {
window[name] = window.opener.wrappedJSObject[name];
}

Просмотреть файл

@ -13,7 +13,7 @@ function handleRequest(request, response) {
invalidHeaders.push("Authorization");
}
for each (let header in invalidHeaders) {
for (let header of invalidHeaders) {
if (request.hasHeader(header)) {
response.setStatusLine(null, 500, "Server Error");
headers[header.toLowerCase()] = request.getHeader(header);

Просмотреть файл

@ -119,7 +119,7 @@
mm.loadFrameScript("data:,(" + childFrameScript.toString() + ")();",
false);
for each (let message in messages) {
for (let message of messages) {
mm.sendAsyncMessage("test:ipcClonedMessage", message);
}
});

Просмотреть файл

@ -338,7 +338,7 @@ BrowserElementAuthPrompt.prototype = {
prompt.authInfo.password = password;
}
for each (let consumer in prompt.consumers) {
for (let consumer of prompt.consumers) {
if (!consumer.callback) {
// Not having a callback means that consumer didn't provide it
// or canceled the notification.

Просмотреть файл

@ -38,7 +38,7 @@ addLoadEvent(function() {
}
}
for each(var event in ["online", "offline"]) {
for (var event of ["online", "offline"]) {
document.documentElement.addEventListener(
event,
makeHandler("document.body.addEventListener('%1', ..., false)",

Просмотреть файл

@ -67,12 +67,12 @@ function createTestEventValue(name) {
is(ev.pointerId, pointerId, "Correct pointerId");
}
for each (let target in [document, window, testTarget, parent])
for (let target of [document, window, testTarget, parent])
target.addEventListener(name, check, false);
testTarget.dispatchEvent(event);
for each (let target in [document, window, testTarget, parent])
for (let target of [document, window, testTarget, parent])
target.removeEventListener(name, check, false);

Просмотреть файл

@ -34,7 +34,7 @@ var group2;
var group3;
var tags = ["input", "menuitem"];
for each (let tag in tags) {
for (let tag of tags) {
function bounce(node) {
let n = node.nextSibling;
@ -46,7 +46,7 @@ function bounce(node) {
var createdNodes = [];
function cleanup() {
for each (let node in createdNodes) {
for (let node of createdNodes) {
if (node.parentNode) {
node.parentNode.removeChild(node);
}
@ -79,7 +79,7 @@ var types = ['c', 'r'];
// First make sure that setting .checked makes .defaultChecked changes no
// longer affect .checked.
for each (let type in types) {
for (let type of types) {
let n = createNode(type, '', false);
is(n.defaultChecked, false, "Bogus defaultChecked on " + typeMapper[type]);
is(n.checked, false, "Bogus checked on " + typeMapper[type]);
@ -109,7 +109,7 @@ cleanup();
// Now check that bouncing a control that's the only one of its kind has no
// effect
for each (let type in types) {
for (let type of types) {
let n = createNode(type, 'test1', true);
$(tag == "input" ? "f1" : "m1").appendChild(n);
n.checked = false;

Просмотреть файл

@ -1647,7 +1647,7 @@ MmsService.prototype = {
savable.receivers = [];
// We don't have Bcc in recevied MMS message.
for each (let type in ["cc", "to"]) {
for (let type of ["cc", "to"]) {
if (intermediate.headers[type]) {
if (intermediate.headers[type] instanceof Array) {
for (let index in intermediate.headers[type]) {

Просмотреть файл

@ -673,7 +673,7 @@ MobileMessageDB.prototype = {
stores = txn.objectStore(storeNames[0]);
} else {
stores = [];
for each (let storeName in storeNames) {
for (let storeName of storeNames) {
if (DEBUG) debug("Retrieving object store " + storeName);
stores.push(txn.objectStore(storeName));
}
@ -1460,7 +1460,7 @@ MobileMessageDB.prototype = {
let timestamp = messageRecord.timestamp;
// Setup participantIdsIndex.
messageRecord.participantIdsIndex = [];
for each (let id in participantIds) {
for (let id of participantIds) {
messageRecord.participantIdsIndex.push([id, timestamp]);
}
if (threadRecord) {
@ -2857,7 +2857,7 @@ MobileMessageDB.prototype = {
aMessageRecord.threadIdIndex = [threadId, timestamp];
// Setup participantIdsIndex.
aMessageRecord.participantIdsIndex = [];
for each (let id in participantIds) {
for (let id of participantIds) {
aMessageRecord.participantIdsIndex.push([id, timestamp]);
}

Просмотреть файл

@ -171,7 +171,7 @@ var LEGACY = {
aMessageRecord.threadIdIndex = [threadId, timestamp];
// Setup participantIdsIndex.
aMessageRecord.participantIdsIndex = [];
for each (let id in participantIds) {
for (let id of participantIds) {
aMessageRecord.participantIdsIndex.push([id, timestamp]);
}

Просмотреть файл

@ -45,7 +45,7 @@ var PaymentManager = {
}
} catch(e) {}
for each (let msgname in PAYMENT_IPC_MSG_NAMES) {
for (let msgname of PAYMENT_IPC_MSG_NAMES) {
ppmm.addMessageListener(msgname, this);
}
@ -401,7 +401,7 @@ var PaymentManager = {
observe: function observe(subject, topic, data) {
if (topic == "xpcom-shutdown") {
for each (let msgname in PAYMENT_IPC_MSG_NAMES) {
for (let msgname of PAYMENT_IPC_MSG_NAMES) {
ppmm.removeMessageListener(msgname, this);
}
this.registeredProviders = null;

Просмотреть файл

@ -79,13 +79,13 @@ var tests = [
{ values: "foo bar baz qux", length: 4 } ] }
];
for each (let test in tests) {
for (let test of tests) {
let list = test.element;
for each (let property in test.listProperty.split(".")) {
for (let property of test.listProperty.split(".")) {
list = list[property];
}
for each (let subtest in test.subtests) {
for (let subtest of test.subtests) {
if (subtest.values) {
test.element.setAttribute(test.attribute, subtest.values);
}

Просмотреть файл

@ -267,7 +267,7 @@ function isValidInterpolation(aFromType, aToType)
// Runs the test.
function run()
{
for each (let additive in [false, true]) {
for (let additive of [false, true]) {
let indexOfExpectedArguments = additive ? 3 : 2;
// Add subtests for each combination of prefix and suffix, and additive
@ -279,7 +279,7 @@ function run()
toArguments = suffixEntry[1],
expectedArguments = suffixEntry[indexOfExpectedArguments];
for each (let prefixEntry in gPrefixes) {
for (let prefixEntry of gPrefixes) {
let [prefixLength, prefix] = prefixEntry;
addTest(prefixLength, prefix, fromType, fromArguments,
toType, toArguments, toType, expectedArguments, additive);
@ -298,9 +298,9 @@ function run()
"a", [60, 70, 80, 1, 0, 90, 100], additive);
// Test all pairs of segment types that cannot be interpolated between.
for each (let fromType in gTypes) {
for (let fromType of gTypes) {
let fromArguments = generatePathSegmentArguments(fromType, 0);
for each (let toType in gTypes) {
for (let toType of gTypes) {
if (!isValidInterpolation(fromType, toType)) {
let toArguments = generatePathSegmentArguments(toType, 1000);
addTest(1, "M100,100", fromType, fromArguments,
@ -314,7 +314,7 @@ function run()
gSVG.setCurrentTime(4);
// Inspect the results of each subtest.
for each (let test in gTests) {
for (let test of gTests) {
let list = test.element.animatedPathSegList;
is(list.numberOfItems, test.prefixLength + 1,
"Length of animatedPathSegList for interpolation " +

Просмотреть файл

@ -236,7 +236,8 @@ NetworkManager.prototype = {
let excludeFota = aMsg.json.excludeFota;
let interfaces = [];
for each (let network in this.networkInterfaces) {
for (let key in this.networkInterfaces) {
let network = this.networkInterfaces[key];
let i = network.info;
if ((i.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_MMS && excludeMms) ||
(i.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_SUPL && excludeSupl) ||
@ -825,7 +826,8 @@ NetworkManager.prototype = {
this._activeNetwork = null;
let anyConnected = false;
for each (let network in this.networkInterfaces) {
for (let key in this.networkInterfaces) {
let network = this.networkInterfaces[key];
if (network.info.state != Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED) {
continue;
}

Просмотреть файл

@ -363,7 +363,8 @@ TetheringService.prototype = {
},
getNetworkInfo: function(aType, aServiceId) {
for each (let networkInfo in gNetworkManager.allNetworkInfo) {
for (let networkId in gNetworkManager.allNetworkInfo) {
let networkInfo = gNetworkManager.allNetworkInfo[networkId];
if (networkInfo.type == aType) {
try {
if (networkInfo instanceof Ci.nsIRilNetworkInfo) {

Просмотреть файл

@ -3786,7 +3786,8 @@ RilObject.prototype = {
}
let list = null;
for each (let ll in usedCellBroadcastConfigs) {
for (let key in usedCellBroadcastConfigs) {
let ll = usedCellBroadcastConfigs[key];
if (ll == null) {
continue;
}

Просмотреть файл

@ -141,7 +141,7 @@ TVSimulatorService.prototype = {
this._internalTuners = new Map();
// TVTunerData
for each (let tunerData in settingsObj.tuners) {
for (let tunerData of settingsObj.tuners) {
let tuner = Cc["@mozilla.org/tv/tvtunerdata;1"]
.createInstance(Ci.nsITVTunerData);
tuner.id = tunerData.id;
@ -156,11 +156,11 @@ TVSimulatorService.prototype = {
};
// TVSource
for each (let sourceData in tunerData.sources) {
for (let sourceData of tunerData.sources) {
wrapTunerData.sourceType = sourceData.type;
// TVChannel
for each (let channelData in sourceData.channels) {
for (let channelData of sourceData.channels) {
let channel = Cc["@mozilla.org/tv/tvchanneldata;1"]
.createInstance(Ci.nsITVChannelData);
channel.networkId = channelData.networkId;
@ -179,7 +179,7 @@ TVSimulatorService.prototype = {
};
// TVProgram
for each (let programData in channelData.programs) {
for (let programData of channelData.programs) {
let program = Cc["@mozilla.org/tv/tvprogramdata;1"]
.createInstance(Ci.nsITVProgramData);
program.eventId = programData.eventId;
@ -386,7 +386,7 @@ TVSimulatorService.prototype = {
return Cr.NS_ERROR_INVALID_ARG;
}
for each (let program in wrapChannelData.programs) {
for (let program of wrapChannelData.programs) {
programArray.appendElement(program, false);
}
@ -461,7 +461,7 @@ TVSimulatorService.prototype = {
_validateTuners: function TVSimValidateTuners(aTunersObject) {
let tunerIds = new Array();
for each (let tuner in aTunersObject) {
for (let tuner of aTunersObject) {
if (!tuner.id ||
!tuner.supportedType ||
!tuner.supportedType.length ||
@ -480,7 +480,7 @@ TVSimulatorService.prototype = {
},
_validateSources: function TVSimValidateSources(aSourcesObject) {
for each (let source in aSourcesObject) {
for (let source of aSourcesObject) {
if (!source.type ||
!TV_SOURCE_TYPES.includes(source.type)) {
debug("invalid source data.");
@ -496,7 +496,7 @@ TVSimulatorService.prototype = {
_validateChannels: function TVSimValidateChannels(aChannelsObject) {
let channelNumbers = new Array();
for each (let channel in aChannelsObject) {
for (let channel of aChannelsObject) {
if (!channel.networkId ||
!channel.transportStreamId ||
!channel.serviceId ||
@ -519,7 +519,7 @@ TVSimulatorService.prototype = {
_validatePrograms: function TVSimValidatePrograms(aProgramsObject) {
let eventIds = new Array();
for each (let program in aProgramsObject) {
for (let program of aProgramsObject) {
if (!program.eventId ||
eventIds.includes(program.eventId) ||
!program.title ||

Просмотреть файл

@ -128,7 +128,7 @@ var PDUBuilder = {
let headerLength = 0;
this.buf = "";
if (options.headers) {
for each (let header in options.headers) {
for (let header of options.headers) {
headerLength += 2; // id + length octets
if (header.octets) {
headerLength += header.octets.length;
@ -149,12 +149,12 @@ var PDUBuilder = {
if (options.headers) {
this.writeHexOctet(headerLength);
for each (let header in options.headers) {
for (let header of options.headers) {
this.writeHexOctet(header.id);
this.writeHexOctet(header.length);
if (header.octets) {
for each (let octet in header.octets) {
for (let octet of header.octets) {
this.writeHexOctet(octet);
}
}

Просмотреть файл

@ -2608,7 +2608,8 @@ WifiWorker.prototype = {
// connect to which ever network it thinks is best, so when we select the
// proper network (or fail to), we need to re-enable the rest.
_enableAllNetworks: function() {
for each (let net in this.configuredNetworks) {
for (let key in this.configuredNetworks) {
let net = this.configuredNetworks[key];
WifiManager.enableNetwork(net.netId, false, function(ok) {
net.disabled = ok ? 1 : 0;
});

Просмотреть файл

@ -11,7 +11,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
function testForExpectedSymbols(stage, data) {
const expectedSymbols = [ "Worker", "ChromeWorker" ];
for each (var symbol in expectedSymbols) {
for (var symbol of expectedSymbols) {
Services.prefs.setBoolPref("workertest.bootstrap." + stage + "." + symbol,
symbol in this);
}

Просмотреть файл

@ -31,8 +31,8 @@
const stages = [ "install", "startup", "shutdown", "uninstall" ];
const symbols = [ "Worker", "ChromeWorker" ];
for each (var stage in stages) {
for each (var symbol in symbols) {
for (var stage of stages) {
for (var symbol of symbols) {
is(Services.prefs.getBoolPref("workertest.bootstrap." + stage +
"." + symbol),
true,