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
2
DEPS
2
DEPS
|
@ -16,7 +16,7 @@ vars = {
|
|||
'chromium_version':
|
||||
'b04584161e07d4ac110045b7647fa8a81f5f0709',
|
||||
'node_version':
|
||||
'v12.18.3',
|
||||
'v14.9.0',
|
||||
'nan_version':
|
||||
'2c4ee8a32a299eada3cd6e468bbd0a473bfea96d',
|
||||
'squirrel.mac_version':
|
||||
|
|
|
@ -150,11 +150,32 @@ console.log(app)
|
|||
|
||||
The `remote` module has the following methods:
|
||||
|
||||
### `remote.require(module)`
|
||||
### `remote.getCurrentWindow()`
|
||||
|
||||
* `module` String
|
||||
Returns [`BrowserWindow`](browser-window.md) - The window to which this web page
|
||||
belongs.
|
||||
|
||||
Returns `any` - The object returned by `require(module)` in the main process.
|
||||
**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.require`
|
||||
|
||||
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.
|
||||
|
||||
|
@ -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_
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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",
|
||||
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <samuel.r.attard@gmail.com>
|
||||
Date: Thu, 13 Feb 2020 10:34:31 -0800
|
||||
Subject: Avoid calling deprecated method
|
||||
|
||||
The {SetExpectInlineWasm} method is deprecated and non-functional since
|
||||
V8 v8.1.
|
||||
|
||||
This is already present in Node.js v14 and can be removed when we upgrade.
|
||||
|
||||
diff --git a/src/node_serdes.cc b/src/node_serdes.cc
|
||||
index bcdcd19b261e8815e3c0c0f150f2eda72ef47cf5..86fb822dd5bfa9da7767418e6c6f206f8e96ca73 100644
|
||||
--- a/src/node_serdes.cc
|
||||
+++ b/src/node_serdes.cc
|
||||
@@ -286,7 +286,6 @@ DeserializerContext::DeserializerContext(Environment* env,
|
||||
length_(Buffer::Length(buffer)),
|
||||
deserializer_(env->isolate(), data_, length_, this) {
|
||||
object()->Set(env->context(), env->buffer_string(), buffer).Check();
|
||||
- deserializer_.SetExpectInlineWasm(true);
|
||||
|
||||
MakeWeak();
|
||||
}
|
|
@ -7,10 +7,10 @@ This adds GN build files for Node, so we don't have to build with GYP.
|
|||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..99192976f2bdfd900240aa58b8989fe2c9d8c771
|
||||
index 0000000000000000000000000000000000000000..446119163d1f7bad577cb0b7b217ecf24b994526
|
||||
--- /dev/null
|
||||
+++ b/BUILD.gn
|
||||
@@ -0,0 +1,361 @@
|
||||
@@ -0,0 +1,360 @@
|
||||
+import("//electron/build/asar.gni")
|
||||
+import("//v8/gni/v8.gni")
|
||||
+
|
||||
|
@ -205,7 +205,6 @@ index 0000000000000000000000000000000000000000..99192976f2bdfd900240aa58b8989fe2
|
|||
+ ":node_js2c",
|
||||
+ "deps/cares",
|
||||
+ "deps/histogram",
|
||||
+ "deps/http_parser",
|
||||
+ "deps/llhttp",
|
||||
+ "deps/nghttp2",
|
||||
+ "deps/uvwasi",
|
||||
|
@ -532,25 +531,6 @@ index 0000000000000000000000000000000000000000..e741a2a9c238a782a674ddcb9a1f98de
|
|||
+ "src/hdr_histogram.h",
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/deps/http_parser/BUILD.gn b/deps/http_parser/BUILD.gn
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..da9e2b42dccacc1ed9b00202c1ff73ebc60d0e8a
|
||||
--- /dev/null
|
||||
+++ b/deps/http_parser/BUILD.gn
|
||||
@@ -0,0 +1,13 @@
|
||||
+config("http_parser_config") {
|
||||
+ defines = [ "HTTP_PARSER_STRICT=0" ]
|
||||
+ include_dirs = [ "." ]
|
||||
+}
|
||||
+
|
||||
+static_library("http_parser") {
|
||||
+ include_dirs = [ "." ]
|
||||
+ public_configs = [ ":http_parser_config" ]
|
||||
+ cflags_c = [ "-Wno-string-conversion" ]
|
||||
+ sources = [
|
||||
+ "http_parser.c",
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/deps/llhttp/BUILD.gn b/deps/llhttp/BUILD.gn
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ce15bc57093caa1bd84ea77e7438e892fb916427
|
||||
|
@ -625,7 +605,7 @@ index 0000000000000000000000000000000000000000..66af819990b338caa49ca59d1fe6c5ad
|
|||
+}
|
||||
diff --git a/deps/uv/BUILD.gn b/deps/uv/BUILD.gn
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..67116f2070bb9200aace81afdf0b1e7a6e4fd0c0
|
||||
index 0000000000000000000000000000000000000000..565819942513be6b7e9d7ad21c8531ad51a8d557
|
||||
--- /dev/null
|
||||
+++ b/deps/uv/BUILD.gn
|
||||
@@ -0,0 +1,191 @@
|
||||
|
@ -664,6 +644,7 @@ index 0000000000000000000000000000000000000000..67116f2070bb9200aace81afdf0b1e7a
|
|||
+ defines += [ "BUILDING_UV_SHARED=1" ]
|
||||
+
|
||||
+ cflags_c = [
|
||||
+ "-Wno-incompatible-pointer-types",
|
||||
+ "-Wno-bitwise-op-parentheses",
|
||||
+ "-Wno-implicit-function-declaration",
|
||||
+ "-Wno-missing-braces",
|
||||
|
@ -806,7 +787,6 @@ index 0000000000000000000000000000000000000000..67116f2070bb9200aace81afdf0b1e7a
|
|||
+ "src/unix/procfs-exepath.c",
|
||||
+ "src/unix/random-getrandom.c",
|
||||
+ "src/unix/random-sysctl-linux.c",
|
||||
+ "src/unix/sysinfo-loadavg.c",
|
||||
+ ]
|
||||
+ libs += [
|
||||
+ "dl",
|
||||
|
@ -866,10 +846,10 @@ index 0000000000000000000000000000000000000000..2c9d2826c85bdd033f1df1d6188df636
|
|||
+}
|
||||
diff --git a/filenames.json b/filenames.json
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a56f4d6751
|
||||
index 0000000000000000000000000000000000000000..b09510a6048f6cff3905240e3c969f143a382047
|
||||
--- /dev/null
|
||||
+++ b/filenames.json
|
||||
@@ -0,0 +1,519 @@
|
||||
@@ -0,0 +1,527 @@
|
||||
+// This file is automatically generated by generate_gn_filenames_json.py
|
||||
+// DO NOT EDIT
|
||||
+{
|
||||
|
@ -892,6 +872,7 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "//v8/include/cppgc/allocation.h",
|
||||
+ "//v8/include/cppgc/common.h",
|
||||
+ "//v8/include/cppgc/custom-space.h",
|
||||
+ "//v8/include/cppgc/default-platform.h",
|
||||
+ "//v8/include/cppgc/garbage-collected.h",
|
||||
+ "//v8/include/cppgc/heap.h",
|
||||
+ "//v8/include/cppgc/liveness-broker.h",
|
||||
|
@ -929,6 +910,7 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "//v8/include/v8-cppgc.h",
|
||||
+ "//v8/include/v8-fast-api-calls.h",
|
||||
+ "//v8/include/v8-internal.h",
|
||||
+ "//v8/include/v8-metrics.h",
|
||||
+ "//v8/include/v8-platform.h",
|
||||
+ "//v8/include/v8-profiler.h",
|
||||
+ "//v8/include/v8-util.h",
|
||||
|
@ -1001,6 +983,7 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "lib/domain.js",
|
||||
+ "lib/events.js",
|
||||
+ "lib/fs.js",
|
||||
+ "lib/fs/promises.js",
|
||||
+ "lib/http.js",
|
||||
+ "lib/http2.js",
|
||||
+ "lib/_http_agent.js",
|
||||
|
@ -1045,6 +1028,7 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "lib/zlib.js",
|
||||
+ "lib/internal/assert.js",
|
||||
+ "lib/internal/assert/assertion_error.js",
|
||||
+ "lib/internal/assert/calltracker.js",
|
||||
+ "lib/internal/async_hooks.js",
|
||||
+ "lib/internal/buffer.js",
|
||||
+ "lib/internal/cli_table.js",
|
||||
|
@ -1076,7 +1060,8 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "lib/internal/dtrace.js",
|
||||
+ "lib/internal/encoding.js",
|
||||
+ "lib/internal/errors.js",
|
||||
+ "lib/internal/error-serdes.js",
|
||||
+ "lib/internal/error_serdes.js",
|
||||
+ "lib/internal/event_target.js",
|
||||
+ "lib/internal/fixed_queue.js",
|
||||
+ "lib/internal/freelist.js",
|
||||
+ "lib/internal/freeze_intrinsics.js",
|
||||
|
@ -1151,6 +1136,7 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "lib/internal/url.js",
|
||||
+ "lib/internal/util.js",
|
||||
+ "lib/internal/util/comparisons.js",
|
||||
+ "lib/internal/util/compositekey.js",
|
||||
+ "lib/internal/util/debuglog.js",
|
||||
+ "lib/internal/util/inspect.js",
|
||||
+ "lib/internal/util/inspector.js",
|
||||
|
@ -1165,6 +1151,7 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "lib/internal/vm/module.js",
|
||||
+ "lib/internal/worker.js",
|
||||
+ "lib/internal/worker/io.js",
|
||||
+ "lib/internal/worker/js_transferable.js",
|
||||
+ "lib/internal/watchdog.js",
|
||||
+ "lib/internal/streams/lazy_transform.js",
|
||||
+ "lib/internal/streams/async_iterator.js",
|
||||
|
@ -1223,6 +1210,7 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "src/js_native_api_v8_internals.h",
|
||||
+ "src/js_stream.cc",
|
||||
+ "src/json_utils.cc",
|
||||
+ "src/js_udp_wrap.cc",
|
||||
+ "src/module_wrap.cc",
|
||||
+ "src/node.cc",
|
||||
+ "src/node_api.cc",
|
||||
|
@ -1236,8 +1224,7 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "src/node_env_var.cc",
|
||||
+ "src/node_errors.cc",
|
||||
+ "src/node_file.cc",
|
||||
+ "src/node_http_parser_llhttp.cc",
|
||||
+ "src/node_http_parser_traditional.cc",
|
||||
+ "src/node_http_parser.cc",
|
||||
+ "src/node_http2.cc",
|
||||
+ "src/node_i18n.cc",
|
||||
+ "src/node_main_instance.cc",
|
||||
|
@ -1272,7 +1259,6 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "src/node_zlib.cc",
|
||||
+ "src/pipe_wrap.cc",
|
||||
+ "src/process_wrap.cc",
|
||||
+ "src/sharedarraybuffer_metadata.cc",
|
||||
+ "src/signal_wrap.cc",
|
||||
+ "src/spawn_sync.cc",
|
||||
+ "src/stream_base.cc",
|
||||
|
@ -1292,6 +1278,10 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "src/util.cc",
|
||||
+ "src/uv.cc",
|
||||
+ "src/aliased_buffer.h",
|
||||
+ "src/aliased_struct.h",
|
||||
+ "src/aliased_struct-inl.h",
|
||||
+ "src/allocated_buffer.h",
|
||||
+ "src/allocated_buffer-inl.h",
|
||||
+ "src/async_wrap.h",
|
||||
+ "src/async_wrap-inl.h",
|
||||
+ "src/base_object.h",
|
||||
|
@ -1308,7 +1298,6 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "src/handle_wrap.h",
|
||||
+ "src/histogram.h",
|
||||
+ "src/histogram-inl.h",
|
||||
+ "src/http_parser_adaptor.h",
|
||||
+ "src/js_stream.h",
|
||||
+ "src/json_utils.h",
|
||||
+ "src/large_pages/node_large_page.cc",
|
||||
|
@ -1328,7 +1317,8 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "src/node_errors.h",
|
||||
+ "src/node_file.h",
|
||||
+ "src/node_file-inl.h",
|
||||
+ "src/node_http_parser_impl.h",
|
||||
+ "src/node_http_common.h",
|
||||
+ "src/node_http_common-inl.h",
|
||||
+ "src/node_http2.h",
|
||||
+ "src/node_http2_state.h",
|
||||
+ "src/node_i18n.h",
|
||||
|
@ -1364,7 +1354,6 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "src/pipe_wrap.h",
|
||||
+ "src/req_wrap.h",
|
||||
+ "src/req_wrap-inl.h",
|
||||
+ "src/sharedarraybuffer_metadata.h",
|
||||
+ "src/spawn_sync.h",
|
||||
+ "src/stream_base.h",
|
||||
+ "src/stream_base-inl.h",
|
||||
|
@ -1385,8 +1374,7 @@ index 0000000000000000000000000000000000000000..2e07ea28437ee25ddaea4d730e1a65a5
|
|||
+ "src/udp_wrap.h",
|
||||
+ "src/util.h",
|
||||
+ "src/util-inl.h",
|
||||
+ "deps/http_parser/http_parser.h",
|
||||
+ "deps/v8/include/v8.h"
|
||||
+ "//v8/include/v8.h"
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/src/inspector/BUILD.gn b/src/inspector/BUILD.gn
|
||||
|
@ -1595,7 +1583,7 @@ index 0000000000000000000000000000000000000000..f3c5c798c0aefcb8cf9b1570a7b4817c
|
|||
+ args = rebase_path(inputs + outputs, root_build_dir)
|
||||
+}
|
||||
diff --git a/src/node_version.h b/src/node_version.h
|
||||
index 9252d51555f0e1bf0957bc4f8bc6e399c1ac6c23..431dd57a7dddc7476a179a5f30ce9e66814006ec 100644
|
||||
index 49e4e9d16f8732641248fd3ab15be1a74d9fd45f..35f90fcae715c5421c672a9397a8e25d93f80cd6 100644
|
||||
--- a/src/node_version.h
|
||||
+++ b/src/node_version.h
|
||||
@@ -89,7 +89,10 @@
|
||||
|
@ -1604,7 +1592,7 @@ index 9252d51555f0e1bf0957bc4f8bc6e399c1ac6c23..431dd57a7dddc7476a179a5f30ce9e66
|
|||
*/
|
||||
+// Electron sets NODE_MODULE_VERSION in their GN configuration
|
||||
+#ifndef NODE_MODULE_VERSION
|
||||
#define NODE_MODULE_VERSION 72
|
||||
#define NODE_MODULE_VERSION 83
|
||||
+#endif
|
||||
|
||||
// The NAPI_VERSION provided by this version of the runtime. This is the version
|
||||
|
|
|
@ -10,7 +10,7 @@ THe fix for this should land in node-gyp as discussed in above issue,
|
|||
landing this as temporary patch.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index df69aecc74ef66b9501d4bed0e1311e7cda2d5b8..dfcf529cd501dc890c05425fcf9a33414a45f1a5 100644
|
||||
index 2fda2d685edc6b8f45441cda017f7cabfe60d91f..bd42d6cfa6006630d316faf2cddd93bea57102ba 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -19,7 +19,7 @@
|
||||
|
@ -22,7 +22,7 @@ index df69aecc74ef66b9501d4bed0e1311e7cda2d5b8..dfcf529cd501dc890c05425fcf9a3341
|
|||
'node_shared_openssl%': 'false',
|
||||
|
||||
'node_tag%': '',
|
||||
@@ -239,6 +239,26 @@
|
||||
@@ -215,6 +215,26 @@
|
||||
'cflags': [ '-fPIC' ],
|
||||
'ldflags': [ '-fPIC' ]
|
||||
}],
|
||||
|
|
|
@ -14,7 +14,7 @@ renderer/browser/worker/sandboxed bootstrap scripts). These are loaded
|
|||
through LoadEmbedderJavaScriptSource()
|
||||
|
||||
diff --git a/src/node_native_module.cc b/src/node_native_module.cc
|
||||
index 7362207412efa49bddfab4e32a64c7e07cf29074..acd9afa62d3aa1b01ce54f189a7261e7e61aa60d 100644
|
||||
index 74729c412674be2cbf01d68be1bc496b06b8ce1e..7311f249fbb24e0612d9f4f174e96fa13ed77acb 100644
|
||||
--- a/src/node_native_module.cc
|
||||
+++ b/src/node_native_module.cc
|
||||
@@ -20,6 +20,7 @@ NativeModuleLoader NativeModuleLoader::instance_;
|
||||
|
@ -26,7 +26,7 @@ index 7362207412efa49bddfab4e32a64c7e07cf29074..acd9afa62d3aa1b01ce54f189a7261e7
|
|||
|
||||
NativeModuleLoader* NativeModuleLoader::GetInstance() {
|
||||
diff --git a/src/node_native_module.h b/src/node_native_module.h
|
||||
index c0bce3bce42c848d63a10147ef483c9d4465f5ce..7f296e459d46b4cda51baf9887df060f0372227d 100644
|
||||
index 3be3f2364dd252bcdd668c699a0e7ae1e754e873..b2af1bce312ffca44e7005e11f92327e7cb240f6 100644
|
||||
--- a/src/node_native_module.h
|
||||
+++ b/src/node_native_module.h
|
||||
@@ -44,6 +44,7 @@ class NativeModuleLoader {
|
||||
|
|
|
@ -6,10 +6,10 @@ Subject: Call process.log from fallback stream on Windows
|
|||
(cherry picked from commit d31e629b4f2daf3500a485caab2b2990a41e3ad4)
|
||||
|
||||
diff --git a/lib/internal/bootstrap/switches/is_main_thread.js b/lib/internal/bootstrap/switches/is_main_thread.js
|
||||
index ac8336fb6229e7f44eb00f43abb07bea83a9463c..2005e8ef9ebd090c1be19ff320f48b9cd365239e 100644
|
||||
index 08623898edafacfa8cee47ab35bd75887f9d3e2a..828589d4047ac49d16e9080ad1f364484941aa6e 100644
|
||||
--- a/lib/internal/bootstrap/switches/is_main_thread.js
|
||||
+++ b/lib/internal/bootstrap/switches/is_main_thread.js
|
||||
@@ -80,6 +80,11 @@ function createWritableStdioStream(fd) {
|
||||
@@ -85,6 +85,11 @@ function createWritableStdioStream(fd) {
|
||||
const { Writable } = require('stream');
|
||||
stream = new Writable({
|
||||
write(buf, enc, cb) {
|
||||
|
|
|
@ -8,25 +8,31 @@ once we stop warning and begin to unilaterally prevent non-context aware modules
|
|||
from being loaded.
|
||||
|
||||
diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
|
||||
index 0a7c4a47c11eb4bb360b6a46fccb4692241bd2dc..b4a0f71af5853f427a10449b52509052fbe3facd 100644
|
||||
index f947c6bf27e80c534a8f72265d0139a8b5b3f13a..d7e56d9c3fe5a56897989915984cb823d27b9c52 100644
|
||||
--- a/lib/internal/bootstrap/pre_execution.js
|
||||
+++ b/lib/internal/bootstrap/pre_execution.js
|
||||
@@ -89,8 +89,10 @@ function patchProcessObject(expandArgv1) {
|
||||
@@ -92,10 +92,12 @@ function patchProcessObject(expandArgv1) {
|
||||
|
||||
if (expandArgv1 && process.argv[1] && !process.argv[1].startsWith('-')) {
|
||||
// Expand process.argv[1] into a full path.
|
||||
- const path = require('path');
|
||||
- try {
|
||||
- process.argv[1] = path.resolve(process.argv[1]);
|
||||
- } catch {}
|
||||
+ if (!process.argv[1] || !process.argv[1].startsWith('electron/js2c')) {
|
||||
const path = require('path');
|
||||
process.argv[1] = path.resolve(process.argv[1]);
|
||||
+ const path = require('path');
|
||||
+ try {
|
||||
+ process.argv[1] = path.resolve(process.argv[1]);
|
||||
+ } catch {}
|
||||
+ }
|
||||
}
|
||||
|
||||
// TODO(joyeecheung): most of these should be deprecated and removed,
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index 7d08fb05e9a0abeb82d416891968b23002dc3685..1f6f5e0cee36fb2a07963264f513a930c349b8fa 100644
|
||||
index c633daa2b3557c98b05cca5f428d87775ef8a02a..4846370adb5206c53d57deef303b2c3f02342d24 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -1111,6 +1111,13 @@ Module.prototype._compile = function(content, filename) {
|
||||
@@ -1049,6 +1049,13 @@ Module.prototype._compile = function(content, filename) {
|
||||
if (getOptionValue('--inspect-brk') && process._eval == null) {
|
||||
if (!resolvedArgv) {
|
||||
// We enter the repl if we're not given a filename argument.
|
||||
|
@ -41,11 +47,11 @@ index 7d08fb05e9a0abeb82d416891968b23002dc3685..1f6f5e0cee36fb2a07963264f513a930
|
|||
try {
|
||||
resolvedArgv = Module._resolveFilename(process.argv[1], null, false);
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index d22b579b25ce4e6af8ec042e282e94248ea14162..67cefbe35f390ba25b49e422d10bca8b423a49a8 100644
|
||||
index bc222804010a035333cf6d7becc9a0a8f385af85..dea62b38cb20a0a0913128e17e8904c4ca71ac1a 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -890,6 +890,15 @@ class Environment : public MemoryRetainer {
|
||||
uint64_t thread_id = kNoThreadId);
|
||||
@@ -885,6 +885,15 @@ class Environment : public MemoryRetainer {
|
||||
ThreadId thread_id);
|
||||
~Environment() override;
|
||||
|
||||
+ void ForceOnlyContextAwareNativeModules() {
|
||||
|
@ -57,10 +63,10 @@ index d22b579b25ce4e6af8ec042e282e94248ea14162..67cefbe35f390ba25b49e422d10bca8b
|
|||
+ bool force_context_aware() { return force_context_aware_; }
|
||||
+ bool warn_non_context_aware() { return warn_non_context_aware_; }
|
||||
+
|
||||
void InitializeLibuv(bool start_profiler_idle_notifier);
|
||||
void InitializeLibuv();
|
||||
inline const std::vector<std::string>& exec_argv();
|
||||
inline const std::vector<std::string>& argv();
|
||||
@@ -1271,6 +1280,9 @@ class Environment : public MemoryRetainer {
|
||||
@@ -1235,6 +1244,9 @@ class Environment : public MemoryRetainer {
|
||||
inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
|
||||
const char* errmsg);
|
||||
|
||||
|
@ -71,7 +77,7 @@ index d22b579b25ce4e6af8ec042e282e94248ea14162..67cefbe35f390ba25b49e422d10bca8b
|
|||
v8::Isolate* const isolate_;
|
||||
IsolateData* const isolate_data_;
|
||||
diff --git a/src/node_binding.cc b/src/node_binding.cc
|
||||
index 5291858bb164a262ca1d69d2582e037aeab23d55..a9ce41fbba4e8b0c4704c1d7795308ce18916739 100644
|
||||
index 0ab18f7aeda3511338cbf115a4b636a6c72437b2..51ae4c89a61a176a9629e537f9409b38c3397aa2 100644
|
||||
--- a/src/node_binding.cc
|
||||
+++ b/src/node_binding.cc
|
||||
@@ -3,6 +3,7 @@
|
||||
|
|
|
@ -7,7 +7,7 @@ This is used so that we can modify the flag at runtime where
|
|||
config can only be set at compile time.
|
||||
|
||||
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
|
||||
index 4e7c3c10255a0eae4d5333f88e51cf7178163a44..a6e33757ca00771671583203c37d9b121abf489b 100644
|
||||
index e1f70addc28e4fe31d3a7089ecec3b5874dde75a..659145e31bbfb6ce782e8dcad452b59202df7573 100644
|
||||
--- a/lib/internal/bootstrap/node.js
|
||||
+++ b/lib/internal/bootstrap/node.js
|
||||
@@ -118,7 +118,7 @@ const {
|
||||
|
|
|
@ -1,145 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <samuel.r.attard@gmail.com>
|
||||
Date: Mon, 4 May 2020 16:57:05 -0700
|
||||
Subject: chore: SetHostCleanupFinalizationGroupCallback has been removed from
|
||||
V8
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index e2aa9c821de685a022fd78935399b7d219468403..2bfba8a011c2b902932e6b1714bbb55b945cd96d 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -12,7 +12,6 @@ using errors::TryCatchScope;
|
||||
using v8::Array;
|
||||
using v8::Context;
|
||||
using v8::EscapableHandleScope;
|
||||
-using v8::FinalizationGroup;
|
||||
using v8::Function;
|
||||
using v8::FunctionCallbackInfo;
|
||||
using v8::HandleScope;
|
||||
@@ -72,15 +71,6 @@ static MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context,
|
||||
return result;
|
||||
}
|
||||
|
||||
-static void HostCleanupFinalizationGroupCallback(
|
||||
- Local<Context> context, Local<FinalizationGroup> group) {
|
||||
- Environment* env = Environment::GetCurrent(context);
|
||||
- if (env == nullptr) {
|
||||
- return;
|
||||
- }
|
||||
- env->RegisterFinalizationGroupForCleanup(group);
|
||||
-}
|
||||
-
|
||||
void* NodeArrayBufferAllocator::Allocate(size_t size) {
|
||||
void* ret;
|
||||
if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers)
|
||||
@@ -249,11 +239,6 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
||||
s.promise_reject_callback : task_queue::PromiseRejectCallback;
|
||||
isolate->SetPromiseRejectCallback(promise_reject_cb);
|
||||
|
||||
- auto* host_cleanup_cb = s.host_cleanup_finalization_group_callback ?
|
||||
- s.host_cleanup_finalization_group_callback :
|
||||
- HostCleanupFinalizationGroupCallback;
|
||||
- isolate->SetHostCleanupFinalizationGroupCallback(host_cleanup_cb);
|
||||
-
|
||||
if (s.flags & DETAILED_SOURCE_POSITIONS_FOR_PROFILING)
|
||||
v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate);
|
||||
}
|
||||
diff --git a/src/env-inl.h b/src/env-inl.h
|
||||
index c6ef9dc13ab6f1d1a778871a62a0a98a01d84ec6..222555831aa1bf0b7b29b4b46e235c98a5dd4ac5 100644
|
||||
--- a/src/env-inl.h
|
||||
+++ b/src/env-inl.h
|
||||
@@ -1123,12 +1123,6 @@ void Environment::RemoveCleanupHook(void (*fn)(void*), void* arg) {
|
||||
cleanup_hooks_.erase(search);
|
||||
}
|
||||
|
||||
-inline void Environment::RegisterFinalizationGroupForCleanup(
|
||||
- v8::Local<v8::FinalizationGroup> group) {
|
||||
- cleanup_finalization_groups_.emplace_back(isolate(), group);
|
||||
- uv_async_send(&task_queues_async_);
|
||||
-}
|
||||
-
|
||||
size_t CleanupHookCallback::Hash::operator()(
|
||||
const CleanupHookCallback& cb) const {
|
||||
return std::hash<void*>()(cb.arg_);
|
||||
diff --git a/src/env.cc b/src/env.cc
|
||||
index 18788e4ceaf208c13704c9c43f017bb1b6dfb0b6..ee76d5889e5672716ac2f0c586f1ddc47fa56be7 100644
|
||||
--- a/src/env.cc
|
||||
+++ b/src/env.cc
|
||||
@@ -30,7 +30,6 @@ using v8::ArrayBuffer;
|
||||
using v8::Boolean;
|
||||
using v8::Context;
|
||||
using v8::EmbedderGraph;
|
||||
-using v8::FinalizationGroup;
|
||||
using v8::Function;
|
||||
using v8::FunctionTemplate;
|
||||
using v8::HandleScope;
|
||||
@@ -487,7 +486,6 @@ void Environment::InitializeLibuv(bool start_profiler_idle_notifier) {
|
||||
[](uv_async_t* async) {
|
||||
Environment* env = ContainerOf(
|
||||
&Environment::task_queues_async_, async);
|
||||
- env->CleanupFinalizationGroups();
|
||||
env->RunAndClearNativeImmediates();
|
||||
});
|
||||
uv_unref(reinterpret_cast<uv_handle_t*>(&idle_prepare_handle_));
|
||||
@@ -1085,25 +1083,6 @@ void Environment::RunWeakRefCleanup() {
|
||||
isolate()->ClearKeptObjects();
|
||||
}
|
||||
|
||||
-void Environment::CleanupFinalizationGroups() {
|
||||
- HandleScope handle_scope(isolate());
|
||||
- Context::Scope context_scope(context());
|
||||
- TryCatchScope try_catch(this);
|
||||
-
|
||||
- while (!cleanup_finalization_groups_.empty() && can_call_into_js()) {
|
||||
- Local<FinalizationGroup> fg =
|
||||
- cleanup_finalization_groups_.front().Get(isolate());
|
||||
- cleanup_finalization_groups_.pop_front();
|
||||
- if (!FinalizationGroup::Cleanup(fg).FromMaybe(false)) {
|
||||
- if (try_catch.HasCaught() && !try_catch.HasTerminated())
|
||||
- errors::TriggerUncaughtException(isolate(), try_catch);
|
||||
- // Re-schedule the execution of the remainder of the queue.
|
||||
- uv_async_send(&task_queues_async_);
|
||||
- return;
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
-
|
||||
// Not really any better place than env.cc at this moment.
|
||||
void BaseObject::DeleteMe(void* data) {
|
||||
BaseObject* self = static_cast<BaseObject*>(data);
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index 67cefbe35f390ba25b49e422d10bca8b423a49a8..9420bdf3f71e2df1011ddd7e583071f5c99beac8 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -1130,9 +1130,7 @@ class Environment : public MemoryRetainer {
|
||||
void AtExit(void (*cb)(void* arg), void* arg);
|
||||
void RunAtExitCallbacks();
|
||||
|
||||
- void RegisterFinalizationGroupForCleanup(v8::Local<v8::FinalizationGroup> fg);
|
||||
void RunWeakRefCleanup();
|
||||
- void CleanupFinalizationGroups();
|
||||
|
||||
// Strings and private symbols are shared across shared contexts
|
||||
// The getters simply proxy to the per-isolate primitive.
|
||||
@@ -1355,8 +1353,6 @@ class Environment : public MemoryRetainer {
|
||||
uint64_t thread_id_;
|
||||
std::unordered_set<worker::Worker*> sub_worker_contexts_;
|
||||
|
||||
- std::deque<v8::Global<v8::FinalizationGroup>> cleanup_finalization_groups_;
|
||||
-
|
||||
static void* const kNodeContextTagPtr;
|
||||
static int const kNodeContextTag;
|
||||
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 638a1a85b046ce4db303d532f7cf36cca2271db5..b9b11b4331bd3ae4a87f65758ee09af25222e19a 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -322,8 +322,6 @@ struct IsolateSettings {
|
||||
v8::PromiseRejectCallback promise_reject_callback = nullptr;
|
||||
v8::AllowWasmCodeGenerationCallback
|
||||
allow_wasm_code_generation_callback = nullptr;
|
||||
- v8::HostCleanupFinalizationGroupCallback
|
||||
- host_cleanup_finalization_group_callback = nullptr;
|
||||
};
|
||||
|
||||
// Overriding IsolateSettings may produce unexpected behavior
|
|
@ -1,64 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Noordhuis <info@bnoordhuis.nl>
|
||||
Date: Wed, 1 Jul 2020 10:32:57 +0200
|
||||
Subject: darwin: work around clock jumping back in time
|
||||
|
||||
It was reported that mach_absolute_time() can jump backward in time when
|
||||
the machine is suspended. Use mach_continuous_time() when available to
|
||||
work around that (macOS 10.12 and up.)
|
||||
|
||||
Fixes: https://github.com/libuv/libuv/issues/2891
|
||||
PR-URL: https://github.com/libuv/libuv/pull/2894
|
||||
Reviewed-By: Phil Willoughby <philwill@fb.com>
|
||||
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
|
||||
|
||||
diff --git a/deps/uv/src/unix/darwin.c b/deps/uv/src/unix/darwin.c
|
||||
index 654aba26b1f9249e3e76b48ae1ad674d9fd12718..4f53ad1fc7f1907281013ca5dc4b251c692d3a7b 100644
|
||||
--- a/deps/uv/src/unix/darwin.c
|
||||
+++ b/deps/uv/src/unix/darwin.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
+#include <dlfcn.h>
|
||||
#include <mach/mach.h>
|
||||
#include <mach/mach_time.h>
|
||||
#include <mach-o/dyld.h> /* _NSGetExecutablePath */
|
||||
@@ -32,6 +33,10 @@
|
||||
#include <sys/sysctl.h>
|
||||
#include <unistd.h> /* sysconf */
|
||||
|
||||
+static uv_once_t once = UV_ONCE_INIT;
|
||||
+static uint64_t (*time_func)(void);
|
||||
+static mach_timebase_info_data_t timebase;
|
||||
+
|
||||
|
||||
int uv__platform_loop_init(uv_loop_t* loop) {
|
||||
loop->cf_state = NULL;
|
||||
@@ -48,15 +53,19 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
|
||||
}
|
||||
|
||||
|
||||
-uint64_t uv__hrtime(uv_clocktype_t type) {
|
||||
- static mach_timebase_info_data_t info;
|
||||
-
|
||||
- if ((ACCESS_ONCE(uint32_t, info.numer) == 0 ||
|
||||
- ACCESS_ONCE(uint32_t, info.denom) == 0) &&
|
||||
- mach_timebase_info(&info) != KERN_SUCCESS)
|
||||
+static void uv__hrtime_init_once(void) {
|
||||
+ if (KERN_SUCCESS != mach_timebase_info(&timebase))
|
||||
abort();
|
||||
|
||||
- return mach_absolute_time() * info.numer / info.denom;
|
||||
+ time_func = (uint64_t (*)(void)) dlsym(RTLD_DEFAULT, "mach_continuous_time");
|
||||
+ if (time_func == NULL)
|
||||
+ time_func = mach_absolute_time;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+uint64_t uv__hrtime(uv_clocktype_t type) {
|
||||
+ uv_once(&once, uv__hrtime_init_once);
|
||||
+ return time_func() * timebase.numer / timebase.denom;
|
||||
}
|
||||
|
||||
|
|
@ -8,22 +8,21 @@ node modules will have different (wrong) ideas about how v8 structs are laid
|
|||
out in memory on 64-bit machines, and will summarily fail to work.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index dfcf529cd501dc890c05425fcf9a33414a45f1a5..38e7b2802f6225ac0e1ff4789b9ff8f4fb04cb79 100644
|
||||
index bd42d6cfa6006630d316faf2cddd93bea57102ba..734c2917535c50e260192abe6acb4726104b7b6a 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -71,6 +71,9 @@
|
||||
# TODO(refack): make v8-perfetto happen
|
||||
'v8_use_perfetto': 0,
|
||||
@@ -64,7 +64,7 @@
|
||||
# options but default values are required here as this file is also used by
|
||||
# node-gyp to build addons.
|
||||
'v8_enable_pointer_compression%': 0,
|
||||
- 'v8_enable_31bit_smis_on_64bit_arch%': 0,
|
||||
+ 'v8_enable_31bit_smis_on_64bit_arch%': 1,
|
||||
|
||||
+ 'v8_enable_pointer_compression%': 0,
|
||||
+ 'v8_enable_31bit_smis_on_64bit_arch': 1,
|
||||
+
|
||||
##### end V8 defaults #####
|
||||
|
||||
# When building native modules using 'npm install' with the system npm,
|
||||
@@ -148,6 +151,9 @@
|
||||
['OS=="mac"', {
|
||||
'clang%': 1,
|
||||
# Disable V8 untrusted code mitigations.
|
||||
# See https://github.com/v8/v8/wiki/Untrusted-code-mitigations
|
||||
@@ -124,6 +124,9 @@
|
||||
'obj_dir%': '<(PRODUCT_DIR)/obj.target',
|
||||
'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a',
|
||||
}],
|
||||
+ ['target_arch == "arm64" or target_arch == "x64"', {
|
||||
+ 'v8_enable_pointer_compression': 1,
|
||||
|
@ -31,16 +30,3 @@ index dfcf529cd501dc890c05425fcf9a33414a45f1a5..38e7b2802f6225ac0e1ff4789b9ff8f4
|
|||
['target_arch in "ppc64 s390x"', {
|
||||
'v8_enable_backtrace': 1,
|
||||
}],
|
||||
@@ -378,6 +384,12 @@
|
||||
}],
|
||||
],
|
||||
}],
|
||||
+ ['v8_enable_pointer_compression == 1', {
|
||||
+ 'defines': ['V8_COMPRESS_POINTERS'],
|
||||
+ }],
|
||||
+ ['v8_enable_pointer_compression == 1 or v8_enable_31bit_smis_on_64bit_arch == 1', {
|
||||
+ 'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH'],
|
||||
+ }],
|
||||
['OS == "win"', {
|
||||
'defines': [
|
||||
'WIN32',
|
||||
|
|
|
@ -9,10 +9,10 @@ modules to sandboxed renderers.
|
|||
TODO(codebytere): remove and replace with a public facing API.
|
||||
|
||||
diff --git a/src/node_binding.cc b/src/node_binding.cc
|
||||
index 0b5f6cfa038369be758e3b0857ee6fa594358b58..5291858bb164a262ca1d69d2582e037aeab23d55 100644
|
||||
index 1072ed34667262d7ef729c3235766f056acd659c..0ab18f7aeda3511338cbf115a4b636a6c72437b2 100644
|
||||
--- a/src/node_binding.cc
|
||||
+++ b/src/node_binding.cc
|
||||
@@ -605,6 +605,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -608,6 +608,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
|
||||
args.GetReturnValue().Set(exports);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ Environment on the V8 context of blink, so no new V8 context is created.
|
|||
As a result, a renderer process may have multiple Node Environments in it.
|
||||
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index 728785d5d2773df68a891a4c81e7b0ebfa6021bb..15abe45edb39597d4fcc686cca4d79314090fa6f 100644
|
||||
index 0dc7040381889541d9b5257158c2564ef0e728a2..cda0220071196fb7eced326985002bf0588aa23f 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -122,6 +122,8 @@ using v8::Undefined;
|
||||
@@ -134,6 +134,8 @@ using v8::Undefined;
|
||||
using v8::V8;
|
||||
using v8::Value;
|
||||
|
||||
|
@ -36,7 +36,7 @@ index 728785d5d2773df68a891a4c81e7b0ebfa6021bb..15abe45edb39597d4fcc686cca4d7931
|
|||
namespace per_process {
|
||||
|
||||
// node_revert.h
|
||||
@@ -736,7 +738,9 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
@@ -836,7 +838,9 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
binding::RegisterBuiltinModules();
|
||||
|
||||
// Make inherited handles noninheritable.
|
||||
|
@ -47,7 +47,7 @@ index 728785d5d2773df68a891a4c81e7b0ebfa6021bb..15abe45edb39597d4fcc686cca4d7931
|
|||
|
||||
// Cache the original command line to be
|
||||
// used in diagnostic reports.
|
||||
@@ -770,6 +774,8 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
@@ -870,6 +874,8 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
if (exit_code != 0) return exit_code;
|
||||
}
|
||||
#endif
|
||||
|
@ -56,7 +56,7 @@ index 728785d5d2773df68a891a4c81e7b0ebfa6021bb..15abe45edb39597d4fcc686cca4d7931
|
|||
|
||||
const int exit_code = ProcessGlobalArgs(argv,
|
||||
exec_argv,
|
||||
@@ -814,6 +820,7 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
@@ -914,6 +920,7 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
}
|
||||
per_process::metadata.versions.InitializeIntlVersions();
|
||||
#endif
|
||||
|
@ -65,10 +65,10 @@ index 728785d5d2773df68a891a4c81e7b0ebfa6021bb..15abe45edb39597d4fcc686cca4d7931
|
|||
NativeModuleEnv::InitializeCodeCache();
|
||||
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 886216e2cb533e7337bc4f6816e2de796f64f81e..8378553f28671e4685b4ed20279b2be5d202e527 100644
|
||||
index 1914e72ee8fa4361379725b8d44892c8a62084e1..d051b422d7c5a51a8590abda382676d3f661b532 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -211,6 +211,8 @@ namespace node {
|
||||
@@ -218,6 +218,8 @@ namespace node {
|
||||
|
||||
class IsolateData;
|
||||
class Environment;
|
||||
|
|
|
@ -9,10 +9,10 @@ Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2315981
|
|||
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2304812
|
||||
|
||||
diff --git a/src/node_platform.cc b/src/node_platform.cc
|
||||
index 5b878f886a13204a3a53f1e57ab2434d68fc9d21..a0ea118861867277d8f5f15625227d49505d1c6a 100644
|
||||
index 4bb9b919f60a91225ddb531e5e5e8acb1bc6a5b5..802c49cf027735302a8c5c504635a1f15e647c78 100644
|
||||
--- a/src/node_platform.cc
|
||||
+++ b/src/node_platform.cc
|
||||
@@ -500,6 +500,10 @@ Platform::StackTracePrinter NodePlatform::GetStackTracePrinter() {
|
||||
@@ -541,6 +541,10 @@ Platform::StackTracePrinter NodePlatform::GetStackTracePrinter() {
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -24,10 +24,10 @@ index 5b878f886a13204a3a53f1e57ab2434d68fc9d21..a0ea118861867277d8f5f15625227d49
|
|||
TaskQueue<T>::TaskQueue()
|
||||
: lock_(), tasks_available_(), tasks_drained_(),
|
||||
diff --git a/src/node_platform.h b/src/node_platform.h
|
||||
index 3c855afeb4019adfb5389721357abe3cd620a01c..1e14daa711ba62f9619ca83a8655482b11cef41d 100644
|
||||
index dc512ddf08facf1ebb0d8c9e7677d349d0d2c87c..a274be6bbea19a4488bca393712a9ac8b50fe16a 100644
|
||||
--- a/src/node_platform.h
|
||||
+++ b/src/node_platform.h
|
||||
@@ -158,6 +158,7 @@ class NodePlatform : public MultiIsolatePlatform {
|
||||
@@ -162,6 +162,7 @@ class NodePlatform : public MultiIsolatePlatform {
|
||||
void UnregisterIsolate(v8::Isolate* isolate) override;
|
||||
void AddIsolateFinishedCallback(v8::Isolate* isolate,
|
||||
void (*callback)(void*), void* data) override;
|
||||
|
|
|
@ -6,10 +6,10 @@ Subject: feat: add uv_loop watcher_queue code
|
|||
Electron's Node Integration works by listening to Node's backend file descriptor in a separate thread; when an event is ready the backend file descriptor will trigger a new event for it, and the main thread will then iterate the libuv loop. For certain operations (ex. adding a timeout task) the backend file descriptor isn't informed, & as a result the main thread doesn't know it needs to iterate the libuv loop so the timeout task will never execute until something else trigger a new event. This commit should be removed when https://github.com/libuv/libuv/pull/1921 is merged
|
||||
|
||||
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
|
||||
index fec663136a4ff14480cc8edcf846cba320ddd4eb..653c8910d7350185d1db4d343e19236a899b3a04 100644
|
||||
index 06b6d001040e0422c672bbed0722343a852a7907..3c2b2eb68c3ea4e81833a376204cd955183f649b 100644
|
||||
--- a/deps/uv/include/uv.h
|
||||
+++ b/deps/uv/include/uv.h
|
||||
@@ -1770,6 +1770,8 @@ union uv_any_req {
|
||||
@@ -1773,6 +1773,8 @@ union uv_any_req {
|
||||
struct uv_loop_s {
|
||||
/* User data - use this for whatever. */
|
||||
void* data;
|
||||
|
@ -19,10 +19,10 @@ index fec663136a4ff14480cc8edcf846cba320ddd4eb..653c8910d7350185d1db4d343e19236a
|
|||
unsigned int active_handles;
|
||||
void* handle_queue[2];
|
||||
diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c
|
||||
index 949eefae339919c36775d6c1bbca5f6f9b3b6201..454bd1bd3c2c7be34b764be39962b35e4e3066f6 100644
|
||||
index 1597828c868b383439f7442a3f22eee5d6ac539d..a0fbc07a21c66cc91b7b342640e5bc4ba579fd78 100644
|
||||
--- a/deps/uv/src/unix/core.c
|
||||
+++ b/deps/uv/src/unix/core.c
|
||||
@@ -885,8 +885,11 @@ void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
||||
@@ -897,8 +897,11 @@ void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
@ -35,7 +35,7 @@ index 949eefae339919c36775d6c1bbca5f6f9b3b6201..454bd1bd3c2c7be34b764be39962b35e
|
|||
|
||||
if (loop->watchers[w->fd] == NULL) {
|
||||
loop->watchers[w->fd] = w;
|
||||
@@ -922,8 +925,11 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
||||
@@ -934,8 +937,11 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
||||
w->events = 0;
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ index 949eefae339919c36775d6c1bbca5f6f9b3b6201..454bd1bd3c2c7be34b764be39962b35e
|
|||
}
|
||||
|
||||
|
||||
@@ -940,6 +946,8 @@ void uv__io_close(uv_loop_t* loop, uv__io_t* w) {
|
||||
@@ -952,6 +958,8 @@ void uv__io_close(uv_loop_t* loop, uv__io_t* w) {
|
||||
void uv__io_feed(uv_loop_t* loop, uv__io_t* w) {
|
||||
if (QUEUE_EMPTY(&w->pending_queue))
|
||||
QUEUE_INSERT_TAIL(&loop->pending_queue, &w->pending_queue);
|
||||
|
|
|
@ -6,10 +6,10 @@ Subject: feat: initialize asar support
|
|||
This patch initializes asar support in Node.js.
|
||||
|
||||
diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
|
||||
index 3d5e0061daa8d11a1c8c535eb0ae7179864a2d02..0a7c4a47c11eb4bb360b6a46fccb4692241bd2dc 100644
|
||||
index dfbefa955cab8adcafc5f46151ac83ed893645e0..f947c6bf27e80c534a8f72265d0139a8b5b3f13a 100644
|
||||
--- a/lib/internal/bootstrap/pre_execution.js
|
||||
+++ b/lib/internal/bootstrap/pre_execution.js
|
||||
@@ -70,6 +70,7 @@ function prepareMainThreadExecution(expandArgv1 = false) {
|
||||
@@ -73,6 +73,7 @@ function prepareMainThreadExecution(expandArgv1 = false) {
|
||||
assert(!CJSLoader.hasLoadedAnyUserCJSModule);
|
||||
loadPreloadModules();
|
||||
initializeFrozenIntrinsics();
|
||||
|
@ -17,7 +17,7 @@ index 3d5e0061daa8d11a1c8c535eb0ae7179864a2d02..0a7c4a47c11eb4bb360b6a46fccb4692
|
|||
}
|
||||
|
||||
function patchProcessObject(expandArgv1) {
|
||||
@@ -440,6 +441,10 @@ function loadPreloadModules() {
|
||||
@@ -447,6 +448,10 @@ function loadPreloadModules() {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Tue, 1 Sep 2020 10:17:37 -0700
|
||||
Subject: fix: -Wincompatible-pointer-types-discards-qualifiers error
|
||||
|
||||
Fixes an 'assigment to 'char *' from 'const char *'' error in libuv.
|
||||
|
||||
This will be upstreamed.
|
||||
|
||||
diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c
|
||||
index 8a801749d472b041fa4472a84e8499cf02b29fc4..99b30f579763e068d907dd17c21ce22265b6bf6f 100644
|
||||
--- a/deps/uv/src/win/fs.c
|
||||
+++ b/deps/uv/src/win/fs.c
|
||||
@@ -1242,8 +1242,8 @@ void fs__mktemp(uv_fs_t* req, uv__fs_mktemp_func func) {
|
||||
size_t len;
|
||||
uint64_t v;
|
||||
char* path;
|
||||
-
|
||||
- path = req->path;
|
||||
+
|
||||
+ path = (char*) req->path;
|
||||
len = wcslen(req->file.pathw);
|
||||
ep = req->file.pathw + len;
|
||||
if (len < num_x || wcsncmp(ep - num_x, L"XXXXXX", num_x)) {
|
|
@ -8,10 +8,10 @@ common.gypi is a file that's included in the node header bundle, despite
|
|||
the fact that we do not build node with gyp.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index cebf2121ff913080ab0771f6c4dfa35ce6812bc0..df69aecc74ef66b9501d4bed0e1311e7cda2d5b8 100644
|
||||
index 0025a6782f36a2643416bf015fff66503216e403..2fda2d685edc6b8f45441cda017f7cabfe60d91f 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -73,6 +73,22 @@
|
||||
@@ -81,6 +81,22 @@
|
||||
|
||||
##### end V8 defaults #####
|
||||
|
||||
|
@ -32,5 +32,5 @@ index cebf2121ff913080ab0771f6c4dfa35ce6812bc0..df69aecc74ef66b9501d4bed0e1311e7
|
|||
+ 'enable_lto%': 'false',
|
||||
+
|
||||
'conditions': [
|
||||
['target_arch=="arm64"', {
|
||||
# Disabled pending https://github.com/nodejs/node/issues/23913.
|
||||
['OS == "win"', {
|
||||
'os_posix': 0,
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Tue, 1 Sep 2020 19:30:08 -0700
|
||||
Subject: fix: allow preventing InitializeInspector in env
|
||||
|
||||
https://github.com/nodejs/node/commit/8c5ad1392f30cfe6b107e9bd85f4cb918ba04aab
|
||||
made it such that env->InitializeInspector was called in CreateEnvironment
|
||||
no matter what, which creates an issue for embedders seeking to manage
|
||||
the InspectorAgent themselves as Electron does. This adds a new
|
||||
EnvironmentFlags option which allows preventing that invocation.
|
||||
|
||||
This will be upstreamed.
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index ac6b47e0f327ca0ffe28e97f747c72ebaa5d7005..97610a12be47cdbf0d39d61e5982bab09ff09e95 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -358,12 +358,14 @@ Environment* CreateEnvironment(
|
||||
thread_id);
|
||||
|
||||
#if HAVE_INSPECTOR
|
||||
- if (inspector_parent_handle) {
|
||||
- env->InitializeInspector(
|
||||
- std::move(static_cast<InspectorParentHandleImpl*>(
|
||||
- inspector_parent_handle.get())->impl));
|
||||
- } else {
|
||||
- env->InitializeInspector({});
|
||||
+ if (!env->should_not_initialize_inspector()) {
|
||||
+ if (inspector_parent_handle) {
|
||||
+ env->InitializeInspector(
|
||||
+ std::move(static_cast<InspectorParentHandleImpl*>(
|
||||
+ inspector_parent_handle.get())->impl));
|
||||
+ } else {
|
||||
+ env->InitializeInspector({});
|
||||
+ }
|
||||
}
|
||||
#endif
|
||||
|
||||
diff --git a/src/env-inl.h b/src/env-inl.h
|
||||
index ddae5766127119f727f52212d5147d29eb72ebc0..a4f48dd1f7e5f765858dbce4a080a775c0d6a124 100644
|
||||
--- a/src/env-inl.h
|
||||
+++ b/src/env-inl.h
|
||||
@@ -817,6 +817,10 @@ inline bool Environment::owns_inspector() const {
|
||||
return flags_ & EnvironmentFlags::kOwnsInspector;
|
||||
}
|
||||
|
||||
+inline bool Environment::should_not_initialize_inspector() const {
|
||||
+ return flags_ & EnvironmentFlags::kNoInitializeInspector;
|
||||
+}
|
||||
+
|
||||
inline bool Environment::tracks_unmanaged_fds() const {
|
||||
return flags_ & EnvironmentFlags::kTrackUnmanagedFds;
|
||||
}
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index dea62b38cb20a0a0913128e17e8904c4ca71ac1a..18305853a4f0da3382f827e38f3b120d807a67c6 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -1023,6 +1023,7 @@ class Environment : public MemoryRetainer {
|
||||
|
||||
inline bool is_main_thread() const;
|
||||
inline bool should_not_register_esm_loader() const;
|
||||
+ inline bool should_not_initialize_inspector() const;
|
||||
inline bool owns_process_state() const;
|
||||
inline bool owns_inspector() const;
|
||||
inline bool tracks_unmanaged_fds() const;
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 80acb3f9f04ef8e6c363cf31384af4037abeeb87..6b657f6941b8f96da08b6397e01e19a2763edf8f 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -424,7 +424,11 @@ enum Flags : uint64_t {
|
||||
kNoRegisterESMLoader = 1 << 3,
|
||||
// Set this flag to make Node.js track "raw" file descriptors, i.e. managed
|
||||
// by fs.open() and fs.close(), and close them during FreeEnvironment().
|
||||
- kTrackUnmanagedFds = 1 << 4
|
||||
+ kTrackUnmanagedFds = 1 << 4,
|
||||
+ // This flag should be set to prevent InspectorAgent initialization from
|
||||
+ // within the environment. This is used by embedders who wish to manage the
|
||||
+ // InspectorAgent themselves.
|
||||
+ kNoInitializeInspector = 1 << 5
|
||||
};
|
||||
} // namespace EnvironmentFlags
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 15 Jul 2020 18:43:32 -0700
|
||||
Subject: fix: allow preventing SetPromiseRejectCallback
|
||||
|
||||
We do not want to use the promise rejection callback that Node.js uses,
|
||||
because it does not send PromiseRejectionEvents to the global script context.
|
||||
We need to use the one Blink already provides, and so we need to
|
||||
slightly augment IsolateSettings to allow for that.
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index 2bfba8a011c2b902932e6b1714bbb55b945cd96d..28851b8a8f8bdd6dec0f54c62f79fd75a3be08ed 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -235,9 +235,11 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
||||
s.allow_wasm_code_generation_callback : AllowWasmCodeGenerationCallback;
|
||||
isolate->SetAllowWasmCodeGenerationCallback(allow_wasm_codegen_cb);
|
||||
|
||||
- auto* promise_reject_cb = s.promise_reject_callback ?
|
||||
- s.promise_reject_callback : task_queue::PromiseRejectCallback;
|
||||
- isolate->SetPromiseRejectCallback(promise_reject_cb);
|
||||
+ if (s.flags & SHOULD_SET_PROMISE_REJECTION_CALLBACK) {
|
||||
+ auto* promise_reject_cb = s.promise_reject_callback ?
|
||||
+ s.promise_reject_callback : task_queue::PromiseRejectCallback;
|
||||
+ isolate->SetPromiseRejectCallback(promise_reject_cb);
|
||||
+ }
|
||||
|
||||
if (s.flags & DETAILED_SOURCE_POSITIONS_FOR_PROFILING)
|
||||
v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate);
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index b9b11b4331bd3ae4a87f65758ee09af25222e19a..60ecc3bd3499c23b297bc11e7f052aede20520c2 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -304,12 +304,14 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
|
||||
|
||||
enum IsolateSettingsFlags {
|
||||
MESSAGE_LISTENER_WITH_ERROR_LEVEL = 1 << 0,
|
||||
- DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1
|
||||
+ DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1,
|
||||
+ SHOULD_SET_PROMISE_REJECTION_CALLBACK = 1 << 2
|
||||
};
|
||||
|
||||
struct IsolateSettings {
|
||||
uint64_t flags = MESSAGE_LISTENER_WITH_ERROR_LEVEL |
|
||||
- DETAILED_SOURCE_POSITIONS_FOR_PROFILING;
|
||||
+ DETAILED_SOURCE_POSITIONS_FOR_PROFILING |
|
||||
+ SHOULD_SET_PROMISE_REJECTION_CALLBACK;
|
||||
v8::MicrotasksPolicy policy = v8::MicrotasksPolicy::kExplicit;
|
||||
|
||||
// Error handling callbacks
|
|
@ -6,10 +6,10 @@ Subject: fix: build and expose inspector agent
|
|||
Node inspector initialization happens in a different start-up function in node.cc, which we don't call in Electron. This allows for us to use the inspector agent in electron/atom/browser/node_debugger.cc
|
||||
|
||||
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
|
||||
index 7712a62d7cbeb0975f00877be36b55da150f1459..1e990059198de3fedc912bfbd5eb6eae8e5c3eea 100644
|
||||
index e6ab76abf56168041108972d54d741af988342b4..7de9d75e49a08625bbd37f5bfcee3f88c5fa978d 100644
|
||||
--- a/src/inspector_agent.cc
|
||||
+++ b/src/inspector_agent.cc
|
||||
@@ -220,7 +220,7 @@ const int CONTEXT_GROUP_ID = 1;
|
||||
@@ -203,7 +203,7 @@ const int CONTEXT_GROUP_ID = 1;
|
||||
|
||||
std::string GetWorkerLabel(node::Environment* env) {
|
||||
std::ostringstream result;
|
||||
|
@ -18,7 +18,7 @@ index 7712a62d7cbeb0975f00877be36b55da150f1459..1e990059198de3fedc912bfbd5eb6eae
|
|||
return result.str();
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ class NodeInspectorClient : public V8InspectorClient {
|
||||
@@ -458,7 +458,7 @@ class NodeInspectorClient : public V8InspectorClient {
|
||||
client_ = V8Inspector::create(env->isolate(), this);
|
||||
// TODO(bnoordhuis) Make name configurable from src/node.cc.
|
||||
std::string name =
|
||||
|
@ -28,7 +28,7 @@ index 7712a62d7cbeb0975f00877be36b55da150f1459..1e990059198de3fedc912bfbd5eb6eae
|
|||
info.is_default = true;
|
||||
contextCreated(env->context(), info);
|
||||
diff --git a/src/inspector_agent.h b/src/inspector_agent.h
|
||||
index 089077370db049a7e6d00ff2bf4d6b61cbc427d9..5594f4ba637c5c890a8226d9face18815c41a97b 100644
|
||||
index efd090c49b4311bcf3d8b717d6e5c65553849aed..a508ddd43ce613441eae759cd6110b6cc15819e4 100644
|
||||
--- a/src/inspector_agent.h
|
||||
+++ b/src/inspector_agent.h
|
||||
@@ -6,7 +6,9 @@
|
||||
|
@ -51,10 +51,10 @@ index 089077370db049a7e6d00ff2bf4d6b61cbc427d9..5594f4ba637c5c890a8226d9face1881
|
|||
explicit Agent(node::Environment* env);
|
||||
~Agent();
|
||||
diff --git a/src/inspector_io.cc b/src/inspector_io.cc
|
||||
index 75290317d2fcae8585ac8d91f49add5fdd0d79c0..8af7427c463e98705dc7a6a4c86341faec3620b2 100644
|
||||
index d3bd1911214f83fbf841a91bf01072d4c12fe870..01b92d5b6b17015eb6037978b36ab20b7d2ad651 100644
|
||||
--- a/src/inspector_io.cc
|
||||
+++ b/src/inspector_io.cc
|
||||
@@ -13,6 +13,8 @@
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "util-inl.h"
|
||||
#include "zlib.h"
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ with what's exposed through BoringSSL. I plan to upstream parts of this or
|
|||
otherwise introduce shims to reduce friction.
|
||||
|
||||
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
|
||||
index c373533ce85241f86d64eab8a49af79f935acdeb..454fff5ada0c271db7fb975f809c84d87773dcd6 100644
|
||||
index c87b00ad87cf133ed30227b8dfd3b8e8d02e9963..0e8a63c38b23ede2003d8dabc1f72161726b53a6 100644
|
||||
--- a/src/node_crypto.cc
|
||||
+++ b/src/node_crypto.cc
|
||||
@@ -5145,6 +5145,7 @@ bool DiffieHellman::Init(int primeLength, int g) {
|
||||
@@ -5187,6 +5187,7 @@ bool DiffieHellman::Init(int primeLength, int g) {
|
||||
|
||||
bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
dh_.reset(DH_new());
|
||||
|
@ -20,7 +20,7 @@ index c373533ce85241f86d64eab8a49af79f935acdeb..454fff5ada0c271db7fb975f809c84d8
|
|||
if (p_len <= 0) {
|
||||
BNerr(BN_F_BN_GENERATE_PRIME_EX, BN_R_BITS_TOO_SMALL);
|
||||
return false;
|
||||
@@ -5153,6 +5154,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
@@ -5195,6 +5196,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR);
|
||||
return false;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ index c373533ce85241f86d64eab8a49af79f935acdeb..454fff5ada0c271db7fb975f809c84d8
|
|||
BIGNUM* bn_p =
|
||||
BN_bin2bn(reinterpret_cast<const unsigned char*>(p), p_len, nullptr);
|
||||
BIGNUM* bn_g = BN_new();
|
||||
@@ -5168,6 +5170,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
@@ -5210,6 +5212,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
|
||||
bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
|
||||
dh_.reset(DH_new());
|
||||
|
@ -36,7 +36,7 @@ index c373533ce85241f86d64eab8a49af79f935acdeb..454fff5ada0c271db7fb975f809c84d8
|
|||
if (p_len <= 0) {
|
||||
BNerr(BN_F_BN_GENERATE_PRIME_EX, BN_R_BITS_TOO_SMALL);
|
||||
return false;
|
||||
@@ -5190,6 +5193,7 @@ bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
|
||||
@@ -5232,6 +5235,7 @@ bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
|
||||
BN_free(bn_g);
|
||||
return false;
|
||||
}
|
||||
|
@ -44,7 +44,18 @@ index c373533ce85241f86d64eab8a49af79f935acdeb..454fff5ada0c271db7fb975f809c84d8
|
|||
return VerifyContext();
|
||||
}
|
||||
|
||||
@@ -6157,6 +6161,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
@@ -5714,8 +5718,9 @@ void ECDH::SetPrivateKey(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
if (!EC_KEY_set_public_key(new_key.get(), pub.get()))
|
||||
return env->ThrowError("Failed to set generated public key");
|
||||
-
|
||||
+#if 0
|
||||
EC_KEY_copy(ecdh->key_.get(), new_key.get());
|
||||
+#endif
|
||||
ecdh->group_ = EC_KEY_get0_group(ecdh->key_.get());
|
||||
}
|
||||
|
||||
@@ -6203,6 +6208,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
EVPKeyCtxPointer Setup() override {
|
||||
EVPKeyPointer params;
|
||||
if (prime_info_.fixed_value_) {
|
||||
|
@ -52,7 +63,7 @@ index c373533ce85241f86d64eab8a49af79f935acdeb..454fff5ada0c271db7fb975f809c84d8
|
|||
DHPointer dh(DH_new());
|
||||
if (!dh)
|
||||
return nullptr;
|
||||
@@ -6173,6 +6178,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
@@ -6219,6 +6225,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
params = EVPKeyPointer(EVP_PKEY_new());
|
||||
CHECK(params);
|
||||
EVP_PKEY_assign_DH(params.get(), dh.release());
|
||||
|
@ -60,7 +71,7 @@ index c373533ce85241f86d64eab8a49af79f935acdeb..454fff5ada0c271db7fb975f809c84d8
|
|||
} else {
|
||||
EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DH, nullptr));
|
||||
if (!param_ctx)
|
||||
@@ -6180,7 +6186,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
@@ -6226,7 +6233,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
|
||||
if (EVP_PKEY_paramgen_init(param_ctx.get()) <= 0)
|
||||
return nullptr;
|
||||
|
@ -69,7 +80,7 @@ index c373533ce85241f86d64eab8a49af79f935acdeb..454fff5ada0c271db7fb975f809c84d8
|
|||
if (EVP_PKEY_CTX_set_dh_paramgen_prime_len(param_ctx.get(),
|
||||
prime_info_.prime_size_) <= 0)
|
||||
return nullptr;
|
||||
@@ -6188,7 +6194,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
@@ -6234,7 +6241,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
if (EVP_PKEY_CTX_set_dh_paramgen_generator(param_ctx.get(),
|
||||
generator_) <= 0)
|
||||
return nullptr;
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <samuel.r.attard@gmail.com>
|
||||
Date: Thu, 25 Jun 2020 09:29:04 -0700
|
||||
Subject: fix: do not register the ESM loader in renderer processes
|
||||
|
||||
Only one ESM loader can be registered per isolate, in renderer processes this should be blink. This patches node so that it won't register it's handler (overriding blinks) in non-browser processes.
|
||||
|
||||
This has been upstreamed in:
|
||||
* https://github.com/nodejs/node/pull/34060
|
||||
* https://github.com/nodejs/node/pull/34127
|
||||
|
||||
We can't easily rebase on that accepted solution here but we can as soon as we upgrade to
|
||||
Node.js v14, since we need to leverage the new version of node::CreateEnvironment
|
||||
introduced in https://github.com/nodejs/node/pull/30467.
|
||||
|
||||
diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
|
||||
index b4a0f71af5853f427a10449b52509052fbe3facd..ba5b0b6e51bcddbc5b9dd9c31231585d61b131a0 100644
|
||||
--- a/lib/internal/bootstrap/pre_execution.js
|
||||
+++ b/lib/internal/bootstrap/pre_execution.js
|
||||
@@ -411,6 +411,9 @@ function initializeESMLoader() {
|
||||
// Create this WeakMap in js-land because V8 has no C++ API for WeakMap.
|
||||
internalBinding('module_wrap').callbackMap = new SafeWeakMap();
|
||||
|
||||
+ // Do not hook the ESM loader in renderer processes as it overrides blinks loader
|
||||
+ if (typeof process.type === 'string' && process.type !== 'browser') return;
|
||||
+
|
||||
const {
|
||||
setImportModuleDynamicallyCallback,
|
||||
setInitializeImportMetaObjectCallback
|
|
@ -1,27 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Rose <nornagon@nornagon.net>
|
||||
Date: Tue, 18 Aug 2020 09:51:46 -0700
|
||||
Subject: fix: enable TLS renegotiation
|
||||
|
||||
This configures BoringSSL to behave more similarly to OpenSSL.
|
||||
See https://github.com/electron/electron/issues/18380.
|
||||
|
||||
This should be upstreamed.
|
||||
|
||||
diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc
|
||||
index bb09ee99e070172a3764119cf85f3eef4d79df87..95bbc4c6a62ccf19a9d94a6afa4f2ce277c9bd4c 100644
|
||||
--- a/src/tls_wrap.cc
|
||||
+++ b/src/tls_wrap.cc
|
||||
@@ -128,6 +128,12 @@ void TLSWrap::InitSSL() {
|
||||
// - https://wiki.openssl.org/index.php/TLS1.3#Non-application_data_records
|
||||
SSL_set_mode(ssl_.get(), SSL_MODE_AUTO_RETRY);
|
||||
|
||||
+#ifdef OPENSSL_IS_BORINGSSL
|
||||
+ // OpenSSL allows renegotiation by default, but BoringSSL disables it.
|
||||
+ // Configure BoringSSL to match OpenSSL's behavior.
|
||||
+ SSL_set_renegotiate_mode(ssl_.get(), ssl_renegotiate_freely);
|
||||
+#endif
|
||||
+
|
||||
SSL_set_app_data(ssl_.get(), this);
|
||||
// Using InfoCallback isn't how we are supposed to check handshake progress:
|
||||
// https://github.com/openssl/openssl/issues/7199#issuecomment-420915993
|
|
@ -6,10 +6,10 @@ Subject: fix: expose InternalCallbackScope
|
|||
This commit exposes InternalCallbackScope in order to allow us access to its internal flags.
|
||||
|
||||
diff --git a/src/node_internals.h b/src/node_internals.h
|
||||
index c1555b312e2f22e191d91d34a348d2e163d85b5b..084ecfa73657d1958d7552baa896e170934639c8 100644
|
||||
index dffaa084db409b833a869a851521e290e6789396..54e24d41e25293d3535cd853eb5a80a7b0fee122 100644
|
||||
--- a/src/node_internals.h
|
||||
+++ b/src/node_internals.h
|
||||
@@ -209,7 +209,7 @@ v8::MaybeLocal<v8::Value> InternalMakeCallback(
|
||||
@@ -204,7 +204,7 @@ v8::MaybeLocal<v8::Value> InternalMakeCallback(
|
||||
v8::Local<v8::Value> argv[],
|
||||
async_context asyncContext);
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@ Subject: fix: expose tracing::Agent and use tracing::TracingController instead
|
|||
of v8::TracingController
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index 5526859e551c10b31e9999d1f8ba89a94db9abfc..e2aa9c821de685a022fd78935399b7d219468403 100644
|
||||
index ea2be2c5c0bad66fbc70124c72aa6fa36de6ea60..ac6b47e0f327ca0ffe28e97f747c72ebaa5d7005 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -352,6 +352,10 @@ MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() {
|
||||
return per_process::v8_platform.Platform();
|
||||
@@ -472,6 +472,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) {
|
||||
return env->platform();
|
||||
}
|
||||
|
||||
+node::tracing::Agent* CreateAgent() {
|
||||
|
@ -20,10 +20,10 @@ index 5526859e551c10b31e9999d1f8ba89a94db9abfc..e2aa9c821de685a022fd78935399b7d2
|
|||
int thread_pool_size,
|
||||
node::tracing::TracingController* tracing_controller) {
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 8378553f28671e4685b4ed20279b2be5d202e527..638a1a85b046ce4db303d532f7cf36cca2271db5 100644
|
||||
index d051b422d7c5a51a8590abda382676d3f661b532..80acb3f9f04ef8e6c363cf31384af4037abeeb87 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -116,6 +116,7 @@ namespace node {
|
||||
@@ -123,6 +123,7 @@ namespace node {
|
||||
|
||||
namespace tracing {
|
||||
|
||||
|
@ -31,12 +31,12 @@ index 8378553f28671e4685b4ed20279b2be5d202e527..638a1a85b046ce4db303d532f7cf36cc
|
|||
class TracingController;
|
||||
|
||||
}
|
||||
@@ -386,6 +387,8 @@ NODE_EXTERN Environment* GetCurrentEnvironment(v8::Local<v8::Context> context);
|
||||
// it returns nullptr.
|
||||
NODE_EXTERN MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform();
|
||||
@@ -510,6 +511,8 @@ NODE_DEPRECATED("Use GetMultiIsolatePlatform(env) instead",
|
||||
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env);
|
||||
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env);
|
||||
|
||||
+NODE_EXTERN node::tracing::Agent* CreateAgent();
|
||||
+
|
||||
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
|
||||
int thread_pool_size,
|
||||
node::tracing::TracingController* tracing_controller);
|
||||
// Legacy variants of MultiIsolatePlatform::Create().
|
||||
NODE_DEPRECATED("Use variant taking a v8::TracingController* pointer instead",
|
||||
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
|
||||
|
|
|
@ -6,10 +6,10 @@ Subject: fix: key gen APIs are not available in BoringSSL
|
|||
This will make Node's key pair generation APIs fail.
|
||||
|
||||
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
|
||||
index c132e6a089b3cb7119910131fe740574d7917b89..82afaee6e2b929faac76fc5d930a8c0fd6558df3 100644
|
||||
index 05da3af09c63dcec2a4b20a4ffd8cb73c2c96982..fc780a4387c9a838a80b063276043f6087ce8259 100644
|
||||
--- a/src/node_crypto.cc
|
||||
+++ b/src/node_crypto.cc
|
||||
@@ -267,24 +267,14 @@ Maybe<bool> Decorate(Environment* env, Local<Object> obj,
|
||||
@@ -288,24 +288,14 @@ Maybe<bool> Decorate(Environment* env, Local<Object> obj,
|
||||
V(BIO) \
|
||||
V(PKCS7) \
|
||||
V(X509V3) \
|
||||
|
@ -34,7 +34,7 @@ index c132e6a089b3cb7119910131fe740574d7917b89..82afaee6e2b929faac76fc5d930a8c0f
|
|||
V(USER) \
|
||||
|
||||
#define V(name) case ERR_LIB_##name: lib = #name "_"; break;
|
||||
@@ -6085,6 +6075,7 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
@@ -6131,6 +6121,7 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
if (EVP_PKEY_paramgen_init(param_ctx.get()) <= 0)
|
||||
return nullptr;
|
||||
|
||||
|
@ -42,7 +42,7 @@ index c132e6a089b3cb7119910131fe740574d7917b89..82afaee6e2b929faac76fc5d930a8c0f
|
|||
if (EVP_PKEY_CTX_set_dsa_paramgen_bits(param_ctx.get(), modulus_bits_) <= 0)
|
||||
return nullptr;
|
||||
|
||||
@@ -6095,6 +6086,7 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
@@ -6141,6 +6132,7 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -51,10 +51,10 @@ index c132e6a089b3cb7119910131fe740574d7917b89..82afaee6e2b929faac76fc5d930a8c0f
|
|||
EVP_PKEY* raw_params = nullptr;
|
||||
if (EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0)
|
||||
diff --git a/src/node_crypto_common.cc b/src/node_crypto_common.cc
|
||||
index 3b35ee1ff7ba8a6aac6419ba6ca13ea33e7bcf42..83f4c1127081542aad2d12b9dc45f99cbd7a106d 100644
|
||||
index 6473b652ac95609aff555d99be38b48a5aa513a5..caaaf19dc02101c2024b511780c94fc85476b7a2 100644
|
||||
--- a/src/node_crypto_common.cc
|
||||
+++ b/src/node_crypto_common.cc
|
||||
@@ -239,10 +239,10 @@ int UseSNIContext(const SSLPointer& ssl, BaseObjectPtr<SecureContext> context) {
|
||||
@@ -240,10 +240,10 @@ int UseSNIContext(const SSLPointer& ssl, BaseObjectPtr<SecureContext> context) {
|
||||
}
|
||||
|
||||
const char* GetClientHelloALPN(const SSLPointer& ssl) {
|
||||
|
@ -66,7 +66,7 @@ index 3b35ee1ff7ba8a6aac6419ba6ca13ea33e7bcf42..83f4c1127081542aad2d12b9dc45f99c
|
|||
if (!SSL_client_hello_get0_ext(
|
||||
ssl.get(),
|
||||
TLSEXT_TYPE_application_layer_protocol_negotiation,
|
||||
@@ -251,17 +251,18 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
|
||||
@@ -252,17 +252,18 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
|
||||
rem < 2) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ index 3b35ee1ff7ba8a6aac6419ba6ca13ea33e7bcf42..83f4c1127081542aad2d12b9dc45f99c
|
|||
if (!SSL_client_hello_get0_ext(
|
||||
ssl.get(),
|
||||
TLSEXT_TYPE_server_name,
|
||||
@@ -283,6 +284,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) {
|
||||
@@ -284,6 +285,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) {
|
||||
if (len + 2 > rem)
|
||||
return nullptr;
|
||||
return reinterpret_cast<const char*>(buf + 5);
|
||||
|
@ -96,7 +96,7 @@ index 3b35ee1ff7ba8a6aac6419ba6ca13ea33e7bcf42..83f4c1127081542aad2d12b9dc45f99c
|
|||
}
|
||||
|
||||
const char* GetServerName(SSL* ssl) {
|
||||
@@ -290,7 +293,10 @@ const char* GetServerName(SSL* ssl) {
|
||||
@@ -291,7 +294,10 @@ const char* GetServerName(SSL* ssl) {
|
||||
}
|
||||
|
||||
bool SetGroups(SecureContext* sc, const char* groups) {
|
||||
|
@ -107,7 +107,7 @@ index 3b35ee1ff7ba8a6aac6419ba6ca13ea33e7bcf42..83f4c1127081542aad2d12b9dc45f99c
|
|||
}
|
||||
|
||||
const char* X509ErrorCode(long err) { // NOLINT(runtime/int)
|
||||
@@ -772,13 +778,13 @@ MaybeLocal<Array> GetClientHelloCiphers(
|
||||
@@ -768,13 +774,13 @@ MaybeLocal<Array> GetClientHelloCiphers(
|
||||
Environment* env,
|
||||
const SSLPointer& ssl) {
|
||||
EscapableHandleScope scope(env->isolate());
|
||||
|
|
|
@ -8,10 +8,10 @@ by using the implementations of those functions as found in the OpenSSL repo.
|
|||
I plan to try and upstream a version of this.
|
||||
|
||||
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
|
||||
index ce64dbca7ce6555bd37d3b6f85ecf41a98e3dd29..c373533ce85241f86d64eab8a49af79f935acdeb 100644
|
||||
index 43bdb88d48324cf8b206c711d3c3133f147aba24..c87b00ad87cf133ed30227b8dfd3b8e8d02e9963 100644
|
||||
--- a/src/node_crypto.cc
|
||||
+++ b/src/node_crypto.cc
|
||||
@@ -4525,7 +4525,7 @@ static unsigned int GetBytesOfRS(const ManagedEVPPKey& pkey) {
|
||||
@@ -4567,7 +4567,7 @@ static unsigned int GetBytesOfRS(const ManagedEVPPKey& pkey) {
|
||||
if (base_id == EVP_PKEY_DSA) {
|
||||
DSA* dsa_key = EVP_PKEY_get0_DSA(pkey.get());
|
||||
// Both r and s are computed mod q, so their width is limited by that of q.
|
||||
|
|
|
@ -7,10 +7,10 @@ This broke the build at some point. Does it still? We should probably remove
|
|||
this patch and find out!
|
||||
|
||||
diff --git a/src/node_internals.h b/src/node_internals.h
|
||||
index 084ecfa73657d1958d7552baa896e170934639c8..cb388f3a9f12949fd3ecb0406f7b550f4ca5ca7c 100644
|
||||
index 54e24d41e25293d3535cd853eb5a80a7b0fee122..59b7e0c225a096acaa191bd144f876cc9a1c4432 100644
|
||||
--- a/src/node_internals.h
|
||||
+++ b/src/node_internals.h
|
||||
@@ -375,10 +375,11 @@ class TraceEventScope {
|
||||
@@ -372,10 +372,11 @@ class TraceEventScope {
|
||||
TraceEventScope(const char* category,
|
||||
const char* name,
|
||||
void* id) : category_(category), name_(name), id_(id) {
|
||||
|
|
|
@ -7,10 +7,10 @@ async hooks are hella broken in Electron. This was checking that they weren't,
|
|||
but they are, so we just disabled the check. YOLO.
|
||||
|
||||
diff --git a/src/api/callback.cc b/src/api/callback.cc
|
||||
index 9f52c25cf0d9005c2e70b76eb52eae1bd15f0a53..e151871dc90b6c29dc3fc3db162e24baeb45923d 100644
|
||||
index 84664c089594eb44a8752ab17852157782fb4d62..6ebe2ec08a1bc875f5e26ba5fedce132596835da 100644
|
||||
--- a/src/api/callback.cc
|
||||
+++ b/src/api/callback.cc
|
||||
@@ -117,12 +117,14 @@ void InternalCallbackScope::Close() {
|
||||
@@ -116,12 +116,14 @@ void InternalCallbackScope::Close() {
|
||||
perform_stopping_check();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,234 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Noordhuis <info@bnoordhuis.nl>
|
||||
Date: Sat, 18 Jan 2020 10:55:31 +0100
|
||||
Subject: lib,src: switch Buffer::kMaxLength to size_t
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Change the type of `Buffer::kMaxLength` to size_t because upcoming
|
||||
changes in V8 will allow typed arrays > 2 GB on 64 bits platforms.
|
||||
|
||||
Not all platforms handle file reads and writes > 2 GB though so keep
|
||||
enforcing the 2 GB typed array limit for I/O operations.
|
||||
|
||||
Fixes: https://github.com/nodejs/node/issues/31399
|
||||
Refs: https://github.com/libuv/libuv/pull/1501
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/31406
|
||||
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
|
||||
Reviewed-By: David Carlier <devnexen@gmail.com>
|
||||
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
|
||||
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
|
||||
Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
||||
Reviewed-By: Rich Trott <rtrott@gmail.com>
|
||||
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
|
||||
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
|
||||
|
||||
diff --git a/lib/fs.js b/lib/fs.js
|
||||
index 9b70b237ef00e19983b39902b50233c682492771..7e1cb0e9e72078340e1f2cc77cd70e7a1f6bf595 100644
|
||||
--- a/lib/fs.js
|
||||
+++ b/lib/fs.js
|
||||
@@ -24,6 +24,10 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
+// Most platforms don't allow reads or writes >= 2 GB.
|
||||
+// See https://github.com/libuv/libuv/pull/1501.
|
||||
+const kIoMaxLength = 2 ** 31 - 1;
|
||||
+
|
||||
const {
|
||||
Map,
|
||||
MathMax,
|
||||
@@ -53,7 +57,7 @@ const {
|
||||
const pathModule = require('path');
|
||||
const { isArrayBufferView } = require('internal/util/types');
|
||||
const binding = internalBinding('fs');
|
||||
-const { Buffer, kMaxLength } = require('buffer');
|
||||
+const { Buffer } = require('buffer');
|
||||
const {
|
||||
codes: {
|
||||
ERR_FS_FILE_TOO_LARGE,
|
||||
@@ -278,7 +282,7 @@ function readFileAfterStat(err, stats) {
|
||||
|
||||
const size = context.size = isFileType(stats, S_IFREG) ? stats[8] : 0;
|
||||
|
||||
- if (size > kMaxLength) {
|
||||
+ if (size > kIoMaxLength) {
|
||||
err = new ERR_FS_FILE_TOO_LARGE(size);
|
||||
return context.close(err);
|
||||
}
|
||||
@@ -335,7 +339,7 @@ function tryCreateBuffer(size, fd, isUserFd) {
|
||||
let threw = true;
|
||||
let buffer;
|
||||
try {
|
||||
- if (size > kMaxLength) {
|
||||
+ if (size > kIoMaxLength) {
|
||||
throw new ERR_FS_FILE_TOO_LARGE(size);
|
||||
}
|
||||
buffer = Buffer.allocUnsafe(size);
|
||||
diff --git a/lib/internal/errors.js b/lib/internal/errors.js
|
||||
index a3d99a79c6340c3bc2955bf3b36d11e8676d1aa1..4e2d1e48257acff20131ee998a0774b709d5dbcc 100644
|
||||
--- a/lib/internal/errors.js
|
||||
+++ b/lib/internal/errors.js
|
||||
@@ -827,9 +827,7 @@ E('ERR_FALSY_VALUE_REJECTION', function(reason) {
|
||||
this.reason = reason;
|
||||
return 'Promise was rejected with falsy value';
|
||||
}, Error);
|
||||
-E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than possible Buffer: ' +
|
||||
- `${kMaxLength} bytes`,
|
||||
- RangeError);
|
||||
+E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than 2 GB', RangeError);
|
||||
E('ERR_FS_INVALID_SYMLINK_TYPE',
|
||||
'Symlink type must be one of "dir", "file", or "junction". Received "%s"',
|
||||
Error); // Switch to TypeError. The current implementation does not seem right
|
||||
diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js
|
||||
index 31eaeef28462166036c5a71a474e1b3c018cfa53..91cf9f6be52d47ba7353ca19f687ab2bb41cbd22 100644
|
||||
--- a/lib/internal/fs/promises.js
|
||||
+++ b/lib/internal/fs/promises.js
|
||||
@@ -1,5 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
+// Most platforms don't allow reads or writes >= 2 GB.
|
||||
+// See https://github.com/libuv/libuv/pull/1501.
|
||||
+const kIoMaxLength = 2 ** 31 - 1;
|
||||
+
|
||||
const {
|
||||
MathMax,
|
||||
MathMin,
|
||||
@@ -15,7 +19,7 @@ const {
|
||||
S_IFREG
|
||||
} = internalBinding('constants').fs;
|
||||
const binding = internalBinding('fs');
|
||||
-const { Buffer, kMaxLength } = require('buffer');
|
||||
+const { Buffer } = require('buffer');
|
||||
const {
|
||||
ERR_FS_FILE_TOO_LARGE,
|
||||
ERR_INVALID_ARG_TYPE,
|
||||
@@ -166,7 +170,7 @@ async function readFileHandle(filehandle, options) {
|
||||
size = 0;
|
||||
}
|
||||
|
||||
- if (size > kMaxLength)
|
||||
+ if (size > kIoMaxLength)
|
||||
throw new ERR_FS_FILE_TOO_LARGE(size);
|
||||
|
||||
const chunks = [];
|
||||
diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js
|
||||
index ed4e9bb66ad79ffd542b769ab17a28bb801764c6..84f9e3b806a237c599f85dcb8fb93bfe9a098eda 100644
|
||||
--- a/lib/internal/fs/utils.js
|
||||
+++ b/lib/internal/fs/utils.js
|
||||
@@ -12,7 +12,7 @@ const {
|
||||
Symbol,
|
||||
} = primordials;
|
||||
|
||||
-const { Buffer, kMaxLength } = require('buffer');
|
||||
+const { Buffer } = require('buffer');
|
||||
const {
|
||||
codes: {
|
||||
ERR_FS_INVALID_SYMLINK_TYPE,
|
||||
@@ -72,6 +72,10 @@ const {
|
||||
|
||||
const isWindows = process.platform === 'win32';
|
||||
|
||||
+// Most platforms don't allow reads or writes >= 2 GB.
|
||||
+// See https://github.com/libuv/libuv/pull/1501.
|
||||
+const kIoMaxLength = 2 ** 31 - 1;
|
||||
+
|
||||
let fs;
|
||||
function lazyLoadFs() {
|
||||
if (!fs) {
|
||||
@@ -569,7 +573,7 @@ const validateOffsetLengthWrite = hideStackFrames(
|
||||
throw new ERR_OUT_OF_RANGE('offset', `<= ${byteLength}`, offset);
|
||||
}
|
||||
|
||||
- const max = byteLength > kMaxLength ? kMaxLength : byteLength;
|
||||
+ const max = byteLength > kIoMaxLength ? kIoMaxLength : byteLength;
|
||||
if (length > max - offset) {
|
||||
throw new ERR_OUT_OF_RANGE('length', `<= ${max - offset}`, length);
|
||||
}
|
||||
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
|
||||
index 59baa45413d500272d0e293ab06bfe4d24e5e0cb..4d1951b740240bff231b7f4c855beb5b73d076af 100644
|
||||
--- a/src/node_buffer.cc
|
||||
+++ b/src/node_buffer.cc
|
||||
@@ -62,6 +62,7 @@ using v8::Local;
|
||||
using v8::Maybe;
|
||||
using v8::MaybeLocal;
|
||||
using v8::Nothing;
|
||||
+using v8::Number;
|
||||
using v8::Object;
|
||||
using v8::String;
|
||||
using v8::Uint32;
|
||||
@@ -1161,7 +1162,7 @@ void Initialize(Local<Object> target,
|
||||
|
||||
target->Set(env->context(),
|
||||
FIXED_ONE_BYTE_STRING(env->isolate(), "kMaxLength"),
|
||||
- Integer::NewFromUnsigned(env->isolate(), kMaxLength)).Check();
|
||||
+ Number::New(env->isolate(), kMaxLength)).Check();
|
||||
|
||||
target->Set(env->context(),
|
||||
FIXED_ONE_BYTE_STRING(env->isolate(), "kStringMaxLength"),
|
||||
diff --git a/src/node_buffer.h b/src/node_buffer.h
|
||||
index 11010017ce0df8367b1992bd9df57117ff50454d..606a6f5caa3b11b6d2a9068ed2fd65800530a5eb 100644
|
||||
--- a/src/node_buffer.h
|
||||
+++ b/src/node_buffer.h
|
||||
@@ -29,7 +29,7 @@ namespace node {
|
||||
|
||||
namespace Buffer {
|
||||
|
||||
-static const unsigned int kMaxLength = v8::TypedArray::kMaxLength;
|
||||
+static const size_t kMaxLength = v8::TypedArray::kMaxLength;
|
||||
|
||||
typedef void (*FreeCallback)(char* data, void* hint);
|
||||
|
||||
diff --git a/test/parallel/test-fs-util-validateoffsetlengthwrite.js b/test/parallel/test-fs-util-validateoffsetlengthwrite.js
|
||||
index be6d8acea77efa5adc82a6bcaaa192167b510fb0..e2c583749d041d76da630bbbf6b46ac490076c56 100644
|
||||
--- a/test/parallel/test-fs-util-validateoffsetlengthwrite.js
|
||||
+++ b/test/parallel/test-fs-util-validateoffsetlengthwrite.js
|
||||
@@ -4,7 +4,10 @@
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const { validateOffsetLengthWrite } = require('internal/fs/utils');
|
||||
-const { kMaxLength } = require('buffer');
|
||||
+
|
||||
+// Most platforms don't allow reads or writes >= 2 GB.
|
||||
+// See https://github.com/libuv/libuv/pull/1501.
|
||||
+const kIoMaxLength = 2 ** 31 - 1;
|
||||
|
||||
// RangeError when offset > byteLength
|
||||
{
|
||||
@@ -22,27 +25,27 @@ const { kMaxLength } = require('buffer');
|
||||
);
|
||||
}
|
||||
|
||||
-// RangeError when byteLength > kMaxLength, and length > kMaxLength - offset .
|
||||
+// RangeError when byteLength > kIoMaxLength, and length > kIoMaxLength - offset .
|
||||
{
|
||||
- const offset = kMaxLength;
|
||||
+ const offset = kIoMaxLength;
|
||||
const length = 100;
|
||||
- const byteLength = kMaxLength + 1;
|
||||
+ const byteLength = kIoMaxLength + 1;
|
||||
assert.throws(
|
||||
() => validateOffsetLengthWrite(offset, length, byteLength),
|
||||
{
|
||||
code: 'ERR_OUT_OF_RANGE',
|
||||
name: 'RangeError',
|
||||
message: 'The value of "length" is out of range. ' +
|
||||
- `It must be <= ${kMaxLength - offset}. Received ${length}`
|
||||
+ `It must be <= ${kIoMaxLength - offset}. Received ${length}`
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
-// RangeError when byteLength < kMaxLength, and length > byteLength - offset .
|
||||
+// RangeError when byteLength < kIoMaxLength, and length > byteLength - offset.
|
||||
{
|
||||
- const offset = kMaxLength - 150;
|
||||
+ const offset = kIoMaxLength - 150;
|
||||
const length = 200;
|
||||
- const byteLength = kMaxLength - 100;
|
||||
+ const byteLength = kIoMaxLength - 100;
|
||||
assert.throws(
|
||||
() => validateOffsetLengthWrite(offset, length, byteLength),
|
||||
{
|
|
@ -1,30 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Tue, 4 Aug 2020 09:17:06 -0700
|
||||
Subject: lib: use non-symbols in isURLInstance check
|
||||
|
||||
This slightly changes the conditional used to determine whether or
|
||||
not something is a URL instance. Since Node.js adds symbols to the URL
|
||||
not specified by the WHATWG, those symbols are not present in other
|
||||
implementations (like Blink's) and therefore can cause false negatives.
|
||||
|
||||
This fixes that by slightly changing the check to properties present
|
||||
in all URL instances as specified in the WHATWG spec.
|
||||
|
||||
Upstreamed at: https://github.com/nodejs/node/pull/34622.
|
||||
|
||||
diff --git a/lib/internal/url.js b/lib/internal/url.js
|
||||
index 78f5b32745a0436337233e8a4b57b89263effad6..ace274501f2c1f6bb06f600abb850e737c988338 100644
|
||||
--- a/lib/internal/url.js
|
||||
+++ b/lib/internal/url.js
|
||||
@@ -1394,8 +1394,8 @@ function pathToFileURL(filepath) {
|
||||
}
|
||||
|
||||
function isURLInstance(fileURLOrPath) {
|
||||
- return fileURLOrPath != null && fileURLOrPath[searchParams] &&
|
||||
- fileURLOrPath[searchParams][searchParams];
|
||||
+ return fileURLOrPath != null && fileURLOrPath['href'] &&
|
||||
+ fileURLOrPath['origin'];
|
||||
}
|
||||
|
||||
function toPathIfFileURL(fileURLOrPath) {
|
|
@ -10,10 +10,10 @@ node's module code.
|
|||
(cherry picked from commit 76ba048c37588ee32636817fa7b8dffc64330cbf)
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index 98668573db651a42876c3369e6fa7c2ef97d6e73..d041ce0470ee48d44897fb77f37f6013d9cc108a 100644
|
||||
index a7fa93b9cfa9468f068fcfb950bade8137483121..a24ab3c2ee7d664700a6c4c8e17c9ef2b74efa5a 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -1254,8 +1254,8 @@ Module._initPaths = function() {
|
||||
@@ -1198,8 +1198,8 @@ Module._initPaths = function() {
|
||||
|
||||
modulePaths = paths;
|
||||
|
||||
|
|
|
@ -1,148 +1,155 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Tue, 25 Aug 2020 19:34:12 -0700
|
||||
Subject: n-api,src: provide asynchronous cleanup hooks
|
||||
From: Gabriel Schulhof <gabriel.schulhof@intel.com>
|
||||
Date: Mon, 17 Aug 2020 10:13:00 -0700
|
||||
Subject: n-api: re-implement async env cleanup hooks
|
||||
|
||||
Backports https://github.com/nodejs/node/pull/34572 and
|
||||
https://github.com/nodejs/node/pull/34819.
|
||||
* Avoid passing core `void*` and function pointers into add-on.
|
||||
* Document `napi_async_cleanup_hook_handle` type.
|
||||
* Render receipt of the handle mandatory from the point where the
|
||||
hook gets called. Removal of the handle remains mandatory.
|
||||
|
||||
Sometimes addons need to perform cleanup actions, for example
|
||||
closing libuv handles or waiting for requests to finish, that
|
||||
cannot be performed synchronously.
|
||||
Fixes: https://github.com/nodejs/node/issues/34715
|
||||
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
|
||||
Co-authored-by: Anna Henningsen <github@addaleax.net>
|
||||
PR-URL: https://github.com/nodejs/node/pull/34819
|
||||
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
|
||||
Reviewed-By: Zeyu Yang <himself65@outlook.com>
|
||||
|
||||
Add C++ API and N-API functions that allow providing such
|
||||
asynchronous cleanup hooks.
|
||||
|
||||
This patch can be removed when Electron upgrades to a version of Node.js
|
||||
which contains the above referenced commit(s).
|
||||
|
||||
diff --git a/src/api/hooks.cc b/src/api/hooks.cc
|
||||
index 037bdda6f41c825dd112b0cc9fca0ebde47c6163..3b16c0350d8a8494202144407664af41d338fe04 100644
|
||||
--- a/src/api/hooks.cc
|
||||
+++ b/src/api/hooks.cc
|
||||
@@ -73,8 +73,35 @@ int EmitExit(Environment* env) {
|
||||
.ToChecked();
|
||||
}
|
||||
diff --git a/doc/api/n-api.md b/doc/api/n-api.md
|
||||
index d9b757721c880388664f11cc5c0425379e105e2b..161f61308e5e5faa1ddf68802fdafacf1e5c1613 100644
|
||||
--- a/doc/api/n-api.md
|
||||
+++ b/doc/api/n-api.md
|
||||
@@ -623,6 +623,15 @@ typedef struct {
|
||||
} napi_type_tag;
|
||||
```
|
||||
|
||||
+typedef void (*CleanupHook)(void* arg);
|
||||
+typedef void (*AsyncCleanupHook)(void* arg, void(*)(void*), void*);
|
||||
+#### napi_async_cleanup_hook_handle
|
||||
+<!-- YAML
|
||||
+added: REPLACEME
|
||||
+-->
|
||||
+
|
||||
+struct AsyncCleanupHookInfo final {
|
||||
+ Environment* env;
|
||||
+ AsyncCleanupHook fun;
|
||||
+ void* arg;
|
||||
+ bool started = false;
|
||||
+ // Use a self-reference to make sure the storage is kept alive while the
|
||||
+ // cleanup hook is registered but not yet finished.
|
||||
+ std::shared_ptr<AsyncCleanupHookInfo> self;
|
||||
+};
|
||||
+An opaque value returned by [`napi_add_async_cleanup_hook`][]. It must be passed
|
||||
+to [`napi_remove_async_cleanup_hook`][] when the chain of asynchronous cleanup
|
||||
+events completes.
|
||||
+
|
||||
+// Opaque type that is basically an alias for `shared_ptr<AsyncCleanupHookInfo>`
|
||||
+// (but not publicly so for easier ABI/API changes). In particular,
|
||||
+// std::shared_ptr does not generally maintain a consistent ABI even on a
|
||||
+// specific platform.
|
||||
+struct ACHHandle final {
|
||||
+ std::shared_ptr<AsyncCleanupHookInfo> info;
|
||||
+};
|
||||
+// This is implemented as an operator on a struct because otherwise you can't
|
||||
+// default-initialize AsyncCleanupHookHandle, because in C++ for a
|
||||
+// std::unique_ptr to be default-initializable the deleter type also needs
|
||||
+// to be default-initializable; in particular, function types don't satisfy
|
||||
+// this.
|
||||
+void DeleteACHHandle::operator ()(ACHHandle* handle) const { delete handle; }
|
||||
+
|
||||
void AddEnvironmentCleanupHook(Isolate* isolate,
|
||||
- void (*fun)(void* arg),
|
||||
+ CleanupHook fun,
|
||||
void* arg) {
|
||||
Environment* env = Environment::GetCurrent(isolate);
|
||||
CHECK_NOT_NULL(env);
|
||||
@@ -82,13 +109,50 @@ void AddEnvironmentCleanupHook(Isolate* isolate,
|
||||
}
|
||||
### N-API callback types
|
||||
|
||||
void RemoveEnvironmentCleanupHook(Isolate* isolate,
|
||||
- void (*fun)(void* arg),
|
||||
+ CleanupHook fun,
|
||||
void* arg) {
|
||||
Environment* env = Environment::GetCurrent(isolate);
|
||||
CHECK_NOT_NULL(env);
|
||||
env->RemoveCleanupHook(fun, arg);
|
||||
}
|
||||
#### napi_callback_info
|
||||
@@ -751,6 +760,30 @@ typedef void (*napi_threadsafe_function_call_js)(napi_env env,
|
||||
Unless for reasons discussed in [Object Lifetime Management][], creating a
|
||||
handle and/or callback scope inside the function body is not necessary.
|
||||
|
||||
+static void FinishAsyncCleanupHook(void* arg) {
|
||||
+ AsyncCleanupHookInfo* info = static_cast<AsyncCleanupHookInfo*>(arg);
|
||||
+ std::shared_ptr<AsyncCleanupHookInfo> keep_alive = info->self;
|
||||
+#### napi_async_cleanup_hook
|
||||
+<!-- YAML
|
||||
+added: REPLACEME
|
||||
+-->
|
||||
+
|
||||
+ info->env->DecreaseWaitingRequestCounter();
|
||||
+ info->self.reset();
|
||||
+}
|
||||
+Function pointer used with [`napi_add_async_cleanup_hook`][]. It will be called
|
||||
+when the environment is being torn down.
|
||||
+
|
||||
+static void RunAsyncCleanupHook(void* arg) {
|
||||
+ AsyncCleanupHookInfo* info = static_cast<AsyncCleanupHookInfo*>(arg);
|
||||
+ info->env->IncreaseWaitingRequestCounter();
|
||||
+ info->started = true;
|
||||
+ info->fun(info->arg, FinishAsyncCleanupHook, info);
|
||||
+}
|
||||
+Callback functions must satisfy the following signature:
|
||||
+
|
||||
+AsyncCleanupHookHandle AddEnvironmentCleanupHook(
|
||||
+ Isolate* isolate,
|
||||
+ AsyncCleanupHook fun,
|
||||
+ void* arg) {
|
||||
+ Environment* env = Environment::GetCurrent(isolate);
|
||||
+ CHECK_NOT_NULL(env);
|
||||
+ auto info = std::make_shared<AsyncCleanupHookInfo>();
|
||||
+ info->env = env;
|
||||
+ info->fun = fun;
|
||||
+ info->arg = arg;
|
||||
+ info->self = info;
|
||||
+ env->AddCleanupHook(RunAsyncCleanupHook, info.get());
|
||||
+ return AsyncCleanupHookHandle(new ACHHandle { info });
|
||||
+}
|
||||
+```c
|
||||
+typedef void (*napi_async_cleanup_hook)(napi_async_cleanup_hook_handle handle,
|
||||
+ void* data);
|
||||
+```
|
||||
+
|
||||
+void RemoveEnvironmentCleanupHook(
|
||||
+ AsyncCleanupHookHandle handle) {
|
||||
+ if (handle->info->started) return;
|
||||
+ handle->info->self.reset();
|
||||
+ handle->info->env->RemoveCleanupHook(RunAsyncCleanupHook, handle->info.get());
|
||||
+}
|
||||
+* `[in] handle`: The handle that must be passed to
|
||||
+[`napi_remove_async_cleanup_hook`][] after completion of the asynchronous
|
||||
+cleanup.
|
||||
+* `[in] data`: The data that was passed to [`napi_add_async_cleanup_hook`][].
|
||||
+
|
||||
async_id AsyncHooksGetExecutionAsyncId(Isolate* isolate) {
|
||||
Environment* env = Environment::GetCurrent(isolate);
|
||||
if (env == nullptr) return -1;
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 60ecc3bd3499c23b297bc11e7f052aede20520c2..4c4e55e338d7b42c36818a45f6b41170c495adde 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -739,6 +739,20 @@ NODE_EXTERN void RemoveEnvironmentCleanupHook(v8::Isolate* isolate,
|
||||
void (*fun)(void* arg),
|
||||
void* arg);
|
||||
+The body of the function should initiate the asynchronous cleanup actions at the
|
||||
+end of which `handle` must be passed in a call to
|
||||
+[`napi_remove_async_cleanup_hook`][].
|
||||
+
|
||||
## Error handling
|
||||
|
||||
+/* These are async equivalents of the above. After the cleanup hook is invoked,
|
||||
+ * `cb(cbarg)` *must* be called, and attempting to remove the cleanup hook will
|
||||
+ * have no effect. */
|
||||
+struct ACHHandle;
|
||||
+struct NODE_EXTERN DeleteACHHandle { void operator()(ACHHandle*) const; };
|
||||
+typedef std::unique_ptr<ACHHandle, DeleteACHHandle> AsyncCleanupHookHandle;
|
||||
N-API uses both return values and JavaScript exceptions for error handling.
|
||||
@@ -1580,6 +1613,10 @@ with `napi_add_env_cleanup_hook`, otherwise the process will abort.
|
||||
#### napi_add_async_cleanup_hook
|
||||
<!-- YAML
|
||||
added: v14.8.0
|
||||
+changes:
|
||||
+ - version: REPLACEME
|
||||
+ pr-url: https://github.com/nodejs/node/pull/34819
|
||||
+ description: Changed signature of the `hook` callback.
|
||||
-->
|
||||
|
||||
> Stability: 1 - Experimental
|
||||
@@ -1587,15 +1624,22 @@ added: v14.8.0
|
||||
```c
|
||||
NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
|
||||
napi_env env,
|
||||
- void (*fun)(void* arg, void(* cb)(void*), void* cbarg),
|
||||
+ napi_async_cleanup_hook hook,
|
||||
void* arg,
|
||||
napi_async_cleanup_hook_handle* remove_handle);
|
||||
```
|
||||
|
||||
-Registers `fun` as a function to be run with the `arg` parameter once the
|
||||
-current Node.js environment exits. Unlike [`napi_add_env_cleanup_hook`][],
|
||||
-the hook is allowed to be asynchronous in this case, and must invoke the passed
|
||||
-`cb()` function with `cbarg` once all asynchronous activity is finished.
|
||||
+* `[in] env`: The environment that the API is invoked under.
|
||||
+* `[in] hook`: The function pointer to call at environment teardown.
|
||||
+* `[in] arg`: The pointer to pass to `hook` when it gets called.
|
||||
+* `[out] remove_handle`: Optional handle that refers to the asynchronous cleanup
|
||||
+hook.
|
||||
+
|
||||
+NODE_EXTERN AsyncCleanupHookHandle AddEnvironmentCleanupHook(
|
||||
+ v8::Isolate* isolate,
|
||||
+ void (*fun)(void* arg, void (*cb)(void*), void* cbarg),
|
||||
+ void* arg);
|
||||
+Registers `hook`, which is a function of type [`napi_async_cleanup_hook`][], as
|
||||
+a function to be run with the `remove_handle` and `arg` parameters once the
|
||||
+current Node.js environment exits.
|
||||
+
|
||||
+NODE_EXTERN void RemoveEnvironmentCleanupHook(AsyncCleanupHookHandle holder);
|
||||
+Unlike [`napi_add_env_cleanup_hook`][], the hook is allowed to be asynchronous.
|
||||
|
||||
Otherwise, behavior generally matches that of [`napi_add_env_cleanup_hook`][].
|
||||
|
||||
@@ -1608,19 +1652,25 @@ is being torn down anyway.
|
||||
#### napi_remove_async_cleanup_hook
|
||||
<!-- YAML
|
||||
added: v14.8.0
|
||||
+changes:
|
||||
+ - version: REPLACEME
|
||||
+ pr-url: https://github.com/nodejs/node/pull/34819
|
||||
+ description: Removed `env` parameter.
|
||||
-->
|
||||
|
||||
> Stability: 1 - Experimental
|
||||
|
||||
```c
|
||||
NAPI_EXTERN napi_status napi_remove_async_cleanup_hook(
|
||||
- napi_env env,
|
||||
napi_async_cleanup_hook_handle remove_handle);
|
||||
```
|
||||
|
||||
+* `[in] remove_handle`: The handle to an asynchronous cleanup hook that was
|
||||
+created with [`napi_add_async_cleanup_hook`][].
|
||||
+
|
||||
/* Returns the id of the current execution context. If the return value is
|
||||
* zero then no execution has been set. This will happen if the user handles
|
||||
* I/O from native code. */
|
||||
Unregisters the cleanup hook corresponding to `remove_handle`. This will prevent
|
||||
the hook from being executed, unless it has already started executing.
|
||||
-This must be called on any `napi_async_cleanup_hook_handle` value retrieved
|
||||
+This must be called on any `napi_async_cleanup_hook_handle` value obtained
|
||||
from [`napi_add_async_cleanup_hook`][].
|
||||
|
||||
## Module registration
|
||||
@@ -5757,6 +5807,7 @@ This API may only be called from the main thread.
|
||||
[`napi_add_async_cleanup_hook`]: #n_api_napi_add_async_cleanup_hook
|
||||
[`napi_add_env_cleanup_hook`]: #n_api_napi_add_env_cleanup_hook
|
||||
[`napi_add_finalizer`]: #n_api_napi_add_finalizer
|
||||
+[`napi_async_cleanup_hook`]: #n_api_napi_async_cleanup_hook
|
||||
[`napi_async_complete_callback`]: #n_api_napi_async_complete_callback
|
||||
[`napi_async_init`]: #n_api_napi_async_init
|
||||
[`napi_callback`]: #n_api_napi_callback
|
||||
diff --git a/src/node_api.cc b/src/node_api.cc
|
||||
index fe24eca1b8e2d81fbafd0a1e2da38d957fbaa1c1..66168bd2c28ce6481516e63734616f487e3ec3e1 100644
|
||||
index 4fbab771d5840004a303094c87981409d8bac848..93488146d56690c27c56a21f2795796d027cfa02 100644
|
||||
--- a/src/node_api.cc
|
||||
+++ b/src/node_api.cc
|
||||
@@ -507,6 +507,70 @@ napi_status napi_remove_env_cleanup_hook(napi_env env,
|
||||
return napi_ok;
|
||||
@@ -519,41 +519,68 @@ napi_status napi_remove_env_cleanup_hook(napi_env env,
|
||||
}
|
||||
|
||||
+struct napi_async_cleanup_hook_handle__ {
|
||||
struct napi_async_cleanup_hook_handle__ {
|
||||
- node::AsyncCleanupHookHandle handle;
|
||||
+ napi_async_cleanup_hook_handle__(napi_env env,
|
||||
+ napi_async_cleanup_hook user_hook,
|
||||
+ void* user_data):
|
||||
|
@ -177,74 +184,162 @@ index fe24eca1b8e2d81fbafd0a1e2da38d957fbaa1c1..66168bd2c28ce6481516e63734616f48
|
|||
+ void* user_data_ = nullptr;
|
||||
+ void (*done_cb_)(void*) = nullptr;
|
||||
+ void* done_data_ = nullptr;
|
||||
+};
|
||||
+
|
||||
+napi_status napi_add_async_cleanup_hook(
|
||||
+ napi_env env,
|
||||
};
|
||||
|
||||
napi_status napi_add_async_cleanup_hook(
|
||||
napi_env env,
|
||||
- void (*fun)(void* arg, void(* cb)(void*), void* cbarg),
|
||||
+ napi_async_cleanup_hook hook,
|
||||
+ void* arg,
|
||||
+ napi_async_cleanup_hook_handle* remove_handle) {
|
||||
+ CHECK_ENV(env);
|
||||
void* arg,
|
||||
napi_async_cleanup_hook_handle* remove_handle) {
|
||||
CHECK_ENV(env);
|
||||
- CHECK_ARG(env, fun);
|
||||
+ CHECK_ARG(env, hook);
|
||||
+
|
||||
|
||||
- auto handle = node::AddEnvironmentCleanupHook(env->isolate, fun, arg);
|
||||
- if (remove_handle != nullptr) {
|
||||
- *remove_handle = new napi_async_cleanup_hook_handle__ { std::move(handle) };
|
||||
- env->Ref();
|
||||
- }
|
||||
+ napi_async_cleanup_hook_handle__* handle =
|
||||
+ new napi_async_cleanup_hook_handle__(env, hook, arg);
|
||||
+
|
||||
+ if (remove_handle != nullptr)
|
||||
+ *remove_handle = handle;
|
||||
+
|
||||
+ return napi_clear_last_error(env);
|
||||
+}
|
||||
+
|
||||
+napi_status napi_remove_async_cleanup_hook(
|
||||
+ napi_async_cleanup_hook_handle remove_handle) {
|
||||
+
|
||||
|
||||
return napi_clear_last_error(env);
|
||||
}
|
||||
|
||||
napi_status napi_remove_async_cleanup_hook(
|
||||
- napi_env env,
|
||||
napi_async_cleanup_hook_handle remove_handle) {
|
||||
- CHECK_ENV(env);
|
||||
- CHECK_ARG(env, remove_handle);
|
||||
|
||||
- node::RemoveEnvironmentCleanupHook(std::move(remove_handle->handle));
|
||||
- delete remove_handle;
|
||||
+ if (remove_handle == nullptr)
|
||||
+ return napi_invalid_arg;
|
||||
+
|
||||
|
||||
- // Release the `env` handle asynchronously since it would be surprising if
|
||||
- // a call to a N-API function would destroy `env` synchronously.
|
||||
- static_cast<node_napi_env>(env)->node_env()
|
||||
- ->SetImmediate([env](node::Environment*) { env->Unref(); });
|
||||
+ delete remove_handle;
|
||||
|
||||
- return napi_clear_last_error(env);
|
||||
+ return napi_ok;
|
||||
+}
|
||||
+
|
||||
}
|
||||
|
||||
napi_status napi_fatal_exception(napi_env env, napi_value err) {
|
||||
NAPI_PREAMBLE(env);
|
||||
CHECK_ARG(env, err);
|
||||
diff --git a/src/node_api.h b/src/node_api.h
|
||||
index 2f1b45572d8130f27492eb6188c1aa611f2e01a3..577a1dcd94987202819e7a36a2d9674f13d13614 100644
|
||||
index 4f3eb8f2caae6375d5334486d75be76bf912d4e3..577a1dcd94987202819e7a36a2d9674f13d13614 100644
|
||||
--- a/src/node_api.h
|
||||
+++ b/src/node_api.h
|
||||
@@ -250,6 +250,19 @@ napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func);
|
||||
@@ -254,12 +254,11 @@ napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func);
|
||||
|
||||
#endif // NAPI_VERSION >= 4
|
||||
|
||||
+#ifdef NAPI_EXPERIMENTAL
|
||||
+
|
||||
+NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
|
||||
+ napi_env env,
|
||||
NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
|
||||
napi_env env,
|
||||
- void (*fun)(void* arg, void(* cb)(void*), void* cbarg),
|
||||
+ napi_async_cleanup_hook hook,
|
||||
+ void* arg,
|
||||
+ napi_async_cleanup_hook_handle* remove_handle);
|
||||
+
|
||||
+NAPI_EXTERN napi_status napi_remove_async_cleanup_hook(
|
||||
+ napi_async_cleanup_hook_handle remove_handle);
|
||||
+
|
||||
+#endif // NAPI_EXPERIMENTAL
|
||||
+
|
||||
EXTERN_C_END
|
||||
void* arg,
|
||||
napi_async_cleanup_hook_handle* remove_handle);
|
||||
|
||||
#endif // SRC_NODE_API_H_
|
||||
NAPI_EXTERN napi_status napi_remove_async_cleanup_hook(
|
||||
- napi_env env,
|
||||
napi_async_cleanup_hook_handle remove_handle);
|
||||
|
||||
#endif // NAPI_EXPERIMENTAL
|
||||
diff --git a/src/node_api_types.h b/src/node_api_types.h
|
||||
index 1c9a2b8aa21889c0d29fb02b234ae9698d122c2c..0e400e9676df5ba09d350fe7a2a70a1dc9e4d3d6 100644
|
||||
index b8711d3eddc408bc239a964528c23d71555a5d72..0e400e9676df5ba09d350fe7a2a70a1dc9e4d3d6 100644
|
||||
--- a/src/node_api_types.h
|
||||
+++ b/src/node_api_types.h
|
||||
@@ -41,4 +41,10 @@ typedef struct {
|
||||
const char* release;
|
||||
} napi_node_version;
|
||||
@@ -43,6 +43,8 @@ typedef struct {
|
||||
|
||||
+#ifdef NAPI_EXPERIMENTAL
|
||||
+typedef struct napi_async_cleanup_hook_handle__* napi_async_cleanup_hook_handle;
|
||||
#ifdef NAPI_EXPERIMENTAL
|
||||
typedef struct napi_async_cleanup_hook_handle__* napi_async_cleanup_hook_handle;
|
||||
+typedef void (*napi_async_cleanup_hook)(napi_async_cleanup_hook_handle handle,
|
||||
+ void* data);
|
||||
+#endif // NAPI_EXPERIMENTAL
|
||||
+
|
||||
#endif // NAPI_EXPERIMENTAL
|
||||
|
||||
#endif // SRC_NODE_API_TYPES_H_
|
||||
diff --git a/test/node-api/test_async_cleanup_hook/binding.c b/test/node-api/test_async_cleanup_hook/binding.c
|
||||
index f0c9cd97a26c48c3f7323930dc856e49e1755f35..7bbde56bb0ec888a97926f36425f7a1dca719514 100644
|
||||
--- a/test/node-api/test_async_cleanup_hook/binding.c
|
||||
+++ b/test/node-api/test_async_cleanup_hook/binding.c
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "../../js-native-api/common.h"
|
||||
|
||||
-void MustNotCall(void* arg, void(*cb)(void*), void* cbarg) {
|
||||
+static void MustNotCall(napi_async_cleanup_hook_handle hook, void* arg) {
|
||||
assert(0);
|
||||
}
|
||||
|
||||
@@ -13,36 +13,26 @@ struct AsyncData {
|
||||
uv_async_t async;
|
||||
napi_env env;
|
||||
napi_async_cleanup_hook_handle handle;
|
||||
- void (*done_cb)(void*);
|
||||
- void* done_arg;
|
||||
};
|
||||
|
||||
-struct AsyncData* CreateAsyncData() {
|
||||
+static struct AsyncData* CreateAsyncData() {
|
||||
struct AsyncData* data = (struct AsyncData*) malloc(sizeof(struct AsyncData));
|
||||
data->handle = NULL;
|
||||
return data;
|
||||
}
|
||||
|
||||
-void AfterCleanupHookTwo(uv_handle_t* handle) {
|
||||
+static void AfterCleanupHookTwo(uv_handle_t* handle) {
|
||||
struct AsyncData* data = (struct AsyncData*) handle->data;
|
||||
- data->done_cb(data->done_arg);
|
||||
+ napi_status status = napi_remove_async_cleanup_hook(data->handle);
|
||||
+ assert(status == napi_ok);
|
||||
free(data);
|
||||
}
|
||||
|
||||
-void AfterCleanupHookOne(uv_async_t* async) {
|
||||
- struct AsyncData* data = (struct AsyncData*) async->data;
|
||||
- if (data->handle != NULL) {
|
||||
- // Verify that removing the hook is okay between starting and finishing
|
||||
- // of its execution.
|
||||
- napi_status status =
|
||||
- napi_remove_async_cleanup_hook(data->env, data->handle);
|
||||
- assert(status == napi_ok);
|
||||
- }
|
||||
-
|
||||
+static void AfterCleanupHookOne(uv_async_t* async) {
|
||||
uv_close((uv_handle_t*) async, AfterCleanupHookTwo);
|
||||
}
|
||||
|
||||
-void AsyncCleanupHook(void* arg, void(*cb)(void*), void* cbarg) {
|
||||
+static void AsyncCleanupHook(napi_async_cleanup_hook_handle handle, void* arg) {
|
||||
struct AsyncData* data = (struct AsyncData*) arg;
|
||||
uv_loop_t* loop;
|
||||
napi_status status = napi_get_uv_event_loop(data->env, &loop);
|
||||
@@ -51,12 +41,11 @@ void AsyncCleanupHook(void* arg, void(*cb)(void*), void* cbarg) {
|
||||
assert(err == 0);
|
||||
|
||||
data->async.data = data;
|
||||
- data->done_cb = cb;
|
||||
- data->done_arg = cbarg;
|
||||
+ data->handle = handle;
|
||||
uv_async_send(&data->async);
|
||||
}
|
||||
|
||||
-napi_value Init(napi_env env, napi_value exports) {
|
||||
+static napi_value Init(napi_env env, napi_value exports) {
|
||||
{
|
||||
struct AsyncData* data = CreateAsyncData();
|
||||
data->env = env;
|
||||
@@ -73,7 +62,7 @@ napi_value Init(napi_env env, napi_value exports) {
|
||||
napi_async_cleanup_hook_handle must_not_call_handle;
|
||||
napi_add_async_cleanup_hook(
|
||||
env, MustNotCall, NULL, &must_not_call_handle);
|
||||
- napi_remove_async_cleanup_hook(env, must_not_call_handle);
|
||||
+ napi_remove_async_cleanup_hook(must_not_call_handle);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Mon, 3 Feb 2020 10:06:45 -0800
|
||||
Subject: Override existing V8 Reallocate
|
||||
|
||||
Refs https://chromium-review.googlesource.com/c/v8/v8/+/2007274.
|
||||
Reallocate has been implemented by V8 itself, so this function must now
|
||||
be overridden. This patch can be removed once the relevant version of V8
|
||||
makes its way into Node.js.
|
||||
|
||||
diff --git a/src/node_internals.h b/src/node_internals.h
|
||||
index cb388f3a9f12949fd3ecb0406f7b550f4ca5ca7c..f4b5c9bb7058da2355204a7285e5f7cc70c4ffda 100644
|
||||
--- a/src/node_internals.h
|
||||
+++ b/src/node_internals.h
|
||||
@@ -115,7 +115,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator {
|
||||
void* Allocate(size_t size) override; // Defined in src/node.cc
|
||||
void* AllocateUninitialized(size_t size) override;
|
||||
void Free(void* data, size_t size) override;
|
||||
- virtual void* Reallocate(void* data, size_t old_size, size_t size);
|
||||
+ virtual void* Reallocate(void* data, size_t old_size, size_t size) override;
|
||||
virtual void RegisterPointer(void* data, size_t size) {
|
||||
total_mem_usage_.fetch_add(size, std::memory_order_relaxed);
|
||||
}
|
|
@ -6,10 +6,10 @@ Subject: Pass all globals through "require"
|
|||
(cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62)
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index d041ce0470ee48d44897fb77f37f6013d9cc108a..0ef46569924354ea3ef59f3220637e30b316a761 100644
|
||||
index a24ab3c2ee7d664700a6c4c8e17c9ef2b74efa5a..cab75bce3624cc74a87283d86c30277c82292982 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -102,6 +102,13 @@ const {
|
||||
@@ -105,6 +105,13 @@ const {
|
||||
CHAR_COLON
|
||||
} = require('internal/constants');
|
||||
|
||||
|
@ -20,10 +20,10 @@ index d041ce0470ee48d44897fb77f37f6013d9cc108a..0ef46569924354ea3ef59f3220637e30
|
|||
+// Do the same for "Buffer".
|
||||
+const localBuffer = Buffer;
|
||||
+
|
||||
const isWindows = process.platform === 'win32';
|
||||
|
||||
const relativeResolveCache = ObjectCreate(null);
|
||||
@@ -1132,10 +1139,12 @@ Module.prototype._compile = function(content, filename) {
|
||||
const {
|
||||
isProxy
|
||||
} = require('internal/util/types');
|
||||
@@ -1070,10 +1077,12 @@ Module.prototype._compile = function(content, filename) {
|
||||
if (requireDepth === 0) statCache = new Map();
|
||||
if (inspectorWrapper) {
|
||||
result = inspectorWrapper(compiledWrapper, thisValue, exports,
|
||||
|
|
|
@ -7,10 +7,10 @@ We use this to allow node's 'fs' module to read from ASAR files as if they were
|
|||
a real filesystem.
|
||||
|
||||
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
|
||||
index c872941b974216d94863bcbf0e597b9c09ca50e2..4e7c3c10255a0eae4d5333f88e51cf7178163a44 100644
|
||||
index 6d6ca2af629c41df68fe1a4652cf94fef30be038..e1f70addc28e4fe31d3a7089ecec3b5874dde75a 100644
|
||||
--- a/lib/internal/bootstrap/node.js
|
||||
+++ b/lib/internal/bootstrap/node.js
|
||||
@@ -57,6 +57,10 @@ setupBuffer();
|
||||
@@ -56,6 +56,10 @@ setupBuffer();
|
||||
process.domain = null;
|
||||
process._exiting = false;
|
||||
|
||||
|
@ -20,21 +20,21 @@ index c872941b974216d94863bcbf0e597b9c09ca50e2..4e7c3c10255a0eae4d5333f88e51cf71
|
|||
+
|
||||
// process.config is serialized config.gypi
|
||||
process.config = JSONParse(internalBinding('native_module').config);
|
||||
|
||||
require('internal/worker/js_transferable').setup();
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index 0ef46569924354ea3ef59f3220637e30b316a761..7d08fb05e9a0abeb82d416891968b23002dc3685 100644
|
||||
index cab75bce3624cc74a87283d86c30277c82292982..c633daa2b3557c98b05cca5f428d87775ef8a02a 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -55,7 +55,7 @@ const assert = require('internal/assert');
|
||||
const fs = require('fs');
|
||||
const internalFS = require('internal/fs/utils');
|
||||
@@ -67,7 +67,7 @@ const internalFS = require('internal/fs/utils');
|
||||
const path = require('path');
|
||||
const { sep } = path;
|
||||
const { emitWarningSync } = require('internal/process/warning');
|
||||
-const { internalModuleStat } = internalBinding('fs');
|
||||
+const internalFsBinding = internalBinding('fs');
|
||||
const packageJsonReader = require('internal/modules/package_json_reader');
|
||||
const { safeGetenv } = internalBinding('credentials');
|
||||
const {
|
||||
@@ -147,7 +147,7 @@ function stat(filename) {
|
||||
@@ -159,7 +159,7 @@ function stat(filename) {
|
||||
const result = statCache.get(filename);
|
||||
if (result !== undefined) return result;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ index 0ef46569924354ea3ef59f3220637e30b316a761..7d08fb05e9a0abeb82d416891968b230
|
|||
return result;
|
||||
}
|
||||
diff --git a/lib/internal/modules/package_json_reader.js b/lib/internal/modules/package_json_reader.js
|
||||
index 066047b55eb9d82bc1eea66dc54aa68abd116b6b..4fcc65e235692d7d5fe2643571f006c593c4e173 100644
|
||||
index 25edfee027c35baba9d8add054895d0aa48bbafa..d545e24e72b2a6fb91b7aa35a576712e831ff937 100644
|
||||
--- a/lib/internal/modules/package_json_reader.js
|
||||
+++ b/lib/internal/modules/package_json_reader.js
|
||||
@@ -1,7 +1,7 @@
|
||||
|
@ -53,15 +53,15 @@ index 066047b55eb9d82bc1eea66dc54aa68abd116b6b..4fcc65e235692d7d5fe2643571f006c5
|
|||
const { SafeMap } = primordials;
|
||||
-const { internalModuleReadJSON } = internalBinding('fs');
|
||||
+const internalFsBinding = internalBinding('fs');
|
||||
const { pathToFileURL } = require('url');
|
||||
const { toNamespacedPath } = require('path');
|
||||
|
||||
const cache = new SafeMap();
|
||||
|
||||
@@ -14,7 +14,7 @@ function read(path) {
|
||||
return cache.get(path);
|
||||
@@ -16,7 +16,7 @@ function read(jsonPath) {
|
||||
return cache.get(jsonPath);
|
||||
}
|
||||
|
||||
- const [string, containsKeys] = internalModuleReadJSON(path);
|
||||
+ const [string, containsKeys] = internalFsBinding.internalModuleReadJSON(path);
|
||||
- const [string, containsKeys] = internalModuleReadJSON(
|
||||
+ const [string, containsKeys] = internalFsBinding.internalModuleReadJSON(
|
||||
toNamespacedPath(jsonPath)
|
||||
);
|
||||
const result = { string, containsKeys };
|
||||
cache.set(path, result);
|
||||
return result;
|
||||
|
|
|
@ -7,10 +7,10 @@ Subject: refactor: alter child_process.fork to use execute script with
|
|||
When forking a child script, we setup a special environment to make the Electron binary run like the upstream node. On Mac, we use the helper app as node binary.
|
||||
|
||||
diff --git a/lib/child_process.js b/lib/child_process.js
|
||||
index 77bce9c386bb3f5f23a003e6e7290b2d84ac06e0..5ed166e1ed76b830c2d97f8170a4a72841201537 100644
|
||||
index 9e1c37af8f169f57891a5d814a31c02d91ec0cdc..17266798cbab11591fd6c18cf416fdcaa11568de 100644
|
||||
--- a/lib/child_process.js
|
||||
+++ b/lib/child_process.js
|
||||
@@ -110,6 +110,15 @@ function fork(modulePath /* , args, options */) {
|
||||
@@ -115,6 +115,15 @@ function fork(modulePath /* , args, options */) {
|
||||
throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio');
|
||||
}
|
||||
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <samuel.r.attard@gmail.com>
|
||||
Date: Mon, 2 Dec 2019 17:25:38 -0800
|
||||
Subject: refactor: TransferrableModule is deprecated, use CompiledWasmModule
|
||||
instead
|
||||
|
||||
This is already present in Node.js v14 and can be removed when we upgrade.
|
||||
|
||||
diff --git a/src/node_messaging.cc b/src/node_messaging.cc
|
||||
index f19e541bff08fb69209a50f4b21257de77efaf9f..f42ed9661500d862545c09cdb233ca8a99cafd35 100644
|
||||
--- a/src/node_messaging.cc
|
||||
+++ b/src/node_messaging.cc
|
||||
@@ -56,7 +56,7 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
|
||||
Environment* env,
|
||||
const std::vector<MessagePort*>& message_ports,
|
||||
const std::vector<Local<SharedArrayBuffer>>& shared_array_buffers,
|
||||
- const std::vector<WasmModuleObject::TransferrableModule>& wasm_modules)
|
||||
+ const std::vector<v8::CompiledWasmModule>& wasm_modules)
|
||||
: message_ports_(message_ports),
|
||||
shared_array_buffers_(shared_array_buffers),
|
||||
wasm_modules_(wasm_modules) {}
|
||||
@@ -80,7 +80,7 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
|
||||
MaybeLocal<WasmModuleObject> GetWasmModuleFromId(
|
||||
Isolate* isolate, uint32_t transfer_id) override {
|
||||
CHECK_LE(transfer_id, wasm_modules_.size());
|
||||
- return WasmModuleObject::FromTransferrableModule(
|
||||
+ return WasmModuleObject::FromCompiledModule(
|
||||
isolate, wasm_modules_[transfer_id]);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
|
||||
private:
|
||||
const std::vector<MessagePort*>& message_ports_;
|
||||
const std::vector<Local<SharedArrayBuffer>>& shared_array_buffers_;
|
||||
- const std::vector<WasmModuleObject::TransferrableModule>& wasm_modules_;
|
||||
+ const std::vector<v8::CompiledWasmModule>& wasm_modules_;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
@@ -179,7 +179,7 @@ void Message::AddMessagePort(std::unique_ptr<MessagePortData>&& data) {
|
||||
message_ports_.emplace_back(std::move(data));
|
||||
}
|
||||
|
||||
-uint32_t Message::AddWASMModule(WasmModuleObject::TransferrableModule&& mod) {
|
||||
+uint32_t Message::AddWASMModule(v8::CompiledWasmModule&& mod) {
|
||||
wasm_modules_.emplace_back(std::move(mod));
|
||||
return wasm_modules_.size() - 1;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ class SerializerDelegate : public ValueSerializer::Delegate {
|
||||
|
||||
Maybe<uint32_t> GetWasmModuleTransferId(
|
||||
Isolate* isolate, Local<WasmModuleObject> module) override {
|
||||
- return Just(msg_->AddWASMModule(module->GetTransferrableModule()));
|
||||
+ return Just(msg_->AddWASMModule(module->GetCompiledModule()));
|
||||
}
|
||||
|
||||
void Finish() {
|
||||
diff --git a/src/node_messaging.h b/src/node_messaging.h
|
||||
index 43f710a84e831502bcfb574d2c456a0f9e815994..28986814b9f32ab310510f93ef9e6e97851e032d 100644
|
||||
--- a/src/node_messaging.h
|
||||
+++ b/src/node_messaging.h
|
||||
@@ -58,7 +58,7 @@ class Message : public MemoryRetainer {
|
||||
void AddMessagePort(std::unique_ptr<MessagePortData>&& data);
|
||||
// Internal method of Message that is called when a new WebAssembly.Module
|
||||
// object is encountered in the incoming value's structure.
|
||||
- uint32_t AddWASMModule(v8::WasmModuleObject::TransferrableModule&& mod);
|
||||
+ uint32_t AddWASMModule(v8::CompiledWasmModule&& mod);
|
||||
|
||||
// The MessagePorts that will be transferred, as recorded by Serialize().
|
||||
// Used for warning user about posting the target MessagePort to itself,
|
||||
@@ -77,7 +77,7 @@ class Message : public MemoryRetainer {
|
||||
std::vector<MallocedBuffer<char>> array_buffer_contents_;
|
||||
std::vector<SharedArrayBufferMetadataReference> shared_array_buffers_;
|
||||
std::vector<std::unique_ptr<MessagePortData>> message_ports_;
|
||||
- std::vector<v8::WasmModuleObject::TransferrableModule> wasm_modules_;
|
||||
+ std::vector<v8::CompiledWasmModule> wasm_modules_;
|
||||
|
||||
friend class MessagePort;
|
||||
};
|
|
@ -1,28 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Locascio <andy@slack-corp.com>
|
||||
Date: Thu, 9 Jan 2020 15:48:36 -0800
|
||||
Subject: remove deprecated task API override removed in latest v8
|
||||
|
||||
This is already present in Node.js v14 and can be removed when we upgrade.
|
||||
|
||||
CL: https://chromium-review.googlesource.com/c/v8/v8/+/1868620
|
||||
|
||||
diff --git a/src/node_platform.h b/src/node_platform.h
|
||||
index 533ae1bcca824837aca327d4ff8f122da12d94f0..3c855afeb4019adfb5389721357abe3cd620a01c 100644
|
||||
--- a/src/node_platform.h
|
||||
+++ b/src/node_platform.h
|
||||
@@ -148,14 +148,6 @@ class NodePlatform : public MultiIsolatePlatform {
|
||||
void CallOnWorkerThread(std::unique_ptr<v8::Task> task) override;
|
||||
void CallDelayedOnWorkerThread(std::unique_ptr<v8::Task> task,
|
||||
double delay_in_seconds) override;
|
||||
- void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override {
|
||||
- UNREACHABLE();
|
||||
- }
|
||||
- void CallDelayedOnForegroundThread(v8::Isolate* isolate,
|
||||
- v8::Task* task,
|
||||
- double delay_in_seconds) override {
|
||||
- UNREACHABLE();
|
||||
- }
|
||||
bool IdleTasksEnabled(v8::Isolate* isolate) override;
|
||||
double MonotonicallyIncreasingTime() override;
|
||||
double CurrentClockTimeMillis() override;
|
|
@ -1,36 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Sun, 1 Mar 2020 00:25:19 -0800
|
||||
Subject: Remove deprecated wasm module type check
|
||||
|
||||
The method was deprecated in favor of {IsWasmModuleObject}.
|
||||
https://chromium-review.googlesource.com/c/v8/v8/+/2033170
|
||||
|
||||
This is already present in Node.js v14 and can be removed when we upgrade.
|
||||
|
||||
diff --git a/src/node_types.cc b/src/node_types.cc
|
||||
index a53bcba555448fd99d582da7dc0c7af528627ca5..e816e0af54d1cf52f2af9ded49e25625b782d5be 100644
|
||||
--- a/src/node_types.cc
|
||||
+++ b/src/node_types.cc
|
||||
@@ -35,7 +35,7 @@ namespace {
|
||||
V(DataView) \
|
||||
V(SharedArrayBuffer) \
|
||||
V(Proxy) \
|
||||
- V(WebAssemblyCompiledModule) \
|
||||
+ V(WasmModuleObject) \
|
||||
V(ModuleNamespaceObject) \
|
||||
|
||||
|
||||
diff --git a/test/parallel/test-util-types.js b/test/parallel/test-util-types.js
|
||||
index 6a9bad016993339dccf8b90e1c0cf4e9d09adcc2..ddf1af8c9183dc61bac9a8bd662edec6459d253e 100644
|
||||
--- a/test/parallel/test-util-types.js
|
||||
+++ b/test/parallel/test-util-types.js
|
||||
@@ -50,7 +50,7 @@ for (const [ value, _method ] of [
|
||||
[ new DataView(new ArrayBuffer()) ],
|
||||
[ new SharedArrayBuffer() ],
|
||||
[ new Proxy({}, {}), 'isProxy' ],
|
||||
- [ new WebAssembly.Module(wasmBuffer), 'isWebAssemblyCompiledModule' ],
|
||||
+ [ new WebAssembly.Module(wasmBuffer), 'isWasmModuleObject' ],
|
||||
]) {
|
||||
const method = _method || `is${value.constructor.name}`;
|
||||
assert(method in types, `Missing ${method} for ${inspect(value)}`);
|
|
@ -1,34 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: John Kleinschmidt <jkleinsc@github.com>
|
||||
Date: Tue, 28 Jan 2020 12:12:28 -0500
|
||||
Subject: Remove serialization/deserialization of WasmModuleObject
|
||||
|
||||
This is already present in Node.js v14 and can be removed when we upgrade.
|
||||
|
||||
Serialization of WasmModuleObject was removed here:
|
||||
https://chromium.googlesource.com/v8/v8/+/30e4ba6df4cdf5582de4d79850bcd270e6a75a7a
|
||||
|
||||
diff --git a/test/parallel/test-v8-serdes.js b/test/parallel/test-v8-serdes.js
|
||||
index a992ba42ce46bfcdccdca997ee13718086d3256d..62096edec540ec3dd70e56fee53b9813b2ebbbfc 100644
|
||||
--- a/test/parallel/test-v8-serdes.js
|
||||
+++ b/test/parallel/test-v8-serdes.js
|
||||
@@ -23,8 +23,7 @@ const objects = [
|
||||
undefined,
|
||||
null,
|
||||
42,
|
||||
- circular,
|
||||
- wasmModule
|
||||
+ circular
|
||||
];
|
||||
|
||||
const hostObject = new (internalBinding('js_stream').JSStream)();
|
||||
@@ -236,9 +235,3 @@ const deserializerTypeError =
|
||||
/^TypeError: buffer must be a TypedArray or a DataView$/,
|
||||
);
|
||||
}
|
||||
-
|
||||
-{
|
||||
- const deserializedWasmModule = v8.deserialize(v8.serialize(wasmModule));
|
||||
- const instance = new WebAssembly.Instance(deserializedWasmModule);
|
||||
- assert.strictEqual(instance.exports.add(10, 20), 30);
|
||||
-}
|
|
@ -8,10 +8,10 @@ The BoringSSL incompatibilities (OPENSSL_memdup) will be shimmed in and this sho
|
|||
be removed when the associated update is rolled into Chromium.
|
||||
|
||||
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
|
||||
index 82afaee6e2b929faac76fc5d930a8c0fd6558df3..ce64dbca7ce6555bd37d3b6f85ecf41a98e3dd29 100644
|
||||
index fc780a4387c9a838a80b063276043f6087ce8259..43bdb88d48324cf8b206c711d3c3133f147aba24 100644
|
||||
--- a/src/node_crypto.cc
|
||||
+++ b/src/node_crypto.cc
|
||||
@@ -5014,18 +5014,6 @@ bool PublicKeyCipher::Cipher(Environment* env,
|
||||
@@ -5055,18 +5055,6 @@ bool PublicKeyCipher::Cipher(Environment* env,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
80
patches/node/test_make_some_tests_embedder_agnostic.patch
Normal file
80
patches/node/test_make_some_tests_embedder_agnostic.patch
Normal file
|
@ -0,0 +1,80 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 3 Sep 2020 13:35:35 -0700
|
||||
Subject: test: make some tests embedder agnostic
|
||||
|
||||
Make the .out checks process-agnostic.
|
||||
|
||||
Upstreamed at https://github.com/nodejs/node/pull/35040.
|
||||
|
||||
diff --git a/test/message/esm_loader_not_found.out b/test/message/esm_loader_not_found.out
|
||||
index 60abb529a3c87152087f4a2c52f79ac5dfdf7f25..26292512d9b00225100d2af91f0f7507072099e2 100644
|
||||
--- a/test/message/esm_loader_not_found.out
|
||||
+++ b/test/message/esm_loader_not_found.out
|
||||
@@ -1,5 +1,5 @@
|
||||
(node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
|
||||
-(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
+(Use `* --trace-warnings ...` to show where the warning was created)
|
||||
internal/process/esm_loader.js:*
|
||||
internalBinding('errors').triggerUncaughtException(
|
||||
^
|
||||
diff --git a/test/message/esm_loader_not_found_cjs_hint_relative.out b/test/message/esm_loader_not_found_cjs_hint_relative.out
|
||||
index f7460c31416dc97ca971d5a88cc8d424276f6d42..1c43c0d3a2eb31e31fbb2cf2496e2bd0ef3bea1d 100644
|
||||
--- a/test/message/esm_loader_not_found_cjs_hint_relative.out
|
||||
+++ b/test/message/esm_loader_not_found_cjs_hint_relative.out
|
||||
@@ -1,5 +1,5 @@
|
||||
(node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
|
||||
-(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
+(Use `* --trace-warnings ...` to show where the warning was created)
|
||||
internal/process/esm_loader.js:*
|
||||
internalBinding('errors').triggerUncaughtException(
|
||||
^
|
||||
diff --git a/test/message/esm_loader_syntax_error.out b/test/message/esm_loader_syntax_error.out
|
||||
index 6201de95208ff3e08c58cfe2cab5bcda2218fbf3..d6c6df0a338c848127ba0cfa11a98d13b0326848 100644
|
||||
--- a/test/message/esm_loader_syntax_error.out
|
||||
+++ b/test/message/esm_loader_syntax_error.out
|
||||
@@ -1,5 +1,5 @@
|
||||
(node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
|
||||
-(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
+(Use `* --trace-warnings ...` to show where the warning was created)
|
||||
file://*/test/fixtures/es-module-loaders/syntax-error.mjs:2
|
||||
await async () => 0;
|
||||
^^^^^^^^^^^^^
|
||||
diff --git a/test/message/promise_unhandled_warn_with_error.out b/test/message/promise_unhandled_warn_with_error.out
|
||||
index b539adb2d1e76931a41f73b606c6e1611b998883..66c98c57f71717046d26e6672897030dfd770da6 100644
|
||||
--- a/test/message/promise_unhandled_warn_with_error.out
|
||||
+++ b/test/message/promise_unhandled_warn_with_error.out
|
||||
@@ -6,5 +6,5 @@
|
||||
at *
|
||||
at *
|
||||
at *
|
||||
-(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
+(Use `* --trace-warnings ...` to show where the warning was created)
|
||||
*UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
|
||||
\ No newline at end of file
|
||||
diff --git a/test/pseudo-tty/test-tty-color-support-warning-2.out b/test/pseudo-tty/test-tty-color-support-warning-2.out
|
||||
index d17fa99b96974a54ad443a37b5f828fe7bd33152..37b470a5f108f9cffc8a08cfb15bf04bbea4d9d5 100644
|
||||
--- a/test/pseudo-tty/test-tty-color-support-warning-2.out
|
||||
+++ b/test/pseudo-tty/test-tty-color-support-warning-2.out
|
||||
@@ -1,3 +1,3 @@
|
||||
|
||||
(node:*) Warning: The 'NODE_DISABLE_COLORS' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
-(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
+(Use `* --trace-warnings ...` to show where the warning was created)
|
||||
diff --git a/test/pseudo-tty/test-tty-color-support-warning.out b/test/pseudo-tty/test-tty-color-support-warning.out
|
||||
index 7a9df4725486d28062ebbcfa4269bf543a051c00..b25d2e42cf7244a6513de2f29c2f647d91983782 100644
|
||||
--- a/test/pseudo-tty/test-tty-color-support-warning.out
|
||||
+++ b/test/pseudo-tty/test-tty-color-support-warning.out
|
||||
@@ -1,3 +1,3 @@
|
||||
|
||||
(node:*) Warning: The 'NODE_DISABLE_COLORS' and 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
-(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
+(Use `* --trace-warnings ...` to show where the warning was created)
|
||||
diff --git a/test/pseudo-tty/test-tty-color-support.out b/test/pseudo-tty/test-tty-color-support.out
|
||||
index 86ed488ee8c1b292c43434f869e19d190e19cf66..df5831c555be1914e28986df62bbb4421a29d68a 100644
|
||||
--- a/test/pseudo-tty/test-tty-color-support.out
|
||||
+++ b/test/pseudo-tty/test-tty-color-support.out
|
||||
@@ -1,2 +1,2 @@
|
||||
(node:*) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
-(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
+(Use `* --trace-warnings ...` to show where the warning was created)
|
|
@ -1,48 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Sun, 1 Mar 2020 13:59:57 -0800
|
||||
Subject: Rename FinalizationGroup to FinalizationRegistry for JS
|
||||
|
||||
https://chromium-review.googlesource.com/c/v8/v8/+/2071236
|
||||
|
||||
This is already present in Node.js v14 and can be removed when we upgrade.
|
||||
|
||||
diff --git a/test/parallel/test-finalization-group-error.js b/test/parallel/test-finalization-group-error.js
|
||||
index 0685811f55b7f8efc88e04ffd5e173ed7d415258..46a670073b1dbba9729e54166378991a7edba5a0 100644
|
||||
--- a/test/parallel/test-finalization-group-error.js
|
||||
+++ b/test/parallel/test-finalization-group-error.js
|
||||
@@ -5,7 +5,7 @@
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
-const g = new globalThis.FinalizationGroup(common.mustCallAtLeast(() => {
|
||||
+const g = new globalThis.FinalizationRegistry(common.mustCallAtLeast(() => {
|
||||
throw new Error('test');
|
||||
}, 1));
|
||||
g.register({}, 42);
|
||||
diff --git a/test/parallel/test-finalization-group-regular-gc.js b/test/parallel/test-finalization-group-regular-gc.js
|
||||
index 7a4a4797eadcf02867ad30c20b37060fa7abb5fb..3c16cfcee23e971fde8793a0478a819d3fc59d90 100644
|
||||
--- a/test/parallel/test-finalization-group-regular-gc.js
|
||||
+++ b/test/parallel/test-finalization-group-regular-gc.js
|
||||
@@ -7,7 +7,7 @@ const assert = require('assert');
|
||||
// GC (not global.gc()).
|
||||
|
||||
const start = Date.now();
|
||||
-const g = new globalThis.FinalizationGroup(() => {
|
||||
+const g = new globalThis.FinalizationRegistry(() => {
|
||||
const diff = Date.now() - start;
|
||||
assert(diff < 10000, `${diff} >= 10000`);
|
||||
});
|
||||
diff --git a/test/parallel/test-finalization-group.js b/test/parallel/test-finalization-group.js
|
||||
index 3e6b9d72e356480e2b78f0b336f252d0eec641d4..4b9357e4d18e6c21d53fc6534f5af1f98805b150 100644
|
||||
--- a/test/parallel/test-finalization-group.js
|
||||
+++ b/test/parallel/test-finalization-group.js
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
const common = require('../common');
|
||||
|
||||
-const g = new globalThis.FinalizationGroup(common.mustCallAtLeast(1));
|
||||
+const g = new globalThis.FinalizationRegistry(common.mustCallAtLeast(1));
|
||||
g.register({}, 42);
|
||||
|
||||
setTimeout(() => {
|
|
@ -1,33 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Sun, 12 Apr 2020 15:58:34 -0700
|
||||
Subject: Split out FinalizationRegistry#cleanupSome to a different flag
|
||||
|
||||
https://chromium-review.googlesource.com/c/v8/v8/+/2141011
|
||||
|
||||
This is already present in Node.js v14 and can be removed when we upgrade.
|
||||
|
||||
diff --git a/test/parallel/test-finalization-group-error.js b/test/parallel/test-finalization-group-error.js
|
||||
index 46a670073b1dbba9729e54166378991a7edba5a0..0857bedd043f0436bddc6d8641c51e78a8b4c562 100644
|
||||
--- a/test/parallel/test-finalization-group-error.js
|
||||
+++ b/test/parallel/test-finalization-group-error.js
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
-// Flags: --expose-gc --harmony-weak-refs
|
||||
+// Flags: --expose-gc --harmony-weak-refs-with-cleanup-some
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
diff --git a/test/parallel/test-finalization-group.js b/test/parallel/test-finalization-group.js
|
||||
index 4b9357e4d18e6c21d53fc6534f5af1f98805b150..95d36cd3506503b99d4b950b6b1caaf8be96b9e9 100644
|
||||
--- a/test/parallel/test-finalization-group.js
|
||||
+++ b/test/parallel/test-finalization-group.js
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
-// Flags: --expose-gc --harmony-weak-refs
|
||||
+// Flags: --expose-gc --harmony-weak-refs-with-cleanup-some
|
||||
|
||||
const common = require('../common');
|
||||
|
|
@ -101,7 +101,7 @@ ${target.dependencies.map(dep => ` "${dep}",`).join('\n')}
|
|||
`);
|
||||
};
|
||||
|
||||
if (process.mainModule === module) {
|
||||
if (require.main === module) {
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
"parallel/test-https-agent-session-reuse",
|
||||
"parallel/test-http2-reset-flood",
|
||||
"parallel/test-https-options-boolean-check",
|
||||
"parallel/test-inspector-inspect-brk-node",
|
||||
"parallel/test-inspector-multisession-ws",
|
||||
"parallel/test-inspector-port-zero-cluster",
|
||||
"parallel/test-inspector-tracing-domain",
|
||||
|
|
|
@ -198,12 +198,16 @@ int NodeMain(int argc, char* argv[]) {
|
|||
isolate_data = node::CreateIsolateData(isolate, loop, gin_env.platform());
|
||||
CHECK_NE(nullptr, isolate_data);
|
||||
|
||||
env = node::CreateEnvironment(isolate_data, gin_env.context(), argc, argv,
|
||||
exec_argc, exec_argv);
|
||||
CHECK_NE(nullptr, env);
|
||||
uint64_t flags = node::EnvironmentFlags::kDefaultFlags |
|
||||
node::EnvironmentFlags::kNoInitializeInspector;
|
||||
|
||||
// This needs to be called before the inspector is initialized.
|
||||
env->InitializeDiagnostics();
|
||||
std::vector<std::string> args(argv, argv + argc); // NOLINT
|
||||
std::vector<std::string> exec_args(exec_argv,
|
||||
exec_argv + exec_argc); // NOLINT
|
||||
env = node::CreateEnvironment(isolate_data, gin_env.context(), args,
|
||||
exec_args,
|
||||
(node::EnvironmentFlags::Flags)flags);
|
||||
CHECK_NE(nullptr, env);
|
||||
|
||||
node::IsolateSettings is;
|
||||
node::SetIsolateUpForNode(isolate, is);
|
||||
|
@ -285,10 +289,6 @@ int NodeMain(int argc, char* argv[]) {
|
|||
node::ResetStdio();
|
||||
|
||||
node::Stop(env);
|
||||
env->stop_sub_worker_contexts();
|
||||
env->RunCleanup();
|
||||
|
||||
node::RunAtExit(env);
|
||||
node::FreeEnvironment(env);
|
||||
node::FreeIsolateData(isolate_data);
|
||||
|
||||
|
|
|
@ -281,8 +281,6 @@ void JavascriptEnvironment::OnMessageLoopDestroying() {
|
|||
gin_helper::CleanedUpAtExit::DoCleanup();
|
||||
}
|
||||
base::CurrentThread::Get()->RemoveTaskObserver(microtasks_runner_.get());
|
||||
platform_->DrainTasks(isolate_);
|
||||
platform_->UnregisterIsolate(isolate_);
|
||||
}
|
||||
|
||||
NodeEnvironment::NodeEnvironment(node::Environment* env) : env_(env) {}
|
||||
|
|
|
@ -246,18 +246,6 @@ namespace electron {
|
|||
|
||||
namespace {
|
||||
|
||||
// Convert the given vector to an array of C-strings. The strings in the
|
||||
// returned vector are only guaranteed valid so long as the vector of strings
|
||||
// is not modified.
|
||||
std::unique_ptr<const char* []> StringVectorToArgArray(
|
||||
const std::vector<std::string>& vector) {
|
||||
std::unique_ptr<const char*[]> array(new const char*[vector.size()]);
|
||||
for (size_t i = 0; i < vector.size(); ++i) {
|
||||
array[i] = vector[i].c_str();
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
base::FilePath GetResourcesPath() {
|
||||
#if defined(OS_MAC)
|
||||
return MainApplicationBundlePath().Append("Contents").Append("Resources");
|
||||
|
@ -394,21 +382,28 @@ node::Environment* NodeBindings::CreateEnvironment(
|
|||
if (browser_env_ != BrowserEnvironment::BROWSER)
|
||||
global.Set("_noBrowserGlobals", true);
|
||||
|
||||
std::vector<std::string> exec_args;
|
||||
base::FilePath resources_path = GetResourcesPath();
|
||||
std::string init_script = "electron/js2c/" + process_type + "_init";
|
||||
|
||||
args.insert(args.begin() + 1, init_script);
|
||||
|
||||
std::unique_ptr<const char*[]> c_argv = StringVectorToArgArray(args);
|
||||
isolate_data_ =
|
||||
node::CreateIsolateData(context->GetIsolate(), uv_loop_, platform);
|
||||
|
||||
node::Environment* env;
|
||||
uint64_t flags = node::EnvironmentFlags::kDefaultFlags |
|
||||
node::EnvironmentFlags::kNoInitializeInspector;
|
||||
if (browser_env_ != BrowserEnvironment::BROWSER) {
|
||||
// Only one ESM loader can be registered per isolate -
|
||||
// in renderer processes this should be blink. We need to tell Node.js
|
||||
// not to register its handler (overriding blinks) in non-browser processes.
|
||||
flags |= node::EnvironmentFlags::kNoRegisterESMLoader;
|
||||
v8::TryCatch try_catch(context->GetIsolate());
|
||||
env = node::CreateEnvironment(isolate_data_, context, args.size(),
|
||||
c_argv.get(), 0, nullptr);
|
||||
env = node::CreateEnvironment(isolate_data_, context, args, exec_args,
|
||||
(node::EnvironmentFlags::Flags)flags);
|
||||
DCHECK(env);
|
||||
|
||||
// This will only be caught when something has gone terrible wrong as all
|
||||
// electron scripts are wrapped in a try {} catch {} in run-compiler.js
|
||||
if (try_catch.HasCaught()) {
|
||||
|
@ -416,8 +411,8 @@ node::Environment* NodeBindings::CreateEnvironment(
|
|||
<< process_type;
|
||||
}
|
||||
} else {
|
||||
env = node::CreateEnvironment(isolate_data_, context, args.size(),
|
||||
c_argv.get(), 0, nullptr);
|
||||
env = node::CreateEnvironment(isolate_data_, context, args, exec_args,
|
||||
(node::EnvironmentFlags::Flags)flags);
|
||||
DCHECK(env);
|
||||
}
|
||||
|
||||
|
@ -450,13 +445,10 @@ node::Environment* NodeBindings::CreateEnvironment(
|
|||
// We do not want to use the promise rejection callback that Node.js uses,
|
||||
// because it does not send PromiseRejectionEvents to the global script
|
||||
// context. We need to use the one Blink already provides.
|
||||
is.flags &=
|
||||
~node::IsolateSettingsFlags::SHOULD_SET_PROMISE_REJECTION_CALLBACK;
|
||||
is.flags |=
|
||||
node::IsolateSettingsFlags::SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK;
|
||||
}
|
||||
|
||||
// This needs to be called before the inspector is initialized.
|
||||
env->InitializeDiagnostics();
|
||||
|
||||
node::SetIsolateUpForNode(context->GetIsolate(), is);
|
||||
|
||||
gin_helper::Dictionary process(context->GetIsolate(), env->process_object());
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
|
||||
#undef debug_string // This is defined in macOS SDK in AssertMacros.h.
|
||||
#undef require_string // This is defined in macOS SDK in AssertMacros.h.
|
||||
|
||||
#include "env-inl.h"
|
||||
#include "env.h"
|
||||
#include "node.h"
|
||||
|
@ -67,6 +68,7 @@
|
|||
#include "node_options-inl.h"
|
||||
#include "node_options.h"
|
||||
#include "node_platform.h"
|
||||
#include "tracing/agent.h"
|
||||
|
||||
// Alternative to NODE_MODULE_CONTEXT_AWARE_X.
|
||||
// Allows to explicitly register builtin modules instead of using
|
||||
|
|
|
@ -178,7 +178,6 @@ void ElectronRendererClient::WillReleaseScriptContext(
|
|||
if (command_line->HasSwitch(switches::kNodeIntegrationInSubFrames) ||
|
||||
command_line->HasSwitch(
|
||||
switches::kDisableElectronSiteInstanceOverrides)) {
|
||||
node::RunAtExit(env);
|
||||
node::FreeEnvironment(env);
|
||||
if (env == node_bindings_->uv_env())
|
||||
node::FreeIsolateData(node_bindings_->isolate_data());
|
||||
|
|
|
@ -375,7 +375,7 @@ describe('contextBridge', () => {
|
|||
if (!useSandbox) {
|
||||
it('should release the global hold on methods sent across contexts', async () => {
|
||||
await makeBindingWindow(() => {
|
||||
require('electron').ipcRenderer.on('get-gc-info', e => e.sender.send('gc-info', { trackedValues: process._linkedBinding('electron_common_v8_util').getWeaklyTrackedValues().length }));
|
||||
require('electron').ipcRenderer.on('get-gc-info', (e: Electron.IpcRendererEvent) => e.sender.send('gc-info', { trackedValues: process._linkedBinding('electron_common_v8_util').getWeaklyTrackedValues().length }));
|
||||
const { weaklyTrackValue } = process._linkedBinding('electron_common_v8_util');
|
||||
contextBridge.exposeInMainWorld('example', {
|
||||
getFunction: () => () => 123,
|
||||
|
|
|
@ -285,7 +285,7 @@ describe('ipc module', () => {
|
|||
w.loadURL('about:blank');
|
||||
await w.webContents.executeJavaScript(`(${function () {
|
||||
const { ipcRenderer } = require('electron');
|
||||
ipcRenderer.on('port', (e) => {
|
||||
ipcRenderer.on('port', e => {
|
||||
const [port] = e.ports;
|
||||
port.start();
|
||||
(port as any).onclose = () => {
|
||||
|
@ -349,7 +349,7 @@ describe('ipc module', () => {
|
|||
w.loadURL('about:blank');
|
||||
await w.webContents.executeJavaScript(`(${function () {
|
||||
const { ipcRenderer } = require('electron');
|
||||
ipcRenderer.on('port', (ev) => {
|
||||
ipcRenderer.on('port', ev => {
|
||||
const [port] = ev.ports;
|
||||
port.onmessage = () => {
|
||||
ipcRenderer.send('done');
|
||||
|
@ -367,9 +367,9 @@ describe('ipc module', () => {
|
|||
w.loadURL('about:blank');
|
||||
await w.webContents.executeJavaScript(`(${function () {
|
||||
const { ipcRenderer } = require('electron');
|
||||
ipcRenderer.on('port', (e1) => {
|
||||
e1.ports[0].onmessage = (e2) => {
|
||||
e2.ports[0].onmessage = (e3) => {
|
||||
ipcRenderer.on('port', e1 => {
|
||||
e1.ports[0].onmessage = e2 => {
|
||||
e2.ports[0].onmessage = e3 => {
|
||||
ipcRenderer.send('done', e3.data);
|
||||
};
|
||||
};
|
||||
|
@ -455,7 +455,7 @@ describe('ipc module', () => {
|
|||
w.loadURL('about:blank');
|
||||
await w.webContents.executeJavaScript(`(${function () {
|
||||
const { ipcRenderer } = require('electron');
|
||||
ipcRenderer.on('foo', (e, msg) => {
|
||||
ipcRenderer.on('foo', (_e, msg) => {
|
||||
ipcRenderer.send('bar', msg);
|
||||
});
|
||||
}})()`);
|
||||
|
|
|
@ -498,11 +498,17 @@ ifdescribe(features.isRemoteModuleEnabled())('remote module', () => {
|
|||
|
||||
it('should search module from the user app', async () => {
|
||||
expectPathsEqual(
|
||||
path.normalize(await remotely(() => require('electron').remote.process.mainModule!.filename)),
|
||||
path.normalize(await remotely(() => {
|
||||
const { remote } = require('electron');
|
||||
return (remote as any).process.mainModule.filename;
|
||||
})),
|
||||
path.resolve(__dirname, 'index.js')
|
||||
);
|
||||
expectPathsEqual(
|
||||
path.normalize(await remotely(() => require('electron').remote.process.mainModule!.paths[0])),
|
||||
path.normalize(await remotely(() => {
|
||||
const { remote } = require('electron');
|
||||
return (remote as any).process.mainModule.paths[0];
|
||||
})),
|
||||
path.resolve(__dirname, 'node_modules')
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1068,21 +1068,19 @@ shell.writeShortcutLink('/home/user/Desktop/shortcut.lnk', 'update', shell.readS
|
|||
// cookies
|
||||
// https://github.com/electron/electron/blob/master/docs/api/cookies.md
|
||||
{
|
||||
const { session } = require('electron')
|
||||
|
||||
// Query all cookies.
|
||||
session.defaultSession.cookies.get({})
|
||||
.then((cookies) => {
|
||||
.then(cookies => {
|
||||
console.log(cookies)
|
||||
}).catch((error) => {
|
||||
}).catch((error: Error) => {
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
// Query all cookies associated with a specific url.
|
||||
session.defaultSession.cookies.get({ url: 'http://www.github.com' })
|
||||
.then((cookies) => {
|
||||
.then(cookies => {
|
||||
console.log(cookies)
|
||||
}).catch((error) => {
|
||||
}).catch((error: Error) => {
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
|
@ -1092,7 +1090,7 @@ shell.writeShortcutLink('/home/user/Desktop/shortcut.lnk', 'update', shell.readS
|
|||
session.defaultSession.cookies.set(cookie)
|
||||
.then(() => {
|
||||
// success
|
||||
}, (error) => {
|
||||
}, (error: Error) => {
|
||||
console.error(error)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
import {
|
||||
desktopCapturer,
|
||||
ipcRenderer,
|
||||
remote,
|
||||
webFrame,
|
||||
|
@ -33,16 +34,16 @@ remote.getCurrentWindow().on('close', () => {
|
|||
// blabla...
|
||||
})
|
||||
|
||||
remote.getCurrentWindow().capturePage().then(buf => {
|
||||
fs.writeFile('/tmp/screenshot.png', buf, err => {
|
||||
remote.getCurrentWindow().capturePage().then(image => {
|
||||
fs.writeFile('/tmp/screenshot.png', image.toBitmap(), err => {
|
||||
console.log(err)
|
||||
})
|
||||
})
|
||||
|
||||
remote.getCurrentWebContents().print()
|
||||
|
||||
remote.getCurrentWindow().capturePage().then(buf => {
|
||||
remote.require('fs').writeFile('/tmp/screenshot.png', buf, (err: Error) => {
|
||||
remote.getCurrentWindow().capturePage().then(image => {
|
||||
remote.require('fs').writeFile('/tmp/screenshot.png', image.toBitmap(), (err: Error) => {
|
||||
console.log(err)
|
||||
})
|
||||
})
|
||||
|
@ -107,8 +108,6 @@ crashReporter.start({
|
|||
// desktopCapturer
|
||||
// https://github.com/electron/electron/blob/master/docs/api/desktop-capturer.md
|
||||
|
||||
const desktopCapturer = require('electron').desktopCapturer
|
||||
|
||||
desktopCapturer.getSources({ types: ['window', 'screen'] }).then(sources => {
|
||||
for (let i = 0; i < sources.length; ++i) {
|
||||
if (sources[i].name == 'Electron') {
|
||||
|
|
16
yarn.lock
16
yarn.lock
|
@ -33,10 +33,10 @@
|
|||
ora "^4.0.3"
|
||||
pretty-ms "^5.1.0"
|
||||
|
||||
"@electron/typescript-definitions@^8.7.8":
|
||||
version "8.7.8"
|
||||
resolved "https://registry.yarnpkg.com/@electron/typescript-definitions/-/typescript-definitions-8.7.8.tgz#31d5c79889bc0671fb2c3452cb061682f595f9be"
|
||||
integrity sha512-B5fG7X1IZU4R20fGpZFLqfNTMJIDrprBAkYYlRzMTGgI74hMxVdcS1HU1eCGRiJISe/pznUS0QYJa7BpuYx+cA==
|
||||
"@electron/typescript-definitions@^8.7.9":
|
||||
version "8.7.9"
|
||||
resolved "https://registry.yarnpkg.com/@electron/typescript-definitions/-/typescript-definitions-8.7.9.tgz#6fe8856341e9ff77af803a9094be92759518c926"
|
||||
integrity sha512-fiJr1KDR1auWTBfggMTRK/ouhHZV2iVumitkkNIA7NKONlVPLtcYf6/JgkWDla+y4CUTzM7M7R5AVSE0f/RuYA==
|
||||
dependencies:
|
||||
"@types/node" "^11.13.7"
|
||||
chalk "^2.4.2"
|
||||
|
@ -347,10 +347,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.13.22.tgz#91ee88ebfa25072433497f6f3150f84fa8c3a91b"
|
||||
integrity sha512-rOsaPRUGTOXbRBOKToy4cgZXY4Y+QSVhxcLwdEveozbk7yuudhWMpxxcaXqYizLMP3VY7OcWCFtx9lGFh5j5kg==
|
||||
|
||||
"@types/node@^12.12.6":
|
||||
version "12.12.30"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.30.tgz#3501e6f09b954de9c404671cefdbcc5d9d7c45f6"
|
||||
integrity sha512-sz9MF/zk6qVr3pAnM0BSQvYIBK44tS75QC5N+VbWSE4DjCV/pJ+UzCW/F+vVnl7TkOPcuwQureKNtSSwjBTaMg==
|
||||
"@types/node@^14.6.2":
|
||||
version "14.6.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.6.3.tgz#cc4f979548ca4d8e7b90bc0180052ab99ee64224"
|
||||
integrity sha512-pC/hkcREG6YfDfui1FBmj8e20jFU5Exjw4NYDm8kEdrW+mOh0T1Zve8DWKnS7ZIZvgncrctcNCXF4Q2I+loyww==
|
||||
|
||||
"@types/normalize-package-data@^2.4.0":
|
||||
version "2.4.0"
|
||||
|
|
Loading…
Reference in a new issue