diff --git a/docs/fiddles/features/web-hid/renderer.js b/docs/fiddles/features/web-hid/renderer.js
index cbb00ab08f..133beb520c 100644
--- a/docs/fiddles/features/web-hid/renderer.js
+++ b/docs/fiddles/features/web-hid/renderer.js
@@ -1,19 +1,10 @@
-async function testIt () {
- const grantedDevices = await navigator.hid.getDevices()
- let grantedDeviceList = ''
- grantedDevices.forEach(device => {
- grantedDeviceList += `
${device.productName}`
- })
- document.getElementById('granted-devices').innerHTML = grantedDeviceList
- const grantedDevices2 = await navigator.hid.requestDevice({
- filters: []
- })
+function formatDevices (devices) {
+ return devices.map(device => device.productName).join('
')
+}
- grantedDeviceList = ''
- grantedDevices2.forEach(device => {
- grantedDeviceList += `
${device.productName}`
- })
- document.getElementById('granted-devices2').innerHTML = grantedDeviceList
+async function testIt () {
+ document.getElementById('granted-devices').innerHTML = formatDevices(await navigator.hid.getDevices())
+ document.getElementById('granted-devices2').innerHTML = formatDevices(await navigator.hid.requestDevice({ filters: [] }))
}
document.getElementById('clickme').addEventListener('click', testIt)
diff --git a/docs/fiddles/features/web-usb/renderer.js b/docs/fiddles/features/web-usb/renderer.js
index cf20c24cc9..1c217d957d 100644
--- a/docs/fiddles/features/web-usb/renderer.js
+++ b/docs/fiddles/features/web-usb/renderer.js
@@ -7,9 +7,9 @@ async function testIt () {
const grantedDevices = await navigator.usb.getDevices()
let grantedDeviceList = ''
if (grantedDevices.length > 0) {
- grantedDevices.forEach(device => {
+ for (const device of grantedDevices) {
grantedDeviceList += `
${getDeviceDetails(device)}`
- })
+ }
} else {
grantedDeviceList = noDevicesFoundMsg
}
diff --git a/docs/fiddles/menus/customize-menus/main.js b/docs/fiddles/menus/customize-menus/main.js
index 3fc16f847d..a93293afde 100644
--- a/docs/fiddles/menus/customize-menus/main.js
+++ b/docs/fiddles/menus/customize-menus/main.js
@@ -68,9 +68,9 @@ const template = [
// on reload, start fresh and close any old
// open secondary windows
if (focusedWindow.id === 1) {
- BrowserWindow.getAllWindows().forEach(win => {
+ for (const win of BrowserWindow.getAllWindows()) {
if (win.id > 1) win.close()
- })
+ }
}
focusedWindow.reload()
}
@@ -209,15 +209,15 @@ function findReopenMenuItem () {
if (!menu) return
let reopenMenuItem
- menu.items.forEach(item => {
+ for (const item of menu.items) {
if (item.submenu) {
- item.submenu.items.forEach(item => {
- if (item.key === 'reopenMenuItem') {
- reopenMenuItem = item
+ for (const subitem of item.submenu.items) {
+ if (subitem.key === 'reopenMenuItem') {
+ reopenMenuItem = subitem
}
- })
+ }
}
- })
+ }
return reopenMenuItem
}
diff --git a/docs/tutorial/code-signing.md b/docs/tutorial/code-signing.md
index e4ac634260..1a35bb7071 100644
--- a/docs/tutorial/code-signing.md
+++ b/docs/tutorial/code-signing.md
@@ -167,11 +167,11 @@ const supportBinaries = await msiCreator.create()
// 🆕 Step 2a: optionally sign support binaries if you
// sign you binaries as part of of your packaging script
-supportBinaries.forEach(async (binary) => {
+for (const binary of supportBinaries) {
// Binaries are the new stub executable and optionally
// the Squirrel auto updater.
await signFile(binary)
-})
+}
// Step 3: Compile the template to a .msi file
await msiCreator.compile()
diff --git a/docs/tutorial/in-app-purchases.md b/docs/tutorial/in-app-purchases.md
index d913df5482..db781d57e0 100644
--- a/docs/tutorial/in-app-purchases.md
+++ b/docs/tutorial/in-app-purchases.md
@@ -46,7 +46,7 @@ inAppPurchase.on('transactions-updated', (event, transactions) => {
}
// Check each transaction.
- transactions.forEach((transaction) => {
+ for (const transaction of transactions) {
const payment = transaction.payment
switch (transaction.transactionState) {
@@ -95,7 +95,7 @@ inAppPurchase.on('transactions-updated', (event, transactions) => {
default:
break
}
- })
+ }
})
// Check if the user is allowed to make in-app purchase.
@@ -112,9 +112,9 @@ inAppPurchase.getProducts(PRODUCT_IDS).then(products => {
}
// Display the name and price of each product.
- products.forEach(product => {
+ for (const product of products) {
console.log(`The price of ${product.localizedTitle} is ${product.formattedPrice}.`)
- })
+ }
// Ask the user which product they want to purchase.
const selectedProduct = products[0]
diff --git a/lib/browser/api/menu-utils.ts b/lib/browser/api/menu-utils.ts
index 084432a66f..4daa615aeb 100644
--- a/lib/browser/api/menu-utils.ts
+++ b/lib/browser/api/menu-utils.ts
@@ -57,12 +57,17 @@ function sortTopologically (originalOrder: T[], edgesById: Map) {
marked.add(mark);
const edges = edgesById.get(mark);
if (edges != null) {
- edges.forEach(visit);
+ for (const edge of edges) {
+ visit(edge);
+ }
}
sorted.push(mark);
};
- originalOrder.forEach(visit);
+ for (const edge of originalOrder) {
+ visit(edge);
+ }
+
return sorted;
}
@@ -98,24 +103,24 @@ function sortItemsInGroup (group: {before?: T[], after?: T[], id?: T}[]) {
const edges = new Map();
const idToIndex = new Map(group.map((item, i) => [item.id, i]));
- group.forEach((item, i) => {
+ for (const [i, item] of group.entries()) {
if (item.before) {
- item.before.forEach(toID => {
+ for (const toID of item.before) {
const to = idToIndex.get(toID);
if (to != null) {
pushOntoMultiMap(edges, to, i);
}
- });
+ }
}
if (item.after) {
- item.after.forEach(toID => {
+ for (const toID of item.after) {
const to = idToIndex.get(toID);
if (to != null) {
pushOntoMultiMap(edges, i, to);
}
- });
+ }
}
- });
+ }
const sortedNodes = sortTopologically(originalOrder, edges);
return sortedNodes.map(i => group[i]);
diff --git a/lib/browser/api/menu.ts b/lib/browser/api/menu.ts
index 3cd17a8ce7..abdf50bf6d 100644
--- a/lib/browser/api/menu.ts
+++ b/lib/browser/api/menu.ts
@@ -153,9 +153,9 @@ Menu.prototype.insert = function (pos, item) {
Menu.prototype._callMenuWillShow = function () {
if (this.delegate) this.delegate.menuWillShow(this);
- this.items.forEach(item => {
+ for (const item of this.items) {
if (item.submenu) item.submenu._callMenuWillShow();
- });
+ }
};
/* Static Methods */
@@ -196,13 +196,13 @@ Menu.buildFromTemplate = function (template) {
const filtered = removeExtraSeparators(sorted);
const menu = new Menu();
- filtered.forEach(item => {
+ for (const item of filtered) {
if (item instanceof MenuItem) {
menu.append(item);
} else {
menu.append(new MenuItem(item));
}
- });
+ }
return menu;
};
@@ -280,9 +280,9 @@ function insertItemByType (this: MenuType, item: MenuItem, pos: number) {
enumerable: true,
get: () => checked.get(item),
set: () => {
- this.groupsMap[item.groupId].forEach(other => {
+ for (const other of this.groupsMap[item.groupId]) {
if (other !== item) checked.set(other, false);
- });
+ }
checked.set(item, true);
}
});
diff --git a/lib/browser/api/net-client-request.ts b/lib/browser/api/net-client-request.ts
index f4948b26ca..9332f86ce1 100644
--- a/lib/browser/api/net-client-request.ts
+++ b/lib/browser/api/net-client-request.ts
@@ -70,9 +70,9 @@ class IncomingMessage extends Readable {
get rawHeaders () {
const rawHeadersArr: string[] = [];
const { rawHeaders } = this._responseHead;
- rawHeaders.forEach(header => {
+ for (const header of rawHeaders) {
rawHeadersArr.push(header.key, header.value);
- });
+ }
return rawHeadersArr;
}
diff --git a/lib/browser/api/net-fetch.ts b/lib/browser/api/net-fetch.ts
index b39f488fc7..b73512f43f 100644
--- a/lib/browser/api/net-fetch.ts
+++ b/lib/browser/api/net-fetch.ts
@@ -98,7 +98,9 @@ export function fetchWithSession (input: RequestInfo, init: (RequestInit & {bypa
r.on('response', (resp: IncomingMessage) => {
if (locallyAborted) return;
const headers = new Headers();
- for (const [k, v] of Object.entries(resp.headers)) { headers.set(k, Array.isArray(v) ? v.join(', ') : v); }
+ for (const [k, v] of Object.entries(resp.headers)) {
+ headers.set(k, Array.isArray(v) ? v.join(', ') : v);
+ }
const nullBodyStatus = [101, 204, 205, 304];
const body = nullBodyStatus.includes(resp.statusCode) || req.method === 'HEAD' ? null : Readable.toWeb(resp as unknown as Readable) as ReadableStream;
const rResp = new Response(body, {
diff --git a/lib/browser/api/touch-bar.ts b/lib/browser/api/touch-bar.ts
index 5ec18e2c7c..8f1c244fd8 100644
--- a/lib/browser/api/touch-bar.ts
+++ b/lib/browser/api/touch-bar.ts
@@ -323,13 +323,15 @@ class TouchBar extends EventEmitter implements Electron.TouchBar {
this.items.set(item.id, item);
item.on('change', this.changeListener);
if (item.child instanceof TouchBar) {
- item.child.orderedItems.forEach(registerItem);
+ for (const child of item.child.orderedItems) {
+ registerItem(child);
+ }
}
};
let hasOtherItemsProxy = false;
const idSet = new Set();
- items.forEach((item) => {
+ for (const item of items) {
if (!(item instanceof TouchBarItem)) {
throw new TypeError('Each item must be an instance of TouchBarItem');
}
@@ -347,7 +349,7 @@ class TouchBar extends EventEmitter implements Electron.TouchBar {
} else {
throw new Error('Cannot add a single instance of TouchBarItem multiple times in a TouchBar');
}
- });
+ }
// register in separate loop after all items are validated
for (const item of (items as TouchBarItem[])) {
diff --git a/lib/browser/guest-view-manager.ts b/lib/browser/guest-view-manager.ts
index eda3d9aff5..942163711c 100644
--- a/lib/browser/guest-view-manager.ts
+++ b/lib/browser/guest-view-manager.ts
@@ -140,9 +140,9 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
const makeProps = (eventKey: string, args: any[]) => {
const props: Record = {};
- webViewEvents[eventKey].forEach((prop, index) => {
+ for (const [index, prop] of webViewEvents[eventKey].entries()) {
props[prop] = args[index];
- });
+ }
return props;
};
diff --git a/lib/browser/parse-features-string.ts b/lib/browser/parse-features-string.ts
index a6d451ea93..4d54479c04 100644
--- a/lib/browser/parse-features-string.ts
+++ b/lib/browser/parse-features-string.ts
@@ -80,11 +80,11 @@ export function parseFeatures (features: string) {
const parsed = parseCommaSeparatedKeyValue(features);
const webPreferences: { [K in AllowedWebPreference]?: any } = {};
- allowedWebPreferences.forEach((key) => {
- if (parsed[key] === undefined) return;
+ for (const key of allowedWebPreferences) {
+ if (parsed[key] === undefined) continue;
webPreferences[key] = parsed[key];
delete parsed[key];
- });
+ }
if (parsed.left !== undefined) parsed.x = parsed.left;
if (parsed.top !== undefined) parsed.y = parsed.top;
diff --git a/script/prepare-appveyor.js b/script/prepare-appveyor.js
index a08ce66e3f..b24cd89eae 100644
--- a/script/prepare-appveyor.js
+++ b/script/prepare-appveyor.js
@@ -94,7 +94,9 @@ function useAppVeyorImage (targetBranch, options) {
assert(validJobs.includes(options.job), `Unknown AppVeyor CI job name: ${options.job}. Valid values are: ${validJobs}.`);
callAppVeyorBuildJobs(targetBranch, options.job, options);
} else {
- validJobs.forEach((job) => callAppVeyorBuildJobs(targetBranch, job, options));
+ for (const job of validJobs) {
+ callAppVeyorBuildJobs(targetBranch, job, options);
+ }
}
}
diff --git a/script/release/ci-release-build.js b/script/release/ci-release-build.js
index fce6510ab1..4d874201d6 100644
--- a/script/release/ci-release-build.js
+++ b/script/release/ci-release-build.js
@@ -193,7 +193,9 @@ function buildAppVeyor (targetBranch, options) {
assert(validJobs.includes(options.job), `Unknown AppVeyor CI job name: ${options.job}. Valid values are: ${validJobs}.`);
callAppVeyor(targetBranch, options.job, options);
} else {
- validJobs.forEach((job) => callAppVeyor(targetBranch, job, options));
+ for (const job of validJobs) {
+ callAppVeyor(targetBranch, job, options);
+ }
}
}
@@ -243,7 +245,9 @@ function buildCircleCI (targetBranch, options) {
} else {
assert(!options.arch, 'Cannot provide a single architecture while building all workflows, please specify a single workflow via --workflow');
options.runningPublishWorkflows = true;
- circleCIPublishWorkflows.forEach((job) => circleCIcall(targetBranch, job, options));
+ for (const job of circleCIPublishWorkflows) {
+ circleCIcall(targetBranch, job, options);
+ }
}
}
diff --git a/script/release/notes/notes.js b/script/release/notes/notes.js
index 9f68d9336d..282d502458 100644
--- a/script/release/notes/notes.js
+++ b/script/release/notes/notes.js
@@ -461,7 +461,7 @@ const getNotes = async (fromRef, toRef, newVersion) => {
toBranch
};
- pool.commits.forEach(commit => {
+ for (const commit of pool.commits) {
const str = commit.semanticType;
if (commit.isBreakingChange) {
notes.breaking.push(commit);
@@ -478,7 +478,7 @@ const getNotes = async (fromRef, toRef, newVersion) => {
} else {
notes.unknown.push(commit);
}
- });
+ }
return notes;
};
diff --git a/script/release/publish-to-npm.js b/script/release/publish-to-npm.js
index fda6db43f8..8f66278531 100644
--- a/script/release/publish-to-npm.js
+++ b/script/release/publish-to-npm.js
@@ -58,18 +58,18 @@ new Promise((resolve, reject) => {
.then((dirPath) => {
tempDir = dirPath;
// copy files from `/npm` to temp directory
- files.forEach((name) => {
+ for (const name of files) {
const noThirdSegment = name === 'README.md' || name === 'LICENSE';
fs.writeFileSync(
path.join(tempDir, name),
fs.readFileSync(path.join(ELECTRON_DIR, noThirdSegment ? '' : 'npm', name))
);
- });
+ }
// copy from root package.json to temp/package.json
const packageJson = require(path.join(tempDir, 'package.json'));
- jsonFields.forEach((fieldName) => {
+ for (const fieldName of jsonFields) {
packageJson[fieldName] = rootPackageJson[fieldName];
- });
+ }
packageJson.version = currentElectronVersion;
fs.writeFileSync(
path.join(tempDir, 'package.json'),
diff --git a/script/release/release.js b/script/release/release.js
index 148909e0fd..ac5ecafea7 100755
--- a/script/release/release.js
+++ b/script/release/release.js
@@ -65,9 +65,9 @@ async function validateReleaseAssets (release, validatingRelease) {
const downloadUrls = release.assets.map(asset => ({ url: asset.browser_download_url, file: asset.name })).sort((a, b) => a.file.localeCompare(b.file));
failureCount = 0;
- requiredAssets.forEach(asset => {
+ for (const asset of requiredAssets) {
check(extantAssets.includes(asset), asset);
- });
+ }
check((failureCount === 0), 'All required GitHub assets exist for release', true);
if (!validatingRelease || !release.draft) {
diff --git a/spec/api-app-spec.ts b/spec/api-app-spec.ts
index 97857464ef..f77b73b56a 100644
--- a/spec/api-app-spec.ts
+++ b/spec/api-app-spec.ts
@@ -1229,9 +1229,9 @@ describe('app module', () => {
'http://',
'https://'
];
- protocols.forEach((protocol) => {
+ for (const protocol of protocols) {
expect(app.getApplicationNameForProtocol(protocol)).to.not.equal('');
- });
+ }
});
it('returns an empty string for a bogus protocol', () => {
diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts
index 404465b5e1..4b5c752404 100644
--- a/spec/api-browser-window-spec.ts
+++ b/spec/api-browser-window-spec.ts
@@ -276,9 +276,9 @@ describe('BrowserWindow module', () => {
}
};
const windows = Array.from(Array(windowCount)).map(() => new BrowserWindow(windowOptions));
- windows.forEach(win => win.show());
- windows.forEach(win => win.focus());
- windows.forEach(win => win.destroy());
+ for (const win of windows) win.show();
+ for (const win of windows) win.focus();
+ for (const win of windows) win.destroy();
app.removeListener('browser-window-focus', focusListener);
});
});
@@ -1342,31 +1342,31 @@ describe('BrowserWindow module', () => {
const fakeSourceIds = [
'none', 'screen:0', 'window:fake', 'window:1234', 'foobar:1:2'
];
- fakeSourceIds.forEach((sourceId) => {
+ for (const sourceId of fakeSourceIds) {
expect(() => {
w.moveAbove(sourceId);
}).to.throw(/Invalid media source id/);
- });
+ }
});
it('should throw an exception if wrong type', async () => {
const fakeSourceIds = [null as any, 123 as any];
- fakeSourceIds.forEach((sourceId) => {
+ for (const sourceId of fakeSourceIds) {
expect(() => {
w.moveAbove(sourceId);
}).to.throw(/Error processing argument at index 0 */);
- });
+ }
});
it('should throw an exception if invalid window', async () => {
// It is very unlikely that these window id exist.
const fakeSourceIds = ['window:99999999:0', 'window:123456:1',
'window:123456:9'];
- fakeSourceIds.forEach((sourceId) => {
+ for (const sourceId of fakeSourceIds) {
expect(() => {
w.moveAbove(sourceId);
}).to.throw(/Invalid media source id/);
- });
+ }
});
it('should not throw an exception', async () => {
diff --git a/spec/api-context-bridge-spec.ts b/spec/api-context-bridge-spec.ts
index c3f8ab3183..4b5952c55f 100644
--- a/spec/api-context-bridge-spec.ts
+++ b/spec/api-context-bridge-spec.ts
@@ -1006,10 +1006,10 @@ describe('contextBridge', () => {
}
};
const keys: string[] = [];
- Object.entries(toExpose).forEach(([key, value]) => {
+ for (const [key, value] of Object.entries(toExpose)) {
keys.push(key);
contextBridge.exposeInMainWorld(key, value);
- });
+ }
contextBridge.exposeInMainWorld('keys', keys);
});
const result = await callWithBindings(async (root: any) => {
diff --git a/spec/api-menu-item-spec.ts b/spec/api-menu-item-spec.ts
index fc015da321..0071a3904e 100644
--- a/spec/api-menu-item-spec.ts
+++ b/spec/api-menu-item-spec.ts
@@ -136,9 +136,9 @@ describe('MenuItems', () => {
const groups = findRadioGroups(template);
- groups.forEach(g => {
+ for (const g of groups) {
expect(findChecked(menu.items, g.begin!, g.end!)).to.deep.equal([g.begin]);
- });
+ }
});
it('should assign groupId automatically', () => {
@@ -146,7 +146,7 @@ describe('MenuItems', () => {
const usedGroupIds = new Set();
const groups = findRadioGroups(template);
- groups.forEach(g => {
+ for (const g of groups) {
const groupId = (menu.items[g.begin!] as any).groupId;
// groupId should be previously unused
@@ -158,14 +158,14 @@ describe('MenuItems', () => {
for (let i = g.begin!; i < g.end!; ++i) {
expect((menu.items[i] as any).groupId).to.equal(groupId);
}
- });
+ }
});
it("setting 'checked' should flip other items' 'checked' property", () => {
const menu = Menu.buildFromTemplate(template);
const groups = findRadioGroups(template);
- groups.forEach(g => {
+ for (const g of groups) {
expect(findChecked(menu.items, g.begin!, g.end!)).to.deep.equal([]);
menu.items[g.begin!].checked = true;
@@ -173,7 +173,7 @@ describe('MenuItems', () => {
menu.items[g.end! - 1].checked = true;
expect(findChecked(menu.items, g.begin!, g.end!)).to.deep.equal([g.end! - 1]);
- });
+ }
});
});
});
diff --git a/spec/api-net-spec.ts b/spec/api-net-spec.ts
index 501dc6307a..882957db7f 100644
--- a/spec/api-net-spec.ts
+++ b/spec/api-net-spec.ts
@@ -68,7 +68,9 @@ async function respondNTimes (fn: http.RequestListener, n: number): Promise sockets.push(s));
defer(() => {
server.close();
- sockets.forEach(s => s.destroy());
+ for (const socket of sockets) {
+ socket.destroy();
+ }
});
return (await listen(server)).url;
}
@@ -771,7 +773,7 @@ describe('net module', () => {
});
});
- ['Lax', 'Strict'].forEach((mode) => {
+ for (const mode of ['Lax', 'Strict']) {
it(`should be able to use the sessions cookie store with same-site ${mode} cookies`, async () => {
const serverUrl = await respondNTimes.toSingleURL((request, response) => {
response.statusCode = 200;
@@ -812,7 +814,7 @@ describe('net module', () => {
const response2 = await getResponse(urlRequest2);
expect(response2.headers['x-cookie']).to.equal('same=site');
});
- });
+ }
it('should be able to use the sessions cookie store safely across redirects', async () => {
const serverUrl = await respondOnce.toSingleURL(async (request, response) => {
@@ -1065,7 +1067,7 @@ describe('net module', () => {
await collectStreamBody(await getResponse(urlRequest));
});
- ['navigate', 'cors', 'no-cors', 'same-origin'].forEach((mode) => {
+ for (const mode of ['navigate', 'cors', 'no-cors', 'same-origin']) {
it(`should set sec-fetch-mode to ${mode} if requested`, async () => {
const serverUrl = await respondOnce.toSingleURL((request, response) => {
expect(request.headers['sec-fetch-mode']).to.equal(mode);
@@ -1080,7 +1082,7 @@ describe('net module', () => {
urlRequest.setHeader('sec-fetch-mode', mode);
await collectStreamBody(await getResponse(urlRequest));
});
- });
+ }
it('should set sec-fetch-dest to empty by default', async () => {
const serverUrl = await respondOnce.toSingleURL((request, response) => {
@@ -1095,12 +1097,12 @@ describe('net module', () => {
await collectStreamBody(await getResponse(urlRequest));
});
- [
+ for (const dest of [
'empty', 'audio', 'audioworklet', 'document', 'embed', 'font',
'frame', 'iframe', 'image', 'manifest', 'object', 'paintworklet',
'report', 'script', 'serviceworker', 'style', 'track', 'video',
'worker', 'xslt'
- ].forEach((dest) => {
+ ]) {
it(`should set sec-fetch-dest to ${dest} if requested`, async () => {
const serverUrl = await respondOnce.toSingleURL((request, response) => {
expect(request.headers['sec-fetch-dest']).to.equal(dest);
@@ -1115,7 +1117,7 @@ describe('net module', () => {
urlRequest.setHeader('sec-fetch-dest', dest);
await collectStreamBody(await getResponse(urlRequest));
});
- });
+ }
it('should be able to abort an HTTP request before first write', async () => {
const serverUrl = await respondOnce.toSingleURL((request, response) => {
@@ -1691,11 +1693,11 @@ describe('net module', () => {
await once(urlRequest, 'close');
await new Promise((resolve, reject) => {
- ['finish', 'abort', 'close', 'error'].forEach(evName => {
+ for (const evName of ['finish', 'abort', 'close', 'error']) {
urlRequest.on(evName as any, () => {
reject(new Error(`Unexpected ${evName} event`));
});
- });
+ }
setTimeout(50).then(resolve);
});
});
@@ -1934,9 +1936,9 @@ describe('net module', () => {
const serverUrl = await respondOnce.toSingleURL((request, response) => {
response.statusCode = 200;
response.statusMessage = 'OK';
- customHeaders.forEach((headerTuple) => {
+ for (const headerTuple of customHeaders) {
response.setHeader(headerTuple[0], headerTuple[1]);
- });
+ }
response.end();
});
const urlRequest = net.request(serverUrl);
@@ -1948,15 +1950,15 @@ describe('net module', () => {
expect(rawHeaders).to.be.an('array');
let rawHeadersIdx = 0;
- customHeaders.forEach((headerTuple) => {
+ for (const headerTuple of customHeaders) {
const headerKey = headerTuple[0];
const headerValues = Array.isArray(headerTuple[1]) ? headerTuple[1] : [headerTuple[1]];
- headerValues.forEach((headerValue) => {
+ for (const headerValue of headerValues) {
expect(rawHeaders[rawHeadersIdx]).to.equal(headerKey);
expect(rawHeaders[rawHeadersIdx + 1]).to.equal(headerValue);
rawHeadersIdx += 2;
- });
- });
+ }
+ }
await collectStreamBody(response);
});
diff --git a/spec/api-subframe-spec.ts b/spec/api-subframe-spec.ts
index 1a56612695..043141a12c 100644
--- a/spec/api-subframe-spec.ts
+++ b/spec/api-subframe-spec.ts
@@ -157,7 +157,7 @@ describe('renderer nodeIntegrationInSubFrames', () => {
});
};
- generateConfigs(
+ const configs = generateConfigs(
{
preload: path.resolve(__dirname, 'fixtures/sub-frames/preload.js'),
nodeIntegrationInSubFrames: true
@@ -174,9 +174,11 @@ describe('renderer nodeIntegrationInSubFrames', () => {
name: 'webview',
webPreferences: { webviewTag: true, preload: false }
}
- ).forEach(config => {
+ );
+
+ for (const config of configs) {
generateTests(config.title, config.webPreferences);
- });
+ }
describe('internal