Bug 1414340 part 1 - Remove non-standard array/generator comprehensions from browser code. r=mossop

This commit is contained in:
Jan de Mooij 2017-11-10 11:52:22 +01:00
parent ca01158c96
commit 296194e65f
5 changed files with 27 additions and 22 deletions

View File

@ -35,7 +35,7 @@ var gGrid = {
/**
* All sites contained in the grid's cells. Sites may be empty.
*/
get sites() { return [for (cell of this.cells) cell.site]; },
get sites() { return this.cells.map(cell => cell.site); },
// Tells whether the grid has already been initialized.
get ready() { return !!this._ready; },

View File

@ -1140,14 +1140,15 @@ addAsyncAnimTest("tree_ordering", { observe: div, subtree: true }, function*() {
var divAnimations = div.getAnimations();
var childAAnimations = childA.getAnimations();
var childBAnimations = childB.getAnimations();
var divBeforeAnimations =
[ for (x of docAnims) if (x.effect.target.parentElement == div &&
x.effect.target.type == "::before") x ];
docAnims.filter(x => (x.effect.target.parentElement == div &&
x.effect.target.type == "::before"));
var divAfterAnimations =
[ for (x of docAnims) if (x.effect.target.parentElement == div &&
x.effect.target.type == "::after") x ];
docAnims.filter(x => (x.effect.target.parentElement == div &&
x.effect.target.type == "::after"));
var childBPseudoAnimations =
[ for (x of docAnims) if (x.effect.target.parentElement == childB) x ];
docAnims.filter(x => x.effect.target.parentElement == childB);
// The order in which we get the corresponding records is currently
// based on the order we visit these nodes when updating styles.

View File

@ -34,7 +34,7 @@ var test = function (isContent) {
};
// Returns generator object that iterates through pref values.
let prefVals = (for (prefVal of [false, true]) prefVal);
let prefVals = (function*() { yield false; yield true; })();
// The main test function, runs until all pref values are exhausted.
let nextTest = function () {

View File

@ -152,18 +152,21 @@ add_task(async function() {
`http://www.example.com:80${defaultPath}`,
];
// Open tabs an collect corresponding browsers
let browsers = [
for (url of tabURLs) BrowserTestUtils.addTab(gBrowser, url).linkedBrowser
];
let browsers = tabURLs.map(url => BrowserTestUtils.addTab(gBrowser, url).linkedBrowser);
// Once all the pages have loaded, run a bunch of tests in "parallel".
await Promise.all((
for (browser of browsers) BrowserTestUtils.browserLoaded(browser)
));
await Promise.all((function*() {
for (let browser of browsers) {
yield BrowserTestUtils.browserLoaded(browser);
}
})());
// Flood random browsers with requests. Once promises settle, check that
// responses all pass.
const results = await Promise.all((
for (browser of randBrowsers(browsers, 50)) ManifestObtainer.browserObtainManifest(browser)
));
const results = await Promise.all((function*() {
for (let browser of randBrowsers(browsers, 50)) {
yield ManifestObtainer.browserObtainManifest(browser);
}
})());
const pass = results.every(manifest => manifest.name === 'pass');
ok(pass, 'Expect every manifest to have name equal to `pass`.');
//cleanup

View File

@ -28,13 +28,14 @@ add_task(async function() {
`http://test:80`,
];
//Add tabs, get the respective browsers
let browsers = [
for (u of tabURLs) BrowserTestUtils.addTab(gBrowser, u).linkedBrowser
];
let browsers = tabURLs.map(u => BrowserTestUtils.addTab(gBrowser, u).linkedBrowser);
//wait for promises to settle
await Promise.all((
for (b of browsers) BrowserTestUtils.browserLoaded(b)
));
await Promise.all((function*() {
for (let b of browsers) {
yield BrowserTestUtils.browserLoaded(b);
}
})());
let expected = 'Expected all promised browsers to have loaded.';
for (const browser of browsers) {
await isDOMLoaded(browser);