Compare commits

...

21 Commits

Author SHA1 Message Date
yangzuohui
71526af2fb fix: fix launch crash when null device is disabled on Windows
add node flag node::ProcessInitializationFlags::kNoStdioInitialization

Co-Authored-By: yangliu <yangliu.leo@bytedance.com>
2025-10-10 12:37:45 -04:00
Niklas Wenzel
550e054168 docs: update Azure Trusted Signing availability (#48494)
* docs: update Azure Trusted Signing availability

Source: https://github.com/Azure/trusted-signing-action/issues/93#issuecomment-3383517386

* docs: remove unused link
2025-10-10 11:43:29 -04:00
Shelley Vohr
b992ead837 fix: dialog.showMessageBox defaultid on Windows (#48216)
* fix: dialog.showMessageBox defaultid on Windows

* Update shell/browser/ui/message_box_win.cc

Co-authored-by: Robo <hop2deep@gmail.com>

---------

Co-authored-by: Robo <hop2deep@gmail.com>
2025-10-10 15:39:23 +02:00
Shelley Vohr
11f76118db fix: unexpected openExternal dialog on macOS Tahoe (#48502)
fix: unexpected openExternal dialog on macOS Tahoe
2025-10-10 12:48:44 +02:00
Robo
37c7487600 fix: crash when inspector evaluates on provisional frames (#48503) 2025-10-10 11:34:09 +02:00
reito
9e46efb8f7 feat: offscreen rendering support rgbaf16 hdr output format. (#48265)
* feat: offscreen rendering support rgbaf16

* docs: update doc

* docs: update doc.
2025-10-09 10:33:34 +02:00
dependabot[bot]
9c38917a14 build(deps): bump actions/github-script from 7.0.1 to 8.0.0 (#48329)
Bumps [actions/github-script](https://github.com/actions/github-script) from 7.0.1 to 8.0.0.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](60a0d83039...ed597411d8)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: 8.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-09 10:33:24 +02:00
zoy
3a53c71324 fix: broken transparent window styles on resizable change (#48378)
* fix: wrong api call

* fix: consistency of the resize state

* fix: edge cases

* chore: add detailed comments

* fix: lint

* chore: only windows

* chore: use transparent
2025-10-09 09:49:20 +02:00
David Sanders
0d478ec69c ci: ignore lost communication with server annotation in audit (#48493) 2025-10-09 09:48:56 +02:00
Erick Zhao
9143f7c6e2 docs: clarify postinstall requirements (#48485)
postinstall
2025-10-09 09:48:47 +02:00
Erick Zhao
df86312e2f docs: add note for node_modules for Yarn and pnpm (#48484)
* Add instructions on using node_modules with Yarn

* update text for pnpm

---------

Co-authored-by: CodingOtto <otto+github@fysiker.fi>
2025-10-09 09:48:22 +02:00
Ulises Gascón
ffbae02a95 docs: add security escalation policy (#48317) 2025-10-08 15:19:07 -07:00
Sam Maddock
a87ee21f5c build: bump version in .nvmrc to 22 (#48413) 2025-10-08 14:21:55 -04:00
electron-roller[bot]
ea8f43f9b9 chore: bump node to v22.20.0 (main) (#48383)
* chore: bump node in DEPS to v22.20.0

* chore: fixup patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-10-08 15:19:08 +02:00
Fedor Indutny
e8e91c331a feat: dynamic ESM import in preload without context isolation (#48375)
Dynamic ESM import in non-context-isolated preload

Extend `HostImportModuleWithPhaseDynamically`'s routing to support
Node.js import resolution in non-context-isolated preloads through
`v8_host_defined_options` length check. The length of host defined
options is distinct between Blink and Node.js and we can use it to
determine which resolver to use.
2025-10-08 10:44:09 +02:00
Charles Kerr
49c1139ab9 chore: remove unused reference to api::BrowserView (#48474)
chore: remove unused reference to api::BrowserView

Unused since #35658 / 15c60143
2025-10-08 10:43:28 +02:00
dependabot[bot]
16bcd645b5 build(deps): bump actions/stale from 9.1.0 to 10.1.0 (#48477)
Bumps [actions/stale](https://github.com/actions/stale) from 9.1.0 to 10.1.0.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](5bef64f19d...5f858e3efb)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-version: 10.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-08 09:56:23 +02:00
John Kleinschmidt
6756974828 build: fixup chromedriver and mksnapshot (#48470)
* build: update build tools to get proper exit codes from e build

xref: https://github.com/electron/build-tools/pull/759

* build: target zips directly

mksnapshot and chromedriver have issues with siso trying to run a separate build and zip step, so just target the zip target

* build: don't unzip chromedriver and mksnapshot in tests

The contents of these files are not used in testing, so we shouldn't unzip them.
2025-10-06 23:22:55 -04:00
Keeley Hammond
d6dfd4ed7a build: handle Metal toolchain being unbundled from Xcode 26 (#48467)
* chore: add metal patch dir

* chore: cherry-pick 2f564f1ca07b from angle (#48465)

* chore: update patch
2025-10-06 10:17:46 -04:00
Charles Kerr
a1ca9a8d55 refactor: DRY in App::SetAppLogPath() (#48452) 2025-10-05 12:32:28 -05:00
Charles Kerr
38e491689a perf: avoid a little extra work in InvokeIpcCallback() (#48456)
perf: two minor perf refactors in InvokeIpcCallback()

1. Allocate the CallbackScope on the stack instead of the heap
2. Skip a redundant call to  node::Environment::GetCurrent()
2025-10-04 21:52:53 -07:00
81 changed files with 868 additions and 346 deletions

View File

@@ -79,7 +79,7 @@ runs:
shell: bash
run: |
cd src
e build --target electron:electron_mksnapshot
e build --target electron:electron_mksnapshot_zip
ELECTRON_DEPOT_TOOLS_DISABLE_LOG=1 e d gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
# Remove unused args from mksnapshot_args
SEDOPTION="-i"
@@ -89,7 +89,6 @@ runs:
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
e build --target electron:electron_mksnapshot_zip
if [ "${{ inputs.target-platform }}" = "win" ]; then
cd out/Default
powershell Compress-Archive -update mksnapshot_args mksnapshot.zip
@@ -123,7 +122,6 @@ runs:
shell: bash
run: |
cd src
e build --target electron:electron_chromedriver
e build --target electron:electron_chromedriver_zip
if [ "${{ inputs.is-asan }}" != "true" ]; then

View File

@@ -15,7 +15,7 @@ runs:
git config --global core.preloadindex true
git config --global core.longpaths true
fi
export BUILD_TOOLS_SHA=c13f4bdb50e65da46a4703f8f882079dd21fd99e
export BUILD_TOOLS_SHA=706147b2376f55078f718576b28129a0457f1795
npm i -g @electron/build-tools
# Update depot_tools to ensure python
e d update_depot_tools

View File

@@ -20,7 +20,7 @@ jobs:
with:
node-version: 22.17.x
- run: npm install @actions/cache@4.0.3 @electron/fiddle-core@2.0.1
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
id: audit-errors
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -73,6 +73,7 @@ jobs:
annotation_level === "failure" &&
!message.startsWith("Process completed with exit code") &&
!message.startsWith("Response status code does not indicate success") &&
!message.startsWith("The hosted runner lost communication with the server") &&
!/Unable to make request/.test(message) &&
!/The requested URL returned error/.test(message),
)

View File

@@ -75,7 +75,7 @@ jobs:
org: electron
- name: Generate Release Project Board Metadata
if: ${{ steps.check-major-version.outputs.MAJOR }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
id: generate-project-metadata
with:
script: |

View File

@@ -37,7 +37,7 @@ jobs:
org: electron
- run: npm install @electron/fiddle-core@1.3.3 mdast-util-from-markdown@2.0.0 unist-util-select@5.1.0 semver@7.6.0
- name: Add labels
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
id: add-labels
env:
ISSUE_BODY: ${{ github.event.issue.body }}

View File

@@ -177,22 +177,18 @@ jobs:
path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
- name: Restore Generated Artifacts
run: ./src/electron/script/actions/restore-artifacts.sh
- name: Unzip Dist, Mksnapshot & Chromedriver (win)
- name: Unzip Dist (win)
if: ${{ inputs.target-platform == 'win' }}
shell: powershell
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force
cd src/out/Default
Expand-Archive -Force dist.zip -DestinationPath ./
Expand-Archive -Force chromedriver.zip -DestinationPath ./
Expand-Archive -Force mksnapshot.zip -DestinationPath ./
- name: Unzip Dist, Mksnapshot & Chromedriver (unix)
- name: Unzip Dist (unix)
if: ${{ inputs.target-platform != 'win' }}
run: |
cd src/out/Default
unzip -:o dist.zip
unzip -:o chromedriver.zip
unzip -:o mksnapshot.zip
#- name: Import & Trust Self-Signed Codesigning Cert on MacOS
# if: ${{ inputs.target-platform == 'macos' && inputs.target-arch == 'x64' }}
# run: |

View File

@@ -16,7 +16,7 @@ jobs:
id: generate-token
with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # tag: v9.1.0
- uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # tag: v10.1.0
with:
repo-token: ${{ steps.generate-token.outputs.token }}
days-before-stale: 90
@@ -39,7 +39,7 @@ jobs:
id: generate-token
with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # tag: v9.1.0
- uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # tag: v10.1.0
with:
repo-token: ${{ steps.generate-token.outputs.token }}
days-before-stale: -1

2
.nvmrc
View File

@@ -1 +1 @@
20
22

2
DEPS
View File

@@ -4,7 +4,7 @@ vars = {
'chromium_version':
'142.0.7417.0',
'node_version':
'v22.19.0',
'v22.20.0',
'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version':

View File

@@ -8,6 +8,12 @@ The Electron team will send a response indicating the next steps in handling you
Report security bugs in third-party modules to the person or team maintaining the module. You can also report a vulnerability through the [npm contact form](https://www.npmjs.com/support) by selecting "I'm reporting a security vulnerability".
## Escalation
If you do not receive an acknowledgement of your report within 6 business days, or if you cannot find a private security contact for the project, you may escalate to the OpenJS Foundation CNA at `security@lists.openjsf.org`.
If the project acknowledges your report but does not provide any further response or engagement within 14 days, escalation is also appropriate.
## The Electron Security Notification Process
For context on Electron's security notification process, please see the [Notifications](https://github.com/electron/governance/blob/main/wg-security/membership-and-notifications.md#notifications) section of the Security WG's [Membership and Notifications](https://github.com/electron/governance/blob/main/wg-security/membership-and-notifications.md) Governance document.

View File

@@ -193,6 +193,11 @@ Disables the Chromium [sandbox](https://www.chromium.org/developers/design-docum
Forces renderer process and Chromium helper processes to run un-sandboxed.
Should only be used for testing.
### --no-stdio-init
Disable stdio initialization during node initialization.
Used to avoid node initialization crash when the nul device is disabled on Windows platform.
### --proxy-bypass-list=`hosts`
Instructs Electron to bypass the proxy server for the given semi-colon-separated

View File

@@ -2,7 +2,10 @@
* `textureInfo` Object - The shared texture info.
* `widgetType` string - The widget type of the texture. Can be `popup` or `frame`.
* `pixelFormat` string - The pixel format of the texture. Can be `rgba` or `bgra`.
* `pixelFormat` string - The pixel format of the texture.
* `rgba` - The texture format is 8-bit unorm RGBA.
* `bgra` - The texture format is 8-bit unorm BGRA.
* `rgbaf16` - The texture format is 16-bit float RGBA.
* `codedSize` [Size](size.md) - The full dimensions of the video frame.
* `colorSpace` [ColorSpace](color-space.md) - The color space of the video frame.
* `visibleRect` [Rectangle](rectangle.md) - A subsection of [0, 0, codedSize.width, codedSize.height]. In OSR case, it is expected to have the full section area.

View File

@@ -87,6 +87,11 @@
paint event. Defaults to `false`. See the
[offscreen rendering tutorial](../../tutorial/offscreen-rendering.md) for
more details.
* `sharedTexturePixelFormat` string (optional) _Experimental_ - The requested output format of the shared texture. Defaults to `argb`.
The name is originated from Chromium [`media::VideoPixelFormat`](https://source.chromium.org/chromium/chromium/src/+/main:media/base/video_types.h) enum suffix and only subset of them are supported.
The actual output pixel format and color space of the texture should refer to [`OffscreenSharedTexture`](../structures/offscreen-shared-texture.md) object in the `paint` event.
* `argb` - The requested output texture format is 8-bit unorm RGBA, with SRGB SDR color space.
* `rgbaf16` - The requested output texture format is 16-bit float RGBA, with scRGB HDR color space.
* `contextIsolation` boolean (optional) - Whether to run Electron APIs and
the specified `preload` script in a separate JavaScript context. Defaults
to `true`. The context that the `preload` script runs in will only have

View File

@@ -12,19 +12,28 @@ network problems. The best resolution is to try switching networks, or
wait a bit and try installing again.
You can also attempt to download Electron directly from
[electron/electron/releases](https://github.com/electron/electron/releases)
[GitHub Releases](https://github.com/electron/electron/releases)
if installing via `npm` is failing.
## When will Electron upgrade to latest Chrome?
If you need to install Electron through a custom mirror or proxy, see
the [Advanced Installation](./tutorial/installation.md) documentation for more details.
The Chrome version of Electron is usually bumped within one or two weeks after
a new stable Chrome version gets released. This estimate is not guaranteed and
depends on the amount of work involved with upgrading.
## How are Electron binaries downloaded?
Only the stable channel of Chrome is used. If an important fix is in beta or dev
channel, we will back-port it.
When you run `npm install electron`, the Electron binary for the corresponding version is downloaded
into your project's `node_modules` folder via npm's `postinstall` lifecycle script.
For more information, please see the [security introduction](tutorial/security.md).
This logic is handled by the [`@electron/get`](https://github.com/electron/get) utility package
under the hood.
## When will Electron upgrade to latest Chromium?
Every new major version of Electron releases with a Chromium major version upgrade. By releasing every
8 weeks, Electron is able to pull in every other major Chromium release on the very same day that it
releases upstream. Security fixes will be backported to stable release channels ahead of time.
See the [Electron Releases](./tutorial/electron-timelines.md) documentation for more details or
[releases.electronjs.org](https://releases.electronjs.org) to see our Release Status dashboard.
## When will Electron upgrade to latest Node.js?

View File

@@ -233,10 +233,10 @@ can find [its documentation here](https://www.electron.build/code-signing).
[Azure Trusted Signing][] is Microsoft's modern cloud-based alternative to EV certificates.
It is the cheapest option for code signing on Windows, and it gets rid of SmartScreen warnings.
As of May 2025, Azure Trusted Signing is [available][trusted-signing-availability] to US and
Canada-based organizations with 3+ years of verifiable business history. Microsoft is looking
to make the program more widely available. If you're reading this at a later point, it could
make sense to check if the eligibility criteria have changed.
As of October 2025, Azure Trusted Signing is available to US and Canada-based organizations
with 3+ years of verifiable business history and to individual developers in the US and Canada.
Microsoft is looking to make the program more widely available. If you're reading this at a
later point, it could make sense to check if the eligibility criteria have changed.
#### Using Electron Forge
@@ -267,6 +267,5 @@ See the [Windows Store Guide][].
[maker-squirrel]: https://www.electronforge.io/config/makers/squirrel.windows
[maker-msi]: https://www.electronforge.io/config/makers/wix-msi
[azure trusted signing]: https://azure.microsoft.com/en-us/products/trusted-signing
[trusted-signing-availability]: https://techcommunity.microsoft.com/blog/microsoft-security-blog/trusted-signing-public-preview-update/4399713
[forge-trusted-signing]: https://www.electronforge.io/guides/code-signing/code-signing-windows#using-azure-trusted-signing
[builder-trusted-signing]: https://www.electron.build/code-signing-win#using-azure-trusted-signing-beta

View File

@@ -32,7 +32,7 @@ This table gives a general overview of where ESM is supported and which ESM load
| Main | Node.js | N/A | <ul><li> [You must use `await` generously before the app's `ready` event](#you-must-use-await-generously-before-the-apps-ready-event) </li></ul> |
| Renderer (Sandboxed) | Chromium | Unsupported | <ul><li> [Sandboxed preload scripts can't use ESM imports](#sandboxed-preload-scripts-cant-use-esm-imports) </li></ul> |
| Renderer (Unsandboxed & Context Isolated) | Chromium | Node.js | <ul><li> [Unsandboxed ESM preload scripts will run after page load on pages with no content](#unsandboxed-esm-preload-scripts-will-run-after-page-load-on-pages-with-no-content) </li> <li>[ESM Preload Scripts must have the `.mjs` extension](#esm-preload-scripts-must-have-the-mjs-extension)</li></ul> |
| Renderer (Unsandboxed & Non Context Isolated) | Chromium | Node.js | <ul><li>[Unsandboxed ESM preload scripts will run after page load on pages with no content](#unsandboxed-esm-preload-scripts-will-run-after-page-load-on-pages-with-no-content)</li><li>[ESM Preload Scripts must have the `.mjs` extension](#esm-preload-scripts-must-have-the-mjs-extension)</li><li>[ESM preload scripts must be context isolated to use dynamic Node.js ESM imports](#esm-preload-scripts-must-be-context-isolated-to-use-dynamic-nodejs-esm-imports)</li></ul> |
| Renderer (Unsandboxed & Non Context Isolated) | Chromium | Node.js | <ul><li>[Unsandboxed ESM preload scripts will run after page load on pages with no content](#unsandboxed-esm-preload-scripts-will-run-after-page-load-on-pages-with-no-content)</li><li>[ESM Preload Scripts must have the `.mjs` extension](#esm-preload-scripts-must-have-the-mjs-extension)</li></ul> |
## Main process

View File

@@ -26,12 +26,12 @@ any dependencies in your app will not be installed.
## Customization
If you want to change the architecture that is downloaded (e.g., `ia32` on an
`x64` machine), you can use the `--arch` flag with npm install or set the
If you want to change the architecture that is downloaded (e.g., `x64` on an
`arm64` machine), you can use the `--arch` flag with npm install or set the
`npm_config_arch` environment variable:
```shell
npm install --arch=ia32 electron
npm install --arch=x64 electron
```
In addition to changing the architecture, you can also specify the platform
@@ -60,7 +60,7 @@ where `$VERSION` is the exact version of Electron).
If you are unable to access GitHub or you need to provide a custom build, you
can do so by either providing a mirror or an existing cache directory.
#### Mirror
### Mirror
You can use environment variables to override the base URL, the path at which to
look for Electron binaries, and the binary filename. The URL used by `@electron/get`
@@ -95,7 +95,7 @@ Electron release you may have to set `electron_use_remote_checksums=1` directly,
or configure it in a `.npmrc` file, to force Electron to use the remote `SHASUMS256.txt`
file to verify the checksum instead of the embedded checksums.
#### Cache
### Cache
Alternatively, you can override the local cache. `@electron/get` will cache
downloaded binaries in a local directory to not stress your network. You can use
@@ -120,7 +120,7 @@ The cache contains the version's official zip file as well as a checksum, and is
│ └── electron-v15.3.1-darwin-x64.zip
```
## Skip binary download
## Postinstall script
Under the hood, Electron's JavaScript API binds to a binary that contains its
implementations. Because this binary is crucial to the function of any Electron app,

View File

@@ -55,14 +55,27 @@ There are a few rules to follow for the purposes of this tutorial:
- _author_, _license_, and _description_ can be any value, but will be necessary for
[packaging][packaging] later on.
:::caution Install dependencies with a regular `node_modules` folder
Electron's packaging toolchain requires the `node_modules` folder to be physically on disk in the
way that npm installs Node dependencies. By default, [Yarn Berry](https://yarnpkg.com/) and
[pnpm](http://pnpm.io/) both use alternative installation strategies.
Therefore, you must set [`nodeLinker: node-modules`](https://yarnpkg.com/configuration/yarnrc#nodeLinker)
in Yarn or [`nodeLinker: hoisted`](https://pnpm.io/settings#nodelinker) in pnpm if you are using
those package managers.
:::
Then, install Electron into your app's **devDependencies**, which is the list of external
development-only package dependencies not required in production.
:::info Why is Electron a devDependency?
:::info Why is Electron a dev dependency?
This may seem counter-intuitive since your production code is running Electron APIs.
However, packaged apps will come bundled with the Electron binary, eliminating the need to specify
it as a production dependency.
This may seem counter-intuitive since your production code is running Electron APIs. Under the hood,
Electron's JavaScript API binds to a binary that contains its implementations. The packaging step for
Electron handles the bundling of this binary, eliminating the need to specify it as a production
dependency.
:::
@@ -70,6 +83,17 @@ it as a production dependency.
npm install electron --save-dev
```
:::warning
In order to correctly install Electron, you need to ensure that its `postinstall` lifecycle
script is able to run. This means avoiding the `--ignore-scripts` flag on npm and allowlisting
`electron` to run build scripts on other package managers.
This is likely to change in a future version of Electron. See
[electron/rfcs#22](https://github.com/electron/rfcs/pull/22) for more details.
:::
Your package.json file should look something like this after initializing your package
and installing Electron. You should also now have a `node_modules` folder containing
the Electron executable, as well as a `package-lock.json` lockfile that specifies

1
patches/angle/.patches Normal file
View File

@@ -0,0 +1 @@
cherry-pick-2f564f1ca07b.patch

View File

@@ -0,0 +1,125 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Mentovai <mark@chromium.org>
Date: Tue, 16 Sep 2025 16:46:36 -0400
Subject: mac: handle Metal toolchain being unbundled from Xcode 26
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The Metal toolchain was formerly part of Xcode, but in Xcode 26, it has
been unbundled and is now a separate install. Attempting to use the
Metal toolchain without installing it results in a build error, such as:
error: error: cannot execute tool 'metal' due to missing Metal
Toolchain; use: xcodebuild -downloadComponent MetalToolchain
By running the suggested command, the Metal toolchain can be installed,
but the existing angle build does not know how to find it correctly.
For system Xcode installations, tools from the Metal toolchain (`metal`
and `metallib`) can be run via `xcrun`. This construct should work
equally well for older Xcode versions, for situations where its still
in use.
For the hermetic toolchain, well continue splicing the Metal toolchain
into the location it had previously been avialable (see
https://chromium-review.googlesource.com/c/6950738), although this is
subject to change in the future.
Bug: chromium:423933062, chromium:445400016
Change-Id: I139eca51938f7cecfec9b90fd488947160ef4ec9
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6955000
Auto-Submit: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/metal/BUILD.gn b/src/libANGLE/renderer/metal/BUILD.gn
index 96e9ee8420810f6a3ca9a0c290d4a654200eb7b9..50ac42a5b9a0f7c8b3b161af40c598cb34ff132a 100644
--- a/src/libANGLE/renderer/metal/BUILD.gn
+++ b/src/libANGLE/renderer/metal/BUILD.gn
@@ -24,20 +24,56 @@ config("angle_metal_backend_config") {
}
if (metal_internal_shader_compilation_supported) {
+ template("run_metal_tool") {
+ action(target_name) {
+ forward_variables_from(invoker,
+ [
+ "deps",
+ "sources",
+ "outputs",
+ "metal_tool",
+ ])
+ script = "shaders/metal_wrapper.py"
+ if (use_system_xcode) {
+ # System Xcode: run metal and metallib via xcrun. Since Xcode 26.0, the
+ # Metal toolchain has been unbundled from Xcode, and must be installed
+ # separately by running `xcodebuild -downloadComponent MetalToolchain`.
+ # There is a vestigial metal executable in mac_bin_path, but its
+ # incapable of running successfuly without the
+ # rest of the Metal toolchain surrounding it. `xcrun` is able to find
+ # and run the correct Metal toolchain when properly installed.
+ #
+ # If youre using system Xcode and your build fails with this message:
+ # error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain
+ # then do what the error message suggests, and then retry your build.
+ args = [
+ "xcrun",
+ metal_tool,
+ ]
+ } else {
+ # Hermetic Xcode: at least for now, the Metal toolchain is
+ # “spliced” into the location in the hermetic toolchain where it lived
+ # before Xcode 26.0, so it can be run directly from there.
+ args = [ mac_bin_path + metal_tool ]
+ }
+
+ args += invoker.args
+ }
+ }
+
_metal_internal_shaders_air_file =
"$root_gen_dir/angle/mtl_internal_shaders_autogen.air"
- action("angle_metal_internal_shaders_to_air") {
- script = "shaders/metal_wrapper.py"
-
- outputs = [ _metal_internal_shaders_air_file ]
-
+ run_metal_tool("angle_metal_internal_shaders_to_air") {
_metal_internal_shaders_metal_source =
"shaders/mtl_internal_shaders_autogen.metal"
sources = [ _metal_internal_shaders_metal_source ]
+ outputs = [ _metal_internal_shaders_air_file ]
+
+ metal_tool = "metal"
+
args = [
- mac_bin_path + "metal",
"-c",
rebase_path(_metal_internal_shaders_metal_source, root_build_dir),
"-o",
@@ -60,17 +96,16 @@ if (metal_internal_shader_compilation_supported) {
_metal_internal_shaders_metallib_file =
"$root_gen_dir/angle/mtl_internal_shaders_autogen.metallib"
- action("angle_metal_internal_shaders_to_mtllib") {
- script = "shaders/metal_wrapper.py"
-
- outputs = [ _metal_internal_shaders_metallib_file ]
+ run_metal_tool("angle_metal_internal_shaders_to_mtllib") {
+ deps = [ ":angle_metal_internal_shaders_to_air" ]
sources = [ _metal_internal_shaders_air_file ]
- deps = [ ":angle_metal_internal_shaders_to_air" ]
+ outputs = [ _metal_internal_shaders_metallib_file ]
+
+ metal_tool = "metallib"
args = [
- mac_bin_path + "metallib",
rebase_path(_metal_internal_shaders_air_file, root_build_dir),
"-o",
rebase_path(_metal_internal_shaders_metallib_file, root_build_dir),

View File

@@ -142,3 +142,5 @@ chore_expose_isolate_parameter_in_script_lifecycle_observers.patch
revert_partial_remove_unused_prehandlemouseevent.patch
allow_electron_to_depend_on_components_os_crypt_sync.patch
disable_nsautofillheuristiccontroller_on_macos_26.patch
expose_referrerscriptinfo_hostdefinedoptionsindex.patch
inspectorpageagent_provisional_frame_speculative_fix.patch

View File

@@ -0,0 +1,53 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fedor Indutny <indutny@signal.org>
Date: Wed, 24 Sep 2025 10:08:48 -0700
Subject: Expose ReferrerScriptInfo::HostDefinedOptionsIndex
In `shell/common/node_bindings.cc`'s
`HostImportModuleWithPhaseDynamically` we route dynamic imports to
either Node.js's or Blink's resolver based on presence of Node.js
environment, process type, etc. Exporting `HostDefinedOptionsIndex`
allows us to route based on the size of `v8_host_defined_options` data
which enables us to support dynamic imports in non-context-isolated
preload scripts.
diff --git a/third_party/blink/renderer/bindings/core/v8/referrer_script_info.cc b/third_party/blink/renderer/bindings/core/v8/referrer_script_info.cc
index 1b797783987255622735047bd78ca0e8bb635d5e..b209c736bb80c186ed51999af1dac0a1d50fc232 100644
--- a/third_party/blink/renderer/bindings/core/v8/referrer_script_info.cc
+++ b/third_party/blink/renderer/bindings/core/v8/referrer_script_info.cc
@@ -12,15 +12,6 @@ namespace blink {
namespace {
-enum HostDefinedOptionsIndex : size_t {
- kBaseURL,
- kCredentialsMode,
- kNonce,
- kParserState,
- kReferrerPolicy,
- kLength
-};
-
// Omit storing base URL if it is same as ScriptOrigin::ResourceName().
// Note: This improves chance of getting into a fast path in
// ReferrerScriptInfo::ToV8HostDefinedOptions.
diff --git a/third_party/blink/renderer/bindings/core/v8/referrer_script_info.h b/third_party/blink/renderer/bindings/core/v8/referrer_script_info.h
index 0119624a028bec3e53e4e402938a98fe6def1483..743865839448748fe00e3e7d5027587cb65393c9 100644
--- a/third_party/blink/renderer/bindings/core/v8/referrer_script_info.h
+++ b/third_party/blink/renderer/bindings/core/v8/referrer_script_info.h
@@ -23,6 +23,15 @@ class CORE_EXPORT ReferrerScriptInfo {
STACK_ALLOCATED();
public:
+ enum HostDefinedOptionsIndex : size_t {
+ kBaseURL,
+ kCredentialsMode,
+ kNonce,
+ kParserState,
+ kReferrerPolicy,
+ kLength
+ };
+
ReferrerScriptInfo() {}
ReferrerScriptInfo(const KURL& base_url,
network::mojom::CredentialsMode credentials_mode,

View File

@@ -0,0 +1,116 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joey Arhar <jarhar@chromium.org>
Date: Wed, 1 Oct 2025 02:03:37 -0700
Subject: InspectorPageAgent provisional frame speculative fix
According to crash reports, addScriptToEvaluateOnNewDocument is running
on provisional frames.
Fixed: 390710982
Change-Id: I5cecf63c9517d0b28fff40361c607b0aa54e68cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6216479
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1523418}
diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc
index 386df6dc728e5a1b1aac9865c1687db03f48d9ee..77bcd0f9f8155d1c9ddc167f594791abf48fcfb9 100644
--- a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc
+++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc
@@ -603,7 +603,11 @@ protocol::Response InspectorPageAgent::addScriptToEvaluateOnNewDocument(
// Runtime.enable that forces main context creation. In this case, we would
// not normally evaluate the script, but we should.
for (LocalFrame* frame : *inspected_frames_) {
- EvaluateScriptOnNewDocument(*frame, *identifier);
+ // Don't evaluate scripts on provisional frames:
+ // https://crbug.com/390710982
+ if (!frame->IsProvisional()) {
+ EvaluateScriptOnNewDocument(*frame, *identifier);
+ }
}
}
diff --git a/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials b/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials
index 8df5aa4252464bd4bf06d04b1b4f100453954082..a58b683bd7f2bea8b059f096b48e61d9cd9302d7 100644
--- a/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials
+++ b/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials
@@ -63,6 +63,7 @@ http/tests/inspector-protocol/target/target-filter.js [ Skip ]
virtual/fenced-frame-mparch/http/tests/inspector-protocol/fenced-frame/fenced-frame-in-oopif-auto-attach.js [ Skip ]
http/tests/inspector-protocol/target/target-info-changed-auto-attach.js [ Skip ]
http/tests/inspector-protocol/page/frame-detached-oopif.js [ Skip ]
+http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload.js [ Skip ]
# Rely on OOPIF for an iframe to be a separate devtools target
http/tests/inspector-protocol/timeline/auction-worklet-frame.js [ Skip ]
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload-expected.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0131df6c227e1803741e654d42b15f589275061a
--- /dev/null
+++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload-expected.txt
@@ -0,0 +1,28 @@
+Tests that Page.addScriptToEvaluateOnNewDocument on auto-attach with runImmediately=true.
+Regression test for crbug.com/390710982.
+console called: {
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ type : string
+ value : evaluated
+ }
+ ]
+ executionContextId : <number>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 8
+ functionName :
+ lineNumber : 0
+ scriptId : <string>
+ url :
+ }
+ ]
+ }
+ timestamp : <number>
+ type : log
+ }
+ sessionId : <string>
+}
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload.js b/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload.js
new file mode 100644
index 0000000000000000000000000000000000000000..52ebe845c323c6d692147052f3458777dcd7f966
--- /dev/null
+++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload.js
@@ -0,0 +1,31 @@
+(async function(/** @type {import('test_runner').TestRunner} */ testRunner) {
+ const { session, dp } = await testRunner.startBlank(
+ `Tests that Page.addScriptToEvaluateOnNewDocument on auto-attach with runImmediately=true.
+Regression test for crbug.com/390710982.`);
+
+ await dp.Page.enable();
+ await dp.Target.enable();
+ await dp.Target.setAutoAttach({ flatten: true, autoAttach: true, waitForDebuggerOnStart: true });
+
+ dp.Target.onAttachedToTarget(async event => {
+ const dp2 = session.createChild(event.params.sessionId).protocol;
+ dp2.Page.enable();
+ dp2.Runtime.enable();
+ dp2.Runtime.onConsoleAPICalled(event => {
+ testRunner.log(event, 'console called: ');
+ });
+ dp2.Page.addScriptToEvaluateOnNewDocument({
+ source: 'console.log("evaluated")',
+ runImmediately: true,
+ });
+ await dp2.Runtime.runIfWaitingForDebugger();
+ });
+
+ const loaded = dp.Page.onceLoadEventFired();
+ await dp.Page.navigate({
+ url: testRunner.url('resources/iframe-src.html')
+ });
+ await loaded;
+
+ testRunner.completeTest();
+});

View File

@@ -12,5 +12,6 @@
{ "patch_dir": "src/electron/patches/ReactiveObjC", "repo": "src/third_party/squirrel.mac/vendor/ReactiveObjC" },
{ "patch_dir": "src/electron/patches/webrtc", "repo": "src/third_party/webrtc" },
{ "patch_dir": "src/electron/patches/reclient-configs", "repo": "src/third_party/engflow-reclient-configs" },
{ "patch_dir": "src/electron/patches/sqlite", "repo": "src/third_party/sqlite/src" }
{ "patch_dir": "src/electron/patches/sqlite", "repo": "src/third_party/sqlite/src" },
{ "patch_dir": "src/electron/patches/angle", "repo": "src/third_party/angle" }
]

View File

@@ -8,10 +8,10 @@ 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 b438b3774d0aa7680fdbc6c6bf39a87893d221b2..ec355061825fb861c17fa2e6cc967b4c7b8d4586 100644
index b24e170cb247261d4a16d77ad40df4dfd33709d9..5e31f984b5655ae2d1d7559b1bd550ba6dc90fb4 100644
--- a/src/node_platform.cc
+++ b/src/node_platform.cc
@@ -687,8 +687,8 @@ bool NodePlatform::IdleTasksEnabled(Isolate* isolate) {
@@ -688,8 +688,8 @@ bool NodePlatform::IdleTasksEnabled(Isolate* isolate) {
return ForIsolate(isolate)->IdleTasksEnabled();
}

View File

@@ -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 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec4843caf89a 100644
index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7c630fddf 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -620,7 +620,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
@@ -654,7 +654,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
MaybeLocal<Object> GetPerContextExports(Local<Context> context,
IsolateData* isolate_data) {
@@ -18,7 +18,7 @@ index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec48
EscapableHandleScope handle_scope(isolate);
Local<Object> global = context->Global();
@@ -666,7 +666,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) {
@@ -700,7 +700,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 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec48
HandleScope handle_scope(isolate);
// When `IsCodeGenerationFromStringsAllowed` is true, V8 takes the fast path
@@ -745,7 +745,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
@@ -779,7 +779,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
}
Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
@@ -36,7 +36,7 @@ index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec48
HandleScope handle_scope(isolate);
// Delete `Intl.v8BreakIterator`
@@ -770,7 +770,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
@@ -804,7 +804,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
}
Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
@@ -45,7 +45,7 @@ index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec48
HandleScope handle_scope(isolate);
// Initialize the default values.
@@ -788,7 +788,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
@@ -822,7 +822,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
IsolateData* isolate_data) {
CHECK(isolate_data);
@@ -54,7 +54,7 @@ index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec48
EscapableHandleScope scope(isolate);
Context::Scope context_scope(context);
@@ -812,7 +812,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
@@ -846,7 +846,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
IsolateData* isolate_data) {
CHECK(isolate_data);
@@ -63,7 +63,7 @@ index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec48
EscapableHandleScope scope(isolate);
Context::Scope context_scope(context);
@@ -838,7 +838,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
@@ -872,7 +872,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
Maybe<void> InitializePrimordials(Local<Context> context,
IsolateData* isolate_data) {
// Run per-context JS files.
@@ -85,10 +85,10 @@ index 6f731b17fe0b84dd3d2c9bc9cfef1f8062a2c5f7..71a1072ed2decbee08d40eda7c47456b
return handle;
diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
index ea5179ad5155cb599891d7421cd61df719ac4cae..ee5380fd055663e5d58491943532ec1dfa11a3c3 100644
index a3d309d832c73ddc79564b9644d825bec7459e7f..580cbaf3858961f375ca2f53c48a07bcba82ef46 100644
--- a/src/crypto/crypto_context.cc
+++ b/src/crypto/crypto_context.cc
@@ -946,7 +946,7 @@ bool ArrayOfStringsToX509s(Local<Context> context,
@@ -967,7 +967,7 @@ bool ArrayOfStringsToX509s(Local<Context> context,
Local<Array> cert_array,
std::vector<X509*>* certs) {
ClearErrorOnReturn clear_error_on_return;
@@ -157,10 +157,10 @@ index 31ed995714bb99ab534f26ba9ebc6051c258a1c9..5ace688bb7ffc86eedf5aff11ab0ab48
// Recreate the buffer in the constructor.
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
diff --git a/src/env.cc b/src/env.cc
index 8cdfbac602796cabbd8a2f673385b93bea9bd7cc..a0097a4af25f760ba4b31865d9a800d1974a454c 100644
index c6209cc7cf317de1bb9217e39dd760e5a83303e2..161d577e0ea6a251c83ba1903b1ec9a582a5317c 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -1744,10 +1744,10 @@ void AsyncHooks::Deserialize(Local<Context> context) {
@@ -1748,10 +1748,10 @@ void AsyncHooks::Deserialize(Local<Context> context) {
context->GetDataFromSnapshotOnce<Array>(
info_->js_execution_async_resources).ToLocalChecked();
} else {
@@ -173,7 +173,7 @@ index 8cdfbac602796cabbd8a2f673385b93bea9bd7cc..a0097a4af25f760ba4b31865d9a800d1
// The native_execution_async_resources_ field requires v8::Local<> instances
// for async calls whose resources were on the stack as JS objects when they
@@ -1787,7 +1787,7 @@ AsyncHooks::SerializeInfo AsyncHooks::Serialize(Local<Context> context,
@@ -1791,7 +1791,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(
@@ -310,10 +310,10 @@ 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 e3880111172363feafb53b51deb08c93596cd4f4..6ab85bb74d708037274e08df343559a37db384dc 100644
index cbb3e7f4df72f83cb8a1afc25a7429218792e964..ffccac5589bfe12eaf7861364cc6f2e403d26679 100644
--- a/src/module_wrap.cc
+++ b/src/module_wrap.cc
@@ -859,7 +859,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
@@ -865,7 +865,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
Local<String> specifier,
Local<FixedArray> import_attributes,
Local<Module> referrer) {
@@ -322,7 +322,7 @@ index e3880111172363feafb53b51deb08c93596cd4f4..6ab85bb74d708037274e08df343559a3
Environment* env = Environment::GetCurrent(context);
if (env == nullptr) {
THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate);
@@ -901,7 +901,7 @@ MaybeLocal<Promise> ImportModuleDynamically(
@@ -907,7 +907,7 @@ MaybeLocal<Promise> ImportModuleDynamically(
Local<Value> resource_name,
Local<String> specifier,
Local<FixedArray> import_attributes) {
@@ -331,7 +331,7 @@ index e3880111172363feafb53b51deb08c93596cd4f4..6ab85bb74d708037274e08df343559a3
Environment* env = Environment::GetCurrent(context);
if (env == nullptr) {
THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate);
@@ -1125,7 +1125,7 @@ MaybeLocal<Module> LinkRequireFacadeWithOriginal(
@@ -1131,7 +1131,7 @@ MaybeLocal<Module> LinkRequireFacadeWithOriginal(
Local<FixedArray> import_attributes,
Local<Module> referrer) {
Environment* env = Environment::GetCurrent(context);
@@ -341,10 +341,10 @@ index e3880111172363feafb53b51deb08c93596cd4f4..6ab85bb74d708037274e08df343559a3
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 4335c7cf53b7e08c95dcee3461384ac12c8ebe41..16ba26ff9babd719b6807bc01339183866c8cf33 100644
index 16a0c71aef949b0ddd27def9dc843298f9a6b75f..28fa4cb3e7a621480a5ff11c48666c0de1363375 100644
--- a/src/node.h
+++ b/src/node.h
@@ -1034,7 +1034,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
@@ -1050,7 +1050,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
#define NODE_DEFINE_CONSTANT(target, constant) \
do { \
@@ -353,7 +353,7 @@ index 4335c7cf53b7e08c95dcee3461384ac12c8ebe41..16ba26ff9babd719b6807bc013391838
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
isolate, #constant, v8::NewStringType::kInternalized); \
@@ -1050,7 +1050,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
@@ -1066,7 +1066,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
#define NODE_DEFINE_HIDDEN_CONSTANT(target, constant) \
do { \
@@ -376,7 +376,7 @@ 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 557972987abeaa56918362638a17a9b6e0763238..b639f788981c5503c22c471eefd225c26a79c3f8 100644
index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c58106217b32d1b 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -275,7 +275,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal(
@@ -433,10 +433,10 @@ index 557972987abeaa56918362638a17a9b6e0763238..b639f788981c5503c22c471eefd225c2
// 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 d193725ea9a3270ed9affea12d11467fb14efdf8..24364b7458c822ff84ac9123843aea1f01d84bc0 100644
index cbcecfba33070b820aca0e2814982160a97a6378..b1ee513fc0873a51b4885f612dbf7b950b5cf2ca 100644
--- a/src/node_constants.cc
+++ b/src/node_constants.cc
@@ -1268,7 +1268,7 @@ void CreatePerContextProperties(Local<Object> target,
@@ -1264,7 +1264,7 @@ void CreatePerContextProperties(Local<Object> target,
Local<Value> unused,
Local<Context> context,
void* priv) {
@@ -446,7 +446,7 @@ index d193725ea9a3270ed9affea12d11467fb14efdf8..24364b7458c822ff84ac9123843aea1f
CHECK(target->SetPrototype(env->context(), Null(env->isolate())).FromJust());
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 386102dfe7e4d9136f47058b03f3702126cd5063..7f4917c3bb73bb333ba85ae11a4be6e6968a7e36 100644
index 21a08a738e5c3506d27e402762a4a267e9278588..475b5628f9b82a2b9b86343f25759c1e6814f816 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -111,7 +111,7 @@ namespace {
@@ -467,7 +467,7 @@ index 386102dfe7e4d9136f47058b03f3702126cd5063..7f4917c3bb73bb333ba85ae11a4be6e6
PropertyAttribute attributes = PropertyAttribute::None;
bool is_declared =
@@ -1651,7 +1651,7 @@ static MaybeLocal<Function> CompileFunctionForCJSLoader(
@@ -1657,7 +1657,7 @@ static MaybeLocal<Function> CompileFunctionForCJSLoader(
bool* cache_rejected,
bool is_cjs_scope,
ScriptCompiler::CachedData* cached_data) {
@@ -521,10 +521,10 @@ index befb642f1effa3c4139e4cd99ff64d9c5175fd72..9c068afd1c4c3fadeee4ba035e67ec4a
READONLY_PROPERTY(target, "exitCodes", exit_codes);
diff --git a/src/node_file.cc b/src/node_file.cc
index 7221708a2296ff44c19ed01dc52d78653ecc4e58..e9ddf73af28a62245291d9d1eb452eeb39312dff 100644
index d7009937b31729f33d9c45cbda7f5440fbdac2aa..e57a3140cd90d7e7852a0c6892091e50b850ae64 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -3755,7 +3755,7 @@ void BindingData::Deserialize(Local<Context> context,
@@ -3753,7 +3753,7 @@ void BindingData::Deserialize(Local<Context> context,
int index,
InternalFieldInfoBase* info) {
DCHECK_IS_SNAPSHOT_SLOT(index);
@@ -534,7 +534,7 @@ index 7221708a2296ff44c19ed01dc52d78653ecc4e58..e9ddf73af28a62245291d9d1eb452eeb
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
BindingData* binding =
diff --git a/src/node_messaging.cc b/src/node_messaging.cc
index 66c8868b9d8e69812464ca9eca53434321f8ec4a..0146a0ee909d570e840e8ae7dc448bcd1c6b31e4 100644
index 1eff9399ff87510164390a1dfea84158a8856b86..e912562d768308906286890b7015cf2c462bac49 100644
--- a/src/node_messaging.cc
+++ b/src/node_messaging.cc
@@ -253,7 +253,7 @@ namespace {
@@ -564,7 +564,7 @@ index 66c8868b9d8e69812464ca9eca53434321f8ec4a..0146a0ee909d570e840e8ae7dc448bcd
Local<Value> argv[] = {message,
FIXED_ONE_BYTE_STRING(isolate, "DataCloneError")};
Local<Value> exception;
@@ -1465,7 +1465,7 @@ BaseObjectPtr<BaseObject> JSTransferable::Data::Deserialize(
@@ -1464,7 +1464,7 @@ BaseObjectPtr<BaseObject> JSTransferable::Data::Deserialize(
Maybe<bool> JSTransferable::Data::FinalizeTransferWrite(
Local<Context> context, ValueSerializer* serializer) {
@@ -609,7 +609,7 @@ 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 e87c6e2da4936827a8426a4d09589afa261c8cba..dabb8836add263088a919a6a3529c9aca47f1ef9 100644
index cd2b4c0107594a8ba9bf671669e4c82326719908..d18945085ff1860bbe3796e0b47904210aafd941 100644
--- a/src/node_realm.cc
+++ b/src/node_realm.cc
@@ -19,7 +19,7 @@ using v8::String;
@@ -622,7 +622,7 @@ index e87c6e2da4936827a8426a4d09589afa261c8cba..dabb8836add263088a919a6a3529c9ac
env->AssignToContext(context, this, ContextInfo(""));
}
diff --git a/src/node_report.cc b/src/node_report.cc
index da7b846d555ba63c30b5700c081ee38685dcaa83..53ac70f319796efafaeea9b4bd314b2f4de3cb06 100644
index df73a8204bc0917073a70ca68d019ceab3159b08..d7bb94db78b3a729f25ceaf66d193032056b36ff 100644
--- a/src/node_report.cc
+++ b/src/node_report.cc
@@ -399,7 +399,7 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer,
@@ -635,10 +635,10 @@ index da7b846d555ba63c30b5700c081ee38685dcaa83..53ac70f319796efafaeea9b4bd314b2f
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 a500204c4768e26a4d2476e7b99e173389e8e1ef..949201e7ddce501b7135fb1c4a907e3ad3ab1146 100644
index 69d8d15d8989ed31a19489e68588e730760c8ffb..d342a5ff91bbd9cb73c02c26ae3a36b9d0dc7b47 100644
--- a/src/node_snapshotable.cc
+++ b/src/node_snapshotable.cc
@@ -1584,7 +1584,7 @@ void BindingData::Deserialize(Local<Context> context,
@@ -1613,7 +1613,7 @@ void BindingData::Deserialize(Local<Context> context,
int index,
InternalFieldInfoBase* info) {
DCHECK_IS_SNAPSHOT_SLOT(index);
@@ -648,10 +648,10 @@ index a500204c4768e26a4d2476e7b99e173389e8e1ef..949201e7ddce501b7135fb1c4a907e3a
// 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 f5704bc13d415853316d72661e9d5584c2432b9f..62f280c1e0e860ae3a3c8b48eda31a3cc8f0c216 100644
index 8b6fe36e1fece112269ebf193d6322a4d1dacc0a..96101167016573e80fff520256ebb78c71d83302 100644
--- a/src/node_sqlite.cc
+++ b/src/node_sqlite.cc
@@ -1856,7 +1856,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
@@ -1858,7 +1858,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
if (args[0]->IsObject() && !args[0]->IsArrayBufferView()) {
Local<Object> obj = args[0].As<Object>();
@@ -661,7 +661,7 @@ index f5704bc13d415853316d72661e9d5584c2432b9f..62f280c1e0e860ae3a3c8b48eda31a3c
if (!obj->GetOwnPropertyNames(context).ToLocal(&keys)) {
return false;
diff --git a/src/node_task_queue.cc b/src/node_task_queue.cc
index 0a5aba6e31fa799a77267aa81d8324f8a5ea6f05..794c802ec09f5e20176816fcdde7152eb24ac27b 100644
index c4257110d8b52017fccd8e1e746b557a0b7084df..6f00da0b515397d300e387f03f4a2bf71155cfe0 100644
--- a/src/node_task_queue.cc
+++ b/src/node_task_queue.cc
@@ -48,7 +48,7 @@ void PromiseRejectCallback(PromiseRejectMessage message) {
@@ -744,10 +744,10 @@ index 74ece724e207a69e2457598a199c12f1cebcfd4a..1705e430099c5a363e02010f83d729b0
static void Clear(const FunctionCallbackInfo<Value>& info) {
diff --git a/src/node_worker.cc b/src/node_worker.cc
index 6c43928ba5a9752c78544d1c77198278eb11ccd7..d1faec81602bbe41c1239b8abb82b592821b4fa4 100644
index 8555ab556b5b74a1cf9cf30747f1f417bfe4e4d9..1a2532337504444d59098304b87e0d65f16e838c 100644
--- a/src/node_worker.cc
+++ b/src/node_worker.cc
@@ -1149,8 +1149,6 @@ void GetEnvMessagePort(const FunctionCallbackInfo<Value>& args) {
@@ -1289,8 +1289,6 @@ void GetEnvMessagePort(const FunctionCallbackInfo<Value>& args) {
Local<Object> port = env->message_port();
CHECK_IMPLIES(!env->is_main_thread(), !port.IsEmpty());
if (!port.IsEmpty()) {
@@ -894,10 +894,10 @@ index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3c
context, that, OneByteString(isolate, name), tmpl, flag);
}
diff --git a/src/util.h b/src/util.h
index efeb12d837db7b88093e4a6a2e20df562180ca1e..2631765cb7fded77d70ac3012d63867deb6f2be7 100644
index 7c98de621ca4d53cbaaa5bd4488aab20c7b033a7..329d2397c87ac37d157e3325e2ab62907d7286b4 100644
--- a/src/util.h
+++ b/src/util.h
@@ -752,7 +752,7 @@ inline v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
@@ -756,7 +756,7 @@ inline v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
// Variation on NODE_DEFINE_CONSTANT that sets a String value.
#define NODE_DEFINE_STRING_CONSTANT(target, name, constant) \
do { \

View File

@@ -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 2415940835036226799a7ea14c6687cc0d56c523..0feb07afbccad97a92cee00954443407eb20ac67 100755
index 91283ca577f580dbf1e0c4e2dbf851a9ceaa38ed..e8eaff30ec947677db2d45425f9180759d0c55de 100755
--- a/configure.py
+++ b/configure.py
@@ -1722,7 +1722,7 @@ def configure_v8(o, configs):
@@ -1728,7 +1728,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,7 +68,7 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea46
assert(!node_enable_inspector || node_use_openssl,
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index b4acc40618e372b09d0cb5e3755034f08711a282..efeaaef7e4dc64a0adb5e6bdbbe18945890de62c 100644
index b83aa87c969fb4e71cb202816713af869bb76283..c54df6fee333ddfe59b9df7e0ddd2935b4dcb33f 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -789,6 +789,7 @@ void BuiltinLoader::RegisterExternalReferences(

View File

@@ -10,7 +10,7 @@ V8 requires C++20 support as of https://chromium-review.googlesource.com/c/v8/v8
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 3a1d2fc9d147a8c89f7b5231d63d37f29979965d..6425ee9e8dba993f3e899362ce9bd7b097f08883 100644
index c28d6f5fe2c922f0b1e3f7e56289c78e7b91c294..95c56305926fc3e0e46e4cf99ec86d3d1b5576a7 100644
--- a/common.gypi
+++ b/common.gypi
@@ -539,7 +539,7 @@
@@ -22,7 +22,7 @@ index 3a1d2fc9d147a8c89f7b5231d63d37f29979965d..6425ee9e8dba993f3e899362ce9bd7b0
],
'defines': [ '__STDC_FORMAT_MACROS' ],
'ldflags': [ '-rdynamic' ],
@@ -709,7 +709,7 @@
@@ -719,7 +719,7 @@
['clang==1', {
'xcode_settings': {
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',

View File

@@ -64,10 +64,10 @@ index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327
module.exports = {
diff --git a/node.gyp b/node.gyp
index d604e0ddd973174aa7be6f2d250af7b9c2b0fcfd..8e97aa3f44087213425927113fe72bca9ddef45b 100644
index 0e0071b508f605bb9b7722f8304814dc176d907e..bcb9f371c4e4d8c665058115dc39eaa65125d679 100644
--- a/node.gyp
+++ b/node.gyp
@@ -176,7 +176,6 @@
@@ -174,7 +174,6 @@
'src/timers.cc',
'src/timer_wrap.cc',
'src/tracing/agent.cc',
@@ -75,7 +75,7 @@ index d604e0ddd973174aa7be6f2d250af7b9c2b0fcfd..8e97aa3f44087213425927113fe72bca
'src/tracing/node_trace_writer.cc',
'src/tracing/trace_event.cc',
'src/tracing/traced_value.cc',
@@ -304,7 +303,6 @@
@@ -302,7 +301,6 @@
'src/tcp_wrap.h',
'src/timers.h',
'src/tracing/agent.h',
@@ -105,7 +105,7 @@ index 40c8aea35c931c46fc62b717c978eab0659645fd..348cdfb0b42aa18f352c220cea0b896c
if (!json_writer_)
return;
diff --git a/src/tracing/agent.cc b/src/tracing/agent.cc
index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187177fc3bd 100644
index eddcf6c3bf91b730d6ca72960e3048ceed7e7844..184e8647b2148bc597d9d3eb63f86ae99917c642 100644
--- a/src/tracing/agent.cc
+++ b/src/tracing/agent.cc
@@ -2,7 +2,9 @@
@@ -144,7 +144,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187
// This thread should be created *after* async handles are created
// (within NodeTraceWriter and NodeTraceBuffer constructors).
@@ -143,8 +151,10 @@ void Agent::StopTracing() {
@@ -148,8 +156,10 @@ void Agent::StopTracing() {
return;
// Perform final Flush on TraceBuffer. We don't want the tracing controller
// to flush the buffer again on destruction of the V8::Platform.
@@ -156,7 +156,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187
started_ = false;
// Thread should finish when the tracing loop is stopped.
@@ -202,6 +212,7 @@ std::string Agent::GetEnabledCategories() const {
@@ -207,6 +217,7 @@ std::string Agent::GetEnabledCategories() const {
return categories;
}
@@ -164,7 +164,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187
void Agent::AppendTraceEvent(TraceObject* trace_event) {
for (const auto& id_writer : writers_)
id_writer.second->AppendTraceEvent(trace_event);
@@ -211,18 +222,21 @@ void Agent::AddMetadataEvent(std::unique_ptr<TraceObject> event) {
@@ -216,18 +227,21 @@ void Agent::AddMetadataEvent(std::unique_ptr<TraceObject> event) {
Mutex::ScopedLock lock(metadata_events_mutex_);
metadata_events_.push_back(std::move(event));
}
@@ -187,7 +187,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187
void TracingController::AddMetadataEvent(
const unsigned char* category_group_enabled,
const char* name,
@@ -246,6 +260,6 @@ void TracingController::AddMetadataEvent(
@@ -251,6 +265,6 @@ void TracingController::AddMetadataEvent(
if (node_agent != nullptr)
node_agent->AddMetadataEvent(std::move(trace_event));
}

View File

@@ -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 e56ba31ed068b81f5c6fbd432cd82bb6916e9a85..3a1d2fc9d147a8c89f7b5231d63d37f29979965d 100644
index 6b79de07be3f839af5b0644f19bfef9c33de590e..c28d6f5fe2c922f0b1e3f7e56289c78e7b91c294 100644
--- a/common.gypi
+++ b/common.gypi
@@ -89,6 +89,8 @@
@@ -42,10 +42,10 @@ index e56ba31ed068b81f5c6fbd432cd82bb6916e9a85..3a1d2fc9d147a8c89f7b5231d63d37f2
# list in v8/BUILD.gn.
['v8_enable_v8_checks == 1', {
diff --git a/configure.py b/configure.py
index 0feb07afbccad97a92cee00954443407eb20ac67..5eccced7cf0212f229db68c76cc824a37e4a29bc 100755
index e8eaff30ec947677db2d45425f9180759d0c55de..dc2d9d80059e845b33444f8bdc29e82d0fe0e26b 100755
--- a/configure.py
+++ b/configure.py
@@ -1704,6 +1704,7 @@ def configure_library(lib, output, pkgname=None):
@@ -1710,6 +1710,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 0feb07afbccad97a92cee00954443407eb20ac67..5eccced7cf0212f229db68c76cc824a3
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 835c78145956de3d8c52b6cc0581bcfef600f90b..174fd4d1af4c8cd75aec09f4548a674fd5539fb2 100644
index a336f44dc1e785ea237865077216d41ab032c0af..96c599aa6448e2aa8e57e84f811564a5281c139a 100644
--- a/src/node.h
+++ b/src/node.h
@@ -22,6 +22,12 @@

View File

@@ -34,7 +34,7 @@ index 0244a214b187e67e0cb89f26cd019855963ec93a..b65a3be6bcb0e28f7f43367d0fa9da53
let kResistStopPropagation;
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index efeaaef7e4dc64a0adb5e6bdbbe18945890de62c..557972987abeaa56918362638a17a9b6e0763238 100644
index c54df6fee333ddfe59b9df7e0ddd2935b4dcb33f..4b288e0f89e0156cb5b0555c0259b2c1150770db 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -35,6 +35,7 @@ using v8::Value;

View File

@@ -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 6425ee9e8dba993f3e899362ce9bd7b097f08883..95d66f75b582b3fd3b833109dfe110ae5b196f83 100644
index 95c56305926fc3e0e46e4cf99ec86d3d1b5576a7..45bb2c4ff94ceac377c9117da4497cdc5ac41171 100644
--- a/common.gypi
+++ b/common.gypi
@@ -128,6 +128,7 @@

View File

@@ -40,10 +40,10 @@ index 9b41db8b0714b7408f79cbd5b4c460d9bc08f239..35ecfb9bbaf2c8e7351e1c69da84c82a
/**
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
index e317a84e55714af0a93719336d02ac26410ad724..e3880111172363feafb53b51deb08c93596cd4f4 100644
index c52e20d742942667f43ea3e151fc6702260b176b..cbb3e7f4df72f83cb8a1afc25a7429218792e964 100644
--- a/src/module_wrap.cc
+++ b/src/module_wrap.cc
@@ -895,7 +895,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
@@ -901,7 +901,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
return module->module_.Get(isolate);
}
@@ -52,7 +52,7 @@ index e317a84e55714af0a93719336d02ac26410ad724..e3880111172363feafb53b51deb08c93
Local<Context> context,
Local<Data> host_defined_options,
Local<Value> resource_name,
@@ -967,12 +967,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback(
@@ -973,12 +973,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback(
Realm* realm = Realm::GetCurrent(args);
HandleScope handle_scope(isolate);
@@ -68,7 +68,7 @@ index e317a84e55714af0a93719336d02ac26410ad724..e3880111172363feafb53b51deb08c93
}
void ModuleWrap::HostInitializeImportMetaObjectCallback(
@@ -1014,13 +1015,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(
@@ -1020,13 +1021,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(
Realm* realm = Realm::GetCurrent(args);
Isolate* isolate = realm->isolate();

View File

@@ -15,10 +15,10 @@ 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 8cabb58e621a9951acd5551afb85c192f2b1c690..b69bacebef3e5e5e5b191c61aa5fe0f71c1edfb3 100644
index 9a0e83b95a72486ab9751b3b8818f4beeb527041..1da7126b9d51238e9b89ee6bed602df3f5598a9e 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -2712,39 +2712,6 @@ added: v12.0.0
@@ -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.
@@ -58,7 +58,7 @@ index 8cabb58e621a9951acd5551afb85c192f2b1c690..b69bacebef3e5e5e5b191c61aa5fe0f7
### `--trace-deprecation`
<!-- YAML
@@ -3429,7 +3396,6 @@ one is included in the list below.
@@ -3445,7 +3412,6 @@ one is included in the list below.
* `--tls-min-v1.1`
* `--tls-min-v1.2`
* `--tls-min-v1.3`
@@ -67,10 +67,10 @@ index 8cabb58e621a9951acd5551afb85c192f2b1c690..b69bacebef3e5e5e5b191c61aa5fe0f7
* `--trace-env-js-stack`
* `--trace-env-native-stack`
diff --git a/doc/node.1 b/doc/node.1
index 6913992a5476d2317a34fb69d3c6af63b686f9a6..1faef5ba1d4206a5cc4c71cb71f7a08f613fbf17 100644
index e3b2c45af01b2e9b9522964da2572988edd2b9e9..64e975546285a1042dda6fdb54fdd502f338a929 100644
--- a/doc/node.1
+++ b/doc/node.1
@@ -539,11 +539,6 @@ but the option is supported for compatibility with older Node.js versions.
@@ -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.
.
@@ -83,7 +83,7 @@ index 6913992a5476d2317a34fb69d3c6af63b686f9a6..1faef5ba1d4206a5cc4c71cb71f7a08f
Print stack traces for deprecations.
.
diff --git a/src/node.cc b/src/node.cc
index 0d383dcdb80fe30e3c2d6880b44f626f065bb1f3..9d9992dacbc595c987827f55eb12ea8af0480df6 100644
index f0c0b6229048a2e9bc05684fab44ab09bc34e1f6..9027df9a321f7db76edd1218c194df519017dfaf 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -232,44 +232,6 @@ void Environment::WaitForInspectorFrontendByOptions() {
@@ -150,7 +150,7 @@ index 0d383dcdb80fe30e3c2d6880b44f626f065bb1f3..9d9992dacbc595c987827f55eb12ea8a
isolate_->SetPromiseHook(TracePromises);
}
diff --git a/src/node_options.cc b/src/node_options.cc
index cfb95f65ccb0c6d150be8a4039caf26faf7cd06d..cb0ecd81b33abd7743e66e225a6cb96b4094f935 100644
index e8424d7539db191a55edebb7d33a3c1dc37e2403..556776b79282d953fdc371d1901f21ca301bec1a 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -773,10 +773,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
@@ -165,10 +165,10 @@ index cfb95f65ccb0c6d150be8a4039caf26faf7cd06d..cb0ecd81b33abd7743e66e225a6cb96b
"show stack traces on deprecations",
&EnvironmentOptions::trace_deprecation,
diff --git a/src/node_options.h b/src/node_options.h
index 3ff1f4b4baa64b8ee2a4587e150ea14cb2fdfdf4..26ac54c4b18dd00b2c1f915dc1ba0e90ca70b48f 100644
index 418dee360f867c363f1576012b32213a51c4fdd0..7078d2493ed696bc5bd92df9c629b714c1a8fbfb 100644
--- a/src/node_options.h
+++ b/src/node_options.h
@@ -204,7 +204,6 @@ class EnvironmentOptions : public Options {
@@ -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;

View File

@@ -18,10 +18,10 @@ 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 1a1e0ec1d89a4d0ecf1c9ae37c23b8f660c051d6..8cabb58e621a9951acd5551afb85c192f2b1c690 100644
index b8f9fb49fcb45602828e79bd79902233b5987dda..9a0e83b95a72486ab9751b3b8818f4beeb527041 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -3467,7 +3467,6 @@ V8 options that are allowed are:
@@ -3483,7 +3483,6 @@ V8 options that are allowed are:
* `--disallow-code-generation-from-strings`
* `--enable-etw-stack-walking`
* `--expose-gc`
@@ -30,7 +30,7 @@ index 1a1e0ec1d89a4d0ecf1c9ae37c23b8f660c051d6..8cabb58e621a9951acd5551afb85c192
* `--jitless`
* `--max-old-space-size`
diff --git a/src/node_options.cc b/src/node_options.cc
index 415d4e34f29bc303674dccbfdc231b251401961b..cfb95f65ccb0c6d150be8a4039caf26faf7cd06d 100644
index 8afded658c3f569de7b329ea9dddc11010748cf9..e8424d7539db191a55edebb7d33a3c1dc37e2403 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -1001,11 +1001,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser(

View File

@@ -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 655349b6fa17217a9202616224032a36fd01e284..bf62c5adf0e0d75cb50636f365f71db82c29ba29 100644
index 960ecd25ebb5b2aba0b92b869a2332a3a69011e1..ced0a5d792c63662c577a41c88b52cae076e7d08 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -62,6 +62,7 @@ let debug = require('internal/util/debuglog').debuglog(
@@ -49,8 +49,8 @@ index 655349b6fa17217a9202616224032a36fd01e284..bf62c5adf0e0d75cb50636f365f71db8
+
if (options.shell) {
validateArgumentNullCheck(options.shell, 'options.shell');
const command = ArrayPrototypeJoin([file, ...args], ' ');
@@ -670,8 +686,6 @@ function normalizeSpawnArguments(file, args, options) {
@@ -671,8 +687,6 @@ function normalizeSpawnArguments(file, args, options) {
ArrayPrototypeUnshift(args, file);
}

View File

@@ -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 7780ae106b479ca620a4065f08d6e4acc200628c..e56ba31ed068b81f5c6fbd432cd82bb6916e9a85 100644
index ae31b372b96358a156761ec7e9c39c9530d1abd1..6b79de07be3f839af5b0644f19bfef9c33de590e 100644
--- a/common.gypi
+++ b/common.gypi
@@ -91,6 +91,23 @@

View File

@@ -15,10 +15,10 @@ 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 9c4c1e1db5fa7c0ca791e01d9be331e0957e9699..b438b3774d0aa7680fdbc6c6bf39a87893d221b2 100644
index 0ffebd1dcb693dcddbedff5d259cf65c115f1dc2..b24e170cb247261d4a16d77ad40df4dfd33709d9 100644
--- a/src/node_platform.cc
+++ b/src/node_platform.cc
@@ -307,11 +307,13 @@ void PerIsolatePlatformData::FlushTasks(uv_async_t* handle) {
@@ -308,11 +308,13 @@ void PerIsolatePlatformData::FlushTasks(uv_async_t* handle) {
platform_data->FlushForegroundTasksInternal();
}
@@ -34,7 +34,7 @@ index 9c4c1e1db5fa7c0ca791e01d9be331e0957e9699..b438b3774d0aa7680fdbc6c6bf39a878
// 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
@@ -330,8 +332,10 @@ void PerIsolatePlatformData::PostTask(std::unique_ptr<Task> task) {
@@ -331,8 +333,10 @@ void PerIsolatePlatformData::PostTask(std::unique_ptr<Task> task) {
uv_async_send(flush_tasks_);
}
@@ -47,7 +47,7 @@ index 9c4c1e1db5fa7c0ca791e01d9be331e0957e9699..b438b3774d0aa7680fdbc6c6bf39a878
if (debug_log_level_ != PlatformDebugLogLevel::kNone) {
fprintf(stderr,
"\nPerIsolatePlatformData::PostDelayedTaskImpl %p %f",
@@ -353,13 +357,15 @@ void PerIsolatePlatformData::PostDelayedTask(
@@ -354,13 +358,15 @@ void PerIsolatePlatformData::PostDelayedTask(
uv_async_send(flush_tasks_);
}

View File

@@ -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 c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d78653ecc4e58 100644
index e78326ed0de805a8bf4f621cad9158635eb44aa2..d7009937b31729f33d9c45cbda7f5440fbdac2aa 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -3504,13 +3504,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
@@ -3502,13 +3502,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
}
BindingData::FilePathIsFileReturnType BindingData::FilePathIsFile(
@@ -83,7 +83,7 @@ index c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d7865
uv_fs_t req;
int rc = uv_fs_stat(env->event_loop(), &req, file_path.c_str(), nullptr);
@@ -3568,6 +3580,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
@@ -3566,6 +3578,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
std::optional<std::string> initial_file_path;
std::string file_path;
@@ -95,7 +95,7 @@ index c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d7865
if (args.Length() >= 2 && args[1]->IsString()) {
auto package_config_main = Utf8Value(isolate, args[1]).ToString();
@@ -3588,7 +3605,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
@@ -3586,7 +3603,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 c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d7865
case BindingData::FilePathIsFileReturnType::kIsFile:
return args.GetReturnValue().Set(i);
case BindingData::FilePathIsFileReturnType::kIsNotFile:
@@ -3625,7 +3642,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
@@ -3623,7 +3640,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
BufferValue buff_file_path(isolate, local_file_path);
ToNamespacedPath(env, &buff_file_path);

View File

@@ -44,7 +44,7 @@ index 13e41d67c635c27bd5e69eb4960eace34beaef0d..9a99c9ca93907630f9f3ba7ba24577a1
let filename = call.getFileName();
const line = call.getLineNumber() - 1;
diff --git a/src/node_options.cc b/src/node_options.cc
index 653112fbaea59fe8b446236085dcae8be671c6e5..415d4e34f29bc303674dccbfdc231b251401961b 100644
index e3509abbc3bf84ac0edcd495eb3dde6219dbfc2d..8afded658c3f569de7b329ea9dddc11010748cf9 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -1566,14 +1566,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {

View File

@@ -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 9d9992dacbc595c987827f55eb12ea8af0480df6..d43a88b8780f04d186485a2dc58ad07083e699ac 100644
index 9027df9a321f7db76edd1218c194df519017dfaf..cc1c35da5601fffc3c53985c5d95cc466662649d 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1222,7 +1222,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
@@ -1246,7 +1246,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
result->platform_ = per_process::v8_platform.Platform();
}

View File

@@ -6,19 +6,20 @@ 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 8e099e0961b624c6143f5a60f050855b3366f177..dfed827fd3fc794f52bad39ccf7b5c14b1caebc3 100644
index 2c33fd44b9a251682de78a8bcdad9ee5a0d3e5e8..ae3ef0e853ae19fca649704854d4bda84a5bd287 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -293,6 +293,9 @@ function cjsPreparseModuleExports(filename, source, isMain, format) {
if (module && module[kModuleExportNames] !== undefined) {
@@ -355,6 +355,10 @@ function cjsPreparseModuleExports(filename, source, format) {
return { module, exportNames: module[kModuleExportNames] };
}
+ if (filename === 'electron') {
+ return { module, exportNames: new SafeSet(['default', ...Object.keys(module.exports)]) };
+ }
const loaded = Boolean(module);
if (!loaded) {
module = new CJSModule(filename);
+
if (source === undefined) {
({ 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
--- a/lib/internal/modules/run_main.js

View File

@@ -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 5cb8dd86fe712755fe09556d227702aec905fbc9..f1768da6ef82fa85700fecbdf9321653345e92c5 100644
index 82225b0a53dd828750991a4e15a060b736b6ea2b..4b0d31356a2496a7fc67876a22da2453efc54f53 100644
--- a/src/env_properties.h
+++ b/src/env_properties.h
@@ -506,6 +506,7 @@
@@ -508,6 +508,7 @@
V(maybe_cache_generated_source_map, v8::Function) \
V(messaging_deserialize_create_object, v8::Function) \
V(message_port, v8::Object) \

View File

@@ -18,7 +18,7 @@ index 9519f947b8dfdc69808839948c9cb8434a0acf0e..23ce72d479f638c33edffcea7c35f5da
/**
diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js
index e718d7b3e7c11addc78cf7af33c93f63a9cb247b..3334818153068468967baa5adc1ed2382592ec76 100644
index 307c35980551470b65128bebf5efe94df4e56892..3676a9852bcd42de0a3a380de117de58035f757b 100644
--- a/lib/internal/modules/esm/load.js
+++ b/lib/internal/modules/esm/load.js
@@ -81,7 +81,7 @@ function defaultLoad(url, context = kEmptyObject) {
@@ -29,8 +29,8 @@ index e718d7b3e7c11addc78cf7af33c93f63a9cb247b..3334818153068468967baa5adc1ed238
+ if (urlInstance.protocol === 'node:' || format === 'electron') {
source = null;
format ??= 'builtin';
} else if (format !== 'commonjs' || defaultType === 'module') {
@@ -94,7 +94,7 @@ function defaultLoad(url, context = kEmptyObject) {
} else if (format === 'addon') {
@@ -97,7 +97,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 e718d7b3e7c11addc78cf7af33c93f63a9cb247b..3334818153068468967baa5adc1ed238
// For backward compatibility reasons, we need to discard the source in
// order for the CJS loader to re-fetch it.
source = null;
@@ -142,7 +142,7 @@ function defaultLoadSync(url, context = kEmptyObject) {
@@ -145,7 +145,7 @@ function defaultLoadSync(url, context = kEmptyObject) {
throwIfUnsupportedURLScheme(urlInstance, false);
@@ -48,7 +48,7 @@ index e718d7b3e7c11addc78cf7af33c93f63a9cb247b..3334818153068468967baa5adc1ed238
source = null;
} else if (source == null) {
({ responseURL, source } = getSourceSync(urlInstance, context));
@@ -175,12 +175,13 @@ function throwIfUnsupportedURLScheme(parsed) {
@@ -178,12 +178,13 @@ function throwIfUnsupportedURLScheme(parsed) {
protocol !== 'file:' &&
protocol !== 'data:' &&
protocol !== 'node:' &&
@@ -64,10 +64,10 @@ index e718d7b3e7c11addc78cf7af33c93f63a9cb247b..3334818153068468967baa5adc1ed238
}
}
diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js
index 87c14d1f84def72c1326e09154b38c417840634e..4491499e6da1724a7fd66b028a78ba145d6114aa 100644
index 78985575beb3df7722ba90968e8f085574b5afdf..e032c016efe227c26364e81804ad183cd2c0d17f 100644
--- a/lib/internal/modules/esm/loader.js
+++ b/lib/internal/modules/esm/loader.js
@@ -498,7 +498,7 @@ class ModuleLoader {
@@ -504,7 +504,7 @@ class ModuleLoader {
}
const cjsModule = wrap[imported_cjs_symbol];
@@ -103,12 +103,12 @@ 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 d595ccbab8ce3042e83054e875eef612914115d8..7ea645b92a015b04cc121ff62aa1fc64b2961241 100644
index 757f093becd112002f3422302f4c29bb464f1a6c..c8cea2117080930105b33e4e50586a2c88ef7352 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
const { exportNames, module } = cjsPreparseModuleExports(filename, source, isMain, format);
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') ?
@@ -126,7 +126,7 @@ index d595ccbab8ce3042e83054e875eef612914115d8..7ea645b92a015b04cc121ff62aa1fc64
continue;
}
// We might trigger a getter -> dont fail.
@@ -245,6 +245,10 @@ translators.set('require-commonjs', (url, source, isMain) => {
@@ -286,6 +286,10 @@ translators.set('require-commonjs', (url, source, isMain) => {
return createCJSModuleWrap(url, source, isMain, 'commonjs');
});
@@ -138,10 +138,10 @@ index d595ccbab8ce3042e83054e875eef612914115d8..7ea645b92a015b04cc121ff62aa1fc64
// 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 b6057ae6656e03d98ea40c018369419749409c6d..9bd9abd49523406fd9ac77f2b5efe311da1fa9aa 100644
index d0c04be7c6ebc352d5958a987f3a4ba538e0d23a..00f9f3b73ed84c04ae712f6057b68737bd416333 100644
--- a/lib/internal/url.js
+++ b/lib/internal/url.js
@@ -1604,6 +1604,8 @@ function fileURLToPath(path, options = kEmptyObject) {
@@ -1605,6 +1605,8 @@ function fileURLToPath(path, options = kEmptyObject) {
path = new URL(path);
else if (!isURL(path))
throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path);

View File

@@ -228,7 +228,7 @@ 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 5e368e3fd93b560c629aef720acd576f118cb1d6..ea5179ad5155cb599891d7421cd61df719ac4cae 100644
index c08dab17fa229d1d67d3ad5174c97192989b2bd0..a3d309d832c73ddc79564b9644d825bec7459e7f 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,
@@ -240,7 +240,7 @@ index 5e368e3fd93b560c629aef720acd576f118cb1d6..ea5179ad5155cb599891d7421cd61df7
X509* ca = sk_X509_value(extra_certs, i);
// NOTE: Increments reference count on `ca`
@@ -1752,11 +1752,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
@@ -1773,11 +1773,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 +254,7 @@ index 5e368e3fd93b560c629aef720acd576f118cb1d6..ea5179ad5155cb599891d7421cd61df7
DHPointer dh;
{
BIOPointer bio(LoadBIO(env, args[0]));
@@ -1982,7 +1983,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
@@ -2003,7 +2004,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
}
// Add CA certs too
@@ -372,7 +372,7 @@ index c26a88b395abfc645da56231635b36fb23c8fa09..f23cedf4f2449d8edc9a8de1b70332e7
UNREACHABLE();
}
diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc
index 471fee77531139ce988292470dff443fdfb05b07..931f7c2ae3d7e12afce471545d610d22f63412d7 100644
index ca5edc8ebdf2550bb62b7969a5650733a2647f4f..198e18b58f31e361a9d2865cbe81e067e5f0b543 100644
--- a/src/crypto/crypto_dsa.cc
+++ b/src/crypto/crypto_dsa.cc
@@ -43,7 +43,7 @@ namespace crypto {
@@ -520,11 +520,11 @@ index 7c548d32b40365343f0e208c3aa856a1c847f4c3..6346f8f7199cf7b7d3736c59571606ff
} // namespace
diff --git a/src/env.h b/src/env.h
index c42493ad958508f650917bf5ca92088714a5056c..07accfbcca491966c6c8ad9c20e146dbd22347f0 100644
index 874e5f4d15a75307e45cf70c06fc104fed843a6a..35e16159a94bb97f19d17767e3ad4bb798660f44 100644
--- a/src/env.h
+++ b/src/env.h
@@ -50,7 +50,7 @@
#include "uv.h"
@@ -51,7 +51,7 @@
#include "v8-profiler.h"
#include "v8.h"
-#if HAVE_OPENSSL
@@ -532,7 +532,7 @@ index c42493ad958508f650917bf5ca92088714a5056c..07accfbcca491966c6c8ad9c20e146db
#include <openssl/evp.h>
#endif
@@ -1076,7 +1076,7 @@ class Environment final : public MemoryRetainer {
@@ -1077,7 +1077,7 @@ class Environment final : public MemoryRetainer {
kExitInfoFieldCount
};
@@ -542,11 +542,11 @@ index c42493ad958508f650917bf5ca92088714a5056c..07accfbcca491966c6c8ad9c20e146db
// We declare another alias here to avoid having to include crypto_util.h
using EVPMDPointer = DeleteFnPtr<EVP_MD, EVP_MD_free>;
diff --git a/src/node_metadata.h b/src/node_metadata.h
index 7b2072ad39c3f1a7c73101b25b69beb781141e26..d23536d88d21255d348175425a59e2424332cd19 100644
index d9c533f100d25aeab1fe8589932a8ddead431258..2acab8786a8a752b17961445edeb872c2b08fdeb 100644
--- a/src/node_metadata.h
+++ b/src/node_metadata.h
@@ -6,7 +6,7 @@
#include <string>
@@ -8,7 +8,7 @@
#include <utility>
#include "node_version.h"
-#if HAVE_OPENSSL
@@ -555,7 +555,7 @@ index 7b2072ad39c3f1a7c73101b25b69beb781141e26..d23536d88d21255d348175425a59e242
#if NODE_OPENSSL_HAS_QUIC
#include <openssl/quic.h>
diff --git a/src/node_options.cc b/src/node_options.cc
index 249361e351946c16452124029c60fca52782adf9..653112fbaea59fe8b446236085dcae8be671c6e5 100644
index ed85bf11f6f325823b59b3b0275908f9210c1b24..e3509abbc3bf84ac0edcd495eb3dde6219dbfc2d 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -7,7 +7,7 @@
@@ -568,7 +568,7 @@ index 249361e351946c16452124029c60fca52782adf9..653112fbaea59fe8b446236085dcae8b
#endif
diff --git a/src/node_options.h b/src/node_options.h
index 2a1a6aaf9f2d358ffffb0a8171df470686b9450e..3ff1f4b4baa64b8ee2a4587e150ea14cb2fdfdf4 100644
index cdbd9ca39e907ab22515293eac2c5512223f4ca2..418dee360f867c363f1576012b32213a51c4fdd0 100644
--- a/src/node_options.h
+++ b/src/node_options.h
@@ -11,7 +11,7 @@

View File

@@ -6,7 +6,7 @@ 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 3334818153068468967baa5adc1ed2382592ec76..ab4c8a4d00f1813e72f1ea8349850b40f55a393e 100644
index 3676a9852bcd42de0a3a380de117de58035f757b..eaecfcfd8b922908957c3fefea65fb9deb445249 100644
--- a/lib/internal/modules/esm/load.js
+++ b/lib/internal/modules/esm/load.js
@@ -10,7 +10,7 @@ const {
@@ -50,10 +50,10 @@ index 5aa946f66c71beff0b7a43c30638ab28a1a5dfc0..e3afd30ba1f591d0298793bc42fd7166
});
const { search, hash } = resolved;
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index 7ea645b92a015b04cc121ff62aa1fc64b2961241..8e099e0961b624c6143f5a60f050855b3366f177 100644
index c8cea2117080930105b33e4e50586a2c88ef7352..2c33fd44b9a251682de78a8bcdad9ee5a0d3e5e8 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -25,7 +25,7 @@ const {
@@ -24,7 +24,7 @@ const {
const { BuiltinModule } = require('internal/bootstrap/realm');
const assert = require('internal/assert');
@@ -62,7 +62,7 @@ index 7ea645b92a015b04cc121ff62aa1fc64b2961241..8e099e0961b624c6143f5a60f050855b
const { dirname, extname } = require('path');
const {
assertBufferSource,
@@ -274,7 +274,7 @@ translators.set('commonjs', function commonjsStrategy(url, source, isMain) {
@@ -315,7 +315,7 @@ translators.set('commonjs', function commonjsStrategy(url, source, isMain) {
try {
// We still need to read the FS to detect the exports.

View File

@@ -45,7 +45,7 @@ index ac00778cfc59fb55e361b24fc81a965a5e8f97e7..f0c4d6dfc9f03bee59e656b2da9ac325
# define UV__EUNATCH UV__ERR(EUNATCH)
#else
diff --git a/src/node_constants.cc b/src/node_constants.cc
index 8c44e32381a44675792ca0922e47df1adda48e41..d193725ea9a3270ed9affea12d11467fb14efdf8 100644
index 0ca643aa74d13f278685d2330b791182b55c15b4..cbcecfba33070b820aca0e2814982160a97a6378 100644
--- a/src/node_constants.cc
+++ b/src/node_constants.cc
@@ -241,10 +241,6 @@ void DefineErrnoConstants(Local<Object> target) {

View File

@@ -194,10 +194,10 @@ index e39852c8e0392e0a9ae5d4ea58be115416e19233..c94b14741c827a81d69a6f036426a344
static const v8::CFunction fast_write_string_ascii(
diff --git a/src/util.h b/src/util.h
index dbec66247852df91c57c2a4e9664d2fea7d3dcef..efeb12d837db7b88093e4a6a2e20df562180ca1e 100644
index dcd6548d41be786c42ce8328d89e532a8e9d43a2..7c98de621ca4d53cbaaa5bd4488aab20c7b033a7 100644
--- a/src/util.h
+++ b/src/util.h
@@ -60,6 +60,7 @@
@@ -62,6 +62,7 @@
namespace node {
constexpr char kPathSeparator = std::filesystem::path::preferred_separator;
@@ -205,7 +205,7 @@ index dbec66247852df91c57c2a4e9664d2fea7d3dcef..efeb12d837db7b88093e4a6a2e20df56
#ifdef _WIN32
/* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */
@@ -585,6 +586,16 @@ class BufferValue : public MaybeStackBuffer<char> {
@@ -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);

View File

@@ -13,7 +13,7 @@ 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 1b5e989e5456a9bf77475e06250702029568c08d..61d65094aebd7f3016d51a8e7c9c761fc69cecba 100644
index 07684482f855363e26c3d7299a585a8a5654015e..627337efae49319e2a77b4686176ce92a8493024 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -816,7 +816,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,

View File

@@ -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 9e1b8d147a99fda962d75c343d0687ffea3c9c69..244d747f010c51366e44dec705ae304423038a85 100644
index cb37fa080fc8e8d524cfa2758c4a8c2c5652324d..8e227ddd1be50c046a8cf2895a31d607eb7d31de 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -313,6 +313,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
@@ -316,6 +316,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
MultiIsolatePlatform* platform,
const SnapshotData* snapshot_data,
const IsolateSettings& settings) {
@@ -32,7 +32,7 @@ index 9e1b8d147a99fda962d75c343d0687ffea3c9c69..244d747f010c51366e44dec705ae3044
Isolate* isolate = Isolate::Allocate();
if (isolate == nullptr) return nullptr;
@@ -356,9 +360,12 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator,
@@ -359,9 +363,12 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator,
uv_loop_t* event_loop,
MultiIsolatePlatform* platform,
const EmbedderSnapshotData* snapshot_data,
@@ -47,10 +47,10 @@ index 9e1b8d147a99fda962d75c343d0687ffea3c9c69..244d747f010c51366e44dec705ae3044
event_loop,
platform,
diff --git a/src/env.cc b/src/env.cc
index 56eb42643f26f3ebb447cb625d5422dcfa872189..8cdfbac602796cabbd8a2f673385b93bea9bd7cc 100644
index 85641b68b1e6f6dd4149f33ba13f76bccc8bf47d..c6209cc7cf317de1bb9217e39dd760e5a83303e2 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -577,14 +577,6 @@ IsolateData::IsolateData(Isolate* isolate,
@@ -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;
@@ -65,7 +65,7 @@ index 56eb42643f26f3ebb447cb625d5422dcfa872189..8cdfbac602796cabbd8a2f673385b93b
{
// 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
@@ -607,15 +599,6 @@ IsolateData::IsolateData(Isolate* isolate,
@@ -608,15 +600,6 @@ IsolateData::IsolateData(Isolate* isolate,
}
}
@@ -82,10 +82,10 @@ index 56eb42643f26f3ebb447cb625d5422dcfa872189..8cdfbac602796cabbd8a2f673385b93b
void SetCppgcReference(Isolate* isolate,
Local<Object> object,
diff --git a/src/env.h b/src/env.h
index 1079e3beb02e5f5d71a15fd2db65cb93ebd175d6..a7be609c3ab9093cec5145367b95ae6859936a24 100644
index 2d5fa8dbd75851bca30453548f6cbe0159509f26..c346e3a9c827993036438685d758a734f9ce8c05 100644
--- a/src/env.h
+++ b/src/env.h
@@ -155,7 +155,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer {
@@ -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);
@@ -93,7 +93,7 @@ index 1079e3beb02e5f5d71a15fd2db65cb93ebd175d6..a7be609c3ab9093cec5145367b95ae68
SET_MEMORY_INFO_NAME(IsolateData)
SET_SELF_SIZE(IsolateData)
@@ -258,7 +257,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer {
@@ -260,7 +259,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer {
const SnapshotData* snapshot_data_;
std::optional<SnapshotConfig> snapshot_config_;
@@ -102,10 +102,10 @@ index 1079e3beb02e5f5d71a15fd2db65cb93ebd175d6..a7be609c3ab9093cec5145367b95ae68
worker::Worker* worker_context_ = nullptr;
PerIsolateWrapperData* wrapper_data_;
diff --git a/src/node.cc b/src/node.cc
index 61d65094aebd7f3016d51a8e7c9c761fc69cecba..0d383dcdb80fe30e3c2d6880b44f626f065bb1f3 100644
index 627337efae49319e2a77b4686176ce92a8493024..f0c0b6229048a2e9bc05684fab44ab09bc34e1f6 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1271,6 +1271,14 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
@@ -1295,6 +1295,14 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
result->platform_ = per_process::v8_platform.Platform();
}
@@ -120,7 +120,7 @@ index 61d65094aebd7f3016d51a8e7c9c761fc69cecba..0d383dcdb80fe30e3c2d6880b44f626f
if (!(flags & ProcessInitializationFlags::kNoInitializeV8)) {
V8::Initialize();
@@ -1280,14 +1288,6 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
@@ -1304,14 +1312,6 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
absl::SetMutexDeadlockDetectionMode(absl::OnDeadlockCycle::kIgnore);
}
@@ -136,7 +136,7 @@ index 61d65094aebd7f3016d51a8e7c9c761fc69cecba..0d383dcdb80fe30e3c2d6880b44f626f
bool use_wasm_trap_handler =
!per_process::cli_options->disable_wasm_trap_handler;
diff --git a/src/node.h b/src/node.h
index 42d55d24bd0770795ae0c0e19241d25a6350ae08..4335c7cf53b7e08c95dcee3461384ac12c8ebe41 100644
index d3a965661d068db359bb1bb4b14e59c28bb615f9..16a0c71aef949b0ddd27def9dc843298f9a6b75f 100644
--- a/src/node.h
+++ b/src/node.h
@@ -590,7 +590,8 @@ NODE_EXTERN v8::Isolate* NewIsolate(
@@ -174,10 +174,10 @@ index 4119ac1b002681d39711eac810ca2fcc2702ffc7..790347056cde949ffe6cf8498a7eca0c
ExitCode NodeMainInstance::Run() {
diff --git a/src/node_worker.cc b/src/node_worker.cc
index e2dbdd39b06c4f2f85eba46cbf1383af144456c6..6c43928ba5a9752c78544d1c77198278eb11ccd7 100644
index 29c4b1de42b3127a98871d200c80197bf974b31f..8555ab556b5b74a1cf9cf30747f1f417bfe4e4d9 100644
--- a/src/node_worker.cc
+++ b/src/node_worker.cc
@@ -163,6 +163,9 @@ class WorkerThreadData {
@@ -177,6 +177,9 @@ class WorkerThreadData {
SetIsolateCreateParamsForNode(&params);
w->UpdateResourceConstraints(&params.constraints);
params.array_buffer_allocator_shared = allocator;
@@ -187,7 +187,7 @@ index e2dbdd39b06c4f2f85eba46cbf1383af144456c6..6c43928ba5a9752c78544d1c77198278
Isolate* isolate =
NewIsolate(&params, &loop_, w->platform_, w->snapshot_data());
if (isolate == nullptr) {
@@ -231,13 +234,8 @@ class WorkerThreadData {
@@ -245,13 +248,8 @@ class WorkerThreadData {
*static_cast<bool*>(data) = true;
}, &platform_finished);

View File

@@ -33,7 +33,7 @@ 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 7dd24545fee674b25503b0fcff9b9af0d5c6a26a..5de8be7f8ed97e6b110e397fc4cacb9a246892b6 100644
index 2e0d180d249c6925c761cb673a4a396905cc971c..5bf854723040859f841608f40ac43ea3d4a44b1e 100644
--- a/src/node_process_object.cc
+++ b/src/node_process_object.cc
@@ -13,7 +13,6 @@
@@ -44,7 +44,7 @@ index 7dd24545fee674b25503b0fcff9b9af0d5c6a26a..5de8be7f8ed97e6b110e397fc4cacb9a
using v8::EscapableHandleScope;
using v8::Function;
using v8::FunctionCallbackInfo;
@@ -186,13 +185,12 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) {
@@ -168,13 +167,12 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) {
// process.title
CHECK(process
@@ -59,7 +59,7 @@ index 7dd24545fee674b25503b0fcff9b9af0d5c6a26a..5de8be7f8ed97e6b110e397fc4cacb9a
None,
SideEffectType::kHasNoSideEffect)
.FromJust());
@@ -211,9 +209,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) {
@@ -193,9 +191,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) {
READONLY_PROPERTY(process, "pid",
Integer::New(isolate, uv_os_getpid()));
@@ -78,7 +78,7 @@ index 7dd24545fee674b25503b0fcff9b9af0d5c6a26a..5de8be7f8ed97e6b110e397fc4cacb9a
// --security-revert flags
#define V(code, _, __) \
@@ -238,12 +242,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) {
@@ -220,12 +224,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) {
// process.debugPort
CHECK(process

View File

@@ -16,7 +16,7 @@ patch:
(cherry picked from commit 30329d06235a9f9733b1d4da479b403462d1b326)
diff --git a/src/env-inl.h b/src/env-inl.h
index 0d32d9f5a55da257a5e5a895a2ff002b780f96fe..9567d9499c62ea44cca651e87ab912ad55e2d90b 100644
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 {
@@ -52,7 +52,7 @@ index 0d32d9f5a55da257a5e5a895a2ff002b780f96fe..9567d9499c62ea44cca651e87ab912ad
return &(wrapper_data_->cppgc_id);
}
diff --git a/src/env.cc b/src/env.cc
index 63fdeeb26ba89284e74ca37050dfd170e7963331..56eb42643f26f3ebb447cb625d5422dcfa872189 100644
index 926645dc647fe7ca01165462f08eac1ade71ac4e..85641b68b1e6f6dd4149f33ba13f76bccc8bf47d 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -23,6 +23,7 @@
@@ -71,7 +71,7 @@ index 63fdeeb26ba89284e74ca37050dfd170e7963331..56eb42643f26f3ebb447cb625d5422dc
using worker::Worker;
int const ContextEmbedderTag::kNodeContextTag = 0x6e6f64;
@@ -529,6 +529,14 @@ void IsolateData::CreateProperties() {
@@ -530,6 +530,14 @@ void IsolateData::CreateProperties() {
CreateEnvProxyTemplate(this);
}
@@ -86,7 +86,7 @@ index 63fdeeb26ba89284e74ca37050dfd170e7963331..56eb42643f26f3ebb447cb625d5422dc
constexpr uint16_t kDefaultCppGCEmbedderID = 0x90de;
Mutex IsolateData::isolate_data_mutex_;
std::unordered_map<uint16_t, std::unique_ptr<PerIsolateWrapperData>>
@@ -566,36 +574,16 @@ IsolateData::IsolateData(Isolate* isolate,
@@ -567,36 +575,16 @@ IsolateData::IsolateData(Isolate* isolate,
v8::CppHeap* cpp_heap = isolate->GetCppHeap();
uint16_t cppgc_id = kDefaultCppGCEmbedderID;
@@ -130,7 +130,7 @@ index 63fdeeb26ba89284e74ca37050dfd170e7963331..56eb42643f26f3ebb447cb625d5422dc
{
// GC could still be run after the IsolateData is destroyed, so we store
@@ -628,11 +616,12 @@ IsolateData::~IsolateData() {
@@ -629,11 +617,12 @@ IsolateData::~IsolateData() {
}
}
@@ -146,10 +146,10 @@ index 63fdeeb26ba89284e74ca37050dfd170e7963331..56eb42643f26f3ebb447cb625d5422dc
void IsolateData::MemoryInfo(MemoryTracker* tracker) const {
diff --git a/src/env.h b/src/env.h
index 07accfbcca491966c6c8ad9c20e146dbd22347f0..1079e3beb02e5f5d71a15fd2db65cb93ebd175d6 100644
index 35e16159a94bb97f19d17767e3ad4bb798660f44..2d5fa8dbd75851bca30453548f6cbe0159509f26 100644
--- a/src/env.h
+++ b/src/env.h
@@ -175,10 +175,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer {
@@ -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;
@@ -161,10 +161,10 @@ index 07accfbcca491966c6c8ad9c20e146dbd22347f0..1079e3beb02e5f5d71a15fd2db65cb93
inline MultiIsolatePlatform* platform() const;
inline const SnapshotData* snapshot_data() const;
diff --git a/src/node.h b/src/node.h
index 174fd4d1af4c8cd75aec09f4548a674fd5539fb2..42d55d24bd0770795ae0c0e19241d25a6350ae08 100644
index 96c599aa6448e2aa8e57e84f811564a5281c139a..d3a965661d068db359bb1bb4b14e59c28bb615f9 100644
--- a/src/node.h
+++ b/src/node.h
@@ -1560,24 +1560,14 @@ void RegisterSignalHandler(int signal,
@@ -1576,24 +1576,14 @@ void RegisterSignalHandler(int signal,
bool reset_handler = false);
#endif // _WIN32

View File

@@ -7,10 +7,10 @@ This refactors several allocators to allocate within the V8 memory cage,
allowing them to be compatible with the V8_SANDBOXED_POINTERS feature.
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 50accbf4052da11d47a5200997f1098ed9d85354..9e1b8d147a99fda962d75c343d0687ffea3c9c69 100644
index fd71ceac65ccef1d2832b45b0b5612877cee22c1..cb37fa080fc8e8d524cfa2758c4a8c2c5652324d 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -103,6 +103,14 @@ MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context,
@@ -106,6 +106,14 @@ MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context,
return result;
}
@@ -143,10 +143,10 @@ index 6346f8f7199cf7b7d3736c59571606fff102fbb6..7eea2eaefcad5780663a6b87985925ae
void SecureHeapUsed(const FunctionCallbackInfo<Value>& args) {
#ifndef OPENSSL_IS_BORINGSSL
diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h
index 1592134716da2de40de4ba028ee937b765423e37..8f3ba65f1fef2c066d6df6087a08ba71100d1090 100644
index ebc7fddeccf04a92c610849b626b33f900d63493..ed7d202d1b041f8a6cd43ae767d696fb29ab9cd9 100644
--- a/src/crypto/crypto_util.h
+++ b/src/crypto/crypto_util.h
@@ -242,7 +242,7 @@ class ByteSource {
@@ -243,7 +243,7 @@ class ByteSource {
// Creates a v8::BackingStore that takes over responsibility for
// any allocated data. The ByteSource will be reset with size = 0
// after being called.
@@ -229,10 +229,10 @@ index 61b6ecd240c9500f21f683065a2f920af3afb502..ad2b1c76325cb5c8f18a618c5a85ae87
constexpr const char* EncodingName(const enum encoding encoding) {
diff --git a/src/node_internals.h b/src/node_internals.h
index 275534285ec28f02b46639142ab4195b24267476..5f9d123f9d4b9feb7bc0b627b1e6309fdbd6e30d 100644
index 12ea72b61b0a5e194207bb369dfed4b8667107cb..64442215714a98f648971e517ddd9c77e38fe3f2 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -120,7 +120,9 @@ v8::MaybeLocal<v8::Object> InitializePrivateSymbols(
@@ -121,7 +121,9 @@ v8::MaybeLocal<v8::Object> InitializePrivateSymbols(
class NodeArrayBufferAllocator : public ArrayBufferAllocator {
public:
@@ -243,7 +243,7 @@ index 275534285ec28f02b46639142ab4195b24267476..5f9d123f9d4b9feb7bc0b627b1e6309f
void* Allocate(size_t size) override; // Defined in src/node.cc
void* AllocateUninitialized(size_t size) override;
@@ -138,7 +140,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator {
@@ -139,7 +141,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator {
}
private:

View File

@@ -7,7 +7,7 @@ Instead of disabling the tests, flag them as flaky so they still run
but don't cause CI failures on flakes.
diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status
index 0546a81ef11ec7ac8d6e214e4090b0e7b94bf70f..25b08be32c7a0aa501b64102f10c9bffc8c57970 100644
index 67c0c04d2365e59db111258d008f8c73173e3e96..a4204e7580e7823399f6057d57c09cba56b5ff78 100644
--- a/test/parallel/parallel.status
+++ b/test/parallel/parallel.status
@@ -5,6 +5,16 @@ prefix parallel
@@ -28,7 +28,7 @@ index 0546a81ef11ec7ac8d6e214e4090b0e7b94bf70f..25b08be32c7a0aa501b64102f10c9bff
test-net-write-fully-async-hex-string: PASS, FLAKY
# https://github.com/nodejs/node/issues/52273
diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status
index 6893abfe6e1c03d455099099f0d7e6b6930372a6..24aab3bad500ce4b9d43bf693c5efa6d563fe858 100644
index 4ae3b6c5fd2eb633ae78bed1824046d862d7579b..d291954d4451b63aeb2bf46232e8705150eb9e79 100644
--- a/test/sequential/sequential.status
+++ b/test/sequential/sequential.status
@@ -7,6 +7,18 @@ prefix sequential

View File

@@ -35,6 +35,8 @@
#include "shell/common/node_bindings.h"
#include "shell/common/node_includes.h"
#include "shell/common/node_util.h"
#include "shell/common/options_switches.h"
#include "shell/common/platform_util.h"
#if BUILDFLAG(IS_WIN)
#include "chrome/child/v8_crashpad_support_win.h"
@@ -153,9 +155,10 @@ int NodeMain() {
v8_crashpad_support::SetUp();
#endif
auto* command_line = base::CommandLine::ForCurrentProcess();
#if BUILDFLAG(IS_LINUX)
int pid = -1;
auto* command_line = base::CommandLine::ForCurrentProcess();
std::optional<std::string> fd_string = os_env->GetVar("CRASHDUMP_SIGNAL_FD");
std::optional<std::string> pid_string =
os_env->GetVar("CRASHPAD_HANDLER_PID");
@@ -189,14 +192,32 @@ int NodeMain() {
NodeBindings::RegisterBuiltinBindings();
// Parse Node.js cli flags and strip out disallowed options.
const std::vector<std::string> args = ElectronCommandLine::AsUtf8();
std::vector<std::string> args = ElectronCommandLine::AsUtf8();
ExitIfContainsDisallowedFlags(args);
uint64_t process_flags =
node::ProcessInitializationFlags::kNoInitializeV8 |
node::ProcessInitializationFlags::kNoInitializeNodeV8Platform;
if (command_line->HasSwitch(switches::kNoStdioInit)) {
process_flags |= node::ProcessInitializationFlags::kNoStdioInitialization;
// remove the option to avoid node error "bad option: --no-stdio-init"
std::string option = std::string("--") + switches::kNoStdioInit;
std::erase(args, option);
} else {
#if BUILDFLAG(IS_WIN)
if (!platform_util::IsNulDeviceEnabled()) {
LOG(FATAL) << "Unable to open nul device needed for initialization,"
"aborting startup. As a workaround, try starting with --"
<< switches::kNoStdioInit;
}
#endif
}
std::shared_ptr<node::InitializationResult> result =
node::InitializeOncePerProcess(
args,
{node::ProcessInitializationFlags::kNoInitializeV8,
node::ProcessInitializationFlags::kNoInitializeNodeV8Platform});
args, static_cast<node::ProcessInitializationFlags::Flags>(
process_flags));
for (const std::string& error : result->errors())
std::cerr << args[0] << ": " << error << '\n';

View File

@@ -870,28 +870,33 @@ void App::SetAppPath(const base::FilePath& app_path) {
app_path_ = app_path;
}
#if !BUILDFLAG(IS_MAC)
void App::SetAppLogsPath(gin_helper::ErrorThrower thrower,
std::optional<base::FilePath> custom_path) {
if (custom_path.has_value()) {
if (!custom_path->IsAbsolute()) {
thrower.ThrowError("Path must be absolute");
return;
}
{
ScopedAllowBlockingForElectron allow_blocking;
base::PathService::Override(DIR_APP_LOGS, custom_path.value());
}
} else {
base::FilePath path;
if (base::PathService::Get(chrome::DIR_USER_DATA, &path)) {
path = path.Append(base::FilePath::FromUTF8Unsafe("logs"));
{
ScopedAllowBlockingForElectron allow_blocking;
base::PathService::Override(DIR_APP_LOGS, path);
}
}
void App::SetAppLogsPath(gin::Arguments* const args) {
base::FilePath path;
// if caller provided a path, it must be absolute
if (args->GetNext(&path) && !path.IsAbsolute()) {
args->ThrowTypeError("Path must be absolute");
return;
}
// if caller did not provide a path, then use a default one
if (path.empty()) {
path = GetDefaultAppLogPath();
}
ScopedAllowBlockingForElectron allow_blocking;
base::PathService::Override(DIR_APP_LOGS, path);
}
#if !BUILDFLAG(IS_MAC)
// static
// default to `${DIR_USER_DATA}/logs`
base::FilePath App::GetDefaultAppLogPath() {
base::FilePath path;
if (base::PathService::Get(chrome::DIR_USER_DATA, &path)) {
path = path.Append(base::FilePath::FromUTF8Unsafe("logs"));
}
return path;
}
#endif

View File

@@ -178,6 +178,8 @@ class App final : public gin::Wrappable<App>,
const content::ChildProcessTerminationInfo& info) override;
private:
[[nodiscard]] static base::FilePath GetDefaultAppLogPath();
void BrowserChildProcessCrashedOrKilled(
const content::ChildProcessData& data,
const content::ChildProcessTerminationInfo& info);
@@ -190,8 +192,7 @@ class App final : public gin::Wrappable<App>,
const std::string& name = std::string());
void ChildProcessDisconnected(content::ChildProcessId pid);
void SetAppLogsPath(gin_helper::ErrorThrower thrower,
std::optional<base::FilePath> custom_path);
void SetAppLogsPath(gin::Arguments* args);
// Get/Set the pre-defined path in PathService.
base::FilePath GetPath(gin_helper::ErrorThrower thrower,

View File

@@ -17,30 +17,14 @@
namespace electron::api {
void App::SetAppLogsPath(gin_helper::ErrorThrower thrower,
std::optional<base::FilePath> custom_path) {
if (custom_path.has_value()) {
if (!custom_path->IsAbsolute()) {
thrower.ThrowError("Path must be absolute");
return;
}
{
ScopedAllowBlockingForElectron allow_blocking;
base::PathService::Override(DIR_APP_LOGS, custom_path.value());
}
} else {
NSString* bundle_name =
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
NSString* logs_path =
[NSString stringWithFormat:@"Library/Logs/%@", bundle_name];
NSString* library_path =
[NSHomeDirectory() stringByAppendingPathComponent:logs_path];
{
ScopedAllowBlockingForElectron allow_blocking;
base::PathService::Override(DIR_APP_LOGS,
base::FilePath([library_path UTF8String]));
}
}
base::FilePath App::GetDefaultAppLogPath() {
NSString* bundle_name =
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
NSString* logs_path =
[NSString stringWithFormat:@"Library/Logs/%@", bundle_name];
NSString* library_path =
[NSHomeDirectory() stringByAppendingPathComponent:logs_path];
return base::FilePath{[library_path UTF8String]};
}
void App::SetActivationPolicy(gin_helper::ErrorThrower thrower,

View File

@@ -132,6 +132,7 @@ UtilityProcessWrapper::UtilityProcessWrapper(
OPEN_EXISTING, 0, nullptr);
if (handle == INVALID_HANDLE_VALUE) {
PLOG(ERROR) << "Failed to create null handle";
Emit("error", "Failed to create null handle for ignoring stdio");
return;
}
if (io_handle == IOHandle::STDOUT) {

View File

@@ -814,6 +814,8 @@ WebContents::WebContents(v8::Isolate* isolate,
options.Get(options::kOffscreen, &use_offscreen_dict);
use_offscreen_dict.Get(options::kUseSharedTexture,
&offscreen_use_shared_texture_);
use_offscreen_dict.Get(options::kSharedTexturePixelFormat,
&offscreen_shared_texture_pixel_format_);
}
}
@@ -851,6 +853,7 @@ WebContents::WebContents(v8::Isolate* isolate,
if (embedder_ && embedder_->IsOffScreen()) {
auto* view = new OffScreenWebContentsView(
false, offscreen_use_shared_texture_,
offscreen_shared_texture_pixel_format_,
base::BindRepeating(&WebContents::OnPaint, base::Unretained(this)));
params.view = view;
params.delegate_view = view;
@@ -872,6 +875,7 @@ WebContents::WebContents(v8::Isolate* isolate,
content::WebContents::CreateParams params(session->browser_context());
auto* view = new OffScreenWebContentsView(
transparent, offscreen_use_shared_texture_,
offscreen_shared_texture_pixel_format_,
base::BindRepeating(&WebContents::OnPaint, base::Unretained(this)));
params.view = view;
params.delegate_view = view;
@@ -1229,6 +1233,7 @@ void WebContents::MaybeOverrideCreateParamsForNewWindow(
if (is_offscreen) {
auto* view = new OffScreenWebContentsView(
false, offscreen_use_shared_texture_,
offscreen_shared_texture_pixel_format_,
base::BindRepeating(&WebContents::OnPaint, base::Unretained(this)));
create_params->view = view;
create_params->delegate_view = view;

View File

@@ -817,6 +817,7 @@ class WebContents final : public ExclusiveAccessContext,
// Whether offscreen rendering use gpu shared texture
bool offscreen_use_shared_texture_ = false;
std::string offscreen_shared_texture_pixel_format_ = "argb";
// Whether window is fullscreened by HTML5 api.
bool html_fullscreen_ = false;

View File

@@ -549,7 +549,7 @@ void ElectronBrowserClient::AppendExtraCommandLineSwitches(
if (process_type == ::switches::kUtilityProcess ||
process_type == ::switches::kRendererProcess) {
// Copy following switches to child process.
static constexpr std::array<const char*, 9U> kCommonSwitchNames = {
static constexpr std::array<const char*, 10U> kCommonSwitchNames = {
switches::kStandardSchemes.c_str(),
switches::kEnableSandbox.c_str(),
switches::kSecureSchemes.c_str(),
@@ -558,6 +558,7 @@ void ElectronBrowserClient::AppendExtraCommandLineSwitches(
switches::kFetchSchemes.c_str(),
switches::kServiceWorkerSchemes.c_str(),
switches::kStreamingSchemes.c_str(),
switches::kNoStdioInit.c_str(),
switches::kCodeCacheSchemes.c_str()};
command_line->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
kCommonSwitchNames);

View File

@@ -50,10 +50,6 @@ namespace electron {
class ElectronMenuModel;
class BackgroundThrottlingSource;
namespace api {
class BrowserView;
}
#if BUILDFLAG(IS_MAC)
using NativeWindowHandle = gfx::NativeView;
#else
@@ -434,8 +430,6 @@ class NativeWindow : public base::SupportsUserData,
void UpdateBackgroundThrottlingState();
protected:
friend class api::BrowserView;
NativeWindow(const gin_helper::Dictionary& options, NativeWindow* parent);
void set_titlebar_overlay_height(int height) {

View File

@@ -266,7 +266,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
params.remove_standard_frame = !has_frame() || has_client_frame();
// If a client frame, we need to draw our own shadows.
if (IsTranslucent() || has_client_frame())
if (transparent() || has_client_frame())
params.opacity = InitParams::WindowOpacity::kTranslucent;
// The given window is most likely not rectangular since it is translucent and
@@ -300,7 +300,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
widget()->Init(std::move(params));
widget()->SetNativeWindowProperty(kNativeWindowKey.c_str(), this);
SetCanResize(resizable_);
widget()->OnSizeConstraintsChanged();
const bool fullscreen = options.ValueOrDefault(options::kFullscreen, false);
@@ -354,11 +354,11 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
// frameless.
DWORD frame_style = WS_CAPTION | WS_OVERLAPPED;
if (resizable_)
if (CanResize())
frame_style |= WS_THICKFRAME;
if (minimizable_)
frame_style |= WS_MINIMIZEBOX;
if (maximizable_)
if (maximizable_ && CanResize())
frame_style |= WS_MAXIMIZEBOX;
// We should not show a frame for transparent window.
@@ -866,7 +866,7 @@ void NativeWindowViews::SetBounds(const gfx::Rect& bounds, bool animate) {
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
// On Linux and Windows the minimum and maximum size should be updated with
// window size when window is not resizable.
if (!resizable_) {
if (!CanResize()) {
SetMaximumSize(bounds.size());
SetMinimumSize(bounds.size());
}
@@ -947,26 +947,21 @@ extensions::SizeConstraints NativeWindowViews::GetContentSizeConstraints()
void NativeWindowViews::SetResizable(bool resizable) {
if (resizable != resizable_) {
resizable_ = resizable;
// On Linux there is no "resizable" property of a window, we have to set
// both the minimum and maximum size to the window size to achieve it.
if (resizable) {
SetContentSizeConstraints(old_size_constraints_);
SetMaximizable(maximizable_);
} else {
old_size_constraints_ = GetContentSizeConstraints();
resizable_ = false;
gfx::Size content_size = GetContentSize();
SetContentSizeConstraints(
extensions::SizeConstraints(content_size, content_size));
}
}
resizable_ = resizable;
SetCanResize(resizable_);
#if BUILDFLAG(IS_WIN)
UpdateThickFrame();
UpdateThickFrame();
#endif
}
}
bool NativeWindowViews::MoveAbove(const std::string& sourceId) {
@@ -1011,12 +1006,20 @@ void NativeWindowViews::MoveTop() {
#endif
}
bool NativeWindowViews::CanResize() const {
#if BUILDFLAG(IS_WIN)
return resizable_ && thick_frame_;
#else
return resizable_;
#endif
}
bool NativeWindowViews::IsResizable() const {
#if BUILDFLAG(IS_WIN)
if (has_frame())
return ::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME;
#endif
return resizable_;
return CanResize();
}
void NativeWindowViews::SetAspectRatio(double aspect_ratio,
@@ -1817,7 +1820,7 @@ views::View* NativeWindowViews::GetInitiallyFocusedView() {
}
bool NativeWindowViews::CanMaximize() const {
return resizable_ && maximizable_;
return CanResize() && maximizable_;
}
bool NativeWindowViews::CanMinimize() const {

View File

@@ -89,6 +89,7 @@ class NativeWindowViews : public NativeWindow,
bool IsResizable() const override;
void SetAspectRatio(double aspect_ratio,
const gfx::Size& extra_size) override;
bool CanResize() const override;
void SetMovable(bool movable) override;
bool IsMovable() const override;
void SetMinimizable(bool minimizable) override;

View File

@@ -154,6 +154,7 @@ class ElectronDelegatedFrameHostClient
OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
bool transparent,
bool offscreen_use_shared_texture,
const std::string& offscreen_shared_texture_pixel_format,
bool painting,
int frame_rate,
const OnPaintCallback& callback,
@@ -165,6 +166,8 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
parent_host_view_(parent_host_view),
transparent_(transparent),
offscreen_use_shared_texture_(offscreen_use_shared_texture),
offscreen_shared_texture_pixel_format_(
offscreen_shared_texture_pixel_format),
callback_(callback),
frame_rate_(frame_rate),
size_(initial_size),
@@ -548,7 +551,8 @@ OffScreenRenderWidgetHostView::CreateViewForWidget(
}
return new OffScreenRenderWidgetHostView(
transparent_, offscreen_use_shared_texture_, true,
transparent_, offscreen_use_shared_texture_,
offscreen_shared_texture_pixel_format_, true,
embedder_host_view->frame_rate(), callback_, render_widget_host,
embedder_host_view, size());
}

View File

@@ -69,14 +69,16 @@ class OffScreenRenderWidgetHostView
public ui::CompositorDelegate,
private OffscreenViewProxyObserver {
public:
OffScreenRenderWidgetHostView(bool transparent,
bool offscreen_use_shared_texture,
bool painting,
int frame_rate,
const OnPaintCallback& callback,
content::RenderWidgetHost* render_widget_host,
OffScreenRenderWidgetHostView* parent_host_view,
gfx::Size initial_size);
OffScreenRenderWidgetHostView(
bool transparent,
bool offscreen_use_shared_texture,
const std::string& offscreen_shared_texture_pixel_format,
bool painting,
int frame_rate,
const OnPaintCallback& callback,
content::RenderWidgetHost* render_widget_host,
OffScreenRenderWidgetHostView* parent_host_view,
gfx::Size initial_size);
~OffScreenRenderWidgetHostView() override;
// disable copy
@@ -238,6 +240,10 @@ class OffScreenRenderWidgetHostView
return offscreen_use_shared_texture_;
}
const std::string offscreen_shared_texture_pixel_format() const {
return offscreen_shared_texture_pixel_format_;
}
ui::Layer* root_layer() const { return root_layer_.get(); }
content::DelegatedFrameHost* delegated_frame_host() const {
@@ -283,6 +289,7 @@ class OffScreenRenderWidgetHostView
const bool transparent_;
const bool offscreen_use_shared_texture_;
const std::string offscreen_shared_texture_pixel_format_;
OnPaintCallback callback_;
OnPopupPaintCallback parent_callback_;

View File

@@ -16,6 +16,22 @@
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/skbitmap_operations.h"
namespace {
media::VideoPixelFormat GetTargetPixelFormatFromOption(
const std::string& pixel_format_option) {
if (pixel_format_option == "argb") {
return media::PIXEL_FORMAT_ARGB;
} else if (pixel_format_option == "rgbaf16") {
return media::PIXEL_FORMAT_RGBAF16;
}
// Use ARGB as default.
return media::PIXEL_FORMAT_ARGB;
}
} // namespace
namespace electron {
OffScreenVideoConsumer::OffScreenVideoConsumer(
@@ -26,7 +42,10 @@ OffScreenVideoConsumer::OffScreenVideoConsumer(
video_capturer_(view->CreateVideoCapturer()) {
video_capturer_->SetAutoThrottlingEnabled(false);
video_capturer_->SetMinSizeChangePeriod(base::TimeDelta());
video_capturer_->SetFormat(media::PIXEL_FORMAT_ARGB);
auto format = GetTargetPixelFormatFromOption(
view->offscreen_shared_texture_pixel_format());
video_capturer_->SetFormat(format);
// https://crrev.org/c/6438681
// Disable capturer's animation lock-in feature for offscreen capture to

View File

@@ -16,9 +16,12 @@ namespace electron {
OffScreenWebContentsView::OffScreenWebContentsView(
bool transparent,
bool offscreen_use_shared_texture,
const std::string& offscreen_shared_texture_pixel_format,
const OnPaintCallback& callback)
: transparent_(transparent),
offscreen_use_shared_texture_(offscreen_use_shared_texture),
offscreen_shared_texture_pixel_format_(
offscreen_shared_texture_pixel_format),
callback_(callback) {
#if BUILDFLAG(IS_MAC)
PlatformCreate();
@@ -112,7 +115,8 @@ OffScreenWebContentsView::CreateViewForWidget(
return static_cast<content::RenderWidgetHostViewBase*>(rwhv);
return new OffScreenRenderWidgetHostView(
transparent_, offscreen_use_shared_texture_, painting_, GetFrameRate(),
transparent_, offscreen_use_shared_texture_,
offscreen_shared_texture_pixel_format_, painting_, GetFrameRate(),
callback_, render_widget_host, nullptr, GetSize());
}
@@ -132,7 +136,8 @@ OffScreenWebContentsView::CreateViewForChildWidget(
}
return new OffScreenRenderWidgetHostView(
transparent_, offscreen_use_shared_texture_, painting_,
transparent_, offscreen_use_shared_texture_,
offscreen_shared_texture_pixel_format_, painting_,
embedder_host_view->frame_rate(), callback_, render_widget_host,
embedder_host_view, GetSize());
}

View File

@@ -34,9 +34,11 @@ class OffScreenWebContentsView : public content::WebContentsView,
public content::RenderViewHostDelegateView,
private NativeWindowObserver {
public:
OffScreenWebContentsView(bool transparent,
bool offscreen_use_shared_texture,
const OnPaintCallback& callback);
OffScreenWebContentsView(
bool transparent,
bool offscreen_use_shared_texture,
const std::string& offscreen_shared_texture_pixel_format,
const OnPaintCallback& callback);
~OffScreenWebContentsView() override;
void SetWebContents(content::WebContents*);
@@ -109,6 +111,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
const bool transparent_;
const bool offscreen_use_shared_texture_;
const std::string offscreen_shared_texture_pixel_format_;
bool painting_ = true;
int frame_rate_ = 60;
OnPaintCallback callback_;

View File

@@ -163,8 +163,19 @@ DialogResult ShowTaskDialogWstr(gfx::AcceleratedWidget parent,
config.dwFlags |= TDF_POSITION_RELATIVE_TO_WINDOW;
}
if (default_id > 0)
config.nDefaultButton = kIDStart + default_id;
if (default_id >= 0 &&
base::checked_cast<size_t>(default_id) < buttons.size()) {
if (!no_link) {
auto common = GetCommonID(buttons[default_id]);
if (common.button != -1) {
config.nDefaultButton = common.id;
} else {
config.nDefaultButton = kIDStart + default_id;
}
} else {
config.nDefaultButton = kIDStart + default_id;
}
}
// TaskDialogIndirect doesn't allow empty name, if we set empty title it
// will show "electron.exe" in title.

View File

@@ -28,6 +28,8 @@ std::string OsrVideoPixelFormatToString(media::VideoPixelFormat format) {
return "bgra";
case media::PIXEL_FORMAT_ABGR:
return "rgba";
case media::PIXEL_FORMAT_RGBAF16:
return "rgbaf16";
default:
NOTREACHED();
}

View File

@@ -24,6 +24,7 @@
#include "base/trace_event/trace_event.h"
#include "chrome/common/chrome_version.h"
#include "content/public/common/content_paths.h"
#include "content/public/renderer/render_frame.h"
#include "electron/buildflags/buildflags.h"
#include "electron/electron_version.h"
#include "electron/fuses.h"
@@ -39,9 +40,13 @@
#include "shell/common/mac/main_application_bundle.h"
#include "shell/common/node_includes.h"
#include "shell/common/node_util.h"
#include "shell/common/options_switches.h"
#include "shell/common/platform_util.h"
#include "shell/common/process_util.h"
#include "shell/common/world_ids.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/renderer/bindings/core/v8/referrer_script_info.h" // nogncheck
#include "third_party/blink/renderer/bindings/core/v8/v8_initializer.h" // nogncheck
#include "third_party/electron_node/src/debug_utils.h"
#include "third_party/electron_node/src/module_wrap.h"
@@ -211,6 +216,61 @@ bool AllowWasmCodeGenerationCallback(v8::Local<v8::Context> context,
return node::AllowWasmCodeGenerationCallback(context, source);
}
enum ESMHandlerPlatform {
kNone,
kNodeJS,
kBlink,
};
static ESMHandlerPlatform SelectESMHandlerPlatform(
v8::Local<v8::Context> context,
v8::Local<v8::Data> raw_host_defined_options) {
if (node::Environment::GetCurrent(context) == nullptr) {
if (electron::IsBrowserProcess() || electron::IsUtilityProcess())
return ESMHandlerPlatform::kNone;
return ESMHandlerPlatform::kBlink;
}
if (!electron::IsRendererProcess())
return ESMHandlerPlatform::kNodeJS;
blink::WebLocalFrame* frame = blink::WebLocalFrame::FrameForContext(context);
if (frame == nullptr)
return ESMHandlerPlatform::kBlink;
auto prefs = content::RenderFrame::FromWebFrame(frame)->GetBlinkPreferences();
// If we're running with contextIsolation enabled in the renderer process,
// fall back to Blink's logic when the frame is not in the isolated world.
if (prefs.context_isolation) {
return frame->GetScriptContextWorldId(context) ==
electron::WorldIDs::ISOLATED_WORLD_ID
? ESMHandlerPlatform::kNodeJS
: ESMHandlerPlatform::kBlink;
}
if (raw_host_defined_options.IsEmpty() ||
!raw_host_defined_options->IsFixedArray()) {
return ESMHandlerPlatform::kBlink;
}
// Since the routing is based on the `host_defined_options` length -
// make sure that Node's host defined options are different from Blink's.
static_assert(
static_cast<size_t>(node::loader::HostDefinedOptions::kLength) !=
blink::ReferrerScriptInfo::HostDefinedOptionsIndex::kLength);
// Use Node.js resolver only if host options were created by it.
auto options = v8::Local<v8::FixedArray>::Cast(raw_host_defined_options);
if (options->Length() == node::loader::HostDefinedOptions::kLength) {
return ESMHandlerPlatform::kNodeJS;
}
return ESMHandlerPlatform::kBlink;
}
v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically(
v8::Local<v8::Context> context,
v8::Local<v8::Data> v8_host_defined_options,
@@ -218,33 +278,22 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically(
v8::Local<v8::String> v8_specifier,
v8::ModuleImportPhase import_phase,
v8::Local<v8::FixedArray> v8_import_attributes) {
if (node::Environment::GetCurrent(context) == nullptr) {
if (electron::IsBrowserProcess() || electron::IsUtilityProcess())
return {};
return blink::V8Initializer::HostImportModuleWithPhaseDynamically(
context, v8_host_defined_options, v8_referrer_resource_url,
v8_specifier, import_phase, v8_import_attributes);
}
// If we're running with contextIsolation enabled in the renderer process,
// fall back to Blink's logic.
if (electron::IsRendererProcess()) {
blink::WebLocalFrame* frame =
blink::WebLocalFrame::FrameForContext(context);
if (!frame || frame->GetScriptContextWorldId(context) !=
electron::WorldIDs::ISOLATED_WORLD_ID) {
switch (SelectESMHandlerPlatform(context, v8_host_defined_options)) {
case ESMHandlerPlatform::kBlink:
return blink::V8Initializer::HostImportModuleWithPhaseDynamically(
context, v8_host_defined_options, v8_referrer_resource_url,
v8_specifier, import_phase, v8_import_attributes);
}
case ESMHandlerPlatform::kNodeJS:
// TODO: Switch to node::loader::ImportModuleDynamicallyWithPhase
// once we land the Node.js version that has it in upstream.
CHECK(import_phase == v8::ModuleImportPhase::kEvaluation);
return node::loader::ImportModuleDynamically(
context, v8_host_defined_options, v8_referrer_resource_url,
v8_specifier, v8_import_attributes);
case ESMHandlerPlatform::kNone:
default:
return {};
}
// TODO: Switch to node::loader::ImportModuleDynamicallyWithPhase
// once we land the Node.js version that has it in upstream.
CHECK(import_phase == v8::ModuleImportPhase::kEvaluation);
return node::loader::ImportModuleDynamically(
context, v8_host_defined_options, v8_referrer_resource_url, v8_specifier,
v8_import_attributes);
}
v8::MaybeLocal<v8::Promise> HostImportModuleDynamically(
@@ -625,6 +674,19 @@ void NodeBindings::Initialize(v8::Isolate* const isolate,
if (!fuses::IsNodeOptionsEnabled())
process_flags |= node::ProcessInitializationFlags::kDisableNodeOptionsEnv;
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kNoStdioInit)) {
process_flags |= node::ProcessInitializationFlags::kNoStdioInitialization;
} else {
#if BUILDFLAG(IS_WIN)
if (!platform_util::IsNulDeviceEnabled()) {
LOG(FATAL) << "Unable to open nul device needed for initialization,"
"aborting startup. As a workaround, try starting with --"
<< switches::kNoStdioInit;
}
#endif
}
std::shared_ptr<node::InitializationResult> result =
node::InitializeOncePerProcess(
args,

View File

@@ -183,6 +183,9 @@ inline constexpr std::string_view kOffscreen = "offscreen";
inline constexpr std::string_view kUseSharedTexture = "useSharedTexture";
inline constexpr std::string_view kSharedTexturePixelFormat =
"sharedTexturePixelFormat";
inline constexpr std::string_view kNodeIntegrationInSubFrames =
"nodeIntegrationInSubFrames";
@@ -306,6 +309,10 @@ inline constexpr base::cstring_view kDisableNTLMv2 = "disable-ntlm-v2";
inline constexpr base::cstring_view kServiceWorkerPreload =
"service-worker-preload";
// If set, flag node::ProcessInitializationFlags::kNoStdioInitialization would
// be set for node initialization.
inline constexpr base::cstring_view kNoStdioInit = "no-stdio-init";
} // namespace switches
} // namespace electron

View File

@@ -47,6 +47,9 @@ void Beep();
#if BUILDFLAG(IS_WIN)
// SHGetFolderPath calls not covered by Chromium
bool GetFolderPath(int key, base::FilePath* result);
// Check if nul device can be used.
bool IsNulDeviceEnabled();
#endif
#if BUILDFLAG(IS_MAC)

View File

@@ -148,6 +148,12 @@ void OpenExternal(const GURL& url,
return;
}
// Check this to prevent system dialog from popping up on macOS Tahoe.
if (![[NSWorkspace sharedWorkspace] URLForApplicationToOpenURL:ns_url]) {
std::move(callback).Run("No application found to open URL");
return;
}
NSWorkspaceOpenConfiguration* configuration =
[NSWorkspaceOpenConfiguration configuration];
configuration.activates = options.activate;

View File

@@ -12,6 +12,8 @@
#include <comdef.h>
#include <commdlg.h>
#include <dwmapi.h>
#include <fcntl.h>
#include <io.h>
#include <objbase.h>
#include <shellapi.h>
#include <shlobj.h>
@@ -450,4 +452,15 @@ void Beep() {
MessageBeep(MB_OK);
}
bool IsNulDeviceEnabled() {
bool ret = true;
int fd = _open("nul", _O_RDWR);
if (fd < 0) {
ret = false;
} else {
_close(fd);
}
return ret;
}
} // namespace platform_util

View File

@@ -4,6 +4,8 @@
#include "electron/shell/renderer/electron_ipc_native.h"
#include <optional>
#include "base/trace_event/trace_event.h"
#include "shell/common/gin_converters/blink_converter.h"
#include "shell/common/gin_converters/value_converter.h"
@@ -45,10 +47,9 @@ void InvokeIpcCallback(v8::Isolate* const isolate,
// Only set up the node::CallbackScope if there's a node environment.
// Sandboxed renderers don't have a node environment.
std::unique_ptr<node::CallbackScope> callback_scope;
if (node::Environment::GetCurrent(context)) {
callback_scope = std::make_unique<node::CallbackScope>(
isolate, ipcNative, node::async_context{0, 0});
std::optional<node::CallbackScope> callback_scope;
if (auto* env = node::Environment::GetCurrent(context)) {
callback_scope.emplace(env, ipcNative, node::async_context{0, 0});
}
auto callback_key = gin::ConvertToV8(isolate, callback_name)

View File

@@ -5455,7 +5455,7 @@ describe('BrowserWindow module', () => {
thickFrame: true,
transparent: true
});
expect(w.isResizable()).to.be.true('resizable');
expect(w.isResizable()).to.be.false('resizable');
w.maximize();
expect(w.isMaximized()).to.be.true('maximized');
const bounds = w.getBounds();

View File

@@ -82,6 +82,11 @@ describe('shell module', () => {
]);
});
ifit(process.platform === 'darwin')('throws when there is no application registered to open the URL', async () => {
const url = `unknownscheme-${Date.now()}://test`;
await expect(shell.openExternal(url)).to.eventually.be.rejectedWith(/No application found to open URL/);
});
it('opens an external link in the renderer', async () => {
const { url, requestReceived } = await urlOpened();
const w = new BrowserWindow({ show: false, webPreferences: { sandbox: false, contextIsolation: false, nodeIntegration: true } });

View File

@@ -130,6 +130,17 @@ describe('esm', () => {
}
describe('nodeIntegration', () => {
let badFilePath = '';
beforeEach(async () => {
badFilePath = path.resolve(path.resolve(os.tmpdir(), 'bad-file.badjs'));
await fs.promises.writeFile(badFilePath, 'const foo = "bar";');
});
afterEach(async () => {
await fs.promises.unlink(badFilePath);
});
it('should support an esm entrypoint', async () => {
const [webContents] = await loadWindowWithPreload('import { resolve } from "path"; window.resolvePath = resolve;', {
nodeIntegration: true,
@@ -189,6 +200,18 @@ describe('esm', () => {
expect(error?.message).to.include('Failed to fetch dynamically imported module');
});
it('should use Node.js ESM dynamic loader in the preload', async () => {
const [, preloadError] = await loadWindowWithPreload(`await import(${JSON.stringify((pathToFileURL(badFilePath)))})`, {
nodeIntegration: true,
sandbox: false,
contextIsolation: false
});
expect(preloadError).to.not.equal(null);
// This is a node.js specific error message
expect(preloadError!.toString()).to.include('Unknown file extension');
});
it('should use import.meta callback handling from Node.js for Node.js modules', async () => {
const result = await runFixture(path.resolve(fixturePath, 'import-meta'));
expect(result.code).to.equal(0);
@@ -196,17 +219,6 @@ describe('esm', () => {
});
describe('with context isolation', () => {
let badFilePath = '';
beforeEach(async () => {
badFilePath = path.resolve(path.resolve(os.tmpdir(), 'bad-file.badjs'));
await fs.promises.writeFile(badFilePath, 'const foo = "bar";');
});
afterEach(async () => {
await fs.promises.unlink(badFilePath);
});
it('should use Node.js ESM dynamic loader in the isolated context', async () => {
const [, preloadError] = await loadWindowWithPreload(`await import(${JSON.stringify((pathToFileURL(badFilePath)))})`, {
nodeIntegration: true,