mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
Compare commits
16 Commits
v26.0.0-be
...
v26.0.0-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6771299fc2 | ||
|
|
b656337b43 | ||
|
|
fbfef19768 | ||
|
|
6b61917d4b | ||
|
|
d47fa5f787 | ||
|
|
9ee4cb49bc | ||
|
|
6a4bb4f6fd | ||
|
|
95855906d0 | ||
|
|
f184603992 | ||
|
|
26aa910d43 | ||
|
|
8655990d83 | ||
|
|
a175e1f69a | ||
|
|
038147b6bc | ||
|
|
03ed9531d4 | ||
|
|
24f2379892 | ||
|
|
9d5a25bf37 |
@@ -60,6 +60,10 @@ dependencies, and tools contained in the `electron/electron` repository.
|
||||
* [Step 11: Landing](https://electronjs.org/docs/development/pull-requests#step-11-landing)
|
||||
* [Continuous Integration Testing](https://electronjs.org/docs/development/pull-requests#continuous-integration-testing)
|
||||
|
||||
### Dependencies Upgrades Policy
|
||||
|
||||
Dependencies in Electron's `package.json` or `yarn.lock` files should only be altered by maintainers. For security reasons, we will not accept PRs that alter our `package.json` or `yarn.lock` files. We invite contributors to make requests updating these files in our issue tracker. If the change is significantly complicated, draft PRs are welcome, with the understanding that these PRs will be closed in favor of a duplicate PR submitted by an Electron maintainer.
|
||||
|
||||
## Style Guides
|
||||
|
||||
See [Coding Style](https://electronjs.org/docs/development/coding-style) for information about which standards Electron adheres to in different parts of its codebase.
|
||||
|
||||
2
DEPS
2
DEPS
@@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'116.0.5845.14',
|
||||
'116.0.5845.42',
|
||||
'node_version':
|
||||
'v18.16.1',
|
||||
'nan_version':
|
||||
|
||||
@@ -201,16 +201,28 @@ for:
|
||||
on_finish:
|
||||
# Uncomment this lines to enable RDP
|
||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
- cd C:\projects\src
|
||||
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
|
||||
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
|
||||
- if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
|
||||
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
|
||||
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
|
||||
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
|
||||
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
|
||||
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
|
||||
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
|
||||
- ps: |
|
||||
cd C:\projects\src
|
||||
$missing_artifacts = $false
|
||||
$artifacts_to_upload = @('dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip')
|
||||
foreach($artifact_name in $artifacts_to_upload) {
|
||||
if ($artifact_name -eq 'ffmpeg.zip') {
|
||||
$artifact_file = "out\ffmpeg\ffmpeg.zip"
|
||||
} elseif ($artifact_name -eq 'node_headers.zip') {
|
||||
$artifact_file = $artifact_name
|
||||
} else {
|
||||
$artifact_file = "out\Default\$artifact_name"
|
||||
}
|
||||
if (Test-Path $artifact_file) {
|
||||
appveyor-retry appveyor PushArtifact $artifact_file
|
||||
} else {
|
||||
Write-warning "$artifact_name is missing and cannot be added to artifacts"
|
||||
$missing_artifacts = $true
|
||||
}
|
||||
}
|
||||
if ($missing_artifacts) {
|
||||
throw "Build failed due to missing artifacts"
|
||||
}
|
||||
- ps: >-
|
||||
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
|
||||
appveyor-retry appveyor PushArtifact pdb.zip
|
||||
@@ -243,7 +255,7 @@ for:
|
||||
# Download build artifacts
|
||||
$apiUrl = 'https://ci.appveyor.com/api'
|
||||
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
|
||||
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','pdb.zip','electron.lib')
|
||||
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','electron.lib')
|
||||
foreach ($job in $build_info.build.jobs) {
|
||||
if ($job.name -eq "Build Arm on X64 Windows") {
|
||||
$jobId = $job.jobId
|
||||
@@ -255,10 +267,13 @@ for:
|
||||
}
|
||||
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
|
||||
}
|
||||
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
|
||||
# Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
|
||||
# 7z x -y -osrc pdb.zip
|
||||
}
|
||||
}
|
||||
- ps: |
|
||||
$out_default_zips = @('dist.zip','pdb.zip')
|
||||
$out_default_zips = @('dist.zip')
|
||||
foreach($zip_name in $out_default_zips) {
|
||||
7z x -y -osrc\out\Default $zip_name
|
||||
}
|
||||
|
||||
35
appveyor.yml
35
appveyor.yml
@@ -199,16 +199,28 @@ for:
|
||||
on_finish:
|
||||
# Uncomment this lines to enable RDP
|
||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
- cd C:\projects\src
|
||||
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
|
||||
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
|
||||
- if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
|
||||
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
|
||||
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
|
||||
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
|
||||
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
|
||||
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
|
||||
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
|
||||
- ps: |
|
||||
cd C:\projects\src
|
||||
$missing_artifacts = $false
|
||||
$artifacts_to_upload = @('dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip')
|
||||
foreach($artifact_name in $artifacts_to_upload) {
|
||||
if ($artifact_name -eq 'ffmpeg.zip') {
|
||||
$artifact_file = "out\ffmpeg\ffmpeg.zip"
|
||||
} elseif ($artifact_name -eq 'node_headers.zip') {
|
||||
$artifact_file = $artifact_name
|
||||
} else {
|
||||
$artifact_file = "out\Default\$artifact_name"
|
||||
}
|
||||
if (Test-Path $artifact_file) {
|
||||
appveyor-retry appveyor PushArtifact $artifact_file
|
||||
} else {
|
||||
Write-warning "$artifact_name is missing and cannot be added to artifacts"
|
||||
$missing_artifacts = $true
|
||||
}
|
||||
}
|
||||
if ($missing_artifacts) {
|
||||
throw "Build failed due to missing artifacts"
|
||||
}
|
||||
- ps: >-
|
||||
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
|
||||
appveyor-retry appveyor PushArtifact pdb.zip
|
||||
@@ -251,6 +263,9 @@ for:
|
||||
}
|
||||
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
|
||||
}
|
||||
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
|
||||
# Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
|
||||
# 7z x -y -osrc pdb.zip
|
||||
}
|
||||
}
|
||||
- ps: |
|
||||
|
||||
@@ -110,7 +110,7 @@ provided to the renderer process. Please refer to
|
||||
|
||||
* `channel` string
|
||||
* `listener` Function<Promise\<void> | any>
|
||||
* `event` IpcMainInvokeEvent
|
||||
* `event` [IpcMainInvokeEvent][ipc-main-invoke-event]
|
||||
* `...args` any[]
|
||||
|
||||
Handles a single `invoke`able IPC message, then removes the listener. See
|
||||
@@ -122,17 +122,6 @@ Handles a single `invoke`able IPC message, then removes the listener. See
|
||||
|
||||
Removes any handler for `channel`, if present.
|
||||
|
||||
## IpcMainEvent object
|
||||
|
||||
The documentation for the `event` object passed to the `callback` can be found
|
||||
in the [`ipc-main-event`][ipc-main-event] structure docs.
|
||||
|
||||
## IpcMainInvokeEvent object
|
||||
|
||||
The documentation for the `event` object passed to `handle` callbacks can be
|
||||
found in the [`ipc-main-invoke-event`][ipc-main-invoke-event]
|
||||
structure docs.
|
||||
|
||||
[IPC tutorial]: ../tutorial/ipc.md
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[web-contents-send]: ../api/web-contents.md#contentssendchannel-args
|
||||
|
||||
@@ -26,7 +26,7 @@ The `ipcRenderer` module has the following method to listen for events and send
|
||||
|
||||
* `channel` string
|
||||
* `listener` Function
|
||||
* `event` IpcRendererEvent
|
||||
* `event` [IpcRendererEvent][ipc-renderer-event]
|
||||
* `...args` any[]
|
||||
|
||||
Listens to `channel`, when a new message arrives `listener` would be called with
|
||||
@@ -36,7 +36,7 @@ Listens to `channel`, when a new message arrives `listener` would be called with
|
||||
|
||||
* `channel` string
|
||||
* `listener` Function
|
||||
* `event` IpcRendererEvent
|
||||
* `event` [IpcRendererEvent][ipc-renderer-event]
|
||||
* `...args` any[]
|
||||
|
||||
Adds a one time `listener` function for the event. This `listener` is invoked
|
||||
@@ -208,12 +208,8 @@ Sends a message to a window with `webContentsId` via `channel`.
|
||||
Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
|
||||
the host page instead of the main process.
|
||||
|
||||
## Event object
|
||||
|
||||
The documentation for the `event` object passed to the `callback` can be found
|
||||
in the [`ipc-renderer-event`](./structures/ipc-renderer-event.md) structure docs.
|
||||
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||
[`window.postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
||||
[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort
|
||||
[ipc-renderer-event]: ./structures/ipc-renderer-event.md
|
||||
|
||||
@@ -891,18 +891,19 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
|
||||
* `permission` string - The type of requested permission.
|
||||
* `clipboard-read` - Request access to read from the clipboard.
|
||||
* `clipboard-sanitized-write` - Request access to write to the clipboard.
|
||||
* `display-capture` - Request access to capture the screen via the [Screen Capture API](https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API).
|
||||
* `fullscreen` - Request control of the app's fullscreen state via the [Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API).
|
||||
* `geolocation` - Request access to the user's location via the [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API)
|
||||
* `idle-detection` - Request access to the user's idle state via the [IdleDetector API](https://developer.mozilla.org/en-US/docs/Web/API/IdleDetector).
|
||||
* `media` - Request access to media devices such as camera, microphone and speakers.
|
||||
* `display-capture` - Request access to capture the screen.
|
||||
* `mediaKeySystem` - Request access to DRM protected content.
|
||||
* `geolocation` - Request access to user's current location.
|
||||
* `notifications` - Request notification creation and the ability to display them in the user's system tray.
|
||||
* `midi` - Request MIDI access in the `webmidi` API.
|
||||
* `midiSysex` - Request the use of system exclusive messages in the `webmidi` API.
|
||||
* `pointerLock` - Request to directly interpret mouse movements as an input method. Click [here](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API) to know more. These requests always appear to originate from the main frame.
|
||||
* `fullscreen` - Request for the app to enter fullscreen mode.
|
||||
* `midi` - Request MIDI access in the [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API).
|
||||
* `midiSysex` - Request the use of system exclusive messages in the [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API).
|
||||
* `notifications` - Request notification creation and the ability to display them in the user's system tray using the [Notifications API](https://developer.mozilla.org/en-US/docs/Web/API/notification)
|
||||
* `pointerLock` - Request to directly interpret mouse movements as an input method via the [Pointer Lock API](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API). These requests always appear to originate from the main frame.
|
||||
* `openExternal` - Request to open links in external applications.
|
||||
* `window-management` - Request access to enumerate screens using the [`getScreenDetails`](https://developer.chrome.com/en/articles/multi-screen-window-placement/) API.
|
||||
* `unknown` - An unrecognized permission request
|
||||
* `unknown` - An unrecognized permission request.
|
||||
* `callback` Function
|
||||
* `permissionGranted` boolean - Allow or deny the permission.
|
||||
* `details` Object - Some properties are only available on certain permission types.
|
||||
@@ -934,7 +935,22 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
|
||||
|
||||
* `handler` Function\<boolean> | null
|
||||
* `webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. All cross origin sub frames making permission checks will pass a `null` webContents to this handler, while certain other permission checks such as `notifications` checks will always pass `null`. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
|
||||
* `permission` string - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, `hid`, `serial`, or `usb`.
|
||||
* `permission` string - Type of permission check.
|
||||
* `clipboard-read` - Request access to read from the clipboard.
|
||||
* `clipboard-sanitized-write` - Request access to write to the clipboard.
|
||||
* `geolocation` - Access the user's geolocation data via the [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API)
|
||||
* `fullscreen` - Control of the app's fullscreen state via the [Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API).
|
||||
* `hid` - Access the HID protocol to manipulate HID devices via the [WebHID API](https://developer.mozilla.org/en-US/docs/Web/API/WebHID_API).
|
||||
* `idle-detection` - Access the user's idle state via the [IdleDetector API](https://developer.mozilla.org/en-US/docs/Web/API/IdleDetector).
|
||||
* `media` - Access to media devices such as camera, microphone and speakers.
|
||||
* `mediaKeySystem` - Access to DRM protected content.
|
||||
* `midi` - Enable MIDI access in the [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API).
|
||||
* `midiSysex` - Use system exclusive messages in the [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API).
|
||||
* `notifications` - Configure and display desktop notifications to the user with the [Notifications API](https://developer.mozilla.org/en-US/docs/Web/API/notification).
|
||||
* `openExternal` - Open links in external applications.
|
||||
* `pointerLock` - Directly interpret mouse movements as an input method via the [Pointer Lock API](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API). These requests always appear to originate from the main frame.
|
||||
* `serial` - Read from and write to serial devices with the [Web Serial API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API).
|
||||
* `usb` - Expose non-standard Universal Serial Bus (USB) compatible devices services to the web with the [WebUSB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API).
|
||||
* `requestingOrigin` string - The origin URL of the permission check
|
||||
* `details` Object - Some properties are only available on certain permission types.
|
||||
* `embeddingOrigin` string (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
* `sender` [IpcRenderer](../ipc-renderer.md) - The `IpcRenderer` instance that emitted the event originally
|
||||
* `senderId` Integer - The `webContents.id` that sent the message, you can call `event.sender.sendTo(event.senderId, ...)` to reply to the message, see [ipcRenderer.sendTo][ipc-renderer-sendto] for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set `event.senderId` to `0`.
|
||||
* `senderIsMainFrame` boolean (optional) - Whether the message sent via [ipcRenderer.sendTo][ipc-renderer-sendto] was sent by the main frame. This is relevant when `nodeIntegrationInSubFrames` is enabled in the originating `webContents`.
|
||||
* `ports` [MessagePort][][] - A list of MessagePorts that were transferred with this message
|
||||
|
||||
[ipc-renderer-sendto]: ../ipc-renderer.md#ipcrenderersendtowebcontentsid-channel-args
|
||||
|
||||
@@ -59,7 +59,7 @@ window.open('https://github.com', '_blank', 'top=500,left=200,frame=false,nodeIn
|
||||
* Non-standard features (that are not handled by Chromium or Electron) given in
|
||||
`features` will be passed to any registered `webContents`'s
|
||||
`did-create-window` event handler in the `options` argument.
|
||||
* `frameName` follows the specification of `windowName` located in the [native documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters).
|
||||
* `frameName` follows the specification of `target` located in the [native documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters).
|
||||
* When opening `about:blank`, the child window's [`WebPreferences`](structures/web-preferences.md) will be copied
|
||||
from the parent window, and there is no way to override it because Chromium
|
||||
skips browser side navigation in this case.
|
||||
|
||||
@@ -41,7 +41,9 @@ Valid `algorithm` values are currently `SHA256` only. The `hash` is a hash of t
|
||||
ASAR integrity checking is currently disabled by default and can be enabled by toggling a fuse. See [Electron Fuses](fuses.md) for more information on what Electron Fuses are and how they work. When enabling this fuse you typically also want to enable the `onlyLoadAppFromAsar` fuse otherwise the validity checking can be bypassed via the Electron app code search path.
|
||||
|
||||
```js @ts-nocheck
|
||||
require('@electron/fuses').flipFuses(
|
||||
const { flipFuses, FuseVersion, FuseV1Options } = require('@electron/fuses')
|
||||
|
||||
flipFuses(
|
||||
// E.g. /a/b/Foo.app
|
||||
pathToPackagedApp,
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
|
||||
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
|
||||
| ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- |
|
||||
| 26.0.0 | 2023-Jun-01 | 2023-Jun-27 | 2023-Aug-15 | TBD | M116 | TBD | ✅ |
|
||||
| 25.0.0 | 2023-Apr-10 | 2023-May-02 | 2023-May-30 | 2024-Jan-02 | M114 | TBD | ✅ |
|
||||
| 25.0.0 | 2023-Apr-10 | 2023-May-02 | 2023-May-30 | 2024-Jan-02 | M114 | v18.15 | ✅ |
|
||||
| 24.0.0 | 2022-Feb-09 | 2023-Mar-07 | 2023-Apr-04 | 2023-Oct-10 | M112 | v18.14 | ✅ |
|
||||
| 23.0.0 | 2022-Dec-01 | 2023-Jan-10 | 2023-Feb-07 | 2023-Aug-15 | M110 | v18.12 | ✅ |
|
||||
| 22.0.0 | 2022-Sep-29 | 2022-Oct-25 | 2022-Nov-29 | 2023-Oct-10 | M108 | v16.17 | ✅ |
|
||||
|
||||
@@ -68,7 +68,9 @@ The loadBrowserProcessSpecificV8Snapshot fuse changes which V8 snapshot file is
|
||||
We've made a handy module, [`@electron/fuses`](https://npmjs.com/package/@electron/fuses), to make flipping these fuses easy. Check out the README of that module for more details on usage and potential error cases.
|
||||
|
||||
```js @ts-nocheck
|
||||
require('@electron/fuses').flipFuses(
|
||||
const { flipFuses, FuseVersion, FuseV1Options } = require('@electron/fuses')
|
||||
|
||||
flipFuses(
|
||||
// Path to electron
|
||||
require('electron'),
|
||||
// Fuses to flip
|
||||
@@ -82,7 +84,7 @@ require('@electron/fuses').flipFuses(
|
||||
You can validate the fuses have been flipped or check the fuse status of an arbitrary Electron app using the fuses CLI.
|
||||
|
||||
```bash
|
||||
npx @electron/fuses read --app /Applications/Foo.app
|
||||
npx @electron/fuses read --app /Applications/Foo.app
|
||||
```
|
||||
|
||||
### The hard way
|
||||
|
||||
@@ -838,7 +838,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
const originalModuleLoad = Module._load;
|
||||
Module._load = (request: string, ...args: any[]) => {
|
||||
const loadResult = originalModuleLoad(request, ...args);
|
||||
if (request === 'child_process') {
|
||||
if (request === 'child_process' || request === 'node:child_process') {
|
||||
if (!asarReady.has(loadResult)) {
|
||||
asarReady.add(loadResult);
|
||||
// Just to make it obvious what we are dealing with here
|
||||
|
||||
@@ -17,13 +17,13 @@ const isWebView = mainFrame.getWebPreference('isWebView');
|
||||
// ElectronApiServiceImpl will look for the "ipcNative" hidden object when
|
||||
// invoking the 'onMessage' callback.
|
||||
v8Util.setHiddenValue(global, 'ipcNative', {
|
||||
onMessage (internal: boolean, channel: string, ports: MessagePort[], args: any[], senderId: number) {
|
||||
onMessage (internal: boolean, channel: string, ports: MessagePort[], args: any[], senderId: number, senderIsMainFrame: boolean) {
|
||||
if (internal && senderId !== 0) {
|
||||
console.error(`Message ${channel} sent by unexpected WebContents (${senderId})`);
|
||||
return;
|
||||
}
|
||||
const sender = internal ? ipcRendererInternal : ipcRenderer;
|
||||
sender.emit(channel, { sender, senderId, ports }, ...args);
|
||||
sender.emit(channel, { sender, senderId, ...(senderId ? { senderIsMainFrame } : {}), ports }, ...args);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -130,3 +130,5 @@ chore_patch_out_profile_methods_in_titlebar_config.patch
|
||||
fix_crash_on_nativetheme_change_during_context_menu_close.patch
|
||||
potential_fix_for_flaky_desktopcaptureapitest_delegation_unittest.patch
|
||||
fix_select_the_first_menu_item_when_opened_via_keyboard.patch
|
||||
chore_add_buildflag_guard_around_new_include.patch
|
||||
fix_use_delegated_generic_capturer_when_available.patch
|
||||
|
||||
@@ -23,10 +23,10 @@ index 103a9d9fb17e954ecaf0acecaa3eeafc23e39c94..de299316216dba204decba3b0eb57f5c
|
||||
int32_t world_id) {}
|
||||
virtual void DidClearWindowObject() {}
|
||||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
||||
index 3829c1b7902c0fbc0bb2fb53e2917ecabdfc8e96..34b02a2d2af10c7f894ed513e82fb92c52c682d1 100644
|
||||
index 68cc76c0f63f3f828ab582dab88f893453144b2a..5547fb35630d2f2c24b21640a90b8c0858f604ce 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -4442,6 +4442,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
@@ -4438,6 +4438,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
observer.DidCreateScriptContext(context, world_id);
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ index 3829c1b7902c0fbc0bb2fb53e2917ecabdfc8e96..34b02a2d2af10c7f894ed513e82fb92c
|
||||
int world_id) {
|
||||
for (auto& observer : observers_)
|
||||
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
|
||||
index 268c6c6f4b22c64ffcbaf715728e8da6f46d3b88..884b315d7fbdc57b20ee1508d352eb1e6825481e 100644
|
||||
index 4ff96217c554e14464605c46c22e380ff73a2d59..a715f724373184546d3320e1d58e85e88975096e 100644
|
||||
--- a/content/renderer/render_frame_impl.h
|
||||
+++ b/content/renderer/render_frame_impl.h
|
||||
@@ -611,6 +611,8 @@ class CONTENT_EXPORT RenderFrameImpl
|
||||
@@ -610,6 +610,8 @@ class CONTENT_EXPORT RenderFrameImpl
|
||||
void DidObserveLayoutShift(double score, bool after_input_or_scroll) override;
|
||||
void DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
int world_id) override;
|
||||
|
||||
@@ -49,10 +49,10 @@ index 22c4d4e9718a503d9c7ca26a40c97149b0f8986a..6bdc2757c96a28022fda9e6f5e3b74a0
|
||||
// its owning reference back to our owning LocalFrame.
|
||||
client_->Detached(type);
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
index fa418d01914fdb671055666c72a84351349eaba8..f2b09355ba3f42dd72804fb470e98621c1a153f3 100644
|
||||
index 51ac02abf2f2e61538b26fcbbaa437567310c164..f91a1af51c01e29ee6ec734eee368e04bf714311 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
@@ -669,10 +669,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
@@ -665,10 +665,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
}
|
||||
DCHECK(!view_ || !view_->IsAttached());
|
||||
|
||||
@@ -63,7 +63,7 @@ index fa418d01914fdb671055666c72a84351349eaba8..f2b09355ba3f42dd72804fb470e98621
|
||||
if (!Client())
|
||||
return false;
|
||||
|
||||
@@ -720,6 +716,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
@@ -716,6 +712,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
DCHECK(!view_->IsAttached());
|
||||
Client()->WillBeDetached();
|
||||
|
||||
|
||||
@@ -33,10 +33,10 @@ index 884bccba58c66861b43b3b50a7535cba543302e2..82e7bf534aa6b998cee8df53be3ca7db
|
||||
"//base",
|
||||
"//build:branding_buildflags",
|
||||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||||
index c7ff5942d379b068f13c470677c83845b960858a..cd9fd963dc720f7394b656afe6ec032b10136d6b 100644
|
||||
index 93184ddac697404d22156015e039b710813ce3a5..0a92a4dac5ce0b2d95ae7f45b76bf45e83420d6b 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -4606,7 +4606,7 @@ static_library("browser") {
|
||||
@@ -4615,7 +4615,7 @@ static_library("browser") {
|
||||
|
||||
# On Windows, the hashes are embedded in //chrome:chrome_initial rather
|
||||
# than here in :chrome_dll.
|
||||
@@ -46,10 +46,10 @@ index c7ff5942d379b068f13c470677c83845b960858a..cd9fd963dc720f7394b656afe6ec032b
|
||||
sources += [ "certificate_viewer_stub.cc" ]
|
||||
}
|
||||
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
|
||||
index 1bf665b53c5a4018533fe1f9be322358043223cf..7d1aef6e02ada78ebb5a2976e942f6ca573c6914 100644
|
||||
index a6b47cee220af2083461bf8c25e9b37defae9c1f..ac514a50b6c7d19acf94da04d2ead46275b7d105 100644
|
||||
--- a/chrome/test/BUILD.gn
|
||||
+++ b/chrome/test/BUILD.gn
|
||||
@@ -6581,7 +6581,6 @@ test("unit_tests") {
|
||||
@@ -6587,7 +6587,6 @@ test("unit_tests") {
|
||||
|
||||
deps += [
|
||||
"//chrome:other_version",
|
||||
@@ -57,7 +57,7 @@ index 1bf665b53c5a4018533fe1f9be322358043223cf..7d1aef6e02ada78ebb5a2976e942f6ca
|
||||
"//chrome//services/util_win:unit_tests",
|
||||
"//chrome/app:chrome_dll_resources",
|
||||
"//chrome/app:win_unit_tests",
|
||||
@@ -6607,6 +6606,10 @@ test("unit_tests") {
|
||||
@@ -6613,6 +6612,10 @@ test("unit_tests") {
|
||||
"//ui/resources",
|
||||
]
|
||||
|
||||
@@ -68,7 +68,7 @@ index 1bf665b53c5a4018533fe1f9be322358043223cf..7d1aef6e02ada78ebb5a2976e942f6ca
|
||||
ldflags = [
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
|
||||
@@ -7532,7 +7535,6 @@ test("unit_tests") {
|
||||
@@ -7539,7 +7542,6 @@ test("unit_tests") {
|
||||
}
|
||||
|
||||
deps += [
|
||||
@@ -76,7 +76,7 @@ index 1bf665b53c5a4018533fe1f9be322358043223cf..7d1aef6e02ada78ebb5a2976e942f6ca
|
||||
"//chrome/browser/apps:icon_standardizer",
|
||||
"//chrome/browser/apps/app_service",
|
||||
"//chrome/browser/apps/app_service:test_support",
|
||||
@@ -7618,6 +7620,10 @@ test("unit_tests") {
|
||||
@@ -7626,6 +7628,10 @@ test("unit_tests") {
|
||||
"//ui/webui/resources/js/browser_command:mojo_bindings",
|
||||
]
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ index 488abc9ed0d61a4b73f4bec34cbca416abfbf715..7b1b36d6ab787e2c43d7556b1e4bb1d3
|
||||
|
||||
if (is_win) {
|
||||
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
|
||||
index db63f3aee66b8e9defbbc1fcaa5f905de9cba918..0b9d69bc6b5185672f88edb722e1ebd05ff9b9d6 100644
|
||||
index abc33d4abffaff80f6c23f63e206505ffacade86..6e6fe7a75ae6ec87e1f4f13d28ffdffc1bb0e7ea 100644
|
||||
--- a/content/browser/BUILD.gn
|
||||
+++ b/content/browser/BUILD.gn
|
||||
@@ -56,6 +56,7 @@ source_set("browser") {
|
||||
@@ -306,7 +306,7 @@ index f5038c6478eeccc17e061681dbee0f384dac4911..bf23c3576bb7b2d10a840e6eb2a420b7
|
||||
if (is_win) {
|
||||
sources += [
|
||||
diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn
|
||||
index c2c93302e51f629594583e5c2f2b89fe084f819e..363892cfe0d359579cff47f85a0bc60794cee22f 100644
|
||||
index a4072a85236ad029ecb292be0085e537a7c482bb..d9250541ab197f625c42feb96d94aca4cd791195 100644
|
||||
--- a/ui/views/BUILD.gn
|
||||
+++ b/ui/views/BUILD.gn
|
||||
@@ -682,6 +682,7 @@ component("views") {
|
||||
|
||||
@@ -9,10 +9,10 @@ potentially prevent a window from being created.
|
||||
TODO(loc): this patch is currently broken.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index 04b898df25b5d2dfafbc0f0010af9325a90c28d4..45d2c05203cc6ef2cebb4a8c32a7954a85111df7 100644
|
||||
index 9f7b9d04cefd48539d8c62cb74c3aac084e116e6..0faa1fba5cea7e301b7497aca5838f761d9e02bd 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -7828,6 +7828,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -7836,6 +7836,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
last_committed_origin_, params->window_container_type,
|
||||
params->target_url, params->referrer.To<Referrer>(),
|
||||
params->frame_name, params->disposition, *params->features,
|
||||
@@ -51,10 +51,10 @@ index 4efa2e72fdc340624ce888e93ffd4359e20c0973..5018e17e0f56efd54529ef3e9ae1de5e
|
||||
new_contents_impl, opener, params.target_url,
|
||||
params.referrer.To<Referrer>(), params.disposition,
|
||||
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
|
||||
index 455703114d540328fafccdec7c9caafa838fdbee..5e37edd4295b501b21d5fe1cad31c9930e96a9f9 100644
|
||||
index 033780b477965e6915fc808cb468598f55050f2b..51da4e464c5768d979188bb46c11565cab5a494e 100644
|
||||
--- a/content/common/frame.mojom
|
||||
+++ b/content/common/frame.mojom
|
||||
@@ -605,6 +605,10 @@ struct CreateNewWindowParams {
|
||||
@@ -597,6 +597,10 @@ struct CreateNewWindowParams {
|
||||
// The navigation initiator's user activation and ad status.
|
||||
blink.mojom.NavigationInitiatorActivationAndAdStatus
|
||||
initiator_activation_and_ad_status;
|
||||
@@ -79,7 +79,7 @@ index d7a8a6d628b790ad9747335b45d1bb148f536ed7..7ba6f9bf054cf9b4d89cfa129caf91a8
|
||||
bool opener_suppressed,
|
||||
bool* no_javascript_access) {
|
||||
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
|
||||
index a558365d87cb4b46eb3bd016fc10889726811db0..1263f4042fe6d62af24131e4a4d7fda714275f48 100644
|
||||
index fe0b1b96209c48d298a0de2041e2841083f891a9..044a426f4dab1b60b035e4f383b6c468446afc74 100644
|
||||
--- a/content/public/browser/content_browser_client.h
|
||||
+++ b/content/public/browser/content_browser_client.h
|
||||
@@ -169,6 +169,7 @@ class NetworkService;
|
||||
@@ -90,7 +90,7 @@ index a558365d87cb4b46eb3bd016fc10889726811db0..1263f4042fe6d62af24131e4a4d7fda7
|
||||
} // namespace network
|
||||
|
||||
namespace sandbox {
|
||||
@@ -1076,6 +1077,8 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
@@ -1078,6 +1079,8 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
const std::string& frame_name,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& features,
|
||||
@@ -148,10 +148,10 @@ index c5bda327264c330345baf7b44b4ba5c478e58952..989778079d5dc91127989e43f3ce6b25
|
||||
// typically happens when popups are created.
|
||||
virtual void WebContentsCreated(WebContents* source_contents,
|
||||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
||||
index b441530bf7da62ddac5a6f17b6b5c76363efea55..3829c1b7902c0fbc0bb2fb53e2917ecabdfc8e96 100644
|
||||
index 556f5310719f9a9e56bb3a34d75a529b8b26f839..68cc76c0f63f3f828ab582dab88f893453144b2a 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -6320,6 +6320,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
|
||||
@@ -6316,6 +6316,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
|
||||
blink::GetNavigationInitiatorActivationAndAdStatus(
|
||||
request.HasUserGesture(), GetWebFrame()->IsAdScriptInStack());
|
||||
|
||||
@@ -210,7 +210,7 @@ index bef5a989bac50c177f15f52fe87ac3790d553e85..65dcd2e3b51929400c8bfb6a98a4fb59
|
||||
|
||||
} // namespace blink
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
index 8b66b0254a673c95f1823321d942ea6caed8d7e5..6ed13e56f489da39b7dff90ed02eedc8c231715f 100644
|
||||
index 6283f14f8b613bc435f8c04fec13d1222795797a..2313fe0a9092dd41db0fecf17080ed12b91b0485 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
@@ -2195,6 +2195,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Charles Kerr <charles@charleskerr.com>
|
||||
Date: Wed, 5 Jul 2023 16:28:30 -0500
|
||||
Subject: chore: add BUILDFLAG guard around new include
|
||||
|
||||
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4628373
|
||||
|
||||
This is an experimental commit; but if it's successful,
|
||||
This patch should be upstreamed and then removed from electron's code.
|
||||
|
||||
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
|
||||
index 7145cc6ad5d1724cde8e2c6b6168a36f4e6b2dbe..f796d075fd07d68e6992c351f639288e9baa4224 100644
|
||||
--- a/chrome/browser/ui/views/frame/browser_view.h
|
||||
+++ b/chrome/browser/ui/views/frame/browser_view.h
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "chrome/browser/ui/views/user_education/browser_feature_promo_controller.h"
|
||||
#include "chrome/common/buildflags.h"
|
||||
#include "components/infobars/core/infobar_container.h"
|
||||
-#include "components/segmentation_platform/public/result.h"
|
||||
#include "components/user_education/common/feature_promo_controller.h"
|
||||
#include "components/user_education/common/feature_promo_handle.h"
|
||||
#include "components/webapps/browser/banners/app_banner_manager.h"
|
||||
@@ -62,6 +61,10 @@
|
||||
#include "ui/views/widget/widget_observer.h"
|
||||
#include "ui/views/window/client_view.h"
|
||||
|
||||
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
+#include "components/segmentation_platform/public/result.h"
|
||||
+#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
+
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
#include "ui/compositor/throughput_tracker.h"
|
||||
#endif
|
||||
@@ -6,7 +6,7 @@ Subject: expose V8Initializer::CodeGenerationCheckCallbackInMainThread
|
||||
This is needed to blend Blink and Node's policy for code generation policy.
|
||||
|
||||
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
||||
index 6cc93de0150bebc10cee83aadc3a643eb8e84ce7..ec992270b6aa54e4507ad0bad501793f72353834 100644
|
||||
index 4a0ae5a492e35b8f11d9f4f98083a63050e0bbe0..653eaaddb8bd69de392695894fabfdacddc7de90 100644
|
||||
--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
||||
+++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
||||
@@ -439,8 +439,9 @@ TrustedTypesCodeGenerationCheck(v8::Local<v8::Context> context,
|
||||
|
||||
@@ -65,10 +65,10 @@ index 02d9eabfef9521722340739bf86df3dfc30018d7..af8639ebcc61d8081a12334f652a551d
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
bool EscapeVirtualization(const base::FilePath& user_data_dir);
|
||||
diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc
|
||||
index 7cd73bf6d1884bd9b38bcb33de009efb1da2add9..a7a441a24098dc95e71e871e776e2cd8dd3c0ea2 100644
|
||||
index 2071c301644f95e6cd0448b08cc7b535343a55a0..ec6c6425f4d76557ddb37a80fd68c1086fc5103d 100644
|
||||
--- a/chrome/browser/process_singleton_posix.cc
|
||||
+++ b/chrome/browser/process_singleton_posix.cc
|
||||
@@ -608,6 +608,7 @@ class ProcessSingleton::LinuxWatcher
|
||||
@@ -613,6 +613,7 @@ class ProcessSingleton::LinuxWatcher
|
||||
// |reader| is for sending back ACK message.
|
||||
void HandleMessage(const std::string& current_dir,
|
||||
const std::vector<std::string>& argv,
|
||||
@@ -76,7 +76,7 @@ index 7cd73bf6d1884bd9b38bcb33de009efb1da2add9..a7a441a24098dc95e71e871e776e2cd8
|
||||
SocketReader* reader);
|
||||
|
||||
private:
|
||||
@@ -662,13 +663,16 @@ void ProcessSingleton::LinuxWatcher::StartListening(int socket) {
|
||||
@@ -667,13 +668,16 @@ void ProcessSingleton::LinuxWatcher::StartListening(int socket) {
|
||||
}
|
||||
|
||||
void ProcessSingleton::LinuxWatcher::HandleMessage(
|
||||
@@ -95,7 +95,7 @@ index 7cd73bf6d1884bd9b38bcb33de009efb1da2add9..a7a441a24098dc95e71e871e776e2cd8
|
||||
// Send back "ACK" message to prevent the client process from starting up.
|
||||
reader->FinishWithACK(kACKToken, std::size(kACKToken) - 1);
|
||||
} else {
|
||||
@@ -716,7 +720,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
|
||||
@@ -721,7 +725,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ index 7cd73bf6d1884bd9b38bcb33de009efb1da2add9..a7a441a24098dc95e71e871e776e2cd8
|
||||
const size_t kMinMessageLength = std::size(kStartToken) + 4;
|
||||
if (bytes_read_ < kMinMessageLength) {
|
||||
buf_[bytes_read_] = 0;
|
||||
@@ -746,10 +751,28 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
|
||||
@@ -751,10 +756,28 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
|
||||
tokens.erase(tokens.begin());
|
||||
tokens.erase(tokens.begin());
|
||||
|
||||
@@ -135,7 +135,7 @@ index 7cd73bf6d1884bd9b38bcb33de009efb1da2add9..a7a441a24098dc95e71e871e776e2cd8
|
||||
fd_watch_controller_.reset();
|
||||
|
||||
// LinuxWatcher::HandleMessage() is in charge of destroying this SocketReader
|
||||
@@ -778,8 +801,10 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK(
|
||||
@@ -783,8 +806,10 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK(
|
||||
//
|
||||
ProcessSingleton::ProcessSingleton(
|
||||
const base::FilePath& user_data_dir,
|
||||
@@ -146,7 +146,7 @@ index 7cd73bf6d1884bd9b38bcb33de009efb1da2add9..a7a441a24098dc95e71e871e776e2cd8
|
||||
current_pid_(base::GetCurrentProcId()) {
|
||||
socket_path_ = user_data_dir.Append(chrome::kSingletonSocketFilename);
|
||||
lock_path_ = user_data_dir.Append(chrome::kSingletonLockFilename);
|
||||
@@ -897,7 +922,8 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
||||
@@ -902,7 +927,8 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
||||
sizeof(socket_timeout));
|
||||
|
||||
// Found another process, prepare our command line
|
||||
@@ -156,7 +156,7 @@ index 7cd73bf6d1884bd9b38bcb33de009efb1da2add9..a7a441a24098dc95e71e871e776e2cd8
|
||||
std::string to_send(kStartToken);
|
||||
to_send.push_back(kTokenDelimiter);
|
||||
|
||||
@@ -907,11 +933,21 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
||||
@@ -912,11 +938,21 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
||||
to_send.append(current_dir.value());
|
||||
|
||||
const std::vector<std::string>& argv = cmd_line.argv();
|
||||
|
||||
@@ -17,10 +17,10 @@ policy->CanCommitOriginAndUrl.
|
||||
Upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/3856266.
|
||||
|
||||
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
|
||||
index 948ee821dfea0dc84a5cc9e93b9dc178fade4892..cf32d9032556d550b0dc3f799458d71cb4484dc5 100644
|
||||
index 76a53ed5fcae948a3b2e950d484ffebd1939fd6c..fdce51afdbb8759fb52bf2ae570de3e4da7dd752 100644
|
||||
--- a/content/browser/renderer_host/navigation_request.cc
|
||||
+++ b/content/browser/renderer_host/navigation_request.cc
|
||||
@@ -7334,10 +7334,11 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
|
||||
@@ -7345,10 +7345,11 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
|
||||
if (IsForMhtmlSubframe())
|
||||
return origin_with_debug_info;
|
||||
|
||||
@@ -37,10 +37,10 @@ index 948ee821dfea0dc84a5cc9e93b9dc178fade4892..cf32d9032556d550b0dc3f799458d71c
|
||||
}
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h
|
||||
index 8e0a631735dedc27898727fbe2a16f3a8ed4e784..5ae6ac7672a7bda8bb147a1fa0d623f3dce7efc2 100644
|
||||
index dcdb5a391827be8d5b3558242ced27cefc54a6e3..17bd5123e6713ed19baa23b72d1b2dc3c3448701 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.h
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.h
|
||||
@@ -2933,6 +2933,17 @@ class CONTENT_EXPORT RenderFrameHostImpl
|
||||
@@ -2930,6 +2930,17 @@ class CONTENT_EXPORT RenderFrameHostImpl
|
||||
// last committed document.
|
||||
CookieChangeListener::CookieChangeInfo GetCookieChangeInfo();
|
||||
|
||||
@@ -58,7 +58,7 @@ index 8e0a631735dedc27898727fbe2a16f3a8ed4e784..5ae6ac7672a7bda8bb147a1fa0d623f3
|
||||
// Sets a ResourceCache in the renderer. `this` must be active and there must
|
||||
// be no pending navigation. `remote` must have the same and process
|
||||
// isolation policy.
|
||||
@@ -3315,17 +3326,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
|
||||
@@ -3307,17 +3318,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
|
||||
// relevant.
|
||||
void ResetWaitingState();
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ index 34777e89362b14587979cef76d8cd71b634cca8c..3d5e44883bab30eebdfaba70f3933435
|
||||
injector_->ExpectsResults(), injector_->ShouldWaitForPromise());
|
||||
}
|
||||
diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h
|
||||
index 1a7e70ad767cc6d196ae0e376e57d92319d22a4c..6ad1f142113966776685c95094a1e2fd65595928 100644
|
||||
index 21b689524b4ee4cab4baf95163c963e725af4226..592cf7fb30ffb93924c29cfb19e4cb6110b607bb 100644
|
||||
--- a/third_party/blink/public/web/web_local_frame.h
|
||||
+++ b/third_party/blink/public/web/web_local_frame.h
|
||||
@@ -444,6 +444,7 @@ class BLINK_EXPORT WebLocalFrame : public WebFrame {
|
||||
@@ -442,6 +442,7 @@ class BLINK_EXPORT WebLocalFrame : public WebFrame {
|
||||
mojom::EvaluationTiming,
|
||||
mojom::LoadEventBlockingOption,
|
||||
WebScriptExecutionCallback,
|
||||
@@ -64,10 +64,10 @@ index 4cd668a127a50e5462e3878c3f1dcb7384926768..dfbec49249404df8f8ebdbd26e6e865c
|
||||
|
||||
#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
index f2b09355ba3f42dd72804fb470e98621c1a153f3..c5ede938b3a05f2bf71aec9246c6deb630ae30a5 100644
|
||||
index f91a1af51c01e29ee6ec734eee368e04bf714311..cf73051f87f646d5b5d356bc30946da1c258a384 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
@@ -2778,6 +2778,7 @@ void LocalFrame::RequestExecuteScript(
|
||||
@@ -2774,6 +2774,7 @@ void LocalFrame::RequestExecuteScript(
|
||||
mojom::blink::EvaluationTiming evaluation_timing,
|
||||
mojom::blink::LoadEventBlockingOption blocking_option,
|
||||
WebScriptExecutionCallback callback,
|
||||
@@ -75,7 +75,7 @@ index f2b09355ba3f42dd72804fb470e98621c1a153f3..c5ede938b3a05f2bf71aec9246c6deb6
|
||||
BackForwardCacheAware back_forward_cache_aware,
|
||||
mojom::blink::WantResultOption want_result_option,
|
||||
mojom::blink::PromiseResultOption promise_behavior) {
|
||||
@@ -2808,7 +2809,8 @@ void LocalFrame::RequestExecuteScript(
|
||||
@@ -2804,7 +2805,8 @@ void LocalFrame::RequestExecuteScript(
|
||||
PausableScriptExecutor::CreateAndRun(
|
||||
ToScriptState(DomWindow(), *world), std::move(script_sources),
|
||||
execute_script_policy, user_gesture, evaluation_timing, blocking_option,
|
||||
@@ -86,10 +86,10 @@ index f2b09355ba3f42dd72804fb470e98621c1a153f3..c5ede938b3a05f2bf71aec9246c6deb6
|
||||
|
||||
void LocalFrame::SetEvictCachedSessionStorageOnFreezeOrUnload() {
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h
|
||||
index 3b648c0c3212a886ee5714a8ccc414e3f649b75c..4abf6372264bba9f1234b39918fb2064393ba487 100644
|
||||
index bc24bbc46d829946da255a74947dc3e5d4685dd3..c5a02b325dae7beb8ebebca49c93b8aa1d86f212 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame.h
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame.h
|
||||
@@ -806,6 +806,7 @@ class CORE_EXPORT LocalFrame final
|
||||
@@ -800,6 +800,7 @@ class CORE_EXPORT LocalFrame final
|
||||
mojom::blink::EvaluationTiming,
|
||||
mojom::blink::LoadEventBlockingOption,
|
||||
WebScriptExecutionCallback,
|
||||
@@ -205,7 +205,7 @@ index 1e4d9e098463d61dcab787afcc46fea63b27e012..3f1ebf493ddd7d1c209acee2fb1255a0
|
||||
const mojom::blink::UserActivationOption user_activation_option_;
|
||||
const mojom::blink::LoadEventBlockingOption blocking_option_;
|
||||
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
|
||||
index 59c1dff78aa1e8069d9c7ee0cf26c8291a78b483..4010ae2efe1eeb885864435eb40818a6f3ee7ec3 100644
|
||||
index edd4bff81eddc975bdca36cdbf6b987109b7a9d8..0d22e08fd745e157e90079976f9ac205cbe161c9 100644
|
||||
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
|
||||
@@ -1132,14 +1132,15 @@ void WebLocalFrameImpl::RequestExecuteScript(
|
||||
@@ -227,7 +227,7 @@ index 59c1dff78aa1e8069d9c7ee0cf26c8291a78b483..4010ae2efe1eeb885864435eb40818a6
|
||||
|
||||
v8::MaybeLocal<v8::Value> WebLocalFrameImpl::CallFunctionEvenIfScriptDisabled(
|
||||
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
|
||||
index 7cc5a466904a9763c50c2add02f50c9d15643faf..452496056c528bf9c0d7216e8dfa0d94f358c1ca 100644
|
||||
index 62106bbc17f85d6f24132d27dad7f7177df83762..4811bd8be40f5878af9321281a121934beda47be 100644
|
||||
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h
|
||||
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
|
||||
@@ -196,6 +196,7 @@ class CORE_EXPORT WebLocalFrameImpl final
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Athul Iddya <athul@iddya.com>
|
||||
Date: Fri, 14 Jul 2023 08:03:37 -0700
|
||||
Subject: fix: use delegated generic capturer when available
|
||||
|
||||
When the generic capturer is used to fetch capture sources, the returned
|
||||
ID will be arbitrarily prefixed with "screen" or "window" regardless of
|
||||
the source type. If the window capturer is used to stream video when the
|
||||
source was a screen or vice-versa, the stream fails to restart in
|
||||
delegated capturers like PipeWire.
|
||||
|
||||
To fix this, use the generic capturer to fetch the media stream if it's
|
||||
delegated and available. This does not cause any issues if the original
|
||||
capturer was window or screen-specific, as the IDs remain valid for
|
||||
generic capturer as well.
|
||||
|
||||
diff --git a/content/browser/media/capture/desktop_capture_device.cc b/content/browser/media/capture/desktop_capture_device.cc
|
||||
index 27687ee9f362c708af3e45d61effb20cebb413ae..ac97925378aa3872c7dc55e6184866be855f7a6b 100644
|
||||
--- a/content/browser/media/capture/desktop_capture_device.cc
|
||||
+++ b/content/browser/media/capture/desktop_capture_device.cc
|
||||
@@ -789,8 +789,14 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create(
|
||||
DesktopCapturerLacros::CaptureType::kScreen,
|
||||
webrtc::DesktopCaptureOptions());
|
||||
#else
|
||||
- std::unique_ptr<webrtc::DesktopCapturer> screen_capturer(
|
||||
- webrtc::DesktopCapturer::CreateScreenCapturer(options));
|
||||
+ std::unique_ptr<webrtc::DesktopCapturer> screen_capturer;
|
||||
+ if (auto generic_capturer =
|
||||
+ webrtc::DesktopCapturer::CreateGenericCapturer(options);
|
||||
+ generic_capturer && generic_capturer->GetDelegatedSourceListController()) {
|
||||
+ screen_capturer = std::move(generic_capturer);
|
||||
+ } else {
|
||||
+ screen_capturer = webrtc::DesktopCapturer::CreateScreenCapturer(options);
|
||||
+ }
|
||||
#endif
|
||||
if (screen_capturer && screen_capturer->SelectSource(source.id)) {
|
||||
capturer = std::make_unique<webrtc::DesktopAndCursorComposer>(
|
||||
@@ -809,8 +815,14 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create(
|
||||
new DesktopCapturerLacros(DesktopCapturerLacros::CaptureType::kWindow,
|
||||
webrtc::DesktopCaptureOptions()));
|
||||
#else
|
||||
- std::unique_ptr<webrtc::DesktopCapturer> window_capturer =
|
||||
- webrtc::DesktopCapturer::CreateWindowCapturer(options);
|
||||
+ std::unique_ptr<webrtc::DesktopCapturer> window_capturer;
|
||||
+ if (auto generic_capturer =
|
||||
+ webrtc::DesktopCapturer::CreateGenericCapturer(options);
|
||||
+ generic_capturer && generic_capturer->GetDelegatedSourceListController()) {
|
||||
+ window_capturer = std::move(generic_capturer);
|
||||
+ } else {
|
||||
+ window_capturer = webrtc::DesktopCapturer::CreateWindowCapturer(options);
|
||||
+ }
|
||||
#endif
|
||||
if (window_capturer && window_capturer->SelectSource(source.id)) {
|
||||
capturer = std::make_unique<webrtc::DesktopAndCursorComposer>(
|
||||
@@ -20,7 +20,7 @@ index 02c8f132c266a599c335f83474b3322700a0e5d1..19f731476a2a2beacef7c4493a586c4a
|
||||
}
|
||||
|
||||
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
|
||||
index 1263f4042fe6d62af24131e4a4d7fda714275f48..c671e038868679d282d67158750f6c90b59d237d 100644
|
||||
index 044a426f4dab1b60b035e4f383b6c468446afc74..85f5c4d124dc8e5c4b8394eee5fc689a698be856 100644
|
||||
--- a/content/public/browser/content_browser_client.h
|
||||
+++ b/content/public/browser/content_browser_client.h
|
||||
@@ -305,6 +305,11 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: gritsettings_resource_ids.patch
|
||||
Add electron resources file to the list of resource ids generation.
|
||||
|
||||
diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec
|
||||
index 887146425378c061fedb49b9c1dfe009d8e25a83..1d51c7b6c26c6e7c72e4fb6d87af4533240f789e 100644
|
||||
index a34293da9026018a3e733ed58e4eabde666c0198..caf6fbc8b80f6fa0d767e698265b589838cdab35 100644
|
||||
--- a/tools/gritsettings/resource_ids.spec
|
||||
+++ b/tools/gritsettings/resource_ids.spec
|
||||
@@ -1185,6 +1185,11 @@
|
||||
|
||||
@@ -21,7 +21,7 @@ index bf0365da219530780ec232e477f13ed216e6d5b9..84b137b0bff80f63db58b08d6c97ed52
|
||||
properties->supports_global_application_menus = true;
|
||||
properties->app_modal_dialogs_use_event_blocker = true;
|
||||
diff --git a/ui/ozone/public/ozone_platform.h b/ui/ozone/public/ozone_platform.h
|
||||
index b7991d9efb0076487fee7698debd6958b9e5177e..58215c5cb86a0d5d3f6699c84f680e65db3dcab3 100644
|
||||
index dbdf1d99a28beced97636fd558be67a92e0a4793..fd0ac892fc511d2a3b16a46dee45a0bc4aad268d 100644
|
||||
--- a/ui/ozone/public/ozone_platform.h
|
||||
+++ b/ui/ozone/public/ozone_platform.h
|
||||
@@ -121,6 +121,10 @@ class COMPONENT_EXPORT(OZONE) OzonePlatform {
|
||||
|
||||
@@ -919,7 +919,7 @@ index d971e446859507456da153a9d59f3ed4857b66cb..9ab75731a941e7065dfaa481508cfa47
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
// Set options for print preset from source PDF document.
|
||||
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
|
||||
index b7029ee5a65e6a2174d62d797fe7354fab0689b7..db63f3aee66b8e9defbbc1fcaa5f905de9cba918 100644
|
||||
index 9c10d729b8e8f4ce9a7a6f945a3a18bfbb4492cb..abc33d4abffaff80f6c23f63e206505ffacade86 100644
|
||||
--- a/content/browser/BUILD.gn
|
||||
+++ b/content/browser/BUILD.gn
|
||||
@@ -2901,8 +2901,9 @@ source_set("browser") {
|
||||
|
||||
@@ -51,7 +51,7 @@ index b05c0157ecca222452fb38e3b28c9d7cc6bcfbfd..02d9eabfef9521722340739bf86df3df
|
||||
base::win::MessageWindow window_; // The message-only window.
|
||||
bool is_virtualized_; // Stuck inside Microsoft Softricity VM environment.
|
||||
diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc
|
||||
index c7c8f4c7f89073990c8fd6269ab83e75abd9ad7d..7cd73bf6d1884bd9b38bcb33de009efb1da2add9 100644
|
||||
index 356c30cc4bf0d672f62ccf15de829b3c7c42f476..2071c301644f95e6cd0448b08cc7b535343a55a0 100644
|
||||
--- a/chrome/browser/process_singleton_posix.cc
|
||||
+++ b/chrome/browser/process_singleton_posix.cc
|
||||
@@ -54,6 +54,7 @@
|
||||
@@ -70,9 +70,9 @@ index c7c8f4c7f89073990c8fd6269ab83e75abd9ad7d..7cd73bf6d1884bd9b38bcb33de009efb
|
||||
#include "base/threading/platform_thread.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/timer/timer.h"
|
||||
@@ -96,9 +98,11 @@
|
||||
#include "net/base/network_interfaces.h"
|
||||
@@ -97,9 +99,11 @@
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/resource/scoped_startup_resource_bundle.h"
|
||||
|
||||
+#if 0
|
||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
@@ -82,17 +82,17 @@ index c7c8f4c7f89073990c8fd6269ab83e75abd9ad7d..7cd73bf6d1884bd9b38bcb33de009efb
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
@@ -342,6 +346,9 @@ bool SymlinkPath(const base::FilePath& target, const base::FilePath& path) {
|
||||
@@ -343,6 +347,9 @@ bool SymlinkPath(const base::FilePath& target, const base::FilePath& path) {
|
||||
bool DisplayProfileInUseError(const base::FilePath& lock_path,
|
||||
const std::string& hostname,
|
||||
int pid) {
|
||||
+ return true;
|
||||
+
|
||||
+#if 0
|
||||
std::u16string error = l10n_util::GetStringFUTF16(
|
||||
IDS_PROFILE_IN_USE_POSIX, base::NumberToString16(pid),
|
||||
base::ASCIIToUTF16(hostname));
|
||||
@@ -361,6 +368,7 @@ bool DisplayProfileInUseError(const base::FilePath& lock_path,
|
||||
// Ensure there is an instance of ResourceBundle that is initialized for
|
||||
// localized string resource accesses.
|
||||
ui::ScopedStartupResourceBundle ensure_startup_resource_bundle;
|
||||
@@ -366,6 +373,7 @@ bool DisplayProfileInUseError(const base::FilePath& lock_path,
|
||||
|
||||
NOTREACHED();
|
||||
return false;
|
||||
@@ -100,7 +100,7 @@ index c7c8f4c7f89073990c8fd6269ab83e75abd9ad7d..7cd73bf6d1884bd9b38bcb33de009efb
|
||||
}
|
||||
|
||||
bool IsChromeProcess(pid_t pid) {
|
||||
@@ -401,6 +409,21 @@ bool CheckCookie(const base::FilePath& path, const base::FilePath& cookie) {
|
||||
@@ -406,6 +414,21 @@ bool CheckCookie(const base::FilePath& path, const base::FilePath& cookie) {
|
||||
return (cookie == ReadLink(path));
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ index c7c8f4c7f89073990c8fd6269ab83e75abd9ad7d..7cd73bf6d1884bd9b38bcb33de009efb
|
||||
bool ConnectSocket(ScopedSocket* socket,
|
||||
const base::FilePath& socket_path,
|
||||
const base::FilePath& cookie_path) {
|
||||
@@ -768,6 +791,10 @@ ProcessSingleton::ProcessSingleton(
|
||||
@@ -773,6 +796,10 @@ ProcessSingleton::ProcessSingleton(
|
||||
|
||||
ProcessSingleton::~ProcessSingleton() {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
@@ -133,7 +133,7 @@ index c7c8f4c7f89073990c8fd6269ab83e75abd9ad7d..7cd73bf6d1884bd9b38bcb33de009efb
|
||||
}
|
||||
|
||||
ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
|
||||
@@ -1031,14 +1058,32 @@ bool ProcessSingleton::Create() {
|
||||
@@ -1036,14 +1063,32 @@ bool ProcessSingleton::Create() {
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ Note that we also need to manually update embedder's
|
||||
`api::WebContents::IsFullscreenForTabOrPending` value.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index 45d2c05203cc6ef2cebb4a8c32a7954a85111df7..2cc189dd47b2ca8dd14e4a836e4bed3ba6dae3a1 100644
|
||||
index 0faa1fba5cea7e301b7497aca5838f761d9e02bd..b87ce268fd12e7bcedd0739548a14d6c6aedbc1d 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -7045,6 +7045,17 @@ void RenderFrameHostImpl::EnterFullscreen(
|
||||
@@ -7053,6 +7053,17 @@ void RenderFrameHostImpl::EnterFullscreen(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,3 +36,4 @@ fix_preventing_potential_oob_in_ada_no_scheme_parsing.patch
|
||||
chore_remove_--no-harmony-atomics_related_code.patch
|
||||
fix_account_for_createexternalizablestring_v8_global.patch
|
||||
fix_wunreachable-code_warning_in_ares_init_rand_engine.patch
|
||||
fix_do_not_resolve_electron_entrypoints.patch
|
||||
|
||||
24
patches/node/fix_do_not_resolve_electron_entrypoints.patch
Normal file
24
patches/node/fix_do_not_resolve_electron_entrypoints.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <marshallofsound@electronjs.org>
|
||||
Date: Wed, 26 Jul 2023 17:03:15 -0700
|
||||
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/run_main.js b/lib/internal/modules/run_main.js
|
||||
index 5a50d5d6afab6e6648f72a1c0efa1df4cd80bcd9..0be45309028b00a6957ee473322a9452a7fa7d67 100644
|
||||
--- a/lib/internal/modules/run_main.js
|
||||
+++ b/lib/internal/modules/run_main.js
|
||||
@@ -13,6 +13,12 @@ const {
|
||||
} = require('internal/modules/esm/handle_process_exit');
|
||||
|
||||
function resolveMainPath(main) {
|
||||
+ // For built-in modules used as the main entry point we _never_
|
||||
+ // want to waste cycles resolving them to file paths on disk
|
||||
+ // that actually might exist
|
||||
+ if (typeof main === 'string' && main.startsWith('electron/js2c')) {
|
||||
+ return main;
|
||||
+ }
|
||||
// Note extension resolution for the main entry point can be deprecated in a
|
||||
// future major.
|
||||
// Module._findPath is monkey-patchable here.
|
||||
@@ -1 +1,3 @@
|
||||
fix_fallback_to_x11_capturer_on_wayland.patch
|
||||
cherry-pick-0e9556a90cec.patch
|
||||
fix_mark_pipewire_capturer_as_failed_after_session_is_closed.patch
|
||||
|
||||
102
patches/webrtc/cherry-pick-0e9556a90cec.patch
Normal file
102
patches/webrtc/cherry-pick-0e9556a90cec.patch
Normal file
@@ -0,0 +1,102 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Grulich <grulja@gmail.com>
|
||||
Date: Wed, 12 Jul 2023 13:15:40 +0200
|
||||
Subject: Desktop capture: introduce capturer requesting both screen and
|
||||
windows
|
||||
|
||||
When PipeWire and xdg-desktop-portals are used, we can actually combine
|
||||
both source types into one request. Make this part of the API for those
|
||||
who want to use it this way, e.g. Firefox or Electron, otherwise they
|
||||
will end up making two simultaneous requests, resulting into two dialogs
|
||||
at the same time asking, while they can be combined into just one.
|
||||
|
||||
Bug: webrtc:15363
|
||||
Change-Id: Ib6e1e47f66cb01d5c65096aec378b44c3af5f387
|
||||
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311549
|
||||
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
|
||||
Commit-Queue: Jan Grulich <grulja@gmail.com>
|
||||
Cr-Commit-Position: refs/heads/main@{#40425}
|
||||
|
||||
diff --git a/modules/desktop_capture/desktop_capture_types.h b/modules/desktop_capture/desktop_capture_types.h
|
||||
index 9627076eea3d1272f87b773ada86be6051f1e224..a4e3e897fde1d3c7bb470449448f30ff6e50caea 100644
|
||||
--- a/modules/desktop_capture/desktop_capture_types.h
|
||||
+++ b/modules/desktop_capture/desktop_capture_types.h
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
-enum class CaptureType { kWindow, kScreen };
|
||||
+enum class CaptureType { kWindow, kScreen, kAnyScreenContent };
|
||||
|
||||
// Type used to identify windows on the desktop. Values are platform-specific:
|
||||
// - On Windows: HWND cast to intptr_t.
|
||||
diff --git a/modules/desktop_capture/desktop_capturer.cc b/modules/desktop_capture/desktop_capturer.cc
|
||||
index 5211f1acecaba963e1436c1d04aa953853c79eb7..b99f5ecb803ac0ac0e26fbdb3411c77605f33011 100644
|
||||
--- a/modules/desktop_capture/desktop_capturer.cc
|
||||
+++ b/modules/desktop_capture/desktop_capturer.cc
|
||||
@@ -26,6 +26,10 @@
|
||||
#include "rtc_base/win/windows_version.h"
|
||||
#endif // defined(RTC_ENABLE_WIN_WGC)
|
||||
|
||||
+#if defined(WEBRTC_USE_PIPEWIRE)
|
||||
+#include "modules/desktop_capture/linux/wayland/base_capturer_pipewire.h"
|
||||
+#endif
|
||||
+
|
||||
namespace webrtc {
|
||||
|
||||
void LogDesktopCapturerFullscreenDetectorUsage() {
|
||||
@@ -101,6 +105,25 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateScreenCapturer(
|
||||
return capturer;
|
||||
}
|
||||
|
||||
+// static
|
||||
+std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateGenericCapturer(
|
||||
+ const DesktopCaptureOptions& options) {
|
||||
+ std::unique_ptr<DesktopCapturer> capturer;
|
||||
+
|
||||
+#if defined(WEBRTC_USE_PIPEWIRE)
|
||||
+ if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
|
||||
+ capturer = std::make_unique<BaseCapturerPipeWire>(
|
||||
+ options, CaptureType::kAnyScreenContent);
|
||||
+ }
|
||||
+
|
||||
+ if (capturer && options.detect_updated_region()) {
|
||||
+ capturer.reset(new DesktopCapturerDifferWrapper(std::move(capturer)));
|
||||
+ }
|
||||
+#endif // defined(WEBRTC_USE_PIPEWIRE)
|
||||
+
|
||||
+ return capturer;
|
||||
+}
|
||||
+
|
||||
#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
|
||||
bool DesktopCapturer::IsRunningUnderWayland() {
|
||||
const char* xdg_session_type = getenv("XDG_SESSION_TYPE");
|
||||
diff --git a/modules/desktop_capture/desktop_capturer.h b/modules/desktop_capture/desktop_capturer.h
|
||||
index fd884f13ff771de2d5ea8b79ba530e9d3b03e913..9c7ecc78f46ea2e2c173416132318f0526714265 100644
|
||||
--- a/modules/desktop_capture/desktop_capturer.h
|
||||
+++ b/modules/desktop_capture/desktop_capturer.h
|
||||
@@ -186,6 +186,11 @@ class RTC_EXPORT DesktopCapturer {
|
||||
static std::unique_ptr<DesktopCapturer> CreateScreenCapturer(
|
||||
const DesktopCaptureOptions& options);
|
||||
|
||||
+ // Creates a DesktopCapturer instance which targets to capture windows and
|
||||
+ // screens.
|
||||
+ static std::unique_ptr<DesktopCapturer> CreateGenericCapturer(
|
||||
+ const DesktopCaptureOptions& options);
|
||||
+
|
||||
#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
|
||||
static bool IsRunningUnderWayland();
|
||||
|
||||
diff --git a/modules/desktop_capture/linux/wayland/screencast_portal.cc b/modules/desktop_capture/linux/wayland/screencast_portal.cc
|
||||
index a473802176a649a62f6d6a377f97daaa9d1e893c..61ed84ebb532521ce9a4af69355807b04f228859 100644
|
||||
--- a/modules/desktop_capture/linux/wayland/screencast_portal.cc
|
||||
+++ b/modules/desktop_capture/linux/wayland/screencast_portal.cc
|
||||
@@ -41,6 +41,8 @@ ScreenCastPortal::CaptureSourceType ScreenCastPortal::ToCaptureSourceType(
|
||||
return ScreenCastPortal::CaptureSourceType::kScreen;
|
||||
case CaptureType::kWindow:
|
||||
return ScreenCastPortal::CaptureSourceType::kWindow;
|
||||
+ case CaptureType::kAnyScreenContent:
|
||||
+ return ScreenCastPortal::CaptureSourceType::kAnyScreenContent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Athul Iddya <athul@iddya.com>
|
||||
Date: Sat, 22 Jul 2023 11:11:01 -0700
|
||||
Subject: fix: mark PipeWire capturer as failed after session is closed
|
||||
|
||||
After a PipeWire screencast session is successfully started, the
|
||||
consumer is expected to keep calling CaptureFrame() from the
|
||||
DesktopCapturer interface in a loop to pull frames. A PipeWire
|
||||
screencast session can be closed by the server on user action. Once the
|
||||
session is closed, there's no point in calling CaptureFrame() again as
|
||||
the capture has to be restarted. Inform the caller of the failure by
|
||||
returning Result::ERROR_PERMANENT on the next invocation of
|
||||
CaptureFrame().
|
||||
|
||||
diff --git a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
|
||||
index 4ef00e68ab58333648b8acaf4256f4b57a42734d..5a67c18c1d1f62aa5e3162d9778ca665bac4a1bb 100644
|
||||
--- a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
|
||||
+++ b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
|
||||
@@ -109,6 +109,7 @@ void BaseCapturerPipeWire::OnScreenCastRequestResult(RequestResponse result,
|
||||
void BaseCapturerPipeWire::OnScreenCastSessionClosed() {
|
||||
if (!capturer_failed_) {
|
||||
options_.screencast_stream()->StopScreenCastStream();
|
||||
+ capturer_failed_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,6 +234,33 @@ void DesktopCapturer::StartHandling(bool capture_window,
|
||||
// clear any existing captured sources.
|
||||
captured_sources_.clear();
|
||||
|
||||
if (capture_window && capture_screen) {
|
||||
// Some capturers like PipeWire suppport a single capturer for both screens
|
||||
// and windows. Use it if possible, treating both as window capture
|
||||
if (auto capturer = webrtc::DesktopCapturer::CreateGenericCapturer(
|
||||
content::desktop_capture::CreateDesktopCaptureOptions());
|
||||
capturer && capturer->GetDelegatedSourceListController()) {
|
||||
capture_screen_ = false;
|
||||
capture_window_ = capture_window;
|
||||
window_capturer_ = std::make_unique<NativeDesktopMediaList>(
|
||||
DesktopMediaList::Type::kWindow, std::move(capturer));
|
||||
window_capturer_->SetThumbnailSize(thumbnail_size);
|
||||
|
||||
OnceCallback update_callback = base::BindOnce(
|
||||
&DesktopCapturer::UpdateSourcesList, weak_ptr_factory_.GetWeakPtr(),
|
||||
window_capturer_.get());
|
||||
OnceCallback failure_callback = base::BindOnce(
|
||||
&DesktopCapturer::HandleFailure, weak_ptr_factory_.GetWeakPtr());
|
||||
|
||||
window_listener_ = std::make_unique<DesktopListListener>(
|
||||
std::move(update_callback), std::move(failure_callback),
|
||||
thumbnail_size.IsEmpty());
|
||||
window_capturer_->StartUpdating(window_listener_.get());
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Start listening for captured sources.
|
||||
capture_window_ = capture_window;
|
||||
capture_screen_ = capture_screen;
|
||||
@@ -372,6 +399,9 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
|
||||
v8::HandleScope scope(isolate);
|
||||
gin_helper::CallMethod(this, "_onfinished", captured_sources_);
|
||||
|
||||
screen_capturer_.reset();
|
||||
window_capturer_.reset();
|
||||
|
||||
Unpin();
|
||||
}
|
||||
}
|
||||
@@ -381,6 +411,9 @@ void DesktopCapturer::HandleFailure() {
|
||||
v8::HandleScope scope(isolate);
|
||||
gin_helper::CallMethod(this, "_onerror", "Failed to get sources.");
|
||||
|
||||
screen_capturer_.reset();
|
||||
window_capturer_.reset();
|
||||
|
||||
Unpin();
|
||||
}
|
||||
|
||||
|
||||
@@ -1881,7 +1881,7 @@ bool WebContents::EmitNavigationEvent(
|
||||
content::RenderFrameHost* initiator_frame_host =
|
||||
navigation_handle->GetInitiatorFrameToken().has_value()
|
||||
? content::RenderFrameHost::FromFrameToken(
|
||||
navigation_handle->GetInitiatorProcessID(),
|
||||
navigation_handle->GetInitiatorProcessId(),
|
||||
navigation_handle->GetInitiatorFrameToken().value())
|
||||
: nullptr;
|
||||
|
||||
@@ -2047,7 +2047,8 @@ void WebContents::MessageSync(
|
||||
|
||||
void WebContents::MessageTo(int32_t web_contents_id,
|
||||
const std::string& channel,
|
||||
blink::CloneableMessage arguments) {
|
||||
blink::CloneableMessage arguments,
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
TRACE_EVENT1("electron", "WebContents::MessageTo", "channel", channel);
|
||||
auto* target_web_contents = FromID(web_contents_id);
|
||||
|
||||
@@ -2063,8 +2064,10 @@ void WebContents::MessageTo(int32_t web_contents_id,
|
||||
return;
|
||||
|
||||
int32_t sender_id = ID();
|
||||
bool sender_is_main_frame = render_frame_host->GetParent() == nullptr;
|
||||
web_frame_main->GetRendererApi()->Message(false /* internal */, channel,
|
||||
std::move(arguments), sender_id);
|
||||
std::move(arguments), sender_id,
|
||||
sender_is_main_frame);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -436,7 +436,8 @@ class WebContents : public ExclusiveAccessContext,
|
||||
content::RenderFrameHost* render_frame_host);
|
||||
void MessageTo(int32_t web_contents_id,
|
||||
const std::string& channel,
|
||||
blink::CloneableMessage arguments);
|
||||
blink::CloneableMessage arguments,
|
||||
content::RenderFrameHost* render_frame_host);
|
||||
void MessageHost(const std::string& channel,
|
||||
blink::CloneableMessage arguments,
|
||||
content::RenderFrameHost* render_frame_host);
|
||||
|
||||
@@ -185,7 +185,8 @@ void WebFrameMain::Send(v8::Isolate* isolate,
|
||||
return;
|
||||
|
||||
GetRendererApi()->Message(internal, channel, std::move(message),
|
||||
0 /* sender_id */);
|
||||
0 /* sender_id */,
|
||||
false /* sender_is_main_frame */);
|
||||
}
|
||||
|
||||
const mojo::Remote<mojom::ElectronRenderer>& WebFrameMain::GetRendererApi() {
|
||||
|
||||
@@ -82,7 +82,8 @@ void ElectronApiIPCHandlerImpl::MessageTo(int32_t web_contents_id,
|
||||
blink::CloneableMessage arguments) {
|
||||
api::WebContents* api_web_contents = api::WebContents::From(web_contents());
|
||||
if (api_web_contents) {
|
||||
api_web_contents->MessageTo(web_contents_id, channel, std::move(arguments));
|
||||
api_web_contents->MessageTo(web_contents_id, channel, std::move(arguments),
|
||||
GetRenderFrameHost());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -198,10 +198,6 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
|
||||
SetSizeConstraints(size_constraints);
|
||||
}
|
||||
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
|
||||
bool resizable;
|
||||
if (options.Get(options::kResizable, &resizable)) {
|
||||
SetResizable(resizable);
|
||||
}
|
||||
bool closable;
|
||||
if (options.Get(options::kClosable, &closable)) {
|
||||
SetClosable(closable);
|
||||
@@ -223,6 +219,7 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
|
||||
if (options.Get(options::kAlwaysOnTop, &top) && top) {
|
||||
SetAlwaysOnTop(ui::ZOrderLevel::kFloatingWindow);
|
||||
}
|
||||
|
||||
bool fullscreenable = true;
|
||||
bool fullscreen = false;
|
||||
if (options.Get(options::kFullscreen, &fullscreen) && !fullscreen) {
|
||||
@@ -231,12 +228,18 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
|
||||
fullscreenable = false;
|
||||
#endif
|
||||
}
|
||||
// Overridden by 'fullscreenable'.
|
||||
|
||||
options.Get(options::kFullScreenable, &fullscreenable);
|
||||
SetFullScreenable(fullscreenable);
|
||||
if (fullscreen) {
|
||||
|
||||
if (fullscreen)
|
||||
SetFullScreen(true);
|
||||
|
||||
bool resizable;
|
||||
if (options.Get(options::kResizable, &resizable)) {
|
||||
SetResizable(resizable);
|
||||
}
|
||||
|
||||
bool skip;
|
||||
if (options.Get(options::kSkipTaskbar, &skip)) {
|
||||
SetSkipTaskbar(skip);
|
||||
|
||||
@@ -820,7 +820,24 @@ void NativeWindowMac::MoveTop() {
|
||||
void NativeWindowMac::SetResizable(bool resizable) {
|
||||
ScopedDisableResize disable_resize;
|
||||
SetStyleMask(resizable, NSWindowStyleMaskResizable);
|
||||
|
||||
// Right now, resizable and fullscreenable are decoupled in
|
||||
// documentation and on Windows/Linux. Chromium disables
|
||||
// fullscreenability if resizability is false on macOS as well
|
||||
// as disabling the maximize traffic light unless the window
|
||||
// is both resizable and maximizable. To work around this, we want
|
||||
// to match behavior on other platforms by disabiliting the maximize
|
||||
// button but keeping fullscreenability enabled.
|
||||
// TODO(codebytere): refactor this once we have a better solution.
|
||||
SetCanResize(resizable);
|
||||
if (!resizable) {
|
||||
SetFullScreenable(true);
|
||||
[[window_ standardWindowButton:NSWindowZoomButton] setEnabled:false];
|
||||
} else {
|
||||
SetFullScreenable(true);
|
||||
[[window_ standardWindowButton:NSWindowZoomButton]
|
||||
setEnabled:IsFullScreenable()];
|
||||
}
|
||||
}
|
||||
|
||||
bool NativeWindowMac::IsResizable() {
|
||||
|
||||
@@ -23,6 +23,10 @@ class NativeWindowMac;
|
||||
int level_;
|
||||
bool is_resizable_;
|
||||
|
||||
// Whether the window is currently minimized. Used to work
|
||||
// around a macOS bug with child window minimization.
|
||||
bool is_minimized_;
|
||||
|
||||
// Only valid during a live resize.
|
||||
// Used to keep track of whether a resize is happening horizontally or
|
||||
// vertically, even if physically the user is resizing in both directions.
|
||||
|
||||
@@ -51,10 +51,22 @@ using FullScreenTransitionState =
|
||||
|
||||
// check occlusion binary flag
|
||||
if (window.occlusionState & NSWindowOcclusionStateVisible) {
|
||||
// The app is visible
|
||||
// There's a macOS bug where if a child window is minimized, and then both
|
||||
// windows are restored via activation of the parent window, the child
|
||||
// window is not properly deminiaturized. This causes traffic light bugs
|
||||
// like the close and miniaturize buttons having no effect. We need to call
|
||||
// deminiaturize on the child window to fix this. Unfortunately, this also
|
||||
// hits ANOTHER bug where even after calling deminiaturize,
|
||||
// windowDidDeminiaturize is not posted on the child window if it was
|
||||
// incidentally restored by the parent, so we need to manually reset
|
||||
// is_minimized_ here.
|
||||
if (shell_->parent() && is_minimized_) {
|
||||
shell_->Restore();
|
||||
is_minimized_ = false;
|
||||
}
|
||||
|
||||
shell_->NotifyWindowShow();
|
||||
} else {
|
||||
// The app is not visible
|
||||
shell_->NotifyWindowHide();
|
||||
}
|
||||
}
|
||||
@@ -244,11 +256,15 @@ using FullScreenTransitionState =
|
||||
|
||||
- (void)windowDidMiniaturize:(NSNotification*)notification {
|
||||
[super windowDidMiniaturize:notification];
|
||||
is_minimized_ = true;
|
||||
|
||||
shell_->NotifyWindowMinimize();
|
||||
}
|
||||
|
||||
- (void)windowDidDeminiaturize:(NSNotification*)notification {
|
||||
[super windowDidDeminiaturize:notification];
|
||||
is_minimized_ = false;
|
||||
|
||||
shell_->AttachChildren();
|
||||
shell_->SetWindowLevel(level_);
|
||||
shell_->NotifyWindowRestore();
|
||||
|
||||
@@ -10,7 +10,8 @@ interface ElectronRenderer {
|
||||
bool internal,
|
||||
string channel,
|
||||
blink.mojom.CloneableMessage arguments,
|
||||
int32 sender_id);
|
||||
int32 sender_id,
|
||||
bool sender_is_main_frame);
|
||||
|
||||
ReceivePostMessage(string channel, blink.mojom.TransferableMessage message);
|
||||
|
||||
|
||||
@@ -83,7 +83,8 @@ void EmitIPCEvent(v8::Local<v8::Context> context,
|
||||
const std::string& channel,
|
||||
std::vector<v8::Local<v8::Value>> ports,
|
||||
v8::Local<v8::Value> args,
|
||||
int32_t sender_id) {
|
||||
int32_t sender_id = 0,
|
||||
bool sender_is_main_frame = false) {
|
||||
auto* isolate = context->GetIsolate();
|
||||
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
@@ -92,9 +93,12 @@ void EmitIPCEvent(v8::Local<v8::Context> context,
|
||||
v8::MicrotasksScope::kRunMicrotasks);
|
||||
|
||||
std::vector<v8::Local<v8::Value>> argv = {
|
||||
gin::ConvertToV8(isolate, internal), gin::ConvertToV8(isolate, channel),
|
||||
gin::ConvertToV8(isolate, ports), args,
|
||||
gin::ConvertToV8(isolate, sender_id)};
|
||||
gin::ConvertToV8(isolate, internal),
|
||||
gin::ConvertToV8(isolate, channel),
|
||||
gin::ConvertToV8(isolate, ports),
|
||||
args,
|
||||
gin::ConvertToV8(isolate, sender_id),
|
||||
gin::ConvertToV8(isolate, sender_is_main_frame)};
|
||||
|
||||
InvokeIpcCallback(context, "onMessage", argv);
|
||||
}
|
||||
@@ -157,7 +161,8 @@ void ElectronApiServiceImpl::OnConnectionError() {
|
||||
void ElectronApiServiceImpl::Message(bool internal,
|
||||
const std::string& channel,
|
||||
blink::CloneableMessage arguments,
|
||||
int32_t sender_id) {
|
||||
int32_t sender_id,
|
||||
bool sender_is_main_frame) {
|
||||
blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
|
||||
if (!frame)
|
||||
return;
|
||||
@@ -170,7 +175,8 @@ void ElectronApiServiceImpl::Message(bool internal,
|
||||
|
||||
v8::Local<v8::Value> args = gin::ConvertToV8(isolate, arguments);
|
||||
|
||||
EmitIPCEvent(context, internal, channel, {}, args, sender_id);
|
||||
EmitIPCEvent(context, internal, channel, {}, args, sender_id,
|
||||
sender_is_main_frame);
|
||||
}
|
||||
|
||||
void ElectronApiServiceImpl::ReceivePostMessage(
|
||||
@@ -197,8 +203,7 @@ void ElectronApiServiceImpl::ReceivePostMessage(
|
||||
|
||||
std::vector<v8::Local<v8::Value>> args = {message_value};
|
||||
|
||||
EmitIPCEvent(context, false, channel, ports, gin::ConvertToV8(isolate, args),
|
||||
0);
|
||||
EmitIPCEvent(context, false, channel, ports, gin::ConvertToV8(isolate, args));
|
||||
}
|
||||
|
||||
void ElectronApiServiceImpl::TakeHeapSnapshot(
|
||||
|
||||
@@ -35,7 +35,8 @@ class ElectronApiServiceImpl : public mojom::ElectronRenderer,
|
||||
void Message(bool internal,
|
||||
const std::string& channel,
|
||||
blink::CloneableMessage arguments,
|
||||
int32_t sender_id) override;
|
||||
int32_t sender_id,
|
||||
bool sender_is_main_frame) override;
|
||||
void ReceivePostMessage(const std::string& channel,
|
||||
blink::TransferableMessage message) override;
|
||||
void TakeHeapSnapshot(mojo::ScopedHandle file,
|
||||
|
||||
@@ -9,7 +9,14 @@ describe('ipcRenderer module', () => {
|
||||
|
||||
let w: BrowserWindow;
|
||||
before(async () => {
|
||||
w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
|
||||
w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
nodeIntegrationInSubFrames: true,
|
||||
contextIsolation: false
|
||||
}
|
||||
});
|
||||
await w.loadURL('about:blank');
|
||||
});
|
||||
after(async () => {
|
||||
@@ -154,7 +161,36 @@ describe('ipcRenderer module', () => {
|
||||
ipcRenderer.sendTo(${contents.id}, 'ping', ${JSON.stringify(payload)})
|
||||
ipcRenderer.once('pong', (event, data) => resolve(data))
|
||||
})`);
|
||||
expect(data).to.equal(payload);
|
||||
expect(data.payload).to.equal(payload);
|
||||
expect(data.senderIsMainFrame).to.be.true();
|
||||
});
|
||||
|
||||
it('sends message to WebContents from a child frame', async () => {
|
||||
const frameCreated = once(w.webContents, 'frame-created') as Promise<[any, Electron.FrameCreatedDetails]>;
|
||||
|
||||
const promise = w.webContents.executeJavaScript(`new Promise(resolve => {
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.src = 'data:text/html,';
|
||||
iframe.name = 'iframe';
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
const { ipcRenderer } = require('electron');
|
||||
ipcRenderer.once('pong', (event, data) => resolve(data));
|
||||
})`);
|
||||
|
||||
const [, details] = await frameCreated;
|
||||
expect(details.frame.name).to.equal('iframe');
|
||||
|
||||
await once(details.frame, 'dom-ready');
|
||||
|
||||
details.frame.executeJavaScript(`new Promise(resolve => {
|
||||
const { ipcRenderer } = require('electron');
|
||||
ipcRenderer.sendTo(${contents.id}, 'ping', ${JSON.stringify(payload)});
|
||||
})`);
|
||||
|
||||
const data = await promise;
|
||||
expect(data.payload).to.equal(payload);
|
||||
expect(data.senderIsMainFrame).to.be.false();
|
||||
});
|
||||
|
||||
it('sends message on channel with non-ASCII characters to WebContents', async () => {
|
||||
|
||||
@@ -1222,64 +1222,69 @@ describe('asar package', function () {
|
||||
});
|
||||
});
|
||||
|
||||
ifdescribe(features.isRunAsNodeEnabled())('child_process.fork', function () {
|
||||
itremote('opens a normal js file', async function () {
|
||||
const child = require('child_process').fork(path.join(asarDir, 'a.asar', 'ping.js'));
|
||||
child.send('message');
|
||||
const msg = await new Promise(resolve => child.once('message', resolve));
|
||||
expect(msg).to.equal('message');
|
||||
function generateSpecs (childProcess: string) {
|
||||
ifdescribe(features.isRunAsNodeEnabled())(`${childProcess}.fork`, function () {
|
||||
itremote('opens a normal js file', async function (childProcess: string) {
|
||||
const child = require(childProcess).fork(path.join(asarDir, 'a.asar', 'ping.js'));
|
||||
child.send('message');
|
||||
const msg = await new Promise(resolve => child.once('message', resolve));
|
||||
expect(msg).to.equal('message');
|
||||
}, [childProcess]);
|
||||
|
||||
itremote('supports asar in the forked js', async function (childProcess: string, fixtures: string) {
|
||||
const file = path.join(asarDir, 'a.asar', 'file1');
|
||||
const child = require(childProcess).fork(path.join(fixtures, 'module', 'asar.js'));
|
||||
child.send(file);
|
||||
const content = await new Promise(resolve => child.once('message', resolve));
|
||||
expect(content).to.equal(fs.readFileSync(file).toString());
|
||||
}, [childProcess, fixtures]);
|
||||
});
|
||||
|
||||
itremote('supports asar in the forked js', async function (fixtures: string) {
|
||||
const file = path.join(asarDir, 'a.asar', 'file1');
|
||||
const child = require('child_process').fork(path.join(fixtures, 'module', 'asar.js'));
|
||||
child.send(file);
|
||||
const content = await new Promise(resolve => child.once('message', resolve));
|
||||
expect(content).to.equal(fs.readFileSync(file).toString());
|
||||
}, [fixtures]);
|
||||
});
|
||||
describe(`${childProcess}.exec`, function () {
|
||||
itremote('should not try to extract the command if there is a reference to a file inside an .asar', async function (childProcess: string) {
|
||||
const echo = path.join(asarDir, 'echo.asar', 'echo');
|
||||
|
||||
describe('child_process.exec', function () {
|
||||
itremote('should not try to extract the command if there is a reference to a file inside an .asar', async function () {
|
||||
const echo = path.join(asarDir, 'echo.asar', 'echo');
|
||||
|
||||
const stdout = await promisify(require('child_process').exec)('echo ' + echo + ' foo bar');
|
||||
expect(stdout.toString().replace(/\r/g, '')).to.equal(echo + ' foo bar\n');
|
||||
});
|
||||
});
|
||||
|
||||
describe('child_process.execSync', function () {
|
||||
itremote('should not try to extract the command if there is a reference to a file inside an .asar', async function () {
|
||||
const echo = path.join(asarDir, 'echo.asar', 'echo');
|
||||
|
||||
const stdout = require('child_process').execSync('echo ' + echo + ' foo bar');
|
||||
expect(stdout.toString().replace(/\r/g, '')).to.equal(echo + ' foo bar\n');
|
||||
});
|
||||
});
|
||||
|
||||
ifdescribe(process.platform === 'darwin' && process.arch !== 'arm64')('child_process.execFile', function () {
|
||||
itremote('executes binaries', async function () {
|
||||
const echo = path.join(asarDir, 'echo.asar', 'echo');
|
||||
const stdout = await promisify(require('child_process').execFile)(echo, ['test']);
|
||||
expect(stdout).to.equal('test\n');
|
||||
const stdout = await promisify(require(childProcess).exec)('echo ' + echo + ' foo bar');
|
||||
expect(stdout.toString().replace(/\r/g, '')).to.equal(echo + ' foo bar\n');
|
||||
}, [childProcess]);
|
||||
});
|
||||
|
||||
itremote('executes binaries without callback', async function () {
|
||||
const echo = path.join(asarDir, 'echo.asar', 'echo');
|
||||
const process = require('child_process').execFile(echo, ['test']);
|
||||
const code = await new Promise(resolve => process.once('close', resolve));
|
||||
expect(code).to.equal(0);
|
||||
process.on('error', function () {
|
||||
throw new Error('error');
|
||||
});
|
||||
describe(`${childProcess}.execSync`, function () {
|
||||
itremote('should not try to extract the command if there is a reference to a file inside an .asar', async function (childProcess: string) {
|
||||
const echo = path.join(asarDir, 'echo.asar', 'echo');
|
||||
|
||||
const stdout = require(childProcess).execSync('echo ' + echo + ' foo bar');
|
||||
expect(stdout.toString().replace(/\r/g, '')).to.equal(echo + ' foo bar\n');
|
||||
}, [childProcess]);
|
||||
});
|
||||
|
||||
itremote('execFileSync executes binaries', function () {
|
||||
const echo = path.join(asarDir, 'echo.asar', 'echo');
|
||||
const output = require('child_process').execFileSync(echo, ['test']);
|
||||
expect(String(output)).to.equal('test\n');
|
||||
ifdescribe(process.platform === 'darwin' && process.arch !== 'arm64')(`${childProcess}.execFile`, function () {
|
||||
itremote('executes binaries', async function (childProcess: string) {
|
||||
const echo = path.join(asarDir, 'echo.asar', 'echo');
|
||||
const stdout = await promisify(require(childProcess).execFile)(echo, ['test']);
|
||||
expect(stdout).to.equal('test\n');
|
||||
}, [childProcess]);
|
||||
|
||||
itremote('executes binaries without callback', async function (childProcess: string) {
|
||||
const echo = path.join(asarDir, 'echo.asar', 'echo');
|
||||
const process = require(childProcess).execFile(echo, ['test']);
|
||||
const code = await new Promise(resolve => process.once('close', resolve));
|
||||
expect(code).to.equal(0);
|
||||
process.on('error', function () {
|
||||
throw new Error('error');
|
||||
});
|
||||
}, [childProcess]);
|
||||
|
||||
itremote('execFileSync executes binaries', function (childProcess: string) {
|
||||
const echo = path.join(asarDir, 'echo.asar', 'echo');
|
||||
const output = require(childProcess).execFileSync(echo, ['test']);
|
||||
expect(String(output)).to.equal('test\n');
|
||||
}, [childProcess]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
generateSpecs('child_process');
|
||||
generateSpecs('node:child_process');
|
||||
|
||||
describe('internalModuleReadJSON', function () {
|
||||
itremote('reads a normal file', function () {
|
||||
|
||||
@@ -1304,6 +1304,94 @@ describe('chromium features', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('IdleDetection', () => {
|
||||
afterEach(closeAllWindows);
|
||||
afterEach(() => {
|
||||
session.defaultSession.setPermissionCheckHandler(null);
|
||||
session.defaultSession.setPermissionRequestHandler(null);
|
||||
});
|
||||
|
||||
it('can grant a permission request', async () => {
|
||||
session.defaultSession.setPermissionRequestHandler(
|
||||
(_wc, permission, callback) => {
|
||||
callback(permission === 'idle-detection');
|
||||
}
|
||||
);
|
||||
|
||||
const w = new BrowserWindow({ show: false });
|
||||
await w.loadFile(path.join(fixturesPath, 'pages', 'button.html'));
|
||||
const permission = await w.webContents.executeJavaScript(`
|
||||
new Promise((resolve, reject) => {
|
||||
const button = document.getElementById('button');
|
||||
button.addEventListener("click", async () => {
|
||||
const permission = await IdleDetector.requestPermission();
|
||||
resolve(permission);
|
||||
});
|
||||
button.click();
|
||||
});
|
||||
`, true);
|
||||
|
||||
expect(permission).to.eq('granted');
|
||||
});
|
||||
|
||||
it('can deny a permission request', async () => {
|
||||
session.defaultSession.setPermissionRequestHandler(
|
||||
(_wc, permission, callback) => {
|
||||
callback(permission !== 'idle-detection');
|
||||
}
|
||||
);
|
||||
|
||||
const w = new BrowserWindow({ show: false });
|
||||
await w.loadFile(path.join(fixturesPath, 'pages', 'button.html'));
|
||||
const permission = await w.webContents.executeJavaScript(`
|
||||
new Promise((resolve, reject) => {
|
||||
const button = document.getElementById('button');
|
||||
button.addEventListener("click", async () => {
|
||||
const permission = await IdleDetector.requestPermission();
|
||||
resolve(permission);
|
||||
});
|
||||
button.click();
|
||||
});
|
||||
`, true);
|
||||
|
||||
expect(permission).to.eq('denied');
|
||||
});
|
||||
|
||||
it('can allow the IdleDetector to start', async () => {
|
||||
session.defaultSession.setPermissionCheckHandler((wc, permission) => {
|
||||
return permission === 'idle-detection';
|
||||
});
|
||||
|
||||
const w = new BrowserWindow({ show: false });
|
||||
await w.loadFile(path.join(fixturesPath, 'pages', 'blank.html'));
|
||||
const result = await w.webContents.executeJavaScript(`
|
||||
const detector = new IdleDetector({ threshold: 60000 });
|
||||
detector.start().then(() => {
|
||||
return 'success';
|
||||
}).catch(e => e.message);
|
||||
`, true);
|
||||
|
||||
expect(result).to.eq('success');
|
||||
});
|
||||
|
||||
it('can prevent the IdleDetector from starting', async () => {
|
||||
session.defaultSession.setPermissionCheckHandler((wc, permission) => {
|
||||
return permission !== 'idle-detection';
|
||||
});
|
||||
|
||||
const w = new BrowserWindow({ show: false });
|
||||
await w.loadFile(path.join(fixturesPath, 'pages', 'blank.html'));
|
||||
const result = await w.webContents.executeJavaScript(`
|
||||
const detector = new IdleDetector({ threshold: 60000 });
|
||||
detector.start().then(() => {
|
||||
console.log('success')
|
||||
}).catch(e => e.message);
|
||||
`, true);
|
||||
|
||||
expect(result).to.eq('Idle detection permission denied');
|
||||
});
|
||||
});
|
||||
|
||||
describe('navigator.mediaDevices', () => {
|
||||
afterEach(closeAllWindows);
|
||||
afterEach(() => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { ipcRenderer } = require('electron');
|
||||
|
||||
ipcRenderer.on('ping', function (event, payload) {
|
||||
ipcRenderer.sendTo(event.senderId, 'pong', payload);
|
||||
ipcRenderer.on('ping', function ({ senderId, senderIsMainFrame }, payload) {
|
||||
ipcRenderer.sendTo(senderId, 'pong', { payload, senderIsMainFrame });
|
||||
});
|
||||
|
||||
ipcRenderer.on('ping-æøåü', function (event, payload) {
|
||||
|
||||
5
spec/fixtures/pages/button.html
vendored
Normal file
5
spec/fixtures/pages/button.html
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<button id="button">CLICK</button>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user