chore: upgrade to Node.js v14.9.0 (#25249)
This commit is contained in:
parent
4d1dab849f
commit
77038b7bda
66 changed files with 724 additions and 1343 deletions
|
@ -362,7 +362,7 @@ export class ClientRequest extends Writable implements Electron.ClientRequest {
|
|||
delete this._urlLoaderOptions.extraHeaders[key];
|
||||
}
|
||||
|
||||
_write (chunk: Buffer, encoding: string, callback: () => void) {
|
||||
_write (chunk: Buffer, encoding: BufferEncoding, callback: () => void) {
|
||||
this._firstWrite = true;
|
||||
if (!this._body) {
|
||||
this._body = new SlurpStream();
|
||||
|
@ -481,6 +481,14 @@ export class ClientRequest extends Writable implements Electron.ClientRequest {
|
|||
}
|
||||
|
||||
_die (err?: Error) {
|
||||
// Node.js assumes that any stream which is ended is no longer capable of emitted events
|
||||
// which is a faulty assumption for the case of an object that is acting like a stream
|
||||
// (our urlRequest). If we don't emit here, this causes errors since we *do* expect
|
||||
// that error events can be emitted after urlRequest.end().
|
||||
if ((this as any)._writableState.destroyed && err) {
|
||||
this.emit('error', err);
|
||||
}
|
||||
|
||||
this.destroy(err);
|
||||
if (this._urlLoader) {
|
||||
this._urlLoader.cancel();
|
||||
|
|
|
@ -4,6 +4,7 @@ import * as fs from 'fs';
|
|||
import { Socket } from 'net';
|
||||
import * as path from 'path';
|
||||
import * as util from 'util';
|
||||
|
||||
const Module = require('module');
|
||||
|
||||
// We modified the original process.argv to let node.js load the init.js,
|
||||
|
@ -62,7 +63,7 @@ process.on('uncaughtException', function (error) {
|
|||
// Emit 'exit' event on quit.
|
||||
const { app } = require('electron');
|
||||
|
||||
app.on('quit', function (event, exitCode) {
|
||||
app.on('quit', (_event, exitCode) => {
|
||||
process.emit('exit', exitCode);
|
||||
});
|
||||
|
||||
|
|
|
@ -353,7 +353,7 @@ handleRemoteCommand('ELECTRON_BROWSER_REQUIRE', function (event, contextId, modu
|
|||
if (customEvent.defaultPrevented) {
|
||||
throw new Error(`Blocked remote.require('${moduleName}')`);
|
||||
} else {
|
||||
customEvent.returnValue = process.mainModule!.require(moduleName);
|
||||
customEvent.returnValue = (process as any).mainModule.require(moduleName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue