mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdd31a7aa4 | ||
|
|
cb0727f88c | ||
|
|
21c6e4e8a0 | ||
|
|
bf4746c7c9 | ||
|
|
091c5db763 | ||
|
|
ee64692287 | ||
|
|
0bc0553af7 | ||
|
|
51beb04c10 | ||
|
|
45a6bfbae9 | ||
|
|
53982a2c3a | ||
|
|
713b24db80 | ||
|
|
f63f875ee0 |
11
.github/workflows/apply-patches.yml
vendored
11
.github/workflows/apply-patches.yml
vendored
@@ -56,16 +56,17 @@ jobs:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Rebase onto Base Branch
|
||||
ref: ${{ github.event.pull_request.base.ref }}
|
||||
- name: Merge PR HEAD
|
||||
working-directory: src/electron
|
||||
env:
|
||||
BASE_REF: ${{ github.event.pull_request.base.ref }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
git config user.email "electron@github.com"
|
||||
git config user.name "Electron Bot"
|
||||
git fetch origin ${BASE_REF}
|
||||
git rebase origin/${BASE_REF}
|
||||
git fetch origin refs/pull/${PR_NUMBER}/head
|
||||
git merge --squash FETCH_HEAD
|
||||
git commit -n -m "Squashed commits"
|
||||
- name: Checkout & Sync & Save
|
||||
uses: ./src/electron/.github/actions/checkout
|
||||
with:
|
||||
|
||||
32
BUILD.gn
32
BUILD.gn
@@ -420,37 +420,6 @@ action("electron_generate_node_defines") {
|
||||
args = [ rebase_path(target_gen_dir) ] + rebase_path(inputs)
|
||||
}
|
||||
|
||||
# MSIX updater needs to be in a separate source_set because it uses C++/WinRT
|
||||
# headers that require exceptions to be enabled.
|
||||
source_set("electron_msix_updater") {
|
||||
sources = [
|
||||
"shell/browser/api/electron_api_msix_updater.cc",
|
||||
"shell/browser/api/electron_api_msix_updater.h",
|
||||
]
|
||||
|
||||
configs += [ "//third_party/electron_node:node_external_config" ]
|
||||
|
||||
public_configs = [ ":electron_lib_config" ]
|
||||
|
||||
if (is_win) {
|
||||
cflags_cc = [
|
||||
"/EHsc", # Enable C++ exceptions for C++/WinRT
|
||||
"-Wno-c++98-compat-extra-semi", #Suppress C++98 compatibility warnings
|
||||
]
|
||||
|
||||
include_dirs = [ "//third_party/nearby/src/internal/platform/implementation/windows/generated" ]
|
||||
}
|
||||
|
||||
deps = [
|
||||
"//base",
|
||||
"//content/public/browser",
|
||||
"//gin",
|
||||
"//third_party/electron_node/deps/simdjson",
|
||||
"//third_party/electron_node/deps/uv",
|
||||
"//v8",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("electron_lib") {
|
||||
configs += [
|
||||
"//v8:external_startup_data",
|
||||
@@ -466,7 +435,6 @@ source_set("electron_lib") {
|
||||
":electron_fuses",
|
||||
":electron_generate_node_defines",
|
||||
":electron_js2c",
|
||||
":electron_msix_updater",
|
||||
":electron_version_header",
|
||||
":resources",
|
||||
"buildflags",
|
||||
|
||||
4
DEPS
4
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'144.0.7559.111',
|
||||
'144.0.7559.134',
|
||||
'node_version':
|
||||
'v24.11.1',
|
||||
'v24.13.0',
|
||||
'nan_version':
|
||||
'675cefebca42410733da8a454c8d9391fcebfbc2',
|
||||
'squirrel.mac_version':
|
||||
|
||||
@@ -632,7 +632,7 @@ Returns `string` - The current application directory.
|
||||
Returns `string` - A path to a special directory or file associated with `name`. On
|
||||
failure, an `Error` is thrown.
|
||||
|
||||
If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being called first, a default log directory will be created equivalent to calling `app.setAppLogsPath()` without a `path` parameter.
|
||||
If `app.getPath('logs')` is called without calling `app.setAppLogsPath()` being called first, a default log directory will be created equivalent to calling `app.setAppLogsPath()` without a `path` parameter.
|
||||
|
||||
### `app.getFileIcon(path[, options])`
|
||||
|
||||
@@ -647,7 +647,7 @@ Returns `Promise<NativeImage>` - fulfilled with the app's icon, which is a [Nati
|
||||
|
||||
Fetches a path's associated icon.
|
||||
|
||||
On _Windows_, there a 2 kinds of icons:
|
||||
On _Windows_, there are 2 kinds of icons:
|
||||
|
||||
* Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
|
||||
* Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
|
||||
@@ -763,7 +763,7 @@ app.getPreferredSystemLanguages() // ['fr-CA', 'en-US', 'zh-Hans-FI', 'es-419']
|
||||
|
||||
Both the available languages and regions and the possible return values differ between the two operating systems.
|
||||
|
||||
As can be seen with the example above, on Windows, it is possible that a preferred system language has no country code, and that one of the preferred system languages corresponds with the language used for the regional format. On macOS, the region serves more as a default country code: the user doesn't need to have Finnish as a preferred language to use Finland as the region,and the country code `FI` is used as the country code for preferred system languages that do not have associated countries in the language name.
|
||||
As can be seen with the example above, on Windows, it is possible that a preferred system language has no country code, and that one of the preferred system languages corresponds with the language used for the regional format. On macOS, the region serves more as a default country code: the user doesn't need to have Finnish as a preferred language to use Finland as the region, and the country code `FI` is used as the country code for preferred system languages that do not have associated countries in the language name.
|
||||
|
||||
### `app.addRecentDocument(path)` _macOS_ _Windows_
|
||||
|
||||
@@ -1225,7 +1225,7 @@ Returns `boolean` - whether hardware acceleration is currently enabled.
|
||||
### `app.disableDomainBlockingFor3DAPIs()`
|
||||
|
||||
By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per
|
||||
domain basis if the GPU processes crashes too frequently. This function
|
||||
domain basis if the GPU process crashes too frequently. This function
|
||||
disables that behavior.
|
||||
|
||||
This method can only be called before app is ready.
|
||||
|
||||
@@ -1049,7 +1049,7 @@ under this mode apps can choose to optimize their UI for tablets, such as
|
||||
enlarging the titlebar and hiding titlebar buttons.
|
||||
|
||||
This API returns whether the window is in tablet mode, and the `resize` event
|
||||
can be be used to listen to changes to tablet mode.
|
||||
can be used to listen to changes to tablet mode.
|
||||
|
||||
#### `win.getMediaSourceId()`
|
||||
|
||||
|
||||
@@ -1140,7 +1140,7 @@ under this mode apps can choose to optimize their UI for tablets, such as
|
||||
enlarging the titlebar and hiding titlebar buttons.
|
||||
|
||||
This API returns whether the window is in tablet mode, and the `resize` event
|
||||
can be be used to listen to changes to tablet mode.
|
||||
can be used to listen to changes to tablet mode.
|
||||
|
||||
#### `win.getMediaSourceId()`
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ will not be allowed. The `finish` event is emitted just after the end operation.
|
||||
Cancels an ongoing HTTP transaction. If the request has already emitted the
|
||||
`close` event, the abort operation will have no effect. Otherwise an ongoing
|
||||
event will emit `abort` and `close` events. Additionally, if there is an ongoing
|
||||
response object,it will emit the `aborted` event.
|
||||
response object, it will emit the `aborted` event.
|
||||
|
||||
#### `request.followRedirect()`
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) _Deprecated_ (non-sandboxed only)
|
||||
|
||||
> [!NOTE]
|
||||
> Using the `clipoard` API from the renderer process is deprecated.
|
||||
> Using the `clipboard` API from the renderer process is deprecated.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> If you want to call this API from a renderer process,
|
||||
|
||||
@@ -168,7 +168,7 @@ Enables net log events to be saved and writes them to `path`.
|
||||
Sets the verbosity of logging when used together with `--enable-logging`.
|
||||
`N` should be one of [Chrome's LogSeverities][severities].
|
||||
|
||||
Note that two complimentary logging mechanisms in Chromium -- `LOG()`
|
||||
Note that two complementary logging mechanisms in Chromium -- `LOG()`
|
||||
and `VLOG()` -- are controlled by different switches. `--log-level`
|
||||
controls `LOG()` messages, while `--v` and `--vmodule` control `VLOG()`
|
||||
messages. So you may want to use a combination of these three switches
|
||||
|
||||
@@ -49,7 +49,7 @@ Use the `system-ui` keyword to match the smoothness to the OS design language.
|
||||
| Value: | `60%` | `0%` |
|
||||
| Example: |  |  |
|
||||
|
||||
### Controlling availibility
|
||||
### Controlling availability
|
||||
|
||||
This CSS rule can be disabled using the Blink feature flag `ElectronCSSCornerSmoothing`.
|
||||
|
||||
|
||||
@@ -344,7 +344,7 @@ Displays a modal dialog that shows an error message.
|
||||
|
||||
This API can be called safely before the `ready` event the `app` module emits,
|
||||
it is usually used to report errors in early stage of startup. If called
|
||||
before the app `ready`event on Linux, the message will be emitted to stderr,
|
||||
before the app `ready` event on Linux, the message will be emitted to stderr,
|
||||
and no GUI dialog will appear.
|
||||
|
||||
### `dialog.showCertificateTrustDialog([window, ]options)` _macOS_ _Windows_
|
||||
|
||||
@@ -34,7 +34,7 @@ Returns:
|
||||
* `error` Error - Typically holds an error string identifying failure root cause.
|
||||
|
||||
Emitted when an error was encountered while streaming response data events. For
|
||||
instance, if the server closes the underlying while the response is still
|
||||
instance, if the server closes the underlying connection while the response is still
|
||||
streaming, an `error` event will be emitted on the response object and a `close`
|
||||
event will subsequently follow on the request object.
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ A `string` (optional) indicating the item's role, if set. Can be `undo`, `redo`,
|
||||
|
||||
#### `menuItem.accelerator`
|
||||
|
||||
An `Accelerator` (optional) indicating the item's accelerator, if set.
|
||||
An `Accelerator | null` indicating the item's accelerator, if set.
|
||||
|
||||
#### `menuItem.userAccelerator` _Readonly_ _macOS_
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ indicate which letter should get a generated accelerator. For example, using
|
||||
opens the associated menu. The indicated character in the button label then gets an
|
||||
underline, and the `&` character is not displayed on the button label.
|
||||
|
||||
In order to escape the `&` character in an item name, add a proceeding `&`. For example, `&&File` would result in `&File` displayed on the button label.
|
||||
In order to escape the `&` character in an item name, add a preceding `&`. For example, `&&File` would result in `&File` displayed on the button label.
|
||||
|
||||
Passing `null` will suppress the default menu. On Windows and Linux,
|
||||
this has the additional effect of removing the menu bar from the window.
|
||||
|
||||
@@ -83,4 +83,4 @@ Currently, Windows high contrast is the only system setting that triggers forced
|
||||
|
||||
### `nativeTheme.prefersReducedTransparency` _Readonly_
|
||||
|
||||
A `boolean` that indicates the whether the user has chosen via system accessibility settings to reduce transparency at the OS level.
|
||||
A `boolean` that indicates whether the user has chosen via system accessibility settings to reduce transparency at the OS level.
|
||||
|
||||
@@ -99,13 +99,13 @@ property is used instead of the `--throw-deprecation` command line flag.
|
||||
|
||||
A `boolean` that controls whether or not deprecations printed to `stderr` include
|
||||
their stack trace. Setting this to `true` will print stack traces for deprecations.
|
||||
This property is instead of the `--trace-deprecation` command line flag.
|
||||
This property is used instead of the `--trace-deprecation` command line flag.
|
||||
|
||||
### `process.traceProcessWarnings`
|
||||
|
||||
A `boolean` that controls whether or not process warnings printed to `stderr` include
|
||||
their stack trace. Setting this to `true` will print stack traces for process warnings
|
||||
(including deprecations). This property is instead of the `--trace-warnings` command
|
||||
(including deprecations). This property is used instead of the `--trace-warnings` command
|
||||
line flag.
|
||||
|
||||
### `process.type` _Readonly_
|
||||
|
||||
@@ -1216,7 +1216,7 @@ function createWindow () {
|
||||
|
||||
mainWindow.webContents.session.setBluetoothPairingHandler((details, callback) => {
|
||||
bluetoothPinCallback = callback
|
||||
// Send a IPC message to the renderer to prompt the user to confirm the pairing.
|
||||
// Send an IPC message to the renderer to prompt the user to confirm the pairing.
|
||||
// Note that this will require logic in the renderer to handle this message and
|
||||
// display a prompt to the user.
|
||||
mainWindow.webContents.send('bluetooth-pairing-request', details)
|
||||
@@ -1264,7 +1264,7 @@ session.defaultSession.allowNTLMCredentialsForDomains('*')
|
||||
|
||||
Overrides the `userAgent` and `acceptLanguages` for this session.
|
||||
|
||||
The `acceptLanguages` must a comma separated ordered list of language codes, for
|
||||
The `acceptLanguages` must be a comma separated ordered list of language codes, for
|
||||
example `"en-US,fr,de,ko,zh-CN,ja"`.
|
||||
|
||||
This doesn't affect existing `WebContents`, and each `WebContents` can use
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* `depthPerComponent` number - The number of bits per color component.
|
||||
* `detected` boolean - `true` if the display is detected by the system.
|
||||
* `displayFrequency` number - The display refresh rate.
|
||||
* `id` number - Unique identifier associated with the display. A value of of -1 means the display is invalid or the correct `id` is not yet known, and a value of -10 means the display is a virtual display assigned to a unified desktop.
|
||||
* `id` number - Unique identifier associated with the display. A value of -1 means the display is invalid or the correct `id` is not yet known, and a value of -10 means the display is a virtual display assigned to a unified desktop.
|
||||
* `internal` boolean - `true` for an internal display and `false` for an external display.
|
||||
* `label` string - User-friendly label, determined by the platform.
|
||||
* `maximumCursorSize` [Size](size.md) - Maximum cursor size in native pixels.
|
||||
|
||||
@@ -15,6 +15,6 @@ In order for extra notification buttons to work on macOS your app must meet the
|
||||
following criteria.
|
||||
|
||||
* App is signed
|
||||
* App has it's `NSUserNotificationAlertStyle` set to `alert` in the `Info.plist`.
|
||||
* App has its `NSUserNotificationAlertStyle` set to `alert` in the `Info.plist`.
|
||||
|
||||
If either of these requirements are not met the button won't appear.
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
* `javascript` boolean (optional) - Enables JavaScript support. Default is `true`.
|
||||
* `webSecurity` boolean (optional) - When `false`, it will disable the
|
||||
same-origin policy (usually using testing websites by people), and set
|
||||
`allowRunningInsecureContent` to `true` if this options has not been set
|
||||
`allowRunningInsecureContent` to `true` if this option has not been set
|
||||
by user. Default is `true`.
|
||||
* `allowRunningInsecureContent` boolean (optional) - Allow an https page to run
|
||||
JavaScript, CSS or plugins from http URLs. Default is `false`.
|
||||
|
||||
@@ -36,6 +36,12 @@ Process: [Main](../glossary.md#main-process)<br />
|
||||
`com.apple.security.cs.allow-unsigned-executable-memory` entitlements. This will allow the utility process
|
||||
to load unsigned libraries. Unless you specifically need this capability, it is best to leave this disabled.
|
||||
Default is `false`.
|
||||
* `disclaim` boolean (optional) _macOS_ - With this flag, the utility process will disclaim
|
||||
responsibility for the child process. This causes the operating system to consider the child
|
||||
process as a separate entity for purposes of security policies like Transparency, Consent, and
|
||||
Control (TCC). When responsibility is disclaimed, the parent process will not be attributed
|
||||
for any TCC requests initiated by the child process. This is useful when launching processes
|
||||
that run third-party or otherwise untrusted code. Default is `false`.
|
||||
* `respondToAuthRequestsFromMainProcess` boolean (optional) - With this flag, all HTTP 401 and 407 network
|
||||
requests created via the [net module](net.md) will allow responding to them via the
|
||||
[`app#login`](app.md#event-login) event in the main process instead of the default
|
||||
|
||||
@@ -383,7 +383,7 @@ Emitted after a server side redirect occurs during navigation. For example a 30
|
||||
redirect.
|
||||
|
||||
This event cannot be prevented, if you want to prevent redirects you should
|
||||
checkout out the `will-redirect` event above.
|
||||
check out the `will-redirect` event above.
|
||||
|
||||
#### Event: 'did-navigate'
|
||||
|
||||
@@ -1465,7 +1465,7 @@ Ignore application menu shortcuts while this web contents is focused.
|
||||
without a recognized 'action' value will result in a console error and have
|
||||
the same effect as returning `{action: 'deny'}`.
|
||||
|
||||
Called before creating a window a new window is requested by the renderer, e.g.
|
||||
Called before creating a window when a new window is requested by the renderer, e.g.
|
||||
by `window.open()`, a link with `target="_blank"`, shift+clicking on a link, or
|
||||
submitting a form with `<form target="_blank">`. See
|
||||
[`window.open()`](window-open.md) for more details and how to use this in
|
||||
@@ -2168,7 +2168,7 @@ Returns `boolean` - If _offscreen rendering_ is enabled returns whether it is cu
|
||||
* `fps` Integer
|
||||
|
||||
If _offscreen rendering_ is enabled sets the frame rate to the specified number.
|
||||
Only values between 1 and 240 are accepted.
|
||||
When `webPreferences.offscreen.useSharedTexture` is `false` only values between 1 and 240 are accepted.
|
||||
|
||||
#### `contents.getFrameRate()`
|
||||
|
||||
@@ -2369,7 +2369,7 @@ instance that might own this `WebContents`.
|
||||
|
||||
#### `contents.devToolsWebContents` _Readonly_
|
||||
|
||||
A `WebContents | null` property that represents the of DevTools `WebContents` associated with a given `WebContents`.
|
||||
A `WebContents | null` property that represents the DevTools `WebContents` associated with a given `WebContents`.
|
||||
|
||||
> [!NOTE]
|
||||
> Users should never store this object because it may become `null`
|
||||
|
||||
@@ -68,7 +68,7 @@ Users can force XWayland by passing `--ozone-platform=x11`.
|
||||
### Removed: `ORIGINAL_XDG_CURRENT_DESKTOP` environment variable
|
||||
|
||||
Previously, Electron changed the value of `XDG_CURRENT_DESKTOP` internally to `Unity`, and stored the original name of the desktop session
|
||||
in a separate variable. `XDG_CURRENT_DESKTOP` is no longer overriden and now reflects the actual desktop environment.
|
||||
in a separate variable. `XDG_CURRENT_DESKTOP` is no longer overridden and now reflects the actual desktop environment.
|
||||
|
||||
### Removed: macOS 11 support
|
||||
|
||||
@@ -149,7 +149,7 @@ window is not currently visible.
|
||||
|
||||
`app.commandLine` was only meant to handle chromium switches (which aren't case-sensitive) and switches passed via `app.commandLine` will not be passed down to any of the child processes.
|
||||
|
||||
If you were using `app.commandLine` to control the behavior of the main process, you should do this via `process.argv`.
|
||||
If you were using `app.commandLine` to control the behavior of the main process, you should do this via `process.argv`.
|
||||
|
||||
### Deprecated: `NativeImage.getBitmap()`
|
||||
|
||||
@@ -179,7 +179,7 @@ from upstream Chromium.
|
||||
### Deprecated: `null` value for `session` property in `ProtocolResponse`
|
||||
|
||||
Previously, setting the ProtocolResponse.session property to `null`
|
||||
Would create a random independent session. This is no longer supported.
|
||||
would create a random independent session. This is no longer supported.
|
||||
|
||||
Using single-purpose sessions here is discouraged due to overhead costs;
|
||||
however, old code that needs to preserve this behavior can emulate it by
|
||||
@@ -190,7 +190,7 @@ and then using it in `ProtocolResponse.session`.
|
||||
|
||||
When calling `Session.clearStorageData(options)`, the `options.quota`
|
||||
property is deprecated. Since the `syncable` type was removed, there
|
||||
is only type left -- `'temporary'` -- so specifying it is unnecessary.
|
||||
is only one type left -- `'temporary'` -- so specifying it is unnecessary.
|
||||
|
||||
### Deprecated: Extension methods and events on `session`
|
||||
|
||||
@@ -519,7 +519,7 @@ more information.
|
||||
|
||||
### Removed: The `--disable-color-correct-rendering` switch
|
||||
|
||||
This switch was never formally documented but it's removal is being noted here regardless. Chromium itself now has better support for color spaces so this flag should not be needed.
|
||||
This switch was never formally documented but its removal is being noted here regardless. Chromium itself now has better support for color spaces so this flag should not be needed.
|
||||
|
||||
### Behavior Changed: `BrowserView.setAutoResize` behavior on macOS
|
||||
|
||||
@@ -1210,7 +1210,7 @@ more details.
|
||||
|
||||
### API Changed: `webContents.printToPDF()`
|
||||
|
||||
`webContents.printToPDF()` has been modified to conform to [`Page.printToPDF`](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF) in the Chrome DevTools Protocol. This has been changes in order to
|
||||
`webContents.printToPDF()` has been modified to conform to [`Page.printToPDF`](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF) in the Chrome DevTools Protocol. This has been changed in order to
|
||||
address changes upstream that made our previous implementation untenable and rife with bugs.
|
||||
|
||||
**Arguments Changed**
|
||||
|
||||
@@ -40,7 +40,7 @@ If you are on arm64 architecture, the build script may be pointing to the wrong
|
||||
|
||||
### Certificates fail to verify
|
||||
|
||||
installing [`certifi`](https://pypi.org/project/certifi/) will fix the following error:
|
||||
Installing [`certifi`](https://pypi.org/project/certifi/) will fix the following error:
|
||||
|
||||
```sh
|
||||
________ running 'python3 src/tools/clang/scripts/update.py' in '/Users/<user>/electron'
|
||||
|
||||
@@ -28,7 +28,7 @@ with breakpoints inside Electron's source code.
|
||||
format.
|
||||
|
||||
* **ProcMon**: The [free SysInternals tool][sys-internals] allows you to inspect
|
||||
a processes parameters, file handles, and registry operations.
|
||||
a process's parameters, file handles, and registry operations.
|
||||
|
||||
## Attaching to and Debugging Electron
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ control via the [`DEPS`](https://github.com/electron/electron/blob/main/DEPS) fi
|
||||
[initializing a local Electron checkout](./build-instructions-gn.md), Electron's source code is just one
|
||||
of many nested folders within the project root.
|
||||
|
||||
The project contains a single `src` folder that corresponds a specific git checkout of
|
||||
The project contains a single `src` folder that corresponds to a specific git checkout of
|
||||
[Chromium's `src` folder](https://source.chromium.org/chromium/chromium/src). In addition, Electron's
|
||||
repository code is contained in `src/electron` (with its own nested git repository), and other
|
||||
Electron-specific third-party dependencies (e.g. [nan](https://github.com/nodejs/nan) or
|
||||
|
||||
@@ -17,7 +17,7 @@ style, run `npm run lint`, which will run a variety of linting checks
|
||||
against your changes depending on which areas of the code they touch.
|
||||
|
||||
Many of these checks are included as precommit hooks, so it's likely
|
||||
you error would be caught at commit time.
|
||||
your error would be caught at commit time.
|
||||
|
||||
## Unit Tests
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ dependency tree from `node_modules`).
|
||||
|
||||
### ASAR integrity
|
||||
|
||||
ASAR integrity is an security feature that validates the contents of your app's
|
||||
ASAR integrity is a security feature that validates the contents of your app's
|
||||
ASAR archives at runtime. When enabled, your Electron app will verify the
|
||||
header hash of its ASAR archive on runtime. If no hash is present or if there is a mismatch in the
|
||||
hashes, the app will forcefully terminate.
|
||||
@@ -137,9 +137,9 @@ See also: [code signing](#code-signing)
|
||||
|
||||
### OSR
|
||||
|
||||
OSR (offscreen rendering) can be used for loading heavy page in
|
||||
OSR (offscreen rendering) can be used for loading a heavy page in
|
||||
background and then displaying it after (it will be much faster).
|
||||
It allows you to render page without showing it on screen.
|
||||
It allows you to render a page without showing it on screen.
|
||||
|
||||
For more information, read the [Offscreen Rendering][] tutorial.
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ const msiCreator = new MSICreator({
|
||||
const supportBinaries = await msiCreator.create()
|
||||
|
||||
// 🆕 Step 2a: optionally sign support binaries if you
|
||||
// sign you binaries as part of of your packaging script
|
||||
// sign your binaries as part of your packaging script
|
||||
for (const binary of supportBinaries) {
|
||||
// Binaries are the new stub executable and optionally
|
||||
// the Squirrel auto updater.
|
||||
|
||||
@@ -14,7 +14,7 @@ _Notes_:
|
||||
* There are two rendering modes that can be used (see the section below) and only
|
||||
the dirty area is passed to the `paint` event to be more efficient.
|
||||
* You can stop/continue the rendering as well as set the frame rate.
|
||||
* When `webPreferences.offscreen.useSharedTexture` is not `true`, the maximum frame rate is 240 because greater values bring only performance
|
||||
* When `webPreferences.offscreen.useSharedTexture` is `false`, the maximum frame rate is 240 because greater values bring only performance
|
||||
losses with no benefits.
|
||||
* When nothing is happening on a webpage, no frames are generated.
|
||||
* An offscreen window is always created as a
|
||||
|
||||
@@ -30,7 +30,7 @@ If you want to focus on building a great product without debugging a weird quirk
|
||||
|
||||
Whatever provider or customer data you need to interact with, they will have probably thought of an integration path with the web. Depending on your technology choice, embedding a YouTube video either takes 30 seconds or requires you to hire a team devoted to streaming and hardware-accelerated video decoding. In the case of YouTube, using anything other than the provided players is actually against their terms and conditions, so you’ll likely embed a browser frame before you implement your own video streaming decoder.
|
||||
|
||||
There will be virtually no platform where your app cannot run if you build it with web technologies. Virtually all devices with a display—be that an ATM, a car infotainment system, a smart TV, a fridge, or a Nintendo Switch—come with means to display web technologies. The web is safe bet if you want to be cross-platform.
|
||||
There will be virtually no platform where your app cannot run if you build it with web technologies. Virtually all devices with a display—be that an ATM, a car infotainment system, a smart TV, a fridge, or a Nintendo Switch—come with means to display web technologies. The web is a safe bet if you want to be cross-platform.
|
||||
|
||||
### Ubiquity
|
||||
|
||||
@@ -59,7 +59,7 @@ What does all of that mean for you, a developer, in practice?
|
||||
|
||||
### Stability, security, performance
|
||||
|
||||
Electron delivers the best experience on all target platforms (macOS, Windows, Linux) by bundling the latest version of Chromium, V8, and Node.js directly with the application binary. When it comes to running and rendering web content with upmost stability, security, and performance, we currently believe that stack to be “best in class”.
|
||||
Electron delivers the best experience on all target platforms (macOS, Windows, Linux) by bundling the latest version of Chromium, V8, and Node.js directly with the application binary. When it comes to running and rendering web content with utmost stability, security, and performance, we currently believe that stack to be “best in class”.
|
||||
|
||||
#### Why bundle anything at all
|
||||
|
||||
|
||||
@@ -277,6 +277,8 @@ filenames = {
|
||||
"shell/browser/api/electron_api_in_app_purchase.h",
|
||||
"shell/browser/api/electron_api_menu.cc",
|
||||
"shell/browser/api/electron_api_menu.h",
|
||||
"shell/browser/api/electron_api_msix_updater.cc",
|
||||
"shell/browser/api/electron_api_msix_updater.h",
|
||||
"shell/browser/api/electron_api_native_theme.cc",
|
||||
"shell/browser/api/electron_api_native_theme.h",
|
||||
"shell/browser/api/electron_api_net_log.cc",
|
||||
|
||||
@@ -353,6 +353,7 @@ export function shouldOverrideCheckStatus (role: RoleId) {
|
||||
|
||||
export function getDefaultAccelerator (role: RoleId) {
|
||||
if (hasRole(role)) return roleList[role].accelerator;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function shouldRegisterAccelerator (role: RoleId) {
|
||||
|
||||
@@ -25,7 +25,7 @@ const MenuItem = function (this: any, options: any) {
|
||||
|
||||
this.overrideReadOnlyProperty('type', roles.getDefaultType(this.role));
|
||||
this.overrideReadOnlyProperty('role');
|
||||
this.overrideReadOnlyProperty('accelerator');
|
||||
this.overrideReadOnlyProperty('accelerator', roles.getDefaultAccelerator(this.role));
|
||||
this.overrideReadOnlyProperty('icon');
|
||||
this.overrideReadOnlyProperty('submenu');
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ Subject: feat: configure launch options for service process
|
||||
Allows configuring base::LaunchOptions::handles_to_inherit, base::LaunchOptions::stdout_handle,
|
||||
base::LaunchOptions::stderr_handle and base::LaunchOptions::feedback_cursor_off when launching
|
||||
the child process.
|
||||
- Mac:
|
||||
Allows configuring base::LaunchOptions::disclaim_responsibility when launching the child process.
|
||||
- All:
|
||||
Allows configuring base::LauncOptions::current_directory, base::LaunchOptions::enviroment
|
||||
and base::LaunchOptions::clear_environment.
|
||||
@@ -165,10 +167,10 @@ index 0791b5317fc6846389f65f93734ae5e816d04623..71df2459fd759a75be573449accd3a4d
|
||||
FinishStartSandboxedProcessOnLauncherThread,
|
||||
this));
|
||||
diff --git a/content/browser/service_host/service_process_host_impl.cc b/content/browser/service_host/service_process_host_impl.cc
|
||||
index d9c14f91747bde0e76056d7f2f2ada166e67f994..53be16879777a3b9bef58ead5f7e420c1bf6acbe 100644
|
||||
index d9c14f91747bde0e76056d7f2f2ada166e67f994..09335acac17f526fb8d8e42e4b2d993b11045786 100644
|
||||
--- a/content/browser/service_host/service_process_host_impl.cc
|
||||
+++ b/content/browser/service_host/service_process_host_impl.cc
|
||||
@@ -69,6 +69,17 @@ void LaunchServiceProcess(mojo::GenericPendingReceiver receiver,
|
||||
@@ -69,6 +69,21 @@ void LaunchServiceProcess(mojo::GenericPendingReceiver receiver,
|
||||
utility_options.WithGpuClientAllowed();
|
||||
}
|
||||
|
||||
@@ -179,6 +181,10 @@ index d9c14f91747bde0e76056d7f2f2ada166e67f994..53be16879777a3b9bef58ead5f7e420c
|
||||
+#elif BUILDFLAG(IS_POSIX)
|
||||
+ utility_options.WithAdditionalFds(std::move(service_options.fds_to_remap));
|
||||
+#endif
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+ utility_options.WithDisclaimResponsibility(
|
||||
+ service_options.disclaim_responsibility);
|
||||
+#endif
|
||||
+ utility_options.WithCurrentDirectory(service_options.current_directory);
|
||||
+ utility_options.WithEnvironment(service_options.environment,
|
||||
+ service_options.clear_environment);
|
||||
@@ -187,7 +193,7 @@ index d9c14f91747bde0e76056d7f2f2ada166e67f994..53be16879777a3b9bef58ead5f7e420c
|
||||
|
||||
UtilityProcessHost::Start(std::move(utility_options),
|
||||
diff --git a/content/browser/service_host/utility_process_host.cc b/content/browser/service_host/utility_process_host.cc
|
||||
index c798b3394db7638e38613a016c2dbb0bfcf54d03..1298ea85a176db2150a4101afc205745f32eb8f5 100644
|
||||
index c798b3394db7638e38613a016c2dbb0bfcf54d03..e90c8a9b2ac7d17fe7e5e814fd6eb3333f440bbe 100644
|
||||
--- a/content/browser/service_host/utility_process_host.cc
|
||||
+++ b/content/browser/service_host/utility_process_host.cc
|
||||
@@ -241,13 +241,13 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithFileToPreload(
|
||||
@@ -207,7 +213,7 @@ index c798b3394db7638e38613a016c2dbb0bfcf54d03..1298ea85a176db2150a4101afc205745
|
||||
|
||||
#if BUILDFLAG(USE_ZYGOTE)
|
||||
UtilityProcessHost::Options& UtilityProcessHost::Options::WithZygoteForTesting(
|
||||
@@ -257,6 +257,36 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithZygoteForTesting(
|
||||
@@ -257,6 +257,45 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithZygoteForTesting(
|
||||
}
|
||||
#endif // BUILDFLAG(USE_ZYGOTE)
|
||||
|
||||
@@ -240,11 +246,20 @@ index c798b3394db7638e38613a016c2dbb0bfcf54d03..1298ea85a176db2150a4101afc205745
|
||||
+ return *this;
|
||||
+}
|
||||
+#endif // BUILDFLAG(IS_WIN)
|
||||
+
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+UtilityProcessHost::Options&
|
||||
+UtilityProcessHost::Options::WithDisclaimResponsibility(
|
||||
+ bool disclaim_responsibility) {
|
||||
+ disclaim_responsibility_ = disclaim_responsibility;
|
||||
+ return *this;
|
||||
+}
|
||||
+#endif // BUILDFLAG(IS_MAC)
|
||||
+
|
||||
UtilityProcessHost::Options&
|
||||
UtilityProcessHost::Options::WithBoundReceiverOnChildProcessForTesting(
|
||||
mojo::GenericPendingReceiver receiver) {
|
||||
@@ -520,9 +550,26 @@ bool UtilityProcessHost::StartProcess() {
|
||||
@@ -520,9 +559,30 @@ bool UtilityProcessHost::StartProcess() {
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_GPU_CHANNEL_MEDIA_CAPTURE) && !BUILDFLAG(IS_WIN)
|
||||
|
||||
@@ -269,11 +284,15 @@ index c798b3394db7638e38613a016c2dbb0bfcf54d03..1298ea85a176db2150a4101afc205745
|
||||
+#if BUILDFLAG(IS_WIN)
|
||||
+ delegate->SetFeedbackCursorOff(options_.feedback_cursor_off_);
|
||||
+#endif // BUILDFLAG(IS_WIN)
|
||||
+
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+ delegate->SetDisclaimResponsibility(options_.disclaim_responsibility_);
|
||||
+#endif // BUILDFLAG(IS_MAC)
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
if (!options_.preload_libraries_.empty()) {
|
||||
diff --git a/content/browser/service_host/utility_process_host.h b/content/browser/service_host/utility_process_host.h
|
||||
index dfdcb66d65f07f4543703396eb529a6ec02b3f4a..d731211d727f6e96533a058106c13f339263712d 100644
|
||||
index dfdcb66d65f07f4543703396eb529a6ec02b3f4a..96c0cadf5caf5bf27f2a767c43f0f1da04298800 100644
|
||||
--- a/content/browser/service_host/utility_process_host.h
|
||||
+++ b/content/browser/service_host/utility_process_host.h
|
||||
@@ -30,6 +30,7 @@
|
||||
@@ -284,7 +303,7 @@ index dfdcb66d65f07f4543703396eb529a6ec02b3f4a..d731211d727f6e96533a058106c13f33
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
namespace base {
|
||||
@@ -133,14 +134,31 @@ class CONTENT_EXPORT UtilityProcessHost final
|
||||
@@ -133,14 +134,36 @@ class CONTENT_EXPORT UtilityProcessHost final
|
||||
std::variant<base::FilePath, base::ScopedFD> file);
|
||||
#endif
|
||||
|
||||
@@ -315,11 +334,16 @@ index dfdcb66d65f07f4543703396eb529a6ec02b3f4a..d731211d727f6e96533a058106c13f33
|
||||
+ // Specifies if the process should trigger mouse cursor feedback.
|
||||
+ Options& WithFeedbackCursorOff(bool feedback_cursor_off);
|
||||
+#endif // BUILDFLAG(IS_WIN)
|
||||
+
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+ // Specifies if the process should disclaim TCC responsibility.
|
||||
+ Options& WithDisclaimResponsibility(bool disclaim_responsibility);
|
||||
+#endif // BUILDFLAG(IS_MAC)
|
||||
+
|
||||
// Requests that the process bind a receiving pipe targeting the interface
|
||||
// named by `receiver`. Calls to this method generally end up in
|
||||
// `ChildThreadImpl::OnBindReceiver()` and the option is used for testing
|
||||
@@ -184,6 +202,27 @@ class CONTENT_EXPORT UtilityProcessHost final
|
||||
@@ -184,6 +207,32 @@ class CONTENT_EXPORT UtilityProcessHost final
|
||||
std::optional<raw_ptr<ZygoteCommunication>> zygote_for_testing_;
|
||||
#endif // BUILDFLAG(USE_ZYGOTE)
|
||||
|
||||
@@ -343,12 +367,17 @@ index dfdcb66d65f07f4543703396eb529a6ec02b3f4a..d731211d727f6e96533a058106c13f33
|
||||
+ // Specifies if the process should trigger mouse cursor feedback.
|
||||
+ bool feedback_cursor_off_ = false;
|
||||
+#endif // BUILDFLAG(IS_WIN)
|
||||
+
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+ // Specifies if the process should disclaim TCC responsibility.
|
||||
+ bool disclaim_responsibility_ = false;
|
||||
+#endif // BUILDFLAG(IS_MAC)
|
||||
+
|
||||
#if BUILDFLAG(ENABLE_GPU_CHANNEL_MEDIA_CAPTURE)
|
||||
// Whether or not to bind viz::mojom::Gpu to the utility process.
|
||||
bool allowed_gpu_;
|
||||
diff --git a/content/browser/service_host/utility_sandbox_delegate.cc b/content/browser/service_host/utility_sandbox_delegate.cc
|
||||
index ada7034c8926c276ea1c7ebf8242c61b0a993c39..b852d40936f1e876681a00f2eb57c9077a086a1d 100644
|
||||
index ada7034c8926c276ea1c7ebf8242c61b0a993c39..aec3de8bd0c18666b33147779cad68c6b41fe1fe 100644
|
||||
--- a/content/browser/service_host/utility_sandbox_delegate.cc
|
||||
+++ b/content/browser/service_host/utility_sandbox_delegate.cc
|
||||
@@ -39,17 +39,19 @@ UtilitySandboxedProcessLauncherDelegate::
|
||||
@@ -406,8 +435,24 @@ index ada7034c8926c276ea1c7ebf8242c61b0a993c39..b852d40936f1e876681a00f2eb57c907
|
||||
|
||||
#if BUILDFLAG(USE_ZYGOTE)
|
||||
ZygoteCommunication* UtilitySandboxedProcessLauncherDelegate::GetZygote() {
|
||||
@@ -189,6 +208,15 @@ UtilitySandboxedProcessLauncherDelegate::GetProcessRequirement() {
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
+
|
||||
+void UtilitySandboxedProcessLauncherDelegate::SetDisclaimResponsibility(
|
||||
+ bool disclaim_responsibility) {
|
||||
+ disclaim_responsibility_ = disclaim_responsibility;
|
||||
+}
|
||||
+
|
||||
+bool UtilitySandboxedProcessLauncherDelegate::DisclaimResponsibility() {
|
||||
+ return disclaim_responsibility_;
|
||||
+}
|
||||
#endif // BUILDFLAG(IS_MAC)
|
||||
|
||||
} // namespace content
|
||||
diff --git a/content/browser/service_host/utility_sandbox_delegate.h b/content/browser/service_host/utility_sandbox_delegate.h
|
||||
index f2e8c1d62c1cb1677f618b584ed401685b03034b..7c47ec471e4676365cf3e023808983cb3e7a18d0 100644
|
||||
index f2e8c1d62c1cb1677f618b584ed401685b03034b..00a20885092bd299e817685dd18c3971b25f721b 100644
|
||||
--- a/content/browser/service_host/utility_sandbox_delegate.h
|
||||
+++ b/content/browser/service_host/utility_sandbox_delegate.h
|
||||
@@ -36,7 +36,9 @@ class CONTENT_EXPORT UtilitySandboxedProcessLauncherDelegate
|
||||
@@ -438,7 +483,12 @@ index f2e8c1d62c1cb1677f618b584ed401685b03034b..7c47ec471e4676365cf3e023808983cb
|
||||
|
||||
#if BUILDFLAG(USE_ZYGOTE)
|
||||
void SetZygote(ZygoteCommunication* handle);
|
||||
@@ -77,9 +84,7 @@ class CONTENT_EXPORT UtilitySandboxedProcessLauncherDelegate
|
||||
@@ -74,12 +81,12 @@ class CONTENT_EXPORT UtilitySandboxedProcessLauncherDelegate
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
std::optional<base::mac::ProcessRequirement> GetProcessRequirement() override;
|
||||
+ void SetDisclaimResponsibility(bool disclaim_responsibility);
|
||||
+ bool DisclaimResponsibility() override;
|
||||
#endif // BUILDFLAG(IS_MAC)
|
||||
|
||||
private:
|
||||
@@ -448,7 +498,7 @@ index f2e8c1d62c1cb1677f618b584ed401685b03034b..7c47ec471e4676365cf3e023808983cb
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Adds preload-libraries to the delegate blob for utility_main() to access
|
||||
@@ -95,12 +100,17 @@ class CONTENT_EXPORT UtilitySandboxedProcessLauncherDelegate
|
||||
@@ -95,12 +102,20 @@ class CONTENT_EXPORT UtilitySandboxedProcessLauncherDelegate
|
||||
std::optional<raw_ptr<ZygoteCommunication>> zygote_;
|
||||
#endif // BUILDFLAG(USE_ZYGOTE)
|
||||
|
||||
@@ -463,6 +513,9 @@ index f2e8c1d62c1cb1677f618b584ed401685b03034b..7c47ec471e4676365cf3e023808983cb
|
||||
+#if BUILDFLAG(IS_WIN)
|
||||
+ bool feedback_cursor_off_ = false;
|
||||
+#endif // BUILDFLAG(IS_WIN)
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+ bool disclaim_responsibility_ = false;
|
||||
+#endif // BUILDFLAG(IS_MAC)
|
||||
};
|
||||
} // namespace content
|
||||
|
||||
@@ -489,10 +542,10 @@ index 39c96d4423b24695eee86353057cfeed19318b57..31b343d97b7672294644041c9bb1a4cd
|
||||
}
|
||||
|
||||
diff --git a/content/public/browser/service_process_host.cc b/content/public/browser/service_process_host.cc
|
||||
index d1bc550a891979e2d41d8d5b18a2f9287468e460..5fcac7a8493e5065f80303067a04f59e7c4509ef 100644
|
||||
index d1bc550a891979e2d41d8d5b18a2f9287468e460..5d255f628788bc8b40d8df0039b08c06ffec8730 100644
|
||||
--- a/content/public/browser/service_process_host.cc
|
||||
+++ b/content/public/browser/service_process_host.cc
|
||||
@@ -53,12 +53,53 @@ ServiceProcessHost::Options::WithExtraCommandLineSwitches(
|
||||
@@ -53,12 +53,62 @@ ServiceProcessHost::Options::WithExtraCommandLineSwitches(
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -542,12 +595,21 @@ index d1bc550a891979e2d41d8d5b18a2f9287468e460..5fcac7a8493e5065f80303067a04f59e
|
||||
+ return *this;
|
||||
+}
|
||||
+#endif // #if BUILDFLAG(IS_WIN)
|
||||
+
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+ServiceProcessHost::Options&
|
||||
+ServiceProcessHost::Options::WithDisclaimResponsibility(
|
||||
+ bool should_disclaim_responsibility) {
|
||||
+ disclaim_responsibility = should_disclaim_responsibility;
|
||||
+ return *this;
|
||||
+}
|
||||
+#endif // BUILDFLAG(IS_MAC)
|
||||
+
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
ServiceProcessHost::Options&
|
||||
ServiceProcessHost::Options::WithPreloadedLibraries(
|
||||
diff --git a/content/public/browser/service_process_host.h b/content/public/browser/service_process_host.h
|
||||
index 0062d2cb6634b8b29977a0312516b1b13936b40a..611a52e908f4cb70fbe5628e220a082e45320b70 100644
|
||||
index 0062d2cb6634b8b29977a0312516b1b13936b40a..888ff36d70c83010f1f45e9eeb2dd6b573158db5 100644
|
||||
--- a/content/public/browser/service_process_host.h
|
||||
+++ b/content/public/browser/service_process_host.h
|
||||
@@ -14,6 +14,7 @@
|
||||
@@ -569,7 +631,7 @@ index 0062d2cb6634b8b29977a0312516b1b13936b40a..611a52e908f4cb70fbe5628e220a082e
|
||||
namespace base {
|
||||
class Process;
|
||||
} // namespace base
|
||||
@@ -94,11 +99,35 @@ class CONTENT_EXPORT ServiceProcessHost {
|
||||
@@ -94,11 +99,40 @@ class CONTENT_EXPORT ServiceProcessHost {
|
||||
// Specifies extra command line switches to append before launch.
|
||||
Options& WithExtraCommandLineSwitches(std::vector<std::string> switches);
|
||||
|
||||
@@ -601,11 +663,16 @@ index 0062d2cb6634b8b29977a0312516b1b13936b40a..611a52e908f4cb70fbe5628e220a082e
|
||||
+ // Specifies if the process should trigger mouse cursor feedback.
|
||||
+ Options& WithFeedbackCursorOff(bool feedback_cursor_off);
|
||||
+#endif // #if BUILDFLAG(IS_WIN)
|
||||
+
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+ // Specifies if the process should disclaim TCC responsibility.
|
||||
+ Options& WithDisclaimResponsibility(bool disclaim_responsibility);
|
||||
+#endif // BUILDFLAG(IS_MAC)
|
||||
+
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Specifies libraries to preload before the sandbox is locked down. Paths
|
||||
// should be absolute paths. Libraries will be preloaded before sandbox
|
||||
@@ -127,11 +156,23 @@ class CONTENT_EXPORT ServiceProcessHost {
|
||||
@@ -127,11 +161,26 @@ class CONTENT_EXPORT ServiceProcessHost {
|
||||
std::optional<GURL> site;
|
||||
std::optional<int> child_flags;
|
||||
std::vector<std::string> extra_switches;
|
||||
@@ -626,6 +693,9 @@ index 0062d2cb6634b8b29977a0312516b1b13936b40a..611a52e908f4cb70fbe5628e220a082e
|
||||
+#if BUILDFLAG(IS_WIN)
|
||||
+ bool feedback_cursor_off = false;
|
||||
+#endif // BUILDFLAG(IS_WIN)
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+ bool disclaim_responsibility = false;
|
||||
+#endif // BUILDFLAG(IS_MAC)
|
||||
};
|
||||
|
||||
// An interface which can be implemented and registered/unregistered with
|
||||
|
||||
@@ -84,10 +84,10 @@ index 2648adb1cf38ab557b66ffd0e3034b26b04d76d6..98eab587f343f6ca472efc3d4e7b31b2
|
||||
private:
|
||||
const std::string service_interface_name_;
|
||||
diff --git a/content/browser/service_host/utility_process_host.cc b/content/browser/service_host/utility_process_host.cc
|
||||
index 1298ea85a176db2150a4101afc205745f32eb8f5..1668345fb66b5a150b01dc3cce2e7262890a9c66 100644
|
||||
index e90c8a9b2ac7d17fe7e5e814fd6eb3333f440bbe..4e11fbf6b5489acc212256fbedc1b9b2d627f7e4 100644
|
||||
--- a/content/browser/service_host/utility_process_host.cc
|
||||
+++ b/content/browser/service_host/utility_process_host.cc
|
||||
@@ -624,7 +624,7 @@ void UtilityProcessHost::OnProcessCrashed(int exit_code) {
|
||||
@@ -637,7 +637,7 @@ void UtilityProcessHost::OnProcessCrashed(int exit_code) {
|
||||
: Client::CrashType::kPreIpcInitialization;
|
||||
}
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
@@ -97,7 +97,7 @@ index 1298ea85a176db2150a4101afc205745f32eb8f5..1668345fb66b5a150b01dc3cce2e7262
|
||||
|
||||
std::optional<std::string> UtilityProcessHost::GetServiceName() {
|
||||
diff --git a/content/browser/service_host/utility_process_host.h b/content/browser/service_host/utility_process_host.h
|
||||
index d731211d727f6e96533a058106c13f339263712d..19e35a0684746d6f5703ac4237de4d8aeddbaa4e 100644
|
||||
index 96c0cadf5caf5bf27f2a767c43f0f1da04298800..5a16fe5c01ae7777064168e8883ec8ec0b82a873 100644
|
||||
--- a/content/browser/service_host/utility_process_host.h
|
||||
+++ b/content/browser/service_host/utility_process_host.h
|
||||
@@ -87,7 +87,7 @@ class CONTENT_EXPORT UtilityProcessHost final
|
||||
|
||||
@@ -28,10 +28,10 @@ The patch should be removed in favor of either:
|
||||
Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397.
|
||||
|
||||
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
|
||||
index 9bdb7c10319be5a6e715a34b29491a06ffe782b1..93e702df43d4c576443cd3efbf9127db2a00693e 100644
|
||||
index a020aa1ddc8ba7f5ecf5a376d00817f7fc61db40..23db0d047187a95cb401629a42fa3baaaf0feb12 100644
|
||||
--- a/content/browser/renderer_host/navigation_request.cc
|
||||
+++ b/content/browser/renderer_host/navigation_request.cc
|
||||
@@ -11514,6 +11514,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() {
|
||||
@@ -11515,6 +11515,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() {
|
||||
target_rph_id);
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ index 419a051968c58ae5a761708e4d942e8975c70852..a77032dd43f5fcbe29c54b622b34607f
|
||||
|
||||
} // namespace base::mac
|
||||
diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc
|
||||
index b63d58da9837ba4d1e4aff8f24f2cd977c5ed02d..8387fd7d2bcf8951b6cc024829c16d970799190c 100644
|
||||
index b63d58da9837ba4d1e4aff8f24f2cd977c5ed02d..49b4c0b69731386ef5a4b7dfb782aa8f4ae09cdd 100644
|
||||
--- a/base/process/launch_mac.cc
|
||||
+++ b/base/process/launch_mac.cc
|
||||
@@ -84,6 +84,10 @@ int posix_spawnattr_set_csm_np(const posix_spawnattr_t*, uint32_t)
|
||||
@@ -181,15 +181,26 @@ index b63d58da9837ba4d1e4aff8f24f2cd977c5ed02d..8387fd7d2bcf8951b6cc024829c16d97
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -301,7 +321,7 @@ Process LaunchProcess(const std::vector<std::string>& argv,
|
||||
@@ -301,16 +321,16 @@ Process LaunchProcess(const std::vector<std::string>& argv,
|
||||
file_actions.Inherit(STDERR_FILENO);
|
||||
}
|
||||
|
||||
-#if BUILDFLAG(IS_MAC)
|
||||
+#if 0
|
||||
+#if !IS_MAS_BUILD()
|
||||
if (options.disclaim_responsibility) {
|
||||
DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1));
|
||||
}
|
||||
+#endif
|
||||
|
||||
EnvironmentMap new_environment_map = options.environment;
|
||||
+#if !IS_MAS_BUILD()
|
||||
MachPortRendezvousServerMac::AddFeatureStateToEnvironment(
|
||||
new_environment_map);
|
||||
-#else
|
||||
- const EnvironmentMap& new_environment_map = options.environment;
|
||||
#endif
|
||||
|
||||
std::vector<char*> argv_cstr;
|
||||
diff --git a/base/process/process_info_mac.mm b/base/process/process_info_mac.mm
|
||||
index e12c1d078147d956a1d9b1bc498c1b1d6fe7b974..233362259dc4e728ed37435e650417647b45a6af 100644
|
||||
--- a/base/process/process_info_mac.mm
|
||||
|
||||
@@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't
|
||||
necessary.
|
||||
|
||||
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json
|
||||
index d326724f7c20983cfe9ec268444028eadd571f71..346eba0c5c5b8e6ffc61a2b00586158b78134c43 100644
|
||||
index 59c516ca84b3e4a5e354fae624a30ef897e2a078..16e5c2f07c0c3f1abbb12496a514f37901d6723a 100644
|
||||
--- a/testing/variations/fieldtrial_testing_config.json
|
||||
+++ b/testing/variations/fieldtrial_testing_config.json
|
||||
@@ -25873,6 +25873,21 @@
|
||||
@@ -25896,6 +25896,21 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -36,10 +36,10 @@ fix_redefined_macos_sdk_header_symbols.patch
|
||||
fix_allow_disabling_fetch_in_renderer_and_worker_processes.patch
|
||||
feat_disable_js_source_phase_imports_by_default.patch
|
||||
fix_avoid_external_memory_leak_on_invalid_tls_protocol_versions.patch
|
||||
lib_check_sharedarraybuffer_existence_in_fast-utf8-stream.patch
|
||||
api_delete_deprecated_fields_on_v8_isolate.patch
|
||||
api_promote_deprecation_of_v8_context_and_v8_object_api_methods.patch
|
||||
src_use_cp_utf8_for_wide_file_names_on_win32.patch
|
||||
fix_ensure_traverseparent_bails_on_resource_path_exit.patch
|
||||
reland_temporal_unflag_temporal.patch
|
||||
src_handle_der_decoding_errors_from_system_certificates.patch
|
||||
build_restore_macos_deployment_target_to_12_0.patch
|
||||
test_make_buffer_sizes_32bit-aware_in.patch
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: Delete deprecated fields on v8::Isolate
|
||||
https://chromium-review.googlesource.com/c/v8/v8/+/7081397
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index ea3e9374c30be92ba5668e33773ffbb2aef55b30..44ba3c42c7a980eee19e1aadcbe7999eefeda989 100644
|
||||
index cfc9b3157d08d62f43e2e5bb01229fe663f3ca61..cce0e1cdc37aa324aa2c52ba134fc1a9a55b10ba 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -231,8 +231,6 @@ void SetIsolateCreateParamsForNode(Isolate::CreateParams* params) {
|
||||
@@ -218,8 +218,6 @@ void SetIsolateCreateParamsForNode(Isolate::CreateParams* params) {
|
||||
// heap based on the actual physical memory.
|
||||
params->constraints.ConfigureDefaults(total_memory, 0);
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ index 37d83e41b618a07aca98118260abe9618f11256d..26d5c1bd3c8191fce1d22b969996b6bf
|
||||
|
||||
template <typename T>
|
||||
diff --git a/src/env-inl.h b/src/env-inl.h
|
||||
index 5dfbd564d5bbd22ebf3b529a07b73e85cbe51986..b0c3c52cab63c6ae67079aa752bd58dd4f162451 100644
|
||||
index 97c43afb487b58c0c77bd59b4a6b6d7a13690053..23a4d7b651935a4029249fb2f1dd3ed46ea3b26f 100644
|
||||
--- a/src/env-inl.h
|
||||
+++ b/src/env-inl.h
|
||||
@@ -199,7 +199,8 @@ inline Environment* Environment::GetCurrent(v8::Local<v8::Context> context) {
|
||||
@@ -189,7 +189,8 @@ inline Environment* Environment::GetCurrent(v8::Local<v8::Context> context) {
|
||||
}
|
||||
return static_cast<Environment*>(
|
||||
context->GetAlignedPointerFromEmbedderData(
|
||||
|
||||
@@ -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 451796ffc4ec93b6e317dd49d92070c61aca04e5..ea3e9374c30be92ba5668e33773ffbb2aef55b30 100644
|
||||
index d753ad6c6b49b26b86920124f7ac90c1e052638e..cfc9b3157d08d62f43e2e5bb01229fe663f3ca61 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -687,7 +687,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
|
||||
@@ -668,7 +668,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
|
||||
|
||||
MaybeLocal<Object> GetPerContextExports(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
@@ -18,7 +18,7 @@ index 451796ffc4ec93b6e317dd49d92070c61aca04e5..ea3e9374c30be92ba5668e33773ffbb2
|
||||
EscapableHandleScope handle_scope(isolate);
|
||||
|
||||
Local<Object> global = context->Global();
|
||||
@@ -733,7 +733,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) {
|
||||
@@ -714,7 +714,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 451796ffc4ec93b6e317dd49d92070c61aca04e5..ea3e9374c30be92ba5668e33773ffbb2
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
// When `IsCodeGenerationFromStringsAllowed` is true, V8 takes the fast path
|
||||
@@ -812,7 +812,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
|
||||
@@ -793,7 +793,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
|
||||
}
|
||||
|
||||
Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
|
||||
@@ -36,7 +36,7 @@ index 451796ffc4ec93b6e317dd49d92070c61aca04e5..ea3e9374c30be92ba5668e33773ffbb2
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
// Delete `Intl.v8BreakIterator`
|
||||
@@ -837,7 +837,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
|
||||
@@ -818,7 +818,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
|
||||
}
|
||||
|
||||
Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
|
||||
@@ -45,7 +45,7 @@ index 451796ffc4ec93b6e317dd49d92070c61aca04e5..ea3e9374c30be92ba5668e33773ffbb2
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
// Initialize the default values.
|
||||
@@ -855,7 +855,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
|
||||
@@ -836,7 +836,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
|
||||
MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
CHECK(isolate_data);
|
||||
@@ -54,7 +54,7 @@ index 451796ffc4ec93b6e317dd49d92070c61aca04e5..ea3e9374c30be92ba5668e33773ffbb2
|
||||
EscapableHandleScope scope(isolate);
|
||||
Context::Scope context_scope(context);
|
||||
|
||||
@@ -879,7 +879,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
|
||||
@@ -860,7 +860,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
|
||||
MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
CHECK(isolate_data);
|
||||
@@ -63,7 +63,7 @@ index 451796ffc4ec93b6e317dd49d92070c61aca04e5..ea3e9374c30be92ba5668e33773ffbb2
|
||||
EscapableHandleScope scope(isolate);
|
||||
Context::Scope context_scope(context);
|
||||
|
||||
@@ -905,7 +905,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
|
||||
@@ -886,7 +886,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
|
||||
Maybe<void> InitializePrimordials(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
// Run per-context JS files.
|
||||
@@ -85,7 +85,7 @@ index cc60ddddb037e0279615bbe24821eb20fd8da677..37d83e41b618a07aca98118260abe961
|
||||
|
||||
return handle;
|
||||
diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
|
||||
index 20d3c1d9d17fde18fc09b6ee219137831eb08a45..8fbf4f25a91b953f3d2868889c7ee06932ee3c5f 100644
|
||||
index f3631d538a38dc3a93a47707ea8dab0462fa2140..12ad6e6ddbda2cc679e733f7a9c6b9e4cf9623dd 100644
|
||||
--- a/src/crypto/crypto_context.cc
|
||||
+++ b/src/crypto/crypto_context.cc
|
||||
@@ -1022,7 +1022,7 @@ bool ArrayOfStringsToX509s(Local<Context> context,
|
||||
@@ -133,10 +133,10 @@ index 266f640fb1c6503a424e77cc41fc15bc658bb6a5..877ae8a18f6b8f2c7e3474dfba060d99
|
||||
// Recreate the buffer in the constructor.
|
||||
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
||||
diff --git a/src/env.cc b/src/env.cc
|
||||
index a78817467518245c4a190e870e0eb30658eafcdb..13dcf0e9c2c86486d1e43763033f43ac4e6b6feb 100644
|
||||
index b5cf58cc953590493beb52abf249e33e486ffc46..347ec5c42e098186ff489dff199ac5989961f6e3 100644
|
||||
--- a/src/env.cc
|
||||
+++ b/src/env.cc
|
||||
@@ -1753,10 +1753,10 @@ void AsyncHooks::Deserialize(Local<Context> context) {
|
||||
@@ -1765,10 +1765,10 @@ void AsyncHooks::Deserialize(Local<Context> context) {
|
||||
context->GetDataFromSnapshotOnce<Array>(
|
||||
info_->js_execution_async_resources).ToLocalChecked();
|
||||
} else {
|
||||
@@ -149,7 +149,7 @@ index a78817467518245c4a190e870e0eb30658eafcdb..13dcf0e9c2c86486d1e43763033f43ac
|
||||
|
||||
// The native_execution_async_resources_ field requires v8::Local<> instances
|
||||
// for async calls whose resources were on the stack as JS objects when they
|
||||
@@ -1796,7 +1796,7 @@ AsyncHooks::SerializeInfo AsyncHooks::Serialize(Local<Context> context,
|
||||
@@ -1808,7 +1808,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(
|
||||
@@ -295,7 +295,7 @@ 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 fa2f28989be19e8ea8f53b990ae96be92ef3c3a3..c26d1301d7b81a6c281d5465bfb29a5786b09dc2 100644
|
||||
index 52483740bb377a2bc2a16af701615d9a4e448eae..84d17a46efe146c1794a43963c41a4461eacfca2 100644
|
||||
--- a/src/module_wrap.cc
|
||||
+++ b/src/module_wrap.cc
|
||||
@@ -99,7 +99,7 @@ ModuleCacheKey ModuleCacheKey::From(Local<Context> context,
|
||||
@@ -307,7 +307,7 @@ index fa2f28989be19e8ea8f53b990ae96be92ef3c3a3..c26d1301d7b81a6c281d5465bfb29a57
|
||||
std::size_t h1 = specifier->GetIdentityHash();
|
||||
size_t num_attributes = import_attributes->Length() / elements_per_attribute;
|
||||
ImportAttributeVector attributes;
|
||||
@@ -1023,7 +1023,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
|
||||
@@ -1022,7 +1022,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
|
||||
return {};
|
||||
}
|
||||
DCHECK_NOT_NULL(resolved_module);
|
||||
@@ -316,16 +316,16 @@ index fa2f28989be19e8ea8f53b990ae96be92ef3c3a3..c26d1301d7b81a6c281d5465bfb29a57
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -1047,7 +1047,7 @@ MaybeLocal<Object> ModuleWrap::ResolveSourceCallback(
|
||||
Local<String> url = resolved_module->object()
|
||||
->GetInternalField(ModuleWrap::kURLSlot)
|
||||
.As<String>();
|
||||
- THROW_ERR_SOURCE_PHASE_NOT_DEFINED(context->GetIsolate(), url);
|
||||
+ THROW_ERR_SOURCE_PHASE_NOT_DEFINED(Isolate::GetCurrent(), url);
|
||||
@@ -1043,7 +1043,7 @@ MaybeLocal<Object> ModuleWrap::ResolveSourceCallback(
|
||||
->GetInternalField(ModuleWrap::kModuleSourceObjectSlot)
|
||||
.As<Value>();
|
||||
if (module_source_object->IsUndefined()) {
|
||||
- THROW_ERR_SOURCE_PHASE_NOT_DEFINED(context->GetIsolate(),
|
||||
+ THROW_ERR_SOURCE_PHASE_NOT_DEFINED(Isolate::GetCurrent(),
|
||||
resolved_module->url_);
|
||||
return {};
|
||||
}
|
||||
CHECK(module_source_object->IsObject());
|
||||
@@ -1060,7 +1060,7 @@ Maybe<ModuleWrap*> ModuleWrap::ResolveModule(
|
||||
@@ -1057,7 +1057,7 @@ Maybe<ModuleWrap*> ModuleWrap::ResolveModule(
|
||||
Local<String> specifier,
|
||||
Local<FixedArray> import_attributes,
|
||||
Local<Module> referrer) {
|
||||
@@ -334,7 +334,7 @@ index fa2f28989be19e8ea8f53b990ae96be92ef3c3a3..c26d1301d7b81a6c281d5465bfb29a57
|
||||
Environment* env = Environment::GetCurrent(context);
|
||||
if (env == nullptr) {
|
||||
THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate);
|
||||
@@ -1105,7 +1105,7 @@ MaybeLocal<Promise> ImportModuleDynamicallyWithPhase(
|
||||
@@ -1106,7 +1106,7 @@ MaybeLocal<Promise> ImportModuleDynamicallyWithPhase(
|
||||
Local<String> specifier,
|
||||
ModuleImportPhase phase,
|
||||
Local<FixedArray> import_attributes) {
|
||||
@@ -343,7 +343,7 @@ index fa2f28989be19e8ea8f53b990ae96be92ef3c3a3..c26d1301d7b81a6c281d5465bfb29a57
|
||||
Environment* env = Environment::GetCurrent(context);
|
||||
if (env == nullptr) {
|
||||
THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate);
|
||||
@@ -1347,7 +1347,7 @@ MaybeLocal<Module> LinkRequireFacadeWithOriginal(
|
||||
@@ -1348,7 +1348,7 @@ MaybeLocal<Module> LinkRequireFacadeWithOriginal(
|
||||
Local<FixedArray> import_attributes,
|
||||
Local<Module> referrer) {
|
||||
Environment* env = Environment::GetCurrent(context);
|
||||
@@ -353,10 +353,10 @@ index fa2f28989be19e8ea8f53b990ae96be92ef3c3a3..c26d1301d7b81a6c281d5465bfb29a57
|
||||
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 84c121f13caa1472cef67113fbc7b7213e7af7e1..6a6f6f057f89ae72c680d19f4d478d421dede613 100644
|
||||
index 154fb15e6c8fe985e92378cc8471aa6a9d579b07..6252c41a14f4bd092cb424858be58d525b235625 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -1064,7 +1064,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
||||
@@ -1063,7 +1063,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
||||
|
||||
#define NODE_DEFINE_CONSTANT(target, constant) \
|
||||
do { \
|
||||
@@ -365,7 +365,7 @@ index 84c121f13caa1472cef67113fbc7b7213e7af7e1..6a6f6f057f89ae72c680d19f4d478d42
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
|
||||
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
|
||||
isolate, #constant, v8::NewStringType::kInternalized); \
|
||||
@@ -1080,7 +1080,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
||||
@@ -1079,7 +1079,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
||||
|
||||
#define NODE_DEFINE_HIDDEN_CONSTANT(target, constant) \
|
||||
do { \
|
||||
@@ -502,10 +502,10 @@ index 6aad252eb5681bb9ab9890812602b43c418e7a7f..5f7ef8cc58f589ba30a44abaaaaaf151
|
||||
Local<Array> keys;
|
||||
if (!entries->GetOwnPropertyNames(context).ToLocal(&keys))
|
||||
diff --git a/src/node_errors.cc b/src/node_errors.cc
|
||||
index 15d78e3eca9693dc518ccb28fc7c02fa1372f34b..9286d20c19a1e06001ca4b60981291d320858064 100644
|
||||
index 55a0c986c5b6989ee9ce277bb6a9778abb2ad2ee..809d88f21e5572807e38132d40ee75870ab8de07 100644
|
||||
--- a/src/node_errors.cc
|
||||
+++ b/src/node_errors.cc
|
||||
@@ -633,7 +633,7 @@ v8::ModifyCodeGenerationFromStringsResult ModifyCodeGenerationFromStrings(
|
||||
@@ -631,7 +631,7 @@ v8::ModifyCodeGenerationFromStringsResult ModifyCodeGenerationFromStrings(
|
||||
v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Value> source,
|
||||
bool is_code_like) {
|
||||
@@ -514,7 +514,7 @@ index 15d78e3eca9693dc518ccb28fc7c02fa1372f34b..9286d20c19a1e06001ca4b60981291d3
|
||||
|
||||
if (context->GetNumberOfEmbedderDataFields() <=
|
||||
ContextEmbedderIndex::kAllowCodeGenerationFromStrings) {
|
||||
@@ -1000,7 +1000,7 @@ const char* errno_string(int errorno) {
|
||||
@@ -1037,7 +1037,7 @@ const char* errno_string(int errorno) {
|
||||
}
|
||||
|
||||
void PerIsolateMessageListener(Local<Message> message, Local<Value> error) {
|
||||
@@ -523,7 +523,7 @@ index 15d78e3eca9693dc518ccb28fc7c02fa1372f34b..9286d20c19a1e06001ca4b60981291d3
|
||||
switch (message->ErrorLevel()) {
|
||||
case Isolate::MessageErrorLevel::kMessageWarning: {
|
||||
Environment* env = Environment::GetCurrent(isolate);
|
||||
@@ -1160,7 +1160,7 @@ void Initialize(Local<Object> target,
|
||||
@@ -1197,7 +1197,7 @@ void Initialize(Local<Object> target,
|
||||
SetMethod(
|
||||
context, target, "getErrorSourcePositions", GetErrorSourcePositions);
|
||||
|
||||
@@ -533,10 +533,10 @@ index 15d78e3eca9693dc518ccb28fc7c02fa1372f34b..9286d20c19a1e06001ca4b60981291d3
|
||||
READONLY_PROPERTY(target, "exitCodes", exit_codes);
|
||||
|
||||
diff --git a/src/node_file.cc b/src/node_file.cc
|
||||
index d73dac2ee3f1cf1cac6845fae0f702c9fba8fcef..969e7d08086f8442bed476feaf15599b8c79db7c 100644
|
||||
index 7dfb7a486040e0188eb53ee7a65f91a99e713a3a..c364f2a4f6dd6ec066b00f364108383154be12ec 100644
|
||||
--- a/src/node_file.cc
|
||||
+++ b/src/node_file.cc
|
||||
@@ -3874,7 +3874,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
@@ -3834,7 +3834,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
int index,
|
||||
InternalFieldInfoBase* info) {
|
||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||
@@ -586,7 +586,7 @@ index 57e068ae249d618c2658638f9f3b03e1fedb6524..8c51ae4e0a435971c6d0288af8781087
|
||||
data_.Reset();
|
||||
return ret;
|
||||
diff --git a/src/node_modules.cc b/src/node_modules.cc
|
||||
index 6b1a9e257b0ce52820838f88c44ec546068fe419..5355f2f96e9c9f6548ae43fd38b0d89a825e6b60 100644
|
||||
index d3907c3d063c7757cdd7ef99ed09bea1eb58a3fd..df9925404e77ec61900f89a5241c86a599e548c5 100644
|
||||
--- a/src/node_modules.cc
|
||||
+++ b/src/node_modules.cc
|
||||
@@ -70,7 +70,7 @@ void BindingData::Deserialize(v8::Local<v8::Context> context,
|
||||
@@ -634,7 +634,7 @@ index 2a5fe9fe501d1fd9356eeb7d044a872fa5a55f38..39f6f142044c42904d234da20a266315
|
||||
env->AssignToContext(context, this, ContextInfo(""));
|
||||
// The environment can also purge empty wrappers in the check callback,
|
||||
diff --git a/src/node_report.cc b/src/node_report.cc
|
||||
index 139e2ae3f2de1f1e28876bdc5332f68ea392484e..d479ada5bf0776fac52cd43c952a7f418ebc0679 100644
|
||||
index ba2dd7e676bfdfe7da66a4a79db3c791a505c9a8..28e6cfac682e301b605c00c4ef2eaf01431f04e4 100644
|
||||
--- a/src/node_report.cc
|
||||
+++ b/src/node_report.cc
|
||||
@@ -400,7 +400,7 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer,
|
||||
@@ -660,10 +660,10 @@ index c2e24b4645e7903e08c80aead1c18c7bcff1bd89..e34d24d51d5c090b560d06f727043f20
|
||||
// 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 8b0bd18e6d9434aba4dd1a02beb0d8a2347c851c..1cab6dde9df945eb82ae59908711cfb75bd8993f 100644
|
||||
index 955b76cbc71d0cd3a1cc01c3c0dea0536a792dc0..0b111ce1fb1d59cad019ba13bbfc513f157d3f06 100644
|
||||
--- a/src/node_sqlite.cc
|
||||
+++ b/src/node_sqlite.cc
|
||||
@@ -2018,7 +2018,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -2061,7 +2061,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
if (args[0]->IsObject() && !args[0]->IsArrayBufferView()) {
|
||||
Local<Object> obj = args[0].As<Object>();
|
||||
@@ -699,10 +699,10 @@ index 9d1e8ec05161570db11f7b662395509774668d78..9b91f83d879ea02fd3d61913c8dfd35b
|
||||
BindingData* binding = realm->AddBindingData<BindingData>(holder);
|
||||
CHECK_NOT_NULL(binding);
|
||||
diff --git a/src/node_v8.cc b/src/node_v8.cc
|
||||
index 5cf30e8094b0014e12fa26d95d19a2d0e6f0ff56..13a4cbb11ad59e761f686c67f7a550d002b8e45c 100644
|
||||
index 8dd32dad262679444c10878299eb6bb8fb04e120..935ea2cf5157c3a2fbdf142fc7024ec6b6d5de26 100644
|
||||
--- a/src/node_v8.cc
|
||||
+++ b/src/node_v8.cc
|
||||
@@ -158,7 +158,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
@@ -163,7 +163,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
int index,
|
||||
InternalFieldInfoBase* info) {
|
||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||
@@ -784,7 +784,7 @@ index da4206187f7c7d2becb8a101c1ff5346a10e13f4..03f0910926f3d403121e227cee32a546
|
||||
// Recreate the buffer in the constructor.
|
||||
BindingData* binding = realm->AddBindingData<BindingData>(holder);
|
||||
diff --git a/src/util-inl.h b/src/util-inl.h
|
||||
index 5699d76fdfee4b260aa23929f1fb678389ad99e7..d07bceb425f00882db116975a92f4835d7c2cf3b 100644
|
||||
index aae5956742f195279ab6af04029d76dee6af2e84..6898e8ea794675e903e13e2b45524d572a3f68bb 100644
|
||||
--- a/src/util-inl.h
|
||||
+++ b/src/util-inl.h
|
||||
@@ -336,14 +336,14 @@ v8::Maybe<void> FromV8Array(v8::Local<v8::Context> context,
|
||||
@@ -876,7 +876,7 @@ index 5699d76fdfee4b260aa23929f1fb678389ad99e7..d07bceb425f00882db116975a92f4835
|
||||
v8::EscapableHandleScope handle_scope(isolate);
|
||||
|
||||
v8::LocalVector<v8::Value> elements(isolate);
|
||||
@@ -751,7 +751,7 @@ inline v8::MaybeLocal<v8::Object> NewDictionaryInstanceNullProto(
|
||||
@@ -803,7 +803,7 @@ inline v8::MaybeLocal<v8::Object> NewDictionaryInstanceNullProto(
|
||||
if (value.IsEmpty()) return v8::MaybeLocal<v8::Object>();
|
||||
}
|
||||
v8::Local<v8::Object> obj = tmpl->NewInstance(context, property_values);
|
||||
@@ -935,10 +935,10 @@ index 660cfff6b8a0c583be843e555e7a06cd09e0d279..c4b39450c5b7f91c46f7027db367c30d
|
||||
context, that, OneByteString(isolate, name), tmpl, flag);
|
||||
}
|
||||
diff --git a/src/util.h b/src/util.h
|
||||
index 63479eb3f12685702a06c27db52183a585de0da9..1db426df35e4976427b578a2974041ec9e92cf4c 100644
|
||||
index 81d08c27fb7037d16e12843dc03c3d8f9caee723..52e6a149d6760640d93c56ce91a759ae9207a8c7 100644
|
||||
--- a/src/util.h
|
||||
+++ b/src/util.h
|
||||
@@ -751,7 +751,7 @@ inline v8::MaybeLocal<v8::Value> ToV8Value(
|
||||
@@ -753,7 +753,7 @@ inline v8::MaybeLocal<v8::Value> ToV8Value(
|
||||
// Variation on NODE_DEFINE_CONSTANT that sets a String value.
|
||||
#define NODE_DEFINE_STRING_CONSTANT(target, name, constant) \
|
||||
do { \
|
||||
|
||||
@@ -33,7 +33,7 @@ index 8d7204f6cb48f783adc4d1c1eb2de0c83b7fffe2..a154559a56bf383d3c26af523c9bb07b
|
||||
|
||||
// Non-alphabetic chars.
|
||||
diff --git a/lib/internal/http.js b/lib/internal/http.js
|
||||
index 9bf929f7f3360f13058d3f446c18a36cd15bea58..abf9a06d891488288bccd98c437746c1ce48bf83 100644
|
||||
index e664663348adc7bb31f7c9ec78481bbeb71401d9..62b659beb766b8256b214447af376f438278b058 100644
|
||||
--- a/lib/internal/http.js
|
||||
+++ b/lib/internal/http.js
|
||||
@@ -11,8 +11,8 @@ const {
|
||||
@@ -64,7 +64,7 @@ index 9bf929f7f3360f13058d3f446c18a36cd15bea58..abf9a06d891488288bccd98c437746c1
|
||||
|
||||
function ipToInt(ip) {
|
||||
diff --git a/node.gyp b/node.gyp
|
||||
index a598de39f13e7069e75484463fb096b771fa45fb..975f3897dd1ce1074626925b9fbf22f15632a0b1 100644
|
||||
index c3917f805464669c709bef83b9982ef95d0fbaa1..56e11cde31897260bf41db3f32f5c6d6fbd6d5bf 100644
|
||||
--- a/node.gyp
|
||||
+++ b/node.gyp
|
||||
@@ -176,7 +176,6 @@
|
||||
|
||||
@@ -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 088e7ebbfe07d273691c86c7ab2dce00fcb475c8..a3f7415dba63828bec94ac8503420f14e3fea14c 100644
|
||||
index 8280cff0d93d42a95875b78de84221aa1bcae092..76a03b9a5458f4afc0ab5768c8a2e90633749fe9 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -89,6 +89,8 @@
|
||||
@@ -54,7 +54,7 @@ index e063f9131d4d547d231811dafea03c8c52b611e6..a5c764d9e7fb0ffa219202015ec67ed6
|
||||
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 27f5bb1571920c963e05644a5fc5858aa4b88288..9c624e4ef26c1b06a6c4bca7def245935189ce07 100644
|
||||
index be22ad370217a13aef2479d478a6373feaf6f208..19c34a430d095c06ccf5a988db91311d420a485a 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -22,6 +22,12 @@
|
||||
|
||||
@@ -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 a3f7415dba63828bec94ac8503420f14e3fea14c..c08f65b0448806c613b27eb91f9dd512adab938c 100644
|
||||
index 76a03b9a5458f4afc0ab5768c8a2e90633749fe9..bdadbdaa607b2f668749fc484271de8d126bbd17 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -128,6 +128,7 @@
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Keeley Hammond <vertedinde@electronjs.org>
|
||||
Date: Thu, 5 Feb 2026 15:29:44 -0800
|
||||
Subject: build: restore macos deployment target to 12.0
|
||||
|
||||
Partially reverts https://github.com/nodejs/node/commit/8b4022177750530d2c142a5a0349d98fb82f16e2
|
||||
Electron will follow Chromium's lead and deprecate macos 12 with
|
||||
M151, and so we should allow for building until then.
|
||||
|
||||
This patch can be removed at the M151 branch point.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index bdadbdaa607b2f668749fc484271de8d126bbd17..8df2802191b7fe6ae14edbd85cb3a5d16eb5a76a 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -677,7 +677,7 @@
|
||||
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
|
||||
'GCC_STRICT_ALIASING': 'NO', # -fno-strict-aliasing
|
||||
'PREBINDING': 'NO', # No -Wl,-prebind
|
||||
- 'MACOSX_DEPLOYMENT_TARGET': '13.5', # -mmacosx-version-min=13.5
|
||||
+ 'MACOSX_DEPLOYMENT_TARGET': '12.0', # -mmacosx-version-min=12.0
|
||||
'USE_HEADERMAP': 'NO',
|
||||
'WARNING_CFLAGS': [
|
||||
'-Wall',
|
||||
@@ -8,7 +8,7 @@ they use themselves as the entry point. We should try to upstream some form
|
||||
of this.
|
||||
|
||||
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
|
||||
index 6585c52e4bd997b20d5a297c536844dea1b8fdc8..fd0a81f5216d8bcf662c7e8bb972ed789eda8645 100644
|
||||
index 8ed8802adcda308166d700e463c8d6cbcb26d94a..9a99ff6d44320c0e28f4a787d24ea98ae1c96196 100644
|
||||
--- a/lib/internal/process/pre_execution.js
|
||||
+++ b/lib/internal/process/pre_execution.js
|
||||
@@ -276,12 +276,14 @@ function patchProcessObject(expandArgv1) {
|
||||
|
||||
@@ -14,10 +14,10 @@ and
|
||||
This patch can be removed once this is fixed upstream in simdjson.
|
||||
|
||||
diff --git a/deps/simdjson/simdjson.h b/deps/simdjson/simdjson.h
|
||||
index a8bd86b28acc16cb04c193a1afbeb8171b314107..e200835e3ae6042f5af62f7ea3e082c677a9d0cf 100644
|
||||
index 35ff2626f26735495e308381782e5f1d9b8a629e..b4aa4bce33d62c579beee745712d24d9ebd5e0c2 100644
|
||||
--- a/deps/simdjson/simdjson.h
|
||||
+++ b/deps/simdjson/simdjson.h
|
||||
@@ -4160,12 +4160,17 @@ inline std::ostream& operator<<(std::ostream& out, simdjson_result<padded_string
|
||||
@@ -4179,12 +4179,17 @@ inline std::ostream& operator<<(std::ostream& out, simdjson_result<padded_string
|
||||
|
||||
} // namespace simdjson
|
||||
|
||||
@@ -35,7 +35,7 @@ index a8bd86b28acc16cb04c193a1afbeb8171b314107..e200835e3ae6042f5af62f7ea3e082c6
|
||||
namespace simdjson {
|
||||
namespace internal {
|
||||
|
||||
@@ -4617,6 +4622,9 @@ inline simdjson_result<padded_string> padded_string::load(std::string_view filen
|
||||
@@ -4636,6 +4641,9 @@ inline simdjson_result<padded_string> padded_string::load(std::string_view filen
|
||||
|
||||
} // namespace simdjson
|
||||
|
||||
@@ -45,7 +45,7 @@ index a8bd86b28acc16cb04c193a1afbeb8171b314107..e200835e3ae6042f5af62f7ea3e082c6
|
||||
inline simdjson::padded_string operator ""_padded(const char *str, size_t len) {
|
||||
return simdjson::padded_string(str, len);
|
||||
}
|
||||
@@ -4625,6 +4633,8 @@ inline simdjson::padded_string operator ""_padded(const char8_t *str, size_t len
|
||||
@@ -4644,6 +4652,8 @@ inline simdjson::padded_string operator ""_padded(const char8_t *str, size_t len
|
||||
return simdjson::padded_string(reinterpret_cast<const char8_t *>(str), len);
|
||||
}
|
||||
#endif
|
||||
@@ -54,7 +54,7 @@ index a8bd86b28acc16cb04c193a1afbeb8171b314107..e200835e3ae6042f5af62f7ea3e082c6
|
||||
#endif // SIMDJSON_PADDED_STRING_INL_H
|
||||
/* end file simdjson/padded_string-inl.h */
|
||||
/* skipped duplicate #include "simdjson/padded_string_view.h" */
|
||||
@@ -43655,12 +43665,16 @@ simdjson_inline simdjson_warn_unused std::unique_ptr<ondemand::parser>& parser::
|
||||
@@ -43674,12 +43684,16 @@ simdjson_inline simdjson_warn_unused std::unique_ptr<ondemand::parser>& parser::
|
||||
return parser_instance;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ index a8bd86b28acc16cb04c193a1afbeb8171b314107..e200835e3ae6042f5af62f7ea3e082c6
|
||||
|
||||
} // namespace ondemand
|
||||
} // namespace arm64
|
||||
@@ -56961,12 +56975,16 @@ simdjson_inline simdjson_warn_unused std::unique_ptr<ondemand::parser>& parser::
|
||||
@@ -57923,12 +57937,16 @@ simdjson_inline simdjson_warn_unused std::unique_ptr<ondemand::parser>& parser::
|
||||
return parser_instance;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ its own blended handler between Node and Blink.
|
||||
Not upstreamable.
|
||||
|
||||
diff --git a/lib/internal/modules/esm/utils.js b/lib/internal/modules/esm/utils.js
|
||||
index a9076a7ae941284d4585829292e2ece25c2b90e4..7335fe20f34fdd822276575686379dd954f1c8e1 100644
|
||||
index 0af25ebbf6c3f2b790238e32f01addfb648e4e52..bd726088f7480853b8507c39668cc4716c4ce61f 100644
|
||||
--- a/lib/internal/modules/esm/utils.js
|
||||
+++ b/lib/internal/modules/esm/utils.js
|
||||
@@ -34,7 +34,7 @@ const {
|
||||
@@ -35,7 +35,7 @@ const {
|
||||
ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING,
|
||||
ERR_INVALID_ARG_VALUE,
|
||||
} = require('internal/errors').codes;
|
||||
@@ -23,7 +23,7 @@ index a9076a7ae941284d4585829292e2ece25c2b90e4..7335fe20f34fdd822276575686379dd9
|
||||
const {
|
||||
emitExperimentalWarning,
|
||||
kEmptyObject,
|
||||
@@ -285,12 +285,13 @@ let _shouldSpawnLoaderHookWorker = true;
|
||||
@@ -286,12 +286,13 @@ let _shouldSpawnLoaderHookWorker = true;
|
||||
* should be spawned later.
|
||||
*/
|
||||
function initializeESM(shouldSpawnLoaderHookWorker = true) {
|
||||
@@ -40,10 +40,10 @@ index a9076a7ae941284d4585829292e2ece25c2b90e4..7335fe20f34fdd822276575686379dd9
|
||||
|
||||
/**
|
||||
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
|
||||
index 26e6bcfa30be8b22b20e66ffe2f8d0b7d60fc6cc..fa2f28989be19e8ea8f53b990ae96be92ef3c3a3 100644
|
||||
index 5703590b5ee2a91a504cf8491716773fc4a302bd..52483740bb377a2bc2a16af701615d9a4e448eae 100644
|
||||
--- a/src/module_wrap.cc
|
||||
+++ b/src/module_wrap.cc
|
||||
@@ -1098,7 +1098,7 @@ Maybe<ModuleWrap*> ModuleWrap::ResolveModule(
|
||||
@@ -1099,7 +1099,7 @@ Maybe<ModuleWrap*> ModuleWrap::ResolveModule(
|
||||
return Just(module_wrap);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ index 26e6bcfa30be8b22b20e66ffe2f8d0b7d60fc6cc..fa2f28989be19e8ea8f53b990ae96be9
|
||||
Local<Context> context,
|
||||
Local<Data> host_defined_options,
|
||||
Local<Value> resource_name,
|
||||
@@ -1186,14 +1186,16 @@ void ModuleWrap::SetImportModuleDynamicallyCallback(
|
||||
@@ -1187,14 +1187,16 @@ void ModuleWrap::SetImportModuleDynamicallyCallback(
|
||||
Realm* realm = Realm::GetCurrent(args);
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
@@ -72,7 +72,7 @@ index 26e6bcfa30be8b22b20e66ffe2f8d0b7d60fc6cc..fa2f28989be19e8ea8f53b990ae96be9
|
||||
}
|
||||
|
||||
void ModuleWrap::HostInitializeImportMetaObjectCallback(
|
||||
@@ -1235,13 +1237,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(
|
||||
@@ -1236,13 +1238,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(
|
||||
Realm* realm = Realm::GetCurrent(args);
|
||||
Isolate* isolate = realm->isolate();
|
||||
|
||||
@@ -91,7 +91,7 @@ index 26e6bcfa30be8b22b20e66ffe2f8d0b7d60fc6cc..fa2f28989be19e8ea8f53b990ae96be9
|
||||
|
||||
MaybeLocal<Value> ModuleWrap::SyntheticModuleEvaluationStepsCallback(
|
||||
diff --git a/src/module_wrap.h b/src/module_wrap.h
|
||||
index 03cf8d0e91d795aad6db9b11956d296ff4999f7e..45264c2ad58e37a73fd62addac7fb671eed6d502 100644
|
||||
index d81facabf8d80e967c5bff2bbd3a1ce9dd79cc76..93d47c7573da7e5824e9bc391dd1c2f5f2588822 100644
|
||||
--- a/src/module_wrap.h
|
||||
+++ b/src/module_wrap.h
|
||||
@@ -8,6 +8,7 @@
|
||||
@@ -119,7 +119,7 @@ index 03cf8d0e91d795aad6db9b11956d296ff4999f7e..45264c2ad58e37a73fd62addac7fb671
|
||||
using ResolveCache =
|
||||
std::unordered_map<ModuleCacheKey, uint32_t, ModuleCacheKey::Hash>;
|
||||
|
||||
@@ -157,6 +166,8 @@ class ModuleWrap : public BaseObject {
|
||||
@@ -156,6 +165,8 @@ class ModuleWrap : public BaseObject {
|
||||
static void CreateRequiredModuleFacade(
|
||||
const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
@@ -128,7 +128,7 @@ index 03cf8d0e91d795aad6db9b11956d296ff4999f7e..45264c2ad58e37a73fd62addac7fb671
|
||||
private:
|
||||
ModuleWrap(Realm* realm,
|
||||
v8::Local<v8::Object> object,
|
||||
@@ -205,7 +216,6 @@ class ModuleWrap : public BaseObject {
|
||||
@@ -204,7 +215,6 @@ class ModuleWrap : public BaseObject {
|
||||
v8::Local<v8::String> specifier,
|
||||
v8::Local<v8::FixedArray> import_attributes,
|
||||
v8::Local<v8::Module> referrer);
|
||||
|
||||
@@ -24,10 +24,10 @@ index 5bd07e5253ae64b02ae1874226ab70c1972cf9e0..768d81a63a42d9016a42b7cdce7b6be8
|
||||
Environment* env = Environment::GetCurrent(args);
|
||||
|
||||
diff --git a/src/node_binding.h b/src/node_binding.h
|
||||
index 813204dc473960e63896b6d3609a882b52ac59fa..2fe91a28460973b543f5dde7a78fdedb05ac98b3 100644
|
||||
index a55a9c6a5787983c0477cb268ef1355162e72911..3455eb3d223a49cd73d80c72c209c26d49b769dc 100644
|
||||
--- a/src/node_binding.h
|
||||
+++ b/src/node_binding.h
|
||||
@@ -155,6 +155,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
@@ -154,6 +154,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void GetLinkedBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DLOpen(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
|
||||
@@ -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 60585d136f7ee103ac49ce0271e24561a2685a0a..088e7ebbfe07d273691c86c7ab2dce00fcb475c8 100644
|
||||
index db1625378697d9e6d7685d57acbdc212e8f25ec0..8280cff0d93d42a95875b78de84221aa1bcae092 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -91,6 +91,23 @@
|
||||
|
||||
@@ -9,10 +9,10 @@ conflict with Blink's in renderer and worker processes.
|
||||
We should try to upstream some version of this.
|
||||
|
||||
diff --git a/doc/api/cli.md b/doc/api/cli.md
|
||||
index 38c66ec426205c07925e4d634e877a8cbb47b255..9b9a5455b9d597bb4009074c922d2c7c5aa975f1 100644
|
||||
index 667603438cc41701820d6aaa734d21ac35bcc8d1..6611face009797f9d540be4478df80d05888893a 100644
|
||||
--- a/doc/api/cli.md
|
||||
+++ b/doc/api/cli.md
|
||||
@@ -1770,6 +1770,14 @@ changes:
|
||||
@@ -1798,6 +1798,14 @@ changes:
|
||||
|
||||
Disable using [syntax detection][] to determine module type.
|
||||
|
||||
@@ -27,7 +27,7 @@ index 38c66ec426205c07925e4d634e877a8cbb47b255..9b9a5455b9d597bb4009074c922d2c7c
|
||||
### `--no-experimental-global-navigator`
|
||||
|
||||
<!-- YAML
|
||||
@@ -3439,6 +3447,7 @@ one is included in the list below.
|
||||
@@ -3476,6 +3484,7 @@ one is included in the list below.
|
||||
* `--no-addons`
|
||||
* `--no-async-context-frame`
|
||||
* `--no-deprecation`
|
||||
@@ -36,10 +36,10 @@ index 38c66ec426205c07925e4d634e877a8cbb47b255..9b9a5455b9d597bb4009074c922d2c7c
|
||||
* `--no-experimental-repl-await`
|
||||
* `--no-experimental-sqlite`
|
||||
diff --git a/doc/node.1 b/doc/node.1
|
||||
index dad692863f2cc6b6d4fad86915cd1700d52e8279..6d451ef912d1162a242b7952f94d2071d8238673 100644
|
||||
index 9a0f5beb5b995fb92b31514c166e1c76e18d8ca9..fab0b24b630e755658b58a7281df1dacc4b7f32a 100644
|
||||
--- a/doc/node.1
|
||||
+++ b/doc/node.1
|
||||
@@ -198,6 +198,9 @@ Enable transformation of TypeScript-only syntax into JavaScript code.
|
||||
@@ -201,6 +201,9 @@ Enable transformation of TypeScript-only syntax into JavaScript code.
|
||||
.It Fl -experimental-eventsource
|
||||
Enable experimental support for the EventSource Web API.
|
||||
.
|
||||
@@ -50,7 +50,7 @@ index dad692863f2cc6b6d4fad86915cd1700d52e8279..6d451ef912d1162a242b7952f94d2071
|
||||
Disable experimental support for the WebSocket API.
|
||||
.
|
||||
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
|
||||
index fd0a81f5216d8bcf662c7e8bb972ed789eda8645..72944995cf3cc30d8bc33bfef8c6690c652cdcf9 100644
|
||||
index 9a99ff6d44320c0e28f4a787d24ea98ae1c96196..8f5810267d1ba430bae02be141f087f2a5d3cf9f 100644
|
||||
--- a/lib/internal/process/pre_execution.js
|
||||
+++ b/lib/internal/process/pre_execution.js
|
||||
@@ -117,6 +117,7 @@ function prepareExecution(options) {
|
||||
@@ -79,7 +79,7 @@ index fd0a81f5216d8bcf662c7e8bb972ed789eda8645..72944995cf3cc30d8bc33bfef8c6690c
|
||||
function setupWebsocket() {
|
||||
if (getOptionValue('--no-experimental-websocket')) {
|
||||
diff --git a/src/node_options.cc b/src/node_options.cc
|
||||
index 03c1dde6de237e44539dccea3295cf4339260b1e..c53c40b36ec311f433c8a0cbb1c06287576e1453 100644
|
||||
index 342bffb00fd355f7f1c5d0d83133bd5561be91e1..41f268195c281689339e98ceb98e8034ecd28b63 100644
|
||||
--- a/src/node_options.cc
|
||||
+++ b/src/node_options.cc
|
||||
@@ -545,7 +545,11 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
|
||||
|
||||
@@ -53,10 +53,10 @@ index 72cc9444ca93ef7a1526e23314693aeaf5f173b0..79684dd7e8d1629b19be01ebf97e43e5
|
||||
const maybeMain = resolvedOption <= legacyMainResolveExtensionsIndexes.kResolvedByMainIndexNode ?
|
||||
packageConfig.main || './' : '';
|
||||
diff --git a/src/node_file.cc b/src/node_file.cc
|
||||
index 00f369e9691e184f9e5f226ce4216bd5b1d353ae..d73dac2ee3f1cf1cac6845fae0f702c9fba8fcef 100644
|
||||
index 88fdca1eb85a49468e787d50f1cee6b8561841d6..7dfb7a486040e0188eb53ee7a65f91a99e713a3a 100644
|
||||
--- a/src/node_file.cc
|
||||
+++ b/src/node_file.cc
|
||||
@@ -3623,13 +3623,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -3583,13 +3583,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
|
||||
BindingData::FilePathIsFileReturnType BindingData::FilePathIsFile(
|
||||
@@ -83,7 +83,7 @@ index 00f369e9691e184f9e5f226ce4216bd5b1d353ae..d73dac2ee3f1cf1cac6845fae0f702c9
|
||||
uv_fs_t req;
|
||||
|
||||
int rc = uv_fs_stat(env->event_loop(), &req, file_path.c_str(), nullptr);
|
||||
@@ -3687,6 +3699,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -3647,6 +3659,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
|
||||
std::optional<std::string> initial_file_path;
|
||||
std::string file_path;
|
||||
|
||||
@@ -95,7 +95,7 @@ index 00f369e9691e184f9e5f226ce4216bd5b1d353ae..d73dac2ee3f1cf1cac6845fae0f702c9
|
||||
if (args.Length() >= 2 && args[1]->IsString()) {
|
||||
auto package_config_main = Utf8Value(isolate, args[1]).ToString();
|
||||
|
||||
@@ -3707,7 +3724,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -3667,7 +3684,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 00f369e9691e184f9e5f226ce4216bd5b1d353ae..d73dac2ee3f1cf1cac6845fae0f702c9
|
||||
case BindingData::FilePathIsFileReturnType::kIsFile:
|
||||
return args.GetReturnValue().Set(i);
|
||||
case BindingData::FilePathIsFileReturnType::kIsNotFile:
|
||||
@@ -3744,7 +3761,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -3704,7 +3721,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
|
||||
BufferValue buff_file_path(isolate, local_file_path);
|
||||
ToNamespacedPath(env, &buff_file_path);
|
||||
|
||||
|
||||
@@ -39,10 +39,10 @@ index 66331d2d9999e93e59cbce9e153affb942b79946..0f7fd0747ea779f76a9e64ed37d195bd
|
||||
if (secureOptions) {
|
||||
validateInteger(secureOptions, 'secureOptions');
|
||||
diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
|
||||
index 8fbf4f25a91b953f3d2868889c7ee06932ee3c5f..96f6ea29525bc2c60297e7be5bc1d0b74cd568e1 100644
|
||||
index 12ad6e6ddbda2cc679e733f7a9c6b9e4cf9623dd..fc6d295a401d5283ba19dd5c95b748c83b7055a9 100644
|
||||
--- a/src/crypto/crypto_context.cc
|
||||
+++ b/src/crypto/crypto_context.cc
|
||||
@@ -1355,10 +1355,8 @@ SecureContext::SecureContext(Environment* env, Local<Object> wrap)
|
||||
@@ -1354,10 +1354,8 @@ SecureContext::SecureContext(Environment* env, Local<Object> wrap)
|
||||
}
|
||||
|
||||
inline void SecureContext::Reset() {
|
||||
|
||||
@@ -22,98 +22,36 @@ index 423f2c4d77bfc98bfbdab93c09aff8012c678cbd..fa0bcceb5697486930a9530732f9a9ab
|
||||
const pkcs8 = Buffer.from(
|
||||
'308204bf020100300d06092a864886f70d0101010500048204a9308204a5020100028' +
|
||||
'2010100d3576092e62957364544e7e4233b7bdb293db2085122c479328546f9f0f712' +
|
||||
diff --git a/test/fixtures/webcrypto/supports-modern-algorithms.mjs b/test/fixtures/webcrypto/supports-modern-algorithms.mjs
|
||||
index 337ed577b143062d41e378cc1f820945e76cea08..76d5e805cbc0e756aef0013373baec31bd320f44 100644
|
||||
--- a/test/fixtures/webcrypto/supports-modern-algorithms.mjs
|
||||
+++ b/test/fixtures/webcrypto/supports-modern-algorithms.mjs
|
||||
@@ -9,6 +9,7 @@ const shake256 = crypto.getHashes().includes('shake256');
|
||||
const chacha = crypto.getCiphers().includes('chacha20-poly1305');
|
||||
const ocb = hasOpenSSL(3);
|
||||
const kmac = hasOpenSSL(3);
|
||||
+const boringSSL = process.features.openssl_is_boringssl;
|
||||
|
||||
const { subtle } = globalThis.crypto;
|
||||
const X25519 = await subtle.generateKey('X25519', false, ['deriveBits', 'deriveKey']);
|
||||
@@ -108,9 +109,9 @@ export const vectors = {
|
||||
[true, 'RSA-PSS'],
|
||||
[true, 'RSASSA-PKCS1-v1_5'],
|
||||
[true, 'X25519'],
|
||||
- [true, 'X448'],
|
||||
+ [!boringSSL, 'X448'],
|
||||
[true, 'Ed25519'],
|
||||
- [true, 'Ed448'],
|
||||
+ [!boringSSL, 'Ed448'],
|
||||
[true, 'ECDH'],
|
||||
[true, 'ECDSA'],
|
||||
[pqc, 'ML-DSA-44'],
|
||||
diff --git a/test/parallel/test-crypto-async-sign-verify.js b/test/parallel/test-crypto-async-sign-verify.js
|
||||
index d385926e9943052bbe1793d4b1e39846e1a69562..dbf7b04afa77f132aaa466c9ee02c5ffad0296bc 100644
|
||||
index 9876c4bb6ecd2e5b8879f153811cd0a0a22997aa..2c4bf03452eb10fec52c38a361b6aad93169f08d 100644
|
||||
--- a/test/parallel/test-crypto-async-sign-verify.js
|
||||
+++ b/test/parallel/test-crypto-async-sign-verify.js
|
||||
@@ -89,6 +89,7 @@ test('rsa_public.pem', 'rsa_private.pem', 'sha256', false,
|
||||
// ED25519
|
||||
test('ed25519_public.pem', 'ed25519_private.pem', undefined, true);
|
||||
// ED448
|
||||
+if (!process.features.openssl_is_boringssl) {
|
||||
test('ed448_public.pem', 'ed448_private.pem', undefined, true);
|
||||
@@ -102,17 +102,17 @@ if (!process.features.openssl_is_boringssl) {
|
||||
// ECDSA w/ ieee-p1363 signature encoding
|
||||
test('ec_secp256k1_public.pem', 'ec_secp256k1_private.pem', 'sha384', false,
|
||||
{ dsaEncoding: 'ieee-p1363' });
|
||||
-}
|
||||
|
||||
// ECDSA w/ der signature encoding
|
||||
@@ -110,6 +111,7 @@ test('dsa_public.pem', 'dsa_private.pem', 'sha256',
|
||||
// DSA w/ ieee-p1363 signature encoding
|
||||
test('dsa_public.pem', 'dsa_private.pem', 'sha256', false,
|
||||
{ dsaEncoding: 'ieee-p1363' });
|
||||
-// DSA w/ der signature encoding
|
||||
-test('dsa_public.pem', 'dsa_private.pem', 'sha256',
|
||||
- false);
|
||||
-test('dsa_public.pem', 'dsa_private.pem', 'sha256',
|
||||
- false, { dsaEncoding: 'der' });
|
||||
+ // DSA w/ der signature encoding
|
||||
+ test('dsa_public.pem', 'dsa_private.pem', 'sha256',
|
||||
+ false);
|
||||
+ test('dsa_public.pem', 'dsa_private.pem', 'sha256',
|
||||
+ false, { dsaEncoding: 'der' });
|
||||
|
||||
-// DSA w/ ieee-p1363 signature encoding
|
||||
-test('dsa_public.pem', 'dsa_private.pem', 'sha256', false,
|
||||
- { dsaEncoding: 'ieee-p1363' });
|
||||
+ // DSA w/ ieee-p1363 signature encoding
|
||||
+ test('dsa_public.pem', 'dsa_private.pem', 'sha256', false,
|
||||
+ { dsaEncoding: 'ieee-p1363' });
|
||||
+}
|
||||
|
||||
// Test Parallel Execution w/ KeyObject is threadsafe in openssl3
|
||||
{
|
||||
@@ -150,7 +152,10 @@ MCowBQYDK2VuAyEA6pwGRbadNQAI/tYN8+/p/0/hbsdHfOEGr1ADiLVk/Gc=
|
||||
const data = crypto.randomBytes(32);
|
||||
const signature = crypto.randomBytes(16);
|
||||
|
||||
- const expected = hasOpenSSL3 ? /operation not supported for this keytype/ : /no default digest/;
|
||||
+ let expected = hasOpenSSL3 ? /operation not supported for this keytype/ : /no default digest/;
|
||||
+ if (hasOpenSSL3 || process.features.openssl_is_boringssl) {
|
||||
+ expected = /operation[\s_]not[\s_]supported[\s_]for[\s_]this[\s_]keytype/i;
|
||||
+ }
|
||||
|
||||
crypto.verify(undefined, data, untrustedKey, signature, common.mustCall((err) => {
|
||||
assert.ok(err);
|
||||
@@ -164,6 +169,6 @@ MCowBQYDK2VuAyEA6pwGRbadNQAI/tYN8+/p/0/hbsdHfOEGr1ADiLVk/Gc=
|
||||
});
|
||||
crypto.sign('sha512', 'message', privateKey, common.mustCall((err) => {
|
||||
assert.ok(err);
|
||||
- assert.match(err.message, /digest too big for rsa key/);
|
||||
+ assert.match(err.message, /digest[\s_]too[\s_]big[\s_]for[\s_]rsa[\s_]key/i);
|
||||
}));
|
||||
}
|
||||
diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js
|
||||
index 4a5f1f149fe6c739f7f1d2ee17df6e61a942d621..b3287f428ce6b3fde11d449c601a57ff5e3843f9 100644
|
||||
--- a/test/parallel/test-crypto-certificate.js
|
||||
+++ b/test/parallel/test-crypto-certificate.js
|
||||
@@ -40,8 +40,10 @@ function copyArrayBuffer(buf) {
|
||||
}
|
||||
|
||||
function checkMethods(certificate) {
|
||||
-
|
||||
+ /* spkacValid has a md5 based signature which is not allowed in boringssl
|
||||
+ https://boringssl.googlesource.com/boringssl/+/33d7e32ce40c04e8f1b99c05964956fda187819f
|
||||
assert.strictEqual(certificate.verifySpkac(spkacValid), true);
|
||||
+ */
|
||||
assert.strictEqual(certificate.verifySpkac(spkacFail), false);
|
||||
|
||||
assert.strictEqual(
|
||||
@@ -56,10 +58,12 @@ function checkMethods(certificate) {
|
||||
);
|
||||
assert.strictEqual(certificate.exportChallenge(spkacFail), '');
|
||||
|
||||
+ /* spkacValid has a md5 based signature which is not allowed in boringssl
|
||||
const ab = copyArrayBuffer(spkacValid);
|
||||
assert.strictEqual(certificate.verifySpkac(ab), true);
|
||||
assert.strictEqual(certificate.verifySpkac(new Uint8Array(ab)), true);
|
||||
assert.strictEqual(certificate.verifySpkac(new DataView(ab)), true);
|
||||
+ */
|
||||
}
|
||||
|
||||
{
|
||||
diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js
|
||||
index 6742722f9e90914b4dc8c079426d10040d476f72..8801ddfe7023fd0f7d5657b86a9164d75765322e 100644
|
||||
@@ -144,7 +82,7 @@ index 81a469c226c261564dee1e0b06b6571b18a41f1f..58b66045dba4201b7ebedd78b129420f
|
||||
|
||||
const availableCurves = new Set(crypto.getCurves());
|
||||
diff --git a/test/parallel/test-crypto-dh-errors.js b/test/parallel/test-crypto-dh-errors.js
|
||||
index 0af4db0310750cea9350ecff7fc44404c6df6c83..b14b4bbf88b902b6de916b92e3d48335c01df911 100644
|
||||
index d7527d82617efccd931f0fc2f700ab876872c1e6..b14b4bbf88b902b6de916b92e3d48335c01df911 100644
|
||||
--- a/test/parallel/test-crypto-dh-errors.js
|
||||
+++ b/test/parallel/test-crypto-dh-errors.js
|
||||
@@ -27,7 +27,7 @@ assert.throws(() => crypto.createDiffieHellman('abcdef', 13.37), {
|
||||
@@ -156,47 +94,11 @@ index 0af4db0310750cea9350ecff7fc44404c6df6c83..b14b4bbf88b902b6de916b92e3d48335
|
||||
name: 'Error',
|
||||
message: /modulus too small/,
|
||||
});
|
||||
@@ -35,7 +35,7 @@ for (const bits of [-1, 0, 1]) {
|
||||
assert.throws(() => crypto.createDiffieHellman(bits), {
|
||||
code: 'ERR_OSSL_BN_BITS_TOO_SMALL',
|
||||
name: 'Error',
|
||||
- message: /bits too small/,
|
||||
+ message: /bits[\s_]too[\s_]small/i,
|
||||
});
|
||||
}
|
||||
}
|
||||
diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js
|
||||
index d7ffbe5eca92734aa2380f482c7f9bfe7e2a36c7..b4e7002d862907d2af3b4f8e985700bd03300809 100644
|
||||
index 3c00a5fc73bb9f86f944df74f29d6b5225bc2f0e..b4e7002d862907d2af3b4f8e985700bd03300809 100644
|
||||
--- a/test/parallel/test-crypto-dh.js
|
||||
+++ b/test/parallel/test-crypto-dh.js
|
||||
@@ -60,18 +60,17 @@ const {
|
||||
let wrongBlockLength;
|
||||
if (hasOpenSSL3) {
|
||||
wrongBlockLength = {
|
||||
- message: 'error:1C80006B:Provider routines::wrong final block length',
|
||||
- code: 'ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH',
|
||||
- library: 'Provider routines',
|
||||
- reason: 'wrong final block length'
|
||||
+ message: /wrong[\s_]final[\s_]block[\s_]length/i,
|
||||
+ code: /ERR_OSSL_(EVP_)?WRONG_FINAL_BLOCK_LENGTH/,
|
||||
+ library: /Provider routines|Cipher functions/,
|
||||
+ reason: /wrong[\s_]final[\s_]block[\s_]length/i,
|
||||
};
|
||||
} else {
|
||||
wrongBlockLength = {
|
||||
- message: 'error:0606506D:digital envelope' +
|
||||
- ' routines:EVP_DecryptFinal_ex:wrong final block length',
|
||||
- code: 'ERR_OSSL_EVP_WRONG_FINAL_BLOCK_LENGTH',
|
||||
- library: 'digital envelope routines',
|
||||
- reason: 'wrong final block length'
|
||||
+ message: /wrong[\s_]final[\s_]block[\s_]length/i,
|
||||
+ code: /ERR_OSSL_(EVP_)?WRONG_FINAL_BLOCK_LENGTH/,
|
||||
+ library: /digital envelope routines|Cipher functions/,
|
||||
+ reason: /wrong[\s_]final[\s_]block[\s_]length/i,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -98,17 +97,23 @@ const {
|
||||
@@ -97,17 +97,23 @@ const {
|
||||
dh3.computeSecret('');
|
||||
}, { message: hasOpenSSL3 && !hasOpenSSL3WithNewErrorMessage ?
|
||||
'Unspecified validation error' :
|
||||
@@ -244,19 +146,6 @@ index d22281abbd5c3cab3aaa3ac494301fa6b4a8a968..5f0c6a4aed2e868a1a1049212edf2187
|
||||
|
||||
s.pipe(h).on('data', common.mustCall(function(c) {
|
||||
assert.strictEqual(c, expect);
|
||||
diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js
|
||||
index 929dd36c669239804f2cfc5168bd3bf6e15855e6..8ebe599bbd21ad30e5041e0eab1e5898caf33e49 100644
|
||||
--- a/test/parallel/test-crypto-hash.js
|
||||
+++ b/test/parallel/test-crypto-hash.js
|
||||
@@ -182,7 +182,7 @@ assert.throws(
|
||||
}
|
||||
|
||||
// Test XOF hash functions and the outputLength option.
|
||||
-{
|
||||
+if (!process.features.openssl_is_boringssl) {
|
||||
// Default outputLengths.
|
||||
assert.strictEqual(crypto.createHash('shake128').digest('hex'),
|
||||
'7f9c2ba4e88f827d616045507605853e');
|
||||
diff --git a/test/parallel/test-crypto-oneshot-hash-xof.js b/test/parallel/test-crypto-oneshot-hash-xof.js
|
||||
index 75cb4800ff1bd51fedd7bc4e2d7e6af6f4f48346..b4363c31592763235116d970a5f45d4cf63de373 100644
|
||||
--- a/test/parallel/test-crypto-oneshot-hash-xof.js
|
||||
@@ -272,51 +161,6 @@ index 75cb4800ff1bd51fedd7bc4e2d7e6af6f4f48346..b4363c31592763235116d970a5f45d4c
|
||||
// Test XOF hash functions and the outputLength option.
|
||||
{
|
||||
// Default outputLengths.
|
||||
diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js
|
||||
index 48cd1ed4df61aaddeee8785cb90f83bdd9628187..d09e01712c617597833bb1320a32a967bcf1d318 100644
|
||||
--- a/test/parallel/test-crypto-padding.js
|
||||
+++ b/test/parallel/test-crypto-padding.js
|
||||
@@ -84,14 +84,13 @@ assert.throws(function() {
|
||||
// Input must have block length %.
|
||||
enc(ODD_LENGTH_PLAIN, false);
|
||||
}, hasOpenSSL3 ? {
|
||||
- message: 'error:1C80006B:Provider routines::wrong final block length',
|
||||
- code: 'ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH',
|
||||
- reason: 'wrong final block length',
|
||||
+ message: /wrong[\s_]final[\s_]block[\s_]length/i,
|
||||
+ code: /ERR_OSSL(_EVP)?_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH/,
|
||||
+ message: /wrong[\s_]final[\s_]block[\s_]length/i,
|
||||
} : {
|
||||
- message: 'error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:' +
|
||||
- 'data not multiple of block length',
|
||||
- code: 'ERR_OSSL_EVP_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH',
|
||||
- reason: 'data not multiple of block length',
|
||||
+ message: /data[\s_]not[\s_]multiple[\s_]of[\s_]block[\s_]length/i,
|
||||
+ code: /ERR_OSSL(_EVP)?_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH/,
|
||||
+ reason: /data[\s_]not[\s_]multiple[\s_]of[\s_]block[\s_]length/i,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -110,15 +109,10 @@ assert.strictEqual(dec(EVEN_LENGTH_ENCRYPTED, false).length, 48);
|
||||
assert.throws(function() {
|
||||
// Must have at least 1 byte of padding (PKCS):
|
||||
assert.strictEqual(dec(EVEN_LENGTH_ENCRYPTED_NOPAD, true), EVEN_LENGTH_PLAIN);
|
||||
-}, hasOpenSSL3 ? {
|
||||
- message: 'error:1C800064:Provider routines::bad decrypt',
|
||||
- reason: 'bad decrypt',
|
||||
- code: 'ERR_OSSL_BAD_DECRYPT',
|
||||
-} : {
|
||||
- message: 'error:06065064:digital envelope routines:EVP_DecryptFinal_ex:' +
|
||||
- 'bad decrypt',
|
||||
- reason: 'bad decrypt',
|
||||
- code: 'ERR_OSSL_EVP_BAD_DECRYPT',
|
||||
+}, {
|
||||
+ message: /bad[\s_]decrypt/i,
|
||||
+ reason: /bad[\s_]decrypt/i,
|
||||
+ code: /ERR_OSSL(_EVP)?_BAD_DECRYPT/,
|
||||
});
|
||||
|
||||
// No-pad encrypted string should return the same:
|
||||
diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js
|
||||
index 119bc3c2d20ea7d681f0b579f9d91ad46cdc3634..8d13b105fa426015a873c411ad1d7f64b3d9580e 100644
|
||||
--- a/test/parallel/test-crypto-rsa-dsa.js
|
||||
@@ -428,23 +272,6 @@ index a66f0a94efd7c952c1d2320fbc7a39fe3a88a8a1..dc5846db0e3dcf8f7cb5f7efcdbc81c1
|
||||
|
||||
for (const [file, length] of keys) {
|
||||
const privKey = fixtures.readKey(file);
|
||||
diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js
|
||||
index 747af780469c22eb8e4c6c35424043e868f75c3d..ed0916b036a9af23d805007ebd609973ee954473 100644
|
||||
--- a/test/parallel/test-crypto-stream.js
|
||||
+++ b/test/parallel/test-crypto-stream.js
|
||||
@@ -73,9 +73,9 @@ const cipher = crypto.createCipheriv('aes-128-cbc', key, iv);
|
||||
const decipher = crypto.createDecipheriv('aes-128-cbc', badkey, iv);
|
||||
|
||||
cipher.pipe(decipher)
|
||||
- .on('error', common.expectsError(hasOpenSSL3 ? {
|
||||
- message: /bad[\s_]decrypt/,
|
||||
- library: 'Provider routines',
|
||||
+ .on('error', common.expectsError((hasOpenSSL3 || process.features.openssl_is_boringssl) ? {
|
||||
+ message: /bad[\s_]decrypt/i,
|
||||
+ library: /Provider routines|Cipher functions/,
|
||||
reason: /bad[\s_]decrypt/i,
|
||||
} : {
|
||||
message: /bad[\s_]decrypt/i,
|
||||
diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js
|
||||
index 84111740cd9ef6425b747e24e984e66e46b0b2ef..b1621d310536fae3fdec91a6a9d275ec8fc99a98 100644
|
||||
--- a/test/parallel/test-crypto.js
|
||||
@@ -502,29 +329,6 @@ index 84111740cd9ef6425b747e24e984e66e46b0b2ef..b1621d310536fae3fdec91a6a9d275ec
|
||||
// Make sure memory isn't released before being returned
|
||||
console.log(crypto.randomBytes(16));
|
||||
|
||||
diff --git a/test/parallel/test-tls-alert-handling.js b/test/parallel/test-tls-alert-handling.js
|
||||
index 7bd42bbe721c4c9442410d524c5ca740078fc72c..de49dbdc2b75517f497af353a6b24b1beb11ed69 100644
|
||||
--- a/test/parallel/test-tls-alert-handling.js
|
||||
+++ b/test/parallel/test-tls-alert-handling.js
|
||||
@@ -43,7 +43,8 @@ const errorHandler = common.mustCall((err) => {
|
||||
|
||||
assert.strictEqual(err.code, expectedErrorCode);
|
||||
assert.strictEqual(err.library, 'SSL routines');
|
||||
- if (!hasOpenSSL3) assert.strictEqual(err.function, 'ssl3_get_record');
|
||||
+ if (!hasOpenSSL3 && !process.features.openssl_is_boringssl)
|
||||
+ assert.strictEqual(err.function, 'ssl3_get_record');
|
||||
assert.match(err.reason, expectedErrorReason);
|
||||
errorReceived = true;
|
||||
if (canCloseServer())
|
||||
@@ -105,7 +106,7 @@ function sendBADTLSRecord() {
|
||||
}
|
||||
assert.strictEqual(err.code, expectedErrorCode);
|
||||
assert.strictEqual(err.library, 'SSL routines');
|
||||
- if (!hasOpenSSL3)
|
||||
+ if (!hasOpenSSL3 && !process.features.openssl_is_boringssl)
|
||||
assert.strictEqual(err.function, 'ssl3_read_bytes');
|
||||
assert.match(err.reason, expectedErrorReason);
|
||||
}));
|
||||
diff --git a/test/parallel/test-webcrypto-wrap-unwrap.js b/test/parallel/test-webcrypto-wrap-unwrap.js
|
||||
index bd788ec4ed88289d35798b8af8c9490a68e081a2..1a5477ba928bce93320f8056db02e1a7b8ddcdf3 100644
|
||||
--- a/test/parallel/test-webcrypto-wrap-unwrap.js
|
||||
@@ -584,9 +388,18 @@ index bd788ec4ed88289d35798b8af8c9490a68e081a2..1a5477ba928bce93320f8056db02e1a7
|
||||
function generateWrappingKeys() {
|
||||
return Promise.all(Object.keys(kWrappingData).map(async (name) => {
|
||||
diff --git a/test/parallel/test-x509-escaping.js b/test/parallel/test-x509-escaping.js
|
||||
index b507af88e1f7f3424b7b5d6d683a295b9d208e5e..825ba4c8dce775f401080a0522565bb7a087bcc3 100644
|
||||
index c8fc4abbb108a6d6849e8452d97d29187da2ebe6..825ba4c8dce775f401080a0522565bb7a087bcc3 100644
|
||||
--- a/test/parallel/test-x509-escaping.js
|
||||
+++ b/test/parallel/test-x509-escaping.js
|
||||
@@ -438,7 +438,7 @@ const { hasOpenSSL3 } = require('../common/crypto');
|
||||
const cert = fixtures.readKey('incorrect_san_correct_subject-cert.pem');
|
||||
|
||||
// The hostname is the CN, but not a SAN entry.
|
||||
- const servername = process.features.openssl_is_boringssl ? undefined : 'good.example.com';
|
||||
+ const servername = 'good.example.com';
|
||||
const certX509 = new X509Certificate(cert);
|
||||
assert.strictEqual(certX509.subject, `CN=${servername}`);
|
||||
assert.strictEqual(certX509.subjectAltName, 'DNS:evil.example.com');
|
||||
@@ -448,7 +448,7 @@ const { hasOpenSSL3 } = require('../common/crypto');
|
||||
assert.strictEqual(certX509.checkHost(servername, { subject: 'default' }),
|
||||
undefined);
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: fix: do not resolve electron entrypoints
|
||||
This wastes fs cycles and can result in strange behavior if this path actually exists on disk
|
||||
|
||||
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
|
||||
index 96869be3c48b84106a5fe2cb752fe979a211d96a..64f8902b1a3d5c335a3b8889b2dc801e8f9ec79c 100644
|
||||
index e4d5579565eea07013c8260fa3c4aa3b266a4b35..fbcef937b26023e0f6f97a0e58ac7350e7616f58 100644
|
||||
--- a/lib/internal/modules/esm/translators.js
|
||||
+++ b/lib/internal/modules/esm/translators.js
|
||||
@@ -404,6 +404,10 @@ function cjsPreparseModuleExports(filename, source, format) {
|
||||
@@ -407,6 +407,10 @@ function cjsPreparseModuleExports(filename, source, format) {
|
||||
return { module, exportNames: module[kModuleExportNames] };
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ index 96869be3c48b84106a5fe2cb752fe979a211d96a..64f8902b1a3d5c335a3b8889b2dc801e
|
||||
({ source } = loadSourceForCJSWithHooks(module, filename, format));
|
||||
}
|
||||
diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js
|
||||
index d337eeca801b9c187d1513519d7faf27310dbc41..34025f0c2c984b1b9993709cbd00be4158ea1db3 100644
|
||||
index 2974459755ec25139aefdab7f36811e036ac4204..593235acacd266ba7d6f1925032cd5ba455c29da 100644
|
||||
--- a/lib/internal/modules/run_main.js
|
||||
+++ b/lib/internal/modules/run_main.js
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
@@ -8,7 +8,7 @@ resource path. This commit ensures that the TraverseParent function
|
||||
bails out if the parent path is outside of the resource path.
|
||||
|
||||
diff --git a/src/node_modules.cc b/src/node_modules.cc
|
||||
index 15686c00524b6e9a31d6d27069605b1d9ebd5d38..98d4dec64c904f45ae09bf3cd8ec9b18b275bc44 100644
|
||||
index df9925404e77ec61900f89a5241c86a599e548c5..b5425122b54d91673e184ccfe88dd3a0ca2ff634 100644
|
||||
--- a/src/node_modules.cc
|
||||
+++ b/src/node_modules.cc
|
||||
@@ -333,8 +333,41 @@ const BindingData::PackageConfig* BindingData::TraverseParent(
|
||||
|
||||
@@ -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 39803ae466fc81a6b2ff6e12093cdf2082790a9f..29ce687a03ccc8e45881f70d34e009e028aa4074 100644
|
||||
index bb874fec74c73b5de0ef6d1e2a872ebceefb11ce..6fafe2a8029c535fa98276e2d73f04ee603a7805 100644
|
||||
--- a/src/env_properties.h
|
||||
+++ b/src/env_properties.h
|
||||
@@ -490,6 +490,7 @@
|
||||
@@ -491,6 +491,7 @@
|
||||
V(maybe_cache_generated_source_map, v8::Function) \
|
||||
V(messaging_deserialize_create_object, v8::Function) \
|
||||
V(message_port, v8::Object) \
|
||||
@@ -20,7 +20,7 @@ index 39803ae466fc81a6b2ff6e12093cdf2082790a9f..29ce687a03ccc8e45881f70d34e009e0
|
||||
V(performance_entry_callback, v8::Function) \
|
||||
V(prepare_stack_trace_callback, v8::Function) \
|
||||
diff --git a/src/node_modules.cc b/src/node_modules.cc
|
||||
index 9eec93f52f0d0b2e45ae04ff357b4ced0770782f..6b1a9e257b0ce52820838f88c44ec546068fe419 100644
|
||||
index fa0aa90cf4d6a9fae3cde0b0bb743b88b47c07bb..d3907c3d063c7757cdd7ef99ed09bea1eb58a3fd 100644
|
||||
--- a/src/node_modules.cc
|
||||
+++ b/src/node_modules.cc
|
||||
@@ -23,12 +23,14 @@ namespace modules {
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: fix: expose the built-in electron module via the ESM loader
|
||||
This allows usage of `import { app } from 'electron'` and `import('electron')` natively in the browser + non-sandboxed renderer
|
||||
|
||||
diff --git a/lib/internal/modules/esm/get_format.js b/lib/internal/modules/esm/get_format.js
|
||||
index 01584983c16a2ab6eec2fbb01208504f2771148b..6afbbca6c95103f3ecad29485581c94735bac0d3 100644
|
||||
index 48ccb97a6244eab4bcfbee92feb9829ca32ad0c5..043d094540845228556b0f9837f48fbaddedfb47 100644
|
||||
--- a/lib/internal/modules/esm/get_format.js
|
||||
+++ b/lib/internal/modules/esm/get_format.js
|
||||
@@ -26,6 +26,7 @@ const protocolHandlers = {
|
||||
@@ -64,18 +64,18 @@ index c284163fba86ec820af1996571fbd3d092d41d34..5f1921d15bc1d3a68c35990f85e36a0e
|
||||
}
|
||||
}
|
||||
diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js
|
||||
index d536d8215c93abd4b9e1faa125257fe120242e92..20bc3b3b15a01251964e741e16500d5d1fb5994e 100644
|
||||
index abfe88c272dcc4aa1e95948bf754f55e1df74ddf..7a29cd391fdf050ebda50c5b2f263d27001ced74 100644
|
||||
--- a/lib/internal/modules/esm/loader.js
|
||||
+++ b/lib/internal/modules/esm/loader.js
|
||||
@@ -499,7 +499,7 @@ class ModuleLoader {
|
||||
}
|
||||
@@ -437,7 +437,7 @@ class ModuleLoader {
|
||||
assert(wrap instanceof ModuleWrap, `Translator used for require(${url}) should not be async`);
|
||||
|
||||
const cjsModule = wrap[imported_cjs_symbol];
|
||||
- if (cjsModule) {
|
||||
+ if (cjsModule && translatorKey !== 'electron') {
|
||||
assert(translatorKey === 'commonjs-sync');
|
||||
// Check if the ESM initiating import CJS is being required by the same CJS module.
|
||||
if (cjsModule?.[kIsExecuting]) {
|
||||
const parentFilename = urlToFilename(parentURL);
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index c27ee4c6612c6a7ea0b6355f03563e8724fd0e40..5f03cf14e948d449d303b22ab6710b5508fb83b2 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
@@ -103,10 +103,10 @@ index c27ee4c6612c6a7ea0b6355f03563e8724fd0e40..5f03cf14e948d449d303b22ab6710b55
|
||||
|
||||
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 446349113e13bce042734010fd98af053c8cf31e..52b8b5d9255f782af96aa859dec4ffa6ca82c9d0 100644
|
||||
index 1716328c7a98996a8933dbaa00a1c6c3156fb2ff..30f887663bbbd9913eff35f0e6e5b8291adda120 100644
|
||||
--- a/lib/internal/modules/esm/translators.js
|
||||
+++ b/lib/internal/modules/esm/translators.js
|
||||
@@ -220,7 +220,9 @@ function createCJSModuleWrap(url, translateContext, parentURL, loadCJS = loadCJS
|
||||
@@ -223,7 +223,9 @@ function createCJSModuleWrap(url, translateContext, parentURL, loadCJS = loadCJS
|
||||
const { exportNames, module } = cjsPreparseModuleExports(filename, source, sourceFormat);
|
||||
cjsCache.set(url, module);
|
||||
|
||||
@@ -117,7 +117,7 @@ index 446349113e13bce042734010fd98af053c8cf31e..52b8b5d9255f782af96aa859dec4ffa6
|
||||
if (!exportNames.has('default')) {
|
||||
ArrayPrototypePush(wrapperNames, 'default');
|
||||
}
|
||||
@@ -322,6 +324,10 @@ translators.set('require-commonjs', (url, translateContext, parentURL) => {
|
||||
@@ -325,6 +327,10 @@ translators.set('require-commonjs', (url, translateContext, parentURL) => {
|
||||
return createCJSModuleWrap(url, translateContext, parentURL);
|
||||
});
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ Upstreams:
|
||||
- https://github.com/nodejs/node/pull/39136
|
||||
|
||||
diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc
|
||||
index e1c2da6969a1ce937d397735e844930f3234bba7..0bed152014949c22b6c610198df39a2522890279 100644
|
||||
index 461819ce0fa732048e4365c40a86ef55d984c35f..fa55c980a9c4f373723a867fd41276d67b0b9413 100644
|
||||
--- a/deps/ncrypto/ncrypto.cc
|
||||
+++ b/deps/ncrypto/ncrypto.cc
|
||||
@@ -11,6 +11,7 @@
|
||||
@@ -151,7 +151,7 @@ index d005bf0ffb93445fa6611a1beb1b465764271ede..01770687bd191c61af02e76d7de24bba
|
||||
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 6482bd58bb6a95cfa4074ea9535e1443aea66bb5..20d3c1d9d17fde18fc09b6ee219137831eb08a45 100644
|
||||
index 03c0c6f42d84efaeba0cc3b997cd29f77648b00d..f3631d538a38dc3a93a47707ea8dab0462fa2140 100644
|
||||
--- a/src/crypto/crypto_context.cc
|
||||
+++ b/src/crypto/crypto_context.cc
|
||||
@@ -143,7 +143,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
|
||||
@@ -163,7 +163,7 @@ index 6482bd58bb6a95cfa4074ea9535e1443aea66bb5..20d3c1d9d17fde18fc09b6ee21913783
|
||||
X509* ca = sk_X509_value(extra_certs, i);
|
||||
|
||||
// NOTE: Increments reference count on `ca`
|
||||
@@ -1831,11 +1831,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -1832,11 +1832,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.
|
||||
@@ -177,7 +177,7 @@ index 6482bd58bb6a95cfa4074ea9535e1443aea66bb5..20d3c1d9d17fde18fc09b6ee21913783
|
||||
DHPointer dh;
|
||||
{
|
||||
BIOPointer bio(LoadBIO(env, args[0]));
|
||||
@@ -2061,7 +2062,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -2062,7 +2063,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
|
||||
// Add CA certs too
|
||||
@@ -276,7 +276,7 @@ index 205e248e0f20f019e189a6c69d3c011a616b3939..12b0d804c6f1d4998b85160b0aac8eb7
|
||||
|
||||
#define V(name) case ERR_LIB_##name: lib = #name "_"; break;
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index f3a2d221f4bb52987e1bdacdadf19aacfcf65ec3..d34aec43630b3cf53004d8180446d7136b59ceac 100644
|
||||
index ed2253f1fc3cf8d59e73e4f2478dfb0d4227aacd..84a650885a79bc5c49efdc26f62ec8db48de775c 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -52,7 +52,7 @@
|
||||
@@ -288,7 +288,7 @@ index f3a2d221f4bb52987e1bdacdadf19aacfcf65ec3..d34aec43630b3cf53004d8180446d713
|
||||
#include <openssl/evp.h>
|
||||
#endif
|
||||
|
||||
@@ -1058,7 +1058,7 @@ class Environment final : public MemoryRetainer {
|
||||
@@ -1059,7 +1059,7 @@ class Environment final : public MemoryRetainer {
|
||||
kExitInfoFieldCount
|
||||
};
|
||||
|
||||
@@ -311,7 +311,7 @@ index d9c533f100d25aeab1fe8589932a8ddead431258..2acab8786a8a752b17961445edeb872c
|
||||
#if NODE_OPENSSL_HAS_QUIC
|
||||
#include <openssl/quic.h>
|
||||
diff --git a/src/node_options.h b/src/node_options.h
|
||||
index 3a1503a035e12b5dce75c77c327607c857a8a367..941ae4f15c42fb8016d03c786973fd4709ac1a0d 100644
|
||||
index 1f15c6cc6a9ae192b1b394c437393e744b5b1153..638e49ccf48d9b9c60189af9255ce7cef9184723 100644
|
||||
--- a/src/node_options.h
|
||||
+++ b/src/node_options.h
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
@@ -50,7 +50,7 @@ index 5f03cf14e948d449d303b22ab6710b5508fb83b2..72cc9444ca93ef7a1526e23314693aea
|
||||
});
|
||||
const { search, hash } = resolved;
|
||||
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
|
||||
index 52b8b5d9255f782af96aa859dec4ffa6ca82c9d0..96869be3c48b84106a5fe2cb752fe979a211d96a 100644
|
||||
index 30f887663bbbd9913eff35f0e6e5b8291adda120..e4d5579565eea07013c8260fa3c4aa3b266a4b35 100644
|
||||
--- a/lib/internal/modules/esm/translators.js
|
||||
+++ b/lib/internal/modules/esm/translators.js
|
||||
@@ -24,7 +24,7 @@ const {
|
||||
@@ -62,7 +62,7 @@ index 52b8b5d9255f782af96aa859dec4ffa6ca82c9d0..96869be3c48b84106a5fe2cb752fe979
|
||||
const { dirname, extname } = require('path');
|
||||
const {
|
||||
assertBufferSource,
|
||||
@@ -362,7 +362,7 @@ translators.set('commonjs', function commonjsStrategy(url, translateContext, par
|
||||
@@ -365,7 +365,7 @@ translators.set('commonjs', function commonjsStrategy(url, translateContext, par
|
||||
|
||||
try {
|
||||
// We still need to read the FS to detect the exports.
|
||||
|
||||
@@ -86,10 +86,10 @@ index fd28e0904d05e24e8eeb74fa36abd9727699a649..fea0426496978c0003fe1481afcf93fc
|
||||
NODE_DEFINE_CONSTANT(target, ETIMEDOUT);
|
||||
#endif
|
||||
diff --git a/src/node_errors.cc b/src/node_errors.cc
|
||||
index 552aa161636928fb646a97402988bc394ee987c1..15d78e3eca9693dc518ccb28fc7c02fa1372f34b 100644
|
||||
index d148127b89b632b339a63eb50370dfa0daca6308..55a0c986c5b6989ee9ce277bb6a9778abb2ad2ee 100644
|
||||
--- a/src/node_errors.cc
|
||||
+++ b/src/node_errors.cc
|
||||
@@ -862,10 +862,6 @@ const char* errno_string(int errorno) {
|
||||
@@ -899,10 +899,6 @@ const char* errno_string(int errorno) {
|
||||
ERRNO_CASE(ENOBUFS);
|
||||
#endif
|
||||
|
||||
@@ -100,7 +100,7 @@ index 552aa161636928fb646a97402988bc394ee987c1..15d78e3eca9693dc518ccb28fc7c02fa
|
||||
#ifdef ENODEV
|
||||
ERRNO_CASE(ENODEV);
|
||||
#endif
|
||||
@@ -904,14 +900,6 @@ const char* errno_string(int errorno) {
|
||||
@@ -941,14 +937,6 @@ const char* errno_string(int errorno) {
|
||||
ERRNO_CASE(ENOSPC);
|
||||
#endif
|
||||
|
||||
@@ -115,7 +115,7 @@ index 552aa161636928fb646a97402988bc394ee987c1..15d78e3eca9693dc518ccb28fc7c02fa
|
||||
#ifdef ENOSYS
|
||||
ERRNO_CASE(ENOSYS);
|
||||
#endif
|
||||
@@ -994,10 +982,6 @@ const char* errno_string(int errorno) {
|
||||
@@ -1031,10 +1019,6 @@ const char* errno_string(int errorno) {
|
||||
ERRNO_CASE(ESTALE);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Sat, 25 Oct 2025 11:06:10 +0200
|
||||
Subject: lib: check SharedArrayBuffer existence in fast-utf8-stream
|
||||
|
||||
After https://github.com/nodejs/node/pull/58897 calling
|
||||
Object.entries on fs will lazy-load fast-utf8-stream, which uses
|
||||
SharedArrayBuffer without checking for its existence first. It
|
||||
won't exist in the renderer process and will throw
|
||||
'SharedArrayBuffer is not a constructor'. Refactor to check
|
||||
for SharedArrayBuffer first.
|
||||
|
||||
This should be upstreamed to Node.js
|
||||
|
||||
diff --git a/lib/internal/streams/fast-utf8-stream.js b/lib/internal/streams/fast-utf8-stream.js
|
||||
index 3bfcc494d17b5cc4c9f494fab4aff4f0d68d2287..241a6b05e84f8e79b8c9b93abfda5562c2e35e9e 100644
|
||||
--- a/lib/internal/streams/fast-utf8-stream.js
|
||||
+++ b/lib/internal/streams/fast-utf8-stream.js
|
||||
@@ -49,7 +49,8 @@ const {
|
||||
const BUSY_WRITE_TIMEOUT = 100;
|
||||
const kEmptyBuffer = Buffer.allocUnsafe(0);
|
||||
|
||||
-const kNil = new Int32Array(new SharedArrayBuffer(4));
|
||||
+const haveSAB = typeof SharedArrayBuffer !== 'undefined';
|
||||
+const kNil = haveSAB ? new Int32Array(new SharedArrayBuffer(4)) : null;
|
||||
|
||||
function sleep(ms) {
|
||||
// Also filters out NaN, non-number types, including empty strings, but allows bigints
|
||||
@@ -59,10 +60,14 @@ function sleep(ms) {
|
||||
throw new ERR_INVALID_ARG_TYPE('ms', ['number', 'bigint'], ms);
|
||||
}
|
||||
throw new ERR_INVALID_ARG_VALUE.RangeError('ms', ms,
|
||||
- 'must be a number greater than 0 and less than Infinity');
|
||||
+ 'must be a number greater than 0 and less than Infinity');
|
||||
+ }
|
||||
+ if (haveSAB) {
|
||||
+ AtomicsWait(kNil, 0, 0, Number(ms));
|
||||
+ } else {
|
||||
+ const { sleep: _sleep } = internalBinding('util');
|
||||
+ _sleep(ms);
|
||||
}
|
||||
-
|
||||
- AtomicsWait(kNil, 0, 0, Number(ms));
|
||||
}
|
||||
|
||||
// 16 KB. Don't write more than docker buffer size.
|
||||
@@ -6,7 +6,7 @@ Subject: Pass all globals through "require"
|
||||
(cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62)
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index 02c9ba15853603ed69af7bdb9a3d3c7513e53ca1..1d43e75ae55a7dd37095a4379963e0e8278aafa1 100644
|
||||
index 414e450ee3a8110b8249dd831fef1ab885cc6fa1..c6ff40d814a49536808a2fd79ee6918c3ac118c9 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -209,6 +209,13 @@ const {
|
||||
|
||||
@@ -7,7 +7,7 @@ We use this to allow node's 'fs' module to read from ASAR files as if they were
|
||||
a real filesystem.
|
||||
|
||||
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
|
||||
index 963fe2ab11927a6802d2b1c0f653b5b1032d4243..0a531f216bd64477b800a169e91d859844161f16 100644
|
||||
index de18fc4934bcfef6485dc0bc853ca324ed17fc4e..52998c967109c797f3eab64f2f99990b2d69841a 100644
|
||||
--- a/lib/internal/bootstrap/node.js
|
||||
+++ b/lib/internal/bootstrap/node.js
|
||||
@@ -129,6 +129,10 @@ process.domain = null;
|
||||
|
||||
@@ -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 6e7c0dbe31d0fef23288787df44e58c44bd47c5d..451796ffc4ec93b6e317dd49d92070c61aca04e5 100644
|
||||
index 53f05293bd94e159dfedf48735989e668acdd08e..d753ad6c6b49b26b86920124f7ac90c1e052638e 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -336,6 +336,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
|
||||
@@ -323,6 +323,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
|
||||
MultiIsolatePlatform* platform,
|
||||
const SnapshotData* snapshot_data,
|
||||
const IsolateSettings& settings) {
|
||||
@@ -32,7 +32,7 @@ index 6e7c0dbe31d0fef23288787df44e58c44bd47c5d..451796ffc4ec93b6e317dd49d92070c6
|
||||
IsolateGroup group = GetOrCreateIsolateGroup();
|
||||
Isolate* isolate = Isolate::Allocate(group);
|
||||
if (isolate == nullptr) return nullptr;
|
||||
@@ -392,9 +396,12 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator,
|
||||
@@ -373,9 +377,12 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator,
|
||||
uv_loop_t* event_loop,
|
||||
MultiIsolatePlatform* platform,
|
||||
const EmbedderSnapshotData* snapshot_data,
|
||||
@@ -89,7 +89,7 @@ index fb2af584a4ae777022c9ef8c20ada1edcbbbefdc..fe6300a5d5d2d6602a84cbd33736c213
|
||||
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
||||
|
||||
diff --git a/src/env.cc b/src/env.cc
|
||||
index 53f0bf7fc1e5c85fa9a5a323e998f04310f4f75e..a78817467518245c4a190e870e0eb30658eafcdb 100644
|
||||
index fdabe48dd7776c59298f7d972286d0d2ed062752..b5cf58cc953590493beb52abf249e33e486ffc46 100644
|
||||
--- a/src/env.cc
|
||||
+++ b/src/env.cc
|
||||
@@ -611,7 +611,7 @@ IsolateData::~IsolateData() {}
|
||||
@@ -102,10 +102,10 @@ index 53f0bf7fc1e5c85fa9a5a323e998f04310f4f75e..a78817467518245c4a190e870e0eb306
|
||||
isolate, object, wrappable);
|
||||
}
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 9c624e4ef26c1b06a6c4bca7def245935189ce07..84c121f13caa1472cef67113fbc7b7213e7af7e1 100644
|
||||
index 19c34a430d095c06ccf5a988db91311d420a485a..154fb15e6c8fe985e92378cc8471aa6a9d579b07 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -604,7 +604,8 @@ NODE_EXTERN v8::Isolate* NewIsolate(
|
||||
@@ -603,7 +603,8 @@ NODE_EXTERN v8::Isolate* NewIsolate(
|
||||
struct uv_loop_s* event_loop,
|
||||
MultiIsolatePlatform* platform,
|
||||
const EmbedderSnapshotData* snapshot_data = nullptr,
|
||||
@@ -115,7 +115,7 @@ index 9c624e4ef26c1b06a6c4bca7def245935189ce07..84c121f13caa1472cef67113fbc7b721
|
||||
NODE_EXTERN v8::Isolate* NewIsolate(
|
||||
std::shared_ptr<ArrayBufferAllocator> allocator,
|
||||
struct uv_loop_s* event_loop,
|
||||
@@ -1625,9 +1626,10 @@ void RegisterSignalHandler(int signal,
|
||||
@@ -1624,9 +1625,10 @@ void RegisterSignalHandler(int signal,
|
||||
// work with only Node.js versions with v8::Object::Wrap() should use that
|
||||
// instead.
|
||||
NODE_DEPRECATED("Use v8::Object::Wrap()",
|
||||
|
||||
@@ -9,7 +9,7 @@ that cannot be decoded (might be related to SSL implementation issues),
|
||||
skip them.
|
||||
|
||||
diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
|
||||
index 96f6ea29525bc2c60297e7be5bc1d0b74cd568e1..9b83f8d6b2c7639044e739a7f055e457882370a2 100644
|
||||
index fc6d295a401d5283ba19dd5c95b748c83b7055a9..b971ea5b6842549563c0c54168d17ecf6e72bb73 100644
|
||||
--- a/src/crypto/crypto_context.cc
|
||||
+++ b/src/crypto/crypto_context.cc
|
||||
@@ -507,7 +507,11 @@ void ReadMacOSKeychainCertificates(
|
||||
|
||||
@@ -1,308 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Fedor Indutny <indutny@signal.org>
|
||||
Date: Tue, 11 Nov 2025 13:43:01 -0800
|
||||
Subject: src: use CP_UTF8 for wide file names on win32
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
`src/node_modules.cc` needs to be consistent with `src/node_file.cc` in
|
||||
how it translates the utf8 strings to `std::wstring` otherwise we might
|
||||
end up in situation where we can read the source code of imported
|
||||
package from disk, but fail to recognize that it is an ESM (or CJS) and
|
||||
cause runtime errors. This type of error is possible on Windows when the
|
||||
path contains unicode characters and "Language for non-Unicode programs"
|
||||
is set to "Chinese (Traditional, Taiwan)".
|
||||
|
||||
See: #58768
|
||||
PR-URL: https://github.com/nodejs/node/pull/60575
|
||||
Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
||||
Reviewed-By: Darshan Sen <raisinten@gmail.com>
|
||||
Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
|
||||
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
|
||||
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
|
||||
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
|
||||
|
||||
diff --git a/src/node_file.cc b/src/node_file.cc
|
||||
index 969e7d08086f8442bed476feaf15599b8c79db7c..e7459654401c275dfb86207831016ed71060bcc9 100644
|
||||
--- a/src/node_file.cc
|
||||
+++ b/src/node_file.cc
|
||||
@@ -3175,42 +3175,6 @@ static void GetFormatOfExtensionlessFile(
|
||||
return args.GetReturnValue().Set(EXTENSIONLESS_FORMAT_JAVASCRIPT);
|
||||
}
|
||||
|
||||
-#ifdef _WIN32
|
||||
-#define BufferValueToPath(str) \
|
||||
- std::filesystem::path(ConvertToWideString(str.ToString(), CP_UTF8))
|
||||
-
|
||||
-std::string ConvertWideToUTF8(const std::wstring& wstr) {
|
||||
- if (wstr.empty()) return std::string();
|
||||
-
|
||||
- int size_needed = WideCharToMultiByte(CP_UTF8,
|
||||
- 0,
|
||||
- &wstr[0],
|
||||
- static_cast<int>(wstr.size()),
|
||||
- nullptr,
|
||||
- 0,
|
||||
- nullptr,
|
||||
- nullptr);
|
||||
- std::string strTo(size_needed, 0);
|
||||
- WideCharToMultiByte(CP_UTF8,
|
||||
- 0,
|
||||
- &wstr[0],
|
||||
- static_cast<int>(wstr.size()),
|
||||
- &strTo[0],
|
||||
- size_needed,
|
||||
- nullptr,
|
||||
- nullptr);
|
||||
- return strTo;
|
||||
-}
|
||||
-
|
||||
-#define PathToString(path) ConvertWideToUTF8(path.wstring());
|
||||
-
|
||||
-#else // _WIN32
|
||||
-
|
||||
-#define BufferValueToPath(str) std::filesystem::path(str.ToStringView());
|
||||
-#define PathToString(path) path.native();
|
||||
-
|
||||
-#endif // _WIN32
|
||||
-
|
||||
static void CpSyncCheckPaths(const FunctionCallbackInfo<Value>& args) {
|
||||
Environment* env = Environment::GetCurrent(args);
|
||||
Isolate* isolate = env->isolate();
|
||||
@@ -3223,7 +3187,7 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo<Value>& args) {
|
||||
THROW_IF_INSUFFICIENT_PERMISSIONS(
|
||||
env, permission::PermissionScope::kFileSystemRead, src.ToStringView());
|
||||
|
||||
- auto src_path = BufferValueToPath(src);
|
||||
+ auto src_path = src.ToPath();
|
||||
|
||||
BufferValue dest(isolate, args[1]);
|
||||
CHECK_NOT_NULL(*dest);
|
||||
@@ -3231,7 +3195,7 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo<Value>& args) {
|
||||
THROW_IF_INSUFFICIENT_PERMISSIONS(
|
||||
env, permission::PermissionScope::kFileSystemWrite, dest.ToStringView());
|
||||
|
||||
- auto dest_path = BufferValueToPath(dest);
|
||||
+ auto dest_path = dest.ToPath();
|
||||
bool dereference = args[2]->IsTrue();
|
||||
bool recursive = args[3]->IsTrue();
|
||||
|
||||
@@ -3260,8 +3224,8 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo<Value>& args) {
|
||||
(src_status.type() == std::filesystem::file_type::directory) ||
|
||||
(dereference && src_status.type() == std::filesystem::file_type::symlink);
|
||||
|
||||
- auto src_path_str = PathToString(src_path);
|
||||
- auto dest_path_str = PathToString(dest_path);
|
||||
+ auto src_path_str = ConvertPathToUTF8(src_path);
|
||||
+ auto dest_path_str = ConvertPathToUTF8(dest_path);
|
||||
|
||||
if (!error_code) {
|
||||
// Check if src and dest are identical.
|
||||
@@ -3356,7 +3320,7 @@ static bool CopyUtimes(const std::filesystem::path& src,
|
||||
uv_fs_t req;
|
||||
auto cleanup = OnScopeLeave([&req]() { uv_fs_req_cleanup(&req); });
|
||||
|
||||
- auto src_path_str = PathToString(src);
|
||||
+ auto src_path_str = ConvertPathToUTF8(src);
|
||||
int result = uv_fs_stat(nullptr, &req, src_path_str.c_str(), nullptr);
|
||||
if (is_uv_error(result)) {
|
||||
env->ThrowUVException(result, "stat", nullptr, src_path_str.c_str());
|
||||
@@ -3367,7 +3331,7 @@ static bool CopyUtimes(const std::filesystem::path& src,
|
||||
const double source_atime = s->st_atim.tv_sec + s->st_atim.tv_nsec / 1e9;
|
||||
const double source_mtime = s->st_mtim.tv_sec + s->st_mtim.tv_nsec / 1e9;
|
||||
|
||||
- auto dest_file_path_str = PathToString(dest);
|
||||
+ auto dest_file_path_str = ConvertPathToUTF8(dest);
|
||||
int utime_result = uv_fs_utime(nullptr,
|
||||
&req,
|
||||
dest_file_path_str.c_str(),
|
||||
@@ -3502,7 +3466,7 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
|
||||
std::error_code error;
|
||||
for (auto dir_entry : std::filesystem::directory_iterator(src)) {
|
||||
auto dest_file_path = dest / dir_entry.path().filename();
|
||||
- auto dest_str = PathToString(dest);
|
||||
+ auto dest_str = ConvertPathToUTF8(dest);
|
||||
|
||||
if (dir_entry.is_symlink()) {
|
||||
if (verbatim_symlinks) {
|
||||
@@ -3565,7 +3529,7 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
} else if (std::filesystem::is_regular_file(dest_file_path)) {
|
||||
if (!dereference || (!force && error_on_exist)) {
|
||||
- auto dest_file_path_str = PathToString(dest_file_path);
|
||||
+ auto dest_file_path_str = ConvertPathToUTF8(dest_file_path);
|
||||
env->ThrowStdErrException(
|
||||
std::make_error_code(std::errc::file_exists),
|
||||
"cp",
|
||||
diff --git a/src/node_modules.cc b/src/node_modules.cc
|
||||
index 5355f2f96e9c9f6548ae43fd38b0d89a825e6b60..15686c00524b6e9a31d6d27069605b1d9ebd5d38 100644
|
||||
--- a/src/node_modules.cc
|
||||
+++ b/src/node_modules.cc
|
||||
@@ -345,22 +345,24 @@ const BindingData::PackageConfig* BindingData::TraverseParent(
|
||||
|
||||
// Stop the search when the process doesn't have permissions
|
||||
// to walk upwards
|
||||
- if (is_permissions_enabled &&
|
||||
- !env->permission()->is_granted(
|
||||
- env,
|
||||
- permission::PermissionScope::kFileSystemRead,
|
||||
- current_path.generic_string())) [[unlikely]] {
|
||||
- return nullptr;
|
||||
+ if (is_permissions_enabled) {
|
||||
+ if (!env->permission()->is_granted(
|
||||
+ env,
|
||||
+ permission::PermissionScope::kFileSystemRead,
|
||||
+ ConvertGenericPathToUTF8(current_path))) [[unlikely]] {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
}
|
||||
|
||||
// Check if the path ends with `/node_modules`
|
||||
- if (current_path.generic_string().ends_with("/node_modules")) {
|
||||
+ if (current_path.filename() == "node_modules") {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto package_json_path = current_path / "package.json";
|
||||
+
|
||||
auto package_json =
|
||||
- GetPackageJSON(realm, package_json_path.string(), nullptr);
|
||||
+ GetPackageJSON(realm, ConvertPathToUTF8(package_json_path), nullptr);
|
||||
if (package_json != nullptr) {
|
||||
return package_json;
|
||||
}
|
||||
@@ -382,20 +384,12 @@ void BindingData::GetNearestParentPackageJSONType(
|
||||
|
||||
ToNamespacedPath(realm->env(), &path_value);
|
||||
|
||||
- std::string path_value_str = path_value.ToString();
|
||||
+ auto path = path_value.ToPath();
|
||||
+
|
||||
if (slashCheck) {
|
||||
- path_value_str.push_back(kPathSeparator);
|
||||
+ path /= "";
|
||||
}
|
||||
|
||||
- std::filesystem::path path;
|
||||
-
|
||||
-#ifdef _WIN32
|
||||
- std::wstring wide_path = ConvertToWideString(path_value_str, GetACP());
|
||||
- path = std::filesystem::path(wide_path);
|
||||
-#else
|
||||
- path = std::filesystem::path(path_value_str);
|
||||
-#endif
|
||||
-
|
||||
auto package_json = TraverseParent(realm, path);
|
||||
|
||||
if (package_json == nullptr) {
|
||||
diff --git a/src/util-inl.h b/src/util-inl.h
|
||||
index d07bceb425f00882db116975a92f4835d7c2cf3b..6898e8ea794675e903e13e2b45524d572a3f68bb 100644
|
||||
--- a/src/util-inl.h
|
||||
+++ b/src/util-inl.h
|
||||
@@ -718,12 +718,11 @@ inline bool IsWindowsBatchFile(const char* filename) {
|
||||
return !extension.empty() && (extension == "cmd" || extension == "bat");
|
||||
}
|
||||
|
||||
-inline std::wstring ConvertToWideString(const std::string& str,
|
||||
- UINT code_page) {
|
||||
+inline std::wstring ConvertUTF8ToWideString(const std::string& str) {
|
||||
int size_needed = MultiByteToWideChar(
|
||||
- code_page, 0, &str[0], static_cast<int>(str.size()), nullptr, 0);
|
||||
+ CP_UTF8, 0, &str[0], static_cast<int>(str.size()), nullptr, 0);
|
||||
std::wstring wstrTo(size_needed, 0);
|
||||
- MultiByteToWideChar(code_page,
|
||||
+ MultiByteToWideChar(CP_UTF8,
|
||||
0,
|
||||
&str[0],
|
||||
static_cast<int>(str.size()),
|
||||
@@ -731,6 +730,59 @@ inline std::wstring ConvertToWideString(const std::string& str,
|
||||
size_needed);
|
||||
return wstrTo;
|
||||
}
|
||||
+
|
||||
+std::string ConvertWideStringToUTF8(const std::wstring& wstr) {
|
||||
+ if (wstr.empty()) return std::string();
|
||||
+
|
||||
+ int size_needed = WideCharToMultiByte(CP_UTF8,
|
||||
+ 0,
|
||||
+ &wstr[0],
|
||||
+ static_cast<int>(wstr.size()),
|
||||
+ nullptr,
|
||||
+ 0,
|
||||
+ nullptr,
|
||||
+ nullptr);
|
||||
+ std::string strTo(size_needed, 0);
|
||||
+ WideCharToMultiByte(CP_UTF8,
|
||||
+ 0,
|
||||
+ &wstr[0],
|
||||
+ static_cast<int>(wstr.size()),
|
||||
+ &strTo[0],
|
||||
+ size_needed,
|
||||
+ nullptr,
|
||||
+ nullptr);
|
||||
+ return strTo;
|
||||
+}
|
||||
+
|
||||
+template <typename T, size_t kStackStorageSize>
|
||||
+std::filesystem::path MaybeStackBuffer<T, kStackStorageSize>::ToPath() const {
|
||||
+ std::wstring wide_path = ConvertUTF8ToWideString(ToString());
|
||||
+ return std::filesystem::path(wide_path);
|
||||
+}
|
||||
+
|
||||
+std::string ConvertPathToUTF8(const std::filesystem::path& path) {
|
||||
+ return ConvertWideStringToUTF8(path.wstring());
|
||||
+}
|
||||
+
|
||||
+std::string ConvertGenericPathToUTF8(const std::filesystem::path& path) {
|
||||
+ return ConvertWideStringToUTF8(path.generic_wstring());
|
||||
+}
|
||||
+
|
||||
+#else // _WIN32
|
||||
+
|
||||
+template <typename T, size_t kStackStorageSize>
|
||||
+std::filesystem::path MaybeStackBuffer<T, kStackStorageSize>::ToPath() const {
|
||||
+ return std::filesystem::path(ToStringView());
|
||||
+}
|
||||
+
|
||||
+std::string ConvertPathToUTF8(const std::filesystem::path& path) {
|
||||
+ return path.native();
|
||||
+}
|
||||
+
|
||||
+std::string ConvertGenericPathToUTF8(const std::filesystem::path& path) {
|
||||
+ return path.generic_string();
|
||||
+}
|
||||
+
|
||||
#endif // _WIN32
|
||||
|
||||
inline v8::MaybeLocal<v8::Object> NewDictionaryInstance(
|
||||
diff --git a/src/util.h b/src/util.h
|
||||
index 1db426df35e4976427b578a2974041ec9e92cf4c..52e6a149d6760640d93c56ce91a759ae9207a8c7 100644
|
||||
--- a/src/util.h
|
||||
+++ b/src/util.h
|
||||
@@ -507,6 +507,8 @@ class MaybeStackBuffer {
|
||||
inline std::basic_string_view<T> ToStringView() const {
|
||||
return {out(), length()};
|
||||
}
|
||||
+ // This can only be used if the buffer contains path data in UTF8
|
||||
+ inline std::filesystem::path ToPath() const;
|
||||
|
||||
private:
|
||||
size_t length_;
|
||||
@@ -1038,9 +1040,15 @@ class JSONOutputStream final : public v8::OutputStream {
|
||||
// Returns true if OS==Windows and filename ends in .bat or .cmd,
|
||||
// case insensitive.
|
||||
inline bool IsWindowsBatchFile(const char* filename);
|
||||
-inline std::wstring ConvertToWideString(const std::string& str, UINT code_page);
|
||||
+inline std::wstring ConvertUTF8ToWideString(const std::string& str);
|
||||
+inline std::string ConvertWideStringToUTF8(const std::wstring& wstr);
|
||||
+
|
||||
#endif // _WIN32
|
||||
|
||||
+inline std::filesystem::path ConvertUTF8ToPath(const std::string& str);
|
||||
+inline std::string ConvertPathToUTF8(const std::filesystem::path& path);
|
||||
+inline std::string ConvertGenericPathToUTF8(const std::filesystem::path& path);
|
||||
+
|
||||
// A helper to create a new instance of the dictionary template.
|
||||
// Unlike v8::DictionaryTemplate::NewInstance, this method will
|
||||
// check that all properties have been set (are not empty MaybeLocals)
|
||||
@@ -6,75 +6,6 @@ Subject: support V8 sandboxed pointers
|
||||
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 31007e599f0b717d586aa97b26c610047f402f0f..6e7c0dbe31d0fef23288787df44e58c44bd47c5d 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -111,6 +111,14 @@ MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context,
|
||||
return result;
|
||||
}
|
||||
|
||||
+NodeArrayBufferAllocator::NodeArrayBufferAllocator() {
|
||||
+ zero_fill_field_ = static_cast<uint32_t*>(allocator_->Allocate(sizeof(*zero_fill_field_)));
|
||||
+}
|
||||
+
|
||||
+NodeArrayBufferAllocator::~NodeArrayBufferAllocator() {
|
||||
+ allocator_->Free(zero_fill_field_, sizeof(*zero_fill_field_));
|
||||
+}
|
||||
+
|
||||
void* NodeArrayBufferAllocator::Allocate(size_t size) {
|
||||
void* ret;
|
||||
if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers) {
|
||||
@@ -342,6 +350,12 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
|
||||
// but also otherwise just doesn't work, and the only real alternative
|
||||
// is disabling shared-readonly-heap mode altogether.
|
||||
static Isolate::CreateParams first_params = *params;
|
||||
+ // Clear allocator pointers to prevent use-after-free during static
|
||||
+ // destruction. The static first_params can outlive V8's internal
|
||||
+ // allocator systems, causing crashes when its destructor tries to
|
||||
+ // free resources after V8 has shut down.
|
||||
+ first_params.array_buffer_allocator = nullptr;
|
||||
+ first_params.array_buffer_allocator_shared.reset();
|
||||
params->snapshot_blob = first_params.snapshot_blob;
|
||||
params->external_references = first_params.external_references;
|
||||
}
|
||||
diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc
|
||||
index 46a7d1396dc1a175ae99f4e403721f1730fdd320..bbb0abb3b9563074d350578e0f5a8fa211046b17 100644
|
||||
--- a/src/crypto/crypto_dh.cc
|
||||
+++ b/src/crypto/crypto_dh.cc
|
||||
@@ -61,17 +61,22 @@ MaybeLocal<Value> DataPointerToBuffer(Environment* env, DataPointer&& data) {
|
||||
bool secure;
|
||||
};
|
||||
#ifdef V8_ENABLE_SANDBOX
|
||||
- auto backing = ArrayBuffer::NewBackingStore(
|
||||
- env->isolate(),
|
||||
- data.size(),
|
||||
- BackingStoreInitializationMode::kUninitialized,
|
||||
- BackingStoreOnFailureMode::kReturnNull);
|
||||
- if (!backing) {
|
||||
- THROW_ERR_MEMORY_ALLOCATION_FAILED(env);
|
||||
- return MaybeLocal<Value>();
|
||||
- }
|
||||
+ std::unique_ptr<v8::BackingStore> backing;
|
||||
if (data.size() > 0) {
|
||||
- memcpy(backing->Data(), data.get(), data.size());
|
||||
+ std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator());
|
||||
+ void* v8_data = allocator->Allocate(data.size());
|
||||
+ CHECK(v8_data);
|
||||
+ memcpy(v8_data, data.get(), data.size());
|
||||
+ backing = ArrayBuffer::NewBackingStore(
|
||||
+ v8_data,
|
||||
+ data.size(),
|
||||
+ [](void* data, size_t length, void*) {
|
||||
+ std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator());
|
||||
+ allocator->Free(data, length);
|
||||
+ }, nullptr);
|
||||
+ } else {
|
||||
+ NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data());
|
||||
+ backing = v8::ArrayBuffer::NewBackingStore(env->isolate(), data.size());
|
||||
}
|
||||
#else
|
||||
auto backing = ArrayBuffer::NewBackingStore(
|
||||
diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc
|
||||
index 12b0d804c6f1d4998b85160b0aac8eb7a3b5576b..27bd93769233dc65a064710db4095d9cdc3a8b1a 100644
|
||||
--- a/src/crypto/crypto_util.cc
|
||||
@@ -189,51 +120,19 @@ index b30297eac08ad9587642b723f91d7e3b954294d4..4c5427596d1c90d3a413cdd9ff4f1151
|
||||
#else
|
||||
auto backing = ArrayBuffer::NewBackingStore(
|
||||
mem->data,
|
||||
diff --git a/src/env-inl.h b/src/env-inl.h
|
||||
index 97c43afb487b58c0c77bd59b4a6b6d7a13690053..5dfbd564d5bbd22ebf3b529a07b73e85cbe51986 100644
|
||||
--- a/src/env-inl.h
|
||||
+++ b/src/env-inl.h
|
||||
@@ -44,6 +44,16 @@
|
||||
|
||||
namespace node {
|
||||
|
||||
+NoArrayBufferZeroFillScope::NoArrayBufferZeroFillScope(
|
||||
+ IsolateData* isolate_data)
|
||||
+ : node_allocator_(isolate_data->node_allocator()) {
|
||||
+ if (node_allocator_ != nullptr) node_allocator_->zero_fill_field()[0] = 0;
|
||||
+}
|
||||
+
|
||||
+NoArrayBufferZeroFillScope::~NoArrayBufferZeroFillScope() {
|
||||
+ if (node_allocator_ != nullptr) node_allocator_->zero_fill_field()[0] = 1;
|
||||
+}
|
||||
+
|
||||
inline v8::Isolate* IsolateData::isolate() const {
|
||||
return isolate_;
|
||||
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
|
||||
index 49df0b4284748effb27b05ecd69f05699dd8be75..77da37881bb351249c45e405289193c10d083e0c 100644
|
||||
--- a/src/node_buffer.cc
|
||||
+++ b/src/node_buffer.cc
|
||||
@@ -1420,7 +1420,7 @@ inline size_t CheckNumberToSize(Local<Value> number) {
|
||||
CHECK(value >= 0 && value < maxSize);
|
||||
size_t size = static_cast<size_t>(value);
|
||||
#ifdef V8_ENABLE_SANDBOX
|
||||
- CHECK_LE(size, kMaxSafeBufferSizeForSandbox);
|
||||
+ CHECK_LE(size, v8::internal::kMaxSafeBufferSizeForSandbox);
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index d34aec43630b3cf53004d8180446d7136b59ceac..b30314d7773742e2332ff47f84bc326151563690 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -111,6 +111,19 @@ class ModuleWrap;
|
||||
class Environment;
|
||||
class Realm;
|
||||
|
||||
+// Disables zero-filling for ArrayBuffer allocations in this scope. This is
|
||||
+// similar to how we implement Buffer.allocUnsafe() in JS land.
|
||||
+class NoArrayBufferZeroFillScope {
|
||||
+ public:
|
||||
+ inline explicit NoArrayBufferZeroFillScope(IsolateData* isolate_data);
|
||||
+ inline ~NoArrayBufferZeroFillScope();
|
||||
+
|
||||
+ private:
|
||||
+ NodeArrayBufferAllocator* node_allocator_;
|
||||
+
|
||||
+ friend class Environment;
|
||||
+};
|
||||
+
|
||||
struct IsolateDataSerializeInfo {
|
||||
std::vector<SnapshotIndex> primitive_values;
|
||||
std::vector<PropInfo> template_values;
|
||||
diff --git a/src/node_i18n.cc b/src/node_i18n.cc
|
||||
index 3c4f419aa29470b3280174b58680b9421b0340b5..3b24ad2a2316f89d98b067e2c13988f87a9a00d2 100644
|
||||
--- a/src/node_i18n.cc
|
||||
@@ -274,30 +173,6 @@ index 3c4f419aa29470b3280174b58680b9421b0340b5..3b24ad2a2316f89d98b067e2c13988f8
|
||||
}
|
||||
|
||||
constexpr const char* EncodingName(const enum encoding encoding) {
|
||||
diff --git a/src/node_internals.h b/src/node_internals.h
|
||||
index 95ce3cf882296bf8eed5a11fe189857c3c88fd15..6612751d07803a1e9b8bf8196b5b8067644064ad 100644
|
||||
--- a/src/node_internals.h
|
||||
+++ b/src/node_internals.h
|
||||
@@ -124,7 +124,9 @@ v8::MaybeLocal<v8::Object> InitializePrivateSymbols(
|
||||
|
||||
class NodeArrayBufferAllocator : public ArrayBufferAllocator {
|
||||
public:
|
||||
- inline uint32_t* zero_fill_field() { return &zero_fill_field_; }
|
||||
+ NodeArrayBufferAllocator();
|
||||
+ ~NodeArrayBufferAllocator() override;
|
||||
+ inline uint32_t* zero_fill_field() { return zero_fill_field_; }
|
||||
|
||||
void* Allocate(size_t size) override; // Defined in src/node.cc
|
||||
void* AllocateUninitialized(size_t size) override;
|
||||
@@ -142,7 +144,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator {
|
||||
}
|
||||
|
||||
private:
|
||||
- uint32_t zero_fill_field_ = 1; // Boolean but exposed as uint32 to JS land.
|
||||
+ uint32_t* zero_fill_field_ = nullptr; // Boolean but exposed as uint32 to JS land.
|
||||
std::atomic<size_t> total_mem_usage_ {0};
|
||||
|
||||
// Delegate to V8's allocator for compatibility with the V8 memory cage.
|
||||
diff --git a/src/node_serdes.cc b/src/node_serdes.cc
|
||||
index 00fcd4b6afccce47ff21c4447d9cd60f25c11835..5f96ee2051e5339456185efddb149c4d43093f31 100644
|
||||
--- a/src/node_serdes.cc
|
||||
@@ -434,26 +309,3 @@ index ef659f1c39f7ee958879bf395377bc99911fc346..225b1465b7c97d972a38968faf6d6850
|
||||
auto ab = ArrayBuffer::New(isolate, std::move(bs));
|
||||
v8::Local<Uint8Array> u8 = v8::Uint8Array::New(ab, 0, 1);
|
||||
|
||||
diff --git a/test/parallel/test-process-env-allowed-flags-are-documented.js b/test/parallel/test-process-env-allowed-flags-are-documented.js
|
||||
index 07e38748b07ddd32a6e3caa3c34183387e1cae18..f09bf0940dad2068f0aa5dce783dd422773d4bbb 100644
|
||||
--- a/test/parallel/test-process-env-allowed-flags-are-documented.js
|
||||
+++ b/test/parallel/test-process-env-allowed-flags-are-documented.js
|
||||
@@ -49,6 +49,8 @@ if (!hasOpenSSL3) {
|
||||
documented.delete('--openssl-shared-config');
|
||||
}
|
||||
|
||||
+const isV8Sandboxed = process.config.variables.v8_enable_sandbox;
|
||||
+
|
||||
// Filter out options that are conditionally present.
|
||||
const conditionalOpts = [
|
||||
{
|
||||
@@ -74,6 +76,9 @@ const conditionalOpts = [
|
||||
}, {
|
||||
include: process.features.inspector,
|
||||
filter: (opt) => opt.startsWith('--inspect') || opt === '--debug-port'
|
||||
+ }, {
|
||||
+ include: !isV8Sandboxed,
|
||||
+ filter: (opt) => ['--secure-heap', '--secure-heap-min'].includes(opt)
|
||||
},
|
||||
];
|
||||
documented.forEach((opt) => {
|
||||
|
||||
@@ -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 bf040bf2ee9c727542e347f3467e04a29bfd1b63..9dcd28bc499aa2b1ba313ab9e921d6835140cc92 100644
|
||||
index 8ac30c589926a46356f44076a21f8c18057378e1..8531599f1c1474640bf804737244129c5860b0bd 100644
|
||||
--- a/test/parallel/parallel.status
|
||||
+++ b/test/parallel/parallel.status
|
||||
@@ -5,6 +5,16 @@ prefix parallel
|
||||
|
||||
38
patches/node/test_make_buffer_sizes_32bit-aware_in.patch
Normal file
38
patches/node/test_make_buffer_sizes_32bit-aware_in.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ren=C3=A9?= <contact.9a5d6388@renegade334.me.uk>
|
||||
Date: Sat, 20 Dec 2025 22:20:21 +0000
|
||||
Subject: test: make buffer sizes 32bit-aware in
|
||||
test-internal-util-construct-sab
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/61026
|
||||
Fixes: https://github.com/nodejs/node/issues/61025
|
||||
Refs: https://github.com/nodejs/node/pull/60497
|
||||
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
|
||||
|
||||
diff --git a/test/parallel/test-internal-util-construct-sab.js b/test/parallel/test-internal-util-construct-sab.js
|
||||
index 5ff9b09f8e7d36a91825a38e861b8c2615c62500..403b59809e47d2e1d3503a059826f66334a2f035 100644
|
||||
--- a/test/parallel/test-internal-util-construct-sab.js
|
||||
+++ b/test/parallel/test-internal-util-construct-sab.js
|
||||
@@ -3,16 +3,20 @@
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
+const { kMaxLength } = require('buffer');
|
||||
const { isSharedArrayBuffer } = require('util/types');
|
||||
const { constructSharedArrayBuffer } = require('internal/util');
|
||||
|
||||
// We're testing that we can construct a SAB even when the global is not exposed.
|
||||
assert.strictEqual(typeof SharedArrayBuffer, 'undefined');
|
||||
|
||||
-for (const length of [undefined, 0, 1, 2 ** 32]) {
|
||||
+for (const length of [undefined, 0, 1, 2 ** 16]) {
|
||||
assert(isSharedArrayBuffer(constructSharedArrayBuffer(length)));
|
||||
}
|
||||
|
||||
-for (const length of [-1, Number.MAX_SAFE_INTEGER + 1, 2 ** 64]) {
|
||||
+// Specifically test the following cases:
|
||||
+// - out-of-range allocation requests should not crash the process
|
||||
+// - no int64 overflow
|
||||
+for (const length of [-1, kMaxLength + 1, 2 ** 64]) {
|
||||
assert.throws(() => constructSharedArrayBuffer(length), RangeError);
|
||||
}
|
||||
@@ -107,10 +107,12 @@
|
||||
"parallel/test-tls-multi-key",
|
||||
"parallel/test-tls-multi-pfx",
|
||||
"parallel/test-tls-no-cert-required",
|
||||
"parallel/test-tls-no-sslv23.js",
|
||||
"parallel/test-tls-options-boolean-check",
|
||||
"parallel/test-tls-passphrase",
|
||||
"parallel/test-tls-peer-certificate",
|
||||
"parallel/test-tls-pfx-authorizationerror",
|
||||
"parallel/test-tls-psk-alpn-callback-exception-handling",
|
||||
"parallel/test-tls-psk-circuit",
|
||||
"parallel/test-tls-reduced-SECLEVEL-in-cipher",
|
||||
"parallel/test-tls-root-certificates",
|
||||
|
||||
@@ -11,14 +11,9 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/task/task_traits.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/browser/native_window.h"
|
||||
#include "shell/browser/window_list.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/gin_helper/error_thrower.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
@@ -33,16 +28,10 @@
|
||||
#include <windows.foundation.metadata.h>
|
||||
#include <windows.h>
|
||||
#include <windows.management.deployment.h>
|
||||
// Use pre-generated C++/WinRT headers from //third_party/nearby instead of the
|
||||
// SDK's cppwinrt headers, which are missing implementation files.
|
||||
#include "third_party/nearby/src/internal/platform/implementation/windows/generated/winrt/Windows.ApplicationModel.h"
|
||||
#include "third_party/nearby/src/internal/platform/implementation/windows/generated/winrt/Windows.Foundation.Collections.h"
|
||||
#include "third_party/nearby/src/internal/platform/implementation/windows/generated/winrt/Windows.Foundation.Metadata.h"
|
||||
#include "third_party/nearby/src/internal/platform/implementation/windows/generated/winrt/Windows.Foundation.h"
|
||||
#include "third_party/nearby/src/internal/platform/implementation/windows/generated/winrt/Windows.Management.Deployment.h"
|
||||
#include "third_party/nearby/src/internal/platform/implementation/windows/generated/winrt/base.h"
|
||||
#include <wrl.h>
|
||||
|
||||
#include "base/win/scoped_com_initializer.h"
|
||||
#include "base/win/core_winrt_util.h"
|
||||
#include "base/win/scoped_hstring.h"
|
||||
#endif
|
||||
|
||||
namespace electron {
|
||||
@@ -55,6 +44,53 @@ const bool debug_msix_updater =
|
||||
namespace {
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
|
||||
// Type aliases for cleaner code
|
||||
using ABI::Windows::ApplicationModel::IAppInstallerInfo;
|
||||
using ABI::Windows::ApplicationModel::IPackage;
|
||||
using ABI::Windows::ApplicationModel::IPackage2;
|
||||
using ABI::Windows::ApplicationModel::IPackage4;
|
||||
using ABI::Windows::ApplicationModel::IPackage6;
|
||||
using ABI::Windows::ApplicationModel::IPackageId;
|
||||
using ABI::Windows::ApplicationModel::IPackageStatics;
|
||||
using ABI::Windows::ApplicationModel::PackageSignatureKind;
|
||||
using ABI::Windows::ApplicationModel::PackageSignatureKind_Developer;
|
||||
using ABI::Windows::ApplicationModel::PackageSignatureKind_Enterprise;
|
||||
using ABI::Windows::ApplicationModel::PackageSignatureKind_None;
|
||||
using ABI::Windows::ApplicationModel::PackageSignatureKind_Store;
|
||||
using ABI::Windows::ApplicationModel::PackageSignatureKind_System;
|
||||
using ABI::Windows::Foundation::AsyncStatus;
|
||||
using ABI::Windows::Foundation::IAsyncInfo;
|
||||
using ABI::Windows::Foundation::IUriRuntimeClass;
|
||||
using ABI::Windows::Foundation::IUriRuntimeClassFactory;
|
||||
using ABI::Windows::Foundation::Metadata::IApiInformationStatics;
|
||||
using ABI::Windows::Management::Deployment::DeploymentOptions;
|
||||
using ABI::Windows::Management::Deployment::
|
||||
DeploymentOptions_ForceApplicationShutdown;
|
||||
using ABI::Windows::Management::Deployment::
|
||||
DeploymentOptions_ForceTargetApplicationShutdown;
|
||||
using ABI::Windows::Management::Deployment::
|
||||
DeploymentOptions_ForceUpdateFromAnyVersion;
|
||||
using ABI::Windows::Management::Deployment::DeploymentOptions_None;
|
||||
using ABI::Windows::Management::Deployment::IAddPackageOptions;
|
||||
using ABI::Windows::Management::Deployment::IDeploymentResult;
|
||||
using ABI::Windows::Management::Deployment::IPackageManager;
|
||||
using ABI::Windows::Management::Deployment::IPackageManager5;
|
||||
using ABI::Windows::Management::Deployment::IPackageManager9;
|
||||
using Microsoft::WRL::Callback;
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
// Type alias for deployment async operation
|
||||
// AddPackageByUriAsync returns IAsyncOperationWithProgress<DeploymentResult*,
|
||||
// DeploymentProgress>
|
||||
using DeploymentAsyncOp = ABI::Windows::Foundation::IAsyncOperationWithProgress<
|
||||
ABI::Windows::Management::Deployment::DeploymentResult*,
|
||||
ABI::Windows::Management::Deployment::DeploymentProgress>;
|
||||
using DeploymentCompletedHandler =
|
||||
ABI::Windows::Foundation::IAsyncOperationWithProgressCompletedHandler<
|
||||
ABI::Windows::Management::Deployment::DeploymentResult*,
|
||||
ABI::Windows::Management::Deployment::DeploymentProgress>;
|
||||
|
||||
// Helper function for debug logging
|
||||
void DebugLog(std::string_view log_msg) {
|
||||
if (electron::debug_msix_updater)
|
||||
@@ -84,32 +120,274 @@ struct RegisterPackageOptions {
|
||||
bool force_update_from_any_version = false;
|
||||
};
|
||||
|
||||
// Helper: Create PackageManager using RoActivateInstance
|
||||
//
|
||||
// Note on COM interface versioning: In COM/WinRT, each interface version
|
||||
// (IPackageManager, IPackageManager5, IPackageManager9, etc.) is a separate
|
||||
// interface that must be queried independently. Unlike C++ inheritance,
|
||||
// IPackageManager9 does NOT inherit methods from IPackageManager5 or the base
|
||||
// IPackageManager. Each version only contains the methods that were newly
|
||||
// added in that version. To call methods from different versions, you must
|
||||
// QueryInterface (or ComPtr::As) for each specific interface version needed.
|
||||
HRESULT CreatePackageManager(ComPtr<IPackageManager>* package_manager) {
|
||||
base::win::ScopedHString class_id = base::win::ScopedHString::Create(
|
||||
RuntimeClass_Windows_Management_Deployment_PackageManager);
|
||||
if (!class_id.is_valid()) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
ComPtr<IInspectable> inspectable;
|
||||
HRESULT hr = base::win::RoActivateInstance(class_id.get(), &inspectable);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
return inspectable.As(package_manager);
|
||||
}
|
||||
|
||||
// Helper: Create URI using IUriRuntimeClassFactory
|
||||
HRESULT CreateUri(const std::wstring& uri_string,
|
||||
ComPtr<IUriRuntimeClass>* uri) {
|
||||
ComPtr<IUriRuntimeClassFactory> uri_factory;
|
||||
HRESULT hr =
|
||||
base::win::GetActivationFactory<IUriRuntimeClassFactory,
|
||||
RuntimeClass_Windows_Foundation_Uri>(
|
||||
&uri_factory);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
base::win::ScopedHString uri_hstring =
|
||||
base::win::ScopedHString::Create(uri_string);
|
||||
if (!uri_hstring.is_valid()) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return uri_factory->CreateUri(uri_hstring.get(), uri->GetAddressOf());
|
||||
}
|
||||
|
||||
// Helper: Create and configure AddPackageOptions
|
||||
HRESULT CreateAddPackageOptions(const UpdateMsixOptions& opts,
|
||||
ComPtr<IAddPackageOptions>* package_options) {
|
||||
base::win::ScopedHString class_id = base::win::ScopedHString::Create(
|
||||
RuntimeClass_Windows_Management_Deployment_AddPackageOptions);
|
||||
if (!class_id.is_valid()) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
ComPtr<IInspectable> inspectable;
|
||||
HRESULT hr = base::win::RoActivateInstance(class_id.get(), &inspectable);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = inspectable.As(package_options);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Configure options using ABI interface methods
|
||||
(*package_options)
|
||||
->put_DeferRegistrationWhenPackagesAreInUse(opts.defer_registration);
|
||||
(*package_options)->put_DeveloperMode(opts.developer_mode);
|
||||
(*package_options)->put_ForceAppShutdown(opts.force_shutdown);
|
||||
(*package_options)->put_ForceTargetAppShutdown(opts.force_target_shutdown);
|
||||
(*package_options)
|
||||
->put_ForceUpdateFromAnyVersion(opts.force_update_from_any_version);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Helper: Check if API contract is present
|
||||
HRESULT CheckApiContractPresent(UINT16 version, boolean* is_present) {
|
||||
ComPtr<IApiInformationStatics> api_info;
|
||||
HRESULT hr = base::win::GetActivationFactory<
|
||||
IApiInformationStatics,
|
||||
RuntimeClass_Windows_Foundation_Metadata_ApiInformation>(&api_info);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
base::win::ScopedHString contract_name = base::win::ScopedHString::Create(
|
||||
L"Windows.Foundation.UniversalApiContract");
|
||||
if (!contract_name.is_valid()) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return api_info->IsApiContractPresentByMajor(contract_name.get(), version,
|
||||
is_present);
|
||||
}
|
||||
|
||||
// Helper: Get current package using IPackageStatics
|
||||
HRESULT GetCurrentPackage(ComPtr<IPackage>* package) {
|
||||
ComPtr<IPackageStatics> package_statics;
|
||||
HRESULT hr = base::win::GetActivationFactory<
|
||||
IPackageStatics, RuntimeClass_Windows_ApplicationModel_Package>(
|
||||
&package_statics);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
return package_statics->get_Current(package->GetAddressOf());
|
||||
}
|
||||
|
||||
// Structure to hold callback data for async operations
|
||||
struct DeploymentCallbackData {
|
||||
scoped_refptr<base::SingleThreadTaskRunner> reply_runner;
|
||||
gin_helper::Promise<void> promise;
|
||||
bool fire_and_forget;
|
||||
ComPtr<DeploymentAsyncOp> async_op; // Keep async_op alive
|
||||
std::string operation_name; // "Deployment" or "Registration" for logs
|
||||
};
|
||||
|
||||
// Handler for deployment/registration completion
|
||||
void OnDeploymentCompleted(std::unique_ptr<DeploymentCallbackData> data,
|
||||
DeploymentAsyncOp* async_op,
|
||||
AsyncStatus status) {
|
||||
std::string error;
|
||||
const std::string& op_name = data->operation_name;
|
||||
|
||||
if (data->fire_and_forget) {
|
||||
std::ostringstream oss;
|
||||
oss << op_name
|
||||
<< " initiated. Force shutdown or target shutdown requested. "
|
||||
"Good bye!";
|
||||
DebugLog(oss.str());
|
||||
// Don't wait for result in fire-and-forget mode
|
||||
data->reply_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise) { promise.Resolve(); },
|
||||
std::move(data->promise)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == AsyncStatus::Error) {
|
||||
ComPtr<IDeploymentResult> result;
|
||||
HRESULT hr = async_op->GetResults(&result);
|
||||
if (SUCCEEDED(hr) && result) {
|
||||
HSTRING error_text_hstring;
|
||||
hr = result->get_ErrorText(&error_text_hstring);
|
||||
if (SUCCEEDED(hr)) {
|
||||
base::win::ScopedHString scoped_error(error_text_hstring);
|
||||
error = scoped_error.GetAsUTF8();
|
||||
}
|
||||
|
||||
ComPtr<IAsyncInfo> async_info;
|
||||
hr = async_op->QueryInterface(IID_PPV_ARGS(&async_info));
|
||||
if (SUCCEEDED(hr)) {
|
||||
HRESULT error_code;
|
||||
hr = async_info->get_ErrorCode(&error_code);
|
||||
if (SUCCEEDED(hr)) {
|
||||
error += " (" + std::to_string(static_cast<int>(error_code)) + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (error.empty()) {
|
||||
error = op_name + " failed with unknown error";
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << op_name << " failed: " << error;
|
||||
DebugLog(oss.str());
|
||||
}
|
||||
} else if (status == AsyncStatus::Canceled) {
|
||||
std::ostringstream oss;
|
||||
oss << op_name << " canceled";
|
||||
DebugLog(oss.str());
|
||||
error = op_name + " canceled";
|
||||
} else if (status == AsyncStatus::Completed) {
|
||||
std::ostringstream oss;
|
||||
oss << "MSIX " << op_name << " completed.";
|
||||
DebugLog(oss.str());
|
||||
} else {
|
||||
error = op_name + " status unknown";
|
||||
std::ostringstream oss;
|
||||
oss << op_name << " status unknown";
|
||||
DebugLog(oss.str());
|
||||
}
|
||||
|
||||
// Post result back to UI thread
|
||||
data->reply_runner->PostTask(
|
||||
FROM_HERE, base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise, std::string error) {
|
||||
if (error.empty()) {
|
||||
promise.Resolve();
|
||||
} else {
|
||||
promise.RejectWithErrorMessage(error);
|
||||
}
|
||||
},
|
||||
std::move(data->promise), std::move(error)));
|
||||
}
|
||||
|
||||
// Performs MSIX update on IO thread
|
||||
void DoUpdateMsix(const std::string& package_uri,
|
||||
UpdateMsixOptions opts,
|
||||
scoped_refptr<base::SingleThreadTaskRunner> reply_runner,
|
||||
gin_helper::Promise<void> promise) {
|
||||
DebugLog("DoUpdateMsix: Starting");
|
||||
|
||||
using winrt::Windows::Foundation::AsyncStatus;
|
||||
using winrt::Windows::Foundation::Uri;
|
||||
using winrt::Windows::Management::Deployment::AddPackageOptions;
|
||||
using winrt::Windows::Management::Deployment::DeploymentResult;
|
||||
using winrt::Windows::Management::Deployment::PackageManager;
|
||||
|
||||
std::string error;
|
||||
std::wstring packageUriString =
|
||||
std::wstring(package_uri.begin(), package_uri.end());
|
||||
Uri uri{packageUriString};
|
||||
PackageManager packageManager;
|
||||
AddPackageOptions packageOptions;
|
||||
|
||||
// Use the pre-parsed options
|
||||
packageOptions.DeferRegistrationWhenPackagesAreInUse(opts.defer_registration);
|
||||
packageOptions.DeveloperMode(opts.developer_mode);
|
||||
packageOptions.ForceAppShutdown(opts.force_shutdown);
|
||||
packageOptions.ForceTargetAppShutdown(opts.force_target_shutdown);
|
||||
packageOptions.ForceUpdateFromAnyVersion(opts.force_update_from_any_version);
|
||||
// Create PackageManager
|
||||
ComPtr<IPackageManager> package_manager;
|
||||
HRESULT hr = CreatePackageManager(&package_manager);
|
||||
if (FAILED(hr)) {
|
||||
error = "Failed to create PackageManager";
|
||||
reply_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise, std::string error) {
|
||||
promise.RejectWithErrorMessage(error);
|
||||
},
|
||||
std::move(promise), std::move(error)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Get IPackageManager9 for AddPackageByUriAsync
|
||||
ComPtr<IPackageManager9> package_manager9;
|
||||
hr = package_manager.As(&package_manager9);
|
||||
if (FAILED(hr)) {
|
||||
error = "Failed to get IPackageManager9 interface";
|
||||
reply_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise, std::string error) {
|
||||
promise.RejectWithErrorMessage(error);
|
||||
},
|
||||
std::move(promise), std::move(error)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Create URI
|
||||
std::wstring uri_wstring = base::UTF8ToWide(package_uri);
|
||||
ComPtr<IUriRuntimeClass> uri;
|
||||
hr = CreateUri(uri_wstring, &uri);
|
||||
if (FAILED(hr)) {
|
||||
error = "Failed to create URI";
|
||||
reply_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise, std::string error) {
|
||||
promise.RejectWithErrorMessage(error);
|
||||
},
|
||||
std::move(promise), std::move(error)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Create AddPackageOptions
|
||||
ComPtr<IAddPackageOptions> package_options;
|
||||
hr = CreateAddPackageOptions(opts, &package_options);
|
||||
if (FAILED(hr)) {
|
||||
error = "Failed to create AddPackageOptions";
|
||||
reply_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise, std::string error) {
|
||||
promise.RejectWithErrorMessage(error);
|
||||
},
|
||||
std::move(promise), std::move(error)));
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@@ -127,63 +405,54 @@ void DoUpdateMsix(const std::string& package_uri,
|
||||
DebugLog(oss.str());
|
||||
}
|
||||
|
||||
auto deploymentOperation =
|
||||
packageManager.AddPackageByUriAsync(uri, packageOptions);
|
||||
|
||||
if (!deploymentOperation) {
|
||||
DebugLog("Deployment operation is null");
|
||||
// Start async operation
|
||||
ComPtr<DeploymentAsyncOp> async_op;
|
||||
hr = package_manager9->AddPackageByUriAsync(uri.Get(), package_options.Get(),
|
||||
&async_op);
|
||||
if (FAILED(hr) || !async_op) {
|
||||
DebugLog("AddPackageByUriAsync failed or returned null");
|
||||
error =
|
||||
"Deployment is NULL. See "
|
||||
"http://go.microsoft.com/fwlink/?LinkId=235160 for diagnosing.";
|
||||
} else {
|
||||
if (!opts.force_shutdown && !opts.force_target_shutdown) {
|
||||
DebugLog("Waiting for deployment...");
|
||||
deploymentOperation.get();
|
||||
DebugLog("Deployment finished.");
|
||||
|
||||
if (deploymentOperation.Status() == AsyncStatus::Error) {
|
||||
auto deploymentResult{deploymentOperation.GetResults()};
|
||||
std::string errorText = winrt::to_string(deploymentResult.ErrorText());
|
||||
std::string errorCode =
|
||||
std::to_string(static_cast<int>(deploymentOperation.ErrorCode()));
|
||||
error = errorText + " (" + errorCode + ")";
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "Deployment failed: " << error;
|
||||
DebugLog(oss.str());
|
||||
}
|
||||
} else if (deploymentOperation.Status() == AsyncStatus::Canceled) {
|
||||
DebugLog("Deployment canceled");
|
||||
error = "Deployment canceled";
|
||||
} else if (deploymentOperation.Status() == AsyncStatus::Completed) {
|
||||
DebugLog("MSIX Deployment completed.");
|
||||
} else {
|
||||
error = "Deployment status unknown";
|
||||
DebugLog("Deployment status unknown");
|
||||
}
|
||||
} else {
|
||||
// At this point, we can not await the deployment because we require a
|
||||
// shutdown of the app to continue, so we do a fire and forget. When the
|
||||
// deployment process tries ot shutdown the app, the process waits for us
|
||||
// to finish here. But to finish we need to shutdow. That leads to a 30s
|
||||
// dealock, till we forcefully get shutdown by the OS.
|
||||
DebugLog(
|
||||
"Deployment initiated. Force shutdown or target shutdown requested. "
|
||||
"Good bye!");
|
||||
}
|
||||
reply_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise, std::string error) {
|
||||
promise.RejectWithErrorMessage(error);
|
||||
},
|
||||
std::move(promise), std::move(error)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Post result back
|
||||
reply_runner->PostTask(
|
||||
FROM_HERE, base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise, std::string error) {
|
||||
if (error.empty()) {
|
||||
promise.Resolve();
|
||||
} else {
|
||||
promise.RejectWithErrorMessage(error);
|
||||
}
|
||||
},
|
||||
std::move(promise), error));
|
||||
// Set up callback data
|
||||
auto callback_data = std::make_unique<DeploymentCallbackData>();
|
||||
callback_data->reply_runner = reply_runner;
|
||||
callback_data->promise = std::move(promise);
|
||||
callback_data->fire_and_forget =
|
||||
opts.force_shutdown || opts.force_target_shutdown;
|
||||
callback_data->async_op = async_op; // Keep async_op alive
|
||||
callback_data->operation_name = "Deployment";
|
||||
|
||||
// Register completion handler
|
||||
DeploymentCallbackData* raw_data = callback_data.get();
|
||||
hr = async_op->put_Completed(
|
||||
Callback<DeploymentCompletedHandler>([data = std::move(callback_data)](
|
||||
DeploymentAsyncOp* op,
|
||||
AsyncStatus status) mutable {
|
||||
OnDeploymentCompleted(std::move(data), op, status);
|
||||
return S_OK;
|
||||
}).Get());
|
||||
|
||||
if (FAILED(hr)) {
|
||||
DebugLog("Failed to register completion handler");
|
||||
raw_data->reply_runner->PostTask(
|
||||
FROM_HERE, base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise) {
|
||||
promise.RejectWithErrorMessage(
|
||||
"Failed to register completion handler");
|
||||
},
|
||||
std::move(raw_data->promise)));
|
||||
}
|
||||
}
|
||||
|
||||
// Performs package registration on IO thread
|
||||
@@ -192,31 +461,67 @@ void DoRegisterPackage(const std::string& family_name,
|
||||
scoped_refptr<base::SingleThreadTaskRunner> reply_runner,
|
||||
gin_helper::Promise<void> promise) {
|
||||
DebugLog("DoRegisterPackage: Starting");
|
||||
|
||||
using winrt::Windows::Foundation::AsyncStatus;
|
||||
using winrt::Windows::Foundation::Collections::IIterable;
|
||||
using winrt::Windows::Management::Deployment::DeploymentOptions;
|
||||
using winrt::Windows::Management::Deployment::PackageManager;
|
||||
|
||||
std::string error;
|
||||
auto familyNameH = winrt::to_hstring(family_name);
|
||||
PackageManager packageManager;
|
||||
DeploymentOptions deploymentOptions = DeploymentOptions::None;
|
||||
|
||||
// Use the pre-parsed options (no V8 access needed)
|
||||
// Create PackageManager
|
||||
ComPtr<IPackageManager> package_manager;
|
||||
HRESULT hr = CreatePackageManager(&package_manager);
|
||||
if (FAILED(hr)) {
|
||||
error = "Failed to create PackageManager";
|
||||
reply_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise, std::string error) {
|
||||
promise.RejectWithErrorMessage(error);
|
||||
},
|
||||
std::move(promise), std::move(error)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Get IPackageManager5 for RegisterPackageByFamilyNameAsync
|
||||
ComPtr<IPackageManager5> package_manager5;
|
||||
hr = package_manager.As(&package_manager5);
|
||||
if (FAILED(hr)) {
|
||||
error = "Failed to get IPackageManager5 interface";
|
||||
reply_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise, std::string error) {
|
||||
promise.RejectWithErrorMessage(error);
|
||||
},
|
||||
std::move(promise), std::move(error)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Build DeploymentOptions flags
|
||||
DeploymentOptions deployment_options = DeploymentOptions_None;
|
||||
if (opts.force_shutdown) {
|
||||
deploymentOptions |= DeploymentOptions::ForceApplicationShutdown;
|
||||
deployment_options = static_cast<DeploymentOptions>(
|
||||
deployment_options | DeploymentOptions_ForceApplicationShutdown);
|
||||
}
|
||||
if (opts.force_target_shutdown) {
|
||||
deploymentOptions |= DeploymentOptions::ForceTargetApplicationShutdown;
|
||||
deployment_options = static_cast<DeploymentOptions>(
|
||||
deployment_options | DeploymentOptions_ForceTargetApplicationShutdown);
|
||||
}
|
||||
if (opts.force_update_from_any_version) {
|
||||
deploymentOptions |= DeploymentOptions::ForceUpdateFromAnyVersion;
|
||||
deployment_options = static_cast<DeploymentOptions>(
|
||||
deployment_options | DeploymentOptions_ForceUpdateFromAnyVersion);
|
||||
}
|
||||
|
||||
// Create empty collections for dependency and optional packages
|
||||
IIterable<winrt::hstring> emptyDependencies{nullptr};
|
||||
IIterable<winrt::hstring> emptyOptional{nullptr};
|
||||
// Create HSTRING for family name
|
||||
base::win::ScopedHString family_name_hstring =
|
||||
base::win::ScopedHString::Create(family_name);
|
||||
if (!family_name_hstring.is_valid()) {
|
||||
error = "Failed to create family name string";
|
||||
reply_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise, std::string error) {
|
||||
promise.RejectWithErrorMessage(error);
|
||||
},
|
||||
std::move(promise), std::move(error)));
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@@ -233,63 +538,59 @@ void DoRegisterPackage(const std::string& family_name,
|
||||
DebugLog(oss.str());
|
||||
}
|
||||
|
||||
auto deploymentOperation = packageManager.RegisterPackageByFamilyNameAsync(
|
||||
familyNameH, emptyDependencies, deploymentOptions, nullptr,
|
||||
emptyOptional);
|
||||
// RegisterPackageByFamilyNameAndOptionalPackagesAsync (ABI name)
|
||||
ComPtr<DeploymentAsyncOp> async_op;
|
||||
hr = package_manager5->RegisterPackageByFamilyNameAndOptionalPackagesAsync(
|
||||
family_name_hstring.get(),
|
||||
nullptr, // dependencyPackageFamilyNames
|
||||
deployment_options,
|
||||
nullptr, // appDataVolume
|
||||
nullptr, // optionalPackageFamilyNames
|
||||
&async_op);
|
||||
|
||||
if (!deploymentOperation) {
|
||||
if (FAILED(hr) || !async_op) {
|
||||
error =
|
||||
"Deployment is NULL. See "
|
||||
"http://go.microsoft.com/fwlink/?LinkId=235160 for diagnosing.";
|
||||
} else {
|
||||
if (!opts.force_shutdown && !opts.force_target_shutdown) {
|
||||
DebugLog("Waiting for registration...");
|
||||
deploymentOperation.get();
|
||||
DebugLog("Registration finished.");
|
||||
|
||||
if (deploymentOperation.Status() == AsyncStatus::Error) {
|
||||
auto deploymentResult{deploymentOperation.GetResults()};
|
||||
std::string errorText = winrt::to_string(deploymentResult.ErrorText());
|
||||
std::string errorCode =
|
||||
std::to_string(static_cast<int>(deploymentOperation.ErrorCode()));
|
||||
error = errorText + " (" + errorCode + ")";
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "Registration failed: " << error;
|
||||
DebugLog(oss.str());
|
||||
}
|
||||
} else if (deploymentOperation.Status() == AsyncStatus::Canceled) {
|
||||
DebugLog("Registration canceled");
|
||||
error = "Registration canceled";
|
||||
} else if (deploymentOperation.Status() == AsyncStatus::Completed) {
|
||||
DebugLog("MSIX Registration completed.");
|
||||
} else {
|
||||
error = "Registration status unknown";
|
||||
DebugLog("Registration status unknown");
|
||||
}
|
||||
} else {
|
||||
// At this point, we can not await the registration because we require a
|
||||
// shutdown of the app to continue, so we do a fire and forget. When the
|
||||
// registration process tries ot shutdown the app, the process waits for
|
||||
// us to finish here. But to finish we need to shutdown. That leads to a
|
||||
// 30s dealock, till we forcefully get shutdown by the OS.
|
||||
DebugLog(
|
||||
"Registration initiated. Force shutdown or target shutdown "
|
||||
"requested. Good bye!");
|
||||
}
|
||||
reply_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise, std::string error) {
|
||||
promise.RejectWithErrorMessage(error);
|
||||
},
|
||||
std::move(promise), std::move(error)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Post result back to UI thread
|
||||
reply_runner->PostTask(
|
||||
FROM_HERE, base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise, std::string error) {
|
||||
if (error.empty()) {
|
||||
promise.Resolve();
|
||||
} else {
|
||||
promise.RejectWithErrorMessage(error);
|
||||
}
|
||||
},
|
||||
std::move(promise), error));
|
||||
// Set up callback data
|
||||
auto callback_data = std::make_unique<DeploymentCallbackData>();
|
||||
callback_data->reply_runner = reply_runner;
|
||||
callback_data->promise = std::move(promise);
|
||||
callback_data->fire_and_forget =
|
||||
opts.force_shutdown || opts.force_target_shutdown;
|
||||
callback_data->async_op = async_op; // Keep async_op alive
|
||||
callback_data->operation_name = "Registration";
|
||||
|
||||
// Register completion handler
|
||||
DeploymentCallbackData* raw_data = callback_data.get();
|
||||
hr = async_op->put_Completed(
|
||||
Callback<DeploymentCompletedHandler>([data = std::move(callback_data)](
|
||||
DeploymentAsyncOp* op,
|
||||
AsyncStatus status) mutable {
|
||||
OnDeploymentCompleted(std::move(data), op, status);
|
||||
return S_OK;
|
||||
}).Get());
|
||||
|
||||
if (FAILED(hr)) {
|
||||
DebugLog("Failed to register completion handler");
|
||||
raw_data->reply_runner->PostTask(
|
||||
FROM_HERE, base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise) {
|
||||
promise.RejectWithErrorMessage(
|
||||
"Failed to register completion handler");
|
||||
},
|
||||
std::move(raw_data->promise)));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -307,6 +608,16 @@ v8::Local<v8::Promise> UpdateMsix(const std::string& package_uri,
|
||||
return handle;
|
||||
}
|
||||
|
||||
// Check for required API contract (IPackageManager9 requires v10)
|
||||
boolean is_api_present = FALSE;
|
||||
if (FAILED(CheckApiContractPresent(10, &is_api_present)) || !is_api_present) {
|
||||
DebugLog("UpdateMsix: Required Windows API contract not present");
|
||||
promise.RejectWithErrorMessage(
|
||||
"This Windows version does not support MSIX updates via this API. "
|
||||
"Windows 10 version 2004 or later is required.");
|
||||
return handle;
|
||||
}
|
||||
|
||||
// Parse options on UI thread (where V8 is available)
|
||||
UpdateMsixOptions opts;
|
||||
options.Get("deferRegistration", &opts.defer_registration);
|
||||
@@ -349,6 +660,16 @@ v8::Local<v8::Promise> RegisterPackage(const std::string& family_name,
|
||||
return handle;
|
||||
}
|
||||
|
||||
// Check for required API contract (IPackageManager5 requires v3)
|
||||
boolean is_api_present = FALSE;
|
||||
if (FAILED(CheckApiContractPresent(3, &is_api_present)) || !is_api_present) {
|
||||
DebugLog("RegisterPackage: Required Windows API contract not present");
|
||||
promise.RejectWithErrorMessage(
|
||||
"This Windows version does not support package registration via this "
|
||||
"API. Windows 10 version 1607 or later is required.");
|
||||
return handle;
|
||||
}
|
||||
|
||||
// Parse options on UI thread (where V8 is available)
|
||||
RegisterPackageOptions opts;
|
||||
options.Get("forceShutdown", &opts.force_shutdown);
|
||||
@@ -384,32 +705,30 @@ bool RegisterRestartOnUpdate(const std::string& command_line) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const wchar_t* commandLine = nullptr;
|
||||
// Flags: RESTART_NO_CRASH | RESTART_NO_HANG | RESTART_NO_REBOOT
|
||||
// This means: only restart on updates (RESTART_NO_PATCH is NOT set)
|
||||
const DWORD dwFlags = 1 | 2 | 8; // 11
|
||||
|
||||
// Convert command line to wide string (keep in scope for API call)
|
||||
std::wstring command_line_wide;
|
||||
const wchar_t* command_line_ptr = nullptr;
|
||||
if (!command_line.empty()) {
|
||||
std::wstring commandLineW =
|
||||
std::wstring(command_line.begin(), command_line.end());
|
||||
commandLine = commandLineW.c_str();
|
||||
command_line_wide = base::UTF8ToWide(command_line);
|
||||
command_line_ptr = command_line_wide.c_str();
|
||||
}
|
||||
|
||||
HRESULT hr = RegisterApplicationRestart(commandLine, dwFlags);
|
||||
HRESULT hr = RegisterApplicationRestart(command_line_ptr, dwFlags);
|
||||
if (FAILED(hr)) {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "RegisterApplicationRestart failed with error code: " << hr;
|
||||
DebugLog(oss.str());
|
||||
}
|
||||
std::ostringstream oss;
|
||||
oss << "RegisterApplicationRestart failed with error code: " << hr;
|
||||
DebugLog(oss.str());
|
||||
return false;
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "RegisterApplicationRestart succeeded"
|
||||
<< (command_line.empty() ? "" : " with command line");
|
||||
DebugLog(oss.str());
|
||||
}
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "RegisterApplicationRestart succeeded"
|
||||
<< (command_line.empty() ? "" : " with command line");
|
||||
DebugLog(oss.str());
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
@@ -434,57 +753,119 @@ v8::Local<v8::Value> GetPackageInfo() {
|
||||
gin_helper::Dictionary result(isolate, v8::Object::New(isolate));
|
||||
|
||||
// Check API contract version (Windows 10 version 1703 or later)
|
||||
if (winrt::Windows::Foundation::Metadata::ApiInformation::
|
||||
IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 7)) {
|
||||
using winrt::Windows::ApplicationModel::Package;
|
||||
using winrt::Windows::ApplicationModel::PackageSignatureKind;
|
||||
Package package = Package::Current();
|
||||
boolean is_present = FALSE;
|
||||
HRESULT hr = CheckApiContractPresent(7, &is_present);
|
||||
if (SUCCEEDED(hr) && is_present) {
|
||||
ComPtr<IPackage> package;
|
||||
hr = GetCurrentPackage(&package);
|
||||
if (SUCCEEDED(hr) && package) {
|
||||
// Query all needed package interface versions upfront.
|
||||
// Note: Like IPackageManager, each IPackage version (IPackage2,
|
||||
// IPackage4, IPackage6) is a separate COM interface. IPackage6 does NOT
|
||||
// inherit methods from earlier versions. We must query each version
|
||||
// separately to access its specific methods:
|
||||
// - IPackage2: get_IsDevelopmentMode
|
||||
// - IPackage4: get_SignatureKind
|
||||
// - IPackage6: GetAppInstallerInfo
|
||||
ComPtr<IPackage2> package2;
|
||||
ComPtr<IPackage4> package4;
|
||||
ComPtr<IPackage6> package6;
|
||||
package.As(&package2);
|
||||
package.As(&package4);
|
||||
package.As(&package6);
|
||||
|
||||
// Get package ID and family name
|
||||
std::string packageId = winrt::to_string(package.Id().FullName());
|
||||
std::string familyName = winrt::to_string(package.Id().FamilyName());
|
||||
// Get package ID (from base IPackage)
|
||||
ComPtr<IPackageId> package_id;
|
||||
hr = package->get_Id(&package_id);
|
||||
if (SUCCEEDED(hr) && package_id) {
|
||||
// Get FullName
|
||||
HSTRING full_name;
|
||||
hr = package_id->get_FullName(&full_name);
|
||||
if (SUCCEEDED(hr)) {
|
||||
base::win::ScopedHString scoped_name(full_name);
|
||||
result.Set("id", scoped_name.GetAsUTF8());
|
||||
}
|
||||
|
||||
result.Set("id", packageId);
|
||||
result.Set("familyName", familyName);
|
||||
result.Set("developmentMode", package.IsDevelopmentMode());
|
||||
// Get FamilyName
|
||||
HSTRING family_name;
|
||||
hr = package_id->get_FamilyName(&family_name);
|
||||
if (SUCCEEDED(hr)) {
|
||||
base::win::ScopedHString scoped_name(family_name);
|
||||
result.Set("familyName", scoped_name.GetAsUTF8());
|
||||
}
|
||||
|
||||
// Get package version
|
||||
auto packageVersion = package.Id().Version();
|
||||
std::string version = std::to_string(packageVersion.Major) + "." +
|
||||
std::to_string(packageVersion.Minor) + "." +
|
||||
std::to_string(packageVersion.Build) + "." +
|
||||
std::to_string(packageVersion.Revision);
|
||||
result.Set("version", version);
|
||||
// Get Version
|
||||
ABI::Windows::ApplicationModel::PackageVersion pkg_version;
|
||||
hr = package_id->get_Version(&pkg_version);
|
||||
if (SUCCEEDED(hr)) {
|
||||
std::string version = std::to_string(pkg_version.Major) + "." +
|
||||
std::to_string(pkg_version.Minor) + "." +
|
||||
std::to_string(pkg_version.Build) + "." +
|
||||
std::to_string(pkg_version.Revision);
|
||||
result.Set("version", version);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert signature kind to string
|
||||
std::string signatureKind;
|
||||
switch (package.SignatureKind()) {
|
||||
case PackageSignatureKind::Developer:
|
||||
signatureKind = "developer";
|
||||
break;
|
||||
case PackageSignatureKind::Enterprise:
|
||||
signatureKind = "enterprise";
|
||||
break;
|
||||
case PackageSignatureKind::None:
|
||||
signatureKind = "none";
|
||||
break;
|
||||
case PackageSignatureKind::Store:
|
||||
signatureKind = "store";
|
||||
break;
|
||||
case PackageSignatureKind::System:
|
||||
signatureKind = "system";
|
||||
break;
|
||||
default:
|
||||
signatureKind = "none";
|
||||
break;
|
||||
}
|
||||
result.Set("signatureKind", signatureKind);
|
||||
// Get IsDevelopmentMode (from IPackage2)
|
||||
if (package2) {
|
||||
boolean is_dev_mode = FALSE;
|
||||
hr = package2->get_IsDevelopmentMode(&is_dev_mode);
|
||||
result.Set("developmentMode", SUCCEEDED(hr) && is_dev_mode != FALSE);
|
||||
} else {
|
||||
result.Set("developmentMode", false);
|
||||
}
|
||||
|
||||
// Get app installer info if available
|
||||
auto appInstallerInfo = package.GetAppInstallerInfo();
|
||||
if (appInstallerInfo != nullptr) {
|
||||
std::string uriStr = winrt::to_string(appInstallerInfo.Uri().ToString());
|
||||
result.Set("appInstallerUri", uriStr);
|
||||
// Get SignatureKind (from IPackage4)
|
||||
if (package4) {
|
||||
PackageSignatureKind sig_kind;
|
||||
hr = package4->get_SignatureKind(&sig_kind);
|
||||
if (SUCCEEDED(hr)) {
|
||||
std::string signature_kind;
|
||||
switch (sig_kind) {
|
||||
case PackageSignatureKind_Developer:
|
||||
signature_kind = "developer";
|
||||
break;
|
||||
case PackageSignatureKind_Enterprise:
|
||||
signature_kind = "enterprise";
|
||||
break;
|
||||
case PackageSignatureKind_None:
|
||||
signature_kind = "none";
|
||||
break;
|
||||
case PackageSignatureKind_Store:
|
||||
signature_kind = "store";
|
||||
break;
|
||||
case PackageSignatureKind_System:
|
||||
signature_kind = "system";
|
||||
break;
|
||||
default:
|
||||
signature_kind = "none";
|
||||
break;
|
||||
}
|
||||
result.Set("signatureKind", signature_kind);
|
||||
} else {
|
||||
result.Set("signatureKind", "none");
|
||||
}
|
||||
} else {
|
||||
result.Set("signatureKind", "none");
|
||||
}
|
||||
|
||||
// Get AppInstallerInfo (from IPackage6)
|
||||
if (package6) {
|
||||
ComPtr<IAppInstallerInfo> app_installer_info;
|
||||
hr = package6->GetAppInstallerInfo(&app_installer_info);
|
||||
if (SUCCEEDED(hr) && app_installer_info) {
|
||||
ComPtr<IUriRuntimeClass> uri;
|
||||
hr = app_installer_info->get_Uri(&uri);
|
||||
if (SUCCEEDED(hr) && uri) {
|
||||
HSTRING uri_string;
|
||||
hr = uri->get_AbsoluteUri(&uri_string);
|
||||
if (SUCCEEDED(hr)) {
|
||||
base::win::ScopedHString scoped_uri(uri_string);
|
||||
result.Set("appInstallerUri", scoped_uri.GetAsUTF8());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Windows version doesn't meet minimum API requirements
|
||||
|
||||
@@ -70,7 +70,8 @@ UtilityProcessWrapper::UtilityProcessWrapper(
|
||||
base::EnvironmentMap env_map,
|
||||
base::FilePath current_working_directory,
|
||||
bool use_plugin_helper,
|
||||
bool create_network_observer) {
|
||||
bool create_network_observer,
|
||||
bool disclaim_responsibility) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
base::win::ScopedHandle stdout_write(nullptr);
|
||||
base::win::ScopedHandle stderr_write(nullptr);
|
||||
@@ -184,6 +185,7 @@ UtilityProcessWrapper::UtilityProcessWrapper(
|
||||
.WithChildFlags(use_plugin_helper
|
||||
? content::ChildProcessHost::CHILD_PLUGIN
|
||||
: content::ChildProcessHost::CHILD_NORMAL)
|
||||
.WithDisclaimResponsibility(disclaim_responsibility)
|
||||
#endif
|
||||
.WithProcessCallback(
|
||||
base::BindOnce(&UtilityProcessWrapper::OnServiceProcessLaunch,
|
||||
@@ -451,6 +453,7 @@ gin_helper::Handle<UtilityProcessWrapper> UtilityProcessWrapper::Create(
|
||||
std::u16string display_name;
|
||||
bool use_plugin_helper = false;
|
||||
bool create_network_observer = false;
|
||||
bool disclaim_responsibility = false;
|
||||
std::map<IOHandle, IOType> stdio;
|
||||
base::FilePath current_working_directory;
|
||||
base::EnvironmentMap env_map;
|
||||
@@ -494,13 +497,15 @@ gin_helper::Handle<UtilityProcessWrapper> UtilityProcessWrapper::Create(
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
opts.Get("allowLoadingUnsignedLibraries", &use_plugin_helper);
|
||||
opts.Get("disclaim", &disclaim_responsibility);
|
||||
#endif
|
||||
}
|
||||
auto handle = gin_helper::CreateHandle(
|
||||
args->isolate(), new UtilityProcessWrapper(
|
||||
std::move(params), display_name, std::move(stdio),
|
||||
env_map, current_working_directory,
|
||||
use_plugin_helper, create_network_observer));
|
||||
args->isolate(),
|
||||
new UtilityProcessWrapper(
|
||||
std::move(params), display_name, std::move(stdio), env_map,
|
||||
current_working_directory, use_plugin_helper, create_network_observer,
|
||||
disclaim_responsibility));
|
||||
handle->Pin(args->isolate());
|
||||
return handle;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ class UtilityProcessWrapper final
|
||||
base::EnvironmentMap env_map,
|
||||
base::FilePath current_working_directory,
|
||||
bool use_plugin_helper,
|
||||
bool create_network_observer);
|
||||
bool create_network_observer,
|
||||
bool disclaim_responsibility);
|
||||
void OnServiceProcessLaunch(const base::Process& process);
|
||||
void CloseConnectorPort();
|
||||
|
||||
|
||||
@@ -106,7 +106,10 @@ bool ProcessSignatureIsSameWithCurrentApp(pid_t pid) {
|
||||
status = SecCodeCheckValidity(process_code.get(), kSecCSDefaultFlags,
|
||||
self_requirement.get());
|
||||
if (status != errSecSuccess && status != errSecCSReqFailed) {
|
||||
OSSTATUS_LOG(ERROR, status) << "SecCodeCheckValidity";
|
||||
// If the code is unsigned, don't log that (it's not an actual error).
|
||||
if (status != errSecCSUnsigned) {
|
||||
OSSTATUS_LOG(ERROR, status) << "SecCodeCheckValidity";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return status == errSecSuccess;
|
||||
|
||||
@@ -43,6 +43,65 @@ describe('MenuItems', () => {
|
||||
expect(item).to.have.property('role').that.is.a('string');
|
||||
expect(item).to.have.property('icon');
|
||||
});
|
||||
|
||||
it('should have a default accelerator for certain roles', () => {
|
||||
const items: Record<string, Electron.MenuItem['accelerator']> = {
|
||||
undo: 'CommandOrControl+Z',
|
||||
redo: process.platform === 'win32' ? 'Control+Y' : 'Shift+CommandOrControl+Z',
|
||||
cut: 'CommandOrControl+X',
|
||||
copy: 'CommandOrControl+C',
|
||||
paste: 'CommandOrControl+V',
|
||||
pasteAndMatchStyle: process.platform === 'darwin' ? 'Cmd+Option+Shift+V' : 'Shift+CommandOrControl+V',
|
||||
delete: null,
|
||||
selectAll: 'CommandOrControl+A',
|
||||
reload: 'CmdOrCtrl+R',
|
||||
forceReload: 'Shift+CmdOrCtrl+R',
|
||||
toggleDevTools: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
|
||||
resetZoom: 'CommandOrControl+0',
|
||||
zoomIn: 'CommandOrControl+Plus',
|
||||
zoomOut: 'CommandOrControl+-',
|
||||
toggleSpellChecker: null,
|
||||
togglefullscreen: process.platform === 'darwin' ? 'Control+Command+F' : 'F11',
|
||||
window: null,
|
||||
minimize: 'CommandOrControl+M',
|
||||
close: 'CommandOrControl+W',
|
||||
help: null,
|
||||
about: null,
|
||||
services: null,
|
||||
hide: 'Command+H',
|
||||
hideOthers: 'Command+Alt+H',
|
||||
unhide: null,
|
||||
quit: process.platform === 'win32' ? null : 'CommandOrControl+Q',
|
||||
showSubstitutions: null,
|
||||
toggleSmartQuotes: null,
|
||||
toggleSmartDashes: null,
|
||||
toggleTextReplacement: null,
|
||||
startSpeaking: null,
|
||||
stopSpeaking: null,
|
||||
zoom: null,
|
||||
front: null,
|
||||
appMenu: null,
|
||||
fileMenu: null,
|
||||
editMenu: null,
|
||||
viewMenu: null,
|
||||
shareMenu: null,
|
||||
recentDocuments: null,
|
||||
toggleTabBar: null,
|
||||
selectNextTab: null,
|
||||
selectPreviousTab: null,
|
||||
showAllTabs: null,
|
||||
mergeAllWindows: null,
|
||||
clearRecentDocuments: null,
|
||||
moveTabToNewWindow: null,
|
||||
windowMenu: null
|
||||
};
|
||||
|
||||
for (const role in items) {
|
||||
if (!Object.hasOwn(items, role)) continue;
|
||||
const item = new MenuItem({ role: role as any });
|
||||
expect(item.accelerator).to.equal(items[role]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('MenuItem.click', () => {
|
||||
@@ -480,7 +539,7 @@ describe('MenuItems', () => {
|
||||
|
||||
it('should display modifiers correctly for simple keys', () => {
|
||||
const menu = Menu.buildFromTemplate([
|
||||
{ label: 'text', accelerator: 'CmdOrCtrl+A' },
|
||||
{ label: 'text', accelerator: 'CommandOrControl+A' },
|
||||
{ label: 'text', accelerator: 'Shift+A' },
|
||||
{ label: 'text', accelerator: 'Alt+A' }
|
||||
]);
|
||||
@@ -492,7 +551,7 @@ describe('MenuItems', () => {
|
||||
|
||||
it('should display modifiers correctly for special keys', () => {
|
||||
const menu = Menu.buildFromTemplate([
|
||||
{ label: 'text', accelerator: 'CmdOrCtrl+Tab' },
|
||||
{ label: 'text', accelerator: 'CommandOrControl+Tab' },
|
||||
{ label: 'text', accelerator: 'Shift+Tab' },
|
||||
{ label: 'text', accelerator: 'Alt+Tab' }
|
||||
]);
|
||||
|
||||
@@ -863,5 +863,24 @@ describe('utilityProcess module', () => {
|
||||
await exit;
|
||||
}
|
||||
});
|
||||
|
||||
// Note: This doesn't test that disclaiming works (that requires stubbing / mocking TCC which is
|
||||
// just straight up not possible generically). This just tests that utility processes still launch
|
||||
// when disclaimed.
|
||||
ifit(process.platform === 'darwin')('supports disclaim option on macOS', async () => {
|
||||
const child = utilityProcess.fork(path.join(fixturesPath, 'post-message.js'), [], {
|
||||
disclaim: true
|
||||
});
|
||||
await once(child, 'spawn');
|
||||
expect(child.pid).to.be.a('number');
|
||||
// Verify the process can communicate normally
|
||||
const testMessage = 'test-disclaim';
|
||||
child.postMessage(testMessage);
|
||||
const [data] = await once(child, 'message');
|
||||
expect(data).to.equal(testMessage);
|
||||
const exit = once(child, 'exit');
|
||||
expect(child.kill()).to.be.true();
|
||||
await exit;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user