Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to Node.js v14.9.0 #25249

Merged
merged 41 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7ed2b3f
chore: update to Node.js v14.9.0
codebytere Sep 1, 2020
511b4f5
Update NODE_MODULE_VERSION for v14
codebytere Sep 1, 2020
73ccd86
Fixup common.gypi default values patch
codebytere Sep 1, 2020
1cec5d7
Fixup tracingAgent patch
codebytere Sep 1, 2020
b6266bb
Fixup globals require patch
codebytere Sep 1, 2020
594f6a0
Fixup fs override patch
codebytere Sep 1, 2020
4cda31e
Fixup context-aware nnm patch
codebytere Sep 1, 2020
71b546a
Remove redundant v8 Wasm patch
codebytere Sep 1, 2020
565db99
Fixup 32 bit smis patch
codebytere Sep 1, 2020
3db1f72
Remove redundant V8 patches
codebytere Sep 1, 2020
7743fb6
Remove buffer kMaxLength patch
codebytere Sep 1, 2020
2e37373
Remove redundant libuv patch
codebytere Sep 1, 2020
8feb12b
Remove redundant ESM loader patch
codebytere Sep 1, 2020
a128148
Remove redundant promise rejection callback
codebytere Sep 1, 2020
e67c007
Remove symbol instance check
codebytere Sep 1, 2020
e6b1fd2
Remove tls negotiation patch
codebytere Sep 1, 2020
36a4f37
Fix indices and filenames
codebytere Sep 1, 2020
f2103f1
Remove legacy http_parser
codebytere Sep 1, 2020
bdc8c60
Fixup crypto compat patch
codebytere Sep 1, 2020
383c5cb
Fix TracingController include
codebytere Sep 1, 2020
29d5d60
Fix -Wincompatible-pointer-types-discards-qualifiers error
codebytere Sep 1, 2020
5c1ccfd
Remove cleanup now in FreeEnvironment
codebytere Sep 2, 2020
59d9280
Allow preventing InitializeInspector in env
codebytere Sep 2, 2020
5755308
Remove duplicate uv_loadavg on Linux
codebytere Sep 2, 2020
b03a1bb
Fix -Wincompatible-pointer-types error
codebytere Sep 2, 2020
4bb17b9
Use new CreateEnvironment in ELECTRON_RUN_AS_NODE
codebytere Sep 2, 2020
a131b65
Update @types/node to v14.x
codebytere Sep 2, 2020
9deed08
Fixup n-api patch
codebytere Sep 2, 2020
e84bdea
Disable test-inspector-inspect-brk-node
codebytere Sep 2, 2020
2fbd255
Fix DiffieHellman crash
codebytere Sep 3, 2020
8f46259
Fix copy_file_range() linux timeout
codebytere Sep 3, 2020
be99743
Make pseudo-tty tests process-agnostic
codebytere Sep 3, 2020
9fa7b53
InitializeDiagnostic is handled by LoadEnvironment now
codebytere Sep 4, 2020
ac3e084
Remove invalid net specs
codebytere Sep 4, 2020
1c77bca
Fix ESM loader registration in non-browser procs
codebytere Sep 14, 2020
51a617c
Fixup patches
codebytere Sep 16, 2020
2f7058c
Correct incorrect smoke test
codebytere Sep 16, 2020
31e0f22
Fix moar types issues
codebytere Sep 16, 2020
28bc637
Fix failing net specs
codebytere Sep 16, 2020
0fea7c0
Reset type inference
codebytere Sep 17, 2020
7029f98
Add stream destroy commentary
codebytere Sep 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ vars = {
'chromium_version':
'b04584161e07d4ac110045b7647fa8a81f5f0709',
'node_version':
'v12.18.3',
'v14.9.0',
'nan_version':
'2c4ee8a32a299eada3cd6e468bbd0a473bfea96d',
'squirrel.mac_version':
Expand Down
49 changes: 24 additions & 25 deletions docs/api/remote.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,32 @@ console.log(app)

The `remote` module has the following methods:

### `remote.require(module)`
### `remote.getCurrentWindow()`

Returns [`BrowserWindow`](browser-window.md) - The window to which this web page
belongs.

**Note:** Do not use `removeAllListeners` on [`BrowserWindow`](browser-window.md).
Use of this can remove all [`blur`](https://developer.mozilla.org/en-US/docs/Web/Events/blur)
listeners, disable click events on touch bar buttons, and other unintended
consequences.

### `remote.getCurrentWebContents()`

Returns [`WebContents`](web-contents.md) - The web contents of this web page.

### `remote.getGlobal(name)`

* `name` String

Returns `any` - The global variable of `name` (e.g. `global[name]`) in the main
process.

## Properties

* `module` String
### `remote.require`

Returns `any` - The object returned by `require(module)` in the main process.
A `NodeJS.Require` function equivalent to `require(module)` in the main process.
Modules specified by their relative path will resolve relative to the entrypoint
of the main process.

Expand Down Expand Up @@ -186,28 +207,6 @@ module.exports = 'bar'
const foo = require('electron').remote.require('./foo') // bar
```

### `remote.getCurrentWindow()`

Returns [`BrowserWindow`](browser-window.md) - The window to which this web page
belongs.

**Note:** Do not use `removeAllListeners` on [`BrowserWindow`](browser-window.md).
Use of this can remove all [`blur`](https://developer.mozilla.org/en-US/docs/Web/Events/blur)
listeners, disable click events on touch bar buttons, and other unintended
consequences.

### `remote.getCurrentWebContents()`

Returns [`WebContents`](web-contents.md) - The web contents of this web page.

### `remote.getGlobal(name)`

* `name` String

Returns `any` - The global variable of `name` (e.g. `global[name]`) in the main
process.

## Properties

### `remote.process` _Readonly_

Expand Down
10 changes: 9 additions & 1 deletion lib/browser/api/net.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
codebytere marked this conversation as resolved.
Show resolved Hide resolved
this.emit('error', err);
}

this.destroy(err);
if (this._urlLoader) {
this._urlLoader.cancel();
Expand Down
3 changes: 2 additions & 1 deletion lib/browser/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
});

Expand Down
2 changes: 1 addition & 1 deletion lib/browser/remote/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
codebytere marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"dependencies": {
"@electron/get": "^1.0.1",
"@types/node": "^12.0.12",
"@types/node": "^14.6.2",
"extract-zip": "^1.0.3"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {
"@electron/docs-parser": "^0.9.1",
"@electron/typescript-definitions": "^8.7.8",
"@electron/typescript-definitions": "^8.7.9",
"@octokit/rest": "^18.0.3",
"@primer/octicons": "^10.0.0",
"@types/basic-auth": "^1.1.3",
Expand All @@ -16,7 +16,7 @@
"@types/express": "^4.17.7",
"@types/fs-extra": "^9.0.1",
"@types/mocha": "^7.0.2",
"@types/node": "^12.12.6",
"@types/node": "^14.6.2",
"@types/semver": "^7.3.3",
"@types/send": "^0.14.5",
"@types/split": "^1.0.0",
Expand Down
18 changes: 3 additions & 15 deletions patches/node/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,14 @@ chore_prevent_warn_non_context-aware_native_modules_being_loaded.patch
chore_read_nobrowserglobals_from_global_not_process.patch
build_bring_back_node_with_ltcg_configuration.patch
revert_crypto_add_oaeplabel_option.patch
refactor_transferrablemodule_is_deprecated_use_compiledwasmmodule.patch
enable_31_bit_smis_on_64bit_arch_and_ptr_compression.patch
remove_deprecated_task_api_override_removed_in_latest_v8.patch
remove_serialization_deserialization_of_wasmmoduleobject.patch
override_existing_v8_reallocate.patch
fix_use_crypto_impls_for_compat.patch
avoid_calling_deprecated_method.patch
remove_deprecated_wasm_module_type_check.patch
weakrefs_rename_finalizationgroup_to_finalizationregistry_for_js.patch
weakrefs_split_out_finalizationregistry_cleanupsome.patch
fix_window_c-ares_incompatibilities.patch
chore_sethostcleanupfinalizationgroupcallback_has_been_removed_from.patch
fix_comment_out_incompatible_crypto_modules.patch
lib_src_switch_buffer_kmaxlength_to_size_t.patch
update_tests_after_increasing_typed_array_size.patch
darwin_work_around_clock_jumping_back_in_time.patch
fix_do_not_register_the_esm_loader_in_renderer_processes.patch
fix_allow_preventing_setpromiserejectcallback.patch
lib_use_non-symbols_in_isurlinstance_check.patch
feat_add_implementation_of_v8_platform_postjob.patch
fix_enable_tls_renegotiation.patch
n-api_src_provide_asynchronous_cleanup_hooks.patch
crypto_update_certdata_to_nss_3_56.patch
fix_-wincompatible-pointer-types-discards-qualifiers_error.patch
fix_allow_preventing_initializeinspector_in_env.patch
test_make_some_tests_embedder_agnostic.patch
22 changes: 0 additions & 22 deletions patches/node/avoid_calling_deprecated_method.patch

This file was deleted.

Loading