Compare commits

..

26 Commits

Author SHA1 Message Date
Charles Kerr
b417696d6b refactor: migrate electron::api::Protocol to cppgc (#50857)
refactor: migrate api::Protocol to cppgc
2026-04-10 15:58:33 +09:00
Mitchell Cohen
4203d7688f fix: external resize hit targets for frameless windows on Windows (#50706) 2026-04-09 18:13:13 -05:00
Zeenat Lawal
62e637275a fix: move Electron help menu links to default app only (#50629)
* fix: remove Electron links from default help menu

* fix: remove help menu entirely from default menu

* fix: move Electron help menu links to default app

* docs: update default menu items list in menu.md
2026-04-09 12:14:22 -07:00
Shelley Vohr
28c0eb29df fix: webContents.print() ignoring mediaSize when silent (#50808)
fix: webContents.print() ignoring mediaSize when silent

PR #49523 moved the default media size fallback into OnGetDeviceNameToUse,
but the new code unconditionally writes kSettingMediaSize — clobbering
any mediaSize the caller had already set in WebContents::Print() from
options.mediaSize / pageSize. As a result, silent prints with an
explicit pageSize (e.g. "Letter") fell back to A4 with tiny content.

Only populate the default/printer media size when the caller hasn't
already supplied one, preserving the precedence:
  1. user-supplied mediaSize / pageSize
  2. printer default (when usePrinterDefaultPageSize is true)
  3. A4 fallback
2026-04-09 12:16:40 -05:00
Charles Kerr
8a730e2aec fix: remove dangling raw_ptr api::WebContents::zoom_controller_ (#50812)
fix: remove dangling raw_ptr api::WebContents::zoom_controller_
2026-04-09 12:16:17 -05:00
Shelley Vohr
044be7ce40 fix: avoid crash in window.print() when prefilling native print dialog (#50843)
fix: avoid crash in window.print() when prefilling native print dialog

When UpdatePrinterSettings() fails (e.g. the printer rejects the
requested resolution), OnError() nullifies print_info_ via
ReleaseContext(). The return value was not checked, so
AskUserForSettings() passed nil to [NSPrintPanel runModalWithPrintInfo:],
crashing in PJCSessionHasApplicationSetPrinter with a null PMPrintSession.

Check the return value and fall back to UseDefaultSettings() on failure
so the dialog opens with defaults instead of crashing.
2026-04-09 13:14:36 -04:00
Shelley Vohr
7245c6a3f0 ci: re-check signed commits on every PR synchronize (#50811)
The needs-signed-commits label was previously added by the lightweight
synchronize workflow but only removed by a job in build.yml gated on
`gha-done`, which requires every macOS/Linux/Windows build to finish
green. That made label removal both slow (waits on the full pipeline)
and fragile (any unrelated build failure leaves the label pinned even
after commits are properly signed).

Drop the `if` guard on the synchronize job so it re-evaluates signing
on every push, and add a removal step that runs on success when the
label is present. Force-pushing signed commits now clears the label as
soon as the check completes, with no dependency on the build pipeline.
2026-04-09 11:02:01 -04:00
Charles Kerr
b484b0bde9 fix: fix inset and stop using gfx::ToFlooredRectDeprecated() (#50809)
fix: fix inset and stop using ToFlooredRectDeprecated()
2026-04-09 09:55:11 -05:00
Charles Kerr
6c8a910232 refactor: remove unnecessary raw_ptr SavePageHandler::web_contents_ (#50810)
refactor: remove unnecessary field raw_ptr<content::WebContents> SavePageHandler::web_contents_
2026-04-09 09:54:44 -05:00
Noah Gregory
cc3d4f5f58 fix: PDF support when site isolation trials disabled (#50689)
* fix: use proper OOPIF PDF check in `StreamsPrivateAPI`

* fix: add `ShouldEnableSubframeZoom` override to `ElectronBrowserClient` for upstream parity

* fix: add `MaybeOverrideLocalURLCrossOriginEmbedderPolicy` override to `ElectronBrowserClient` for upstream parity

* fix: add `DoesSiteRequireDedicatedProcess` override to `ElectronBrowserClient` for upstream parity

* style: move `DoesSiteRequireDedicatedProcess` to correct override section
2026-04-09 15:35:26 +02:00
Shelley Vohr
b711ce7b04 chore: remove window enlargement revert patch (#50612)
* chore: remove window enlargement revert patch

Chromium removed the `window_enlargement_` system from
DesktopWindowTreeHostWin (1771dbae), which was a workaround for an AMD
driver bug from 2013 (crbug.com/286609) where translucent HWNDs smaller
than 64x64 caused graphical glitches. Chromium confirmed this is no
longer needed and shipped the removal.

This removes the revert patch and all Electron-side code that depended
on the `kEnableTransparentHwndEnlargement` feature flag, including the
`GetExpandedWindowSize` helper and max size constraint expansion in
`NativeWindow::GetContentMaximumSize`.

* test: remove obsolete <64x64 transparent window test

The test was added in 2018 (#12904) to verify the AMD driver
workaround that artificially enlarged translucent HWNDs smaller than
64x64 (crbug.com/286609). The workaround set the real HWND to 64x64
and subtracted a stored window_enlargement_ from every client/window
bounds query, so getContentSize() reported the originally-requested
size even though the actual HWND was larger.

With both the Chromium window_enlargement_ system and Electron's
GetExpandedWindowSize gone, setContentSize on a transparent
thickFrame window calls SetWindowPos directly. WS_THICKFRAME windows
are subject to DefWindowProc's MINMAXINFO.ptMinTrackSize clamp on
programmatic resizes (Chromium's OnGetMinMaxInfo ends with
SetMsgHandled(FALSE), so DefWindowProc overwrites the zeroed
min-track with system defaults), which on Windows Server 2025
floors at 32x39 — hence the failing [32, 39] vs [30, 30].

The removed feature_list.cc comment explicitly flagged this test as
the blocker for retiring kEnableTransparentHwndEnlargement, so
delete it alongside the workaround it was validating.
2026-04-09 15:34:10 +02:00
Alexey
adf9a6e303 fix: restore std::deque for dynamic crash key storage (#50795)
#47171 migrated `std::deque` to `base::circular_deque` in
`shell/common/crash_keys.cc`. However, `CrashKeyString` wraps a
`crashpad::Annotation` that holds self-referential pointers and
registers itself in a process-global linked list. `circular_deque`
relocates elements on growth (via `VectorBuffer::MoveConstructRange`),
leaving those pointers dangling — causing missing crash keys or a hung
crashpad handler (especially on macOS). The `base/containers/README.md`
warns: "Since `base::deque` does not have stable iterators and it will
move the objects it contains, it may not be appropriate for all uses."

Reverts to `std::deque`, whose block-based layout never relocates
existing elements. Adds a regression test that registers 50 dynamic
crash keys and verifies they all survive a renderer crash.

Notes: Fixed crash keys being lost and the crash reporter hanging on
macOS when many dynamic crash keys were registered.

Made-with: Cursor
2026-04-09 10:50:32 +02:00
Calvin
6744293e96 fix: account for extraSize in aspect ratio min/max clamping on macOS (#50794)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 10:50:17 +02:00
dependabot[bot]
0d3342debf build(deps-dev): bump @xmldom/xmldom from 0.8.11 to 0.8.12 in the npm_and_yarn group across 1 directory (#50824)
build(deps-dev): bump @xmldom/xmldom

Bumps the npm_and_yarn group with 1 update in the / directory: [@xmldom/xmldom](https://github.com/xmldom/xmldom).


Updates `@xmldom/xmldom` from 0.8.11 to 0.8.12
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/xmldom/xmldom/compare/0.8.11...0.8.12)

---
updated-dependencies:
- dependency-name: "@xmldom/xmldom"
  dependency-version: 0.8.12
  dependency-type: direct:development
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-09 09:54:13 +02:00
Calvin
157cdac4b9 test: use shared get_out_dir() in generate_node_headers.py (#50828)
The local get_out_dir() defaulted to 'Testing' instead of 'Default',
causing e test to fail when using a non-Testing build config. Replace
it with the canonical version from script/lib/util.py.
2026-04-09 09:52:14 +02:00
Shelley Vohr
4dfada86ce fix: menu items not cleaned up after rebuild (#50806)
Menu was holding a SelfKeepAlive to itself from construction, so any
Menu that was never opened (e.g. an application menu replaced before
being shown) stayed pinned in cppgc forever. Repeated calls to
Menu.setApplicationMenu leaked every prior Menu along with its model
and items.

Restore the original Pin/Unpin lifecycle: start keep_alive_ empty and
only assign `this` in OnMenuWillShow. OnMenuWillClose already clears
it.
2026-04-09 11:56:39 +09:00
Kanishk Ranjan
df81a1d4ac test: add desktopCapturer icon validation (#50261)
* chore: testing of desktopCapturer can run on arm

* fix: DesktopMediaListCaptureThread crash

Fixed a crash when Windows calls ::CoCreateInstance() in the
DesktopMediaListCaptureThread before COM is initialized.

* test: added test for desktopCapturer fetchWindowIcons

* chore: updating Chromium patch hash

---------

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2026-04-08 14:56:27 -04:00
Shelley Vohr
c3e3958668 fix: devtools re-attaches on open when previously detached (#50807)
PR #50646 added a dock state allowlist in SetDockState() that collapsed any
non-matching value to "right". WebContents::OpenDevTools passes an empty
string when no `mode` option is given, which is the sentinel LoadCompleted()
uses to restore `currentDockState` from prefs. The allowlist clobbered that
sentinel to "right", so previously-undocked devtools would flash detached
and then snap back to the right dock.

Preserve the empty string through SetDockState() so the pref-restore path
runs; still reject any non-empty invalid value to keep the JS-injection
guard from #50646 intact.
2026-04-08 13:36:47 -04:00
electron-roller[bot]
afd5fb4a60 chore: bump chromium to 148.0.7778.0 (main) (#50769)
* chore: bump chromium in DEPS to 148.0.7776.0

* chore: bump chromium in DEPS to 148.0.7778.0

* fix(patch): buffered_data_source_host_impl include added upstream

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7712714

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fix(patch): ASan process info callback added upstream

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7724018

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fix(patch): ServiceProcessHost per-instance observer migration

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7700794

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fix(patch): FSA BlockPath factory method refactor

Upstream refactored BlockPath initialization to use factory methods
(CreateRelative, CreateAbsolute, CreateSuffix) and a switch statement.
Updated the exposed code in the header to match.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7665590

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fix(patch): service process tracker per-instance observer refactor

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7700794

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* chore: update patches (trivial only)

* 7723958: Rename blink::WebString::FromUTF16() to FromUtf16()

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7723958

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fixup! fix(patch): ASan process info callback added upstream

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <samuelmaddock@electronjs.org>
Co-authored-by: Claude <svc-devxp-claude@slack-corp.com>
2026-04-08 13:34:24 -04:00
Charles Kerr
8679522922 chore: iwyu commonly-included headers in shell/ (#50778)
* chore: iwyu in shell/browser/api/electron_api_web_contents.h

* chore: iwyu in shell/browser/browser.h

* chore: iwyu in shell/browser/javascript_environment.h

* chore: iwyu in shell/common/gin_hhelper/function_template.h

* chore: do not include node_includes.h if we are not using it

* chore: fix transitive include
2026-04-08 09:33:42 -05:00
David Sanders
0828de3ccd ci: include .obj checksums when calculating object change rate (#50772) 2026-04-08 14:57:40 +02:00
Michaela Laurencin
6b5a4ff66c ci: allow ai-pr label without comment (#50792) 2026-04-08 13:09:23 +02:00
Charles Kerr
ca28023d4d chore: remove unused enum classes (#50782)
chore: remove unused FileSystemAccessPermissionContext::Access enum class

chore: remove unused FileSystemAccessPermissionContext::RequestType enum class

declared in 344aba08 but never used
2026-04-08 09:41:38 +02:00
Samuel Attard
e60441ad60 build: update build-tools to latest (#50786) 2026-04-08 09:31:12 +02:00
Charles Kerr
a189425373 fix: dangling raw_ptr api::Session::browser_context_ (#50784)
* fix: dangling raw_ptr api::Session::browser_context_

* fix: address code review feedback
2026-04-08 15:04:29 +09:00
Charles Kerr
7eccea1315 refactor: remove use of deprecated class base::MemoryPressureListener (#50763) 2026-04-07 20:11:02 -05:00
112 changed files with 1167 additions and 1159 deletions

View File

@@ -15,7 +15,7 @@ runs:
git config --global core.preloadindex true
git config --global core.longpaths true
fi
export BUILD_TOOLS_SHA=a0cc95a1884a631559bcca0c948465b725d9295a
export BUILD_TOOLS_SHA=1b7bd25dae4a780bb3170fff56c9327b53aaf7eb
npm i -g @electron/build-tools
# Update depot_tools to ensure python
e d update_depot_tools
@@ -29,4 +29,4 @@ runs:
else
echo "$HOME/.electron_build_tools/third_party/depot_tools" >> $GITHUB_PATH
echo "$HOME/.electron_build_tools/third_party/depot_tools/python-bin" >> $GITHUB_PATH
fi
fi

View File

@@ -442,34 +442,7 @@ jobs:
contents: read
needs: [docs-only, macos-x64, macos-arm64, linux-x64, linux-x64-asan, linux-arm, linux-arm64, windows-x64, windows-x86, windows-arm64]
if: always() && github.repository == 'electron/electron' && !contains(needs.*.result, 'failure')
steps:
steps:
- name: GitHub Actions Jobs Done
run: |
echo "All GitHub Actions Jobs are done"
check-signed-commits:
name: Check signed commits in green PR
needs: gha-done
if: ${{ contains(github.event.pull_request.labels.*.name, 'needs-signed-commits')}}
runs-on: ubuntu-slim
permissions:
contents: read
pull-requests: write
steps:
- name: Check signed commits in PR
uses: 1Password/check-signed-commits-action@ed2885f3ed2577a4f5d3c3fe895432a557d23d52 # v1
with:
comment: |
⚠️ This PR contains unsigned commits. This repository enforces [commit signatures](https://docs.github.com/en/authentication/managing-commit-signature-verification)
for all incoming PRs. To get your PR merged, please sign those commits
(`git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}`) and force push them to this branch
(`git push --force-with-lease`)
For more information on signing commits, see GitHub's documentation on [Telling Git about your signing key](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key).
- name: Remove needs-signed-commits label
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
gh pr edit $PR_URL --remove-label needs-signed-commits

View File

@@ -50,7 +50,7 @@ jobs:
field-value: ✅ Reviewed
pull-request-labeled-ai-pr:
name: ai-pr label added
if: github.event.label.name == 'ai-pr'
if: github.event.label.name == 'ai-pr' && github.event.pull_request.state != 'closed'
runs-on: ubuntu-latest
permissions: {}
steps:

View File

@@ -13,7 +13,6 @@ permissions: {}
jobs:
check-signed-commits:
name: Check signed commits in PR
if: ${{ !contains(github.event.pull_request.labels.*.name, 'needs-signed-commits')}}
runs-on: ubuntu-slim
permissions:
contents: read
@@ -23,9 +22,9 @@ jobs:
uses: 1Password/check-signed-commits-action@ed2885f3ed2577a4f5d3c3fe895432a557d23d52 # v1
with:
comment: |
⚠️ This PR contains unsigned commits. This repository enforces [commit signatures](https://docs.github.com/en/authentication/managing-commit-signature-verification)
for all incoming PRs. To get your PR merged, please sign those commits
(`git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}`) and force push them to this branch
⚠️ This PR contains unsigned commits. This repository enforces [commit signatures](https://docs.github.com/en/authentication/managing-commit-signature-verification)
for all incoming PRs. To get your PR merged, please sign those commits
(`git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}`) and force push them to this branch
(`git push --force-with-lease`)
For more information on signing commits, see GitHub's documentation on [Telling Git about your signing key](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key).
@@ -37,3 +36,11 @@ jobs:
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
gh pr edit $PR_URL --add-label needs-signed-commits
- name: Remove needs-signed-commits label
if: ${{ success() && contains(github.event.pull_request.labels.*.name, 'needs-signed-commits') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
gh pr edit $PR_URL --remove-label needs-signed-commits

2
DEPS
View File

@@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'148.0.7768.0',
'148.0.7778.0',
'node_version':
'v24.14.1',
'nan_version':

View File

@@ -1,5 +1,5 @@
import { shell } from 'electron/common';
import { app, dialog, BrowserWindow, ipcMain } from 'electron/main';
import { app, dialog, BrowserWindow, ipcMain, Menu } from 'electron/main';
import * as path from 'node:path';
import * as url from 'node:url';
@@ -11,6 +11,53 @@ app.on('window-all-closed', () => {
app.quit();
});
const isMac = process.platform === 'darwin';
app.whenReady().then(() => {
const helpMenu: Electron.MenuItemConstructorOptions = {
role: 'help',
submenu: [
{
label: 'Learn More',
click: async () => {
await shell.openExternal('https://electronjs.org');
}
},
{
label: 'Documentation',
click: async () => {
const version = process.versions.electron;
await shell.openExternal(`https://github.com/electron/electron/tree/v${version}/docs#readme`);
}
},
{
label: 'Community Discussions',
click: async () => {
await shell.openExternal('https://discord.gg/electronjs');
}
},
{
label: 'Search Issues',
click: async () => {
await shell.openExternal('https://github.com/electron/electron/issues');
}
}
]
};
const macAppMenu: Electron.MenuItemConstructorOptions = { role: 'appMenu' };
const template: Electron.MenuItemConstructorOptions[] = [
...(isMac ? [macAppMenu] : []),
{ role: 'fileMenu' },
{ role: 'editMenu' },
{ role: 'viewMenu' },
{ role: 'windowMenu' },
helpMenu
];
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
});
function decorateURL (url: string) {
// safely add `?utm_source=default_app
const parsedUrl = new URL(url);

View File

@@ -46,7 +46,7 @@ this has the additional effect of removing the menu bar from the window.
> [!NOTE]
> The default menu will be created automatically if the app does not set one.
> It contains standard items such as `File`, `Edit`, `View`, `Window` and `Help`.
> It contains standard items such as `File`, `Edit`, `View`, and `Window`.
#### `Menu.getApplicationMenu()`

View File

@@ -1,5 +1,4 @@
import { shell } from 'electron/common';
import { app, Menu } from 'electron/main';
import { Menu } from 'electron/main';
const isMac = process.platform === 'darwin';
@@ -12,47 +11,13 @@ export const setApplicationMenuWasSet = () => {
export const setDefaultApplicationMenu = () => {
if (applicationMenuWasSet) return;
const helpMenu: Electron.MenuItemConstructorOptions = {
role: 'help',
submenu: app.isPackaged
? []
: [
{
label: 'Learn More',
click: async () => {
await shell.openExternal('https://electronjs.org');
}
},
{
label: 'Documentation',
click: async () => {
const version = process.versions.electron;
await shell.openExternal(`https://github.com/electron/electron/tree/v${version}/docs#readme`);
}
},
{
label: 'Community Discussions',
click: async () => {
await shell.openExternal('https://discord.gg/electronjs');
}
},
{
label: 'Search Issues',
click: async () => {
await shell.openExternal('https://github.com/electron/electron/issues');
}
}
]
};
const macAppMenu: Electron.MenuItemConstructorOptions = { role: 'appMenu' };
const template: Electron.MenuItemConstructorOptions[] = [
...(isMac ? [macAppMenu] : []),
{ role: 'fileMenu' },
{ role: 'editMenu' },
{ role: 'viewMenu' },
{ role: 'windowMenu' },
helpMenu
{ role: 'windowMenu' }
];
const menu = Menu.buildFromTemplate(template);

View File

@@ -21,7 +21,7 @@
"@types/semver": "^7.5.8",
"@types/stream-json": "^1.7.8",
"@types/temp": "^0.9.4",
"@xmldom/xmldom": "^0.8.11",
"@xmldom/xmldom": "^0.8.12",
"buffer": "^6.0.3",
"chalk": "^4.1.0",
"check-for-leaks": "^1.2.1",

View File

@@ -10,10 +10,10 @@ this patch is required to provide ripemd160 support in the nodejs crypto
module.
diff --git a/crypto/digest/digest_extra.cc b/crypto/digest/digest_extra.cc
index 17961ba6bd9de78b5b1b1008eb1f73babd49d0e7..6a870dce37df8f49106c24b183308a2c7a03fd7d 100644
index d38e0c1132da60ec96c3a5c2416ff07589f03b80..cd60baaf22a8d5dc20544d861d36b7d74d986e7b 100644
--- a/crypto/digest/digest_extra.cc
+++ b/crypto/digest/digest_extra.cc
@@ -47,6 +47,7 @@ static const struct nid_to_digest nid_to_digest_mapping[] = {
@@ -48,6 +48,7 @@ static const struct nid_to_digest nid_to_digest_mapping[] = {
{NID_sha512, EVP_sha512, SN_sha512, LN_sha512},
{NID_sha512_256, EVP_sha512_256, SN_sha512_256, LN_sha512_256},
{NID_md5_sha1, EVP_md5_sha1, SN_md5_sha1, LN_md5_sha1},
@@ -62,10 +62,10 @@ index a246a51103701e0ac8a0722324350a462f95bcc9..ddf0a90337d4e40de09bc345cf959dff
+
#undef CHECK
diff --git a/decrepit/evp/evp_do_all.cc b/decrepit/evp/evp_do_all.cc
index feaf17c72cecb8099bc11ac10747fbad719ddca9..891a73f229e3f0838cb2fa99b8fb24fdeac1962b 100644
index 584b1390a841cc1b1dcb69e16d8242a88e4bb9cb..637aeccb8de8d793eabc38e32bef6834ac0e6ad3 100644
--- a/decrepit/evp/evp_do_all.cc
+++ b/decrepit/evp/evp_do_all.cc
@@ -79,6 +79,7 @@ void EVP_MD_do_all_sorted(void (*callback)(const EVP_MD *cipher,
@@ -82,6 +82,7 @@ void EVP_MD_do_all_sorted(void (*callback)(const EVP_MD *md,
callback(EVP_sha384(), "SHA384", nullptr, arg);
callback(EVP_sha512(), "SHA512", nullptr, arg);
callback(EVP_sha512_256(), "SHA512-256", nullptr, arg);
@@ -73,16 +73,16 @@ index feaf17c72cecb8099bc11ac10747fbad719ddca9..891a73f229e3f0838cb2fa99b8fb24fd
callback(EVP_md4(), "md4", nullptr, arg);
callback(EVP_md5(), "md5", nullptr, arg);
@@ -88,6 +89,7 @@ void EVP_MD_do_all_sorted(void (*callback)(const EVP_MD *cipher,
@@ -91,6 +92,7 @@ void EVP_MD_do_all_sorted(void (*callback)(const EVP_MD *md,
callback(EVP_sha384(), "sha384", nullptr, arg);
callback(EVP_sha512(), "sha512", nullptr, arg);
callback(EVP_sha512_256(), "sha512-256", nullptr, arg);
+ callback(EVP_ripemd160(), "ripemd160", nullptr, arg);
}
void EVP_MD_do_all(void (*callback)(const EVP_MD *cipher, const char *name,
void EVP_MD_do_all(void (*callback)(const EVP_MD *md, const char *name,
diff --git a/include/openssl/digest.h b/include/openssl/digest.h
index 40670234682ac00dec268dea43f0ee1e39e8684f..293fbc9faf01ea0ca4e58b0a65b14597fe4916a6 100644
index 62ad57368cb3059ee25df08bb07876fef499de2e..322daef194b3c7b73011419bb74bccb311eb03a5 100644
--- a/include/openssl/digest.h
+++ b/include/openssl/digest.h
@@ -48,6 +48,9 @@ OPENSSL_EXPORT const EVP_MD *EVP_blake2b256(void);

View File

@@ -64,10 +64,10 @@ index dabc54aa13745600a62e57ecbb427e48a4565282..ce213e00573102ce9405a794d3c140d9
const EVP_CIPHER *EVP_get_cipherbynid(int nid) {
diff --git a/decrepit/evp/evp_do_all.cc b/decrepit/evp/evp_do_all.cc
index 891a73f229e3f0838cb2fa99b8fb24fdeac1962b..f7d0c5dc66f016eb9338c15e7f5ef59e6de2969d 100644
index 637aeccb8de8d793eabc38e32bef6834ac0e6ad3..c5dd0b18d7338457e47ae47088d9822472b24212 100644
--- a/decrepit/evp/evp_do_all.cc
+++ b/decrepit/evp/evp_do_all.cc
@@ -20,8 +20,10 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
@@ -23,8 +23,10 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
const char *unused, void *arg),
void *arg) {
callback(EVP_aes_128_cbc(), "AES-128-CBC", nullptr, arg);
@@ -78,7 +78,7 @@ index 891a73f229e3f0838cb2fa99b8fb24fdeac1962b..f7d0c5dc66f016eb9338c15e7f5ef59e
callback(EVP_aes_128_ctr(), "AES-128-CTR", nullptr, arg);
callback(EVP_aes_192_ctr(), "AES-192-CTR", nullptr, arg);
callback(EVP_aes_256_ctr(), "AES-256-CTR", nullptr, arg);
@@ -34,9 +36,13 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
@@ -37,9 +39,13 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
callback(EVP_aes_128_gcm(), "AES-128-GCM", nullptr, arg);
callback(EVP_aes_192_gcm(), "AES-192-GCM", nullptr, arg);
callback(EVP_aes_256_gcm(), "AES-256-GCM", nullptr, arg);
@@ -92,7 +92,7 @@ index 891a73f229e3f0838cb2fa99b8fb24fdeac1962b..f7d0c5dc66f016eb9338c15e7f5ef59e
callback(EVP_des_ede_cbc(), "DES-EDE-CBC", nullptr, arg);
callback(EVP_des_ede3_cbc(), "DES-EDE3-CBC", nullptr, arg);
callback(EVP_rc2_cbc(), "RC2-CBC", nullptr, arg);
@@ -44,8 +50,10 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
@@ -47,8 +53,10 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
// OpenSSL returns everything twice, the second time in lower case.
callback(EVP_aes_128_cbc(), "aes-128-cbc", nullptr, arg);
@@ -103,7 +103,7 @@ index 891a73f229e3f0838cb2fa99b8fb24fdeac1962b..f7d0c5dc66f016eb9338c15e7f5ef59e
callback(EVP_aes_128_ctr(), "aes-128-ctr", nullptr, arg);
callback(EVP_aes_192_ctr(), "aes-192-ctr", nullptr, arg);
callback(EVP_aes_256_ctr(), "aes-256-ctr", nullptr, arg);
@@ -58,9 +66,13 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
@@ -61,9 +69,13 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
callback(EVP_aes_128_gcm(), "aes-128-gcm", nullptr, arg);
callback(EVP_aes_192_gcm(), "aes-192-gcm", nullptr, arg);
callback(EVP_aes_256_gcm(), "aes-256-gcm", nullptr, arg);

View File

@@ -125,7 +125,6 @@ feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch
fix_win32_synchronous_spellcheck.patch
chore_grandfather_in_electron_views_and_delegates.patch
refactor_patch_electron_permissiontypes_into_blink.patch
revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch
fix_add_macos_memory_query_fallback_to_avoid_crash.patch
fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch
feat_add_support_for_embedder_snapshot_validation.patch
@@ -150,3 +149,4 @@ fix_use_fresh_lazynow_for_onendworkitemimpl_after_didruntask.patch
fix_pulseaudio_stream_and_icon_names.patch
fix_fire_menu_popup_start_for_dynamically_created_aria_menus.patch
feat_allow_enabling_extensions_on_custom_protocols.patch
fix_initialize_com_on_desktopmedialistcapturethread_on_windows.patch

View File

@@ -23,10 +23,10 @@ index 3f8cf4edc7448e6b584adae8fcbb872d27377126..1d03dc809d4c18f24314d94811e0bf52
int32_t world_id) {}
virtual void DidClearWindowObject() {}
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index bed7c59163e10f2d273a6eb07d095d3f5af97db9..9a881bb119f6f93ae86b2cc75f95a30cde91cfbc 100644
index ab959e66f8841d7367863bb13d6c7a0854d0df23..5279ba15f45bd7634b5f24553ad64c0069318cc0 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4731,6 +4731,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
@@ -4733,6 +4733,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
observer.DidCreateScriptContext(context, world_id);
}

View File

@@ -6,7 +6,7 @@ Subject: allow disabling blink scheduler throttling per RenderView
This allows us to disable throttling for hidden windows.
diff --git a/content/browser/renderer_host/navigation_controller_impl_unittest.cc b/content/browser/renderer_host/navigation_controller_impl_unittest.cc
index 29d5b174e122cbd140554687548106ead8f8e8d9..da74da96c3fe35a0f3838f04bca08846f7b41abe 100644
index f5a6ffc61f6cdff3897a97003b74838aac27e2a1..9b10aeb457a010db0ab89211610ea97b1a364453 100644
--- a/content/browser/renderer_host/navigation_controller_impl_unittest.cc
+++ b/content/browser/renderer_host/navigation_controller_impl_unittest.cc
@@ -168,6 +168,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast {
@@ -51,7 +51,7 @@ index 89fed16c112d55c13a9f23695e2898d630f7d815..b7f486337f46daac015644525c9870f5
void SendRendererPreferencesToRenderer(
const blink::RendererPreferences& preferences);
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 2a6ec0fbdd46427de42f880031fef19ff6269b77..cae6b1a65d0b8483f7a2bf0bd6dfc7a310216202 100644
index 53ec5cd693539d74424c683f78e953e85c13c098..ccfe78580c2acb9a3afa43d246e1a83cc0e28598 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -655,8 +655,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) {
@@ -116,7 +116,7 @@ index 932658273154ef2e022358e493a8e7c00c86e732..57bbfb5cde62c9496c351c861880a189
// Visibility -----------------------------------------------------------
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc
index 8646f9337065b8009a210c8878bdbb132265ab3e..1f38d76c867c5d7ee4b8584db49f5025aff6c50e 100644
index b5a7e1b177f031837f670c26bff7394315eb6ea5..ed63aa041733e2fb09d77a219c93c322985cc81e 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -2471,6 +2471,10 @@ void WebViewImpl::SetPageLifecycleStateInternal(
@@ -130,7 +130,7 @@ index 8646f9337065b8009a210c8878bdbb132265ab3e..1f38d76c867c5d7ee4b8584db49f5025
bool storing_in_bfcache = new_state->is_in_back_forward_cache &&
!old_state->is_in_back_forward_cache;
bool restoring_from_bfcache = !new_state->is_in_back_forward_cache &&
@@ -4163,10 +4167,23 @@ PageScheduler* WebViewImpl::Scheduler() const {
@@ -4170,10 +4174,23 @@ PageScheduler* WebViewImpl::Scheduler() const {
return GetPage()->GetPageScheduler();
}
@@ -155,7 +155,7 @@ index 8646f9337065b8009a210c8878bdbb132265ab3e..1f38d76c867c5d7ee4b8584db49f5025
// Do not throttle if the page should be painting.
bool is_visible =
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h
index 8d5c7349c360726778e37976fc54d660d7424f1f..96ee25c8ae4b50ab265bd698517efe15e2f1f44d 100644
index b2ad789e53146b06e0e416f2dcf384cf7e9c17ae..838c67ac5b02c427858febbfbddf25fb03632b37 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.h
+++ b/third_party/blink/renderer/core/exported/web_view_impl.h
@@ -446,6 +446,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,

View File

@@ -15,7 +15,7 @@ Refs changes in:
This patch reverts the changes to fix associated crashes in Electron.
diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc
index 3f1ccee622b92fe8004f7763d2374d02117236f7..03f53c6755d4f6f46d23f7860b19390bb77bd4de 100644
index 9827a89c56141596fde57b78f9c9894f273db83e..cedb4bd8217a0ad3ab07d85421e1850bc4d910f5 100644
--- a/third_party/blink/renderer/core/frame/frame.cc
+++ b/third_party/blink/renderer/core/frame/frame.cc
@@ -135,14 +135,6 @@ bool Frame::Detach(FrameDetachType type) {

View File

@@ -28,10 +28,10 @@ index 0af4d4b75d0519fabcb5d48bd9d5bd465bc80e92..eb6b23655afaa268f25d99301a0853aa
":chrome_dll",
":chrome_exe_version",
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index a14985635e8cb2c9e98044ece46a557ac5f36f08..8e94e37dc75ebadedece1e370538c151c31b7b35 100644
index e91f97276866bd500720962c74acaca2c22fff7c..22867153821d2b1e83feb1a2a7a6b8c26ba776eb 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -7720,6 +7720,10 @@ test("unit_tests") {
@@ -7737,6 +7737,10 @@ test("unit_tests") {
"//chrome/notification_helper",
]
@@ -42,7 +42,7 @@ index a14985635e8cb2c9e98044ece46a557ac5f36f08..8e94e37dc75ebadedece1e370538c151
deps += [
"//chrome:other_version",
"//chrome//services/util_win:unit_tests",
@@ -8693,6 +8697,10 @@ test("unit_tests") {
@@ -8711,6 +8715,10 @@ test("unit_tests") {
"../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc",
]
@@ -53,7 +53,7 @@ index a14985635e8cb2c9e98044ece46a557ac5f36f08..8e94e37dc75ebadedece1e370538c151
sources += [
# The importer code is not used on Android.
"../common/importer/firefox_importer_utils_unittest.cc",
@@ -8749,7 +8757,7 @@ test("unit_tests") {
@@ -8767,7 +8775,7 @@ test("unit_tests") {
# TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above?
deps += [
"../browser/screen_ai:screen_ai_install_state",

View File

@@ -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 3f5964a623d18b59d3761d0617644fc8ccfd9eb1..b898ebdd18bfefb4c6d8fa62e3e128a5154b049c 100644
index ac474e220d411dec278c40448f038b25e6788d2a..e4ff8f11bed9e53f3134068492ac94b4c9bb4df2 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -10217,6 +10217,7 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -10228,6 +10228,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,
@@ -21,10 +21,10 @@ index 3f5964a623d18b59d3761d0617644fc8ccfd9eb1..b898ebdd18bfefb4c6d8fa62e3e128a5
&no_javascript_access);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index b0f9312b11641fa4a3e0e9d87281153bbf577f0e..0088e16862b4eb08e2100f13e0d9fecfc0d8aa9d 100644
index 3e0c8bd308d8a947a2bd295a2d83e385e53853fb..4e91b3aeb5630476c660e8814e2fd9d92c5a9ca1 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -5494,6 +5494,10 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -5501,6 +5501,10 @@ FrameTree* WebContentsImpl::CreateNewWindow(
create_params.initially_hidden = renderer_started_hidden;
create_params.initial_popup_url = params.target_url;
@@ -35,7 +35,7 @@ index b0f9312b11641fa4a3e0e9d87281153bbf577f0e..0088e16862b4eb08e2100f13e0d9fecf
// Even though all codepaths leading here are in response to a renderer
// trying to open a new window, if the new window ends up in a different
// browsing instance, then the RenderViewHost, RenderWidgetHost,
@@ -5548,6 +5552,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -5555,6 +5559,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
// Sets the newly created WebContents WindowOpenDisposition.
new_contents_impl->original_window_open_disposition_ = params.disposition;
@@ -48,7 +48,7 @@ index b0f9312b11641fa4a3e0e9d87281153bbf577f0e..0088e16862b4eb08e2100f13e0d9fecf
// If the new frame has a name, make sure any SiteInstances that can find
// this named frame have proxies for it. Must be called after
// SetSessionStorageNamespace, since this calls CreateRenderView, which uses
@@ -5589,12 +5599,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -5596,12 +5606,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
AddWebContentsDestructionObserver(new_contents_impl);
}
@@ -77,10 +77,10 @@ index 444fa7009d0db33470cac9ab9cfdc23ceacec942..ab9aeb852e5ea89583284386d9a78a3e
// Operation result when the renderer asks the browser to create a new window.
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 35e40748ca10661e13f1e04d22e0867d335b46c0..8651e4d019b6dc4e94cae9706eccf8dacb5350a2 100644
index e806de04ca92cb8351e9a242a5241c0d4286da97..d0b3e4bc348921df7e6446dbc1f14860b8a84d87 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -862,6 +862,8 @@ bool ContentBrowserClient::CanCreateWindow(
@@ -854,6 +854,8 @@ bool ContentBrowserClient::CanCreateWindow(
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
@@ -90,7 +90,7 @@ index 35e40748ca10661e13f1e04d22e0867d335b46c0..8651e4d019b6dc4e94cae9706eccf8da
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 27a2f100c949319889f791a661b6990b6d0bf97a..02321334795bb096206146caf24084c12347664e 100644
index 70588ccd619ac7969918771bccf5c054320e4f6f..eb684232648424fab4ba73b1fc813b0b3f8b809b 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -205,6 +205,7 @@ class NetworkService;
@@ -101,7 +101,7 @@ index 27a2f100c949319889f791a661b6990b6d0bf97a..02321334795bb096206146caf24084c1
} // namespace network
namespace sandbox {
@@ -1414,6 +1415,8 @@ class CONTENT_EXPORT ContentBrowserClient {
@@ -1406,6 +1407,8 @@ class CONTENT_EXPORT ContentBrowserClient {
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
@@ -170,10 +170,10 @@ index 0650197909d484b8a0f48ab61b22471c71bce0e8..29c380d7845aab1a7b3417e0d3940ea0
// 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 e5dae3b2c85ce3d38fdfcb64bb732f6e45e34217..bed7c59163e10f2d273a6eb07d095d3f5af97db9 100644
index 5936c5eaa081abde7f7c26cc990a122622e46908..ab959e66f8841d7367863bb13d6c7a0854d0df23 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -6842,6 +6842,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
@@ -6845,6 +6845,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
params->started_by_ad =
GetWebFrame()->IsAdFrame() || GetWebFrame()->IsAdScriptInStack();

View File

@@ -8,10 +8,10 @@ electron objects that extend gin::Wrappable and gets
allocated on the cpp heap
diff --git a/gin/public/wrappable_pointer_tags.h b/gin/public/wrappable_pointer_tags.h
index fee622ebde42211de6f702b754cfa38595df5a1c..6b524632ebb405e473cf4fe8e253bd13bf7b67e5 100644
index fee622ebde42211de6f702b754cfa38595df5a1c..9f7e1b1b8d871721891255c1f21de825d0df1e30 100644
--- a/gin/public/wrappable_pointer_tags.h
+++ b/gin/public/wrappable_pointer_tags.h
@@ -77,7 +77,20 @@ enum WrappablePointerTag : uint16_t {
@@ -77,7 +77,21 @@ enum WrappablePointerTag : uint16_t {
kWebAXObjectProxy, // content::WebAXObjectProxy
kWrappedExceptionHandler, // extensions::WrappedExceptionHandler
kIndigoContext, // indigo::IndigoContext
@@ -24,6 +24,7 @@ index fee622ebde42211de6f702b754cfa38595df5a1c..6b524632ebb405e473cf4fe8e253bd13
+ kElectronNetLog, // electron::api::NetLog
+ kElectronPowerMonitor, // electron::api::PowerMonitor
+ kElectronPowerSaveBlocker, // electron::api::PowerSaveBlocker
+ kElectronProtocol, // electron::api::Protocol
+ kElectronReplyChannel, // gin_helper::internal::ReplyChannel
+ kElectronScreen, // electron::api::Screen
+ kElectronSession, // electron::api::Session

View File

@@ -34,10 +34,10 @@ index 1d03dc809d4c18f24314d94811e0bf527aa7b5b4..16030bcecb2e39b8870144ce7c3d11dd
virtual void DidClearWindowObject() {}
virtual void DidChangeScrollOffset() {}
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 9a881bb119f6f93ae86b2cc75f95a30cde91cfbc..540935b14c5f78b573a14414f4259db9c34d02ae 100644
index 5279ba15f45bd7634b5f24553ad64c0069318cc0..2840f22e2b8b4aae09a06774a70f2ec7340536d9 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4737,10 +4737,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures(
@@ -4739,10 +4739,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures(
observer.DidInstallConditionalFeatures(context, world_id);
}

View File

@@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it
by changing something in Electron.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index f6b48f3641674bae565ec2c6294d9f6cf1d48db4..09346abdd2df2f672b1c3cc1757fa375eb6e0c72 100644
index aaa2b2229dac8c5e8cf590300b436082f6c3773b..e12758010f5c243d2fb9c733b74bcb0eea89f5da 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -5465,7 +5465,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -5472,7 +5472,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
: IsGuest();
// While some guest types do not have a guest SiteInstance, the ones that
// don't all override WebContents creation above.

View File

@@ -80,10 +80,10 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23
content::WebContents* source,
const content::OpenURLParams& params,
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index c71041d2eae5ea25af82137351f12e46182e6c69..d8263194614006213e157f6b10f3facb093b2944 100644
index 8f8852b2af1acfa4ec985fd1c8b50563b991b12a..c2f2903545b191c5ab13462bf330efce37d7d08c 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -2287,7 +2287,8 @@ bool Browser::IsWebContentsCreationOverridden(
@@ -2310,7 +2310,8 @@ bool Browser::IsWebContentsCreationOverridden(
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
const std::string& frame_name,
@@ -93,7 +93,7 @@ index c71041d2eae5ea25af82137351f12e46182e6c69..d8263194614006213e157f6b10f3facb
if (HasActorTaskPreventingNewWebContents(profile(), opener)) {
// If an ExecutionEngine is acting on the opener, prevent it from creating a
// new WebContents. We'll instead force the navigation to happen in the same
@@ -2300,7 +2301,7 @@ bool Browser::IsWebContentsCreationOverridden(
@@ -2323,7 +2324,7 @@ bool Browser::IsWebContentsCreationOverridden(
return (window_container_type ==
content::mojom::WindowContainerType::BACKGROUND &&
ShouldCreateBackgroundContents(source_site_instance, opener_url,
@@ -223,10 +223,10 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5
content::WebContents* AddNewContents(
content::WebContents* source,
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index ec75b1a31c029ff9f1d23f297be4ae40bc24af9c..1a45bab9c0e4e429bb338c757cdc49d64f337b88 100644
index d43e75c20aca09080f4223d339c88381f030c504..8cd59445bae73ff0193e4512d7c36740cbad847f 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -5429,8 +5429,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -5436,8 +5436,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
if (delegate_ &&
delegate_->IsWebContentsCreationOverridden(
opener, source_site_instance, params.window_container_type,
@@ -357,7 +357,7 @@ index f459dddeb3f8f3a33ffead0e96fba791d18a0108..f7a229b186774ca3a01f2d747eab139a
content::RenderFrameHost* opener,
content::SiteInstance* source_site_instance,
diff --git a/fuchsia_web/webengine/browser/frame_impl.cc b/fuchsia_web/webengine/browser/frame_impl.cc
index 3b50b6b3616ead57de44d309a306db09dce82c65..c709f13b7c0bac9f41cac745678aaee04c1caf46 100644
index 9c1fb0b2ed4f013ef6108a9844b22f6bfe697621..ef4991adc766d53b03d280395630b83ced38c2e8 100644
--- a/fuchsia_web/webengine/browser/frame_impl.cc
+++ b/fuchsia_web/webengine/browser/frame_impl.cc
@@ -585,8 +585,7 @@ bool FrameImpl::IsWebContentsCreationOverridden(

View File

@@ -7,12 +7,12 @@ By default, chromium sets up one v8 snapshot to be used in all v8 contexts. This
to have a dedicated browser process v8 snapshot defined by the file `browser_v8_context_snapshot.bin`.
diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc
index b795a9dbf898570a7cd8469ee386c4edf4bfa275..449940fe1b6969576f1b2c21d7719620e578e8a8 100644
index e795339c000cf695ca05c6d3c736678fa47df21e..bbcad80a8efdac88c26ececeaf4023152631b662 100644
--- a/content/app/content_main_runner_impl.cc
+++ b/content/app/content_main_runner_impl.cc
@@ -277,8 +277,13 @@ void AsanProcessInfoCB(const char* reason,
}
#endif // defined(ADDRESS_SANITIZER)
@@ -261,8 +261,13 @@ std::string GetSnapshotDataDescriptor(const base::CommandLine& command_line) {
#endif
-void LoadV8SnapshotFile(const base::CommandLine& command_line) {
+void LoadV8SnapshotFile(const raw_ptr<ContentMainDelegate> delegate, const base::CommandLine& command_line) {

View File

@@ -6,10 +6,10 @@ Subject: fix: disabling compositor recycling
Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron.
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index f7c3e60f748e24e51bffa2bc8914a8a7b67bd504..2324454f8a782bb4fe065b727a39b7cf523d9ce8 100644
index 886b3e87e9041931d3cb59ef775b5012e8e2f908..9287bde2d8c0eaa00c29fca974111b3f32b6e813 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -590,7 +590,11 @@
@@ -597,7 +597,11 @@
}
host()->WasHidden();

View File

@@ -6,10 +6,10 @@ Subject: disable_hidden.patch
Electron uses this to disable background throttling for hidden windows.
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index ced1f88a6ab9ad7b8e180149cbb652adb5b5b47f..1919546e9be90303d1aee29208d8227ece452827 100644
index fe46ebe4e5bcda2eff543aa5b5a2310628a3ea5a..8df679251dc314a94079fcc9d4edd7fab12873d4 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -810,6 +810,10 @@ void RenderWidgetHostImpl::WasHidden() {
@@ -818,6 +818,10 @@ void RenderWidgetHostImpl::WasHidden() {
return;
}
@@ -21,10 +21,10 @@ index ced1f88a6ab9ad7b8e180149cbb652adb5b5b47f..1919546e9be90303d1aee29208d8227e
// Prompts should remain open and functional across tab switches.
if (!delegate_ || !delegate_->IsWaitingForPointerLockPrompt(this)) {
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
index 0886acf77ef00ac54a33103585c4e1c022e9d5d6..71a0a74f8bc32e58f98a1841a1dd9c4b4c37118e 100644
index 37b2ca1000ead76ec7e403bf1e2dc647bcee74ce..1312c87909729ac59ea661321c10862f34072f95 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -1055,6 +1055,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl
@@ -1059,6 +1059,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl
base::TimeDelta GetHungRendererDelayForTesting();
@@ -34,10 +34,10 @@ index 0886acf77ef00ac54a33103585c4e1c022e9d5d6..71a0a74f8bc32e58f98a1841a1dd9c4b
// |routing_id| must not be IPC::mojom::kRoutingIdNone.
// If this object outlives |delegate|, DetachDelegate() must be called when
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index e001bfdf97408a06bcbe7e3dbcdad743d86e57fc..2a6ec0fbdd46427de42f880031fef19ff6269b77 100644
index 550a2090d11ea151d8003610cb39a8035c5d299c..53ec5cd693539d74424c683f78e953e85c13c098 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -717,7 +717,7 @@ void RenderWidgetHostViewAura::HideImpl() {
@@ -712,7 +712,7 @@ void RenderWidgetHostViewAura::HideImpl() {
CHECK(visibility_ == Visibility::HIDDEN ||
visibility_ == Visibility::OCCLUDED);

View File

@@ -33,10 +33,10 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4
} // namespace net
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
index 4efd5407479b9e5ee6af84a4cd6d26895d8b19f7..498c877f3f159729eae4857b5210b913eec962d0 100644
index cf1001557f2f59747ceb394ab2c93b4bf379dafb..2e16a8d19e1ccfbfc838ed33ecac3375f1e81b17 100644
--- a/services/network/network_context.cc
+++ b/services/network/network_context.cc
@@ -1965,6 +1965,13 @@ void NetworkContext::SetNetworkConditions(
@@ -1994,6 +1994,13 @@ void NetworkContext::SetNetworkConditions(
std::move(network_conditions));
}
@@ -51,10 +51,10 @@ index 4efd5407479b9e5ee6af84a4cd6d26895d8b19f7..498c877f3f159729eae4857b5210b913
// This may only be called on NetworkContexts created with the constructor
// that calls MakeURLRequestContext().
diff --git a/services/network/network_context.h b/services/network/network_context.h
index 912e4d60647f6376dfef62d18998b556bc7efa32..53082e9f0bfb98c1267fc034fa34e157b4c04d9b 100644
index 04e6e884dccbb680a39f2b9c8a54de162e056a30..672dd48040586190b761e2db554ba0767d254f62 100644
--- a/services/network/network_context.h
+++ b/services/network/network_context.h
@@ -331,6 +331,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
@@ -332,6 +332,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
void SetNetworkConditions(
const base::UnguessableToken& throttling_profile_id,
std::vector<mojom::MatchedNetworkConditionsPtr> conditions) override;
@@ -63,10 +63,10 @@ index 912e4d60647f6376dfef62d18998b556bc7efa32..53082e9f0bfb98c1267fc034fa34e157
void SetEnableReferrers(bool enable_referrers) override;
#if BUILDFLAG(IS_CT_SUPPORTED)
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
index 63d410dd356594a5928ed2f84b05b403bf3367f0..ca47c9cb58d5d69faade9f85d1e63683d79cb5e3 100644
index 6c43c2985123525793dd6b60c9d7d7c1db7fdf04..7493bd8dd37b36a3e7a96b1373619fee0b6a9d8e 100644
--- a/services/network/public/mojom/network_context.mojom
+++ b/services/network/public/mojom/network_context.mojom
@@ -1291,6 +1291,9 @@ interface NetworkContext {
@@ -1299,6 +1299,9 @@ interface NetworkContext {
SetNetworkConditions(mojo_base.mojom.UnguessableToken throttling_profile_id,
array<MatchedNetworkConditions> conditions);
@@ -77,7 +77,7 @@ index 63d410dd356594a5928ed2f84b05b403bf3367f0..ca47c9cb58d5d69faade9f85d1e63683
SetAcceptLanguage(string new_accept_language);
diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h
index bc26f449109b3be84490fbb3569e36aa4aca8c4b..d273faec6c235cb7d29f0f7fb90affdca7240e51 100644
index b472be0acdc0cd4971e6e0a9e623bc1c84d07a02..f328a3aa2df9f5c6163a5023a5df157350d3707f 100644
--- a/services/network/test/test_network_context.h
+++ b/services/network/test/test_network_context.h
@@ -156,6 +156,7 @@ class TestNetworkContext : public mojom::NetworkContext {

View File

@@ -15,7 +15,7 @@ Ideally we could add an embedder observer pattern here but that can be
done in future work.
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc
index 1f38d76c867c5d7ee4b8584db49f5025aff6c50e..00221901d054f1ed9280af17559731ef75442c5d 100644
index ed63aa041733e2fb09d77a219c93c322985cc81e..ea23d47128d4e974353ea5a976a72d4fa0600e2b 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -1855,6 +1855,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,

View File

@@ -17,11 +17,11 @@ which removed range-requests-supported on non-http protocols. See https://issues
for more information.
diff --git a/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc b/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc
index d96ffd263cad628c3e12b0a39cf082161ea6bb58..b33f52a48f570c7aee1a3f55fb3f9a1ed3bd35c0 100644
index 0af2ad19954bd868f6b92616da869b350f088103..efc53247962f166f2b441f76c7a2c94d8ceb979a 100644
--- a/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc
+++ b/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc
@@ -11,8 +11,10 @@
#include "base/containers/adapters.h"
@@ -12,8 +12,10 @@
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/raw_span.h"
+#include "base/no_destructor.h"
@@ -31,7 +31,7 @@ index d96ffd263cad628c3e12b0a39cf082161ea6bb58..b33f52a48f570c7aee1a3f55fb3f9a1e
#include "media/base/media_log.h"
#include "net/base/net_errors.h"
#include "third_party/blink/renderer/platform/media/buffered_data_source_host_impl.h"
@@ -69,6 +71,10 @@ constexpr base::TimeDelta kSeekDelay = base::Milliseconds(20);
@@ -70,6 +72,10 @@ constexpr base::TimeDelta kSeekDelay = base::Milliseconds(20);
} // namespace
@@ -42,7 +42,7 @@ index d96ffd263cad628c3e12b0a39cf082161ea6bb58..b33f52a48f570c7aee1a3f55fb3f9a1e
class MultiBufferDataSource::ReadOperation {
public:
ReadOperation() = delete;
@@ -136,13 +142,29 @@ MultiBufferDataSource::~MultiBufferDataSource() {
@@ -137,13 +143,29 @@ MultiBufferDataSource::~MultiBufferDataSource() {
DCHECK(render_task_runner_->BelongsToCurrentThread());
}
@@ -74,18 +74,18 @@ index d96ffd263cad628c3e12b0a39cf082161ea6bb58..b33f52a48f570c7aee1a3f55fb3f9a1e
void MultiBufferDataSource::SetReader(
diff --git a/third_party/blink/renderer/platform/media/multi_buffer_data_source.h b/third_party/blink/renderer/platform/media/multi_buffer_data_source.h
index 342c690100eacf3cdde92bb60b6c08769f693e96..4980848c38703764de3c210c119f844bed508aa2 100644
index 470b6015dad4063375175324f49afb3548cdf0dd..61b633d65eaa76f98fd0d858d490b12077646ad2 100644
--- a/third_party/blink/renderer/platform/media/multi_buffer_data_source.h
+++ b/third_party/blink/renderer/platform/media/multi_buffer_data_source.h
@@ -18,6 +18,7 @@
@@ -19,6 +19,7 @@
#include "media/base/data_source.h"
#include "media/base/ranges.h"
#include "media/base/tuneable.h"
+#include "third_party/blink/public/platform/web_common.h"
#include "third_party/blink/renderer/platform/media/buffered_data_source_host_impl.h"
#include "third_party/blink/renderer/platform/media/url_index.h"
#include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
@@ -35,6 +36,8 @@ namespace blink {
@@ -37,6 +38,8 @@ namespace blink {
class BufferedDataSourceHost;
class MultiBufferReader;
@@ -94,7 +94,7 @@ index 342c690100eacf3cdde92bb60b6c08769f693e96..4980848c38703764de3c210c119f844b
// A data source capable of loading URLs and buffering the data using an
// in-memory sliding window.
//
@@ -64,6 +67,8 @@ class PLATFORM_EXPORT MultiBufferDataSource
@@ -94,6 +97,8 @@ class PLATFORM_EXPORT MultiBufferDataSource
return url_data_->mime_type();
}

View File

@@ -44,10 +44,10 @@ index 57ed3cf54b2921df09ad84906b3da7527c6080bb..ffe3a0894c612adaa429a783827c8503
class WebRequestEventRouter : public KeyedService {
public:
diff --git a/extensions/common/extension.cc b/extensions/common/extension.cc
index 731994059b8900e7cec46acfb9d17f18c3b8ed89..c32aee04fa1788ae26a0f9a0c5b9d2afb94c84c6 100644
index 542bc99fbaace39351a6f991a7702d0c77c891eb..9fef3d7fe3108cca843100967489f1cc1b6b4589 100644
--- a/extensions/common/extension.cc
+++ b/extensions/common/extension.cc
@@ -222,7 +222,8 @@ const int Extension::kValidHostPermissionSchemes =
@@ -223,7 +223,8 @@ const int Extension::kValidHostPermissionSchemes =
URLPattern::SCHEME_CHROMEUI | URLPattern::SCHEME_HTTP |
URLPattern::SCHEME_HTTPS | URLPattern::SCHEME_FILE |
URLPattern::SCHEME_FTP | URLPattern::SCHEME_WS | URLPattern::SCHEME_WSS |

View File

@@ -167,7 +167,7 @@ index 34b4e7c1b449312e9cb517be192a39a6b5286e3c..4f39415717f423b9a87f83779851e08b
FinishStartSandboxedProcessOnLauncherThread,
this));
diff --git a/content/browser/service_host/service_process_host_impl.cc b/content/browser/service_host/service_process_host_impl.cc
index d9c14f91747bde0e76056d7f2f2ada166e67f994..09335acac17f526fb8d8e42e4b2d993b11045786 100644
index 4c0b23afb38066f4d29ead2d5705ae2b58ddca34..b79eb508bdfc1ae08dce254cfa57ab6c9b7bfc8a 100644
--- a/content/browser/service_host/service_process_host_impl.cc
+++ b/content/browser/service_host/service_process_host_impl.cc
@@ -69,6 +69,21 @@ void LaunchServiceProcess(mojo::GenericPendingReceiver receiver,
@@ -584,10 +584,10 @@ index 4159eef9e1f54c82ac0d8ad6437925dd3c6fa3ec..b835257f686635b91f80c2d6651fb735
#if BUILDFLAG(IS_MAC)
// Whether or not to disclaim TCC responsibility for the process, defaults to
diff --git a/content/public/browser/service_process_host.cc b/content/public/browser/service_process_host.cc
index d1bc550a891979e2d41d8d5b18a2f9287468e460..5d255f628788bc8b40d8df0039b08c06ffec8730 100644
index a3970c9358d7e03b58e646c85a488d97609c44fd..1afc67fab97a3bb9515afefb8a3f051147d1d678 100644
--- a/content/public/browser/service_process_host.cc
+++ b/content/public/browser/service_process_host.cc
@@ -53,12 +53,62 @@ ServiceProcessHost::Options::WithExtraCommandLineSwitches(
@@ -53,6 +53,26 @@ ServiceProcessHost::Options::WithExtraCommandLineSwitches(
return *this;
}
@@ -614,6 +614,7 @@ index d1bc550a891979e2d41d8d5b18a2f9287468e460..5d255f628788bc8b40d8df0039b08c06
ServiceProcessHost::Options& ServiceProcessHost::Options::WithProcessCallback(
base::OnceCallback<void(const base::Process&)> callback) {
process_callback = std::move(callback);
@@ -68,6 +88,36 @@ ServiceProcessHost::Options& ServiceProcessHost::Options::WithObserver(
return *this;
}
@@ -651,18 +652,18 @@ index d1bc550a891979e2d41d8d5b18a2f9287468e460..5d255f628788bc8b40d8df0039b08c06
ServiceProcessHost::Options&
ServiceProcessHost::Options::WithPreloadedLibraries(
diff --git a/content/public/browser/service_process_host.h b/content/public/browser/service_process_host.h
index 0062d2cb6634b8b29977a0312516b1b13936b40a..888ff36d70c83010f1f45e9eeb2dd6b573158db5 100644
index ea68aa0d16c46ad53b63e10027e81503610051d9..ac1ffa290b59d964931a312a911efbecc5eb04ac 100644
--- a/content/public/browser/service_process_host.h
+++ b/content/public/browser/service_process_host.h
@@ -14,6 +14,7 @@
#include "base/command_line.h"
@@ -15,6 +15,7 @@
#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list_types.h"
+#include "base/process/launch.h"
#include "base/process/process_handle.h"
#include "content/common/content_export.h"
#include "content/public/browser/service_process_info.h"
@@ -28,6 +29,10 @@
@@ -29,6 +30,10 @@
#include "base/types/pass_key.h"
#endif // BUILDFLAG(IS_WIN)
@@ -673,7 +674,7 @@ index 0062d2cb6634b8b29977a0312516b1b13936b40a..888ff36d70c83010f1f45e9eeb2dd6b5
namespace base {
class Process;
} // namespace base
@@ -94,11 +99,40 @@ class CONTENT_EXPORT ServiceProcessHost {
@@ -98,6 +103,16 @@ class CONTENT_EXPORT ServiceProcessHost {
// Specifies extra command line switches to append before launch.
Options& WithExtraCommandLineSwitches(std::vector<std::string> switches);
@@ -690,8 +691,10 @@ index 0062d2cb6634b8b29977a0312516b1b13936b40a..888ff36d70c83010f1f45e9eeb2dd6b5
// Specifies a callback to be invoked with service process once it's
// launched. Will be on UI thread.
Options& WithProcessCallback(
base::OnceCallback<void(const base::Process&)>);
@@ -111,6 +126,24 @@ class CONTENT_EXPORT ServiceProcessHost {
// the service process terminates, notifications are silently skipped.
// Will be called on the UI thread.
Options& WithObserver(base::WeakPtr<Observer> observer);
+ // Specifies the working directory for the launched process.
+ Options& WithCurrentDirectory(const base::FilePath& cwd);
+
@@ -710,11 +713,10 @@ index 0062d2cb6634b8b29977a0312516b1b13936b40a..888ff36d70c83010f1f45e9eeb2dd6b5
+ // Specifies if the process should disclaim TCC responsibility.
+ Options& WithDisclaimResponsibility(bool disclaim_responsibility);
+#endif // BUILDFLAG(IS_MAC)
+
#if BUILDFLAG(IS_WIN)
// Specifies libraries to preload before the sandbox is locked down. Paths
// should be absolute paths. Libraries will be preloaded before sandbox
@@ -127,11 +161,26 @@ class CONTENT_EXPORT ServiceProcessHost {
@@ -140,12 +173,27 @@ class CONTENT_EXPORT ServiceProcessHost {
std::optional<GURL> site;
std::optional<int> child_flags;
std::vector<std::string> extra_switches;
@@ -725,6 +727,7 @@ index 0062d2cb6634b8b29977a0312516b1b13936b40a..888ff36d70c83010f1f45e9eeb2dd6b5
+ base::FileHandleMappingVector fds_to_remap;
+#endif
base::OnceCallback<void(const base::Process&)> process_callback;
base::WeakPtr<Observer> observer;
#if BUILDFLAG(IS_WIN)
std::vector<base::FilePath> preload_libraries;
#endif // BUILDFLAG(IS_WIN)
@@ -740,7 +743,7 @@ index 0062d2cb6634b8b29977a0312516b1b13936b40a..888ff36d70c83010f1f45e9eeb2dd6b5
+#endif // BUILDFLAG(IS_MAC)
};
// An interface which can be implemented and registered/unregistered with
// An interface which can be implemented and used with
diff --git a/sandbox/policy/win/sandbox_win.cc b/sandbox/policy/win/sandbox_win.cc
index 5c92eec064e36fa4be5a57a769a4091a18e3396d..b705450708560c0ae8b386d7efdb5c526964c629 100644
--- a/sandbox/policy/win/sandbox_win.cc

View File

@@ -46,7 +46,7 @@ index 6e60de1319c5506d7180719fa230ab9cf537b832..e570e335fbd413340ddedeee423eca71
'internal-forced-visited-'):
internal_visited_order = 0
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5
index 3a14c5d0a462f0f6785bd8d711a7e70e50c05ff9..5f39e61139318294cf2ecdf2e922741740ab8ae9 100644
index f46a4e31e0ea81f362be1c06bc23f6e6cb15d967..1a7874271e123d4fadd8ae694394061fc0c73cfe 100644
--- a/third_party/blink/renderer/core/css/css_properties.json5
+++ b/third_party/blink/renderer/core/css/css_properties.json5
@@ -9643,6 +9643,27 @@
@@ -91,10 +91,10 @@ index 2afe18e9e4a5404ed184aeedc1c02a313853f463..7c3b0c2da6ded539764ce59bc43f49e9
return a.EmptyCells() == b.EmptyCells();
case CSSPropertyID::kFill:
diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
index b73db1a68d20cca66468db23d4c8e0e49db648b3..8dc1458ab436ce8202811371ee7ce8e077d4fa7b 100644
index 65c9b1f3a73d3822371f09b0cb764c63aaeb8a31..6e3737cf147252c6999ddcb887309682a91787d6 100644
--- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
+++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
@@ -13324,5 +13324,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue(
@@ -13328,5 +13328,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue(
CSSValueID::kNone>(stream);
}
@@ -203,10 +203,10 @@ index 19cda703154dab9397827ab6ea66c2ca446c644d..dd5943c511886f4e39b2e7f10e67e60f
return result;
}
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn
index 214c0c8bcf1033d077672b822ad53a42d0e09213..e8f9b4873defc9dea6868e8c481e4f4668a7686c 100644
index 87f64f5c2cfd4bdc8aca697f6115effed091b86e..a11c5cb976077e53a6c3d456d2583f16fb58e415 100644
--- a/third_party/blink/renderer/platform/BUILD.gn
+++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1673,6 +1673,8 @@ component("platform") {
@@ -1675,6 +1675,8 @@ component("platform") {
"widget/widget_base.h",
"widget/widget_base_client.h",
"windows_keyboard_codes.h",
@@ -314,7 +314,7 @@ index 18f283e625101318ee14b50e6e765dfd1c9a1a44..44a3a55974c9e4b9e715574075f25661
auto DrawAsSinglePath = [&]() {
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5
index 515cbf4825600e20ab4ed9c54f2ae705eb5e8f27..4f016f7411882db169ebdff1cfc311698744e760 100644
index 89301f737c6a1f4043a47366db604967159b7cb6..0f6417f6933f3f71f39b4a06ac229efd3ac7634b 100644
--- a/third_party/blink/renderer/platform/runtime_enabled_features.json5
+++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -215,6 +215,10 @@

View File

@@ -8,10 +8,10 @@ rendering with the viz compositor by way of a custom HostDisplayClient
and LayeredWindowUpdater.
diff --git a/components/viz/host/host_display_client.cc b/components/viz/host/host_display_client.cc
index b153c538488b7b77af0630a454604d9fb7eba487..1b97bfae745d3aeaa4ebd3d3a0dfc64f48da0d70 100644
index 65df78d7f2a311633e8512f46efa005c41930873..1978ac9a080c63f8e9aa323c7215051890c55f00 100644
--- a/components/viz/host/host_display_client.cc
+++ b/components/viz/host/host_display_client.cc
@@ -49,9 +49,9 @@ void HostDisplayClient::OnDisplayReceivedCALayerParams(
@@ -50,9 +50,9 @@ void HostDisplayClient::OnDisplayReceivedCALayerParams(
}
#endif
@@ -22,7 +22,7 @@ index b153c538488b7b77af0630a454604d9fb7eba487..1b97bfae745d3aeaa4ebd3d3a0dfc64f
if (!NeedsToUseLayerWindow(widget_)) {
DLOG(ERROR) << "HWND shouldn't be using a layered window";
return;
@@ -59,7 +59,15 @@ void HostDisplayClient::CreateLayeredWindowUpdater(
@@ -60,7 +60,15 @@ void HostDisplayClient::CreateLayeredWindowUpdater(
layered_window_updater_ =
std::make_unique<LayeredWindowUpdaterImpl>(widget_, std::move(receiver));
@@ -508,10 +508,10 @@ index 0000000000000000000000000000000000000000..e1a22ee881c0fd679ac2d2d4d11a3c93
+
+#endif // COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_SOFTWARE_OUTPUT_DEVICE_PROXY_H_
diff --git a/components/viz/service/display_embedder/software_output_device_win.cc b/components/viz/service/display_embedder/software_output_device_win.cc
index b5154321105f08335b67ad2d552afa61337a4976..cb28230d9a8da6bd2259ef0c898013293421ac56 100644
index 4f9e8946fa02d859e92a6896beba82721914f868..78486eaa993ee7ffd5188b31503de7dda1158297 100644
--- a/components/viz/service/display_embedder/software_output_device_win.cc
+++ b/components/viz/service/display_embedder/software_output_device_win.cc
@@ -156,7 +156,7 @@ void SoftwareOutputDeviceWinProxy::EndPaintDelegated(
@@ -158,7 +158,7 @@ void SoftwareOutputDeviceWinProxy::EndPaintDelegated(
if (!canvas_)
return;

View File

@@ -11,10 +11,10 @@ ServiceProcessHost::Observer functions, but we need to pass the exit code to
the observer.
diff --git a/content/browser/service_host/service_process_tracker.cc b/content/browser/service_host/service_process_tracker.cc
index fb41c8dfd147a90d7d581b49ad7f909d947cb214..ae0dce9d1dde14f1562adac7d324635983bb4c09 100644
index c7b620b9dd25c7842470c4827bd55c81c5816e05..a5f72f8bd55e7a2a43e792f91878de52f09fb988 100644
--- a/content/browser/service_host/service_process_tracker.cc
+++ b/content/browser/service_host/service_process_tracker.cc
@@ -51,7 +51,8 @@ void ServiceProcessTracker::NotifyTerminated(ServiceProcessId id) {
@@ -67,7 +67,8 @@ void ServiceProcessTracker::NotifyTerminated(ServiceProcessId id) {
void ServiceProcessTracker::NotifyCrashed(
ServiceProcessId id,
@@ -24,22 +24,19 @@ index fb41c8dfd147a90d7d581b49ad7f909d947cb214..ae0dce9d1dde14f1562adac7d3246359
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto iter = processes_.find(id);
CHECK(iter != processes_.end());
@@ -65,7 +66,9 @@ void ServiceProcessTracker::NotifyCrashed(
break;
@@ -82,6 +83,7 @@ void ServiceProcessTracker::NotifyCrashed(
}
for (auto& observer : observers_) {
- observer.OnServiceProcessCrashed(iter->second.Duplicate());
+ auto params = iter->second.Duplicate();
+ params.set_exit_code(exit_code);
+ observer.OnServiceProcessCrashed(params);
auto info_dup = iter->second.Duplicate();
+ info_dup.set_exit_code(exit_code);
for (auto& obs : observers_) {
obs.OnServiceProcessCrashed(info_dup);
}
processes_.erase(iter);
}
diff --git a/content/browser/service_host/service_process_tracker.h b/content/browser/service_host/service_process_tracker.h
index 9a5179c4eeacf8bbfb2d831b4301836df490f3a8..511fc9b9d5ce14a1b5ef457a1047e40d3bb64273 100644
index 899fa2680af1c3c491b110cdd2154abe2695bebe..bfd3a4837f361b106e46849e8be2675066387448 100644
--- a/content/browser/service_host/service_process_tracker.h
+++ b/content/browser/service_host/service_process_tracker.h
@@ -36,7 +36,8 @@ class ServiceProcessTracker {
@@ -40,7 +40,8 @@ class ServiceProcessTracker {
void NotifyTerminated(ServiceProcessId id);
void NotifyCrashed(ServiceProcessId id,
@@ -50,11 +47,11 @@ index 9a5179c4eeacf8bbfb2d831b4301836df490f3a8..511fc9b9d5ce14a1b5ef457a1047e40d
void AddObserver(ServiceProcessHost::Observer* observer);
diff --git a/content/browser/service_host/utility_process_client.cc b/content/browser/service_host/utility_process_client.cc
index 99da7eee3cb1a09b984832211bceee385147aec2..5e4bd537d94ad26c8d309ebfb63845a8d3d11dae 100644
index 6bb0ad536c4b8ddd32461e54b93471e8a055c5ea..c549032bd6ac0c161e05f6ace5ec0390fda95258 100644
--- a/content/browser/service_host/utility_process_client.cc
+++ b/content/browser/service_host/utility_process_client.cc
@@ -40,7 +40,7 @@ void UtilityProcessClient::OnProcessTerminatedNormally() {
process_info_->service_process_id());
@@ -42,7 +42,7 @@ void UtilityProcessClient::OnProcessTerminatedNormally() {
GetServiceProcessTracker().NotifyTerminated(*service_process_id_);
}
-void UtilityProcessClient::OnProcessCrashed(CrashType type) {
@@ -62,19 +59,19 @@ index 99da7eee3cb1a09b984832211bceee385147aec2..5e4bd537d94ad26c8d309ebfb63845a8
// TODO(crbug.com/40654042): It is unclear how we can observe
// |OnProcessCrashed()| without observing |OnProcessLaunched()| first, but
// it can happen on Android. Ignore the notification in this case.
@@ -49,6 +49,6 @@ void UtilityProcessClient::OnProcessCrashed(CrashType type) {
@@ -50,6 +50,6 @@ void UtilityProcessClient::OnProcessCrashed(CrashType type) {
return;
}
GetServiceProcessTracker().NotifyCrashed(process_info_->service_process_id(),
- type);
+ type, exit_code);
- GetServiceProcessTracker().NotifyCrashed(*service_process_id_, type);
+ GetServiceProcessTracker().NotifyCrashed(*service_process_id_, type, exit_code);
}
} // namespace content
diff --git a/content/browser/service_host/utility_process_client.h b/content/browser/service_host/utility_process_client.h
index 2648adb1cf38ab557b66ffd0e3034b26b04d76d6..98eab587f343f6ca472efc3d4e7b31b2b8821417 100644
index 97a0f76571caf19e39d861bf188da9173fc2f8f6..e651e9b2f9a35265da00432cf2ffdc5857c1fa08 100644
--- a/content/browser/service_host/utility_process_client.h
+++ b/content/browser/service_host/utility_process_client.h
@@ -36,7 +36,7 @@ class UtilityProcessClient : public UtilityProcessHost::Client {
@@ -39,7 +39,7 @@ class UtilityProcessClient : public UtilityProcessHost::Client {
void OnProcessTerminatedNormally() override;

View File

@@ -170,7 +170,7 @@ index 75a82bc82ebe8e7b5b51b760cf4258cfd65a2df5..4b29c955c3347e2907c0d064834d917c
if (params.opacity == views::Widget::InitParams::WindowOpacity::kInferred &&
diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h
index 9741a329a96db439d074c1d9013558a51f18ed86..c95b315a30994b539fdd2429bab53674823ff5b5 100644
index 93a47570d4854a3136fc4ac7f46d2f3d5c55db6c..78b720d556fb4f3f316baedaa70e56b1a171ab6a 100644
--- a/ui/views/widget/widget.h
+++ b/ui/views/widget/widget.h
@@ -324,6 +324,11 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
@@ -195,7 +195,7 @@ index 9741a329a96db439d074c1d9013558a51f18ed86..c95b315a30994b539fdd2429bab53674
// If set, the window size will follow the content preferred size.
bool autosize = false;
@@ -1295,6 +1303,11 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
@@ -1285,6 +1293,11 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// with it. TYPE_CONTROL and TYPE_TOOLTIP is not considered top level.
bool is_top_level() const { return is_top_level_; }
@@ -207,7 +207,7 @@ index 9741a329a96db439d074c1d9013558a51f18ed86..c95b315a30994b539fdd2429bab53674
// True if the window size will follow the content preferred size.
bool is_autosized() const { return is_autosized_; }
@@ -1743,6 +1756,9 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
@@ -1730,6 +1743,9 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// If true, the mouse is currently down.
bool is_mouse_button_pressed_ = false;

View File

@@ -8,7 +8,7 @@ Check for broken links by confirming the file exists before setting its utime.
This patch should be upstreamed & removed.
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
index 31e2b5775021564b7c80b6756020973141c08530..88446019ce1a98eab8a648220e5ed0cac623c1e9 100755
index 5bce95d5ea98c9a6522905f5c237fc5934fe2800..761df90191dd6444d64caf30e2a14c54c8ab536f 100755
--- a/tools/clang/scripts/update.py
+++ b/tools/clang/scripts/update.py
@@ -201,10 +201,9 @@ def DownloadAndUnpack(url, output_dir, path_prefixes=None, is_known_zip=False):

View File

@@ -28,10 +28,10 @@ The patch should be removed in favor of either:
Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397.
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
index c0961beb9e8ee039fce607513c81f911128a2d81..4b67c11fa1749c42e9fe04865b8d369a80c7d847 100644
index 7532fbb742624d86c342df29a7621867fa99180b..45cbb6bcaf16307a6949473ddb62a2be95031199 100644
--- a/content/browser/renderer_host/navigation_request.cc
+++ b/content/browser/renderer_host/navigation_request.cc
@@ -11913,6 +11913,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() {
@@ -11915,6 +11915,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() {
target_rph_id);
}

View File

@@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Charles Kerr <charles@charleskerr.com>
Date: Tue, 24 Mar 2026 16:33:20 -0500
Subject: fix: initialize COM on DesktopMediaListCaptureThread on Windows
On Windows, the DesktopMediaListCaptureThread runs with a UI message
pump that doesn't initialize COM. When WebRTC's window capturer
enumerates windows, interacting with UWP/Metro windows causes twinapi.dll
to internally call ::CoCreateInstance(), which hits Chromium's
DCheckedCoCreateInstance hook and triggers a crash.
This patch fixes the crash by ensuring COM is initialized on the
capture thread by calling `init_com_with_mta(false)`.
diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc
index 9a8ebb4edfb92d9fe28ae4b87463a68547ea1ab3..13446d9849c54f1bfe515c3db4d69dd181ec6d39 100644
--- a/chrome/browser/media/webrtc/native_desktop_media_list.cc
+++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc
@@ -786,6 +786,13 @@ NativeDesktopMediaList::NativeDesktopMediaList(
base::MessagePumpType thread_type = base::MessagePumpType::UI;
#else
base::MessagePumpType thread_type = base::MessagePumpType::DEFAULT;
+#endif
+#if BUILDFLAG(IS_WIN)
+ // On Windows, window enumeration via webrtc::DesktopCapturer may interact
+ // with UWP/Metro windows through twinapi.dll, which internally calls
+ // CoCreateInstance. Initialize COM on this thread to prevent crashes in
+ // Chromium's DCheckedCoCreateInstance hook.
+ thread_.init_com_with_mta(false);
#endif
thread_.StartWithOptions(base::Thread::Options(thread_type, 0));

View File

@@ -9,10 +9,10 @@ focus node change via TextInputManager.
chromium-bug: https://crbug.com/1369605
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index cae6b1a65d0b8483f7a2bf0bd6dfc7a310216202..6ac0fc4b5d31ff3bce6440ae418145d0dc6882ed 100644
index ccfe78580c2acb9a3afa43d246e1a83cc0e28598..30218b43ce1d57e45e9c265de4edcdce496cda79 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -3406,6 +3406,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged(
@@ -3403,6 +3403,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged(
}
}
@@ -39,10 +39,10 @@ index 448104cb33edbf6f2c046c4adbac3185eb4c9cb1..47b2677d2878cb9d5544798ddc49b54d
// Detaches |this| from the input method object.
// is_removed flag is true if this is called while the window is
diff --git a/content/browser/renderer_host/text_input_manager.cc b/content/browser/renderer_host/text_input_manager.cc
index 705a2ee24e463a65784a48844d7c9c26ae7b48db..87bf9b64616688152bd681cb57cefbc68a46d618 100644
index 86dff7f91f1934d699371f49ee71fea458eb9822..5eda935a18ebabc0a76f99069f6c6a754139f8cc 100644
--- a/content/browser/renderer_host/text_input_manager.cc
+++ b/content/browser/renderer_host/text_input_manager.cc
@@ -184,6 +184,7 @@ void TextInputManager::UpdateTextInputState(
@@ -185,6 +185,7 @@ void TextInputManager::UpdateTextInputState(
if (text_input_state.type == ui::TEXT_INPUT_TYPE_NONE &&
active_view_ != view) {
@@ -50,7 +50,7 @@ index 705a2ee24e463a65784a48844d7c9c26ae7b48db..87bf9b64616688152bd681cb57cefbc6
// We reached here because an IPC is received to reset the TextInputState
// for |view|. But |view| != |active_view_|, which suggests that at least
// one other view has become active and we have received the corresponding
@@ -474,6 +475,12 @@ void TextInputManager::NotifyObserversAboutInputStateUpdate(
@@ -475,6 +476,12 @@ void TextInputManager::NotifyObserversAboutInputStateUpdate(
observer.OnUpdateTextInputStateCalled(this, updated_view, did_update_state);
}
@@ -87,10 +87,10 @@ index a4768b51dae6817c9e9a467e9b16e827e0bfebda..83c42b5062aa8193fe2f56e407abe67d
// The view with active text input state, i.e., a focused <input> element.
// It will be nullptr if no such view exists. Note that the active view
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 8f98cd136d73d5ff795fd3c62a696cc7d2fd3c84..f6b48f3641674bae565ec2c6294d9f6cf1d48db4 100644
index e039e2c82ad75ca4b95763414f7aafb6d3a3dbf2..aaa2b2229dac8c5e8cf590300b436082f6c3773b 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -10430,7 +10430,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame(
@@ -10437,7 +10437,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame(
"WebContentsImpl::OnFocusedElementChangedInFrame",
"render_frame_host", frame);
RenderWidgetHostViewBase* root_view =

View File

@@ -8,10 +8,10 @@ such as the background turning black when maximizing the window and
dynamic background material settings not taking effect.
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
index d1e06b675b19226cf3b78e1aada8d8f2d684fada..ce810555b8501797643987916a728cad8f5adaa5 100644
index e4da40256ce94d6a0896792a8ef2faa18e1fa5d2..3a5833fcc018f32e86c0a95a42937fb9ac6c5a40 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -184,6 +184,10 @@ void DesktopWindowTreeHostWin::FinishTouchDrag(gfx::Point screen_point) {
@@ -167,6 +167,10 @@ void DesktopWindowTreeHostWin::FinishTouchDrag(gfx::Point screen_point) {
}
}
@@ -23,7 +23,7 @@ index d1e06b675b19226cf3b78e1aada8d8f2d684fada..ce810555b8501797643987916a728cad
void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) {
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
index a40bd9f25fa07a553c011cf19f155f8158f4ae5f..ae2baec731b5fcd8be97f2177d23b860d67ab8bc 100644
index 27322ef34edf3fa8bfbd20b1baddcaf3b7555618..b8d1fa863fd05ebc3ab8ac5ef8c4d81361ce45fe 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
@@ -93,6 +93,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin

View File

@@ -11,10 +11,10 @@ This patch should be upstreamed as a conditional revert of the logic in desktop
vs mobile runtimes. i.e. restore the old logic only on desktop platforms
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 3e62cf797e2fc127c4af86a912224f6c745b87f5..903b731a9cd58e418c26099044da62f7a23bd6ea 100644
index 06599737a290ba4c52a7d36725aef565d49800bd..fe26e2aeba6fc03201373693d4afa2b78c89e54a 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -2147,9 +2147,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() {
@@ -2155,9 +2155,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() {
void RenderWidgetHostImpl::NotifyScreenInfoChanged() {
// The resize message (which may not happen immediately) will carry with it
// the screen info as well as the new size (if the screen has changed scale

View File

@@ -211,7 +211,7 @@ index f2c94689450f0333a144ccf82cf147c194896e6b..1c2e9fe36c297f7d614d9ca290e4d13c
const mojom::blink::UserActivationOption user_activation_option_;
const mojom::blink::LoadEventBlockingOption blocking_option_;
diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc
index dec0b09e07c568b74b5ba25e8e3cb9f5b5cf7070..f28392d50ded3bb1ecb891314a989f1c07167bf6 100644
index 7d4039de028e6c7ef87e93792961c338032b261d..41d0a336dc4c91c74c57383f9203f7bca7675b66 100644
--- a/third_party/blink/renderer/core/frame/web_frame_test.cc
+++ b/third_party/blink/renderer/core/frame/web_frame_test.cc
@@ -300,6 +300,7 @@ void ExecuteScriptsInMainWorld(

View File

@@ -6,7 +6,7 @@ Subject: fix: select the first menu item when opened via keyboard
This fixes an accessibility issue where the root view is 'focused' to the screen reader instead of the first menu item as with all other native menus. This patch will be upstreamed.
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index 1b779f740710a49056f8b6b88df9033dd1289c91..21339edaab1069186f904f1c64a9c66f70c42a77 100644
index 63f140c698fb1e5ba1f93c24bfe19bc3f87cec19..ea1824d09b37f6404985ffb048ce196ad5811507 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -724,6 +724,16 @@ void MenuController::Run(Widget* parent,
@@ -26,7 +26,7 @@ index 1b779f740710a49056f8b6b88df9033dd1289c91..21339edaab1069186f904f1c64a9c66f
if (button_controller) {
pressed_lock_ = button_controller->TakeLock(
false, ui::LocatedEvent::FromIfValid(event));
@@ -2530,18 +2540,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) {
@@ -2535,18 +2545,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) {
}
item->GetSubmenu()->ShowAt(params);

View File

@@ -6,10 +6,10 @@ Subject: frame_host_manager.patch
Allows embedder to intercept site instances created by chromium.
diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc
index 1e76d25ab16ec1215e4c532fd7cb73702f16ffc6..8af96cfe14c4358cb6ab09135c04b04530f6e033 100644
index f9179c9f42b16b5c73b7102700410f2d1b83aeab..abce85bb4fb63d1662bbc9ad28a1047f97c6d3c4 100644
--- a/content/browser/renderer_host/render_frame_host_manager.cc
+++ b/content/browser/renderer_host/render_frame_host_manager.cc
@@ -4891,6 +4891,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
@@ -4913,6 +4913,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
request->ResetStateForSiteInstanceChange();
}
@@ -20,7 +20,7 @@ index 1e76d25ab16ec1215e4c532fd7cb73702f16ffc6..8af96cfe14c4358cb6ab09135c04b045
}
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index 02321334795bb096206146caf24084c12347664e..70d485a1ef60230e2bcc5e64c02f35af805c87f5 100644
index eb684232648424fab4ba73b1fc813b0b3f8b809b..42b6fe4eb2c1db7afd6379ae07c1062856ed958e 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -350,6 +350,11 @@ class CONTENT_EXPORT ContentBrowserClient {

View File

@@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch
Add electron resources file to the list of resource ids generation.
diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec
index 98b18d9e8129f2b06c4633b4ff74320fa2dee5f6..2f9bbe7578ce8e255a4aed6dd9dacea245640795 100644
index ffd47250ce5a6a75471bb65aaf3d65b550be3586..e75f89f05ba0e3cc29d857f76244d777efdf1b84 100644
--- a/tools/gritsettings/resource_ids.spec
+++ b/tools/gritsettings/resource_ids.spec
@@ -1670,6 +1670,11 @@
@@ -1678,6 +1678,11 @@
"includes": [12000],
},

View File

@@ -50,7 +50,7 @@ system font by checking if it's kCTFontPriorityAttribute is set to
system priority.
diff --git a/base/BUILD.gn b/base/BUILD.gn
index 2fea06e3d762884df05e74c0cef98990c302f814..fbadbe444df1b58e9e9cb985d30d009b661802ec 100644
index aad39d792791fb1e17d7a529eb234f74fdb65b09..95262f1cb611bfa9ac61321312b0aa5a979900cd 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -1086,6 +1086,7 @@ component("base") {
@@ -129,7 +129,7 @@ index 416e541436d201aabca26cdbf7e8477103bd014c..8c5f92b03d67e5f0587b0e9420969061
}
diff --git a/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn b/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
index 5c058b320fb0655db4eeb807b56547de83baa59a..ac397a51a961886e374bcf732fd5731ccfaf687e 100644
index 51a9d1fef7b2dbfef69f8474d74d45b69f16219d..cd61d8ae6ac772f8b8c28157e21b439cdb87dcca 100644
--- a/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
+++ b/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
@@ -978,6 +978,7 @@ if (is_clang_or_gcc) {
@@ -974,7 +974,7 @@ index 664e12c07204feeb5be16581fe51e8adc4b898dd..38159d146cdf71f84611d58e2983418a
return kAttributes;
}
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index 1742ffc72707b7566982e60ae4964d0da901cbfe..56a1b7fb501979812b1f2e194044667f84f2312e 100644
index 718b28f411f7c32af45dc1e1cf4b4deeba78b06b..3a2189e97b99b2b2cf0308feeeddb9a249b3edb5 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -363,6 +363,7 @@ source_set("browser") {
@@ -1020,7 +1020,7 @@ index d4320df856533ef75f943deeac82119c746f5e20..c6e9cc8fd3b3e152493086a6f401d1c6
// Used to force the NSApplication's focused accessibility element to be the
// content::BrowserAccessibilityCocoa accessibility tree when the NSView for
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 0241e3d3afaf7cd70214f71c1c8f023a49669ff8..f7c3e60f748e24e51bffa2bc8914a8a7b67bd504 100644
index 63041c4311293c53d370522646012cde803e0a99..886b3e87e9041931d3cb59ef775b5012e8e2f908 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -53,6 +53,7 @@
@@ -1042,7 +1042,7 @@ index 0241e3d3afaf7cd70214f71c1c8f023a49669ff8..f7c3e60f748e24e51bffa2bc8914a8a7
// Reset `ns_view_` before resetting `remote_ns_view_` to avoid dangling
// pointers. `ns_view_` gets reinitialized later in this method.
@@ -1713,10 +1716,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
@@ -1720,10 +1723,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
gfx::NativeViewAccessible
RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() {
@@ -1055,7 +1055,7 @@ index 0241e3d3afaf7cd70214f71c1c8f023a49669ff8..f7c3e60f748e24e51bffa2bc8914a8a7
return gfx::NativeViewAccessible([GetInProcessNSView() window]);
}
@@ -1768,9 +1773,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
@@ -1775,9 +1780,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
}
void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) {
@@ -1067,7 +1067,7 @@ index 0241e3d3afaf7cd70214f71c1c8f023a49669ff8..f7c3e60f748e24e51bffa2bc8914a8a7
}
bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame(
@@ -2300,20 +2307,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
@@ -2307,20 +2314,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
void RenderWidgetHostViewMac::GetRenderWidgetAccessibilityToken(
GetRenderWidgetAccessibilityTokenCallback callback) {
base::ProcessId pid = getpid();
@@ -1095,10 +1095,10 @@ index 0241e3d3afaf7cd70214f71c1c8f023a49669ff8..f7c3e60f748e24e51bffa2bc8914a8a7
///////////////////////////////////////////////////////////////////////////////
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
index c759540ec86f1eca0d5b6ef61b899eb5fcdca16f..9ea2729f7c805bea9aa417fc0371fd2240cf544a 100644
index 6294792999d1653b73c695ebfddda0f8a45d82c9..da6be02dcff5d956e69fa356ec6dea65aa9780af 100644
--- a/content/common/BUILD.gn
+++ b/content/common/BUILD.gn
@@ -280,6 +280,7 @@ source_set("common") {
@@ -282,6 +282,7 @@ source_set("common") {
"//ui/shell_dialogs",
"//url",
"//url/ipc:url_ipc",
@@ -1189,7 +1189,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe
} // namespace content
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
index 45de48909df23b461aa8924bb391f13242aacef4..da0faf5bc419a11d192487ea373cee63596c2032 100644
index ec792aa7e050550721cd221bfe8ff335e22e90ef..4521cc9e247c44248627c12b9eda0961f837d744 100644
--- a/content/test/BUILD.gn
+++ b/content/test/BUILD.gn
@@ -701,6 +701,7 @@ static_library("test_support") {
@@ -1209,7 +1209,7 @@ index 45de48909df23b461aa8924bb391f13242aacef4..da0faf5bc419a11d192487ea373cee63
}
mojom("content_test_mojo_bindings") {
@@ -2077,6 +2080,7 @@ test("content_browsertests") {
@@ -2078,6 +2081,7 @@ test("content_browsertests") {
"//ui/shell_dialogs",
"//ui/snapshot",
"//ui/webui:test_support",
@@ -1217,7 +1217,7 @@ index 45de48909df23b461aa8924bb391f13242aacef4..da0faf5bc419a11d192487ea373cee63
]
if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) {
@@ -3441,6 +3445,7 @@ test("content_unittests") {
@@ -3446,6 +3450,7 @@ test("content_unittests") {
"//ui/shell_dialogs",
"//ui/webui:test_support",
"//url",

View File

@@ -7,10 +7,10 @@ This adds a callback from the network service that's used to implement
session.setCertificateVerifyCallback.
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
index 0d70e10657f5f1cc5811e56044f13d9ae6c7f2a1..4efd5407479b9e5ee6af84a4cd6d26895d8b19f7 100644
index 68b3acc5a4e67fee975fd982f252cbf46c28ccac..cf1001557f2f59747ceb394ab2c93b4bf379dafb 100644
--- a/services/network/network_context.cc
+++ b/services/network/network_context.cc
@@ -172,6 +172,11 @@
@@ -173,6 +173,11 @@
#include "services/network/web_transport.h"
#include "url/gurl.h"
@@ -22,7 +22,7 @@ index 0d70e10657f5f1cc5811e56044f13d9ae6c7f2a1..4efd5407479b9e5ee6af84a4cd6d2689
#if BUILDFLAG(IS_CT_SUPPORTED)
// gn check does not account for BUILDFLAG(). So, for iOS builds, it will
// complain about a missing dependency on the target exposing this header. Add a
@@ -631,6 +636,111 @@ void RecordHSTSPreconnectUpgradeReason(HSTSRedirectUpgradeReason reason) {
@@ -632,6 +637,111 @@ void RecordHSTSPreconnectUpgradeReason(HSTSRedirectUpgradeReason reason) {
} // namespace
@@ -134,7 +134,7 @@ index 0d70e10657f5f1cc5811e56044f13d9ae6c7f2a1..4efd5407479b9e5ee6af84a4cd6d2689
constexpr uint32_t NetworkContext::kMaxOutstandingRequestsPerProcess;
NetworkContext::NetworkContextHttpAuthPreferences::
@@ -1078,6 +1188,13 @@ void NetworkContext::SetClient(
@@ -1081,6 +1191,13 @@ void NetworkContext::SetClient(
client_.Bind(std::move(client));
}
@@ -148,7 +148,7 @@ index 0d70e10657f5f1cc5811e56044f13d9ae6c7f2a1..4efd5407479b9e5ee6af84a4cd6d2689
void NetworkContext::CreateURLLoaderFactory(
mojo::PendingReceiver<mojom::URLLoaderFactory> receiver,
mojom::URLLoaderFactoryParamsPtr params) {
@@ -2767,6 +2884,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
@@ -2800,6 +2917,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
cert_verifier = std::make_unique<net::CachingCertVerifier>(
std::make_unique<net::CoalescingCertVerifier>(
std::move(cert_verifier)));
@@ -160,10 +160,10 @@ index 0d70e10657f5f1cc5811e56044f13d9ae6c7f2a1..4efd5407479b9e5ee6af84a4cd6d2689
builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier(
diff --git a/services/network/network_context.h b/services/network/network_context.h
index 80f64d8bc17c9a706dafd3e9639a6d7e62caf0d5..912e4d60647f6376dfef62d18998b556bc7efa32 100644
index 54a5feca1fbec658039826304f27283bd9d9c15a..04e6e884dccbb680a39f2b9c8a54de162e056a30 100644
--- a/services/network/network_context.h
+++ b/services/network/network_context.h
@@ -121,6 +121,7 @@ class SimpleUrlPatternMatcher;
@@ -122,6 +122,7 @@ class SimpleUrlPatternMatcher;
}
namespace network {
@@ -171,7 +171,7 @@ index 80f64d8bc17c9a706dafd3e9639a6d7e62caf0d5..912e4d60647f6376dfef62d18998b556
class CookieManager;
class HostResolver;
class MdnsResponderManager;
@@ -257,6 +258,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
@@ -258,6 +259,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
void CreateURLLoaderFactory(
mojo::PendingReceiver<mojom::URLLoaderFactory> receiver,
mojom::URLLoaderFactoryParamsPtr params) override;
@@ -180,7 +180,7 @@ index 80f64d8bc17c9a706dafd3e9639a6d7e62caf0d5..912e4d60647f6376dfef62d18998b556
void ResetURLLoaderFactories() override;
void GetViaObliviousHttp(
mojom::ObliviousHttpRequestPtr request,
@@ -982,6 +985,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
@@ -1002,6 +1005,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
std::vector<base::OnceClosure> dismount_closures_;
#endif // BUILDFLAG(IS_DIRECTORY_TRANSFER_REQUIRED)
@@ -190,7 +190,7 @@ index 80f64d8bc17c9a706dafd3e9639a6d7e62caf0d5..912e4d60647f6376dfef62d18998b556
std::unique_ptr<HostResolver> internal_host_resolver_;
std::set<std::unique_ptr<HostResolver>, base::UniquePtrComparator>
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
index 47134ad9365ce50035d5a305418e36a41fc917c9..63d410dd356594a5928ed2f84b05b403bf3367f0 100644
index 152bffb4e6565437e867b79364c594305350047f..6c43c2985123525793dd6b60c9d7d7c1db7fdf04 100644
--- a/services/network/public/mojom/network_context.mojom
+++ b/services/network/public/mojom/network_context.mojom
@@ -325,6 +325,17 @@ struct SocketBrokerRemotes {
@@ -211,7 +211,7 @@ index 47134ad9365ce50035d5a305418e36a41fc917c9..63d410dd356594a5928ed2f84b05b403
// Parameters for constructing a network context.
struct NetworkContextParams {
// The user agent string.
@@ -977,6 +988,9 @@ interface NetworkContext {
@@ -981,6 +992,9 @@ interface NetworkContext {
// Sets a client for this network context.
SetClient(pending_remote<NetworkContextClient> client);
@@ -222,7 +222,7 @@ index 47134ad9365ce50035d5a305418e36a41fc917c9..63d410dd356594a5928ed2f84b05b403
CreateURLLoaderFactory(
pending_receiver<URLLoaderFactory> url_loader_factory,
diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h
index beb1c3dba14fcc504886f100b1568768231a4f2d..bc26f449109b3be84490fbb3569e36aa4aca8c4b 100644
index 8b419ec4a949551557eba8c84589a18147b78c5d..b472be0acdc0cd4971e6e0a9e623bc1c84d07a02 100644
--- a/services/network/test/test_network_context.h
+++ b/services/network/test/test_network_context.h
@@ -63,6 +63,8 @@ class TestNetworkContext : public mojom::NetworkContext {

View File

@@ -512,10 +512,10 @@ index aa79c324af2cec50019bca3bccff5d420fb30ffd..0b85598f87673537eccdd0b310e8462e
scoped_refptr<base::RefCountedMemory> print_data,
const gfx::Size& page_size,
diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h
index db3b04ba3353831ec766f48450b6dce40909bc59..d6fd0d304dffa71be42547a3f6ee6cdb7546de8b 100644
index b6bbf0f1829a6759f65535679aafb8e407242166..f355b8981e8fc672b1ad165b3b770d3f17b3e13c 100644
--- a/chrome/browser/printing/print_view_manager_base.h
+++ b/chrome/browser/printing/print_view_manager_base.h
@@ -46,6 +46,8 @@ namespace printing {
@@ -48,6 +48,8 @@ namespace printing {
class PrintQueriesQueue;
class PrinterQuery;
@@ -524,7 +524,7 @@ index db3b04ba3353831ec766f48450b6dce40909bc59..d6fd0d304dffa71be42547a3f6ee6cdb
// Base class for managing the print commands for a WebContents.
class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
public:
@@ -76,7 +78,9 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
@@ -78,7 +80,9 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
// Prints the current document immediately. Since the rendering is
// asynchronous, the actual printing will not be completed on the return of
// this function. Returns false if printing is impossible at the moment.
@@ -535,7 +535,7 @@ index db3b04ba3353831ec766f48450b6dce40909bc59..d6fd0d304dffa71be42547a3f6ee6cdb
// Like PrintNow(), but for the node under the context menu, instead of the
// entire frame.
@@ -130,8 +134,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
@@ -132,8 +136,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
void IsPrintingEnabled(IsPrintingEnabledCallback callback) override;
void ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
ScriptedPrintCallback callback) override;
@@ -546,7 +546,7 @@ index db3b04ba3353831ec766f48450b6dce40909bc59..d6fd0d304dffa71be42547a3f6ee6cdb
// Adds and removes observers for `PrintViewManagerBase` events. The order in
// which notifications are sent to observers is undefined. Observers must be
@@ -139,6 +145,14 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
@@ -141,6 +147,14 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
void AddTestObserver(TestObserver& observer);
void RemoveTestObserver(TestObserver& observer);
@@ -561,7 +561,7 @@ index db3b04ba3353831ec766f48450b6dce40909bc59..d6fd0d304dffa71be42547a3f6ee6cdb
protected:
#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS)
using PrintDocumentCallback =
@@ -218,7 +232,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
@@ -220,7 +234,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
mojom::ScriptedPrintParamsPtr params,
ScriptedPrintCallback callback);
@@ -570,7 +570,7 @@ index db3b04ba3353831ec766f48450b6dce40909bc59..d6fd0d304dffa71be42547a3f6ee6cdb
// Helper method bound to `content_analysis_before_printing_document_` when
// content analysis should happen right before the document is to be printed.
// This method is virtual for testing purposes.
@@ -282,6 +296,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
@@ -284,6 +298,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
bool success);
#endif
void CompleteUpdatePrintSettings(
@@ -578,7 +578,7 @@ index db3b04ba3353831ec766f48450b6dce40909bc59..d6fd0d304dffa71be42547a3f6ee6cdb
base::DictValue job_settings,
std::unique_ptr<PrintSettings> print_settings,
UpdatePrintSettingsCallback callback);
@@ -376,8 +391,11 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
@@ -378,8 +393,11 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
// The current RFH that is printing with a system printing dialog.
raw_ptr<content::RenderFrameHost> printing_rfh_ = nullptr;
@@ -620,7 +620,7 @@ index 2a477e820d9f0126a05f86cd44f02c2189275bad..a2e9442ff9f5acf8e301f457b1806251
#if BUILDFLAG(IS_CHROMEOS)
diff --git a/chrome/browser/printing/printer_query_oop.cc b/chrome/browser/printing/printer_query_oop.cc
index dc2a15ab4d784b0b6c85b84a30c3c08a17ed8e3d..e197026e8a7f132c1bf90a0f5f1eabb4f5f064ee 100644
index dc2a15ab4d784b0b6c85b84a30c3c08a17ed8e3d..5ca7920c8525c3c72fd96b14709fb35a9cc28daf 100644
--- a/chrome/browser/printing/printer_query_oop.cc
+++ b/chrome/browser/printing/printer_query_oop.cc
@@ -126,7 +126,7 @@ void PrinterQueryOop::OnDidAskUserForSettings(
@@ -632,7 +632,7 @@ index dc2a15ab4d784b0b6c85b84a30c3c08a17ed8e3d..e197026e8a7f132c1bf90a0f5f1eabb4
// Want the same PrintBackend service as the query so that we use the same
// device context.
print_document_client_id_ =
@@ -189,6 +189,21 @@ void PrinterQueryOop::GetSettingsWithUI(uint32_t document_page_count,
@@ -189,6 +189,28 @@ void PrinterQueryOop::GetSettingsWithUI(uint32_t document_page_count,
// browser process.
// - Other platforms don't have a system print UI or do not use OOP
// printing, so this does not matter.
@@ -643,12 +643,19 @@ index dc2a15ab4d784b0b6c85b84a30c3c08a17ed8e3d..e197026e8a7f132c1bf90a0f5f1eabb4
+ // remote service context, not the local one used by the native dialog.
+ if (settings().dpi()) {
+ printing_context()->SetPrintSettings(settings());
+ printing_context()->UpdatePrinterSettings(PrintingContext::PrinterSettings{
+ if (printing_context()->UpdatePrinterSettings(
+ PrintingContext::PrinterSettings{
+#if BUILDFLAG(IS_MAC)
+ .external_preview = false,
+ .external_preview = false,
+#endif
+ .show_system_dialog = false,
+ });
+ .show_system_dialog = false,
+ }) != mojom::ResultCode::kSuccess) {
+ // Prefilling failed (e.g. the printer does not support the requested
+ // resolution). Reinitialize with defaults so that AskUserForSettings
+ // does not crash due to a null print_info_. The dialog will simply
+ // open without prefilled values.
+ printing_context()->UseDefaultSettings();
+ }
+ }
+
PrinterQuery::GetSettingsWithUI(

View File

@@ -30,10 +30,10 @@ index 4dad6bbade99a00b5ae0f45d4de34d866918545c..6c7ec195fa64e3a1a718811192c9f6fd
// RenderWidgetHost on the primary main frame, and false otherwise.
virtual bool IsWidgetForPrimaryMainFrame(RenderWidgetHostImpl*);
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 1919546e9be90303d1aee29208d8227ece452827..3e62cf797e2fc127c4af86a912224f6c745b87f5 100644
index 8df679251dc314a94079fcc9d4edd7fab12873d4..06599737a290ba4c52a7d36725aef565d49800bd 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -2058,6 +2058,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) {
@@ -2066,6 +2066,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) {
if (view_) {
view_->UpdateCursor(cursor);
}
@@ -44,10 +44,10 @@ index 1919546e9be90303d1aee29208d8227ece452827..3e62cf797e2fc127c4af86a912224f6c
void RenderWidgetHostImpl::ShowContextMenuAtPoint(
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 0088e16862b4eb08e2100f13e0d9fecfc0d8aa9d..ec75b1a31c029ff9f1d23f297be4ae40bc24af9c 100644
index 4e91b3aeb5630476c660e8814e2fd9d92c5a9ca1..d43e75c20aca09080f4223d339c88381f030c504 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -6335,6 +6335,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
@@ -6342,6 +6342,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
return text_input_manager_.get();
}

View File

@@ -8,7 +8,7 @@ it in Electron and prevent drift from Chrome's blocklist. We should look for a w
to upstream this change to Chrome.
diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
index 4e769e8be28ffd18788d8786fe7341e5d5b0697c..2f447d1a3e7ab50458159bcb717220bb60f6f6ea 100644
index fc75611edcaffa0501d5ad171e82e42a9d48002b..087d79d3249b7589f7f4cd5f7330edf33b7ec165 100644
--- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
+++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
@@ -83,11 +83,13 @@
@@ -25,14 +25,10 @@ index 4e769e8be28ffd18788d8786fe7341e5d5b0697c..2f447d1a3e7ab50458159bcb717220bb
#include "components/tabs/public/tab_interface.h"
#if BUILDFLAG(ENABLE_PLATFORM_APPS)
#include "extensions/browser/extension_registry.h" // nogncheck
@@ -286,190 +288,10 @@ bool MaybeIsLocalUNCPath(const base::FilePath& path) {
@@ -287,214 +289,10 @@ bool MaybeIsLocalUNCPath(const base::FilePath& path) {
}
#endif
-// Sentinel used to indicate that no PathService key is specified for a path in
-// the struct below.
-constexpr const int kNoBasePathKey = -1;
-
-// A wrapper around `base::NormalizeFilePath` that returns its result instead of
-// using an out parameter.
-base::FilePath NormalizeFilePath(const base::FilePath& path) {
@@ -62,117 +58,132 @@ index 4e769e8be28ffd18788d8786fe7341e5d5b0697c..2f447d1a3e7ab50458159bcb717220bb
-
-std::unique_ptr<ChromeFileSystemAccessPermissionContext::BlockPathRules>
-GenerateBlockPaths(bool should_normalize_file_path) {
- static constexpr ChromeFileSystemAccessPermissionContext::BlockPath
- kBlockPaths[] = {
- // Don't allow users to share their entire home directory, entire
- // desktop or entire documents folder, but do allow sharing anything
- // inside those directories not otherwise blocked.
- {base::DIR_HOME, nullptr, BlockType::kDontBlockChildren},
- {base::DIR_USER_DESKTOP, nullptr, BlockType::kDontBlockChildren},
- {chrome::DIR_USER_DOCUMENTS, nullptr, BlockType::kDontBlockChildren},
- // Similar restrictions for the downloads directory.
- {chrome::DIR_DEFAULT_DOWNLOADS, nullptr,
- BlockType::kDontBlockChildren},
- {chrome::DIR_DEFAULT_DOWNLOADS_SAFE, nullptr,
- BlockType::kDontBlockChildren},
- // The Chrome installation itself should not be modified by the web.
- {base::DIR_EXE, nullptr, BlockType::kBlockAllChildren},
- {base::DIR_MODULE, nullptr, BlockType::kBlockAllChildren},
- {base::DIR_ASSETS, nullptr, BlockType::kBlockAllChildren},
- // And neither should the configuration of at least the currently
- // running Chrome instance (note that this does not take
- // --user-data-dir command line overrides into account).
- {chrome::DIR_USER_DATA, nullptr, BlockType::kBlockAllChildren},
- // ~/.ssh is pretty sensitive on all platforms, so block access to
- // that.
- {base::DIR_HOME, FILE_PATH_LITERAL(".ssh"),
- BlockType::kBlockAllChildren},
- // And limit access to ~/.gnupg as well.
- {base::DIR_HOME, FILE_PATH_LITERAL(".gnupg"),
- BlockType::kBlockAllChildren},
- using BlockPath = ChromeFileSystemAccessPermissionContext::BlockPath;
- static constexpr BlockPath kBlockPaths[] = {
- // Don't allow users to share their entire home directory, entire desktop
- // or entire documents folder, but do allow sharing anything inside those
- // directories not otherwise blocked.
- BlockPath::CreateRelative(base::DIR_HOME, BlockType::kDontBlockChildren),
- BlockPath::CreateRelative(base::DIR_USER_DESKTOP,
- BlockType::kDontBlockChildren),
- BlockPath::CreateRelative(chrome::DIR_USER_DOCUMENTS,
- BlockType::kDontBlockChildren),
- // Similar restrictions for the downloads directory.
- BlockPath::CreateRelative(chrome::DIR_DEFAULT_DOWNLOADS,
- BlockType::kDontBlockChildren),
- BlockPath::CreateRelative(chrome::DIR_DEFAULT_DOWNLOADS_SAFE,
- BlockType::kDontBlockChildren),
- // The Chrome installation itself should not be modified by the web.
- BlockPath::CreateRelative(base::DIR_EXE, BlockType::kBlockAllChildren),
- BlockPath::CreateRelative(base::DIR_MODULE, BlockType::kBlockAllChildren),
- BlockPath::CreateRelative(base::DIR_ASSETS, BlockType::kBlockAllChildren),
- // And neither should the configuration of at least the currently running
- // Chrome instance (note that this does not take --user-data-dir command
- // line overrides into account).
- BlockPath::CreateRelative(chrome::DIR_USER_DATA,
- BlockType::kBlockAllChildren),
- // ~/.ssh is pretty sensitive on all platforms, so block access to that.
- BlockPath::CreateRelative(base::DIR_HOME, FILE_PATH_LITERAL(".ssh"),
- BlockType::kBlockAllChildren),
- // And limit access to ~/.gnupg as well.
- BlockPath::CreateRelative(base::DIR_HOME, FILE_PATH_LITERAL(".gnupg"),
- BlockType::kBlockAllChildren),
-#if BUILDFLAG(IS_WIN)
- // Some Windows specific directories to block, basically all apps, the
- // operating system itself, as well as configuration data for apps.
- {base::DIR_PROGRAM_FILES, nullptr, BlockType::kBlockAllChildren},
- {base::DIR_PROGRAM_FILESX86, nullptr, BlockType::kBlockAllChildren},
- {base::DIR_PROGRAM_FILES6432, nullptr, BlockType::kBlockAllChildren},
- {base::DIR_WINDOWS, nullptr, BlockType::kBlockAllChildren},
- {base::DIR_ROAMING_APP_DATA, nullptr, BlockType::kBlockAllChildren},
- {base::DIR_LOCAL_APP_DATA, nullptr, BlockType::kBlockAllChildren},
- {base::DIR_COMMON_APP_DATA, nullptr, BlockType::kBlockAllChildren},
- // Opening a file from an MTP device, such as a smartphone or a
- // camera, is
- // implemented by Windows as opening a file in the temporary internet
- // files directory. To support that, allow opening files in that
- // directory, but not whole directories.
- {base::DIR_IE_INTERNET_CACHE, nullptr,
- BlockType::kBlockNestedDirectories},
- // Some Windows specific directories to block, basically all apps, the
- // operating system itself, as well as configuration data for apps.
- BlockPath::CreateRelative(base::DIR_PROGRAM_FILES,
- BlockType::kBlockAllChildren),
- BlockPath::CreateRelative(base::DIR_PROGRAM_FILESX86,
- BlockType::kBlockAllChildren),
- BlockPath::CreateRelative(base::DIR_PROGRAM_FILES6432,
- BlockType::kBlockAllChildren),
- BlockPath::CreateRelative(base::DIR_WINDOWS,
- BlockType::kBlockAllChildren),
- BlockPath::CreateRelative(base::DIR_ROAMING_APP_DATA,
- BlockType::kBlockAllChildren),
- BlockPath::CreateRelative(base::DIR_LOCAL_APP_DATA,
- BlockType::kBlockAllChildren),
- BlockPath::CreateRelative(base::DIR_COMMON_APP_DATA,
- BlockType::kBlockAllChildren),
- // Opening a file from an MTP device, such as a smartphone or a camera, is
- // implemented by Windows as opening a file in the temporary internet
- // files directory. To support that, allow opening files in that
- // directory, but not whole directories.
- BlockPath::CreateRelative(base::DIR_IE_INTERNET_CACHE,
- BlockType::kBlockNestedDirectories),
- // Block */.git/hooks on Windows, see crbug.com/465668234.
- BlockPath::CreateSuffix(FILE_PATH_LITERAL(".git/hooks"),
- BlockType::kBlockWrite),
-#endif
-#if BUILDFLAG(IS_MAC)
- // Similar Mac specific blocks.
- {base::DIR_APP_DATA, nullptr, BlockType::kBlockAllChildren},
- // Block access to the current bundle directory.
- {chrome::DIR_OUTER_BUNDLE, nullptr, BlockType::kBlockAllChildren},
- // Block access to the user's Applications directory.
- {base::DIR_HOME, FILE_PATH_LITERAL("Applications"),
- BlockType::kBlockAllChildren},
- // Block access to the root Applications directory.
- {kNoBasePathKey, FILE_PATH_LITERAL("/Applications"),
- BlockType::kBlockAllChildren},
- {base::DIR_HOME, FILE_PATH_LITERAL("Library"),
- BlockType::kBlockAllChildren},
- // Allow access to other cloud files, such as Google Drive.
- {base::DIR_HOME, FILE_PATH_LITERAL("Library/CloudStorage"),
- BlockType::kDontBlockChildren},
- // Allow the site to interact with data from its corresponding
- // natively
- // installed (sandboxed) application. It would be nice to limit a site
- // to
- // access only _its_ corresponding natively installed application, but
- // unfortunately there's no straightforward way to do that. See
- // https://crbug.com/40095723#c22.
- {base::DIR_HOME, FILE_PATH_LITERAL("Library/Containers"),
- BlockType::kDontBlockChildren},
- // Allow access to iCloud files...
- {base::DIR_HOME, FILE_PATH_LITERAL("Library/Mobile Documents"),
- BlockType::kDontBlockChildren},
- // ... which may also appear at this directory.
- {base::DIR_HOME,
- FILE_PATH_LITERAL("Library/Mobile Documents/com~apple~CloudDocs"),
- BlockType::kDontBlockChildren},
- // Similar Mac specific blocks.
- BlockPath::CreateRelative(base::DIR_APP_DATA,
- BlockType::kBlockAllChildren),
- // Block access to the current bundle directory.
- BlockPath::CreateRelative(chrome::DIR_OUTER_BUNDLE,
- BlockType::kBlockAllChildren),
- // Block access to the user's Applications directory.
- BlockPath::CreateRelative(base::DIR_HOME,
- FILE_PATH_LITERAL("Applications"),
- BlockType::kBlockAllChildren),
- // Block access to the root Applications directory.
- BlockPath::CreateAbsolute(FILE_PATH_LITERAL("/Applications"),
- BlockType::kBlockAllChildren),
- BlockPath::CreateRelative(base::DIR_HOME, FILE_PATH_LITERAL("Library"),
- BlockType::kBlockAllChildren),
- // Allow access to other cloud files, such as Google Drive.
- BlockPath::CreateRelative(base::DIR_HOME,
- FILE_PATH_LITERAL("Library/CloudStorage"),
- BlockType::kDontBlockChildren),
- // Allow the site to interact with data from its corresponding natively
- // installed (sandboxed) application. It would be nice to limit a site to
- // access only _its_ corresponding natively installed application, but
- // unfortunately there's no straightforward way to do that. See
- // https://crbug.com/40095723#c22.
- BlockPath::CreateRelative(base::DIR_HOME,
- FILE_PATH_LITERAL("Library/Containers"),
- BlockType::kDontBlockChildren),
- // Allow access to iCloud files...
- BlockPath::CreateRelative(base::DIR_HOME,
- FILE_PATH_LITERAL("Library/Mobile Documents"),
- BlockType::kDontBlockChildren),
- // ... which may also appear at this directory.
- BlockPath::CreateRelative(
- base::DIR_HOME,
- FILE_PATH_LITERAL("Library/Mobile Documents/com~apple~CloudDocs"),
- BlockType::kDontBlockChildren),
-#endif
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
- // On Linux also block access to devices via /dev.
- {kNoBasePathKey, FILE_PATH_LITERAL("/dev"),
- BlockType::kBlockAllChildren},
- // And security sensitive data in /proc and /sys.
- {kNoBasePathKey, FILE_PATH_LITERAL("/proc"),
- BlockType::kBlockAllChildren},
- {kNoBasePathKey, FILE_PATH_LITERAL("/sys"),
- BlockType::kBlockAllChildren},
- // And system files in /boot and /etc.
- {kNoBasePathKey, FILE_PATH_LITERAL("/boot"),
- BlockType::kBlockAllChildren},
- {kNoBasePathKey, FILE_PATH_LITERAL("/etc"),
- BlockType::kBlockAllChildren},
- // And block all of ~/.config, matching the similar restrictions on
- // mac
- // and windows.
- {base::DIR_HOME, FILE_PATH_LITERAL(".config"),
- BlockType::kBlockAllChildren},
- // Block ~/.dbus as well, just in case, although there probably isn't
- // much
- // a website can do with access to that directory and its contents.
- {base::DIR_HOME, FILE_PATH_LITERAL(".dbus"),
- BlockType::kBlockAllChildren},
- // On Linux also block access to devices via /dev.
- BlockPath::CreateAbsolute(FILE_PATH_LITERAL("/dev"),
- BlockType::kBlockAllChildren),
- // And security sensitive data in /proc and /sys.
- BlockPath::CreateAbsolute(FILE_PATH_LITERAL("/proc"),
- BlockType::kBlockAllChildren),
- BlockPath::CreateAbsolute(FILE_PATH_LITERAL("/sys"),
- BlockType::kBlockAllChildren),
- // And system files in /boot and /etc.
- BlockPath::CreateAbsolute(FILE_PATH_LITERAL("/boot"),
- BlockType::kBlockAllChildren),
- BlockPath::CreateAbsolute(FILE_PATH_LITERAL("/etc"),
- BlockType::kBlockAllChildren),
- // And block all of ~/.config, matching the similar restrictions on mac
- // and windows.
- BlockPath::CreateRelative(base::DIR_HOME, FILE_PATH_LITERAL(".config"),
- BlockType::kBlockAllChildren),
- // Block ~/.dbus as well, just in case, although there probably isn't much
- // a website can do with access to that directory and its contents.
- BlockPath::CreateRelative(base::DIR_HOME, FILE_PATH_LITERAL(".dbus"),
- BlockType::kBlockAllChildren),
-#endif
-#if BUILDFLAG(IS_ANDROID)
- {base::DIR_ANDROID_APP_DATA, nullptr, BlockType::kBlockAllChildren},
- {base::DIR_CACHE, nullptr, BlockType::kBlockAllChildren},
- BlockPath::CreateRelative(base::DIR_ANDROID_APP_DATA,
- BlockType::kBlockAllChildren),
- BlockPath::CreateRelative(base::DIR_CACHE, BlockType::kBlockAllChildren),
-#endif
- // TODO(crbug.com/40095723): Refine this list, for example add
- // XDG_CONFIG_HOME when it is not set ~/.config?
- };
- // TODO(crbug.com/40095723): Refine this list, for example add
- // XDG_CONFIG_HOME when it is not set ~/.config?
- };
-
- // ChromeOS supports multi-user sign-in. base::DIR_HOME only returns the
- // profile path for the primary user, the first user to sign in. We want to
@@ -187,28 +198,41 @@ index 4e769e8be28ffd18788d8786fe7341e5d5b0697c..2f447d1a3e7ab50458159bcb717220bb
-
- for (const auto& blocked_path : kBlockPaths) {
- base::FilePath path;
- if (blocked_path.base_path_key != kNoBasePathKey) {
- if (kUseProfilePathForDirHome &&
- blocked_path.base_path_key == base::DIR_HOME) {
- block_path_rules->profile_based_block_path_rules_.emplace_back(
- blocked_path.path, blocked_path.type);
- switch (blocked_path.block_path_type) {
- case ChromeFileSystemAccessPermissionContext::BlockPathType::kAbsolute: {
- CHECK(blocked_path.path);
- path = base::FilePath(blocked_path.path);
- break;
- }
- case ChromeFileSystemAccessPermissionContext::BlockPathType::kRelative: {
- CHECK(blocked_path.base_path_key);
- if (kUseProfilePathForDirHome &&
- blocked_path.base_path_key == base::DIR_HOME) {
- block_path_rules->profile_based_block_path_rules_.emplace_back(
- blocked_path.path, blocked_path.block_type);
- continue;
- }
-
- if (!base::PathService::Get(blocked_path.base_path_key.value(),
- &path)) {
- continue;
- }
-
- if (blocked_path.path) {
- path = path.Append(blocked_path.path);
- }
- break;
- }
- case ChromeFileSystemAccessPermissionContext::BlockPathType::kSuffix: {
- block_path_rules->suffix_block_path_rules_.emplace_back(
- blocked_path.path, blocked_path.block_type);
- continue;
- }
-
- if (!base::PathService::Get(blocked_path.base_path_key, &path)) {
- continue;
- }
-
- if (blocked_path.path) {
- path = path.Append(blocked_path.path);
- }
- } else {
- DCHECK(blocked_path.path);
- path = base::FilePath(blocked_path.path);
- }
-
- block_path_rules->block_path_rules_.emplace_back(
- should_normalize_file_path ? NormalizeFilePath(path) : path,
- blocked_path.type);
- blocked_path.block_type);
- }
-
- return block_path_rules;
@@ -220,7 +244,7 @@ index 4e769e8be28ffd18788d8786fe7341e5d5b0697c..2f447d1a3e7ab50458159bcb717220bb
// Checks if `path` should be blocked by the `rules`.
// The BlockType of the nearest ancestor of a path to check is what
@@ -1404,16 +1226,6 @@ struct ChromeFileSystemAccessPermissionContext::OriginState {
@@ -1474,16 +1272,6 @@ struct ChromeFileSystemAccessPermissionContext::OriginState {
std::unique_ptr<base::RetainingOneShotTimer> cleanup_timer;
};
@@ -237,7 +261,7 @@ index 4e769e8be28ffd18788d8786fe7341e5d5b0697c..2f447d1a3e7ab50458159bcb717220bb
ChromeFileSystemAccessPermissionContext::
ChromeFileSystemAccessPermissionContext(content::BrowserContext* context,
const base::Clock* clock)
@@ -1432,7 +1244,7 @@ ChromeFileSystemAccessPermissionContext::
@@ -1502,7 +1290,7 @@ ChromeFileSystemAccessPermissionContext::
#if BUILDFLAG(IS_ANDROID)
one_time_permissions_tracker_.Observe(
OneTimePermissionsTrackerFactory::GetForBrowserContext(context));
@@ -246,7 +270,7 @@ index 4e769e8be28ffd18788d8786fe7341e5d5b0697c..2f447d1a3e7ab50458159bcb717220bb
auto* provider = web_app::WebAppProvider::GetForWebApps(
Profile::FromBrowserContext(profile_));
if (provider) {
@@ -2812,7 +2624,7 @@ void ChromeFileSystemAccessPermissionContext::OnShutdown() {
@@ -2885,7 +2673,7 @@ void ChromeFileSystemAccessPermissionContext::OnShutdown() {
one_time_permissions_tracker_.Reset();
}
@@ -255,7 +279,7 @@ index 4e769e8be28ffd18788d8786fe7341e5d5b0697c..2f447d1a3e7ab50458159bcb717220bb
void ChromeFileSystemAccessPermissionContext::OnWebAppInstalled(
const webapps::AppId& app_id) {
if (!base::FeatureList::IsEnabled(
@@ -3170,11 +2982,7 @@ bool ChromeFileSystemAccessPermissionContext::
@@ -3243,11 +3031,7 @@ bool ChromeFileSystemAccessPermissionContext::
HandleType handle_type,
UserAction user_action,
GrantType grant_type) {
@@ -268,7 +292,7 @@ index 4e769e8be28ffd18788d8786fe7341e5d5b0697c..2f447d1a3e7ab50458159bcb717220bb
if (!base::FeatureList::IsEnabled(
features::kFileSystemAccessPersistentPermissions)) {
return false;
@@ -3225,6 +3033,7 @@ bool ChromeFileSystemAccessPermissionContext::
@@ -3298,6 +3082,7 @@ bool ChromeFileSystemAccessPermissionContext::
return false;
#endif // BUILDFLAG(IS_ANDROID)
@@ -277,10 +301,10 @@ index 4e769e8be28ffd18788d8786fe7341e5d5b0697c..2f447d1a3e7ab50458159bcb717220bb
std::vector<FileRequestData> ChromeFileSystemAccessPermissionContext::
diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
index add60ba0e2ca7be385b59d46e3bdaceb55996947..5163e7092c3016494321b4c4a5f785f37f8b9411 100644
index ae026d5321cd513c188297e53fe65aaaa77d6f34..184fda7f5851a5d22957b3ebd9d47a4f635a1aff 100644
--- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
+++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
@@ -9,10 +9,13 @@
@@ -10,10 +10,13 @@
#include <vector>
#include "base/auto_reset.h"
@@ -294,7 +318,7 @@ index add60ba0e2ca7be385b59d46e3bdaceb55996947..5163e7092c3016494321b4c4a5f785f3
#include "base/scoped_observation.h"
#include "base/sequence_checker.h"
#include "base/time/clock.h"
@@ -22,6 +25,7 @@
@@ -23,6 +26,7 @@
#include "chrome/browser/file_system_access/file_system_access_permission_request_manager.h"
#include "chrome/browser/permissions/one_time_permissions_tracker.h"
#include "chrome/browser/permissions/one_time_permissions_tracker_observer.h"
@@ -302,7 +326,7 @@ index add60ba0e2ca7be385b59d46e3bdaceb55996947..5163e7092c3016494321b4c4a5f785f3
#include "components/enterprise/buildflags/buildflags.h"
#include "components/permissions/features.h"
#include "components/permissions/object_permission_context_base.h"
@@ -419,6 +423,191 @@ class ChromeFileSystemAccessPermissionContext
@@ -471,6 +475,219 @@ class ChromeFileSystemAccessPermissionContext
bool IsPathInDowngradedReadPathsForTesting(const url::Origin& origin,
const base::FilePath& path);
@@ -339,117 +363,132 @@ index add60ba0e2ca7be385b59d46e3bdaceb55996947..5163e7092c3016494321b4c4a5f785f3
+
+ static std::unique_ptr<ChromeFileSystemAccessPermissionContext::BlockPathRules>
+ GenerateBlockPaths(bool should_normalize_file_path) {
+ static constexpr ChromeFileSystemAccessPermissionContext::BlockPath
+ kBlockPaths[] = {
+ // Don't allow users to share their entire home directory, entire
+ // desktop or entire documents folder, but do allow sharing anything
+ // inside those directories not otherwise blocked.
+ {base::DIR_HOME, nullptr, BlockType::kDontBlockChildren},
+ {base::DIR_USER_DESKTOP, nullptr, BlockType::kDontBlockChildren},
+ {chrome::DIR_USER_DOCUMENTS, nullptr, BlockType::kDontBlockChildren},
+ // Similar restrictions for the downloads directory.
+ {chrome::DIR_DEFAULT_DOWNLOADS, nullptr,
+ BlockType::kDontBlockChildren},
+ {chrome::DIR_DEFAULT_DOWNLOADS_SAFE, nullptr,
+ BlockType::kDontBlockChildren},
+ // The Chrome installation itself should not be modified by the web.
+ {base::DIR_EXE, nullptr, BlockType::kBlockAllChildren},
+ {base::DIR_MODULE, nullptr, BlockType::kBlockAllChildren},
+ {base::DIR_ASSETS, nullptr, BlockType::kBlockAllChildren},
+ // And neither should the configuration of at least the currently
+ // running Chrome instance (note that this does not take
+ // --user-data-dir command line overrides into account).
+ {chrome::DIR_USER_DATA, nullptr, BlockType::kBlockAllChildren},
+ // ~/.ssh is pretty sensitive on all platforms, so block access to
+ // that.
+ {base::DIR_HOME, FILE_PATH_LITERAL(".ssh"),
+ BlockType::kBlockAllChildren},
+ // And limit access to ~/.gnupg as well.
+ {base::DIR_HOME, FILE_PATH_LITERAL(".gnupg"),
+ BlockType::kBlockAllChildren},
+ using BlockPath = ChromeFileSystemAccessPermissionContext::BlockPath;
+ static constexpr BlockPath kBlockPaths[] = {
+ // Don't allow users to share their entire home directory, entire desktop
+ // or entire documents folder, but do allow sharing anything inside those
+ // directories not otherwise blocked.
+ BlockPath::CreateRelative(base::DIR_HOME, BlockType::kDontBlockChildren),
+ BlockPath::CreateRelative(base::DIR_USER_DESKTOP,
+ BlockType::kDontBlockChildren),
+ BlockPath::CreateRelative(chrome::DIR_USER_DOCUMENTS,
+ BlockType::kDontBlockChildren),
+ // Similar restrictions for the downloads directory.
+ BlockPath::CreateRelative(chrome::DIR_DEFAULT_DOWNLOADS,
+ BlockType::kDontBlockChildren),
+ BlockPath::CreateRelative(chrome::DIR_DEFAULT_DOWNLOADS_SAFE,
+ BlockType::kDontBlockChildren),
+ // The Chrome installation itself should not be modified by the web.
+ BlockPath::CreateRelative(base::DIR_EXE, BlockType::kBlockAllChildren),
+ BlockPath::CreateRelative(base::DIR_MODULE, BlockType::kBlockAllChildren),
+ BlockPath::CreateRelative(base::DIR_ASSETS, BlockType::kBlockAllChildren),
+ // And neither should the configuration of at least the currently running
+ // Chrome instance (note that this does not take --user-data-dir command
+ // line overrides into account).
+ BlockPath::CreateRelative(chrome::DIR_USER_DATA,
+ BlockType::kBlockAllChildren),
+ // ~/.ssh is pretty sensitive on all platforms, so block access to that.
+ BlockPath::CreateRelative(base::DIR_HOME, FILE_PATH_LITERAL(".ssh"),
+ BlockType::kBlockAllChildren),
+ // And limit access to ~/.gnupg as well.
+ BlockPath::CreateRelative(base::DIR_HOME, FILE_PATH_LITERAL(".gnupg"),
+ BlockType::kBlockAllChildren),
+ #if BUILDFLAG(IS_WIN)
+ // Some Windows specific directories to block, basically all apps, the
+ // operating system itself, as well as configuration data for apps.
+ {base::DIR_PROGRAM_FILES, nullptr, BlockType::kBlockAllChildren},
+ {base::DIR_PROGRAM_FILESX86, nullptr, BlockType::kBlockAllChildren},
+ {base::DIR_PROGRAM_FILES6432, nullptr, BlockType::kBlockAllChildren},
+ {base::DIR_WINDOWS, nullptr, BlockType::kBlockAllChildren},
+ {base::DIR_ROAMING_APP_DATA, nullptr, BlockType::kBlockAllChildren},
+ {base::DIR_LOCAL_APP_DATA, nullptr, BlockType::kBlockAllChildren},
+ {base::DIR_COMMON_APP_DATA, nullptr, BlockType::kBlockAllChildren},
+ // Opening a file from an MTP device, such as a smartphone or a
+ // camera, is
+ // implemented by Windows as opening a file in the temporary internet
+ // files directory. To support that, allow opening files in that
+ // directory, but not whole directories.
+ {base::DIR_IE_INTERNET_CACHE, nullptr,
+ BlockType::kBlockNestedDirectories},
+ // Some Windows specific directories to block, basically all apps, the
+ // operating system itself, as well as configuration data for apps.
+ BlockPath::CreateRelative(base::DIR_PROGRAM_FILES,
+ BlockType::kBlockAllChildren),
+ BlockPath::CreateRelative(base::DIR_PROGRAM_FILESX86,
+ BlockType::kBlockAllChildren),
+ BlockPath::CreateRelative(base::DIR_PROGRAM_FILES6432,
+ BlockType::kBlockAllChildren),
+ BlockPath::CreateRelative(base::DIR_WINDOWS,
+ BlockType::kBlockAllChildren),
+ BlockPath::CreateRelative(base::DIR_ROAMING_APP_DATA,
+ BlockType::kBlockAllChildren),
+ BlockPath::CreateRelative(base::DIR_LOCAL_APP_DATA,
+ BlockType::kBlockAllChildren),
+ BlockPath::CreateRelative(base::DIR_COMMON_APP_DATA,
+ BlockType::kBlockAllChildren),
+ // Opening a file from an MTP device, such as a smartphone or a camera, is
+ // implemented by Windows as opening a file in the temporary internet
+ // files directory. To support that, allow opening files in that
+ // directory, but not whole directories.
+ BlockPath::CreateRelative(base::DIR_IE_INTERNET_CACHE,
+ BlockType::kBlockNestedDirectories),
+ // Block */.git/hooks on Windows, see crbug.com/465668234.
+ BlockPath::CreateSuffix(FILE_PATH_LITERAL(".git/hooks"),
+ BlockType::kBlockWrite),
+ #endif
+ #if BUILDFLAG(IS_MAC)
+ // Similar Mac specific blocks.
+ {base::DIR_APP_DATA, nullptr, BlockType::kBlockAllChildren},
+ // Block access to the current bundle directory.
+ {chrome::DIR_OUTER_BUNDLE, nullptr, BlockType::kBlockAllChildren},
+ // Block access to the user's Applications directory.
+ {base::DIR_HOME, FILE_PATH_LITERAL("Applications"),
+ BlockType::kBlockAllChildren},
+ // Block access to the root Applications directory.
+ {kNoBasePathKey, FILE_PATH_LITERAL("/Applications"),
+ BlockType::kBlockAllChildren},
+ {base::DIR_HOME, FILE_PATH_LITERAL("Library"),
+ BlockType::kBlockAllChildren},
+ // Allow access to other cloud files, such as Google Drive.
+ {base::DIR_HOME, FILE_PATH_LITERAL("Library/CloudStorage"),
+ BlockType::kDontBlockChildren},
+ // Allow the site to interact with data from its corresponding
+ // natively
+ // installed (sandboxed) application. It would be nice to limit a site
+ // to
+ // access only _its_ corresponding natively installed application, but
+ // unfortunately there's no straightforward way to do that. See
+ // https://crbug.com/984641#c22.
+ {base::DIR_HOME, FILE_PATH_LITERAL("Library/Containers"),
+ BlockType::kDontBlockChildren},
+ // Allow access to iCloud files...
+ {base::DIR_HOME, FILE_PATH_LITERAL("Library/Mobile Documents"),
+ BlockType::kDontBlockChildren},
+ // ... which may also appear at this directory.
+ {base::DIR_HOME,
+ // Similar Mac specific blocks.
+ BlockPath::CreateRelative(base::DIR_APP_DATA,
+ BlockType::kBlockAllChildren),
+ // Block access to the current bundle directory.
+ BlockPath::CreateRelative(chrome::DIR_OUTER_BUNDLE,
+ BlockType::kBlockAllChildren),
+ // Block access to the user's Applications directory.
+ BlockPath::CreateRelative(base::DIR_HOME,
+ FILE_PATH_LITERAL("Applications"),
+ BlockType::kBlockAllChildren),
+ // Block access to the root Applications directory.
+ BlockPath::CreateAbsolute(FILE_PATH_LITERAL("/Applications"),
+ BlockType::kBlockAllChildren),
+ BlockPath::CreateRelative(base::DIR_HOME, FILE_PATH_LITERAL("Library"),
+ BlockType::kBlockAllChildren),
+ // Allow access to other cloud files, such as Google Drive.
+ BlockPath::CreateRelative(base::DIR_HOME,
+ FILE_PATH_LITERAL("Library/CloudStorage"),
+ BlockType::kDontBlockChildren),
+ // Allow the site to interact with data from its corresponding natively
+ // installed (sandboxed) application. It would be nice to limit a site to
+ // access only _its_ corresponding natively installed application, but
+ // unfortunately there's no straightforward way to do that. See
+ // https://crbug.com/40095723#c22.
+ BlockPath::CreateRelative(base::DIR_HOME,
+ FILE_PATH_LITERAL("Library/Containers"),
+ BlockType::kDontBlockChildren),
+ // Allow access to iCloud files...
+ BlockPath::CreateRelative(base::DIR_HOME,
+ FILE_PATH_LITERAL("Library/Mobile Documents"),
+ BlockType::kDontBlockChildren),
+ // ... which may also appear at this directory.
+ BlockPath::CreateRelative(
+ base::DIR_HOME,
+ FILE_PATH_LITERAL("Library/Mobile Documents/com~apple~CloudDocs"),
+ BlockType::kDontBlockChildren},
+ BlockType::kDontBlockChildren),
+ #endif
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
+ // On Linux also block access to devices via /dev.
+ {kNoBasePathKey, FILE_PATH_LITERAL("/dev"),
+ BlockType::kBlockAllChildren},
+ // And security sensitive data in /proc and /sys.
+ {kNoBasePathKey, FILE_PATH_LITERAL("/proc"),
+ BlockType::kBlockAllChildren},
+ {kNoBasePathKey, FILE_PATH_LITERAL("/sys"),
+ BlockType::kBlockAllChildren},
+ // And system files in /boot and /etc.
+ {kNoBasePathKey, FILE_PATH_LITERAL("/boot"),
+ BlockType::kBlockAllChildren},
+ {kNoBasePathKey, FILE_PATH_LITERAL("/etc"),
+ BlockType::kBlockAllChildren},
+ // And block all of ~/.config, matching the similar restrictions on
+ // mac
+ // and windows.
+ {base::DIR_HOME, FILE_PATH_LITERAL(".config"),
+ BlockType::kBlockAllChildren},
+ // Block ~/.dbus as well, just in case, although there probably isn't
+ // much
+ // a website can do with access to that directory and its contents.
+ {base::DIR_HOME, FILE_PATH_LITERAL(".dbus"),
+ BlockType::kBlockAllChildren},
+ // On Linux also block access to devices via /dev.
+ BlockPath::CreateAbsolute(FILE_PATH_LITERAL("/dev"),
+ BlockType::kBlockAllChildren),
+ // And security sensitive data in /proc and /sys.
+ BlockPath::CreateAbsolute(FILE_PATH_LITERAL("/proc"),
+ BlockType::kBlockAllChildren),
+ BlockPath::CreateAbsolute(FILE_PATH_LITERAL("/sys"),
+ BlockType::kBlockAllChildren),
+ // And system files in /boot and /etc.
+ BlockPath::CreateAbsolute(FILE_PATH_LITERAL("/boot"),
+ BlockType::kBlockAllChildren),
+ BlockPath::CreateAbsolute(FILE_PATH_LITERAL("/etc"),
+ BlockType::kBlockAllChildren),
+ // And block all of ~/.config, matching the similar restrictions on mac
+ // and windows.
+ BlockPath::CreateRelative(base::DIR_HOME, FILE_PATH_LITERAL(".config"),
+ BlockType::kBlockAllChildren),
+ // Block ~/.dbus as well, just in case, although there probably isn't much
+ // a website can do with access to that directory and its contents.
+ BlockPath::CreateRelative(base::DIR_HOME, FILE_PATH_LITERAL(".dbus"),
+ BlockType::kBlockAllChildren),
+ #endif
+ #if BUILDFLAG(IS_ANDROID)
+ {base::DIR_ANDROID_APP_DATA, nullptr, BlockType::kBlockAllChildren},
+ {base::DIR_CACHE, nullptr, BlockType::kBlockAllChildren},
+ BlockPath::CreateRelative(base::DIR_ANDROID_APP_DATA,
+ BlockType::kBlockAllChildren),
+ BlockPath::CreateRelative(base::DIR_CACHE, BlockType::kBlockAllChildren),
+ #endif
+ // TODO(crbug.com/40095723): Refine this list, for example add
+ // XDG_CONFIG_HOME when it is not set ~/.config?
+ };
+ // TODO(crbug.com/40095723): Refine this list, for example add
+ // XDG_CONFIG_HOME when it is not set ~/.config?
+ };
+
+ // ChromeOS supports multi-user sign-in. base::DIR_HOME only returns the
+ // profile path for the primary user, the first user to sign in. We want to
@@ -464,28 +503,41 @@ index add60ba0e2ca7be385b59d46e3bdaceb55996947..5163e7092c3016494321b4c4a5f785f3
+
+ for (const auto& blocked_path : kBlockPaths) {
+ base::FilePath path;
+ if (blocked_path.base_path_key != kNoBasePathKey) {
+ if (kUseProfilePathForDirHome &&
+ blocked_path.base_path_key == base::DIR_HOME) {
+ block_path_rules->profile_based_block_path_rules_.emplace_back(
+ blocked_path.path, blocked_path.type);
+ switch (blocked_path.block_path_type) {
+ case ChromeFileSystemAccessPermissionContext::BlockPathType::kAbsolute: {
+ CHECK(blocked_path.path);
+ path = base::FilePath(blocked_path.path);
+ break;
+ }
+ case ChromeFileSystemAccessPermissionContext::BlockPathType::kRelative: {
+ CHECK(blocked_path.base_path_key);
+ if (kUseProfilePathForDirHome &&
+ blocked_path.base_path_key == base::DIR_HOME) {
+ block_path_rules->profile_based_block_path_rules_.emplace_back(
+ blocked_path.path, blocked_path.block_type);
+ continue;
+ }
+
+ if (!base::PathService::Get(blocked_path.base_path_key.value(),
+ &path)) {
+ continue;
+ }
+
+ if (blocked_path.path) {
+ path = path.Append(blocked_path.path);
+ }
+ break;
+ }
+ case ChromeFileSystemAccessPermissionContext::BlockPathType::kSuffix: {
+ block_path_rules->suffix_block_path_rules_.emplace_back(
+ blocked_path.path, blocked_path.block_type);
+ continue;
+ }
+
+ if (!base::PathService::Get(blocked_path.base_path_key, &path)) {
+ continue;
+ }
+
+ if (blocked_path.path) {
+ path = path.Append(blocked_path.path);
+ }
+ } else {
+ DCHECK(blocked_path.path);
+ path = base::FilePath(blocked_path.path);
+ }
+
+ block_path_rules->block_path_rules_.emplace_back(
+ should_normalize_file_path ? NormalizeFilePath(path) : path,
+ blocked_path.type);
+ blocked_path.block_type);
+ }
+
+ return block_path_rules;

View File

@@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be
accessed from our JS event. The filtering is moved into Electron's code.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 09346abdd2df2f672b1c3cc1757fa375eb6e0c72..1ef2411d03c041367e59bf9b3af2b1a6cb45dcee 100644
index e12758010f5c243d2fb9c733b74bcb0eea89f5da..6910e1e54995027933abc5724afac9129df7519c 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -10582,25 +10582,13 @@ void WebContentsImpl::RendererUnresponsive(
@@ -10589,25 +10589,13 @@ void WebContentsImpl::RendererUnresponsive(
base::RepeatingClosure hang_monitor_restarter) {
OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive",
"render_widget_host", render_widget_host);

View File

@@ -39,10 +39,10 @@ index 6c7ec195fa64e3a1a718811192c9f6fdbf9463c6..c11744d2246c3df138cdb91f1d4459c6
// event before sending it to the renderer. See enum for details on return
// value.
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 903b731a9cd58e418c26099044da62f7a23bd6ea..54d51fc916e1d2819d4e5dca0c5dd3d25790cd72 100644
index fe26e2aeba6fc03201373693d4afa2b78c89e54a..ab880a04a9638b348192a4c85785bc769e7dd83b 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1554,6 +1554,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
@@ -1562,6 +1562,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
CHECK_GE(mouse_event.GetType(), WebInputEvent::Type::kMouseTypeFirst);
CHECK_LE(mouse_event.GetType(), WebInputEvent::Type::kMouseTypeLast);
@@ -54,7 +54,7 @@ index 903b731a9cd58e418c26099044da62f7a23bd6ea..54d51fc916e1d2819d4e5dca0c5dd3d2
if (mouse_event_callback.Run(mouse_event)) {
return;
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 1ef2411d03c041367e59bf9b3af2b1a6cb45dcee..bd505514fe1aa90b1f61f50c875bfe62abb9d85a 100644
index 6910e1e54995027933abc5724afac9129df7519c..8011e752e23f62162cb2fff2461dfe5948af6dad 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4586,6 +4586,12 @@ void WebContentsImpl::RenderWidgetWasResized(

View File

@@ -1,285 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <jkleinsc@electronjs.org>
Date: Sat, 14 Jun 2025 16:21:07 -0400
Subject: Revert "[views] Remove DesktopWindowTreeHostWin::window_enlargement_"
This reverts commit 1771dbae6961e7bb7c22bbc6c77f84d90ef2be46.
Electron needs this patch to allow windows smaller than 64x64
on Windows. We should refactor our code so that this patch isn't
necessary.
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json
index d40db208ccc9955d38bab1c37e1c86a55ad7acf7..51c44e48902e44e7e1d6bda134a8f90e4bea3e81 100644
--- a/testing/variations/fieldtrial_testing_config.json
+++ b/testing/variations/fieldtrial_testing_config.json
@@ -22559,6 +22559,21 @@
]
}
],
+ "TransparentHwndEnlargement": [
+ {
+ "platforms": [
+ "windows"
+ ],
+ "experiments": [
+ {
+ "name": "DisableTransparentHwndEnlargement",
+ "disable_features": [
+ "EnableTransparentHwndEnlargement"
+ ]
+ }
+ ]
+ }
+ ],
"TransportSecurityFileWriterScheduleAndroid": [
{
"platforms": [
diff --git a/ui/views/views_features.cc b/ui/views/views_features.cc
index c74cf661f64e60ad6740e011f372e53426ce0c4d..77ce34e4f47a54f7ecabbd6e6d4d19555af248ff 100644
--- a/ui/views/views_features.cc
+++ b/ui/views/views_features.cc
@@ -34,6 +34,14 @@ BASE_FEATURE(kEnableInputProtection, base::FEATURE_DISABLED_BY_DEFAULT);
// crbug.com/370856871.
BASE_FEATURE(kEnableTouchDragCursorSync, base::FEATURE_ENABLED_BY_DEFAULT);
+// Enables enlargement of HWNDs to a minimum size of 64x64 to handle reported
+// graphical glitches on certain hardware.
+// TODO(crbug.com/401996981): Remove this once enlargement is confirmed to no
+// longer be needed.
+BASE_FEATURE(kEnableTransparentHwndEnlargement,
+ "EnableTransparentHwndEnlargement",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
// Used to enable keyboard-accessible tooltips in Views UI, as opposed
// to kKeyboardAccessibleTooltip in //ui/base/ui_base_features.cc.
BASE_FEATURE(kKeyboardAccessibleTooltipInViews,
diff --git a/ui/views/views_features.h b/ui/views/views_features.h
index 092e51509d4adccb8adbe2481909068e3e6836aa..5093a4c08bf6675ed1e5cb944c1bcb8251bdb033 100644
--- a/ui/views/views_features.h
+++ b/ui/views/views_features.h
@@ -16,6 +16,7 @@ VIEWS_EXPORT BASE_DECLARE_FEATURE(kAnnounceTextAdditionalAttributes);
VIEWS_EXPORT BASE_DECLARE_FEATURE(kApplyInitialUrlToWebContents);
VIEWS_EXPORT BASE_DECLARE_FEATURE(kEnableInputProtection);
VIEWS_EXPORT BASE_DECLARE_FEATURE(kEnableTouchDragCursorSync);
+VIEWS_EXPORT BASE_DECLARE_FEATURE(kEnableTransparentHwndEnlargement);
VIEWS_EXPORT BASE_DECLARE_FEATURE(kKeyboardAccessibleTooltipInViews);
} // namespace views::features
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
index e4da40256ce94d6a0896792a8ef2faa18e1fa5d2..d1e06b675b19226cf3b78e1aada8d8f2d684fada 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -85,6 +85,23 @@ namespace {
// This constant controls how many pixels wide that border is.
const int kMouseCaptureRegionBorder = 5;
+gfx::Size GetExpandedWindowSize(bool is_translucent, gfx::Size size) {
+ if (!base::FeatureList::IsEnabled(
+ features::kEnableTransparentHwndEnlargement) ||
+ !is_translucent) {
+ return size;
+ }
+
+ // Some AMD drivers can't display windows that are less than 64x64 pixels,
+ // so expand them to be at least that size. http://crbug.com/286609
+ gfx::Size expanded(std::max(size.width(), 64), std::max(size.height(), 64));
+ return expanded;
+}
+
+void InsetBottomRight(gfx::Rect* rect, const gfx::Vector2d& vector) {
+ rect->Inset(gfx::Insets::TLBR(0, 0, vector.y(), vector.x()));
+}
+
// Updates the cursor clip region. Used for mouse locking.
void UpdateMouseLockRegion(aura::Window* window, bool locked) {
if (!locked) {
@@ -342,9 +359,14 @@ bool DesktopWindowTreeHostWin::IsVisible() const {
}
void DesktopWindowTreeHostWin::SetSize(const gfx::Size& size) {
- const gfx::Size size_in_pixels =
+ gfx::Size size_in_pixels =
display::win::GetScreenWin()->DIPToScreenSize(GetHWND(), size);
- message_handler_->SetSize(size_in_pixels);
+ gfx::Size expanded =
+ GetExpandedWindowSize(message_handler_->is_translucent(), size_in_pixels);
+ window_enlargement_ =
+ gfx::Vector2d(expanded.width() - size_in_pixels.width(),
+ expanded.height() - size_in_pixels.height());
+ message_handler_->SetSize(expanded);
}
void DesktopWindowTreeHostWin::StackAbove(aura::Window* window) {
@@ -359,30 +381,40 @@ void DesktopWindowTreeHostWin::StackAtTop() {
}
void DesktopWindowTreeHostWin::CenterWindow(const gfx::Size& size) {
- const gfx::Size size_in_pixels =
+ gfx::Size size_in_pixels =
display::win::GetScreenWin()->DIPToScreenSize(GetHWND(), size);
- message_handler_->CenterWindow(size_in_pixels);
+ gfx::Size expanded_size;
+ expanded_size =
+ GetExpandedWindowSize(message_handler_->is_translucent(), size_in_pixels);
+ window_enlargement_ =
+ gfx::Vector2d(expanded_size.width() - size_in_pixels.width(),
+ expanded_size.height() - size_in_pixels.height());
+ message_handler_->CenterWindow(expanded_size);
}
void DesktopWindowTreeHostWin::GetWindowPlacement(
gfx::Rect* bounds,
ui::mojom::WindowShowState* show_state) const {
message_handler_->GetWindowPlacement(bounds, show_state);
+ InsetBottomRight(bounds, window_enlargement_);
*bounds = display::win::GetScreenWin()->ScreenToDIPRect(GetHWND(), *bounds);
}
gfx::Rect DesktopWindowTreeHostWin::GetWindowBoundsInScreen() const {
gfx::Rect pixel_bounds = message_handler_->GetWindowBoundsInScreen();
+ InsetBottomRight(&pixel_bounds, window_enlargement_);
return display::win::GetScreenWin()->ScreenToDIPRect(GetHWND(), pixel_bounds);
}
gfx::Rect DesktopWindowTreeHostWin::GetClientAreaBoundsInScreen() const {
gfx::Rect pixel_bounds = message_handler_->GetClientAreaBoundsInScreen();
+ InsetBottomRight(&pixel_bounds, window_enlargement_);
return display::win::GetScreenWin()->ScreenToDIPRect(GetHWND(), pixel_bounds);
}
gfx::Rect DesktopWindowTreeHostWin::GetRestoredBounds() const {
gfx::Rect pixel_bounds = message_handler_->GetRestoredBounds();
+ InsetBottomRight(&pixel_bounds, window_enlargement_);
return display::win::GetScreenWin()->ScreenToDIPRect(GetHWND(), pixel_bounds);
}
@@ -701,37 +733,44 @@ void DesktopWindowTreeHostWin::HideImpl() {
// other get/set methods work in DIP.
gfx::Rect DesktopWindowTreeHostWin::GetBoundsInPixels() const {
- const gfx::Rect bounds_px(message_handler_->GetClientAreaBounds());
+ gfx::Rect bounds(message_handler_->GetClientAreaBounds());
// If the window bounds were expanded we need to return the original bounds
// To achieve this we do the reverse of the expansion, i.e. add the
// window_expansion_top_left_delta_ to the origin and subtract the
// window_expansion_bottom_right_delta_ from the width and height.
- const gfx::Rect without_expansion_bounds_px(
- bounds_px.x() + window_expansion_top_left_delta_.x(),
- bounds_px.y() + window_expansion_top_left_delta_.y(),
- bounds_px.width() - window_expansion_bottom_right_delta_.x(),
- bounds_px.height() - window_expansion_bottom_right_delta_.y());
- return without_expansion_bounds_px;
+ gfx::Rect without_expansion(
+ bounds.x() + window_expansion_top_left_delta_.x(),
+ bounds.y() + window_expansion_top_left_delta_.y(),
+ bounds.width() - window_expansion_bottom_right_delta_.x() -
+ window_enlargement_.x(),
+ bounds.height() - window_expansion_bottom_right_delta_.y() -
+ window_enlargement_.y());
+ return without_expansion;
}
-void DesktopWindowTreeHostWin::SetBoundsInPixels(
- const gfx::Rect& bounds_in_pixels) {
+void DesktopWindowTreeHostWin::SetBoundsInPixels(const gfx::Rect& bounds) {
// If the window bounds have to be expanded we need to subtract the
// window_expansion_top_left_delta_ from the origin and add the
// window_expansion_bottom_right_delta_ to the width and height
- const gfx::Size old_content_size_px = GetBoundsInPixels().size();
-
- const gfx::Rect expanded_bounds_px(
- bounds_in_pixels.x() - window_expansion_top_left_delta_.x(),
- bounds_in_pixels.y() - window_expansion_top_left_delta_.y(),
- bounds_in_pixels.width() + window_expansion_bottom_right_delta_.x(),
- bounds_in_pixels.height() + window_expansion_bottom_right_delta_.y());
-
- // When `expanded_bounds_px` causes the window to be moved to a display with a
+ gfx::Size old_content_size = GetBoundsInPixels().size();
+
+ gfx::Rect expanded(
+ bounds.x() - window_expansion_top_left_delta_.x(),
+ bounds.y() - window_expansion_top_left_delta_.y(),
+ bounds.width() + window_expansion_bottom_right_delta_.x(),
+ bounds.height() + window_expansion_bottom_right_delta_.y());
+
+ gfx::Rect new_expanded(
+ expanded.origin(),
+ GetExpandedWindowSize(message_handler_->is_translucent(),
+ expanded.size()));
+ window_enlargement_ =
+ gfx::Vector2d(new_expanded.width() - expanded.width(),
+ new_expanded.height() - expanded.height());
+ // When |new_expanded| causes the window to be moved to a display with a
// different DSF, HWNDMessageHandler::OnDpiChanged() will be called and the
// window size will be scaled automatically.
- message_handler_->SetBounds(expanded_bounds_px,
- old_content_size_px != bounds_in_pixels.size());
+ message_handler_->SetBounds(new_expanded, old_content_size != bounds.size());
}
gfx::Rect
@@ -943,18 +982,26 @@ int DesktopWindowTreeHostWin::GetNonClientComponent(
void DesktopWindowTreeHostWin::GetWindowMask(const gfx::Size& size_px,
SkPath* path) {
- Widget* widget = GetWidget();
- if (!widget || !widget->non_client_view()) {
- return;
- }
+ // Request the window mask for hwnd of `size_px`. The hwnd size must be
+ // adjusted by `window_enlargement` to return to the client-expected window
+ // size (see crbug.com/41047830).
+ const gfx::Size adjusted_size_in_px =
+ size_px - gfx::Size(window_enlargement_.x(), window_enlargement_.y());
- widget->non_client_view()->GetWindowMask(
- display::win::GetScreenWin()->ScreenToDIPSize(GetHWND(), size_px), path);
- // Convert path in DIPs to pixels.
- if (!path->isEmpty()) {
- const float scale =
- display::win::GetScreenWin()->GetScaleFactorForHWND(GetHWND());
- *path = path->makeTransform(SkMatrix::Scale(scale, scale));
+ if (Widget* widget = GetWidget(); widget && widget->non_client_view()) {
+ widget->non_client_view()->GetWindowMask(
+ display::win::GetScreenWin()->ScreenToDIPSize(GetHWND(),
+ adjusted_size_in_px),
+ path);
+ // Convert path in DIPs to pixels.
+ if (!path->isEmpty()) {
+ const float scale =
+ display::win::GetScreenWin()->GetScaleFactorForHWND(GetHWND());
+ *path = path->makeTransform(SkMatrix::Scale(scale, scale));
+ }
+ } else if (!window_enlargement_.IsZero()) {
+ *path = SkPath::Rect(SkRect::MakeXYWH(0, 0, adjusted_size_in_px.width(),
+ adjusted_size_in_px.height()));
}
}
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
index 27322ef34edf3fa8bfbd20b1baddcaf3b7555618..a40bd9f25fa07a553c011cf19f155f8158f4ae5f 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
@@ -175,7 +175,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
void ShowImpl() override;
void HideImpl() override;
gfx::Rect GetBoundsInPixels() const override;
- void SetBoundsInPixels(const gfx::Rect& bounds_in_pixels) override;
+ void SetBoundsInPixels(const gfx::Rect& bounds) override;
gfx::Rect GetBoundsInAcceleratedWidgetPixelCoordinates() override;
gfx::Point GetLocationOnScreenInPixels() const override;
void SetCapture() override;
@@ -330,6 +330,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
gfx::Vector2d window_expansion_top_left_delta_;
gfx::Vector2d window_expansion_bottom_right_delta_;
+ // Windows are enlarged to be at least 64x64 pixels, so keep track of the
+ // extra added here.
+ // TODO(crbug.com/401996981): This is likely no longer necessary and should be
+ // removed.
+ gfx::Vector2d window_enlargement_;
+
// Whether the window close should be converted to a hide, and then actually
// closed on the completion of the hide animation. This is cached because
// the property is set on the contained window which has a shorter lifetime.

View File

@@ -9,7 +9,7 @@ is needed for OSR.
Originally landed in https://github.com/electron/libchromiumcontent/pull/226.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 1a45bab9c0e4e429bb338c757cdc49d64f337b88..462a05f830906518366182140c36ae73e96d6fc0 100644
index 8cd59445bae73ff0193e4512d7c36740cbad847f..ba7c3966f2c079bcec329f8f4a724c561969f33f 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4305,6 +4305,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,

View File

@@ -15,10 +15,10 @@ Note that we also need to manually update embedder's
`api::WebContents::IsFullscreenForTabOrPending` value.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index b898ebdd18bfefb4c6d8fa62e3e128a5154b049c..7c3a56dd43cfb10986a28b5d9bedb4ed75b89ca7 100644
index e4ff8f11bed9e53f3134068492ac94b4c9bb4df2..17c3b5c78c3ef08e0b901f3ace8bb07ee78e4cab 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -9259,6 +9259,17 @@ void RenderFrameHostImpl::EnterFullscreen(
@@ -9260,6 +9260,17 @@ void RenderFrameHostImpl::EnterFullscreen(
}
}
@@ -37,7 +37,7 @@ index b898ebdd18bfefb4c6d8fa62e3e128a5154b049c..7c3a56dd43cfb10986a28b5d9bedb4ed
if (had_fullscreen_token && !GetView()->HasFocus()) {
GetView()->Focus();
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 462a05f830906518366182140c36ae73e96d6fc0..8f98cd136d73d5ff795fd3c62a696cc7d2fd3c84 100644
index ba7c3966f2c079bcec329f8f4a724c561969f33f..e039e2c82ad75ca4b95763414f7aafb6d3a3dbf2 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4603,21 +4603,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent(

View File

@@ -26,7 +26,7 @@ index 1f6c015c361b3146db760643e3670a110634d75b..d4d9c10d3420a5ff998aeb593ea6a255
// An empty URL is returned if the URL is not overriden.
virtual GURL OverrideFlashEmbedWithHTML(const GURL& url);
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
index efe0b36d0ff8ff12fd39ea72c036dba42be8d0fe..8c98620a6eb83283516a3fbe186c94c0ba75aac3 100644
index 416d53d0cce178de992074b0c0371bca2e4ed900..cd0e4d7ea77ffe9fd09982ef2d9f5d57df8e2995 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -935,6 +935,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() {

View File

@@ -35,7 +35,7 @@ index d4d9c10d3420a5ff998aeb593ea6a25556d1215e..d64fef6bfc37264dcdc1bbea22eb5c4e
// from the worker thread.
virtual void WillDestroyWorkerContextOnWorkerThread(
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
index 8c98620a6eb83283516a3fbe186c94c0ba75aac3..cfa6fb6d66529081bb24a29bd9affa148bea3a1f 100644
index cd0e4d7ea77ffe9fd09982ef2d9f5d57df8e2995..3a96f5f084061c30344552a01b3d3a7260dad65e 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -947,6 +947,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated(

View File

@@ -10,10 +10,10 @@ to handle this without patching, but this is fairly clean for now and no longer
patching legacy devtools code.
diff --git a/front_end/entrypoints/main/MainImpl.ts b/front_end/entrypoints/main/MainImpl.ts
index 9432286fb380145a0ef2c92f14be6083812ccd81..5929b1c30277c480886a2951a330c83ad97da6dd 100644
index 5b82adb6600fd4ec3df1976cd6d23880c57f114c..d70f30fa82578365434d4338fb49f654858ac012 100644
--- a/front_end/entrypoints/main/MainImpl.ts
+++ b/front_end/entrypoints/main/MainImpl.ts
@@ -780,6 +780,8 @@ export class MainImpl {
@@ -779,6 +779,8 @@ export class MainImpl {
globalThis.Main = globalThis.Main || {};
// @ts-expect-error Exported for Tests.js
globalThis.Main.Main = MainImpl;

View File

@@ -15,7 +15,7 @@ Rather than disabling builtins PGO entirely, warn and skip mismatched
builtins so all other builtins still benefit from PGO.
diff --git a/BUILD.gn b/BUILD.gn
index b9fd222a47342e6b0617a2d4e9d88ad25be09ed8..751265ba83c04f0c545248a71b35e46034bfc90a 100644
index 382c7d3ed44eab5df1f33082d0d0ef85121bc47c..7b6a68379b81f317b3e2da868e9665239c60ffbe 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -2821,9 +2821,11 @@ template("run_mksnapshot") {

View File

@@ -164,9 +164,10 @@ async function main () {
const currentVersion = getChromiumVersionFromDEPS(depsContent);
// Calculate the SHA256 for each object file under `outDir`
const objectFiles = await fs.readdir(outDir, { encoding: 'utf8', recursive: true });
const files = await fs.readdir(outDir, { encoding: 'utf8', recursive: true });
const objectFiles = files.filter(file => file.endsWith('.o') || file.endsWith('.obj'));
const checksums = {};
for (const file of objectFiles.filter(f => f.endsWith('.o'))) {
for (const file of objectFiles) {
const content = await fs.readFile(resolve(outDir, file));
checksums[file] = createHash('sha256').update(content).digest('hex');
}

View File

@@ -8,7 +8,9 @@ from pathlib import Path
SRC_DIR = Path(__file__).resolve().parents[3]
sys.path.append(os.path.join(SRC_DIR, 'third_party/electron_node/tools'))
sys.path.append(str(Path(__file__).resolve().parents[1])) # electron/script/
from lib.util import get_out_dir
import install
class LoadPythonDictionaryError(Exception):
@@ -31,13 +33,6 @@ def LoadPythonDictionary(path):
)
return file_data
def get_out_dir():
out_dir = 'Testing'
override = os.environ.get('ELECTRON_OUT_DIR')
if override is not None:
out_dir = override
return os.path.join(SRC_DIR, 'out', out_dir)
if __name__ == '__main__':
node_root_dir = os.path.join(SRC_DIR, 'third_party/electron_node')
out = {}

View File

@@ -77,6 +77,7 @@
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/error_thrower.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/language_util.h"
#include "shell/common/node_includes.h"
#include "shell/common/options_switches.h"

View File

@@ -8,7 +8,6 @@
#include "base/path_service.h"
#include "shell/common/electron_paths.h"
#include "shell/common/node_includes.h"
#include "shell/common/process_util.h"
#include "shell/common/thread_restrictions.h"

View File

@@ -276,6 +276,7 @@ void Menu::OnMenuWillClose() {
}
void Menu::OnMenuWillShow() {
keep_alive_ = this;
Emit("menu-will-show");
}

View File

@@ -132,7 +132,7 @@ class Menu : public gin::Wrappable<Menu>,
int GetIndexOfCommandId(int command_id) const;
int GetItemCount() const;
gin_helper::SelfKeepAlive<Menu> keep_alive_{this};
gin_helper::SelfKeepAlive<Menu> keep_alive_{nullptr};
};
} // namespace electron::api

View File

@@ -19,7 +19,6 @@
#include "shell/browser/api/electron_api_web_frame_main.h"
#include "shell/browser/native_window.h"
#include "shell/common/keyboard_util.h"
#include "shell/common/node_includes.h"
#include "ui/base/cocoa/menu_utils.h"
#include "v8/include/cppgc/allocation.h"
#include "v8/include/v8-cppgc.h"

View File

@@ -12,6 +12,7 @@
#include "base/no_destructor.h"
#include "content/common/url_schemes.h"
#include "content/public/browser/child_process_security_policy.h"
#include "gin/converter.h"
#include "gin/object_template_builder.h"
#include "shell/browser/browser.h"
#include "shell/browser/javascript_environment.h"
@@ -19,13 +20,13 @@
#include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/gin_converters/net_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/handle.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/node_includes.h"
#include "shell/common/node_util.h"
#include "shell/common/options_switches.h"
#include "url/url_util.h"
#include "v8/include/cppgc/allocation.h"
namespace {
@@ -81,7 +82,8 @@ struct Converter<CustomScheme> {
namespace electron::api {
gin::DeprecatedWrapperInfo Protocol::kWrapperInfo = {gin::kEmbedderNativeGin};
const gin::WrapperInfo Protocol::kWrapperInfo = {{gin::kEmbedderNativeGin},
gin::kElectronProtocol};
std::vector<std::string>& GetStandardSchemes() {
static base::NoDestructor<std::vector<std::string>> g_standard_schemes;
@@ -296,23 +298,22 @@ void Protocol::HandleOptionalCallback(gin::Arguments* args, Error error) {
}
// static
gin_helper::Handle<Protocol> Protocol::Create(
v8::Isolate* isolate,
ProtocolRegistry* protocol_registry) {
return gin_helper::CreateHandle(isolate, new Protocol{protocol_registry});
Protocol* Protocol::Create(v8::Isolate* isolate,
ProtocolRegistry* protocol_registry) {
return cppgc::MakeGarbageCollected<Protocol>(
isolate->GetCppHeap()->GetAllocationHandle(), protocol_registry);
}
// static
gin_helper::Handle<Protocol> Protocol::New(gin_helper::ErrorThrower thrower) {
Protocol* Protocol::New(gin_helper::ErrorThrower thrower) {
thrower.ThrowError("Protocol cannot be created from JS");
return {};
}
// static
v8::Local<v8::ObjectTemplate> Protocol::FillObjectTemplate(
v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> tmpl) {
return gin::ObjectTemplateBuilder(isolate, GetClassName(), tmpl)
void Protocol::FillObjectTemplate(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> tmpl) {
gin::ObjectTemplateBuilder(isolate, GetClassName(), tmpl)
.SetMethod("registerStringProtocol",
&Protocol::RegisterProtocolFor<ProtocolType::kString>)
.SetMethod("registerBufferProtocol",
@@ -345,8 +346,12 @@ v8::Local<v8::ObjectTemplate> Protocol::FillObjectTemplate(
.Build();
}
const char* Protocol::GetTypeName() {
return GetClassName();
const gin::WrapperInfo* Protocol::wrapper_info() const {
return &kWrapperInfo;
}
const char* Protocol::GetHumanReadableName() const {
return "Electron / Protocol";
}
} // namespace electron::api
@@ -372,7 +377,8 @@ void Initialize(v8::Local<v8::Object> exports,
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
gin_helper::Dictionary dict{isolate, exports};
dict.Set("Protocol",
electron::api::Protocol::GetConstructor(isolate, context));
electron::api::Protocol::GetConstructor(
isolate, context, &electron::api::Protocol::kWrapperInfo));
dict.SetMethod("registerSchemesAsPrivileged", &RegisterSchemesAsPrivileged);
dict.SetMethod("getStandardSchemes", &electron::api::GetStandardSchemes);
}

View File

@@ -9,20 +9,14 @@
#include <vector>
#include "base/memory/raw_ptr.h"
#include "content/public/browser/content_browser_client.h"
#include "gin/wrappable.h"
#include "shell/browser/net/electron_url_loader_factory.h"
#include "shell/common/gin_helper/constructible.h"
#include "shell/common/gin_helper/wrappable.h"
namespace gin {
class Arguments;
} // namespace gin
namespace gin_helper {
template <typename T>
class Handle;
} // namespace gin_helper
namespace electron {
class ProtocolRegistry;
@@ -38,23 +32,25 @@ void RegisterSchemesAsPrivileged(gin_helper::ErrorThrower thrower,
v8::Local<v8::Value> val);
// Protocol implementation based on network services.
class Protocol final : public gin_helper::DeprecatedWrappable<Protocol>,
class Protocol final : public gin::Wrappable<Protocol>,
public gin_helper::Constructible<Protocol> {
public:
static gin_helper::Handle<Protocol> Create(
v8::Isolate* isolate,
ProtocolRegistry* protocol_registry);
static Protocol* Create(v8::Isolate* isolate,
ProtocolRegistry* protocol_registry);
// gin_helper::Constructible
static gin_helper::Handle<Protocol> New(gin_helper::ErrorThrower thrower);
static v8::Local<v8::ObjectTemplate> FillObjectTemplate(
v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> tmpl);
static Protocol* New(gin_helper::ErrorThrower thrower);
static void FillObjectTemplate(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> tmpl);
static const char* GetClassName() { return "Protocol"; }
// gin_helper::Wrappable
static gin::DeprecatedWrapperInfo kWrapperInfo;
const char* GetTypeName() override;
// gin::Wrappable
static const gin::WrapperInfo kWrapperInfo;
const gin::WrapperInfo* wrapper_info() const override;
const char* GetHumanReadableName() const override;
explicit Protocol(ProtocolRegistry* protocol_registry);
~Protocol() override;
private:
// Possible errors.
@@ -70,9 +66,6 @@ class Protocol final : public gin_helper::DeprecatedWrappable<Protocol>,
using CompletionCallback =
base::RepeatingCallback<void(v8::Local<v8::Value>)>;
explicit Protocol(ProtocolRegistry* protocol_registry);
~Protocol() override;
[[nodiscard]] static std::string_view ErrorCodeToString(Error error);
// JS APIs.

View File

@@ -17,6 +17,7 @@
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observation.h"
#include "base/strings/string_util.h"
#include "base/types/pass_key.h"
@@ -76,6 +77,7 @@
#include "shell/browser/media/media_device_id_salt.h"
#include "shell/browser/net/cert_verifier_client.h"
#include "shell/browser/net/resolve_host_function.h"
#include "shell/browser/net/resolve_proxy_helper.h"
#include "shell/browser/session_preferences.h"
#include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/gin_converters/content_converter.h"
@@ -550,8 +552,7 @@ gin::WrapperInfo Session::kWrapperInfo = {{gin::kEmbedderNativeGin},
Session::Session(v8::Isolate* isolate, ElectronBrowserContext* browser_context)
: isolate_(isolate),
network_emulation_token_(base::UnguessableToken::Create()),
browser_context_{
raw_ref<ElectronBrowserContext>::from_ptr(browser_context)} {
browser_context_{browser_context} {
gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
data->AddDisposeObserver(this);
// Observe DownloadManager to get download notifications.
@@ -559,9 +560,7 @@ Session::Session(v8::Isolate* isolate, ElectronBrowserContext* browser_context)
SessionPreferences::CreateForBrowserContext(browser_context);
protocol_.Reset(
isolate,
Protocol::Create(isolate, browser_context->protocol_registry()).ToV8());
protocol_ = Protocol::Create(isolate, browser_context->protocol_registry());
browser_context->SetUserData(
kElectronApiSessionKey,
@@ -584,16 +583,21 @@ Session::~Session() {
}
void Session::Dispose() {
if (keep_alive_) {
browser_context()->GetDownloadManager()->RemoveObserver(this);
if (!keep_alive_)
return;
ElectronBrowserContext* const browser_context = this->browser_context();
if (!browser_context)
return;
browser_context->GetDownloadManager()->RemoveObserver(this);
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
if (auto* service =
SpellcheckServiceFactory::GetForContext(browser_context())) {
service->SetHunspellObserver(nullptr);
}
#endif
if (auto* service =
SpellcheckServiceFactory::GetForContext(browser_context)) {
service->SetHunspellObserver(nullptr);
}
#endif
}
void Session::OnDownloadCreated(content::DownloadManager* manager,
@@ -1350,8 +1354,8 @@ v8::Local<v8::Value> Session::Extensions(v8::Isolate* isolate) {
return extensions_.Get(isolate);
}
v8::Local<v8::Value> Session::Protocol(v8::Isolate* isolate) {
return protocol_.Get(isolate);
api::Protocol* Session::Protocol() {
return protocol_.Get();
}
v8::Local<v8::Value> Session::ServiceWorkerContext(v8::Isolate* isolate) {
@@ -1875,6 +1879,7 @@ void Session::OnBeforeMicrotasksRunnerDispose(v8::Isolate* isolate) {
data->RemoveDisposeObserver(this);
Dispose();
weak_factory_.Invalidate();
browser_context_ = nullptr;
keep_alive_.Clear();
}

View File

@@ -10,8 +10,6 @@
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ref.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "content/public/browser/download_manager.h"
#include "electron/buildflags/buildflags.h"
@@ -21,7 +19,6 @@
#include "services/network/public/mojom/ssl_config.mojom-forward.h"
#include "shell/browser/api/ipc_dispatcher.h"
#include "shell/browser/event_emitter_mixin.h"
#include "shell/browser/net/resolve_proxy_helper.h"
#include "shell/common/gin_helper/constructible.h"
#include "shell/common/gin_helper/self_keep_alive.h"
@@ -61,6 +58,7 @@ struct PreloadScript;
namespace api {
class NetLog;
class Protocol;
class WebRequest;
class Session final : public gin::Wrappable<Session>,
@@ -103,8 +101,8 @@ class Session final : public gin::Wrappable<Session>,
Session(v8::Isolate* isolate, ElectronBrowserContext* browser_context);
~Session() override;
ElectronBrowserContext* browser_context() const {
return &browser_context_.get();
[[nodiscard]] ElectronBrowserContext* browser_context() const {
return browser_context_;
}
// gin::Wrappable
@@ -168,7 +166,7 @@ class Session final : public gin::Wrappable<Session>,
const gin_helper::Dictionary& options);
v8::Local<v8::Value> Cookies(v8::Isolate* isolate);
v8::Local<v8::Value> Extensions(v8::Isolate* isolate);
v8::Local<v8::Value> Protocol(v8::Isolate* isolate);
api::Protocol* Protocol();
v8::Local<v8::Value> ServiceWorkerContext(v8::Isolate* isolate);
WebRequest* WebRequest(v8::Isolate* isolate);
api::NetLog* NetLog(v8::Isolate* isolate);
@@ -215,7 +213,7 @@ class Session final : public gin::Wrappable<Session>,
// Cached gin_helper::Wrappable objects.
v8::TracedReference<v8::Value> cookies_;
v8::TracedReference<v8::Value> extensions_;
v8::TracedReference<v8::Value> protocol_;
cppgc::Member<api::Protocol> protocol_;
cppgc::Member<api::NetLog> net_log_;
v8::TracedReference<v8::Value> service_worker_context_;
cppgc::Member<api::WebRequest> web_request_;
@@ -225,7 +223,7 @@ class Session final : public gin::Wrappable<Session>,
// The client id to enable the network throttler.
base::UnguessableToken network_emulation_token_;
const raw_ref<ElectronBrowserContext> browser_context_;
raw_ptr<ElectronBrowserContext> browser_context_;
gin::WeakCellFactory<Session> weak_factory_{this};

View File

@@ -26,7 +26,6 @@
#include "shell/common/gin_converters/gurl_converter.h"
#include "shell/common/gin_converters/value_converter.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/node_includes.h"
#include "shell/common/process_util.h"
#include "skia/ext/skia_utils_mac.h"

View File

@@ -47,11 +47,13 @@
#include "content/browser/renderer_host/render_widget_host_impl.h" // nogncheck
#include "content/browser/renderer_host/render_widget_host_view_base.h" // nogncheck
#include "content/browser/web_contents/web_contents_impl.h" // nogncheck
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/context_menu_params.h"
#include "content/public/browser/desktop_media_id.h"
#include "content/public/browser/desktop_streams_registry.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/download_request_utils.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/file_select_listener.h"
@@ -90,9 +92,11 @@
#include "services/service_manager/public/cpp/interface_provider.h"
#include "shell/browser/api/electron_api_browser_window.h"
#include "shell/browser/api/electron_api_debugger.h"
#include "shell/browser/api/electron_api_session.h"
#include "shell/browser/api/electron_api_web_frame_main.h"
#include "shell/browser/api/frame_subscriber.h"
#include "shell/browser/api/message_port.h"
#include "shell/browser/api/save_page_handler.h"
#include "shell/browser/browser.h"
#include "shell/browser/child_web_contents_tracker.h"
#include "shell/browser/electron_autofill_driver_factory.h"
@@ -910,14 +914,15 @@ WebContents::WebContents(v8::Isolate* isolate,
session = Session::FromPartition(isolate, "");
}
session_ = session;
ElectronBrowserContext* const browser_context = session->browser_context();
DCHECK(browser_context != nullptr);
std::unique_ptr<content::WebContents> web_contents;
if (is_guest()) {
scoped_refptr<content::SiteInstance> site_instance =
content::SiteInstance::CreateForURL(session->browser_context(),
content::SiteInstance::CreateForURL(browser_context,
GURL("chrome-guest://fake-host"));
content::WebContents::CreateParams params(session->browser_context(),
site_instance);
content::WebContents::CreateParams params{browser_context, site_instance};
guest_delegate_ =
std::make_unique<WebViewGuestDelegate>(embedder_->web_contents(), this);
params.guest_delegate = guest_delegate_.get();
@@ -945,7 +950,7 @@ WebContents::WebContents(v8::Isolate* isolate,
SkColor bc = ParseCSSColor(background_color_str).value_or(SK_ColorWHITE);
bool transparent = bc == SK_ColorTRANSPARENT;
content::WebContents::CreateParams params(session->browser_context());
content::WebContents::CreateParams params{browser_context};
auto* view = new OffScreenWebContentsView(
transparent, offscreen_use_shared_texture_,
offscreen_shared_texture_pixel_format_, offscreen_device_scale_factor_,
@@ -956,22 +961,23 @@ WebContents::WebContents(v8::Isolate* isolate,
web_contents = content::WebContents::Create(params);
view->SetWebContents(web_contents.get());
} else {
content::WebContents::CreateParams params(session->browser_context());
content::WebContents::CreateParams params{browser_context};
params.initially_hidden = !initially_shown;
web_contents = content::WebContents::Create(params);
}
InitWithSessionAndOptions(isolate, std::move(web_contents),
session->browser_context(), options);
InitWithSessionAndOptions(isolate, std::move(web_contents), browser_context,
options);
}
void WebContents::InitZoomController(content::WebContents* web_contents,
const gin_helper::Dictionary& options) {
WebContentsZoomController::CreateForWebContents(web_contents);
zoom_controller_ = WebContentsZoomController::FromWebContents(web_contents);
WebContentsZoomController* const zoom_controller =
WebContentsZoomController::GetOrCreateForWebContents(web_contents);
double zoom_factor;
if (options.Get(options::kZoomFactor, &zoom_factor))
zoom_controller_->SetDefaultZoomFactor(zoom_factor);
zoom_controller->SetDefaultZoomFactor(zoom_factor);
// Nothing to do with ZoomController, but this function gets called in all
// init cases!
@@ -2884,8 +2890,8 @@ v8::Local<v8::Promise> WebContents::SavePage(
return handle;
}
auto* handler = new SavePageHandler(web_contents(), std::move(promise));
handler->Handle(full_file_path, save_type);
auto* handler = new SavePageHandler{std::move(promise)};
handler->Handle(full_file_path, save_type, web_contents());
return handle;
}
@@ -3147,16 +3153,18 @@ void OnGetDeviceNameToUse(base::WeakPtr<content::WebContents> web_contents,
.Set(printing::kSettingMediaSizeIsDefault, true);
};
const bool use_default_size =
print_settings.FindBool(kUseDefaultPrinterPageSize).value_or(false);
std::optional<gfx::Size> paper_size;
if (use_default_size)
paper_size = GetPrinterDefaultPaperSize(base::UTF16ToUTF8(info.second));
if (!print_settings.Find(printing::kSettingMediaSize)) {
const bool use_default_size =
print_settings.FindBool(kUseDefaultPrinterPageSize).value_or(false);
std::optional<gfx::Size> paper_size;
if (use_default_size)
paper_size = GetPrinterDefaultPaperSize(base::UTF16ToUTF8(info.second));
print_settings.Set(
printing::kSettingMediaSize,
paper_size ? make_media_size(paper_size->height(), paper_size->width())
: make_media_size(297000, 210000));
print_settings.Set(
printing::kSettingMediaSize,
paper_size ? make_media_size(paper_size->height(), paper_size->width())
: make_media_size(297000, 210000));
}
content::RenderFrameHost* rfh = GetRenderFrameHostToUse(web_contents.get());
if (!rfh)
@@ -3862,12 +3870,16 @@ gfx::Size WebContents::GetSizeForNewRenderView(content::WebContents* wc) {
return {};
}
WebContentsZoomController* WebContents::GetZoomController() const {
return WebContentsZoomController::FromWebContents(web_contents());
}
void WebContents::SetZoomLevel(double level) {
zoom_controller_->SetZoomLevel(level);
GetZoomController()->SetZoomLevel(level);
}
double WebContents::GetZoomLevel() const {
return zoom_controller_->GetZoomLevel();
return GetZoomController()->GetZoomLevel();
}
void WebContents::SetZoomFactor(gin_helper::ErrorThrower thrower,
@@ -3887,7 +3899,7 @@ double WebContents::GetZoomFactor() const {
}
void WebContents::SetTemporaryZoomLevel(double level) {
zoom_controller_->SetTemporaryZoomLevel(level);
GetZoomController()->SetTemporaryZoomLevel(level);
}
std::optional<PreloadScript> WebContents::GetPreloadScript() const {

View File

@@ -22,8 +22,6 @@
#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" // nogncheck
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "content/common/frame.mojom-forward.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/frame_tree_node_id.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/javascript_dialog_manager.h"
@@ -33,9 +31,6 @@
#include "content/public/common/stop_find_action.h"
#include "electron/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "shell/browser/api/electron_api_debugger.h"
#include "shell/browser/api/electron_api_session.h"
#include "shell/browser/api/save_page_handler.h"
#include "shell/browser/background_throttling_source.h"
#include "shell/browser/event_emitter_mixin.h"
#include "shell/browser/extended_web_contents_observer.h"
@@ -43,13 +38,10 @@
#include "shell/browser/preload_script.h"
#include "shell/browser/ui/inspectable_web_contents_delegate.h"
#include "shell/browser/ui/inspectable_web_contents_view_delegate.h"
#include "shell/common/api/api.mojom.h"
#include "shell/common/gin_helper/cleaned_up_at_exit.h"
#include "shell/common/gin_helper/constructible.h"
#include "shell/common/gin_helper/handle.h"
#include "shell/common/gin_helper/pinnable.h"
#include "shell/common/gin_helper/wrappable.h"
#include "shell/common/web_contents_utility.mojom.h"
#include "ui/base/models/image_model.h"
#include "v8/include/cppgc/persistent.h"
@@ -66,8 +58,14 @@ struct DeviceEmulationParams;
// enum class PermissionType;
} // namespace blink
namespace base {
class FilePath;
class Value;
} // namespace base
namespace content {
enum class KeyboardEventProcessingResult;
class DevToolsAgentHost;
class WebContents;
} // namespace content
@@ -79,6 +77,8 @@ namespace gin_helper {
class Dictionary;
class ErrorThrower;
template <typename T>
class Handle;
template <typename T>
class Promise;
} // namespace gin_helper
@@ -110,7 +110,9 @@ class OffScreenWebContentsView;
namespace api {
class BaseWindow;
class Debugger;
class FrameSubscriber;
class Session;
// Wrapper around the content::WebContents.
class WebContents final : public ExclusiveAccessContext,
@@ -378,7 +380,7 @@ class WebContents final : public ExclusiveAccessContext,
content::RenderFrameHost* Opener();
content::RenderFrameHost* FocusedFrame();
WebContentsZoomController* GetZoomController() { return zoom_controller_; }
[[nodiscard]] WebContentsZoomController* GetZoomController() const;
void AddObserver(ExtendedWebContentsObserver* obs) {
observers_.AddObserver(obs);
@@ -856,11 +858,6 @@ class WebContents final : public ExclusiveAccessContext,
// destroyed before dialog_manager_, otherwise a crash would happen.
std::unique_ptr<InspectableWebContents> inspectable_web_contents_;
// The zoom controller for this webContents.
// Note: owned by inspectable_web_contents_, so declare this *after*
// that field to ensure the dtor destroys them in the right order.
raw_ptr<WebContentsZoomController> zoom_controller_ = nullptr;
std::optional<GURL> pending_unload_url_ = std::nullopt;
// Maps url to file path, used by the file requests sent from devtools.

View File

@@ -12,9 +12,8 @@
namespace electron::api {
SavePageHandler::SavePageHandler(content::WebContents* web_contents,
gin_helper::Promise<void> promise)
: web_contents_(web_contents), promise_(std::move(promise)) {}
SavePageHandler::SavePageHandler(gin_helper::Promise<void> promise)
: promise_{std::move(promise)} {}
SavePageHandler::~SavePageHandler() = default;
@@ -26,9 +25,10 @@ void SavePageHandler::OnDownloadCreated(content::DownloadManager* manager,
}
bool SavePageHandler::Handle(const base::FilePath& full_path,
const content::SavePageType& save_type) {
const content::SavePageType& save_type,
content::WebContents* web_contents) {
auto* download_manager =
web_contents_->GetBrowserContext()->GetDownloadManager();
web_contents->GetBrowserContext()->GetDownloadManager();
download_manager->AddObserver(this);
// Chromium will create a 'foo_files' directory under the directory of saving
// page 'foo.html' for holding other resource files of 'foo.html'.
@@ -36,7 +36,7 @@ bool SavePageHandler::Handle(const base::FilePath& full_path,
full_path.RemoveExtension().BaseName().value() +
FILE_PATH_LITERAL("_files"));
bool result =
web_contents_->SavePage(full_path, saved_main_directory_path, save_type);
web_contents->SavePage(full_path, saved_main_directory_path, save_type);
download_manager->RemoveObserver(this);
// If initialization fails which means fail to create |DownloadItem|, we need
// to delete the |SavePageHandler| instance to avoid memory-leak.

View File

@@ -5,7 +5,6 @@
#ifndef ELECTRON_SHELL_BROWSER_API_SAVE_PAGE_HANDLER_H_
#define ELECTRON_SHELL_BROWSER_API_SAVE_PAGE_HANDLER_H_
#include "base/memory/raw_ptr.h"
#include "components/download/public/common/download_item.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/save_page_type.h"
@@ -26,12 +25,12 @@ namespace electron::api {
class SavePageHandler : private content::DownloadManager::Observer,
private download::DownloadItem::Observer {
public:
SavePageHandler(content::WebContents* web_contents,
gin_helper::Promise<void> promise);
explicit SavePageHandler(gin_helper::Promise<void> promise);
~SavePageHandler() override;
bool Handle(const base::FilePath& full_path,
const content::SavePageType& save_type);
const content::SavePageType& save_type,
content::WebContents* web_contents);
private:
void Destroy(download::DownloadItem* item);
@@ -43,7 +42,6 @@ class SavePageHandler : private content::DownloadManager::Observer,
// download::DownloadItem::Observer:
void OnDownloadUpdated(download::DownloadItem* item) override;
raw_ptr<content::WebContents> web_contents_; // weak
gin_helper::Promise<void> promise_;
};

View File

@@ -22,6 +22,7 @@
#include "shell/browser/window_list.h"
#include "shell/common/application_info.h"
#include "shell/common/gin_converters/login_item_settings_converter.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/thread_restrictions.h"
namespace electron {

View File

@@ -15,7 +15,6 @@
#include "base/task/cancelable_task_tracker.h"
#include "base/values.h"
#include "shell/browser/window_list_observer.h"
#include "shell/common/gin_helper/promise.h"
#if BUILDFLAG(IS_WIN)
#include <windows.h>
@@ -35,7 +34,17 @@ class Arguments;
namespace gin_helper {
class Arguments;
}
template <typename T>
class Promise;
} // namespace gin_helper
namespace v8 {
template <typename T>
class Local;
class Isolate;
class Promise;
class Value;
} // namespace v8
namespace electron {

View File

@@ -42,6 +42,7 @@
#include "shell/common/gin_converters/image_converter.h"
#include "shell/common/gin_converters/login_item_settings_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/skia_util.h"
#include "shell/common/thread_restrictions.h"
#include "skia/ext/font_utils.h"

View File

@@ -63,6 +63,7 @@
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_private_key.h"
#include "pdf/pdf_features.h"
#include "printing/buildflags/buildflags.h"
#include "services/device/public/cpp/geolocation/geolocation_system_permission_manager.h"
#include "services/device/public/cpp/geolocation/location_provider.h"
@@ -1591,6 +1592,46 @@ bool ElectronBrowserClient::ShouldEnableStrictSiteIsolation() {
return true;
}
bool ElectronBrowserClient::ShouldEnableSubframeZoom() {
#if BUILDFLAG(ENABLE_PDF_VIEWER)
return chrome_pdf::features::IsOopifPdfEnabled();
#else
return false;
#endif
}
#if BUILDFLAG(ENABLE_PDF_VIEWER)
std::optional<network::CrossOriginEmbedderPolicy>
ElectronBrowserClient::MaybeOverrideLocalURLCrossOriginEmbedderPolicy(
content::NavigationHandle* navigation_handle) {
if (!chrome_pdf::features::IsOopifPdfEnabled() ||
!navigation_handle->IsPdf()) {
return std::nullopt;
}
content::RenderFrameHost* pdf_extension = navigation_handle->GetParentFrame();
if (!pdf_extension) {
return std::nullopt;
}
content::RenderFrameHost* pdf_embedder = pdf_extension->GetParent();
CHECK(pdf_embedder);
return pdf_embedder->GetCrossOriginEmbedderPolicy();
}
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
bool ElectronBrowserClient::DoesSiteRequireDedicatedProcess(
content::BrowserContext* browser_context,
const GURL& effective_site_url) {
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
return GetEnabledExtensionFromEffectiveURL(browser_context,
effective_site_url) != nullptr;
#else
return content::ContentBrowserClient::DoesSiteRequireDedicatedProcess(
browser_context, effective_site_url);
#endif
}
void ElectronBrowserClient::BindHostReceiverForRenderer(
content::RenderProcessHost* render_process_host,
mojo::GenericPendingReceiver receiver) {

View File

@@ -30,6 +30,7 @@ class FilePath;
namespace content {
class ClientCertificateDelegate;
class NavigationHandle;
class PlatformNotificationService;
class NavigationThrottleRegistry;
class QuotaPermissionContext;
@@ -82,6 +83,14 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
// content::ContentBrowserClient:
std::string GetApplicationLocale() override;
bool ShouldEnableStrictSiteIsolation() override;
bool ShouldEnableSubframeZoom() override;
#if BUILDFLAG(ENABLE_PDF_VIEWER)
std::optional<network::CrossOriginEmbedderPolicy>
MaybeOverrideLocalURLCrossOriginEmbedderPolicy(
content::NavigationHandle* navigation_handle) override;
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context,
const GURL& effective_site_url) override;
void BindHostReceiverForRenderer(
content::RenderProcessHost* render_process_host,
mojo::GenericPendingReceiver receiver) override;

View File

@@ -626,6 +626,9 @@ void ElectronBrowserMainParts::PostMainMessageLoopRun() {
#if BUILDFLAG(IS_LINUX)
ui::OzonePlatform::GetInstance()->PostMainMessageLoopRun();
#endif
browser_.reset();
js_env_.reset();
}
#if !BUILDFLAG(IS_MAC)

View File

@@ -71,7 +71,7 @@ void StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent(
std::move(transferrable_loader), original_url);
#if BUILDFLAG(ENABLE_PDF_VIEWER)
if (base::FeatureList::IsEnabled(chrome_pdf::features::kPdfOopif) &&
if (chrome_pdf::features::IsOopifPdfEnabled() &&
extension_id == extension_misc::kPdfExtensionId) {
pdf::PdfViewerStreamManager::Create(web_contents);
pdf::PdfViewerStreamManager::FromWebContents(web_contents)

View File

@@ -398,9 +398,7 @@ ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
if (!contents)
return RespondNow(Error("No such tab"));
double zoom_level = contents->GetZoomController()->GetZoomLevel();
double zoom_factor = blink::ZoomLevelToZoomFactor(zoom_level);
const double zoom_factor = contents->GetZoomFactor();
return RespondNow(ArgumentList(tabs::GetZoom::Results::Create(zoom_factor)));
}
@@ -414,9 +412,9 @@ ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
if (!contents)
return RespondNow(Error("No such tab"));
auto* zoom_controller = contents->GetZoomController();
WebContentsZoomController::ZoomMode zoom_mode =
contents->GetZoomController()->zoom_mode();
const auto* zoom_controller = contents->GetZoomController();
const WebContentsZoomController::ZoomMode zoom_mode =
zoom_controller->zoom_mode();
tabs::ZoomSettings zoom_settings;
ZoomModeToZoomSettings(zoom_mode, &zoom_settings);
zoom_settings.default_zoom_factor =

View File

@@ -34,10 +34,6 @@
#include "printing/printing_features.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "ui/views/views_features.h"
#endif
namespace electron {
void InitializeFeatureList() {
@@ -71,13 +67,6 @@ void InitializeFeatureList() {
blink::features::kDropInputEventsWhilePaintHolding.name;
#if BUILDFLAG(IS_WIN)
// Refs https://issues.chromium.org/issues/401996981
// TODO(deepak1556): Remove this once test added in
// https://github.com/electron/electron/pull/12904
// can work without this feature.
enable_features += std::string(",") +
views::features::kEnableTransparentHwndEnlargement.name;
// See https://chromium-review.googlesource.com/c/chromium/src/+/7204292
// This feature causes the following sandbox failure on Windows:
// sandbox\policy\win\sandbox_win.cc:777 Sandbox cannot access executable

View File

@@ -116,10 +116,6 @@ class FileSystemAccessPermissionContext
content::GlobalRenderFrameHostId frame_id,
EntriesAllowedByEnterprisePolicyCallback callback) override;
enum class Access { kRead, kWrite, kReadWrite };
enum class RequestType { kNewPermission, kRestorePermissions };
void RevokeActiveGrants(const url::Origin& origin,
const base::FilePath& file_path = base::FilePath());

View File

@@ -17,12 +17,15 @@
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool/initialization_util.h"
#include "gin/array_buffer.h"
#include "gin/public/isolate_holder.h"
#include "gin/v8_initializer.h"
#include "shell/browser/microtasks_runner.h"
#include "shell/common/gin_helper/cleaned_up_at_exit.h"
#include "shell/common/node_includes.h"
#include "third_party/blink/public/common/switches.h"
#include "third_party/electron_node/src/node_wasm_web_api.h"
#include "v8/include/v8-isolate.h"
#include "v8/include/v8-locker.h"
namespace {
v8::Isolate* g_isolate;
@@ -137,6 +140,10 @@ v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop,
return isolate;
}
v8::Isolate* JavascriptEnvironment::isolate() const {
return isolate_holder_->isolate();
}
// static
v8::Isolate* JavascriptEnvironment::GetIsolate() {
CHECK(g_isolate);

View File

@@ -7,15 +7,22 @@
#include <memory>
#include "gin/public/isolate_holder.h"
#include "uv.h" // NOLINT(build/include_directory)
#include "v8/include/v8-locker.h"
namespace gin {
class IsolateHolder;
} // namespace gin
namespace node {
class Environment;
class MultiIsolatePlatform;
} // namespace node
namespace v8 {
class Isolate;
class Locker;
} // namespace v8
namespace electron {
class MicrotasksRunner;
@@ -34,14 +41,13 @@ class JavascriptEnvironment {
void DestroyMicrotasksRunner();
node::MultiIsolatePlatform* platform() const { return platform_.get(); }
[[nodiscard]] v8::Isolate* isolate() const {
return isolate_holder_->isolate();
}
size_t max_young_generation_size_in_bytes() const {
return max_young_generation_size_;
}
static v8::Isolate* GetIsolate();
[[nodiscard]] v8::Isolate* isolate() const;
[[nodiscard]] static v8::Isolate* GetIsolate();
private:
v8::Isolate* Initialize(uv_loop_t* event_loop, bool setup_wasm_streaming);

View File

@@ -7,6 +7,7 @@
#include <utility>
#include "base/task/sequenced_task_runner.h"
#include "content/public/browser/browser_thread.h"
#include "gin/arguments.h"
#include "gin/dictionary.h"
#include "shell/browser/api/electron_api_app.h"

View File

@@ -31,11 +31,6 @@
#include "shell/browser/ui/views/frameless_view.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "ui/display/win/screen_win.h"
#include "ui/views/views_features.h"
#endif
#if defined(USE_OZONE)
#include "ui/base/ui_base_features.h"
#include "ui/ozone/public/ozone_platform.h"
@@ -71,31 +66,6 @@ struct Converter<electron::NativeWindow::TitleBarStyle> {
namespace electron {
namespace {
#if BUILDFLAG(IS_WIN)
gfx::Size GetExpandedWindowSize(const NativeWindow* window,
bool transparent,
gfx::Size size) {
if (!base::FeatureList::IsEnabled(
views::features::kEnableTransparentHwndEnlargement) ||
!transparent) {
return size;
}
gfx::Size min_size = display::win::GetScreenWin()->ScreenToDIPSize(
window->GetAcceleratedWidget(), gfx::Size{64, 64});
// Some AMD drivers can't display windows that are less than 64x64 pixels,
// so expand them to be at least that size. http://crbug.com/286609
gfx::Size expanded(std::max(size.width(), min_size.width()),
std::max(size.height(), min_size.height()));
return expanded;
}
#endif
} // namespace
NativeWindow::NativeWindow(const int32_t base_window_id,
const gin_helper::Dictionary& options,
NativeWindow* parent)
@@ -398,15 +368,7 @@ gfx::Size NativeWindow::GetContentMinimumSize() const {
}
gfx::Size NativeWindow::GetContentMaximumSize() const {
const auto size_constraints = GetContentSizeConstraints();
gfx::Size maximum_size = size_constraints.GetMaximumSize();
#if BUILDFLAG(IS_WIN)
if (size_constraints.HasMaximumSize())
maximum_size = GetExpandedWindowSize(this, transparent(), maximum_size);
#endif
return maximum_size;
return GetContentSizeConstraints().GetMaximumSize();
}
void NativeWindow::SetSheetOffset(const double offsetX, const double offsetY) {

View File

@@ -440,13 +440,11 @@ NativeWindowViews::NativeWindowViews(const int32_t base_window_id,
if (window)
window->AddPreTargetHandler(this);
#if BUILDFLAG(IS_LINUX)
// We need to set bounds again after widget init for two reasons:
// 1. For CSD windows, user-specified bounds need to be inflated by frame
// insets, but the frame view isn't available at first.
// 2. The widget clamps bounds to fit the screen, but we want to allow
// windows larger than the display.
SetBounds(gfx::Rect(GetPosition(), size), false);
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
// The initial params.bounds was applied before the frame view existed, so
// non-client insets weren't accounted for and bounds need to be set again.
if (!GetRestoredFrameBorderInsets().IsEmpty())
SetBounds(gfx::Rect(GetPosition(), size), false);
#endif
}
@@ -906,7 +904,9 @@ gfx::Rect NativeWindowViews::GetNormalBounds() const {
if (IsMaximized() && transparent())
return restore_bounds_;
#endif
return WidgetToLogicalBounds(widget()->GetRestoredBounds());
gfx::Rect bounds = widget()->GetRestoredBounds();
bounds.Inset(GetRestoredFrameBorderInsets());
return bounds;
}
void NativeWindowViews::SetContentSizeConstraints(
@@ -1676,17 +1676,24 @@ NativeWindowHandle NativeWindowViews::GetNativeWindowHandle() const {
gfx::Rect NativeWindowViews::LogicalToWidgetBounds(
const gfx::Rect& bounds) const {
// Use widget() directly since NativeWindowViews::IsMaximized() can
// call GetBounds and end up in a loop.
if (widget()->IsMaximized() || widget()->IsFullscreen())
return bounds;
gfx::Rect widget_bounds(bounds);
const gfx::Insets frame_insets = GetRestoredFrameBorderInsets();
widget_bounds.Outset(
gfx::Outsets::TLBR(frame_insets.top(), frame_insets.left(),
frame_insets.bottom(), frame_insets.right()));
return widget_bounds;
}
gfx::Rect NativeWindowViews::WidgetToLogicalBounds(
const gfx::Rect& bounds) const {
if (widget()->IsMaximized() || widget()->IsFullscreen())
return bounds;
gfx::Rect logical_bounds(bounds);
logical_bounds.Inset(GetRestoredFrameBorderInsets());
return logical_bounds;

View File

@@ -194,6 +194,7 @@ class NativeWindowViews : public NativeWindow,
TaskbarHost& taskbar_host() { return taskbar_host_; }
void UpdateThickFrame();
void SetLayered();
bool has_thick_frame() const { return thick_frame_; }
#endif
SkColor overlay_button_color() const { return overlay_button_color_; }

View File

@@ -158,45 +158,43 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
windowSize.width() - contentSize.width() + extraSize.width();
double extraHeightPlusFrame = titleBarHeight + extraSize.height();
newSize.width =
roundf((frameSize.height - extraHeightPlusFrame) * aspectRatio +
extraWidthPlusFrame);
newSize.height =
roundf((newSize.width - extraWidthPlusFrame) / aspectRatio +
extraHeightPlusFrame);
auto widthForHeight = [&](double h) {
return (h - extraHeightPlusFrame) * aspectRatio + extraWidthPlusFrame;
};
auto heightForWidth = [&](double w) {
return (w - extraWidthPlusFrame) / aspectRatio + extraHeightPlusFrame;
};
newSize.width = roundf(widthForHeight(frameSize.height));
newSize.height = roundf(heightForWidth(newSize.width));
// Clamp to minimum width/height while ensuring aspect ratio remains.
NSSize minSize = [window minSize];
NSSize zeroSize =
shell_->has_frame() ? NSMakeSize(0, titleBarHeight) : NSZeroSize;
if (!NSEqualSizes(minSize, zeroSize)) {
double minWidthForAspectRatio =
(minSize.height - titleBarHeight) * aspectRatio;
bool atMinHeight =
minSize.height > zeroSize.height && newSize.height <= minSize.height;
newSize.width = atMinHeight ? minWidthForAspectRatio
newSize.width = atMinHeight ? widthForHeight(minSize.height)
: std::max(newSize.width, minSize.width);
double minHeightForAspectRatio = minSize.width / aspectRatio;
bool atMinWidth =
minSize.width > zeroSize.width && newSize.width <= minSize.width;
newSize.height = atMinWidth ? minHeightForAspectRatio
newSize.height = atMinWidth ? heightForWidth(minSize.width)
: std::max(newSize.height, minSize.height);
}
// Clamp to maximum width/height while ensuring aspect ratio remains.
NSSize maxSize = [window maxSize];
if (!NSEqualSizes(maxSize, NSMakeSize(FLT_MAX, FLT_MAX))) {
double maxWidthForAspectRatio = maxSize.height * aspectRatio;
bool atMaxHeight =
maxSize.height < FLT_MAX && newSize.height >= maxSize.height;
newSize.width = atMaxHeight ? maxWidthForAspectRatio
newSize.width = atMaxHeight ? widthForHeight(maxSize.height)
: std::min(newSize.width, maxSize.width);
double maxHeightForAspectRatio = maxSize.width / aspectRatio;
bool atMaxWidth =
maxSize.width < FLT_MAX && newSize.width >= maxSize.width;
newSize.height = atMaxWidth ? maxHeightForAspectRatio
newSize.height = atMaxWidth ? heightForWidth(maxSize.width)
: std::min(newSize.height, maxSize.height);
}
}

View File

@@ -402,7 +402,7 @@ void InspectableWebContents::SetDockState(const std::string& state) {
can_dock_ = false;
} else {
can_dock_ = true;
dock_state_ = IsValidDockState(state) ? state : "right";
dock_state_ = (state.empty() || IsValidDockState(state)) ? state : "right";
}
}

View File

@@ -106,29 +106,19 @@ int WinFrameView::NonClientHitTest(const gfx::Point& point) {
if (SUCCEEDED(DwmGetWindowAttribute(
views::HWNDForWidget(frame()), DWMWA_CAPTION_BUTTON_BOUNDS,
&button_bounds, sizeof(button_bounds)))) {
gfx::RectF button_bounds_in_dips = gfx::ConvertRectToDips(
gfx::Rect(button_bounds), display::win::GetDPIScale());
// TODO(crbug.com/1131681): GetMirroredRect() requires an integer rect,
// but the size in DIPs may not be an integer with a fractional device
// scale factor. If we want to keep using integers, the choice to use
// ToFlooredRectDeprecated() seems to be doing the wrong thing given the
// comment below about insetting 1 DIP instead of 1 physical pixel. We
// should probably use ToEnclosedRect() and then we could have inset 1
// physical pixel here.
gfx::Rect buttons =
GetMirroredRect(gfx::ToFlooredRectDeprecated(button_bounds_in_dips));
gfx::Rect button_bounds_px(button_bounds);
// There is a small one-pixel strip right above the caption buttons in
// which the resize border "peeks" through.
constexpr int kCaptionButtonTopInset = 1;
// The sizing region at the window edge above the caption buttons is
// 1 px regardless of scale factor. If we inset by 1 before converting
// to DIPs, the precision loss might eliminate this region entirely. The
// best we can do is to inset after conversion. This guarantees we'll
// show the resize cursor when resizing is possible. The cost of which
// is also maybe showing it over the portion of the DIP that isn't the
// outermost pixel.
buttons.Inset(gfx::Insets::TLBR(0, kCaptionButtonTopInset, 0, 0));
// which the resize border "peeks" through. Inset in physical pixels
// before converting to DIPs so the resize strip remains exposed at
// fractional scale factors.
button_bounds_px.Inset(gfx::Insets::TLBR(1, 0, 0, 0));
const gfx::RectF button_bounds_in_dips =
gfx::ConvertRectToDips(button_bounds_px, display::win::GetDPIScale());
// GetMirroredRect() requires an integer rect. Use ToEnclosedRect() so
// the top inset is preserved (rounded up) at fractional scale factors.
gfx::Rect buttons =
GetMirroredRect(gfx::ToEnclosedRect(button_bounds_in_dips));
if (buttons.Contains(point))
return HTNOWHERE;
}
@@ -238,14 +228,15 @@ void WinFrameView::LayoutCaptionButtons() {
int custom_height = window()->titlebar_overlay_height();
int height = TitlebarHeight(custom_height);
// TODO(mlaurencin): This -1 creates a 1 pixel margin between the right
// edge of the button container and the edge of the window, allowing for this
// edge portion to return the correct hit test and be manually resized
// properly. Alternatives can be explored, but the differences in view
// structures between Electron and Chromium may result in this as the best
// option.
int variable_width =
IsMaximized() ? preferred_size.width() : preferred_size.width() - 1;
// Insets place the resize hit targets outside of the frame, so the caption
// buttons can go right at the edge. Without insets, the resize hit
// targets are inside the frame, and a 1px margin is needed to click and drag
// next to the button container. The margin can be removed if support is added
// for insets on non-thick frames.
int variable_width = !RestoredFrameBorderInsets().IsEmpty()
? preferred_size.width()
: (IsMaximized() ? preferred_size.width()
: preferred_size.width() - 1);
caption_button_container_->SetBounds(width() - preferred_size.width(),
WindowTopY(), variable_width, height);
@@ -277,22 +268,33 @@ bool WinFrameView::GetShouldPaintAsActive() {
gfx::Size WinFrameView::GetMinimumSize() const {
if (!window_)
return gfx::Size();
// Chromium expects minimum size to be in content dimensions on Windows
// because it adds the frame border automatically in OnGetMinMaxInfo.
// Chromium expects minimum size to be in content dimensions on Windows.
// If WidgetSizeIsClientSize() is true, it will account for frame borders and
// insets automatically.
return window_->GetContentMinimumSize();
}
gfx::Size WinFrameView::GetMaximumSize() const {
if (!window_)
return gfx::Size();
// Chromium expects minimum size to be in content dimensions on Windows
// because it adds the frame border automatically in OnGetMinMaxInfo.
// See comment in GetMinimumSize().
gfx::Size size = window_->GetContentMaximumSize();
// Electron public APIs returns (0, 0) when maximum size is not set, but it
// would break internal window APIs like HWNDMessageHandler::SetAspectRatio.
return size.IsEmpty() ? gfx::Size(INT_MAX, INT_MAX) : size;
}
gfx::Insets WinFrameView::RestoredFrameBorderInsets() const {
if (window_->has_frame() || !window_->has_thick_frame() ||
!window_->IsResizable())
return {};
const int thickness =
display::win::GetScreenWin()->GetSystemMetricsInDIP(SM_CXSIZEFRAME) +
display::win::GetScreenWin()->GetSystemMetricsInDIP(SM_CXPADDEDBORDER);
return gfx::Insets::TLBR(0, thickness, thickness, thickness);
}
BEGIN_METADATA(WinFrameView)
END_METADATA

View File

@@ -36,6 +36,9 @@ class WinFrameView : public FramelessView {
gfx::Size GetMinimumSize() const override;
gfx::Size GetMaximumSize() const override;
// views::FramelessView:
gfx::Insets RestoredFrameBorderInsets() const override;
WinCaptionButtonContainer* caption_button_container() {
return caption_button_container_;
}

View File

@@ -89,24 +89,45 @@ bool ElectronDesktopWindowTreeHostWin::GetDwmFrameInsetsInPixels(
return false;
}
bool ElectronDesktopWindowTreeHostWin::WidgetSizeIsClientSize() const {
// For both framed and frameless windows with resize insets (thick frames),
// this should return true so that the aura layer is sized to the client area
// rather than the full HWND, and so insets are accounted for when handling
// size/aspect ratio constraints.
if (native_window_view_->has_thick_frame())
return true;
return views::DesktopWindowTreeHostWin::WidgetSizeIsClientSize();
}
bool ElectronDesktopWindowTreeHostWin::GetClientAreaInsets(
gfx::Insets* insets,
int frame_thickness) const {
// Windows by default extends the maximized window slightly larger than
// current workspace, for frameless window since the standard frame has been
// removed, the client area would then be drew outside current workspace.
//
// Indenting the client area can fix this behavior.
if (IsMaximized() && !native_window_view_->has_frame()) {
// The insets would be eventually passed to WM_NCCALCSIZE, which takes
// the metrics under the DPI of _main_ monitor instead of current monitor.
//
// Please make sure you tested maximized frameless window under multiple
// monitors with different DPIs before changing this code.
if (!native_window_view_->has_frame()) {
const int thickness = ::GetSystemMetrics(SM_CXSIZEFRAME) +
::GetSystemMetrics(SM_CXPADDEDBORDER);
*insets = gfx::Insets::TLBR(thickness, thickness, thickness, thickness);
return true;
if (IsMaximized()) {
// Windows by default extends the maximized window slightly larger than
// current workspace, for frameless window since the standard frame has
// been removed, the client area would then be drew outside current
// workspace.
//
// Indenting the client area can fix this behavior.
//
// The insets would be eventually passed to WM_NCCALCSIZE, which takes
// the metrics under the DPI of _main_ monitor instead of current monitor.
//
// Please make sure you tested maximized frameless window under multiple
// monitors with different DPIs before changing this code.
*insets = gfx::Insets::TLBR(thickness, thickness, thickness, thickness);
return true;
} else if (native_window_view_->has_thick_frame() &&
native_window_view_->IsResizable()) {
// Grow the insets to support resize targets past the frame edge like in
// windows with standard frames.
*insets = gfx::Insets::TLBR(0, thickness, thickness, thickness);
return true;
}
}
return false;
}

View File

@@ -40,6 +40,7 @@ class ElectronDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin,
LRESULT* result) override;
bool ShouldPaintAsActive() const override;
bool GetDwmFrameInsetsInPixels(gfx::Insets* insets) const override;
bool WidgetSizeIsClientSize() const override;
bool GetClientAreaInsets(gfx::Insets* insets,
int frame_thickness) const override;
bool HandleMouseEventForCaption(UINT message) const override;

View File

@@ -705,8 +705,10 @@ gin_helper::Handle<SimpleURLLoaderWrapper> SimpleURLLoaderWrapper::Create(
else // default session
session = Session::FromPartition(args->isolate(), "");
}
if (session)
if (session) {
browser_context = session->browser_context();
DCHECK(browser_context != nullptr);
}
}
auto ret = gin_helper::CreateHandle(

View File

@@ -6,6 +6,7 @@
#include "base/i18n/rtl.h"
#include "base/no_destructor.h"
#include "base/strings/string_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/common/chrome_version.h"
#include "components/embedder_support/user_agent_utils.h"

View File

@@ -5,11 +5,11 @@
#include "shell/common/crash_keys.h"
#include <cstdint>
#include <deque>
#include <map>
#include <string>
#include "base/command_line.h"
#include "base/containers/circular_deque.h"
#include "base/environment.h"
#include "base/no_destructor.h"
#include "base/strings/strcat.h"
@@ -28,17 +28,22 @@ namespace electron::crash_keys {
namespace {
// Do NOT replace with base::circular_deque. CrashKeyString wraps a
// crashpad::Annotation that holds self-referential pointers and registers
// in a process-global linked list; relocating elements (as circular_deque
// does on growth) corrupts that list and hangs the crashpad handler.
// std::deque never relocates existing elements. See #50795.
auto& GetExtraCrashKeys() {
constexpr size_t kMaxCrashKeyValueSize = 20320;
static_assert(kMaxCrashKeyValueSize < crashpad::Annotation::kValueMaxSize,
"max crash key value length above what crashpad supports");
using CrashKeyString = crash_reporter::CrashKeyString<kMaxCrashKeyValueSize>;
static base::NoDestructor<base::circular_deque<CrashKeyString>> extra_keys;
static base::NoDestructor<std::deque<CrashKeyString>> extra_keys;
return *extra_keys;
}
auto& GetExtraCrashKeyNames() {
static base::NoDestructor<base::circular_deque<std::string>> crash_key_names;
static base::NoDestructor<std::deque<std::string>> crash_key_names;
return *crash_key_names;
}

View File

@@ -4,7 +4,7 @@
#include "shell/common/gin_helper/callback.h"
#include "gin/arguments.h"
#include "gin/dictionary.h"
#include "gin/persistent.h"
#include "v8/include/cppgc/allocation.h"
#include "v8/include/v8-cppgc.h"
@@ -51,28 +51,42 @@ struct TranslatorHolder {
delete data.GetParameter();
}
static gin::DeprecatedWrapperInfo kWrapperInfo;
v8::Global<v8::External> handle;
Translator translator;
bool one_time = false;
bool called = false;
};
void CallTranslator(const v8::FunctionCallbackInfo<v8::Value>& info) {
gin::Arguments args(info);
auto* holder =
static_cast<TranslatorHolder*>(info.Data().As<v8::External>()->Value(
v8::kExternalPointerTypeTagDefault));
gin::DeprecatedWrapperInfo TranslatorHolder::kWrapperInfo = {
gin::kEmbedderNativeGin};
if (holder->one_time && holder->called) {
args.ThrowTypeError("One-time callback was called more than once");
return;
void CallTranslator(v8::Local<v8::External> external,
v8::Local<v8::Object> state,
gin::Arguments* args) {
// Whether the callback should only be called once.
v8::Isolate* isolate = args->isolate();
auto context = isolate->GetCurrentContext();
bool one_time =
state->Has(context, gin::StringToSymbol(isolate, "oneTime")).ToChecked();
// Check if the callback has already been called.
if (one_time) {
auto called_symbol = gin::StringToSymbol(isolate, "called");
if (state->Has(context, called_symbol).ToChecked()) {
args->ThrowTypeError("One-time callback was called more than once");
return;
} else {
state->Set(context, called_symbol, v8::True(isolate)).ToChecked();
}
}
holder->called = true;
holder->translator.Run(&args);
auto* holder = static_cast<TranslatorHolder*>(
external->Value(v8::kExternalPointerTypeTagDefault));
holder->translator.Run(args);
if (holder->one_time)
holder->translator.Reset();
// Free immediately for one-time callback.
if (one_time)
delete holder;
}
} // namespace
@@ -99,11 +113,41 @@ v8::Local<v8::Function> SafeV8Function::NewHandle(v8::Isolate* isolate) const {
v8::Local<v8::Value> CreateFunctionFromTranslator(v8::Isolate* isolate,
const Translator& translator,
bool one_time) {
gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
auto* wrapper_info = &TranslatorHolder::kWrapperInfo;
v8::Local<v8::FunctionTemplate> constructor =
data->DeprecatedGetFunctionTemplate(wrapper_info);
// The FunctionTemplate is cached.
if (constructor.IsEmpty()) {
constructor =
CreateFunctionTemplate(isolate, base::BindRepeating(&CallTranslator));
data->DeprecatedSetFunctionTemplate(wrapper_info, constructor);
}
auto* holder = new TranslatorHolder(isolate);
holder->translator = translator;
holder->one_time = one_time;
auto state = gin::Dictionary::CreateEmpty(isolate);
if (one_time)
state.Set("oneTime", true);
auto context = isolate->GetCurrentContext();
return v8::Function::New(context, CallTranslator, holder->handle.Get(isolate))
return BindFunctionWith(
isolate, context, constructor->GetFunction(context).ToLocalChecked(),
holder->handle.Get(isolate), gin::ConvertToV8(isolate, state));
}
// func.bind(func, arg1).
// NB(zcbenz): Using C++11 version crashes VS.
v8::Local<v8::Value> BindFunctionWith(v8::Isolate* isolate,
v8::Local<v8::Context> context,
v8::Local<v8::Function> func,
v8::Local<v8::Value> arg1,
v8::Local<v8::Value> arg2) {
v8::MaybeLocal<v8::Value> bind =
func->Get(context, gin::StringToV8(isolate, "bind"));
CHECK(!bind.IsEmpty());
v8::Local<v8::Function> bind_func = bind.ToLocalChecked().As<v8::Function>();
v8::Local<v8::Value> converted[] = {func, arg1, arg2};
return bind_func->Call(context, func, std::size(converted), converted)
.ToLocalChecked();
}

View File

@@ -13,6 +13,7 @@
#include "shell/common/gin_helper/function_template.h"
#include "shell/common/gin_helper/locker.h"
#include "v8/include/cppgc/persistent.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-function.h"
#include "v8/include/v8-microtask-queue.h"
// Implements safe conversions between JS functions and base::RepeatingCallback.
@@ -118,6 +119,11 @@ using Translator = base::RepeatingCallback<void(gin::Arguments* args)>;
v8::Local<v8::Value> CreateFunctionFromTranslator(v8::Isolate* isolate,
const Translator& translator,
bool one_time);
v8::Local<v8::Value> BindFunctionWith(v8::Isolate* isolate,
v8::Local<v8::Context> context,
v8::Local<v8::Function> func,
v8::Local<v8::Value> arg1,
v8::Local<v8::Value> arg2);
// Calls callback with Arguments.
template <typename Sig>

Some files were not shown because too many files have changed in this diff Show More