mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
Compare commits
8 Commits
refactor/a
...
v40.0.0-al
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1265eccf43 | ||
|
|
23792bc7ed | ||
|
|
4138dfeb19 | ||
|
|
709a9f5f20 | ||
|
|
a2bb5069a5 | ||
|
|
2b99c7645d | ||
|
|
3c8714a940 | ||
|
|
a01b4becfa |
4
DEPS
4
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'143.0.7497.0',
|
||||
'144.0.7500.0',
|
||||
'node_version':
|
||||
'v22.20.0',
|
||||
'v24.11.0',
|
||||
'nan_version':
|
||||
'675cefebca42410733da8a454c8d9391fcebfbc2',
|
||||
'squirrel.mac_version':
|
||||
|
||||
@@ -75,3 +75,6 @@ enable_linux_installer = false
|
||||
|
||||
# Disable "Save to Drive" feature in PDF viewer
|
||||
enable_pdf_save_to_drive = false
|
||||
|
||||
# Explictly disable use_reclient until reclient is completely removed
|
||||
use_reclient = false
|
||||
|
||||
@@ -41,7 +41,7 @@ webContents.setWindowOpenHandler((details) => {
|
||||
|
||||
When using shared texture offscreen rendering feature, the `paint` event now emits a more structured object.
|
||||
It moves the `sharedTextureHandle`, `planes`, `modifier` into a unified `handle` property.
|
||||
See [here](https://www.electronjs.org/docs/latest/api/structures/offscreen-shared-texture) for more details.
|
||||
See the [OffscreenSharedTexture](./api/structures/offscreen-shared-texture.md) API structure for more details.
|
||||
|
||||
## Planned Breaking API Changes (38.0)
|
||||
|
||||
|
||||
@@ -46,11 +46,11 @@ Menu.prototype._isCommandIdEnabled = function (id) {
|
||||
};
|
||||
|
||||
Menu.prototype._shouldCommandIdWorkWhenHidden = function (id) {
|
||||
return this.commandsMap[id] ? !!this.commandsMap[id].acceleratorWorksWhenHidden : false;
|
||||
return this.commandsMap[id]?.acceleratorWorksWhenHidden ?? false;
|
||||
};
|
||||
|
||||
Menu.prototype._isCommandIdVisible = function (id) {
|
||||
return this.commandsMap[id] ? this.commandsMap[id].visible : false;
|
||||
return this.commandsMap[id]?.visible ?? false;
|
||||
};
|
||||
|
||||
Menu.prototype._getAcceleratorForCommandId = function (id, useDefaultAccelerator) {
|
||||
@@ -61,12 +61,12 @@ Menu.prototype._getAcceleratorForCommandId = function (id, useDefaultAccelerator
|
||||
};
|
||||
|
||||
Menu.prototype._shouldRegisterAcceleratorForCommandId = function (id) {
|
||||
return this.commandsMap[id] ? this.commandsMap[id].registerAccelerator : false;
|
||||
return this.commandsMap[id]?.registerAccelerator ?? false;
|
||||
};
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
Menu.prototype._getSharingItemForCommandId = function (id) {
|
||||
return this.commandsMap[id] ? this.commandsMap[id].sharingItem : null;
|
||||
return this.commandsMap[id]?.sharingItem ?? null;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,10 @@ export function fetchWithSession (input: RequestInfo, init: (RequestInit & {bypa
|
||||
p.reject(err);
|
||||
});
|
||||
|
||||
if (!req.body?.pipeTo(Writable.toWeb(r as unknown as Writable)).then(() => r.end())) { r.end(); }
|
||||
// pipeTo expects a WritableStream<Uint8Array>. Node.js' Writable.toWeb returns WritableStream<any>,
|
||||
// which causes a TS structural mismatch.
|
||||
const writable = Writable.toWeb(r as unknown as Writable) as unknown as WritableStream<Uint8Array>;
|
||||
if (!req.body?.pipeTo(writable).then(() => r.end())) { r.end(); }
|
||||
|
||||
return p.promise;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import { createReadStream } from 'fs';
|
||||
import { Readable } from 'stream';
|
||||
import { ReadableStream } from 'stream/web';
|
||||
|
||||
import type { ReadableStreamDefaultReader } from 'stream/web';
|
||||
|
||||
// Global protocol APIs.
|
||||
const { registerSchemesAsPrivileged, getStandardSchemes, Protocol } = process._linkedBinding('electron_browser_protocol');
|
||||
|
||||
@@ -12,7 +14,7 @@ const ERR_UNEXPECTED = -9;
|
||||
|
||||
const isBuiltInScheme = (scheme: string) => ['http', 'https', 'file'].includes(scheme);
|
||||
|
||||
function makeStreamFromPipe (pipe: any): ReadableStream {
|
||||
function makeStreamFromPipe (pipe: any): ReadableStream<Uint8Array> {
|
||||
const buf = new Uint8Array(1024 * 1024 /* 1 MB */);
|
||||
return new ReadableStream({
|
||||
async pull (controller) {
|
||||
@@ -38,21 +40,26 @@ function makeStreamFromFileInfo ({
|
||||
filePath: string;
|
||||
offset?: number;
|
||||
length?: number;
|
||||
}): ReadableStream {
|
||||
}): ReadableStream<Uint8Array> {
|
||||
// Node's Readable.toWeb produces a WHATWG ReadableStream whose chunks are Uint8Array.
|
||||
return Readable.toWeb(createReadStream(filePath, {
|
||||
start: offset,
|
||||
end: length >= 0 ? offset + length : undefined
|
||||
}));
|
||||
})) as ReadableStream<Uint8Array>;
|
||||
}
|
||||
|
||||
function convertToRequestBody (uploadData: ProtocolRequest['uploadData']): RequestInit['body'] {
|
||||
if (!uploadData) return null;
|
||||
// Optimization: skip creating a stream if the request is just a single buffer.
|
||||
if (uploadData.length === 1 && (uploadData[0] as any).type === 'rawData') return uploadData[0].bytes;
|
||||
if (uploadData.length === 1 && (uploadData[0] as any).type === 'rawData') {
|
||||
return uploadData[0].bytes as any;
|
||||
}
|
||||
|
||||
const chunks = [...uploadData] as any[]; // TODO: types are wrong
|
||||
let current: ReadableStreamDefaultReader | null = null;
|
||||
return new ReadableStream({
|
||||
const chunks = [...uploadData] as any[]; // TODO: refine ProtocolRequest types
|
||||
// Use Node's web stream types explicitly to avoid DOM lib vs Node lib structural mismatches.
|
||||
// Generic <Uint8Array> ensures reader.read() returns value?: Uint8Array consistent with enqueue.
|
||||
let current: ReadableStreamDefaultReader<Uint8Array> | null = null;
|
||||
return new ReadableStream<Uint8Array>({
|
||||
async pull (controller) {
|
||||
if (current) {
|
||||
const { done, value } = await current.read();
|
||||
@@ -67,7 +74,7 @@ function convertToRequestBody (uploadData: ProtocolRequest['uploadData']): Reque
|
||||
if (!chunks.length) { return controller.close(); }
|
||||
const chunk = chunks.shift()!;
|
||||
if (chunk.type === 'rawData') {
|
||||
controller.enqueue(chunk.bytes);
|
||||
controller.enqueue(chunk.bytes as Uint8Array);
|
||||
} else if (chunk.type === 'file') {
|
||||
current = makeStreamFromFileInfo(chunk).getReader();
|
||||
return this.pull!(controller);
|
||||
|
||||
@@ -40,7 +40,7 @@ process.on('uncaughtException', function (error) {
|
||||
// Emit 'exit' event on quit.
|
||||
const { app } = require('electron');
|
||||
|
||||
app.on('quit', (_event, exitCode) => {
|
||||
app.on('quit', (_event: any, exitCode: number) => {
|
||||
process.emit('exit', exitCode);
|
||||
});
|
||||
|
||||
|
||||
@@ -746,7 +746,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
|
||||
context.readdirResults.push(dirent);
|
||||
if (dirent!.isDirectory() || stat === 1) {
|
||||
context.pathsQueue.push(path.join(dirent!.path, dirent!.name));
|
||||
context.pathsQueue.push(path.join(dirent!.parentPath, dirent!.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron/get": "^2.0.0",
|
||||
"@types/node": "^22.7.7",
|
||||
"@types/node": "^24.9.0",
|
||||
"extract-zip": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"@octokit/rest": "^20.1.2",
|
||||
"@primer/octicons": "^10.0.0",
|
||||
"@types/minimist": "^1.2.5",
|
||||
"@types/node": "^22.7.7",
|
||||
"@types/node": "^24.9.0",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/stream-json": "^1.7.8",
|
||||
"@types/temp": "^0.9.4",
|
||||
|
||||
@@ -143,3 +143,4 @@ expose_referrerscriptinfo_hostdefinedoptionsindex.patch
|
||||
chore_disable_protocol_handler_dcheck.patch
|
||||
fix_check_for_file_existence_before_setting_mtime.patch
|
||||
revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch
|
||||
fix_release_mouse_buttons_on_focus_loss_on_wayland.patch
|
||||
|
||||
@@ -7,10 +7,10 @@ Ensure that licenses for the dependencies introduced by Electron
|
||||
are included in `LICENSES.chromium.html`
|
||||
|
||||
diff --git a/tools/licenses/licenses.py b/tools/licenses/licenses.py
|
||||
index 833a80f1387c64eec418b57d74373dd93130a9dc..a85714b903fc934593258192bc61d72cc557615b 100755
|
||||
index 514be069768cc1bbd39f2b261cefb1a9f267f89f..0a1ab64914cfaa087e4000fb81bfafd18aa1b98b 100755
|
||||
--- a/tools/licenses/licenses.py
|
||||
+++ b/tools/licenses/licenses.py
|
||||
@@ -356,6 +356,31 @@ SPECIAL_CASES = {
|
||||
@@ -357,6 +357,31 @@ SPECIAL_CASES = {
|
||||
"License": "Apache 2.0",
|
||||
"License File": ["//third_party/sample3/the_license"],
|
||||
},
|
||||
|
||||
@@ -49,7 +49,7 @@ index cdb5b9246087b5678cf6a0f2713f6238dafc13de..7efbe7524c5ddd3785fff0e2d8901f93
|
||||
// its owning reference back to our owning LocalFrame.
|
||||
client_->Detached(type);
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
index 0b8972e0ab8ff854fc169b39d762790299f7bf9c..fdbafb9177d345181339fcdf2d95aebbd8665a49 100644
|
||||
index ad61f3b044e8ce7591cfe7484af8e3b0c7705673..f42b5f8c7676cda5d73ee035e18165acabb186f3 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
@@ -747,10 +747,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
|
||||
@@ -10,10 +10,10 @@ Needed for:
|
||||
2) //electron/shell/common:web_contents_utility
|
||||
|
||||
diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn
|
||||
index b6511498e08e6d0a280b89175fcfdb61c7e40df4..e214d7ea5e7108baf9f9910d6b44deff587914c2 100644
|
||||
index e463b4c63105d021da2467844c8371eec6b8a836..bd81d75d735f997bf6aa9133e142b50759084b47 100644
|
||||
--- a/content/public/common/BUILD.gn
|
||||
+++ b/content/public/common/BUILD.gn
|
||||
@@ -370,6 +370,8 @@ mojom("interfaces") {
|
||||
@@ -371,6 +371,8 @@ mojom("interfaces") {
|
||||
"//content/common/*",
|
||||
"//extensions/common:mojom",
|
||||
"//extensions/common:mojom_blink",
|
||||
|
||||
@@ -33,10 +33,10 @@ index c51468e6fdb46634b5458b387d1c78caf2dd083f..7236611d2a392008f43b1b83ae125e94
|
||||
"//base",
|
||||
"//build:branding_buildflags",
|
||||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||||
index 03b7e243f304528ed12fcb0194f084bb4475d3a6..5ae8aaea4939b6a5500f487fa79c6352ffd6d173 100644
|
||||
index cc003098ca1338334bce844d3e82351b573a3b93..ddd737d756776d2200da89924699de5087fe768d 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -4823,7 +4823,7 @@ static_library("browser") {
|
||||
@@ -4833,7 +4833,7 @@ static_library("browser") {
|
||||
]
|
||||
}
|
||||
|
||||
@@ -46,10 +46,10 @@ index 03b7e243f304528ed12fcb0194f084bb4475d3a6..5ae8aaea4939b6a5500f487fa79c6352
|
||||
# than here in :chrome_dll.
|
||||
deps += [ "//chrome:packed_resources_integrity_header" ]
|
||||
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
|
||||
index 870557c8f7edb33c6373d59ffa9e87483262ca27..0e7ce248a0af7b9062ae258613474f859a3e153c 100644
|
||||
index 206d205405b06766859abf4f13eb7b65e81667f6..c4138e4c1a03ec6f23a91d19155a70af433a4a89 100644
|
||||
--- a/chrome/test/BUILD.gn
|
||||
+++ b/chrome/test/BUILD.gn
|
||||
@@ -7583,9 +7583,12 @@ test("unit_tests") {
|
||||
@@ -7587,9 +7587,12 @@ test("unit_tests") {
|
||||
"//chrome/notification_helper",
|
||||
]
|
||||
|
||||
@@ -63,7 +63,7 @@ index 870557c8f7edb33c6373d59ffa9e87483262ca27..0e7ce248a0af7b9062ae258613474f85
|
||||
"//chrome//services/util_win:unit_tests",
|
||||
"//chrome/app:chrome_dll_resources",
|
||||
"//chrome/app:win_unit_tests",
|
||||
@@ -8521,6 +8524,10 @@ test("unit_tests") {
|
||||
@@ -8530,6 +8533,10 @@ test("unit_tests") {
|
||||
"../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc",
|
||||
]
|
||||
|
||||
@@ -74,7 +74,7 @@ index 870557c8f7edb33c6373d59ffa9e87483262ca27..0e7ce248a0af7b9062ae258613474f85
|
||||
sources += [
|
||||
# The importer code is not used on Android.
|
||||
"../common/importer/firefox_importer_utils_unittest.cc",
|
||||
@@ -8577,7 +8584,6 @@ test("unit_tests") {
|
||||
@@ -8586,7 +8593,6 @@ test("unit_tests") {
|
||||
# TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above?
|
||||
deps += [
|
||||
"../browser/screen_ai:screen_ai_install_state",
|
||||
|
||||
@@ -9,10 +9,10 @@ potentially prevent a window from being created.
|
||||
TODO(loc): this patch is currently broken.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index c6addeca2a539557c4b6bbb1c20e9904c64525f5..c50cceaf899308e126844e986abc4e01bc7497bb 100644
|
||||
index ce1e5c65773a1967bcaa31e5b2572d4e7fa8b148..9d54e7e7ccabad6dfcdc54214683df8b3b414208 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -9848,6 +9848,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -9953,6 +9953,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
last_committed_origin_, params->window_container_type,
|
||||
params->target_url, params->referrer.To<Referrer>(),
|
||||
params->frame_name, params->disposition, *params->features,
|
||||
|
||||
@@ -66,10 +66,10 @@ index 32dfed04e2fd7cd2e60c7cf145d182f4163feb68..c44c488ef90f4ceaada28666f80a5919
|
||||
void DidChangeScrollOffset() override;
|
||||
blink::WebMediaStreamDeviceObserver* MediaStreamDeviceObserver() override;
|
||||
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc
|
||||
index bf221ce102ea9ca25655f14a7cd90c625799d4b0..c4d81b211016616f6cbbdfcfae6620d4931ce775 100644
|
||||
index 37691ecee7a72b2ec47ff575239f628116cf136b..c67e3faf7440514e203e5b15a68fc34525a045a2 100644
|
||||
--- a/content/renderer/service_worker/service_worker_context_client.cc
|
||||
+++ b/content/renderer/service_worker/service_worker_context_client.cc
|
||||
@@ -322,6 +322,7 @@ void ServiceWorkerContextClient::WorkerContextStarted(
|
||||
@@ -318,6 +318,7 @@ void ServiceWorkerContextClient::WorkerContextStarted(
|
||||
}
|
||||
|
||||
void ServiceWorkerContextClient::WillEvaluateScript(
|
||||
@@ -77,7 +77,7 @@ index bf221ce102ea9ca25655f14a7cd90c625799d4b0..c4d81b211016616f6cbbdfcfae6620d4
|
||||
v8::Local<v8::Context> v8_context) {
|
||||
DCHECK(worker_task_runner_->RunsTasksInCurrentSequence());
|
||||
start_timing_->script_evaluation_start_time = base::TimeTicks::Now();
|
||||
@@ -340,8 +341,8 @@ void ServiceWorkerContextClient::WillEvaluateScript(
|
||||
@@ -336,8 +337,8 @@ void ServiceWorkerContextClient::WillEvaluateScript(
|
||||
|
||||
DCHECK(proxy_);
|
||||
GetContentClient()->renderer()->WillEvaluateServiceWorkerOnWorkerThread(
|
||||
@@ -89,10 +89,10 @@ index bf221ce102ea9ca25655f14a7cd90c625799d4b0..c4d81b211016616f6cbbdfcfae6620d4
|
||||
|
||||
void ServiceWorkerContextClient::DidEvaluateScript(bool success) {
|
||||
diff --git a/content/renderer/service_worker/service_worker_context_client.h b/content/renderer/service_worker/service_worker_context_client.h
|
||||
index 2f3ba35491d17aa76f9baf8ba1cd53680a923654..477c6ac5a77c69cc4f062366c52adff3a36bdc76 100644
|
||||
index 1f5e24bc38d6ced52e4773236522e9520efc6f6d..a22ca5968fce5e6a0c436ec9b40f0e2f7c1482cf 100644
|
||||
--- a/content/renderer/service_worker/service_worker_context_client.h
|
||||
+++ b/content/renderer/service_worker/service_worker_context_client.h
|
||||
@@ -168,7 +168,8 @@ class ServiceWorkerContextClient
|
||||
@@ -165,7 +165,8 @@ class ServiceWorkerContextClient
|
||||
void WorkerContextStarted(
|
||||
blink::WebServiceWorkerContextProxy* proxy,
|
||||
scoped_refptr<base::SequencedTaskRunner> worker_task_runner) override;
|
||||
|
||||
@@ -10,7 +10,7 @@ Subject: chore: "grandfather in" Electron Views and Delegates
|
||||
6448510: Lock further access to View::set_owned_by_client(). | https://chromium-review.googlesource.com/c/chromium/src/+/6448510
|
||||
|
||||
diff --git a/ui/views/view.h b/ui/views/view.h
|
||||
index 4fada89e37b9c63f7690fbbdd2ef4ecf86b5d756..73dd5aa59d8d1bb05aaed080e27426cc58da2d61 100644
|
||||
index a34494ddd3daf79d12596c56e752692ace0d1ab2..fd4b87226a364b1104b25379f2d87ebeefbb6927 100644
|
||||
--- a/ui/views/view.h
|
||||
+++ b/ui/views/view.h
|
||||
@@ -81,6 +81,19 @@ class ArcNotificationContentView;
|
||||
|
||||
@@ -80,10 +80,10 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params,
|
||||
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
|
||||
index 7477bbc1a4e6ccb536d2c63ffe7c2b0982a5d298..5bfbf89e19e9c35c942b856276b35707a75fc0ef 100644
|
||||
index e550b21eba674396ba97b9ec21535964502d1b36..24e13b4f6ab01bdbefba791002edb0a4faf4811a 100644
|
||||
--- a/chrome/browser/ui/browser.cc
|
||||
+++ b/chrome/browser/ui/browser.cc
|
||||
@@ -2366,7 +2366,8 @@ bool Browser::IsWebContentsCreationOverridden(
|
||||
@@ -2369,7 +2369,8 @@ bool Browser::IsWebContentsCreationOverridden(
|
||||
content::mojom::WindowContainerType window_container_type,
|
||||
const GURL& opener_url,
|
||||
const std::string& frame_name,
|
||||
@@ -93,7 +93,7 @@ index 7477bbc1a4e6ccb536d2c63ffe7c2b0982a5d298..5bfbf89e19e9c35c942b856276b35707
|
||||
if (HasActorTask(profile(), opener)) {
|
||||
// If an ExecutionEngine is acting on the opener, prevent it from creating a
|
||||
// new WebContents. We'll instead force the navigation to happen in the same
|
||||
@@ -2379,7 +2380,7 @@ bool Browser::IsWebContentsCreationOverridden(
|
||||
@@ -2382,7 +2383,7 @@ bool Browser::IsWebContentsCreationOverridden(
|
||||
return (window_container_type ==
|
||||
content::mojom::WindowContainerType::BACKGROUND &&
|
||||
ShouldCreateBackgroundContents(source_site_instance, opener_url,
|
||||
@@ -103,7 +103,7 @@ index 7477bbc1a4e6ccb536d2c63ffe7c2b0982a5d298..5bfbf89e19e9c35c942b856276b35707
|
||||
|
||||
WebContents* Browser::CreateCustomWebContents(
|
||||
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
|
||||
index 5eb967dec8c8ec8b8959b361438807a987011d04..784c2ad55d22bc82b5e629f364561d3f49c00887 100644
|
||||
index e0d63627518a5e0e1bdef510f3c0d849db4cc0d8..a052d78b6578a1e1fab88e1acafff77e5871c335 100644
|
||||
--- a/chrome/browser/ui/browser.h
|
||||
+++ b/chrome/browser/ui/browser.h
|
||||
@@ -935,8 +935,7 @@ class Browser : public TabStripModelObserver,
|
||||
|
||||
@@ -8,10 +8,10 @@ Allow registering custom protocols to handle service worker main script fetching
|
||||
Refs https://bugs.chromium.org/p/chromium/issues/detail?id=996511
|
||||
|
||||
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc
|
||||
index cdd2f243082290767abbee39b4e80a67c705a789..7168d496663675455b417f709339aab08aabc9f0 100644
|
||||
index cb60c976d469958b6d7dbd69dddc91866744c429..88f1cbc3bc7f3efaae01c88c17fa467175d4f8ea 100644
|
||||
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
|
||||
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
|
||||
@@ -1972,6 +1972,26 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
@@ -1957,6 +1957,26 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
loader_factory_bundle_info =
|
||||
context()->loader_factory_bundle_for_update_check()->Clone();
|
||||
|
||||
@@ -38,7 +38,7 @@ index cdd2f243082290767abbee39b4e80a67c705a789..7168d496663675455b417f709339aab0
|
||||
if (auto* config = content::WebUIConfigMap::GetInstance().GetConfig(
|
||||
browser_context(), scope)) {
|
||||
// If this is a Service Worker for a WebUI, the WebUI's URLDataSource
|
||||
@@ -1991,9 +2011,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
@@ -1976,9 +1996,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
features::kEnableServiceWorkersForChromeScheme) &&
|
||||
scope.scheme() == kChromeUIScheme) {
|
||||
config->RegisterURLDataSource(browser_context());
|
||||
@@ -49,7 +49,7 @@ index cdd2f243082290767abbee39b4e80a67c705a789..7168d496663675455b417f709339aab0
|
||||
.emplace(kChromeUIScheme, CreateWebUIServiceWorkerLoaderFactory(
|
||||
browser_context(), kChromeUIScheme,
|
||||
base::flat_set<std::string>()));
|
||||
@@ -2001,9 +2019,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
@@ -1986,9 +2004,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
features::kEnableServiceWorkersForChromeUntrusted) &&
|
||||
scope.scheme() == kChromeUIUntrustedScheme) {
|
||||
config->RegisterURLDataSource(browser_context());
|
||||
|
||||
@@ -33,10 +33,10 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4
|
||||
|
||||
} // namespace net
|
||||
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
|
||||
index cf1cee2251d8ba88535acc1e41cf82986b62f259..27c1a38d0f1b06cbc0722f2067fe39a4f86f0903 100644
|
||||
index 3598823a6400c4e5045621950433d2688cfbba89..66379714141b83a2ded90f88ce8b89bf900ca5a6 100644
|
||||
--- a/services/network/network_context.cc
|
||||
+++ b/services/network/network_context.cc
|
||||
@@ -1910,6 +1910,13 @@ void NetworkContext::EnableDurableMessageCollector(
|
||||
@@ -1911,6 +1911,13 @@ void NetworkContext::EnableDurableMessageCollector(
|
||||
it->second->AddReceiver(std::move(receiver));
|
||||
}
|
||||
|
||||
@@ -63,10 +63,10 @@ index 90cf1a70c068771ac98b2d5a283cba5e54c05ff4..0dc8de8d4e37e48cb28d8112c0233ac8
|
||||
void SetEnableReferrers(bool enable_referrers) override;
|
||||
#if BUILDFLAG(IS_CT_SUPPORTED)
|
||||
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
|
||||
index 00374e2ad12939733983fc6ea4643ff72134942a..ed149b049cb837adb17dfbd302f3ccc597c85fba 100644
|
||||
index 434cd63a228ddbdf2efffc0c6a17ab6376beb19d..75d2ad3ccdf4408a2c40c042be60ebd75c320b90 100644
|
||||
--- a/services/network/public/mojom/network_context.mojom
|
||||
+++ b/services/network/public/mojom/network_context.mojom
|
||||
@@ -1353,6 +1353,9 @@ interface NetworkContext {
|
||||
@@ -1357,6 +1357,9 @@ interface NetworkContext {
|
||||
mojo_base.mojom.UnguessableToken throttling_profile_id,
|
||||
pending_receiver<DurableMessageCollector> receiver);
|
||||
|
||||
|
||||
@@ -405,7 +405,7 @@ index 70a23343d5815db0722e2977d966219b824a83b1..85ac45c1868832c47460108f93d86a51
|
||||
std::vector<std::string> extension_schemes;
|
||||
// Registers a URL scheme with a predefined default custom handler.
|
||||
diff --git a/url/url_util.cc b/url/url_util.cc
|
||||
index 5f45b59482b66aad4e8ab08cae9f3eef3f4e6fa7..88512b7dc2c04364af76182a42c414212a46cd58 100644
|
||||
index 90c06884c9c7e91a706d58917b38c0919e546c1b..f3aa192ac229423fa0b9c8caa8f7b1df18cc45ec 100644
|
||||
--- a/url/url_util.cc
|
||||
+++ b/url/url_util.cc
|
||||
@@ -136,6 +136,9 @@ struct SchemeRegistry {
|
||||
@@ -418,7 +418,7 @@ index 5f45b59482b66aad4e8ab08cae9f3eef3f4e6fa7..88512b7dc2c04364af76182a42c41421
|
||||
// Schemes with a predefined default custom handler.
|
||||
std::vector<SchemeWithHandler> predefined_handler_schemes;
|
||||
|
||||
@@ -679,6 +682,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() {
|
||||
@@ -677,6 +680,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() {
|
||||
return GetSchemeRegistry().empty_document_schemes;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ making three primary changes to Blink:
|
||||
* Controls whether the CSS rule is available.
|
||||
|
||||
diff --git a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom
|
||||
index 5e04647ae947613138ca3e803a5bac34acf9672f..edfdb10888b4c8efb63e6713f04858d35050112a 100644
|
||||
index cd3f33a59c40705ee5aa0869c298dc11b3caac21..803212c1b7662f9b78f4e1f7a61acec129f54280 100644
|
||||
--- a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom
|
||||
+++ b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom
|
||||
@@ -48,6 +48,7 @@ enum CSSSampleId {
|
||||
@@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca
|
||||
'internal-forced-visited-'):
|
||||
internal_visited_order = 0
|
||||
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5
|
||||
index 8ea9539c27b3c565efb05b8da39fcead8e4c2ee3..27346b484d7d6e78e3eea36bc9b1f819b98892cd 100644
|
||||
index 9bf6537f620594d6fe1e14e2ef32bc20b6127b3d..e90341e484c40df23974c17de8f5212b0de26029 100644
|
||||
--- a/third_party/blink/renderer/core/css/css_properties.json5
|
||||
+++ b/third_party/blink/renderer/core/css/css_properties.json5
|
||||
@@ -9049,6 +9049,26 @@
|
||||
@@ -9057,6 +9057,26 @@
|
||||
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
|
||||
},
|
||||
|
||||
@@ -76,7 +76,7 @@ index 8ea9539c27b3c565efb05b8da39fcead8e4c2ee3..27346b484d7d6e78e3eea36bc9b1f819
|
||||
{
|
||||
name: "-internal-visited-color",
|
||||
diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc
|
||||
index f4806d8ea97785e8450ba7d08da45108702c4217..71398ba97655c1a96633a8be2c0387604bfabf9d 100644
|
||||
index 64a361128ec56be0382c72ef40db1bd01cb8d9a0..1dc51536f5860448dda9adc2b1129f53efbbd595 100644
|
||||
--- a/third_party/blink/renderer/core/css/css_property_equality.cc
|
||||
+++ b/third_party/blink/renderer/core/css/css_property_equality.cc
|
||||
@@ -354,6 +354,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property,
|
||||
@@ -89,10 +89,10 @@ index f4806d8ea97785e8450ba7d08da45108702c4217..71398ba97655c1a96633a8be2c038760
|
||||
return a.EmptyCells() == b.EmptyCells();
|
||||
case CSSPropertyID::kFill:
|
||||
diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
|
||||
index 56d4ea1c4c27062adb90754d75d3595a0fb71a9e..40b786c32a0c21ff31886a1fc8b6d7b2cfff2e91 100644
|
||||
index c818580d191226b88dbac41d4eabbabf0b6035d9..c91591362e5b5fce9a383c07270f3c5e62771fe2 100644
|
||||
--- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
|
||||
+++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
|
||||
@@ -12500,5 +12500,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue(
|
||||
@@ -12521,5 +12521,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue(
|
||||
CSSValueID::kNone>(stream);
|
||||
}
|
||||
|
||||
@@ -130,10 +130,10 @@ index 56d4ea1c4c27062adb90754d75d3595a0fb71a9e..40b786c32a0c21ff31886a1fc8b6d7b2
|
||||
} // namespace css_longhand
|
||||
} // namespace blink
|
||||
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
|
||||
index b2cfcac17cac610bf2f686ded14e6cfe3b7023a9..81e98f83c0387a4c527e3d46361fcfe4c9791e9c 100644
|
||||
index 4c4a4ca1c5d0d9ebfc361323bf932b2c36de9c49..e350bb786146ade7991422fc8f8c640daa7ea2a8 100644
|
||||
--- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
|
||||
+++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
|
||||
@@ -4122,6 +4122,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback(
|
||||
@@ -4119,6 +4119,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback(
|
||||
return PositionTryFallback(scoped_name, tactic_list);
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560
|
||||
|
||||
auto DrawAsSinglePath = [&]() {
|
||||
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
index 1ce3037cb0f173c192707de4e36b92bd733a89c0..195d4430d824d815b7de7799842c6e53b6a997aa 100644
|
||||
index 43474abcc45706874b4d2733bff468b2b79f5d0f..e8e341a58cb86526361d57c5d4753f76bfac5de6 100644
|
||||
--- a/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
+++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
@@ -214,6 +214,10 @@
|
||||
|
||||
@@ -180,7 +180,7 @@ index 07502f4ff2afd53a43d8f0ab68d4c4c39f6c0737..20d51f86d5084edf0b05ce0ab11fcd12
|
||||
HWND child_hwnd;
|
||||
auto device = CreateSoftwareOutputDeviceWin(
|
||||
diff --git a/components/viz/service/display_embedder/output_surface_provider_impl.h b/components/viz/service/display_embedder/output_surface_provider_impl.h
|
||||
index e4b46a79560e7698a6400b2ab8a57f38205a8718..3cb2518c6644cf0618f625d981befd466a3dfb2c 100644
|
||||
index f49bbc5d568f0cb323a22997a949e2cae8f35d59..c0154ee828e67b197eb2ddb1abf04c0aede0d264 100644
|
||||
--- a/components/viz/service/display_embedder/output_surface_provider_impl.h
|
||||
+++ b/components/viz/service/display_embedder/output_surface_provider_impl.h
|
||||
@@ -54,7 +54,8 @@ class VIZ_SERVICE_EXPORT OutputSurfaceProviderImpl
|
||||
|
||||
@@ -20,7 +20,7 @@ This patch will be removed when the deprecated sync api support is
|
||||
removed.
|
||||
|
||||
diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc
|
||||
index fc516272be02a3dac1086e4aaf2015dc946cc3c2..86b8df2b23dc975a6db87f04005cb105054305b0 100644
|
||||
index c9b607c9bd09d43099a1704d5d4139c64e4beac4..18ad7ed73b0ed4de158519c01342f0bfd7cc3666 100644
|
||||
--- a/components/permissions/permission_util.cc
|
||||
+++ b/components/permissions/permission_util.cc
|
||||
@@ -536,6 +536,7 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe(
|
||||
|
||||
@@ -16,7 +16,7 @@ Linux or Windows to un-fullscreen in some circumstances without this
|
||||
change.
|
||||
|
||||
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
|
||||
index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0669f2517 100644
|
||||
index 3d17e79f291e6d3925d29cf349c30b4f7c7a6f54..a7494e62a6a49a71e5aef2c8abb4ec29426a5d23 100644
|
||||
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
|
||||
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
|
||||
@@ -47,7 +47,7 @@
|
||||
@@ -37,7 +37,7 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0
|
||||
if (!popunder_preventer_) {
|
||||
popunder_preventer_ = std::make_unique<PopunderPreventer>(web_contents);
|
||||
} else {
|
||||
@@ -317,12 +317,14 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
|
||||
@@ -326,12 +326,14 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
|
||||
void FullscreenController::FullscreenTabOpeningPopup(
|
||||
content::WebContents* opener,
|
||||
content::WebContents* popup) {
|
||||
@@ -52,7 +52,7 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0
|
||||
}
|
||||
#endif // !BUILDFLAG(IS_ANDROID)
|
||||
|
||||
@@ -406,8 +408,7 @@ void FullscreenController::FullscreenTransitionCompleted() {
|
||||
@@ -415,8 +417,7 @@ void FullscreenController::FullscreenTransitionCompleted() {
|
||||
#endif // DCHECK_IS_ON()
|
||||
tab_fullscreen_target_display_id_ = display::kInvalidDisplayId;
|
||||
started_fullscreen_transition_ = false;
|
||||
@@ -62,7 +62,7 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0
|
||||
if (!IsTabFullscreen()) {
|
||||
// Activate any popup windows created while content fullscreen, after exit.
|
||||
popunder_preventer_.reset();
|
||||
@@ -543,18 +544,17 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
@@ -552,19 +553,18 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
// Do not enter fullscreen mode if disallowed by pref. This prevents the user
|
||||
// from manually entering fullscreen mode and also disables kiosk mode on
|
||||
// desktop platforms.
|
||||
@@ -76,6 +76,7 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0
|
||||
return;
|
||||
- }
|
||||
#endif
|
||||
fullscreen_parameters_ = fullscreen_tab_params;
|
||||
started_fullscreen_transition_ = true;
|
||||
toggled_into_fullscreen_ = true;
|
||||
+#if 0
|
||||
@@ -86,7 +87,7 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0
|
||||
if (option == TAB) {
|
||||
origin = GetRequestingOrigin();
|
||||
tab_fullscreen_ = true;
|
||||
@@ -592,6 +592,7 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
@@ -602,6 +602,7 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
origin = url::Origin::Create(extension_url_.value());
|
||||
}
|
||||
}
|
||||
@@ -94,7 +95,7 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0
|
||||
|
||||
fullscreen_start_time_ = base::TimeTicks::Now();
|
||||
if (option == BROWSER) {
|
||||
@@ -613,6 +614,7 @@ void FullscreenController::ExitFullscreenModeInternal() {
|
||||
@@ -623,6 +624,7 @@ void FullscreenController::ExitFullscreenModeInternal() {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,12 +103,13 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0
|
||||
// `fullscreen_start_time_` is null if a fullscreen tab moves to a new window.
|
||||
if (fullscreen_start_time_ && exclusive_access_tab()) {
|
||||
ukm::SourceId source_id =
|
||||
@@ -624,18 +626,19 @@ void FullscreenController::ExitFullscreenModeInternal() {
|
||||
@@ -634,19 +636,20 @@ void FullscreenController::ExitFullscreenModeInternal() {
|
||||
.Record(ukm::UkmRecorder::Get());
|
||||
fullscreen_start_time_.reset();
|
||||
}
|
||||
+#endif
|
||||
|
||||
fullscreen_parameters_.reset();
|
||||
toggled_into_fullscreen_ = false;
|
||||
started_fullscreen_transition_ = true;
|
||||
-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID)
|
||||
@@ -126,12 +128,12 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0
|
||||
extension_url_.reset();
|
||||
exclusive_access_manager()->UpdateBubble(base::NullCallback());
|
||||
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.h b/chrome/browser/ui/exclusive_access/fullscreen_controller.h
|
||||
index f9e3ec3c61e0c9f16b13e2ee5fd447e26b49a6da..e06b1fb4a0c256c0f51ff66d06663af46c9c88ae 100644
|
||||
index e80fa0ad07db3b670812b7b8b4fe09e1986933be..f86bd0cbfe79462617ed191b616cb5b6237c5ce8 100644
|
||||
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller.h
|
||||
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.h
|
||||
@@ -256,7 +256,7 @@ class FullscreenController : public ExclusiveAccessControllerBase {
|
||||
// Used in testing to set the state to tab fullscreen.
|
||||
bool is_tab_fullscreen_for_testing_ = false;
|
||||
@@ -261,7 +261,7 @@ class FullscreenController : public ExclusiveAccessControllerBase {
|
||||
// Set of parameters used to enter fullscreen
|
||||
std::optional<FullscreenTabParams> fullscreen_parameters_;
|
||||
|
||||
-#if !BUILDFLAG(IS_ANDROID)
|
||||
+#if 0
|
||||
|
||||
@@ -8,7 +8,7 @@ Check for broken links by confirming the file exists before setting its utime.
|
||||
This patch should be upstreamed & removed.
|
||||
|
||||
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
|
||||
index bcf4c9b192234aa1d470662e4036ac7a23ce2262..724ccef88dc6d798bb948d3fc89a84640d863174 100755
|
||||
index f2a9172815d80e6a9a70d7775eec6fdddd925461..54f78924eb09abf19d19c698e4c37f5ec3dc8249 100755
|
||||
--- a/tools/clang/scripts/update.py
|
||||
+++ b/tools/clang/scripts/update.py
|
||||
@@ -201,10 +201,9 @@ def DownloadAndUnpack(url, output_dir, path_prefixes=None, is_known_zip=False):
|
||||
|
||||
@@ -28,10 +28,10 @@ The patch should be removed in favor of either:
|
||||
Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397.
|
||||
|
||||
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
|
||||
index 5f6fb36d9302e557ff56f770ff70b091ade0f53a..81e91f51d119b2e02f432c2e7ae81f6d118811b3 100644
|
||||
index 3624c9c96f3ac526e99fb09c378144439c707442..fd818f40e9c3e1efe15dcbb369270a27e2f50483 100644
|
||||
--- a/content/browser/renderer_host/navigation_request.cc
|
||||
+++ b/content/browser/renderer_host/navigation_request.cc
|
||||
@@ -11454,6 +11454,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() {
|
||||
@@ -11466,6 +11466,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() {
|
||||
target_rph_id);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: fix: export zlib symbols
|
||||
This patch sets ZLIB_DLL so that we properly export zlib symbols.
|
||||
|
||||
diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn
|
||||
index 3d0735452a66d4213d1c4cf7c36cd36b3bf1c6f8..3dc1b24fe5f25b0a8b00d1a7918f518f0bad091d 100644
|
||||
index afd3e8cc0f38e95b3b04835b46bd1197a63b4ed1..652fa32d49de9f0c73777c0d4d99421f52e16b38 100644
|
||||
--- a/third_party/zlib/BUILD.gn
|
||||
+++ b/third_party/zlib/BUILD.gn
|
||||
@@ -333,6 +333,10 @@ component("zlib") {
|
||||
|
||||
@@ -56,7 +56,7 @@ index cecf528475cb832ed1876381878eade582bc83d6..71308b2d963c2d083328aad6be356dc5
|
||||
|
||||
enum EmbedderDataTag : uint16_t {
|
||||
diff --git a/third_party/blink/renderer/platform/bindings/script_state.cc b/third_party/blink/renderer/platform/bindings/script_state.cc
|
||||
index 7c602990a3f9a3083308d282fe79bf858b642cdf..f8ee61b8b2a45371d259717215a1fb4511514567 100644
|
||||
index 8b6522c9299bef5ab766795b64a1ba30bc382a12..54d981405df5edab4695dfd01bb6a7b7dd8b7b3a 100644
|
||||
--- a/third_party/blink/renderer/platform/bindings/script_state.cc
|
||||
+++ b/third_party/blink/renderer/platform/bindings/script_state.cc
|
||||
@@ -14,6 +14,12 @@ namespace blink {
|
||||
@@ -72,7 +72,7 @@ index 7c602990a3f9a3083308d282fe79bf858b642cdf..f8ee61b8b2a45371d259717215a1fb45
|
||||
// static
|
||||
void ScriptState::SetCreateCallback(CreateCallback create_callback) {
|
||||
DCHECK(create_callback);
|
||||
@@ -39,6 +45,10 @@ ScriptState::ScriptState(v8::Local<v8::Context> context,
|
||||
@@ -40,6 +46,10 @@ ScriptState::ScriptState(v8::Local<v8::Context> context,
|
||||
context_.SetWeak(this, &OnV8ContextCollectedCallback);
|
||||
context->SetAlignedPointerInEmbedderData(kV8ContextPerContextDataIndex, this,
|
||||
gin::kBlinkScriptState);
|
||||
@@ -83,7 +83,7 @@ index 7c602990a3f9a3083308d282fe79bf858b642cdf..f8ee61b8b2a45371d259717215a1fb45
|
||||
RendererResourceCoordinator::Get()->OnScriptStateCreated(this,
|
||||
execution_context);
|
||||
}
|
||||
@@ -82,6 +92,10 @@ void ScriptState::DissociateContext() {
|
||||
@@ -83,6 +93,10 @@ void ScriptState::DissociateContext() {
|
||||
// Cut the reference from V8 context to ScriptState.
|
||||
GetContext()->SetAlignedPointerInEmbedderData(
|
||||
kV8ContextPerContextDataIndex, nullptr, gin::kBlinkScriptState);
|
||||
@@ -95,7 +95,7 @@ index 7c602990a3f9a3083308d282fe79bf858b642cdf..f8ee61b8b2a45371d259717215a1fb45
|
||||
|
||||
// Cut the reference from ScriptState to V8 context.
|
||||
diff --git a/third_party/blink/renderer/platform/bindings/script_state.h b/third_party/blink/renderer/platform/bindings/script_state.h
|
||||
index f06885f429a395b5c2eb55c89803837b550d765c..1d64099b32c2a9a0d68e8b5317d17e13789dc299 100644
|
||||
index 5ccdf26cead17031d510589b74288cbe79692779..0bc2fdbf8e70d53a49794defe8b4a3d1d5a501cd 100644
|
||||
--- a/third_party/blink/renderer/platform/bindings/script_state.h
|
||||
+++ b/third_party/blink/renderer/platform/bindings/script_state.h
|
||||
@@ -6,6 +6,7 @@
|
||||
@@ -122,7 +122,7 @@ index f06885f429a395b5c2eb55c89803837b550d765c..1d64099b32c2a9a0d68e8b5317d17e13
|
||||
ScriptState* script_state =
|
||||
static_cast<ScriptState*>(context->GetAlignedPointerFromEmbedderData(
|
||||
isolate, kV8ContextPerContextDataIndex, gin::kBlinkScriptState));
|
||||
@@ -267,6 +277,14 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> {
|
||||
@@ -270,6 +280,14 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> {
|
||||
static_cast<int>(gin::kPerContextDataStartIndex) +
|
||||
static_cast<int>(gin::kEmbedderBlink);
|
||||
|
||||
|
||||
@@ -83,10 +83,10 @@ index de8cfaabed0e4ed3db9b55729f7ea22014f63dd2..45df203c236ed0f36f079ad0dcbe98e9
|
||||
|
||||
PictureInPictureOcclusionTracker*
|
||||
diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
|
||||
index f737adbdc968e659cf5ba59e6cd5fd5fa093edff..0c9d713a51a15abdec331f8991bfa6222984afec 100644
|
||||
index c204274499a520aeeb2aaaad12e4aafd43738d23..56afbbf55148b5077253c0189bf6444c2daaf7ba 100644
|
||||
--- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
|
||||
@@ -474,11 +474,13 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create(
|
||||
@@ -476,11 +476,13 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create(
|
||||
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mitchell COhen <mitch.cohen@me.com>
|
||||
Date: Sun, 2 Nov 2025 15:30:56 -0500
|
||||
Subject: fix: release mouse buttons on focus loss on Wayland
|
||||
|
||||
Fixes an issue where the mouse flags would get stuck if you right-click
|
||||
the CSD titlebar in Wayland.
|
||||
|
||||
Bug: 455147429
|
||||
Change-Id: I9f5a9f395b3c1d85094a40a92d40691a897dbd05
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7091872
|
||||
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
|
||||
Reviewed-by: Kramer Ge <fangzhoug@chromium.org>
|
||||
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1538048}
|
||||
|
||||
diff --git a/ui/ozone/platform/wayland/host/wayland_event_source.cc b/ui/ozone/platform/wayland/host/wayland_event_source.cc
|
||||
index 4cc15e842b633e93f1d6654225765769eb75fffd..4e421ccbd36d4efebd43c9def5b575b7d8d5e336 100644
|
||||
--- a/ui/ozone/platform/wayland/host/wayland_event_source.cc
|
||||
+++ b/ui/ozone/platform/wayland/host/wayland_event_source.cc
|
||||
@@ -336,6 +336,13 @@ void WaylandEventSource::OnPointerFocusChanged(
|
||||
// Save new pointer location.
|
||||
pointer_location_ = location;
|
||||
window_manager_->SetPointerFocusedWindow(window);
|
||||
+ } else {
|
||||
+ // The compositor may swallow the release event for any buttons that are
|
||||
+ // pressed when the window loses focus, e.g. when right-clicking the
|
||||
+ // titlebar to open the system menu on GNOME.
|
||||
+ if (!connection_->IsDragInProgress()) {
|
||||
+ ReleasePressedPointerButtons(window, ui::EventTimeForNow());
|
||||
+ }
|
||||
}
|
||||
|
||||
auto closure = focused ? base::NullCallback()
|
||||
@@ -59,10 +59,10 @@ index cba373664bec3a32abad6fe0396bd67b53b7e67f..a54f1b3351efd2d8f324436f7f35cd43
|
||||
|
||||
#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
index fdbafb9177d345181339fcdf2d95aebbd8665a49..56472f526e751790d9163a3445d5ac15b86e187d 100644
|
||||
index f42b5f8c7676cda5d73ee035e18165acabb186f3..7ff305ce80f243ce4ab0844321644908ab6addb9 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
@@ -3188,6 +3188,7 @@ void LocalFrame::RequestExecuteScript(
|
||||
@@ -3190,6 +3190,7 @@ void LocalFrame::RequestExecuteScript(
|
||||
mojom::blink::EvaluationTiming evaluation_timing,
|
||||
mojom::blink::LoadEventBlockingOption blocking_option,
|
||||
WebScriptExecutionCallback callback,
|
||||
@@ -70,7 +70,7 @@ index fdbafb9177d345181339fcdf2d95aebbd8665a49..56472f526e751790d9163a3445d5ac15
|
||||
BackForwardCacheAware back_forward_cache_aware,
|
||||
mojom::blink::WantResultOption want_result_option,
|
||||
mojom::blink::PromiseResultOption promise_behavior) {
|
||||
@@ -3245,7 +3246,7 @@ void LocalFrame::RequestExecuteScript(
|
||||
@@ -3247,7 +3248,7 @@ void LocalFrame::RequestExecuteScript(
|
||||
PausableScriptExecutor::CreateAndRun(
|
||||
script_state, std::move(script_sources), execute_script_policy,
|
||||
user_gesture, evaluation_timing, blocking_option, want_result_option,
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: fix: select the first menu item when opened via keyboard
|
||||
This fixes an accessibility issue where the root view is 'focused' to the screen reader instead of the first menu item as with all other native menus. This patch will be upstreamed.
|
||||
|
||||
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
|
||||
index 2b537c6e6e3db1b7512bf41dbb0a44df752aeada..6b06366c31906c71d266966414d75534b10a875b 100644
|
||||
index 4fd9d4eb67842ac4232d1fe4cbb3da60c2d8c9bb..750e8886015692287bc7fa045b40c5a030cf886b 100644
|
||||
--- a/ui/views/controls/menu/menu_controller.cc
|
||||
+++ b/ui/views/controls/menu/menu_controller.cc
|
||||
@@ -713,6 +713,16 @@ void MenuController::Run(Widget* parent,
|
||||
@@ -26,7 +26,7 @@ index 2b537c6e6e3db1b7512bf41dbb0a44df752aeada..6b06366c31906c71d266966414d75534
|
||||
if (button_controller) {
|
||||
pressed_lock_ = button_controller->TakeLock(
|
||||
false, ui::LocatedEvent::FromIfValid(event));
|
||||
@@ -2475,18 +2485,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) {
|
||||
@@ -2480,18 +2490,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) {
|
||||
}
|
||||
item->GetSubmenu()->ShowAt(params);
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: frame_host_manager.patch
|
||||
Allows embedder to intercept site instances created by chromium.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc
|
||||
index b95cedc2e178a743830b395e9bb62ef7d3ddf8d2..1f08d28a7be70d4e730ef29e46c7d093d7f765fc 100644
|
||||
index 53bbf0174048d62b252b797b06695e6290273e80..4350b57ebf424e392c54dd2b54e62690527ca9b6 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_manager.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_manager.cc
|
||||
@@ -4806,6 +4806,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
|
||||
@@ -4809,6 +4809,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
|
||||
request->ResetStateForSiteInstanceChange();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch
|
||||
Add electron resources file to the list of resource ids generation.
|
||||
|
||||
diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec
|
||||
index 647916bff39218a0a9711405f7b98eb9b4d6f821..0d3455c124c260cb0e7c313e1e923276598781db 100644
|
||||
index aeb9f8b8eaf68c076348278f6a8b394cae2ef827..edfddee6f923b86fae535dbde1ce886b61c5510f 100644
|
||||
--- a/tools/gritsettings/resource_ids.spec
|
||||
+++ b/tools/gritsettings/resource_ids.spec
|
||||
@@ -1595,6 +1595,11 @@
|
||||
@@ -1597,6 +1597,11 @@
|
||||
"messages": [10120],
|
||||
},
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ system font by checking if it's kCTFontPriorityAttribute is set to
|
||||
system priority.
|
||||
|
||||
diff --git a/base/BUILD.gn b/base/BUILD.gn
|
||||
index 2edc8252e3e83ab0238383091ebea5a21df3186f..3bbea6f7c13914e8f6e791cd77cab82b1eed51dd 100644
|
||||
index 7aa2eeb7769e7be0d58f03d35445e3b5564e2718..af777c45221b5db1b2f5699101ad61eed99fc40e 100644
|
||||
--- a/base/BUILD.gn
|
||||
+++ b/base/BUILD.gn
|
||||
@@ -1069,6 +1069,7 @@ component("base") {
|
||||
@@ -581,7 +581,7 @@ index e51fd827f7afc01a5189737f86a2414627a6546e..bb50f03ba5622c2bfb96bc75d145f471
|
||||
return kAttributes;
|
||||
}
|
||||
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
|
||||
index 9b0fea4c6ff8f43c695c437b5c295fcd41326d40..adf889c805e177d8d09700aa9d7f5ff2306b6826 100644
|
||||
index 4c555d3c077216fd25d45b5f9727ff3e20b80e83..648cfefa2cdf87524dc4bb12f8d8b37419921ef9 100644
|
||||
--- a/content/browser/BUILD.gn
|
||||
+++ b/content/browser/BUILD.gn
|
||||
@@ -344,6 +344,7 @@ source_set("browser") {
|
||||
@@ -702,10 +702,10 @@ index ea86cb14edf163b02a2b0fda0ab3fb6245edd717..9a507a70493e5a648a25968f917a7829
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
|
||||
index 19c948e949386a1678767cbc606304e65400c507..9394e841d84593ea846b785cffe2ab06efffd7d1 100644
|
||||
index f57ce1a0430df7692be55685e79121ed604daf2a..3fbc26fb179a64a2f1eab027a05b16241c185b28 100644
|
||||
--- a/content/common/BUILD.gn
|
||||
+++ b/content/common/BUILD.gn
|
||||
@@ -274,6 +274,7 @@ source_set("common") {
|
||||
@@ -273,6 +273,7 @@ source_set("common") {
|
||||
"//ui/shell_dialogs",
|
||||
"//url",
|
||||
"//url/ipc:url_ipc",
|
||||
@@ -796,7 +796,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe
|
||||
|
||||
} // namespace content
|
||||
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
|
||||
index dfd3674692bc984821b52f1d410c1fa2ca56c42e..25dd06214e3aea73ebe556f9b8498ef8a63e42d6 100644
|
||||
index 25638e35e38d59adb261185e1387256ba16fc9bd..2b2f7e003bacea00a1421ce3bedf71747b567928 100644
|
||||
--- a/content/test/BUILD.gn
|
||||
+++ b/content/test/BUILD.gn
|
||||
@@ -703,6 +703,7 @@ static_library("test_support") {
|
||||
@@ -1395,7 +1395,7 @@ index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..9921ccb10d3455600eddd85f77f10228
|
||||
|
||||
} // namespace sandbox
|
||||
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn
|
||||
index ac8db428b19dc3d442dc668b4e601d56f7b48c61..c6dfcdb6ac8ccc145eaad4087677add1afb217e1 100644
|
||||
index e54ba53ed4866e568ae5c2dfe65e72adfe253e03..07d046634534efb28ee4584dd1b11678f7473e8f 100644
|
||||
--- a/third_party/blink/renderer/core/BUILD.gn
|
||||
+++ b/third_party/blink/renderer/core/BUILD.gn
|
||||
@@ -428,6 +428,7 @@ component("core") {
|
||||
@@ -1407,7 +1407,7 @@ index ac8db428b19dc3d442dc668b4e601d56f7b48c61..c6dfcdb6ac8ccc145eaad4087677add1
|
||||
|
||||
if (is_mac) {
|
||||
diff --git a/third_party/blink/renderer/core/editing/build.gni b/third_party/blink/renderer/core/editing/build.gni
|
||||
index c771cee7be34f36521de34ef893ee578b648a8c8..b0bd447b848bfdb7a9ff9cd98ba95574cb846cc2 100644
|
||||
index 4f04476e9175bae9e89eb9ea4316bffe49a9eb91..e77615c7b26518f4930ac1b004b413173fa0f46b 100644
|
||||
--- a/third_party/blink/renderer/core/editing/build.gni
|
||||
+++ b/third_party/blink/renderer/core/editing/build.gni
|
||||
@@ -362,10 +362,14 @@ blink_core_sources_editing = [
|
||||
|
||||
@@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement
|
||||
session.setCertificateVerifyCallback.
|
||||
|
||||
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
|
||||
index ecff85f3bdb1eb56f76bf71b2d365bba2c42a415..cf1cee2251d8ba88535acc1e41cf82986b62f259 100644
|
||||
index 71cef856b5d4311124bc8bf30bf6c0f73b990b13..3598823a6400c4e5045621950433d2688cfbba89 100644
|
||||
--- a/services/network/network_context.cc
|
||||
+++ b/services/network/network_context.cc
|
||||
@@ -166,6 +166,11 @@
|
||||
@@ -134,7 +134,7 @@ index ecff85f3bdb1eb56f76bf71b2d365bba2c42a415..cf1cee2251d8ba88535acc1e41cf8298
|
||||
constexpr uint32_t NetworkContext::kMaxOutstandingRequestsPerProcess;
|
||||
|
||||
NetworkContext::NetworkContextHttpAuthPreferences::
|
||||
@@ -1021,6 +1131,13 @@ void NetworkContext::SetClient(
|
||||
@@ -1022,6 +1132,13 @@ void NetworkContext::SetClient(
|
||||
client_.Bind(std::move(client));
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ index ecff85f3bdb1eb56f76bf71b2d365bba2c42a415..cf1cee2251d8ba88535acc1e41cf8298
|
||||
void NetworkContext::CreateURLLoaderFactory(
|
||||
mojo::PendingReceiver<mojom::URLLoaderFactory> receiver,
|
||||
mojom::URLLoaderFactoryParamsPtr params) {
|
||||
@@ -2688,6 +2805,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
|
||||
@@ -2689,6 +2806,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
|
||||
cert_verifier = std::make_unique<net::CachingCertVerifier>(
|
||||
std::make_unique<net::CoalescingCertVerifier>(
|
||||
std::move(cert_verifier)));
|
||||
@@ -190,7 +190,7 @@ index 3795ce4def719c36e1dace911be53b0103aeafc5..90cf1a70c068771ac98b2d5a283cba5e
|
||||
std::unique_ptr<HostResolver> internal_host_resolver_;
|
||||
std::set<std::unique_ptr<HostResolver>, base::UniquePtrComparator>
|
||||
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
|
||||
index 2d27a56d773140749469444af635b11d302793c1..00374e2ad12939733983fc6ea4643ff72134942a 100644
|
||||
index f6f90744b2faab08fd44f7b0ecc9c271abf62813..434cd63a228ddbdf2efffc0c6a17ab6376beb19d 100644
|
||||
--- a/services/network/public/mojom/network_context.mojom
|
||||
+++ b/services/network/public/mojom/network_context.mojom
|
||||
@@ -316,6 +316,17 @@ struct SocketBrokerRemotes {
|
||||
@@ -211,7 +211,7 @@ index 2d27a56d773140749469444af635b11d302793c1..00374e2ad12939733983fc6ea4643ff7
|
||||
// Parameters for constructing a network context.
|
||||
struct NetworkContextParams {
|
||||
// The user agent string.
|
||||
@@ -1009,6 +1020,9 @@ interface NetworkContext {
|
||||
@@ -1013,6 +1024,9 @@ interface NetworkContext {
|
||||
// Sets a client for this network context.
|
||||
SetClient(pending_remote<NetworkContextClient> client);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ index 85df555841ac0d32d2f097547c9991cecf0f4b1a..7a108339448fad3105e87c9d9af678c2
|
||||
ui::ImageModel::FromVectorIcon(*icon, kColorPipWindowForeground,
|
||||
kCloseButtonIconSize));
|
||||
diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
|
||||
index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5fa093edff 100644
|
||||
index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..c204274499a520aeeb2aaaad12e4aafd43738d23 100644
|
||||
--- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
|
||||
@@ -18,12 +18,16 @@
|
||||
@@ -58,7 +58,18 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5f
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
#include "chrome/browser/ui/views/overlay/back_to_tab_button.h"
|
||||
#include "chrome/browser/ui/views/overlay/back_to_tab_label_button.h"
|
||||
@@ -79,7 +83,7 @@
|
||||
@@ -32,8 +36,10 @@
|
||||
#include "chrome/browser/ui/views/overlay/hang_up_button.h"
|
||||
#include "chrome/browser/ui/views/overlay/minimize_button.h"
|
||||
#include "chrome/browser/ui/views/overlay/overlay_controls_fade_animation.h"
|
||||
+#if 0
|
||||
#include "chrome/browser/ui/views/overlay/overlay_window_live_caption_button.h"
|
||||
#include "chrome/browser/ui/views/overlay/overlay_window_live_caption_dialog.h"
|
||||
+#endif
|
||||
#include "chrome/browser/ui/views/overlay/playback_image_button.h"
|
||||
#include "chrome/browser/ui/views/overlay/resize_handle_button.h"
|
||||
#include "chrome/browser/ui/views/overlay/simple_overlay_window_image_button.h"
|
||||
@@ -79,7 +85,7 @@
|
||||
#include "ui/aura/window.h"
|
||||
#endif
|
||||
|
||||
@@ -67,7 +78,7 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5f
|
||||
#include "chrome/browser/shell_integration_win.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "ui/aura/window.h"
|
||||
@@ -434,7 +438,7 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create(
|
||||
@@ -434,7 +440,7 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create(
|
||||
overlay_window->Init(std::move(params));
|
||||
overlay_window->OnRootViewReady();
|
||||
|
||||
@@ -76,13 +87,43 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5f
|
||||
std::wstring app_user_model_id;
|
||||
Browser* browser = chrome::FindBrowserWithTab(controller->GetWebContents());
|
||||
if (browser) {
|
||||
@@ -1274,11 +1278,13 @@ void VideoOverlayWindowViews::SetUpViews() {
|
||||
&VideoOverlayWindowViews::OnLiveCaptionButtonPressed,
|
||||
base::Unretained(this)));
|
||||
live_caption_button->SetSize(kActionButtonSize);
|
||||
@@ -734,6 +740,7 @@ void VideoOverlayWindowViews::OnMouseEvent(ui::MouseEvent* event) {
|
||||
}
|
||||
|
||||
case ui::EventType::kMousePressed:
|
||||
+#if 0
|
||||
live_caption_button->SetIsLiveCaptionDialogOpen(false);
|
||||
live_caption_dialog = std::make_unique<OverlayWindowLiveCaptionDialog>(
|
||||
// Hide the live caption dialog if it's visible and the user clicks
|
||||
// outside of it.
|
||||
if (live_caption_dialog_ && live_caption_dialog_->GetVisible() &&
|
||||
@@ -742,6 +749,7 @@ void VideoOverlayWindowViews::OnMouseEvent(ui::MouseEvent* event) {
|
||||
SetLiveCaptionDialogVisibility(false);
|
||||
return;
|
||||
}
|
||||
+#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1136,9 +1144,11 @@ void VideoOverlayWindowViews::SetUpViews() {
|
||||
std::unique_ptr<HangUpButton> hang_up_button;
|
||||
std::unique_ptr<global_media_controls::MediaProgressView> progress_view;
|
||||
std::unique_ptr<views::Label> timestamp;
|
||||
+#if 0
|
||||
std::unique_ptr<views::Label> live_status;
|
||||
std::unique_ptr<OverlayWindowLiveCaptionButton> live_caption_button;
|
||||
std::unique_ptr<OverlayWindowLiveCaptionDialog> live_caption_dialog;
|
||||
+#endif
|
||||
|
||||
if (Use2024UI()) {
|
||||
play_pause_controls_view->SetSize({kCenterButtonSize, kCenterButtonSize});
|
||||
@@ -1261,6 +1271,7 @@ void VideoOverlayWindowViews::SetUpViews() {
|
||||
timestamp->SetEnabledColor(ui::kColorSysOnSurfaceSubtle);
|
||||
timestamp->SetBackgroundColor(SK_ColorTRANSPARENT);
|
||||
timestamp->SetHorizontalAlignment(gfx::ALIGN_LEFT);
|
||||
+#if 0
|
||||
live_status = std::make_unique<views::Label>(
|
||||
l10n_util::GetStringUTF16(IDS_PICTURE_IN_PICTURE_LIVE_STATUS_TEXT),
|
||||
views::style::CONTEXT_LABEL, views::style::STYLE_CAPTION_BOLD);
|
||||
@@ -1279,6 +1290,7 @@ void VideoOverlayWindowViews::SetUpViews() {
|
||||
Profile::FromBrowserContext(
|
||||
controller_->GetWebContents()->GetBrowserContext()));
|
||||
live_caption_dialog->SetVisible(false);
|
||||
@@ -90,19 +131,97 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5f
|
||||
toggle_microphone_button =
|
||||
std::make_unique<ToggleMicrophoneButton>(base::BindRepeating(
|
||||
[](VideoOverlayWindowViews* overlay) {
|
||||
@@ -2415,9 +2421,10 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) {
|
||||
@@ -1494,6 +1506,7 @@ void VideoOverlayWindowViews::SetUpViews() {
|
||||
timestamp->layer()->SetFillsBoundsOpaquely(false);
|
||||
timestamp->layer()->SetName("Timestamp");
|
||||
|
||||
+#if 0
|
||||
live_status->SetPaintToLayer(ui::LAYER_TEXTURED);
|
||||
live_status->layer()->SetFillsBoundsOpaquely(false);
|
||||
live_status->layer()->SetName("LiveStatus");
|
||||
@@ -1505,6 +1518,7 @@ void VideoOverlayWindowViews::SetUpViews() {
|
||||
live_caption_dialog->SetPaintToLayer(ui::LAYER_TEXTURED);
|
||||
live_caption_dialog->layer()->SetFillsBoundsOpaquely(false);
|
||||
live_caption_dialog->layer()->SetName("LiveCaptionDialog");
|
||||
+#endif
|
||||
} else {
|
||||
// views::View that holds the skip-ad label button.
|
||||
// -------------------------
|
||||
@@ -1596,13 +1610,14 @@ void VideoOverlayWindowViews::SetUpViews() {
|
||||
|
||||
timestamp_ =
|
||||
playback_controls_container_view_->AddChildView(std::move(timestamp));
|
||||
+#if 0
|
||||
live_status_ =
|
||||
playback_controls_container_view_->AddChildView(std::move(live_status));
|
||||
-
|
||||
live_caption_button_ = playback_controls_container_view_->AddChildView(
|
||||
std::move(live_caption_button));
|
||||
live_caption_dialog_ =
|
||||
controls_container_view->AddChildView(std::move(live_caption_dialog));
|
||||
+#endif
|
||||
|
||||
toggle_camera_button_ =
|
||||
vc_container->AddChildView(std::move(toggle_camera_button));
|
||||
@@ -1897,6 +1912,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() {
|
||||
timestamp_->SetSize({max_timestamp_width, kTimestampHeight});
|
||||
timestamp_->SetVisible(!is_live_);
|
||||
|
||||
+#if 0
|
||||
live_status_->SetPosition(timestamp_position);
|
||||
live_status_->SetMaximumWidthSingleLine(max_timestamp_width);
|
||||
live_status_->SetSize(
|
||||
@@ -1917,6 +1933,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() {
|
||||
live_caption_dialog_->SetPosition(
|
||||
{live_caption_button_bounds.right() - live_caption_dialog_->width(),
|
||||
live_caption_button_bounds.y() - live_caption_dialog_->height()});
|
||||
+#endif
|
||||
|
||||
// The play/pause button and replay/forward 10 seconds buttons should not be
|
||||
// visible while dragging the progress bar or for live media.
|
||||
@@ -2407,6 +2424,7 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) {
|
||||
return;
|
||||
}
|
||||
|
||||
+#if 0
|
||||
if (live_caption_dialog_ && live_caption_dialog_->GetVisible()) {
|
||||
if (!GetLiveCaptionDialogBounds().Contains(event->location())) {
|
||||
// Hide the live caption dialog if it's visible and the user taps outside
|
||||
@@ -2415,11 +2433,11 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) {
|
||||
event->SetHandled();
|
||||
return;
|
||||
}
|
||||
-
|
||||
+#if 0
|
||||
// Otherwise, let the live caption dialog handle the gesture.
|
||||
live_caption_dialog_->OnGestureTapEvent(event);
|
||||
+#endif
|
||||
return;
|
||||
}
|
||||
+#endif
|
||||
|
||||
@@ -2576,6 +2583,7 @@ gfx::Rect VideoOverlayWindowViews::GetLiveCaptionDialogBounds() {
|
||||
if (GetBackToTabControlsBounds().Contains(event->location())) {
|
||||
controller_->CloseAndFocusInitiator();
|
||||
@@ -2561,21 +2579,28 @@ gfx::Rect VideoOverlayWindowViews::GetProgressViewBounds() {
|
||||
}
|
||||
|
||||
gfx::Rect VideoOverlayWindowViews::GetLiveCaptionButtonBounds() {
|
||||
+#if 0
|
||||
if (!Use2024UI()) {
|
||||
return gfx::Rect();
|
||||
}
|
||||
return live_caption_button_->GetMirroredBounds();
|
||||
+#endif
|
||||
+ return gfx::Rect();
|
||||
}
|
||||
|
||||
gfx::Rect VideoOverlayWindowViews::GetLiveCaptionDialogBounds() {
|
||||
+#if 0
|
||||
if (!Use2024UI() || !live_caption_dialog_->GetVisible()) {
|
||||
return gfx::Rect();
|
||||
}
|
||||
return live_caption_dialog_->GetMirroredBounds();
|
||||
+#endif
|
||||
+ return gfx::Rect();
|
||||
}
|
||||
|
||||
bool VideoOverlayWindowViews::HasHighMediaEngagement(
|
||||
const url::Origin& origin) const {
|
||||
@@ -110,7 +229,7 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5f
|
||||
MediaEngagementService* service =
|
||||
MediaEngagementService::Get(Profile::FromBrowserContext(
|
||||
GetController()->GetWebContents()->GetBrowserContext()));
|
||||
@@ -2584,6 +2592,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement(
|
||||
@@ -2584,6 +2609,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement(
|
||||
}
|
||||
|
||||
return service->HasHighEngagement(origin);
|
||||
@@ -119,3 +238,24 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5f
|
||||
}
|
||||
|
||||
bool VideoOverlayWindowViews::IsTrustedForMediaPlayback() const {
|
||||
@@ -2850,16 +2877,20 @@ void VideoOverlayWindowViews::UpdateTimestampLabel(base::TimeDelta current_time,
|
||||
}
|
||||
|
||||
void VideoOverlayWindowViews::OnLiveCaptionButtonPressed() {
|
||||
+#if 0
|
||||
SetLiveCaptionDialogVisibility(!live_caption_dialog_->GetVisible());
|
||||
+#endif
|
||||
}
|
||||
|
||||
void VideoOverlayWindowViews::SetLiveCaptionDialogVisibility(
|
||||
bool wanted_visibility) {
|
||||
+#if 0
|
||||
if (wanted_visibility == live_caption_dialog_->GetVisible()) {
|
||||
return;
|
||||
}
|
||||
live_caption_dialog_->SetVisible(wanted_visibility);
|
||||
live_caption_button_->SetIsLiveCaptionDialogOpen(wanted_visibility);
|
||||
+#endif
|
||||
|
||||
views::View* controls_to_be_disabled_when_live_caption_is_open[] = {
|
||||
minimize_button_.get(),
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: refactor: patch electron PermissionTypes into blink
|
||||
6387077: [PermissionOptions] Generalize PermissionRequestDescription | https://chromium-review.googlesource.com/c/chromium/src/+/6387077
|
||||
|
||||
diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc
|
||||
index 86b8df2b23dc975a6db87f04005cb105054305b0..770fd74ac5a21fe6daf68efe68efcf5a69483d84 100644
|
||||
index 18ad7ed73b0ed4de158519c01342f0bfd7cc3666..43f46dbbba4fb66b2a2c66580b85de0d7e16bf57 100644
|
||||
--- a/components/permissions/permission_util.cc
|
||||
+++ b/components/permissions/permission_util.cc
|
||||
@@ -536,7 +536,17 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe(
|
||||
|
||||
@@ -15,10 +15,10 @@ described in 97b353a (#34993):
|
||||
This patch can be removed when we fix that crash.
|
||||
|
||||
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
|
||||
index 9cb826530cf567e98baf91a60ca1f7496aca9431..2d0e92f9f373f8ef6ffa3c292811df957d457c95 100644
|
||||
index 2034b961d99225ebe9b606af915f5d90fdae913e..a7ee864ae4d14d36bdf5f7f4fb0ba86255dc9c6f 100644
|
||||
--- a/chrome/browser/chrome_browser_main.cc
|
||||
+++ b/chrome/browser/chrome_browser_main.cc
|
||||
@@ -1412,6 +1412,17 @@ void ChromeBrowserMainParts::PostProfileInit(Profile* profile,
|
||||
@@ -1475,6 +1475,17 @@ void ChromeBrowserMainParts::PostProfileInit(Profile* profile,
|
||||
profile->GetPath()));
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d
|
||||
}
|
||||
|
||||
diff --git a/content/common/features.cc b/content/common/features.cc
|
||||
index 444e54b49c5b9661dcce5563193484a4e0ea2836..b902bc814c15998f7678275326ee818e58d070a1 100644
|
||||
index f4c4f0cd75e8e8331d4a223d6faa6735401f0a86..5efe4e75273dec930534049e7e2a4935af0140c1 100644
|
||||
--- a/content/common/features.cc
|
||||
+++ b/content/common/features.cc
|
||||
@@ -311,6 +311,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
@@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't
|
||||
necessary.
|
||||
|
||||
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json
|
||||
index ce09656206496ee36294eb0d9b5a595d67411141..008ec5d958ee2105eb2de03b22c18734399e6435 100644
|
||||
index 5abbbb2684682532658b33c7f5fe2b91779a81a9..e6db0f72d82203a50728d42cdfcd482caa0126ef 100644
|
||||
--- a/testing/variations/fieldtrial_testing_config.json
|
||||
+++ b/testing/variations/fieldtrial_testing_config.json
|
||||
@@ -25413,6 +25413,21 @@
|
||||
@@ -25526,6 +25526,21 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -15,10 +15,10 @@ Note that we also need to manually update embedder's
|
||||
`api::WebContents::IsFullscreenForTabOrPending` value.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index c50cceaf899308e126844e986abc4e01bc7497bb..e875bf555a92e4539aa0ea7e20eb369718b465cd 100644
|
||||
index 9d54e7e7ccabad6dfcdc54214683df8b3b414208..d5284c4a18f779b4a0fefa9e15ba4f8c023ca352 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -8954,6 +8954,17 @@ void RenderFrameHostImpl::EnterFullscreen(
|
||||
@@ -9048,6 +9048,17 @@ void RenderFrameHostImpl::EnterFullscreen(
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ index c50cceaf899308e126844e986abc4e01bc7497bb..e875bf555a92e4539aa0ea7e20eb3697
|
||||
+ }
|
||||
+
|
||||
// Focus the window if another frame may have delegated the capability.
|
||||
if (had_fullscreen_token && !GetView()->HasFocus())
|
||||
if (had_fullscreen_token && !GetView()->HasFocus()) {
|
||||
GetView()->Focus();
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index 66c603cfa5916e377a5d978a5d8e0f0e63ddb2a3..4a7c0480ad0e9d1f350909a14ef4e6d8d7b24581 100644
|
||||
|
||||
@@ -2,3 +2,4 @@ fix_correct_usages_of_v8_returnvalue_void_set_nonempty_for_new.patch
|
||||
fix_replace_deprecated_get_setprototype.patch
|
||||
fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch
|
||||
test_use_v8_version_check_instead_of_node_version_check.patch
|
||||
fix_remove_deprecated_propertycallbackinfo_holder.patch
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 30 Oct 2025 09:11:54 +0000
|
||||
Subject: fix: remove deprecated PropertyCallbackInfo::Holder()
|
||||
|
||||
Removed upstream in https://chromium-review.googlesource.com/c/v8/v8/+/7013355.
|
||||
|
||||
Property interceptors should be migrated to use info.This if they are installed
|
||||
on the object instance otherwise info.HolderV2 if they are installed on the
|
||||
prototype chain.
|
||||
|
||||
diff --git a/nan_callbacks_12_inl.h b/nan_callbacks_12_inl.h
|
||||
index ff3b654de5bcc7a187c4361b9eec26ea4b62a1eb..e40383c095ab329b2e20b7e68ade507788a79fb6 100644
|
||||
--- a/nan_callbacks_12_inl.h
|
||||
+++ b/nan_callbacks_12_inl.h
|
||||
@@ -160,7 +160,7 @@ class PropertyCallbackInfo {
|
||||
inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); }
|
||||
inline v8::Local<v8::Value> Data() const { return data_; }
|
||||
inline v8::Local<v8::Object> This() const { return info_.This(); }
|
||||
- inline v8::Local<v8::Object> Holder() const { return info_.Holder(); }
|
||||
+ inline v8::Local<v8::Object> Holder() const { return info_.HolderV2(); }
|
||||
inline ReturnValue<T> GetReturnValue() const {
|
||||
return ReturnValue<T>(info_.GetReturnValue());
|
||||
}
|
||||
diff --git a/test/cpp/accessors.cpp b/test/cpp/accessors.cpp
|
||||
index 5848a40920c35680360a9d8b1390e983c6896996..e8506e4727e707ca766fe1b4229272ba18864ae0 100644
|
||||
--- a/test/cpp/accessors.cpp
|
||||
+++ b/test/cpp/accessors.cpp
|
||||
@@ -159,7 +159,7 @@ NAN_SETTER(SetterGetter::SetProp2) {
|
||||
|
||||
NAN_METHOD(SetterGetter::Log) {
|
||||
SetterGetter* settergetter =
|
||||
- ObjectWrap::Unwrap<SetterGetter>(info.Holder());
|
||||
+ ObjectWrap::Unwrap<SetterGetter>(info.This());
|
||||
|
||||
info.GetReturnValue().Set(Nan::New(settergetter->log).ToLocalChecked());
|
||||
}
|
||||
diff --git a/test/cpp/accessors2.cpp b/test/cpp/accessors2.cpp
|
||||
index f5a2b312ca62256bc43141fad145cd68fc300446..59125d33c19856938907ab4dd28dc60037065a16 100644
|
||||
--- a/test/cpp/accessors2.cpp
|
||||
+++ b/test/cpp/accessors2.cpp
|
||||
@@ -88,7 +88,7 @@ NAN_METHOD(SetterGetter::New) {
|
||||
|
||||
NAN_GETTER(SetterGetter::GetProp1) {
|
||||
SetterGetter* settergetter =
|
||||
- ObjectWrap::Unwrap<SetterGetter>(info.Holder());
|
||||
+ ObjectWrap::Unwrap<SetterGetter>(info.This());
|
||||
assert(strlen(settergetter->log) < sizeof (settergetter->log));
|
||||
strncat(
|
||||
settergetter->log
|
||||
@@ -110,7 +110,7 @@ NAN_GETTER(SetterGetter::GetProp1) {
|
||||
|
||||
NAN_GETTER(SetterGetter::GetProp2) {
|
||||
SetterGetter* settergetter =
|
||||
- ObjectWrap::Unwrap<SetterGetter>(info.Holder());
|
||||
+ ObjectWrap::Unwrap<SetterGetter>(info.This());
|
||||
assert(strlen(settergetter->log) < sizeof (settergetter->log));
|
||||
strncat(
|
||||
settergetter->log
|
||||
@@ -132,7 +132,7 @@ NAN_GETTER(SetterGetter::GetProp2) {
|
||||
|
||||
NAN_SETTER(SetterGetter::SetProp2) {
|
||||
SetterGetter* settergetter =
|
||||
- ObjectWrap::Unwrap<SetterGetter>(info.Holder());
|
||||
+ ObjectWrap::Unwrap<SetterGetter>(info.This());
|
||||
strncpy(
|
||||
settergetter->prop2
|
||||
, *Nan::Utf8String(value)
|
||||
@@ -157,7 +157,7 @@ NAN_SETTER(SetterGetter::SetProp2) {
|
||||
|
||||
NAN_METHOD(SetterGetter::Log) {
|
||||
SetterGetter* settergetter =
|
||||
- ObjectWrap::Unwrap<SetterGetter>(info.Holder());
|
||||
+ ObjectWrap::Unwrap<SetterGetter>(info.This());
|
||||
|
||||
info.GetReturnValue().Set(Nan::New(settergetter->log).ToLocalChecked());
|
||||
}
|
||||
diff --git a/test/cpp/indexedinterceptors.cpp b/test/cpp/indexedinterceptors.cpp
|
||||
index 19b7673ff4c07236b11e1947d805979c21a0876e..668aa22f00ecc624ea4a66de93d289cdc7aad722 100644
|
||||
--- a/test/cpp/indexedinterceptors.cpp
|
||||
+++ b/test/cpp/indexedinterceptors.cpp
|
||||
@@ -74,7 +74,7 @@ NAN_METHOD(IndexedInterceptor::New) {
|
||||
|
||||
NAN_INDEX_GETTER(IndexedInterceptor::PropertyGetter) {
|
||||
IndexedInterceptor* interceptor =
|
||||
- ObjectWrap::Unwrap<IndexedInterceptor>(info.Holder());
|
||||
+ ObjectWrap::Unwrap<IndexedInterceptor>(info.This());
|
||||
if (index == 0) {
|
||||
info.GetReturnValue().Set(Nan::New(interceptor->buf).ToLocalChecked());
|
||||
} else {
|
||||
@@ -85,7 +85,7 @@ NAN_INDEX_GETTER(IndexedInterceptor::PropertyGetter) {
|
||||
|
||||
NAN_INDEX_SETTER(IndexedInterceptor::PropertySetter) {
|
||||
IndexedInterceptor* interceptor =
|
||||
- ObjectWrap::Unwrap<IndexedInterceptor>(info.Holder());
|
||||
+ ObjectWrap::Unwrap<IndexedInterceptor>(info.This());
|
||||
if (index == 0) {
|
||||
std::strncpy(
|
||||
interceptor->buf
|
||||
@@ -107,7 +107,7 @@ NAN_INDEX_ENUMERATOR(IndexedInterceptor::PropertyEnumerator) {
|
||||
|
||||
NAN_INDEX_DELETER(IndexedInterceptor::PropertyDeleter) {
|
||||
IndexedInterceptor* interceptor =
|
||||
- ObjectWrap::Unwrap<IndexedInterceptor>(info.Holder());
|
||||
+ ObjectWrap::Unwrap<IndexedInterceptor>(info.This());
|
||||
std::strncpy(interceptor->buf, "goober", sizeof (interceptor->buf));
|
||||
info.GetReturnValue().Set(True());
|
||||
return Intercepted::Yes();
|
||||
diff --git a/test/cpp/methodswithdata.cpp b/test/cpp/methodswithdata.cpp
|
||||
index 8a908e3246f1efd77290597e500185010293c473..a1ac03c891c14bcd96c139514866acc4c2bd393c 100644
|
||||
--- a/test/cpp/methodswithdata.cpp
|
||||
+++ b/test/cpp/methodswithdata.cpp
|
||||
@@ -150,7 +150,7 @@ NAN_SETTER(SetterGetter::SetProp2) {
|
||||
|
||||
NAN_METHOD(SetterGetter::Log) {
|
||||
SetterGetter* settergetter =
|
||||
- ObjectWrap::Unwrap<SetterGetter>(info.Holder());
|
||||
+ ObjectWrap::Unwrap<SetterGetter>(info.This());
|
||||
|
||||
info.GetReturnValue().Set(Nan::New(settergetter->log).ToLocalChecked());
|
||||
}
|
||||
diff --git a/test/cpp/namedinterceptors.cpp b/test/cpp/namedinterceptors.cpp
|
||||
index 9f4b3b2000188fbeb53a5ec53969226916bac9da..d0761e5880d91792470ae4fecd0b5dfd3770bfef 100644
|
||||
--- a/test/cpp/namedinterceptors.cpp
|
||||
+++ b/test/cpp/namedinterceptors.cpp
|
||||
@@ -74,7 +74,7 @@ NAN_METHOD(NamedInterceptor::New) {
|
||||
|
||||
NAN_PROPERTY_GETTER(NamedInterceptor::PropertyGetter) {
|
||||
NamedInterceptor* interceptor =
|
||||
- ObjectWrap::Unwrap<NamedInterceptor>(info.Holder());
|
||||
+ ObjectWrap::Unwrap<NamedInterceptor>(info.This());
|
||||
if (!std::strcmp(*Nan::Utf8String(property), "prop")) {
|
||||
info.GetReturnValue().Set(Nan::New(interceptor->buf).ToLocalChecked());
|
||||
} else {
|
||||
@@ -85,7 +85,7 @@ NAN_PROPERTY_GETTER(NamedInterceptor::PropertyGetter) {
|
||||
|
||||
NAN_PROPERTY_SETTER(NamedInterceptor::PropertySetter) {
|
||||
NamedInterceptor* interceptor =
|
||||
- ObjectWrap::Unwrap<NamedInterceptor>(info.Holder());
|
||||
+ ObjectWrap::Unwrap<NamedInterceptor>(info.This());
|
||||
if (!std::strcmp(*Nan::Utf8String(property), "prop")) {
|
||||
std::strncpy(
|
||||
interceptor->buf
|
||||
@@ -106,7 +106,7 @@ NAN_PROPERTY_ENUMERATOR(NamedInterceptor::PropertyEnumerator) {
|
||||
|
||||
NAN_PROPERTY_DELETER(NamedInterceptor::PropertyDeleter) {
|
||||
NamedInterceptor* interceptor =
|
||||
- ObjectWrap::Unwrap<NamedInterceptor>(info.Holder());
|
||||
+ ObjectWrap::Unwrap<NamedInterceptor>(info.This());
|
||||
std::strncpy(interceptor->buf, "goober", sizeof (interceptor->buf));
|
||||
info.GetReturnValue().Set(True());
|
||||
return Intercepted::Yes();
|
||||
diff --git a/test/cpp/objectwraphandle.cpp b/test/cpp/objectwraphandle.cpp
|
||||
index ac4f79aa256c82d2a8b64fa5a0d44d5c2ebbd9c7..64dd9e7ad95d1f37a6223dfd8e385b9d122ba3bc 100644
|
||||
--- a/test/cpp/objectwraphandle.cpp
|
||||
+++ b/test/cpp/objectwraphandle.cpp
|
||||
@@ -47,17 +47,17 @@ class MyObject : public ObjectWrap {
|
||||
}
|
||||
|
||||
static NAN_METHOD(GetHandle) {
|
||||
- MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.Holder());
|
||||
+ MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.This());
|
||||
info.GetReturnValue().Set(obj->handle());
|
||||
}
|
||||
|
||||
static NAN_METHOD(GetHandleConst) {
|
||||
- MyObject const *obj = ObjectWrap::Unwrap<MyObject>(info.Holder());
|
||||
+ MyObject const *obj = ObjectWrap::Unwrap<MyObject>(info.This());
|
||||
info.GetReturnValue().Set(obj->handle());
|
||||
}
|
||||
|
||||
static NAN_METHOD(GetValue) {
|
||||
- MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.Holder());
|
||||
+ MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.This());
|
||||
info.GetReturnValue().Set(obj->value_);
|
||||
}
|
||||
|
||||
diff --git a/test/cpp/wrappedobjectfactory.cpp b/test/cpp/wrappedobjectfactory.cpp
|
||||
index 9930a5f12913f703391e3d183b56a37569c60887..ec3955e496ed623966c83b5a5b661103892622fd 100644
|
||||
--- a/test/cpp/wrappedobjectfactory.cpp
|
||||
+++ b/test/cpp/wrappedobjectfactory.cpp
|
||||
@@ -49,7 +49,7 @@ class InnerObject : public ObjectWrap {
|
||||
}
|
||||
|
||||
static NAN_METHOD(GetValue) {
|
||||
- InnerObject* obj = ObjectWrap::Unwrap<InnerObject>(info.Holder());
|
||||
+ InnerObject* obj = ObjectWrap::Unwrap<InnerObject>(info.This());
|
||||
info.GetReturnValue().Set(obj->value_);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ class MyObject : public ObjectWrap {
|
||||
}
|
||||
|
||||
static NAN_METHOD(GetValue) {
|
||||
- MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.Holder());
|
||||
+ MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.This());
|
||||
info.GetReturnValue().Set(obj->value_);
|
||||
}
|
||||
|
||||
@@ -17,48 +17,25 @@ chore_expose_importmoduledynamically_and.patch
|
||||
test_formally_mark_some_tests_as_flaky.patch
|
||||
fix_do_not_resolve_electron_entrypoints.patch
|
||||
ci_ensure_node_tests_set_electron_run_as_node.patch
|
||||
fix_assert_module_in_the_renderer_process.patch
|
||||
fix_allow_passing_fileexists_fn_to_legacymainresolve.patch
|
||||
fix_remove_deprecated_errno_constants.patch
|
||||
build_enable_perfetto.patch
|
||||
fix_add_source_location_for_v8_task_runner.patch
|
||||
src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch
|
||||
test_update_v8-stats_test_for_v8_12_6.patch
|
||||
src_do_not_use_soon-to-be-deprecated_v8_api.patch
|
||||
src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch
|
||||
build_compile_with_c_20_support.patch
|
||||
add_v8_taskpirority_to_foreground_task_runner_signature.patch
|
||||
cli_remove_deprecated_v8_flag.patch
|
||||
build_restore_clang_as_default_compiler_on_macos.patch
|
||||
fix_remove_outdated_v8_flags_from_node_cc.patch
|
||||
chore_disable_deprecation_ftbfs_in_simdjson_header.patch
|
||||
build_allow_unbundling_of_node_js_dependencies.patch
|
||||
test_use_static_method_names_in_call_stacks.patch
|
||||
fix_remove_fastapitypedarray_usage.patch
|
||||
test_handle_explicit_resource_management_globals.patch
|
||||
build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch
|
||||
fix_adjust_wpt_and_webidl_tests_for_enabled_float16array.patch
|
||||
chore_add_createexternalizabletwobytestring_to_globals.patch
|
||||
refactor_attach_cppgc_heap_on_v8_isolate_creation.patch
|
||||
fix_ensure_traverseparent_bails_on_resource_path_exit.patch
|
||||
cli_move_--trace-atomics-wait_to_eol.patch
|
||||
fix_cppgc_initializing_twice.patch
|
||||
fix_task_starvation_in_inspector_context_test.patch
|
||||
fix_expose_readfilesync_override_for_modules.patch
|
||||
fix_array_out-of-bounds_read_in_boyer-moore_search.patch
|
||||
chore_add_missing_include_of_iterator.patch
|
||||
test_accomodate_v8_thenable_stack_trace_change_in_snapshot.patch
|
||||
chore_exclude_electron_node_folder_from_exit-time-destructors.patch
|
||||
api_remove_deprecated_getisolate.patch
|
||||
src_switch_from_get_setprototype_to_get_setprototypev2.patch
|
||||
fix_replace_deprecated_setprototype.patch
|
||||
fix_redefined_macos_sdk_header_symbols.patch
|
||||
src_simplify_string_bytes_with_views.patch
|
||||
src_improve_utf8_string_generation_performance.patch
|
||||
src_use_non-deprecated_utf8lengthv2_method.patch
|
||||
src_use_non-deprecated_writeutf8v2_method.patch
|
||||
src_refactor_writeucs2_and_remove_flags_argument.patch
|
||||
src_use_string_writev2_in_twobytevalue.patch
|
||||
node-api_use_writev2_in_napi_get_value_string_utf16.patch
|
||||
node-api_use_writeonebytev2_in_napi_get_value_string_latin1.patch
|
||||
src_migrate_writeonebyte_to_writeonebytev2.patch
|
||||
fix_allow_disabling_fetch_in_renderer_and_worker_processes.patch
|
||||
feat_disable_js_source_phase_imports_by_default.patch
|
||||
fix_avoid_external_memory_leak_on_invalid_tls_protocol_versions.patch
|
||||
lib_check_sharedarraybuffer_existence_in_fast-utf8-stream.patch
|
||||
chore_handle_support_for_import_defer_as_ns_and_import_defer.patch
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Calvin Watford <cwatford@slack-corp.com>
|
||||
Date: Wed, 18 Sep 2024 16:25:05 -0600
|
||||
Subject: add v8::TaskPirority to foreground task runner signature
|
||||
|
||||
For now, we ignore the priority parameter. We expect this will be fixed
|
||||
naturally upstream, and we will be able to remove this patch in a future
|
||||
Node.js upgrade.
|
||||
|
||||
diff --git a/src/node_platform.cc b/src/node_platform.cc
|
||||
index b24e170cb247261d4a16d77ad40df4dfd33709d9..5e31f984b5655ae2d1d7559b1bd550ba6dc90fb4 100644
|
||||
--- a/src/node_platform.cc
|
||||
+++ b/src/node_platform.cc
|
||||
@@ -688,8 +688,8 @@ bool NodePlatform::IdleTasksEnabled(Isolate* isolate) {
|
||||
return ForIsolate(isolate)->IdleTasksEnabled();
|
||||
}
|
||||
|
||||
-std::shared_ptr<v8::TaskRunner>
|
||||
-NodePlatform::GetForegroundTaskRunner(Isolate* isolate) {
|
||||
+std::shared_ptr<v8::TaskRunner> NodePlatform::GetForegroundTaskRunner(
|
||||
+ Isolate* isolate, v8::TaskPriority priority) {
|
||||
return ForIsolate(isolate)->GetForegroundTaskRunner();
|
||||
}
|
||||
|
||||
diff --git a/src/node_platform.h b/src/node_platform.h
|
||||
index a0222b4a1b074c6708e390d58d04221717069ac1..8015ca1801573c3a7c4a5db6d0f10b4016a9267c 100644
|
||||
--- a/src/node_platform.h
|
||||
+++ b/src/node_platform.h
|
||||
@@ -213,7 +213,7 @@ class NodePlatform : public MultiIsolatePlatform {
|
||||
void (*callback)(void*), void* data) override;
|
||||
|
||||
std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(
|
||||
- v8::Isolate* isolate) override;
|
||||
+ v8::Isolate* isolate, v8::TaskPriority priority) override;
|
||||
|
||||
Platform::StackTracePrinter GetStackTracePrinter() override;
|
||||
v8::PageAllocator* GetPageAllocator() override;
|
||||
@@ -6,10 +6,10 @@ Subject: Remove deprecated `GetIsolate`
|
||||
https://chromium-review.googlesource.com/c/v8/v8/+/6905244
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7c630fddf 100644
|
||||
index 072deb1fa70313e33397f6ff994e3f3548e86092..14be033113bfb13c64e5f99446afaf0cb2aa16a9 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -654,7 +654,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
|
||||
@@ -669,7 +669,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
|
||||
|
||||
MaybeLocal<Object> GetPerContextExports(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
@@ -18,7 +18,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
|
||||
EscapableHandleScope handle_scope(isolate);
|
||||
|
||||
Local<Object> global = context->Global();
|
||||
@@ -700,7 +700,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) {
|
||||
@@ -715,7 +715,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) {
|
||||
// This runs at runtime, regardless of whether the context
|
||||
// is created from a snapshot.
|
||||
Maybe<void> InitializeContextRuntime(Local<Context> context) {
|
||||
@@ -27,7 +27,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
// When `IsCodeGenerationFromStringsAllowed` is true, V8 takes the fast path
|
||||
@@ -779,7 +779,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
|
||||
@@ -794,7 +794,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
|
||||
}
|
||||
|
||||
Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
|
||||
@@ -36,7 +36,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
// Delete `Intl.v8BreakIterator`
|
||||
@@ -804,7 +804,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
|
||||
@@ -819,7 +819,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
|
||||
}
|
||||
|
||||
Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
|
||||
@@ -45,7 +45,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
// Initialize the default values.
|
||||
@@ -822,7 +822,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
|
||||
@@ -837,7 +837,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
|
||||
MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
CHECK(isolate_data);
|
||||
@@ -54,7 +54,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
|
||||
EscapableHandleScope scope(isolate);
|
||||
Context::Scope context_scope(context);
|
||||
|
||||
@@ -846,7 +846,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
|
||||
@@ -861,7 +861,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
|
||||
MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
CHECK(isolate_data);
|
||||
@@ -63,7 +63,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
|
||||
EscapableHandleScope scope(isolate);
|
||||
Context::Scope context_scope(context);
|
||||
|
||||
@@ -872,7 +872,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
|
||||
@@ -887,7 +887,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
|
||||
Maybe<void> InitializePrimordials(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
// Run per-context JS files.
|
||||
@@ -73,7 +73,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
|
||||
Local<Object> exports;
|
||||
|
||||
diff --git a/src/base_object-inl.h b/src/base_object-inl.h
|
||||
index 6f731b17fe0b84dd3d2c9bc9cfef1f8062a2c5f7..71a1072ed2decbee08d40eda7c47456be5093bc2 100644
|
||||
index cc60ddddb037e0279615bbe24821eb20fd8da677..37d83e41b618a07aca98118260abe9618f11256d 100644
|
||||
--- a/src/base_object-inl.h
|
||||
+++ b/src/base_object-inl.h
|
||||
@@ -55,7 +55,6 @@ v8::Local<v8::Object> BaseObject::object() const {
|
||||
@@ -85,10 +85,10 @@ index 6f731b17fe0b84dd3d2c9bc9cfef1f8062a2c5f7..71a1072ed2decbee08d40eda7c47456b
|
||||
|
||||
return handle;
|
||||
diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
|
||||
index a3d309d832c73ddc79564b9644d825bec7459e7f..580cbaf3858961f375ca2f53c48a07bcba82ef46 100644
|
||||
index 20d3c1d9d17fde18fc09b6ee219137831eb08a45..8fbf4f25a91b953f3d2868889c7ee06932ee3c5f 100644
|
||||
--- a/src/crypto/crypto_context.cc
|
||||
+++ b/src/crypto/crypto_context.cc
|
||||
@@ -967,7 +967,7 @@ bool ArrayOfStringsToX509s(Local<Context> context,
|
||||
@@ -1022,7 +1022,7 @@ bool ArrayOfStringsToX509s(Local<Context> context,
|
||||
Local<Array> cert_array,
|
||||
std::vector<X509*>* certs) {
|
||||
ClearErrorOnReturn clear_error_on_return;
|
||||
@@ -98,11 +98,11 @@ index a3d309d832c73ddc79564b9644d825bec7459e7f..580cbaf3858961f375ca2f53c48a07bc
|
||||
uint32_t array_length = cert_array->Length();
|
||||
|
||||
diff --git a/src/crypto/crypto_x509.cc b/src/crypto/crypto_x509.cc
|
||||
index eb6dad44a49d997097c8fb5009eeb60a7305da27..fd29d17de195017970856ce30d7a9c5785b0b8ee 100644
|
||||
index 4c5427596d1c90d3a413cdd9ff4f1151e657073d..70135a6be65e41fcb3564ddf6d1e8083a59ef8bb 100644
|
||||
--- a/src/crypto/crypto_x509.cc
|
||||
+++ b/src/crypto/crypto_x509.cc
|
||||
@@ -97,7 +97,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, BIOPointer&& bio) {
|
||||
if (!bio) return {};
|
||||
@@ -107,7 +107,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, BIOPointer&& bio) {
|
||||
return {};
|
||||
BUF_MEM* mem = bio;
|
||||
Local<Value> ret;
|
||||
- if (!String::NewFromUtf8(context->GetIsolate(),
|
||||
@@ -110,32 +110,8 @@ index eb6dad44a49d997097c8fb5009eeb60a7305da27..fd29d17de195017970856ce30d7a9c57
|
||||
mem->data,
|
||||
NewStringType::kNormal,
|
||||
mem->length)
|
||||
@@ -121,7 +121,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const ASN1_OBJECT* obj) {
|
||||
}
|
||||
|
||||
Local<Value> result;
|
||||
- if (!String::NewFromUtf8(context->GetIsolate(), str).ToLocal(&result)) {
|
||||
+ if (!String::NewFromUtf8(Isolate::GetCurrent(), str).ToLocal(&result)) {
|
||||
@@ -121,7 +121,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const BIOPointer& bio) {
|
||||
return {};
|
||||
}
|
||||
return result;
|
||||
@@ -136,12 +136,12 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const ASN1_STRING* str) {
|
||||
unsigned char* value_str;
|
||||
int value_str_size = ASN1_STRING_to_UTF8(&value_str, str);
|
||||
if (value_str_size < 0) {
|
||||
- return Undefined(context->GetIsolate());
|
||||
+ return Undefined(Isolate::GetCurrent());
|
||||
}
|
||||
DataPointer free_value_str(value_str, value_str_size);
|
||||
|
||||
Local<Value> result;
|
||||
- if (!String::NewFromUtf8(context->GetIsolate(),
|
||||
+ if (!String::NewFromUtf8(Isolate::GetCurrent(),
|
||||
reinterpret_cast<const char*>(value_str),
|
||||
NewStringType::kNormal,
|
||||
value_str_size)
|
||||
@@ -155,7 +155,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const BIOPointer& bio) {
|
||||
if (!bio) return {};
|
||||
BUF_MEM* mem = bio;
|
||||
Local<Value> ret;
|
||||
- if (!String::NewFromUtf8(context->GetIsolate(),
|
||||
@@ -144,23 +120,23 @@ index eb6dad44a49d997097c8fb5009eeb60a7305da27..fd29d17de195017970856ce30d7a9c57
|
||||
NewStringType::kNormal,
|
||||
mem->length)
|
||||
diff --git a/src/encoding_binding.cc b/src/encoding_binding.cc
|
||||
index 31ed995714bb99ab534f26ba9ebc6051c258a1c9..5ace688bb7ffc86eedf5aff11ab0ab487ad9440e 100644
|
||||
index 266f640fb1c6503a424e77cc41fc15bc658bb6a5..877ae8a18f6b8f2c7e3474dfba060d99db88e6b9 100644
|
||||
--- a/src/encoding_binding.cc
|
||||
+++ b/src/encoding_binding.cc
|
||||
@@ -73,7 +73,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
@@ -76,7 +76,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
int index,
|
||||
InternalFieldInfoBase* info) {
|
||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||
- v8::HandleScope scope(context->GetIsolate());
|
||||
+ v8::HandleScope scope(Isolate::GetCurrent());
|
||||
- HandleScope scope(context->GetIsolate());
|
||||
+ HandleScope scope(Isolate::GetCurrent());
|
||||
Realm* realm = Realm::GetCurrent(context);
|
||||
// Recreate the buffer in the constructor.
|
||||
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
||||
diff --git a/src/env.cc b/src/env.cc
|
||||
index c6209cc7cf317de1bb9217e39dd760e5a83303e2..161d577e0ea6a251c83ba1903b1ec9a582a5317c 100644
|
||||
index a78817467518245c4a190e870e0eb30658eafcdb..13dcf0e9c2c86486d1e43763033f43ac4e6b6feb 100644
|
||||
--- a/src/env.cc
|
||||
+++ b/src/env.cc
|
||||
@@ -1748,10 +1748,10 @@ void AsyncHooks::Deserialize(Local<Context> context) {
|
||||
@@ -1753,10 +1753,10 @@ void AsyncHooks::Deserialize(Local<Context> context) {
|
||||
context->GetDataFromSnapshotOnce<Array>(
|
||||
info_->js_execution_async_resources).ToLocalChecked();
|
||||
} else {
|
||||
@@ -173,7 +149,7 @@ index c6209cc7cf317de1bb9217e39dd760e5a83303e2..161d577e0ea6a251c83ba1903b1ec9a5
|
||||
|
||||
// The native_execution_async_resources_ field requires v8::Local<> instances
|
||||
// for async calls whose resources were on the stack as JS objects when they
|
||||
@@ -1791,7 +1791,7 @@ AsyncHooks::SerializeInfo AsyncHooks::Serialize(Local<Context> context,
|
||||
@@ -1796,7 +1796,7 @@ AsyncHooks::SerializeInfo AsyncHooks::Serialize(Local<Context> context,
|
||||
info.async_id_fields = async_id_fields_.Serialize(context, creator);
|
||||
if (!js_execution_async_resources_.IsEmpty()) {
|
||||
info.js_execution_async_resources = creator->AddData(
|
||||
@@ -183,7 +159,7 @@ index c6209cc7cf317de1bb9217e39dd760e5a83303e2..161d577e0ea6a251c83ba1903b1ec9a5
|
||||
} else {
|
||||
info.js_execution_async_resources = 0;
|
||||
diff --git a/src/inspector/network_agent.cc b/src/inspector/network_agent.cc
|
||||
index 3b5d9615021101ad03d9dfef83e0c56b462b59ad..823e7b8d3d07eb2afa1cc62d3d9e2af20f4e2e89 100644
|
||||
index d136b72e598d07f3c2fcc9c2c8ba84f5ff1aaad7..649008aafc8d68cfecb02c28ad1e26a9b749f7bd 100644
|
||||
--- a/src/inspector/network_agent.cc
|
||||
+++ b/src/inspector/network_agent.cc
|
||||
@@ -29,31 +29,31 @@ using v8::Value;
|
||||
@@ -296,6 +272,15 @@ index 3b5d9615021101ad03d9dfef83e0c56b462b59ad..823e7b8d3d07eb2afa1cc62d3d9e2af2
|
||||
protocol::String url;
|
||||
if (!ObjectGetProtocolString(context, response, "url").To(&url)) {
|
||||
return {};
|
||||
@@ -210,7 +210,7 @@ std::unique_ptr<protocol::Network::Response> createResponseFromObject(
|
||||
|
||||
std::unique_ptr<protocol::Network::WebSocketResponse> createWebSocketResponse(
|
||||
v8::Local<v8::Context> context, Local<Object> response) {
|
||||
- HandleScope handle_scope(context->GetIsolate());
|
||||
+ HandleScope handle_scope(v8::Isolate::GetCurrent());
|
||||
int status;
|
||||
if (!ObjectGetInt(context, response, "status").To(&status)) {
|
||||
return {};
|
||||
diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h
|
||||
index 27aeac589b19cd681923fb848ce5f36c66fc05e2..5f2900869763f40cac54e3cb3fe2e24eda615410 100644
|
||||
--- a/src/js_native_api_v8.h
|
||||
@@ -310,10 +295,37 @@ index 27aeac589b19cd681923fb848ce5f36c66fc05e2..5f2900869763f40cac54e3cb3fe2e24e
|
||||
module_api_version(module_api_version) {
|
||||
napi_clear_last_error(this);
|
||||
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
|
||||
index cbb3e7f4df72f83cb8a1afc25a7429218792e964..ffccac5589bfe12eaf7861364cc6f2e403d26679 100644
|
||||
index 8fed194cbae9ce75bd0805b4df30b4de64fbbefa..a584e3a80adb69d2028dc79450349823ab973a58 100644
|
||||
--- a/src/module_wrap.cc
|
||||
+++ b/src/module_wrap.cc
|
||||
@@ -865,7 +865,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
|
||||
@@ -99,7 +99,7 @@ ModuleCacheKey ModuleCacheKey::From(Local<Context> context,
|
||||
Local<String> specifier,
|
||||
Local<FixedArray> import_attributes) {
|
||||
CHECK_EQ(import_attributes->Length() % elements_per_attribute, 0);
|
||||
- Isolate* isolate = context->GetIsolate();
|
||||
+ Isolate* isolate = Isolate::GetCurrent();
|
||||
std::size_t h1 = specifier->GetIdentityHash();
|
||||
size_t num_attributes = import_attributes->Length() / elements_per_attribute;
|
||||
ImportAttributeVector attributes;
|
||||
@@ -1022,7 +1022,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
|
||||
return {};
|
||||
}
|
||||
DCHECK_NOT_NULL(resolved_module);
|
||||
- return resolved_module->module_.Get(context->GetIsolate());
|
||||
+ return resolved_module->module_.Get(Isolate::GetCurrent());
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -1046,7 +1046,7 @@ MaybeLocal<Object> ModuleWrap::ResolveSourceCallback(
|
||||
Local<String> url = resolved_module->object()
|
||||
->GetInternalField(ModuleWrap::kURLSlot)
|
||||
.As<String>();
|
||||
- THROW_ERR_SOURCE_PHASE_NOT_DEFINED(context->GetIsolate(), url);
|
||||
+ THROW_ERR_SOURCE_PHASE_NOT_DEFINED(Isolate::GetCurrent(), url);
|
||||
return {};
|
||||
}
|
||||
CHECK(module_source_object->IsObject());
|
||||
@@ -1059,7 +1059,7 @@ Maybe<ModuleWrap*> ModuleWrap::ResolveModule(
|
||||
Local<String> specifier,
|
||||
Local<FixedArray> import_attributes,
|
||||
Local<Module> referrer) {
|
||||
@@ -322,16 +334,16 @@ index cbb3e7f4df72f83cb8a1afc25a7429218792e964..ffccac5589bfe12eaf7861364cc6f2e4
|
||||
Environment* env = Environment::GetCurrent(context);
|
||||
if (env == nullptr) {
|
||||
THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate);
|
||||
@@ -907,7 +907,7 @@ MaybeLocal<Promise> ImportModuleDynamically(
|
||||
Local<Value> resource_name,
|
||||
@@ -1104,7 +1104,7 @@ MaybeLocal<Promise> ImportModuleDynamicallyWithPhase(
|
||||
Local<String> specifier,
|
||||
ModuleImportPhase phase,
|
||||
Local<FixedArray> import_attributes) {
|
||||
- Isolate* isolate = context->GetIsolate();
|
||||
+ Isolate* isolate = Isolate::GetCurrent();
|
||||
Environment* env = Environment::GetCurrent(context);
|
||||
if (env == nullptr) {
|
||||
THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate);
|
||||
@@ -1131,7 +1131,7 @@ MaybeLocal<Module> LinkRequireFacadeWithOriginal(
|
||||
@@ -1346,7 +1346,7 @@ MaybeLocal<Module> LinkRequireFacadeWithOriginal(
|
||||
Local<FixedArray> import_attributes,
|
||||
Local<Module> referrer) {
|
||||
Environment* env = Environment::GetCurrent(context);
|
||||
@@ -341,10 +353,10 @@ index cbb3e7f4df72f83cb8a1afc25a7429218792e964..ffccac5589bfe12eaf7861364cc6f2e4
|
||||
CHECK(!env->temporary_required_module_facade_original.IsEmpty());
|
||||
return env->temporary_required_module_facade_original.Get(isolate);
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 16a0c71aef949b0ddd27def9dc843298f9a6b75f..28fa4cb3e7a621480a5ff11c48666c0de1363375 100644
|
||||
index 7fae281a6e0f3c1a9f0eb97536883bb26c16d94d..fb37310f44c8d06d1ab2697ed64a0b539776a411 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -1050,7 +1050,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
||||
@@ -1064,7 +1064,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
||||
|
||||
#define NODE_DEFINE_CONSTANT(target, constant) \
|
||||
do { \
|
||||
@@ -353,7 +365,7 @@ index 16a0c71aef949b0ddd27def9dc843298f9a6b75f..28fa4cb3e7a621480a5ff11c48666c0d
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
|
||||
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
|
||||
isolate, #constant, v8::NewStringType::kInternalized); \
|
||||
@@ -1066,7 +1066,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
||||
@@ -1080,7 +1080,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
||||
|
||||
#define NODE_DEFINE_HIDDEN_CONSTANT(target, constant) \
|
||||
do { \
|
||||
@@ -363,7 +375,7 @@ index 16a0c71aef949b0ddd27def9dc843298f9a6b75f..28fa4cb3e7a621480a5ff11c48666c0d
|
||||
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
|
||||
isolate, #constant, v8::NewStringType::kInternalized); \
|
||||
diff --git a/src/node_blob.cc b/src/node_blob.cc
|
||||
index 9b9956f5ee3150a80f040cd0dbb9ef6589295600..14de0dad25fbf854ea23eb25abd6f9f2179e0dad 100644
|
||||
index d278a32c9934c15bc721da164efccca7bc7e7111..ab862bf93a411e6ae6da7c9f9706cee279a0ad70 100644
|
||||
--- a/src/node_blob.cc
|
||||
+++ b/src/node_blob.cc
|
||||
@@ -554,7 +554,7 @@ void BlobBindingData::Deserialize(Local<Context> context,
|
||||
@@ -376,10 +388,10 @@ index 9b9956f5ee3150a80f040cd0dbb9ef6589295600..14de0dad25fbf854ea23eb25abd6f9f2
|
||||
BlobBindingData* binding = realm->AddBindingData<BlobBindingData>(holder);
|
||||
CHECK_NOT_NULL(binding);
|
||||
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
|
||||
index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c58106217b32d1b 100644
|
||||
index e69eb280050cae0c0f394b2f956eef947e628904..9bb4576fcf4f07550e7d6f4ff2310cedc8093c5f 100644
|
||||
--- a/src/node_builtins.cc
|
||||
+++ b/src/node_builtins.cc
|
||||
@@ -275,7 +275,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal(
|
||||
@@ -274,7 +274,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal(
|
||||
const char* id,
|
||||
LocalVector<String>* parameters,
|
||||
Realm* optional_realm) {
|
||||
@@ -388,7 +400,7 @@ index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c581062
|
||||
EscapableHandleScope scope(isolate);
|
||||
|
||||
Local<String> source;
|
||||
@@ -397,7 +397,7 @@ void BuiltinLoader::SaveCodeCache(const char* id, Local<Function> fun) {
|
||||
@@ -396,7 +396,7 @@ void BuiltinLoader::SaveCodeCache(const char* id, Local<Function> fun) {
|
||||
MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context,
|
||||
const char* id,
|
||||
Realm* optional_realm) {
|
||||
@@ -397,7 +409,7 @@ index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c581062
|
||||
LocalVector<String> parameters(isolate);
|
||||
// Detects parameters of the scripts based on module ids.
|
||||
// internal/bootstrap/realm: process, getLinkedBinding,
|
||||
@@ -451,7 +451,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context,
|
||||
@@ -450,7 +450,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context,
|
||||
MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
|
||||
const char* id,
|
||||
Realm* realm) {
|
||||
@@ -406,7 +418,7 @@ index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c581062
|
||||
// Detects parameters of the scripts based on module ids.
|
||||
// internal/bootstrap/realm: process, getLinkedBinding,
|
||||
// getInternalBinding, primordials
|
||||
@@ -507,7 +507,7 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
|
||||
@@ -506,7 +506,7 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
|
||||
if (!maybe_fn.ToLocal(&fn)) {
|
||||
return MaybeLocal<Value>();
|
||||
}
|
||||
@@ -415,12 +427,12 @@ index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c581062
|
||||
return fn->Call(context, undefined, argc, argv);
|
||||
}
|
||||
|
||||
@@ -546,14 +546,14 @@ bool BuiltinLoader::CompileAllBuiltinsAndCopyCodeCache(
|
||||
@@ -544,14 +544,14 @@ bool BuiltinLoader::CompileAllBuiltinsAndCopyCodeCache(
|
||||
to_eager_compile_.emplace(id);
|
||||
}
|
||||
|
||||
- v8::TryCatch bootstrapCatch(context->GetIsolate());
|
||||
+ v8::TryCatch bootstrapCatch(Isolate::GetCurrent());
|
||||
- TryCatch bootstrapCatch(context->GetIsolate());
|
||||
+ TryCatch bootstrapCatch(Isolate::GetCurrent());
|
||||
auto fn = LookupAndCompile(context, id.data(), nullptr);
|
||||
if (bootstrapCatch.HasCaught()) {
|
||||
per_process::Debug(DebugCategory::CODE_CACHE,
|
||||
@@ -433,10 +445,10 @@ index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c581062
|
||||
// This is used by the snapshot builder, so save the code cache
|
||||
// unconditionally.
|
||||
diff --git a/src/node_constants.cc b/src/node_constants.cc
|
||||
index cbcecfba33070b820aca0e2814982160a97a6378..b1ee513fc0873a51b4885f612dbf7b950b5cf2ca 100644
|
||||
index fea0426496978c0003fe1481afcf93fc9c23edca..c9588880d05435ab9f4e23fcff74c93309664270 100644
|
||||
--- a/src/node_constants.cc
|
||||
+++ b/src/node_constants.cc
|
||||
@@ -1264,7 +1264,7 @@ void CreatePerContextProperties(Local<Object> target,
|
||||
@@ -1265,7 +1265,7 @@ void CreatePerContextProperties(Local<Object> target,
|
||||
Local<Value> unused,
|
||||
Local<Context> context,
|
||||
void* priv) {
|
||||
@@ -444,12 +456,12 @@ index cbcecfba33070b820aca0e2814982160a97a6378..b1ee513fc0873a51b4885f612dbf7b95
|
||||
+ Isolate* isolate = Isolate::GetCurrent();
|
||||
Environment* env = Environment::GetCurrent(context);
|
||||
|
||||
CHECK(target->SetPrototype(env->context(), Null(env->isolate())).FromJust());
|
||||
CHECK(
|
||||
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
|
||||
index 21a08a738e5c3506d27e402762a4a267e9278588..475b5628f9b82a2b9b86343f25759c1e6814f816 100644
|
||||
index 3c234205e89be7e976dae5c3fcc73ca67953e034..e66d4fcb0c064f96cdb819c783027d864fe88d12 100644
|
||||
--- a/src/node_contextify.cc
|
||||
+++ b/src/node_contextify.cc
|
||||
@@ -111,7 +111,7 @@ namespace {
|
||||
@@ -113,7 +113,7 @@ namespace {
|
||||
|
||||
// Convert an int to a V8 Name (String or Symbol).
|
||||
MaybeLocal<String> Uint32ToName(Local<Context> context, uint32_t index) {
|
||||
@@ -458,7 +470,7 @@ index 21a08a738e5c3506d27e402762a4a267e9278588..475b5628f9b82a2b9b86343f25759c1e
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
@@ -682,7 +682,7 @@ Intercepted ContextifyContext::PropertyDefinerCallback(
|
||||
@@ -677,7 +677,7 @@ Intercepted ContextifyContext::PropertyDefinerCallback(
|
||||
}
|
||||
|
||||
Local<Context> context = ctx->context();
|
||||
@@ -467,7 +479,7 @@ index 21a08a738e5c3506d27e402762a4a267e9278588..475b5628f9b82a2b9b86343f25759c1e
|
||||
|
||||
PropertyAttribute attributes = PropertyAttribute::None;
|
||||
bool is_declared =
|
||||
@@ -1657,7 +1657,7 @@ static MaybeLocal<Function> CompileFunctionForCJSLoader(
|
||||
@@ -1666,7 +1666,7 @@ static MaybeLocal<Function> CompileFunctionForCJSLoader(
|
||||
bool* cache_rejected,
|
||||
bool is_cjs_scope,
|
||||
ScriptCompiler::CachedData* cached_data) {
|
||||
@@ -477,10 +489,10 @@ index 21a08a738e5c3506d27e402762a4a267e9278588..475b5628f9b82a2b9b86343f25759c1e
|
||||
|
||||
Local<Symbol> symbol = env->vm_dynamic_import_default_internal();
|
||||
diff --git a/src/node_env_var.cc b/src/node_env_var.cc
|
||||
index 492d5f455f45a5c8a957ecdabed38709a633f640..48f9917113555c7ed87e37750c45d152fa4b68f8 100644
|
||||
index 6aad252eb5681bb9ab9890812602b43c418e7a7f..5f7ef8cc58f589ba30a44abaaaaaf1514458c3f0 100644
|
||||
--- a/src/node_env_var.cc
|
||||
+++ b/src/node_env_var.cc
|
||||
@@ -295,7 +295,7 @@ std::shared_ptr<KVStore> KVStore::CreateMapKVStore() {
|
||||
@@ -311,7 +311,7 @@ std::shared_ptr<KVStore> KVStore::CreateMapKVStore() {
|
||||
|
||||
Maybe<void> KVStore::AssignFromObject(Local<Context> context,
|
||||
Local<Object> entries) {
|
||||
@@ -490,7 +502,7 @@ index 492d5f455f45a5c8a957ecdabed38709a633f640..48f9917113555c7ed87e37750c45d152
|
||||
Local<Array> keys;
|
||||
if (!entries->GetOwnPropertyNames(context).ToLocal(&keys))
|
||||
diff --git a/src/node_errors.cc b/src/node_errors.cc
|
||||
index befb642f1effa3c4139e4cd99ff64d9c5175fd72..9c068afd1c4c3fadeee4ba035e67ec4ae72c7f73 100644
|
||||
index 4386a1bc5678e351ce084cd2c47202561619b164..8d51201ad24999ed8f54e16c7878432d41841cf2 100644
|
||||
--- a/src/node_errors.cc
|
||||
+++ b/src/node_errors.cc
|
||||
@@ -633,7 +633,7 @@ v8::ModifyCodeGenerationFromStringsResult ModifyCodeGenerationFromStrings(
|
||||
@@ -511,9 +523,9 @@ index befb642f1effa3c4139e4cd99ff64d9c5175fd72..9c068afd1c4c3fadeee4ba035e67ec4a
|
||||
switch (message->ErrorLevel()) {
|
||||
case Isolate::MessageErrorLevel::kMessageWarning: {
|
||||
Environment* env = Environment::GetCurrent(isolate);
|
||||
@@ -1118,7 +1118,7 @@ void Initialize(Local<Object> target,
|
||||
@@ -1161,7 +1161,7 @@ void Initialize(Local<Object> target,
|
||||
SetMethod(
|
||||
context, target, "triggerUncaughtException", TriggerUncaughtException);
|
||||
context, target, "getErrorSourcePositions", GetErrorSourcePositions);
|
||||
|
||||
- Isolate* isolate = context->GetIsolate();
|
||||
+ Isolate* isolate = Isolate::GetCurrent();
|
||||
@@ -521,10 +533,10 @@ index befb642f1effa3c4139e4cd99ff64d9c5175fd72..9c068afd1c4c3fadeee4ba035e67ec4a
|
||||
READONLY_PROPERTY(target, "exitCodes", exit_codes);
|
||||
|
||||
diff --git a/src/node_file.cc b/src/node_file.cc
|
||||
index d7009937b31729f33d9c45cbda7f5440fbdac2aa..e57a3140cd90d7e7852a0c6892091e50b850ae64 100644
|
||||
index d73dac2ee3f1cf1cac6845fae0f702c9fba8fcef..969e7d08086f8442bed476feaf15599b8c79db7c 100644
|
||||
--- a/src/node_file.cc
|
||||
+++ b/src/node_file.cc
|
||||
@@ -3753,7 +3753,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
@@ -3874,7 +3874,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
int index,
|
||||
InternalFieldInfoBase* info) {
|
||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||
@@ -534,10 +546,10 @@ index d7009937b31729f33d9c45cbda7f5440fbdac2aa..e57a3140cd90d7e7852a0c6892091e50
|
||||
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
||||
BindingData* binding =
|
||||
diff --git a/src/node_messaging.cc b/src/node_messaging.cc
|
||||
index 1eff9399ff87510164390a1dfea84158a8856b86..e912562d768308906286890b7015cf2c462bac49 100644
|
||||
index 57e068ae249d618c2658638f9f3b03e1fedb6524..8c51ae4e0a435971c6d0288af87810877dd31a49 100644
|
||||
--- a/src/node_messaging.cc
|
||||
+++ b/src/node_messaging.cc
|
||||
@@ -253,7 +253,7 @@ namespace {
|
||||
@@ -254,7 +254,7 @@ namespace {
|
||||
|
||||
MaybeLocal<Function> GetEmitMessageFunction(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
@@ -546,7 +558,7 @@ index 1eff9399ff87510164390a1dfea84158a8856b86..e912562d768308906286890b7015cf2c
|
||||
Local<Object> per_context_bindings;
|
||||
Local<Value> emit_message_val;
|
||||
if (!GetPerContextExports(context, isolate_data)
|
||||
@@ -268,7 +268,7 @@ MaybeLocal<Function> GetEmitMessageFunction(Local<Context> context,
|
||||
@@ -269,7 +269,7 @@ MaybeLocal<Function> GetEmitMessageFunction(Local<Context> context,
|
||||
}
|
||||
|
||||
MaybeLocal<Function> GetDOMException(Local<Context> context) {
|
||||
@@ -555,7 +567,7 @@ index 1eff9399ff87510164390a1dfea84158a8856b86..e912562d768308906286890b7015cf2c
|
||||
Local<Object> per_context_bindings;
|
||||
Local<Value> domexception_ctor_val;
|
||||
if (!GetPerContextExports(context).ToLocal(&per_context_bindings) ||
|
||||
@@ -283,7 +283,7 @@ MaybeLocal<Function> GetDOMException(Local<Context> context) {
|
||||
@@ -284,7 +284,7 @@ MaybeLocal<Function> GetDOMException(Local<Context> context) {
|
||||
}
|
||||
|
||||
void ThrowDataCloneException(Local<Context> context, Local<String> message) {
|
||||
@@ -564,7 +576,7 @@ index 1eff9399ff87510164390a1dfea84158a8856b86..e912562d768308906286890b7015cf2c
|
||||
Local<Value> argv[] = {message,
|
||||
FIXED_ONE_BYTE_STRING(isolate, "DataCloneError")};
|
||||
Local<Value> exception;
|
||||
@@ -1464,7 +1464,7 @@ BaseObjectPtr<BaseObject> JSTransferable::Data::Deserialize(
|
||||
@@ -1477,7 +1477,7 @@ BaseObjectPtr<BaseObject> JSTransferable::Data::Deserialize(
|
||||
|
||||
Maybe<bool> JSTransferable::Data::FinalizeTransferWrite(
|
||||
Local<Context> context, ValueSerializer* serializer) {
|
||||
@@ -574,10 +586,10 @@ index 1eff9399ff87510164390a1dfea84158a8856b86..e912562d768308906286890b7015cf2c
|
||||
data_.Reset();
|
||||
return ret;
|
||||
diff --git a/src/node_modules.cc b/src/node_modules.cc
|
||||
index 6204986dc97686a248d6ae483f3a413ee5c51e47..c0108310df81c9bd1756a6fb92466a7f84e53f7c 100644
|
||||
index bdbc511ef3f680bbac6770b89f47acaee95d56a2..d8477191efafba3c41c06d765f4b03bd00b8573c 100644
|
||||
--- a/src/node_modules.cc
|
||||
+++ b/src/node_modules.cc
|
||||
@@ -64,7 +64,7 @@ void BindingData::Deserialize(v8::Local<v8::Context> context,
|
||||
@@ -69,7 +69,7 @@ void BindingData::Deserialize(v8::Local<v8::Context> context,
|
||||
int index,
|
||||
InternalFieldInfoBase* info) {
|
||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||
@@ -586,7 +598,7 @@ index 6204986dc97686a248d6ae483f3a413ee5c51e47..c0108310df81c9bd1756a6fb92466a7f
|
||||
Realm* realm = Realm::GetCurrent(context);
|
||||
BindingData* binding = realm->AddBindingData<BindingData>(holder);
|
||||
CHECK_NOT_NULL(binding);
|
||||
@@ -706,7 +706,7 @@ void BindingData::CreatePerContextProperties(Local<Object> target,
|
||||
@@ -735,7 +735,7 @@ void BindingData::CreatePerContextProperties(Local<Object> target,
|
||||
Realm* realm = Realm::GetCurrent(context);
|
||||
realm->AddBindingData<BindingData>(target);
|
||||
|
||||
@@ -596,10 +608,10 @@ index 6204986dc97686a248d6ae483f3a413ee5c51e47..c0108310df81c9bd1756a6fb92466a7f
|
||||
|
||||
#define V(status) \
|
||||
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc
|
||||
index 1cb08b715865f8337e0292fc8e2a26488ba21694..2bd20fc173d4110282ee736e49b49ce0859088f3 100644
|
||||
index e453bacc3e5247493a3582c24174bfe6e590825d..fe4aad63bc877be105830a80aa6be10ce3f8fda4 100644
|
||||
--- a/src/node_process_methods.cc
|
||||
+++ b/src/node_process_methods.cc
|
||||
@@ -736,7 +736,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
@@ -737,7 +737,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
int index,
|
||||
InternalFieldInfoBase* info) {
|
||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||
@@ -609,10 +621,10 @@ index 1cb08b715865f8337e0292fc8e2a26488ba21694..2bd20fc173d4110282ee736e49b49ce0
|
||||
// Recreate the buffer in the constructor.
|
||||
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
||||
diff --git a/src/node_realm.cc b/src/node_realm.cc
|
||||
index cd2b4c0107594a8ba9bf671669e4c82326719908..d18945085ff1860bbe3796e0b47904210aafd941 100644
|
||||
index 2a5fe9fe501d1fd9356eeb7d044a872fa5a55f38..39f6f142044c42904d234da20a266315346c135a 100644
|
||||
--- a/src/node_realm.cc
|
||||
+++ b/src/node_realm.cc
|
||||
@@ -19,7 +19,7 @@ using v8::String;
|
||||
@@ -22,7 +22,7 @@ using v8::String;
|
||||
using v8::Value;
|
||||
|
||||
Realm::Realm(Environment* env, v8::Local<v8::Context> context, Kind kind)
|
||||
@@ -620,12 +632,12 @@ index cd2b4c0107594a8ba9bf671669e4c82326719908..d18945085ff1860bbe3796e0b4790421
|
||||
+ : env_(env), isolate_(v8::Isolate::GetCurrent()), kind_(kind) {
|
||||
context_.Reset(isolate_, context);
|
||||
env->AssignToContext(context, this, ContextInfo(""));
|
||||
}
|
||||
// The environment can also purge empty wrappers in the check callback,
|
||||
diff --git a/src/node_report.cc b/src/node_report.cc
|
||||
index df73a8204bc0917073a70ca68d019ceab3159b08..d7bb94db78b3a729f25ceaf66d193032056b36ff 100644
|
||||
index c82c6bcc083ba60137e83b3c291130636db3162f..0d06f61d7fb2472a3d7a66854040dc493406b79e 100644
|
||||
--- a/src/node_report.cc
|
||||
+++ b/src/node_report.cc
|
||||
@@ -399,7 +399,7 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer,
|
||||
@@ -400,7 +400,7 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer,
|
||||
if (!error.IsEmpty() && error->IsObject()) {
|
||||
TryCatch try_catch(isolate);
|
||||
Local<Object> error_obj = error.As<Object>();
|
||||
@@ -635,10 +647,10 @@ index df73a8204bc0917073a70ca68d019ceab3159b08..d7bb94db78b3a729f25ceaf66d193032
|
||||
if (!error_obj->GetOwnPropertyNames(context).ToLocal(&keys)) {
|
||||
return writer->json_objectend(); // the end of 'errorProperties'
|
||||
diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc
|
||||
index 69d8d15d8989ed31a19489e68588e730760c8ffb..d342a5ff91bbd9cb73c02c26ae3a36b9d0dc7b47 100644
|
||||
index c2e24b4645e7903e08c80aead1c18c7bcff1bd89..e34d24d51d5c090b560d06f727043f20924e6f46 100644
|
||||
--- a/src/node_snapshotable.cc
|
||||
+++ b/src/node_snapshotable.cc
|
||||
@@ -1613,7 +1613,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
@@ -1614,7 +1614,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
int index,
|
||||
InternalFieldInfoBase* info) {
|
||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||
@@ -648,10 +660,10 @@ index 69d8d15d8989ed31a19489e68588e730760c8ffb..d342a5ff91bbd9cb73c02c26ae3a36b9
|
||||
// Recreate the buffer in the constructor.
|
||||
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
||||
diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc
|
||||
index 8b6fe36e1fece112269ebf193d6322a4d1dacc0a..96101167016573e80fff520256ebb78c71d83302 100644
|
||||
index 7bb4d4108c8326d69da5236c7ea7f00ddb68cea9..cf9ce6686cffca7e700a0e20cb9f776a5f0f7c4a 100644
|
||||
--- a/src/node_sqlite.cc
|
||||
+++ b/src/node_sqlite.cc
|
||||
@@ -1858,7 +1858,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -2020,7 +2020,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
if (args[0]->IsObject() && !args[0]->IsArrayBufferView()) {
|
||||
Local<Object> obj = args[0].As<Object>();
|
||||
@@ -661,7 +673,7 @@ index 8b6fe36e1fece112269ebf193d6322a4d1dacc0a..96101167016573e80fff520256ebb78c
|
||||
if (!obj->GetOwnPropertyNames(context).ToLocal(&keys)) {
|
||||
return false;
|
||||
diff --git a/src/node_task_queue.cc b/src/node_task_queue.cc
|
||||
index c4257110d8b52017fccd8e1e746b557a0b7084df..6f00da0b515397d300e387f03f4a2bf71155cfe0 100644
|
||||
index d33ee3c26c111e53edf27e6368ca8f64ff30a349..f1c53c44f201b295888e7932c5e3e2b19cb9c319 100644
|
||||
--- a/src/node_task_queue.cc
|
||||
+++ b/src/node_task_queue.cc
|
||||
@@ -48,7 +48,7 @@ void PromiseRejectCallback(PromiseRejectMessage message) {
|
||||
@@ -674,10 +686,10 @@ index c4257110d8b52017fccd8e1e746b557a0b7084df..6f00da0b515397d300e387f03f4a2bf7
|
||||
|
||||
Environment* env = Environment::GetCurrent(isolate);
|
||||
diff --git a/src/node_url.cc b/src/node_url.cc
|
||||
index 09589e85e8bc131811204833d9a76f98c7b2a102..1154b452151b6b597aed67effbb3796c635d236b 100644
|
||||
index 9d1e8ec05161570db11f7b662395509774668d78..9b91f83d879ea02fd3d61913c8dfd35b3bf1ac31 100644
|
||||
--- a/src/node_url.cc
|
||||
+++ b/src/node_url.cc
|
||||
@@ -69,7 +69,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
@@ -70,7 +70,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
int index,
|
||||
InternalFieldInfoBase* info) {
|
||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||
@@ -687,10 +699,10 @@ index 09589e85e8bc131811204833d9a76f98c7b2a102..1154b452151b6b597aed67effbb3796c
|
||||
BindingData* binding = realm->AddBindingData<BindingData>(holder);
|
||||
CHECK_NOT_NULL(binding);
|
||||
diff --git a/src/node_v8.cc b/src/node_v8.cc
|
||||
index 430d5dd4f808af7b1790bd62f06d47b86100d4e9..08a741216d88c95d580e9281e174550001ff2b21 100644
|
||||
index 98e392f6d7118bee8a3d0bce4de1ded76a293001..152b030198c6b36efd2be6c06f5c6e8bbc7cfadb 100644
|
||||
--- a/src/node_v8.cc
|
||||
+++ b/src/node_v8.cc
|
||||
@@ -157,7 +157,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
@@ -158,7 +158,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
int index,
|
||||
InternalFieldInfoBase* info) {
|
||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||
@@ -700,10 +712,10 @@ index 430d5dd4f808af7b1790bd62f06d47b86100d4e9..08a741216d88c95d580e9281e1745500
|
||||
// Recreate the buffer in the constructor.
|
||||
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
||||
diff --git a/src/node_wasi.cc b/src/node_wasi.cc
|
||||
index 3f91b651b83a20e70d5b368e012f5ee4b9d16092..40c601acd752b559f7ffbc00c15728fbb5275ac5 100644
|
||||
index 370221d3cddc201180260ecb3a222bc831c91093..f5aff2f65fe6b9f48cf970ab3e7c57cfe4885f85 100644
|
||||
--- a/src/node_wasi.cc
|
||||
+++ b/src/node_wasi.cc
|
||||
@@ -49,7 +49,7 @@ using v8::WasmMemoryObject;
|
||||
@@ -50,7 +50,7 @@ using v8::WasmMemoryObject;
|
||||
static MaybeLocal<Value> WASIException(Local<Context> context,
|
||||
int errorno,
|
||||
const char* syscall) {
|
||||
@@ -712,20 +724,22 @@ index 3f91b651b83a20e70d5b368e012f5ee4b9d16092..40c601acd752b559f7ffbc00c15728fb
|
||||
Environment* env = Environment::GetCurrent(context);
|
||||
CHECK_NOT_NULL(env);
|
||||
const char* err_name = uvwasi_embedder_err_code_to_string(errorno);
|
||||
@@ -275,7 +275,7 @@ R WASI::WasiFunction<FT, F, R, Args...>::FastCallback(
|
||||
@@ -275,8 +275,8 @@ R WASI::WasiFunction<FT, F, R, Args...>::FastCallback(
|
||||
return EinvalError<R>();
|
||||
}
|
||||
|
||||
- v8::Isolate* isolate = receiver->GetIsolate();
|
||||
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
- Isolate* isolate = receiver->GetIsolate();
|
||||
- HandleScope scope(isolate);
|
||||
+ Isolate* isolate = Isolate::GetCurrent();
|
||||
+ HandleScope handle_scope(isolate);
|
||||
if (wasi->memory_.IsEmpty()) {
|
||||
THROW_ERR_WASI_NOT_STARTED(isolate);
|
||||
return EinvalError<R>();
|
||||
diff --git a/src/node_webstorage.cc b/src/node_webstorage.cc
|
||||
index 74ece724e207a69e2457598a199c12f1cebcfd4a..1705e430099c5a363e02010f83d729b0aa54f8e5 100644
|
||||
index cc90af827a3fbd14fb4cbfbfd39cc661f22cf6e1..5819d9bca845e0eed6d4d93564469d8f3c36200b 100644
|
||||
--- a/src/node_webstorage.cc
|
||||
+++ b/src/node_webstorage.cc
|
||||
@@ -58,7 +58,7 @@ using v8::Value;
|
||||
@@ -57,7 +57,7 @@ using v8::Value;
|
||||
} while (0)
|
||||
|
||||
static void ThrowQuotaExceededException(Local<Context> context) {
|
||||
@@ -734,7 +748,7 @@ index 74ece724e207a69e2457598a199c12f1cebcfd4a..1705e430099c5a363e02010f83d729b0
|
||||
auto dom_exception_str = FIXED_ONE_BYTE_STRING(isolate, "DOMException");
|
||||
auto err_name = FIXED_ONE_BYTE_STRING(isolate, "QuotaExceededError");
|
||||
auto err_message =
|
||||
@@ -434,7 +434,7 @@ Maybe<void> Storage::Store(Local<Name> key, Local<Value> value) {
|
||||
@@ -433,7 +433,7 @@ Maybe<void> Storage::Store(Local<Name> key, Local<Value> value) {
|
||||
}
|
||||
|
||||
static MaybeLocal<String> Uint32ToName(Local<Context> context, uint32_t index) {
|
||||
@@ -744,10 +758,10 @@ index 74ece724e207a69e2457598a199c12f1cebcfd4a..1705e430099c5a363e02010f83d729b0
|
||||
|
||||
static void Clear(const FunctionCallbackInfo<Value>& info) {
|
||||
diff --git a/src/node_worker.cc b/src/node_worker.cc
|
||||
index 8555ab556b5b74a1cf9cf30747f1f417bfe4e4d9..1a2532337504444d59098304b87e0d65f16e838c 100644
|
||||
index 62c53368d1173edb7eb42e3337049c46fd7cdda9..7d08d8af7f6d99f7bd41cb7eb91063c630b3f87b 100644
|
||||
--- a/src/node_worker.cc
|
||||
+++ b/src/node_worker.cc
|
||||
@@ -1289,8 +1289,6 @@ void GetEnvMessagePort(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -1466,8 +1466,6 @@ void GetEnvMessagePort(const FunctionCallbackInfo<Value>& args) {
|
||||
Local<Object> port = env->message_port();
|
||||
CHECK_IMPLIES(!env->is_main_thread(), !port.IsEmpty());
|
||||
if (!port.IsEmpty()) {
|
||||
@@ -757,10 +771,10 @@ index 8555ab556b5b74a1cf9cf30747f1f417bfe4e4d9..1a2532337504444d59098304b87e0d65
|
||||
}
|
||||
}
|
||||
diff --git a/src/timers.cc b/src/timers.cc
|
||||
index bf90e68479da141265f748775acacab513b8d437..5f0d07b4ac1d9b8df6c8bb059e5d07ac1a882b36 100644
|
||||
index da4206187f7c7d2becb8a101c1ff5346a10e13f4..03f0910926f3d403121e227cee32a546b2394e04 100644
|
||||
--- a/src/timers.cc
|
||||
+++ b/src/timers.cc
|
||||
@@ -117,7 +117,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
@@ -114,7 +114,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
int index,
|
||||
InternalFieldInfoBase* info) {
|
||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||
@@ -770,10 +784,10 @@ index bf90e68479da141265f748775acacab513b8d437..5f0d07b4ac1d9b8df6c8bb059e5d07ac
|
||||
// Recreate the buffer in the constructor.
|
||||
BindingData* binding = realm->AddBindingData<BindingData>(holder);
|
||||
diff --git a/src/util-inl.h b/src/util-inl.h
|
||||
index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330cb47c1a7 100644
|
||||
index 9d4db311024c5f526fc3c00764fff686af044026..da9268dcf2ff432ddeec7c0f61a147b73f3130e2 100644
|
||||
--- a/src/util-inl.h
|
||||
+++ b/src/util-inl.h
|
||||
@@ -326,14 +326,14 @@ v8::Maybe<void> FromV8Array(v8::Local<v8::Context> context,
|
||||
@@ -336,14 +336,14 @@ v8::Maybe<void> FromV8Array(v8::Local<v8::Context> context,
|
||||
std::vector<v8::Global<v8::Value>>* out) {
|
||||
uint32_t count = js_array->Length();
|
||||
out->reserve(count);
|
||||
@@ -790,7 +804,7 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330
|
||||
if (str.size() >= static_cast<size_t>(v8::String::kMaxLength)) [[unlikely]] {
|
||||
// V8 only has a TODO comment about adding an exception when the maximum
|
||||
// string size is exceeded.
|
||||
@@ -349,7 +349,7 @@ v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
||||
@@ -359,7 +359,7 @@ v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
||||
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
||||
v8_inspector::StringView str,
|
||||
v8::Isolate* isolate) {
|
||||
@@ -799,7 +813,7 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330
|
||||
if (str.length() >= static_cast<size_t>(v8::String::kMaxLength))
|
||||
[[unlikely]] {
|
||||
// V8 only has a TODO comment about adding an exception when the maximum
|
||||
@@ -376,7 +376,7 @@ template <typename T>
|
||||
@@ -386,7 +386,7 @@ template <typename T>
|
||||
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
||||
const std::vector<T>& vec,
|
||||
v8::Isolate* isolate) {
|
||||
@@ -808,7 +822,7 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330
|
||||
v8::EscapableHandleScope handle_scope(isolate);
|
||||
|
||||
MaybeStackBuffer<v8::Local<v8::Value>, 128> arr(vec.size());
|
||||
@@ -393,7 +393,7 @@ template <typename T>
|
||||
@@ -403,7 +403,7 @@ template <typename T>
|
||||
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
||||
const std::set<T>& set,
|
||||
v8::Isolate* isolate) {
|
||||
@@ -817,7 +831,16 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330
|
||||
v8::Local<v8::Set> set_js = v8::Set::New(isolate);
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
@@ -412,7 +412,7 @@ template <typename T, typename U>
|
||||
@@ -422,7 +422,7 @@ template <typename T, std::size_t U>
|
||||
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
||||
const std::ranges::elements_view<T, U>& vec,
|
||||
v8::Isolate* isolate) {
|
||||
- if (isolate == nullptr) isolate = context->GetIsolate();
|
||||
+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope handle_scope(isolate);
|
||||
|
||||
MaybeStackBuffer<v8::Local<v8::Value>, 128> arr(vec.size());
|
||||
@@ -441,7 +441,7 @@ template <typename T, typename U>
|
||||
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
||||
const std::unordered_map<T, U>& map,
|
||||
v8::Isolate* isolate) {
|
||||
@@ -826,7 +849,7 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330
|
||||
v8::EscapableHandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Map> ret = v8::Map::New(isolate);
|
||||
@@ -455,7 +455,7 @@ template <typename T, typename>
|
||||
@@ -484,7 +484,7 @@ template <typename T, typename>
|
||||
v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
||||
const T& number,
|
||||
v8::Isolate* isolate) {
|
||||
@@ -835,7 +858,7 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330
|
||||
return ConvertNumberToV8Value(isolate, number);
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ v8::Local<v8::Array> ToV8ValuePrimitiveArray(v8::Local<v8::Context> context,
|
||||
@@ -497,7 +497,7 @@ v8::Local<v8::Array> ToV8ValuePrimitiveArray(v8::Local<v8::Context> context,
|
||||
std::is_floating_point_v<T>,
|
||||
"Only primitive types (bool, integral, floating-point) are supported.");
|
||||
|
||||
@@ -844,11 +867,20 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330
|
||||
v8::EscapableHandleScope handle_scope(isolate);
|
||||
|
||||
v8::LocalVector<v8::Value> elements(isolate);
|
||||
@@ -731,7 +731,7 @@ inline v8::MaybeLocal<v8::Object> NewDictionaryInstanceNullProto(
|
||||
if (value.IsEmpty()) return v8::MaybeLocal<v8::Object>();
|
||||
}
|
||||
v8::Local<v8::Object> obj = tmpl->NewInstance(context, property_values);
|
||||
- if (obj->SetPrototypeV2(context, v8::Null(context->GetIsolate()))
|
||||
+ if (obj->SetPrototypeV2(context, v8::Null(v8::Isolate::GetCurrent()))
|
||||
.IsNothing()) {
|
||||
return v8::MaybeLocal<v8::Object>();
|
||||
}
|
||||
diff --git a/src/util.cc b/src/util.cc
|
||||
index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3cc469a46d 100644
|
||||
index 660cfff6b8a0c583be843e555e7a06cd09e0d279..c4b39450c5b7f91c46f7027db367c30db34927bb 100644
|
||||
--- a/src/util.cc
|
||||
+++ b/src/util.cc
|
||||
@@ -393,7 +393,7 @@ void SetMethod(Local<v8::Context> context,
|
||||
@@ -391,7 +391,7 @@ void SetMethod(Local<v8::Context> context,
|
||||
Local<v8::Object> that,
|
||||
const std::string_view name,
|
||||
v8::FunctionCallback callback) {
|
||||
@@ -857,7 +889,7 @@ index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3c
|
||||
Local<v8::Function> function =
|
||||
NewFunctionTemplate(isolate,
|
||||
callback,
|
||||
@@ -454,7 +454,7 @@ void SetFastMethod(Local<v8::Context> context,
|
||||
@@ -452,7 +452,7 @@ void SetFastMethod(Local<v8::Context> context,
|
||||
const std::string_view name,
|
||||
v8::FunctionCallback slow_callback,
|
||||
const v8::CFunction* c_function) {
|
||||
@@ -866,7 +898,7 @@ index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3c
|
||||
Local<v8::Function> function =
|
||||
NewFunctionTemplate(isolate,
|
||||
slow_callback,
|
||||
@@ -476,7 +476,7 @@ void SetFastMethodNoSideEffect(Local<v8::Context> context,
|
||||
@@ -474,7 +474,7 @@ void SetFastMethodNoSideEffect(Local<v8::Context> context,
|
||||
const std::string_view name,
|
||||
v8::FunctionCallback slow_callback,
|
||||
const v8::CFunction* c_function) {
|
||||
@@ -875,7 +907,7 @@ index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3c
|
||||
Local<v8::Function> function =
|
||||
NewFunctionTemplate(isolate,
|
||||
slow_callback,
|
||||
@@ -564,7 +564,7 @@ void SetMethodNoSideEffect(Local<v8::Context> context,
|
||||
@@ -562,7 +562,7 @@ void SetMethodNoSideEffect(Local<v8::Context> context,
|
||||
Local<v8::Object> that,
|
||||
const std::string_view name,
|
||||
v8::FunctionCallback callback) {
|
||||
@@ -884,7 +916,7 @@ index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3c
|
||||
Local<v8::Function> function =
|
||||
NewFunctionTemplate(isolate,
|
||||
callback,
|
||||
@@ -665,7 +665,7 @@ void SetConstructorFunction(Local<v8::Context> context,
|
||||
@@ -689,7 +689,7 @@ void SetConstructorFunction(Local<v8::Context> context,
|
||||
const char* name,
|
||||
Local<v8::FunctionTemplate> tmpl,
|
||||
SetConstructorFunctionFlag flag) {
|
||||
@@ -894,10 +926,10 @@ index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3c
|
||||
context, that, OneByteString(isolate, name), tmpl, flag);
|
||||
}
|
||||
diff --git a/src/util.h b/src/util.h
|
||||
index 7c98de621ca4d53cbaaa5bd4488aab20c7b033a7..329d2397c87ac37d157e3325e2ab62907d7286b4 100644
|
||||
index 2b351235cf7f32c9fad25367cc912d187466f1e0..6da57f95165bbdedb65dab6eaae8c39b815ee4e5 100644
|
||||
--- a/src/util.h
|
||||
+++ b/src/util.h
|
||||
@@ -756,7 +756,7 @@ inline v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
|
||||
@@ -739,7 +739,7 @@ inline v8::MaybeLocal<v8::Value> ToV8Value(
|
||||
// Variation on NODE_DEFINE_CONSTANT that sets a String value.
|
||||
#define NODE_DEFINE_STRING_CONSTANT(target, name, constant) \
|
||||
do { \
|
||||
|
||||
@@ -11,10 +11,10 @@ really in 20/21. We have to wait until 22 is released to be able to
|
||||
build with upstream GN files.
|
||||
|
||||
diff --git a/configure.py b/configure.py
|
||||
index 91283ca577f580dbf1e0c4e2dbf851a9ceaa38ed..e8eaff30ec947677db2d45425f9180759d0c55de 100755
|
||||
index 7f73f084ef1a8336089e6a16423c2eb310c0b9f2..96eedd5d9ae05ee6704724290973251059d5dd78 100755
|
||||
--- a/configure.py
|
||||
+++ b/configure.py
|
||||
@@ -1728,7 +1728,7 @@ def configure_v8(o, configs):
|
||||
@@ -1730,7 +1730,7 @@ def configure_v8(o, configs):
|
||||
# Until we manage to get rid of all those, v8_enable_sandbox cannot be used.
|
||||
# Note that enabling pointer compression without enabling sandbox is unsupported by V8,
|
||||
# so this can be broken at any time.
|
||||
@@ -68,10 +68,10 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea46
|
||||
|
||||
assert(!node_enable_inspector || node_use_openssl,
|
||||
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
|
||||
index b83aa87c969fb4e71cb202816713af869bb76283..c54df6fee333ddfe59b9df7e0ddd2935b4dcb33f 100644
|
||||
index 581b9886ded52f294b7cc6b080b2269b7617c85e..e43e2559aaf48add88aad342b1c96fd34f26c87f 100644
|
||||
--- a/src/node_builtins.cc
|
||||
+++ b/src/node_builtins.cc
|
||||
@@ -789,6 +789,7 @@ void BuiltinLoader::RegisterExternalReferences(
|
||||
@@ -774,6 +774,7 @@ void BuiltinLoader::RegisterExternalReferences(
|
||||
registry->Register(GetNatives);
|
||||
|
||||
RegisterExternalReferencesForInternalizedBuiltinCode(registry);
|
||||
@@ -80,10 +80,10 @@ index b83aa87c969fb4e71cb202816713af869bb76283..c54df6fee333ddfe59b9df7e0ddd2935
|
||||
|
||||
} // namespace builtins
|
||||
diff --git a/src/node_builtins.h b/src/node_builtins.h
|
||||
index f9426599f2d5dc6ad061407f0c4eb2c9203a4433..302030f610965f07dd6998d282275c1bdf738009 100644
|
||||
index 7a7b84337feb67960819472e43192dbdc151e299..bcdd50f635757f41287c87df1db9cd3b55c4b6b9 100644
|
||||
--- a/src/node_builtins.h
|
||||
+++ b/src/node_builtins.h
|
||||
@@ -74,6 +74,8 @@ using BuiltinCodeCacheMap =
|
||||
@@ -75,6 +75,8 @@ using BuiltinCodeCacheMap =
|
||||
// Generated by tools/js2c.cc as node_javascript.cc
|
||||
void RegisterExternalReferencesForInternalizedBuiltinCode(
|
||||
ExternalReferenceRegistry* registry);
|
||||
@@ -92,26 +92,6 @@ index f9426599f2d5dc6ad061407f0c4eb2c9203a4433..302030f610965f07dd6998d282275c1b
|
||||
|
||||
// Handles compilation and caching of built-in JavaScript modules and
|
||||
// bootstrap scripts, whose source are bundled into the binary as static data.
|
||||
diff --git a/tools/install.py b/tools/install.py
|
||||
index 8797b59e59c85a8877b977fa3281e50165e6f6b2..0af01e075616195f38fb242626dcab770ec1eb57 100755
|
||||
--- a/tools/install.py
|
||||
+++ b/tools/install.py
|
||||
@@ -222,6 +222,7 @@ def headers(options, action):
|
||||
'include/cppgc/internal/caged-heap-local-data.h',
|
||||
'include/cppgc/internal/caged-heap.h',
|
||||
'include/cppgc/internal/compiler-specific.h',
|
||||
+ 'include/cppgc/internal/conditional-stack-allocated.h',
|
||||
'include/cppgc/internal/finalizer-trait.h',
|
||||
'include/cppgc/internal/gc-info.h',
|
||||
'include/cppgc/internal/logging.h',
|
||||
@@ -301,6 +302,7 @@ def headers(options, action):
|
||||
'include/v8-promise.h',
|
||||
'include/v8-proxy.h',
|
||||
'include/v8-regexp.h',
|
||||
+ 'include/v8-sandbox.h',
|
||||
'include/v8-script.h',
|
||||
'include/v8-snapshot.h',
|
||||
'include/v8-source-location.h',
|
||||
diff --git a/tools/js2c.cc b/tools/js2c.cc
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
@@ -271,7 +251,7 @@ index 856878c33681a73d41016729dabe48b0a6a80589..91a11852d206b65485fe90fd037a0bd1
|
||||
if sys.platform == 'win32':
|
||||
files = [ x.replace('\\', '/') for x in files ]
|
||||
diff --git a/unofficial.gni b/unofficial.gni
|
||||
index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f5294aab9d37 100644
|
||||
index c742b62c484e9dd205eff63dcffad78c76828375..20d2483bb16e297ab5b12aab6f56948d6d25cb03 100644
|
||||
--- a/unofficial.gni
|
||||
+++ b/unofficial.gni
|
||||
@@ -147,31 +147,41 @@ template("node_gn_build") {
|
||||
@@ -339,7 +319,7 @@ index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f529
|
||||
executable(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
|
||||
@@ -297,6 +311,7 @@ template("node_gn_build") {
|
||||
@@ -314,6 +328,7 @@ template("node_gn_build") {
|
||||
}
|
||||
|
||||
executable("node_js2c") {
|
||||
@@ -347,7 +327,7 @@ index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f529
|
||||
deps = [
|
||||
"deps/uv",
|
||||
"$node_simdutf_path",
|
||||
@@ -307,26 +322,75 @@ template("node_gn_build") {
|
||||
@@ -324,26 +339,75 @@ template("node_gn_build") {
|
||||
"src/embedded_data.cc",
|
||||
"src/embedded_data.h",
|
||||
]
|
||||
@@ -433,7 +413,7 @@ index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f529
|
||||
outputs = [ "$target_gen_dir/node_javascript.cc" ]
|
||||
|
||||
# Get the path to node_js2c executable of the host toolchain.
|
||||
@@ -340,11 +404,11 @@ template("node_gn_build") {
|
||||
@@ -357,11 +421,11 @@ template("node_gn_build") {
|
||||
get_label_info(":node_js2c($host_toolchain)", "name") +
|
||||
host_executable_suffix
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ We don't need to do this for zlib, as the existing gn workflow uses the same
|
||||
Upstreamed at https://github.com/nodejs/node/pull/55903
|
||||
|
||||
diff --git a/unofficial.gni b/unofficial.gni
|
||||
index 26ebc811272ef2990f8d090c54e7f5294aab9d37..8886f2a79ae77614789d6ae0defd4f18fc756456 100644
|
||||
index 20d2483bb16e297ab5b12aab6f56948d6d25cb03..253226009faf563f6db285d4b2908f308c1f96ea 100644
|
||||
--- a/unofficial.gni
|
||||
+++ b/unofficial.gni
|
||||
@@ -160,7 +160,6 @@ template("node_gn_build") {
|
||||
|
||||
@@ -14,7 +14,7 @@ error: duplicate symbol: crdtp::ProtocolTypeTraits<std::__Cr::basic_string<char,
|
||||
Some distinguishing change should be upstreamed to Node.js.
|
||||
|
||||
diff --git a/src/inspector/node_string.cc b/src/inspector/node_string.cc
|
||||
index 8521730bd03cdfce47e9b5d0f5d68a568bc3de8c..28f4598aa7ea0e93350f79566c06d0f08313be9f 100644
|
||||
index e2148e954217b9b999e9713e95f1a115ccf7d657..7ec7464cdc0ef00e6600fb897ae99e44ed0f4ad8 100644
|
||||
--- a/src/inspector/node_string.cc
|
||||
+++ b/src/inspector/node_string.cc
|
||||
@@ -7,7 +7,8 @@
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 4 Sep 2024 16:39:23 +0200
|
||||
Subject: build: compile with C++20 support
|
||||
|
||||
Refs https://github.com/nodejs/node/pull/45427
|
||||
|
||||
V8 requires C++20 support as of https://chromium-review.googlesource.com/c/v8/v8/+/5587859.
|
||||
|
||||
This can be removed when Electron upgrades to a version of Node.js containing the required V8 version.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index c28d6f5fe2c922f0b1e3f7e56289c78e7b91c294..95c56305926fc3e0e46e4cf99ec86d3d1b5576a7 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -539,7 +539,7 @@
|
||||
'-fno-rtti',
|
||||
'-fno-exceptions',
|
||||
'-fno-strict-aliasing',
|
||||
- '-std=gnu++17',
|
||||
+ '-std=gnu++20',
|
||||
],
|
||||
'defines': [ '__STDC_FORMAT_MACROS' ],
|
||||
'ldflags': [ '-rdynamic' ],
|
||||
@@ -719,7 +719,7 @@
|
||||
['clang==1', {
|
||||
'xcode_settings': {
|
||||
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
|
||||
- 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++17', # -std=gnu++17
|
||||
+ 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++20', # -std=gnu++20
|
||||
'CLANG_CXX_LIBRARY': 'libc++',
|
||||
},
|
||||
}],
|
||||
@@ -33,10 +33,10 @@ index 8d7204f6cb48f783adc4d1c1eb2de0c83b7fffe2..a154559a56bf383d3c26af523c9bb07b
|
||||
|
||||
// Non-alphabetic chars.
|
||||
diff --git a/lib/internal/http.js b/lib/internal/http.js
|
||||
index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327199acfd5 100644
|
||||
index 9bf929f7f3360f13058d3f446c18a36cd15bea58..abf9a06d891488288bccd98c437746c1ce48bf83 100644
|
||||
--- a/lib/internal/http.js
|
||||
+++ b/lib/internal/http.js
|
||||
@@ -8,8 +8,8 @@ const {
|
||||
@@ -11,8 +11,8 @@ const {
|
||||
const { setUnrefTimeout } = require('internal/timers');
|
||||
const { getCategoryEnabledBuffer, trace } = internalBinding('trace_events');
|
||||
const {
|
||||
@@ -46,8 +46,8 @@ index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327
|
||||
+ CHAR_UPPERCASE_E,
|
||||
} = require('internal/constants');
|
||||
|
||||
let utcCache;
|
||||
@@ -44,11 +44,13 @@ function isTraceHTTPEnabled() {
|
||||
const { URL } = require('internal/url');
|
||||
@@ -51,11 +51,13 @@ function isTraceHTTPEnabled() {
|
||||
const traceEventCategory = 'node,node.http';
|
||||
|
||||
function traceBegin(...args) {
|
||||
@@ -62,12 +62,12 @@ index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327
|
||||
+ trace(CHAR_UPPERCASE_E, traceEventCategory, ...args);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
function ipToInt(ip) {
|
||||
diff --git a/node.gyp b/node.gyp
|
||||
index 0e0071b508f605bb9b7722f8304814dc176d907e..bcb9f371c4e4d8c665058115dc39eaa65125d679 100644
|
||||
index 420d57135f48df59b2cbd33497ef90b6148017e6..eefb1e0577b881da7a1570fd7ac465fe8b06747c 100644
|
||||
--- a/node.gyp
|
||||
+++ b/node.gyp
|
||||
@@ -174,7 +174,6 @@
|
||||
@@ -176,7 +176,6 @@
|
||||
'src/timers.cc',
|
||||
'src/timer_wrap.cc',
|
||||
'src/tracing/agent.cc',
|
||||
@@ -75,7 +75,7 @@ index 0e0071b508f605bb9b7722f8304814dc176d907e..bcb9f371c4e4d8c665058115dc39eaa6
|
||||
'src/tracing/node_trace_writer.cc',
|
||||
'src/tracing/trace_event.cc',
|
||||
'src/tracing/traced_value.cc',
|
||||
@@ -302,7 +301,6 @@
|
||||
@@ -308,7 +307,6 @@
|
||||
'src/tcp_wrap.h',
|
||||
'src/timers.h',
|
||||
'src/tracing/agent.h',
|
||||
|
||||
@@ -7,7 +7,7 @@ Subject: build: ensure native module compilation fails if not using a new
|
||||
This should not be upstreamed, it is a quality-of-life patch for downstream module builders.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index 6b79de07be3f839af5b0644f19bfef9c33de590e..c28d6f5fe2c922f0b1e3f7e56289c78e7b91c294 100644
|
||||
index 29a912f58e7b522ae21fddac510946cbcbaaa4cc..aea3a882c338eb757bef9e85fabab3fc7e7495f7 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -89,6 +89,8 @@
|
||||
@@ -42,10 +42,10 @@ index 6b79de07be3f839af5b0644f19bfef9c33de590e..c28d6f5fe2c922f0b1e3f7e56289c78e
|
||||
# list in v8/BUILD.gn.
|
||||
['v8_enable_v8_checks == 1', {
|
||||
diff --git a/configure.py b/configure.py
|
||||
index e8eaff30ec947677db2d45425f9180759d0c55de..dc2d9d80059e845b33444f8bdc29e82d0fe0e26b 100755
|
||||
index 96eedd5d9ae05ee6704724290973251059d5dd78..52060f9c6dc1bcec67a0fd4710e01e73a6cf276c 100755
|
||||
--- a/configure.py
|
||||
+++ b/configure.py
|
||||
@@ -1710,6 +1710,7 @@ def configure_library(lib, output, pkgname=None):
|
||||
@@ -1711,6 +1711,7 @@ def configure_library(lib, output, pkgname=None):
|
||||
def configure_v8(o, configs):
|
||||
set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0)
|
||||
|
||||
@@ -54,7 +54,7 @@ index e8eaff30ec947677db2d45425f9180759d0c55de..dc2d9d80059e845b33444f8bdc29e82d
|
||||
o['variables']['v8_enable_javascript_promise_hooks'] = 1
|
||||
o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index a336f44dc1e785ea237865077216d41ab032c0af..96c599aa6448e2aa8e57e84f811564a5281c139a 100644
|
||||
index c5ade4bd30456cde33379c6202b65709650d3ec0..f7b3f90b0c2cfbeacc5bc50112dd711df8d3c364 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -22,6 +22,12 @@
|
||||
|
||||
@@ -10,7 +10,7 @@ JS errors and ensures embedder JS is loaded via LoadEmbedderJavaScriptSource.
|
||||
That method is generated by our modifications to js2c.cc in the BUILD.gn patch
|
||||
|
||||
diff --git a/lib/internal/fs/watchers.js b/lib/internal/fs/watchers.js
|
||||
index 0244a214b187e67e0cb89f26cd019855963ec93a..b65a3be6bcb0e28f7f43367d0fa9da533db9d0d1 100644
|
||||
index 605dee28cace56f2366fec9d7f18894559044ae4..15dcabb3b1682438eb6d5a681363b7ea8602b9e7 100644
|
||||
--- a/lib/internal/fs/watchers.js
|
||||
+++ b/lib/internal/fs/watchers.js
|
||||
@@ -299,12 +299,13 @@ function emitCloseNT(self) {
|
||||
@@ -34,10 +34,10 @@ index 0244a214b187e67e0cb89f26cd019855963ec93a..b65a3be6bcb0e28f7f43367d0fa9da53
|
||||
let kResistStopPropagation;
|
||||
|
||||
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
|
||||
index c54df6fee333ddfe59b9df7e0ddd2935b4dcb33f..4b288e0f89e0156cb5b0555c0259b2c1150770db 100644
|
||||
index e43e2559aaf48add88aad342b1c96fd34f26c87f..e69eb280050cae0c0f394b2f956eef947e628904 100644
|
||||
--- a/src/node_builtins.cc
|
||||
+++ b/src/node_builtins.cc
|
||||
@@ -35,6 +35,7 @@ using v8::Value;
|
||||
@@ -39,6 +39,7 @@ using v8::Value;
|
||||
BuiltinLoader::BuiltinLoader()
|
||||
: config_(GetConfig()), code_cache_(std::make_shared<BuiltinCodeCache>()) {
|
||||
LoadJavaScriptSource();
|
||||
@@ -46,10 +46,10 @@ index c54df6fee333ddfe59b9df7e0ddd2935b4dcb33f..4b288e0f89e0156cb5b0555c0259b2c1
|
||||
AddExternalizedBuiltin(
|
||||
"internal/deps/cjs-module-lexer/lexer",
|
||||
diff --git a/src/node_builtins.h b/src/node_builtins.h
|
||||
index 302030f610965f07dd6998d282275c1bdf738009..35cb7766eeccc62dd2f0ce9484a2f1ec7beccc05 100644
|
||||
index bcdd50f635757f41287c87df1db9cd3b55c4b6b9..e908f3c0e314b90ff7b6c599940ea8f4e657c709 100644
|
||||
--- a/src/node_builtins.h
|
||||
+++ b/src/node_builtins.h
|
||||
@@ -138,6 +138,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {
|
||||
@@ -141,6 +141,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {
|
||||
|
||||
// Generated by tools/js2c.cc as node_javascript.cc
|
||||
void LoadJavaScriptSource(); // Loads data into source_
|
||||
|
||||
@@ -11,7 +11,7 @@ node-gyp will use the result of `process.config` that reflects the environment
|
||||
in which the binary got built.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index 95c56305926fc3e0e46e4cf99ec86d3d1b5576a7..45bb2c4ff94ceac377c9117da4497cdc5ac41171 100644
|
||||
index aea3a882c338eb757bef9e85fabab3fc7e7495f7..9303217fb05190c734e410a524a6921723d665d5 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -128,6 +128,7 @@
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: John Kleinschmidt <jkleinsc@electronjs.org>
|
||||
Date: Fri, 28 Feb 2025 11:24:53 -0500
|
||||
Subject: chore: add createExternalizableTwoByteString to globals
|
||||
|
||||
https://chromium-review.googlesource.com/c/v8/v8/+/6304942 added
|
||||
createExternalizableTwoByteString, so make sure it is handled
|
||||
as a global in the parallel/test-fs-write test.
|
||||
|
||||
diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js
|
||||
index 82f3425de2aa162aa97047098806a08d0f8be4bd..31ab5b833db94fec6f2e976f53f650bc6318e794 100644
|
||||
--- a/test/parallel/test-fs-write.js
|
||||
+++ b/test/parallel/test-fs-write.js
|
||||
@@ -48,6 +48,7 @@ assert.notStrictEqual(isOneByteString, undefined);
|
||||
// Account for extra globals exposed by --expose_externalize_string.
|
||||
common.allowGlobals(
|
||||
createExternalizableString,
|
||||
+ createExternalizableTwoByteString,
|
||||
externalizeString,
|
||||
isOneByteString,
|
||||
globalThis.x,
|
||||
@@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: David Sanders <dsanders11@ucsbalum.com>
|
||||
Date: Mon, 21 Jul 2025 16:58:56 -0700
|
||||
Subject: chore: add missing include of <iterator>
|
||||
|
||||
This has been upstreamed at https://github.com/ada-url/ada/pull/982
|
||||
|
||||
diff --git a/deps/ada/ada.cpp b/deps/ada/ada.cpp
|
||||
index d7f9b3a92c5330dad1cbd9f6f0bdd96908a4ad13..68fe0701bced5db86834ebd8232d4fe5ae7ed308 100644
|
||||
--- a/deps/ada/ada.cpp
|
||||
+++ b/deps/ada/ada.cpp
|
||||
@@ -11217,6 +11217,7 @@ ada_warn_unused std::string to_string(ada::state state) {
|
||||
|
||||
#include <numeric>
|
||||
#include <algorithm>
|
||||
+#include <iterator>
|
||||
#include <string>
|
||||
|
||||
namespace ada {
|
||||
@@ -13067,6 +13068,7 @@ template url_aggregator parse_url<url_aggregator>(
|
||||
/* end file src/parser.cpp */
|
||||
/* begin file src/url_components.cpp */
|
||||
|
||||
+#include <iterator>
|
||||
#include <numeric>
|
||||
#include <string>
|
||||
|
||||
@@ -13192,6 +13194,7 @@ namespace ada {
|
||||
/* end file src/url_components.cpp */
|
||||
/* begin file src/url_aggregator.cpp */
|
||||
|
||||
+#include <iterator>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
@@ -8,10 +8,10 @@ they use themselves as the entry point. We should try to upstream some form
|
||||
of this.
|
||||
|
||||
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
|
||||
index 98ed40e3076f6628b1771dade63ac51600e8e447..1eba13caf1e00a8b41b2cf8afc4168c8f98be69f 100644
|
||||
index c7f86098bdb00b6be84d547a0ac41919fa1bbb0f..35b43990c8f24f0888f89173f5662050a11b26ed 100644
|
||||
--- a/lib/internal/process/pre_execution.js
|
||||
+++ b/lib/internal/process/pre_execution.js
|
||||
@@ -245,12 +245,14 @@ function patchProcessObject(expandArgv1) {
|
||||
@@ -243,12 +243,14 @@ function patchProcessObject(expandArgv1) {
|
||||
// the entry point.
|
||||
if (expandArgv1 && process.argv[1] && process.argv[1][0] !== '-') {
|
||||
// Expand process.argv[1] into a full path.
|
||||
|
||||
@@ -20,7 +20,7 @@ index ab7dc27de3e304f6d912d5834da47e3b4eb25495..b6c0fd4ceee989dac55c7d54e52fef18
|
||||
}
|
||||
}
|
||||
diff --git a/unofficial.gni b/unofficial.gni
|
||||
index 8886f2a79ae77614789d6ae0defd4f18fc756456..a64d2e4ac475abc049fff7ea62ec76de565a747d 100644
|
||||
index 253226009faf563f6db285d4b2908f308c1f96ea..dd686d2f7c8d2f6e8d6bd13a7bf2b4b140556ba9 100644
|
||||
--- a/unofficial.gni
|
||||
+++ b/unofficial.gni
|
||||
@@ -143,7 +143,10 @@ template("node_gn_build") {
|
||||
@@ -35,7 +35,7 @@ index 8886f2a79ae77614789d6ae0defd4f18fc756456..a64d2e4ac475abc049fff7ea62ec76de
|
||||
public_configs = [
|
||||
":node_external_config",
|
||||
"deps/googletest:googletest_config",
|
||||
@@ -345,6 +348,7 @@ template("node_gn_build") {
|
||||
@@ -362,6 +365,7 @@ template("node_gn_build") {
|
||||
"src/embedded_data.h",
|
||||
]
|
||||
include_dirs = [ "src", "tools" ]
|
||||
|
||||
@@ -11,10 +11,10 @@ its own blended handler between Node and Blink.
|
||||
Not upstreamable.
|
||||
|
||||
diff --git a/lib/internal/modules/esm/utils.js b/lib/internal/modules/esm/utils.js
|
||||
index 9b41db8b0714b7408f79cbd5b4c460d9bc08f239..35ecfb9bbaf2c8e7351e1c69da84c82a4a7cb049 100644
|
||||
index 4a4279459341e87784ee8efa832dc74371c4a708..88d84786e72cf8712e0b9bda16c418d4087fe549 100644
|
||||
--- a/lib/internal/modules/esm/utils.js
|
||||
+++ b/lib/internal/modules/esm/utils.js
|
||||
@@ -30,7 +30,7 @@ const {
|
||||
@@ -34,7 +34,7 @@ const {
|
||||
ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING,
|
||||
ERR_INVALID_ARG_VALUE,
|
||||
} = require('internal/errors').codes;
|
||||
@@ -23,8 +23,8 @@ index 9b41db8b0714b7408f79cbd5b4c460d9bc08f239..35ecfb9bbaf2c8e7351e1c69da84c82a
|
||||
const {
|
||||
loadPreloadModules,
|
||||
initializeFrozenIntrinsics,
|
||||
@@ -281,12 +281,13 @@ let _forceDefaultLoader = false;
|
||||
* @param {boolean} [forceDefaultLoader=false] - A boolean indicating disabling custom loaders.
|
||||
@@ -291,12 +291,13 @@ let _forceDefaultLoader = false;
|
||||
* @param {boolean} [forceDefaultLoader] - A boolean indicating disabling custom loaders.
|
||||
*/
|
||||
function initializeESM(forceDefaultLoader = false) {
|
||||
+ const shouldSetOnIsolate = !getEmbedderOptions().shouldNotRegisterESMLoader;
|
||||
@@ -40,19 +40,19 @@ index 9b41db8b0714b7408f79cbd5b4c460d9bc08f239..35ecfb9bbaf2c8e7351e1c69da84c82a
|
||||
|
||||
/**
|
||||
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
|
||||
index c52e20d742942667f43ea3e151fc6702260b176b..cbb3e7f4df72f83cb8a1afc25a7429218792e964 100644
|
||||
index 5783728da2894270f902f47b210008df0e911bde..8fed194cbae9ce75bd0805b4df30b4de64fbbefa 100644
|
||||
--- a/src/module_wrap.cc
|
||||
+++ b/src/module_wrap.cc
|
||||
@@ -901,7 +901,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
|
||||
return module->module_.Get(isolate);
|
||||
@@ -1097,7 +1097,7 @@ Maybe<ModuleWrap*> ModuleWrap::ResolveModule(
|
||||
return Just(module_wrap);
|
||||
}
|
||||
|
||||
-static MaybeLocal<Promise> ImportModuleDynamically(
|
||||
+MaybeLocal<Promise> ImportModuleDynamically(
|
||||
-static MaybeLocal<Promise> ImportModuleDynamicallyWithPhase(
|
||||
+MaybeLocal<Promise> ImportModuleDynamicallyWithPhase(
|
||||
Local<Context> context,
|
||||
Local<Data> host_defined_options,
|
||||
Local<Value> resource_name,
|
||||
@@ -973,12 +973,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback(
|
||||
@@ -1185,14 +1185,16 @@ void ModuleWrap::SetImportModuleDynamicallyCallback(
|
||||
Realm* realm = Realm::GetCurrent(args);
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
@@ -63,12 +63,16 @@ index c52e20d742942667f43ea3e151fc6702260b176b..cbb3e7f4df72f83cb8a1afc25a742921
|
||||
realm->set_host_import_module_dynamically_callback(import_callback);
|
||||
|
||||
- isolate->SetHostImportModuleDynamicallyCallback(ImportModuleDynamically);
|
||||
+ if (args[1]->IsBoolean() && args[1]->BooleanValue(isolate))
|
||||
- isolate->SetHostImportModuleWithPhaseDynamicallyCallback(
|
||||
+ if (args[1]->IsBoolean() && args[1]->BooleanValue(isolate)) {
|
||||
+ isolate->SetHostImportModuleDynamicallyCallback(ImportModuleDynamically);
|
||||
+ isolate->SetHostImportModuleWithPhaseDynamicallyCallback(
|
||||
ImportModuleDynamicallyWithPhase);
|
||||
+ }
|
||||
}
|
||||
|
||||
void ModuleWrap::HostInitializeImportMetaObjectCallback(
|
||||
@@ -1020,13 +1021,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(
|
||||
@@ -1234,13 +1236,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(
|
||||
Realm* realm = Realm::GetCurrent(args);
|
||||
Isolate* isolate = realm->isolate();
|
||||
|
||||
@@ -87,7 +91,7 @@ index c52e20d742942667f43ea3e151fc6702260b176b..cbb3e7f4df72f83cb8a1afc25a742921
|
||||
|
||||
MaybeLocal<Value> ModuleWrap::SyntheticModuleEvaluationStepsCallback(
|
||||
diff --git a/src/module_wrap.h b/src/module_wrap.h
|
||||
index 9363ce73e51cde3d3a94f9912f072d532d0f8560..c0e972ed293157726efc5fa76dfa62d3da51c22a 100644
|
||||
index 03cf8d0e91d795aad6db9b11956d296ff4999f7e..45264c2ad58e37a73fd62addac7fb671eed6d502 100644
|
||||
--- a/src/module_wrap.h
|
||||
+++ b/src/module_wrap.h
|
||||
@@ -8,6 +8,7 @@
|
||||
@@ -98,23 +102,24 @@ index 9363ce73e51cde3d3a94f9912f072d532d0f8560..c0e972ed293157726efc5fa76dfa62d3
|
||||
#include "v8-script.h"
|
||||
|
||||
namespace node {
|
||||
@@ -33,7 +34,14 @@ enum HostDefinedOptions : int {
|
||||
kLength = 9,
|
||||
@@ -92,7 +93,15 @@ struct ModuleCacheKey : public MemoryRetainer {
|
||||
hash(hash) {}
|
||||
};
|
||||
|
||||
-class ModuleWrap : public BaseObject {
|
||||
+NODE_EXTERN v8::MaybeLocal<v8::Promise> ImportModuleDynamically(
|
||||
+NODE_EXTERN v8::MaybeLocal<v8::Promise> ImportModuleDynamicallyWithPhase(
|
||||
+ v8::Local<v8::Context> context,
|
||||
+ v8::Local<v8::Data> host_defined_options,
|
||||
+ v8::Local<v8::Value> resource_name,
|
||||
+ v8::Local<v8::String> specifier,
|
||||
+ v8::Local<v8::FixedArray> import_assertions);
|
||||
+ v8::ModuleImportPhase phase,
|
||||
+ v8::Local<v8::FixedArray> import_attributes);
|
||||
+
|
||||
+class NODE_EXTERN ModuleWrap : public BaseObject {
|
||||
public:
|
||||
enum InternalFields {
|
||||
kModuleSlot = BaseObject::kInternalFieldCount,
|
||||
@@ -92,6 +100,8 @@ class ModuleWrap : public BaseObject {
|
||||
using ResolveCache =
|
||||
std::unordered_map<ModuleCacheKey, uint32_t, ModuleCacheKey::Hash>;
|
||||
|
||||
@@ -157,6 +166,8 @@ class ModuleWrap : public BaseObject {
|
||||
static void CreateRequiredModuleFacade(
|
||||
const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
@@ -123,11 +128,11 @@ index 9363ce73e51cde3d3a94f9912f072d532d0f8560..c0e972ed293157726efc5fa76dfa62d3
|
||||
private:
|
||||
ModuleWrap(Realm* realm,
|
||||
v8::Local<v8::Object> object,
|
||||
@@ -131,7 +141,6 @@ class ModuleWrap : public BaseObject {
|
||||
@@ -205,7 +216,6 @@ class ModuleWrap : public BaseObject {
|
||||
v8::Local<v8::String> specifier,
|
||||
v8::Local<v8::FixedArray> import_attributes,
|
||||
v8::Local<v8::Module> referrer);
|
||||
- static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);
|
||||
|
||||
v8::Global<v8::Module> module_;
|
||||
std::unordered_map<std::string, v8::Global<v8::Object>> resolve_cache_;
|
||||
// This method may throw a JavaScript exception, so the return type is
|
||||
// wrapped in a Maybe.
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 29 Oct 2025 11:45:23 +0000
|
||||
Subject: chore: handle support for `import defer * as ns` and `import.defer`
|
||||
syntax
|
||||
|
||||
V8 added support for the above syntax https://chromium-review.googlesource.com/c/v8/v8/+/7017517
|
||||
by adding a new `ModuleImportPhase::kDefer` phase.
|
||||
|
||||
This patch can be removed when Electron updates to a version of Node.js containing
|
||||
the above CL.
|
||||
|
||||
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
|
||||
index a584e3a80adb69d2028dc79450349823ab973a58..6f010fa2e014b2d13b1f89a691d09e2ffdf690b6 100644
|
||||
--- a/src/module_wrap.cc
|
||||
+++ b/src/module_wrap.cc
|
||||
@@ -563,8 +563,10 @@ ModulePhase to_phase_constant(ModuleImportPhase phase) {
|
||||
return kEvaluationPhase;
|
||||
case ModuleImportPhase::kSource:
|
||||
return kSourcePhase;
|
||||
+ case ModuleImportPhase::kDefer:
|
||||
+ default:
|
||||
+ UNREACHABLE();
|
||||
}
|
||||
- UNREACHABLE();
|
||||
}
|
||||
|
||||
static Local<Object> createImportAttributesContainer(
|
||||
@@ -1471,6 +1473,7 @@ void ModuleWrap::CreatePerContextProperties(Local<Object> target,
|
||||
|
||||
V(ModulePhase, kEvaluationPhase);
|
||||
V(ModulePhase, kSourcePhase);
|
||||
+ V(ModulePhase, kDeferPhase);
|
||||
#undef V
|
||||
}
|
||||
|
||||
diff --git a/src/module_wrap.h b/src/module_wrap.h
|
||||
index 45264c2ad58e37a73fd62addac7fb671eed6d502..fb32fbc5c1cfa4aef4a7822dbc6195429299da3e 100644
|
||||
--- a/src/module_wrap.h
|
||||
+++ b/src/module_wrap.h
|
||||
@@ -37,6 +37,7 @@ enum HostDefinedOptions : int {
|
||||
enum ModulePhase : int {
|
||||
kSourcePhase = 1,
|
||||
kEvaluationPhase = 2,
|
||||
+ kDeferPhase = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1,305 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Marco Ippolito <marcoippolito54@gmail.com>
|
||||
Date: Wed, 1 May 2024 14:24:48 +0200
|
||||
Subject: cli: move --trace-atomics-wait to eol
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/52747
|
||||
Fixes: https://github.com/nodejs/node/issues/42982
|
||||
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
|
||||
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
|
||||
Reviewed-By: Michaël Zasso <targos@protonmail.com>
|
||||
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
|
||||
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
|
||||
|
||||
diff --git a/doc/api/cli.md b/doc/api/cli.md
|
||||
index 9a0e83b95a72486ab9751b3b8818f4beeb527041..1da7126b9d51238e9b89ee6bed602df3f5598a9e 100644
|
||||
--- a/doc/api/cli.md
|
||||
+++ b/doc/api/cli.md
|
||||
@@ -2727,39 +2727,6 @@ added: v12.0.0
|
||||
Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.3'. Use to disable support
|
||||
for TLSv1.2, which is not as secure as TLSv1.3.
|
||||
|
||||
-### `--trace-atomics-wait`
|
||||
-
|
||||
-<!-- YAML
|
||||
-added: v14.3.0
|
||||
-deprecated:
|
||||
- - v18.8.0
|
||||
- - v16.18.0
|
||||
--->
|
||||
-
|
||||
-> Stability: 0 - Deprecated
|
||||
-
|
||||
-Print short summaries of calls to [`Atomics.wait()`][] to stderr.
|
||||
-The output could look like this:
|
||||
-
|
||||
-```text
|
||||
-(node:15701) [Thread 0] Atomics.wait(<address> + 0, 1, inf) started
|
||||
-(node:15701) [Thread 0] Atomics.wait(<address> + 0, 1, inf) did not wait because the values mismatched
|
||||
-(node:15701) [Thread 0] Atomics.wait(<address> + 0, 0, 10) started
|
||||
-(node:15701) [Thread 0] Atomics.wait(<address> + 0, 0, 10) timed out
|
||||
-(node:15701) [Thread 0] Atomics.wait(<address> + 4, 0, inf) started
|
||||
-(node:15701) [Thread 1] Atomics.wait(<address> + 4, -1, inf) started
|
||||
-(node:15701) [Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread
|
||||
-(node:15701) [Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread
|
||||
-```
|
||||
-
|
||||
-The fields here correspond to:
|
||||
-
|
||||
-* The thread id as given by [`worker_threads.threadId`][]
|
||||
-* The base address of the `SharedArrayBuffer` in question, as well as the
|
||||
- byte offset corresponding to the index passed to `Atomics.wait()`
|
||||
-* The expected value that was passed to `Atomics.wait()`
|
||||
-* The timeout passed to `Atomics.wait`
|
||||
-
|
||||
### `--trace-deprecation`
|
||||
|
||||
<!-- YAML
|
||||
@@ -3445,7 +3412,6 @@ one is included in the list below.
|
||||
* `--tls-min-v1.1`
|
||||
* `--tls-min-v1.2`
|
||||
* `--tls-min-v1.3`
|
||||
-* `--trace-atomics-wait`
|
||||
* `--trace-deprecation`
|
||||
* `--trace-env-js-stack`
|
||||
* `--trace-env-native-stack`
|
||||
diff --git a/doc/node.1 b/doc/node.1
|
||||
index e3b2c45af01b2e9b9522964da2572988edd2b9e9..64e975546285a1042dda6fdb54fdd502f338a929 100644
|
||||
--- a/doc/node.1
|
||||
+++ b/doc/node.1
|
||||
@@ -542,11 +542,6 @@ but the option is supported for compatibility with older Node.js versions.
|
||||
Set default minVersion to 'TLSv1.3'. Use to disable support for TLSv1.2 in
|
||||
favour of TLSv1.3, which is more secure.
|
||||
.
|
||||
-.It Fl -trace-atomics-wait
|
||||
-Print short summaries of calls to
|
||||
-.Sy Atomics.wait() .
|
||||
-.
|
||||
-This flag is deprecated.
|
||||
.It Fl -trace-deprecation
|
||||
Print stack traces for deprecations.
|
||||
.
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index 0725cc97510375bc616534ddf3de4b231bae6bf5..f21687ad9dfd69c829aaaf8f3ed66b6bf6713765 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -232,44 +232,6 @@ void Environment::WaitForInspectorFrontendByOptions() {
|
||||
}
|
||||
#endif // HAVE_INSPECTOR
|
||||
|
||||
-#define ATOMIC_WAIT_EVENTS(V) \
|
||||
- V(kStartWait, "started") \
|
||||
- V(kWokenUp, "was woken up by another thread") \
|
||||
- V(kTimedOut, "timed out") \
|
||||
- V(kTerminatedExecution, "was stopped by terminated execution") \
|
||||
- V(kAPIStopped, "was stopped through the embedder API") \
|
||||
- V(kNotEqual, "did not wait because the values mismatched") \
|
||||
-
|
||||
-static void AtomicsWaitCallback(Isolate::AtomicsWaitEvent event,
|
||||
- Local<v8::SharedArrayBuffer> array_buffer,
|
||||
- size_t offset_in_bytes, int64_t value,
|
||||
- double timeout_in_ms,
|
||||
- Isolate::AtomicsWaitWakeHandle* stop_handle,
|
||||
- void* data) {
|
||||
- Environment* env = static_cast<Environment*>(data);
|
||||
-
|
||||
- const char* message = "(unknown event)";
|
||||
- switch (event) {
|
||||
-#define V(key, msg) \
|
||||
- case Isolate::AtomicsWaitEvent::key: \
|
||||
- message = msg; \
|
||||
- break;
|
||||
- ATOMIC_WAIT_EVENTS(V)
|
||||
-#undef V
|
||||
- }
|
||||
-
|
||||
- fprintf(stderr,
|
||||
- "(node:%d) [Thread %" PRIu64 "] Atomics.wait(%p + %zx, %" PRId64
|
||||
- ", %.f) %s\n",
|
||||
- static_cast<int>(uv_os_getpid()),
|
||||
- env->thread_id(),
|
||||
- array_buffer->Data(),
|
||||
- offset_in_bytes,
|
||||
- value,
|
||||
- timeout_in_ms,
|
||||
- message);
|
||||
-}
|
||||
-
|
||||
void Environment::InitializeDiagnostics() {
|
||||
isolate_->GetHeapProfiler()->AddBuildEmbedderGraphCallback(
|
||||
Environment::BuildEmbedderGraph, this);
|
||||
@@ -278,17 +240,6 @@ void Environment::InitializeDiagnostics() {
|
||||
}
|
||||
if (options_->trace_uncaught)
|
||||
isolate_->SetCaptureStackTraceForUncaughtExceptions(true);
|
||||
- if (options_->trace_atomics_wait) {
|
||||
- ProcessEmitDeprecationWarning(
|
||||
- Environment::GetCurrent(isolate_),
|
||||
- "The flag --trace-atomics-wait is deprecated.",
|
||||
- "DEP0165");
|
||||
- isolate_->SetAtomicsWaitCallback(AtomicsWaitCallback, this);
|
||||
- AddCleanupHook([](void* data) {
|
||||
- Environment* env = static_cast<Environment*>(data);
|
||||
- env->isolate()->SetAtomicsWaitCallback(nullptr, nullptr);
|
||||
- }, this);
|
||||
- }
|
||||
if (options_->trace_promises) {
|
||||
isolate_->SetPromiseHook(TracePromises);
|
||||
}
|
||||
diff --git a/src/node_options.cc b/src/node_options.cc
|
||||
index e8424d7539db191a55edebb7d33a3c1dc37e2403..556776b79282d953fdc371d1901f21ca301bec1a 100644
|
||||
--- a/src/node_options.cc
|
||||
+++ b/src/node_options.cc
|
||||
@@ -773,10 +773,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
|
||||
"throw an exception on deprecations",
|
||||
&EnvironmentOptions::throw_deprecation,
|
||||
kAllowedInEnvvar);
|
||||
- AddOption("--trace-atomics-wait",
|
||||
- "(deprecated) trace Atomics.wait() operations",
|
||||
- &EnvironmentOptions::trace_atomics_wait,
|
||||
- kAllowedInEnvvar);
|
||||
AddOption("--trace-deprecation",
|
||||
"show stack traces on deprecations",
|
||||
&EnvironmentOptions::trace_deprecation,
|
||||
diff --git a/src/node_options.h b/src/node_options.h
|
||||
index 418dee360f867c363f1576012b32213a51c4fdd0..7078d2493ed696bc5bd92df9c629b714c1a8fbfb 100644
|
||||
--- a/src/node_options.h
|
||||
+++ b/src/node_options.h
|
||||
@@ -205,7 +205,6 @@ class EnvironmentOptions : public Options {
|
||||
std::vector<std::string> coverage_include_pattern;
|
||||
std::vector<std::string> coverage_exclude_pattern;
|
||||
bool throw_deprecation = false;
|
||||
- bool trace_atomics_wait = false;
|
||||
bool trace_deprecation = false;
|
||||
bool trace_exit = false;
|
||||
bool trace_sync_io = false;
|
||||
diff --git a/test/parallel/test-trace-atomic-deprecation.js b/test/parallel/test-trace-atomic-deprecation.js
|
||||
deleted file mode 100644
|
||||
index 8aeddb28e938d23e646d882cfe24b2e2311f9ab2..0000000000000000000000000000000000000000
|
||||
--- a/test/parallel/test-trace-atomic-deprecation.js
|
||||
+++ /dev/null
|
||||
@@ -1,14 +0,0 @@
|
||||
-'use strict';
|
||||
-
|
||||
-const common = require('../common');
|
||||
-const assert = require('node:assert');
|
||||
-const { test } = require('node:test');
|
||||
-
|
||||
-test('should emit deprecation warning DEP0165', async () => {
|
||||
- const { code, stdout, stderr } = await common.spawnPromisified(
|
||||
- process.execPath, ['--trace-atomics-wait', '-e', '{}']
|
||||
- );
|
||||
- assert.match(stderr, /\[DEP0165\] DeprecationWarning:/);
|
||||
- assert.strictEqual(stdout, '');
|
||||
- assert.strictEqual(code, 0);
|
||||
-});
|
||||
diff --git a/test/parallel/test-trace-atomics-wait.js b/test/parallel/test-trace-atomics-wait.js
|
||||
deleted file mode 100644
|
||||
index 6449a2be2b47e0758090dc13d136877b1874c635..0000000000000000000000000000000000000000
|
||||
--- a/test/parallel/test-trace-atomics-wait.js
|
||||
+++ /dev/null
|
||||
@@ -1,101 +0,0 @@
|
||||
-'use strict';
|
||||
-require('../common');
|
||||
-const assert = require('assert');
|
||||
-const child_process = require('child_process');
|
||||
-const { Worker } = require('worker_threads');
|
||||
-
|
||||
-if (process.argv[2] === 'child') {
|
||||
- const i32arr = new Int32Array(new SharedArrayBuffer(8));
|
||||
- assert.strictEqual(Atomics.wait(i32arr, 0, 1), 'not-equal');
|
||||
- assert.strictEqual(Atomics.wait(i32arr, 0, 0, 10), 'timed-out');
|
||||
-
|
||||
- new Worker(`
|
||||
- const i32arr = require('worker_threads').workerData;
|
||||
- Atomics.store(i32arr, 1, -1);
|
||||
- Atomics.notify(i32arr, 1);
|
||||
- Atomics.wait(i32arr, 1, -1);
|
||||
- `, { eval: true, workerData: i32arr });
|
||||
-
|
||||
- Atomics.wait(i32arr, 1, 0);
|
||||
- assert.strictEqual(Atomics.load(i32arr, 1), -1);
|
||||
- Atomics.store(i32arr, 1, 0);
|
||||
- Atomics.notify(i32arr, 1);
|
||||
- return;
|
||||
-}
|
||||
-
|
||||
-const proc = child_process.spawnSync(
|
||||
- process.execPath,
|
||||
- [ '--disable-warning=DEP0165', '--trace-atomics-wait', __filename, 'child' ],
|
||||
- { encoding: 'utf8', stdio: [ 'inherit', 'inherit', 'pipe' ] });
|
||||
-
|
||||
-if (proc.status !== 0) console.log(proc);
|
||||
-assert.strictEqual(proc.status, 0);
|
||||
-
|
||||
-const SABAddress = proc.stderr.match(/Atomics\.wait\((?<SAB>.+) \+/).groups.SAB;
|
||||
-const actualTimeline = proc.stderr
|
||||
- .replace(new RegExp(SABAddress, 'g'), '<address>')
|
||||
- .replace(new RegExp(`\\(node:${proc.pid}\\) `, 'g'), '')
|
||||
- .replace(/\binf(inity)?\b/gi, 'inf')
|
||||
- .replace(/\r/g, '')
|
||||
- .trim();
|
||||
-console.log('+++ normalized stdout +++');
|
||||
-console.log(actualTimeline);
|
||||
-console.log('--- normalized stdout ---');
|
||||
-
|
||||
-const begin =
|
||||
-`[Thread 0] Atomics.wait(<address> + 0, 1, inf) started
|
||||
-[Thread 0] Atomics.wait(<address> + 0, 1, inf) did not wait because the \
|
||||
-values mismatched
|
||||
-[Thread 0] Atomics.wait(<address> + 0, 0, 10) started
|
||||
-[Thread 0] Atomics.wait(<address> + 0, 0, 10) timed out`;
|
||||
-
|
||||
-const expectedTimelines = [
|
||||
- `${begin}
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) started
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) started
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread`,
|
||||
- `${begin}
|
||||
-[Thread 1] Atomics.wait(<address> + 4, 0, inf) started
|
||||
-[Thread 0] Atomics.wait(<address> + 4, -1, inf) started
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread`,
|
||||
- `${begin}
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) started
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) started
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread`,
|
||||
- `${begin}
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) started
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) started
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) did not wait because the \
|
||||
-values mismatched`,
|
||||
- `${begin}
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) started
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) started
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) did not wait because the \
|
||||
-values mismatched`,
|
||||
- `${begin}
|
||||
-[Thread 1] Atomics.wait(<address> + 4, 0, inf) started
|
||||
-[Thread 0] Atomics.wait(<address> + 4, -1, inf) started
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) did not wait because the \
|
||||
-values mismatched`,
|
||||
- `${begin}
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) started
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) did not wait because the \
|
||||
-values mismatched
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) started
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) did not wait because the \
|
||||
-values mismatched`,
|
||||
- `${begin}
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) started
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) started
|
||||
-[Thread 0] Atomics.wait(<address> + 4, 0, inf) did not wait because the \
|
||||
-values mismatched
|
||||
-[Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread`,
|
||||
-];
|
||||
-
|
||||
-assert(expectedTimelines.includes(actualTimeline));
|
||||
@@ -1,59 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Omer Katz <omerkatz@chromium.org>
|
||||
Date: Thu, 19 Sep 2024 10:50:09 +0200
|
||||
Subject: cli: remove deprecated V8 flag
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Remove the `--huge-max-old-generation-size` V8 flag from the
|
||||
`NODE_OPTIONS` allowlist. That flag was recently deprecated (it
|
||||
currently remains as nop, see crrev.com/c/5831467) and will soon be
|
||||
completely removed.
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/54761
|
||||
Reviewed-By: Richard Lau <rlau@redhat.com>
|
||||
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
|
||||
Reviewed-By: Michaël Zasso <targos@protonmail.com>
|
||||
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
|
||||
|
||||
diff --git a/doc/api/cli.md b/doc/api/cli.md
|
||||
index b8f9fb49fcb45602828e79bd79902233b5987dda..9a0e83b95a72486ab9751b3b8818f4beeb527041 100644
|
||||
--- a/doc/api/cli.md
|
||||
+++ b/doc/api/cli.md
|
||||
@@ -3483,7 +3483,6 @@ V8 options that are allowed are:
|
||||
* `--disallow-code-generation-from-strings`
|
||||
* `--enable-etw-stack-walking`
|
||||
* `--expose-gc`
|
||||
-* `--huge-max-old-generation-size`
|
||||
* `--interpreted-frames-native-stack`
|
||||
* `--jitless`
|
||||
* `--max-old-space-size`
|
||||
diff --git a/src/node_options.cc b/src/node_options.cc
|
||||
index 8afded658c3f569de7b329ea9dddc11010748cf9..e8424d7539db191a55edebb7d33a3c1dc37e2403 100644
|
||||
--- a/src/node_options.cc
|
||||
+++ b/src/node_options.cc
|
||||
@@ -1001,11 +1001,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser(
|
||||
"disallow eval and friends",
|
||||
V8Option{},
|
||||
kAllowedInEnvvar);
|
||||
- AddOption("--huge-max-old-generation-size",
|
||||
- "increase default maximum heap size on machines with 16GB memory "
|
||||
- "or more",
|
||||
- V8Option{},
|
||||
- kAllowedInEnvvar);
|
||||
AddOption("--jitless",
|
||||
"disable runtime allocation of executable memory",
|
||||
V8Option{},
|
||||
diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js
|
||||
index c5d74f40e7894980b45713c77cc36f836be73528..53bca572c3405c0357f868aae71fc2c82d973c04 100644
|
||||
--- a/test/parallel/test-cli-node-options.js
|
||||
+++ b/test/parallel/test-cli-node-options.js
|
||||
@@ -76,7 +76,6 @@ if (common.hasCrypto) {
|
||||
expect('--abort_on-uncaught_exception', 'B\n');
|
||||
expect('--disallow-code-generation-from-strings', 'B\n');
|
||||
expect('--expose-gc', 'B\n');
|
||||
-expect('--huge-max-old-generation-size', 'B\n');
|
||||
expect('--jitless', 'B\n');
|
||||
expect('--max-old-space-size=0', 'B\n');
|
||||
expect('--max-semi-space-size=0', 'B\n');
|
||||
@@ -8,7 +8,7 @@ to child processes spawned with `ELECTRON_RUN_AS_NODE` which is used
|
||||
by the crashpad client to connect with the handler process.
|
||||
|
||||
diff --git a/lib/child_process.js b/lib/child_process.js
|
||||
index 960ecd25ebb5b2aba0b92b869a2332a3a69011e1..ced0a5d792c63662c577a41c88b52cae076e7d08 100644
|
||||
index 17c6b69c118a759f9fcf254a035f1a07fcc4059f..c8576fbf889d13f951a9ad2ffeb93389cfe2445b 100644
|
||||
--- a/lib/child_process.js
|
||||
+++ b/lib/child_process.js
|
||||
@@ -62,6 +62,7 @@ let debug = require('internal/util/debuglog').debuglog(
|
||||
@@ -27,7 +27,7 @@ index 960ecd25ebb5b2aba0b92b869a2332a3a69011e1..ced0a5d792c63662c577a41c88b52cae
|
||||
args = [...execArgv, modulePath, ...args];
|
||||
|
||||
if (typeof options.stdio === 'string') {
|
||||
@@ -637,6 +637,22 @@ function normalizeSpawnArguments(file, args, options) {
|
||||
@@ -638,6 +638,22 @@ function normalizeSpawnArguments(file, args, options) {
|
||||
'options.windowsVerbatimArguments');
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ index 960ecd25ebb5b2aba0b92b869a2332a3a69011e1..ced0a5d792c63662c577a41c88b52cae
|
||||
+
|
||||
if (options.shell) {
|
||||
validateArgumentNullCheck(options.shell, 'options.shell');
|
||||
|
||||
@@ -671,8 +687,6 @@ function normalizeSpawnArguments(file, args, options) {
|
||||
if (args.length > 0 && !emittedDEP0190Already) {
|
||||
@@ -680,8 +696,6 @@ function normalizeSpawnArguments(file, args, options) {
|
||||
ArrayPrototypeUnshift(args, file);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 aa4213c3622eab077fa8d764775c1f95c6313e34..11f722d2d7c21079cbc65033429086231a786ca7 100644
|
||||
index 5bd07e5253ae64b02ae1874226ab70c1972cf9e0..768d81a63a42d9016a42b7cdce7b6be86c59afdf 100644
|
||||
--- a/src/node_binding.cc
|
||||
+++ b/src/node_binding.cc
|
||||
@@ -652,6 +652,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -655,6 +655,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
|
||||
args.GetReturnValue().Set(exports);
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ index aa4213c3622eab077fa8d764775c1f95c6313e34..11f722d2d7c21079cbc6503342908623
|
||||
Environment* env = Environment::GetCurrent(args);
|
||||
|
||||
diff --git a/src/node_binding.h b/src/node_binding.h
|
||||
index 611f38ef5e21cc303127326d50c648fbb557b4da..3d95ad2733dc83d0b7d37d57c337732c8a0e83d7 100644
|
||||
index 813204dc473960e63896b6d3609a882b52ac59fa..2fe91a28460973b543f5dde7a78fdedb05ac98b3 100644
|
||||
--- a/src/node_binding.h
|
||||
+++ b/src/node_binding.h
|
||||
@@ -154,6 +154,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
@@ -155,6 +155,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void GetLinkedBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DLOpen(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 22 Oct 2025 11:03:57 +0200
|
||||
Subject: feat: disable js source phase imports by default.
|
||||
|
||||
Refs:
|
||||
- https://chromium-review.googlesource.com/c/v8/v8/+/7003082
|
||||
- https://chromium-review.googlesource.com/c/chromium/src/+/6336964
|
||||
- https://github.com/nodejs/node/pull/56919
|
||||
|
||||
We need to disable source phase imports in renderer and worker processes - Chromium
|
||||
disables them in content/renderer/render_process_impl.cc via and the process will
|
||||
hard crash otherwise.
|
||||
|
||||
They shouldn't be enabled by default in Node.js either as they are still not yet
|
||||
Stage 3.
|
||||
|
||||
Upstreamed in https://github.com/nodejs/node/pull/60364
|
||||
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index 5713d49d859e1161e1d6703c0b6f3d717a5a9a34..829634c084cb91eb7f488dbdd48175a093dd6e12 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -780,7 +780,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
|
||||
env_opts->abort_on_uncaught_exception = true;
|
||||
}
|
||||
|
||||
- v8_args.emplace_back("--js-source-phase-imports");
|
||||
+ // v8_args.emplace_back("--js-source-phase-imports");
|
||||
|
||||
#ifdef __POSIX__
|
||||
// Block SIGPROF signals when sleeping in epoll_wait/kevent/etc. Avoids the
|
||||
@@ -7,7 +7,7 @@ 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 ae31b372b96358a156761ec7e9c39c9530d1abd1..6b79de07be3f839af5b0644f19bfef9c33de590e 100644
|
||||
index 7727dfc4c62100cbd873ee4b34c6089ab4b638b1..29a912f58e7b522ae21fddac510946cbcbaaa4cc 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -91,6 +91,23 @@
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: VerteDinde <vertedinde@electronjs.org>
|
||||
Date: Mon, 29 Apr 2024 02:56:27 -0700
|
||||
Subject: fix: add source location for v8::Task Runner
|
||||
|
||||
This patch corresponds with an upstream change which adds
|
||||
Post*TaskImpl variants of v8::TaskRunner::Post*Task methods,
|
||||
which take a v8::SourceLocation argument, and makes Post*Task
|
||||
methods non-virtual. In the original CL, embedders are asked
|
||||
to override the Post*TaskImpl methods.
|
||||
|
||||
This patch can be removed when node's upstream makes a
|
||||
corresponding change.
|
||||
|
||||
CL: https://chromium-review.googlesource.com/c/v8/v8/+/5300826
|
||||
|
||||
diff --git a/src/node_platform.cc b/src/node_platform.cc
|
||||
index 0ffebd1dcb693dcddbedff5d259cf65c115f1dc2..b24e170cb247261d4a16d77ad40df4dfd33709d9 100644
|
||||
--- a/src/node_platform.cc
|
||||
+++ b/src/node_platform.cc
|
||||
@@ -308,11 +308,13 @@ void PerIsolatePlatformData::FlushTasks(uv_async_t* handle) {
|
||||
platform_data->FlushForegroundTasksInternal();
|
||||
}
|
||||
|
||||
-void PerIsolatePlatformData::PostIdleTask(std::unique_ptr<v8::IdleTask> task) {
|
||||
+void PerIsolatePlatformData::PostIdleTaskImpl(std::unique_ptr<v8::IdleTask> task,
|
||||
+ const v8::SourceLocation& location) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
-void PerIsolatePlatformData::PostTask(std::unique_ptr<Task> task) {
|
||||
+void PerIsolatePlatformData::PostTaskImpl(std::unique_ptr<Task> task,
|
||||
+ const v8::SourceLocation& location) {
|
||||
// The task can be posted from any V8 background worker thread, even when
|
||||
// the foreground task runner is being cleaned up by Shutdown(). In that
|
||||
// case, make sure we wait until the shutdown is completed (which leads
|
||||
@@ -331,8 +333,10 @@ void PerIsolatePlatformData::PostTask(std::unique_ptr<Task> task) {
|
||||
uv_async_send(flush_tasks_);
|
||||
}
|
||||
|
||||
-void PerIsolatePlatformData::PostDelayedTask(
|
||||
- std::unique_ptr<Task> task, double delay_in_seconds) {
|
||||
+void PerIsolatePlatformData::PostDelayedTaskImpl(
|
||||
+ std::unique_ptr<Task> task,
|
||||
+ double delay_in_seconds,
|
||||
+ const v8::SourceLocation& location) {
|
||||
if (debug_log_level_ != PlatformDebugLogLevel::kNone) {
|
||||
fprintf(stderr,
|
||||
"\nPerIsolatePlatformData::PostDelayedTaskImpl %p %f",
|
||||
@@ -354,13 +358,15 @@ void PerIsolatePlatformData::PostDelayedTask(
|
||||
uv_async_send(flush_tasks_);
|
||||
}
|
||||
|
||||
-void PerIsolatePlatformData::PostNonNestableTask(std::unique_ptr<Task> task) {
|
||||
+void PerIsolatePlatformData::PostNonNestableTaskImpl(std::unique_ptr<Task> task,
|
||||
+ const v8::SourceLocation& location) {
|
||||
PostTask(std::move(task));
|
||||
}
|
||||
|
||||
-void PerIsolatePlatformData::PostNonNestableDelayedTask(
|
||||
+void PerIsolatePlatformData::PostNonNestableDelayedTaskImpl(
|
||||
std::unique_ptr<Task> task,
|
||||
- double delay_in_seconds) {
|
||||
+ double delay_in_seconds,
|
||||
+ const v8::SourceLocation& location) {
|
||||
PostDelayedTask(std::move(task), delay_in_seconds);
|
||||
}
|
||||
|
||||
diff --git a/src/node_platform.h b/src/node_platform.h
|
||||
index af30ebeb0c8629ab86d1a55fd63610165abfbabf..a0222b4a1b074c6708e390d58d04221717069ac1 100644
|
||||
--- a/src/node_platform.h
|
||||
+++ b/src/node_platform.h
|
||||
@@ -80,18 +80,21 @@ class PerIsolatePlatformData :
|
||||
~PerIsolatePlatformData() override;
|
||||
|
||||
std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner() override;
|
||||
- void PostTask(std::unique_ptr<v8::Task> task) override;
|
||||
- void PostIdleTask(std::unique_ptr<v8::IdleTask> task) override;
|
||||
- void PostDelayedTask(std::unique_ptr<v8::Task> task,
|
||||
- double delay_in_seconds) override;
|
||||
+ void PostTaskImpl(std::unique_ptr<v8::Task> task, const v8::SourceLocation&) override;
|
||||
+ void PostIdleTaskImpl(std::unique_ptr<v8::IdleTask> task, const v8::SourceLocation&) override;
|
||||
+ void PostDelayedTaskImpl(std::unique_ptr<v8::Task> task,
|
||||
+ double delay_in_seconds,
|
||||
+ const v8::SourceLocation&) override;
|
||||
bool IdleTasksEnabled() override { return false; }
|
||||
|
||||
// Non-nestable tasks are treated like regular tasks.
|
||||
bool NonNestableTasksEnabled() const override { return true; }
|
||||
bool NonNestableDelayedTasksEnabled() const override { return true; }
|
||||
- void PostNonNestableTask(std::unique_ptr<v8::Task> task) override;
|
||||
- void PostNonNestableDelayedTask(std::unique_ptr<v8::Task> task,
|
||||
- double delay_in_seconds) override;
|
||||
+ void PostNonNestableTaskImpl(std::unique_ptr<v8::Task> task,
|
||||
+ const v8::SourceLocation&) override;
|
||||
+ void PostNonNestableDelayedTaskImpl(std::unique_ptr<v8::Task> task,
|
||||
+ double delay_in_seconds,
|
||||
+ const v8::SourceLocation&) override;
|
||||
|
||||
void AddShutdownCallback(void (*callback)(void*), void* data);
|
||||
void Shutdown();
|
||||
@@ -11,31 +11,14 @@ Node.js upgrades to a version of V8 that has Float16Array enabled by
|
||||
default.
|
||||
|
||||
diff --git a/test/common/globals.js b/test/common/globals.js
|
||||
index 2c1dac019ba2aa0a23c2434997e2007dd2eacde8..152d9afa8f8ef6b76fceb0ac4481d1df719b872b 100644
|
||||
index 1641c4df36b92dbe29b06817d87130a94ae1b22f..34563b304f0e708ae066f8303a09e37b6bf123d6 100644
|
||||
--- a/test/common/globals.js
|
||||
+++ b/test/common/globals.js
|
||||
@@ -35,6 +35,7 @@ const intrinsics = new Set([
|
||||
'Int16Array',
|
||||
@@ -36,6 +36,7 @@ const intrinsics = new Set([
|
||||
'Float16Array',
|
||||
'Uint32Array',
|
||||
'Int32Array',
|
||||
+ 'Float16Array',
|
||||
'Float32Array',
|
||||
'Float64Array',
|
||||
'Uint8ClampedArray',
|
||||
diff --git a/test/wpt/status/encoding.json b/test/wpt/status/encoding.json
|
||||
index f9378d7195a2a77eb89ae696ab26747fd8bf65b8..c258031e48556480d500a02925a8d9c29dfb2a18 100644
|
||||
--- a/test/wpt/status/encoding.json
|
||||
+++ b/test/wpt/status/encoding.json
|
||||
@@ -70,12 +70,6 @@
|
||||
"requires": ["full-icu"]
|
||||
},
|
||||
"encodeInto.any.js": {
|
||||
- "fail": {
|
||||
- "expected": [
|
||||
- "Invalid encodeInto() destination: Float16Array, backed by: ArrayBuffer",
|
||||
- "Invalid encodeInto() destination: Float16Array, backed by: SharedArrayBuffer"
|
||||
- ]
|
||||
- },
|
||||
"requires": ["small-icu"]
|
||||
},
|
||||
"textdecoder-copy.any.js": {
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Tue, 21 Oct 2025 20:00:06 +0200
|
||||
Subject: fix: allow disabling fetch in renderer and worker processes
|
||||
|
||||
We need to disable Node.js' fetch implementation to prevent
|
||||
conflict with Blink's in renderer and worker processes.
|
||||
|
||||
We should try to upstream some version of this.
|
||||
|
||||
diff --git a/doc/api/cli.md b/doc/api/cli.md
|
||||
index cc990c01704484cbaa314320b3b3b72acffb6940..6b985c9fce6ec607df0e04f93b3cd5b84233d0b9 100644
|
||||
--- a/doc/api/cli.md
|
||||
+++ b/doc/api/cli.md
|
||||
@@ -1767,6 +1767,14 @@ changes:
|
||||
|
||||
Disable using [syntax detection][] to determine module type.
|
||||
|
||||
+### `--no-experimental-fetch`
|
||||
+
|
||||
+<!-- YAML
|
||||
+added: v18.0.0
|
||||
+-->
|
||||
+
|
||||
+Disable exposition of Fetch API on the global scope.
|
||||
+
|
||||
### `--no-experimental-global-navigator`
|
||||
|
||||
<!-- YAML
|
||||
@@ -3436,6 +3444,7 @@ one is included in the list below.
|
||||
* `--no-addons`
|
||||
* `--no-async-context-frame`
|
||||
* `--no-deprecation`
|
||||
+* `--no-experimental-fetch`
|
||||
* `--no-experimental-global-navigator`
|
||||
* `--no-experimental-repl-await`
|
||||
* `--no-experimental-sqlite`
|
||||
diff --git a/doc/node.1 b/doc/node.1
|
||||
index 6210cbf42b26d4673f67aac43874ea28c8955fd5..565068cc3aca0eb03642e1160b814b48cb0c3c45 100644
|
||||
--- a/doc/node.1
|
||||
+++ b/doc/node.1
|
||||
@@ -198,6 +198,9 @@ Enable transformation of TypeScript-only syntax into JavaScript code.
|
||||
.It Fl -experimental-eventsource
|
||||
Enable experimental support for the EventSource Web API.
|
||||
.
|
||||
+.It Fl -no-experimental-fetch
|
||||
+Disable experimental support for the Fetch API.
|
||||
+.
|
||||
.It Fl -no-experimental-websocket
|
||||
Disable experimental support for the WebSocket API.
|
||||
.
|
||||
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
|
||||
index 35b43990c8f24f0888f89173f5662050a11b26ed..2c0d12c0fa9c85ac7ffb41dabda83760ed1ae3ee 100644
|
||||
--- a/lib/internal/process/pre_execution.js
|
||||
+++ b/lib/internal/process/pre_execution.js
|
||||
@@ -110,6 +110,7 @@ function prepareExecution(options) {
|
||||
setupSQLite();
|
||||
setupQuic();
|
||||
setupWebStorage();
|
||||
+ setupFetch();
|
||||
setupWebsocket();
|
||||
setupEventsource();
|
||||
setupCodeCoverage();
|
||||
@@ -312,6 +313,16 @@ function setupWarningHandler() {
|
||||
}
|
||||
}
|
||||
|
||||
+function setupFetch() {
|
||||
+ if (getOptionValue('--no-experimental-fetch')) {
|
||||
+ delete globalThis.fetch;
|
||||
+ delete globalThis.FormData;
|
||||
+ delete globalThis.Headers;
|
||||
+ delete globalThis.Request;
|
||||
+ delete globalThis.Response;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// https://websockets.spec.whatwg.org/
|
||||
function setupWebsocket() {
|
||||
if (getOptionValue('--no-experimental-websocket')) {
|
||||
diff --git a/src/node_options.cc b/src/node_options.cc
|
||||
index 2a3ab5e73cdb98bde9df1465d5fb5e40ad7799f7..9317191d22f51fd75157e849eb67678d1ee6a2a1 100644
|
||||
--- a/src/node_options.cc
|
||||
+++ b/src/node_options.cc
|
||||
@@ -537,7 +537,11 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
|
||||
&EnvironmentOptions::experimental_eventsource,
|
||||
kAllowedInEnvvar,
|
||||
false);
|
||||
- AddOption("--experimental-fetch", "", NoOp{}, kAllowedInEnvvar);
|
||||
+ AddOption("--experimental-fetch",
|
||||
+ "experimental Fetch API",
|
||||
+ &EnvironmentOptions::experimental_fetch,
|
||||
+ kAllowedInEnvvar,
|
||||
+ true);
|
||||
AddOption("--experimental-websocket",
|
||||
"experimental WebSocket API",
|
||||
&EnvironmentOptions::experimental_websocket,
|
||||
diff --git a/test/parallel/test-process-env-allowed-flags-are-documented.js b/test/parallel/test-process-env-allowed-flags-are-documented.js
|
||||
index f09bf0940dad2068f0aa5dce783dd422773d4bbb..ccf4ffcacf9bd9965978738656b8fe091fee4d6a 100644
|
||||
--- a/test/parallel/test-process-env-allowed-flags-are-documented.js
|
||||
+++ b/test/parallel/test-process-env-allowed-flags-are-documented.js
|
||||
@@ -122,7 +122,6 @@ const undocumented = difference(process.allowedNodeEnvironmentFlags,
|
||||
assert(undocumented.delete('--debug-arraybuffer-allocations'));
|
||||
assert(undocumented.delete('--no-debug-arraybuffer-allocations'));
|
||||
assert(undocumented.delete('--es-module-specifier-resolution'));
|
||||
-assert(undocumented.delete('--experimental-fetch'));
|
||||
assert(undocumented.delete('--experimental-wasm-modules'));
|
||||
assert(undocumented.delete('--experimental-global-customevent'));
|
||||
assert(undocumented.delete('--experimental-global-webcrypto'));
|
||||
@@ -11,7 +11,7 @@ We can fix this by allowing the C++ implementation of legacyMainResolve to use
|
||||
a fileExists function that does take Asar into account.
|
||||
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index e3afd30ba1f591d0298793bc42fd7166a4219bce..408dc96307d7f52f92db41004b358051a81c627c 100644
|
||||
index 72cc9444ca93ef7a1526e23314693aeaf5f173b0..79684dd7e8d1629b19be01ebf97e43e503dec581 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
+++ b/lib/internal/modules/esm/resolve.js
|
||||
@@ -28,14 +28,13 @@ const { BuiltinModule } = require('internal/bootstrap/realm');
|
||||
@@ -53,10 +53,10 @@ index e3afd30ba1f591d0298793bc42fd7166a4219bce..408dc96307d7f52f92db41004b358051
|
||||
const maybeMain = resolvedOption <= legacyMainResolveExtensionsIndexes.kResolvedByMainIndexNode ?
|
||||
packageConfig.main || './' : '';
|
||||
diff --git a/src/node_file.cc b/src/node_file.cc
|
||||
index e78326ed0de805a8bf4f621cad9158635eb44aa2..d7009937b31729f33d9c45cbda7f5440fbdac2aa 100644
|
||||
index 00f369e9691e184f9e5f226ce4216bd5b1d353ae..d73dac2ee3f1cf1cac6845fae0f702c9fba8fcef 100644
|
||||
--- a/src/node_file.cc
|
||||
+++ b/src/node_file.cc
|
||||
@@ -3502,13 +3502,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -3623,13 +3623,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
|
||||
BindingData::FilePathIsFileReturnType BindingData::FilePathIsFile(
|
||||
@@ -83,7 +83,7 @@ index e78326ed0de805a8bf4f621cad9158635eb44aa2..d7009937b31729f33d9c45cbda7f5440
|
||||
uv_fs_t req;
|
||||
|
||||
int rc = uv_fs_stat(env->event_loop(), &req, file_path.c_str(), nullptr);
|
||||
@@ -3566,6 +3578,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -3687,6 +3699,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
|
||||
std::optional<std::string> initial_file_path;
|
||||
std::string file_path;
|
||||
|
||||
@@ -95,7 +95,7 @@ index e78326ed0de805a8bf4f621cad9158635eb44aa2..d7009937b31729f33d9c45cbda7f5440
|
||||
if (args.Length() >= 2 && args[1]->IsString()) {
|
||||
auto package_config_main = Utf8Value(isolate, args[1]).ToString();
|
||||
|
||||
@@ -3586,7 +3603,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -3707,7 +3724,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
|
||||
BufferValue buff_file_path(isolate, local_file_path);
|
||||
ToNamespacedPath(env, &buff_file_path);
|
||||
|
||||
@@ -104,7 +104,7 @@ index e78326ed0de805a8bf4f621cad9158635eb44aa2..d7009937b31729f33d9c45cbda7f5440
|
||||
case BindingData::FilePathIsFileReturnType::kIsFile:
|
||||
return args.GetReturnValue().Set(i);
|
||||
case BindingData::FilePathIsFileReturnType::kIsNotFile:
|
||||
@@ -3623,7 +3640,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -3744,7 +3761,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
|
||||
BufferValue buff_file_path(isolate, local_file_path);
|
||||
ToNamespacedPath(env, &buff_file_path);
|
||||
|
||||
@@ -114,7 +114,7 @@ index e78326ed0de805a8bf4f621cad9158635eb44aa2..d7009937b31729f33d9c45cbda7f5440
|
||||
return args.GetReturnValue().Set(i);
|
||||
case BindingData::FilePathIsFileReturnType::kIsNotFile:
|
||||
diff --git a/src/node_file.h b/src/node_file.h
|
||||
index bdad1ae25f4892cbbfd8cc30c4d8b4a6f600edbc..099488319f53bc7718313d6e30df2237cad6771d 100644
|
||||
index 224fa6f7ade375cb673c8adcc95927fa04f9c248..343c6bec67e6cf70ffb91b87e7837dbaf6071cee 100644
|
||||
--- a/src/node_file.h
|
||||
+++ b/src/node_file.h
|
||||
@@ -101,7 +101,8 @@ class BindingData : public SnapshotableObject {
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 16 Aug 2023 19:15:29 +0200
|
||||
Subject: fix: assert module in the renderer process
|
||||
|
||||
When creating a Node.js Environment, embedders have the option to disable Node.js'
|
||||
default overriding of Error.prepareStackTrace. However, the assert module depends on
|
||||
a WeakMap that is populated with the error stacktraces in the overridden function.
|
||||
|
||||
This adds handling to fall back to the default implementation if Error.prepareStackTrace
|
||||
if the override has been disabled.
|
||||
|
||||
This will be upstreamed.
|
||||
|
||||
diff --git a/lib/internal/assert/utils.js b/lib/internal/assert/utils.js
|
||||
index 13e41d67c635c27bd5e69eb4960eace34beaef0d..9a99c9ca93907630f9f3ba7ba24577a11465661c 100644
|
||||
--- a/lib/internal/assert/utils.js
|
||||
+++ b/lib/internal/assert/utils.js
|
||||
@@ -24,6 +24,7 @@ const AssertionError = require('internal/assert/assertion_error');
|
||||
const { openSync, closeSync, readSync } = require('fs');
|
||||
const { EOL } = require('internal/constants');
|
||||
const { BuiltinModule } = require('internal/bootstrap/realm');
|
||||
+const { getEmbedderOptions } = require('internal/options');
|
||||
const { isError } = require('internal/util');
|
||||
|
||||
const errorCache = new SafeMap();
|
||||
@@ -166,8 +167,16 @@ function getErrMessage(message, fn) {
|
||||
ErrorCaptureStackTrace(err, fn);
|
||||
if (errorStackTraceLimitIsWritable) Error.stackTraceLimit = tmpLimit;
|
||||
|
||||
- overrideStackTrace.set(err, (_, stack) => stack);
|
||||
- const call = err.stack[0];
|
||||
+ let call;
|
||||
+ if (getEmbedderOptions().hasPrepareStackTraceCallback) {
|
||||
+ overrideStackTrace.set(err, (_, stack) => stack);
|
||||
+ call = err.stack[0];
|
||||
+ } else {
|
||||
+ const tmpPrepare = Error.prepareStackTrace;
|
||||
+ Error.prepareStackTrace = (_, stack) => stack;
|
||||
+ call = err.stack[0];
|
||||
+ Error.prepareStackTrace = tmpPrepare;
|
||||
+ }
|
||||
|
||||
let filename = call.getFileName();
|
||||
const line = call.getLineNumber() - 1;
|
||||
diff --git a/src/node_options.cc b/src/node_options.cc
|
||||
index e3509abbc3bf84ac0edcd495eb3dde6219dbfc2d..8afded658c3f569de7b329ea9dddc11010748cf9 100644
|
||||
--- a/src/node_options.cc
|
||||
+++ b/src/node_options.cc
|
||||
@@ -1566,14 +1566,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
Isolate* isolate = args.GetIsolate();
|
||||
|
||||
- constexpr size_t kOptionsSize = 4;
|
||||
+ constexpr size_t kOptionsSize = 5;
|
||||
std::array<Local<Name>, kOptionsSize> names = {
|
||||
+ FIXED_ONE_BYTE_STRING(env->isolate(), "hasPrepareStackTraceCallback"),
|
||||
FIXED_ONE_BYTE_STRING(env->isolate(), "shouldNotRegisterESMLoader"),
|
||||
FIXED_ONE_BYTE_STRING(env->isolate(), "noGlobalSearchPaths"),
|
||||
FIXED_ONE_BYTE_STRING(env->isolate(), "noBrowserGlobals"),
|
||||
FIXED_ONE_BYTE_STRING(env->isolate(), "hasEmbedderPreload")};
|
||||
|
||||
std::array<Local<Value>, kOptionsSize> values = {
|
||||
+ Boolean::New(isolate, env->prepare_stack_trace_callback().IsEmpty()),
|
||||
Boolean::New(isolate, env->should_not_register_esm_loader()),
|
||||
Boolean::New(isolate, env->no_global_search_paths()),
|
||||
Boolean::New(isolate, env->no_browser_globals()),
|
||||
@@ -0,0 +1,57 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Fri, 24 Oct 2025 15:32:50 +0200
|
||||
Subject: fix: avoid external memory leak on invalid TLS protocol versions
|
||||
|
||||
Fixes a crash caused by unbalanced external memory accounting when
|
||||
tls.createSecureContext() is called with invalid minVersion/maxVersion values:
|
||||
|
||||
Prior to this change, _tls_common.js instantiated a native SecureContext
|
||||
which incremented V8 external memory via
|
||||
env->external_memory_accounter()->Increase(kExternalSize) in crypto_context.cc
|
||||
before protocol version validation ran in toV(), so an early
|
||||
ERR_TLS_INVALID_PROTOCOL_VERSION throw left the +1024 bytes un-decremented
|
||||
and V8 asserted in ExternalMemoryAccounter::~ExternalMemoryAccounter
|
||||
during Environment teardown.
|
||||
|
||||
Fix this by reordering the constructor to validate minVersion/maxVersion first and
|
||||
only allocate the native SecureContext on success.
|
||||
|
||||
This should be upstreamed to Node.js.
|
||||
|
||||
diff --git a/lib/_tls_common.js b/lib/_tls_common.js
|
||||
index 66331d2d9999e93e59cbce9e153affb942b79946..0f7fd0747ea779f76a9e64ed37d195bd735ea2a8 100644
|
||||
--- a/lib/_tls_common.js
|
||||
+++ b/lib/_tls_common.js
|
||||
@@ -82,10 +82,11 @@ function SecureContext(secureProtocol, secureOptions, minVersion, maxVersion) {
|
||||
throw new ERR_TLS_PROTOCOL_VERSION_CONFLICT(maxVersion, secureProtocol);
|
||||
}
|
||||
|
||||
+ const minV = toV('minimum', minVersion, tls.DEFAULT_MIN_VERSION);
|
||||
+ const maxV = toV('maximum', maxVersion, tls.DEFAULT_MAX_VERSION);
|
||||
+
|
||||
this.context = new NativeSecureContext();
|
||||
- this.context.init(secureProtocol,
|
||||
- toV('minimum', minVersion, tls.DEFAULT_MIN_VERSION),
|
||||
- toV('maximum', maxVersion, tls.DEFAULT_MAX_VERSION));
|
||||
+ this.context.init(secureProtocol, minV, maxV);
|
||||
|
||||
if (secureOptions) {
|
||||
validateInteger(secureOptions, 'secureOptions');
|
||||
diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
|
||||
index 8fbf4f25a91b953f3d2868889c7ee06932ee3c5f..96f6ea29525bc2c60297e7be5bc1d0b74cd568e1 100644
|
||||
--- a/src/crypto/crypto_context.cc
|
||||
+++ b/src/crypto/crypto_context.cc
|
||||
@@ -1355,10 +1355,8 @@ SecureContext::SecureContext(Environment* env, Local<Object> wrap)
|
||||
}
|
||||
|
||||
inline void SecureContext::Reset() {
|
||||
- if (ctx_ != nullptr) {
|
||||
- env()->external_memory_accounter()->Decrease(env()->isolate(),
|
||||
- kExternalSize);
|
||||
- }
|
||||
+ env()->external_memory_accounter()->Decrease(env()->isolate(),
|
||||
+ kExternalSize);
|
||||
ctx_.reset();
|
||||
cert_.reset();
|
||||
issuer_.reset();
|
||||
@@ -12,10 +12,10 @@ This can be removed/refactored once Node.js upgrades to a version of V8
|
||||
containing the above CL.
|
||||
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index f21687ad9dfd69c829aaaf8f3ed66b6bf6713765..17c29c759d4fa1a3b709c0844a80fbf509124d73 100644
|
||||
index c70bec82a28b166afa785d458d3f6c820d7b8565..5713d49d859e1161e1d6703c0b6f3d717a5a9a34 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -1246,7 +1246,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
|
||||
@@ -1245,7 +1245,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
|
||||
result->platform_ = per_process::v8_platform.Platform();
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,10 +6,10 @@ Subject: fix: do not resolve electron entrypoints
|
||||
This wastes fs cycles and can result in strange behavior if this path actually exists on disk
|
||||
|
||||
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
|
||||
index 2c33fd44b9a251682de78a8bcdad9ee5a0d3e5e8..ae3ef0e853ae19fca649704854d4bda84a5bd287 100644
|
||||
index 1f967df42128a05e49acfa6d409737c06a3372e3..c9b0dae3378f556c453f4fa31208eb6f57c433a9 100644
|
||||
--- a/lib/internal/modules/esm/translators.js
|
||||
+++ b/lib/internal/modules/esm/translators.js
|
||||
@@ -355,6 +355,10 @@ function cjsPreparseModuleExports(filename, source, format) {
|
||||
@@ -408,6 +408,10 @@ function cjsPreparseModuleExports(filename, source, format) {
|
||||
return { module, exportNames: module[kModuleExportNames] };
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ index 2c33fd44b9a251682de78a8bcdad9ee5a0d3e5e8..ae3ef0e853ae19fca649704854d4bda8
|
||||
({ source } = loadSourceForCJSWithHooks(module, filename, format));
|
||||
}
|
||||
diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js
|
||||
index 02ba43adc2c8e92a78942bbb04023a16f5870ee9..bbf1ab69b884a9325bebdd07b2c4fd354eee946b 100644
|
||||
index 2a9ef56d1568080d19d4b6e68a14c752e48c3822..fb45f3dc66a49a554df1c06431197392c0a199b7 100644
|
||||
--- a/lib/internal/modules/run_main.js
|
||||
+++ b/lib/internal/modules/run_main.js
|
||||
@@ -2,6 +2,7 @@
|
||||
@@ -32,8 +32,8 @@ index 02ba43adc2c8e92a78942bbb04023a16f5870ee9..bbf1ab69b884a9325bebdd07b2c4fd35
|
||||
globalThis,
|
||||
} = primordials;
|
||||
|
||||
@@ -26,6 +27,13 @@ const {
|
||||
* @param {string} main - Entry point path
|
||||
@@ -27,6 +28,13 @@ const {
|
||||
* @returns {string|undefined}
|
||||
*/
|
||||
function resolveMainPath(main) {
|
||||
+ // For built-in modules used as the main entry point we _never_
|
||||
@@ -43,11 +43,11 @@ index 02ba43adc2c8e92a78942bbb04023a16f5870ee9..bbf1ab69b884a9325bebdd07b2c4fd35
|
||||
+ return main;
|
||||
+ }
|
||||
+
|
||||
const defaultType = getOptionValue('--experimental-default-type');
|
||||
/** @type {string} */
|
||||
let mainPath;
|
||||
@@ -62,6 +70,13 @@ function resolveMainPath(main) {
|
||||
* @param {string} mainPath - Absolute path to the main entry point
|
||||
// Extension searching for the main entry point is supported for backward compatibility.
|
||||
@@ -50,6 +58,13 @@ function resolveMainPath(main) {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function shouldUseESMLoader(mainPath) {
|
||||
+ // For built-in modules used as the main entry point we _never_
|
||||
@@ -57,6 +57,6 @@ index 02ba43adc2c8e92a78942bbb04023a16f5870ee9..bbf1ab69b884a9325bebdd07b2c4fd35
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
if (getOptionValue('--experimental-default-type') === 'module') { return true; }
|
||||
|
||||
/**
|
||||
* @type {string[]} userLoaders A list of custom loaders registered by the user
|
||||
* (or an empty list when none have been registered).
|
||||
|
||||
@@ -8,10 +8,10 @@ resource path. This commit ensures that the TraverseParent function
|
||||
bails out if the parent path is outside of the resource path.
|
||||
|
||||
diff --git a/src/node_modules.cc b/src/node_modules.cc
|
||||
index 55d628f0c5e7f330e548878807de26d51ef025b5..c06779dea471b6f6a8dd29d4657162ef0faec043 100644
|
||||
index 9eec93f52f0d0b2e45ae04ff357b4ced0770782f..b93ccedaf703f86ae2092c304785394c471d520c 100644
|
||||
--- a/src/node_modules.cc
|
||||
+++ b/src/node_modules.cc
|
||||
@@ -291,8 +291,41 @@ const BindingData::PackageConfig* BindingData::TraverseParent(
|
||||
@@ -284,8 +284,41 @@ const BindingData::PackageConfig* BindingData::TraverseParent(
|
||||
Realm* realm, const std::filesystem::path& check_path) {
|
||||
std::filesystem::path current_path = check_path;
|
||||
auto env = realm->env();
|
||||
@@ -53,7 +53,7 @@ index 55d628f0c5e7f330e548878807de26d51ef025b5..c06779dea471b6f6a8dd29d4657162ef
|
||||
do {
|
||||
current_path = current_path.parent_path();
|
||||
|
||||
@@ -311,6 +344,12 @@ const BindingData::PackageConfig* BindingData::TraverseParent(
|
||||
@@ -304,6 +337,12 @@ const BindingData::PackageConfig* BindingData::TraverseParent(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ an API override to replace the native `ReadFileSync` in the `modules`
|
||||
binding.
|
||||
|
||||
diff --git a/src/env_properties.h b/src/env_properties.h
|
||||
index 82225b0a53dd828750991a4e15a060b736b6ea2b..4b0d31356a2496a7fc67876a22da2453efc54f53 100644
|
||||
index 2884149d82d180e0d2ecfa7ac8fd92f201f1cb55..dded4bf3d7106d127efbad81087f0c375b2b2c95 100644
|
||||
--- a/src/env_properties.h
|
||||
+++ b/src/env_properties.h
|
||||
@@ -508,6 +508,7 @@
|
||||
@@ -490,6 +490,7 @@
|
||||
V(maybe_cache_generated_source_map, v8::Function) \
|
||||
V(messaging_deserialize_create_object, v8::Function) \
|
||||
V(message_port, v8::Object) \
|
||||
@@ -20,18 +20,18 @@ index 82225b0a53dd828750991a4e15a060b736b6ea2b..4b0d31356a2496a7fc67876a22da2453
|
||||
V(performance_entry_callback, v8::Function) \
|
||||
V(prepare_stack_trace_callback, v8::Function) \
|
||||
diff --git a/src/node_modules.cc b/src/node_modules.cc
|
||||
index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413ee5c51e47 100644
|
||||
index b93ccedaf703f86ae2092c304785394c471d520c..bdbc511ef3f680bbac6770b89f47acaee95d56a2 100644
|
||||
--- a/src/node_modules.cc
|
||||
+++ b/src/node_modules.cc
|
||||
@@ -21,6 +21,7 @@ namespace modules {
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace modules {
|
||||
using v8::Array;
|
||||
using v8::Context;
|
||||
using v8::External;
|
||||
+using v8::Function;
|
||||
using v8::FunctionCallbackInfo;
|
||||
using v8::HandleScope;
|
||||
using v8::Isolate;
|
||||
@@ -89,6 +90,7 @@ Local<Array> BindingData::PackageConfig::Serialize(Realm* realm) const {
|
||||
using v8::Integer;
|
||||
@@ -94,6 +95,7 @@ Local<Array> BindingData::PackageConfig::Serialize(Realm* realm) const {
|
||||
|
||||
const BindingData::PackageConfig* BindingData::GetPackageJSON(
|
||||
Realm* realm, std::string_view path, ErrorContext* error_context) {
|
||||
@@ -39,7 +39,7 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e
|
||||
auto binding_data = realm->GetBindingData<BindingData>();
|
||||
|
||||
auto cache_entry = binding_data->package_configs_.find(path.data());
|
||||
@@ -98,8 +100,36 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON(
|
||||
@@ -103,8 +105,36 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON(
|
||||
|
||||
PackageConfig package_config{};
|
||||
package_config.file_path = path;
|
||||
@@ -76,8 +76,8 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e
|
||||
+ if (read_err < 0) {
|
||||
return nullptr;
|
||||
}
|
||||
// In some systems, std::string is annotated to generate an
|
||||
@@ -249,6 +279,12 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON(
|
||||
simdjson::ondemand::document document;
|
||||
@@ -242,6 +272,12 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON(
|
||||
return &cached.first->second;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e
|
||||
void BindingData::ReadPackageJSON(const FunctionCallbackInfo<Value>& args) {
|
||||
CHECK_GE(args.Length(), 1); // path, [is_esm, base, specifier]
|
||||
CHECK(args[0]->IsString()); // path
|
||||
@@ -643,6 +679,8 @@ void InitImportMetaPathHelpers(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -674,6 +710,8 @@ void SaveCompileCacheEntry(const FunctionCallbackInfo<Value>& args) {
|
||||
void BindingData::CreatePerIsolateProperties(IsolateData* isolate_data,
|
||||
Local<ObjectTemplate> target) {
|
||||
Isolate* isolate = isolate_data->isolate();
|
||||
@@ -99,7 +99,7 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e
|
||||
SetMethod(isolate, target, "readPackageJSON", ReadPackageJSON);
|
||||
SetMethod(isolate,
|
||||
target,
|
||||
@@ -685,6 +723,8 @@ void BindingData::CreatePerContextProperties(Local<Object> target,
|
||||
@@ -733,6 +771,8 @@ void BindingData::CreatePerContextProperties(Local<Object> target,
|
||||
|
||||
void BindingData::RegisterExternalReferences(
|
||||
ExternalReferenceRegistry* registry) {
|
||||
@@ -107,9 +107,9 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e
|
||||
+
|
||||
registry->Register(ReadPackageJSON);
|
||||
registry->Register(GetNearestParentPackageJSONType);
|
||||
registry->Register(GetNearestParentPackageJSON);
|
||||
registry->Register(GetPackageScopeConfig<false>);
|
||||
diff --git a/src/node_modules.h b/src/node_modules.h
|
||||
index eb2900d8f8385238f89a6dcc972a28e5fcb1d288..e28f38d98f4f8749048af135f0dcbe55aa69c4fe 100644
|
||||
index e4ba6b75bc86d14deada835903ba68a4cb0eccc5..ae77f9ec81b358bd356993617cd07671d382e8ca 100644
|
||||
--- a/src/node_modules.h
|
||||
+++ b/src/node_modules.h
|
||||
@@ -54,6 +54,8 @@ class BindingData : public SnapshotableObject {
|
||||
@@ -119,5 +119,5 @@ index eb2900d8f8385238f89a6dcc972a28e5fcb1d288..e28f38d98f4f8749048af135f0dcbe55
|
||||
+ static void OverrideReadFileSync(
|
||||
+ const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void ReadPackageJSON(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void GetNearestParentPackageJSON(
|
||||
static void GetNearestParentPackageJSONType(
|
||||
const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: fix: expose the built-in electron module via the ESM loader
|
||||
This allows usage of `import { app } from 'electron'` and `import('electron')` natively in the browser + non-sandboxed renderer
|
||||
|
||||
diff --git a/lib/internal/modules/esm/get_format.js b/lib/internal/modules/esm/get_format.js
|
||||
index 9519f947b8dfdc69808839948c9cb8434a0acf0e..23ce72d479f638c33edffcea7c35f5da6cab7cae 100644
|
||||
index 01584983c16a2ab6eec2fbb01208504f2771148b..6afbbca6c95103f3ecad29485581c94735bac0d3 100644
|
||||
--- a/lib/internal/modules/esm/get_format.js
|
||||
+++ b/lib/internal/modules/esm/get_format.js
|
||||
@@ -26,6 +26,7 @@ const protocolHandlers = {
|
||||
@@ -18,10 +18,10 @@ index 9519f947b8dfdc69808839948c9cb8434a0acf0e..23ce72d479f638c33edffcea7c35f5da
|
||||
|
||||
/**
|
||||
diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js
|
||||
index 307c35980551470b65128bebf5efe94df4e56892..3676a9852bcd42de0a3a380de117de58035f757b 100644
|
||||
index 8414d303c078d51a93c9127a1fd8d6f24961b104..e8a2326e158550786620439fa4039c2b449624cc 100644
|
||||
--- a/lib/internal/modules/esm/load.js
|
||||
+++ b/lib/internal/modules/esm/load.js
|
||||
@@ -81,7 +81,7 @@ function defaultLoad(url, context = kEmptyObject) {
|
||||
@@ -77,7 +77,7 @@ function defaultLoad(url, context = kEmptyObject) {
|
||||
|
||||
throwIfUnsupportedURLScheme(urlInstance);
|
||||
|
||||
@@ -30,7 +30,7 @@ index 307c35980551470b65128bebf5efe94df4e56892..3676a9852bcd42de0a3a380de117de58
|
||||
source = null;
|
||||
format ??= 'builtin';
|
||||
} else if (format === 'addon') {
|
||||
@@ -97,7 +97,7 @@ function defaultLoad(url, context = kEmptyObject) {
|
||||
@@ -93,7 +93,7 @@ function defaultLoad(url, context = kEmptyObject) {
|
||||
// Now that we have the source for the module, run `defaultGetFormat` to detect its format.
|
||||
format = defaultGetFormat(urlInstance, context);
|
||||
|
||||
@@ -39,7 +39,7 @@ index 307c35980551470b65128bebf5efe94df4e56892..3676a9852bcd42de0a3a380de117de58
|
||||
// For backward compatibility reasons, we need to discard the source in
|
||||
// order for the CJS loader to re-fetch it.
|
||||
source = null;
|
||||
@@ -145,7 +145,7 @@ function defaultLoadSync(url, context = kEmptyObject) {
|
||||
@@ -141,7 +141,7 @@ function defaultLoadSync(url, context = kEmptyObject) {
|
||||
|
||||
throwIfUnsupportedURLScheme(urlInstance, false);
|
||||
|
||||
@@ -48,7 +48,7 @@ index 307c35980551470b65128bebf5efe94df4e56892..3676a9852bcd42de0a3a380de117de58
|
||||
source = null;
|
||||
} else if (source == null) {
|
||||
({ responseURL, source } = getSourceSync(urlInstance, context));
|
||||
@@ -178,12 +178,13 @@ function throwIfUnsupportedURLScheme(parsed) {
|
||||
@@ -174,12 +174,13 @@ function throwIfUnsupportedURLScheme(parsed) {
|
||||
protocol !== 'file:' &&
|
||||
protocol !== 'data:' &&
|
||||
protocol !== 'node:' &&
|
||||
@@ -64,10 +64,10 @@ index 307c35980551470b65128bebf5efe94df4e56892..3676a9852bcd42de0a3a380de117de58
|
||||
}
|
||||
}
|
||||
diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js
|
||||
index 78985575beb3df7722ba90968e8f085574b5afdf..e032c016efe227c26364e81804ad183cd2c0d17f 100644
|
||||
index 300da51afe6185f5f9799a88fc75ba3b8f0cf5fb..4c7e2dc8c00c7a38a27169d1cc08e27f89e74fbb 100644
|
||||
--- a/lib/internal/modules/esm/loader.js
|
||||
+++ b/lib/internal/modules/esm/loader.js
|
||||
@@ -504,7 +504,7 @@ class ModuleLoader {
|
||||
@@ -522,7 +522,7 @@ class ModuleLoader {
|
||||
}
|
||||
|
||||
const cjsModule = wrap[imported_cjs_symbol];
|
||||
@@ -77,10 +77,10 @@ index 78985575beb3df7722ba90968e8f085574b5afdf..e032c016efe227c26364e81804ad183c
|
||||
// Check if the ESM initiating import CJS is being required by the same CJS module.
|
||||
if (cjsModule?.[kIsExecuting]) {
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..5aa946f66c71beff0b7a43c30638ab28a1a5dfc0 100644
|
||||
index c27ee4c6612c6a7ea0b6355f03563e8724fd0e40..5f03cf14e948d449d303b22ab6710b5508fb83b2 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
+++ b/lib/internal/modules/esm/resolve.js
|
||||
@@ -750,6 +750,9 @@ function packageImportsResolve(name, base, conditions) {
|
||||
@@ -751,6 +751,9 @@ function packageImportsResolve(name, base, conditions) {
|
||||
throw importNotDefined(name, packageJSONUrl, base);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..5aa946f66c71beff0b7a43c30638ab28
|
||||
|
||||
/**
|
||||
* Resolves a package specifier to a URL.
|
||||
@@ -764,6 +767,11 @@ function packageResolve(specifier, base, conditions) {
|
||||
@@ -765,6 +768,11 @@ function packageResolve(specifier, base, conditions) {
|
||||
return new URL('node:' + specifier);
|
||||
}
|
||||
|
||||
@@ -103,30 +103,21 @@ index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..5aa946f66c71beff0b7a43c30638ab28
|
||||
|
||||
const packageConfig = packageJsonReader.read(packageJSONPath, { __proto__: null, specifier, base, isESM: true });
|
||||
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
|
||||
index 757f093becd112002f3422302f4c29bb464f1a6c..c8cea2117080930105b33e4e50586a2c88ef7352 100644
|
||||
index 147d96bda8098fe16e5d0053e36eab05fb489c22..3c82913ca381eba30596f22a734b49dcba9b6f5b 100644
|
||||
--- a/lib/internal/modules/esm/translators.js
|
||||
+++ b/lib/internal/modules/esm/translators.js
|
||||
@@ -188,7 +188,7 @@ function createCJSModuleWrap(url, source, isMain, format, loadCJS = loadCJSModul
|
||||
|
||||
@@ -215,7 +215,9 @@ function createCJSModuleWrap(url, source, isMain, format, loadCJS = loadCJSModul
|
||||
const { exportNames, module } = cjsPreparseModuleExports(filename, source, format);
|
||||
cjsCache.set(url, module);
|
||||
- const namesWithDefault = exportNames.has('default') ?
|
||||
+ const namesWithDefault = filename === 'electron' ? ['default', ...Object.keys(module.exports)] : exportNames.has('default') ?
|
||||
[...exportNames] : ['default', ...exportNames];
|
||||
|
||||
if (isMain) {
|
||||
@@ -210,8 +210,8 @@ function createCJSModuleWrap(url, source, isMain, format, loadCJS = loadCJSModul
|
||||
({ exports } = module);
|
||||
}
|
||||
for (const exportName of exportNames) {
|
||||
- if (!ObjectPrototypeHasOwnProperty(exports, exportName) ||
|
||||
- exportName === 'default') {
|
||||
+ if (exportName === 'default' ||
|
||||
+ !ObjectPrototypeHasOwnProperty(exports, exportName)) {
|
||||
continue;
|
||||
}
|
||||
// We might trigger a getter -> dont fail.
|
||||
@@ -286,6 +286,10 @@ translators.set('require-commonjs', (url, source, isMain) => {
|
||||
- const wrapperNames = [...exportNames];
|
||||
+ const wrapperNames = filename === 'electron' ?
|
||||
+ ['default', ...Object.keys(module.exports)] :
|
||||
+ [...exportNames];
|
||||
if (!exportNames.has('default')) {
|
||||
ArrayPrototypePush(wrapperNames, 'default');
|
||||
}
|
||||
@@ -319,6 +321,10 @@ translators.set('require-commonjs', (url, source, isMain) => {
|
||||
return createCJSModuleWrap(url, source, isMain, 'commonjs');
|
||||
});
|
||||
|
||||
@@ -138,10 +129,10 @@ index 757f093becd112002f3422302f4c29bb464f1a6c..c8cea2117080930105b33e4e50586a2c
|
||||
// This translator function must be sync, as `require` is sync.
|
||||
translators.set('require-commonjs-typescript', (url, source, isMain) => {
|
||||
diff --git a/lib/internal/url.js b/lib/internal/url.js
|
||||
index d0c04be7c6ebc352d5958a987f3a4ba538e0d23a..00f9f3b73ed84c04ae712f6057b68737bd416333 100644
|
||||
index a1473fdac8aba3be541df3b6688a05c0dfbe403f..0a87d997856ea227f8f21393909ffc4634043f24 100644
|
||||
--- a/lib/internal/url.js
|
||||
+++ b/lib/internal/url.js
|
||||
@@ -1605,6 +1605,8 @@ function fileURLToPath(path, options = kEmptyObject) {
|
||||
@@ -1609,6 +1609,8 @@ function fileURLToPath(path, options = kEmptyObject) {
|
||||
path = new URL(path);
|
||||
else if (!isURL(path))
|
||||
throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path);
|
||||
|
||||
@@ -17,160 +17,82 @@ Upstreams:
|
||||
- https://github.com/nodejs/node/pull/39136
|
||||
|
||||
diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc
|
||||
index 6f9406eecacb7411a2e84a7b51e60b726d1961f3..a0cfb0bc3776dc3682cdb332ed418286d3243bd1 100644
|
||||
index e1c2da6969a1ce937d397735e844930f3234bba7..0bed152014949c22b6c610198df39a2522890279 100644
|
||||
--- a/deps/ncrypto/ncrypto.cc
|
||||
+++ b/deps/ncrypto/ncrypto.cc
|
||||
@@ -786,7 +786,7 @@ bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext) {
|
||||
|
||||
bool ok = true;
|
||||
|
||||
- for (int i = 0; i < sk_GENERAL_NAME_num(names); i++) {
|
||||
+ for (size_t i = 0; i < sk_GENERAL_NAME_num(names); i++) {
|
||||
GENERAL_NAME* gen = sk_GENERAL_NAME_value(names, i);
|
||||
|
||||
if (i != 0) BIO_write(out.get(), ", ", 2);
|
||||
@@ -810,7 +810,7 @@ bool SafeX509InfoAccessPrint(const BIOPointer& out, X509_EXTENSION* ext) {
|
||||
|
||||
bool ok = true;
|
||||
|
||||
- for (int i = 0; i < sk_ACCESS_DESCRIPTION_num(descs); i++) {
|
||||
+ for (size_t i = 0; i < sk_ACCESS_DESCRIPTION_num(descs); i++) {
|
||||
ACCESS_DESCRIPTION* desc = sk_ACCESS_DESCRIPTION_value(descs, i);
|
||||
|
||||
if (i != 0) BIO_write(out.get(), "\n", 1);
|
||||
@@ -952,13 +952,17 @@ BIOPointer X509View::getValidTo() const {
|
||||
|
||||
int64_t X509View::getValidToTime() const {
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
#include <string_view>
|
||||
+#include <vector>
|
||||
#if OPENSSL_VERSION_MAJOR >= 3
|
||||
#include <openssl/core_names.h>
|
||||
#include <openssl/params.h>
|
||||
@@ -1130,7 +1131,9 @@ int64_t X509View::getValidToTime() const {
|
||||
return tp;
|
||||
#else
|
||||
struct tm tp;
|
||||
- ASN1_TIME_to_tm(X509_get0_notAfter(cert_), &tp);
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
+ ASN1_TIME_to_tm(X509_get0_notAfter(cert_), &tp);
|
||||
+#endif
|
||||
return PortableTimeGM(&tp);
|
||||
#endif
|
||||
}
|
||||
|
||||
int64_t X509View::getValidFromTime() const {
|
||||
@@ -1142,7 +1145,9 @@ int64_t X509View::getValidFromTime() const {
|
||||
return tp;
|
||||
#else
|
||||
struct tm tp;
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
ASN1_TIME_to_tm(X509_get0_notBefore(cert_), &tp);
|
||||
+#endif
|
||||
return PortableTimeGM(&tp);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1233,7 +1237,11 @@ BIOPointer BIOPointer::NewMem() {
|
||||
}
|
||||
|
||||
BIOPointer BIOPointer::NewSecMem() {
|
||||
- return BIOPointer(BIO_new(BIO_s_secmem()));
|
||||
+#ifdef OPENSSL_IS_BORINGSSL
|
||||
+ return BIOPointer(BIO_new(BIO_s_mem()));
|
||||
+#else
|
||||
+ return BIOPointer(BIO_new(BIO_s_secmem()));
|
||||
+#endif
|
||||
}
|
||||
|
||||
BIOPointer BIOPointer::New(const BIO_METHOD* method) {
|
||||
@@ -1303,8 +1311,10 @@ BignumPointer DHPointer::FindGroup(const std::string_view name,
|
||||
#define V(n, p) \
|
||||
if (EqualNoCase(name, n)) return BignumPointer(p(nullptr));
|
||||
if (option != FindGroupOption::NO_SMALL_PRIMES) {
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
V("modp1", BN_get_rfc2409_prime_768);
|
||||
V("modp2", BN_get_rfc2409_prime_1024);
|
||||
+#endif
|
||||
V("modp5", BN_get_rfc3526_prime_1536);
|
||||
}
|
||||
V("modp14", BN_get_rfc3526_prime_2048);
|
||||
@@ -1380,11 +1390,13 @@ DHPointer::CheckPublicKeyResult DHPointer::checkPublicKey(
|
||||
int codes = 0;
|
||||
if (DH_check_pub_key(dh_.get(), pub_key.get(), &codes) != 1)
|
||||
return DHPointer::CheckPublicKeyResult::CHECK_FAILED;
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
if (codes & DH_CHECK_PUBKEY_TOO_SMALL) {
|
||||
return DHPointer::CheckPublicKeyResult::TOO_SMALL;
|
||||
} else if (codes & DH_CHECK_PUBKEY_TOO_SMALL) {
|
||||
return DHPointer::CheckPublicKeyResult::TOO_LARGE;
|
||||
- } else if (codes != 0) {
|
||||
+#endif
|
||||
+ if (codes != 0) {
|
||||
return DHPointer::CheckPublicKeyResult::INVALID;
|
||||
}
|
||||
return CheckPublicKeyResult::NONE;
|
||||
@@ -2327,7 +2339,7 @@ const std::string_view SSLPointer::getClientHelloAlpn() const {
|
||||
const unsigned char* buf;
|
||||
size_t len;
|
||||
size_t rem;
|
||||
@@ -2886,10 +2891,6 @@ std::optional<uint32_t> SSLPointer::verifyPeerCertificate() const {
|
||||
const char* SSLPointer::getClientHelloAlpn() const {
|
||||
if (ssl_ == nullptr) return {};
|
||||
#ifndef OPENSSL_IS_BORINGSSL
|
||||
- const unsigned char* buf;
|
||||
- size_t len;
|
||||
- size_t rem;
|
||||
-
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
if (!SSL_client_hello_get0_ext(
|
||||
get(),
|
||||
TLSEXT_TYPE_application_layer_protocol_negotiation,
|
||||
@@ -2340,6 +2352,8 @@ const std::string_view SSLPointer::getClientHelloAlpn() const {
|
||||
len = (buf[0] << 8) | buf[1];
|
||||
if (len + 2 != rem) return {};
|
||||
return reinterpret_cast<const char*>(buf + 3);
|
||||
+#endif
|
||||
+ return {};
|
||||
}
|
||||
|
||||
const std::string_view SSLPointer::getClientHelloServerName() const {
|
||||
@@ -2347,7 +2361,7 @@ const std::string_view SSLPointer::getClientHelloServerName() const {
|
||||
const unsigned char* buf;
|
||||
size_t len;
|
||||
size_t rem;
|
||||
-
|
||||
@@ -3090,9 +3091,11 @@ const Cipher Cipher::AES_256_GCM = Cipher::FromNid(NID_aes_256_gcm);
|
||||
const Cipher Cipher::AES_128_KW = Cipher::FromNid(NID_id_aes128_wrap);
|
||||
const Cipher Cipher::AES_192_KW = Cipher::FromNid(NID_id_aes192_wrap);
|
||||
const Cipher Cipher::AES_256_KW = Cipher::FromNid(NID_id_aes256_wrap);
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
if (!SSL_client_hello_get0_ext(get(), TLSEXT_TYPE_server_name, &buf, &rem) ||
|
||||
rem <= 2) {
|
||||
return {};
|
||||
@@ -2363,6 +2377,8 @@ const std::string_view SSLPointer::getClientHelloServerName() const {
|
||||
len = (*(buf + 3) << 8) | *(buf + 4);
|
||||
if (len + 2 > rem) return {};
|
||||
return reinterpret_cast<const char*>(buf + 5);
|
||||
const Cipher Cipher::AES_128_OCB = Cipher::FromNid(NID_aes_128_ocb);
|
||||
const Cipher Cipher::AES_192_OCB = Cipher::FromNid(NID_aes_192_ocb);
|
||||
const Cipher Cipher::AES_256_OCB = Cipher::FromNid(NID_aes_256_ocb);
|
||||
+#endif
|
||||
+ return {};
|
||||
}
|
||||
const Cipher Cipher::CHACHA20_POLY1305 = Cipher::FromNid(NID_chacha20_poly1305);
|
||||
|
||||
std::optional<const std::string_view> SSLPointer::GetServerName(
|
||||
@@ -2396,8 +2412,11 @@ bool SSLPointer::isServer() const {
|
||||
EVPKeyPointer SSLPointer::getPeerTempKey() const {
|
||||
if (!ssl_) return {};
|
||||
EVP_PKEY* raw_key = nullptr;
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
if (!SSL_get_peer_tmp_key(get(), &raw_key)) return {};
|
||||
return EVPKeyPointer(raw_key);
|
||||
+#endif
|
||||
+ return {};
|
||||
}
|
||||
|
||||
SSLCtxPointer::SSLCtxPointer(SSL_CTX* ctx) : ctx_(ctx) {}
|
||||
bool Cipher::isGcmMode() const {
|
||||
diff --git a/deps/ncrypto/ncrypto.h b/deps/ncrypto/ncrypto.h
|
||||
index e5bf2b529bf23914677e25d7468aad58a4684557..9a3c6029ff3319cce58c79782a7bd5d1fcd467f9 100644
|
||||
index 175ec8ba0f2a908ffad2ce48434aeed573b09c90..3218590ddce1e92c2a9d776f20f9fb016612061d 100644
|
||||
--- a/deps/ncrypto/ncrypto.h
|
||||
+++ b/deps/ncrypto/ncrypto.h
|
||||
@@ -623,17 +623,21 @@ class DHPointer final {
|
||||
UNABLE_TO_CHECK_GENERATOR = DH_UNABLE_TO_CHECK_GENERATOR,
|
||||
NOT_SUITABLE_GENERATOR = DH_NOT_SUITABLE_GENERATOR,
|
||||
Q_NOT_PRIME = DH_CHECK_Q_NOT_PRIME,
|
||||
@@ -306,9 +306,13 @@ class Cipher final {
|
||||
#else
|
||||
static constexpr size_t MAX_AUTH_TAG_LENGTH = 16;
|
||||
#endif
|
||||
- static_assert(EVP_GCM_TLS_TAG_LEN <= MAX_AUTH_TAG_LENGTH &&
|
||||
- EVP_CCM_TLS_TAG_LEN <= MAX_AUTH_TAG_LENGTH &&
|
||||
- EVP_CHACHAPOLY_TLS_TAG_LEN <= MAX_AUTH_TAG_LENGTH);
|
||||
+ static_assert(EVP_GCM_TLS_TAG_LEN <= MAX_AUTH_TAG_LENGTH
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
INVALID_Q = DH_CHECK_INVALID_Q_VALUE,
|
||||
INVALID_J = DH_CHECK_INVALID_J_VALUE,
|
||||
+ && EVP_CCM_TLS_TAG_LEN <= MAX_AUTH_TAG_LENGTH
|
||||
+ && EVP_CHACHAPOLY_TLS_TAG_LEN <= MAX_AUTH_TAG_LENGTH);
|
||||
+#else
|
||||
+ );
|
||||
+#endif
|
||||
CHECK_FAILED = 512,
|
||||
};
|
||||
CheckResult check();
|
||||
|
||||
enum class CheckPublicKeyResult {
|
||||
NONE,
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
TOO_SMALL = DH_R_CHECK_PUBKEY_TOO_SMALL,
|
||||
TOO_LARGE = DH_R_CHECK_PUBKEY_TOO_LARGE,
|
||||
- INVALID = DH_R_CHECK_PUBKEY_INVALID,
|
||||
+#endif
|
||||
+ INVALID = DH_R_INVALID_PUBKEY,
|
||||
CHECK_FAILED = 512,
|
||||
};
|
||||
// Check to see if the given public key is suitable for this DH instance.
|
||||
Cipher() = default;
|
||||
Cipher(const EVP_CIPHER* cipher) : cipher_(cipher) {}
|
||||
diff --git a/node.gni b/node.gni
|
||||
index e2407027ab05e59b2f0f1c213b98ea469db7a91b..c64761b730e61edcdc0e46a48699f2fd5bb1c0a6 100644
|
||||
--- a/node.gni
|
||||
@@ -185,31 +107,32 @@ index e2407027ab05e59b2f0f1c213b98ea469db7a91b..c64761b730e61edcdc0e46a48699f2fd
|
||||
# The location of simdutf - use the one from node's deps by default.
|
||||
node_simdutf_path = "//third_party/simdutf"
|
||||
diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc
|
||||
index 2176fb6982484e2c42538478eeb4dd81c9d50ee1..c00d3616e08b00b1e0a3a29b2dbb5278e1e14fcc 100644
|
||||
index 5ed2f8b35a1e2f8348a0f3891f37944f49371256..bd453ae633b2833cc3c6e3e415b43792dc5bf2e5 100644
|
||||
--- a/src/crypto/crypto_cipher.cc
|
||||
+++ b/src/crypto/crypto_cipher.cc
|
||||
@@ -1027,7 +1027,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
|
||||
if (EVP_PKEY_decrypt_init(ctx.get()) <= 0) {
|
||||
return ThrowCryptoError(env, ERR_get_error());
|
||||
@@ -447,6 +447,7 @@ bool CipherBase::InitAuthenticated(const char* cipher_type,
|
||||
}
|
||||
-
|
||||
} else {
|
||||
if (auth_tag_len == kNoAuthTagLength) {
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
int rsa_pkcs1_implicit_rejection =
|
||||
EVP_PKEY_CTX_ctrl_str(ctx.get(), "rsa_pkcs1_implicit_rejection", "1");
|
||||
// From the doc -2 means that the option is not supported.
|
||||
@@ -1042,6 +1042,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
|
||||
env,
|
||||
"RSA_PKCS1_PADDING is no longer supported for private decryption");
|
||||
}
|
||||
// We treat ChaCha20-Poly1305 specially. Like GCM, the authentication tag
|
||||
// length defaults to 16 bytes when encrypting. Unlike GCM, the
|
||||
// authentication tag length also defaults to 16 bytes when decrypting,
|
||||
@@ -458,6 +459,9 @@ bool CipherBase::InitAuthenticated(const char* cipher_type,
|
||||
env(), "authTagLength required for %s", cipher_type);
|
||||
return false;
|
||||
}
|
||||
+#else
|
||||
+ return false;
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
||||
const EVP_MD* digest = nullptr;
|
||||
// TODO(tniessen) Support CCM decryption in FIPS mode
|
||||
diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc
|
||||
index d94f6e1c82c4a62547b3b395f375c86ce4deb5de..b81b9005365272217c77e2b9289bd9f877c0e77c 100644
|
||||
index d005bf0ffb93445fa6611a1beb1b465764271ede..01770687bd191c61af02e76d7de24bbac5c47b8f 100644
|
||||
--- a/src/crypto/crypto_common.cc
|
||||
+++ b/src/crypto/crypto_common.cc
|
||||
@@ -124,7 +124,7 @@ StackOfX509 CloneSSLCerts(X509Pointer&& cert,
|
||||
@@ -90,7 +90,7 @@ StackOfX509 CloneSSLCerts(X509Pointer&& cert,
|
||||
if (!peer_certs) return StackOfX509();
|
||||
if (cert && !sk_X509_push(peer_certs.get(), cert.release()))
|
||||
return StackOfX509();
|
||||
@@ -218,7 +141,7 @@ index d94f6e1c82c4a62547b3b395f375c86ce4deb5de..b81b9005365272217c77e2b9289bd9f8
|
||||
X509Pointer cert(X509_dup(sk_X509_value(ssl_certs, i)));
|
||||
if (!cert || !sk_X509_push(peer_certs.get(), cert.get()))
|
||||
return StackOfX509();
|
||||
@@ -140,7 +140,7 @@ MaybeLocal<Object> AddIssuerChainToObject(X509Pointer* cert,
|
||||
@@ -106,7 +106,7 @@ MaybeLocal<Object> AddIssuerChainToObject(X509Pointer* cert,
|
||||
Environment* const env) {
|
||||
cert->reset(sk_X509_delete(peer_certs.get(), 0));
|
||||
for (;;) {
|
||||
@@ -228,10 +151,10 @@ index d94f6e1c82c4a62547b3b395f375c86ce4deb5de..b81b9005365272217c77e2b9289bd9f8
|
||||
X509View ca(sk_X509_value(peer_certs.get(), i));
|
||||
if (!cert->view().isIssuedBy(ca)) continue;
|
||||
diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
|
||||
index c08dab17fa229d1d67d3ad5174c97192989b2bd0..a3d309d832c73ddc79564b9644d825bec7459e7f 100644
|
||||
index 6482bd58bb6a95cfa4074ea9535e1443aea66bb5..20d3c1d9d17fde18fc09b6ee219137831eb08a45 100644
|
||||
--- a/src/crypto/crypto_context.cc
|
||||
+++ b/src/crypto/crypto_context.cc
|
||||
@@ -141,7 +141,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
|
||||
@@ -143,7 +143,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
|
||||
// the CA certificates.
|
||||
SSL_CTX_clear_extra_chain_certs(ctx);
|
||||
|
||||
@@ -240,7 +163,7 @@ index c08dab17fa229d1d67d3ad5174c97192989b2bd0..a3d309d832c73ddc79564b9644d825be
|
||||
X509* ca = sk_X509_value(extra_certs, i);
|
||||
|
||||
// NOTE: Increments reference count on `ca`
|
||||
@@ -1773,11 +1773,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -1831,11 +1831,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
|
||||
// If the user specified "auto" for dhparams, the JavaScript layer will pass
|
||||
// true to this function instead of the original string. Any other string
|
||||
// value will be interpreted as custom DH parameters below.
|
||||
@@ -254,7 +177,7 @@ index c08dab17fa229d1d67d3ad5174c97192989b2bd0..a3d309d832c73ddc79564b9644d825be
|
||||
DHPointer dh;
|
||||
{
|
||||
BIOPointer bio(LoadBIO(env, args[0]));
|
||||
@@ -2003,7 +2004,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -2061,7 +2062,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
|
||||
// Add CA certs too
|
||||
@@ -264,71 +187,10 @@ index c08dab17fa229d1d67d3ad5174c97192989b2bd0..a3d309d832c73ddc79564b9644d825be
|
||||
|
||||
X509_STORE_add_cert(sc->GetCertStoreOwnedByThisSecureContext(), ca);
|
||||
diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc
|
||||
index c26a88b395abfc645da56231635b36fb23c8fa09..f23cedf4f2449d8edc9a8de1b70332e75d693cdd 100644
|
||||
index e35fda9ad2e8c52c75492d66566dc6e6c57dd2ae..46a7d1396dc1a175ae99f4e403721f1730fdd320 100644
|
||||
--- a/src/crypto/crypto_dh.cc
|
||||
+++ b/src/crypto/crypto_dh.cc
|
||||
@@ -7,7 +7,9 @@
|
||||
#include "memory_tracker-inl.h"
|
||||
#include "ncrypto.h"
|
||||
#include "node_errors.h"
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
#include "openssl/bnerr.h"
|
||||
+#endif
|
||||
#include "openssl/dh.h"
|
||||
#include "threadpoolwork-inl.h"
|
||||
#include "v8.h"
|
||||
@@ -88,11 +90,7 @@ void New(const FunctionCallbackInfo<Value>& args) {
|
||||
if (args[0]->IsInt32()) {
|
||||
int32_t bits = args[0].As<Int32>()->Value();
|
||||
if (bits < 2) {
|
||||
-#if OPENSSL_VERSION_MAJOR >= 3
|
||||
- ERR_put_error(ERR_LIB_DH, 0, DH_R_MODULUS_TOO_SMALL, __FILE__, __LINE__);
|
||||
-#else
|
||||
- ERR_put_error(ERR_LIB_BN, 0, BN_R_BITS_TOO_SMALL, __FILE__, __LINE__);
|
||||
-#endif
|
||||
+ OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL);
|
||||
return ThrowCryptoError(env, ERR_get_error(), "Invalid prime length");
|
||||
}
|
||||
|
||||
@@ -105,7 +103,7 @@ void New(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
int32_t generator = args[1].As<Int32>()->Value();
|
||||
if (generator < 2) {
|
||||
- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__);
|
||||
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
|
||||
return ThrowCryptoError(env, ERR_get_error(), "Invalid generator");
|
||||
}
|
||||
|
||||
@@ -134,12 +132,12 @@ void New(const FunctionCallbackInfo<Value>& args) {
|
||||
if (args[1]->IsInt32()) {
|
||||
int32_t generator = args[1].As<Int32>()->Value();
|
||||
if (generator < 2) {
|
||||
- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__);
|
||||
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
|
||||
return ThrowCryptoError(env, ERR_get_error(), "Invalid generator");
|
||||
}
|
||||
bn_g = BignumPointer::New();
|
||||
if (!bn_g.setWord(generator)) {
|
||||
- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__);
|
||||
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
|
||||
return ThrowCryptoError(env, ERR_get_error(), "Invalid generator");
|
||||
}
|
||||
} else {
|
||||
@@ -148,11 +146,11 @@ void New(const FunctionCallbackInfo<Value>& args) {
|
||||
return THROW_ERR_OUT_OF_RANGE(env, "generator is too big");
|
||||
bn_g = BignumPointer(reinterpret_cast<uint8_t*>(arg1.data()), arg1.size());
|
||||
if (!bn_g) {
|
||||
- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__);
|
||||
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
|
||||
return ThrowCryptoError(env, ERR_get_error(), "Invalid generator");
|
||||
}
|
||||
if (bn_g.getWord() < 2) {
|
||||
- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__);
|
||||
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
|
||||
return ThrowCryptoError(env, ERR_get_error(), "Invalid generator");
|
||||
}
|
||||
}
|
||||
@@ -260,15 +258,17 @@ void ComputeSecret(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -309,15 +309,17 @@ void ComputeSecret(const FunctionCallbackInfo<Value>& args) {
|
||||
BignumPointer key(key_buf.data(), key_buf.size());
|
||||
|
||||
switch (dh.checkPublicKey(key)) {
|
||||
@@ -348,58 +210,24 @@ index c26a88b395abfc645da56231635b36fb23c8fa09..f23cedf4f2449d8edc9a8de1b70332e7
|
||||
case DHPointer::CheckPublicKeyResult::NONE:
|
||||
break;
|
||||
}
|
||||
@@ -400,9 +400,11 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
|
||||
key_params = EVPKeyPointer::New();
|
||||
CHECK(key_params);
|
||||
CHECK_EQ(EVP_PKEY_assign_DH(key_params.get(), dh.release()), 1);
|
||||
- } else if (int* prime_size = std::get_if<int>(¶ms->params.prime)) {
|
||||
+ } else if (std::get_if<int>(¶ms->params.prime)) {
|
||||
EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DH, nullptr));
|
||||
EVP_PKEY* raw_params = nullptr;
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
+ int* prime_size = std::get_if<int>(¶ms->params.prime);
|
||||
if (!param_ctx ||
|
||||
EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 ||
|
||||
EVP_PKEY_CTX_set_dh_paramgen_prime_len(
|
||||
@@ -416,6 +418,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
|
||||
}
|
||||
diff --git a/src/crypto/crypto_hash.cc b/src/crypto/crypto_hash.cc
|
||||
index 33cde71b105c7cf22b559583d2e46bfb50016f6d..659910992dff7c05bb7e367e1cba14256b46dea4 100644
|
||||
--- a/src/crypto/crypto_hash.cc
|
||||
+++ b/src/crypto/crypto_hash.cc
|
||||
@@ -232,7 +232,7 @@ void Hash::OneShotDigest(const FunctionCallbackInfo<Value>& args) {
|
||||
enum encoding output_enc = ParseEncoding(isolate, args[4], args[5], HEX);
|
||||
|
||||
key_params = EVPKeyPointer(raw_params);
|
||||
+#else
|
||||
+ return EVPKeyCtxPointer();
|
||||
+#endif
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
}
|
||||
diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc
|
||||
index ca5edc8ebdf2550bb62b7969a5650733a2647f4f..198e18b58f31e361a9d2865cbe81e067e5f0b543 100644
|
||||
--- a/src/crypto/crypto_dsa.cc
|
||||
+++ b/src/crypto/crypto_dsa.cc
|
||||
@@ -43,7 +43,7 @@ namespace crypto {
|
||||
EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) {
|
||||
EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DSA, nullptr));
|
||||
EVP_PKEY* raw_params = nullptr;
|
||||
-
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
if (!param_ctx ||
|
||||
EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 ||
|
||||
EVP_PKEY_CTX_set_dsa_paramgen_bits(
|
||||
@@ -58,7 +58,9 @@ EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) {
|
||||
return EVPKeyCtxPointer();
|
||||
}
|
||||
}
|
||||
-
|
||||
+#else
|
||||
+ return EVPKeyCtxPointer();
|
||||
+#endif
|
||||
if (EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0)
|
||||
return EVPKeyCtxPointer();
|
||||
bool is_xof = (EVP_MD_flags(md) & EVP_MD_FLAG_XOF) != 0;
|
||||
- int output_length = EVP_MD_size(md);
|
||||
+ size_t output_length = EVP_MD_size(md);
|
||||
|
||||
// This is to cause hash() to fail when an incorrect
|
||||
// outputLength option was passed for a non-XOF hash function.
|
||||
diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc
|
||||
index 7238cda445fd663e6b45fa134f31d017bb267dfc..522655555cdb2ab2083797f736bf167d1f42c15e 100644
|
||||
index e805a984322c8348ceba950fe6f45e002ade10b3..bb9b1f8e1b3c6dd8479ee463e303088e3240d6be 100644
|
||||
--- a/src/crypto/crypto_keys.cc
|
||||
+++ b/src/crypto/crypto_keys.cc
|
||||
@@ -949,6 +949,7 @@ void KeyObjectHandle::GetAsymmetricKeyType(
|
||||
@@ -1034,6 +1034,7 @@ void KeyObjectHandle::GetAsymmetricKeyType(
|
||||
}
|
||||
|
||||
bool KeyObjectHandle::CheckEcKeyData() const {
|
||||
@@ -407,62 +235,21 @@ index 7238cda445fd663e6b45fa134f31d017bb267dfc..522655555cdb2ab2083797f736bf167d
|
||||
MarkPopErrorOnReturn mark_pop_error_on_return;
|
||||
|
||||
const auto& key = data_.GetAsymmetricKey();
|
||||
@@ -965,6 +966,9 @@ bool KeyObjectHandle::CheckEcKeyData() const {
|
||||
#else
|
||||
return EVP_PKEY_public_check(ctx.get()) == 1;
|
||||
#endif
|
||||
@@ -1043,6 +1044,9 @@ bool KeyObjectHandle::CheckEcKeyData() const {
|
||||
|
||||
return data_.GetKeyType() == kKeyTypePrivate ? ctx.privateCheck()
|
||||
: ctx.publicCheck();
|
||||
+#else
|
||||
+ return true;
|
||||
+#endif
|
||||
}
|
||||
|
||||
void KeyObjectHandle::CheckEcKeyData(const FunctionCallbackInfo<Value>& args) {
|
||||
diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc
|
||||
index 78f2093d1d010be6f9c492662f4f582657ff6a13..b6aef7fd27cd974697bcee05955bfd9ccf4d5837 100644
|
||||
--- a/src/crypto/crypto_random.cc
|
||||
+++ b/src/crypto/crypto_random.cc
|
||||
@@ -143,7 +143,7 @@ Maybe<void> RandomPrimeTraits::AdditionalConfig(
|
||||
|
||||
params->bits = bits;
|
||||
params->safe = safe;
|
||||
- params->prime = BignumPointer::NewSecure();
|
||||
+ params->prime = BignumPointer::New();
|
||||
if (!params->prime) {
|
||||
THROW_ERR_CRYPTO_OPERATION_FAILED(env, "could not generate prime");
|
||||
return Nothing<void>();
|
||||
diff --git a/src/crypto/crypto_rsa.cc b/src/crypto/crypto_rsa.cc
|
||||
index 05a3882c7e17d78e27aabb29891aa250789a47c0..1f2fccce6ed8f14525557644e0bdd130eedf3337 100644
|
||||
--- a/src/crypto/crypto_rsa.cc
|
||||
+++ b/src/crypto/crypto_rsa.cc
|
||||
@@ -612,10 +612,13 @@ Maybe<void> GetRsaKeyDetail(Environment* env,
|
||||
}
|
||||
|
||||
if (params->saltLength != nullptr) {
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
+ // TODO(codebytere): Upstream a shim to BoringSSL?
|
||||
if (ASN1_INTEGER_get_int64(&salt_length, params->saltLength) != 1) {
|
||||
ThrowCryptoError(env, ERR_get_error(), "ASN1_INTEGER_get_in64 error");
|
||||
return Nothing<void>();
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
if (target
|
||||
diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc
|
||||
index 7c548d32b40365343f0e208c3aa856a1c847f4c3..6346f8f7199cf7b7d3736c59571606fff102fbb6 100644
|
||||
index 205e248e0f20f019e189a6c69d3c011a616b3939..12b0d804c6f1d4998b85160b0aac8eb7a3b5576b 100644
|
||||
--- a/src/crypto/crypto_util.cc
|
||||
+++ b/src/crypto/crypto_util.cc
|
||||
@@ -207,7 +207,8 @@ void TestFipsCrypto(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
|
||||
void GetOpenSSLSecLevelCrypto(const FunctionCallbackInfo<Value>& args) {
|
||||
// for BoringSSL assume the same as the default
|
||||
- int sec_level = OPENSSL_TLS_SECURITY_LEVEL;
|
||||
+ // value of OPENSSL_TLS_SECURITY_LEVEL.
|
||||
+ int sec_level = 1;
|
||||
#ifndef OPENSSL_IS_BORINGSSL
|
||||
Environment* env = Environment::GetCurrent(args);
|
||||
|
||||
@@ -527,24 +528,15 @@ Maybe<void> Decorate(Environment* env,
|
||||
@@ -533,24 +533,15 @@ Maybe<void> Decorate(Environment* env,
|
||||
V(BIO) \
|
||||
V(PKCS7) \
|
||||
V(X509V3) \
|
||||
@@ -488,42 +275,11 @@ index 7c548d32b40365343f0e208c3aa856a1c847f4c3..6346f8f7199cf7b7d3736c59571606ff
|
||||
V(USER) \
|
||||
|
||||
#define V(name) case ERR_LIB_##name: lib = #name "_"; break;
|
||||
@@ -686,7 +678,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
|
||||
CHECK(args[0]->IsUint32());
|
||||
Environment* env = Environment::GetCurrent(args);
|
||||
uint32_t len = args[0].As<Uint32>()->Value();
|
||||
- void* data = OPENSSL_secure_zalloc(len);
|
||||
+ void* data = OPENSSL_malloc(len);
|
||||
if (data == nullptr) {
|
||||
// There's no memory available for the allocation.
|
||||
// Return nothing.
|
||||
@@ -697,7 +689,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
|
||||
data,
|
||||
len,
|
||||
[](void* data, size_t len, void* deleter_data) {
|
||||
- OPENSSL_secure_clear_free(data, len);
|
||||
+ OPENSSL_clear_free(data, len);
|
||||
},
|
||||
data);
|
||||
Local<ArrayBuffer> buffer = ArrayBuffer::New(env->isolate(), store);
|
||||
@@ -705,10 +697,12 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
|
||||
void SecureHeapUsed(const FunctionCallbackInfo<Value>& args) {
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
Environment* env = Environment::GetCurrent(args);
|
||||
if (CRYPTO_secure_malloc_initialized())
|
||||
args.GetReturnValue().Set(
|
||||
BigInt::New(env->isolate(), CRYPTO_secure_used()));
|
||||
+#endif
|
||||
}
|
||||
} // namespace
|
||||
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index 874e5f4d15a75307e45cf70c06fc104fed843a6a..35e16159a94bb97f19d17767e3ad4bb798660f44 100644
|
||||
index f3a2d221f4bb52987e1bdacdadf19aacfcf65ec3..d34aec43630b3cf53004d8180446d7136b59ceac 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -51,7 +51,7 @@
|
||||
@@ -52,7 +52,7 @@
|
||||
#include "v8-profiler.h"
|
||||
#include "v8.h"
|
||||
|
||||
@@ -532,7 +288,7 @@ index 874e5f4d15a75307e45cf70c06fc104fed843a6a..35e16159a94bb97f19d17767e3ad4bb7
|
||||
#include <openssl/evp.h>
|
||||
#endif
|
||||
|
||||
@@ -1077,7 +1077,7 @@ class Environment final : public MemoryRetainer {
|
||||
@@ -1058,7 +1058,7 @@ class Environment final : public MemoryRetainer {
|
||||
kExitInfoFieldCount
|
||||
};
|
||||
|
||||
@@ -554,21 +310,8 @@ index d9c533f100d25aeab1fe8589932a8ddead431258..2acab8786a8a752b17961445edeb872c
|
||||
#include <openssl/crypto.h>
|
||||
#if NODE_OPENSSL_HAS_QUIC
|
||||
#include <openssl/quic.h>
|
||||
diff --git a/src/node_options.cc b/src/node_options.cc
|
||||
index ed85bf11f6f325823b59b3b0275908f9210c1b24..e3509abbc3bf84ac0edcd495eb3dde6219dbfc2d 100644
|
||||
--- a/src/node_options.cc
|
||||
+++ b/src/node_options.cc
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "node_external_reference.h"
|
||||
#include "node_internals.h"
|
||||
#include "node_sea.h"
|
||||
-#if HAVE_OPENSSL
|
||||
+#if HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL)
|
||||
#include "openssl/opensslv.h"
|
||||
#endif
|
||||
|
||||
diff --git a/src/node_options.h b/src/node_options.h
|
||||
index cdbd9ca39e907ab22515293eac2c5512223f4ca2..418dee360f867c363f1576012b32213a51c4fdd0 100644
|
||||
index 3a1503a035e12b5dce75c77c327607c857a8a367..941ae4f15c42fb8016d03c786973fd4709ac1a0d 100644
|
||||
--- a/src/node_options.h
|
||||
+++ b/src/node_options.h
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
@@ -6,19 +6,19 @@ Subject: fix: lazyload fs in esm loaders to apply asar patches
|
||||
Changes { foo } from fs to just "fs.foo" so that our patching of fs is applied to esm loaders
|
||||
|
||||
diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js
|
||||
index 3676a9852bcd42de0a3a380de117de58035f757b..eaecfcfd8b922908957c3fefea65fb9deb445249 100644
|
||||
index e8a2326e158550786620439fa4039c2b449624cc..c17867136a07022a740d6bf957fe7a8138a48c11 100644
|
||||
--- a/lib/internal/modules/esm/load.js
|
||||
+++ b/lib/internal/modules/esm/load.js
|
||||
@@ -10,7 +10,7 @@ const {
|
||||
@@ -9,7 +9,7 @@ const {
|
||||
|
||||
const { defaultGetFormat } = require('internal/modules/esm/get_format');
|
||||
const { validateAttributes, emitImportAssertionWarning } = require('internal/modules/esm/assert');
|
||||
const { getOptionValue } = require('internal/options');
|
||||
-const { readFileSync } = require('fs');
|
||||
+const fs = require('fs');
|
||||
|
||||
const defaultType =
|
||||
getOptionValue('--experimental-default-type');
|
||||
@@ -38,7 +38,7 @@ function getSourceSync(url, context) {
|
||||
const { Buffer: { from: BufferFrom } } = require('buffer');
|
||||
|
||||
@@ -34,7 +34,7 @@ function getSourceSync(url, context) {
|
||||
const responseURL = href;
|
||||
let source;
|
||||
if (protocol === 'file:') {
|
||||
@@ -28,7 +28,7 @@ index 3676a9852bcd42de0a3a380de117de58035f757b..eaecfcfd8b922908957c3fefea65fb9d
|
||||
const result = dataURLProcessor(url);
|
||||
if (result === 'failure') {
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index 5aa946f66c71beff0b7a43c30638ab28a1a5dfc0..e3afd30ba1f591d0298793bc42fd7166a4219bce 100644
|
||||
index 5f03cf14e948d449d303b22ab6710b5508fb83b2..72cc9444ca93ef7a1526e23314693aeaf5f173b0 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
+++ b/lib/internal/modules/esm/resolve.js
|
||||
@@ -25,7 +25,7 @@ const {
|
||||
@@ -50,7 +50,7 @@ index 5aa946f66c71beff0b7a43c30638ab28a1a5dfc0..e3afd30ba1f591d0298793bc42fd7166
|
||||
});
|
||||
const { search, hash } = resolved;
|
||||
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
|
||||
index c8cea2117080930105b33e4e50586a2c88ef7352..2c33fd44b9a251682de78a8bcdad9ee5a0d3e5e8 100644
|
||||
index 3c82913ca381eba30596f22a734b49dcba9b6f5b..1f967df42128a05e49acfa6d409737c06a3372e3 100644
|
||||
--- a/lib/internal/modules/esm/translators.js
|
||||
+++ b/lib/internal/modules/esm/translators.js
|
||||
@@ -24,7 +24,7 @@ const {
|
||||
@@ -62,7 +62,7 @@ index c8cea2117080930105b33e4e50586a2c88ef7352..2c33fd44b9a251682de78a8bcdad9ee5
|
||||
const { dirname, extname } = require('path');
|
||||
const {
|
||||
assertBufferSource,
|
||||
@@ -315,7 +315,7 @@ translators.set('commonjs', function commonjsStrategy(url, source, isMain) {
|
||||
@@ -350,7 +350,7 @@ translators.set('commonjs', function commonjsStrategy(url, source, isMain) {
|
||||
|
||||
try {
|
||||
// We still need to read the FS to detect the exports.
|
||||
|
||||
@@ -10,7 +10,7 @@ change, it seems to introduce an incompatibility when compiling
|
||||
using clang modules. Disabling them resolves the issue.
|
||||
|
||||
diff --git a/unofficial.gni b/unofficial.gni
|
||||
index a64d2e4ac475abc049fff7ea62ec76de565a747d..ab456452d102088005fc4bfcb394d2de5ec44889 100644
|
||||
index dd686d2f7c8d2f6e8d6bd13a7bf2b4b140556ba9..97e4bcfaa8aa42a5fc2b68ccdd8128eac8886532 100644
|
||||
--- a/unofficial.gni
|
||||
+++ b/unofficial.gni
|
||||
@@ -195,6 +195,10 @@ template("node_gn_build") {
|
||||
@@ -24,7 +24,7 @@ index a64d2e4ac475abc049fff7ea62ec76de565a747d..ab456452d102088005fc4bfcb394d2de
|
||||
}
|
||||
if (is_posix) {
|
||||
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
|
||||
@@ -350,6 +354,12 @@ template("node_gn_build") {
|
||||
@@ -367,6 +371,12 @@ template("node_gn_build") {
|
||||
include_dirs = [ "src", "tools" ]
|
||||
configs += [ "//build/config/compiler:no_exit_time_destructors" ]
|
||||
|
||||
|
||||
@@ -45,10 +45,10 @@ index ac00778cfc59fb55e361b24fc81a965a5e8f97e7..f0c4d6dfc9f03bee59e656b2da9ac325
|
||||
# define UV__EUNATCH UV__ERR(EUNATCH)
|
||||
#else
|
||||
diff --git a/src/node_constants.cc b/src/node_constants.cc
|
||||
index 0ca643aa74d13f278685d2330b791182b55c15b4..cbcecfba33070b820aca0e2814982160a97a6378 100644
|
||||
index fd28e0904d05e24e8eeb74fa36abd9727699a649..fea0426496978c0003fe1481afcf93fc9c23edca 100644
|
||||
--- a/src/node_constants.cc
|
||||
+++ b/src/node_constants.cc
|
||||
@@ -241,10 +241,6 @@ void DefineErrnoConstants(Local<Object> target) {
|
||||
@@ -242,10 +242,6 @@ void DefineErrnoConstants(Local<Object> target) {
|
||||
NODE_DEFINE_CONSTANT(target, ENOBUFS);
|
||||
#endif
|
||||
|
||||
@@ -59,7 +59,7 @@ index 0ca643aa74d13f278685d2330b791182b55c15b4..cbcecfba33070b820aca0e2814982160
|
||||
#ifdef ENODEV
|
||||
NODE_DEFINE_CONSTANT(target, ENODEV);
|
||||
#endif
|
||||
@@ -281,14 +277,6 @@ void DefineErrnoConstants(Local<Object> target) {
|
||||
@@ -282,14 +278,6 @@ void DefineErrnoConstants(Local<Object> target) {
|
||||
NODE_DEFINE_CONSTANT(target, ENOSPC);
|
||||
#endif
|
||||
|
||||
@@ -74,7 +74,7 @@ index 0ca643aa74d13f278685d2330b791182b55c15b4..cbcecfba33070b820aca0e2814982160
|
||||
#ifdef ENOSYS
|
||||
NODE_DEFINE_CONSTANT(target, ENOSYS);
|
||||
#endif
|
||||
@@ -369,10 +357,6 @@ void DefineErrnoConstants(Local<Object> target) {
|
||||
@@ -370,10 +358,6 @@ void DefineErrnoConstants(Local<Object> target) {
|
||||
NODE_DEFINE_CONSTANT(target, ESTALE);
|
||||
#endif
|
||||
|
||||
@@ -86,7 +86,7 @@ index 0ca643aa74d13f278685d2330b791182b55c15b4..cbcecfba33070b820aca0e2814982160
|
||||
NODE_DEFINE_CONSTANT(target, ETIMEDOUT);
|
||||
#endif
|
||||
diff --git a/src/node_errors.cc b/src/node_errors.cc
|
||||
index 5f51add4cdf68a9487edfc9382f586cc94539571..befb642f1effa3c4139e4cd99ff64d9c5175fd72 100644
|
||||
index ae8553ee2022d60fea4572976b14ba9cd253aa45..4386a1bc5678e351ce084cd2c47202561619b164 100644
|
||||
--- a/src/node_errors.cc
|
||||
+++ b/src/node_errors.cc
|
||||
@@ -862,10 +862,6 @@ const char* errno_string(int errorno) {
|
||||
|
||||
@@ -1,224 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Sun, 29 Dec 2024 04:01:32 +0900
|
||||
Subject: fix: remove FastApiTypedArray usage
|
||||
|
||||
Refs https://github.com/electron/electron/pull/45055#issuecomment-2559095439
|
||||
Can be removed when upstream adopts relevant V8 version.
|
||||
|
||||
diff --git a/src/crypto/crypto_timing.cc b/src/crypto/crypto_timing.cc
|
||||
index fe669d40c31a29334b047b9cfee3067f64ef0a7b..9e5de7bbe574add017cd12ee091304d01e6458d6 100644
|
||||
--- a/src/crypto/crypto_timing.cc
|
||||
+++ b/src/crypto/crypto_timing.cc
|
||||
@@ -12,7 +12,6 @@ namespace node {
|
||||
|
||||
using v8::CFunction;
|
||||
using v8::FastApiCallbackOptions;
|
||||
-using v8::FastApiTypedArray;
|
||||
using v8::FunctionCallbackInfo;
|
||||
using v8::Local;
|
||||
using v8::Object;
|
||||
@@ -51,14 +50,13 @@ void TimingSafeEqual(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
|
||||
bool FastTimingSafeEqual(Local<Value> receiver,
|
||||
- const FastApiTypedArray<uint8_t>& a,
|
||||
- const FastApiTypedArray<uint8_t>& b,
|
||||
+ Local<Value> a,
|
||||
+ Local<Value> b,
|
||||
// NOLINTNEXTLINE(runtime/references)
|
||||
FastApiCallbackOptions& options) {
|
||||
- uint8_t* data_a;
|
||||
- uint8_t* data_b;
|
||||
- if (a.length() != b.length() || !a.getStorageIfAligned(&data_a) ||
|
||||
- !b.getStorageIfAligned(&data_b)) {
|
||||
+ FAST_SPREAD_BUFFER_ARG(a, a_buffer);
|
||||
+ FAST_SPREAD_BUFFER_ARG(b, b_buffer);
|
||||
+ if (a_buffer_length != b_buffer_length) {
|
||||
TRACK_V8_FAST_API_CALL("crypto.timingSafeEqual.error");
|
||||
v8::HandleScope scope(options.isolate);
|
||||
THROW_ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH(options.isolate);
|
||||
@@ -66,7 +64,7 @@ bool FastTimingSafeEqual(Local<Value> receiver,
|
||||
}
|
||||
|
||||
TRACK_V8_FAST_API_CALL("crypto.timingSafeEqual.ok");
|
||||
- return CRYPTO_memcmp(data_a, data_b, a.length()) == 0;
|
||||
+ return CRYPTO_memcmp(a_buffer_data, b_buffer_data, a_buffer_length) == 0;
|
||||
}
|
||||
|
||||
static CFunction fast_timing_safe_equal(CFunction::Make(FastTimingSafeEqual));
|
||||
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
|
||||
index e39852c8e0392e0a9ae5d4ea58be115416e19233..c94b14741c827a81d69a6f036426a344e563ad72 100644
|
||||
--- a/src/node_buffer.cc
|
||||
+++ b/src/node_buffer.cc
|
||||
@@ -44,6 +44,14 @@
|
||||
#define THROW_AND_RETURN_UNLESS_BUFFER(env, obj) \
|
||||
THROW_AND_RETURN_IF_NOT_BUFFER(env, obj, "argument") \
|
||||
|
||||
+#define THROW_AND_RETURN_VAL_UNLESS_BUFFER(isolate, val, prefix, retval) \
|
||||
+ do { \
|
||||
+ if (!Buffer::HasInstance(val)) { \
|
||||
+ node::THROW_ERR_INVALID_ARG_TYPE(isolate, prefix " must be a buffer"); \
|
||||
+ return retval; \
|
||||
+ } \
|
||||
+ } while (0)
|
||||
+
|
||||
#define THROW_AND_RETURN_IF_OOB(r) \
|
||||
do { \
|
||||
Maybe<bool> m = (r); \
|
||||
@@ -60,7 +68,6 @@ using v8::ArrayBufferView;
|
||||
using v8::BackingStore;
|
||||
using v8::Context;
|
||||
using v8::EscapableHandleScope;
|
||||
-using v8::FastApiTypedArray;
|
||||
using v8::FunctionCallbackInfo;
|
||||
using v8::Global;
|
||||
using v8::HandleScope;
|
||||
@@ -584,19 +591,24 @@ void SlowCopy(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
// Assume caller has properly validated args.
|
||||
uint32_t FastCopy(Local<Value> receiver,
|
||||
- const v8::FastApiTypedArray<uint8_t>& source,
|
||||
- const v8::FastApiTypedArray<uint8_t>& target,
|
||||
+ Local<Value> source_obj,
|
||||
+ Local<Value> target_obj,
|
||||
uint32_t target_start,
|
||||
uint32_t source_start,
|
||||
- uint32_t to_copy) {
|
||||
- uint8_t* source_data;
|
||||
- CHECK(source.getStorageIfAligned(&source_data));
|
||||
-
|
||||
+ uint32_t to_copy,
|
||||
+ v8::FastApiCallbackOptions& options) {
|
||||
+ FAST_SPREAD_BUFFER_ARG(source_obj, source);
|
||||
uint8_t* target_data;
|
||||
- CHECK(target.getStorageIfAligned(&target_data));
|
||||
+ FAST_SPREAD_BUFFER_ARG(target_obj, target_buffer);
|
||||
+ if (target_buffer_length <= kMaxSizeInHeap) {
|
||||
+ HandleScope handle_scope(options.isolate);
|
||||
+ SPREAD_BUFFER_ARG(target_obj, target_buffer);
|
||||
+ target_data = reinterpret_cast<uint8_t*>(target_buffer_data);
|
||||
+ } else {
|
||||
+ target_data = target_buffer_data;
|
||||
+ }
|
||||
|
||||
memmove(target_data + target_start, source_data + source_start, to_copy);
|
||||
-
|
||||
return to_copy;
|
||||
}
|
||||
|
||||
@@ -865,19 +877,17 @@ void Compare(const FunctionCallbackInfo<Value> &args) {
|
||||
}
|
||||
|
||||
int32_t FastCompare(v8::Local<v8::Value>,
|
||||
- const FastApiTypedArray<uint8_t>& a,
|
||||
- const FastApiTypedArray<uint8_t>& b) {
|
||||
- uint8_t* data_a;
|
||||
- uint8_t* data_b;
|
||||
- CHECK(a.getStorageIfAligned(&data_a));
|
||||
- CHECK(b.getStorageIfAligned(&data_b));
|
||||
+ v8::Local<v8::Value> a,
|
||||
+ v8::Local<v8::Value> b) {
|
||||
+ FAST_SPREAD_BUFFER_ARG(a, a_buffer);
|
||||
+ FAST_SPREAD_BUFFER_ARG(b, b_buffer);
|
||||
|
||||
- size_t cmp_length = std::min(a.length(), b.length());
|
||||
+ size_t cmp_length = std::min(a_buffer_length, b_buffer_length);
|
||||
|
||||
return normalizeCompareVal(
|
||||
- cmp_length > 0 ? memcmp(data_a, data_b, cmp_length) : 0,
|
||||
- a.length(),
|
||||
- b.length());
|
||||
+ cmp_length > 0 ? memcmp(a_buffer_data, b_buffer_data, cmp_length) : 0,
|
||||
+ a_buffer_length,
|
||||
+ b_buffer_length);
|
||||
}
|
||||
|
||||
static v8::CFunction fast_compare(v8::CFunction::Make(FastCompare));
|
||||
@@ -1149,14 +1159,13 @@ void SlowIndexOfNumber(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
|
||||
int32_t FastIndexOfNumber(v8::Local<v8::Value>,
|
||||
- const FastApiTypedArray<uint8_t>& buffer,
|
||||
+ v8::Local<v8::Value> source_obj,
|
||||
uint32_t needle,
|
||||
int64_t offset_i64,
|
||||
bool is_forward) {
|
||||
- uint8_t* buffer_data;
|
||||
- CHECK(buffer.getStorageIfAligned(&buffer_data));
|
||||
+ FAST_SPREAD_BUFFER_ARG(source_obj, buffer);
|
||||
return IndexOfNumber(
|
||||
- buffer_data, buffer.length(), needle, offset_i64, is_forward);
|
||||
+ buffer_data, buffer_length, needle, offset_i64, is_forward);
|
||||
}
|
||||
|
||||
static v8::CFunction fast_index_of_number(
|
||||
@@ -1496,21 +1505,31 @@ void SlowWriteString(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
template <encoding encoding>
|
||||
uint32_t FastWriteString(Local<Value> receiver,
|
||||
- const v8::FastApiTypedArray<uint8_t>& dst,
|
||||
+ Local<v8::Value> dst,
|
||||
const v8::FastOneByteString& src,
|
||||
uint32_t offset,
|
||||
- uint32_t max_length) {
|
||||
- uint8_t* dst_data;
|
||||
- CHECK(dst.getStorageIfAligned(&dst_data));
|
||||
- CHECK(offset <= dst.length());
|
||||
- CHECK(dst.length() - offset <= std::numeric_limits<uint32_t>::max());
|
||||
+ uint32_t max_length,
|
||||
+ v8::FastApiCallbackOptions& options) {
|
||||
+ THROW_AND_RETURN_VAL_UNLESS_BUFFER(options.isolate, dst, "dst", 0);
|
||||
+ uint8_t* dst_buffer_data;
|
||||
+ FAST_SPREAD_BUFFER_ARG(dst, dst_fast_buffer);
|
||||
+ if (dst_fast_buffer_length <= kMaxSizeInHeap) {
|
||||
+ HandleScope handle_scope(options.isolate);
|
||||
+ SPREAD_BUFFER_ARG(dst, dst_slow_buffer);
|
||||
+ dst_buffer_data = reinterpret_cast<uint8_t*>(dst_slow_buffer_data);
|
||||
+ } else {
|
||||
+ dst_buffer_data = dst_fast_buffer_data;
|
||||
+ };
|
||||
+
|
||||
+ CHECK(dst_fast_buffer_length <= std::numeric_limits<uint32_t>::max());
|
||||
+ uint32_t dst_size = static_cast<uint32_t>(dst_fast_buffer_length);
|
||||
TRACK_V8_FAST_API_CALL("buffer.writeString");
|
||||
|
||||
return WriteOneByteString<encoding>(
|
||||
src.data,
|
||||
src.length,
|
||||
- reinterpret_cast<char*>(dst_data + offset),
|
||||
- std::min<uint32_t>(dst.length() - offset, max_length));
|
||||
+ reinterpret_cast<char*>(dst_buffer_data + offset),
|
||||
+ std::min<uint32_t>(dst_size - offset, max_length));
|
||||
}
|
||||
|
||||
static const v8::CFunction fast_write_string_ascii(
|
||||
diff --git a/src/util.h b/src/util.h
|
||||
index dcd6548d41be786c42ce8328d89e532a8e9d43a2..7c98de621ca4d53cbaaa5bd4488aab20c7b033a7 100644
|
||||
--- a/src/util.h
|
||||
+++ b/src/util.h
|
||||
@@ -62,6 +62,7 @@
|
||||
namespace node {
|
||||
|
||||
constexpr char kPathSeparator = std::filesystem::path::preferred_separator;
|
||||
+static constexpr size_t kMaxSizeInHeap = 64;
|
||||
|
||||
#ifdef _WIN32
|
||||
/* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */
|
||||
@@ -589,6 +590,16 @@ class BufferValue : public MaybeStackBuffer<char> {
|
||||
static_cast<char*>(name->Buffer()->Data()) + name##_offset; \
|
||||
if (name##_length > 0) CHECK_NE(name##_data, nullptr);
|
||||
|
||||
+#define FAST_SPREAD_BUFFER_ARG(val, name) \
|
||||
+ CHECK((val)->IsArrayBufferView()); \
|
||||
+ v8::Local<v8::ArrayBufferView> name = (val).As<v8::ArrayBufferView>(); \
|
||||
+ uint8_t name##_buffer[kMaxSizeInHeap]; \
|
||||
+ v8::MemorySpan<uint8_t> name##_storage(name##_buffer); \
|
||||
+ name##_storage = name->GetContents(name##_storage); \
|
||||
+ const size_t name##_length = name##_storage.size(); \
|
||||
+ uint8_t* name##_data = name##_storage.data(); \
|
||||
+ if (name##_length > 0) CHECK_NE(name##_data, nullptr);
|
||||
+
|
||||
// Use this when a variable or parameter is unused in order to explicitly
|
||||
// silence a compiler warning about that.
|
||||
template <typename T> inline void USE(T&&) {}
|
||||
@@ -1,41 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Fri, 18 Oct 2024 17:01:06 +0200
|
||||
Subject: fix: remove outdated V8 flags from node.cc
|
||||
|
||||
Refs https://chromium-review.googlesource.com/c/v8/v8/+/5507047
|
||||
Refs https://chromium-review.googlesource.com/c/v8/v8/+/6249026
|
||||
Refs https://chromium-review.googlesource.com/c/v8/v8/+/6948286
|
||||
|
||||
The above CLs remove the following flags from V8:
|
||||
* --harmony-import-assertions
|
||||
* --experimental-wasm-memory64
|
||||
* --experimental-wasm-imported-strings
|
||||
|
||||
This patch can be removed when we upgrade to a V8 version that
|
||||
contains the above CLs.
|
||||
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index 07684482f855363e26c3d7299a585a8a5654015e..5a7378890dc310bb3779974c79f387e7cdda15b0 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -816,7 +816,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
|
||||
}
|
||||
// TODO(nicolo-ribaudo): remove this once V8 doesn't enable it by default
|
||||
// anymore.
|
||||
- v8_args.emplace_back("--no-harmony-import-assertions");
|
||||
+ // v8_args.emplace_back("--no-harmony-import-assertions");
|
||||
|
||||
auto env_opts = per_process::cli_options->per_isolate->per_env;
|
||||
if (std::find(v8_args.begin(), v8_args.end(),
|
||||
@@ -827,8 +827,8 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
|
||||
}
|
||||
|
||||
// Support stable Phase 5 WebAssembly proposals
|
||||
- v8_args.emplace_back("--experimental-wasm-imported-strings");
|
||||
- v8_args.emplace_back("--experimental-wasm-memory64");
|
||||
+ // v8_args.emplace_back("--experimental-wasm-imported-strings");
|
||||
+ // v8_args.emplace_back("--experimental-wasm-memory64");
|
||||
v8_args.emplace_back("--experimental-wasm-exnref");
|
||||
|
||||
#ifdef __POSIX__
|
||||
@@ -1,61 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Maddock <smaddock@slack-corp.com>
|
||||
Date: Mon, 6 Oct 2025 16:34:43 -0400
|
||||
Subject: fix: replace deprecated Get/SetPrototype
|
||||
|
||||
https://chromium-review.googlesource.com/c/v8/v8/+/6983465
|
||||
|
||||
This is already applied in newer versions of Node so we can drop
|
||||
this patch once we upgrade to v23.
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index 0a358735c331767e8eb563a80e9aaccfb544c27b..d7d18d5fcbf008ac131db189a141315af4f6410b 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -835,7 +835,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
|
||||
|
||||
Local<Object> private_symbols_object;
|
||||
if (!private_symbols->NewInstance(context).ToLocal(&private_symbols_object) ||
|
||||
- private_symbols_object->SetPrototype(context, Null(isolate))
|
||||
+ private_symbols_object->SetPrototypeV2(context, Null(isolate))
|
||||
.IsNothing()) {
|
||||
return MaybeLocal<Object>();
|
||||
}
|
||||
@@ -861,7 +861,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
|
||||
Local<Object> per_isolate_symbols_object;
|
||||
if (!per_isolate_symbols->NewInstance(context).ToLocal(
|
||||
&per_isolate_symbols_object) ||
|
||||
- per_isolate_symbols_object->SetPrototype(context, Null(isolate))
|
||||
+ per_isolate_symbols_object->SetPrototypeV2(context, Null(isolate))
|
||||
.IsNothing()) {
|
||||
return MaybeLocal<Object>();
|
||||
}
|
||||
diff --git a/src/node_constants.cc b/src/node_constants.cc
|
||||
index 2f23cc63f148a792f1302e1d2d88822730abaa33..42678e5d11e5ff9543bf12ec02fee7d3263d7629 100644
|
||||
--- a/src/node_constants.cc
|
||||
+++ b/src/node_constants.cc
|
||||
@@ -1307,7 +1307,7 @@ void CreatePerContextProperties(Local<Object> target,
|
||||
.FromJust());
|
||||
|
||||
Local<Object> internal_constants = Object::New(isolate);
|
||||
- CHECK(internal_constants->SetPrototype(env->context(),
|
||||
+ CHECK(internal_constants->SetPrototypeV2(env->context(),
|
||||
Null(env->isolate())).FromJust());
|
||||
|
||||
DefineErrnoConstants(err_constants);
|
||||
diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc
|
||||
index 96101167016573e80fff520256ebb78c71d83302..a76a68e50d81bddd80c02fa8263b788c098c887d 100644
|
||||
--- a/src/node_sqlite.cc
|
||||
+++ b/src/node_sqlite.cc
|
||||
@@ -2106,9 +2106,9 @@ void StatementSync::Iterate(const FunctionCallbackInfo<Value>& args) {
|
||||
StatementSyncIterator::Create(env, BaseObjectPtr<StatementSync>(stmt));
|
||||
|
||||
if (iter->object()
|
||||
- ->GetPrototype()
|
||||
+ ->GetPrototypeV2()
|
||||
.As<Object>()
|
||||
- ->SetPrototype(context, js_iterator_prototype)
|
||||
+ ->SetPrototypeV2(context, js_iterator_prototype)
|
||||
.IsNothing()) {
|
||||
return;
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Calvin Watford <cwatford@slack-corp.com>
|
||||
Date: Thu, 3 Apr 2025 10:59:30 -0600
|
||||
Subject: Fix task starvation in inspector context test
|
||||
|
||||
A V8 change makes these contexts get collected in a task that is posted
|
||||
and run asynchronously. The tests were synchronously GC'ing in an
|
||||
infinite loop, preventing the task loop from running the task that would
|
||||
GC these contexts.
|
||||
|
||||
This change should be upstreamed in some way.
|
||||
|
||||
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/4733273
|
||||
|
||||
diff --git a/test/parallel/test-inspector-contexts.js b/test/parallel/test-inspector-contexts.js
|
||||
index e7bdc53f8cd5763572798cbd9ef07c902e3fc335..8b7a1f1aaf648efe10761af205ac561952a06980 100644
|
||||
--- a/test/parallel/test-inspector-contexts.js
|
||||
+++ b/test/parallel/test-inspector-contexts.js
|
||||
@@ -17,6 +17,13 @@ function notificationPromise(method) {
|
||||
return new Promise((resolve) => session.once(method, resolve));
|
||||
}
|
||||
|
||||
+function gcImmediate() {
|
||||
+ return new Promise((resolve) => {
|
||||
+ global.gc();
|
||||
+ setImmediate(resolve);
|
||||
+ });
|
||||
+}
|
||||
+
|
||||
async function testContextCreatedAndDestroyed() {
|
||||
console.log('Testing context created/destroyed notifications');
|
||||
{
|
||||
@@ -68,7 +75,7 @@ async function testContextCreatedAndDestroyed() {
|
||||
// GC is unpredictable...
|
||||
console.log('Checking/waiting for GC.');
|
||||
while (!contextDestroyed)
|
||||
- global.gc();
|
||||
+ await gcImmediate();
|
||||
console.log('Context destroyed.');
|
||||
|
||||
assert.strictEqual(contextDestroyed.params.executionContextId, id,
|
||||
@@ -100,7 +107,7 @@ async function testContextCreatedAndDestroyed() {
|
||||
// GC is unpredictable...
|
||||
console.log('Checking/waiting for GC again.');
|
||||
while (!contextDestroyed)
|
||||
- global.gc();
|
||||
+ await gcImmediate();
|
||||
console.log('Other context destroyed.');
|
||||
}
|
||||
|
||||
@@ -126,7 +133,7 @@ async function testContextCreatedAndDestroyed() {
|
||||
// GC is unpredictable...
|
||||
console.log('Checking/waiting for GC a third time.');
|
||||
while (!contextDestroyed)
|
||||
- global.gc();
|
||||
+ await gcImmediate();
|
||||
console.log('Context destroyed once again.');
|
||||
}
|
||||
|
||||
@@ -150,7 +157,7 @@ async function testContextCreatedAndDestroyed() {
|
||||
// GC is unpredictable...
|
||||
console.log('Checking/waiting for GC a fourth time.');
|
||||
while (!contextDestroyed)
|
||||
- global.gc();
|
||||
+ await gcImmediate();
|
||||
console.log('Context destroyed a fourth time.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Sat, 25 Oct 2025 11:06:10 +0200
|
||||
Subject: lib: check SharedArrayBuffer existence in fast-utf8-stream
|
||||
|
||||
After https://github.com/nodejs/node/pull/58897 calling
|
||||
Object.entries on fs will lazy-load fast-utf8-stream, which uses
|
||||
SharedArrayBuffer without checking for its existence first. It
|
||||
won't exist in the renderer process and will throw
|
||||
'SharedArrayBuffer is not a constructor'. Refactor to check
|
||||
for SharedArrayBuffer first.
|
||||
|
||||
This should be upstreamed to Node.js
|
||||
|
||||
diff --git a/lib/internal/streams/fast-utf8-stream.js b/lib/internal/streams/fast-utf8-stream.js
|
||||
index 3bfcc494d17b5cc4c9f494fab4aff4f0d68d2287..241a6b05e84f8e79b8c9b93abfda5562c2e35e9e 100644
|
||||
--- a/lib/internal/streams/fast-utf8-stream.js
|
||||
+++ b/lib/internal/streams/fast-utf8-stream.js
|
||||
@@ -49,7 +49,8 @@ const {
|
||||
const BUSY_WRITE_TIMEOUT = 100;
|
||||
const kEmptyBuffer = Buffer.allocUnsafe(0);
|
||||
|
||||
-const kNil = new Int32Array(new SharedArrayBuffer(4));
|
||||
+const haveSAB = typeof SharedArrayBuffer !== 'undefined';
|
||||
+const kNil = haveSAB ? new Int32Array(new SharedArrayBuffer(4)) : null;
|
||||
|
||||
function sleep(ms) {
|
||||
// Also filters out NaN, non-number types, including empty strings, but allows bigints
|
||||
@@ -59,10 +60,14 @@ function sleep(ms) {
|
||||
throw new ERR_INVALID_ARG_TYPE('ms', ['number', 'bigint'], ms);
|
||||
}
|
||||
throw new ERR_INVALID_ARG_VALUE.RangeError('ms', ms,
|
||||
- 'must be a number greater than 0 and less than Infinity');
|
||||
+ 'must be a number greater than 0 and less than Infinity');
|
||||
+ }
|
||||
+ if (haveSAB) {
|
||||
+ AtomicsWait(kNil, 0, 0, Number(ms));
|
||||
+ } else {
|
||||
+ const { sleep: _sleep } = internalBinding('util');
|
||||
+ _sleep(ms);
|
||||
}
|
||||
-
|
||||
- AtomicsWait(kNil, 0, 0, Number(ms));
|
||||
}
|
||||
|
||||
// 16 KB. Don't write more than docker buffer size.
|
||||
@@ -1,60 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chengzhong Wu <cwu631@bloomberg.net>
|
||||
Date: Fri, 16 May 2025 17:10:54 +0100
|
||||
Subject: node-api: use WriteOneByteV2 in napi_get_value_string_latin1
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/58325
|
||||
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
|
||||
Reviewed-By: Michael Dawson <midawson@redhat.com>
|
||||
|
||||
diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc
|
||||
index cc2312bd2fd1ed194f927bbf33951ca0548d1a31..e4fd88f406be4d9117aa490ca2aa328c5ff0aab9 100644
|
||||
--- a/src/js_native_api_v8.cc
|
||||
+++ b/src/js_native_api_v8.cc
|
||||
@@ -2441,21 +2441,21 @@ napi_status NAPI_CDECL napi_get_value_string_latin1(
|
||||
|
||||
v8::Local<v8::Value> val = v8impl::V8LocalValueFromJsValue(value);
|
||||
RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected);
|
||||
+ v8::Local<v8::String> str = val.As<v8::String>();
|
||||
|
||||
if (!buf) {
|
||||
CHECK_ARG(env, result);
|
||||
- *result = val.As<v8::String>()->Length();
|
||||
+ *result = str->Length();
|
||||
} else if (bufsize != 0) {
|
||||
- int copied =
|
||||
- val.As<v8::String>()->WriteOneByte(env->isolate,
|
||||
- reinterpret_cast<uint8_t*>(buf),
|
||||
- 0,
|
||||
- bufsize - 1,
|
||||
- v8::String::NO_NULL_TERMINATION);
|
||||
-
|
||||
- buf[copied] = '\0';
|
||||
+ uint32_t length = static_cast<uint32_t>(
|
||||
+ std::min(bufsize - 1, static_cast<size_t>(str->Length())));
|
||||
+ str->WriteOneByteV2(env->isolate,
|
||||
+ 0,
|
||||
+ length,
|
||||
+ reinterpret_cast<uint8_t*>(buf),
|
||||
+ v8::String::WriteFlags::kNullTerminate);
|
||||
if (result != nullptr) {
|
||||
- *result = copied;
|
||||
+ *result = length;
|
||||
}
|
||||
} else if (result != nullptr) {
|
||||
*result = 0;
|
||||
@@ -2479,12 +2479,12 @@ napi_status NAPI_CDECL napi_get_value_string_utf8(
|
||||
|
||||
v8::Local<v8::Value> val = v8impl::V8LocalValueFromJsValue(value);
|
||||
RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected);
|
||||
+ v8::Local<v8::String> str = val.As<v8::String>();
|
||||
|
||||
if (!buf) {
|
||||
CHECK_ARG(env, result);
|
||||
- *result = val.As<v8::String>()->Utf8LengthV2(env->isolate);
|
||||
+ *result = str->Utf8LengthV2(env->isolate);
|
||||
} else if (bufsize != 0) {
|
||||
- auto str = val.As<v8::String>();
|
||||
size_t copied =
|
||||
str->WriteUtf8V2(env->isolate,
|
||||
buf,
|
||||
@@ -1,55 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= <tniessen@tnie.de>
|
||||
Date: Fri, 16 May 2025 17:10:45 +0100
|
||||
Subject: node-api: use WriteV2 in napi_get_value_string_utf16
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Since `String::Write()` is deprecated, use `String::Write2()` instead.
|
||||
That requires us to compute the correct number of characters ahead of
|
||||
time but removes the need for dealing with the return value.
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/58165
|
||||
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
|
||||
Reviewed-By: James M Snell <jasnell@gmail.com>
|
||||
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com>
|
||||
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
|
||||
Reviewed-By: Michael Dawson <midawson@redhat.com>
|
||||
|
||||
diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc
|
||||
index 8f97ca4d9cbb840efd36c77fed12d746a2793670..cc2312bd2fd1ed194f927bbf33951ca0548d1a31 100644
|
||||
--- a/src/js_native_api_v8.cc
|
||||
+++ b/src/js_native_api_v8.cc
|
||||
@@ -2520,21 +2520,23 @@ napi_status NAPI_CDECL napi_get_value_string_utf16(napi_env env,
|
||||
|
||||
v8::Local<v8::Value> val = v8impl::V8LocalValueFromJsValue(value);
|
||||
RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected);
|
||||
+ v8::Local<v8::String> str = val.As<v8::String>();
|
||||
|
||||
if (!buf) {
|
||||
CHECK_ARG(env, result);
|
||||
// V8 assumes UTF-16 length is the same as the number of characters.
|
||||
- *result = val.As<v8::String>()->Length();
|
||||
+ *result = str->Length();
|
||||
} else if (bufsize != 0) {
|
||||
- int copied = val.As<v8::String>()->Write(env->isolate,
|
||||
- reinterpret_cast<uint16_t*>(buf),
|
||||
- 0,
|
||||
- bufsize - 1,
|
||||
- v8::String::NO_NULL_TERMINATION);
|
||||
+ uint32_t length = static_cast<uint32_t>(
|
||||
+ std::min(bufsize - 1, static_cast<size_t>(str->Length())));
|
||||
+ str->WriteV2(env->isolate,
|
||||
+ 0,
|
||||
+ length,
|
||||
+ reinterpret_cast<uint16_t*>(buf),
|
||||
+ v8::String::WriteFlags::kNullTerminate);
|
||||
|
||||
- buf[copied] = '\0';
|
||||
if (result != nullptr) {
|
||||
- *result = copied;
|
||||
+ *result = length;
|
||||
}
|
||||
} else if (result != nullptr) {
|
||||
*result = 0;
|
||||
@@ -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 a7d8fa1139c82054ac37a4e11cfb68605dc21f31..589c239aa544e118b7d9b7fff86d7deefe903896 100644
|
||||
index 8a28cd0e497911550cb0fa889c4f2f780d86c24b..811a2961834b9648f5f6b51c3bda570541413818 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -202,6 +202,13 @@ const {
|
||||
@@ -208,6 +208,13 @@ const {
|
||||
CHAR_FORWARD_SLASH,
|
||||
} = require('internal/constants');
|
||||
|
||||
@@ -23,7 +23,7 @@ index a7d8fa1139c82054ac37a4e11cfb68605dc21f31..589c239aa544e118b7d9b7fff86d7dee
|
||||
const {
|
||||
isProxy,
|
||||
} = require('internal/util/types');
|
||||
@@ -1701,10 +1708,12 @@ Module.prototype._compile = function(content, filename, format) {
|
||||
@@ -1755,10 +1762,12 @@ Module.prototype._compile = function(content, filename, format) {
|
||||
if (this[kIsMainSymbol] && getOptionValue('--inspect-brk')) {
|
||||
const { callAndPauseOnStart } = internalBinding('inspector');
|
||||
result = callAndPauseOnStart(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 1a39b9f15e689e5c7ca1e3001b2ef6d854f8cc1e..9035311718c0a68e903e0ce748480bc78112c6ff 100644
|
||||
index 963fe2ab11927a6802d2b1c0f653b5b1032d4243..0a531f216bd64477b800a169e91d859844161f16 100644
|
||||
--- a/lib/internal/bootstrap/node.js
|
||||
+++ b/lib/internal/bootstrap/node.js
|
||||
@@ -132,6 +132,10 @@ process.domain = null;
|
||||
@@ -129,6 +129,10 @@ process.domain = null;
|
||||
}
|
||||
process._exiting = false;
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ This can be removed when Node.js upgrades to a version of V8 containing CLs
|
||||
from the above issue.
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index cb37fa080fc8e8d524cfa2758c4a8c2c5652324d..8e227ddd1be50c046a8cf2895a31d607eb7d31de 100644
|
||||
index a869bc0a145009b57db3f37208e405d9356cc20f..072deb1fa70313e33397f6ff994e3f3548e86092 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -316,6 +316,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
|
||||
@@ -319,6 +319,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
|
||||
MultiIsolatePlatform* platform,
|
||||
const SnapshotData* snapshot_data,
|
||||
const IsolateSettings& settings) {
|
||||
@@ -32,7 +32,7 @@ index cb37fa080fc8e8d524cfa2758c4a8c2c5652324d..8e227ddd1be50c046a8cf2895a31d607
|
||||
Isolate* isolate = Isolate::Allocate();
|
||||
if (isolate == nullptr) return nullptr;
|
||||
|
||||
@@ -359,9 +363,12 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator,
|
||||
@@ -374,9 +378,12 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator,
|
||||
uv_loop_t* event_loop,
|
||||
MultiIsolatePlatform* platform,
|
||||
const EmbedderSnapshotData* snapshot_data,
|
||||
@@ -46,100 +46,66 @@ index cb37fa080fc8e8d524cfa2758c4a8c2c5652324d..8e227ddd1be50c046a8cf2895a31d607
|
||||
return NewIsolate(¶ms,
|
||||
event_loop,
|
||||
platform,
|
||||
diff --git a/src/env.cc b/src/env.cc
|
||||
index 85641b68b1e6f6dd4149f33ba13f76bccc8bf47d..c6209cc7cf317de1bb9217e39dd760e5a83303e2 100644
|
||||
--- a/src/env.cc
|
||||
+++ b/src/env.cc
|
||||
@@ -578,14 +578,6 @@ IsolateData::IsolateData(Isolate* isolate,
|
||||
// We do not care about overflow since we just want this to be different
|
||||
// from the cppgc id.
|
||||
uint16_t non_cppgc_id = cppgc_id + 1;
|
||||
- if (cpp_heap == nullptr) {
|
||||
- cpp_heap_ = CppHeap::Create(platform, v8::CppHeapCreateParams{{}});
|
||||
- // TODO(joyeecheung): pass it into v8::Isolate::CreateParams and let V8
|
||||
- // own it when we can keep the isolate registered/task runner discoverable
|
||||
- // during isolate disposal.
|
||||
- isolate->AttachCppHeap(cpp_heap_.get());
|
||||
- }
|
||||
-
|
||||
{
|
||||
// GC could still be run after the IsolateData is destroyed, so we store
|
||||
// the ids in a static map to ensure pointers to them are still valid
|
||||
@@ -608,15 +600,6 @@ IsolateData::IsolateData(Isolate* isolate,
|
||||
}
|
||||
diff --git a/src/cppgc_helpers-inl.h b/src/cppgc_helpers-inl.h
|
||||
index 745ecab746f7c7540733d31a94f52809dcddd5be..0e52bf5a6f4837d0f4bfed83987c6903796fda55 100644
|
||||
--- a/src/cppgc_helpers-inl.h
|
||||
+++ b/src/cppgc_helpers-inl.h
|
||||
@@ -15,11 +15,12 @@ void CppgcMixin::Wrap(T* ptr, Realm* realm, v8::Local<v8::Object> obj) {
|
||||
v8::Isolate* isolate = realm->isolate();
|
||||
ptr->traced_reference_ = v8::TracedReference<v8::Object>(isolate, obj);
|
||||
// Note that ptr must be of concrete type T in Wrap.
|
||||
- v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(isolate, obj, ptr);
|
||||
+ auto* wrappable = static_cast<v8::Object::Wrappable*>(ptr);
|
||||
+ v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(isolate, obj, wrappable);
|
||||
// Keep the layout consistent with BaseObjects.
|
||||
obj->SetAlignedPointerInInternalField(
|
||||
- kEmbedderType, realm->isolate_data()->embedder_id_for_cppgc());
|
||||
- obj->SetAlignedPointerInInternalField(kSlot, ptr);
|
||||
+ kEmbedderType, realm->isolate_data()->embedder_id_for_cppgc(), 0);
|
||||
+ obj->SetAlignedPointerInInternalField(kSlot, ptr, 0);
|
||||
realm->TrackCppgcWrapper(ptr);
|
||||
}
|
||||
|
||||
-IsolateData::~IsolateData() {
|
||||
- if (cpp_heap_ != nullptr) {
|
||||
- v8::Locker locker(isolate_);
|
||||
- // The CppHeap must be detached before being terminated.
|
||||
- isolate_->DetachCppHeap();
|
||||
- cpp_heap_->Terminate();
|
||||
- }
|
||||
-}
|
||||
-
|
||||
@@ -40,7 +41,7 @@ T* CppgcMixin::Unwrap(v8::Local<v8::Object> obj) {
|
||||
if (obj->InternalFieldCount() != T::kInternalFieldCount) {
|
||||
return nullptr;
|
||||
}
|
||||
- T* ptr = static_cast<T*>(obj->GetAlignedPointerFromInternalField(T::kSlot));
|
||||
+ T* ptr = static_cast<T*>(obj->GetAlignedPointerFromInternalField(T::kSlot, 0));
|
||||
return ptr;
|
||||
}
|
||||
|
||||
diff --git a/src/cppgc_helpers.h b/src/cppgc_helpers.h
|
||||
index fb2af584a4ae777022c9ef8c20ada1edcbbbefdc..fe6300a5d5d2d6602a84cbd33736c2133041d1b0 100644
|
||||
--- a/src/cppgc_helpers.h
|
||||
+++ b/src/cppgc_helpers.h
|
||||
@@ -155,7 +155,7 @@ class CppgcMixin : public cppgc::GarbageCollectedMixin, public MemoryRetainer {
|
||||
*/
|
||||
#define CPPGC_MIXIN(Klass) \
|
||||
public /* NOLINT(whitespace/indent) */ \
|
||||
- cppgc::GarbageCollected<Klass>, public cppgc::NameProvider, public CppgcMixin
|
||||
+ v8::Object::Wrappable, public CppgcMixin
|
||||
|
||||
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
||||
|
||||
diff --git a/src/env.cc b/src/env.cc
|
||||
index 53f0bf7fc1e5c85fa9a5a323e998f04310f4f75e..a78817467518245c4a190e870e0eb30658eafcdb 100644
|
||||
--- a/src/env.cc
|
||||
+++ b/src/env.cc
|
||||
@@ -611,7 +611,7 @@ IsolateData::~IsolateData() {}
|
||||
// Deprecated API, embedders should use v8::Object::Wrap() directly instead.
|
||||
void SetCppgcReference(Isolate* isolate,
|
||||
Local<Object> object,
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index 2d5fa8dbd75851bca30453548f6cbe0159509f26..c346e3a9c827993036438685d758a734f9ce8c05 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -157,7 +157,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer {
|
||||
ArrayBufferAllocator* node_allocator = nullptr,
|
||||
const EmbedderSnapshotData* embedder_snapshot_data = nullptr,
|
||||
std::shared_ptr<PerIsolateOptions> options = nullptr);
|
||||
- ~IsolateData();
|
||||
|
||||
SET_MEMORY_INFO_NAME(IsolateData)
|
||||
SET_SELF_SIZE(IsolateData)
|
||||
@@ -260,7 +259,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer {
|
||||
const SnapshotData* snapshot_data_;
|
||||
std::optional<SnapshotConfig> snapshot_config_;
|
||||
|
||||
- std::unique_ptr<v8::CppHeap> cpp_heap_;
|
||||
std::shared_ptr<PerIsolateOptions> options_;
|
||||
worker::Worker* worker_context_ = nullptr;
|
||||
PerIsolateWrapperData* wrapper_data_;
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index 5a7378890dc310bb3779974c79f387e7cdda15b0..0725cc97510375bc616534ddf3de4b231bae6bf5 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -1295,6 +1295,14 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
|
||||
result->platform_ = per_process::v8_platform.Platform();
|
||||
}
|
||||
|
||||
+ if (!(flags & ProcessInitializationFlags::kNoInitializeCppgc)) {
|
||||
+ v8::PageAllocator* allocator = nullptr;
|
||||
+ if (result->platform_ != nullptr) {
|
||||
+ allocator = result->platform_->GetPageAllocator();
|
||||
+ }
|
||||
+ cppgc::InitializeProcess(allocator);
|
||||
+ }
|
||||
+
|
||||
if (!(flags & ProcessInitializationFlags::kNoInitializeV8)) {
|
||||
V8::Initialize();
|
||||
|
||||
@@ -1304,14 +1312,6 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
|
||||
absl::SetMutexDeadlockDetectionMode(absl::OnDeadlockCycle::kIgnore);
|
||||
}
|
||||
|
||||
- if (!(flags & ProcessInitializationFlags::kNoInitializeCppgc)) {
|
||||
- v8::PageAllocator* allocator = nullptr;
|
||||
- if (result->platform_ != nullptr) {
|
||||
- allocator = result->platform_->GetPageAllocator();
|
||||
- }
|
||||
- cppgc::InitializeProcess(allocator);
|
||||
- }
|
||||
-
|
||||
#if NODE_USE_V8_WASM_TRAP_HANDLER
|
||||
bool use_wasm_trap_handler =
|
||||
!per_process::cli_options->disable_wasm_trap_handler;
|
||||
- void* wrappable) {
|
||||
+ v8::Object::Wrappable* wrappable) {
|
||||
v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(
|
||||
isolate, object, wrappable);
|
||||
}
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index d3a965661d068db359bb1bb4b14e59c28bb615f9..16a0c71aef949b0ddd27def9dc843298f9a6b75f 100644
|
||||
index f7b3f90b0c2cfbeacc5bc50112dd711df8d3c364..7fae281a6e0f3c1a9f0eb97536883bb26c16d94d 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -590,7 +590,8 @@ NODE_EXTERN v8::Isolate* NewIsolate(
|
||||
@@ -604,7 +604,8 @@ NODE_EXTERN v8::Isolate* NewIsolate(
|
||||
struct uv_loop_s* event_loop,
|
||||
MultiIsolatePlatform* platform,
|
||||
const EmbedderSnapshotData* snapshot_data = nullptr,
|
||||
@@ -149,8 +115,22 @@ index d3a965661d068db359bb1bb4b14e59c28bb615f9..16a0c71aef949b0ddd27def9dc843298
|
||||
NODE_EXTERN v8::Isolate* NewIsolate(
|
||||
std::shared_ptr<ArrayBufferAllocator> allocator,
|
||||
struct uv_loop_s* event_loop,
|
||||
@@ -1617,9 +1618,10 @@ void RegisterSignalHandler(int signal,
|
||||
// work with only Node.js versions with v8::Object::Wrap() should use that
|
||||
// instead.
|
||||
NODE_DEPRECATED("Use v8::Object::Wrap()",
|
||||
- NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate,
|
||||
- v8::Local<v8::Object> object,
|
||||
- void* wrappable));
|
||||
+ NODE_EXTERN void SetCppgcReference(
|
||||
+ v8::Isolate* isolate,
|
||||
+ v8::Local<v8::Object> object,
|
||||
+ v8::Object::Wrappable* wrappable));
|
||||
|
||||
} // namespace node
|
||||
|
||||
diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc
|
||||
index 4119ac1b002681d39711eac810ca2fcc2702ffc7..790347056cde949ffe6cf8498a7eca0c4864c997 100644
|
||||
index dd6ecd1f9d82f6661b2480c0195e33515633429f..334d5cb7df7a763e0929468392dad83421cad606 100644
|
||||
--- a/src/node_main_instance.cc
|
||||
+++ b/src/node_main_instance.cc
|
||||
@@ -44,6 +44,8 @@ NodeMainInstance::NodeMainInstance(const SnapshotData* snapshot_data,
|
||||
@@ -162,22 +142,11 @@ index 4119ac1b002681d39711eac810ca2fcc2702ffc7..790347056cde949ffe6cf8498a7eca0c
|
||||
|
||||
isolate_ =
|
||||
NewIsolate(isolate_params_.get(), event_loop, platform, snapshot_data);
|
||||
@@ -81,9 +83,9 @@ NodeMainInstance::~NodeMainInstance() {
|
||||
// This should only be done on a main instance that owns its isolate.
|
||||
// IsolateData must be freed before UnregisterIsolate() is called.
|
||||
isolate_data_.reset();
|
||||
- platform_->UnregisterIsolate(isolate_);
|
||||
}
|
||||
isolate_->Dispose();
|
||||
+ platform_->UnregisterIsolate(isolate_);
|
||||
}
|
||||
|
||||
ExitCode NodeMainInstance::Run() {
|
||||
diff --git a/src/node_worker.cc b/src/node_worker.cc
|
||||
index 29c4b1de42b3127a98871d200c80197bf974b31f..8555ab556b5b74a1cf9cf30747f1f417bfe4e4d9 100644
|
||||
index 7bae29747d8cd8e83973d105099f9111fc185fe1..62c53368d1173edb7eb42e3337049c46fd7cdda9 100644
|
||||
--- a/src/node_worker.cc
|
||||
+++ b/src/node_worker.cc
|
||||
@@ -177,6 +177,9 @@ class WorkerThreadData {
|
||||
@@ -181,6 +181,9 @@ class WorkerThreadData {
|
||||
SetIsolateCreateParamsForNode(¶ms);
|
||||
w->UpdateResourceConstraints(¶ms.constraints);
|
||||
params.array_buffer_allocator_shared = allocator;
|
||||
@@ -187,153 +156,3 @@ index 29c4b1de42b3127a98871d200c80197bf974b31f..8555ab556b5b74a1cf9cf30747f1f417
|
||||
Isolate* isolate =
|
||||
NewIsolate(¶ms, &loop_, w->platform_, w->snapshot_data());
|
||||
if (isolate == nullptr) {
|
||||
@@ -245,13 +248,8 @@ class WorkerThreadData {
|
||||
*static_cast<bool*>(data) = true;
|
||||
}, &platform_finished);
|
||||
|
||||
- // The order of these calls is important; if the Isolate is first disposed
|
||||
- // and then unregistered, there is a race condition window in which no
|
||||
- // new Isolate at the same address can successfully be registered with
|
||||
- // the platform.
|
||||
- // (Refs: https://github.com/nodejs/node/issues/30846)
|
||||
- w_->platform_->UnregisterIsolate(isolate);
|
||||
isolate->Dispose();
|
||||
+ w_->platform_->UnregisterIsolate(isolate);
|
||||
|
||||
// Wait until the platform has cleaned up all relevant resources.
|
||||
while (!platform_finished) {
|
||||
diff --git a/src/util.cc b/src/util.cc
|
||||
index 0c01d338b9d1ced7f173ac862239315f91326791..5ca32f026f9f001ddadc14965705fe005600eddd 100644
|
||||
--- a/src/util.cc
|
||||
+++ b/src/util.cc
|
||||
@@ -726,8 +726,8 @@ RAIIIsolateWithoutEntering::RAIIIsolateWithoutEntering(const SnapshotData* data)
|
||||
}
|
||||
|
||||
RAIIIsolateWithoutEntering::~RAIIIsolateWithoutEntering() {
|
||||
- per_process::v8_platform.Platform()->UnregisterIsolate(isolate_);
|
||||
isolate_->Dispose();
|
||||
+ per_process::v8_platform.Platform()->UnregisterIsolate(isolate_);
|
||||
}
|
||||
|
||||
RAIIIsolate::RAIIIsolate(const SnapshotData* data)
|
||||
diff --git a/test/cctest/node_test_fixture.h b/test/cctest/node_test_fixture.h
|
||||
index 3414c0be8ad777f0b9836323150071b688831a38..82013ffe7667d53248bd616efb79b294e4ae47dd 100644
|
||||
--- a/test/cctest/node_test_fixture.h
|
||||
+++ b/test/cctest/node_test_fixture.h
|
||||
@@ -123,8 +123,8 @@ class NodeTestFixture : public NodeZeroIsolateTestFixture {
|
||||
void TearDown() override {
|
||||
platform->DrainTasks(isolate_);
|
||||
isolate_->Exit();
|
||||
- platform->UnregisterIsolate(isolate_);
|
||||
isolate_->Dispose();
|
||||
+ platform->UnregisterIsolate(isolate_);
|
||||
isolate_ = nullptr;
|
||||
NodeZeroIsolateTestFixture::TearDown();
|
||||
}
|
||||
diff --git a/test/cctest/test_cppgc.cc b/test/cctest/test_cppgc.cc
|
||||
index edd413ae9b956b2e59e8166785adef6a8ff06d51..d1c1549efcb0320bc0f7d354db2101acc0930005 100644
|
||||
--- a/test/cctest/test_cppgc.cc
|
||||
+++ b/test/cctest/test_cppgc.cc
|
||||
@@ -46,18 +46,15 @@ int CppGCed::kDestructCount = 0;
|
||||
int CppGCed::kTraceCount = 0;
|
||||
|
||||
TEST_F(NodeZeroIsolateTestFixture, ExistingCppHeapTest) {
|
||||
- v8::Isolate* isolate =
|
||||
- node::NewIsolate(allocator.get(), ¤t_loop, platform.get());
|
||||
|
||||
// Create and attach the CppHeap before we set up the IsolateData so that
|
||||
// it recognizes the existing heap.
|
||||
std::unique_ptr<v8::CppHeap> cpp_heap =
|
||||
v8::CppHeap::Create(platform.get(), v8::CppHeapCreateParams{{}});
|
||||
|
||||
- // TODO(joyeecheung): pass it into v8::Isolate::CreateParams and let V8
|
||||
- // own it when we can keep the isolate registered/task runner discoverable
|
||||
- // during isolate disposal.
|
||||
- isolate->AttachCppHeap(cpp_heap.get());
|
||||
+ v8::Isolate* isolate =
|
||||
+ node::NewIsolate(allocator.get(), ¤t_loop, platform.get(),
|
||||
+ nullptr, {}, std::move(cpp_heap));
|
||||
|
||||
// Try creating Context + IsolateData + Environment.
|
||||
{
|
||||
@@ -102,13 +99,11 @@ TEST_F(NodeZeroIsolateTestFixture, ExistingCppHeapTest) {
|
||||
platform->DrainTasks(isolate);
|
||||
|
||||
// Cleanup.
|
||||
- isolate->DetachCppHeap();
|
||||
- cpp_heap->Terminate();
|
||||
platform->DrainTasks(isolate);
|
||||
}
|
||||
|
||||
- platform->UnregisterIsolate(isolate);
|
||||
isolate->Dispose();
|
||||
+ platform->UnregisterIsolate(isolate);
|
||||
|
||||
// Check that all the objects are created and destroyed properly.
|
||||
EXPECT_EQ(CppGCed::kConstructCount, 100);
|
||||
diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc
|
||||
index 008cda77b650dc2d904ae00e7629b5ad05d297ad..103931516cea9beb7f25c53526928e67b3c90d2d 100644
|
||||
--- a/test/cctest/test_environment.cc
|
||||
+++ b/test/cctest/test_environment.cc
|
||||
@@ -625,6 +625,9 @@ TEST_F(NodeZeroIsolateTestFixture, CtrlCWithOnlySafeTerminationTest) {
|
||||
// Allocate and initialize Isolate.
|
||||
v8::Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator = allocator.get();
|
||||
+ create_params.cpp_heap =
|
||||
+ v8::CppHeap::Create(platform.get(), v8::CppHeapCreateParams{{}})
|
||||
+ .release();
|
||||
v8::Isolate* isolate = v8::Isolate::Allocate();
|
||||
CHECK_NOT_NULL(isolate);
|
||||
platform->RegisterIsolate(isolate, ¤t_loop);
|
||||
@@ -675,8 +678,8 @@ TEST_F(NodeZeroIsolateTestFixture, CtrlCWithOnlySafeTerminationTest) {
|
||||
}
|
||||
|
||||
// Cleanup.
|
||||
- platform->UnregisterIsolate(isolate);
|
||||
isolate->Dispose();
|
||||
+ platform->UnregisterIsolate(isolate);
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
diff --git a/test/cctest/test_platform.cc b/test/cctest/test_platform.cc
|
||||
index 53644accf29749bf8fc18b641ae1eaef93cd6f98..7e5b143fb4b633e18a4b2d7440cba7e077c50950 100644
|
||||
--- a/test/cctest/test_platform.cc
|
||||
+++ b/test/cctest/test_platform.cc
|
||||
@@ -102,8 +102,8 @@ TEST_F(NodeZeroIsolateTestFixture, IsolatePlatformDelegateTest) {
|
||||
|
||||
// Graceful shutdown
|
||||
delegate->Shutdown();
|
||||
- platform->UnregisterIsolate(isolate);
|
||||
isolate->Dispose();
|
||||
+ platform->UnregisterIsolate(isolate);
|
||||
}
|
||||
|
||||
TEST_F(PlatformTest, TracingControllerNullptr) {
|
||||
diff --git a/test/fuzzers/fuzz_env.cc b/test/fuzzers/fuzz_env.cc
|
||||
index bace3051f8cecd5050d4707f2431973752a22188..5ca295848a974c70ff1a9094eb288ef7e658d8e5 100644
|
||||
--- a/test/fuzzers/fuzz_env.cc
|
||||
+++ b/test/fuzzers/fuzz_env.cc
|
||||
@@ -65,8 +65,8 @@ public:
|
||||
void Teardown() {
|
||||
platform->DrainTasks(isolate_);
|
||||
isolate_->Exit();
|
||||
- platform->UnregisterIsolate(isolate_);
|
||||
isolate_->Dispose();
|
||||
+ platform->UnregisterIsolate(isolate_);
|
||||
isolate_ = nullptr;
|
||||
}
|
||||
};
|
||||
diff --git a/test/fuzzers/fuzz_strings.cc b/test/fuzzers/fuzz_strings.cc
|
||||
index 8f5e1a473e3148e0bcdcc3c2fd582685665ce461..936876cdae20d29618d3789a5ab46a1b3101a79d 100644
|
||||
--- a/test/fuzzers/fuzz_strings.cc
|
||||
+++ b/test/fuzzers/fuzz_strings.cc
|
||||
@@ -72,8 +72,8 @@ public:
|
||||
void Teardown() {
|
||||
platform->DrainTasks(isolate_);
|
||||
isolate_->Exit();
|
||||
- platform->UnregisterIsolate(isolate_);
|
||||
isolate_->Dispose();
|
||||
+ platform->UnregisterIsolate(isolate_);
|
||||
isolate_ = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Igor Sheludko <ishell@chromium.org>
|
||||
Date: Fri, 19 Apr 2024 12:29:53 +0200
|
||||
Subject: src: do not use soon-to-be-deprecated V8 API
|
||||
|
||||
V8 announced deprecation of the following methods:
|
||||
- v8::Object::SetAccessor(...) in favor of
|
||||
v8::Object::SetNativeDataProperty(...),
|
||||
- v8::ObjectTemplate::SetNativeDataProperty(...) with AccessControl
|
||||
parameter in favor of
|
||||
v8::ObjectTemplate::SetNativeDataProperty(...) without AccessControl
|
||||
parameter.
|
||||
|
||||
See https://crrev.com/c/5006387.
|
||||
|
||||
This slightly changes behavior of the following properties:
|
||||
- process.debugPort (for worker processes),
|
||||
- process.title (for worker processes),
|
||||
- process.ppid.
|
||||
|
||||
The difference is that they will now behave like a regular writable
|
||||
JavaScript data properties - in case setter callback is not provided
|
||||
they will be be reconfigured from a native data property (the one
|
||||
that calls C++ callbacks upon get/set operations) to a real data
|
||||
property (so subsequent reads will no longer trigger C++ getter
|
||||
callbacks).
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/53174
|
||||
Reviewed-By: Michael Dawson <midawson@redhat.com>
|
||||
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
|
||||
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
|
||||
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
|
||||
Reviewed-By: James M Snell <jasnell@gmail.com>
|
||||
|
||||
diff --git a/src/node_process_object.cc b/src/node_process_object.cc
|
||||
index 2e0d180d249c6925c761cb673a4a396905cc971c..5bf854723040859f841608f40ac43ea3d4a44b1e 100644
|
||||
--- a/src/node_process_object.cc
|
||||
+++ b/src/node_process_object.cc
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
namespace node {
|
||||
using v8::Context;
|
||||
-using v8::DEFAULT;
|
||||
using v8::EscapableHandleScope;
|
||||
using v8::Function;
|
||||
using v8::FunctionCallbackInfo;
|
||||
@@ -168,13 +167,12 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
// process.title
|
||||
CHECK(process
|
||||
- ->SetAccessor(
|
||||
+ ->SetNativeDataProperty(
|
||||
context,
|
||||
FIXED_ONE_BYTE_STRING(isolate, "title"),
|
||||
ProcessTitleGetter,
|
||||
env->owns_process_state() ? ProcessTitleSetter : nullptr,
|
||||
Local<Value>(),
|
||||
- DEFAULT,
|
||||
None,
|
||||
SideEffectType::kHasNoSideEffect)
|
||||
.FromJust());
|
||||
@@ -193,9 +191,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) {
|
||||
READONLY_PROPERTY(process, "pid",
|
||||
Integer::New(isolate, uv_os_getpid()));
|
||||
|
||||
- CHECK(process->SetAccessor(context,
|
||||
- FIXED_ONE_BYTE_STRING(isolate, "ppid"),
|
||||
- GetParentProcessId).FromJust());
|
||||
+ CHECK(process
|
||||
+ ->SetNativeDataProperty(context,
|
||||
+ FIXED_ONE_BYTE_STRING(isolate, "ppid"),
|
||||
+ GetParentProcessId,
|
||||
+ nullptr,
|
||||
+ Local<Value>(),
|
||||
+ None,
|
||||
+ SideEffectType::kHasNoSideEffect)
|
||||
+ .FromJust());
|
||||
|
||||
// --security-revert flags
|
||||
#define V(code, _, __) \
|
||||
@@ -220,12 +224,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
// process.debugPort
|
||||
CHECK(process
|
||||
- ->SetAccessor(context,
|
||||
- FIXED_ONE_BYTE_STRING(isolate, "debugPort"),
|
||||
- DebugPortGetter,
|
||||
- env->owns_process_state() ? DebugPortSetter : nullptr,
|
||||
- Local<Value>())
|
||||
- .FromJust());
|
||||
+ ->SetNativeDataProperty(
|
||||
+ context,
|
||||
+ FIXED_ONE_BYTE_STRING(isolate, "debugPort"),
|
||||
+ DebugPortGetter,
|
||||
+ env->owns_process_state() ? DebugPortSetter : nullptr,
|
||||
+ Local<Value>(),
|
||||
+ None,
|
||||
+ SideEffectType::kHasNoSideEffect)
|
||||
+ .FromJust());
|
||||
|
||||
// process.versions
|
||||
Local<Object> versions = Object::New(isolate);
|
||||
diff --git a/test/parallel/test-worker-unsupported-things.js b/test/parallel/test-worker-unsupported-things.js
|
||||
index 18c1617c3cde5ef12f9c97828840c39e0be3dc2c..95d93d24dec9f1944091a97574f01c94d617cc49 100644
|
||||
--- a/test/parallel/test-worker-unsupported-things.js
|
||||
+++ b/test/parallel/test-worker-unsupported-things.js
|
||||
@@ -14,14 +14,16 @@ if (!process.env.HAS_STARTED_WORKER) {
|
||||
} else {
|
||||
{
|
||||
const before = process.title;
|
||||
- process.title += ' in worker';
|
||||
- assert.strictEqual(process.title, before);
|
||||
+ const after = before + ' in worker';
|
||||
+ process.title = after;
|
||||
+ assert.strictEqual(process.title, after);
|
||||
}
|
||||
|
||||
{
|
||||
const before = process.debugPort;
|
||||
- process.debugPort++;
|
||||
- assert.strictEqual(process.debugPort, before);
|
||||
+ const after = before + 1;
|
||||
+ process.debugPort = after;
|
||||
+ assert.strictEqual(process.debugPort, after);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1,166 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Yagiz Nizipli <yagiz@nizipli.com>
|
||||
Date: Mon, 16 Sep 2024 20:19:46 -0400
|
||||
Subject: src: improve utf8 string generation performance
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/54873
|
||||
Reviewed-By: Daniel Lemire <daniel@lemire.me>
|
||||
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
|
||||
Reviewed-By: James M Snell <jasnell@gmail.com>
|
||||
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
|
||||
|
||||
diff --git a/src/string_bytes.cc b/src/string_bytes.cc
|
||||
index f0fbf496dcfdec2c522508c61ae24fb20b1eb081..4324ed52d7cd6af5202512858a62346c3ab6c302 100644
|
||||
--- a/src/string_bytes.cc
|
||||
+++ b/src/string_bytes.cc
|
||||
@@ -386,21 +386,21 @@ Maybe<size_t> StringBytes::StorageSize(Isolate* isolate,
|
||||
Local<Value> val,
|
||||
enum encoding encoding) {
|
||||
HandleScope scope(isolate);
|
||||
- size_t data_size = 0;
|
||||
- bool is_buffer = Buffer::HasInstance(val);
|
||||
|
||||
- if (is_buffer && (encoding == BUFFER || encoding == LATIN1)) {
|
||||
+ if (Buffer::HasInstance(val) && (encoding == BUFFER || encoding == LATIN1)) {
|
||||
return Just(Buffer::Length(val));
|
||||
}
|
||||
|
||||
Local<String> str;
|
||||
if (!val->ToString(isolate->GetCurrentContext()).ToLocal(&str))
|
||||
return Nothing<size_t>();
|
||||
+ String::ValueView view(isolate, str);
|
||||
+ size_t data_size = 0;
|
||||
|
||||
switch (encoding) {
|
||||
case ASCII:
|
||||
case LATIN1:
|
||||
- data_size = str->Length();
|
||||
+ data_size = view.length();
|
||||
break;
|
||||
|
||||
case BUFFER:
|
||||
@@ -408,25 +408,25 @@ Maybe<size_t> StringBytes::StorageSize(Isolate* isolate,
|
||||
// A single UCS2 codepoint never takes up more than 3 utf8 bytes.
|
||||
// It is an exercise for the caller to decide when a string is
|
||||
// long enough to justify calling Size() instead of StorageSize()
|
||||
- data_size = 3 * str->Length();
|
||||
+ data_size = 3 * view.length();
|
||||
break;
|
||||
|
||||
case UCS2:
|
||||
- data_size = str->Length() * sizeof(uint16_t);
|
||||
+ data_size = view.length() * sizeof(uint16_t);
|
||||
break;
|
||||
|
||||
case BASE64URL:
|
||||
- data_size = simdutf::base64_length_from_binary(str->Length(),
|
||||
+ data_size = simdutf::base64_length_from_binary(view.length(),
|
||||
simdutf::base64_url);
|
||||
break;
|
||||
|
||||
case BASE64:
|
||||
- data_size = simdutf::base64_length_from_binary(str->Length());
|
||||
+ data_size = simdutf::base64_length_from_binary(view.length());
|
||||
break;
|
||||
|
||||
case HEX:
|
||||
- CHECK(str->Length() % 2 == 0 && "invalid hex string length");
|
||||
- data_size = str->Length() / 2;
|
||||
+ CHECK(view.length() % 2 == 0 && "invalid hex string length");
|
||||
+ data_size = view.length() / 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -447,32 +447,36 @@ Maybe<size_t> StringBytes::Size(Isolate* isolate,
|
||||
Local<String> str;
|
||||
if (!val->ToString(isolate->GetCurrentContext()).ToLocal(&str))
|
||||
return Nothing<size_t>();
|
||||
+ String::ValueView view(isolate, str);
|
||||
|
||||
switch (encoding) {
|
||||
case ASCII:
|
||||
case LATIN1:
|
||||
- return Just<size_t>(str->Length());
|
||||
+ return Just<size_t>(view.length());
|
||||
|
||||
case BUFFER:
|
||||
case UTF8:
|
||||
- return Just<size_t>(str->Utf8Length(isolate));
|
||||
+ if (view.is_one_byte()) {
|
||||
+ return Just<size_t>(simdutf::utf8_length_from_latin1(
|
||||
+ reinterpret_cast<const char*>(view.data8()), view.length()));
|
||||
+ }
|
||||
+ return Just<size_t>(simdutf::utf8_length_from_utf16(
|
||||
+ reinterpret_cast<const char16_t*>(view.data16()), view.length()));
|
||||
|
||||
case UCS2:
|
||||
- return Just(str->Length() * sizeof(uint16_t));
|
||||
+ return Just(view.length() * sizeof(uint16_t));
|
||||
|
||||
case BASE64URL: {
|
||||
- String::Value value(isolate, str);
|
||||
- return Just(simdutf::base64_length_from_binary(value.length(),
|
||||
+ return Just(simdutf::base64_length_from_binary(view.length(),
|
||||
simdutf::base64_url));
|
||||
}
|
||||
|
||||
case BASE64: {
|
||||
- String::Value value(isolate, str);
|
||||
- return Just(simdutf::base64_length_from_binary(value.length()));
|
||||
+ return Just(simdutf::base64_length_from_binary(view.length()));
|
||||
}
|
||||
|
||||
case HEX:
|
||||
- return Just<size_t>(str->Length() / 2);
|
||||
+ return Just<size_t>(view.length() / 2);
|
||||
}
|
||||
|
||||
UNREACHABLE();
|
||||
diff --git a/src/util.cc b/src/util.cc
|
||||
index 1b38f22b930b77d80aa53f9b12299d3cc469a46d..03c4794314c1c228f95536d2d20a440061cf3a80 100644
|
||||
--- a/src/util.cc
|
||||
+++ b/src/util.cc
|
||||
@@ -48,6 +48,8 @@
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
+#include <simdutf.h>
|
||||
+
|
||||
#include <atomic>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@@ -100,11 +102,31 @@ static void MakeUtf8String(Isolate* isolate,
|
||||
MaybeStackBuffer<T>* target) {
|
||||
Local<String> string;
|
||||
if (!value->ToString(isolate->GetCurrentContext()).ToLocal(&string)) return;
|
||||
+ String::ValueView value_view(isolate, string);
|
||||
+
|
||||
+ auto value_length = value_view.length();
|
||||
+
|
||||
+ if (value_view.is_one_byte()) {
|
||||
+ auto const_char = reinterpret_cast<const char*>(value_view.data8());
|
||||
+ auto expected_length =
|
||||
+ target->capacity() < (static_cast<size_t>(value_length) * 2 + 1)
|
||||
+ ? simdutf::utf8_length_from_latin1(const_char, value_length)
|
||||
+ : value_length * 2;
|
||||
+
|
||||
+ // Add +1 for null termination.
|
||||
+ target->AllocateSufficientStorage(expected_length + 1);
|
||||
+ const auto actual_length = simdutf::convert_latin1_to_utf8(
|
||||
+ const_char, value_length, target->out());
|
||||
+ target->SetLengthAndZeroTerminate(actual_length);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- size_t storage;
|
||||
- if (!StringBytes::StorageSize(isolate, string, UTF8).To(&storage)) return;
|
||||
- storage += 1;
|
||||
+ // Add +1 for null termination.
|
||||
+ size_t storage = (3 * value_length) + 1;
|
||||
target->AllocateSufficientStorage(storage);
|
||||
+
|
||||
+ // TODO(@anonrig): Use simdutf to speed up non-one-byte strings once it's
|
||||
+ // implemented
|
||||
const int flags =
|
||||
String::NO_NULL_TERMINATION | String::REPLACE_INVALID_UTF8;
|
||||
const int length =
|
||||
@@ -1,276 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chengzhong Wu <cwu631@bloomberg.net>
|
||||
Date: Fri, 29 Aug 2025 23:41:00 +0100
|
||||
Subject: src: migrate WriteOneByte to WriteOneByteV2
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/59634
|
||||
Fixes: https://github.com/nodejs/node/issues/59555
|
||||
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
|
||||
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
|
||||
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
|
||||
Reviewed-By: Darshan Sen <raisinten@gmail.com>
|
||||
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
|
||||
|
||||
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
|
||||
index ae73e6743879f32f08b4f6f8c546c587de71d2f3..be93e60f851c6c144fdd19f810e0a44cf3845bce 100644
|
||||
--- a/src/node_buffer.cc
|
||||
+++ b/src/node_buffer.cc
|
||||
@@ -1033,8 +1033,11 @@ void IndexOfString(const FunctionCallbackInfo<Value>& args) {
|
||||
if (needle_data == nullptr) {
|
||||
return args.GetReturnValue().Set(-1);
|
||||
}
|
||||
- needle->WriteOneByte(
|
||||
- isolate, needle_data, 0, needle_length, String::NO_NULL_TERMINATION);
|
||||
+ StringBytes::Write(isolate,
|
||||
+ reinterpret_cast<char*>(needle_data),
|
||||
+ needle_length,
|
||||
+ needle,
|
||||
+ enc);
|
||||
|
||||
result = nbytes::SearchString(reinterpret_cast<const uint8_t*>(haystack),
|
||||
haystack_length,
|
||||
@@ -1288,11 +1291,7 @@ static void Btoa(const FunctionCallbackInfo<Value>& args) {
|
||||
simdutf::binary_to_base64(ext->data(), ext->length(), buffer.out());
|
||||
} else if (input->IsOneByte()) {
|
||||
MaybeStackBuffer<uint8_t> stack_buf(input->Length());
|
||||
- input->WriteOneByte(env->isolate(),
|
||||
- stack_buf.out(),
|
||||
- 0,
|
||||
- input->Length(),
|
||||
- String::NO_NULL_TERMINATION);
|
||||
+ input->WriteOneByteV2(env->isolate(), 0, input->Length(), stack_buf.out());
|
||||
|
||||
size_t expected_length =
|
||||
simdutf::base64_length_from_binary(input->Length());
|
||||
@@ -1348,11 +1347,8 @@ static void Atob(const FunctionCallbackInfo<Value>& args) {
|
||||
ext->data(), ext->length(), buffer.out(), simdutf::base64_default);
|
||||
} else if (input->IsOneByte()) {
|
||||
MaybeStackBuffer<uint8_t> stack_buf(input->Length());
|
||||
- input->WriteOneByte(args.GetIsolate(),
|
||||
- stack_buf.out(),
|
||||
- 0,
|
||||
- input->Length(),
|
||||
- String::NO_NULL_TERMINATION);
|
||||
+ input->WriteOneByteV2(
|
||||
+ args.GetIsolate(), 0, input->Length(), stack_buf.out());
|
||||
const char* data = reinterpret_cast<const char*>(*stack_buf);
|
||||
size_t expected_length =
|
||||
simdutf::maximal_binary_length_from_base64(data, input->Length());
|
||||
diff --git a/src/node_http2.cc b/src/node_http2.cc
|
||||
index 8237c9b7d325dd925ae8798d7795fcd94eeb13d0..27a0db87e1f7f75336ecaa044e7cd66a9a5e87a4 100644
|
||||
--- a/src/node_http2.cc
|
||||
+++ b/src/node_http2.cc
|
||||
@@ -485,13 +485,10 @@ Origins::Origins(
|
||||
|
||||
CHECK_LE(origin_contents + origin_string_len,
|
||||
static_cast<char*>(bs_->Data()) + bs_->ByteLength());
|
||||
- CHECK_EQ(origin_string->WriteOneByte(
|
||||
- env->isolate(),
|
||||
- reinterpret_cast<uint8_t*>(origin_contents),
|
||||
- 0,
|
||||
- origin_string_len,
|
||||
- String::NO_NULL_TERMINATION),
|
||||
- origin_string_len);
|
||||
+ origin_string->WriteOneByteV2(env->isolate(),
|
||||
+ 0,
|
||||
+ origin_string_len,
|
||||
+ reinterpret_cast<uint8_t*>(origin_contents));
|
||||
|
||||
size_t n = 0;
|
||||
char* p;
|
||||
@@ -3183,8 +3180,8 @@ void Http2Session::AltSvc(const FunctionCallbackInfo<Value>& args) {
|
||||
if (origin_str.IsEmpty() || value_str.IsEmpty())
|
||||
return;
|
||||
|
||||
- size_t origin_len = origin_str->Length();
|
||||
- size_t value_len = value_str->Length();
|
||||
+ int origin_len = origin_str->Length();
|
||||
+ int value_len = value_str->Length();
|
||||
|
||||
CHECK_LE(origin_len + value_len, 16382); // Max permitted for ALTSVC
|
||||
// Verify that origin len != 0 if stream id == 0, or
|
||||
@@ -3193,8 +3190,13 @@ void Http2Session::AltSvc(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
MaybeStackBuffer<uint8_t> origin(origin_len);
|
||||
MaybeStackBuffer<uint8_t> value(value_len);
|
||||
- origin_str->WriteOneByte(env->isolate(), *origin);
|
||||
- value_str->WriteOneByte(env->isolate(), *value);
|
||||
+ origin_str->WriteOneByteV2(env->isolate(),
|
||||
+ 0,
|
||||
+ origin_len,
|
||||
+ *origin,
|
||||
+ String::WriteFlags::kNullTerminate);
|
||||
+ value_str->WriteOneByteV2(
|
||||
+ env->isolate(), 0, value_len, *value, String::WriteFlags::kNullTerminate);
|
||||
|
||||
session->AltSvc(id, *origin, origin_len, *value, value_len);
|
||||
}
|
||||
diff --git a/src/node_http_common-inl.h b/src/node_http_common-inl.h
|
||||
index dba1a5e051b3e03c435ba3885b3fe2d04ea8ca9e..46984dba907fffb836d62b9c6e6b325a0ba504dd 100644
|
||||
--- a/src/node_http_common-inl.h
|
||||
+++ b/src/node_http_common-inl.h
|
||||
@@ -2,9 +2,11 @@
|
||||
#define SRC_NODE_HTTP_COMMON_INL_H_
|
||||
|
||||
#include "node_http_common.h"
|
||||
+
|
||||
+#include "env-inl.h"
|
||||
#include "node.h"
|
||||
#include "node_mem-inl.h"
|
||||
-#include "env-inl.h"
|
||||
+#include "string_bytes.h"
|
||||
#include "v8.h"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -37,13 +39,12 @@ NgHeaders<T>::NgHeaders(Environment* env, v8::Local<v8::Array> headers) {
|
||||
nv_t* const nva = reinterpret_cast<nv_t*>(start);
|
||||
|
||||
CHECK_LE(header_contents + header_string_len, *buf_ + buf_.length());
|
||||
- CHECK_EQ(header_string.As<v8::String>()->WriteOneByte(
|
||||
- env->isolate(),
|
||||
- reinterpret_cast<uint8_t*>(header_contents),
|
||||
- 0,
|
||||
- header_string_len,
|
||||
- v8::String::NO_NULL_TERMINATION),
|
||||
- header_string_len);
|
||||
+ CHECK_EQ(StringBytes::Write(env->isolate(),
|
||||
+ header_contents,
|
||||
+ header_string_len,
|
||||
+ header_string.As<v8::String>(),
|
||||
+ LATIN1),
|
||||
+ static_cast<size_t>(header_string_len));
|
||||
|
||||
size_t n = 0;
|
||||
char* p;
|
||||
diff --git a/src/string_bytes.cc b/src/string_bytes.cc
|
||||
index b02e9c5d14c2438d30b16f977c4e8a76bb23479d..71381f8fdc341cf2bac34028eb10df30fd9306b9 100644
|
||||
--- a/src/string_bytes.cc
|
||||
+++ b/src/string_bytes.cc
|
||||
@@ -249,11 +249,13 @@ size_t StringBytes::Write(Isolate* isolate,
|
||||
nbytes = std::min(buflen, static_cast<size_t>(input_view.length()));
|
||||
memcpy(buf, input_view.data8(), nbytes);
|
||||
} else {
|
||||
- uint8_t* const dst = reinterpret_cast<uint8_t*>(buf);
|
||||
- const int flags = String::HINT_MANY_WRITES_EXPECTED |
|
||||
- String::NO_NULL_TERMINATION |
|
||||
- String::REPLACE_INVALID_UTF8;
|
||||
- nbytes = str->WriteOneByte(isolate, dst, 0, buflen, flags);
|
||||
+ nbytes = std::min(buflen, static_cast<size_t>(input_view.length()));
|
||||
+ // Do not use v8::String::WriteOneByteV2 as it asserts the string to be
|
||||
+ // a one byte string. For compatibility, convert the uint16_t to uint8_t
|
||||
+ // even though this may loose accuracy.
|
||||
+ for (size_t i = 0; i < nbytes; i++) {
|
||||
+ buf[i] = static_cast<uint8_t>(input_view.data16()[i]);
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/test/cctest/test_string_bytes.cc b/test/cctest/test_string_bytes.cc
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bc308918680bb153dbbda8b18dcb24d129f14833
|
||||
--- /dev/null
|
||||
+++ b/test/cctest/test_string_bytes.cc
|
||||
@@ -0,0 +1,100 @@
|
||||
+#include "gtest/gtest.h"
|
||||
+#include "node.h"
|
||||
+#include "node_test_fixture.h"
|
||||
+#include "string_bytes.h"
|
||||
+#include "util-inl.h"
|
||||
+
|
||||
+using node::MaybeStackBuffer;
|
||||
+using node::StringBytes;
|
||||
+using v8::HandleScope;
|
||||
+using v8::Local;
|
||||
+using v8::Maybe;
|
||||
+using v8::String;
|
||||
+
|
||||
+class StringBytesTest : public EnvironmentTestFixture {};
|
||||
+
|
||||
+// Data "Hello, ÆÊÎÖÿ"
|
||||
+static const char latin1_data[] = "Hello, \xC6\xCA\xCE\xD6\xFF";
|
||||
+static const char utf8_data[] = "Hello, ÆÊÎÖÿ";
|
||||
+
|
||||
+TEST_F(StringBytesTest, WriteLatin1WithOneByteString) {
|
||||
+ const HandleScope handle_scope(isolate_);
|
||||
+ const Argv argv;
|
||||
+ Env env_{handle_scope, argv};
|
||||
+
|
||||
+ Local<String> one_byte_str =
|
||||
+ String::NewFromOneByte(isolate_,
|
||||
+ reinterpret_cast<const uint8_t*>(latin1_data))
|
||||
+ .ToLocalChecked();
|
||||
+
|
||||
+ Maybe<size_t> size_maybe =
|
||||
+ StringBytes::StorageSize(isolate_, one_byte_str, node::LATIN1);
|
||||
+
|
||||
+ ASSERT_TRUE(size_maybe.IsJust());
|
||||
+ size_t size = size_maybe.FromJust();
|
||||
+ ASSERT_EQ(size, 12u);
|
||||
+
|
||||
+ MaybeStackBuffer<char> buf;
|
||||
+ size_t written = StringBytes::Write(
|
||||
+ isolate_, buf.out(), buf.capacity(), one_byte_str, node::LATIN1);
|
||||
+ ASSERT_EQ(written, 12u);
|
||||
+
|
||||
+ // Null-terminate the buffer and compare the contents.
|
||||
+ buf.SetLength(13);
|
||||
+ buf[12] = '\0';
|
||||
+ ASSERT_STREQ(latin1_data, buf.out());
|
||||
+}
|
||||
+
|
||||
+TEST_F(StringBytesTest, WriteLatin1WithUtf8String) {
|
||||
+ const HandleScope handle_scope(isolate_);
|
||||
+ const Argv argv;
|
||||
+ Env env_{handle_scope, argv};
|
||||
+
|
||||
+ Local<String> utf8_str =
|
||||
+ String::NewFromUtf8(isolate_, utf8_data).ToLocalChecked();
|
||||
+
|
||||
+ Maybe<size_t> size_maybe =
|
||||
+ StringBytes::StorageSize(isolate_, utf8_str, node::LATIN1);
|
||||
+
|
||||
+ ASSERT_TRUE(size_maybe.IsJust());
|
||||
+ size_t size = size_maybe.FromJust();
|
||||
+ ASSERT_EQ(size, 12u);
|
||||
+
|
||||
+ MaybeStackBuffer<char> buf;
|
||||
+ size_t written = StringBytes::Write(
|
||||
+ isolate_, buf.out(), buf.capacity(), utf8_str, node::LATIN1);
|
||||
+ ASSERT_EQ(written, 12u);
|
||||
+
|
||||
+ // Null-terminate the buffer and compare the contents.
|
||||
+ buf.SetLength(13);
|
||||
+ buf[12] = '\0';
|
||||
+ ASSERT_STREQ(latin1_data, buf.out());
|
||||
+}
|
||||
+
|
||||
+// Verify that StringBytes::Write converts two-byte characters to one-byte
|
||||
+// characters, even if there is no valid one-byte representation.
|
||||
+TEST_F(StringBytesTest, WriteLatin1WithInvalidChar) {
|
||||
+ const HandleScope handle_scope(isolate_);
|
||||
+ const Argv argv;
|
||||
+ Env env_{handle_scope, argv};
|
||||
+
|
||||
+ Local<String> utf8_str =
|
||||
+ String::NewFromUtf8(isolate_, "Hello, 世界").ToLocalChecked();
|
||||
+
|
||||
+ Maybe<size_t> size_maybe =
|
||||
+ StringBytes::StorageSize(isolate_, utf8_str, node::LATIN1);
|
||||
+
|
||||
+ ASSERT_TRUE(size_maybe.IsJust());
|
||||
+ size_t size = size_maybe.FromJust();
|
||||
+ ASSERT_EQ(size, 9u);
|
||||
+
|
||||
+ MaybeStackBuffer<char> buf;
|
||||
+ size_t written = StringBytes::Write(
|
||||
+ isolate_, buf.out(), buf.capacity(), utf8_str, node::LATIN1);
|
||||
+ ASSERT_EQ(written, 9u);
|
||||
+
|
||||
+ // Null-terminate the buffer and compare the contents.
|
||||
+ buf.SetLength(10);
|
||||
+ buf[9] = '\0';
|
||||
+ ASSERT_STREQ("Hello, \x16\x4C", buf.out());
|
||||
+}
|
||||
@@ -1,140 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= <tniessen@tnie.de>
|
||||
Date: Thu, 8 May 2025 13:55:26 +0100
|
||||
Subject: src: refactor WriteUCS2 and remove flags argument
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This change refactors `StringBytes::WriteUCS2()` in multiple ways.
|
||||
|
||||
The `flags` argument being passed to `WriteUCS2()` is not useful: the
|
||||
only really relevant flag is `NO_NULL_TERMINATION` since V8 ignores
|
||||
`REPLACE_INVALID_UTF8`, `HINT_MANY_WRITES_EXPECTED`, and
|
||||
`PRESERVE_ONE_BYTE_NULL` for UTF-16 strings. However, `WriteUCS2()`
|
||||
might not null-terminate the result correctly regardless of whether
|
||||
`NO_NULL_TERMINATION` is set because it makes multiple calls to
|
||||
`String::Write()` internally. For these reasons, this patch removes the
|
||||
`flags` argument entirely and always assumes `NO_NULL_TERMINATION`.
|
||||
|
||||
Next, this patch replaces the calls to the deprecated function
|
||||
`String::Write()` with calls to the new function `String::WriteV2()`,
|
||||
which always succeeds and always writes a predictable number of
|
||||
characters, removing the need to deal with a return value here.
|
||||
|
||||
Lastly, this patch simplifies the implementation of `WriteUCS2()` and
|
||||
computes the exact number of characters `nchars` from the beginning,
|
||||
removing the need to later check again if the number of characters is
|
||||
zero.
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/58163
|
||||
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
|
||||
Reviewed-By: James M Snell <jasnell@gmail.com>
|
||||
|
||||
diff --git a/src/string_bytes.cc b/src/string_bytes.cc
|
||||
index 0eb9b1967f1f185a140239924809468394297d58..b02e9c5d14c2438d30b16f977c4e8a76bb23479d 100644
|
||||
--- a/src/string_bytes.cc
|
||||
+++ b/src/string_bytes.cc
|
||||
@@ -198,40 +198,34 @@ MaybeLocal<Value> ExternTwoByteString::NewSimpleFromCopy(Isolate* isolate,
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
-size_t StringBytes::WriteUCS2(
|
||||
- Isolate* isolate, char* buf, size_t buflen, Local<String> str, int flags) {
|
||||
+size_t StringBytes::WriteUCS2(Isolate* isolate,
|
||||
+ char* buf,
|
||||
+ size_t buflen,
|
||||
+ Local<String> str) {
|
||||
uint16_t* const dst = reinterpret_cast<uint16_t*>(buf);
|
||||
|
||||
- size_t max_chars = buflen / sizeof(*dst);
|
||||
- if (max_chars == 0) {
|
||||
+ const size_t max_chars = buflen / sizeof(*dst);
|
||||
+ const size_t nchars = std::min(max_chars, static_cast<size_t>(str->Length()));
|
||||
+ if (nchars == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t* const aligned_dst = nbytes::AlignUp(dst, sizeof(*dst));
|
||||
- size_t nchars;
|
||||
+ CHECK_EQ(reinterpret_cast<uintptr_t>(aligned_dst) % sizeof(*dst), 0);
|
||||
if (aligned_dst == dst) {
|
||||
- nchars = str->Write(isolate, dst, 0, max_chars, flags);
|
||||
- return nchars * sizeof(*dst);
|
||||
- }
|
||||
+ str->WriteV2(isolate, 0, nchars, dst);
|
||||
+ } else {
|
||||
+ // Write all but the last char.
|
||||
+ str->WriteV2(isolate, 0, nchars - 1, aligned_dst);
|
||||
|
||||
- CHECK_EQ(reinterpret_cast<uintptr_t>(aligned_dst) % sizeof(*dst), 0);
|
||||
+ // Shift everything to unaligned-left.
|
||||
+ memmove(dst, aligned_dst, (nchars - 1) * sizeof(*dst));
|
||||
|
||||
- // Write all but the last char
|
||||
- max_chars = std::min(max_chars, static_cast<size_t>(str->Length()));
|
||||
- if (max_chars == 0) {
|
||||
- return 0;
|
||||
+ // One more char to be written.
|
||||
+ uint16_t last;
|
||||
+ str->WriteV2(isolate, nchars - 1, 1, &last);
|
||||
+ memcpy(dst + nchars - 1, &last, sizeof(last));
|
||||
}
|
||||
- nchars = str->Write(isolate, aligned_dst, 0, max_chars - 1, flags);
|
||||
- CHECK_EQ(nchars, max_chars - 1);
|
||||
-
|
||||
- // Shift everything to unaligned-left
|
||||
- memmove(dst, aligned_dst, nchars * sizeof(*dst));
|
||||
-
|
||||
- // One more char to be written
|
||||
- uint16_t last;
|
||||
- CHECK_EQ(str->Write(isolate, &last, nchars, 1, flags), 1);
|
||||
- memcpy(buf + nchars * sizeof(*dst), &last, sizeof(last));
|
||||
- nchars++;
|
||||
|
||||
return nchars * sizeof(*dst);
|
||||
}
|
||||
@@ -248,10 +242,6 @@ size_t StringBytes::Write(Isolate* isolate,
|
||||
Local<String> str = val.As<String>();
|
||||
String::ValueView input_view(isolate, str);
|
||||
|
||||
- int flags = String::HINT_MANY_WRITES_EXPECTED |
|
||||
- String::NO_NULL_TERMINATION |
|
||||
- String::REPLACE_INVALID_UTF8;
|
||||
-
|
||||
switch (encoding) {
|
||||
case ASCII:
|
||||
case LATIN1:
|
||||
@@ -260,6 +250,9 @@ size_t StringBytes::Write(Isolate* isolate,
|
||||
memcpy(buf, input_view.data8(), nbytes);
|
||||
} else {
|
||||
uint8_t* const dst = reinterpret_cast<uint8_t*>(buf);
|
||||
+ const int flags = String::HINT_MANY_WRITES_EXPECTED |
|
||||
+ String::NO_NULL_TERMINATION |
|
||||
+ String::REPLACE_INVALID_UTF8;
|
||||
nbytes = str->WriteOneByte(isolate, dst, 0, buflen, flags);
|
||||
}
|
||||
break;
|
||||
@@ -271,7 +264,7 @@ size_t StringBytes::Write(Isolate* isolate,
|
||||
break;
|
||||
|
||||
case UCS2: {
|
||||
- nbytes = WriteUCS2(isolate, buf, buflen, str, flags);
|
||||
+ nbytes = WriteUCS2(isolate, buf, buflen, str);
|
||||
|
||||
// Node's "ucs2" encoding wants LE character data stored in
|
||||
// the Buffer, so we need to reorder on BE platforms. See
|
||||
diff --git a/src/string_bytes.h b/src/string_bytes.h
|
||||
index 53bc003fbda43663d6b8619672b23803fc88deb6..2a916b1c6a03b53c15e96e050dfa5711caaa07e2 100644
|
||||
--- a/src/string_bytes.h
|
||||
+++ b/src/string_bytes.h
|
||||
@@ -102,8 +102,7 @@ class StringBytes {
|
||||
static size_t WriteUCS2(v8::Isolate* isolate,
|
||||
char* buf,
|
||||
size_t buflen,
|
||||
- v8::Local<v8::String> str,
|
||||
- int flags);
|
||||
+ v8::Local<v8::String> str);
|
||||
};
|
||||
|
||||
} // namespace node
|
||||
@@ -1,308 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Joyee Cheung <joyeec9h3@gmail.com>
|
||||
Date: Wed, 29 May 2024 19:59:19 +0200
|
||||
Subject: src: remove dependency on wrapper-descriptor-based CppHeap
|
||||
|
||||
As V8 has moved away from wrapper-descriptor-based CppHeap, this
|
||||
patch:
|
||||
|
||||
1. Create the CppHeap without using wrapper descirptors.
|
||||
2. Deprecates node::SetCppgcReference() in favor of
|
||||
v8::Object::Wrap() since the wrapper descriptor is no longer
|
||||
relevant. It is still kept as a compatibility layer for addons
|
||||
that need to also work on Node.js versions without
|
||||
v8::Object::Wrap().
|
||||
|
||||
(cherry picked from commit 30329d06235a9f9733b1d4da479b403462d1b326)
|
||||
|
||||
diff --git a/src/env-inl.h b/src/env-inl.h
|
||||
index 67b4cc2037b8e02f6382cd12a7abb157d0dbac65..4906c6c4c0ab5260d6e6387d0ed8e0687f982a38 100644
|
||||
--- a/src/env-inl.h
|
||||
+++ b/src/env-inl.h
|
||||
@@ -62,31 +62,6 @@ inline uv_loop_t* IsolateData::event_loop() const {
|
||||
return event_loop_;
|
||||
}
|
||||
|
||||
-inline void IsolateData::SetCppgcReference(v8::Isolate* isolate,
|
||||
- v8::Local<v8::Object> object,
|
||||
- void* wrappable) {
|
||||
- v8::CppHeap* heap = isolate->GetCppHeap();
|
||||
- CHECK_NOT_NULL(heap);
|
||||
- v8::WrapperDescriptor descriptor = heap->wrapper_descriptor();
|
||||
- uint16_t required_size = std::max(descriptor.wrappable_instance_index,
|
||||
- descriptor.wrappable_type_index);
|
||||
- CHECK_GT(object->InternalFieldCount(), required_size);
|
||||
-
|
||||
- uint16_t* id_ptr = nullptr;
|
||||
- {
|
||||
- Mutex::ScopedLock lock(isolate_data_mutex_);
|
||||
- auto it =
|
||||
- wrapper_data_map_.find(descriptor.embedder_id_for_garbage_collected);
|
||||
- CHECK_NE(it, wrapper_data_map_.end());
|
||||
- id_ptr = &(it->second->cppgc_id);
|
||||
- }
|
||||
-
|
||||
- object->SetAlignedPointerInInternalField(descriptor.wrappable_type_index,
|
||||
- id_ptr);
|
||||
- object->SetAlignedPointerInInternalField(descriptor.wrappable_instance_index,
|
||||
- wrappable);
|
||||
-}
|
||||
-
|
||||
inline uint16_t* IsolateData::embedder_id_for_cppgc() const {
|
||||
return &(wrapper_data_->cppgc_id);
|
||||
}
|
||||
diff --git a/src/env.cc b/src/env.cc
|
||||
index 926645dc647fe7ca01165462f08eac1ade71ac4e..85641b68b1e6f6dd4149f33ba13f76bccc8bf47d 100644
|
||||
--- a/src/env.cc
|
||||
+++ b/src/env.cc
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "util-inl.h"
|
||||
#include "v8-cppgc.h"
|
||||
#include "v8-profiler.h"
|
||||
+#include "v8-sandbox.h" // v8::Object::Wrap(), v8::Object::Unwrap()
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
@@ -72,7 +73,6 @@ using v8::TryCatch;
|
||||
using v8::Uint32;
|
||||
using v8::Undefined;
|
||||
using v8::Value;
|
||||
-using v8::WrapperDescriptor;
|
||||
using worker::Worker;
|
||||
|
||||
int const ContextEmbedderTag::kNodeContextTag = 0x6e6f64;
|
||||
@@ -530,6 +530,14 @@ void IsolateData::CreateProperties() {
|
||||
CreateEnvProxyTemplate(this);
|
||||
}
|
||||
|
||||
+// Previously, the general convention of the wrappable layout for cppgc in
|
||||
+// the ecosystem is:
|
||||
+// [ 0 ] -> embedder id
|
||||
+// [ 1 ] -> wrappable instance
|
||||
+// Now V8 has deprecated this layout-based tracing enablement, embedders
|
||||
+// should simply use v8::Object::Wrap() and v8::Object::Unwrap(). We preserve
|
||||
+// this layout only to distinguish internally how the memory of a Node.js
|
||||
+// wrapper is managed or whether a wrapper is managed by Node.js.
|
||||
constexpr uint16_t kDefaultCppGCEmbedderID = 0x90de;
|
||||
Mutex IsolateData::isolate_data_mutex_;
|
||||
std::unordered_map<uint16_t, std::unique_ptr<PerIsolateWrapperData>>
|
||||
@@ -567,36 +575,16 @@ IsolateData::IsolateData(Isolate* isolate,
|
||||
v8::CppHeap* cpp_heap = isolate->GetCppHeap();
|
||||
|
||||
uint16_t cppgc_id = kDefaultCppGCEmbedderID;
|
||||
- if (cpp_heap != nullptr) {
|
||||
- // The general convention of the wrappable layout for cppgc in the
|
||||
- // ecosystem is:
|
||||
- // [ 0 ] -> embedder id
|
||||
- // [ 1 ] -> wrappable instance
|
||||
- // If the Isolate includes a CppHeap attached by another embedder,
|
||||
- // And if they also use the field 0 for the ID, we DCHECK that
|
||||
- // the layout matches our layout, and record the embedder ID for cppgc
|
||||
- // to avoid accidentally enabling cppgc on non-cppgc-managed wrappers .
|
||||
- v8::WrapperDescriptor descriptor = cpp_heap->wrapper_descriptor();
|
||||
- if (descriptor.wrappable_type_index == BaseObject::kEmbedderType) {
|
||||
- cppgc_id = descriptor.embedder_id_for_garbage_collected;
|
||||
- DCHECK_EQ(descriptor.wrappable_instance_index, BaseObject::kSlot);
|
||||
- }
|
||||
- // If the CppHeap uses the slot we use to put non-cppgc-traced BaseObject
|
||||
- // for embedder ID, V8 could accidentally enable cppgc on them. So
|
||||
- // safe guard against this.
|
||||
- DCHECK_NE(descriptor.wrappable_type_index, BaseObject::kSlot);
|
||||
- } else {
|
||||
- cpp_heap_ = CppHeap::Create(
|
||||
- platform,
|
||||
- CppHeapCreateParams{
|
||||
- {},
|
||||
- WrapperDescriptor(
|
||||
- BaseObject::kEmbedderType, BaseObject::kSlot, cppgc_id)});
|
||||
- isolate->AttachCppHeap(cpp_heap_.get());
|
||||
- }
|
||||
// We do not care about overflow since we just want this to be different
|
||||
// from the cppgc id.
|
||||
uint16_t non_cppgc_id = cppgc_id + 1;
|
||||
+ if (cpp_heap == nullptr) {
|
||||
+ cpp_heap_ = CppHeap::Create(platform, v8::CppHeapCreateParams{{}});
|
||||
+ // TODO(joyeecheung): pass it into v8::Isolate::CreateParams and let V8
|
||||
+ // own it when we can keep the isolate registered/task runner discoverable
|
||||
+ // during isolate disposal.
|
||||
+ isolate->AttachCppHeap(cpp_heap_.get());
|
||||
+ }
|
||||
|
||||
{
|
||||
// GC could still be run after the IsolateData is destroyed, so we store
|
||||
@@ -629,11 +617,12 @@ IsolateData::~IsolateData() {
|
||||
}
|
||||
}
|
||||
|
||||
-// Public API
|
||||
+// Deprecated API, embedders should use v8::Object::Wrap() directly instead.
|
||||
void SetCppgcReference(Isolate* isolate,
|
||||
Local<Object> object,
|
||||
void* wrappable) {
|
||||
- IsolateData::SetCppgcReference(isolate, object, wrappable);
|
||||
+ v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(
|
||||
+ isolate, object, static_cast<v8::Object::Wrappable*>(wrappable));
|
||||
}
|
||||
|
||||
void IsolateData::MemoryInfo(MemoryTracker* tracker) const {
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index 35e16159a94bb97f19d17767e3ad4bb798660f44..2d5fa8dbd75851bca30453548f6cbe0159509f26 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -177,10 +177,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer {
|
||||
uint16_t* embedder_id_for_cppgc() const;
|
||||
uint16_t* embedder_id_for_non_cppgc() const;
|
||||
|
||||
- static inline void SetCppgcReference(v8::Isolate* isolate,
|
||||
- v8::Local<v8::Object> object,
|
||||
- void* wrappable);
|
||||
-
|
||||
inline uv_loop_t* event_loop() const;
|
||||
inline MultiIsolatePlatform* platform() const;
|
||||
inline const SnapshotData* snapshot_data() const;
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 96c599aa6448e2aa8e57e84f811564a5281c139a..d3a965661d068db359bb1bb4b14e59c28bb615f9 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -1576,24 +1576,14 @@ void RegisterSignalHandler(int signal,
|
||||
bool reset_handler = false);
|
||||
#endif // _WIN32
|
||||
|
||||
-// Configure the layout of the JavaScript object with a cppgc::GarbageCollected
|
||||
-// instance so that when the JavaScript object is reachable, the garbage
|
||||
-// collected instance would have its Trace() method invoked per the cppgc
|
||||
-// contract. To make it work, the process must have called
|
||||
-// cppgc::InitializeProcess() before, which is usually the case for addons
|
||||
-// loaded by the stand-alone Node.js executable. Embedders of Node.js can use
|
||||
-// either need to call it themselves or make sure that
|
||||
-// ProcessInitializationFlags::kNoInitializeCppgc is *not* set for cppgc to
|
||||
-// work.
|
||||
-// If the CppHeap is owned by Node.js, which is usually the case for addon,
|
||||
-// the object must be created with at least two internal fields available,
|
||||
-// and the first two internal fields would be configured by Node.js.
|
||||
-// This may be superseded by a V8 API in the future, see
|
||||
-// https://bugs.chromium.org/p/v8/issues/detail?id=13960. Until then this
|
||||
-// serves as a helper for Node.js isolates.
|
||||
-NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate,
|
||||
- v8::Local<v8::Object> object,
|
||||
- void* wrappable);
|
||||
+// This is kept as a compatibility layer for addons to wrap cppgc-managed
|
||||
+// objects on Node.js versions without v8::Object::Wrap(). Addons created to
|
||||
+// work with only Node.js versions with v8::Object::Wrap() should use that
|
||||
+// instead.
|
||||
+NODE_DEPRECATED("Use v8::Object::Wrap()",
|
||||
+ NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate,
|
||||
+ v8::Local<v8::Object> object,
|
||||
+ void* wrappable));
|
||||
|
||||
} // namespace node
|
||||
|
||||
diff --git a/test/addons/cppgc-object/binding.cc b/test/addons/cppgc-object/binding.cc
|
||||
index 1b70ff11dc561abdc5ac794f6280557d5c428239..7fc16a87b843ce0626ee137a07c3ccb7f4cc6493 100644
|
||||
--- a/test/addons/cppgc-object/binding.cc
|
||||
+++ b/test/addons/cppgc-object/binding.cc
|
||||
@@ -1,8 +1,10 @@
|
||||
+#include <assert.h>
|
||||
#include <cppgc/allocation.h>
|
||||
#include <cppgc/garbage-collected.h>
|
||||
#include <cppgc/heap.h>
|
||||
#include <node.h>
|
||||
#include <v8-cppgc.h>
|
||||
+#include <v8-sandbox.h>
|
||||
#include <v8.h>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -15,8 +17,10 @@ class CppGCed : public cppgc::GarbageCollected<CppGCed> {
|
||||
static void New(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
v8::Isolate* isolate = args.GetIsolate();
|
||||
v8::Local<v8::Object> js_object = args.This();
|
||||
- CppGCed* gc_object = cppgc::MakeGarbageCollected<CppGCed>(
|
||||
- isolate->GetCppHeap()->GetAllocationHandle());
|
||||
+ auto* heap = isolate->GetCppHeap();
|
||||
+ assert(heap != nullptr);
|
||||
+ CppGCed* gc_object =
|
||||
+ cppgc::MakeGarbageCollected<CppGCed>(heap->GetAllocationHandle());
|
||||
node::SetCppgcReference(isolate, js_object, gc_object);
|
||||
args.GetReturnValue().Set(js_object);
|
||||
}
|
||||
@@ -24,12 +28,6 @@ class CppGCed : public cppgc::GarbageCollected<CppGCed> {
|
||||
static v8::Local<v8::Function> GetConstructor(
|
||||
v8::Local<v8::Context> context) {
|
||||
auto ft = v8::FunctionTemplate::New(context->GetIsolate(), New);
|
||||
- auto ot = ft->InstanceTemplate();
|
||||
- v8::WrapperDescriptor descriptor =
|
||||
- context->GetIsolate()->GetCppHeap()->wrapper_descriptor();
|
||||
- uint16_t required_size = std::max(descriptor.wrappable_instance_index,
|
||||
- descriptor.wrappable_type_index);
|
||||
- ot->SetInternalFieldCount(required_size + 1);
|
||||
return ft->GetFunction(context).ToLocalChecked();
|
||||
}
|
||||
|
||||
diff --git a/test/cctest/test_cppgc.cc b/test/cctest/test_cppgc.cc
|
||||
index 49665174615870b4f70529b1d548e593846140a1..edd413ae9b956b2e59e8166785adef6a8ff06d51 100644
|
||||
--- a/test/cctest/test_cppgc.cc
|
||||
+++ b/test/cctest/test_cppgc.cc
|
||||
@@ -3,16 +3,12 @@
|
||||
#include <cppgc/heap.h>
|
||||
#include <node.h>
|
||||
#include <v8-cppgc.h>
|
||||
+#include <v8-sandbox.h>
|
||||
#include <v8.h>
|
||||
#include "node_test_fixture.h"
|
||||
|
||||
// This tests that Node.js can work with an existing CppHeap.
|
||||
|
||||
-// Mimic the Blink layout.
|
||||
-static int kWrappableTypeIndex = 0;
|
||||
-static int kWrappableInstanceIndex = 1;
|
||||
-static uint16_t kEmbedderID = 0x1;
|
||||
-
|
||||
// Mimic a class that does not know about Node.js.
|
||||
class CppGCed : public cppgc::GarbageCollected<CppGCed> {
|
||||
public:
|
||||
@@ -23,12 +19,11 @@ class CppGCed : public cppgc::GarbageCollected<CppGCed> {
|
||||
static void New(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
v8::Isolate* isolate = args.GetIsolate();
|
||||
v8::Local<v8::Object> js_object = args.This();
|
||||
- CppGCed* gc_object = cppgc::MakeGarbageCollected<CppGCed>(
|
||||
- isolate->GetCppHeap()->GetAllocationHandle());
|
||||
- js_object->SetAlignedPointerInInternalField(kWrappableTypeIndex,
|
||||
- &kEmbedderID);
|
||||
- js_object->SetAlignedPointerInInternalField(kWrappableInstanceIndex,
|
||||
- gc_object);
|
||||
+ auto* heap = isolate->GetCppHeap();
|
||||
+ CHECK_NOT_NULL(heap);
|
||||
+ CppGCed* gc_object =
|
||||
+ cppgc::MakeGarbageCollected<CppGCed>(heap->GetAllocationHandle());
|
||||
+ node::SetCppgcReference(isolate, js_object, gc_object);
|
||||
kConstructCount++;
|
||||
args.GetReturnValue().Set(js_object);
|
||||
}
|
||||
@@ -36,8 +31,6 @@ class CppGCed : public cppgc::GarbageCollected<CppGCed> {
|
||||
static v8::Local<v8::Function> GetConstructor(
|
||||
v8::Local<v8::Context> context) {
|
||||
auto ft = v8::FunctionTemplate::New(context->GetIsolate(), New);
|
||||
- auto ot = ft->InstanceTemplate();
|
||||
- ot->SetInternalFieldCount(2);
|
||||
return ft->GetFunction(context).ToLocalChecked();
|
||||
}
|
||||
|
||||
@@ -58,12 +51,12 @@ TEST_F(NodeZeroIsolateTestFixture, ExistingCppHeapTest) {
|
||||
|
||||
// Create and attach the CppHeap before we set up the IsolateData so that
|
||||
// it recognizes the existing heap.
|
||||
- std::unique_ptr<v8::CppHeap> cpp_heap = v8::CppHeap::Create(
|
||||
- platform.get(),
|
||||
- v8::CppHeapCreateParams(
|
||||
- {},
|
||||
- v8::WrapperDescriptor(
|
||||
- kWrappableTypeIndex, kWrappableInstanceIndex, kEmbedderID)));
|
||||
+ std::unique_ptr<v8::CppHeap> cpp_heap =
|
||||
+ v8::CppHeap::Create(platform.get(), v8::CppHeapCreateParams{{}});
|
||||
+
|
||||
+ // TODO(joyeecheung): pass it into v8::Isolate::CreateParams and let V8
|
||||
+ // own it when we can keep the isolate registered/task runner discoverable
|
||||
+ // during isolate disposal.
|
||||
isolate->AttachCppHeap(cpp_heap.get());
|
||||
|
||||
// Try creating Context + IsolateData + Environment.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user