mirror of
https://github.com/electron/electron.git
synced 2026-03-19 03:02:02 -04:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1598b9116d | ||
|
|
68cd11118d | ||
|
|
1e2d5902a5 | ||
|
|
1bbe8c9610 | ||
|
|
4bfc2a83fc | ||
|
|
d80adf4aed | ||
|
|
b39f8e3e1c | ||
|
|
9c3f76f617 | ||
|
|
3925b82a07 | ||
|
|
e2b4cbfff3 | ||
|
|
29216464dc | ||
|
|
649c19c877 | ||
|
|
603bcb73e3 | ||
|
|
488af02eaa | ||
|
|
589e08af80 | ||
|
|
06521fad4c | ||
|
|
771cbce43b | ||
|
|
b5cfc5dd91 | ||
|
|
d6e6fcea86 | ||
|
|
cc64a5e8d9 | ||
|
|
2d12f059b4 | ||
|
|
f715930d49 | ||
|
|
477fe8566e | ||
|
|
a9837ed476 | ||
|
|
1f7269f482 | ||
|
|
2813b89824 | ||
|
|
a4560db9f0 | ||
|
|
adfc062313 | ||
|
|
8dc34b4b25 | ||
|
|
6cc5ad763d | ||
|
|
4c5637c687 | ||
|
|
0d71ed0f29 | ||
|
|
fc63000ee7 | ||
|
|
8d41dbe65f | ||
|
|
f3b90cc91c | ||
|
|
a78a8cd30c | ||
|
|
2511f78120 | ||
|
|
f711af1080 | ||
|
|
616026ce1c | ||
|
|
ada2c4e072 |
2
.github/actions/build-electron/action.yml
vendored
2
.github/actions/build-electron/action.yml
vendored
@@ -95,7 +95,7 @@ runs:
|
||||
# Upload build stats to Datadog
|
||||
if ($env:DD_API_KEY) {
|
||||
try {
|
||||
npx node electron\script\build-stats.mjs out\Default\siso.exe.INFO --upload-stats
|
||||
npx node electron\script\build-stats.mjs out\Default\siso.exe.INFO --upload-stats ; $LASTEXITCODE = 0
|
||||
} catch {
|
||||
Write-Host "Build stats upload failed, continuing..."
|
||||
}
|
||||
|
||||
4
.github/workflows/pipeline-electron-lint.yml
vendored
4
.github/workflows/pipeline-electron-lint.yml
vendored
@@ -46,7 +46,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
||||
gn_version="$(curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/DEPS?format=TEXT" | base64 -d | grep gn_version | head -n1 | cut -d\' -f4)"
|
||||
gn_version="$(curl -sL -b ~/.gitcookies "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/DEPS?format=TEXT" | base64 -d | grep gn_version | head -n1 | cut -d\' -f4)"
|
||||
|
||||
cipd ensure -ensure-file - -root . <<-CIPD
|
||||
\$ServiceURL https://chrome-infra-packages.appspot.com/
|
||||
@@ -62,7 +62,7 @@ jobs:
|
||||
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
||||
|
||||
mkdir -p src/buildtools
|
||||
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
|
||||
curl -sL -b ~/.gitcookies "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
|
||||
|
||||
gclient sync --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]"
|
||||
- name: Add problem matchers
|
||||
|
||||
2
.github/workflows/update-website-docs.yml
vendored
2
.github/workflows/update-website-docs.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
||||
echo "isLatestRelease=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Trigger website docs update
|
||||
if: ${{ steps.check-if-latest-release.outputs.isLatestRelease }}
|
||||
if: ${{ steps.check-if-latest-release.outputs.isLatestRelease == 'true' }}
|
||||
env:
|
||||
GH_REPO: electron/website
|
||||
GH_TOKEN: ${{ fromJSON(steps.secret-service.outputs.secrets).WEBSITE_DOCS_UPDATER_APP_TOKEN }}
|
||||
|
||||
4
DEPS
4
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'144.0.7559.177',
|
||||
'144.0.7559.225',
|
||||
'node_version':
|
||||
'v24.13.1',
|
||||
'v24.14.0',
|
||||
'nan_version':
|
||||
'675cefebca42410733da8a454c8d9391fcebfbc2',
|
||||
'squirrel.mac_version':
|
||||
|
||||
@@ -250,7 +250,9 @@ Returns:
|
||||
|
||||
Emitted when the user clicks the native macOS new tab button. The new
|
||||
tab button is only visible if the current `BrowserWindow` has a
|
||||
`tabbingIdentifier`
|
||||
`tabbingIdentifier`.
|
||||
|
||||
You must create a window in this handler in order for macOS tabbing to work as expected.
|
||||
|
||||
### Event: 'browser-window-blur'
|
||||
|
||||
@@ -1329,7 +1331,7 @@ Returns `boolean` - Whether the current desktop environment is Unity launcher.
|
||||
### `app.getLoginItemSettings([options])` _macOS_ _Windows_
|
||||
|
||||
* `options` Object (optional)
|
||||
* `type` string (optional) _macOS_ - Can be one of `mainAppService`, `agentService`, `daemonService`, or `loginItemService`. Defaults to `mainAppService`. Only available on macOS 13 and up. See [app.setLoginItemSettings](app.md#appsetloginitemsettingssettings-macos-windows) for more information about each type.
|
||||
* `type` string (optional) _macOS_ - Can be `mainAppService`, `agentService`, `daemonService`, or `loginItemService`. Defaults to `mainAppService`. Only available on macOS 13 and up. See [app.setLoginItemSettings](app.md#appsetloginitemsettingssettings-macos-windows) for more information about each type.
|
||||
* `serviceName` string (optional) _macOS_ - The name of the service. Required if `type` is non-default. Only available on macOS 13 and up.
|
||||
* `path` string (optional) _Windows_ - The executable path to compare against. Defaults to `process.execPath`.
|
||||
* `args` string[] (optional) _Windows_ - The command-line arguments to compare against. Defaults to an empty array.
|
||||
@@ -1344,13 +1346,13 @@ Returns `Object`:
|
||||
* `wasOpenedAtLogin` boolean _macOS_ - `true` if the app was opened at login automatically.
|
||||
* `wasOpenedAsHidden` boolean _macOS_ _Deprecated_ - `true` if the app was opened as a hidden login item. This indicates that the app should not open any windows at startup. This setting is not available on [MAS builds][mas-builds] or on macOS 13 and up.
|
||||
* `restoreState` boolean _macOS_ _Deprecated_ - `true` if the app was opened as a login item that should restore the state from the previous session. This indicates that the app should restore the windows that were open the last time the app was closed. This setting is not available on [MAS builds][mas-builds] or on macOS 13 and up.
|
||||
* `status` string _macOS_ - can be one of `not-registered`, `enabled`, `requires-approval`, or `not-found`.
|
||||
* `status` string _macOS_ - can be `not-registered`, `enabled`, `requires-approval`, or `not-found`.
|
||||
* `executableWillLaunchAtLogin` boolean _Windows_ - `true` if app is set to open at login and its run key is not deactivated. This differs from `openAtLogin` as it ignores the `args` option, this property will be true if the given executable would be launched at login with **any** arguments.
|
||||
* `launchItems` Object[] _Windows_
|
||||
* `name` string _Windows_ - name value of a registry entry.
|
||||
* `path` string _Windows_ - The executable to an app that corresponds to a registry entry.
|
||||
* `args` string[] _Windows_ - the command-line arguments to pass to the executable.
|
||||
* `scope` string _Windows_ - one of `user` or `machine`. Indicates whether the registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
|
||||
* `scope` string _Windows_ - can be `user` or `machine`. Indicates whether the registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
|
||||
* `enabled` boolean _Windows_ - `true` if the app registry key is startup approved and therefore shows as `enabled` in Task Manager and Windows settings.
|
||||
|
||||
### `app.setLoginItemSettings(settings)` _macOS_ _Windows_
|
||||
|
||||
@@ -351,7 +351,11 @@ Emitted when the window has closed a sheet.
|
||||
|
||||
#### Event: 'new-window-for-tab' _macOS_
|
||||
|
||||
Emitted when the native new tab button is clicked.
|
||||
Emitted when the user clicks the native macOS new tab button. The new
|
||||
tab button is only visible if the current `BrowserWindow` has a
|
||||
`tabbingIdentifier`.
|
||||
|
||||
You must create a window in this handler in order for macOS tabbing to work as expected.
|
||||
|
||||
#### Event: 'system-context-menu' _Windows_ _Linux_
|
||||
|
||||
|
||||
@@ -431,7 +431,11 @@ Emitted when the window has closed a sheet.
|
||||
|
||||
#### Event: 'new-window-for-tab' _macOS_
|
||||
|
||||
Emitted when the native new tab button is clicked.
|
||||
Emitted when the user clicks the native macOS new tab button. The new
|
||||
tab button is only visible if the current `BrowserWindow` has a
|
||||
`tabbingIdentifier`.
|
||||
|
||||
You must create a window in this handler in order for macOS tabbing to work as expected.
|
||||
|
||||
#### Event: 'system-context-menu' _Windows_ _Linux_
|
||||
|
||||
|
||||
@@ -350,6 +350,11 @@ Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https:
|
||||
|
||||
Disable exposition of [Navigator API][] on the global scope from Node.js.
|
||||
|
||||
### `--experimental-transform-types`
|
||||
|
||||
Enables the [transformation](https://nodejs.org/api/typescript.html#type-stripping)
|
||||
of TypeScript-only syntax into JavaScript code.
|
||||
|
||||
## Chromium Flags
|
||||
|
||||
There isn't a documented list of all Chromium switches, but there are a few ways to find them.
|
||||
|
||||
@@ -73,13 +73,16 @@ The following properties are available on instances of `MenuItem`:
|
||||
|
||||
#### `menuItem.id`
|
||||
|
||||
A `string` indicating the item's unique id. This property can be
|
||||
dynamically changed.
|
||||
A `string` indicating the item's unique id.
|
||||
|
||||
This property can be dynamically changed.
|
||||
|
||||
#### `menuItem.label`
|
||||
|
||||
A `string` indicating the item's visible label.
|
||||
|
||||
This property can be dynamically changed.
|
||||
|
||||
#### `menuItem.click`
|
||||
|
||||
A `Function` that is fired when the MenuItem receives a click event.
|
||||
@@ -118,31 +121,37 @@ An `Accelerator | null` indicating the item's [user-assigned accelerator](https:
|
||||
|
||||
#### `menuItem.icon`
|
||||
|
||||
A `NativeImage | string` (optional) indicating the
|
||||
item's icon, if set.
|
||||
A `NativeImage | string` (optional) indicating the item's icon, if set.
|
||||
|
||||
This property can be dynamically changed.
|
||||
|
||||
#### `menuItem.sublabel`
|
||||
|
||||
A `string` indicating the item's sublabel.
|
||||
|
||||
This property can be dynamically changed.
|
||||
|
||||
#### `menuItem.toolTip` _macOS_
|
||||
|
||||
A `string` indicating the item's hover text.
|
||||
|
||||
#### `menuItem.enabled`
|
||||
|
||||
A `boolean` indicating whether the item is enabled. This property can be
|
||||
dynamically changed.
|
||||
A `boolean` indicating whether the item is enabled.
|
||||
|
||||
This property can be dynamically changed.
|
||||
|
||||
#### `menuItem.visible`
|
||||
|
||||
A `boolean` indicating whether the item is visible. This property can be
|
||||
dynamically changed.
|
||||
A `boolean` indicating whether the item is visible.
|
||||
|
||||
This property can be dynamically changed.
|
||||
|
||||
#### `menuItem.checked`
|
||||
|
||||
A `boolean` indicating whether the item is checked. This property can be
|
||||
dynamically changed.
|
||||
A `boolean` indicating whether the item is checked.
|
||||
|
||||
This property can be dynamically changed.
|
||||
|
||||
A `checkbox` menu item will toggle the `checked` property on and off when
|
||||
selected.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# sharedTexture
|
||||
|
||||
> Import shared textures into Electron and converts platform specific handles into [`VideoFrame`](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame). Supports all Web rendering systems, and can be transferred across Electron processes. Read [here](https://github.com/electron/electron/blob/main/shell/common/api/shared_texture/README.md) for more information.
|
||||
> Import shared textures into Electron and converts platform specific handles into [`VideoFrame`](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame). Supports all Web rendering systems, and can be transferred across Electron processes. Read [here](../../shell/common/api/shared_texture/README.md) for more information.
|
||||
|
||||
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
The actual output pixel format and color space of the texture should refer to [`OffscreenSharedTexture`](../structures/offscreen-shared-texture.md) object in the `paint` event.
|
||||
* `argb` - The requested output texture format is 8-bit unorm RGBA, with SRGB SDR color space.
|
||||
* `rgbaf16` - The requested output texture format is 16-bit float RGBA, with scRGB HDR color space.
|
||||
* `deviceScaleFactor` number (optional) _Experimental_ - The device scale factor of the offscreen rendering output. If not set, will use primary display's scale factor as default.
|
||||
* `contextIsolation` boolean (optional) - Whether to run Electron APIs and
|
||||
the specified `preload` script in a separate JavaScript context. Defaults
|
||||
to `true`. The context that the `preload` script runs in will only have
|
||||
@@ -156,6 +157,8 @@
|
||||
`WebContents` when the preferred size changes. Default is `false`.
|
||||
* `transparent` boolean (optional) - Whether to enable background transparency for the guest page. Default is `true`. **Note:** The guest page's text and background colors are derived from the [color scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme) of its root element. When transparency is enabled, the text color will still change accordingly but the background will remain transparent.
|
||||
* `enableDeprecatedPaste` boolean (optional) _Deprecated_ - Whether to enable the `paste` [execCommand](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand). Default is `false`.
|
||||
* `focusOnNavigation` boolean (optional) - Whether to focus the WebContents
|
||||
when navigating. Default is `true`.
|
||||
|
||||
[chrome-content-scripts]: https://developer.chrome.com/extensions/content_scripts#execution-environment
|
||||
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
|
||||
@@ -933,7 +933,7 @@ copying data between CPU and GPU memory, with Chromium's hardware acceleration s
|
||||
Only a limited number of textures can exist at the same time, so it's important that you call `texture.release()` as soon as you're done with the texture.
|
||||
By managing the texture lifecycle by yourself, you can safely pass the `texture.textureInfo` to other processes through IPC.
|
||||
|
||||
More details can be found in the [offscreen rendering tutorial](../tutorial/offscreen-rendering.md). To learn about how to handle the texture in native code, refer to [offscreen rendering's code documentation.](https://github.com/electron/electron/blob/main/shell/browser/osr/README.md).
|
||||
More details can be found in the [offscreen rendering tutorial](../tutorial/offscreen-rendering.md). To learn about how to handle the texture in native code, refer to [offscreen rendering's code documentation.](../../shell/browser/osr/README.md).
|
||||
|
||||
```js
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
@@ -41,7 +41,7 @@ e init --root=~/electron --bootstrap testing
|
||||
```
|
||||
|
||||
The `--bootstrap` flag also runs `e sync` (synchronizes source code branches from
|
||||
[`DEPS`](https://github.com/electron/electron/blob/main/DEPS) using
|
||||
[`DEPS`](../../DEPS) using
|
||||
[`gclient`](https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/HEAD/README.gclient.md))
|
||||
and `e build` (compiles the Electron binary into the `${root}/src/out` folder).
|
||||
|
||||
@@ -63,7 +63,7 @@ Some quick tips on building once your checkout is set up:
|
||||
* **Updating your checkout:** Run git commands such as `git checkout <branch>` and `git pull` from `${root}/src/electron`.
|
||||
Whenever you update your commit `HEAD`, make sure to `e sync` before `e build` to sync dependencies
|
||||
such as Chromium and Node.js. This is especially relevant because the Chromium version in
|
||||
[`DEPS`](https://github.com/electron/electron/blob/main/DEPS) changes frequently.
|
||||
[`DEPS`](../../DEPS) changes frequently.
|
||||
* **Rebuilding:** When making changes to code in `${root}/src/electron/` in a local branch, you only need to re-run `e build`.
|
||||
* **Adding patches:** When contributing changes in `${root}/src/` outside of `${root}/src/electron/`, you need to do so
|
||||
via Electron's [patch system](./patches.md). The `e patches` command can export all relevant patches to
|
||||
@@ -98,7 +98,7 @@ Project configurations can be found in the `.gn` and `.gni` files in the `electr
|
||||
|
||||
The following `gn` files contain the main rules for building Electron:
|
||||
|
||||
* [`BUILD.gn`](https://github.com/electron/electron/blob/main/BUILD.gn) defines how Electron itself
|
||||
* [`BUILD.gn`](../../BUILD.gn) defines how Electron itself
|
||||
is built and includes the default configurations for linking with Chromium.
|
||||
* [`build/args/{testing,release,all}.gn`](https://github.com/electron/electron/tree/main/build/args)
|
||||
contain the default build arguments for building Electron.
|
||||
|
||||
@@ -6,7 +6,7 @@ This is not a comprehensive end-all guide to creating an Electron Browser API, r
|
||||
|
||||
## Add your files to Electron's project configuration
|
||||
|
||||
Electron uses [GN](https://gn.googlesource.com/gn) as a meta build system to generate files for its compiler, [Ninja](https://ninja-build.org/). This means that in order to tell Electron to compile your code, we have to add your API's code and header file names into [`filenames.gni`](https://github.com/electron/electron/blob/main/filenames.gni).
|
||||
Electron uses [GN](https://gn.googlesource.com/gn) as a meta build system to generate files for its compiler, [Ninja](https://ninja-build.org/). This means that in order to tell Electron to compile your code, we have to add your API's code and header file names into [`filenames.gni`](../../filenames.gni).
|
||||
|
||||
You will need to append your API file names alphabetically into the appropriate files like so:
|
||||
|
||||
@@ -127,7 +127,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
||||
|
||||
## Link your Electron API with Node
|
||||
|
||||
In the [`typings/internal-ambient.d.ts`](https://github.com/electron/electron/blob/main/typings/internal-ambient.d.ts) file, we need to append a new property onto the `Process` interface like so:
|
||||
In the [`typings/internal-ambient.d.ts`](../../typings/internal-ambient.d.ts) file, we need to append a new property onto the `Process` interface like so:
|
||||
|
||||
```ts title='typings/internal-ambient.d.ts' @ts-nocheck
|
||||
interface Process {
|
||||
@@ -141,7 +141,7 @@ At the very bottom of your `api_name.cc` file:
|
||||
NODE_LINKED_BINDING_CONTEXT_AWARE(electron_browser_{api_name},Initialize)
|
||||
```
|
||||
|
||||
In your [`shell/common/node_bindings.cc`](https://github.com/electron/electron/blob/main/shell/common/node_bindings.cc) file, add your node binding name to Electron's built-in modules.
|
||||
In your [`shell/common/node_bindings.cc`](../../shell/common/node_bindings.cc) file, add your node binding name to Electron's built-in modules.
|
||||
|
||||
```cpp title='shell/common/node_bindings.cc'
|
||||
#define ELECTRON_BROWSER_MODULES(V) \
|
||||
@@ -159,7 +159,7 @@ We will need to create a new TypeScript file in the path that follows:
|
||||
|
||||
`"lib/browser/api/{electron_browser_{api_name}}.ts"`
|
||||
|
||||
An example of the contents of this file can be found [here](https://github.com/electron/electron/blob/main/lib/browser/api/native-theme.ts).
|
||||
An example of the contents of this file can be found [here](../../lib/browser/api/native-theme.ts).
|
||||
|
||||
### Expose your module to TypeScript
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ $ git push origin my-branch
|
||||
### Step 9: Opening the Pull Request
|
||||
|
||||
From within GitHub, opening a new pull request will present you with a template
|
||||
that should be filled out. It can be found [here](https://github.com/electron/electron/blob/main/.github/PULL_REQUEST_TEMPLATE.md).
|
||||
that should be filled out. It can be found [here](../../.github/PULL_REQUEST_TEMPLATE.md).
|
||||
|
||||
If you do not adequately complete this template, your PR may be delayed in being merged as maintainers
|
||||
seek more information or clarify ambiguities.
|
||||
@@ -218,8 +218,7 @@ seem unfamiliar, refer to this
|
||||
|
||||
#### Approval and Request Changes Workflow
|
||||
|
||||
All pull requests require approval from a
|
||||
[Code Owner](https://github.com/electron/electron/blob/main/.github/CODEOWNERS)
|
||||
All pull requests require approval from a [Code Owner](../../.github/CODEOWNERS)
|
||||
of the area you modified in order to land. Whenever a maintainer reviews a pull
|
||||
request they may request changes. These may be small, such as fixing a typo, or
|
||||
may involve substantive changes. Such requests are intended to be helpful, but
|
||||
|
||||
@@ -10,7 +10,7 @@ to understand the source code better.
|
||||
## Project structure
|
||||
|
||||
Electron is a complex project containing multiple upstream dependencies, which are tracked in source
|
||||
control via the [`DEPS`](https://github.com/electron/electron/blob/main/DEPS) file. When
|
||||
control via the [`DEPS`](../../DEPS) file. When
|
||||
[initializing a local Electron checkout](./build-instructions-gn.md), Electron's source code is just one
|
||||
of many nested folders within the project root.
|
||||
|
||||
|
||||
@@ -15,6 +15,14 @@ Currently, ASAR integrity checking is supported on:
|
||||
* macOS as of `electron>=16.0.0`
|
||||
* Windows as of `electron>=30.0.0`
|
||||
|
||||
> [!NOTE]
|
||||
> ASAR integrity is fully supported in Mac App Store (MAS) builds and is recommended
|
||||
> as a best practice. While MAS-installed applications have their `Resources/` folder
|
||||
> protected by the system (owned by root), ASAR integrity still provides an additional
|
||||
> layer of security. It is especially important if you use Electron's MAS build but
|
||||
> distribute your app through channels other than the Mac App Store (such as direct
|
||||
> download), since those installations won't have the system-level read-only protections.
|
||||
|
||||
In order to enable ASAR integrity checking, you also need to ensure that your `app.asar` file
|
||||
was generated by a version of the `@electron/asar` npm package that supports ASAR integrity.
|
||||
|
||||
|
||||
@@ -197,4 +197,4 @@ Somewhere in the Electron binary, there will be a sequence of bytes that look li
|
||||
|
||||
To flip a fuse, you find its position in the fuse wire and change it to "0" or "1" depending on the state you'd like.
|
||||
|
||||
You can view the current schema [here](https://github.com/electron/electron/blob/main/build/fuses/fuses.json5).
|
||||
You can view the current schema [here](../../build/fuses/fuses.json5).
|
||||
|
||||
@@ -37,7 +37,7 @@ setting.
|
||||
The frames are directly copied in GPU textures, thus this mode is very fast because
|
||||
there's no CPU-GPU memory copies overhead, and you can directly import the shared
|
||||
texture to your own rendering program. You can read more details
|
||||
[here](https://github.com/electron/electron/blob/main/shell/browser/osr/README.md).
|
||||
[here](../../shell/common/api/shared_texture/README.md).
|
||||
|
||||
2. Use CPU shared memory bitmap
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ toc_max_heading_level: 3
|
||||
|
||||
:::info Reporting security issues
|
||||
For information on how to properly disclose an Electron vulnerability,
|
||||
see [SECURITY.md](https://github.com/electron/electron/blob/main/SECURITY.md).
|
||||
see [SECURITY.md](../../SECURITY.md).
|
||||
|
||||
For upstream Chromium vulnerabilities: Electron keeps up to date with alternating
|
||||
Chromium releases. For more information, see the
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
* For information on supported releases, see the [Electron Releases](./electron-timelines.md) doc.
|
||||
* For community support on Electron, see the [Community page](https://www.electronjs.org/community).
|
||||
* For platform support info, see the [README](https://github.com/electron/electron/blob/main/README.md).
|
||||
* For platform support info, see the [README](../../README.md).
|
||||
|
||||
@@ -26,9 +26,9 @@ const MenuItem = function (this: any, options: any) {
|
||||
this.overrideReadOnlyProperty('type', roles.getDefaultType(this.role));
|
||||
this.overrideReadOnlyProperty('role');
|
||||
this.overrideReadOnlyProperty('accelerator', roles.getDefaultAccelerator(this.role));
|
||||
this.overrideReadOnlyProperty('icon');
|
||||
this.overrideReadOnlyProperty('submenu');
|
||||
|
||||
this.overrideProperty('icon');
|
||||
this.overrideProperty('label', roles.getDefaultLabel(this.role));
|
||||
this.overrideProperty('sublabel', '');
|
||||
this.overrideProperty('toolTip', '');
|
||||
|
||||
@@ -53,6 +53,18 @@ Menu.prototype._isCommandIdVisible = function (id) {
|
||||
return this.commandsMap[id]?.visible ?? false;
|
||||
};
|
||||
|
||||
Menu.prototype._getLabelForCommandId = function (id) {
|
||||
return this.commandsMap[id]?.label ?? '';
|
||||
};
|
||||
|
||||
Menu.prototype._getSecondaryLabelForCommandId = function (id) {
|
||||
return this.commandsMap[id]?.sublabel ?? '';
|
||||
};
|
||||
|
||||
Menu.prototype._getIconForCommandId = function (id) {
|
||||
return this.commandsMap[id]?.icon ?? null;
|
||||
};
|
||||
|
||||
Menu.prototype._getAcceleratorForCommandId = function (id, useDefaultAccelerator) {
|
||||
const command = this.commandsMap[id];
|
||||
if (!command) return;
|
||||
@@ -158,7 +170,6 @@ Menu.prototype.insert = function (pos, item) {
|
||||
insertItemByType.call(this, item, pos);
|
||||
|
||||
// set item properties
|
||||
if (item.sublabel) this.setSublabel(pos, item.sublabel);
|
||||
if (item.toolTip) this.setToolTip(pos, item.toolTip);
|
||||
if (item.icon) this.setIcon(pos, item.icon);
|
||||
if (item.role) this.setRole(pos, item.role);
|
||||
|
||||
@@ -9,6 +9,7 @@ if ((globalThis as any).blinkfetch) {
|
||||
const keys = ['fetch', 'Response', 'FormData', 'Request', 'Headers', 'EventSource'];
|
||||
for (const key of keys) {
|
||||
(globalThis as any)[key] = (globalThis as any)[`blink${key}`];
|
||||
delete (globalThis as any)[`blink${key}`];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ if ((globalThis as any).blinkfetch) {
|
||||
const keys = ['fetch', 'Response', 'FormData', 'Request', 'Headers', 'EventSource'];
|
||||
for (const key of keys) {
|
||||
(globalThis as any)[key] = (globalThis as any)[`blink${key}`];
|
||||
delete (globalThis as any)[`blink${key}`];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"lint:gn": "node ./script/lint.js --gn",
|
||||
"lint:docs": "remark docs -qf && npm run lint:js-in-markdown && npm run create-typescript-definitions && npm run lint:ts-check-js-in-markdown && npm run lint:docs-fiddles && npm run lint:docs-relative-links && npm run lint:markdown && npm run lint:api-history",
|
||||
"lint:docs-fiddles": "standard \"docs/fiddles/**/*.js\"",
|
||||
"lint:docs-relative-links": "lint-roller-markdown-links --root docs \"**/*.md\"",
|
||||
"lint:docs-relative-links": "lint-roller-markdown-links --resource-root . --root docs \"**/*.md\"",
|
||||
"lint:markdown": "node ./script/lint.js --md",
|
||||
"lint:ts-check-js-in-markdown": "lint-roller-markdown-ts-check --root docs \"**/*.md\" --ignore \"breaking-changes.md\"",
|
||||
"lint:js-in-markdown": "lint-roller-markdown-standard --root docs \"**/*.md\"",
|
||||
|
||||
@@ -147,3 +147,5 @@ fix_os_crypt_async_cookie_encryption.patch
|
||||
graphite_handle_out_of_order_recording_errors.patch
|
||||
move_wayland_pointer_lock_overrides_to_common_code.patch
|
||||
loaf_add_feature_to_enable_sourceurl_for_all_protocols.patch
|
||||
fix_update_dbus_signal_signature_for_xdg_globalshortcuts_portal.patch
|
||||
patch_osr_control_screen_info.patch
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: build: allow electron to use exec_script
|
||||
This is similar to the //build usecase so we're OK adding ourselves here
|
||||
|
||||
diff --git a/.gn b/.gn
|
||||
index ae58a0b0a64ae1fdb3f9cd8587041d71a121c6b9..0ed56526002b12deb6d29f3dd23a0d74d8e7473c 100644
|
||||
index ae58a0b0a64ae1fdb3f9cd8587041d71a121c6b9..f9d4e9b015ad266452dfa2a442b432ef31d09a5b 100644
|
||||
--- a/.gn
|
||||
+++ b/.gn
|
||||
@@ -167,4 +167,27 @@ exec_script_allowlist =
|
||||
@@ -167,4 +167,28 @@ exec_script_allowlist =
|
||||
|
||||
"//tools/grit/grit_rule.gni",
|
||||
"//tools/gritsettings/BUILD.gn",
|
||||
@@ -25,6 +25,7 @@ index ae58a0b0a64ae1fdb3f9cd8587041d71a121c6b9..0ed56526002b12deb6d29f3dd23a0d74
|
||||
+ "//third_party/electron_node/deps/googletest/unofficial.gni",
|
||||
+ "//third_party/electron_node/deps/histogram/unofficial.gni",
|
||||
+ "//third_party/electron_node/deps/llhttp/unofficial.gni",
|
||||
+ "//third_party/electron_node/deps/merve/unofficial.gni",
|
||||
+ "//third_party/electron_node/deps/nbytes/unofficial.gni",
|
||||
+ "//third_party/electron_node/deps/ncrypto/unofficial.gni",
|
||||
+ "//third_party/electron_node/deps/nghttp2/unofficial.gni",
|
||||
|
||||
@@ -12,7 +12,7 @@ We attempt to migrate the safe storage key from the old account, if that migrati
|
||||
Existing apps that aren't built for the app store should be unimpacted, there is one edge case where a user uses BOTH an AppStore and a darwin build of the same app only one will keep it's access to the safestorage key as during the migration we delete the old account. This is an acceptable edge case as no one should be actively using two versions of the same app.
|
||||
|
||||
diff --git a/components/os_crypt/common/keychain_password_mac.mm b/components/os_crypt/common/keychain_password_mac.mm
|
||||
index f19628cc0cdba39b232f55935e8eee9786b02a77..036b50f53e78bc21ed1e1d6dd876b50ab1e8f05d 100644
|
||||
index f19628cc0cdba39b232f55935e8eee9786b02a77..ab6ce9b1cf85029050a7497cd53813a03a46d408 100644
|
||||
--- a/components/os_crypt/common/keychain_password_mac.mm
|
||||
+++ b/components/os_crypt/common/keychain_password_mac.mm
|
||||
@@ -27,6 +27,12 @@
|
||||
@@ -28,14 +28,13 @@ index f19628cc0cdba39b232f55935e8eee9786b02a77..036b50f53e78bc21ed1e1d6dd876b50a
|
||||
namespace {
|
||||
|
||||
// These two strings ARE indeed user facing. But they are used to access
|
||||
@@ -96,11 +102,51 @@
|
||||
@@ -96,18 +102,56 @@
|
||||
uma_result);
|
||||
};
|
||||
|
||||
+ const std::string account_name_suffix = kAccountNameSuffix;
|
||||
+ const std::string suffixed_account_name = GetAccountName() + account_name_suffix;
|
||||
auto password =
|
||||
- keychain_->FindGenericPassword(GetServiceName(), GetAccountName());
|
||||
+ keychain_->FindGenericPassword(GetServiceName(), suffixed_account_name);
|
||||
+
|
||||
+ if (password.has_value()) {
|
||||
@@ -53,10 +52,8 @@ index f19628cc0cdba39b232f55935e8eee9786b02a77..036b50f53e78bc21ed1e1d6dd876b50a
|
||||
+
|
||||
+ // If the suffixed account didn't exist, we should check if the legacy non-suffixed account
|
||||
+ // exists. If it does we can use that key and migrate it to the new account
|
||||
+ base::apple::ScopedCFTypeRef<SecKeychainItemRef> item_ref;
|
||||
+ password =
|
||||
+ keychain_->FindGenericPassword(GetServiceName(), GetAccountName(),
|
||||
+ item_ref.InitializeInto());
|
||||
keychain_->FindGenericPassword(GetServiceName(), GetAccountName());
|
||||
|
||||
if (password.has_value()) {
|
||||
uma_result = FindGenericPasswordResult::kPasswordFound;
|
||||
@@ -70,7 +67,7 @@ index f19628cc0cdba39b232f55935e8eee9786b02a77..036b50f53e78bc21ed1e1d6dd876b50a
|
||||
+ // If we successfully made the suffixed account we can delete the old
|
||||
+ // account to ensure new apps don't try to use it and run into IAM
|
||||
+ // issues
|
||||
+ error = keychain_->ItemDelete(item_ref.get());
|
||||
+ error = keychain_->ItemDelete(GetServiceName(), GetAccountName());
|
||||
+ if (error != noErr) {
|
||||
+ OSSTATUS_DLOG(ERROR, error) << "Keychain delete for legacy key failed";
|
||||
+ }
|
||||
@@ -81,115 +78,79 @@ index f19628cc0cdba39b232f55935e8eee9786b02a77..036b50f53e78bc21ed1e1d6dd876b50a
|
||||
return std::string(base::as_string_view(*password));
|
||||
}
|
||||
|
||||
if (password.error() == errSecItemNotFound) {
|
||||
uma_result = FindGenericPasswordResult::kPasswordNotFound;
|
||||
return AddRandomPasswordToKeychain(*keychain_, GetServiceName(),
|
||||
- GetAccountName());
|
||||
+ suffixed_account_name);
|
||||
}
|
||||
|
||||
OSSTATUS_LOG(ERROR, password.error()) << "Keychain lookup failed";
|
||||
diff --git a/crypto/apple/keychain.h b/crypto/apple/keychain.h
|
||||
index 1d2264a5229206f45d1a9bcb009d47180efa6a8b..1dcf2b1d09831012c7f5768a5c6193d529efc821 100644
|
||||
index 1d2264a5229206f45d1a9bcb009d47180efa6a8b..4472e5b605e09659bd75cd4797f073775fe4b354 100644
|
||||
--- a/crypto/apple/keychain.h
|
||||
+++ b/crypto/apple/keychain.h
|
||||
@@ -17,6 +17,14 @@
|
||||
|
||||
namespace crypto::apple {
|
||||
|
||||
+// TODO(smaddock): Migrate to SecItem* as part of
|
||||
+// https://issues.chromium.org/issues/40233280
|
||||
+#if BUILDFLAG(IS_IOS)
|
||||
+using AppleSecKeychainItemRef = void*;
|
||||
+#else
|
||||
+using AppleSecKeychainItemRef = SecKeychainItemRef;
|
||||
+#endif
|
||||
+
|
||||
// Wraps the KeychainServices API in a very thin layer, to allow it to be
|
||||
// mocked out for testing.
|
||||
|
||||
@@ -44,13 +52,18 @@ class CRYPTO_EXPORT Keychain {
|
||||
// std::vector<uint8_t> arm is populated instead.
|
||||
virtual base::expected<std::vector<uint8_t>, OSStatus> FindGenericPassword(
|
||||
std::string_view service_name,
|
||||
- std::string_view account_name) const = 0;
|
||||
+ std::string_view account_name,
|
||||
+ AppleSecKeychainItemRef* item = nullptr) const = 0;
|
||||
|
||||
virtual OSStatus AddGenericPassword(
|
||||
std::string_view service_name,
|
||||
@@ -51,6 +51,11 @@ class CRYPTO_EXPORT Keychain {
|
||||
std::string_view account_name,
|
||||
base::span<const uint8_t> password) const = 0;
|
||||
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+ virtual OSStatus ItemDelete(AppleSecKeychainItemRef item) const = 0;
|
||||
+#endif // !BUILDFLAG(IS_MAC)
|
||||
+ virtual OSStatus ItemDelete(std::string_view service_name,
|
||||
+ std::string_view account_name) const = 0;
|
||||
+#endif // BUILDFLAG(IS_MAC)
|
||||
+
|
||||
protected:
|
||||
Keychain();
|
||||
};
|
||||
diff --git a/crypto/apple/keychain_secitem.h b/crypto/apple/keychain_secitem.h
|
||||
index eb74282adaba24ebd667f0ab3fc34dbe4cd8b527..7b91eb27489cece38eca719986255c5ec01c4bac 100644
|
||||
index eb74282adaba24ebd667f0ab3fc34dbe4cd8b527..0d25e49e2fa1b374d6867b8c602f7685a7f9498d 100644
|
||||
--- a/crypto/apple/keychain_secitem.h
|
||||
+++ b/crypto/apple/keychain_secitem.h
|
||||
@@ -17,12 +17,17 @@ class CRYPTO_EXPORT KeychainSecItem : public Keychain {
|
||||
|
||||
base::expected<std::vector<uint8_t>, OSStatus> FindGenericPassword(
|
||||
std::string_view service_name,
|
||||
- std::string_view account_name) const override;
|
||||
+ std::string_view account_name,
|
||||
+ AppleSecKeychainItemRef* item) const override;
|
||||
|
||||
OSStatus AddGenericPassword(
|
||||
@@ -23,6 +23,11 @@ class CRYPTO_EXPORT KeychainSecItem : public Keychain {
|
||||
std::string_view service_name,
|
||||
std::string_view account_name,
|
||||
base::span<const uint8_t> password) const override;
|
||||
+
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+ OSStatus ItemDelete(AppleSecKeychainItemRef item) const override;
|
||||
+#endif // !BUILDFLAG(IS_MAC)
|
||||
+ OSStatus ItemDelete(std::string_view service_name,
|
||||
+ std::string_view account_name) const override;
|
||||
+#endif // BUILDFLAG(IS_MAC)
|
||||
};
|
||||
|
||||
} // namespace crypto::apple
|
||||
diff --git a/crypto/apple/keychain_secitem.mm b/crypto/apple/keychain_secitem.mm
|
||||
index a8d50dd27db52526b0635c2b97f076df1994a6aa..e45f0d1079c8acfae55cf873e66ab3d9a10ad8ee 100644
|
||||
index a8d50dd27db52526b0635c2b97f076df1994a6aa..464c17909b9a554b269a70ea08771da6ec7ac011 100644
|
||||
--- a/crypto/apple/keychain_secitem.mm
|
||||
+++ b/crypto/apple/keychain_secitem.mm
|
||||
@@ -138,7 +138,8 @@
|
||||
|
||||
base::expected<std::vector<uint8_t>, OSStatus>
|
||||
KeychainSecItem::FindGenericPassword(std::string_view service_name,
|
||||
- std::string_view account_name) const {
|
||||
+ std::string_view account_name,
|
||||
+ AppleSecKeychainItemRef* item) const {
|
||||
base::apple::ScopedCFTypeRef<CFDictionaryRef> query =
|
||||
MakeGenericPasswordQuery(service_name, account_name);
|
||||
|
||||
@@ -165,4 +166,13 @@
|
||||
@@ -165,4 +165,18 @@
|
||||
return base::ToVector(base::apple::CFDataToSpan(password_data));
|
||||
}
|
||||
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+OSStatus KeychainSecItem::ItemDelete(AppleSecKeychainItemRef item) const {
|
||||
+ // TODO(smaddock): AppleSecKeychainItemRef aliases the deprecated
|
||||
+ // SecKeychainItemRef. Need to update this to accept a CFDictionary in the
|
||||
+ // case of SecItemDelete.
|
||||
+ return noErr;
|
||||
+OSStatus KeychainSecItem::ItemDelete(std::string_view service_name,
|
||||
+ std::string_view account_name) const {
|
||||
+ NSDictionary* query = @{
|
||||
+ CFToNSPtrCast(kSecClass) : CFToNSPtrCast(kSecClassGenericPassword),
|
||||
+ CFToNSPtrCast(kSecAttrService) : base::SysUTF8ToNSString(service_name),
|
||||
+ CFToNSPtrCast(kSecAttrAccount) : base::SysUTF8ToNSString(account_name),
|
||||
+ };
|
||||
+ base::apple::ScopedCFTypeRef<CFDictionaryRef> cf_query(
|
||||
+ NSToCFOwnershipCast(query));
|
||||
+ return SecItemDelete(cf_query.get());
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
} // namespace crypto::apple
|
||||
diff --git a/crypto/apple/mock_keychain.cc b/crypto/apple/mock_keychain.cc
|
||||
index 080806aaf3fc10548b160850ad36ef3519ea2b6f..21f04059d67ba41118face6ee9327aa05e854362 100644
|
||||
index 080806aaf3fc10548b160850ad36ef3519ea2b6f..98625524b668b86c857d5a8910bfb53b3ab40575 100644
|
||||
--- a/crypto/apple/mock_keychain.cc
|
||||
+++ b/crypto/apple/mock_keychain.cc
|
||||
@@ -32,7 +32,8 @@ MockKeychain::~MockKeychain() = default;
|
||||
|
||||
base::expected<std::vector<uint8_t>, OSStatus>
|
||||
MockKeychain::FindGenericPassword(std::string_view service_name,
|
||||
- std::string_view account_name) const {
|
||||
+ std::string_view account_name,
|
||||
+ AppleSecKeychainItemRef* item) const {
|
||||
IncrementKeychainAccessHistogram();
|
||||
|
||||
// When simulating |noErr|, return canned |passwordData| and
|
||||
@@ -56,6 +57,10 @@ OSStatus MockKeychain::AddGenericPassword(
|
||||
@@ -56,6 +56,11 @@ OSStatus MockKeychain::AddGenericPassword(
|
||||
return noErr;
|
||||
}
|
||||
|
||||
+OSStatus MockKeychain::ItemDelete(SecKeychainItemRef itemRef) const {
|
||||
+OSStatus MockKeychain::ItemDelete(std::string_view service_name,
|
||||
+ std::string_view account_name) const {
|
||||
+ return noErr;
|
||||
+}
|
||||
+
|
||||
@@ -197,25 +158,17 @@ index 080806aaf3fc10548b160850ad36ef3519ea2b6f..21f04059d67ba41118face6ee9327aa0
|
||||
IncrementKeychainAccessHistogram();
|
||||
return kPassword;
|
||||
diff --git a/crypto/apple/mock_keychain.h b/crypto/apple/mock_keychain.h
|
||||
index 680efe0312c81449e069c19d9c6ef146da7834db..b49c2ba5f639344ab57e9f14c098effc38729d1f 100644
|
||||
index 680efe0312c81449e069c19d9c6ef146da7834db..102db6013b505fed32db176a90f5176118f62773 100644
|
||||
--- a/crypto/apple/mock_keychain.h
|
||||
+++ b/crypto/apple/mock_keychain.h
|
||||
@@ -36,13 +36,18 @@ class CRYPTO_EXPORT MockKeychain : public Keychain {
|
||||
// Keychain implementation.
|
||||
base::expected<std::vector<uint8_t>, OSStatus> FindGenericPassword(
|
||||
std::string_view service_name,
|
||||
- std::string_view account_name) const override;
|
||||
+ std::string_view account_name,
|
||||
+ AppleSecKeychainItemRef* item) const override;
|
||||
|
||||
OSStatus AddGenericPassword(
|
||||
std::string_view service_name,
|
||||
@@ -43,6 +43,11 @@ class CRYPTO_EXPORT MockKeychain : public Keychain {
|
||||
std::string_view account_name,
|
||||
base::span<const uint8_t> password) const override;
|
||||
|
||||
+#if !BUILDFLAG(IS_IOS)
|
||||
+ OSStatus ItemDelete(SecKeychainItemRef itemRef) const override;
|
||||
+#endif // !BUILDFLAG(IS_IOS)
|
||||
+#if BUILDFLAG(IS_MAC)
|
||||
+ OSStatus ItemDelete(std::string_view service_name,
|
||||
+ std::string_view account_name) const override;
|
||||
+#endif // BUILDFLAG(IS_MAC)
|
||||
+
|
||||
// Returns the password that OSCrypt uses to generate its encryption key.
|
||||
std::string GetEncryptionPassword() const;
|
||||
|
||||
@@ -4,7 +4,7 @@ Date: Wed, 28 Jun 2023 21:11:40 +0900
|
||||
Subject: fix: harden blink::ScriptState::MaybeFrom
|
||||
|
||||
NOTE: since https://chromium-review.googlesource.com/c/chromium/src/+/6973697
|
||||
the patch is only needed for 32-bit builds.
|
||||
the patch is only needed for 32-bit builds or builds where the V8 sandbox is disabled.
|
||||
|
||||
This is needed as side effect of https://chromium-review.googlesource.com/c/chromium/src/+/4609446
|
||||
which now gets blink::ExecutionContext from blink::ScriptState
|
||||
@@ -56,18 +56,18 @@ index cecf528475cb832ed1876381878eade582bc83d6..71308b2d963c2d083328aad6be356dc5
|
||||
|
||||
enum EmbedderDataTag : uint16_t {
|
||||
diff --git a/third_party/blink/renderer/platform/bindings/script_state.cc b/third_party/blink/renderer/platform/bindings/script_state.cc
|
||||
index 8b6522c9299bef5ab766795b64a1ba30bc382a12..a714aeb8a62886bedb3820b33b49b1ebdb9c7cc0 100644
|
||||
index 8b6522c9299bef5ab766795b64a1ba30bc382a12..4615dc04a3814a096898a36c7bbeb30f960a8b4d 100644
|
||||
--- a/third_party/blink/renderer/platform/bindings/script_state.cc
|
||||
+++ b/third_party/blink/renderer/platform/bindings/script_state.cc
|
||||
@@ -14,6 +14,12 @@ namespace blink {
|
||||
|
||||
ScriptState::CreateCallback ScriptState::s_create_callback_ = nullptr;
|
||||
|
||||
+#if defined(ARCH_CPU_32_BITS)
|
||||
+#if !defined(V8_ENABLE_SANDBOX)
|
||||
+int const ScriptState::kScriptStateTag = 0x6e6f64;
|
||||
+void* const ScriptState::kScriptStateTagPtr = const_cast<void*>(
|
||||
+ static_cast<const void*>(&ScriptState::kScriptStateTag));
|
||||
+#endif // defined(ARCH_CPU_32_BITS)
|
||||
+#endif // !defined(V8_ENABLE_SANDBOX)
|
||||
+
|
||||
// static
|
||||
void ScriptState::SetCreateCallback(CreateCallback create_callback) {
|
||||
@@ -76,10 +76,10 @@ index 8b6522c9299bef5ab766795b64a1ba30bc382a12..a714aeb8a62886bedb3820b33b49b1eb
|
||||
context_.SetWeak(this, &OnV8ContextCollectedCallback);
|
||||
context->SetAlignedPointerInEmbedderData(kV8ContextPerContextDataIndex, this,
|
||||
gin::kBlinkScriptState);
|
||||
+#if defined(ARCH_CPU_32_BITS)
|
||||
+#if !defined(V8_ENABLE_SANDBOX)
|
||||
+ context->SetAlignedPointerInEmbedderData(
|
||||
+ kV8ContextPerContextDataTagIndex, ScriptState::kScriptStateTagPtr, v8::kEmbedderDataTypeTagDefault);
|
||||
+#endif // defined(ARCH_CPU_32_BITS)
|
||||
+#endif // !defined(V8_ENABLE_SANDBOX)
|
||||
RendererResourceCoordinator::Get()->OnScriptStateCreated(this,
|
||||
execution_context);
|
||||
}
|
||||
@@ -87,15 +87,15 @@ index 8b6522c9299bef5ab766795b64a1ba30bc382a12..a714aeb8a62886bedb3820b33b49b1eb
|
||||
// Cut the reference from V8 context to ScriptState.
|
||||
GetContext()->SetAlignedPointerInEmbedderData(
|
||||
kV8ContextPerContextDataIndex, nullptr, gin::kBlinkScriptState);
|
||||
+#if defined(ARCH_CPU_32_BITS)
|
||||
+#if !defined(V8_ENABLE_SANDBOX)
|
||||
+ GetContext()->SetAlignedPointerInEmbedderData(
|
||||
+ kV8ContextPerContextDataTagIndex, nullptr, v8::kEmbedderDataTypeTagDefault);
|
||||
+#endif // defined(ARCH_CPU_32_BITS)
|
||||
+#endif // !defined(V8_ENABLE_SANDBOX)
|
||||
reference_from_v8_context_.Clear();
|
||||
|
||||
// Cut the reference from ScriptState to V8 context.
|
||||
diff --git a/third_party/blink/renderer/platform/bindings/script_state.h b/third_party/blink/renderer/platform/bindings/script_state.h
|
||||
index 5ccdf26cead17031d510589b74288cbe79692779..bf3023d5305c05c5d92953b5bf5f655f964e5c28 100644
|
||||
index 5ccdf26cead17031d510589b74288cbe79692779..54ede003ebe0a46e624c9d67f7272b8898bbc83e 100644
|
||||
--- a/third_party/blink/renderer/platform/bindings/script_state.h
|
||||
+++ b/third_party/blink/renderer/platform/bindings/script_state.h
|
||||
@@ -6,6 +6,7 @@
|
||||
@@ -110,7 +110,7 @@ index 5ccdf26cead17031d510589b74288cbe79692779..bf3023d5305c05c5d92953b5bf5f655f
|
||||
kV8ContextPerContextDataIndex) {
|
||||
return nullptr;
|
||||
}
|
||||
+#if defined(ARCH_CPU_32_BITS)
|
||||
+#if !defined(V8_ENABLE_SANDBOX)
|
||||
+ if (context->GetNumberOfEmbedderDataFields() <=
|
||||
+ kV8ContextPerContextDataTagIndex ||
|
||||
+ context->GetAlignedPointerFromEmbedderData(
|
||||
@@ -119,7 +119,7 @@ index 5ccdf26cead17031d510589b74288cbe79692779..bf3023d5305c05c5d92953b5bf5f655f
|
||||
+ ScriptState::kScriptStateTagPtr) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+#endif // defined(ARCH_CPU_32_BITS)
|
||||
+#endif // !defined(V8_ENABLE_SANDBOX)
|
||||
ScriptState* script_state =
|
||||
static_cast<ScriptState*>(context->GetAlignedPointerFromEmbedderData(
|
||||
isolate, kV8ContextPerContextDataIndex, gin::kBlinkScriptState));
|
||||
@@ -127,13 +127,13 @@ index 5ccdf26cead17031d510589b74288cbe79692779..bf3023d5305c05c5d92953b5bf5f655f
|
||||
static_cast<int>(gin::kPerContextDataStartIndex) +
|
||||
static_cast<int>(gin::kEmbedderBlink);
|
||||
|
||||
+#if defined(ARCH_CPU_32_BITS)
|
||||
+#if !defined(V8_ENABLE_SANDBOX)
|
||||
+ static void* const kScriptStateTagPtr;
|
||||
+ static int const kScriptStateTag;
|
||||
+ static constexpr int kV8ContextPerContextDataTagIndex =
|
||||
+ static_cast<int>(gin::kPerContextDataStartIndex) +
|
||||
+ static_cast<int>(gin::kEmbedderBlinkTag);
|
||||
+#endif // defined(ARCH_CPU_32_BITS)
|
||||
+#endif // !defined(V8_ENABLE_SANDBOX)
|
||||
+
|
||||
// For accessing information about the last script compilation via
|
||||
// internals.idl.
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Mon, 16 Feb 2026 22:33:57 +0100
|
||||
Subject: fix: update DBus signal signature for XDG GlobalShortcuts portal
|
||||
|
||||
Refs https://chromium-review.googlesource.com/c/chromium/src/+/7143562
|
||||
|
||||
The Activated signal from the XDG GlobalShortcuts portal has signature "osta{sv}",
|
||||
but ConnectToSignal was declared with "ost". The strict ReadMessage parser
|
||||
fails on the extra trailing options vardict. Fix by updating the signature
|
||||
to match the spec.
|
||||
|
||||
This should be upstreamed.
|
||||
|
||||
diff --git a/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.cc b/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.cc
|
||||
index 505e59edad7acb41f272f1e323cfd90744e4701b..ead80cfac902a7630cf502b03cb7d2ee048944ac 100644
|
||||
--- a/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.cc
|
||||
+++ b/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.cc
|
||||
@@ -78,7 +78,7 @@ void GlobalAcceleratorListenerLinux::OnServiceStarted(bool service_started) {
|
||||
global_shortcuts_proxy_ = bus_->GetObjectProxy(
|
||||
kPortalServiceName, dbus::ObjectPath(kPortalObjectPath));
|
||||
|
||||
- dbus_utils::ConnectToSignal<"ost">(
|
||||
+ dbus_utils::ConnectToSignal<"osta{sv}">(
|
||||
global_shortcuts_proxy_, kGlobalShortcutsInterface, kSignalActivated,
|
||||
base::BindRepeating(&GlobalAcceleratorListenerLinux::OnActivatedSignal,
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
@@ -299,13 +299,14 @@ void GlobalAcceleratorListenerLinux::OnBindShortcuts(
|
||||
}
|
||||
|
||||
void GlobalAcceleratorListenerLinux::OnActivatedSignal(
|
||||
- dbus_utils::ConnectToSignalResultSig<"ost"> result) {
|
||||
+ dbus_utils::ConnectToSignalResultSig<"osta{sv}"> result) {
|
||||
if (!result.has_value()) {
|
||||
LOG(ERROR) << "Failed to parse Activated signal.";
|
||||
return;
|
||||
}
|
||||
|
||||
- auto [session_handle, shortcut_id, timestamp] = std::move(result.value());
|
||||
+ auto [session_handle, shortcut_id, timestamp, options] =
|
||||
+ std::move(result.value());
|
||||
|
||||
// Only process the signal if it comes from our current session.
|
||||
if (!session_proxy_ || session_proxy_->object_path() != session_handle) {
|
||||
diff --git a/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.h b/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.h
|
||||
index 3838de75a0a3791f774e2ddedec0f6c7f2f30157..91a205e6c526aa02b46b1590fa427e8875a67280 100644
|
||||
--- a/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.h
|
||||
+++ b/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.h
|
||||
@@ -97,7 +97,8 @@ class GlobalAcceleratorListenerLinux : public GlobalAcceleratorListener {
|
||||
base::expected<dbus_xdg::Dictionary, dbus_xdg::ResponseError> results);
|
||||
|
||||
// Callbacks for DBus signals.
|
||||
- void OnActivatedSignal(dbus_utils::ConnectToSignalResultSig<"ost"> result);
|
||||
+ void OnActivatedSignal(
|
||||
+ dbus_utils::ConnectToSignalResultSig<"osta{sv}"> result);
|
||||
|
||||
void OnSignalConnected(const std::string& interface_name,
|
||||
const std::string& signal_name,
|
||||
@@ -1,13 +1,13 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Thu, 7 Apr 2022 20:30:16 +0900
|
||||
Subject: Make gtk::GetLibGdkPixbuf public
|
||||
Subject: Make gtk::GetLibGdkPixbuf and gtk::GetLibGdk public
|
||||
|
||||
Allows embedders to get a handle to the gdk_pixbuf
|
||||
library already loaded in the process.
|
||||
Allows embedders to get handles to the gdk_pixbuf
|
||||
and gdk libraries already loaded in the process.
|
||||
|
||||
diff --git a/ui/gtk/gtk_compat.cc b/ui/gtk/gtk_compat.cc
|
||||
index e05b4f2eb1b22d5a647cb020bae4e4052a2e735c..c06af1c03487fafe76fde3bfa157a7d265e2f3a0 100644
|
||||
index e05b4f2eb1b22d5a647cb020bae4e4052a2e735c..86524a419606bea3e7d090415fda8f2d8ce24df2 100644
|
||||
--- a/ui/gtk/gtk_compat.cc
|
||||
+++ b/ui/gtk/gtk_compat.cc
|
||||
@@ -78,11 +78,6 @@ void* GetLibGio() {
|
||||
@@ -22,7 +22,7 @@ index e05b4f2eb1b22d5a647cb020bae4e4052a2e735c..c06af1c03487fafe76fde3bfa157a7d2
|
||||
void* GetLibGdk3() {
|
||||
static void* libgdk3 = DlOpen("libgdk-3.so.0");
|
||||
return libgdk3;
|
||||
@@ -175,6 +170,11 @@ gfx::Insets InsetsFromGtkBorder(const GtkBorder& border) {
|
||||
@@ -175,6 +170,15 @@ gfx::Insets InsetsFromGtkBorder(const GtkBorder& border) {
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -30,20 +30,27 @@ index e05b4f2eb1b22d5a647cb020bae4e4052a2e735c..c06af1c03487fafe76fde3bfa157a7d2
|
||||
+ static void* libgdk_pixbuf = DlOpen("libgdk_pixbuf-2.0.so.0");
|
||||
+ return libgdk_pixbuf;
|
||||
+}
|
||||
+
|
||||
+void* GetLibGdk() {
|
||||
+ return GtkCheckVersion(4) ? GetLibGtk4() : GetLibGdk3();
|
||||
+}
|
||||
+
|
||||
bool LoadGtk(ui::LinuxUiBackend backend) {
|
||||
static bool loaded = LoadGtkImpl(backend);
|
||||
return loaded;
|
||||
diff --git a/ui/gtk/gtk_compat.h b/ui/gtk/gtk_compat.h
|
||||
index 841e2e8fcdbe2da4aac487badd4d352476e461a2..e458df649546fa3bee10e24f0edac147186cc152 100644
|
||||
index 841e2e8fcdbe2da4aac487badd4d352476e461a2..043c3ab4dde02ca71798034e8cb2b3f2d2677af7 100644
|
||||
--- a/ui/gtk/gtk_compat.h
|
||||
+++ b/ui/gtk/gtk_compat.h
|
||||
@@ -42,6 +42,9 @@ using SkColor = uint32_t;
|
||||
@@ -42,6 +42,12 @@ using SkColor = uint32_t;
|
||||
|
||||
namespace gtk {
|
||||
|
||||
+// Get handle to the currently loaded gdk_pixbuf library in the process.
|
||||
+void* GetLibGdkPixbuf();
|
||||
+
|
||||
+// Get handle to the currently loaded gdk library in the process.
|
||||
+void* GetLibGdk();
|
||||
+
|
||||
// Loads libgtk and related libraries and returns true on success.
|
||||
bool LoadGtk(ui::LinuxUiBackend backend);
|
||||
|
||||
@@ -516,7 +516,7 @@ index 020050de162705651b4eb8378880cd4eb017d46c..2d3554861a570271d6f9b9a2c8b1de53
|
||||
// The NSWindow used by BridgedNativeWidget. Provides hooks into AppKit that
|
||||
// can only be accomplished by overriding methods.
|
||||
diff --git a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
|
||||
index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6b192912c 100644
|
||||
index a474e70cf3c10405b6f94f129f5a7312bb81fd73..adaff0f3d676eeaef93ac9a4a3b55fc0e572d33b 100644
|
||||
--- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
|
||||
+++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
|
||||
@@ -21,6 +21,7 @@
|
||||
@@ -553,7 +553,7 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
@end
|
||||
|
||||
struct NSEdgeAndCornerThicknesses {
|
||||
@@ -158,13 +163,17 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event;
|
||||
@@ -158,13 +163,30 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event;
|
||||
@implementation NSView (CRFrameViewAdditions)
|
||||
// If a mouseDown: falls through to the frame view, turn it into a window drag.
|
||||
- (void)cr_mouseDownOnFrameView:(NSEvent*)event {
|
||||
@@ -561,6 +561,19 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
if ([self.window _resizeDirectionForMouseLocation:event.locationInWindow] !=
|
||||
-1)
|
||||
return;
|
||||
+#else
|
||||
+ // For MAS builds, approximate the resize direction check.
|
||||
+ if (self.window.styleMask & NSWindowStyleMaskResizable) {
|
||||
+ constexpr CGFloat kResizeThreshold = 5.0;
|
||||
+ NSPoint location = event.locationInWindow;
|
||||
+ NSRect frame = self.window.frame;
|
||||
+ CGFloat width = NSWidth(frame);
|
||||
+ CGFloat height = NSHeight(frame);
|
||||
+ if (location.x < kResizeThreshold || location.x > width - kResizeThreshold ||
|
||||
+ location.y < kResizeThreshold || location.y > height - kResizeThreshold) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
[self.window performWindowDragWithEvent:event];
|
||||
}
|
||||
@@ -571,7 +584,7 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
@implementation NativeWidgetMacNSWindowTitledFrame
|
||||
- (void)mouseDown:(NSEvent*)event {
|
||||
if (self.window.isMovable)
|
||||
@@ -192,6 +201,8 @@ - (BOOL)usesCustomDrawing {
|
||||
@@ -192,6 +214,8 @@ - (BOOL)usesCustomDrawing {
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -580,7 +593,7 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
@implementation NativeWidgetMacNSWindow {
|
||||
@private
|
||||
CommandDispatcher* __strong _commandDispatcher;
|
||||
@@ -241,6 +252,7 @@ - (instancetype)initWithContentRect:(NSRect)contentRect
|
||||
@@ -241,6 +265,7 @@ - (instancetype)initWithContentRect:(NSRect)contentRect
|
||||
// bubbles and the find bar, but these should not be movable.
|
||||
// Instead, let's push this up to the parent window which should be
|
||||
// the browser.
|
||||
@@ -588,7 +601,7 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
- (void)_zoomToScreenEdge:(NSUInteger)edge {
|
||||
if (self.parentWindow) {
|
||||
[self.parentWindow _zoomToScreenEdge:edge];
|
||||
@@ -248,6 +260,7 @@ - (void)_zoomToScreenEdge:(NSUInteger)edge {
|
||||
@@ -248,6 +273,7 @@ - (void)_zoomToScreenEdge:(NSUInteger)edge {
|
||||
[super _zoomToScreenEdge:edge];
|
||||
}
|
||||
}
|
||||
@@ -596,7 +609,7 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
|
||||
// This override helps diagnose lifetime issues in crash stacktraces by
|
||||
// inserting a symbol on NativeWidgetMacNSWindow and should be kept even if it
|
||||
@@ -393,6 +406,8 @@ - (NSAccessibilityRole)accessibilityRole {
|
||||
@@ -393,6 +419,8 @@ - (NSAccessibilityRole)accessibilityRole {
|
||||
|
||||
// NSWindow overrides.
|
||||
|
||||
@@ -605,7 +618,7 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
+ (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
|
||||
if (windowStyle & NSWindowStyleMaskTitled) {
|
||||
if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class])
|
||||
@@ -404,6 +419,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
|
||||
@@ -404,6 +432,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
|
||||
return [super frameViewClassForStyleMask:windowStyle];
|
||||
}
|
||||
|
||||
@@ -614,7 +627,7 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
- (BOOL)_isTitleHidden {
|
||||
bool shouldShowWindowTitle = YES;
|
||||
if (_bridge)
|
||||
@@ -428,12 +445,14 @@ - (BOOL)_usesCustomDrawing {
|
||||
@@ -428,12 +458,14 @@ - (BOOL)_usesCustomDrawing {
|
||||
// if it were valid to set that style for windows, setting the window style
|
||||
// recalculates and re-caches a bunch of stuff, so a surgical override is the
|
||||
// cleanest approach.
|
||||
@@ -629,7 +642,7 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
|
||||
+ (void)_getExteriorResizeEdgeThicknesses:
|
||||
(NSEdgeAndCornerThicknesses*)outThicknesses
|
||||
@@ -687,9 +706,11 @@ - (id)archiver:(NSKeyedArchiver*)archiver willEncodeObject:(id)object {
|
||||
@@ -687,9 +719,11 @@ - (id)archiver:(NSKeyedArchiver*)archiver willEncodeObject:(id)object {
|
||||
}
|
||||
|
||||
- (void)saveRestorableState {
|
||||
@@ -641,7 +654,7 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
|
||||
// Certain conditions, such as in the Speedometer 3 benchmark, can trigger a
|
||||
// rapid succession of calls to saveRestorableState. If there's no pending
|
||||
@@ -756,6 +777,7 @@ - (void)reallySaveRestorableState {
|
||||
@@ -756,6 +790,7 @@ - (void)reallySaveRestorableState {
|
||||
// affects its restorable state changes.
|
||||
- (void)invalidateRestorableState {
|
||||
[super invalidateRestorableState];
|
||||
@@ -649,7 +662,7 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
if ([self _isConsideredOpenForPersistentState]) {
|
||||
if (_willUpdateRestorableState)
|
||||
return;
|
||||
@@ -768,6 +790,7 @@ - (void)invalidateRestorableState {
|
||||
@@ -768,6 +803,7 @@ - (void)invalidateRestorableState {
|
||||
_willUpdateRestorableState = NO;
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
||||
}
|
||||
@@ -657,7 +670,7 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
}
|
||||
|
||||
// On newer SDKs, _canMiniaturize respects NSWindowStyleMaskMiniaturizable in
|
||||
@@ -932,6 +955,7 @@ - (void)maybeRemoveTreeFromOrderingGroups {
|
||||
@@ -932,6 +968,7 @@ - (void)maybeRemoveTreeFromOrderingGroups {
|
||||
// Since _removeFromGroups: is not documented it could go away in newer
|
||||
// versions of macOS. If the selector does not exist, DumpWithoutCrashing() so
|
||||
// we hear about the change.
|
||||
@@ -665,7 +678,7 @@ index a474e70cf3c10405b6f94f129f5a7312bb81fd73..00f6719bd80c8fdf31f910af3b93b5c6
|
||||
if (![NSWindow instancesRespondToSelector:@selector(_removeFromGroups:)]) {
|
||||
base::debug::DumpWithoutCrashing();
|
||||
return;
|
||||
@@ -949,6 +973,7 @@ - (void)maybeRemoveTreeFromOrderingGroups {
|
||||
@@ -949,6 +986,7 @@ - (void)maybeRemoveTreeFromOrderingGroups {
|
||||
[currentWindow _removeFromGroups:child];
|
||||
}
|
||||
}
|
||||
|
||||
22
patches/chromium/patch_osr_control_screen_info.patch
Normal file
22
patches/chromium/patch_osr_control_screen_info.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: reito <reito@chromium.org>
|
||||
Date: Wed, 29 Oct 2025 00:50:03 +0800
|
||||
Subject: patch: osr control screen info
|
||||
|
||||
We need to override GetNewScreenInfosForUpdate to ensure the screen info
|
||||
is updated correctly, instead of overriding GetScreenInfo which seems not
|
||||
working.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h
|
||||
index 2fc206be84d3d41379bb26540cbf0fa4b1ba95fb..cd85325d60f0c47bbd1e15624e96e62a7f51cd47 100644
|
||||
--- a/content/browser/renderer_host/render_widget_host_view_base.h
|
||||
+++ b/content/browser/renderer_host/render_widget_host_view_base.h
|
||||
@@ -685,7 +685,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
|
||||
|
||||
// Generates the most current set of ScreenInfos from the current set of
|
||||
// displays in the system for use in UpdateScreenInfo.
|
||||
- display::ScreenInfos GetNewScreenInfosForUpdate();
|
||||
+ virtual display::ScreenInfos GetNewScreenInfosForUpdate();
|
||||
|
||||
// Called when display properties that need to be synchronized with the
|
||||
// renderer process changes. This method is called before notifying
|
||||
@@ -6,7 +6,7 @@ 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 cfc9b3157d08d62f43e2e5bb01229fe663f3ca61..cce0e1cdc37aa324aa2c52ba134fc1a9a55b10ba 100644
|
||||
index 2111ee63a6ace438c1a143c90a807ed9fc2bcc9d..ce6426a1bf2dadb1a642874a05718724ef0f3d7c 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -218,8 +218,6 @@ void SetIsolateCreateParamsForNode(Isolate::CreateParams* params) {
|
||||
|
||||
@@ -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 d753ad6c6b49b26b86920124f7ac90c1e052638e..cfc9b3157d08d62f43e2e5bb01229fe663f3ca61 100644
|
||||
index 8974bac7dca43294cc5cc4570f8e2e78f42aefaa..2111ee63a6ace438c1a143c90a807ed9fc2bcc9d 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -668,7 +668,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
|
||||
@@ -795,7 +795,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
|
||||
|
||||
MaybeLocal<Object> GetPerContextExports(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
@@ -18,7 +18,7 @@ index d753ad6c6b49b26b86920124f7ac90c1e052638e..cfc9b3157d08d62f43e2e5bb01229fe6
|
||||
EscapableHandleScope handle_scope(isolate);
|
||||
|
||||
Local<Object> global = context->Global();
|
||||
@@ -714,7 +714,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) {
|
||||
@@ -841,7 +841,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 d753ad6c6b49b26b86920124f7ac90c1e052638e..cfc9b3157d08d62f43e2e5bb01229fe6
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
// When `IsCodeGenerationFromStringsAllowed` is true, V8 takes the fast path
|
||||
@@ -793,7 +793,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
|
||||
@@ -920,7 +920,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
|
||||
}
|
||||
|
||||
Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
|
||||
@@ -36,7 +36,7 @@ index d753ad6c6b49b26b86920124f7ac90c1e052638e..cfc9b3157d08d62f43e2e5bb01229fe6
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
// Delete `Intl.v8BreakIterator`
|
||||
@@ -818,7 +818,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
|
||||
@@ -945,7 +945,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
|
||||
}
|
||||
|
||||
Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
|
||||
@@ -45,7 +45,7 @@ index d753ad6c6b49b26b86920124f7ac90c1e052638e..cfc9b3157d08d62f43e2e5bb01229fe6
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
// Initialize the default values.
|
||||
@@ -836,7 +836,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
|
||||
@@ -963,7 +963,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
|
||||
MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
CHECK(isolate_data);
|
||||
@@ -54,7 +54,7 @@ index d753ad6c6b49b26b86920124f7ac90c1e052638e..cfc9b3157d08d62f43e2e5bb01229fe6
|
||||
EscapableHandleScope scope(isolate);
|
||||
Context::Scope context_scope(context);
|
||||
|
||||
@@ -860,7 +860,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
|
||||
@@ -987,7 +987,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
|
||||
MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
CHECK(isolate_data);
|
||||
@@ -63,7 +63,7 @@ index d753ad6c6b49b26b86920124f7ac90c1e052638e..cfc9b3157d08d62f43e2e5bb01229fe6
|
||||
EscapableHandleScope scope(isolate);
|
||||
Context::Scope context_scope(context);
|
||||
|
||||
@@ -886,7 +886,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
|
||||
@@ -1013,7 +1013,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
|
||||
Maybe<void> InitializePrimordials(Local<Context> context,
|
||||
IsolateData* isolate_data) {
|
||||
// Run per-context JS files.
|
||||
@@ -120,10 +120,10 @@ index 4c5427596d1c90d3a413cdd9ff4f1151e657073d..70135a6be65e41fcb3564ddf6d1e8083
|
||||
NewStringType::kNormal,
|
||||
mem->length)
|
||||
diff --git a/src/encoding_binding.cc b/src/encoding_binding.cc
|
||||
index a913e34c73db3fb62aedcf28bee1bf1c4d59de7a..9de38eb9907269e99fdf0907aa35862572a2c643 100644
|
||||
index 6fe4f0492dc1f3eaf576c8ff7866080a54cb81c1..41e8e052ff81df78ece87163b0499966cc2ed1b9 100644
|
||||
--- a/src/encoding_binding.cc
|
||||
+++ b/src/encoding_binding.cc
|
||||
@@ -75,7 +75,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
@@ -76,7 +76,7 @@ void BindingData::Deserialize(Local<Context> context,
|
||||
int index,
|
||||
InternalFieldInfoBase* info) {
|
||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||
@@ -353,10 +353,10 @@ index 52483740bb377a2bc2a16af701615d9a4e448eae..84d17a46efe146c1794a43963c41a446
|
||||
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 154fb15e6c8fe985e92378cc8471aa6a9d579b07..6252c41a14f4bd092cb424858be58d525b235625 100644
|
||||
index 6e99e8ca1b53cce05615c16c3221ae3a203f50df..72de9923dacd0c25bbf83bc5b22ce243fd3769c2 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -1063,7 +1063,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
||||
@@ -1141,7 +1141,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
||||
|
||||
#define NODE_DEFINE_CONSTANT(target, constant) \
|
||||
do { \
|
||||
@@ -365,7 +365,7 @@ index 154fb15e6c8fe985e92378cc8471aa6a9d579b07..6252c41a14f4bd092cb424858be58d52
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
|
||||
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
|
||||
isolate, #constant, v8::NewStringType::kInternalized); \
|
||||
@@ -1079,7 +1079,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
||||
@@ -1157,7 +1157,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
|
||||
|
||||
#define NODE_DEFINE_HIDDEN_CONSTANT(target, constant) \
|
||||
do { \
|
||||
@@ -375,10 +375,10 @@ index 154fb15e6c8fe985e92378cc8471aa6a9d579b07..6252c41a14f4bd092cb424858be58d52
|
||||
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
|
||||
isolate, #constant, v8::NewStringType::kInternalized); \
|
||||
diff --git a/src/node_blob.cc b/src/node_blob.cc
|
||||
index d278a32c9934c15bc721da164efccca7bc7e7111..ab862bf93a411e6ae6da7c9f9706cee279a0ad70 100644
|
||||
index 4311d71bb0526f9a83a16525243446a590092910..417cd8cbd307b9bfc498ad2df24ed193616ac512 100644
|
||||
--- a/src/node_blob.cc
|
||||
+++ b/src/node_blob.cc
|
||||
@@ -554,7 +554,7 @@ void BlobBindingData::Deserialize(Local<Context> context,
|
||||
@@ -562,7 +562,7 @@ void BlobBindingData::Deserialize(Local<Context> context,
|
||||
int index,
|
||||
InternalFieldInfoBase* info) {
|
||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||
@@ -388,10 +388,10 @@ index d278a32c9934c15bc721da164efccca7bc7e7111..ab862bf93a411e6ae6da7c9f9706cee2
|
||||
BlobBindingData* binding = realm->AddBindingData<BlobBindingData>(holder);
|
||||
CHECK_NOT_NULL(binding);
|
||||
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
|
||||
index 703ac1be06249736073f797058d170576a0db1bf..f0607ec9fd1983386166d0f4782adac99ace943e 100644
|
||||
index 3377d697615ee168e49e83c4202bc227581f1aaf..1a9a57b73e635ac61016598687167a08b073f84a 100644
|
||||
--- a/src/node_builtins.cc
|
||||
+++ b/src/node_builtins.cc
|
||||
@@ -275,7 +275,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal(
|
||||
@@ -260,7 +260,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal(
|
||||
const char* id,
|
||||
LocalVector<String>* parameters,
|
||||
Realm* optional_realm) {
|
||||
@@ -400,7 +400,7 @@ index 703ac1be06249736073f797058d170576a0db1bf..f0607ec9fd1983386166d0f4782adac9
|
||||
EscapableHandleScope scope(isolate);
|
||||
|
||||
Local<String> source;
|
||||
@@ -397,7 +397,7 @@ void BuiltinLoader::SaveCodeCache(const char* id, Local<Function> fun) {
|
||||
@@ -382,7 +382,7 @@ void BuiltinLoader::SaveCodeCache(const char* id, Local<Function> fun) {
|
||||
MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context,
|
||||
const char* id,
|
||||
Realm* optional_realm) {
|
||||
@@ -409,7 +409,7 @@ index 703ac1be06249736073f797058d170576a0db1bf..f0607ec9fd1983386166d0f4782adac9
|
||||
LocalVector<String> parameters(isolate);
|
||||
// Detects parameters of the scripts based on module ids.
|
||||
// internal/bootstrap/realm: process, getLinkedBinding,
|
||||
@@ -451,7 +451,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context,
|
||||
@@ -436,7 +436,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context,
|
||||
MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
|
||||
const char* id,
|
||||
Realm* realm) {
|
||||
@@ -418,7 +418,7 @@ index 703ac1be06249736073f797058d170576a0db1bf..f0607ec9fd1983386166d0f4782adac9
|
||||
// Detects parameters of the scripts based on module ids.
|
||||
// internal/bootstrap/realm: process, getLinkedBinding,
|
||||
// getInternalBinding, primordials
|
||||
@@ -507,7 +507,7 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
|
||||
@@ -492,7 +492,7 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
|
||||
if (!maybe_fn.ToLocal(&fn)) {
|
||||
return MaybeLocal<Value>();
|
||||
}
|
||||
@@ -427,7 +427,7 @@ index 703ac1be06249736073f797058d170576a0db1bf..f0607ec9fd1983386166d0f4782adac9
|
||||
return fn->Call(context, undefined, argc, argv);
|
||||
}
|
||||
|
||||
@@ -545,14 +545,14 @@ bool BuiltinLoader::CompileAllBuiltinsAndCopyCodeCache(
|
||||
@@ -530,14 +530,14 @@ bool BuiltinLoader::CompileAllBuiltinsAndCopyCodeCache(
|
||||
to_eager_compile_.emplace(id);
|
||||
}
|
||||
|
||||
@@ -546,7 +546,7 @@ index ba6ffc2b6565dea500bc8dd4818c8fcb7648694a..e834325a763f7ea8f53210145b5edd13
|
||||
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
||||
BindingData* binding =
|
||||
diff --git a/src/node_messaging.cc b/src/node_messaging.cc
|
||||
index 57e068ae249d618c2658638f9f3b03e1fedb6524..8c51ae4e0a435971c6d0288af87810877dd31a49 100644
|
||||
index 9ff675d23914aaa168de2f82b8509027de477cbf..76c934ccbc98737918c18a28e63df7eb759fed7c 100644
|
||||
--- a/src/node_messaging.cc
|
||||
+++ b/src/node_messaging.cc
|
||||
@@ -254,7 +254,7 @@ namespace {
|
||||
@@ -586,7 +586,7 @@ index 57e068ae249d618c2658638f9f3b03e1fedb6524..8c51ae4e0a435971c6d0288af8781087
|
||||
data_.Reset();
|
||||
return ret;
|
||||
diff --git a/src/node_modules.cc b/src/node_modules.cc
|
||||
index cecdda74847801fd5821bc0afdf0dfc9f131c44a..04ebecc5d924f6c2fddd9992462d1ff692e1cee5 100644
|
||||
index ffc19850ac563082b14729e93d69695ef2c868f5..0cd351e7aff9e293e736e0aca22e67b577eb48eb 100644
|
||||
--- a/src/node_modules.cc
|
||||
+++ b/src/node_modules.cc
|
||||
@@ -70,7 +70,7 @@ void BindingData::Deserialize(v8::Local<v8::Context> context,
|
||||
@@ -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 6bfc54dd81446545ebbb0faedb55a5383b81de49..2e52fb801684feb22800d4809daab006fc7cae9c 100644
|
||||
index 050d779bdcd2b3129abddc3fefa1e852831df236..3f4749286406e03e77de6567b667c0098fbc2a18 100644
|
||||
--- a/src/node_sqlite.cc
|
||||
+++ b/src/node_sqlite.cc
|
||||
@@ -2061,7 +2061,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -2162,7 +2162,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
if (args[0]->IsObject() && !args[0]->IsArrayBufferView()) {
|
||||
Local<Object> obj = args[0].As<Object>();
|
||||
@@ -758,7 +758,7 @@ index 5c7d268d38ff55ce4db07463b1ea0bcb2f4e63ea..bd83654012442195866e57173b6e5d4d
|
||||
|
||||
static void Clear(const FunctionCallbackInfo<Value>& info) {
|
||||
diff --git a/src/node_worker.cc b/src/node_worker.cc
|
||||
index e7d26b4c8cbb08a175084ceac51395860dc60598..fa4ec53ee556a23c8fd018caa1eee51bc5e004fe 100644
|
||||
index 1acc61af0c995ddefbc00fe232b2454de77a84a3..3041746fc8a132f68cc1d801bb1700634699828d 100644
|
||||
--- a/src/node_worker.cc
|
||||
+++ b/src/node_worker.cc
|
||||
@@ -1465,8 +1465,6 @@ void GetEnvMessagePort(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
@@ -11,10 +11,10 @@ really in 20/21. We have to wait until 22 is released to be able to
|
||||
build with upstream GN files.
|
||||
|
||||
diff --git a/configure.py b/configure.py
|
||||
index f31d460038db2fa2fa4c47d62be3100da959978f..209f23b04663113e4f6b3c3242c0544cfed9a950 100755
|
||||
index 98a8b147e4cbfd5957c35688f2b37ae0ca52a818..fd13970ae73bbe5db186f81faed792a5597bbcd0 100755
|
||||
--- a/configure.py
|
||||
+++ b/configure.py
|
||||
@@ -1736,7 +1736,7 @@ def configure_v8(o, configs):
|
||||
@@ -1821,7 +1821,7 @@ def configure_v8(o, configs):
|
||||
# Until we manage to get rid of all those, v8_enable_sandbox cannot be used.
|
||||
# Note that enabling pointer compression without enabling sandbox is unsupported by V8,
|
||||
# so this can be broken at any time.
|
||||
@@ -23,8 +23,54 @@ index f31d460038db2fa2fa4c47d62be3100da959978f..209f23b04663113e4f6b3c3242c0544c
|
||||
# We set v8_enable_pointer_compression_shared_cage to 0 always, even when
|
||||
# pointer compression is enabled so that we don't accidentally enable shared
|
||||
# cage mode when pointer compression is on.
|
||||
diff --git a/deps/merve/BUILD.gn b/deps/merve/BUILD.gn
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7bb318f8835dba6f4a6f211d8534bb6923958747
|
||||
--- /dev/null
|
||||
+++ b/deps/merve/BUILD.gn
|
||||
@@ -0,0 +1,14 @@
|
||||
+##############################################################################
|
||||
+# #
|
||||
+# DO NOT EDIT THIS FILE! #
|
||||
+# #
|
||||
+##############################################################################
|
||||
+
|
||||
+# This file is used by GN for building, which is NOT the build system used for
|
||||
+# building official binaries.
|
||||
+# Please modify the gyp files if you are making changes to build system.
|
||||
+
|
||||
+import("unofficial.gni")
|
||||
+
|
||||
+merve_gn_build("merve") {
|
||||
+}
|
||||
diff --git a/deps/merve/unofficial.gni b/deps/merve/unofficial.gni
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..dfb508d1d22f84accb146620ed07d89715b367e6
|
||||
--- /dev/null
|
||||
+++ b/deps/merve/unofficial.gni
|
||||
@@ -0,0 +1,20 @@
|
||||
+# This file is used by GN for building, which is NOT the build system used for
|
||||
+# building official binaries.
|
||||
+# Please edit the gyp files if you are making changes to build system.
|
||||
+
|
||||
+# The actual configurations are put inside a template in unofficial.gni to
|
||||
+# prevent accidental edits from contributors.
|
||||
+template("merve_gn_build") {
|
||||
+ config("merve_config") {
|
||||
+ include_dirs = [ "." ]
|
||||
+ }
|
||||
+ gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
+ [ rebase_path("merve.gyp") ],
|
||||
+ "scope",
|
||||
+ [ "merve.gyp" ])
|
||||
+ source_set(target_name) {
|
||||
+ forward_variables_from(invoker, "*")
|
||||
+ public_configs = [ ":merve_config" ]
|
||||
+ sources = gypi_values.merve_sources
|
||||
+ }
|
||||
+}
|
||||
diff --git a/node.gni b/node.gni
|
||||
index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea469db7a91b 100644
|
||||
index d4438f7fd61598afac2c1e3184721a759d22b10c..156fee33b3813fe4d94a1c9585f217a99dbfbd5f 100644
|
||||
--- a/node.gni
|
||||
+++ b/node.gni
|
||||
@@ -5,10 +5,10 @@
|
||||
@@ -40,7 +86,16 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea46
|
||||
|
||||
# The location of OpenSSL - use the one from node's deps by default.
|
||||
node_openssl_path = "$node_path/deps/openssl"
|
||||
@@ -50,7 +50,7 @@ declare_args() {
|
||||
@@ -26,8 +26,6 @@ declare_args() {
|
||||
# TODO(zcbenz): This is currently copied from configure.py, we should share
|
||||
# the list between configure.py and GN configurations.
|
||||
node_builtin_shareable_builtins = [
|
||||
- "deps/cjs-module-lexer/lexer.js",
|
||||
- "deps/cjs-module-lexer/dist/lexer.js",
|
||||
"deps/undici/undici.js",
|
||||
"deps/amaro/dist/index.js",
|
||||
]
|
||||
@@ -50,7 +48,7 @@ declare_args() {
|
||||
node_openssl_system_ca_path = ""
|
||||
|
||||
# Initialize v8 platform during node.js startup.
|
||||
@@ -49,7 +104,7 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea46
|
||||
|
||||
# Custom build tag.
|
||||
node_tag = ""
|
||||
@@ -70,10 +70,16 @@ declare_args() {
|
||||
@@ -70,10 +68,16 @@ declare_args() {
|
||||
# TODO(zcbenz): There are few broken things for now:
|
||||
# 1. cross-os compilation is not supported.
|
||||
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
|
||||
@@ -68,10 +123,10 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea46
|
||||
|
||||
assert(!node_enable_inspector || node_use_openssl,
|
||||
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
|
||||
index 7b34b14856a5193c723987f69d6040bdb6aa7c34..90fdf52d79954bf2cd86fd1d2d6da8199683d344 100644
|
||||
index f25ca01d6ef016489371a3a1c9d8500da65e8023..2c816bef8d64f3e0ba2993c4885641620ee64272 100644
|
||||
--- a/src/node_builtins.cc
|
||||
+++ b/src/node_builtins.cc
|
||||
@@ -775,6 +775,7 @@ void BuiltinLoader::RegisterExternalReferences(
|
||||
@@ -760,6 +760,7 @@ void BuiltinLoader::RegisterExternalReferences(
|
||||
registry->Register(GetNatives);
|
||||
|
||||
RegisterExternalReferencesForInternalizedBuiltinCode(registry);
|
||||
@@ -251,10 +306,10 @@ index 856878c33681a73d41016729dabe48b0a6a80589..91a11852d206b65485fe90fd037a0bd1
|
||||
if sys.platform == 'win32':
|
||||
files = [ x.replace('\\', '/') for x in files ]
|
||||
diff --git a/unofficial.gni b/unofficial.gni
|
||||
index c742b62c484e9dd205eff63dcffad78c76828375..20d2483bb16e297ab5b12aab6f56948d6d25cb03 100644
|
||||
index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e352859909695 100644
|
||||
--- a/unofficial.gni
|
||||
+++ b/unofficial.gni
|
||||
@@ -147,31 +147,41 @@ template("node_gn_build") {
|
||||
@@ -147,31 +147,42 @@ template("node_gn_build") {
|
||||
public_configs = [
|
||||
":node_external_config",
|
||||
"deps/googletest:googletest_config",
|
||||
@@ -273,6 +328,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..20d2483bb16e297ab5b12aab6f56948d
|
||||
"deps/cares",
|
||||
"deps/histogram",
|
||||
"deps/llhttp",
|
||||
+ "deps/merve",
|
||||
"deps/nbytes",
|
||||
"deps/nghttp2",
|
||||
- "deps/ngtcp2",
|
||||
@@ -299,7 +355,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..20d2483bb16e297ab5b12aab6f56948d
|
||||
"$target_gen_dir/node_javascript.cc",
|
||||
] + gypi_values.node_sources
|
||||
|
||||
@@ -194,7 +204,7 @@ template("node_gn_build") {
|
||||
@@ -194,7 +205,7 @@ template("node_gn_build") {
|
||||
}
|
||||
if (node_use_openssl) {
|
||||
deps += [ "deps/ncrypto" ]
|
||||
@@ -308,7 +364,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..20d2483bb16e297ab5b12aab6f56948d
|
||||
sources += gypi_values.node_crypto_sources
|
||||
}
|
||||
if (node_use_sqlite) {
|
||||
@@ -223,6 +233,10 @@ template("node_gn_build") {
|
||||
@@ -223,6 +234,10 @@ template("node_gn_build") {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,7 +375,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..20d2483bb16e297ab5b12aab6f56948d
|
||||
executable(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
|
||||
@@ -314,6 +328,7 @@ template("node_gn_build") {
|
||||
@@ -314,6 +329,7 @@ template("node_gn_build") {
|
||||
}
|
||||
|
||||
executable("node_js2c") {
|
||||
@@ -327,7 +383,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..20d2483bb16e297ab5b12aab6f56948d
|
||||
deps = [
|
||||
"deps/uv",
|
||||
"$node_simdutf_path",
|
||||
@@ -324,26 +339,75 @@ template("node_gn_build") {
|
||||
@@ -324,26 +340,75 @@ template("node_gn_build") {
|
||||
"src/embedded_data.cc",
|
||||
"src/embedded_data.h",
|
||||
]
|
||||
@@ -413,7 +469,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..20d2483bb16e297ab5b12aab6f56948d
|
||||
outputs = [ "$target_gen_dir/node_javascript.cc" ]
|
||||
|
||||
# Get the path to node_js2c executable of the host toolchain.
|
||||
@@ -357,11 +421,11 @@ template("node_gn_build") {
|
||||
@@ -357,11 +422,11 @@ template("node_gn_build") {
|
||||
get_label_info(":node_js2c($host_toolchain)", "name") +
|
||||
host_executable_suffix
|
||||
|
||||
|
||||
@@ -14,18 +14,10 @@ We don't need to do this for zlib, as the existing gn workflow uses the same
|
||||
Upstreamed at https://github.com/nodejs/node/pull/55903
|
||||
|
||||
diff --git a/unofficial.gni b/unofficial.gni
|
||||
index 20d2483bb16e297ab5b12aab6f56948d6d25cb03..253226009faf563f6db285d4b2908f308c1f96ea 100644
|
||||
index bff7b0650cfe8578a044e45d0f9e352859909695..4ab316e45bd84e43a53335df60f847b17fe6c2fa 100644
|
||||
--- a/unofficial.gni
|
||||
+++ b/unofficial.gni
|
||||
@@ -160,7 +160,6 @@ template("node_gn_build") {
|
||||
":run_node_js2c",
|
||||
"deps/cares",
|
||||
"deps/histogram",
|
||||
- "deps/llhttp",
|
||||
"deps/nbytes",
|
||||
"deps/nghttp2",
|
||||
"deps/postject",
|
||||
@@ -198,7 +197,17 @@ template("node_gn_build") {
|
||||
@@ -199,7 +199,17 @@ template("node_gn_build") {
|
||||
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
|
||||
configs += [ "//build/config/gcc:symbol_visibility_default" ]
|
||||
}
|
||||
@@ -44,7 +36,7 @@ index 20d2483bb16e297ab5b12aab6f56948d6d25cb03..253226009faf563f6db285d4b2908f30
|
||||
if (v8_enable_i18n_support) {
|
||||
deps += [ "//third_party/icu" ]
|
||||
}
|
||||
@@ -231,6 +240,19 @@ template("node_gn_build") {
|
||||
@@ -232,6 +242,19 @@ template("node_gn_build") {
|
||||
sources += node_inspector.node_inspector_sources +
|
||||
node_inspector.node_inspector_generated_sources
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ index 8d7204f6cb48f783adc4d1c1eb2de0c83b7fffe2..a154559a56bf383d3c26af523c9bb07b
|
||||
|
||||
// Non-alphabetic chars.
|
||||
diff --git a/lib/internal/http.js b/lib/internal/http.js
|
||||
index e664663348adc7bb31f7c9ec78481bbeb71401d9..62b659beb766b8256b214447af376f438278b058 100644
|
||||
index f8b4fd7c4ca5a0907806c7e804de8c951675a36a..209e3bcf8be5a23ac528dcd673bed82cbad709ca 100644
|
||||
--- a/lib/internal/http.js
|
||||
+++ b/lib/internal/http.js
|
||||
@@ -11,8 +11,8 @@ const {
|
||||
@@ -64,10 +64,10 @@ index e664663348adc7bb31f7c9ec78481bbeb71401d9..62b659beb766b8256b214447af376f43
|
||||
|
||||
function ipToInt(ip) {
|
||||
diff --git a/node.gyp b/node.gyp
|
||||
index c035d1d7cdac1d18cca0ef5cefbc5ce4c1fd1b86..a48e4e5d1fb7621b12b9abeaaf78214515a23efc 100644
|
||||
index f5cd416b5fe7a51084bc4af9a4427a8e62599fd8..5eb70ce3820f2b82121bc102c5182ab768cbef36 100644
|
||||
--- a/node.gyp
|
||||
+++ b/node.gyp
|
||||
@@ -176,7 +176,6 @@
|
||||
@@ -182,7 +182,6 @@
|
||||
'src/timers.cc',
|
||||
'src/timer_wrap.cc',
|
||||
'src/tracing/agent.cc',
|
||||
@@ -75,7 +75,7 @@ index c035d1d7cdac1d18cca0ef5cefbc5ce4c1fd1b86..a48e4e5d1fb7621b12b9abeaaf782145
|
||||
'src/tracing/node_trace_writer.cc',
|
||||
'src/tracing/trace_event.cc',
|
||||
'src/tracing/traced_value.cc',
|
||||
@@ -308,7 +307,6 @@
|
||||
@@ -314,7 +313,6 @@
|
||||
'src/tcp_wrap.h',
|
||||
'src/timers.h',
|
||||
'src/tracing/agent.h',
|
||||
|
||||
@@ -7,7 +7,7 @@ Subject: build: ensure native module compilation fails if not using a new
|
||||
This should not be upstreamed, it is a quality-of-life patch for downstream module builders.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index cf3ceaf19972ee107deff63b4dba16c12191c615..6159350823fd9f0090e2b98e8797e829fd481750 100644
|
||||
index b3b5c23e471ece7584d209b3ae4197c46011d50e..bdcea65ad3e0315c85b1818e695d8b63093aed34 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -89,6 +89,8 @@
|
||||
@@ -42,10 +42,10 @@ index cf3ceaf19972ee107deff63b4dba16c12191c615..6159350823fd9f0090e2b98e8797e829
|
||||
# list in v8/BUILD.gn.
|
||||
['v8_enable_v8_checks == 1', {
|
||||
diff --git a/configure.py b/configure.py
|
||||
index 209f23b04663113e4f6b3c3242c0544cfed9a950..88164b99ae3d37f47e5e9a9ba96d7b450d6ba4ab 100755
|
||||
index fd13970ae73bbe5db186f81faed792a5597bbcd0..162e3b09c92b49cd39d32a87ff97a54555d3e47b 100755
|
||||
--- a/configure.py
|
||||
+++ b/configure.py
|
||||
@@ -1717,6 +1717,7 @@ def configure_library(lib, output, pkgname=None):
|
||||
@@ -1802,6 +1802,7 @@ def configure_library(lib, output, pkgname=None):
|
||||
def configure_v8(o, configs):
|
||||
set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0)
|
||||
|
||||
@@ -54,7 +54,7 @@ index 209f23b04663113e4f6b3c3242c0544cfed9a950..88164b99ae3d37f47e5e9a9ba96d7b45
|
||||
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 be22ad370217a13aef2479d478a6373feaf6f208..19c34a430d095c06ccf5a988db91311d420a485a 100644
|
||||
index ebfd7229b5f0044b628fbe0b03ac211f0c6ed9a6..b92a9d42da8419741c435643b7401efcb21a9e8b 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -22,6 +22,12 @@
|
||||
|
||||
@@ -10,10 +10,10 @@ JS errors and ensures embedder JS is loaded via LoadEmbedderJavaScriptSource.
|
||||
That method is generated by our modifications to js2c.cc in the BUILD.gn patch
|
||||
|
||||
diff --git a/lib/internal/fs/watchers.js b/lib/internal/fs/watchers.js
|
||||
index 605dee28cace56f2366fec9d7f18894559044ae4..15dcabb3b1682438eb6d5a681363b7ea8602b9e7 100644
|
||||
index a493c9579669072d97c7caa9049e846bda36f8b9..334ffaa6f2d955125ca8b427ace1442c94011e18 100644
|
||||
--- a/lib/internal/fs/watchers.js
|
||||
+++ b/lib/internal/fs/watchers.js
|
||||
@@ -299,12 +299,13 @@ function emitCloseNT(self) {
|
||||
@@ -361,12 +361,13 @@ function emitCloseNT(self) {
|
||||
}
|
||||
|
||||
// Legacy alias on the C++ wrapper object. This is not public API, so we may
|
||||
@@ -34,7 +34,7 @@ index 605dee28cace56f2366fec9d7f18894559044ae4..15dcabb3b1682438eb6d5a681363b7ea
|
||||
let kResistStopPropagation;
|
||||
|
||||
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
|
||||
index 90fdf52d79954bf2cd86fd1d2d6da8199683d344..703ac1be06249736073f797058d170576a0db1bf 100644
|
||||
index 2c816bef8d64f3e0ba2993c4885641620ee64272..3377d697615ee168e49e83c4202bc227581f1aaf 100644
|
||||
--- a/src/node_builtins.cc
|
||||
+++ b/src/node_builtins.cc
|
||||
@@ -39,6 +39,7 @@ using v8::Value;
|
||||
@@ -42,9 +42,9 @@ index 90fdf52d79954bf2cd86fd1d2d6da8199683d344..703ac1be06249736073f797058d17057
|
||||
: config_(GetConfig()), code_cache_(std::make_shared<BuiltinCodeCache>()) {
|
||||
LoadJavaScriptSource();
|
||||
+ LoadEmbedderJavaScriptSource();
|
||||
#ifdef NODE_SHARED_BUILTIN_CJS_MODULE_LEXER_LEXER_PATH
|
||||
AddExternalizedBuiltin(
|
||||
"internal/deps/cjs-module-lexer/lexer",
|
||||
#ifdef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH
|
||||
AddExternalizedBuiltin("internal/deps/undici/undici",
|
||||
STRINGIFY(NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH));
|
||||
diff --git a/src/node_builtins.h b/src/node_builtins.h
|
||||
index bcdd50f635757f41287c87df1db9cd3b55c4b6b9..e908f3c0e314b90ff7b6c599940ea8f4e657c709 100644
|
||||
--- a/src/node_builtins.h
|
||||
|
||||
@@ -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 6159350823fd9f0090e2b98e8797e829fd481750..5f47ec9bb405f6c1574304ac68807929604cd402 100644
|
||||
index bdcea65ad3e0315c85b1818e695d8b63093aed34..0653735a0b154e326e5df7049a7beb395f0015c8 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -128,6 +128,7 @@
|
||||
|
||||
@@ -10,7 +10,7 @@ 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 5f47ec9bb405f6c1574304ac68807929604cd402..914f28b41d05b1485874885570ae5adaabd8e1b2 100644
|
||||
index 0653735a0b154e326e5df7049a7beb395f0015c8..006f52ed18d955da0d9a06e881e86e6e724095ac 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -677,7 +677,7 @@
|
||||
|
||||
@@ -20,7 +20,7 @@ index ab7dc27de3e304f6d912d5834da47e3b4eb25495..b6c0fd4ceee989dac55c7d54e52fef18
|
||||
}
|
||||
}
|
||||
diff --git a/unofficial.gni b/unofficial.gni
|
||||
index 253226009faf563f6db285d4b2908f308c1f96ea..dd686d2f7c8d2f6e8d6bd13a7bf2b4b140556ba9 100644
|
||||
index 4ab316e45bd84e43a53335df60f847b17fe6c2fa..def9a302830e493e51cc2b3588816fcbd3a1bb51 100644
|
||||
--- a/unofficial.gni
|
||||
+++ b/unofficial.gni
|
||||
@@ -143,7 +143,10 @@ template("node_gn_build") {
|
||||
@@ -35,7 +35,7 @@ index 253226009faf563f6db285d4b2908f308c1f96ea..dd686d2f7c8d2f6e8d6bd13a7bf2b4b1
|
||||
public_configs = [
|
||||
":node_external_config",
|
||||
"deps/googletest:googletest_config",
|
||||
@@ -362,6 +365,7 @@ template("node_gn_build") {
|
||||
@@ -364,6 +367,7 @@ template("node_gn_build") {
|
||||
"src/embedded_data.h",
|
||||
]
|
||||
include_dirs = [ "src", "tools" ]
|
||||
|
||||
@@ -9,10 +9,10 @@ modules to sandboxed renderers.
|
||||
TODO(codebytere): remove and replace with a public facing API.
|
||||
|
||||
diff --git a/src/node_binding.cc b/src/node_binding.cc
|
||||
index 3b284583d6ccc9b2d0273d678335b9ab0a6fa81c..fbbdc26b8d1428084709ab113f102c42424842b0 100644
|
||||
index 740706e917b7d28c520abdbd743605bf73274f30..9ab30b3c9bc663d2947fcbfaac6f06d2c8f8a5b1 100644
|
||||
--- a/src/node_binding.cc
|
||||
+++ b/src/node_binding.cc
|
||||
@@ -655,6 +655,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -656,6 +656,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
|
||||
args.GetReturnValue().Set(exports);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ Stage 3.
|
||||
Upstreamed in https://github.com/nodejs/node/pull/60364
|
||||
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index ae082f2d0498e0e694e427da71078ca19086e275..f9630a5cd9bed1535a7839517313a2d47d403b1f 100644
|
||||
index b9d35e60f39d1edd910cd0fc1e57157458db93f5..4421ddd05f69e32f38d074a4cc04e4e7eac89e76 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -782,7 +782,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
|
||||
@@ -778,7 +778,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
|
||||
|
||||
if (std::ranges::find(v8_args, "--no-js-source-phase-imports") ==
|
||||
v8_args.end()) {
|
||||
|
||||
@@ -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 5adfd888711ae46a3ba157853359145c4409169b..cf3ceaf19972ee107deff63b4dba16c12191c615 100644
|
||||
index c5a7dc9cacf8b983984e7c7de9e63d26e418cc8d..b3b5c23e471ece7584d209b3ae4197c46011d50e 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 d94226df8d90d791c3c5fdb7cab7357b0e2555b0..7512ec43ea10d9b0e167125040bc8136f7ad568a 100644
|
||||
index f05686608297e538f0a6f65abb389281bced4291..c8da076f80a559b9ee6d2ffed831b088c15c8e88 100644
|
||||
--- a/doc/api/cli.md
|
||||
+++ b/doc/api/cli.md
|
||||
@@ -1814,6 +1814,14 @@ changes:
|
||||
@@ -1820,6 +1820,14 @@ changes:
|
||||
|
||||
Disable using [syntax detection][] to determine module type.
|
||||
|
||||
@@ -27,7 +27,7 @@ index d94226df8d90d791c3c5fdb7cab7357b0e2555b0..7512ec43ea10d9b0e167125040bc8136
|
||||
### `--no-experimental-global-navigator`
|
||||
|
||||
<!-- YAML
|
||||
@@ -3493,6 +3501,7 @@ one is included in the list below.
|
||||
@@ -3499,6 +3507,7 @@ one is included in the list below.
|
||||
* `--no-addons`
|
||||
* `--no-async-context-frame`
|
||||
* `--no-deprecation`
|
||||
@@ -96,7 +96,7 @@ index f6f81f50c8bd91a72ca96093dc64c183bd58039b..aa18dab6e4171d8a7f0af4b7db1b8c2c
|
||||
"experimental WebSocket API",
|
||||
&EnvironmentOptions::experimental_websocket,
|
||||
diff --git a/test/parallel/test-process-env-allowed-flags-are-documented.js b/test/parallel/test-process-env-allowed-flags-are-documented.js
|
||||
index f09bf0940dad2068f0aa5dce783dd422773d4bbb..ccf4ffcacf9bd9965978738656b8fe091fee4d6a 100644
|
||||
index d62a2583523c6b3c1de394a18e8060199e446bf1..7d6c6ea7949fd6b52bb54c31a2d71257349e64a9 100644
|
||||
--- a/test/parallel/test-process-env-allowed-flags-are-documented.js
|
||||
+++ b/test/parallel/test-process-env-allowed-flags-are-documented.js
|
||||
@@ -122,7 +122,6 @@ const undocumented = difference(process.allowedNodeEnvironmentFlags,
|
||||
|
||||
@@ -11,7 +11,7 @@ We can fix this by allowing the C++ implementation of legacyMainResolve to use
|
||||
a fileExists function that does take Asar into account.
|
||||
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index 8dc8bbfe8d73e2d11edc261d6fe9f37aaa81e4cd..9c965f21918b8170ca2c2d6efee067b52537698e 100644
|
||||
index 81799fc159cf20344aac64cd7129240deb9a4fe8..12b476ff97603718186dd25b1f435d377841bd89 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
+++ b/lib/internal/modules/esm/resolve.js
|
||||
@@ -28,14 +28,13 @@ const { BuiltinModule } = require('internal/bootstrap/realm');
|
||||
|
||||
@@ -12,10 +12,10 @@ This can be removed/refactored once Node.js upgrades to a version of V8
|
||||
containing the above CL.
|
||||
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index 8791119956ff93d65163d2ef424a8d821ebbdfad..ae082f2d0498e0e694e427da71078ca19086e275 100644
|
||||
index 0bc086ccd1ff449c0f3fb08a972a0c45d3178f1c..b9d35e60f39d1edd910cd0fc1e57157458db93f5 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -1248,7 +1248,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
|
||||
@@ -1244,7 +1244,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
|
||||
result->platform_ = per_process::v8_platform.Platform();
|
||||
}
|
||||
|
||||
|
||||
@@ -388,7 +388,7 @@ 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 c8fc4abbb108a6d6849e8452d97d29187da2ebe6..825ba4c8dce775f401080a0522565bb7a087bcc3 100644
|
||||
index a5937a09cb1535778a6345885a69ca9bcecf3e96..336313d30b3329b73c04f2f6d6a5e02375a11a72 100644
|
||||
--- a/test/parallel/test-x509-escaping.js
|
||||
+++ b/test/parallel/test-x509-escaping.js
|
||||
@@ -438,7 +438,7 @@ const { hasOpenSSL3 } = require('../common/crypto');
|
||||
|
||||
@@ -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 e4d5579565eea07013c8260fa3c4aa3b266a4b35..fbcef937b26023e0f6f97a0e58ac7350e7616f58 100644
|
||||
index a6fbcb6fd3c2413df96273d93b7339cad3f25f7a..130fe48b233691d8ee4c5d56f80d331924619008 100644
|
||||
--- a/lib/internal/modules/esm/translators.js
|
||||
+++ b/lib/internal/modules/esm/translators.js
|
||||
@@ -407,6 +407,10 @@ function cjsPreparseModuleExports(filename, source, format) {
|
||||
@@ -392,6 +392,10 @@ function cjsPreparseModuleExports(filename, source, format) {
|
||||
return { module, exportNames: module[kModuleExportNames] };
|
||||
}
|
||||
|
||||
|
||||
@@ -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 04ebecc5d924f6c2fddd9992462d1ff692e1cee5..5d9a9da3a068a68c13c5c0cacfe07eec3dad8bc3 100644
|
||||
index 0cd351e7aff9e293e736e0aca22e67b577eb48eb..b925434940baeeb6b06882242ca947736866d175 100644
|
||||
--- a/src/node_modules.cc
|
||||
+++ b/src/node_modules.cc
|
||||
@@ -345,8 +345,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 bb874fec74c73b5de0ef6d1e2a872ebceefb11ce..6fafe2a8029c535fa98276e2d73f04ee603a7805 100644
|
||||
index 454750db0113d289e7f8c8cb160e91797790572c..09786f710a88e0243bfaab10d0eca5cb2db62245 100644
|
||||
--- a/src/env_properties.h
|
||||
+++ b/src/env_properties.h
|
||||
@@ -491,6 +491,7 @@
|
||||
@@ -492,6 +492,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 bb874fec74c73b5de0ef6d1e2a872ebceefb11ce..6fafe2a8029c535fa98276e2d73f04ee
|
||||
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 95a7b8c32693c32ca9f57e01aff9ef06b84f78b2..cecdda74847801fd5821bc0afdf0dfc9f131c44a 100644
|
||||
index 3e4918a35e0d2f100f14596a3857f927b2a38c8f..ffc19850ac563082b14729e93d69695ef2c868f5 100644
|
||||
--- a/src/node_modules.cc
|
||||
+++ b/src/node_modules.cc
|
||||
@@ -23,12 +23,14 @@ namespace modules {
|
||||
@@ -118,7 +118,7 @@ index 95a7b8c32693c32ca9f57e01aff9ef06b84f78b2..cecdda74847801fd5821bc0afdf0dfc9
|
||||
SetMethod(isolate, target, "readPackageJSON", ReadPackageJSON);
|
||||
SetMethod(isolate,
|
||||
target,
|
||||
@@ -735,6 +786,8 @@ void BindingData::CreatePerContextProperties(Local<Object> target,
|
||||
@@ -751,6 +802,8 @@ void BindingData::CreatePerContextProperties(Local<Object> target,
|
||||
|
||||
void BindingData::RegisterExternalReferences(
|
||||
ExternalReferenceRegistry* registry) {
|
||||
|
||||
@@ -77,10 +77,10 @@ index 22c1e9f1ae652b033903f56f394352806ddff754..961da666a233541203b5416909fd1ff0
|
||||
if (cjsModule?.[kIsExecuting]) {
|
||||
const parentFilename = urlToFilename(parentURL);
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index c1d774b9c5c4049f7ecda4e3a1faaa59dad01764..4fd58b1cea557ec122bd860e1ebc15bd04c44f78 100644
|
||||
index cc1230648881d8d14ba3902fca78291c90fb79fb..edf347102fedbb28bce221defa99c37b5834024b 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
+++ b/lib/internal/modules/esm/resolve.js
|
||||
@@ -752,6 +752,9 @@ function packageImportsResolve(name, base, conditions) {
|
||||
@@ -751,6 +751,9 @@ function packageImportsResolve(name, base, conditions) {
|
||||
throw importNotDefined(name, packageJSONUrl, base);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ index c1d774b9c5c4049f7ecda4e3a1faaa59dad01764..4fd58b1cea557ec122bd860e1ebc15bd
|
||||
|
||||
/**
|
||||
* Resolves a package specifier to a URL.
|
||||
@@ -766,6 +769,11 @@ function packageResolve(specifier, base, conditions) {
|
||||
@@ -765,6 +768,11 @@ function packageResolve(specifier, base, conditions) {
|
||||
return new URL('node:' + specifier);
|
||||
}
|
||||
|
||||
@@ -103,10 +103,10 @@ index c1d774b9c5c4049f7ecda4e3a1faaa59dad01764..4fd58b1cea557ec122bd860e1ebc15bd
|
||||
|
||||
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 1716328c7a98996a8933dbaa00a1c6c3156fb2ff..30f887663bbbd9913eff35f0e6e5b8291adda120 100644
|
||||
index d6c96996a900da8e7d4f7f5104312e73e72c2d62..ec76d7ffa45f49721d395e8e33be79114daa0369 100644
|
||||
--- a/lib/internal/modules/esm/translators.js
|
||||
+++ b/lib/internal/modules/esm/translators.js
|
||||
@@ -223,7 +223,9 @@ function createCJSModuleWrap(url, translateContext, parentURL, loadCJS = loadCJS
|
||||
@@ -214,7 +214,9 @@ function createCJSModuleWrap(url, translateContext, parentURL, loadCJS = loadCJS
|
||||
const { exportNames, module } = cjsPreparseModuleExports(filename, source, sourceFormat);
|
||||
cjsCache.set(url, module);
|
||||
|
||||
@@ -117,7 +117,7 @@ index 1716328c7a98996a8933dbaa00a1c6c3156fb2ff..30f887663bbbd9913eff35f0e6e5b829
|
||||
if (!exportNames.has('default')) {
|
||||
ArrayPrototypePush(wrapperNames, 'default');
|
||||
}
|
||||
@@ -325,6 +327,10 @@ translators.set('require-commonjs', (url, translateContext, parentURL) => {
|
||||
@@ -313,6 +315,10 @@ translators.set('require-commonjs', (url, translateContext, parentURL) => {
|
||||
return createCJSModuleWrap(url, translateContext, parentURL);
|
||||
});
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ index 175ec8ba0f2a908ffad2ce48434aeed573b09c90..3218590ddce1e92c2a9d776f20f9fb01
|
||||
Cipher() = default;
|
||||
Cipher(const EVP_CIPHER* cipher) : cipher_(cipher) {}
|
||||
diff --git a/node.gni b/node.gni
|
||||
index e2407027ab05e59b2f0f1c213b98ea469db7a91b..c64761b730e61edcdc0e46a48699f2fd5bb1c0a6 100644
|
||||
index 156fee33b3813fe4d94a1c9585f217a99dbfbd5f..8239967653fee7791800ee3292e77b91bffaaef9 100644
|
||||
--- a/node.gni
|
||||
+++ b/node.gni
|
||||
@@ -11,7 +11,7 @@ declare_args() {
|
||||
@@ -298,7 +298,7 @@ index 3ab33341806ad6c0b06b982a30a57b7b5399e38f..754ddf7b331465c56081db05d6fd2a45
|
||||
// We declare another alias here to avoid having to include crypto_util.h
|
||||
using EVPMDPointer = DeleteFnPtr<EVP_MD, EVP_MD_free>;
|
||||
diff --git a/src/node_metadata.h b/src/node_metadata.h
|
||||
index d9c533f100d25aeab1fe8589932a8ddead431258..2acab8786a8a752b17961445edeb872c2b08fdeb 100644
|
||||
index 7f6268a1d83d3182b318bc95fd2ee119a2df8dea..f2ee335aa98a2465f63dafa33664197acc6f79b1 100644
|
||||
--- a/src/node_metadata.h
|
||||
+++ b/src/node_metadata.h
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
@@ -28,7 +28,7 @@ index 5f1921d15bc1d3a68c35990f85e36a0e8a5b3ec4..99c6ce57c04768d125dd0a1c6bd62bca
|
||||
const result = dataURLProcessor(url);
|
||||
if (result === 'failure') {
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index 4fd58b1cea557ec122bd860e1ebc15bd04c44f78..8dc8bbfe8d73e2d11edc261d6fe9f37aaa81e4cd 100644
|
||||
index edf347102fedbb28bce221defa99c37b5834024b..81799fc159cf20344aac64cd7129240deb9a4fe8 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
+++ b/lib/internal/modules/esm/resolve.js
|
||||
@@ -25,7 +25,7 @@ const {
|
||||
@@ -50,10 +50,10 @@ index 4fd58b1cea557ec122bd860e1ebc15bd04c44f78..8dc8bbfe8d73e2d11edc261d6fe9f37a
|
||||
});
|
||||
const { search, hash } = resolved;
|
||||
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
|
||||
index 30f887663bbbd9913eff35f0e6e5b8291adda120..e4d5579565eea07013c8260fa3c4aa3b266a4b35 100644
|
||||
index ec76d7ffa45f49721d395e8e33be79114daa0369..a6fbcb6fd3c2413df96273d93b7339cad3f25f7a 100644
|
||||
--- a/lib/internal/modules/esm/translators.js
|
||||
+++ b/lib/internal/modules/esm/translators.js
|
||||
@@ -24,7 +24,7 @@ const {
|
||||
@@ -23,7 +23,7 @@ const {
|
||||
|
||||
const { BuiltinModule } = require('internal/bootstrap/realm');
|
||||
const assert = require('internal/assert');
|
||||
@@ -62,7 +62,7 @@ index 30f887663bbbd9913eff35f0e6e5b8291adda120..e4d5579565eea07013c8260fa3c4aa3b
|
||||
const { dirname, extname } = require('path');
|
||||
const {
|
||||
assertBufferSource,
|
||||
@@ -365,7 +365,7 @@ translators.set('commonjs', function commonjsStrategy(url, translateContext, par
|
||||
@@ -350,7 +350,7 @@ translators.set('commonjs', function commonjsStrategy(url, translateContext, par
|
||||
|
||||
try {
|
||||
// We still need to read the FS to detect the exports.
|
||||
|
||||
@@ -10,10 +10,10 @@ change, it seems to introduce an incompatibility when compiling
|
||||
using clang modules. Disabling them resolves the issue.
|
||||
|
||||
diff --git a/unofficial.gni b/unofficial.gni
|
||||
index dd686d2f7c8d2f6e8d6bd13a7bf2b4b140556ba9..97e4bcfaa8aa42a5fc2b68ccdd8128eac8886532 100644
|
||||
index def9a302830e493e51cc2b3588816fcbd3a1bb51..900c5e4d8a48d0725420518c923c7024518158b8 100644
|
||||
--- a/unofficial.gni
|
||||
+++ b/unofficial.gni
|
||||
@@ -195,6 +195,10 @@ template("node_gn_build") {
|
||||
@@ -197,6 +197,10 @@ template("node_gn_build") {
|
||||
"CoreFoundation.framework",
|
||||
"Security.framework",
|
||||
]
|
||||
@@ -24,7 +24,7 @@ index dd686d2f7c8d2f6e8d6bd13a7bf2b4b140556ba9..97e4bcfaa8aa42a5fc2b68ccdd8128ea
|
||||
}
|
||||
if (is_posix) {
|
||||
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
|
||||
@@ -367,6 +371,12 @@ template("node_gn_build") {
|
||||
@@ -369,6 +373,12 @@ template("node_gn_build") {
|
||||
include_dirs = [ "src", "tools" ]
|
||||
configs += [ "//build/config/compiler:no_exit_time_destructors" ]
|
||||
|
||||
|
||||
@@ -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 2b199e82fee3a9d56521b9c5cc04a20cdfd6f045..e28755a20176c2806769430910b28a0e61d7691e 100644
|
||||
index 0a6788d1b848d860fa3fa3e857c7feab6f16311e..a6b01d7e143fa6ffeda6fa7723e279db7678ddd4 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -209,6 +209,13 @@ const {
|
||||
@@ -23,7 +23,7 @@ index 2b199e82fee3a9d56521b9c5cc04a20cdfd6f045..e28755a20176c2806769430910b28a0e
|
||||
const {
|
||||
isProxy,
|
||||
} = require('internal/util/types');
|
||||
@@ -1799,10 +1806,12 @@ Module.prototype._compile = function(content, filename, format) {
|
||||
@@ -1807,9 +1814,12 @@ Module.prototype._compile = function(content, filename, format) {
|
||||
if (this[kIsMainSymbol] && getOptionValue('--inspect-brk')) {
|
||||
const { callAndPauseOnStart } = internalBinding('inspector');
|
||||
result = callAndPauseOnStart(compiledWrapper, thisValue, exports,
|
||||
@@ -31,10 +31,10 @@ index 2b199e82fee3a9d56521b9c5cc04a20cdfd6f045..e28755a20176c2806769430910b28a0e
|
||||
+ require, module, filename, dirname,
|
||||
+ process, localGlobal, localBuffer);
|
||||
} else {
|
||||
result = ReflectApply(compiledWrapper, thisValue,
|
||||
- [exports, require, module, filename, dirname]);
|
||||
+ [exports, require, module, filename, dirname,
|
||||
+ process, localGlobal, localBuffer]);
|
||||
- result = FunctionPrototypeCall(compiledWrapper, thisValue, exports, require, module, filename, dirname);
|
||||
+ result = FunctionPrototypeCall(compiledWrapper, thisValue, exports,
|
||||
+ require, module, filename, dirname,
|
||||
+ process, localGlobal, localBuffer);
|
||||
}
|
||||
this[kIsExecuting] = false;
|
||||
if (requireDepth === 0) { statCache = null; }
|
||||
|
||||
@@ -18,7 +18,7 @@ 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 53f05293bd94e159dfedf48735989e668acdd08e..d753ad6c6b49b26b86920124f7ac90c1e052638e 100644
|
||||
index 5f51ad205189bd75d0d9638b1104c12b537b4e9b..8974bac7dca43294cc5cc4570f8e2e78f42aefaa 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -323,6 +323,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
|
||||
@@ -102,7 +102,7 @@ index fdabe48dd7776c59298f7d972286d0d2ed062752..b5cf58cc953590493beb52abf249e33e
|
||||
isolate, object, wrappable);
|
||||
}
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 19c34a430d095c06ccf5a988db91311d420a485a..154fb15e6c8fe985e92378cc8471aa6a9d579b07 100644
|
||||
index b92a9d42da8419741c435643b7401efcb21a9e8b..6e99e8ca1b53cce05615c16c3221ae3a203f50df 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -603,7 +603,8 @@ NODE_EXTERN v8::Isolate* NewIsolate(
|
||||
@@ -115,7 +115,7 @@ index 19c34a430d095c06ccf5a988db91311d420a485a..154fb15e6c8fe985e92378cc8471aa6a
|
||||
NODE_EXTERN v8::Isolate* NewIsolate(
|
||||
std::shared_ptr<ArrayBufferAllocator> allocator,
|
||||
struct uv_loop_s* event_loop,
|
||||
@@ -1624,9 +1625,10 @@ void RegisterSignalHandler(int signal,
|
||||
@@ -1702,9 +1703,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()",
|
||||
@@ -130,7 +130,7 @@ index 19c34a430d095c06ccf5a988db91311d420a485a..154fb15e6c8fe985e92378cc8471aa6a
|
||||
} // namespace node
|
||||
|
||||
diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc
|
||||
index dd6ecd1f9d82f6661b2480c0195e33515633429f..334d5cb7df7a763e0929468392dad83421cad606 100644
|
||||
index 6f674df3ed0dc1b4e5cd3a249fb787a9fc98361d..90f9eb84b6835c36a91ce23d77722812ce173c0f 100644
|
||||
--- a/src/node_main_instance.cc
|
||||
+++ b/src/node_main_instance.cc
|
||||
@@ -44,6 +44,8 @@ NodeMainInstance::NodeMainInstance(const SnapshotData* snapshot_data,
|
||||
@@ -143,7 +143,7 @@ index dd6ecd1f9d82f6661b2480c0195e33515633429f..334d5cb7df7a763e0929468392dad834
|
||||
isolate_ =
|
||||
NewIsolate(isolate_params_.get(), event_loop, platform, snapshot_data);
|
||||
diff --git a/src/node_worker.cc b/src/node_worker.cc
|
||||
index fcfd5fecdebd2724441eb83b498b38b11eedad25..e7d26b4c8cbb08a175084ceac51395860dc60598 100644
|
||||
index fa7dc52b19119ed3d2dc407c029f56107476bc39..1acc61af0c995ddefbc00fe232b2454de77a84a3 100644
|
||||
--- a/src/node_worker.cc
|
||||
+++ b/src/node_worker.cc
|
||||
@@ -181,6 +181,9 @@ class WorkerThreadData {
|
||||
|
||||
@@ -121,10 +121,10 @@ index b30297eac08ad9587642b723f91d7e3b954294d4..4c5427596d1c90d3a413cdd9ff4f1151
|
||||
auto backing = ArrayBuffer::NewBackingStore(
|
||||
mem->data,
|
||||
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
|
||||
index ddee7b7e40c3ee4054b2b15b75154607aa6431ed..decc3c8c966c2322f22d6bdd871514bb53882a29 100644
|
||||
index e1bee00825d140232456d6dc2337420fde6bda17..04edc4ca3c0e7c2284d2822fe9f5de66ff64fda2 100644
|
||||
--- a/src/node_buffer.cc
|
||||
+++ b/src/node_buffer.cc
|
||||
@@ -1420,7 +1420,7 @@ inline size_t CheckNumberToSize(Local<Value> number) {
|
||||
@@ -1443,7 +1443,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
|
||||
@@ -133,6 +133,41 @@ index ddee7b7e40c3ee4054b2b15b75154607aa6431ed..decc3c8c966c2322f22d6bdd871514bb
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
@@ -1466,6 +1466,26 @@ void CreateUnsafeArrayBuffer(const FunctionCallbackInfo<Value>& args) {
|
||||
env->isolate_data()->is_building_snapshot()) {
|
||||
buf = ArrayBuffer::New(isolate, size);
|
||||
} else {
|
||||
+#if defined(V8_ENABLE_SANDBOX)
|
||||
+ // When the V8 sandbox is enabled, all array buffers must be allocated
|
||||
+ // within the V8 memory cage via the V8 allocator.
|
||||
+ std::unique_ptr<ArrayBuffer::Allocator> allocator(
|
||||
+ ArrayBuffer::Allocator::NewDefaultAllocator());
|
||||
+ void* data = allocator->AllocateUninitialized(size);
|
||||
+ if (!data) [[unlikely]] {
|
||||
+ THROW_ERR_MEMORY_ALLOCATION_FAILED(env);
|
||||
+ return;
|
||||
+ }
|
||||
+ std::unique_ptr<BackingStore> store = ArrayBuffer::NewBackingStore(
|
||||
+ data,
|
||||
+ size,
|
||||
+ [](void* data, size_t length, void*) {
|
||||
+ std::unique_ptr<ArrayBuffer::Allocator> allocator(
|
||||
+ ArrayBuffer::Allocator::NewDefaultAllocator());
|
||||
+ allocator->Free(data, length);
|
||||
+ },
|
||||
+ nullptr);
|
||||
+#else
|
||||
std::unique_ptr<BackingStore> store = ArrayBuffer::NewBackingStore(
|
||||
isolate,
|
||||
size,
|
||||
@@ -1476,6 +1496,7 @@ void CreateUnsafeArrayBuffer(const FunctionCallbackInfo<Value>& args) {
|
||||
THROW_ERR_MEMORY_ALLOCATION_FAILED(env);
|
||||
return;
|
||||
}
|
||||
+#endif
|
||||
|
||||
buf = ArrayBuffer::New(isolate, std::move(store));
|
||||
}
|
||||
diff --git a/src/node_i18n.cc b/src/node_i18n.cc
|
||||
index 3c4f419aa29470b3280174b58680b9421b0340b5..3b24ad2a2316f89d98b067e2c13988f87a9a00d2 100644
|
||||
--- a/src/node_i18n.cc
|
||||
|
||||
@@ -12,10 +12,10 @@ See:
|
||||
https://chromium-review.googlesource.com/c/v8/v8/+/6826001
|
||||
|
||||
diff --git a/test/fixtures/test-runner/output/describe_it.snapshot b/test/fixtures/test-runner/output/describe_it.snapshot
|
||||
index 67d4af7f1b9f45d48b35c930cb1490ee019d0bdf..21d8744340c5a4c002d8c91266f46c2b66591b6e 100644
|
||||
index cae467f6487ffef4fbe94da229e30c2537fe9e95..f1240a6a99dafc18ad51d413719df58b757893ab 100644
|
||||
--- a/test/fixtures/test-runner/output/describe_it.snapshot
|
||||
+++ b/test/fixtures/test-runner/output/describe_it.snapshot
|
||||
@@ -690,6 +690,8 @@ not ok 54 - timeouts
|
||||
@@ -726,6 +726,8 @@ not ok 60 - timeouts
|
||||
code: 'ERR_TEST_FAILURE'
|
||||
stack: |-
|
||||
*
|
||||
@@ -23,8 +23,8 @@ index 67d4af7f1b9f45d48b35c930cb1490ee019d0bdf..21d8744340c5a4c002d8c91266f46c2b
|
||||
+ *
|
||||
...
|
||||
1..2
|
||||
not ok 55 - successful thenable
|
||||
@@ -712,6 +714,7 @@ not ok 56 - rejected thenable
|
||||
not ok 61 - successful thenable
|
||||
@@ -748,6 +750,7 @@ not ok 62 - rejected thenable
|
||||
code: 'ERR_TEST_FAILURE'
|
||||
stack: |-
|
||||
*
|
||||
|
||||
@@ -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 8bf4ae46f2d1d204d05adb6e951a613902f8bae2..2438ed04e3477c3bc74d02717129bf830a40c5f4 100644
|
||||
index 73a866bbef8b75e9f351ad9b1d3b0fd7850fca86..a052cc735a5660cb1b8b2875bb24c205ad7ecf94 100644
|
||||
--- a/test/parallel/parallel.status
|
||||
+++ b/test/parallel/parallel.status
|
||||
@@ -5,6 +5,16 @@ prefix parallel
|
||||
|
||||
@@ -172,14 +172,7 @@
|
||||
"report/test-report-uv-handles",
|
||||
"report/test-report-worker",
|
||||
"report/test-report-writereport",
|
||||
"sea/test-single-executable-blob-config",
|
||||
"sea/test-single-executable-blob-config-errors",
|
||||
"sequential/test-single-executable-application",
|
||||
"sequential/test-single-executable-application-disable-experimental-sea-warning",
|
||||
"sequential/test-single-executable-application-empty",
|
||||
"sequential/test-single-executable-application-snapshot",
|
||||
"sequential/test-single-executable-application-snapshot-and-code-cache",
|
||||
"sequential/test-single-executable-application-use-code-cache",
|
||||
"sea/test-single-executable",
|
||||
"sequential/test-tls-connect",
|
||||
"wpt/test-webcrypto",
|
||||
"wasm-allocation/test-wasm-allocation"
|
||||
|
||||
@@ -368,6 +368,9 @@ def upload_io_to_github(release, filename, filepath, version):
|
||||
for c in iter(lambda: upload_process.stdout.read(1), b""):
|
||||
sys.stdout.buffer.write(c)
|
||||
sys.stdout.flush()
|
||||
upload_process.wait()
|
||||
if upload_process.returncode != 0:
|
||||
sys.exit(upload_process.returncode)
|
||||
|
||||
if "GITHUB_OUTPUT" in os.environ:
|
||||
output_path = os.environ["GITHUB_OUTPUT"]
|
||||
|
||||
@@ -103,6 +103,40 @@ bool Menu::IsCommandIdEnabled(int command_id) const {
|
||||
return InvokeBoolMethod(this, "_isCommandIdEnabled", command_id);
|
||||
}
|
||||
|
||||
std::u16string Menu::GetLabelForCommandId(int command_id) const {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
v8::Local<v8::Value> val = gin_helper::CallMethod(
|
||||
isolate, const_cast<Menu*>(this), "_getLabelForCommandId", command_id);
|
||||
std::u16string label;
|
||||
if (!gin::ConvertFromV8(isolate, val, &label))
|
||||
label.clear();
|
||||
return label;
|
||||
}
|
||||
|
||||
std::u16string Menu::GetSecondaryLabelForCommandId(int command_id) const {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
v8::Local<v8::Value> val =
|
||||
gin_helper::CallMethod(isolate, const_cast<Menu*>(this),
|
||||
"_getSecondaryLabelForCommandId", command_id);
|
||||
std::u16string label;
|
||||
if (!gin::ConvertFromV8(isolate, val, &label))
|
||||
label.clear();
|
||||
return label;
|
||||
}
|
||||
|
||||
ui::ImageModel Menu::GetIconForCommandId(int command_id) const {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
v8::Local<v8::Value> val = gin_helper::CallMethod(
|
||||
isolate, const_cast<Menu*>(this), "_getIconForCommandId", command_id);
|
||||
gfx::Image icon;
|
||||
if (!gin::ConvertFromV8(isolate, val, &icon))
|
||||
icon = gfx::Image();
|
||||
return ui::ImageModel::FromImage(icon);
|
||||
}
|
||||
|
||||
bool Menu::IsCommandIdVisible(int command_id) const {
|
||||
return InvokeBoolMethod(this, "_isCommandIdVisible", command_id);
|
||||
}
|
||||
@@ -206,10 +240,6 @@ void Menu::SetIcon(int index, const gfx::Image& image) {
|
||||
model_->SetIcon(index, ui::ImageModel::FromImage(image));
|
||||
}
|
||||
|
||||
void Menu::SetSublabel(int index, const std::u16string& sublabel) {
|
||||
model_->SetSecondaryLabel(index, sublabel);
|
||||
}
|
||||
|
||||
void Menu::SetToolTip(int index, const std::u16string& toolTip) {
|
||||
model_->SetToolTip(index, toolTip);
|
||||
}
|
||||
@@ -291,7 +321,6 @@ void Menu::FillObjectTemplate(v8::Isolate* isolate,
|
||||
.SetMethod("insertSeparator", &Menu::InsertSeparatorAt)
|
||||
.SetMethod("insertSubMenu", &Menu::InsertSubMenuAt)
|
||||
.SetMethod("setIcon", &Menu::SetIcon)
|
||||
.SetMethod("setSublabel", &Menu::SetSublabel)
|
||||
.SetMethod("setToolTip", &Menu::SetToolTip)
|
||||
.SetMethod("setRole", &Menu::SetRole)
|
||||
.SetMethod("setCustomType", &Menu::SetCustomType)
|
||||
@@ -311,6 +340,8 @@ void Menu::FillObjectTemplate(v8::Isolate* isolate,
|
||||
.SetMethod("_getAcceleratorTextAt", &Menu::GetAcceleratorTextAtForTesting)
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
.SetMethod("_getUserAcceleratorAt", &Menu::GetUserAcceleratorAt)
|
||||
.SetMethod("_simulateSubmenuCloseSequenceForTesting",
|
||||
&Menu::SimulateSubmenuCloseSequenceForTesting)
|
||||
#endif
|
||||
.Build();
|
||||
}
|
||||
|
||||
@@ -73,6 +73,9 @@ class Menu : public gin::Wrappable<Menu>,
|
||||
bool IsCommandIdChecked(int command_id) const override;
|
||||
bool IsCommandIdEnabled(int command_id) const override;
|
||||
bool IsCommandIdVisible(int command_id) const override;
|
||||
std::u16string GetLabelForCommandId(int command_id) const override;
|
||||
std::u16string GetSecondaryLabelForCommandId(int command_id) const override;
|
||||
ui::ImageModel GetIconForCommandId(int command_id) const override;
|
||||
bool ShouldCommandIdWorkWhenHidden(int command_id) const override;
|
||||
bool GetAcceleratorForCommandIdWithParams(
|
||||
int command_id,
|
||||
@@ -84,6 +87,7 @@ class Menu : public gin::Wrappable<Menu>,
|
||||
int command_id,
|
||||
ElectronMenuModel::SharingItem* item) const override;
|
||||
v8::Local<v8::Value> GetUserAcceleratorAt(int command_id) const;
|
||||
virtual void SimulateSubmenuCloseSequenceForTesting();
|
||||
#endif
|
||||
void ExecuteCommand(int command_id, int event_flags) override;
|
||||
void OnMenuWillShow(ui::SimpleMenuModel* source) override;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/mac/scoped_sending_event.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "base/task/current_thread.h"
|
||||
@@ -246,6 +247,20 @@ std::u16string MenuMac::GetAcceleratorTextAtForTesting(int index) const {
|
||||
return text;
|
||||
}
|
||||
|
||||
void Menu::SimulateSubmenuCloseSequenceForTesting() {
|
||||
ElectronMenuController* controller =
|
||||
[[ElectronMenuController alloc] initWithModel:model()
|
||||
useDefaultAccelerator:NO];
|
||||
NSMenu* menu = [controller menu];
|
||||
NSMenu* submenu = menu.itemArray[0].submenu;
|
||||
|
||||
[controller setPopupCloseCallback:base::BindOnce([] {})];
|
||||
[controller menuWillOpen:menu];
|
||||
[controller menuWillOpen:submenu];
|
||||
[controller menuDidClose:submenu];
|
||||
[controller menuDidClose:menu];
|
||||
}
|
||||
|
||||
void MenuMac::ClosePopupOnUI(int32_t window_id) {
|
||||
auto controller = popup_controllers_.find(window_id);
|
||||
if (controller != popup_controllers_.end()) {
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
#include "shell/browser/electron_browser_context.h"
|
||||
#include "shell/browser/electron_browser_main_parts.h"
|
||||
#include "shell/browser/electron_navigation_throttle.h"
|
||||
#include "shell/browser/electron_permission_manager.h"
|
||||
#include "shell/browser/file_select_helper.h"
|
||||
#include "shell/browser/native_window.h"
|
||||
#include "shell/browser/osr/osr_render_widget_host_view.h"
|
||||
@@ -820,6 +821,8 @@ WebContents::WebContents(v8::Isolate* isolate,
|
||||
&offscreen_use_shared_texture_);
|
||||
use_offscreen_dict.Get(options::kSharedTexturePixelFormat,
|
||||
&offscreen_shared_texture_pixel_format_);
|
||||
use_offscreen_dict.Get(options::kDeviceScaleFactor,
|
||||
&offscreen_device_scale_factor_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -858,6 +861,7 @@ WebContents::WebContents(v8::Isolate* isolate,
|
||||
auto* view = new OffScreenWebContentsView(
|
||||
false, offscreen_use_shared_texture_,
|
||||
offscreen_shared_texture_pixel_format_,
|
||||
offscreen_device_scale_factor_,
|
||||
base::BindRepeating(&WebContents::OnPaint, base::Unretained(this)));
|
||||
params.view = view;
|
||||
params.delegate_view = view;
|
||||
@@ -879,7 +883,7 @@ WebContents::WebContents(v8::Isolate* isolate,
|
||||
content::WebContents::CreateParams params(session->browser_context());
|
||||
auto* view = new OffScreenWebContentsView(
|
||||
transparent, offscreen_use_shared_texture_,
|
||||
offscreen_shared_texture_pixel_format_,
|
||||
offscreen_shared_texture_pixel_format_, offscreen_device_scale_factor_,
|
||||
base::BindRepeating(&WebContents::OnPaint, base::Unretained(this)));
|
||||
params.view = view;
|
||||
params.delegate_view = view;
|
||||
@@ -1045,6 +1049,13 @@ void WebContents::InitWithWebContents(
|
||||
}
|
||||
|
||||
WebContents::~WebContents() {
|
||||
if (web_contents()) {
|
||||
auto* permission_manager = static_cast<ElectronPermissionManager*>(
|
||||
web_contents()->GetBrowserContext()->GetPermissionControllerDelegate());
|
||||
if (permission_manager)
|
||||
permission_manager->CancelPendingRequests(web_contents());
|
||||
}
|
||||
|
||||
if (inspectable_web_contents_)
|
||||
inspectable_web_contents_->GetView()->SetDelegate(nullptr);
|
||||
|
||||
@@ -1240,10 +1251,12 @@ void WebContents::MaybeOverrideCreateParamsForNewWindow(
|
||||
dict.Get(options::kOffscreen, &is_offscreen) && is_offscreen);
|
||||
|
||||
if (is_offscreen) {
|
||||
// Use a no-op callback here. The real OnPaint callback will be bound
|
||||
// to the child WebContents in AddNewContents via SetCallback().
|
||||
auto* view = new OffScreenWebContentsView(
|
||||
false, offscreen_use_shared_texture_,
|
||||
offscreen_shared_texture_pixel_format_,
|
||||
base::BindRepeating(&WebContents::OnPaint, base::Unretained(this)));
|
||||
offscreen_device_scale_factor_, base::DoNothing());
|
||||
create_params->view = view;
|
||||
create_params->delegate_view = view;
|
||||
}
|
||||
@@ -1271,6 +1284,15 @@ content::WebContents* WebContents::AddNewContents(
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
auto api_web_contents = CreateAndTake(isolate, std::move(new_contents), type);
|
||||
|
||||
// Rebind the paint callback to the child WebContents. The
|
||||
// OffScreenWebContentsView was initially created with the parent's OnPaint
|
||||
// in MaybeOverrideCreateParamsForNewWindow, but the paint data
|
||||
// belongs to the child.
|
||||
if (auto* osr_view = api_web_contents->GetOffScreenWebContentsView()) {
|
||||
osr_view->SetCallback(base::BindRepeating(&WebContents::OnPaint,
|
||||
api_web_contents->GetWeakPtr()));
|
||||
}
|
||||
|
||||
// We call RenderFrameCreated here as at this point the empty "about:blank"
|
||||
// render frame has already been created. If the window never navigates again
|
||||
// RenderFrameCreated won't be called and certain prefs like
|
||||
@@ -1473,18 +1495,24 @@ void WebContents::EnterFullscreenModeForTab(
|
||||
auto* permission_helper =
|
||||
WebContentsPermissionHelper::FromWebContents(source);
|
||||
auto callback =
|
||||
base::BindRepeating(&WebContents::OnEnterFullscreenModeForTab,
|
||||
base::Unretained(this), requesting_frame, options);
|
||||
permission_helper->RequestFullscreenPermission(requesting_frame, callback);
|
||||
base::BindOnce(&WebContents::OnEnterFullscreenModeForTab, GetWeakPtr(),
|
||||
requesting_frame->GetGlobalFrameToken(), options);
|
||||
permission_helper->RequestFullscreenPermission(requesting_frame,
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
void WebContents::OnEnterFullscreenModeForTab(
|
||||
content::RenderFrameHost* requesting_frame,
|
||||
const content::GlobalRenderFrameHostToken& frame_token,
|
||||
const blink::mojom::FullscreenOptions& options,
|
||||
bool allowed) {
|
||||
if (!allowed || !owner_window())
|
||||
return;
|
||||
|
||||
auto* requesting_frame =
|
||||
content::RenderFrameHost::FromFrameToken(frame_token);
|
||||
if (!requesting_frame)
|
||||
return;
|
||||
|
||||
auto* source = content::WebContents::FromRenderFrameHost(requesting_frame);
|
||||
if (IsFullscreenForTabOrPending(source)) {
|
||||
DCHECK_EQ(fullscreen_frame_, source->GetFocusedFrame());
|
||||
@@ -1603,8 +1631,7 @@ void WebContents::RequestPointerLock(content::WebContents* web_contents,
|
||||
WebContentsPermissionHelper::FromWebContents(web_contents);
|
||||
permission_helper->RequestPointerLockPermission(
|
||||
user_gesture, last_unlocked_by_target,
|
||||
base::BindOnce(&WebContents::OnRequestPointerLock,
|
||||
base::Unretained(this)));
|
||||
base::BindOnce(&WebContents::OnRequestPointerLock, GetWeakPtr()));
|
||||
}
|
||||
|
||||
void WebContents::LostPointerLock() {
|
||||
@@ -1634,8 +1661,8 @@ void WebContents::RequestKeyboardLock(content::WebContents* web_contents,
|
||||
auto* permission_helper =
|
||||
WebContentsPermissionHelper::FromWebContents(web_contents);
|
||||
permission_helper->RequestKeyboardLockPermission(
|
||||
esc_key_locked, base::BindOnce(&WebContents::OnRequestKeyboardLock,
|
||||
base::Unretained(this)));
|
||||
esc_key_locked,
|
||||
base::BindOnce(&WebContents::OnRequestKeyboardLock, GetWeakPtr()));
|
||||
}
|
||||
|
||||
void WebContents::CancelKeyboardLockRequest(
|
||||
@@ -2065,6 +2092,10 @@ void WebContents::ReadyToCommitNavigation(
|
||||
// Only focus for top-level contents.
|
||||
if (type_ != Type::kBrowserWindow)
|
||||
return;
|
||||
// Don't focus if focusOnNavigation is disabled.
|
||||
auto* prefs = WebContentsPreferences::From(web_contents());
|
||||
if (prefs && !prefs->ShouldFocusOnNavigation())
|
||||
return;
|
||||
web_contents()->SetInitialFocus();
|
||||
}
|
||||
|
||||
@@ -4656,6 +4687,19 @@ gin_helper::Handle<WebContents> WebContents::CreateFromWebPreferences(
|
||||
existing_preferences->SetFromDictionary(web_preferences_dict);
|
||||
web_contents->SetBackgroundColor(
|
||||
existing_preferences->GetBackgroundColor());
|
||||
|
||||
double zoom_factor;
|
||||
if (web_preferences.Get(options::kZoomFactor, &zoom_factor)) {
|
||||
auto* zoom_controller = WebContentsZoomController::FromWebContents(
|
||||
web_contents->web_contents());
|
||||
if (zoom_controller) {
|
||||
zoom_controller->SetDefaultZoomFactor(zoom_factor);
|
||||
// Also set the current zoom level immediately, since the page
|
||||
// has already navigated by the time we wrap the webContents.
|
||||
zoom_controller->SetZoomLevel(
|
||||
blink::ZoomFactorToZoomLevel(zoom_factor));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Create one if not.
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/devtools_agent_host.h"
|
||||
#include "content/public/browser/frame_tree_node_id.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
#include "content/public/browser/javascript_dialog_manager.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/web_contents_delegate.h"
|
||||
@@ -336,7 +337,7 @@ class WebContents final : public ExclusiveAccessContext,
|
||||
|
||||
// Callback triggered on permission response.
|
||||
void OnEnterFullscreenModeForTab(
|
||||
content::RenderFrameHost* requesting_frame,
|
||||
const content::GlobalRenderFrameHostToken& frame_token,
|
||||
const blink::mojom::FullscreenOptions& options,
|
||||
bool allowed);
|
||||
|
||||
@@ -820,6 +821,13 @@ class WebContents final : public ExclusiveAccessContext,
|
||||
bool offscreen_use_shared_texture_ = false;
|
||||
std::string offscreen_shared_texture_pixel_format_ = "argb";
|
||||
|
||||
// TODO(reito): 0.0f means the device scale factor is not set, it's a
|
||||
// migration of the breaking change so that we can read the device scale
|
||||
// factor from physical primary screen's info. In Electron 42, we need to set
|
||||
// this to 1.0f so that the offscreen rendering use 1.0 as default when
|
||||
// `deviceScaleFactor` is not specified in webPreferences.
|
||||
float offscreen_device_scale_factor_ = 0.0f;
|
||||
|
||||
// Whether window is fullscreened by HTML5 api.
|
||||
bool html_fullscreen_ = false;
|
||||
|
||||
|
||||
@@ -83,8 +83,16 @@ void WebContentsView::ApplyBorderRadius() {
|
||||
|
||||
int WebContentsView::NonClientHitTest(const gfx::Point& point) {
|
||||
if (api_web_contents_) {
|
||||
// Convert the point to the contents view's coordinate space rather than
|
||||
// the InspectableWebContentsView's coordinate space, because the draggable
|
||||
// region is relative to the web content area. When DevTools is docked
|
||||
// (e.g. to the left), the contents view is offset within the parent,
|
||||
// so we need to account for that offset.
|
||||
auto* inspectable_view =
|
||||
api_web_contents_->inspectable_web_contents()->GetView();
|
||||
auto* contents_view = inspectable_view->GetContentsView();
|
||||
gfx::Point local_point(point);
|
||||
views::View::ConvertPointFromWidget(view(), &local_point);
|
||||
views::View::ConvertPointFromWidget(contents_view, &local_point);
|
||||
SkRegion* region = api_web_contents_->draggable_region();
|
||||
if (region && region->contains(local_point.x(), local_point.y()))
|
||||
return HTCAPTION;
|
||||
|
||||
@@ -268,7 +268,7 @@ void ElectronDownloadManagerDelegate::OnDownloadPathGenerated(
|
||||
gin_helper::Promise<gin_helper::Dictionary> dialog_promise(isolate);
|
||||
auto dialog_callback = base::BindOnce(
|
||||
&ElectronDownloadManagerDelegate::OnDownloadSaveDialogDone,
|
||||
base::Unretained(this), download_guid, std::move(callback));
|
||||
weak_ptr_factory_.GetWeakPtr(), download_guid, std::move(callback));
|
||||
|
||||
std::ignore = dialog_promise.Then(std::move(dialog_callback));
|
||||
file_dialog::ShowSaveDialog(settings, std::move(dialog_promise));
|
||||
|
||||
@@ -154,6 +154,23 @@ bool ElectronPermissionManager::HasPermissionCheckHandler() const {
|
||||
return !check_handler_.is_null();
|
||||
}
|
||||
|
||||
void ElectronPermissionManager::CancelPendingRequests(
|
||||
content::WebContents* web_contents) {
|
||||
std::vector<int> ids_to_remove;
|
||||
for (PendingRequestsMap::iterator iter(&pending_requests_); !iter.IsAtEnd();
|
||||
iter.Advance()) {
|
||||
auto* pending_request = iter.GetCurrentValue();
|
||||
content::RenderFrameHost* rfh = pending_request->GetRenderFrameHost();
|
||||
if (!rfh ||
|
||||
content::WebContents::FromRenderFrameHost(rfh) == web_contents) {
|
||||
ids_to_remove.push_back(iter.GetCurrentKey());
|
||||
}
|
||||
}
|
||||
for (int id : ids_to_remove) {
|
||||
pending_requests_.Remove(id);
|
||||
}
|
||||
}
|
||||
|
||||
void ElectronPermissionManager::RequestPermissionWithDetails(
|
||||
blink::mojom::PermissionDescriptorPtr permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
|
||||
@@ -84,6 +84,8 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
|
||||
bool HasPermissionRequestHandler() const;
|
||||
bool HasPermissionCheckHandler() const;
|
||||
|
||||
void CancelPendingRequests(content::WebContents* web_contents);
|
||||
|
||||
void CheckBluetoothDevicePair(gin_helper::Dictionary details,
|
||||
PairCallback pair_callback) const;
|
||||
|
||||
|
||||
@@ -143,14 +143,12 @@ static NSDictionary* UNNotificationResponseToNSDictionary(
|
||||
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
||||
NSURL* url = userActivity.webpageURL;
|
||||
NSDictionary* details = url ? @{@"webpageURL" : url.absoluteString} : @{};
|
||||
if (!userActivity.userInfo)
|
||||
return NO;
|
||||
NSDictionary* user_info = userActivity.userInfo ?: @{};
|
||||
|
||||
electron::Browser* browser = electron::Browser::Get();
|
||||
return browser->ContinueUserActivity(
|
||||
activity_type,
|
||||
electron::NSDictionaryToValue(userActivity.userInfo),
|
||||
electron::NSDictionaryToValue(details))
|
||||
return browser->ContinueUserActivity(activity_type,
|
||||
electron::NSDictionaryToValue(user_info),
|
||||
electron::NSDictionaryToValue(details))
|
||||
? YES
|
||||
: NO;
|
||||
}
|
||||
|
||||
@@ -773,10 +773,9 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
|
||||
if (!IsFullScreenable())
|
||||
return;
|
||||
|
||||
bool leaving_fullscreen = IsFullscreen() && !fullscreen;
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// There is no native fullscreen state on Windows.
|
||||
bool leaving_fullscreen = IsFullscreen() && !fullscreen;
|
||||
|
||||
if (fullscreen) {
|
||||
last_window_state_ = ui::mojom::WindowShowState::kFullscreen;
|
||||
NotifyWindowEnterFullScreen();
|
||||
@@ -815,7 +814,13 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
|
||||
// Note: the following must be after "widget()->SetFullscreen(fullscreen);"
|
||||
if (leaving_fullscreen && !IsVisible())
|
||||
FlipWindowStyle(GetAcceleratedWidget(), true, WS_VISIBLE);
|
||||
|
||||
#else
|
||||
if (IsVisible())
|
||||
widget()->SetFullscreen(fullscreen);
|
||||
else if (fullscreen)
|
||||
widget()->native_widget_private()->Show(
|
||||
ui::mojom::WindowShowState::kFullscreen, gfx::Rect());
|
||||
#endif
|
||||
// Auto-hide menubar when in fullscreen.
|
||||
if (fullscreen) {
|
||||
menu_bar_visible_before_fullscreen_ = IsMenuBarVisible();
|
||||
@@ -826,6 +831,9 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
|
||||
// `menu_bar_visible_before_fullscreen_` is always false on the
|
||||
// second call which results in `SetMenuBarVisibility(false)` no
|
||||
// matter what. We check `leaving_fullscreen` to avoid this.
|
||||
//
|
||||
// Additionally, simply calling `win.setFullscreen(false)`
|
||||
// when not in fullscreen should do nothing.
|
||||
if (!leaving_fullscreen)
|
||||
return;
|
||||
|
||||
@@ -833,23 +841,6 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
|
||||
menu_bar_visible_before_fullscreen_);
|
||||
menu_bar_visible_before_fullscreen_ = false;
|
||||
}
|
||||
#else
|
||||
if (IsVisible())
|
||||
widget()->SetFullscreen(fullscreen);
|
||||
else if (fullscreen)
|
||||
widget()->native_widget_private()->Show(
|
||||
ui::mojom::WindowShowState::kFullscreen, gfx::Rect());
|
||||
|
||||
// Auto-hide menubar when in fullscreen.
|
||||
if (fullscreen) {
|
||||
menu_bar_visible_before_fullscreen_ = IsMenuBarVisible();
|
||||
SetMenuBarVisibility(false);
|
||||
} else {
|
||||
SetMenuBarVisibility(!IsMenuBarAutoHide() &&
|
||||
menu_bar_visible_before_fullscreen_);
|
||||
menu_bar_visible_before_fullscreen_ = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NativeWindowViews::IsFullscreen() const {
|
||||
|
||||
@@ -371,7 +371,7 @@ void HandleToastActivation(const std::wstring& invoked_args,
|
||||
|
||||
int action_index = -1;
|
||||
if (!action_index_str.empty()) {
|
||||
action_index = std::stoi(action_index_str);
|
||||
base::StringToInt(base::WideToUTF8(action_index_str), &action_index);
|
||||
}
|
||||
|
||||
std::string reply_text;
|
||||
|
||||
@@ -53,8 +53,6 @@ namespace electron {
|
||||
|
||||
namespace {
|
||||
|
||||
const float kDefaultScaleFactor = 1.0;
|
||||
|
||||
ui::MouseEvent UiMouseEventFromWebMouseEvent(blink::WebMouseEvent event) {
|
||||
int button_flags = 0;
|
||||
switch (event.button) {
|
||||
@@ -96,6 +94,15 @@ ui::MouseWheelEvent UiMouseWheelEventFromWebMouseEvent(
|
||||
base::ClampFloor<int>(event.delta_y)};
|
||||
}
|
||||
|
||||
// TODO(reito): Remove this function and use default 1.0f when Electron 42.
|
||||
float GetDefaultDeviceScaleFactorFromDisplayInfo() {
|
||||
display::Display display =
|
||||
display::Screen::Get()->GetDisplayNearestView(gfx::NativeView());
|
||||
|
||||
const float factor = display.device_scale_factor();
|
||||
return factor > 0 ? factor : 1.0f;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class ElectronDelegatedFrameHostClient
|
||||
@@ -155,6 +162,7 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
|
||||
bool transparent,
|
||||
bool offscreen_use_shared_texture,
|
||||
const std::string& offscreen_shared_texture_pixel_format,
|
||||
float offscreen_device_scale_factor,
|
||||
bool painting,
|
||||
int frame_rate,
|
||||
const OnPaintCallback& callback,
|
||||
@@ -168,6 +176,7 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
|
||||
offscreen_use_shared_texture_(offscreen_use_shared_texture),
|
||||
offscreen_shared_texture_pixel_format_(
|
||||
offscreen_shared_texture_pixel_format),
|
||||
offscreen_device_scale_factor_(offscreen_device_scale_factor),
|
||||
callback_(callback),
|
||||
frame_rate_(frame_rate),
|
||||
size_(initial_size),
|
||||
@@ -184,11 +193,11 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
|
||||
DCHECK(render_widget_host_);
|
||||
DCHECK(!render_widget_host_->GetView());
|
||||
|
||||
// Initialize a screen_infos_ struct as needed, to cache the scale factor.
|
||||
if (screen_infos_.screen_infos.empty()) {
|
||||
UpdateScreenInfo();
|
||||
// TODO(reito): Remove this when Electron 42.
|
||||
if (cc::MathUtil::IsWithinEpsilon(offscreen_device_scale_factor_, 0.0f)) {
|
||||
offscreen_device_scale_factor_ =
|
||||
GetDefaultDeviceScaleFactorFromDisplayInfo();
|
||||
}
|
||||
screen_infos_.mutable_current().device_scale_factor = kDefaultScaleFactor;
|
||||
|
||||
delegated_frame_host_allocator_.GenerateId();
|
||||
delegated_frame_host_surface_id_ =
|
||||
@@ -210,15 +219,6 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
|
||||
compositor_->SetDelegate(this);
|
||||
compositor_->SetRootLayer(root_layer_.get());
|
||||
|
||||
// For offscreen rendering with format rgbaf16, we need to set correct display
|
||||
// color spaces to the compositor, otherwise it won't support hdr.
|
||||
if (offscreen_use_shared_texture_ &&
|
||||
offscreen_shared_texture_pixel_format_ == "rgbaf16") {
|
||||
gfx::DisplayColorSpaces hdr_display_color_spaces(
|
||||
gfx::ColorSpace::CreateSRGBLinear(), viz::SinglePlaneFormat::kRGBA_F16);
|
||||
compositor_->SetDisplayColorSpaces(hdr_display_color_spaces);
|
||||
}
|
||||
|
||||
ResizeRootLayer(false);
|
||||
|
||||
render_widget_host_->SetView(this);
|
||||
@@ -504,19 +504,6 @@ void OffScreenRenderWidgetHostView::CopyFromSurface(
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
display::ScreenInfo OffScreenRenderWidgetHostView::GetScreenInfo() const {
|
||||
display::ScreenInfo screen_info;
|
||||
screen_info.depth = 24;
|
||||
screen_info.depth_per_component = 8;
|
||||
screen_info.orientation_angle = 0;
|
||||
screen_info.device_scale_factor = GetDeviceScaleFactor();
|
||||
screen_info.orientation_type =
|
||||
display::mojom::ScreenOrientation::kLandscapePrimary;
|
||||
screen_info.rect = gfx::Rect(size_);
|
||||
screen_info.available_rect = gfx::Rect(size_);
|
||||
return screen_info;
|
||||
}
|
||||
|
||||
gfx::Rect OffScreenRenderWidgetHostView::GetBoundsInRootWindow() {
|
||||
return gfx::Rect(size_);
|
||||
}
|
||||
@@ -562,8 +549,8 @@ OffScreenRenderWidgetHostView::CreateViewForWidget(
|
||||
|
||||
return new OffScreenRenderWidgetHostView(
|
||||
transparent_, offscreen_use_shared_texture_,
|
||||
offscreen_shared_texture_pixel_format_, true,
|
||||
embedder_host_view->frame_rate(), callback_, render_widget_host,
|
||||
offscreen_shared_texture_pixel_format_, offscreen_device_scale_factor_,
|
||||
true, embedder_host_view->frame_rate(), callback_, render_widget_host,
|
||||
embedder_host_view, size());
|
||||
}
|
||||
|
||||
@@ -971,35 +958,55 @@ void OffScreenRenderWidgetHostView::InvalidateBounds(const gfx::Rect& bounds) {
|
||||
CompositeFrame(bounds);
|
||||
}
|
||||
|
||||
display::ScreenInfos
|
||||
OffScreenRenderWidgetHostView::GetNewScreenInfosForUpdate() {
|
||||
display::ScreenInfo screen_info;
|
||||
screen_info.depth = 24;
|
||||
screen_info.depth_per_component = 8;
|
||||
screen_info.orientation_angle = 0;
|
||||
screen_info.orientation_type =
|
||||
display::mojom::ScreenOrientation::kLandscapePrimary;
|
||||
screen_info.rect = gfx::Rect(size_);
|
||||
screen_info.available_rect = gfx::Rect(size_);
|
||||
screen_info.device_scale_factor = offscreen_device_scale_factor_;
|
||||
|
||||
// When pixel format is 'rgbaf16', we need to set screen info to support HDR.
|
||||
if (offscreen_use_shared_texture_ &&
|
||||
offscreen_shared_texture_pixel_format_ == "rgbaf16") {
|
||||
gfx::DisplayColorSpaces hdr_display_color_spaces{
|
||||
gfx::ColorSpace::CreateSRGBLinear(), viz::SinglePlaneFormat::kRGBA_F16};
|
||||
// The max luminance value doesn't matter so we set to a large value.
|
||||
hdr_display_color_spaces.SetHDRMaxLuminanceRelative(100.0f);
|
||||
screen_info.display_color_spaces = hdr_display_color_spaces;
|
||||
}
|
||||
|
||||
display::ScreenInfos screen_infos{screen_info};
|
||||
return screen_infos;
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::ResizeRootLayer(bool force) {
|
||||
SetupFrameRate(false);
|
||||
|
||||
display::Display display =
|
||||
display::Screen::Get()->GetDisplayNearestView(GetNativeView());
|
||||
const float scaleFactor = display.device_scale_factor();
|
||||
float sf = GetDeviceScaleFactor();
|
||||
const bool sf_did_change = scaleFactor != sf;
|
||||
|
||||
// Initialize a screen_infos_ struct as needed, to cache the scale factor.
|
||||
if (screen_infos_.screen_infos.empty()) {
|
||||
UpdateScreenInfo();
|
||||
}
|
||||
screen_infos_.mutable_current().device_scale_factor = scaleFactor;
|
||||
auto old_screen_info = screen_infos_.current();
|
||||
UpdateScreenInfo();
|
||||
|
||||
auto new_screen_info = screen_infos_.current();
|
||||
gfx::Size size = GetViewBounds().size();
|
||||
|
||||
if (!force && !sf_did_change && size == root_layer()->bounds().size())
|
||||
if (!force && size == root_layer()->bounds().size() &&
|
||||
old_screen_info == new_screen_info)
|
||||
return;
|
||||
|
||||
root_layer()->SetBounds(gfx::Rect(size));
|
||||
|
||||
const gfx::Size& size_in_pixels =
|
||||
gfx::ToFlooredSize(gfx::ConvertSizeToPixels(size, sf));
|
||||
auto sf = GetDeviceScaleFactor();
|
||||
const gfx::Size& size_in_pixels = SizeInPixels();
|
||||
|
||||
if (compositor_) {
|
||||
compositor_allocator_.GenerateId();
|
||||
compositor_surface_id_ = compositor_allocator_.GetCurrentLocalSurfaceId();
|
||||
compositor_->SetScaleAndSize(sf, size_in_pixels, compositor_surface_id_);
|
||||
compositor_->SetDisplayColorSpaces(new_screen_info.display_color_spaces);
|
||||
}
|
||||
|
||||
delegated_frame_host_allocator_.GenerateId();
|
||||
|
||||
@@ -73,6 +73,7 @@ class OffScreenRenderWidgetHostView
|
||||
bool transparent,
|
||||
bool offscreen_use_shared_texture,
|
||||
const std::string& offscreen_shared_texture_pixel_format,
|
||||
float offscreen_device_scale_factor,
|
||||
bool painting,
|
||||
int frame_rate,
|
||||
const OnPaintCallback& callback,
|
||||
@@ -150,7 +151,6 @@ class OffScreenRenderWidgetHostView
|
||||
const gfx::Size& output_size,
|
||||
base::OnceCallback<void(const viz::CopyOutputBitmapWithMetadata&)>
|
||||
callback) override;
|
||||
display::ScreenInfo GetScreenInfo() const override;
|
||||
void TransformPointToRootSurface(gfx::PointF* point) override {}
|
||||
gfx::Rect GetBoundsInRootWindow() override;
|
||||
std::optional<content::DisplayFeature> GetDisplayFeature() override;
|
||||
@@ -170,6 +170,7 @@ class OffScreenRenderWidgetHostView
|
||||
const std::optional<std::vector<gfx::Rect>>& character_bounds) override {}
|
||||
gfx::Size GetCompositorViewportPixelSize() override;
|
||||
ui::Compositor* GetCompositor() override;
|
||||
display::ScreenInfos GetNewScreenInfosForUpdate() override;
|
||||
|
||||
content::RenderWidgetHostViewBase* CreateViewForWidget(
|
||||
content::RenderWidgetHost*,
|
||||
@@ -292,6 +293,8 @@ class OffScreenRenderWidgetHostView
|
||||
const bool transparent_;
|
||||
const bool offscreen_use_shared_texture_;
|
||||
const std::string offscreen_shared_texture_pixel_format_;
|
||||
float offscreen_device_scale_factor_;
|
||||
|
||||
OnPaintCallback callback_;
|
||||
OnPopupPaintCallback parent_callback_;
|
||||
|
||||
|
||||
@@ -17,11 +17,13 @@ OffScreenWebContentsView::OffScreenWebContentsView(
|
||||
bool transparent,
|
||||
bool offscreen_use_shared_texture,
|
||||
const std::string& offscreen_shared_texture_pixel_format,
|
||||
float offscreen_device_scale_factor,
|
||||
const OnPaintCallback& callback)
|
||||
: transparent_(transparent),
|
||||
offscreen_use_shared_texture_(offscreen_use_shared_texture),
|
||||
offscreen_shared_texture_pixel_format_(
|
||||
offscreen_shared_texture_pixel_format),
|
||||
offscreen_device_scale_factor_(offscreen_device_scale_factor),
|
||||
callback_(callback) {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
PlatformCreate();
|
||||
@@ -45,6 +47,10 @@ void OffScreenWebContentsView::SetWebContents(
|
||||
view->InstallTransparency();
|
||||
}
|
||||
|
||||
void OffScreenWebContentsView::SetCallback(const OnPaintCallback& callback) {
|
||||
callback_ = callback;
|
||||
}
|
||||
|
||||
void OffScreenWebContentsView::SetNativeWindow(NativeWindow* window) {
|
||||
if (native_window_)
|
||||
native_window_->RemoveObserver(this);
|
||||
@@ -116,8 +122,9 @@ OffScreenWebContentsView::CreateViewForWidget(
|
||||
|
||||
return new OffScreenRenderWidgetHostView(
|
||||
transparent_, offscreen_use_shared_texture_,
|
||||
offscreen_shared_texture_pixel_format_, painting_, GetFrameRate(),
|
||||
callback_, render_widget_host, nullptr, GetSize());
|
||||
offscreen_shared_texture_pixel_format_, offscreen_device_scale_factor_,
|
||||
painting_, GetFrameRate(), callback_, render_widget_host, nullptr,
|
||||
GetSize());
|
||||
}
|
||||
|
||||
content::RenderWidgetHostViewBase*
|
||||
@@ -137,9 +144,9 @@ OffScreenWebContentsView::CreateViewForChildWidget(
|
||||
|
||||
return new OffScreenRenderWidgetHostView(
|
||||
transparent_, offscreen_use_shared_texture_,
|
||||
offscreen_shared_texture_pixel_format_, painting_,
|
||||
embedder_host_view->frame_rate(), callback_, render_widget_host,
|
||||
embedder_host_view, GetSize());
|
||||
offscreen_shared_texture_pixel_format_, offscreen_device_scale_factor_,
|
||||
painting_, embedder_host_view->frame_rate(), callback_,
|
||||
render_widget_host, embedder_host_view, GetSize());
|
||||
}
|
||||
|
||||
void OffScreenWebContentsView::RenderViewReady() {
|
||||
|
||||
@@ -38,11 +38,13 @@ class OffScreenWebContentsView : public content::WebContentsView,
|
||||
bool transparent,
|
||||
bool offscreen_use_shared_texture,
|
||||
const std::string& offscreen_shared_texture_pixel_format,
|
||||
float offscreen_device_scale_factor,
|
||||
const OnPaintCallback& callback);
|
||||
~OffScreenWebContentsView() override;
|
||||
|
||||
void SetWebContents(content::WebContents*);
|
||||
void SetNativeWindow(NativeWindow* window);
|
||||
void SetCallback(const OnPaintCallback& callback);
|
||||
|
||||
// NativeWindowObserver:
|
||||
void OnWindowResize() override;
|
||||
@@ -113,6 +115,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
|
||||
const bool transparent_;
|
||||
const bool offscreen_use_shared_texture_;
|
||||
const std::string offscreen_shared_texture_pixel_format_;
|
||||
const float offscreen_device_scale_factor_;
|
||||
bool painting_ = true;
|
||||
int frame_rate_ = 60;
|
||||
OnPaintCallback callback_;
|
||||
|
||||
@@ -258,7 +258,7 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
|
||||
|
||||
// Empties the source menu items to the destination.
|
||||
- (void)moveMenuItems:(NSMenu*)source to:(NSMenu*)destination {
|
||||
const NSInteger count = [source numberOfItems];
|
||||
const NSInteger count = source.numberOfItems;
|
||||
for (NSInteger index = 0; index < count; index++) {
|
||||
NSMenuItem* removedItem = [source itemAtIndex:0];
|
||||
[source removeItemAtIndex:0];
|
||||
@@ -269,25 +269,25 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
|
||||
// Replaces the item's submenu instance with the singleton recent documents
|
||||
// menu. Previously replaced menu items will be recovered.
|
||||
- (void)replaceSubmenuShowingRecentDocuments:(NSMenuItem*)item {
|
||||
NSMenu* recentDocumentsMenu = [recentDocumentsMenuItem_ submenu];
|
||||
NSMenu* recentDocumentsMenu = recentDocumentsMenuItem_.submenu;
|
||||
|
||||
// Remove menu items in recent documents back to swap menu
|
||||
[self moveMenuItems:recentDocumentsMenu to:recentDocumentsMenuSwap_];
|
||||
// Swap back the submenu
|
||||
[recentDocumentsMenuItem_ setSubmenu:recentDocumentsMenuSwap_];
|
||||
recentDocumentsMenuItem_.submenu = recentDocumentsMenuSwap_;
|
||||
|
||||
// Retain the item's submenu for a future recovery
|
||||
recentDocumentsMenuSwap_ = [item submenu];
|
||||
recentDocumentsMenuSwap_ = item.submenu;
|
||||
|
||||
// Repopulate with items from the submenu to be replaced
|
||||
[self moveMenuItems:recentDocumentsMenuSwap_ to:recentDocumentsMenu];
|
||||
// Update the submenu's title
|
||||
[recentDocumentsMenu setTitle:[recentDocumentsMenuSwap_ title]];
|
||||
recentDocumentsMenu.title = recentDocumentsMenuSwap_.title;
|
||||
// Replace submenu
|
||||
[item setSubmenu:recentDocumentsMenu];
|
||||
item.submenu = recentDocumentsMenu;
|
||||
|
||||
DCHECK_EQ([item action], @selector(submenuAction:));
|
||||
DCHECK_EQ([item target], recentDocumentsMenu);
|
||||
DCHECK_EQ(item.action, @selector(submenuAction:));
|
||||
DCHECK_EQ(item.target, recentDocumentsMenu);
|
||||
|
||||
// Remember the new menu item that carries the recent documents menu
|
||||
recentDocumentsMenuItem_ = item;
|
||||
@@ -303,7 +303,7 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
|
||||
NSArray* services = [NSSharingService sharingServicesForItems:items];
|
||||
for (NSSharingService* service in services)
|
||||
[menu addItem:[self menuItemForService:service withItems:items]];
|
||||
[menu setDelegate:self];
|
||||
menu.delegate = self;
|
||||
return menu;
|
||||
}
|
||||
|
||||
@@ -313,9 +313,9 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
|
||||
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle:service.menuItemTitle
|
||||
action:@selector(performShare:)
|
||||
keyEquivalent:@""];
|
||||
[item setTarget:self];
|
||||
[item setImage:service.image];
|
||||
[item setRepresentedObject:@{@"service" : service, @"items" : items}];
|
||||
item.target = self;
|
||||
item.image = service.image;
|
||||
item.representedObject = @{@"service" : service, @"items" : items};
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -351,10 +351,10 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
|
||||
// If the menu item has an icon, set it.
|
||||
ui::ImageModel icon = model->GetIconAt(index);
|
||||
if (icon.IsImage())
|
||||
[item setImage:icon.GetImage().ToNSImage()];
|
||||
item.image = icon.GetImage().ToNSImage();
|
||||
|
||||
std::u16string toolTip = model->GetToolTipAt(index);
|
||||
[item setToolTip:base::SysUTF16ToNSString(toolTip)];
|
||||
item.toolTip = base::SysUTF16ToNSString(toolTip);
|
||||
|
||||
if (role == u"services") {
|
||||
std::u16string title = u"Services";
|
||||
@@ -398,7 +398,7 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
|
||||
submenu.delegate = self;
|
||||
|
||||
// Set submenu's role.
|
||||
if ((role == u"window" || role == u"windowmenu") && [submenu numberOfItems])
|
||||
if ((role == u"window" || role == u"windowmenu") && submenu.numberOfItems)
|
||||
[NSApp setWindowsMenu:submenu];
|
||||
else if (role == u"help")
|
||||
[NSApp setHelpMenu:submenu];
|
||||
@@ -463,6 +463,14 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
|
||||
return item;
|
||||
}
|
||||
|
||||
// Called by AppKit before displaying a menu and when a key equivalent is
|
||||
// pressed. This ensures menu item states (enabled, checked, hidden) are
|
||||
// refreshed from the model even when the menu is closed, which is necessary
|
||||
// since we set autoenablesItems = NO.
|
||||
- (void)menuNeedsUpdate:(NSMenu*)menu {
|
||||
[self refreshMenuTree:menu];
|
||||
}
|
||||
|
||||
- (void)applyStateToMenuItem:(NSMenuItem*)item {
|
||||
id represented = item.representedObject;
|
||||
if (!represented)
|
||||
@@ -487,10 +495,29 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
|
||||
// When the menu is closed, we need to allow shortcuts to be triggered even
|
||||
// if the menu item is disabled. So we only disable the menu item when the
|
||||
// menu is open. This matches behavior of |validateUserInterfaceItem|.
|
||||
item.enabled = model->IsEnabledAt(index) || !isMenuOpen_;
|
||||
item.enabled = model->IsEnabledAt(index);
|
||||
item.hidden = !model->IsVisibleAt(index);
|
||||
item.state = model->IsItemCheckedAt(index) ? NSControlStateValueOn
|
||||
: NSControlStateValueOff;
|
||||
std::u16string label16 = model->GetLabelAt(index);
|
||||
NSString* label = l10n_util::FixUpWindowsStyleLabel(label16);
|
||||
item.title = label;
|
||||
|
||||
std::u16string rawSecondaryLabel = model->GetSecondaryLabelAt(index);
|
||||
if (!rawSecondaryLabel.empty()) {
|
||||
if (@available(macOS 14.4, *)) {
|
||||
NSString* secondary_label =
|
||||
l10n_util::FixUpWindowsStyleLabel(rawSecondaryLabel);
|
||||
item.subtitle = secondary_label;
|
||||
}
|
||||
}
|
||||
|
||||
ui::ImageModel icon = model->GetIconAt(index);
|
||||
if (icon.IsImage()) {
|
||||
item.image = icon.GetImage().ToNSImage();
|
||||
} else {
|
||||
item.image = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)refreshMenuTree:(NSMenu*)menu {
|
||||
@@ -566,7 +593,6 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
|
||||
[menu removeItem:item];
|
||||
}
|
||||
|
||||
[self refreshMenuTree:menu];
|
||||
if (model_)
|
||||
model_->MenuWillShow();
|
||||
}
|
||||
@@ -576,19 +602,25 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
|
||||
if (!isMenuOpen_)
|
||||
return;
|
||||
|
||||
isMenuOpen_ = NO;
|
||||
[self refreshMenuTree:menu];
|
||||
|
||||
// There are two scenarios where we should emit menu-did-close:
|
||||
// 1. It's a popup and the top level menu is closed.
|
||||
// 2. It's an application menu, and the current menu's supermenu
|
||||
// is the top-level menu.
|
||||
bool has_close_cb = !popupCloseCallback.is_null();
|
||||
bool should_emit_close = true;
|
||||
if (menu != menu_) {
|
||||
if (has_close_cb || menu.supermenu != menu_)
|
||||
return;
|
||||
should_emit_close = !has_close_cb && menu.supermenu == menu_;
|
||||
}
|
||||
|
||||
[self refreshMenuTree:menu];
|
||||
|
||||
// Submenu's close event arrives before the top-level menu closes.
|
||||
// Don't change isMenuOpen_ until the top-level one receives the close event.
|
||||
if (!should_emit_close)
|
||||
return;
|
||||
|
||||
isMenuOpen_ = NO;
|
||||
|
||||
if (model_)
|
||||
model_->MenuWillClose();
|
||||
// Post async task so that itemSelected runs before the close callback
|
||||
|
||||
@@ -35,6 +35,41 @@ int ScopedDisableResize::disable_resize_ = 0;
|
||||
|
||||
typedef void (*MouseDownImpl)(id, SEL, NSEvent*);
|
||||
|
||||
// Work around an Apple bug where the visual tab picker's
|
||||
// grid animation creates NSLayoutConstraints against nil layout anchors,
|
||||
// crashing in NSVisualTabPickerShadowTileView. This happens when a new tabbed
|
||||
// window is created while the tab picker is open — the "+" tile (and possibly
|
||||
// others) have broken internal state. Rather than patching individual tile
|
||||
// animation methods, short-circuit the entire grid animation by swizzling
|
||||
// NSVisualTabPickerGridView's -startGridAnimation:completionHandler: to
|
||||
// immediately invoke the completion handler without running the animation.
|
||||
typedef void (*StartGridAnimationIMP)(id, SEL, id, id);
|
||||
static StartGridAnimationIMP g_orig_startGridAnimation = nullptr;
|
||||
|
||||
static void Patched_startGridAnimation(id self,
|
||||
SEL _cmd,
|
||||
id animation,
|
||||
void (^completionHandler)(void)) {
|
||||
if (completionHandler)
|
||||
completionHandler();
|
||||
}
|
||||
|
||||
static void SwizzleTabPickerGridAnimation() {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
Class cls = NSClassFromString(@"NSVisualTabPickerGridView");
|
||||
if (!cls)
|
||||
return;
|
||||
SEL sel = @selector(startGridAnimation:completionHandler:);
|
||||
Method method = class_getInstanceMethod(cls, sel);
|
||||
if (!method)
|
||||
return;
|
||||
g_orig_startGridAnimation =
|
||||
(StartGridAnimationIMP)method_getImplementation(method);
|
||||
method_setImplementation(method, (IMP)Patched_startGridAnimation);
|
||||
});
|
||||
}
|
||||
|
||||
namespace {
|
||||
MouseDownImpl g_nsthemeframe_mousedown;
|
||||
MouseDownImpl g_nsnextstepframe_mousedown;
|
||||
@@ -125,6 +160,7 @@ void SwizzleSwipeWithEvent(NSView* view, SEL swiz_selector) {
|
||||
|
||||
- (id)initWithShell:(electron::NativeWindowMac*)shell
|
||||
styleMask:(NSUInteger)styleMask {
|
||||
SwizzleTabPickerGridAnimation();
|
||||
if ((self = [super initWithContentRect:ui::kWindowSizeDeterminedLater
|
||||
styleMask:styleMask
|
||||
backing:NSBackingStoreBuffered
|
||||
|
||||
@@ -60,16 +60,22 @@ std::u16string ElectronMenuModel::GetRoleAt(size_t index) {
|
||||
return iter == std::end(roles_) ? std::u16string() : iter->second;
|
||||
}
|
||||
|
||||
void ElectronMenuModel::SetSecondaryLabel(size_t index,
|
||||
const std::u16string& sublabel) {
|
||||
int command_id = GetCommandIdAt(index);
|
||||
sublabels_[command_id] = sublabel;
|
||||
std::u16string ElectronMenuModel::GetLabelAt(size_t index) const {
|
||||
if (delegate_)
|
||||
return delegate_->GetLabelForCommandId(GetCommandIdAt(index));
|
||||
return std::u16string();
|
||||
}
|
||||
|
||||
std::u16string ElectronMenuModel::GetSecondaryLabelAt(size_t index) const {
|
||||
int command_id = GetCommandIdAt(index);
|
||||
const auto iter = sublabels_.find(command_id);
|
||||
return iter == std::end(sublabels_) ? std::u16string() : iter->second;
|
||||
if (delegate_)
|
||||
return delegate_->GetSecondaryLabelForCommandId(GetCommandIdAt(index));
|
||||
return std::u16string();
|
||||
}
|
||||
|
||||
ui::ImageModel ElectronMenuModel::GetIconAt(size_t index) const {
|
||||
if (delegate_)
|
||||
return delegate_->GetIconForCommandId(GetCommandIdAt(index));
|
||||
return ui::ImageModel();
|
||||
}
|
||||
|
||||
bool ElectronMenuModel::GetAcceleratorAtWithParams(
|
||||
|
||||
@@ -88,8 +88,9 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
|
||||
std::u16string GetCustomTypeAt(size_t index);
|
||||
void SetRole(size_t index, const std::u16string& role);
|
||||
std::u16string GetRoleAt(size_t index);
|
||||
void SetSecondaryLabel(size_t index, const std::u16string& sublabel);
|
||||
std::u16string GetLabelAt(size_t index) const override;
|
||||
std::u16string GetSecondaryLabelAt(size_t index) const override;
|
||||
ui::ImageModel GetIconAt(size_t index) const override;
|
||||
bool GetAcceleratorAtWithParams(size_t index,
|
||||
bool use_default_accelerator,
|
||||
ui::Accelerator* accelerator) const;
|
||||
@@ -124,9 +125,8 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
|
||||
std::optional<SharingItem> sharing_item_;
|
||||
#endif
|
||||
|
||||
base::flat_map<int, std::u16string> toolTips_; // command id -> tooltip
|
||||
base::flat_map<int, std::u16string> roles_; // command id -> role
|
||||
base::flat_map<int, std::u16string> sublabels_; // command id -> sublabel
|
||||
base::flat_map<int, std::u16string> toolTips_; // command id -> tooltip
|
||||
base::flat_map<int, std::u16string> roles_; // command id -> role
|
||||
base::flat_map<int, std::u16string>
|
||||
customTypes_; // command id -> custom type
|
||||
base::ObserverList<Observer> observers_;
|
||||
|
||||
@@ -82,11 +82,13 @@ GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap) {
|
||||
constexpr GdkColorspace kColorspace = GDK_COLORSPACE_RGB;
|
||||
constexpr gboolean kHasAlpha = true;
|
||||
constexpr int kBitsPerSample = 8;
|
||||
return gdk_pixbuf_new_from_bytes(
|
||||
g_bytes_new(std::data(bytes), std::size(bytes)), kColorspace, kHasAlpha,
|
||||
kBitsPerSample, width, height,
|
||||
GBytes* gbytes = g_bytes_new(std::data(bytes), std::size(bytes));
|
||||
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_bytes(
|
||||
gbytes, kColorspace, kHasAlpha, kBitsPerSample, width, height,
|
||||
gdk_pixbuf_calculate_rowstride(kColorspace, kHasAlpha, kBitsPerSample,
|
||||
width, height));
|
||||
g_bytes_unref(gbytes);
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
} // namespace gtk_util
|
||||
|
||||
@@ -62,9 +62,9 @@ class InspectableWebContentsView : public views::View {
|
||||
// views::View:
|
||||
void Layout(PassKey) override;
|
||||
|
||||
private:
|
||||
views::View* GetContentsView() const;
|
||||
|
||||
private:
|
||||
// Owns us.
|
||||
raw_ptr<InspectableWebContents> inspectable_web_contents_;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "components/input/native_web_keyboard_event.h"
|
||||
#include "shell/browser/native_window.h"
|
||||
#include "shell/browser/ui/views/menu_bar.h"
|
||||
#include "ui/events/keycodes/dom/keycode_converter.h"
|
||||
#include "ui/views/layout/box_layout.h"
|
||||
|
||||
namespace electron {
|
||||
@@ -21,9 +22,21 @@ bool IsAltKey(const input::NativeWebKeyboardEvent& event) {
|
||||
|
||||
bool IsAltModifier(const input::NativeWebKeyboardEvent& event) {
|
||||
using Mods = input::NativeWebKeyboardEvent::Modifiers;
|
||||
|
||||
// AltGraph (AltGr) should not be treated as a single Alt keypress for
|
||||
// menu-bar toggling.
|
||||
if (event.windows_key_code == ui::VKEY_ALTGR ||
|
||||
ui::KeycodeConverter::DomKeyToKeyString(event.dom_key) == "AltGraph") {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (event.GetModifiers() & Mods::kKeyModifiers) == Mods::kAltKey;
|
||||
}
|
||||
|
||||
bool IsSingleAltKey(const input::NativeWebKeyboardEvent& event) {
|
||||
return IsAltKey(event) && IsAltModifier(event);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
RootView::RootView(NativeWindow* window)
|
||||
@@ -98,7 +111,7 @@ void RootView::HandleKeyEvent(const input::NativeWebKeyboardEvent& event) {
|
||||
return;
|
||||
|
||||
// Show accelerator when "Alt" is pressed.
|
||||
if (menu_bar_visible_ && IsAltKey(event))
|
||||
if (menu_bar_visible_ && IsSingleAltKey(event))
|
||||
menu_bar_->SetAcceleratorVisibility(
|
||||
event.GetType() == blink::WebInputEvent::Type::kRawKeyDown);
|
||||
|
||||
@@ -121,11 +134,11 @@ void RootView::HandleKeyEvent(const input::NativeWebKeyboardEvent& event) {
|
||||
|
||||
// Toggle the menu bar only when a single Alt is released.
|
||||
if (event.GetType() == blink::WebInputEvent::Type::kRawKeyDown &&
|
||||
IsAltKey(event)) {
|
||||
IsSingleAltKey(event)) {
|
||||
// When a single Alt is pressed:
|
||||
menu_bar_alt_pressed_ = true;
|
||||
} else if (event.GetType() == blink::WebInputEvent::Type::kKeyUp &&
|
||||
IsAltKey(event) && menu_bar_alt_pressed_) {
|
||||
IsSingleAltKey(event) && menu_bar_alt_pressed_) {
|
||||
// When a single Alt is released right after a Alt is pressed:
|
||||
menu_bar_alt_pressed_ = false;
|
||||
if (menu_bar_autohide_)
|
||||
|
||||
@@ -197,6 +197,14 @@ void ElectronDesktopWindowTreeHostWin::SetAllowScreenshots(bool allow) {
|
||||
UpdateAllowScreenshots();
|
||||
}
|
||||
|
||||
// Refs https://chromium-review.googlesource.com/c/chromium/src/+/7095963
|
||||
// Chromium's fullscreen handler conflicts with ours and results in incorrect
|
||||
// restoration.
|
||||
void ElectronDesktopWindowTreeHostWin::Restore() {
|
||||
::SendMessage(GetAcceleratedWidget(), WM_SYSCOMMAND,
|
||||
static_cast<WPARAM>(SC_RESTORE), 0);
|
||||
}
|
||||
|
||||
void ElectronDesktopWindowTreeHostWin::UpdateAllowScreenshots() {
|
||||
bool allowed = views::DesktopWindowTreeHostWin::AreScreenshotsAllowed();
|
||||
if (allowed == allow_screenshots_)
|
||||
|
||||
@@ -50,6 +50,7 @@ class ElectronDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin,
|
||||
LRESULT* result) override;
|
||||
void HandleVisibilityChanged(bool visible) override;
|
||||
void SetAllowScreenshots(bool allow) override;
|
||||
void Restore() override;
|
||||
|
||||
// ui::NativeThemeObserver:
|
||||
void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;
|
||||
|
||||
@@ -68,6 +68,7 @@ gin::WeakCell<api::Session>* UsbChooserController::GetSession() {
|
||||
void UsbChooserController::OnDeviceAdded(
|
||||
const device::mojom::UsbDeviceInfo& device_info) {
|
||||
if (DisplayDevice(device_info)) {
|
||||
devices_.push_back(device_info.Clone());
|
||||
gin::WeakCell<api::Session>* session = GetSession();
|
||||
if (session && session->Get()) {
|
||||
session->Get()->Emit("usb-device-added", device_info.Clone(),
|
||||
@@ -78,6 +79,9 @@ void UsbChooserController::OnDeviceAdded(
|
||||
|
||||
void UsbChooserController::OnDeviceRemoved(
|
||||
const device::mojom::UsbDeviceInfo& device_info) {
|
||||
std::erase_if(devices_, [&device_info](const auto& device) {
|
||||
return device->guid == device_info.guid;
|
||||
});
|
||||
gin::WeakCell<api::Session>* session = GetSession();
|
||||
if (session && session->Get()) {
|
||||
session->Get()->Emit("usb-device-removed", device_info.Clone(),
|
||||
@@ -90,9 +94,11 @@ void UsbChooserController::OnDeviceChosen(gin::Arguments* args) {
|
||||
if (!args->GetNext(&device_id) || device_id.empty()) {
|
||||
RunCallback(/*device_info=*/nullptr);
|
||||
} else {
|
||||
auto* device_info = chooser_context_->GetDeviceInfo(device_id);
|
||||
if (device_info) {
|
||||
RunCallback(device_info->Clone());
|
||||
const auto it = std::ranges::find_if(
|
||||
devices_,
|
||||
[&device_id](const auto& device) { return device->guid == device_id; });
|
||||
if (it != devices_.end()) {
|
||||
RunCallback((*it)->Clone());
|
||||
} else {
|
||||
util::EmitWarning(
|
||||
base::StrCat({"The device id ", device_id, " was not found."}),
|
||||
@@ -127,6 +133,11 @@ void UsbChooserController::GotUsbDeviceList(
|
||||
return !DisplayDevice(*device_info);
|
||||
});
|
||||
|
||||
devices_.clear();
|
||||
for (const auto& device : devices) {
|
||||
devices_.push_back(device->Clone());
|
||||
}
|
||||
|
||||
v8::Local<v8::Object> details = gin::DataObjectBuilder(isolate)
|
||||
.Set("deviceList", devices)
|
||||
.Set("frame", rfh)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef ELECTRON_SHELL_BROWSER_USB_USB_CHOOSER_CONTROLLER_H_
|
||||
#define ELECTRON_SHELL_BROWSER_USB_USB_CHOOSER_CONTROLLER_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
@@ -75,6 +76,9 @@ class UsbChooserController final : private UsbChooserContext::DeviceObserver,
|
||||
|
||||
base::WeakPtr<ElectronUsbDelegate> usb_delegate_;
|
||||
|
||||
// Filtered list of devices that passed DisplayDevice()
|
||||
std::vector<device::mojom::UsbDeviceInfoPtr> devices_;
|
||||
|
||||
content::GlobalRenderFrameHostId render_frame_host_id_;
|
||||
|
||||
base::WeakPtrFactory<UsbChooserController> weak_factory_{this};
|
||||
|
||||
@@ -135,7 +135,6 @@ void WebContentsPreferences::Clear() {
|
||||
default_encoding_ = std::nullopt;
|
||||
is_webview_ = false;
|
||||
custom_args_.clear();
|
||||
custom_switches_.clear();
|
||||
enable_blink_features_ = std::nullopt;
|
||||
disable_blink_features_ = std::nullopt;
|
||||
disable_popups_ = false;
|
||||
@@ -149,6 +148,7 @@ void WebContentsPreferences::Clear() {
|
||||
preload_path_ = std::nullopt;
|
||||
v8_cache_options_ = blink::mojom::V8CacheOptions::kDefault;
|
||||
deprecated_paste_enabled_ = false;
|
||||
focus_on_navigation_ = true;
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
scroll_bounce_ = false;
|
||||
@@ -203,7 +203,6 @@ void WebContentsPreferences::SetFromDictionary(
|
||||
if (web_preferences.Get("defaultEncoding", &encoding))
|
||||
default_encoding_ = encoding;
|
||||
web_preferences.Get(options::kCustomArgs, &custom_args_);
|
||||
web_preferences.Get("commandLineSwitches", &custom_switches_);
|
||||
web_preferences.Get("disablePopups", &disable_popups_);
|
||||
web_preferences.Get("disableDialogs", &disable_dialogs_);
|
||||
web_preferences.Get("safeDialogs", &safe_dialogs_);
|
||||
@@ -249,6 +248,8 @@ void WebContentsPreferences::SetFromDictionary(
|
||||
web_preferences.Get(options::kEnableDeprecatedPaste,
|
||||
&deprecated_paste_enabled_);
|
||||
|
||||
web_preferences.Get(options::kFocusOnNavigation, &focus_on_navigation_);
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
web_preferences.Get(options::kScrollBounce, &scroll_bounce_);
|
||||
#endif
|
||||
@@ -335,11 +336,6 @@ void WebContentsPreferences::AppendCommandLineSwitches(
|
||||
if (!arg.empty())
|
||||
command_line->AppendArg(arg);
|
||||
|
||||
// Custom command line switches.
|
||||
for (const auto& arg : custom_switches_)
|
||||
if (!arg.empty())
|
||||
command_line->AppendSwitch(arg);
|
||||
|
||||
if (enable_blink_features_)
|
||||
command_line->AppendSwitchASCII(::switches::kEnableBlinkFeatures,
|
||||
*enable_blink_features_);
|
||||
|
||||
@@ -78,6 +78,7 @@ class WebContentsPreferences
|
||||
bool ShouldDisablePopups() const { return disable_popups_; }
|
||||
bool IsWebSecurityEnabled() const { return web_security_; }
|
||||
std::optional<base::FilePath> GetPreloadPath() const { return preload_path_; }
|
||||
bool ShouldFocusOnNavigation() const { return focus_on_navigation_; }
|
||||
bool IsSandboxed() const;
|
||||
|
||||
private:
|
||||
@@ -121,7 +122,6 @@ class WebContentsPreferences
|
||||
std::optional<std::string> default_encoding_;
|
||||
bool is_webview_;
|
||||
std::vector<std::string> custom_args_;
|
||||
std::vector<std::string> custom_switches_;
|
||||
std::optional<std::string> enable_blink_features_;
|
||||
std::optional<std::string> disable_blink_features_;
|
||||
bool disable_popups_;
|
||||
@@ -134,6 +134,7 @@ class WebContentsPreferences
|
||||
std::optional<base::FilePath> preload_path_;
|
||||
blink::mojom::V8CacheOptions v8_cache_options_;
|
||||
bool deprecated_paste_enabled_ = false;
|
||||
bool focus_on_navigation_;
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
bool scroll_bounce_;
|
||||
|
||||
@@ -413,6 +413,7 @@ bool IsAllowedOption(const std::string_view option) {
|
||||
"--inspect-port",
|
||||
"--inspect-publish-uid",
|
||||
"--experimental-network-inspection",
|
||||
"--experimental-transform-types",
|
||||
});
|
||||
|
||||
// This should be aligned with what's possible to set via the process object.
|
||||
|
||||
@@ -186,6 +186,8 @@ inline constexpr std::string_view kUseSharedTexture = "useSharedTexture";
|
||||
inline constexpr std::string_view kSharedTexturePixelFormat =
|
||||
"sharedTexturePixelFormat";
|
||||
|
||||
inline constexpr std::string_view kDeviceScaleFactor = "deviceScaleFactor";
|
||||
|
||||
inline constexpr std::string_view kNodeIntegrationInSubFrames =
|
||||
"nodeIntegrationInSubFrames";
|
||||
|
||||
@@ -222,6 +224,9 @@ inline constexpr std::string_view kSpellcheck = "spellcheck";
|
||||
inline constexpr std::string_view kEnableDeprecatedPaste =
|
||||
"enableDeprecatedPaste";
|
||||
|
||||
// Whether to focus the webContents on navigation.
|
||||
inline constexpr std::string_view kFocusOnNavigation = "focusOnNavigation";
|
||||
|
||||
inline constexpr std::string_view kModal = "modal";
|
||||
|
||||
} // namespace options
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
#include "dbus/bus.h"
|
||||
#include "dbus/message.h"
|
||||
#include "dbus/object_proxy.h"
|
||||
#include "ui/gtk/gtk_compat.h" // nogncheck
|
||||
|
||||
#include "electron/electron_gtk_stubs.h"
|
||||
#include "shell/common/platform_util_internal.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
@@ -405,6 +407,16 @@ bool PlatformTrashItem(const base::FilePath& full_path, std::string* error) {
|
||||
} // namespace internal
|
||||
|
||||
void Beep() {
|
||||
// `gdk_display_beep` is actually stubbed out, and the function pointer the
|
||||
// stub uses may be nullptr. We need to initialize the stub here to ensure
|
||||
// that is not the case so that we can avoid a crash.
|
||||
// TODO: move this elsewhere if / when we start using stubs for more
|
||||
// GDK functions than just `gdk_display_beep`.
|
||||
if (!electron::IsElectron_gdkInitialized()) {
|
||||
electron::InitializeElectron_gdk(gtk::GetLibGdk());
|
||||
CHECK(electron::IsElectron_gdkInitialized())
|
||||
<< "Failed to initialize libgdk";
|
||||
}
|
||||
auto* display = gdk_display_get_default();
|
||||
if (!display)
|
||||
return;
|
||||
|
||||
@@ -423,8 +423,9 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContextInner(
|
||||
blink::VideoFrame* video_frame =
|
||||
blink::V8VideoFrame::ToWrappable(source_isolate, value);
|
||||
if (video_frame != nullptr) {
|
||||
v8::Context::Scope destination_context_scope(destination_context);
|
||||
blink::ScriptState* script_state =
|
||||
blink::ScriptState::ForCurrentRealm(destination_isolate);
|
||||
blink::ScriptState::From(destination_isolate, destination_context);
|
||||
return v8::MaybeLocal<v8::Value>(
|
||||
blink::ToV8Traits<blink::VideoFrame>::ToV8(script_state,
|
||||
video_frame));
|
||||
@@ -905,7 +906,7 @@ bool OverrideGlobalPropertyFromIsolatedWorld(
|
||||
}
|
||||
if (!setter->IsNullOrUndefined() && setter->IsObject()) {
|
||||
v8::Local<v8::Context> source_context =
|
||||
getter->GetCreationContextChecked(isolate);
|
||||
setter.As<v8::Object>()->GetCreationContextChecked(isolate);
|
||||
v8::MaybeLocal<v8::Value> maybe_setter_proxy = PassValueToOtherContext(
|
||||
isolate, source_context, isolate, main_context, setter,
|
||||
source_context->Global(), false, BridgeErrorTarget::kSource);
|
||||
|
||||
@@ -3983,6 +3983,28 @@ describe('BrowserWindow module', () => {
|
||||
expect(webPreferences!.contextIsolation).to.equal(false);
|
||||
});
|
||||
|
||||
it('should apply zoomFactor from setWindowOpenHandler overrideBrowserWindowOptions', async () => {
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
sandbox: true
|
||||
}
|
||||
});
|
||||
|
||||
w.webContents.setWindowOpenHandler(() => ({
|
||||
action: 'allow',
|
||||
overrideBrowserWindowOptions: {
|
||||
webPreferences: {
|
||||
zoomFactor: 2.0
|
||||
}
|
||||
}
|
||||
}));
|
||||
w.loadFile(path.join(fixtures, 'api', 'new-window.html'));
|
||||
const [childWindow] = await once(w.webContents, 'did-create-window') as [BrowserWindow, any];
|
||||
await once(childWindow.webContents, 'did-finish-load');
|
||||
expect(childWindow.webContents.getZoomFactor()).to.be.closeTo(2.0, 0.1);
|
||||
});
|
||||
|
||||
it('should set ipc event sender correctly', async () => {
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
@@ -4888,6 +4910,27 @@ describe('BrowserWindow module', () => {
|
||||
await restore;
|
||||
expect(w.isMaximized()).to.equal(true);
|
||||
});
|
||||
|
||||
ifit(process.platform !== 'linux')('should not break fullscreen state', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
w.show();
|
||||
|
||||
const enterFS = once(w, 'enter-full-screen');
|
||||
w.setFullScreen(true);
|
||||
await enterFS;
|
||||
expect(w.isFullScreen()).to.be.true('not fullscreen');
|
||||
|
||||
w.restore();
|
||||
await setTimeout(1000);
|
||||
|
||||
expect(w.isFullScreen()).to.be.true('not fullscreen after restore');
|
||||
expect(w.isMinimized()).to.be.false('should not be minimized');
|
||||
|
||||
// Clean up fullscreen state.
|
||||
const leaveFS = once(w, 'leave-full-screen');
|
||||
w.setFullScreen(false);
|
||||
await leaveFS;
|
||||
});
|
||||
});
|
||||
|
||||
// TODO(dsanders11): Enable once maximize event works on Linux again on CI
|
||||
@@ -5888,20 +5931,43 @@ describe('BrowserWindow module', () => {
|
||||
});
|
||||
});
|
||||
|
||||
ifdescribe(process.platform === 'linux')('menu bar AltGr behavior', () => {
|
||||
it('does not toggle auto-hide menu bar visibility', async () => {
|
||||
const w = new BrowserWindow({ show: false, autoHideMenuBar: true });
|
||||
w.setMenuBarVisibility(false);
|
||||
expect(w.isMenuBarVisible()).to.be.false('isMenuBarVisible');
|
||||
|
||||
w.show();
|
||||
await once(w, 'show');
|
||||
w.webContents.focus();
|
||||
w.webContents.sendInputEvent({ type: 'keyDown', keyCode: 'AltGr' });
|
||||
w.webContents.sendInputEvent({ type: 'keyUp', keyCode: 'AltGr' });
|
||||
await setTimeout();
|
||||
|
||||
expect(w.isMenuBarVisible()).to.be.false('isMenuBarVisible');
|
||||
});
|
||||
});
|
||||
|
||||
ifdescribe(process.platform !== 'darwin')('when fullscreen state is changed', () => {
|
||||
it('correctly remembers state prior to fullscreen change', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
|
||||
// This should do nothing.
|
||||
w.setFullScreen(false);
|
||||
|
||||
expect(w.isMenuBarVisible()).to.be.true('isMenuBarVisible');
|
||||
w.setMenuBarVisibility(false);
|
||||
expect(w.isMenuBarVisible()).to.be.false('isMenuBarVisible');
|
||||
|
||||
const enterFS = once(w, 'enter-full-screen');
|
||||
w.setFullScreen(true);
|
||||
w.setFullScreen(true); // This should do nothing.
|
||||
await enterFS;
|
||||
expect(w.fullScreen).to.be.true('not fullscreen');
|
||||
|
||||
const exitFS = once(w, 'leave-full-screen');
|
||||
w.setFullScreen(false);
|
||||
w.setFullScreen(false); // This should do nothing.
|
||||
await exitFS;
|
||||
expect(w.fullScreen).to.be.false('not fullscreen');
|
||||
|
||||
@@ -5918,11 +5984,13 @@ describe('BrowserWindow module', () => {
|
||||
|
||||
const enterFS = once(w, 'enter-full-screen');
|
||||
w.setFullScreen(true);
|
||||
w.setFullScreen(true); // This should do nothing.
|
||||
await enterFS;
|
||||
expect(w.fullScreen).to.be.true('not fullscreen');
|
||||
|
||||
const exitFS = once(w, 'leave-full-screen');
|
||||
w.setFullScreen(false);
|
||||
w.setFullScreen(false); // This should do nothing.
|
||||
await exitFS;
|
||||
expect(w.fullScreen).to.be.false('not fullscreen');
|
||||
|
||||
@@ -5935,6 +6003,9 @@ describe('BrowserWindow module', () => {
|
||||
const w = new BrowserWindow();
|
||||
await w.loadFile(path.join(fixtures, 'pages', 'a.html'));
|
||||
|
||||
// This should do nothing.
|
||||
w.setFullScreen(false);
|
||||
|
||||
expect(w.isMenuBarVisible()).to.be.true('isMenuBarVisible');
|
||||
expect(w.isFullScreen()).to.be.false('is fullscreen');
|
||||
|
||||
@@ -6728,6 +6799,7 @@ describe('BrowserWindow module', () => {
|
||||
expect(data.constructor.name).to.equal('NativeImage');
|
||||
expect(data.isEmpty()).to.be.false('data is empty');
|
||||
const size = data.getSize();
|
||||
// TODO(reito): Use scale factor 1.0f when Electron 42.
|
||||
const { scaleFactor } = screen.getPrimaryDisplay();
|
||||
expect(size.width).to.be.closeTo(100 * scaleFactor, 2);
|
||||
expect(size.height).to.be.closeTo(100 * scaleFactor, 2);
|
||||
@@ -6822,6 +6894,66 @@ describe('BrowserWindow module', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('offscreen rendering with device scale factor', () => {
|
||||
let w: BrowserWindow;
|
||||
const scaleFactor = 1.5;
|
||||
|
||||
beforeEach(function () {
|
||||
w = new BrowserWindow({
|
||||
width: 100,
|
||||
height: 100,
|
||||
show: false,
|
||||
webPreferences: {
|
||||
backgroundThrottling: false,
|
||||
offscreen: {
|
||||
deviceScaleFactor: scaleFactor
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
afterEach(closeAllWindows);
|
||||
|
||||
it('creates offscreen window with correct size considering device scale factor', async () => {
|
||||
const paint = once(w.webContents, 'paint') as Promise<[any, Electron.Rectangle, Electron.NativeImage]>;
|
||||
w.loadFile(path.join(fixtures, 'api', 'offscreen-rendering.html'));
|
||||
const [, , data] = await paint;
|
||||
expect(data.constructor.name).to.equal('NativeImage');
|
||||
expect(data.isEmpty()).to.be.false('data is empty');
|
||||
const size = data.getSize();
|
||||
expect(size.width).to.be.closeTo(100 * scaleFactor, 2);
|
||||
expect(size.height).to.be.closeTo(100 * scaleFactor, 2);
|
||||
});
|
||||
|
||||
it('has correct screen and window sizes', async () => {
|
||||
w.loadFile(path.join(fixtures, 'api', 'offscreen-rendering.html'));
|
||||
await once(w.webContents, 'dom-ready');
|
||||
const sizes = await w.webContents.executeJavaScript(`
|
||||
new Promise((resolve) => {
|
||||
const screenSize = [screen.width, screen.height];
|
||||
const outerSize = [window.outerWidth, window.outerHeight];
|
||||
const dpr = window.devicePixelRatio;
|
||||
resolve({ screenSize, outerSize, dpr });
|
||||
});
|
||||
`);
|
||||
expect(sizes.screenSize).to.deep.equal([100, 100]);
|
||||
expect(sizes.outerSize).to.deep.equal([100, 100]);
|
||||
expect(sizes.dpr).to.be.equal(scaleFactor);
|
||||
});
|
||||
|
||||
it('has correct device screen size media query result', async () => {
|
||||
w.loadFile(path.join(fixtures, 'api', 'offscreen-rendering.html'));
|
||||
await once(w.webContents, 'dom-ready');
|
||||
const query = `(device-width: ${100}px)`;
|
||||
const matches = await w.webContents.executeJavaScript(`
|
||||
new Promise((resolve) => {
|
||||
const mediaQuery = window.matchMedia('${query}');
|
||||
resolve(mediaQuery.matches);
|
||||
});
|
||||
`);
|
||||
expect(matches).to.be.true();
|
||||
});
|
||||
});
|
||||
|
||||
describe('"transparent" option', () => {
|
||||
afterEach(closeAllWindows);
|
||||
|
||||
|
||||
@@ -666,6 +666,46 @@ describe('contextBridge', () => {
|
||||
expect(result).to.deep.equal(['1245']);
|
||||
});
|
||||
|
||||
it('should handle VideoFrames', async () => {
|
||||
await makeBindingWindow(() => {
|
||||
contextBridge.exposeInMainWorld('example', {
|
||||
getVideoFrame: () => {
|
||||
const canvas = new OffscreenCanvas(16, 16);
|
||||
canvas.getContext('2d')!.fillRect(0, 0, 16, 16);
|
||||
return new VideoFrame(canvas, { timestamp: 0 });
|
||||
}
|
||||
});
|
||||
});
|
||||
const result = await callWithBindings((root: any) => {
|
||||
const frame = root.example.getVideoFrame();
|
||||
const info = [frame.constructor.name, frame.codedWidth, frame.codedHeight, frame.timestamp];
|
||||
frame.close();
|
||||
return info;
|
||||
});
|
||||
expect(result).to.deep.equal(['VideoFrame', 16, 16, 0]);
|
||||
});
|
||||
|
||||
it('should handle VideoFrames going backwards over the bridge', async () => {
|
||||
await makeBindingWindow(() => {
|
||||
contextBridge.exposeInMainWorld('example', {
|
||||
getVideoFrameInfo: (fn: Function) => {
|
||||
const frame = fn();
|
||||
const info = [frame.constructor.name, frame.codedWidth, frame.codedHeight, frame.timestamp];
|
||||
frame.close();
|
||||
return info;
|
||||
}
|
||||
});
|
||||
});
|
||||
const result = await callWithBindings((root: any) => {
|
||||
return root.example.getVideoFrameInfo(() => {
|
||||
const canvas = new OffscreenCanvas(32, 32);
|
||||
canvas.getContext('2d')!.fillRect(0, 0, 32, 32);
|
||||
return new VideoFrame(canvas, { timestamp: 100 });
|
||||
});
|
||||
});
|
||||
expect(result).to.deep.equal(['VideoFrame', 32, 32, 100]);
|
||||
});
|
||||
|
||||
// Can only run tests which use the GCRunner in non-sandboxed environments
|
||||
if (!useSandbox) {
|
||||
it('should release the global hold on methods sent across contexts', async () => {
|
||||
@@ -904,7 +944,12 @@ describe('contextBridge', () => {
|
||||
[Symbol('foo')]: 123
|
||||
},
|
||||
getBody: () => document.body,
|
||||
getBlob: () => new Blob(['ab', 'cd'])
|
||||
getBlob: () => new Blob(['ab', 'cd']),
|
||||
getVideoFrame: () => {
|
||||
const canvas = new OffscreenCanvas(16, 16);
|
||||
canvas.getContext('2d')!.fillRect(0, 0, 16, 16);
|
||||
return new VideoFrame(canvas, { timestamp: 0 });
|
||||
}
|
||||
});
|
||||
});
|
||||
const result = await callWithBindings(async (root: any) => {
|
||||
@@ -978,7 +1023,8 @@ describe('contextBridge', () => {
|
||||
[arg, Object],
|
||||
[arg.key, String],
|
||||
[example.getBody(), HTMLBodyElement],
|
||||
[example.getBlob(), Blob]
|
||||
[example.getBlob(), Blob],
|
||||
[example.getVideoFrame(), VideoFrame]
|
||||
];
|
||||
return {
|
||||
protoMatches: protoChecks.map(([a, Constructor]) => Object.getPrototypeOf(a) === Constructor.prototype)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user