Compare commits

..

161 Commits

Author SHA1 Message Date
Sudowoodo Release Bot
c0588770ea Bump v19.0.5 2022-06-20 10:16:20 -07:00
trop[bot]
2a9a71af29 fix: overzealous media key listening on Windows (#34646)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-20 13:13:45 -04:00
Shelley Vohr
7073603150 refactor: remove deprecated drag-and-drop code (#34652) 2022-06-20 12:02:06 -04:00
trop[bot]
82bb684765 fix: performance problem in crashReporter.start() on macOS (#34638)
* fix: performance problem in crashReporter.start() on macOS

This change reduces the duration of crashReporter.start() on Intel macOS
from 622 milliseconds to 257 milliseconds!

Backports https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3641386

  posix: Replace DoubleForkAndExec() with ForkAndSpawn()

  The DoubleForkAndExec() function was taking over 622 milliseconds to run
  on macOS 11 (BigSur) on Intel i5-1038NG7. I did some debugging by adding
  some custom traces and found that the fork() syscall is the bottleneck
  here, i.e., the first fork() takes around 359 milliseconds and the
  nested fork() takes around 263 milliseconds. Replacing the nested fork()
  and exec() with posix_spawn() reduces the time consumption to 257
  milliseconds!

  See https://github.com/libuv/libuv/pull/3064 to know why fork() is so
  slow on macOS and why posix_spawn() is a better replacement.

  Another point to note is that even base::LaunchProcess() from Chromium
  calls posix_spawnp() on macOS -
  8f8d82dea0:base/process/launch_mac.cc;l=295-296

  Change-Id: I25c6ee9629a1ae5d0c32b361b56a1ce0b4b0fd26
  Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3641386
  Reviewed-by: Mark Mentovai <mark@chromium.org>
  Commit-Queue: Mark Mentovai <mark@chromium.org>

Fixes: https://github.com/electron/electron/issues/34321
Signed-off-by: Darshan Sen <raisinten@gmail.com>

* Update .patches

Co-authored-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-06-20 16:43:11 +09:00
trop[bot]
36169d15da chore: fix BrowserView painting when origin updated (#34642)
chore: fix View painting when origin updated

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-20 16:41:45 +09:00
Raymond Zhao
5174419819 refactor: use stubs for libgdk-pixbuf dependency (#34602) 2022-06-20 13:30:43 +09:00
Keeley Hammond
64fc21fec9 build: Revert "Bump v19.0.6" & "Bump v19.0.5" (#34600)
Revert "Bump v19.0.6" & "Bump v19.0.5"
2022-06-17 15:50:10 -04:00
trop[bot]
74df9ad42f fix: draggable regions updating on bounds change (#34611)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-17 15:36:26 +02:00
Sudowoodo Release Bot
12f4be7fba Bump v19.0.6 2022-06-15 18:26:49 -07:00
Sudowoodo Release Bot
9b8cd7cc53 Bump v19.0.5 2022-06-15 17:52:45 -07:00
trop[bot]
59a3898ba8 chore: increase timeout for electron-build step (#34584)
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
2022-06-16 09:44:16 +09:00
Sudowoodo Release Bot
6cb2b75fbb Revert "Bump v19.0.5"
This reverts commit 0764bb1560.
2022-06-15 13:21:08 -07:00
Sudowoodo Release Bot
0764bb1560 Bump v19.0.5 2022-06-15 08:31:03 -07:00
trop[bot]
5dd4b6aaed test: add missing page-title-updated event spec for webview (#34543)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-06-14 16:16:28 -04:00
trop[bot]
4e97448f70 fix: crash when setWindowOpenHandler callback throws (#34546)
* fix: crash when setWindowOpenHandler throws

* refactor: throw as process uncaughtException event

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-14 15:23:14 -04:00
electron-roller[bot]
92528220db chore: bump chromium to 102.0.5005.115 (19-x-y) (#34498)
* chore: bump chromium in DEPS to 102.0.5005.115

* Trigger Build

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-06-14 11:04:22 -04:00
trop[bot]
108d1f9a29 refactor: move duplicate code to RendererClientBase::ShouldLoadPreload helper (#34519)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-06-13 15:20:37 +02:00
trop[bot]
4dedbadcb5 fix: all files selection logic on linux (#34517)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-13 11:16:57 +02:00
trop[bot]
ea2bea7382 fix: don't require glibc 2.29+ on linux arm64 builds (#34502)
* build: use sid sysroot for linux arm64

* try this

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-06-10 20:55:23 -04:00
trop[bot]
3cf901e45b fix: update normal bounds prior to minimizing (#34484)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-09 15:39:08 -04:00
trop[bot]
e87d17b728 build: update clang-format script (#34480)
* build: fix clang-format script

* chore: remove python2 cases

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-09 11:13:54 +09:00
Sudowoodo Release Bot
def1ec7f99 Bump v19.0.4 2022-06-08 08:30:58 -07:00
trop[bot]
85f6bffee0 chore: fix nan spec runner on macOS (#34463)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-06-08 10:30:12 +02:00
trop[bot]
94632e9703 test: fix for flaky renderer crash test (#34455)
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2022-06-07 09:46:11 +02:00
trop[bot]
7acd622750 test: skip flaky test on 32-bit Windows (#34449)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-06-06 14:40:03 -04:00
trop[bot]
c050839202 docs: fix did-frame-navigate example in webFrameMain docs (#34444)
docs: fix did-frame-navigate example in webFrameMain docs

Co-authored-by: Will Anderson <will@itsananderson.com>
2022-06-06 11:21:08 -04:00
David Sanders
c0555c1668 fix: on macOS show BrowserWindow on maximize if not currently shown (#34365)
fix: on macOS show BrowserWindow on maximize if not currently shown (#32949)
2022-06-06 11:12:20 -04:00
Sudowoodo Release Bot
07344857d6 Bump v19.0.3 2022-06-02 19:35:06 -07:00
trop[bot]
f57ca1174c fix: render process crash handling (#34431)
* fix: crash when renderer process is reused

Could occur when a renderer crashes and the same-origin URL is loaded again
which leads to reusing the renderer process.

* test: renderer process crash recovery

* fix: handle case which leads to render frame DCHECK

* fix: lint

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2022-06-02 19:33:11 -07:00
trop[bot]
a189d3dde6 ci: cache python install to better deal with download errors. (#34408)
* ci: cache python install to better deal with download errors.

* chore: use our CDN to download python2

* build: DRY up the python install steps

* fixup backport for 19-x-y

* trigger ci

* fixup the fixup

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Samuel Attard <sattard@salesforce.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-06-02 17:15:19 -04:00
trop[bot]
a49f0f7318 fix: crash in WebFrameMain mojo connection when RenderFrameHost is nullptr (#34416)
* fix: crash when RenderFrameHost is nullptr

* chore: lint fix

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2022-06-02 15:16:41 +09:00
Sudowoodo Release Bot
ba32b32ec3 Bump v19.0.2 2022-06-01 08:31:50 -07:00
trop[bot]
3ad5a45173 fix: zombie windows when fullscreening and closing (#34391)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-05-31 15:36:50 +02:00
Shelley Vohr
b9d16ab3eb fix: esc not working on Windows during fullscreen (#34359)
* fix: esc not working on Windows during fullscreen

* chore: fix lint
2022-05-30 16:28:51 +02:00
Shelley Vohr
7e2606df02 fix: missing resource printing DCHECK (#34369)
* fix: missing resource printing DCHECK

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-05-30 12:19:27 +02:00
trop[bot]
8692a5b921 test: add setTitlebarOverlay spec (#34252)
spec: add setTitlebarOverlay spec

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-05-26 11:05:03 -04:00
electron-roller[bot]
abf438bddc chore: bump chromium to 102.0.5005.63 (19-x-y) (#34349)
chore: bump chromium in DEPS to 102.0.5005.63

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2022-05-25 16:45:55 -04:00
Sudowoodo Release Bot
56515ad544 Bump v19.0.1 2022-05-25 08:31:42 -07:00
trop[bot]
a9ff8f1359 build: do not checkout chromium for ts docs check (#34344)
Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-05-24 21:36:57 -07:00
trop[bot]
f84cafe4fd chore: add a TRACE call for crash_reporter::Start() (#34326)
chore: add a TRACE call for crash_reporter::Start()

Initializing the crashReporter takes around 620 milliseconds on Intel
macOS. I have sent a CL to crashpad to partially fix the performance
issue in
https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3641386.
It would be beneficial to log the performance impact of this function in
the traces in case this slows down in the future.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

Co-authored-by: Darshan Sen <raisinten@gmail.com>
2022-05-24 07:41:08 -07:00
Sudowoodo Release Bot
42266d2bf0 Bump v19.0.0 2022-05-23 10:25:38 -07:00
John Kleinschmidt
44b5c72f67 fix: crash on navigator.serial.getPorts() (#34323)
(cherry picked from commit 7f9431764f)
2022-05-23 10:21:05 -07:00
trop[bot]
96e1c7ec92 fix: building node modules with Visual Studio 2017 (#34316)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-05-23 10:11:38 -07:00
trop[bot]
0206a9b7ed fix: service worker registration with custom protocols (#34315)
* fix: service worker registration with custom protocols

Refs https://github.com/electron/electron/issues/32664

* chore: update patches

Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-05-23 08:29:54 -07:00
trop[bot]
10ad6f8295 docs: remove X-Content-Security-Policy header in quick-start.md (#34319)
reference: Note: It is known that having both Content-Security-Policy
 and X-Content-Security-Policy or X-Webkit-CSP causes unexpected
 behaviours on certain versions of browsers. Please avoid using deprecated
 X-* headers. https://content-security-policy.com/
also:
1ad18486ed

Co-authored-by: Letu Ren <fantasquex@gmail.com>
2022-05-23 11:19:05 -04:00
Keeley Hammond
23c18be06f revert: add first-instance-ack event to the app.requestSingleInstanceLock() flow (#34312)
fix: revert "feat: add first-instance-ack event to the `app.requestSingleInstanceLock()` flow (#34295)

* Revert "fix: requestSingleInstanceLock API ConnectNamedPipe sometimes hangs program (#33778)"

This reverts commit ffb8749243.

* fix: revert "feat: add first-instance-ack event to the `app.requestSingleInstanceLock()` flow"

* chore: update patch
2022-05-23 14:51:05 +02:00
Keeley Hammond
cc4565bb41 ci: save Windows artifacts at end of job in case they fail (#34313) 2022-05-23 11:25:53 +02:00
Shelley Vohr
9d1c53a7e4 fix: DCHECK on webContents.print() (#34299)
* fix: DCHECK on webContents.print()

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-05-23 10:11:06 +02:00
Shelley Vohr
c7cd23c069 fix: WCO crash on bad titlebarStyle (#34302) 2022-05-22 19:42:27 -07:00
Shelley Vohr
f9dc5b52d0 fix: crash when loading extension with missing manifest (#34303) 2022-05-22 19:32:22 -07:00
electron-roller[bot]
aca4b543d5 chore: bump chromium to 102.0.5005.61 (19-x-y) (#34288)
chore: bump chromium in DEPS to 102.0.5005.61

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2022-05-20 10:32:30 +02:00
trop[bot]
c2a11cef63 fix: crash when creating interface for speculative frame (#34294)
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2022-05-19 15:13:48 -07:00
trop[bot]
85a7498bd6 fix: delayed bounds when moving/resizing and preventing default (#34285)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-05-19 18:25:11 +02:00
Sudowoodo Release Bot
b0c255b72c Bump v19.0.0-beta.8 2022-05-19 06:31:02 -07:00
trop[bot]
2d91a03b36 docs: Update release dates for E20 (#34275)
Co-authored-by: Sofia Nguy <sofianguy@gmail.com>
2022-05-18 13:21:51 -07:00
trop[bot]
424fd85b1a docs: add missing explanation for [angle|dawn]_enable_vulkan_validation_layers = false (#34259)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-05-17 11:43:55 -04:00
electron-roller[bot]
ad48ccbb9b chore: bump chromium to 102.0.5005.49 (19-x-y) (#34198)
* chore: bump chromium in DEPS to 102.0.5005.49

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-05-16 12:01:03 -04:00
Sudowoodo Release Bot
2ea9be3ade Bump v19.0.0-beta.7 2022-05-16 06:31:51 -07:00
trop[bot]
52a9566f28 fix: fetching PDF element from WebLocalFrame (#34215)
fix: fetching PDF element from WebLocalFrame

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-05-13 11:24:01 -05:00
trop[bot]
4ecaae9555 fix: call loadUrl when opening new windows from links (#34189)
* fix: call loadUrl when opening new windows from links

* spec: add regression test

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-05-12 21:49:25 -04:00
trop[bot]
21b8200170 fix: tray icon not highlighting on empty menu (#34208)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-05-12 16:20:00 -07:00
Sudowoodo Release Bot
2b6cd3458f Bump v19.0.0-beta.6 2022-05-12 06:31:14 -07:00
trop[bot]
00e747ac24 test: fixup done being called multiple times (#34188)
* test: fixup done being called multiple times

* chore: run ci

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-05-12 11:04:42 +02:00
Keeley Hammond
082b06cf4e build: re-enable 32-bit Windows symbol generation (#34179) 2022-05-11 13:16:49 -07:00
trop[bot]
b07e17a3bb fix: fix a crash in safeStorage on Linux (#34147)
On Linux, `isEncryptionAvailable()` was crashing instead of returning a
boolean before the 'ready' event was emitted by the app. The reason of
the crash is that [`CreateKeyStorage()`](https://source.chromium.org/chromium/chromium/src/+/main:components/os_crypt/os_crypt_linux.cc;l=74;drc=35be6215ec8f09e50176f36753c68f26c63d1885;bpv=1;bpt=0)
expects the config to be set but the function responsible for setting the
config, [`SetConfig()`](https://source.chromium.org/chromium/chromium/src/+/main:components/os_crypt/os_crypt_linux.cc;l=237;drc=35be6215ec8f09e50176f36753c68f26c63d1885;bpv=1;bpt=0),
is called only after the app is ready inside [`PostCreateMainMessageLoop()`](https://github.com/electron/electron/blob/main/shell/browser/electron_browser_main_parts.cc#L499).
So this changes `IsEncryptionAvailable()` to return `false` when the app
is not ready on Linux and uses that instead of the raw API in other
places like `EncryptString()` and `DecryptString()`.

Fixes: https://github.com/electron/electron/issues/32206
Signed-off-by: Darshan Sen <raisinten@gmail.com>

Co-authored-by: Darshan Sen <raisinten@gmail.com>
2022-05-11 10:20:30 -04:00
trop[bot]
49ee456797 test: run node specs with py3 (#34165)
Co-authored-by: Jeremy Rose <japthorp@slack-corp.com>
2022-05-11 10:02:00 +02:00
trop[bot]
85063322e9 fix: building node modules with Visual Studio 2017 (#34164)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-05-11 10:01:48 +02:00
trop[bot]
633d2961eb fix: create singleton pipename from user & executable (#34160)
* fix: create singleton pipename from user & executable

* fix: use process id & main thread id for pipe name

* fix: write rand to file using WIN method

* fix: remove file rand, add user_name to pipe

* chore: style fixes, shorten program_name & user_name

* fix: remove user_name

* chore: trigger CircleCI

Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2022-05-10 16:26:05 -07:00
trop[bot]
4f0592101b chore: stub gtk_native_dialog_get_type (#34151)
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2022-05-09 20:59:41 -07:00
trop[bot]
8797485564 build: change upload-to-s3 vars to upload-to-storage (#34143)
* build: change upload-to-s3 vars to upload-to-az

* build: change upload-to-az to upload-to-storage

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2022-05-09 12:57:14 -07:00
Sudowoodo Release Bot
c3746dc439 Bump v19.0.0-beta.5 2022-05-09 06:31:11 -07:00
Keeley Hammond
d5dadd0d4a fix: load FirstPartySets without Electron initialization (#34138) 2022-05-09 10:44:04 +02:00
trop[bot]
da62dd2721 build: stop uploading assets to S3 (#34116)
* build: remove S3 uploads

* build: remove ending slash upload-index-json (#34125)

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2022-05-07 03:25:57 -07:00
trop[bot]
c945629872 build: use azure function to hash assets instead of lambda (#34123)
Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-05-07 03:25:29 -07:00
trop[bot]
536a17f5ed docs: add missing ackCallback parameter (#34128)
Co-authored-by: Raymond Zhao <raymondzhao@microsoft.com>
2022-05-06 23:34:54 -07:00
trop[bot]
433765cd73 refactor: prevent RemoveFromLoginItems() from mounting volumes from login items (#34108)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-05-05 22:29:41 -04:00
electron-roller[bot]
870110fd52 chore: bump chromium to 102.0.5005.40 (19-x-y) (#34089)
* chore: bump chromium in DEPS to 102.0.5005.40

* chore: update patches

* Trigger Build

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-05-05 22:06:43 -04:00
trop[bot]
8ce14231fb test: unflake some more tests (#34102)
* test: unflake webview fullscreen test

* test: unflake net throttle test

* Update spec-main/api-net-spec.ts

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: Samuel Attard <sattard@salesforce.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2022-05-05 20:19:46 -04:00
trop[bot]
de09ba2c51 fix: offscreen rendering crash on input select (#34093)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-05-05 11:49:28 -07:00
trop[bot]
290b548b15 test: unflake some focus tests (#34079)
* spec: unflake some focus tests

* test: disable flaky webFrame visibiilty spec

Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-05-05 09:40:11 -04:00
Sudowoodo Release Bot
3df4dcc591 Bump v19.0.0-beta.4 2022-05-05 06:31:30 -07:00
trop[bot]
c33d65c1d9 fix: requestSingleInstanceLock API sometimes hangs (#34071)
Co-authored-by: Raymond Zhao <raymondzhao@microsoft.com>
2022-05-04 16:41:34 -07:00
trop[bot]
ddb0b1b4c4 test: fix nativeModulesEnabled in spec/webview-spec.js (#34066)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-05-04 16:28:33 +02:00
trop[bot]
14d3e369ae test: scope internal test fixtures under @electron-ci (#34024)
* test: scope internal test fixtures under `@electron`

* Missed references

* Move packages from @electron to @electron-ci scope

* Fix tests

* fix require

Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-05-04 00:05:49 -07:00
trop[bot]
9f66268fab fix: make BrowserWindow#isFocused() return false when blur() is called on macOS (#34031)
The isFocused() method on macOS works by checking if the selected
BrowserWindow is a key window. Unfortunately, this didn't work well
with blur() because it wasn't calling any macOS APIs that would change
the key status of the window. Hence, this changes the implementation of
blur() to call orderOut first, which removes the key
status of the window. Then when the orderBack function is called, it
moves the window to the back of its level in the screen list, without
changing the key window.

Fixes: https://github.com/electron/electron/issues/33732
Signed-off-by: Darshan Sen <raisinten@gmail.com>

Co-authored-by: Darshan Sen <raisinten@gmail.com>
2022-05-04 00:05:17 -07:00
Samuel Attard
577b2ba44b refactor: use posix_spawn instead of NSTask so we can disclaim the spawned ShipIt executable (#33468) (#34058) 2022-05-03 16:14:12 -07:00
trop[bot]
7e35b91f4d build: use smaller resource_class because goma (#34032)
Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-05-03 11:28:59 -04:00
electron-roller[bot]
04f2b2e2e3 chore: bump chromium to 102.0.5005.27 (19-x-y) (#33932)
* chore: bump chromium in DEPS to 102.0.5005.12

* chore: bump chromium in DEPS to 102.0.5005.22

* 3587410: [Printing] Remove JobEventDetails

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587410
(cherry picked from commit 75d75bc087a29640cc58ecb7122dbc8ea10ce785)

* chore: update patches

* 3579297: Convert UpdatePrintSettings() to use non-deprecated base::Value APIs.

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

* 3577218: WebUI: Delete webui_resources.grd and related GN targets.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3577218
(cherry picked from commit b12e658fee8f8d8832145f0ab141549c3466f567)

* chore: bump chromium in DEPS to 102.0.5005.27

* 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244
(cherry picked from commit 9ccc4d6249)

* 3584006: Remove IsRenderViewLive from content public

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3584006
(cherry picked from commit 5c5bc4ca6d)

* 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244
(cherry picked from commit dbdff6fe7e)

* 3581708: Restore original display when moving from tab-fullscreen to browser-fullscreen.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3581708
(cherry picked from commit c02749954c)

* 64908: Stop building legacy SwiftShader GL in Chromium

https://swiftshader-review.googlesource.com/c/SwiftShader/+/64908

* 3573245: Added Themed versions of RoundedRectBackground and RoundedRectBorder.

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

* fixup for lint

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
2022-05-03 11:27:43 -04:00
Sudowoodo Release Bot
7f88b507d9 Bump v19.0.0-beta.3 2022-05-02 10:47:10 -07:00
trop[bot]
855f36903e fix: move FirstPartySets into the browser process (#34011)
Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3448551

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2022-05-02 10:46:22 -07:00
trop[bot]
9ef6a77a72 fix: support mixed-case extensions in Linux file dialogs (#34015)
Co-authored-by: Kevin Ushey <kevinushey@gmail.com>
2022-05-02 10:33:48 -07:00
trop[bot]
853693bc87 build: allow script/spec-runner.js with empty list of runners (#34002)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-05-02 09:45:40 -04:00
trop[bot]
f6a2c296d8 docs: fix return type of setJumpList() in electron.d.ts (#33963)
Before:
```ts
setJumpList(categories: (JumpListCategory[]) | (null)): void;
```

After:
```ts
setJumpList(categories: (JumpListCategory[]) | (null)): ('ok' | 'error' | 'invalidSeparatorError' | 'fileTypeRegistrationError' | 'customCategoryAccessDeniedError');
```

Fixes: https://github.com/electron/electron/issues/33909
Signed-off-by: Darshan Sen <raisinten@gmail.com>

Co-authored-by: Darshan Sen <raisinten@gmail.com>
2022-05-02 17:29:51 +09:00
trop[bot]
eb3abf4c98 refactor: better solution for resizable frameless DCHECK (#33974)
* refactor: better solution for resizable frameless DCHECK

* fix: also implement TargetForRectin WinFrameView

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-05-02 17:29:39 +09:00
trop[bot]
6f853ef616 spec: allow connections to port 2049 (#33993)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-05-02 10:27:34 +09:00
Sudowoodo Release Bot
002ea74027 Bump v19.0.0-beta.2 2022-04-29 06:38:53 -07:00
Keeley Hammond
f30714e85d fix: fix FirstPartySetsHandler initialization (#33972) 2022-04-28 22:18:34 -07:00
Keeley Hammond
1f1a0b5461 build: improve CI speeds and reduce CI costs (#33904) (#33951)
* build: improve CI speeds and reduce CI costs (#33904)

* rely on src cache instead of workspace
* run some tasks in the background and "thread join" later
* merge some ninja build commands to reduce overhead

* remove third_party/electron_node:overlapped-checker

Target is not present in older branches

Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-04-28 12:54:08 -07:00
trop[bot]
dce5680271 feat: allow null when subscribing notification (#33770)
* feat: allow null when subscribing notification

* docs: document null event

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-04-28 12:20:08 -04:00
trop[bot]
fdd268b31e fix: disable MallocNanoZone on mac (#33966)
Co-authored-by: Jacek Oleksy <jacek.oleksy@gmail.com>
2022-04-28 12:00:45 -04:00
Sudowoodo Release Bot
005eeafe95 Bump v19.0.0-beta.1 2022-04-28 08:53:29 -07:00
Sudowoodo Release Bot
6944863de8 Revert "Bump v19.0.0-alpha.6"
This reverts commit e69ca30e61.
2022-04-28 06:50:36 -07:00
Sudowoodo Release Bot
e69ca30e61 Bump v19.0.0-alpha.6 2022-04-28 06:31:27 -07:00
trop[bot]
40f6d434a9 build: use dev-cdn instead of sysroots s3 bucket (#33937)
Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-04-28 03:14:14 -07:00
trop[bot]
39ab6525b3 build: ensure sync-done file exists during git cache save (#33956)
Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-04-27 17:21:34 -07:00
trop[bot]
693b9ec77e feat: implement chrome.tabs.reload to fix PDF Viewer (#33712)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-04-27 12:17:43 -07:00
trop[bot]
b4b2262c1b build: fix macos release GN gen (#33920)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-04-27 11:36:29 -07:00
trop[bot]
04510c6870 build: actually verify az urls too (#33950)
Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-04-27 11:06:56 -07:00
Samuel Attard
f2b27f8bb1 build: improve circleci config (#33940)
* build: improve circleci config (#33881)

* build: fix conditional restore of git cache

* build: split lint out of setup.yml

* ci: update release script to handle new CircleCI configs (#33914)

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-04-27 11:02:31 -07:00
trop[bot]
8bd1bbc5ae chore: use semantic-commit-action (#33867)
* chore: use semantic-commit-action

* Update semantic.yml

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2022-04-26 19:05:56 +09:00
trop[bot]
3ed7b54608 build: upload to AZ as well as S3 (#33597)
* build: upload to AZ aswell as S3

* fix: provide env to azput

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2022-04-25 23:29:01 -07:00
electron-roller[bot]
b0ab8e49a9 chore: bump chromium to 102.0.4999.0. (19-x-y) (#33848)
* chore: bump chromium in DEPS to 102.0.5005.3

* chore: bump chromium in DEPS to 102.0.5005.2

* chore: bump chromium in DEPS to 102.0.5005.12

* chore: bump chromium to 102.0.4999.0 (main) (#33731)

* chore: bump chromium in DEPS to 102.0.4999.0

* 3576640: Set OOM handler during V8 initialization

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

* 3574964: Remove deprecated base::Value usage in print_settings_conversion code.

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

* 3570062: Replicate Active state to render process for all RenderViews.

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

* chore: fixup patch indices

* 3380402: Remove legacy SwiftShader

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

* 3570254: [Local Fonts] Rename permission name from FONT_ACCESS to LOCAL_FONTS.

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

* 3572172: Rename or remove several parameters involved in creation of MimeHandler streams

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

* fix: add missing base/bits include

* chore: fix lint

* chore: remove ia32 Linux support

* chore: patch out swift-format cipd dep on macOS

* build: apply patch better

* build: reset all caches

* build: update zip manifests to remove swiftshared libraries

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3380402

* Revert "build: update zip manifests to remove swiftshared libraries"

This reverts commit 6aeec01ef1a79425a7b7d8c1cfb131a26b91c494.

* Revert "3380402: Remove legacy SwiftShader"

This reverts commit 4c7eebbbf2d0a459cc192959e17ae20f970c2da2.

* build: remove unused swiftshader egl libraries

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Attard <sattard@salesforce.com>
(cherry picked from commit f3e0517b6e)

* chore: update patch after cherry-pick from main roller pr

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-04-25 09:49:02 -04:00
Sudowoodo Release Bot
cb6acecfbe Bump v19.0.0-alpha.5 2022-04-25 06:31:14 -07:00
trop[bot]
97c99731df fix: apply senderFrame details to ipcMain port event (#33783)
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2022-04-25 09:43:59 +09:00
Sudowoodo Release Bot
6adcd6d4ec Bump v19.0.0-alpha.4 2022-04-21 12:01:45 -07:00
Sudowoodo Release Bot
a9e20abc6b Revert "Bump v19.0.0-alpha.4"
This reverts commit 7c0ed9e837.
2022-04-21 10:25:18 -07:00
Sudowoodo Release Bot
7c0ed9e837 Bump v19.0.0-alpha.4 2022-04-21 06:30:39 -07:00
trop[bot]
9e35bddc32 build: fix intermittent compilation failures on macOS (#33879)
* build: fix intermittent compilation failures on macOS

* chore: remove //base dependency from main executable

* chore: fix lint

Co-authored-by: Milan Burda <milan.burda@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2022-04-21 03:14:31 -07:00
trop[bot]
6c0d8e3989 chore: backport 7c9b3938d from libuv (#33872)
Backports https://github.com/libuv/libuv/pull/3597

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2022-04-21 17:21:20 +09:00
Samuel Attard
94d13db50d fix: include accessibility blink strings (#33841) 2022-04-19 20:01:16 -07:00
electron-roller[bot]
cfd9825bc2 chore: bump chromium to 102.0.4989.0 (19-x-y) (#33556)
* chore: bump chromium in DEPS to 102.0.4975.0

* chore: bump chromium in DEPS to 102.0.4977.0

* chore: bump chromium in DEPS to 102.0.4979.0

* chore: bump chromium in DEPS to 102.0.4981.0

* chore: bump chromium in DEPS to 102.0.4983.0

* chore: bump chromium in DEPS to 102.0.4985.0

* chore: bump chromium in DEPS to 102.0.4987.0

* chore: bump chromium in DEPS to 102.0.4989.0

* chore: bump chromium in DEPS to 102.0.4991.0

* chore: bump chromium in DEPS to 102.0.4993.0

* chore: bump chromium in DEPS to 102.0.4995.0

* chore: bump chromium in DEPS to 102.0.4997.0

* chore: bump chromium in DEPS to 102.0.4999.0

* chore: bump chromium in DEPS to 102.0.5001.0

* chore: bump chromium in DEPS to 102.0.5003.0

* chore: bump chromium in DEPS to 102.0.5005.0

* chore: bump chromium in DEPS to 102.0.5005.3

* chore: bump chromium to 102.0.4989.0 (main) (#33557)

* chore: bump chromium in DEPS to 102.0.4975.0

* chore: bump chromium in DEPS to 102.0.4977.0

* chore: update patches

* Remove parameter of OnGpuProcessCrashed()

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

* hid: Add exclusionFilters option to requestDevice

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

* chore: bump chromium in DEPS to 102.0.4979.0

* chore: bump chromium in DEPS to 102.0.4981.0

* chore: update patches

* Deny notification/push permission for documents in non-standard StoragePartitions

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

* Improve FrameTreeNode tracking in URLLoaderNetworkContext

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

* fixup! Remove parameter of OnGpuProcessCrashed()

* chore: fix lint

* Reland "Use gfx::Insets[F]::TLBR() and gfx::Insets[F]::VH() in the rest of Chrome"

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

* chore: bump chromium in DEPS to 102.0.4983.0

* Ensure EyeDropperView does not access a destroyed window

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

* ci: don't delete dawn .git directory

83901: Adds a generated file with the dawn git hash encoded at build time. | https://dawn-review.googlesource.com/c/dawn/+/83901

* ci: update Windows toolchain

3550827: New toolchain for Windows 10 20348 SDK | https://chromium-review.googlesource.com/c/chromium/src/+/3550827

* chore: bump chromium in DEPS to 102.0.4985.0

* chore: update patches

* chore: bump chromium in DEPS to 102.0.4987.0

* chore: update patches

* 3563432: codehealth: remove uses of DictionaryValue in cbui/webui

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

* chore: update patches after rebase

* Use gfx::Insets[F]::TLBR() and gfx::Insets[F]::VH() in the rest of Chrome

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

* 3565724: Preserve "proper method names" as-is in error.stack.

https://chromium-review.googlesource.com/c/v8/v8/+/3565724

* chore: bump chromium in DEPS to 102.0.4989.0

* chore: update patches

* fixup ci: don't delete dawn .git directory for Windows

* 3560843: Remove multi-parameter version of gfx::Rect[F]::Inset()

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

* 3572711: Remove unused IDS_PDF_TOOLTIP_ROTATE_CW resource.

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

* 3572926: Reland "[Sysroot] Switch to Debian Bullseye stable"

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

* build: fixup sysroots with electron specific dependencies

* fixup Remove multi-parameter version of gfx::Rect[F]::Inset()

* fixup 3565724: Preserve "proper method names" as-is in error.stack.

* fixup Remove multi-parameter version of gfx::Rect[F]::Inset()

* test: add spec for navigator.hid.requestDevice({ exclusionFilters: [...] }

* fixup 3565724: Preserve "proper method names" as-is in error.stack.

* ci: use python3 to get the windows toolchain profile

3525960: Explicitly run everything with python3 | https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3525960

* chore: add diagnostic logging

* fix: try calling process.crash()

* chore: remove logging

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
(cherry picked from commit 59dd17f2cf)

* chore: update patches after rebase

* chore: bump chromium in DEPS to 102.0.5005.3

* Revert "chore: bump chromium in DEPS to 102.0.5005.3"

This reverts commit 958cfb2aff.

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-04-19 15:15:36 -04:00
Sudowoodo Release Bot
5ede2aefe7 Bump v19.0.0-alpha.3 2022-04-18 11:12:41 -07:00
trop[bot]
a4308f6ca5 fix: potential crash caused by dlopen different gtk libraries (#33813)
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2022-04-18 09:43:59 -04:00
Sudowoodo Release Bot
ddd550a95d Bump v19.0.0-alpha.2 2022-04-14 22:29:35 -07:00
trop[bot]
fd3a49ef81 fix: event propagation after exiting fullscreen on Windows (#33788)
* fix: event propagation after exiting fullscreen on Windows

* ci: empty commit to trigger circleci

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
2022-04-14 22:28:17 -07:00
trop[bot]
1f99f5b902 ci: build python2 from source (#33798)
* ci: add python2 to publish jobs

* chore: install python2 via circle

Co-authored-by: VerteDinde <vertedinde@electronjs.org>
2022-04-14 22:24:16 -07:00
Sudowoodo Release Bot
542b10da26 Revert "Bump v19.0.0-alpha.2"
This reverts commit ceb1cd9002.
2022-04-14 07:04:03 -07:00
Sudowoodo Release Bot
ceb1cd9002 Bump v19.0.0-alpha.2 2022-04-14 06:30:56 -07:00
trop[bot]
9e61ef9d2f ci: manually install python@2 (#33786)
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
2022-04-14 06:14:16 -07:00
trop[bot]
20353c29e5 chore: add missing GN dep (#33767)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-04-14 09:54:25 +02:00
trop[bot]
2217dffbfa chore: interpret bytes to string (#33775)
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
2022-04-14 09:51:14 +02:00
trop[bot]
1dc407a349 fix: #ARGB to #RGBA conversion (#33755)
* fix: argb to rgba conversion

* chore: remove logging import

* refactor: color_str -> converted_color_str

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-04-13 19:05:05 +02:00
Keeley Hammond
f76354b8a5 build: filter symbols/json correctly per arch (#33751) 2022-04-13 11:31:20 +02:00
trop[bot]
6b9509d2c9 docs: note safeStorage.isEncryptionAvailable() needs ready event (#33739)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-04-13 10:45:51 +02:00
Sudowoodo Release Bot
dfb6608b98 Revert "Bump v19.0.0-alpha.2"
This reverts commit 7ce1018581.
2022-04-12 19:29:39 -07:00
Sudowoodo Release Bot
7ce1018581 Bump v19.0.0-alpha.2 2022-04-12 16:58:52 -07:00
trop[bot]
f70bc4de62 build: migrate urllib to python3 (#33744)
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
2022-04-12 16:58:01 -07:00
trop[bot]
3232650535 build: explicitly run scripts with python3 (#33728)
* build: explicitly run scripts with python3

* chore: update patches

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-04-12 13:03:04 -07:00
trop[bot]
d37b2671e4 docs: recommend setting e.returnValue (#33646)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-04-12 12:09:41 +02:00
trop[bot]
60b91ddcfb build: use python3 to lint (#33718) 2022-04-12 11:02:36 +02:00
Sudowoodo Release Bot
d1037e45b3 Revert "Bump v19.0.0-alpha.2"
This reverts commit fb8d290f0e.
2022-04-11 18:41:53 -07:00
trop[bot]
11e14081cf fix: report more detailed errors in shell.openExternal() on Windows (#33660)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-04-11 12:00:07 -07:00
Sudowoodo Release Bot
fb8d290f0e Bump v19.0.0-alpha.2 2022-04-11 11:42:07 -07:00
Keeley Hammond
f149686bb9 build: temporarily disable 32-bit Windows symbol generation (#33653) (#33689)
* build: temporarily disable 32-bit Windows symbol generation (#33653)

* build: temporarily disable 32-bit Windows symbol generation

* fix: modify upload.py

* chore: fix comment

Co-authored-by: VerteDinde <vertedinde@electronjs.org>

* chore: upload correct assets

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-04-11 11:40:57 -07:00
Sudowoodo Release Bot
43b982e0fa Revert "Bump v19.0.0-alpha.2"
This reverts commit c98e4d85ef.
2022-04-11 11:03:43 -07:00
Sudowoodo Release Bot
c98e4d85ef Bump v19.0.0-alpha.2 2022-04-11 06:30:36 -07:00
trop[bot]
96903856a8 fix: build when pdf component is disabled (#33666)
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2022-04-08 07:50:17 -04:00
Sudowoodo Release Bot
9018c76e37 Revert "Bump v19.0.0-alpha.2"
This reverts commit ac3dd718bf.
2022-04-07 07:44:17 -07:00
Sudowoodo Release Bot
ac3dd718bf Bump v19.0.0-alpha.2 2022-04-07 06:32:07 -07:00
trop[bot]
ae9be599e7 fix: don't unmaximize on macOS if user set max bounds (#33549)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-04-06 17:17:28 -04:00
trop[bot]
d0fde072d4 fix: remove usage of private pid API on MAS (#33623)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-04-06 13:40:05 +02:00
trop[bot]
5b9647d3ff docs: mark platform-specific functionality for BrowserWindow (#33596)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2022-04-05 12:42:07 -04:00
trop[bot]
05f58d824c Revert "fix: some frameless windows showing a frame on Windows (#32692)" (#33609)
This reverts commit 7c701367c0.

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2022-04-05 12:27:17 -04:00
trop[bot]
5f6d02a4e7 fix: add missing translation string for ax tree (#33617)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2022-04-05 08:58:10 -07:00
Sudowoodo Release Bot
01b429edf2 Revert "Bump v19.0.0-alpha.2"
This reverts commit 1b8181af14.
2022-04-04 08:05:27 -07:00
Sudowoodo Release Bot
1b8181af14 Bump v19.0.0-alpha.2 2022-04-04 06:31:13 -07:00
trop[bot]
bdff8837a7 fix: create userData on requestSingleInstanceLock() if needed (#33559) (#33593)
* test: use custom userData folder for requestSingleInstanceLock()

* update test

* prefix test folder path

* fix: create userDataDir on requestSingleInstanceLock() if needed

* Trigger Build

Co-authored-by: Micha Hanselmann <micha.hanselmann@gmail.com>
2022-04-04 17:57:52 +09:00
Sudowoodo Release Bot
85b8861a7f Revert "Bump v19.0.0-alpha.2"
This reverts commit 74e57fa3e7.
2022-03-31 16:46:31 -07:00
Sudowoodo Release Bot
74e57fa3e7 Bump v19.0.0-alpha.2 2022-03-31 06:30:58 -07:00
electron-roller[bot]
6442e87276 chore: bump chromium to 102.0.4971.0 (19-x-y) (#33518)
* chore: bump chromium in DEPS to 102.0.4973.0

* chore: bump chromium to 102.0.4971.0 (main) (#33454)

* chore: bump chromium in DEPS to 102.0.4965.0

* chore: 3-way merge of chromium/printing.patch

* chore: update patch shear in chromium/picture-in-picture.patch

* chore: update patches

* 3101519: Window Placement: Prototype fullscreen companion window support

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3101519

build: add popup_preventer.cc, .h to our library. It's needed because
FullscreenController, we were already using, started aggregating a
PopupPreventer in 3101519.

* chore: bump chromium in DEPS to 102.0.4967.0

* Revert "3101519: Window Placement: Prototype fullscreen companion window support"

This reverts commit fc215cb99c464e939882ed3f5cf8e9874a8e3311.

Adding popup_preventer might not be the right solution; there are
cascading dependencies.

* 3551449: Add service-based usage for system print settings

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3551449

chore: fix code shear in patches/chromium/printing.patch

* chore: update patches

* chore: bump chromium in DEPS to 102.0.4969.0

* chore: update patches

* chore: bump chromium in DEPS to 102.0.4971.0

* chore: update fix_patch_out_permissions_checks_in_exclusive_access.patch

Refs https://chromium-review.googlesource.com/c/chromium/src/+/3101519

PopupunderPreventer is not useful in //electron since the window
attributes are controlled by the user via setWindowOpenHandler.

* chore: update patches

* Add FirstPartySetsHandler as a interface class in content API.

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

* Create a new MediaStreamRequestType for GetOpenDevice

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

* Support site isolation for <webview> tags in WebViewRendererState.

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

* ci: update xcode version

Refs https://chromium-review.googlesource.com/c/chromium/src/+/3544199
https://developer.apple.com/documentation/screencapturekit/capturing_screen_content_in_macos

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
(cherry picked from commit b711860d21)

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2022-03-30 22:43:08 -07:00
Sudowoodo Release Bot
9a8985f7a2 Bump v19.0.0-alpha.1 2022-03-29 16:07:47 -07:00
307 changed files with 4414 additions and 2166 deletions

View File

@@ -527,15 +527,6 @@ step-install-gnutar-on-mac: &step-install-gnutar-on-mac
ln -fs /usr/local/bin/gtar /usr/local/bin/tar
fi
step-install-python2-on-mac: &step-install-python2-on-mac
run:
name: Install python2 on macos
command: |
if [ "`uname`" == "Darwin" ]; then
curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg
sudo installer -pkg python-2.7.18-macosx10.9.pkg -target /
fi
step-gn-gen-default: &step-gn-gen-default
run:
name: Default GN gen
@@ -558,7 +549,7 @@ step-gn-check: &step-gn-check
step-electron-build: &step-electron-build
run:
name: Electron build
no_output_timeout: 30m
no_output_timeout: 60m
command: |
# On arm platforms we generate a cross-arch ffmpeg that ninja does not seem
# to realize is not correct / should be rebuilt. We delete it here so it is
@@ -661,7 +652,6 @@ step-persist-data-for-tests: &step-persist-data-for-tests
- src/out/Default/mksnapshot.zip
- src/out/Default/chromedriver.zip
- src/out/Default/gen/node_headers
- src/out/Default/overlapped-checker
- src/out/ffmpeg/ffmpeg.zip
- src/electron
- src/third_party/electron_node
@@ -688,6 +678,13 @@ step-electron-dist-unzip: &step-electron-dist-unzip
# passed.
unzip -:o dist.zip
step-ffmpeg-unzip: &step-ffmpeg-unzip
run:
name: Unzip ffmpeg.zip
command: |
cd src/out/ffmpeg
unzip -:o ffmpeg.zip
step-mksnapshot-unzip: &step-mksnapshot-unzip
run:
name: Unzip mksnapshot.zip
@@ -716,6 +713,13 @@ step-ffmpeg-build: &step-ffmpeg-build
cd src
ninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES
step-verify-ffmpeg: &step-verify-ffmpeg
run:
name: Verify ffmpeg
command: |
cd src
python electron/script/verify-ffmpeg.py --source-root "$PWD" --build-dir out/Default --ffmpeg-path out/ffmpeg
step-verify-mksnapshot: &step-verify-mksnapshot
run:
name: Verify mksnapshot
@@ -1011,7 +1015,7 @@ steps-electron-gn-check: &steps-electron-gn-check
- *step-checkout-electron
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-install-python2-on-mac
- install-python2-mac
- *step-setup-env-for-build
- *step-setup-goma-for-build
- *step-generate-deps-hash
@@ -1030,6 +1034,53 @@ steps-electron-ts-compile-for-doc-change: &steps-electron-ts-compile-for-doc-cha
#Compile ts/js to verify doc change didn't break anything
- *step-ts-compile
steps-native-tests: &steps-native-tests
steps:
- attach_workspace:
at: .
- *step-depot-tools-add-to-path
- install-python2-mac
- *step-setup-env-for-build
- *step-setup-goma-for-build
- *step-wait-for-goma
- *step-gn-gen-default
- run:
name: Build tests
command: |
cd src
ninja -C out/Default $BUILD_TARGET
- *step-show-goma-stats
- *step-setup-linux-for-headless-testing
- run:
name: Run tests
command: |
mkdir test_results
python src/electron/script/native-tests.py run \
--config $TESTS_CONFIG \
--tests-dir src/out/Default \
--output-dir test_results \
$TESTS_ARGS
- store_artifacts:
path: test_results
destination: test_results # Put it in the root folder.
- store_test_results:
path: test_results
steps-verify-ffmpeg: &steps-verify-ffmpeg
steps:
- attach_workspace:
at: .
- *step-depot-tools-add-to-path
- *step-electron-dist-unzip
- *step-ffmpeg-unzip
- *step-setup-linux-for-headless-testing
- *step-verify-ffmpeg
- *step-maybe-notify-slack-failure
steps-tests: &steps-tests
steps:
- attach_workspace:
@@ -1130,6 +1181,31 @@ steps-test-node: &steps-test-node
# Command Aliases
commands:
install-python2-mac:
steps:
- restore_cache:
keys:
- v2.7.18-python-cache-{{ arch }}
name: Restore python cache
- run:
name: Install python2 on macos
command: |
if [ "`uname`" == "Darwin" ]; then
if [ ! -f "python-downloads/python-2.7.18-macosx10.9.pkg" ]; then
mkdir python-downloads
echo 'Downloading Python 2.7.18'
curl -O https://dev-cdn.electronjs.org/python/python-2.7.18-macosx10.9.pkg
mv python-2.7.18-macosx10.9.pkg python-downloads
else
echo 'Using Python install from cache'
fi
sudo installer -pkg python-downloads/python-2.7.18-macosx10.9.pkg -target /
fi
- save_cache:
paths:
- python-downloads
key: v2.7.18-python-cache-{{ arch }}
name: Persisting python cache
maybe-restore-portaled-src-cache:
parameters:
halt-if-successful:
@@ -1296,7 +1372,7 @@ commands:
- run: rm -rf src/electron
- *step-restore-brew-cache
- *step-install-gnutar-on-mac
- *step-install-python2-on-mac
- install-python2-mac
- *step-save-brew-cache
- when:
condition: << parameters.build >>
@@ -1411,7 +1487,7 @@ commands:
- *step-electron-build
- *step-maybe-electron-dist-strip
- step-electron-dist-build:
additional-targets: shell_browser_ui_unittests third_party/electron_node:headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip
additional-targets: shell_browser_ui_unittests third_party/electron_node:headers electron:hunspell_dictionaries_zip
- *step-show-goma-stats
@@ -1488,7 +1564,7 @@ commands:
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-restore-brew-cache
- *step-install-python2-on-mac
- install-python2-mac
- *step-get-more-space-on-mac
- when:
condition: << parameters.checkout >>
@@ -1809,7 +1885,7 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
<<: *steps-electron-gn-check
osx-publish-x64:
osx-publish-x64-skip-checkout:
executor:
name: macos
size: macos.x86.medium.gen2
@@ -1830,7 +1906,7 @@ jobs:
attach: true
checkout: false
osx-publish-arm64:
osx-publish-arm64-skip-checkout:
executor:
name: macos
size: macos.x86.medium.gen2
@@ -1900,7 +1976,7 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
<<: *steps-electron-gn-check
mas-publish-x64:
mas-publish-x64-skip-checkout:
executor:
name: macos
size: macos.x86.medium.gen2
@@ -1921,7 +1997,7 @@ jobs:
attach: true
checkout: false
mas-publish-arm64:
mas-publish-arm64-skip-checkout:
executor:
name: macos
size: macos.x86.medium.gen2
@@ -2007,6 +2083,16 @@ jobs:
<<: *env-stack-dumping
<<: *steps-test-node
linux-x64-verify-ffmpeg:
executor:
name: linux-docker
size: medium
environment:
<<: *env-linux-medium
<<: *env-headless-testing
<<: *env-send-slack-notifications
<<: *steps-verify-ffmpeg
linux-arm-testing-tests:
executor: linux-arm
environment:
@@ -2063,6 +2149,17 @@ jobs:
<<: *env-apple-silicon
<<: *steps-tests
# Layer 4: Summary.
linux-release-summary:
executor:
name: linux-docker
size: medium
environment:
<<: *env-linux-medium
<<: *env-send-slack-notifications
steps:
- *step-maybe-notify-slack-success
# List all workflows
workflows:
docs-only:
@@ -2088,19 +2185,19 @@ workflows:
when: << pipeline.parameters.run-macos-publish >>
jobs:
- mac-checkout
- osx-publish-x64:
- osx-publish-x64-skip-checkout:
requires:
- mac-checkout
context: release-env
- mas-publish-x64:
- mas-publish-x64-skip-checkout:
requires:
- mac-checkout
context: release-env
- osx-publish-arm64:
- osx-publish-arm64-skip-checkout:
requires:
- mac-checkout
context: release-env
- mas-publish-arm64:
- mas-publish-arm64-skip-checkout:
requires:
- mac-checkout
context: release-env

View File

@@ -7,14 +7,8 @@ on:
- edited
- synchronize
permissions:
contents: read
jobs:
main:
permissions:
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
name: Validate PR Title
runs-on: ubuntu-latest
steps:

View File

@@ -79,15 +79,11 @@ if (is_linux) {
]
}
# Generates electron_gtk_stubs.h header which contains
# stubs for extracting function ptrs from the gtk library.
# Function signatures for which stubs are required should be
# declared in electron_gtk.sigs, currently this file contains
# signatures for the functions used with native file chooser
# implementation. In future, this file can be extended to contain
# gtk4 stubs to switch gtk version in runtime.
generate_stubs("electron_gtk_stubs") {
sigs = [ "shell/browser/ui/electron_gtk.sigs" ]
sigs = [
"shell/browser/ui/electron_gdk_pixbuf.sigs",
"shell/browser/ui/electron_gtk.sigs",
]
extra_header = "shell/browser/ui/electron_gtk.fragment"
output_name = "electron_gtk_stubs"
public_deps = [ "//ui/gtk:gtk_config" ]
@@ -366,7 +362,6 @@ source_set("electron_lib") {
"shell/common/api:mojo",
"//base:base_static",
"//base/allocator:buildflags",
"//chrome:strings",
"//chrome/app:command_ids",
"//chrome/app/resources:platform_locale_settings",
"//components/autofill/core/common:features",
@@ -561,8 +556,8 @@ source_set("electron_lib") {
"//ui/base/ime/linux",
"//ui/events/devices/x11",
"//ui/events/platform/x11",
"//ui/gtk",
"//ui/views/controls/webview",
"//ui/views/linux_ui:linux_ui_factory",
"//ui/wm",
]
if (ozone_platform_x11) {
@@ -911,10 +906,7 @@ if (is_mac) {
assert(defined(invoker.helper_name_suffix))
output_name = electron_helper_name + invoker.helper_name_suffix
deps = [
":electron_framework+link",
"//base/allocator:early_zone_registration_mac",
]
deps = [ ":electron_framework+link" ]
if (!is_mas_build) {
deps += [ "//sandbox/mac:seatbelt" ]
}
@@ -1074,7 +1066,6 @@ if (is_mac) {
":electron_app_plist",
":electron_app_resources",
":electron_fuses",
"//base/allocator:early_zone_registration_mac",
"//electron/buildflags",
]
if (is_mas_build) {

9
DEPS
View File

@@ -2,11 +2,14 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'103.0.5044.0',
'102.0.5005.115',
'node_version':
'v16.15.0',
'v16.14.2',
'nan_version':
'16fa32231e2ccd89d2804b3f765319128b20c4ac',
# The following commit hash of NAN is v2.14.2 with *only* changes to the
# test suite. This should be updated to a specific tag when one becomes
# available.
'65b32af46e9d7fab2e4ff657751205b3865f4920',
'squirrel.mac_version':
'0e5d146ba13101a1302d59ea6e6e0b3cace4ae38',

View File

@@ -1 +1 @@
20.0.0-alpha.1
19.0.5

View File

@@ -23,6 +23,10 @@
# https://www.appveyor.com/docs/build-configuration/#secure-variables
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
# Uncomment these lines to enable RDP
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
version: 1.0.{build}
build_cloud: electron-16-core
image: vs2019bt-16.16.11
@@ -237,8 +241,6 @@ deploy_script:
node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
}
on_finish:
# Uncomment this lines to enable RDP
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- cd ..
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
@@ -253,5 +255,4 @@ on_finish:
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
}
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )

View File

@@ -2,7 +2,7 @@ is_electron_build = true
root_extra_deps = [ "//electron" ]
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
node_module_version = 107
node_module_version = 106
v8_promise_internal_field_count = 1
v8_embedder_string = "-electron.0"
@@ -32,16 +32,9 @@ dawn_enable_vulkan_validation_layers = false
# See https://chromium-review.googlesource.com/c/chromium/src/+/2774898.
enable_pseudolocales = false
is_cfi = false
# Make application name configurable at runtime for cookie crypto
allow_runtime_configurable_key_storage = true
# CET shadow stack is incompatible with v8, until v8 is CET compliant
# enabling this flag causes main process crashes where CET is enabled
# Ref: https://source.chromium.org/chromium/chromium/src/+/45fba672185aae233e75d6ddc81ea1e0b30db050:v8/BUILD.gn;l=357
enable_cet_shadow_stack = false
# For similar reasons, disable CFI, which is not well supported in V8.
# Chromium doesn't have any problems with this because they do not run
# V8 in the browser process.
# Ref: https://source.chromium.org/chromium/chromium/src/+/45fba672185aae233e75d6ddc81ea1e0b30db050:v8/BUILD.gn;l=281
is_cfi = false

View File

@@ -89,8 +89,6 @@ static_library("chrome") {
"//chrome/browser/icon_loader_mac.mm",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
"//chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm",
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
"//chrome/browser/process_singleton_mac.mm",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",

View File

@@ -66,9 +66,9 @@ async function createWindow (backgroundColor?: string) {
mainWindow = new BrowserWindow(options);
mainWindow.on('ready-to-show', () => mainWindow!.show());
mainWindow.webContents.setWindowOpenHandler(details => {
shell.openExternal(decorateURL(details.url));
return { action: 'deny' };
mainWindow.webContents.on('new-window', (event, url) => {
event.preventDefault();
shell.openExternal(decorateURL(url));
});
mainWindow.webContents.session.setPermissionRequestHandler((webContents, permission, done) => {

View File

@@ -582,10 +582,6 @@ You should seek to use the `steal` option as sparingly as possible.
Hides all application windows without minimizing them.
### `app.isHidden()` _macOS_
Returns `boolean` - `true` if the application—including all of its windows—is hidden (e.g. with `Command-H`), `false` otherwise.
### `app.show()` _macOS_
Shows application windows after they were hidden. Does not automatically focus
@@ -611,18 +607,9 @@ Returns `string` - The current application directory.
* `%APPDATA%` on Windows
* `$XDG_CONFIG_HOME` or `~/.config` on Linux
* `~/Library/Application Support` on macOS
* `userData` The directory for storing your app's configuration files, which
by default is the `appData` directory appended with your app's name. By
convention files storing user data should be written to this directory, and
it is not recommended to write large files here because some environments
may backup this directory to cloud storage.
* `sessionData` The directory for storing data generated by `Session`, such
as localStorage, cookies, disk cache, downloaded dictionaries, network
state, devtools files. By default this points to `userData`. Chromium may
write very large disk cache here, so if your app does not rely on browser
storage like localStorage or cookies to save user data, it is recommended
to set this directory to other locations to avoid polluting the `userData`
directory.
* `userData` The directory for storing your app's configuration files, which by
default it is the `appData` directory appended with your app's name.
* `cache`
* `temp` Temporary directory.
* `exe` The current executable file.
* `module` The `libchromiumcontent` library.
@@ -672,9 +659,9 @@ In that case, the directory should be created with `fs.mkdirSync` or similar.
You can only override paths of a `name` defined in `app.getPath`.
By default, web pages' cookies and caches will be stored under the `sessionData`
By default, web pages' cookies and caches will be stored under the `userData`
directory. If you want to change this location, you have to override the
`sessionData` path before the `ready` event of the `app` module is emitted.
`userData` path before the `ready` event of the `app` module is emitted.
### `app.getVersion()`

View File

@@ -11,9 +11,6 @@ relative to its owning window. It is meant to be an alternative to the
Process: [Main](../glossary.md#main-process)
This module cannot be used until the `ready` event of the `app`
module is emitted.
### Example
```javascript

View File

@@ -4,9 +4,6 @@
Process: [Main](../glossary.md#main-process)
This module cannot be used until the `ready` event of the `app`
module is emitted.
```javascript
// In the main process.
const { BrowserWindow } = require('electron')

View File

@@ -35,7 +35,7 @@ page you load in your renderer executes code in this world.
When `contextIsolation` is enabled in your `webPreferences` (this is the default behavior since Electron 12.0.0), your `preload` scripts run in an
"Isolated World". You can read more about context isolation and what it affects in the
[security](../tutorial/security.md#3-enable-context-isolation) docs.
[security](../tutorial/security.md#3-enable-context-isolation-for-remote-content) docs.
## Methods

View File

@@ -253,11 +253,9 @@ Returns:
* `device` [HIDDevice[]](structures/hid-device.md)
* `frame` [WebFrameMain](web-frame-main.md)
Emitted after `navigator.hid.requestDevice` has been called and
`select-hid-device` has fired if a new device becomes available before
the callback from `select-hid-device` is called. This event is intended for
use when using a UI to ask users to pick a device so that the UI can be updated
with the newly added device.
Emitted when a new HID device becomes available. For example, when a new USB device is plugged in.
This event will only be emitted after `navigator.hid.requestDevice` has been called and `select-hid-device` has fired.
#### Event: 'hid-device-removed'
@@ -268,24 +266,9 @@ Returns:
* `device` [HIDDevice[]](structures/hid-device.md)
* `frame` [WebFrameMain](web-frame-main.md)
Emitted after `navigator.hid.requestDevice` has been called and
`select-hid-device` has fired if a device has been removed before the callback
from `select-hid-device` is called. This event is intended for use when using
a UI to ask users to pick a device so that the UI can be updated to remove the
specified device.
Emitted when a HID device has been removed. For example, this event will fire when a USB device is unplugged.
#### Event: 'hid-device-revoked'
Returns:
* `event` Event
* `details` Object
* `device` [HIDDevice[]](structures/hid-device.md)
* `frame` [WebFrameMain](web-frame-main.md)
Emitted after `HIDDevice.forget()` has been called. This event can be used
to help maintain persistent storage of permissions when
`setDevicePermissionHandler` is used.
This event will only be emitted after `navigator.hid.requestDevice` has been called and `select-hid-device` has fired.
#### Event: 'select-serial-port'
@@ -365,11 +348,7 @@ Returns:
* `port` [SerialPort](structures/serial-port.md)
* `webContents` [WebContents](web-contents.md)
Emitted after `navigator.serial.requestPort` has been called and
`select-serial-port` has fired if a new serial port becomes available before
the callback from `select-serial-port` is called. This event is intended for
use when using a UI to ask users to pick a port so that the UI can be updated
with the newly added port.
Emitted after `navigator.serial.requestPort` has been called and `select-serial-port` has fired if a new serial port becomes available. For example, this event will fire when a new USB device is plugged in.
#### Event: 'serial-port-removed'
@@ -379,11 +358,7 @@ Returns:
* `port` [SerialPort](structures/serial-port.md)
* `webContents` [WebContents](web-contents.md)
Emitted after `navigator.serial.requestPort` has been called and
`select-serial-port` has fired if a serial port has been removed before the
callback from `select-serial-port` is called. This event is intended for use
when using a UI to ask users to pick a port so that the UI can be updated
to remove the specified port.
Emitted after `navigator.serial.requestPort` has been called and `select-serial-port` has fired if a serial port has been removed. For example, this event will fire when a USB device is unplugged.
### Instance Methods

View File

@@ -16,7 +16,7 @@ win.loadURL('https://twitter.com')
win.webContents.on(
'did-frame-navigate',
(event, url, isMainFrame, frameProcessId, frameRoutingId) => {
(event, url, httpResponseCode, httpStatusText, isMainFrame, frameProcessId, frameRoutingId) => {
const frame = webFrameMain.fromId(frameProcessId, frameRoutingId)
if (frame) {
const code = 'document.body.innerHTML = document.body.innerHTML.replaceAll("heck", "h*ck")'

View File

@@ -556,7 +556,7 @@ Stops any `findInPage` request for the `webview` with the provided `action`.
* `header` string (optional) - string to be printed as page header.
* `footer` string (optional) - string to be printed as page footer.
* `pageSize` string | Size (optional) - Specify page size of the printed document. Can be `A3`,
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` in microns.
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`.
Returns `Promise<void>`

View File

@@ -372,7 +372,7 @@ value.
In Electron 12, `contextIsolation` will be enabled by default. To restore
the previous behavior, `contextIsolation: false` must be specified in WebPreferences.
We [recommend having contextIsolation enabled](tutorial/security.md#3-enable-context-isolation) for the security of your application.
We [recommend having contextIsolation enabled](tutorial/security.md#3-enable-context-isolation-for-remote-content) for the security of your application.
Another implication is that `require()` cannot be used in the renderer process unless
`nodeIntegration` is `true` and `contextIsolation` is `false`.

View File

@@ -8,24 +8,20 @@ function createWindow () {
})
mainWindow.webContents.session.on('select-hid-device', (event, details, callback) => {
//Add events to handle devices being added or removed before the callback on
//`select-hid-device` is called.
mainWindow.webContents.session.on('hid-device-added', (event, device) => {
console.log('hid-device-added FIRED WITH', device)
//Optionally update details.deviceList
})
mainWindow.webContents.session.on('hid-device-removed', (event, device) => {
console.log('hid-device-removed FIRED WITH', device)
//Optionally update details.deviceList
})
event.preventDefault()
if (details.deviceList && details.deviceList.length > 0) {
callback(details.deviceList[0].deviceId)
}
})
mainWindow.webContents.session.on('hid-device-added', (event, device) => {
console.log('hid-device-added FIRED WITH', device)
})
mainWindow.webContents.session.on('hid-device-removed', (event, device) => {
console.log('hid-device-removed FIRED WITH', device)
})
mainWindow.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin, details) => {
if (permission === 'hid' && details.securityOrigin === 'file:///') {
return true

View File

@@ -8,19 +8,6 @@ function createWindow () {
})
mainWindow.webContents.session.on('select-serial-port', (event, portList, webContents, callback) => {
//Add listeners to handle ports being added or removed before the callback for `select-serial-port`
//is called.
mainWindow.webContents.session.on('serial-port-added', (event, port) => {
console.log('serial-port-added FIRED WITH', port)
//Optionally update portList to add the new port
})
mainWindow.webContents.session.on('serial-port-removed', (event, port) => {
console.log('serial-port-removed FIRED WITH', port)
//Optionally update portList to remove the port
})
event.preventDefault()
if (portList && portList.length > 0) {
callback(portList[0].portId)
@@ -29,6 +16,14 @@ function createWindow () {
}
})
mainWindow.webContents.session.on('serial-port-added', (event, port) => {
console.log('serial-port-added FIRED WITH', port)
})
mainWindow.webContents.session.on('serial-port-removed', (event, port) => {
console.log('serial-port-removed FIRED WITH', port)
})
mainWindow.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin, details) => {
if (permission === 'serial' && details.securityOrigin === 'file:///') {
return true

View File

@@ -36,10 +36,8 @@ the WebHID API:
can be used to select a HID device when a call to
`navigator.hid.requestDevice` is made. Additionally the [`hid-device-added`](../api/session.md#event-hid-device-added)
and [`hid-device-removed`](../api/session.md#event-hid-device-removed) events
on the Session can be used to handle devices being plugged in or unplugged
when handling the `select-hid-device` event.
**Note:** These events only fire until the callback from `select-hid-device`
is called. They are not intended to be used as a generic hid device listener.
on the Session can be used to handle devices being plugged in or unplugged during the
`navigator.hid.requestDevice` process.
* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler)
can be used to provide default permissioning to devices without first calling
for permission to devices via `navigator.hid.requestDevice`. Additionally,
@@ -84,11 +82,8 @@ There are several additional APIs for working with the Web Serial API:
* The [`serial-port-added`](../api/session.md#event-serial-port-added)
and [`serial-port-removed`](../api/session.md#event-serial-port-removed) events
on the Session can be used to handle devices being plugged in or unplugged
when handling the `select-serial-port` event.
**Note:** These events only fire until the callback from `select-serial-port`
is called. They are not intended to be used as a generic serial port
listener.
on the Session can be used to handle devices being plugged in or unplugged during the
`navigator.serial.requestPort` process.
* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler)
can be used to provide default permissioning to devices without first calling
for permission to devices via `navigator.serial.requestPort`. Additionally,

View File

@@ -116,7 +116,7 @@ inAppPurchase.getProducts(PRODUCT_IDS).then(products => {
console.log(`The price of ${product.localizedTitle} is ${product.formattedPrice}.`)
})
// Ask the user which product they want to purchase.
// Ask the user which product he/she wants to purchase.
const selectedProduct = products[0]
const selectedQuantity = 1

View File

@@ -403,7 +403,7 @@ app.on('window-all-closed', () => {
```js
// preload.js
// All the Node.js APIs are available in the preload process.
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {

View File

@@ -99,7 +99,7 @@ You should at least follow these steps to improve the security of your applicati
1. [Only load secure content](#1-only-load-secure-content)
2. [Disable the Node.js integration in all renderers that display remote content](#2-do-not-enable-nodejs-integration-for-remote-content)
3. [Enable context isolation in all renderers](#3-enable-context-isolation)
3. [Enable context isolation in all renderers that display remote content](#3-enable-context-isolation-for-remote-content)
4. [Enable process sandboxing](#4-enable-process-sandboxing)
5. [Use `ses.setPermissionRequestHandler()` in all sessions that load remote content](#5-handle-session-permission-requests-from-remote-content)
6. [Do not disable `webSecurity`](#6-do-not-disable-websecurity)
@@ -225,7 +225,7 @@ do consume Node.js modules or features. Preload scripts continue to have access
to `require` and other Node.js features, allowing developers to expose a custom
API to remotely loaded content via the [contextBridge API](../api/context-bridge.md).
### 3. Enable Context Isolation
### 3. Enable Context Isolation for remote content
:::info
This recommendation is the default behavior in Electron since 12.0.0.

View File

@@ -115,9 +115,9 @@ const win = new BrowserWindow({
})
```
On Windows, you can also specify additional parameters. The color of the overlay and its symbols can be specified by setting `titleBarOverlay` to an object and using the `color` and `symbolColor` properties respectively. The height of the overlay can also be specified with the `height` property.
If a color option is not specified, the color will default to its system color for the window control buttons. Similarly, if the height option is not specified it will default to the default height:
On Windows, you can also specify the color of the overlay and its symbols by setting
`titleBarOverlay` to an object with the `color` and `symbolColor` properties. If an option
is not specified, the color will default to its system color for the window control buttons:
```javascript title='main.js'
// on Windows
@@ -126,8 +126,7 @@ const win = new BrowserWindow({
titleBarStyle: 'hidden',
titleBarOverlay: {
color: '#2f3241',
symbolColor: '#74b1be',
height: 60
symbolColor: '#74b1be'
}
})
```
@@ -136,10 +135,6 @@ const win = new BrowserWindow({
> color and dimension values from a renderer using a set of readonly
> [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars].
### Limitations
* Transparent colors are currently not supported. Progress updates for this feature can be found in PR [#33567](https://github.com/electron/electron/issues/33567).
## Create transparent windows
By setting the `transparent` option to `true`, you can make a fully transparent window.

View File

@@ -54,8 +54,6 @@ template("electron_extra_paks") {
])
output = "${invoker.output_dir}/resources.pak"
sources = [
"$root_gen_dir/chrome/browser_resources.pak",
"$root_gen_dir/chrome/common_resources.pak",
"$root_gen_dir/chrome/dev_ui_browser_resources.pak",
"$root_gen_dir/components/components_resources.pak",
"$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
@@ -71,8 +69,6 @@ template("electron_extra_paks") {
]
deps = [
"//chrome/browser:dev_ui_browser_resources",
"//chrome/browser:resources",
"//chrome/common:resources",
"//components/resources",
"//content:content_resources",
"//content:dev_ui_content_resources",
@@ -176,25 +172,19 @@ template("electron_paks") {
}
source_patterns = [
"${root_gen_dir}/chrome/locale_settings_",
"${root_gen_dir}/chrome/platform_locale_settings_",
"${root_gen_dir}/chrome/generated_resources_",
"${root_gen_dir}/components/strings/components_locale_settings_",
"${root_gen_dir}/components/strings/components_strings_",
"${root_gen_dir}/third_party/blink/public/strings/blink_accessibility_strings_",
"${root_gen_dir}/third_party/blink/public/strings/blink_strings_",
"${root_gen_dir}/device/bluetooth/strings/bluetooth_strings_",
"${root_gen_dir}/extensions/strings/extensions_strings_",
"${root_gen_dir}/services/strings/services_strings_",
"${root_gen_dir}/third_party/blink/public/strings/blink_accessibility_strings_",
"${root_gen_dir}/third_party/blink/public/strings/blink_strings_",
"${root_gen_dir}/ui/strings/app_locale_settings_",
"${root_gen_dir}/ui/strings/ax_strings_",
"${root_gen_dir}/ui/strings/ui_strings_",
]
deps = [
"//chrome/app:generated_resources",
"//chrome/app/resources:locale_settings",
"//chrome/app/resources:platform_locale_settings",
"//components/strings:components_locale_settings",
"//components/strings:components_strings",
"//device/bluetooth/strings",
"//extensions/strings",

View File

@@ -11,8 +11,15 @@
<output filename="electron_resources.pak" type="data_package" />
</outputs>
<release seq="1" allow_pseudo="false">
<messages fallback_to_english="true">
<!-- TODO(deepak1556): Add translations,
check https://www.chromium.org/developers/design-documents/ui-localization -->
<part file="electron_strings.grdp" />
</messages>
<includes>
<include name="IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE" file="${target_gen_dir}/shell_devtools_discovery_page.html" use_base_dir="false" type="BINDATA" />
<include name="IDR_PDF_MANIFEST" file="../chrome/browser/resources/pdf/manifest.json" type="BINDATA" />
<include name="IDR_CRYPTOTOKEN_MANIFEST" file="../chrome/browser/resources/cryptotoken/manifest.json" type="BINDATA" />
</includes>
</release>
</grit>

163
electron_strings.grdp Normal file
View File

@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<!-- Windows Caption Buttons -->
<message name="IDS_APP_ACCNAME_CLOSE" desc="The accessible name for the Close button.">
Close
</message>
<message name="IDS_APP_ACCNAME_MINIMIZE" desc="The accessible name for the Minimize button.">
Minimize
</message>
<message name="IDS_APP_ACCNAME_MAXIMIZE" desc="The accessible name for the Maximize button.">
Maximize
</message>
<message name="IDS_APP_ACCNAME_RESTORE" desc="The accessible name for the Restore button.">
Restore
</message>
<!-- Printing Service -->
<message name="IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME" desc="The name of the utility process used for printing conversions.">
Printing Service
</message>
<message name="IDS_PRINT_INVALID_PRINTER_SETTINGS" desc="Message to display when selected printer is not reachable or its settings are invalid.">
The selected printer is not available or not installed correctly. <ph name="BR">&lt;br&gt;</ph> Check your printer or try selecting another printer.
</message>
<message name="IDS_DEFAULT_PRINT_DOCUMENT_TITLE" desc="Default title for a print document">
Untitled Document
</message>
<message name="IDS_UTILITY_PROCESS_PRINT_BACKEND_SERVICE_NAME" desc="The name of the utility process used for backend interactions with printer drivers.">
Print Backend Service
</message>
<!-- Desktop Capturer API -->
<message name="IDS_DESKTOP_MEDIA_PICKER_SINGLE_SCREEN_NAME" desc="Name for screens in the desktop media picker UI when there is only one monitor.">
Entire Screen
</message>
<message name="IDS_DESKTOP_MEDIA_PICKER_MULTIPLE_SCREEN_NAME" desc="Name for screens in the desktop media picker UI when there are multiple monitors.">
{SCREEN_INDEX, plural, =1{Screen #} other{Screen #}}
</message>
<!-- File Select Helper-->
<message name="IDS_IMAGE_FILES" desc="The description of the image file extensions in the select file dialog.">
Image Files
</message>
<message name="IDS_AUDIO_FILES" desc="The description of the audio file extensions in the select file dialog.">
Audio Files
</message>
<message name="IDS_VIDEO_FILES" desc="The description of the video file extensions in the select file dialog.">
Video Files
</message>
<message name="IDS_CUSTOM_FILES" desc="The description of the custom file extensions in the select file dialog.">
Custom Files
</message>
<message name="IDS_DEFAULT_DOWNLOAD_FILENAME" desc="Default name for downloaded files when we have no idea what they could be.">
download
</message>
<!-- Picture-in-Picture -->
<if expr="is_macosx">
<message name="IDS_PICTURE_IN_PICTURE_TITLE_TEXT" desc="Title of the Picture-in-Picture window. This appears in the system tray and window header.">
Picture in Picture
</message>
</if>
<if expr="not is_macosx">
<message name="IDS_PICTURE_IN_PICTURE_TITLE_TEXT" desc="Title of the Picture-in-Picture window. This appears in the system tray and window header.">
Picture in picture
</message>
</if>
<message name="IDS_PICTURE_IN_PICTURE_PAUSE_CONTROL_TEXT" desc="Text label of the pause control button. The button appears when the user hovers over the Picture-in-Picture window and the video is currently playing.">
Pause
</message>
<message name="IDS_PICTURE_IN_PICTURE_PLAY_CONTROL_TEXT" desc="Text label of the play control button. The button appears when the user hovers over the Picture-in-Picture window and the video is currently paused.">
Play
</message>
<message name="IDS_PICTURE_IN_PICTURE_REPLAY_CONTROL_TEXT" desc="Text label of the replay control button. The button appears when the user hovers over the Picture-in-Picture window and the video is ended.">
Play from the beginning
</message>
<message name="IDS_PICTURE_IN_PICTURE_BACK_TO_TAB_CONTROL_TEXT" desc="Text label of the back to tab control button. The button appears when the user hovers over the Picture-in-Picture window.">
Back to video player
</message>
<message name="IDS_PICTURE_IN_PICTURE_MUTE_CONTROL_TEXT" desc="Text label of the mute control button. The button appears when the user hovers over the Picture-in-Picture window and the video is currently unmuted.">
Mute
</message>
<message name="IDS_PICTURE_IN_PICTURE_UNMUTE_CONTROL_TEXT" desc="Text label of the mute control button. The button appears when the user hovers over the Picture-in-Picture window and the video is currently muted.">
Unmute
</message>
<message name="IDS_PICTURE_IN_PICTURE_SKIP_AD_CONTROL_TEXT" desc="Text label of the skip ad control button. The button appears when the user hovers over the Picture-in-Picture window.">
Skip Ad
</message>
<message name="IDS_PICTURE_IN_PICTURE_MUTE_MICROPHONE_TEXT" desc="Text label of the mute microphone control button. The button appears when the user hovers over the Picture-in-Picture window.">
Mute microphone
</message>
<message name="IDS_PICTURE_IN_PICTURE_UNMUTE_MICROPHONE_TEXT" desc="Text label of the unmute microphone control button. The button appears when the user hovers over the Picture-in-Picture window.">
Unmute microphone
</message>
<message name="IDS_PICTURE_IN_PICTURE_TURN_ON_CAMERA_TEXT" desc="Text label of the turn on camera control button. The button appears when the user hovers over the Picture-in-Picture window.">
Turn on camera
</message>
<message name="IDS_PICTURE_IN_PICTURE_TURN_OFF_CAMERA_TEXT" desc="Text label of the turn off camera control button. The button appears when the user hovers over the Picture-in-Picture window.">
Turn off camera
</message>
<message name="IDS_PICTURE_IN_PICTURE_HANG_UP_TEXT" desc="Text label of the hang up control button. The button appears when the user hovers over the Picture-in-Picture window.">
Hang up
</message>
<message name="IDS_PICTURE_IN_PICTURE_CLOSE_CONTROL_TEXT" desc="Text label of the close control button. The button appears when the user hovers over the Picture-in-Picture window.">
Close
</message>
<message name="IDS_PICTURE_IN_PICTURE_RESIZE_HANDLE_TEXT" desc="Text label of the resize handle. The button appears when the user hovers over the Picture-in-Picture window.">
Resize
</message>
<message name="IDS_PICTURE_IN_PICTURE_PLAY_PAUSE_CONTROL_ACCESSIBLE_TEXT" desc="Accessible text label used for the controls button in the Picture-in-Picture window. The button toggles between play and pause controls.">
Toggle video to play or pause
</message>
<message name="IDS_PICTURE_IN_PICTURE_MUTE_CONTROL_ACCESSIBLE_TEXT" desc="Accessible text label used for the controls button in the Picture-in-Picture window. The button toggles mute state.">
Toggle mute
</message>
<message name="IDS_PICTURE_IN_PICTURE_NEXT_TRACK_CONTROL_ACCESSIBLE_TEXT" desc="Accessible text label used for the controls button in the Picture-in-Picture window. The button invokes next track action.">
Next track
</message>
<message name="IDS_PICTURE_IN_PICTURE_PREVIOUS_TRACK_CONTROL_ACCESSIBLE_TEXT" desc="Accessible text label used for the controls button in the Picture-in-Picture window. The button invokes previous track action.">
Previous track
</message>
<message name="IDS_SPELLCHECK_DICTIONARY" use_name_for_id="true">
en-US
</message>
<message name="IDS_ACCEPT_LANGUAGES" use_name_for_id="true">
en-US,en
</message>
<if expr="is_win">
<message name="IDS_UTILITY_PROCESS_UTILITY_WIN_NAME" desc="The name of the utility process used to handle Windows utility operations.">
Windows Utilities
</message>
</if>
<message name="IDS_DOWNLOAD_MORE_ACTIONS"
desc="Tooltip of a button on the downloads page that shows a menu with actions like 'Open downloads folder' or 'Clear all'">
More actions
</message>
<!-- Badging -->
<message name="IDS_SATURATED_BADGE_CONTENT" desc="The content to display when the application's badge is too large to display to indicate that the badge is more than a given maximum. This string should be as short as possible, preferably only one character beyond the content">
<ph name="MAXIMUM_VALUE">$1<ex>99</ex></ph>+
</message>
<message name="IDS_BADGE_UNREAD_NOTIFICATIONS_SATURATED" desc="The accessibility text which will be read by a screen reader when the notification count is too large to display (e.g. greater than 99).">
{MAX_UNREAD_NOTIFICATIONS, plural, =1 {More than 1 unread notification} other {More than # unread notifications}}
</message>
<message name="IDS_BADGE_UNREAD_NOTIFICATIONS_UNSPECIFIED" desc="The accessibility text which will be read by a screen reader when there are some unspecified number of notifications, or user attention is required">
Unread Notifications
</message>
<message name="IDS_BADGE_UNREAD_NOTIFICATIONS" desc="The accessibility text which will be read by a screen reader when there are notifcatications">
{UNREAD_NOTIFICATIONS, plural, =1 {1 Unread Notification} other {# Unread Notifications}}
</message>
<message name="IDS_HID_CHOOSER_ITEM_WITHOUT_NAME" desc="User option displaying the device IDs for a Human Interface Device (HID) without a device name.">
Unknown Device (<ph name="DEVICE_ID">$1<ex>1234:abcd</ex></ph>) </message>
<if expr="is_win">
<then>
<message name="IDS_AX_UNLABELED_IMAGE_ROLE_DESCRIPTION" desc="Accessibility role description for a graphic (image) on a web page or PDF that does not have a description for blind users." is_accessibility_with_no_ui="true">
Unlabeled graphic
</message>
</then>
<else>
<message name="IDS_AX_UNLABELED_IMAGE_ROLE_DESCRIPTION" desc="Accessibility role description for an image on a web page or PDF that does not have a description for blind users." is_accessibility_with_no_ui="true">
Unlabeled image
</message>
</else>
</if>
</grit-part>

View File

@@ -566,7 +566,6 @@ filenames = {
"shell/common/gin_converters/gfx_converter.h",
"shell/common/gin_converters/guid_converter.h",
"shell/common/gin_converters/gurl_converter.h",
"shell/common/gin_converters/hid_device_info_converter.h",
"shell/common/gin_converters/image_converter.cc",
"shell/common/gin_converters/image_converter.h",
"shell/common/gin_converters/message_box_converter.cc",

View File

@@ -36,14 +36,17 @@ const discardableDuplicateHeaders = new Set([
]);
class IncomingMessage extends Readable {
_shouldPush: boolean = false;
_data: (Buffer | null)[] = [];
_shouldPush: boolean;
_data: (Buffer | null)[];
_responseHead: NodeJS.ResponseHead;
_resume: (() => void) | null = null;
_resume: (() => void) | null;
constructor (responseHead: NodeJS.ResponseHead) {
super();
this._shouldPush = false;
this._data = [];
this._responseHead = responseHead;
this._resume = null;
}
get statusCode () {

View File

@@ -504,6 +504,7 @@ WebContents.prototype._callWindowOpenHandler = function (event: Electron.Event,
if (!this._windowOpenHandler) {
return defaultResponse;
}
const response = this._windowOpenHandler(details);
if (typeof response !== 'object') {
@@ -666,7 +667,15 @@ WebContents.prototype._init = function () {
postBody,
disposition
};
const result = this._callWindowOpenHandler(event, details);
let result;
try {
result = this._callWindowOpenHandler(event, details);
} catch (err) {
event.preventDefault();
throw err;
}
const options = result.browserWindowConstructorOptions;
if (!event.defaultPrevented) {
openGuestWindow({
@@ -697,7 +706,15 @@ WebContents.prototype._init = function () {
referrer,
postBody
};
const result = this._callWindowOpenHandler(event, details);
let result;
try {
result = this._callWindowOpenHandler(event, details);
} catch (err) {
event.preventDefault();
throw err;
}
windowOpenOutlivesOpenerOption = result.outlivesOpener;
windowOpenOverriddenOptions = result.browserWindowConstructorOptions;
if (!event.defaultPrevented) {

View File

@@ -41,7 +41,7 @@ export function openGuestWindow ({ event, embedder, guest, referrer, disposition
outlivesOpener: boolean,
}): BrowserWindow | undefined {
const { url, frameName, features } = windowOpenArgs;
const browserWindowOptions = makeBrowserWindowOptions({
const { options: browserWindowOptions } = makeBrowserWindowOptions({
embedder,
features,
overrideOptions: overrideBrowserWindowOptions
@@ -211,21 +211,23 @@ function makeBrowserWindowOptions ({ embedder, features, overrideOptions }: {
const { options: parsedOptions, webPreferences: parsedWebPreferences } = parseFeatures(features);
return {
show: true,
width: 800,
height: 600,
...parsedOptions,
...overrideOptions,
// Note that for normal code path an existing WebContents created by
// Chromium will be used, with web preferences parsed in the
// |-will-add-new-contents| event.
// The |webPreferences| here is only used by the |new-window| event.
webPreferences: makeWebPreferences({
embedder,
insecureParsedWebPreferences: parsedWebPreferences,
secureOverrideWebPreferences: overrideOptions && overrideOptions.webPreferences
})
} as Electron.BrowserViewConstructorOptions;
options: {
show: true,
width: 800,
height: 600,
...parsedOptions,
...overrideOptions,
// Note that for normal code path an existing WebContents created by
// Chromium will be used, with web preferences parsed in the
// |-will-add-new-contents| event.
// The |webPreferences| here is only used by the |new-window| event.
webPreferences: makeWebPreferences({
embedder,
insecureParsedWebPreferences: parsedWebPreferences,
secureOverrideWebPreferences: overrideOptions && overrideOptions.webPreferences
})
} as Electron.BrowserViewConstructorOptions
};
}
export function makeWebPreferences ({ embedder, secureOverrideWebPreferences = {}, insecureParsedWebPreferences: parsedWebPreferences = {} }: {

View File

@@ -70,8 +70,17 @@ function isInstalled () {
// unzips and makes path.txt point at the correct executable
function extractFile (zipPath) {
return extract(zipPath, { dir: path.join(__dirname, 'dist') })
.then(() => fs.promises.writeFile(path.join(__dirname, 'path.txt'), platformPath));
return new Promise((resolve, reject) => {
extract(zipPath, { dir: path.join(__dirname, 'dist') }, err => {
if (err) return reject(err);
fs.writeFile(path.join(__dirname, 'path.txt'), platformPath, err => {
if (err) return reject(err);
resolve();
});
});
});
}
function getPlatformPath () {

View File

@@ -10,9 +10,9 @@
"dependencies": {
"@electron/get": "^1.14.1",
"@types/node": "^16.11.26",
"extract-zip": "^2.0.1"
"extract-zip": "^1.0.3"
},
"engines": {
"node": ">= 10.17.0"
"node": ">= 8.6"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "electron",
"version": "20.0.0-alpha.1",
"version": "19.0.5",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {
@@ -77,7 +77,7 @@
"scripts": {
"asar": "asar",
"generate-version-json": "node script/generate-version-json.js",
"lint": "node ./script/lint.js && npm run lint:clang-format && npm run lint:docs",
"lint": "node ./script/lint.js && npm run lint:docs",
"lint:js": "node ./script/lint.js --js",
"lint:clang-format": "python3 script/run-clang-format.py -r -c shell/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
"lint:clang-tidy": "ts-node ./script/run-clang-tidy.ts",
@@ -94,6 +94,7 @@
"gn-typescript-definitions": "npm run create-typescript-definitions && shx cp electron.d.ts",
"pre-flight": "pre-flight",
"gn-check": "node ./script/gn-check.js",
"gn-format": "python3 script/run-gn-format.py",
"precommit": "lint-staged",
"preinstall": "node -e 'process.exit(0)'",
"prepack": "check-for-leaks",
@@ -124,7 +125,7 @@
],
"*.{gn,gni}": [
"npm run gn-check",
"python3 script/run-gn-format.py"
"npm run gn-format"
],
"*.py": [
"node script/lint.js --py --fix --only --"
@@ -141,8 +142,5 @@
"DEPS": [
"node script/gen-hunspell-filenames.js"
]
},
"resolutions": {
"nan": "nodejs/nan#16fa32231e2ccd89d2804b3f765319128b20c4ac"
}
}

View File

@@ -21,11 +21,15 @@ resource_file_conflict.patch
scroll_bounce_flag.patch
mas_blink_no_private_api.patch
mas_no_private_api.patch
mas-cfisobjc.patch
mas-cgdisplayusesforcetogray.patch
mas-audiodeviceduck.patch
mas_disable_remote_layer.patch
mas_disable_remote_accessibility.patch
mas_disable_custom_window_frame.patch
mas_avoid_usage_of_private_macos_apis.patch
mas_avoid_usage_of_abort_report_np.patch
mas_avoid_usage_of_pthread_fchdir_np.patch
mas_avoid_usage_of_setapplicationisdaemon_and.patch
mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch
chrome_key_systems.patch
add_didinstallconditionalfeatures.patch
@@ -54,6 +58,7 @@ feat_add_set_theme_source_to_allow_apps_to.patch
add_webmessageportconverter_entangleandinjectmessageportchannel.patch
ignore_rc_check.patch
remove_usage_of_incognito_apis_in_the_spellchecker.patch
chore_use_electron_resources_not_chrome_for_spellchecker.patch
allow_disabling_blink_scheduler_throttling_per_renderview.patch
hack_plugin_response_interceptor_to_point_to_electron.patch
feat_add_support_for_overriding_the_base_spellchecker_download_url.patch
@@ -75,6 +80,7 @@ skip_atk_toolchain_check.patch
worker_feat_add_hook_to_notify_script_ready.patch
chore_provide_iswebcontentscreationoverridden_with_full_params.patch
fix_properly_honor_printing_page_ranges.patch
fix_use_electron_generated_resources.patch
chore_expose_v8_initialization_isolate_callbacks.patch
export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch
fix_export_zlib_symbols.patch
@@ -97,6 +103,7 @@ process_singleton.patch
fix_expose_decrementcapturercount_in_web_contents_impl.patch
add_ui_scopedcliboardwriter_writeunsaferawdata.patch
feat_add_data_parameter_to_processsingleton.patch
mas_gate_private_enterprise_APIs.patch
load_v8_snapshot_in_browser_process.patch
fix_adapt_exclusive_access_for_electron_needs.patch
fix_aspect_ratio_with_max_size.patch
@@ -109,4 +116,6 @@ build_make_libcxx_abi_unstable_false_for_electron.patch
introduce_ozoneplatform_electron_can_call_x11_property.patch
make_gtk_getlibgtk_public.patch
build_disable_print_content_analysis.patch
feat_move_firstpartysets_to_content_browser_client.patch
custom_protocols_plzserviceworker.patch
posix_replace_doubleforkandexec_with_forkandspawn.patch

View File

@@ -10,7 +10,7 @@ This patch makes three changes to Accelerator::GetShortcutText to improve shortc
3. Ctrl-Shift-= and Ctrl-Plus show up as such
diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc
index 783202623cc15168c726180fe232751551c43798..7cf5449a61a31bebbaffd920129daf1866211d7c 100644
index 2468b2c5881821d6f8e24a0e7c42243427b384ad..7e44c97edabf5ae012ff4f84d1404d8f223a13fe 100644
--- a/ui/base/accelerators/accelerator.cc
+++ b/ui/base/accelerators/accelerator.cc
@@ -11,6 +11,7 @@

View File

@@ -10,10 +10,10 @@ Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set.
This should be upstreamed.
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index e0ff6fae1e96699e7cb54c9e82a3c68a8e95602b..2179a906bb6c93fbfaa8e7b7e64fddfaab034e94 100644
index 660c5f35c6095b23cc483c8eb1c119c215dc681d..961c0d7f7a9fe5f9e130998aeb0c872c571b710e 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -241,6 +241,10 @@ int GpuMain(MainFunctionParams parameters) {
@@ -240,6 +240,10 @@ int GpuMain(MainFunctionParams parameters) {
// to the GpuProcessHost once the GpuServiceImpl has started.
viz::GpuServiceImpl::InstallPreInitializeLogHandler();
@@ -24,7 +24,7 @@ index e0ff6fae1e96699e7cb54c9e82a3c68a8e95602b..2179a906bb6c93fbfaa8e7b7e64fddfa
// We are experiencing what appear to be memory-stomp issues in the GPU
// process. These issues seem to be impacting the task executor and listeners
// registered to it. Create the task executor on the heap to guard against
@@ -347,7 +351,6 @@ int GpuMain(MainFunctionParams parameters) {
@@ -346,7 +350,6 @@ int GpuMain(MainFunctionParams parameters) {
GpuProcess gpu_process(io_thread_priority);
#endif

View File

@@ -23,7 +23,7 @@ index eb6f4c87c4479d5f4fb8e3f85a231fb9cc744a63..11298b413021b4d438195482db253a93
int32_t world_id) {}
virtual void DidClearWindowObject() {}
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index abcd95ad39d8d66e1a7149e89bc6bfe2a8197d19..1b021461f214287c94fb22b17d980c19e3f07dde 100644
index f217de19126feeeafee01b2be31ced936696ce20..95966ce7f0eeb0a7f2822bef69b540ac6bfe298d 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4489,6 +4489,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
@@ -79,10 +79,10 @@ index a6ba8411384855c82712960375bc949c5c2bd522..fc86ca807c9c1bda9236160580b09415
if (World().IsMainWorld()) {
GetFrame()->Loader().DispatchDidClearWindowObjectInMainWorld();
diff --git a/third_party/blink/renderer/core/frame/local_frame_client.h b/third_party/blink/renderer/core/frame/local_frame_client.h
index 810726792cba326f66df5a8d0d833eaee4975594..635fb45b0a9d1716bd45d8b6c5dbc5f9fbf0ffa8 100644
index f36d04ff77481bd30e0de3f6d45c54dfece4067c..d30f569cd68716b9e963cf0fb5da3f7e65cc215a 100644
--- a/third_party/blink/renderer/core/frame/local_frame_client.h
+++ b/third_party/blink/renderer/core/frame/local_frame_client.h
@@ -298,6 +298,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
@@ -303,6 +303,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
virtual void DidCreateScriptContext(v8::Local<v8::Context>,
int32_t world_id) = 0;
@@ -92,10 +92,10 @@ index 810726792cba326f66df5a8d0d833eaee4975594..635fb45b0a9d1716bd45d8b6c5dbc5f9
int32_t world_id) = 0;
virtual bool AllowScriptExtensions() = 0;
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
index 772748673a5854349ba2be28abe21b7ff3f8541f..b3ebd622a61187f718ca16ac8cfeb189d35584d2 100644
index 5a83dcdf50acc27da2b1fbb3e515cb4316305a3a..86f31acc40a2dd296c34f3ecf5ef6ccd97cbc18c 100644
--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
+++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
@@ -273,6 +273,13 @@ void LocalFrameClientImpl::DidCreateScriptContext(
@@ -275,6 +275,13 @@ void LocalFrameClientImpl::DidCreateScriptContext(
web_frame_->Client()->DidCreateScriptContext(context, world_id);
}
@@ -110,7 +110,7 @@ index 772748673a5854349ba2be28abe21b7ff3f8541f..b3ebd622a61187f718ca16ac8cfeb189
v8::Local<v8::Context> context,
int32_t world_id) {
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.h b/third_party/blink/renderer/core/frame/local_frame_client_impl.h
index 200f0c57df1f15428b45a228adfee8fd5465ecbf..ec8cad0a94b31561096fdaba1a75fb54c96d3f7e 100644
index ac81fdc1ac99ca02458a10c0d258b846a8a9955e..ed838db2474790437ff4b57e23a1e289afce4d47 100644
--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.h
+++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.h
@@ -80,6 +80,8 @@ class CORE_EXPORT LocalFrameClientImpl final : public LocalFrameClient {
@@ -123,10 +123,10 @@ index 200f0c57df1f15428b45a228adfee8fd5465ecbf..ec8cad0a94b31561096fdaba1a75fb54
int32_t world_id) override;
diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h
index acd3b33c64f1534555c14047e29c18f31a1e8f92..63a9e0695efb0f357c0c3298175da9bbdc78a41c 100644
index aab6a77b18f83adeac065083f83b94b7ff251282..0d0e272a162be8d1bee9e0122e3e7a59b0ad32a3 100644
--- a/third_party/blink/renderer/core/loader/empty_clients.h
+++ b/third_party/blink/renderer/core/loader/empty_clients.h
@@ -352,6 +352,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
@@ -359,6 +359,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
void DidCreateScriptContext(v8::Local<v8::Context>,
int32_t world_id) override {}

View File

@@ -8,7 +8,7 @@ was removed as part of the Raw Clipboard API scrubbing.
https://bugs.chromium.org/p/chromium/issues/detail?id=1217643
diff --git a/ui/base/clipboard/scoped_clipboard_writer.cc b/ui/base/clipboard/scoped_clipboard_writer.cc
index 1eb1d0fe4696f26e7de43fc8797c283e9e6db042..766f8d8df866ce7fbc337cecceb715cced39643c 100644
index 3009acd40eee36bc3d4dd8642f0ce5e6476da973..1d52ce84184a3ca94e4e0f04d331bf56d75e07d0 100644
--- a/ui/base/clipboard/scoped_clipboard_writer.cc
+++ b/ui/base/clipboard/scoped_clipboard_writer.cc
@@ -227,6 +227,16 @@ void ScopedClipboardWriter::WriteEncodedDataTransferEndpointForTesting(

View File

@@ -6,10 +6,10 @@ Subject: allow disabling blink scheduler throttling per RenderView
This allows us to disable throttling for hidden windows.
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index f19a15f85afe2d754833667d8c272c75da3de0b2..18de1a2533b479a6090ed412987f0b5c3922c711 100644
index a9267b633e126f057e914b895f280ed658ff279d..179b5449f53c2d7b9024fb08fe1b1f6c03c6d5b0 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -661,6 +661,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
@@ -665,6 +665,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque);
}
@@ -22,11 +22,11 @@ index f19a15f85afe2d754833667d8c272c75da3de0b2..18de1a2533b479a6090ed412987f0b5c
return is_active();
}
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
index 64f6ebe2a86a659da70f32cdbdb961384adca43f..2fc1062eb798a233f0eede6dd945f25d633e5f8f 100644
index 3f0df3df3dd74ced71869ce01abf7b159387b8f4..85b169530a21bcfc016d1439a71d35378077774d 100644
--- a/content/browser/renderer_host/render_view_host_impl.h
+++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -136,6 +136,7 @@ class CONTENT_EXPORT RenderViewHostImpl
void EnablePreferredSizeMode() override;
@@ -137,6 +137,7 @@ class CONTENT_EXPORT RenderViewHostImpl
bool IsRenderViewLiveForTesting() const override;
void WriteIntoTrace(perfetto::TracedProto<TraceProto> context) const override;
+ void SetSchedulerThrottling(bool allowed) override;
@@ -34,10 +34,10 @@ index 64f6ebe2a86a659da70f32cdbdb961384adca43f..2fc1062eb798a233f0eede6dd945f25d
void SendRendererPreferencesToRenderer(
const blink::RendererPreferences& preferences);
diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h
index 4d2a4c6746e1dbfc619faf2e16eaa4948d74e372..6c9f190ff595234eca18ff20ca0655da4689b7a2 100644
index 3b01b3419c4361d5d75ad1c37e5baa3a1967bd09..35c82d931242a1180091267c18e0255840acc5ce 100644
--- a/content/public/browser/render_view_host.h
+++ b/content/public/browser/render_view_host.h
@@ -77,6 +77,9 @@ class CONTENT_EXPORT RenderViewHost {
@@ -80,6 +80,9 @@ class CONTENT_EXPORT RenderViewHost {
virtual void WriteIntoTrace(
perfetto::TracedProto<TraceProto> context) const = 0;
@@ -85,10 +85,10 @@ index 5e4032ccf916f969cd669af7d983becddb57c72b..a858c9f2fa609ae756a2e70d0362f2de
// 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 9704d8d8a4ee9e36c1a61c6723ce1039320014b6..cd14dd54e3c7bb56e82cbd6c566c11018b4deb94 100644
index 6504c73f614bebad7b899c8b76c4b3034b7dab7a..f76a0ee0778d7b4e4df69a4c43b4a6bfdc89294d 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -3698,6 +3698,13 @@ PageScheduler* WebViewImpl::Scheduler() const {
@@ -3689,6 +3689,13 @@ PageScheduler* WebViewImpl::Scheduler() const {
return GetPage()->GetPageScheduler();
}
@@ -102,7 +102,7 @@ index 9704d8d8a4ee9e36c1a61c6723ce1039320014b6..cd14dd54e3c7bb56e82cbd6c566c1101
void WebViewImpl::SetVisibilityState(
mojom::blink::PageVisibilityState visibility_state,
bool is_initial_state) {
@@ -3709,7 +3716,8 @@ void WebViewImpl::SetVisibilityState(
@@ -3700,7 +3707,8 @@ void WebViewImpl::SetVisibilityState(
}
GetPage()->SetVisibilityState(visibility_state, is_initial_state);
GetPage()->GetPageScheduler()->SetPageVisible(
@@ -113,10 +113,10 @@ index 9704d8d8a4ee9e36c1a61c6723ce1039320014b6..cd14dd54e3c7bb56e82cbd6c566c1101
mojom::blink::PageVisibilityState WebViewImpl::GetVisibilityState() {
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 51ab4f029e467fa5ea2663af38445d9565e19fe4..18005ca7a272d7731a4b8eeeac92ce163c2a262e 100644
index 5c9609a6a8d1e18981ac14ad5321fa82c3eb38e0..0a2564a8e45210ba58438e95caa70d01fac22aee 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.h
+++ b/third_party/blink/renderer/core/exported/web_view_impl.h
@@ -419,6 +419,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
@@ -420,6 +420,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
LocalDOMWindow* PagePopupWindow() const;
PageScheduler* Scheduler() const override;
@@ -124,7 +124,7 @@ index 51ab4f029e467fa5ea2663af38445d9565e19fe4..18005ca7a272d7731a4b8eeeac92ce16
void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state,
bool is_initial_state) override;
mojom::blink::PageVisibilityState GetVisibilityState() override;
@@ -854,6 +855,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
@@ -855,6 +856,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
// If true, we send IPC messages when |preferred_size_| changes.
bool send_preferred_size_changes_ = false;

View File

@@ -8,10 +8,10 @@ WebPreferences of in-process child windows, rather than relying on
process-level command line switches, as before.
diff --git a/third_party/blink/common/web_preferences/web_preferences.cc b/third_party/blink/common/web_preferences/web_preferences.cc
index 6d51f6a77c21b60ab756dbf8d4961b351a2e2b07..c6dc3cebfb32489a5e50b850ed02a066bf3f258e 100644
index 4e51622d725ad0ee448ea1794c209aae7f78e09a..df6e9ed6fda9e6fa695fa3ab717847735dc63b17 100644
--- a/third_party/blink/common/web_preferences/web_preferences.cc
+++ b/third_party/blink/common/web_preferences/web_preferences.cc
@@ -142,6 +142,20 @@ WebPreferences::WebPreferences()
@@ -140,6 +140,20 @@ WebPreferences::WebPreferences()
fake_no_alloc_direct_call_for_testing_enabled(false),
v8_cache_options(blink::mojom::V8CacheOptions::kDefault),
record_whole_document(false),
@@ -33,13 +33,13 @@ index 6d51f6a77c21b60ab756dbf8d4961b351a2e2b07..c6dc3cebfb32489a5e50b850ed02a066
accelerated_video_decode_enabled(false),
animation_policy(
diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
index 187fd8d9818693262256d5cbddd5e02659ba903d..f166517f4e70ced310253539fb6197f6b3af559c 100644
index 16e7501cf2da98d0046d65102e634af31c1f6c39..53fbfdb4837fe444c3564523068faadcc12afd1a 100644
--- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
+++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
@@ -23,6 +23,10 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
@@ -22,6 +22,10 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
!data.ReadSansSerifFontFamilyMap(&out->sans_serif_font_family_map) ||
!data.ReadCursiveFontFamilyMap(&out->cursive_font_family_map) ||
!data.ReadFantasyFontFamilyMap(&out->fantasy_font_family_map) ||
!data.ReadMathFontFamilyMap(&out->math_font_family_map) ||
+ // Begin Electron-specific WebPreferences.
+ !data.ReadPreloads(&out->preloads) ||
+ !data.ReadPreload(&out->preload) ||
@@ -47,7 +47,7 @@ index 187fd8d9818693262256d5cbddd5e02659ba903d..f166517f4e70ced310253539fb6197f6
!data.ReadLazyFrameLoadingDistanceThresholdsPx(
&out->lazy_frame_loading_distance_thresholds_px) ||
!data.ReadLazyImageLoadingDistanceThresholdsPx(
@@ -148,6 +152,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
@@ -145,6 +149,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
data.fake_no_alloc_direct_call_for_testing_enabled();
out->v8_cache_options = data.v8_cache_options();
out->record_whole_document = data.record_whole_document();
@@ -68,7 +68,7 @@ index 187fd8d9818693262256d5cbddd5e02659ba903d..f166517f4e70ced310253539fb6197f6
out->accelerated_video_decode_enabled =
data.accelerated_video_decode_enabled();
diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h
index 59947bfd3c042e5f7d3993967fece9b519f93472..368ec7fb398409cd6386269934eaffcce356793f 100644
index b2b3be2019209d3810bb0dc570e2a1ebcf702ad8..0ff23de6bd73d6d0ba82402ec39d2f0812c41aab 100644
--- a/third_party/blink/public/common/web_preferences/web_preferences.h
+++ b/third_party/blink/public/common/web_preferences/web_preferences.h
@@ -10,6 +10,7 @@
@@ -79,7 +79,7 @@ index 59947bfd3c042e5f7d3993967fece9b519f93472..368ec7fb398409cd6386269934eaffcc
#include "net/nqe/effective_connection_type.h"
#include "third_party/blink/public/common/common_export.h"
#include "third_party/blink/public/mojom/css/preferred_color_scheme.mojom-shared.h"
@@ -154,6 +155,22 @@ struct BLINK_COMMON_EXPORT WebPreferences {
@@ -152,6 +153,22 @@ struct BLINK_COMMON_EXPORT WebPreferences {
blink::mojom::V8CacheOptions v8_cache_options;
bool record_whole_document;
@@ -103,7 +103,7 @@ index 59947bfd3c042e5f7d3993967fece9b519f93472..368ec7fb398409cd6386269934eaffcc
// only controls whether or not the "document.cookie" field is properly
// connected to the backing store, for instance if you wanted to be able to
diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
index bd425a5869477de9095c6a41c683609d065b08c0..3a5d7450aa40e8a7614e83f316d3d0fb59583381 100644
index 30fd01c6e804d05091ff6147ac570901a8d998b9..4acd2df36ab6928947b5defe8691eccaf3cd7b19 100644
--- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
+++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
@@ -6,6 +6,7 @@
@@ -114,7 +114,7 @@ index bd425a5869477de9095c6a41c683609d065b08c0..3a5d7450aa40e8a7614e83f316d3d0fb
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "net/nqe/effective_connection_type.h"
#include "third_party/blink/public/common/common_export.h"
@@ -428,6 +429,60 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
@@ -418,6 +419,60 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
return r.record_whole_document;
}
@@ -176,7 +176,7 @@ index bd425a5869477de9095c6a41c683609d065b08c0..3a5d7450aa40e8a7614e83f316d3d0fb
return r.cookie_enabled;
}
diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
index 738ac646e075f7a37ba2a263c7799a755e63d3fb..80d6ae17d34ef5c7fd14e21c4e1ee3ed4ef9c5fe 100644
index d10d1b4c0b16ac9e863077cf60feca35fa2da329..1a49fb1a11f75aa3c79cd3cc1796957d0b9a5549 100644
--- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
+++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
@@ -10,6 +10,7 @@ import "third_party/blink/public/mojom/v8_cache_options.mojom";
@@ -187,7 +187,7 @@ index 738ac646e075f7a37ba2a263c7799a755e63d3fb..80d6ae17d34ef5c7fd14e21c4e1ee3ed
enum PointerType {
kPointerNone = 1, // 1 << 0
@@ -206,6 +207,22 @@ struct WebPreferences {
@@ -204,6 +205,22 @@ struct WebPreferences {
V8CacheOptions v8_cache_options;
bool record_whole_document;

View File

@@ -6,10 +6,10 @@ Subject: allow new privileges in unsandboxed child processes
This allows unsandboxed renderers to launch setuid processes on Linux.
diff --git a/content/browser/child_process_launcher_helper_linux.cc b/content/browser/child_process_launcher_helper_linux.cc
index 80db4cb5941ee84db1534c070c4daefef76d0faf..cf40ac56a9ce4bd4a28eb511b5f37d148e4be6ac 100644
index f60ad777ab7698a4518d3b1b61ade29e7c618a3a..c7781bdb49f8a92aa9ee1d8dd1af03fa9cf2dfe3 100644
--- a/content/browser/child_process_launcher_helper_linux.cc
+++ b/content/browser/child_process_launcher_helper_linux.cc
@@ -54,6 +54,18 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
@@ -53,6 +53,18 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
if (GetProcessType() == switches::kRendererProcess) {
const int sandbox_fd = SandboxHostLinux::GetInstance()->GetChildSocket();
options->fds_to_remap.push_back(std::make_pair(sandbox_fd, GetSandboxFD()));

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 c136ea03ea961ce419d42c60efc646e4ddfe5693..4e635c3775df0f1b3b3d7551fba8f8d59d1b541b 100644
index a519c49a01987feab4dadbc4ba48b73e943fa404..c8d2a65cb428e85c33675668cc106f0af124dfee 100644
--- a/third_party/blink/renderer/core/frame/frame.cc
+++ b/third_party/blink/renderer/core/frame/frame.cc
@@ -123,14 +123,6 @@ bool Frame::Detach(FrameDetachType type) {
@@ -49,10 +49,10 @@ index c136ea03ea961ce419d42c60efc646e4ddfe5693..4e635c3775df0f1b3b3d7551fba8f8d5
// its owning reference back to our owning LocalFrame.
client_->Detached(type);
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
index 019b87a77fb7306bacdcda20e388cdfb8d3a6be8..f972ae236566248d3179d147e9692322153e326d 100644
index 3efc0a04ae3fa60dce4aeb9a296c8dd1bb43320a..5dac7c18f39abefcc318ba2a7b8fad449189d0b6 100644
--- a/third_party/blink/renderer/core/frame/local_frame.cc
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -544,10 +544,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
@@ -543,10 +543,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
}
DCHECK(!view_ || !view_->IsAttached());
@@ -63,7 +63,7 @@ index 019b87a77fb7306bacdcda20e388cdfb8d3a6be8..f972ae236566248d3179d147e9692322
if (!Client())
return false;
@@ -593,6 +589,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
@@ -592,6 +588,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
DCHECK(!view_->IsAttached());
Client()->WillBeDetached();

View File

@@ -10,10 +10,10 @@ breakpad independently, as a "browser" process. This patches
crash annotation.
diff --git a/components/crash/core/app/breakpad_linux.cc b/components/crash/core/app/breakpad_linux.cc
index 3933fa761768b5a45891bfef4c2c2123b92fc276..2eb52b71d7ebc7525cceffbecc99db6751429afd 100644
index 43f6d476f3ee2759cf41c492f932522994e7ddec..8df14f416ee321e1259433715a61fa6025207d80 100644
--- a/components/crash/core/app/breakpad_linux.cc
+++ b/components/crash/core/app/breakpad_linux.cc
@@ -719,8 +719,13 @@ bool CrashDone(const MinidumpDescriptor& minidump,
@@ -718,8 +718,13 @@ bool CrashDone(const MinidumpDescriptor& minidump,
log_path[log_path_len] = '\0';
info.log_filename = log_path;
#endif
@@ -29,7 +29,7 @@ index 3933fa761768b5a45891bfef4c2c2123b92fc276..2eb52b71d7ebc7525cceffbecc99db67
info.distro = base::g_linux_distro;
info.distro_length = my_strlen(base::g_linux_distro);
info.upload = upload;
@@ -2027,8 +2032,13 @@ void InitCrashReporter(const std::string& process_type) {
@@ -2025,8 +2030,13 @@ void InitCrashReporter(const std::string& process_type) {
process_type == kWebViewSingleProcessType ||
process_type == kBrowserProcessType ||
#endif
@@ -40,6 +40,6 @@ index 3933fa761768b5a45891bfef4c2c2123b92fc276..2eb52b71d7ebc7525cceffbecc99db67
+ g_is_node = true;
+ }
+
#if !BUILDFLAG(IS_CHROMEOS)
#if !BUILDFLAG(IS_CHROMEOS_ASH)
SetUploadURL(GetCrashReporterClient()->GetUploadUrl());
#endif

View File

@@ -8,7 +8,7 @@ categories in use are known / declared. This patch is required for us
to introduce a new Electron category for Electron-specific tracing.
diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h
index 7528d88c5d40571f1dcbd02201128ba2eed0cf08..ae50430c441539eb6152a926d382fb0552f3c358 100644
index 0736e7021761e6019e1b52448d21ffdb73b964fc..571b553e9aaa98739851d0ff312eefe9f6a75596 100644
--- a/base/trace_event/builtin_categories.h
+++ b/base/trace_event/builtin_categories.h
@@ -80,6 +80,7 @@

View File

@@ -11,10 +11,10 @@ if we ever align our .pak file generation with Chrome we can remove this
patch.
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index 99ab95668a7d3a31339b576b4a3a6038f39c2795..92f43eac6d654ff8ebe57d291c4f77aa1b029895 100644
index 3c40d999a9545051e91a9f0ad3bf7ca2a95d80c4..b5a20be5e22238e7e1969bdaf52c0b05e84bb846 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
@@ -173,11 +173,16 @@ if (!is_android && !is_mac) {
@@ -171,11 +171,16 @@ if (!is_android && !is_mac) {
"common/crash_keys.h",
]
@@ -33,10 +33,10 @@ index 99ab95668a7d3a31339b576b4a3a6038f39c2795..92f43eac6d654ff8ebe57d291c4f77aa
"//base",
"//build:branding_buildflags",
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index cb28e691fb863fe7739a7ca536170e6c7a76a315..eacc853e2b9fc3c9e448f419e02d7378da310e9e 100644
index 948d05358b89895faa97a7d383bfac66a45464a8..43859d267010103daf80525a5af0f312a577411c 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -4588,7 +4588,7 @@ static_library("browser") {
@@ -4560,7 +4560,7 @@ static_library("browser") {
# On Windows, the hashes are embedded in //chrome:chrome_initial rather
# than here in :chrome_dll.
@@ -46,10 +46,10 @@ index cb28e691fb863fe7739a7ca536170e6c7a76a315..eacc853e2b9fc3c9e448f419e02d7378
sources += [ "certificate_viewer_stub.cc" ]
}
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 24a27fb4a47678be448d597c7e430ce28d23be11..664e9b0378d5b7c09fa66b7a10c7f938da14aab9 100644
index 641f52eb7952858738a6623b480f767261e5d009..6d0c624ea62a9125ef7e5579da197de2327a12ff 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -5841,7 +5841,6 @@ test("unit_tests") {
@@ -6002,7 +6002,6 @@ test("unit_tests") {
deps += [
"//chrome:other_version",
@@ -57,7 +57,7 @@ index 24a27fb4a47678be448d597c7e430ce28d23be11..664e9b0378d5b7c09fa66b7a10c7f938
"//chrome//services/util_win:unit_tests",
"//chrome/app:chrome_dll_resources",
"//chrome/browser:chrome_process_finder",
@@ -5864,6 +5863,10 @@ test("unit_tests") {
@@ -6025,6 +6024,10 @@ test("unit_tests") {
"//ui/resources",
]
@@ -68,7 +68,7 @@ index 24a27fb4a47678be448d597c7e430ce28d23be11..664e9b0378d5b7c09fa66b7a10c7f938
ldflags = [
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
@@ -6757,7 +6760,6 @@ test("unit_tests") {
@@ -6712,7 +6715,6 @@ test("unit_tests") {
}
deps += [
@@ -76,14 +76,15 @@ index 24a27fb4a47678be448d597c7e430ce28d23be11..664e9b0378d5b7c09fa66b7a10c7f938
"//chrome/browser:cart_db_content_proto",
"//chrome/browser:coupon_db_content_proto",
"//chrome/browser/media/router:test_support",
@@ -6856,6 +6858,10 @@ test("unit_tests") {
@@ -6760,6 +6762,11 @@ test("unit_tests") {
if (is_chromeos) {
deps += [ "//ui/chromeos" ]
}
}
+ if (!is_electron_build) {
+ deps += [ "//chrome:packed_resources_integrity_hash" ]
+ }
+
if (is_chromeos_ash) {
sources -= [
"../browser/policy/cloud/user_policy_signin_service_unittest.cc",
+ if (!is_electron_build) {
+ deps += [ "//chrome:packed_resources_integrity_hash" ]
+ }
+
if (is_chromeos_ash) {
deps += [
"//ash/assistant/model",

View File

@@ -7,7 +7,7 @@ Build libc++ as static library to compile and pass
nan tests
diff --git a/buildtools/third_party/libc++/BUILD.gn b/buildtools/third_party/libc++/BUILD.gn
index 74b6ad644d49c003996db0eab225ea30ac17420a..0a1ba3510be3047bfc34e603c5aaafbf15908269 100644
index a53cc9066a3485ff6829e3c410eb523de7d074d6..9697e2dc2d0892fc7f1007d62488c2f2f24ec92f 100644
--- a/buildtools/third_party/libc++/BUILD.gn
+++ b/buildtools/third_party/libc++/BUILD.gn
@@ -44,7 +44,11 @@ config("winver") {

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 aa0be995df8c2f9fa0d84922d30c7e1cdf9025c8..e588b460aa32b4c984d593ed54e10310b59ace9b 100644
index ec886101b6e5347bdd832684a5c3b2cc3179c657..0287e414f4020147ddee297f7c1447c32a118905 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -6840,6 +6840,7 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -6943,6 +6943,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 aa0be995df8c2f9fa0d84922d30c7e1cdf9025c8..e588b460aa32b4c984d593ed54e10310
&no_javascript_access);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 6da28755d61f8957b0e6b6d0f1e669c2dbb347fa..a96bb634eb5c5405abb62b88d576e5e3ed354caa 100644
index 335e70179a03ee379082525bb4c7d596983bd633..faa795be3a6cbc7ae13d9a42a1bdbd01ac0406a9 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3951,6 +3951,14 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -3947,6 +3947,14 @@ FrameTree* WebContentsImpl::CreateNewWindow(
}
auto* new_contents_impl = new_contents.get();
@@ -39,7 +39,7 @@ index 6da28755d61f8957b0e6b6d0f1e669c2dbb347fa..a96bb634eb5c5405abb62b88d576e5e3
new_contents_impl->GetController().SetSessionStorageNamespace(
partition_config, session_storage_namespace);
@@ -3995,12 +4003,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -3991,12 +3999,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
AddWebContentsDestructionObserver(new_contents_impl);
}
@@ -68,10 +68,10 @@ index a7f36529608011013dab96a803ad3187c940fc81..2bbcea3efede2fda4ff2c5b270e1db01
// 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 984205b3d1bb4acfde6c5d106118a88f866af341..e33a5c9c6d493cd4ac2664ea10390193e3e53fcc 100644
index ffa24d4b6779226ea3b94afdf176939ea7e42e34..16fb4946cb3ea2d097e8ed05bb340cc3f0782ed6 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -581,6 +581,8 @@ bool ContentBrowserClient::CanCreateWindow(
@@ -579,6 +579,8 @@ bool ContentBrowserClient::CanCreateWindow(
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
@@ -81,10 +81,10 @@ index 984205b3d1bb4acfde6c5d106118a88f866af341..e33a5c9c6d493cd4ac2664ea10390193
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 7e22f3e0b84f3e6b1ef7b1c5176665b38bd53629..f6d98708c436447ee6c93acb5d476719c238ca9c 100644
index ae3dda4b9b40bb0d4c1a10eaedda9270d3543a8b..9b988bb631ab759739ae01c918efb1d563d5aafc 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -168,6 +168,7 @@ class NetworkService;
@@ -165,6 +165,7 @@ class NetworkService;
class TrustedURLLoaderHeaderClient;
} // namespace mojom
struct ResourceRequest;
@@ -92,7 +92,7 @@ index 7e22f3e0b84f3e6b1ef7b1c5176665b38bd53629..f6d98708c436447ee6c93acb5d476719
} // namespace network
namespace sandbox {
@@ -959,6 +960,8 @@ class CONTENT_EXPORT ContentBrowserClient {
@@ -954,6 +955,8 @@ class CONTENT_EXPORT ContentBrowserClient {
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
@@ -173,7 +173,7 @@ index 89b07508aef80680a847c106fea0e2fa58ff964b..6630af3583a6bac6135d46644280d644
/*is_opener_navigation=*/false, request.HasUserGesture(),
// `openee_can_access_opener_origin` only matters for opener navigations,
diff --git a/content/web_test/browser/web_test_content_browser_client.cc b/content/web_test/browser/web_test_content_browser_client.cc
index 2e7c332565ebe33b00ab7fff96a6a8dfc61422a6..0ab061f51d1d0c93f23bfcf5ba051172cea37eb8 100644
index 4379497806bf7c85ade2f4e4554d6a60c4ec966c..fa860bbcf0c12df33dae69d25b01587676a1b79e 100644
--- a/content/web_test/browser/web_test_content_browser_client.cc
+++ b/content/web_test/browser/web_test_content_browser_client.cc
@@ -438,6 +438,8 @@ bool WebTestContentBrowserClient::CanCreateWindow(
@@ -186,7 +186,7 @@ index 2e7c332565ebe33b00ab7fff96a6a8dfc61422a6..0ab061f51d1d0c93f23bfcf5ba051172
bool opener_suppressed,
bool* no_javascript_access) {
diff --git a/content/web_test/browser/web_test_content_browser_client.h b/content/web_test/browser/web_test_content_browser_client.h
index 00e2a8c21d4f0ef00c942498251fa44065da63c0..0fc4b092fa276063e05f990bf920fecd60c6d26c 100644
index d4eb4d482b2641585d501131c64b90cc9dbcfd18..132a5d86279b9a2cb4364b9c6d3e89e12d55052e 100644
--- a/content/web_test/browser/web_test_content_browser_client.h
+++ b/content/web_test/browser/web_test_content_browser_client.h
@@ -80,6 +80,8 @@ class WebTestContentBrowserClient : public ShellContentBrowserClient {
@@ -220,10 +220,10 @@ index 84d32491a56528a84b4395fba1d54cdbb38d522b..09998a83c449ef8cd9f360fbcdcf7edc
} // namespace blink
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc
index ea47699384318126fef1a8c4cc3cb881cdc8e624..22d63b9f89913878518294f19afc85550196ca3e 100644
index 2e2ba228a7f179b7cf9c43434bd20ca20b1f1af6..de9f95426ad2dcc99bc4961a0e57539d287408e4 100644
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -2088,6 +2088,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
@@ -2074,6 +2074,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
WebWindowFeatures window_features =
GetWindowFeaturesFromString(features, incumbent_window);

View File

@@ -108,10 +108,10 @@ index 6688ba8ba2fb7d930773144cdbc43f1f6fa2b685..22015c7b9b50e1264551ce226757f90e
}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 1837aac53e6e13aebb0eee00249b305e0c7192c9..cf0b500239f635decc718fb9cfceb3f3f5be23c6 100644
index 7548e63c57dc8463cb59614122e32c574ae17437..a9e1c335e3fae4fa795059c9b28bd5d404184c2e 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -1798,12 +1798,11 @@ bool Browser::IsWebContentsCreationOverridden(
@@ -1786,12 +1786,11 @@ bool Browser::IsWebContentsCreationOverridden(
content::SiteInstance* source_site_instance,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
@@ -127,10 +127,10 @@ index 1837aac53e6e13aebb0eee00249b305e0c7192c9..cf0b500239f635decc718fb9cfceb3f3
WebContents* Browser::CreateCustomWebContents(
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 631c30c8f153e72cd92de457d8ba6f44574edbe6..a24181efacd35c3d7b9b0bcdc066dd0a0f7bc43a 100644
index 5edda102ff59ccb30d2150a88e75e8fb65379fca..82aaa442bca9e7a5e57315ace0b1c62e40ec1d24 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -828,8 +828,7 @@ class Browser : public TabStripModelObserver,
@@ -808,8 +808,7 @@ class Browser : public TabStripModelObserver,
content::SiteInstance* source_site_instance,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
@@ -246,10 +246,10 @@ index c6bd5c19f8a7ceec17c9e32af5296a9617f3a619..02199b439fba7fdc617b7f7980d958b7
void AddNewContents(content::WebContents* source,
std::unique_ptr<content::WebContents> new_contents,
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 1b616ba52d9c77c64c7f24a0d204ce36641dce38..0303ae1c4d8681bc1bf56eb9ff1fc13afd678706 100644
index add5ba98f4409460b93aa2f8c49eb49a1f59470a..4b77c71375a7375e168c9bee93a73c3af6fe1252 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3899,8 +3899,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -3895,8 +3895,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
if (delegate_ && delegate_->IsWebContentsCreationOverridden(
source_site_instance, params.window_container_type,
@@ -344,10 +344,10 @@ index ef6faf317dd4168adf6fd530a7da0b80f9166dec..f401659a81d4aeaf71039d71eb8fec48
content::RenderFrameHost* opener,
content::SiteInstance* source_site_instance,
diff --git a/fuchsia/engine/browser/frame_impl.cc b/fuchsia/engine/browser/frame_impl.cc
index d2497be79bb5d7943589bb928e2fbe13f76aa3e3..54adf30432cf178f2d00630420e45cfa95551b54 100644
index 424c5f89440dccc29f3431e034d0a4fd4f647a00..8d40d0bd30fc28e841eedb3f34be3c033db62449 100644
--- a/fuchsia/engine/browser/frame_impl.cc
+++ b/fuchsia/engine/browser/frame_impl.cc
@@ -404,8 +404,7 @@ bool FrameImpl::IsWebContentsCreationOverridden(
@@ -402,8 +402,7 @@ bool FrameImpl::IsWebContentsCreationOverridden(
content::SiteInstance* source_site_instance,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,

View File

@@ -0,0 +1,58 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <sattard@slack-corp.com>
Date: Wed, 23 Oct 2019 14:17:18 -0700
Subject: chore: use electron resources not chrome for spellchecker
spellchecker uses a few IDS_ resources. We need to load these from
Electrons grit header instead of Chromes
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index af2fd82cbc458b396107a161d9c3dd31077e57a7..948d05358b89895faa97a7d383bfac66a45464a8 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -7182,6 +7182,7 @@ static_library("browser") {
deps += [
"//components/spellcheck/browser",
"//components/spellcheck/common",
+ "//electron:resources",
]
if (!is_android) {
diff --git a/chrome/browser/spellchecker/spellcheck_factory.cc b/chrome/browser/spellchecker/spellcheck_factory.cc
index 7c3b6a69acb16186add5d467dbc22360d90d46d4..703e2ce60f4f35f9c71e8b503ffd62f9ea8f365a 100644
--- a/chrome/browser/spellchecker/spellcheck_factory.cc
+++ b/chrome/browser/spellchecker/spellcheck_factory.cc
@@ -7,7 +7,7 @@
#include "build/build_config.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/spellchecker/spellcheck_service.h"
-#include "chrome/grit/locale_settings.h"
+#include "electron/grit/electron_resources.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
diff --git a/components/language/core/browser/BUILD.gn b/components/language/core/browser/BUILD.gn
index fdba4ca90882656d6ba369dae48d5dfc13991cb8..fb3b759362275aafd4ed01a7865a4dd0dfaad727 100644
--- a/components/language/core/browser/BUILD.gn
+++ b/components/language/core/browser/BUILD.gn
@@ -30,6 +30,7 @@ static_library("browser") {
"//components/pref_registry",
"//components/prefs",
"//components/strings",
+ "//electron:resources",
"//ui/base",
]
}
diff --git a/components/language/core/browser/language_prefs.cc b/components/language/core/browser/language_prefs.cc
index 26f86d67c32b2a022698ae5ea5509912d2ccfacb..d48844d49308d67ee7bfa823335c7443173badbe 100644
--- a/components/language/core/browser/language_prefs.cc
+++ b/components/language/core/browser/language_prefs.cc
@@ -22,7 +22,7 @@
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
-#include "components/strings/grit/components_locale_settings.h"
+#include "electron/grit/electron_resources.h"
#include "ui/base/l10n/l10n_util.h"
namespace language {

View File

@@ -7,7 +7,7 @@ Disable persiste licence support check for widevine cdm,
as its not supported in the current version of chrome.
diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc
index 587144562fffda66cee9cbd23b16fb4e8607d208..a41bb82f8dcf292cf23aa8781bd5a5c52f11e578 100644
index ff769b9855810bfe3761079ddae286fc8aa5602f..1fea025e8fc1d4e2496f117780fa4d0eb2f2e983 100644
--- a/chrome/renderer/media/chrome_key_systems.cc
+++ b/chrome/renderer/media/chrome_key_systems.cc
@@ -17,7 +17,9 @@

View File

@@ -13,10 +13,10 @@ Ultimately we should remove the option to disable compression, and
subsequently remove this patch.
diff --git a/components/crash/core/app/breakpad_linux.cc b/components/crash/core/app/breakpad_linux.cc
index 2eb52b71d7ebc7525cceffbecc99db6751429afd..d3ff2942d831745efed440be0fe1e82441a39ff7 100644
index 8df14f416ee321e1259433715a61fa6025207d80..1d7f38d3f89d9c7f110cc9eb880264464787eb32 100644
--- a/components/crash/core/app/breakpad_linux.cc
+++ b/components/crash/core/app/breakpad_linux.cc
@@ -111,6 +111,8 @@ void SetUploadURL(const std::string& url) {
@@ -110,6 +110,8 @@ void SetUploadURL(const std::string& url) {
DCHECK(!g_upload_url);
g_upload_url = strdup(url.c_str());
}
@@ -25,9 +25,9 @@ index 2eb52b71d7ebc7525cceffbecc99db6751429afd..d3ff2942d831745efed440be0fe1e824
#endif
bool g_is_node = false;
@@ -1324,56 +1326,60 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info,
@@ -1322,56 +1324,60 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info,
#else // BUILDFLAG(IS_CHROMEOS)
#else // BUILDFLAG(IS_CHROMEOS_ASH)
- // Compress |dumpfile| with gzip.
- const pid_t gzip_child = sys_fork();
@@ -127,7 +127,7 @@ index 2eb52b71d7ebc7525cceffbecc99db6751429afd..d3ff2942d831745efed440be0fe1e824
static const char header_msg[] =
"--header=Content-Type: multipart/form-data; boundary=";
const size_t header_content_type_size =
@@ -1400,7 +1406,8 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info,
@@ -1398,7 +1404,8 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info,
static const char kWgetBinary[] = "/usr/bin/wget";
const char* args[] = {
kWgetBinary,
@@ -137,9 +137,9 @@ index 2eb52b71d7ebc7525cceffbecc99db6751429afd..d3ff2942d831745efed440be0fe1e824
header_content_type,
post_file,
g_upload_url,
@@ -2041,6 +2048,7 @@ void InitCrashReporter(const std::string& process_type) {
@@ -2039,6 +2046,7 @@ void InitCrashReporter(const std::string& process_type) {
#if !BUILDFLAG(IS_CHROMEOS)
#if !BUILDFLAG(IS_CHROMEOS_ASH)
SetUploadURL(GetCrashReporterClient()->GetUploadUrl());
+ g_compress_uploads = GetCrashReporterClient()->GetShouldCompressUploads();
#endif

View File

@@ -9,10 +9,10 @@ rate-limiting, compression and global annotations.
This should be upstreamed.
diff --git a/components/crash/core/app/breakpad_linux.cc b/components/crash/core/app/breakpad_linux.cc
index 4ed2558351e37dde0eb35b6eb32f442346ff2490..3933fa761768b5a45891bfef4c2c2123b92fc276 100644
index 823e49a234e3dd31bf6527c2e4efa96f3d23f1f2..43f6d476f3ee2759cf41c492f932522994e7ddec 100644
--- a/components/crash/core/app/breakpad_linux.cc
+++ b/components/crash/core/app/breakpad_linux.cc
@@ -113,6 +113,7 @@ void SetUploadURL(const std::string& url) {
@@ -112,6 +112,7 @@ void SetUploadURL(const std::string& url) {
}
#endif

View File

@@ -8,10 +8,10 @@ Allow registering custom protocols to handle service worker main script fetching
Refs https://bugs.chromium.org/p/chromium/issues/detail?id=996511
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc
index 9aba6deb9e11ec2803f163088d1c321dd256787f..1dc24bb4c83acd2ff618b085059c918261b2a3d4 100644
index f827745b9800d4f11a17e405b0eb22601d7e4dd4..0cecbfb2a6fd3daa71338c94bda4b1f45eb51d5e 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -1616,6 +1616,28 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
@@ -1591,6 +1591,28 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
loader_factory_bundle_info =
context()->loader_factory_bundle_for_update_check()->Clone();
@@ -40,7 +40,7 @@ index 9aba6deb9e11ec2803f163088d1c321dd256787f..1dc24bb4c83acd2ff618b085059c9182
if (base::FeatureList::IsEnabled(
features::kEnableServiceWorkersForChromeUntrusted) &&
scope.scheme_piece() == kChromeUIUntrustedScheme) {
@@ -1636,9 +1658,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
@@ -1611,9 +1633,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
browser_context(), scope_origin)) {
config->RegisterURLDataSource(browser_context());

View File

@@ -17,10 +17,10 @@ only one or two specific checks fail. Then it's better to simply comment out the
failing checks and allow the rest of the target to have them enabled.
diff --git a/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.cc b/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.cc
index 21e7b1cbada3856a7d91040c259be80ae95df07e..b19206ba58725f949403469a3e1d221b12833581 100644
index ab0afb79514e42acb87e94809ed4a2b7c736a825..23fb303820860a030643d6d5a1a449823bb146e8 100644
--- a/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.cc
+++ b/third_party/blink/renderer/core/mobile_metrics/mobile_friendliness_checker.cc
@@ -542,8 +542,7 @@ void MobileFriendlinessChecker::NotifyInvalidatePaint(
@@ -515,8 +515,7 @@ void MobileFriendlinessChecker::NotifyInvalidatePaint(
->GetPageScaleConstraintsSet()
.FinalConstraints()
.initial_scale;

View File

@@ -82,9 +82,18 @@ index 1e4a652634fbde2ca9a256baca840bbc5a0e001f..546f5bc3a2f79035f0eec196d9e704b8
const Source& GetSource(int index) const override;
DesktopMediaList::Type GetMediaListType() const override;
diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc
index 6d8c9d940bb4488ffedc1eb8c543c065bb3953c9..d5092cb0245a4b8dc26073741f0bc6657b943bdd 100644
index 6d8c9d940bb4488ffedc1eb8c543c065bb3953c9..2026b926eee56f6b235963b23ab86b2743eaed90 100644
--- a/chrome/browser/media/webrtc/native_desktop_media_list.cc
+++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc
@@ -18,7 +18,7 @@
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/media/webrtc/desktop_media_list.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_features.h"
@@ -127,8 +127,9 @@ BOOL CALLBACK AllHwndCollector(HWND hwnd, LPARAM param) {
#endif // BUILDFLAG(IS_WIN)

View File

@@ -20,10 +20,10 @@ to deal with color spaces. That is being tracked at
https://crbug.com/634542 and https://crbug.com/711107.
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index f3f1d19619717f0f0493ab1ec90f47fd16bdd574..10bdf83528295d50cde496ade386a3546aa7bfc2 100644
index 14e13169de8b5e808e3284792237bef9939b1e00..7628a96dc8b2c9e8128cd462138d3487304c6e10 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1880,6 +1880,9 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw(
@@ -1894,6 +1894,9 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw(
TargetColorParams LayerTreeHostImpl::GetTargetColorParams(
gfx::ContentColorUsage content_color_usage) const {
TargetColorParams params;
@@ -228,7 +228,7 @@ index 7fb664525ba696626544c8b09597105bff874c05..b987d649ef84451a9d3e5c2f87da3eb0
+
+#undef PATCH_CS
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 11e2a00aaffeba9379c0f2c41e6300d3020c7a88..9cfd058861a506bc3d6f72e5ed4a37b60ff4454b 100644
index 8cd9a960ca1de81857af60daa91596c1dbb17786..7455afe4d81eac31fe3792a4459834a7f968918c 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -227,6 +227,7 @@ GpuTerminationStatus ConvertToGpuTerminationStatus(
@@ -240,7 +240,7 @@ index 11e2a00aaffeba9379c0f2c41e6300d3020c7a88..9cfd058861a506bc3d6f72e5ed4a37b6
sandbox::policy::switches::kGpuSandboxAllowSysVShm,
sandbox::policy::switches::kGpuSandboxFailuresFatal,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 0c8d0735523d388d0e68d2ad0b20a1c2525502ed..089b8e85776874938cfdafad0c3576562a78c1b0 100644
index 09f72f1fbd7b782c5bf52245482b358103f0c243..80d9fd40efed1edc90e7bdf1db534acb876206ca 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -198,6 +198,7 @@
@@ -251,7 +251,7 @@ index 0c8d0735523d388d0e68d2ad0b20a1c2525502ed..089b8e85776874938cfdafad0c357656
#include "ui/gl/gl_switches.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -3217,6 +3218,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
@@ -3219,6 +3220,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
// Propagate the following switches to the renderer command line (along
// with any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = {

View File

@@ -6,19 +6,19 @@ 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 c37193c2207fb4f20993a35e2ac6fde8f0727a45..8e81312b1424d37c756bbb93cb4020a693c9b380 100644
index 18c77a5520ea2ae7cfee4eea3ed01fa8a588829d..557b77bea785108359b0c78f12c2b2afbdc2475d 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -531,7 +531,11 @@
browser_compositor_->GetDelegatedFrameHost()->HasSavedFrame();
if (has_saved_frame)
TRACE_EVENT_BEGIN("cc", "RWHVMac::WasOccluded with saved frame");
@@ -511,7 +511,11 @@
return;
host()->WasHidden();
- browser_compositor_->SetRenderWidgetHostIsHidden(true);
+ // Consider the RWHV occluded only if it is not attached to a window
+ // (e.g. unattached BrowserView). Otherwise we treat it as visible to
+ // prevent unnecessary compositor recycling.
+ const bool unattached = ![GetInProcessNSView() window];
+ browser_compositor_->SetRenderWidgetHostIsHidden(unattached);
if (has_saved_frame)
TRACE_EVENT_END("cc");
}
void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) {

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 730ac0aaf36da1842c7add66fbaea58baadf2e74..fcc45c987cfce94f5378d4aeee1cfe703178e133 100644
index 9e740edbf36dd7a30062c88f857103c56eebd729..7cda66952e0d3a67c32791ad3c7d7de8df03f876 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -809,6 +809,9 @@ void RenderWidgetHostImpl::WasHidden() {
@@ -808,6 +808,9 @@ void RenderWidgetHostImpl::WasHidden() {
if (is_hidden_)
return;
@@ -20,10 +20,10 @@ index 730ac0aaf36da1842c7add66fbaea58baadf2e74..fcc45c987cfce94f5378d4aeee1cfe70
blink::mojom::PointerLockResult::kWrongDocument);
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
index 2ae96b816427148f4f0adf39c549d37fe3d02619..0288d36642629d7ec1846cd977f378ff9c0afd40 100644
index 23783e5e004b613c27fd753e1f7ff96d51fa5f68..225b4ea0c5ac74d6b6700c306182d003a972cedc 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -879,6 +879,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl
@@ -886,6 +886,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl
SiteInstanceGroup* GetSiteInstanceGroup();
@@ -34,7 +34,7 @@ index 2ae96b816427148f4f0adf39c549d37fe3d02619..0288d36642629d7ec1846cd977f378ff
// |routing_id| must not be MSG_ROUTING_NONE.
// 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 a3eb86299d8d34262347ee093940e61af6eab348..cb99fd2eb69bba9b133664fb68076eeeb9576818 100644
index 5f29761ad8556e730dca6b076b87f6391313fb95..3e5f5a34150079bf74d612bff85b6875ad41d2e6 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -605,7 +605,7 @@ void RenderWidgetHostViewAura::HideImpl() {

View File

@@ -24,10 +24,10 @@ This patch temporarily disables the metrics so we can have green CI, and we
should continue seeking for a real fix.
diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc
index cfc5263749fa3068ad3699892bc4060891d7a0ef..f0aa5f66bc62efb2ea2d105d86dc3a8ea13e5eec 100644
index c289c888bc9d74d3f696714650b65aa373be27b4..aad7ec5ed0b6f6ab5cdfe0d7902d952c7c9e36c6 100644
--- a/content/browser/renderer_host/navigator.cc
+++ b/content/browser/renderer_host/navigator.cc
@@ -1293,6 +1293,7 @@ void Navigator::RecordNavigationMetrics(
@@ -1286,6 +1286,7 @@ void Navigator::RecordNavigationMetrics(
.InMilliseconds());
}
@@ -35,7 +35,7 @@ index cfc5263749fa3068ad3699892bc4060891d7a0ef..f0aa5f66bc62efb2ea2d105d86dc3a8e
// If this is a same-process navigation and we have timestamps for unload
// durations, fill those metrics out as well.
if (params.unload_start && params.unload_end &&
@@ -1339,6 +1340,7 @@ void Navigator::RecordNavigationMetrics(
@@ -1332,6 +1333,7 @@ void Navigator::RecordNavigationMetrics(
first_before_unload_start_time)
.InMilliseconds());
}

View File

@@ -6,7 +6,7 @@ Subject: Don't run PCScan functions if PCScan is disabled
PCScan should not be invoked if PCScan is disabled. Upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/2916657.
diff --git a/base/allocator/partition_allocator/memory_reclaimer.cc b/base/allocator/partition_allocator/memory_reclaimer.cc
index 1e54559bd5f9a2ee889b921379d70c51e902502d..6797a076b612ad4ed6d5ce7d9868d944fae3694f 100644
index d871ceecd76e21b23c500643363ced2ca87e8013..e0a26a90ee38342aefdbdd76e9c56a932b214235 100644
--- a/base/allocator/partition_allocator/memory_reclaimer.cc
+++ b/base/allocator/partition_allocator/memory_reclaimer.cc
@@ -66,7 +66,7 @@ void MemoryReclaimer::Reclaim(int flags) {
@@ -49,7 +49,7 @@ index d51b37c8a2df11f71fa6056193100d00883db43d..b44002788cf4d4f5d754dd35dd193be2
#endif
diff --git a/base/threading/platform_thread_win.cc b/base/threading/platform_thread_win.cc
index 5b179a2d15cfc4997410d9467bf9484f5cae0b9f..98296aa4e8d75e94b141694c592dfa83627861ff 100644
index 8542c0d0d49511298cca800a59796b1e4271a3d8..1d0eeff5800f2ccf3f1fb6b1356c8cd067cfd945 100644
--- a/base/threading/platform_thread_win.cc
+++ b/base/threading/platform_thread_win.cc
@@ -30,6 +30,7 @@

View File

@@ -11,7 +11,7 @@ This regressed in https://chromium-review.googlesource.com/c/chromium/src/+/2572
Upstream: https://chromium-review.googlesource.com/c/chromium/src/+/2598393
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 1b021461f214287c94fb22b17d980c19e3f07dde..76691715d09a62a1edc0306dcac1d3e7e312fb1d 100644
index 95966ce7f0eeb0a7f2822bef69b540ac6bfe298d..34c2bdc5d4dda2fb0bdf2a8c3e5f8f9a5e11b977 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -2398,7 +2398,7 @@ const blink::WebView* RenderFrameImpl::GetWebView() const {

View File

@@ -21,10 +21,10 @@ index c9b535eb083c250f4f874d8e6bd0c29ea9f3a10f..f220b8669507a4aea616b0dfbabda509
v8::ZoneBackingAllocator* GetZoneBackingAllocator() override;
#endif
diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc
index 1a41a282f054d8ca93db19dc5df7f1de14cb8e44..452372aa40947531452c7ad7226a4ee6b0adfccb 100644
index 952023235d9f1905b64195f625dbb3b1af97f908..3d8b4cc17584e7ae8be0b77a073a0453bcd5b3ef 100644
--- a/gin/v8_platform.cc
+++ b/gin/v8_platform.cc
@@ -367,6 +367,10 @@ PageAllocator* V8Platform::GetPageAllocator() {
@@ -366,6 +366,10 @@ PageAllocator* V8Platform::GetPageAllocator() {
return g_page_allocator.Pointer();
}

View File

@@ -33,7 +33,7 @@ index 14c71cc69388da46f62d9835e2a06fef0870da02..9481ea08401ae29ae9c1d960491b05b3
} // namespace net
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
index 6a331146e6fbf23e4177176f67fe534141579eb7..7f6974b8fbfe052902e6c0a55d386fb3a8b26558 100644
index f06a04983571623b542dba11933c4c95c3dcf398..606573a33573884baa173b796e1870b8defcda2a 100644
--- a/services/network/network_context.cc
+++ b/services/network/network_context.cc
@@ -1407,6 +1407,13 @@ void NetworkContext::SetNetworkConditions(
@@ -51,10 +51,10 @@ index 6a331146e6fbf23e4177176f67fe534141579eb7..7f6974b8fbfe052902e6c0a55d386fb3
// 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 620d7b7b733cc9749775c2bcabcebdedafe6ba0b..984e1f04c01006b7f038538c16ad2dd224925731 100644
index 2cd8707b120deb41683e13def5d446fd3bf93afe..c654d54cbb1427e700d918a94390c022b5b1cb14 100644
--- a/services/network/network_context.h
+++ b/services/network/network_context.h
@@ -298,6 +298,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
@@ -302,6 +302,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
void CloseIdleConnections(CloseIdleConnectionsCallback callback) override;
void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id,
mojom::NetworkConditionsPtr conditions) override;
@@ -63,10 +63,10 @@ index 620d7b7b733cc9749775c2bcabcebdedafe6ba0b..984e1f04c01006b7f038538c16ad2dd2
void SetEnableReferrers(bool enable_referrers) override;
#if BUILDFLAG(IS_CHROMEOS)
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
index 0450b50b5545d9b8f9025553167bed2e78157130..1b772288816ee770ee47cb59cf6c93439729320e 100644
index b52e5a2230e96d55d7886bde331a505c58dd093a..757dd77b06cba44e832e86e729e44b1e9a427c49 100644
--- a/services/network/public/mojom/network_context.mojom
+++ b/services/network/public/mojom/network_context.mojom
@@ -1090,6 +1090,9 @@ interface NetworkContext {
@@ -1087,6 +1087,9 @@ interface NetworkContext {
SetNetworkConditions(mojo_base.mojom.UnguessableToken throttling_profile_id,
NetworkConditions? conditions);

View File

@@ -12,7 +12,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 cd14dd54e3c7bb56e82cbd6c566c11018b4deb94..0b0b3a03a64ae6a321eeb27619f4f0ae5ee388cc 100644
index f76a0ee0778d7b4e4df69a4c43b4a6bfdc89294d..45baa4d62cb4e5aebedebba993ddbc9f06711d35 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -159,6 +159,7 @@
@@ -23,7 +23,7 @@ index cd14dd54e3c7bb56e82cbd6c566c11018b4deb94..0b0b3a03a64ae6a321eeb27619f4f0ae
#include "third_party/blink/renderer/platform/graphics/image.h"
#include "third_party/blink/renderer/platform/graphics/paint/cull_rect.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h"
@@ -1785,6 +1786,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
@@ -1776,6 +1777,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
#if BUILDFLAG(IS_MAC)
web_view_impl->SetMaximumLegibleScale(
prefs.default_maximum_page_scale_factor);

View File

@@ -13,7 +13,7 @@ app.requestSingleInstanceLock API so that users can pass in a JSON
object for the second instance to send to the first instance.
diff --git a/chrome/browser/process_singleton.h b/chrome/browser/process_singleton.h
index 5a64220aaf1309832dc0ad543e353de67fe0a779..55a2a78ce166a65cd11b26e0aa31968f6a10bec8 100644
index 5a64220aaf1309832dc0ad543e353de67fe0a779..e75c4f0d7cf1cac2e5862eb858800359e2001eb6 100644
--- a/chrome/browser/process_singleton.h
+++ b/chrome/browser/process_singleton.h
@@ -18,6 +18,7 @@
@@ -57,18 +57,19 @@ index 5a64220aaf1309832dc0ad543e353de67fe0a779..55a2a78ce166a65cd11b26e0aa31968f
#endif
private:
- NotificationCallback notification_callback_; // Handler for notifications.
+ // A callback to run when the first instance receives data from the second.
NotificationCallback notification_callback_; // Handler for notifications.
+ NotificationCallback notification_callback_;
+ // Custom data to pass to the other instance during notify.
+ base::span<const uint8_t> additional_data_;
#if BUILDFLAG(IS_WIN)
bool EscapeVirtualization(const base::FilePath& user_data_dir);
diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc
index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc4e2f5751 100644
index be2c417c07a4206fac4a9a6c03e516fd0493c942..9a1f7b80e9ec538977f9b492829646a62d2a67cd 100644
--- a/chrome/browser/process_singleton_posix.cc
+++ b/chrome/browser/process_singleton_posix.cc
@@ -611,6 +611,7 @@ class ProcessSingleton::LinuxWatcher
@@ -612,6 +612,7 @@ class ProcessSingleton::LinuxWatcher
// |reader| is for sending back ACK message.
void HandleMessage(const std::string& current_dir,
const std::vector<std::string>& argv,
@@ -76,7 +77,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc
SocketReader* reader);
private:
@@ -665,13 +666,16 @@ void ProcessSingleton::LinuxWatcher::StartListening(int socket) {
@@ -666,13 +667,16 @@ void ProcessSingleton::LinuxWatcher::StartListening(int socket) {
}
void ProcessSingleton::LinuxWatcher::HandleMessage(
@@ -95,7 +96,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc
// Send back "ACK" message to prevent the client process from starting up.
reader->FinishWithACK(kACKToken, std::size(kACKToken) - 1);
} else {
@@ -719,7 +723,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
@@ -720,7 +724,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
}
}
@@ -105,7 +106,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc
const size_t kMinMessageLength = std::size(kStartToken) + 4;
if (bytes_read_ < kMinMessageLength) {
buf_[bytes_read_] = 0;
@@ -749,10 +754,28 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
@@ -750,10 +755,28 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
tokens.erase(tokens.begin());
tokens.erase(tokens.begin());
@@ -135,7 +136,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc
fd_watch_controller_.reset();
// LinuxWatcher::HandleMessage() is in charge of destroying this SocketReader
@@ -781,8 +804,10 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK(
@@ -782,8 +805,10 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK(
//
ProcessSingleton::ProcessSingleton(
const base::FilePath& user_data_dir,
@@ -146,7 +147,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc
current_pid_(base::GetCurrentProcId()),
watcher_(new LinuxWatcher(this)) {
socket_path_ = user_data_dir.Append(chrome::kSingletonSocketFilename);
@@ -901,7 +926,8 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
@@ -902,7 +927,8 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
sizeof(socket_timeout));
// Found another process, prepare our command line
@@ -156,7 +157,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc
std::string to_send(kStartToken);
to_send.push_back(kTokenDelimiter);
@@ -911,11 +937,21 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
@@ -912,11 +938,21 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
to_send.append(current_dir.value());
const std::vector<std::string>& argv = cmd_line.argv();
@@ -179,7 +180,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc
if (!WriteToSocket(socket.fd(), to_send.data(), to_send.length())) {
// Try to kill the other process, because it might have been dead.
diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc
index 0c87fc8ccb4511904f19b76ae5e03a5df6664391..c34d4fe10781e6b9286a43176f7312da4e815caf 100644
index ec725b44296266bea1a51aea889463a0bba8449c..beb2925f2fd7a1a93435bf4b1a40b5c71b49e449 100644
--- a/chrome/browser/process_singleton_win.cc
+++ b/chrome/browser/process_singleton_win.cc
@@ -80,10 +80,12 @@ BOOL CALLBACK BrowserWindowEnumeration(HWND window, LPARAM param) {

View File

@@ -10,10 +10,10 @@ get this standardised, but in lieu of that, this makes MessagePort a
whole bunch more useful!
diff --git a/third_party/blink/renderer/core/messaging/message_port.cc b/third_party/blink/renderer/core/messaging/message_port.cc
index b72ede668172bd8202b1d52736e4eb4ffe84d619..7ec7e3883925b50b064682e8976d09b18222d637 100644
index a284d187968914b4304eb49362b2a8ccafa5e5c2..d6f8bf39c47cfc622dec5736d82ccc308d406cfa 100644
--- a/third_party/blink/renderer/core/messaging/message_port.cc
+++ b/third_party/blink/renderer/core/messaging/message_port.cc
@@ -166,6 +166,7 @@ void MessagePort::close() {
@@ -162,6 +162,7 @@ void MessagePort::close() {
Entangle(pipe.TakePort0());
}
closed_ = true;
@@ -22,7 +22,7 @@ index b72ede668172bd8202b1d52736e4eb4ffe84d619..7ec7e3883925b50b064682e8976d09b1
void MessagePort::Entangle(MessagePortDescriptor port) {
diff --git a/third_party/blink/renderer/core/messaging/message_port.h b/third_party/blink/renderer/core/messaging/message_port.h
index 30d13d1e47e3acc7df6ce5c627fd7b3a32c3edc4..f9baba3c6d13992508da48a13c97bb10c8ec56e0 100644
index c5e0fefac929d4a484488761741d42f2b002f7a1..83d7901d99ad01ba039ea1ffa3dbee2595fc31ff 100644
--- a/third_party/blink/renderer/core/messaging/message_port.h
+++ b/third_party/blink/renderer/core/messaging/message_port.h
@@ -120,6 +120,13 @@ class CORE_EXPORT MessagePort : public EventTargetWithInlineData,

View File

@@ -81,7 +81,7 @@ index 309422bcf85810db88a048bd0930c4072b41f234..759549f3046f4a897b597409b670bb1c
private:
const HWND hwnd_;
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn
index fe988e3bbcf0c9deb5592f24fdeda3016114e3bf..da82b0458d0c87cf4de793007b826984d010cbb2 100644
index 002b3ddfb0f77b787b74ee088578e3eb813d0192..a9003a98546bbfe78e2d30457a032218cc263441 100644
--- a/components/viz/service/BUILD.gn
+++ b/components/viz/service/BUILD.gn
@@ -139,6 +139,8 @@ viz_component("service") {
@@ -653,7 +653,7 @@ index de00e766ba17532e10dcf5d0fd31fa344920a9f7..7aaedf83ad22dcc1d2dd39a31cf7e08b
float scale_factor;
};
diff --git a/ui/gfx/mojom/ca_layer_params_mojom_traits.cc b/ui/gfx/mojom/ca_layer_params_mojom_traits.cc
index a80185658d82c67713e578d176955c442f0568ab..e29003b3b6def9a1f842139f4269893a2609a601 100644
index c7035798bd867f51b39f36f1be79293bf2b5cc12..131446361de812f9b915483bca2b6d2165b65e3d 100644
--- a/ui/gfx/mojom/ca_layer_params_mojom_traits.cc
+++ b/ui/gfx/mojom/ca_layer_params_mojom_traits.cc
@@ -52,6 +52,9 @@ bool StructTraits<gfx::mojom::CALayerParamsDataView, gfx::CALayerParams>::Read(

View File

@@ -103,10 +103,10 @@ index 4c4cc16db82d7434573f7740855fbe72d68815e6..f71290800b6bb51a39b1f86be36f02d6
string mime_type;
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc
index 44ea9794a42eb9d2f0bcff722a05e530dbfff10c..318da554d3326b376898689c80b576979c564c5e 100644
index 85e984259a1e067c76d57e5e54eb3ed1d9694ec0..dbe9e809898ee720c0670e9c6db73c38658613b2 100644
--- a/services/network/url_loader.cc
+++ b/services/network/url_loader.cc
@@ -468,6 +468,7 @@ URLLoader::URLLoader(
@@ -469,6 +469,7 @@ URLLoader::URLLoader(
mojo::SimpleWatcher::ArmingPolicy::MANUAL,
base::SequencedTaskRunnerHandle::Get()),
per_factory_corb_state_(context.GetMutableCorbState()),
@@ -114,7 +114,7 @@ index 44ea9794a42eb9d2f0bcff722a05e530dbfff10c..318da554d3326b376898689c80b57697
devtools_request_id_(request.devtools_request_id),
request_mode_(request.mode),
request_credentials_mode_(request.credentials_mode),
@@ -620,7 +621,7 @@ URLLoader::URLLoader(
@@ -636,7 +637,7 @@ URLLoader::URLLoader(
url_request_->SetRequestHeadersCallback(base::BindRepeating(
&URLLoader::SetRawRequestHeadersAndNotify, base::Unretained(this)));
@@ -123,7 +123,7 @@ index 44ea9794a42eb9d2f0bcff722a05e530dbfff10c..318da554d3326b376898689c80b57697
url_request_->SetResponseHeadersCallback(base::BindRepeating(
&URLLoader::SetRawResponseHeaders, base::Unretained(this)));
}
@@ -1347,6 +1348,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) {
@@ -1428,6 +1429,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) {
}
response_ = BuildResponseHead();
@@ -144,10 +144,10 @@ index 44ea9794a42eb9d2f0bcff722a05e530dbfff10c..318da554d3326b376898689c80b57697
// Parse and remove the Trust Tokens response headers, if any are expected,
diff --git a/services/network/url_loader.h b/services/network/url_loader.h
index abc8ecdcd717b06552af7cf5c4e4e8f60db16ec1..4f633b5a818388f6cfd30a15496c94dde1e2b48c 100644
index e235b3cc8657e081063709f6d2cd6e0b2e99f2b2..15b77b8648b905711df8551b1645b14dd7d6fd87 100644
--- a/services/network/url_loader.h
+++ b/services/network/url_loader.h
@@ -497,6 +497,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader
@@ -502,6 +502,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader
std::unique_ptr<ResourceScheduler::ScheduledResourceRequest>
resource_scheduler_request_handle_;

View File

@@ -0,0 +1,874 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: VerteDinde <keeleymhammond@gmail.com>
Date: Sun, 8 May 2022 17:21:12 -0700
Subject: feat: replace ad-hoc SetPublicFirstPartySets calls with method in
ContentBrowserClient
Cherry-picked from upstream Chromium. This patch can be removed when the
fix is inherited from the next Chromium roll backport.
This essentially requires
embedders to indicate whether they will
(maybe asynchronously) call SetPublicFirstPartySets during startup, or
not. This makes it easier to initialize First-Party Sets properly, since
it is now done via a pull-based interface rather than a push-based
interface (which would require code in every embedder in order to
set up the First-Party Sets backend). Now, there is a single place (in
content) that handles every embedder that won't need to explicitly call
SetPublicFirstPartySets at some point (e.g. after initializing
Component Updater, in Chrome's case).
Bug: 1321908
Change-Id: I47eaaaf77e548079e1bd6360fd573e877aa79b32
Reviewed-on:
https://chromium-review.googlesource.com/c/chromium/src/+/3623985
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
Cr-Commit-Position: refs/heads/main@{#999047}
Patch-Filename:
feat_move_firstpartysets_to_content_browser_client.patch
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index e07874dc5a2fab83dff0a07d35aeb0cad7a1a67c..9f635870282f0f2a9b8bfaaa59e34f91675dcda3 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -1601,10 +1601,6 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
// called inside PostProfileInit and depends on it.
if (!parsed_command_line().HasSwitch(switches::kDisableComponentUpdate)) {
component_updater::RegisterComponentsForUpdate();
- } else {
- // Initialize First-Party Sets even if component updater is disabled.
- content::FirstPartySetsHandler::GetInstance()->SetPublicFirstPartySets(
- base::File());
}
// TODO(stevenjb): Move WIN and MACOSX specific code to appropriate Parts.
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 3943c32ab29e785f401c2a5b31f1f6ed832514f0..939c28a029418bc353795aa1a007508680f42e57 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -6462,6 +6462,12 @@ bool ChromeContentBrowserClient::IsFirstPartySetsEnabled() {
return local_state->GetBoolean(first_party_sets::kFirstPartySetsEnabled);
}
+bool ChromeContentBrowserClient::WillProvidePublicFirstPartySets() {
+ return !base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableComponentUpdate) &&
+ base::FeatureList::IsEnabled(features::kFirstPartySets);
+}
+
base::Value::Dict ChromeContentBrowserClient::GetFirstPartySetsOverrides() {
if (!g_browser_process) {
// If browser process doesn't exist (e.g. in minimal mode on Android),
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index f0415a5099cdf181ab620fb6400db4f524c2c892..016b8276feeb6c35c88bc779ae84eea38d66f57d 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -772,6 +772,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
bool IsFindInPageDisabledForOrigin(const url::Origin& origin) override;
bool IsFirstPartySetsEnabled() override;
+ bool WillProvidePublicFirstPartySets() override;
base::Value::Dict GetFirstPartySetsOverrides() override;
bool ShouldPreconnectNavigation(
diff --git a/content/browser/first_party_sets/first_party_set_parser.cc b/content/browser/first_party_sets/first_party_set_parser.cc
index b03570f072f407a1d2c6a58646db0f48a845429d..3ac5c0d206c7910e5ae653004e96780c14c8315d 100644
--- a/content/browser/first_party_sets/first_party_set_parser.cc
+++ b/content/browser/first_party_sets/first_party_set_parser.cc
@@ -323,4 +323,4 @@ FirstPartySetParser::ParseSetsFromEnterprisePolicy(
return absl::nullopt;
}
-} // namespace content
+} // namespace content
\ No newline at end of file
diff --git a/content/browser/first_party_sets/first_party_set_parser.h b/content/browser/first_party_sets/first_party_set_parser.h
index 491a8b508ef0d093f37608d2fde615427b9319df..3f33b1604fecbff0d4db8739ad138d95223b579c 100644
--- a/content/browser/first_party_sets/first_party_set_parser.h
+++ b/content/browser/first_party_sets/first_party_set_parser.h
@@ -102,4 +102,4 @@ class CONTENT_EXPORT FirstPartySetParser {
} // namespace content
-#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SET_PARSER_H_
+#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SET_PARSER_H_
\ No newline at end of file
diff --git a/content/browser/first_party_sets/first_party_sets_handler_impl.cc b/content/browser/first_party_sets/first_party_sets_handler_impl.cc
index e5d277236b6393d35e8cf5a69c7f6d16f3394582..bb6840eecabfab9e9f0ae6b0fdc4e4436d1ea3b1 100644
--- a/content/browser/first_party_sets/first_party_sets_handler_impl.cc
+++ b/content/browser/first_party_sets/first_party_sets_handler_impl.cc
@@ -74,7 +74,8 @@ FirstPartySetsHandler* FirstPartySetsHandler::GetInstance() {
// static
FirstPartySetsHandlerImpl* FirstPartySetsHandlerImpl::GetInstance() {
static base::NoDestructor<FirstPartySetsHandlerImpl> instance(
- GetContentClient()->browser()->IsFirstPartySetsEnabled());
+ GetContentClient()->browser()->IsFirstPartySetsEnabled(),
+ GetContentClient()->browser()->WillProvidePublicFirstPartySets());
return instance.get();
}
@@ -89,8 +90,12 @@ FirstPartySetsHandler::ValidateEnterprisePolicy(
policy, /*out_sets=*/nullptr);
}
-FirstPartySetsHandlerImpl::FirstPartySetsHandlerImpl(bool enabled)
- : enabled_(enabled) {
+FirstPartySetsHandlerImpl::FirstPartySetsHandlerImpl(
+ bool enabled,
+ bool embedder_will_provide_public_sets)
+ : enabled_(enabled),
+ embedder_will_provide_public_sets_(enabled &&
+ embedder_will_provide_public_sets) {
sets_loader_ = std::make_unique<FirstPartySetsLoader>(
base::BindOnce(&FirstPartySetsHandlerImpl::SetCompleteSets,
// base::Unretained(this) is safe here because
@@ -112,12 +117,23 @@ void FirstPartySetsHandlerImpl::Init(const base::FilePath& user_data_dir,
const std::string& flag_value,
SetsReadyOnceCallback on_sets_ready) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(!initialized_);
+ DCHECK(persisted_sets_path_.empty());
+ DCHECK(on_sets_ready_.is_null());
+
+ initialized_ = true;
on_sets_ready_ = std::move(on_sets_ready);
SetPersistedSets(user_data_dir);
- SetManuallySpecifiedSet(flag_value);
- if (!IsEnabled())
+ if (IsEnabled()) {
+ DCHECK(!on_sets_ready_.is_null());
+ sets_loader_->SetManuallySpecifiedSet(flag_value);
+ if (!embedder_will_provide_public_sets_) {
+ sets_loader_->SetComponentSets(base::File());
+ }
+ } else {
SetCompleteSets({});
+ }
}
bool FirstPartySetsHandlerImpl::IsEnabled() const {
@@ -127,16 +143,17 @@ bool FirstPartySetsHandlerImpl::IsEnabled() const {
void FirstPartySetsHandlerImpl::SetPublicFirstPartySets(base::File sets_file) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (!IsEnabled()) {
- sets_loader_->DisposeFile(std::move(sets_file));
- return;
- }
+ DCHECK(enabled_);
+ DCHECK(embedder_will_provide_public_sets_);
sets_loader_->SetComponentSets(std::move(sets_file));
}
void FirstPartySetsHandlerImpl::ResetForTesting() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ initialized_ = false;
enabled_ = GetContentClient()->browser()->IsFirstPartySetsEnabled();
+ embedder_will_provide_public_sets_ =
+ GetContentClient()->browser()->WillProvidePublicFirstPartySets();
// Initializes the `sets_loader_` member with a callback to SetCompleteSets
// and the result of content::GetFirstPartySetsOverrides.
@@ -153,19 +170,16 @@ void FirstPartySetsHandlerImpl::ResetForTesting() {
raw_persisted_sets_ = absl::nullopt;
}
-void FirstPartySetsHandlerImpl::SetManuallySpecifiedSet(
- const std::string& flag_value) {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (!IsEnabled())
- return;
- sets_loader_->SetManuallySpecifiedSet(flag_value);
-}
-
void FirstPartySetsHandlerImpl::SetPersistedSets(
const base::FilePath& user_data_dir) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(!raw_persisted_sets_.has_value());
+ DCHECK(persisted_sets_path_.empty());
if (user_data_dir.empty()) {
VLOG(1) << "Empty path. Failed loading serialized First-Party Sets file.";
+ // We have to continue, in case the embedder has enabled FPS but has not
+ // provided a directory to store persisted sets.
+ OnReadPersistedSetsFile("");
return;
}
persisted_sets_path_ = user_data_dir.Append(kPersistedFirstPartySetsFileName);
@@ -184,19 +198,36 @@ void FirstPartySetsHandlerImpl::SetPersistedSets(
void FirstPartySetsHandlerImpl::OnReadPersistedSetsFile(
const std::string& raw_persisted_sets) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- DCHECK(!persisted_sets_path_.empty());
+ DCHECK(!raw_persisted_sets_.has_value());
raw_persisted_sets_ = raw_persisted_sets;
UmaHistogramTimes(
- "Cookie.FirstPartySets.InitializationDuration.ReadPersistedSets",
+ "Cookie.FirstPartySets.InitializationDuration.ReadPersistedSets2",
construction_timer_.Elapsed());
- ClearSiteDataOnChangedSetsIfReady();
+
+ if (sets_.has_value()) {
+ ClearSiteDataOnChangedSets();
+
+ if (IsEnabled()) {
+ DCHECK(!on_sets_ready_.is_null());
+ std::move(on_sets_ready_).Run(sets_.value());
+ }
+ }
}
void FirstPartySetsHandlerImpl::SetCompleteSets(
base::flat_map<net::SchemefulSite, net::SchemefulSite> sets) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(!sets_.has_value());
sets_ = std::move(sets);
- ClearSiteDataOnChangedSetsIfReady();
+
+ if (raw_persisted_sets_.has_value()) {
+ ClearSiteDataOnChangedSets();
+
+ if (IsEnabled()) {
+ DCHECK(!on_sets_ready_.is_null());
+ std::move(on_sets_ready_).Run(sets_.value());
+ }
+ }
}
// static
@@ -229,10 +260,10 @@ base::flat_set<net::SchemefulSite> FirstPartySetsHandlerImpl::ComputeSetsDiff(
return result;
}
-void FirstPartySetsHandlerImpl::ClearSiteDataOnChangedSetsIfReady() {
+void FirstPartySetsHandlerImpl::ClearSiteDataOnChangedSets() const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (!raw_persisted_sets_.has_value() || !sets_.has_value())
- return;
+ DCHECK(sets_.has_value());
+ DCHECK(raw_persisted_sets_.has_value());
base::flat_set<net::SchemefulSite> diff =
ComputeSetsDiff(FirstPartySetParser::DeserializeFirstPartySets(
@@ -241,14 +272,13 @@ void FirstPartySetsHandlerImpl::ClearSiteDataOnChangedSetsIfReady() {
// TODO(shuuran@chromium.org): Implement site state clearing.
- if (!on_sets_ready_.is_null() && IsEnabledAndReady())
- std::move(on_sets_ready_).Run(sets_.value());
-
- base::ThreadPool::PostTask(
- FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
- base::BindOnce(
- &MaybeWriteSetsToDisk, persisted_sets_path_,
- FirstPartySetParser::SerializeFirstPartySets(sets_.value())));
+ if (!persisted_sets_path_.empty()) {
+ base::ThreadPool::PostTask(
+ FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
+ base::BindOnce(
+ &MaybeWriteSetsToDisk, persisted_sets_path_,
+ FirstPartySetParser::SerializeFirstPartySets(sets_.value())));
+ }
}
bool FirstPartySetsHandlerImpl::IsEnabledAndReady() const {
@@ -256,4 +286,4 @@ bool FirstPartySetsHandlerImpl::IsEnabledAndReady() const {
return IsEnabled() && sets_.has_value();
}
-} // namespace content
+} // namespace content
\ No newline at end of file
diff --git a/content/browser/first_party_sets/first_party_sets_handler_impl.h b/content/browser/first_party_sets/first_party_sets_handler_impl.h
index a60adcd16b5b8911965f9a22c2e70b5044150758..829cd96245cbe39eeddecf2e0403f2ba1ab88793 100644
--- a/content/browser/first_party_sets/first_party_sets_handler_impl.h
+++ b/content/browser/first_party_sets/first_party_sets_handler_impl.h
@@ -55,10 +55,9 @@ class CONTENT_EXPORT FirstPartySetsHandlerImpl : public FirstPartySetsHandler {
// persisted sets, since we may still need to clear data from a previous
// invocation of Chromium which had First-Party Sets enabled.
//
- // TODO(https://crbug.com/1309188): Init() should be called in the
- // BrowserMainLoop::PreMainMessageLoopRun(). But just in case it's
- // accidentally called from other places, make sure it's no-op for the
- // following calls.
+ // If First-Party Sets is enabled, `on_sets_ready` must not be null.
+ //
+ // Must be called exactly once.
void Init(const base::FilePath& user_data_dir,
const std::string& flag_value,
SetsReadyOnceCallback on_sets_ready);
@@ -78,6 +77,11 @@ class CONTENT_EXPORT FirstPartySetsHandlerImpl : public FirstPartySetsHandler {
enabled_ = enabled;
}
+ void SetEmbedderWillProvidePublicSetsForTesting(bool will_provide) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ embedder_will_provide_public_sets_ = enabled_ && will_provide;
+ }
+
// Compares the map `old_sets` to `current_sets` and returns the set of sites
// that: 1) were in `old_sets` but are no longer in `current_sets`, i.e. leave
// the FPSs; or, 2) mapped to a different owner site.
@@ -92,41 +96,38 @@ class CONTENT_EXPORT FirstPartySetsHandlerImpl : public FirstPartySetsHandler {
private:
friend class base::NoDestructor<FirstPartySetsHandlerImpl>;
- explicit FirstPartySetsHandlerImpl(bool enabled);
+ FirstPartySetsHandlerImpl(bool enabled,
+ bool embedder_will_provide_public_sets);
// This method reads the persisted First-Party Sets from the file under
- // `user_data_dir`.
+ // `user_data_dir`. Must be called exactly once.
void SetPersistedSets(const base::FilePath& user_data_dir);
- // Stores the read persisted sets in `raw_persisted_sets_`.
+ // Stores the read persisted sets in `raw_persisted_sets_`. Must be called
+ // exactly once.
void OnReadPersistedSetsFile(const std::string& raw_persisted_sets);
- // Parses and sets the First-Party Set that was provided via the
- // `kUseFirstPartySet` flag/switch.
- //
- // Has no effect if `kFirstPartySets` is disabled, or
- // `SetPublicFirstPartySets` is not called.
- void SetManuallySpecifiedSet(const std::string& flag_value);
-
- // Sets the current First-Party Sets data.
+ // Sets the current First-Party Sets data. Must be called exactly once.
void SetCompleteSets(FlattenedSets sets);
- // Checks the required inputs have been received, and if so:
+ // Does the following:
// 1) computes the diff between the `sets_` and the parsed
// `raw_persisted_sets_`;
// 2) clears the site data of the set of sites based on the diff;
- // 3) calls `on_sets_ready_` if conditions are met;
- // 4) writes the current First-Party Sets to the file in
+ // 3) writes the current First-Party Sets to the file in
// `persisted_sets_path_`.
//
// TODO(shuuran@chromium.org): Implement the code to clear site state.
- void ClearSiteDataOnChangedSetsIfReady();
+ void ClearSiteDataOnChangedSets() const;
// Returns true if:
// * First-Party Sets are enabled;
// * `sets_` is ready to be used.
bool IsEnabledAndReady() const;
+ // Whether Init has been called already or not.
+ bool initialized_ = false;
+
// Represents the mapping of site -> site, where keys are members of sets, and
// values are owners of the sets. Owners are explicitly represented as members
// of the set.
@@ -144,6 +145,7 @@ class CONTENT_EXPORT FirstPartySetsHandlerImpl : public FirstPartySetsHandler {
base::FilePath persisted_sets_path_ GUARDED_BY_CONTEXT(sequence_checker_);
bool enabled_ GUARDED_BY_CONTEXT(sequence_checker_);
+ bool embedder_will_provide_public_sets_ GUARDED_BY_CONTEXT(sequence_checker_);
// We use a OnceCallback to ensure we only pass along the sets once
// during Chrome's lifetime (modulo reconfiguring the network service).
@@ -160,4 +162,4 @@ class CONTENT_EXPORT FirstPartySetsHandlerImpl : public FirstPartySetsHandler {
} // namespace content
-#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SETS_HANDLER_IMPL_H_
+#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SETS_HANDLER_IMPL_H_
\ No newline at end of file
diff --git a/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc b/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc
index 0c0eeda67a8a4bdc9876f5ad3fe78c06c4f18b5d..3e92801eb25e339e6b3a43b5fadab8f1b78b23f9 100644
--- a/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc
+++ b/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc
@@ -367,14 +367,6 @@ TEST_F(FirstPartySetsHandlerImplDisabledTest, IgnoresValid) {
FAIL(); // Should not be called.
}));
- // Set required inputs to be able to receive the merged sets from
- // FirstPartySetsLoader.
- const std::string input =
- "{\"owner\": \"https://example.test\",\"members\": "
- "[\"https://aaaa.test\"]}";
- ASSERT_TRUE(base::JSONReader::Read(input));
- SetPublicFirstPartySetsAndWait(input);
-
env().RunUntilIdle();
// TODO(shuuran@chromium.org): test site state is cleared.
@@ -397,9 +389,6 @@ TEST_F(FirstPartySetsHandlerImplDisabledTest,
FAIL(); // Should not be called.
}));
- SetPublicFirstPartySetsAndWait(R"({"owner": "https://example.test", )"
- R"("members": ["https://member.test"]})");
-
EXPECT_EQ(
FirstPartySetsHandlerImpl::GetInstance()->GetSetsIfEnabledAndReady(),
absl::nullopt);
@@ -413,11 +402,6 @@ class FirstPartySetsHandlerImplEnabledTest
};
TEST_F(FirstPartySetsHandlerImplEnabledTest, PersistedSetsNotReady) {
- const std::string input = R"({"owner": "https://foo.test", )"
- R"("members": ["https://member2.test"]})";
- ASSERT_TRUE(base::JSONReader::Read(input));
- SetPublicFirstPartySetsAndWait(input);
-
// Empty `user_data_dir` will fail loading persisted sets.
FirstPartySetsHandlerImpl::GetInstance()->Init(
/*user_data_dir=*/{},
@@ -431,6 +415,8 @@ TEST_F(FirstPartySetsHandlerImplEnabledTest, PersistedSetsNotReady) {
}
TEST_F(FirstPartySetsHandlerImplEnabledTest, PublicFirstPartySetsNotReady) {
+ FirstPartySetsHandlerImpl::GetInstance()
+ ->SetEmbedderWillProvidePublicSetsForTesting(true);
ASSERT_TRUE(base::WriteFile(persisted_sets_path_, "{}"));
// Persisted sets are expected to be loaded with the provided path.
@@ -447,6 +433,8 @@ TEST_F(FirstPartySetsHandlerImplEnabledTest, PublicFirstPartySetsNotReady) {
TEST_F(FirstPartySetsHandlerImplEnabledTest,
Successful_PersistedSetsFileNotExist) {
+ FirstPartySetsHandlerImpl::GetInstance()
+ ->SetEmbedderWillProvidePublicSetsForTesting(true);
const std::string input = R"({"owner": "https://foo.test", )"
R"("members": ["https://member2.test"]})";
ASSERT_TRUE(base::JSONReader::Read(input));
@@ -479,6 +467,8 @@ TEST_F(FirstPartySetsHandlerImplEnabledTest,
}
TEST_F(FirstPartySetsHandlerImplEnabledTest, Successful_PersistedSetsEmpty) {
+ FirstPartySetsHandlerImpl::GetInstance()
+ ->SetEmbedderWillProvidePublicSetsForTesting(true);
ASSERT_TRUE(base::WriteFile(persisted_sets_path_, "{}"));
const std::string input = R"({"owner": "https://foo.test", )"
@@ -514,6 +504,8 @@ TEST_F(FirstPartySetsHandlerImplEnabledTest, Successful_PersistedSetsEmpty) {
TEST_F(FirstPartySetsHandlerImplEnabledTest,
GetSetsIfEnabledAndReady_AfterSetsReady) {
+ FirstPartySetsHandlerImpl::GetInstance()
+ ->SetEmbedderWillProvidePublicSetsForTesting(true);
ASSERT_TRUE(base::WriteFile(persisted_sets_path_, "{}"));
const std::string input = R"({"owner": "https://example.test", )"
@@ -549,6 +541,8 @@ TEST_F(FirstPartySetsHandlerImplEnabledTest,
TEST_F(FirstPartySetsHandlerImplEnabledTest,
GetSetsIfEnabledAndReady_BeforeSetsReady) {
+ FirstPartySetsHandlerImpl::GetInstance()
+ ->SetEmbedderWillProvidePublicSetsForTesting(true);
ASSERT_TRUE(base::WriteFile(persisted_sets_path_, "{}"));
// Call GetSetsIfEnabledAndReady before the sets are ready.
diff --git a/content/browser/first_party_sets/first_party_sets_loader.cc b/content/browser/first_party_sets/first_party_sets_loader.cc
index 52acedfde41b85acfc9246121ccfd6e63290270e..c229815ff14160c4f325fb51473e3b4baf5a9891 100644
--- a/content/browser/first_party_sets/first_party_sets_loader.cc
+++ b/content/browser/first_party_sets/first_party_sets_loader.cc
@@ -20,6 +20,7 @@
#include "base/strings/string_split.h"
#include "base/task/thread_pool.h"
#include "base/values.h"
+#include "content/browser/first_party_sets/addition_overlaps_union_find.h"
#include "content/browser/first_party_sets/first_party_set_parser.h"
#include "net/base/schemeful_site.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
@@ -66,6 +67,37 @@ std::string ReadSetsFile(base::File sets_file) {
return base::ReadStreamToString(file.get(), &raw_sets) ? raw_sets : "";
}
+// Creates a set of SchemefulSites present with the given list of SingleSets.
+base::flat_set<net::SchemefulSite> FlattenSingleSetList(
+ const std::vector<content::FirstPartySetsLoader::SingleSet>& sets) {
+ std::vector<net::SchemefulSite> sites;
+ for (const content::FirstPartySetsLoader::SingleSet& set : sets) {
+ sites.push_back(set.first);
+ sites.insert(sites.end(), set.second.begin(), set.second.end());
+ }
+ return sites;
+}
+
+// Populates the `policy_set_overlaps` out-parameter by checking
+// `existing_sets`. If `site` is equal to an existing site e in `sets`, then
+// `policy_set_index` will be added to the list of set indices at
+// `policy_set_overlaps`[e].
+void AddIfPolicySetOverlaps(
+ const net::SchemefulSite& site,
+ size_t policy_set_index,
+ FirstPartySetsLoader::FlattenedSets existing_sets,
+ base::flat_map<net::SchemefulSite, base::flat_set<size_t>>&
+ policy_set_overlaps) {
+ // Check `site` for membership in `existing_sets`.
+ if (auto it = existing_sets.find(site); it != existing_sets.end()) {
+ // Add the index of `site`'s policy set to the list of policy set indices
+ // that also overlap with site_owner.
+ auto [site_and_sets, inserted] =
+ policy_set_overlaps.insert({it->second, {}});
+ site_and_sets->second.insert(policy_set_index);
+ }
+}
+
} // namespace
FirstPartySetsLoader::FirstPartySetsLoader(
@@ -89,7 +121,7 @@ void FirstPartySetsLoader::SetManuallySpecifiedSet(
manually_specified_set_ = {CanonicalizeSet(base::SplitString(
flag_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY))};
UmaHistogramTimes(
- "Cookie.FirstPartySets.InitializationDuration.ReadCommandLineSet",
+ "Cookie.FirstPartySets.InitializationDuration.ReadCommandLineSet2",
construction_timer_.Elapsed());
MaybeFinishLoading();
@@ -127,7 +159,7 @@ void FirstPartySetsLoader::OnReadSetsFile(const std::string& raw_sets) {
component_sets_parse_progress_ = Progress::kFinished;
UmaHistogramTimes(
- "Cookie.FirstPartySets.InitializationDuration.ReadComponentSets",
+ "Cookie.FirstPartySets.InitializationDuration.ReadComponentSets2",
construction_timer_.Elapsed());
MaybeFinishLoading();
}
@@ -144,33 +176,141 @@ void FirstPartySetsLoader::DisposeFile(base::File sets_file) {
}
}
+std::vector<FirstPartySetsLoader::SingleSet>
+FirstPartySetsLoader::NormalizeAdditionSets(
+ const FlattenedSets& existing_sets,
+ const std::vector<SingleSet>& addition_sets) {
+ // Create a mapping from an owner site in `existing_sets` to all policy sets
+ // that intersect with the set that it owns.
+ base::flat_map<net::SchemefulSite, base::flat_set<size_t>>
+ policy_set_overlaps;
+ for (size_t set_idx = 0; set_idx < addition_sets.size(); set_idx++) {
+ const net::SchemefulSite& owner = addition_sets[set_idx].first;
+ AddIfPolicySetOverlaps(owner, set_idx, existing_sets, policy_set_overlaps);
+ for (const net::SchemefulSite& member : addition_sets[set_idx].second) {
+ AddIfPolicySetOverlaps(member, set_idx, existing_sets,
+ policy_set_overlaps);
+ }
+ }
+
+ AdditionOverlapsUnionFind union_finder(addition_sets.size());
+ for (auto& [public_site, policy_set_indices] : policy_set_overlaps) {
+ // Union together all overlapping policy sets to determine which one will
+ // take ownership.
+ for (size_t representative : policy_set_indices) {
+ union_finder.Union(*policy_set_indices.begin(), representative);
+ }
+ }
+
+ // The union-find data structure now knows which policy set should be given
+ // the role of representative for each entry in policy_set_overlaps.
+ // AdditionOverlapsUnionFind::SetsMapping returns a map from representative
+ // index to list of its children.
+ std::vector<SingleSet> normalized_additions;
+ for (auto& [rep, children] : union_finder.SetsMapping()) {
+ SingleSet normalized = addition_sets[rep];
+ for (size_t child_set_idx : children) {
+ // Update normalized to absorb the child_set_idx-th addition set.
+ const SingleSet& child_set = addition_sets[child_set_idx];
+ normalized.second.insert(child_set.first);
+ normalized.second.insert(child_set.second.begin(),
+ child_set.second.end());
+ }
+ normalized_additions.push_back(normalized);
+ }
+ return normalized_additions;
+}
+
void FirstPartySetsLoader::ApplyManuallySpecifiedSet() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- DCHECK_EQ(component_sets_parse_progress_, Progress::kFinished);
- DCHECK(manually_specified_set_.has_value());
+ DCHECK(HasAllInputs());
if (!manually_specified_set_.value().has_value())
return;
+ ApplyReplacementOverrides({manually_specified_set_->value()});
+ RemoveAllSingletons();
+}
+
+void FirstPartySetsLoader::ApplyReplacementOverrides(
+ const std::vector<SingleSet>& override_sets) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(HasAllInputs());
+
+ base::flat_set<net::SchemefulSite> all_override_sites =
+ FlattenSingleSetList(override_sets);
+
+ // Erase the intersection between |sets_| and the list of |override_sets| and
+ // any members whose owner was in the intersection.
+ base::EraseIf(
+ sets_, [&all_override_sites](
+ const std::pair<net::SchemefulSite, net::SchemefulSite>& p) {
+ return all_override_sites.contains(p.first) ||
+ all_override_sites.contains(p.second);
+ });
+
+ // Next, we must add each site in the override_sets to |sets_|.
+ for (auto& [owner, members] : override_sets) {
+ sets_.emplace(owner, owner);
+ for (const net::SchemefulSite& member : members) {
+ sets_.emplace(member, owner);
+ }
+ }
+}
+
+void FirstPartySetsLoader::ApplyAdditionOverrides(
+ const std::vector<SingleSet>& new_sets) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(HasAllInputs());
+
+ if (new_sets.empty())
+ return;
- const net::SchemefulSite& manual_owner =
- manually_specified_set_.value()->first;
- const base::flat_set<net::SchemefulSite>& manual_members =
- manually_specified_set_.value()->second;
+ std::vector<SingleSet> normalized_additions =
+ NormalizeAdditionSets(sets_, new_sets);
- const auto was_manually_provided =
- [&manual_members, &manual_owner](const net::SchemefulSite& site) {
- return site == manual_owner || manual_members.contains(site);
- };
+ FlattenedSets flattened_additions;
+ for (const auto& [owner, members] : normalized_additions) {
+ for (const net::SchemefulSite& member : members)
+ flattened_additions.emplace(member, owner);
+ flattened_additions.emplace(owner, owner);
+ }
- // Erase the intersection between the manually-specified set and the
- // CU-supplied set, and any members whose owner was in the intersection.
- base::EraseIf(sets_, [&was_manually_provided](const auto& p) {
- return was_manually_provided(p.first) || was_manually_provided(p.second);
- });
+ // Identify intersections between addition sets and existing sets. This will
+ // be used to reparent existing sets if they intersect with an addition set.
+ //
+ // Since we reparent every member of an existing set (regardless of whether
+ // the intersection was via one of its members or its owner), we just keep
+ // track of the set itself, via its owner.
+ base::flat_map<net::SchemefulSite, net::SchemefulSite> owners_in_intersection;
+ for (const auto& [site, owner] : flattened_additions) {
+ // Found an overlap with an existing set. Add the existing owner to the
+ // map.
+ if (auto it = sets_.find(site); it != sets_.end()) {
+ owners_in_intersection[it->second] = owner;
+ }
+ }
+
+ // Update the (site, owner) mappings in sets_ such that if owner is in the
+ // intersection, then the site is mapped to owners_in_intersection[owner].
+ //
+ // This reparents existing sets to their owner given by the normalized
+ // addition sets.
+ for (auto& [site, owner] : sets_) {
+ if (auto owner_entry = owners_in_intersection.find(owner);
+ owner_entry != owners_in_intersection.end()) {
+ owner = owner_entry->second;
+ }
+ }
- // Now remove singleton sets. We already removed any sites that were part
- // of the intersection, or whose owner was part of the intersection. This
- // leaves sites that *are* owners, which no longer have any (other)
- // members.
+ // Since the intersection between sets_ and flattened_additions has already
+ // been updated above, we can insert flattened_additions into sets_ without
+ // affecting any existing mappings in sets_.
+ sets_.insert(flattened_additions.begin(), flattened_additions.end());
+}
+
+void FirstPartySetsLoader::RemoveAllSingletons() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ // Now remove singleton sets, which are sets that just contain sites that
+ // *are* owners, but no longer have any (other) members.
std::set<net::SchemefulSite> owners_with_members;
for (const auto& it : sets_) {
if (it.first != it.second)
@@ -179,21 +319,29 @@ void FirstPartySetsLoader::ApplyManuallySpecifiedSet() {
base::EraseIf(sets_, [&owners_with_members](const auto& p) {
return p.first == p.second && !base::Contains(owners_with_members, p.first);
});
+}
- // Next, we must add the manually-added set to the parsed value.
- for (const net::SchemefulSite& member : manual_members) {
- sets_.emplace(member, manual_owner);
- }
- sets_.emplace(manual_owner, manual_owner);
+void FirstPartySetsLoader::ApplyAllPolicyOverrides() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(HasAllInputs());
+ ApplyReplacementOverrides(policy_overrides_.replacements);
+ ApplyAdditionOverrides(policy_overrides_.additions);
+ RemoveAllSingletons();
}
void FirstPartySetsLoader::MaybeFinishLoading() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (component_sets_parse_progress_ != Progress::kFinished ||
- !manually_specified_set_.has_value())
+ if (!HasAllInputs())
return;
ApplyManuallySpecifiedSet();
+ ApplyAllPolicyOverrides();
std::move(on_load_complete_).Run(std::move(sets_));
}
-} // namespace content
+bool FirstPartySetsLoader::HasAllInputs() const {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ return component_sets_parse_progress_ == Progress::kFinished &&
+ manually_specified_set_.has_value();
+}
+
+} // namespace content
\ No newline at end of file
diff --git a/content/browser/first_party_sets/first_party_sets_loader.h b/content/browser/first_party_sets/first_party_sets_loader.h
index c27d2300c4c3533df91a8e814e89827bbd7d72ae..8588fe5f9922b36c9fe8e16ac16d02ccf00c8723 100644
--- a/content/browser/first_party_sets/first_party_sets_loader.h
+++ b/content/browser/first_party_sets/first_party_sets_loader.h
@@ -57,6 +57,19 @@ class CONTENT_EXPORT FirstPartySetsLoader {
// Close the file on thread pool that allows blocking.
void DisposeFile(base::File sets_file);
+ // Handles addition sets which overlap by intersecting with the same existing
+ // set, known as a transitive-overlap.
+ //
+ // This uses a Union-Find algorithm to select the earliest-provided addition
+ // set as the representative of all other addition sets that
+ // transitively-overlap with it.
+ //
+ // The "earliest-provided" tie-breaker is determined using a set's index in
+ // `addition_sets`.
+ static std::vector<SingleSet> NormalizeAdditionSets(
+ const FlattenedSets& existing_sets,
+ const std::vector<SingleSet>& addition_sets);
+
private:
// Parses the contents of `raw_sets` as a collection of First-Party Set
// declarations, and assigns to `sets_`.
@@ -67,10 +80,42 @@ class CONTENT_EXPORT FirstPartySetsLoader {
// `SetManuallySpecifiedSet`, and the public sets via `SetComponentSets`.
void ApplyManuallySpecifiedSet();
+ // Removes the intersection between `sets_` and `override_sets` from the
+ // `sets_` member variable, and then adds the `override_sets` into `sets_`.
+ void ApplyReplacementOverrides(const std::vector<SingleSet>& override_sets);
+
+ // Updates the intersection between `sets_` and `override_sets` within the
+ // `sets_` member variable, and then adds the `override_sets` into
+ // `sets_`.
+ //
+ // The applied update ensures that invariants of First-Party Sets are
+ // maintained, and that all sets in sets_ are disjoint.
+ //
+ // This will add in the `override_sets` into `sets_` without removing
+ // any existing sites from the list of First-Party Sets.
+ void ApplyAdditionOverrides(const std::vector<SingleSet>& override_sets);
+
+ // Removes all singletons (owners that have no members) from sets_.
+ void RemoveAllSingletons();
+
+ // Applies the First-Party Sets overrides provided by policy.
+ //
+ // Must not be called until the loader has already received the public sets
+ // via `SetComponentSets` and the CLI-provided sets have been applied to
+ // `sets_`.
+ //
+ // Applies "Replacement" overrides before applying "Addition" overrides.
+ void ApplyAllPolicyOverrides();
+
// Checks the required inputs have been received, and if so, invokes the
// callback `on_load_complete_`, after merging sets appropriately.
void MaybeFinishLoading();
+ // Returns true if all sources are present (Component Updater sets, CLI set,
+ // and Policy sets). The Policy sets are provided at construction time, so
+ // this effectively checks that the other two sources are ready.
+ bool HasAllInputs() const;
+
// Represents the mapping of site -> site, where keys are members of sets,
// and values are owners of the sets (explicitly including an entry of owner
// -> owner).
@@ -117,4 +162,4 @@ class CONTENT_EXPORT FirstPartySetsLoader {
} // namespace content
-#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SETS_LOADER_H_
+#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SETS_LOADER_H_
\ No newline at end of file
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 16fb4946cb3ea2d097e8ed05bb340cc3f0782ed6..b751bf43d41a149579047faeec958646ecc3a5e0 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -1327,6 +1327,10 @@ bool ContentBrowserClient::IsFirstPartySetsEnabled() {
return base::FeatureList::IsEnabled(features::kFirstPartySets);
}
+bool ContentBrowserClient::WillProvidePublicFirstPartySets() {
+ return false;
+}
+
base::Value::Dict ContentBrowserClient::GetFirstPartySetsOverrides() {
return base::Value::Dict();
}
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index 4db1e6c2dbea27249ca15d5660b7fcd8c6736ad1..8aac2a95a3ac66f0b0c180f46ec29ca7341a1d4c 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -2227,6 +2227,16 @@ class CONTENT_EXPORT ContentBrowserClient {
// should not change in a single browser session.
virtual bool IsFirstPartySetsEnabled();
+ // Returns true iff the embedder will provide a list of First-Party Sets via
+ // content::FirstPartySetsHandler::SetPublicFirstPartySets during startup, at
+ // some point. If `IsFirstPartySetsEnabled()` returns false, this method will
+ // still be called, but its return value will be ignored.
+ //
+ // If this method returns false but `IsFirstPartySetsEnabled()` returns true
+ // (e.g. in tests), an empty list will be used instead of waiting for the
+ // embedder to call content::FirstPartySetsHandler::SetPublicFirstPartySets.
+ virtual bool WillProvidePublicFirstPartySets();
+
// Returns a base::Value::Dict containing the value of the First-Party Sets
// Overrides enterprise policy.
// If the policy was not present or it was invalid, this returns an empty
diff --git a/content/public/browser/first_party_sets_handler.h b/content/public/browser/first_party_sets_handler.h
index 8bd62717732a4afe1e8c02fd5ceb39bd1790e3e0..3ff5dea5612fe3329c7c612818f1436a980ea9e3 100644
--- a/content/public/browser/first_party_sets_handler.h
+++ b/content/public/browser/first_party_sets_handler.h
@@ -72,7 +72,9 @@ class CONTENT_EXPORT FirstPartySetsHandler {
//
// Embedder should call this method as early as possible during browser
// startup if First-Party Sets are enabled, since no First-Party Sets queries
- // are answered until initialization is complete.
+ // are answered until initialization is complete. Must not be called if
+ // `ContentBrowserClient::WillProvidePublicFirstPartySets` returns false or
+ // `ContentBrowserClient::IsFrstpartySetsEnabled` returns false.
virtual void SetPublicFirstPartySets(base::File sets_file) = 0;
// Resets the state on the instance for testing.
diff --git a/content/shell/browser/shell_browser_main_parts.cc b/content/shell/browser/shell_browser_main_parts.cc
index 89040432c9f56d8285d8e9f59e1e0280abc25199..bd412789695f49253f67f237b2a92b8dee298e7a 100644
--- a/content/shell/browser/shell_browser_main_parts.cc
+++ b/content/shell/browser/shell_browser_main_parts.cc
@@ -189,8 +189,6 @@ int ShellBrowserMainParts::PreMainMessageLoopRun() {
net::NetModule::SetResourceProvider(PlatformResourceProvider);
ShellDevToolsManagerDelegate::StartHttpHandler(browser_context_.get());
InitializeMessageLoopContext();
- // The First-Party Sets feature always expects to be initialized
- FirstPartySetsHandler::GetInstance()->SetPublicFirstPartySets(base::File());
return 0;
}

View File

@@ -16,7 +16,7 @@ Linux or Windows to un-fullscreen in some circumstances without this
change.
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
index ac9f8b06b066adb53a92cb1768e21d6b6e9be2a8..ebc0f0fe568d7219486360bbe4b6c65e415735e4 100644
index 467fed776d390e1a10075d62dab75fd8a6789627..d6f3c20fabee755373add6ee1e5722c106204e42 100644
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
@@ -16,12 +16,16 @@
@@ -36,7 +36,7 @@ index ac9f8b06b066adb53a92cb1768e21d6b6e9be2a8..ebc0f0fe568d7219486360bbe4b6c65e
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
@@ -165,6 +169,7 @@ void FullscreenController::EnterFullscreenModeForTab(
@@ -164,6 +168,7 @@ void FullscreenController::EnterFullscreenModeForTab(
return;
}
@@ -44,7 +44,7 @@ index ac9f8b06b066adb53a92cb1768e21d6b6e9be2a8..ebc0f0fe568d7219486360bbe4b6c65e
if (base::FeatureList::IsEnabled(
blink::features::kWindowPlacementFullscreenCompanionWindow)) {
if (!popunder_preventer_)
@@ -172,6 +177,7 @@ void FullscreenController::EnterFullscreenModeForTab(
@@ -171,6 +176,7 @@ void FullscreenController::EnterFullscreenModeForTab(
else
popunder_preventer_->WillActivateWebContents(web_contents);
}
@@ -52,7 +52,7 @@ index ac9f8b06b066adb53a92cb1768e21d6b6e9be2a8..ebc0f0fe568d7219486360bbe4b6c65e
// Keep the current state. |SetTabWithExclusiveAccess| may change the return
// value of |IsWindowFullscreenForTabOrPending|.
@@ -221,7 +227,9 @@ void FullscreenController::EnterFullscreenModeForTab(
@@ -220,7 +226,9 @@ void FullscreenController::EnterFullscreenModeForTab(
}
void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
@@ -62,7 +62,7 @@ index ac9f8b06b066adb53a92cb1768e21d6b6e9be2a8..ebc0f0fe568d7219486360bbe4b6c65e
if (MaybeToggleFullscreenWithinTab(web_contents, false)) {
// During tab capture of fullscreen-within-tab views, the browser window
@@ -276,11 +284,13 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
@@ -275,11 +283,13 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
void FullscreenController::FullscreenTabOpeningPopup(
content::WebContents* opener,
content::WebContents* popup) {
@@ -76,7 +76,7 @@ index ac9f8b06b066adb53a92cb1768e21d6b6e9be2a8..ebc0f0fe568d7219486360bbe4b6c65e
}
void FullscreenController::OnTabDeactivated(
@@ -443,17 +453,15 @@ void FullscreenController::EnterFullscreenModeInternal(
@@ -429,17 +439,15 @@ void FullscreenController::EnterFullscreenModeInternal(
// Do not enter fullscreen mode if disallowed by pref. This prevents the user
// from manually entering fullscreen mode and also disables kiosk mode on
// desktop platforms.
@@ -90,7 +90,7 @@ index ac9f8b06b066adb53a92cb1768e21d6b6e9be2a8..ebc0f0fe568d7219486360bbe4b6c65e
return;
- }
#endif
started_fullscreen_transition_ = true;
toggled_into_fullscreen_ = true;
+#if 0
bool entering_tab_fullscreen = option == TAB && !tab_fullscreen_;
@@ -98,7 +98,7 @@ index ac9f8b06b066adb53a92cb1768e21d6b6e9be2a8..ebc0f0fe568d7219486360bbe4b6c65e
GURL url;
if (option == TAB) {
url = GetRequestingOrigin();
@@ -463,6 +471,7 @@ void FullscreenController::EnterFullscreenModeInternal(
@@ -449,6 +457,7 @@ void FullscreenController::EnterFullscreenModeInternal(
url = extension_caused_fullscreen_;
}
@@ -106,7 +106,7 @@ index ac9f8b06b066adb53a92cb1768e21d6b6e9be2a8..ebc0f0fe568d7219486360bbe4b6c65e
if (option == TAB && display_id != display::kInvalidDisplayId) {
// Check, but do not prompt, for permission to request a specific screen.
// Sites generally need permission to get the display id in the first place.
@@ -480,6 +489,7 @@ void FullscreenController::EnterFullscreenModeInternal(
@@ -466,6 +475,7 @@ void FullscreenController::EnterFullscreenModeInternal(
GetDisplayId(WebContents::FromRenderFrameHost(requesting_frame));
}
}
@@ -114,10 +114,10 @@ index ac9f8b06b066adb53a92cb1768e21d6b6e9be2a8..ebc0f0fe568d7219486360bbe4b6c65e
if (option == BROWSER)
base::RecordAction(base::UserMetricsAction("ToggleFullscreen"));
@@ -507,12 +517,12 @@ void FullscreenController::ExitFullscreenModeInternal() {
@@ -492,12 +502,12 @@ void FullscreenController::ExitFullscreenModeInternal() {
RecordExitingUMA();
toggled_into_fullscreen_ = false;
started_fullscreen_transition_ = true;
-#if BUILDFLAG(IS_MAC)
- // Mac windows report a state change instantly, and so we must also clear
+
@@ -131,10 +131,10 @@ index ac9f8b06b066adb53a92cb1768e21d6b6e9be2a8..ebc0f0fe568d7219486360bbe4b6c65e
extension_caused_fullscreen_ = GURL();
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.h b/chrome/browser/ui/exclusive_access/fullscreen_controller.h
index f0841982cb296079c8b943067564d74bc1b7067c..49f59fc2c12c98faada52e0e7c8c9c6e6251b599 100644
index 58a1ff5fb9fecd8c85905045ba43f43f0c63c2bb..15f868ac651c05eae6505adb80f2b4573a1166ef 100644
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller.h
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.h
@@ -242,10 +242,12 @@ class FullscreenController : public ExclusiveAccessControllerBase {
@@ -224,10 +224,12 @@ class FullscreenController : public ExclusiveAccessControllerBase {
// Used in testing to set the state to tab fullscreen.
bool is_tab_fullscreen_for_testing_ = false;

View File

@@ -6,10 +6,10 @@ Subject: fix: export zlib symbols
This patch sets ZLIB_DLL so that we properly export zlib symbols.
diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn
index 999b1de1b2ba1fff5dd92173300dc22b9aa5a865..2132d8ef92acd39bffe3bebddb80b4317e1f52b8 100644
index 49f52e1f8b1e505481a124a55ab91a7dd5ec571c..2cb7ee4f708808433e638bf62cb9a465c3651944 100644
--- a/third_party/zlib/BUILD.gn
+++ b/third_party/zlib/BUILD.gn
@@ -313,6 +313,10 @@ component("zlib") {
@@ -312,6 +312,10 @@ component("zlib") {
defines = []
deps = []

View File

@@ -8,10 +8,10 @@ we invoke it in order to expose contents.decrementCapturerCount([stayHidden, sta
to users. We should try to upstream this.
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index df1633d59070e19592a52f02a76bdd9006d7c6f0..e599e866d2f5e72259e5b34b65510a06b3209784 100644
index 2a29af8d9aa67768ec521e87190174397a25b722..7a5ce3038427756c26e38c91c5b3211a9a8999dd 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -1820,7 +1820,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
@@ -1828,7 +1828,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
// IncrementCapturerCount() is destructed.
void DecrementCapturerCount(bool stay_hidden,
bool stay_awake,

View File

@@ -59,10 +59,10 @@ index ad366d0fd4c3a637d75a102ab56984f0d01bfc04..d63eb133fd4bab1ea309bb8c742acf88
// true if register successfully, or false if 1) the specificied |accelerator|
// has been registered by another caller or other native applications, or
diff --git a/content/browser/media/media_keys_listener_manager_impl.cc b/content/browser/media/media_keys_listener_manager_impl.cc
index b954f8dde00d4f5257223c464e9145a6bef48900..b58999f295586a61bcc2648488a8b28f15d80a7e 100644
index b954f8dde00d4f5257223c464e9145a6bef48900..ee9da826014d3aae9675daac6cdbc0f447a14efd 100644
--- a/content/browser/media/media_keys_listener_manager_impl.cc
+++ b/content/browser/media/media_keys_listener_manager_impl.cc
@@ -56,7 +56,12 @@ bool MediaKeysListenerManagerImpl::StartWatchingMediaKey(
@@ -56,7 +56,11 @@ bool MediaKeysListenerManagerImpl::StartWatchingMediaKey(
CanActiveMediaSessionControllerReceiveEvents();
// Tell the underlying MediaKeysListener to listen for the key.
@@ -71,12 +71,11 @@ index b954f8dde00d4f5257223c464e9145a6bef48900..b58999f295586a61bcc2648488a8b28f
+#if BUILDFLAG(IS_MAC)
+ !media_key_handling_enabled_ &&
+#endif // BUILDFLAG(IS_MAC)
+ should_start_watching &&
+ media_keys_listener_ &&
+ should_start_watching && media_keys_listener_ &&
!media_keys_listener_->StartWatchingMediaKey(key_code)) {
return false;
}
@@ -239,18 +244,18 @@ void MediaKeysListenerManagerImpl::StartListeningForMediaKeysIfNecessary() {
@@ -239,6 +243,7 @@ void MediaKeysListenerManagerImpl::StartListeningForMediaKeysIfNecessary() {
#endif
if (system_media_controls_) {
@@ -84,19 +83,22 @@ index b954f8dde00d4f5257223c464e9145a6bef48900..b58999f295586a61bcc2648488a8b28f
system_media_controls_->AddObserver(this);
system_media_controls_notifier_ =
std::make_unique<SystemMediaControlsNotifier>(
system_media_controls_.get());
- } else {
- // If we can't access system media controls, then directly listen for media
- // key keypresses instead.
- media_keys_listener_ = ui::MediaKeysListener::Create(
- this, ui::MediaKeysListener::Scope::kGlobal);
- DCHECK(media_keys_listener_);
@@ -251,6 +256,19 @@ void MediaKeysListenerManagerImpl::StartListeningForMediaKeysIfNecessary() {
DCHECK(media_keys_listener_);
}
+ // Directly listen for media key keypresses when using GlobalShortcuts.
+ media_keys_listener_ = ui::MediaKeysListener::Create(
+ this, ui::MediaKeysListener::Scope::kGlobal);
+ DCHECK(media_keys_listener_);
+#if BUILDFLAG(IS_MAC)
+ // Chromium's implementation of SystemMediaControls falls
+ // down into MPRemoteCommandCenter, which makes it such that an app will not
+ // will not receive remote control events until it begins playing audio.
+ // If there's not already a MediaKeysListener instance, create one so
+ // that globalShortcuts work correctly.
+ if (!media_keys_listener_) {
+ media_keys_listener_ = ui::MediaKeysListener::Create(
+ this, ui::MediaKeysListener::Scope::kGlobal);
+ DCHECK(media_keys_listener_);
+ }
+#endif
+
EnsureAuxiliaryServices();
}

View File

@@ -7,10 +7,10 @@ This tweaks Chrome's Accessibility support at chrome://accessibility
to make it usable from Electron by removing Profile references.
diff --git a/chrome/browser/accessibility/accessibility_ui.cc b/chrome/browser/accessibility/accessibility_ui.cc
index 35568a00ef94ca0db2cbb0325634ce8d2a881e12..a8ea8eaabb7cf3248b19af93bf5002f88e23fd8d 100644
index ee30fddfeb034d14ae05cb5957026f65f32a4fd4..aa38a6e0cc4c0ac57469bb67c85dae3b8ce19bc2 100644
--- a/chrome/browser/accessibility/accessibility_ui.cc
+++ b/chrome/browser/accessibility/accessibility_ui.cc
@@ -22,7 +22,10 @@
@@ -21,7 +21,10 @@
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"

View File

@@ -100,10 +100,10 @@ index b7ba6ba4446963b08bce9fe416379169bd880378..7c621ea7a60725d08ee9ade68b65fd5b
} else {
// No need to bother, we don't know how many pages are available.
diff --git a/ui/gtk/printing/print_dialog_gtk.cc b/ui/gtk/printing/print_dialog_gtk.cc
index d0143dc64f818ee662694576ce2aa9488114f1c7..e3cbaa1b9c91805f8a4f81e110c8a85591b5f380 100644
index 804166d8844da5bd889f014e79d59d0cd75f5490..35ef412756a2c63394e5f2587b5bc73eadae4d60 100644
--- a/ui/gtk/printing/print_dialog_gtk.cc
+++ b/ui/gtk/printing/print_dialog_gtk.cc
@@ -242,6 +242,24 @@ void PrintDialogGtk::UpdateSettings(
@@ -239,6 +239,24 @@ void PrintDialogGtk::UpdateSettings(
gtk_print_settings_set_n_copies(gtk_settings_, settings->copies());
gtk_print_settings_set_collate(gtk_settings_, settings->collate());

View File

@@ -0,0 +1,53 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Thu, 24 Sep 2020 11:10:41 -0700
Subject: fix: use electron generated resources
This patch fixes a few instances where we need to use Electron generated
resources for IDS strings, or the IDs will be wrong and cause DCHECKS
as they will loaded as empty strings.
* IDS_UTILITY_PROCESS_UTILITY_WIN_NAME on Windows
* IDR_PDF_MANIFEST on Linux
* IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME on Windows
diff --git a/chrome/browser/pdf/pdf_extension_util.cc b/chrome/browser/pdf/pdf_extension_util.cc
index 441c28828328b72b625db10c5dca85f1f2349482..17973b511994cf32da051d144fc893a87fbb1d0c 100644
--- a/chrome/browser/pdf/pdf_extension_util.cc
+++ b/chrome/browser/pdf/pdf_extension_util.cc
@@ -11,8 +11,7 @@
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/common/chrome_content_client.h"
-#include "chrome/grit/browser_resources.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "components/strings/grit/components_strings.h"
#include "components/zoom/page_zoom_constants.h"
#include "ui/base/l10n/l10n_util.h"
diff --git a/chrome/browser/printing/printing_service.cc b/chrome/browser/printing/printing_service.cc
index 6d18517898c11c6a628cec2eade57fe845827b3d..a21f52e8a3c6f80d69b27faae4b77700fdd09e35 100644
--- a/chrome/browser/printing/printing_service.cc
+++ b/chrome/browser/printing/printing_service.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/printing/printing_service.h"
#include "base/no_destructor.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "chrome/services/printing/public/mojom/printing_service.mojom.h"
#include "content/public/browser/service_process_host.h"
diff --git a/chrome/browser/win/icon_reader_service.cc b/chrome/browser/win/icon_reader_service.cc
index d5497a7e26cdb66c7c074bc509e2bfec7d7875cd..62d2f555253eef903bd04ff1a0ad37d1470309e0 100644
--- a/chrome/browser/win/icon_reader_service.cc
+++ b/chrome/browser/win/icon_reader_service.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/win/icon_reader_service.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "chrome/services/util_win/public/mojom/util_read_icon.mojom.h"
#include "content/public/browser/service_process_host.h"

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 2b8e23df6545ca438c4af8434120cc40c70e09ec..049350bc63d627e85b239d23b976c3a62381fd57 100644
index b17180351e6e693352fcda973bdc23da79d8bfac..307ea58a72fe05f283b2cdfd6027625f96c5a99b 100644
--- a/content/browser/renderer_host/render_frame_host_manager.cc
+++ b/content/browser/renderer_host/render_frame_host_manager.cc
@@ -3206,6 +3206,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
@@ -3167,6 +3167,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
request->ResetStateForSiteInstanceChange();
}
@@ -20,10 +20,10 @@ index 2b8e23df6545ca438c4af8434120cc40c70e09ec..049350bc63d627e85b239d23b976c3a6
}
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index f6d98708c436447ee6c93acb5d476719c238ca9c..505279149690d469fa979010435373e40a5c8c43 100644
index 9b988bb631ab759739ae01c918efb1d563d5aafc..4db1e6c2dbea27249ca15d5660b7fcd8c6736ad1 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -274,6 +274,11 @@ class CONTENT_EXPORT ContentBrowserClient {
@@ -272,6 +272,11 @@ class CONTENT_EXPORT ContentBrowserClient {
virtual ~ContentBrowserClient() = default;

View File

@@ -38,7 +38,7 @@ index 20cfc2257e9ba25ec3f39f19db952ba6b6036c72..4efc13c79ae742fa1925d06431862745
// Returns whether `Initialize` has already been invoked in the process.
// Initialization is a one-way operation (i.e., this method cannot return
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc
index 072387786cc70f7d0b7d3d31cebf86af69f98a30..9df4d0aa257e7b4ecacd8c7a4ad392c4a33ff177 100644
index 9dddcdf88d56b32a9b8b9be529f0f13a03bd6e06..f4e5be79c1d3b92f6723f7b0c4d9a7f38c81ff99 100644
--- a/gin/v8_initializer.cc
+++ b/gin/v8_initializer.cc
@@ -352,7 +352,8 @@ void SetFlags(IsolateHolder::ScriptMode mode,

View File

@@ -12,7 +12,7 @@ rendering and there is no signal from browser process on this event
to identify it.
diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc
index bbdd4dcc4bc327b99db11629422cc92a9d477256..0f21c9a6e4da03e4af7a8ea692ce71bb008827ed 100644
index e9c3f3dee36a44d40844a88dbb899f593d03c907..c8dc226ce7c87fa84da5c99760f12538e367bbc9 100644
--- a/content/browser/gpu/gpu_data_manager_impl.cc
+++ b/content/browser/gpu/gpu_data_manager_impl.cc
@@ -230,6 +230,11 @@ void GpuDataManagerImpl::TerminateInfoCollectionGpuProcess() {
@@ -28,10 +28,10 @@ index bbdd4dcc4bc327b99db11629422cc92a9d477256..0f21c9a6e4da03e4af7a8ea692ce71bb
void GpuDataManagerImpl::UpdateDawnInfo(
diff --git a/content/browser/gpu/gpu_data_manager_impl.h b/content/browser/gpu/gpu_data_manager_impl.h
index 0a01900683c73778565f9059b293bbe863d2d070..cd4e58f73e7d5bd0f9f41b1ec63031666e6b978e 100644
index 4ed951d5829e87431a1f9f84f0317978cb673e31..82f9a2f97e71848ece8d04effc083db94a45d495 100644
--- a/content/browser/gpu/gpu_data_manager_impl.h
+++ b/content/browser/gpu/gpu_data_manager_impl.h
@@ -128,6 +128,7 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager,
@@ -124,6 +124,7 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager,
// BrowserMainParts override instead.
void PostCreateThreads();
void TerminateInfoCollectionGpuProcess();
@@ -40,10 +40,10 @@ index 0a01900683c73778565f9059b293bbe863d2d070..cd4e58f73e7d5bd0f9f41b1ec6303166
void UpdateDawnInfo(const std::vector<std::string>& dawn_info_list);
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc
index 260a2d4ef5df85291eda27a0f7066646d31dacfe..1f83ab4a9b22b35dd2b9053553121b49e1c42ca1 100644
index 53402e4d706f58c26498015c1a5c33b4f7ceabc7..c14ce99ec72881133a5bf2bd90369ee0211f6ca1 100644
--- a/content/browser/gpu/gpu_data_manager_impl_private.cc
+++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -1232,6 +1232,12 @@ void GpuDataManagerImplPrivate::TerminateInfoCollectionGpuProcess() {
@@ -1215,6 +1215,12 @@ void GpuDataManagerImplPrivate::TerminateInfoCollectionGpuProcess() {
if (host)
host->ForceShutdown();
}
@@ -57,7 +57,7 @@ index 260a2d4ef5df85291eda27a0f7066646d31dacfe..1f83ab4a9b22b35dd2b9053553121b49
void GpuDataManagerImplPrivate::UpdateDawnInfo(
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.h b/content/browser/gpu/gpu_data_manager_impl_private.h
index 85a4d09a54922205d416538ea97c7f2b5897f86a..acba97124a8643c7452bea63e91533cbfa7e182c 100644
index ac0afe687650da564187127dc7ea93a47acde719..237e3f00b1451be43949a797ef1b35885b958a5d 100644
--- a/content/browser/gpu/gpu_data_manager_impl_private.h
+++ b/content/browser/gpu/gpu_data_manager_impl_private.h
@@ -90,6 +90,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {

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 6cda63d5c6a0b7b2b41d01382b73dbdeea3651de..174e6a5265ec4186934a0bd0619ecf02073f4fe1 100644
index 6a91282809a76ca60dd1b329c683705b127eb22a..a2672faad7c39c3d938c1c31abb6fd0d37582fbf 100644
--- a/tools/gritsettings/resource_ids.spec
+++ b/tools/gritsettings/resource_ids.spec
@@ -962,6 +962,11 @@
@@ -954,6 +954,11 @@
"includes": [4960],
},

View File

@@ -11,7 +11,7 @@ If removing this patch causes no sync failures, it's safe to delete :+1:
Ref https://chromium-review.googlesource.com/c/chromium/src/+/2953903
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
index 36786064cd26faf4968e8ee90fb382e95247e4de..ce9f4b6a0d4f3350f89e9ba4f02a5cbb064524c4 100755
index 6bd25626dc999438316c2084442a29389d4154fb..bc27370e73d3061dfacbd96a3b8cf576b94e3d9b 100755
--- a/tools/clang/scripts/update.py
+++ b/tools/clang/scripts/update.py
@@ -298,6 +298,8 @@ def GetDefaultHostOs():

View File

@@ -9,10 +9,10 @@ but due to the nature of electron, we need to load the v8 snapshot
in the browser process.
diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc
index 0a0c6eb9567a96f569c25bad8ea98b4cd165b04a..0ce83c22636fce72e613893df30ca52b142077fd 100644
index 85a55e9bbb7403b031c512fa5e010cbb0487d9c6..31c83eab4781725540f57e1e66c6f7e7c0b85d8b 100644
--- a/content/app/content_main_runner_impl.cc
+++ b/content/app/content_main_runner_impl.cc
@@ -252,11 +252,8 @@ void LoadV8SnapshotFile(const base::CommandLine& command_line) {
@@ -247,11 +247,8 @@ void LoadV8SnapshotFile(const base::CommandLine& command_line) {
bool ShouldLoadV8Snapshot(const base::CommandLine& command_line,
const std::string& process_type) {

View File

@@ -1,16 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Thu, 7 Apr 2022 20:30:16 +0900
Subject: Make gtk::GetLibGtk public
Subject: Make gtk::GetLibGtk and gtk::GetLibGdkPixbuf public
Allows embedders to get a handle to the gtk library
already loaded in the process.
Allows embedders to get a handle to the gtk and
gdk_pixbuf libraries already loaded in the process.
diff --git a/ui/gtk/gtk_compat.cc b/ui/gtk/gtk_compat.cc
index b5c7af5bdb93b320f95252d35d2d76bae7f8c445..40b706ed7cde206e98274025148604760b7477f9 100644
index 0ed04582106639911d9a4e0284ff880be9c3bc74..0f7aaf3254864e92a54634dedb2fd2fbf8eb8990 100644
--- a/ui/gtk/gtk_compat.cc
+++ b/ui/gtk/gtk_compat.cc
@@ -86,12 +86,6 @@ void* GetLibGtk4(bool check = true) {
@@ -66,11 +66,6 @@ void* GetLibGio() {
return libgio;
}
-void* GetLibGdkPixbuf() {
- static void* libgdk_pixbuf = DlOpen("libgdk_pixbuf-2.0.so.0");
- return libgdk_pixbuf;
-}
-
void* GetLibGdk3() {
static void* libgdk3 = DlOpen("libgdk-3.so.0");
return libgdk3;
@@ -86,12 +81,6 @@ void* GetLibGtk4(bool check = true) {
return libgtk4;
}
@@ -23,10 +35,15 @@ index b5c7af5bdb93b320f95252d35d2d76bae7f8c445..40b706ed7cde206e9827402514860476
bool LoadGtk3() {
if (!GetLibGtk3(false))
return false;
@@ -134,6 +128,12 @@ gfx::Insets InsetsFromGtkBorder(const GtkBorder& border) {
@@ -134,6 +123,17 @@ gfx::Insets InsetsFromGtkBorder(const GtkBorder& border) {
} // namespace
+void* GetLibGdkPixbuf() {
+ static void* libgdk_pixbuf = DlOpen("libgdk_pixbuf-2.0.so.0");
+ return libgdk_pixbuf;
+}
+
+void* GetLibGtk() {
+ if (GtkCheckVersion(4))
+ return GetLibGtk4();
@@ -37,13 +54,16 @@ index b5c7af5bdb93b320f95252d35d2d76bae7f8c445..40b706ed7cde206e9827402514860476
static bool loaded = LoadGtkImpl();
return loaded;
diff --git a/ui/gtk/gtk_compat.h b/ui/gtk/gtk_compat.h
index 57e55b9e749b43d327deff449a530e1f435a8e8b..2245974f91be4a691d82f54b55e12e44ae2000c5 100644
index 72981270fe26579211afcaf3c596a412f69f5fac..63e383f03f51124f67a0c522f57eb4cc23857bc1 100644
--- a/ui/gtk/gtk_compat.h
+++ b/ui/gtk/gtk_compat.h
@@ -34,6 +34,9 @@ using SkColor = uint32_t;
@@ -37,6 +37,12 @@ using SkColor = uint32_t;
namespace gtk {
+// Get handle to the currently loaded gdk-pixbuf library in the process.
+void* GetLibGdkPixbuf();
+
+// Get handle to the currently loaded gtk library in the process.
+void* GetLibGtk();
+

View File

@@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Apthorp <nornagon@nornagon.net>
Date: Thu, 20 Sep 2018 17:49:31 -0700
Subject: mas: avoid usage of AudioDeviceDuck
Removes usage of the AudioDeviceDuck private API.
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
index 0e842caf7b6487d94978c7b68fb5b222e330581f..5eafcd163ee1a05203a5eb76592a449f5a84e71f 100644
--- a/media/audio/mac/audio_low_latency_input_mac.cc
+++ b/media/audio/mac/audio_low_latency_input_mac.cc
@@ -34,19 +34,23 @@
namespace {
extern "C" {
+#ifndef MAS_BUILD
// See:
// https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/PAL/pal/spi/cf/CoreAudioSPI.h?rev=228264
OSStatus AudioDeviceDuck(AudioDeviceID inDevice,
Float32 inDuckedLevel,
const AudioTimeStamp* __nullable inStartTime,
Float32 inRampDuration) __attribute__((weak_import));
+#endif
}
void UndoDucking(AudioDeviceID output_device_id) {
+#ifndef MAS_BUILD
if (AudioDeviceDuck != nullptr) {
// Ramp the volume back up over half a second.
AudioDeviceDuck(output_device_id, 1.0, nullptr, 0.5);
}
+#endif
}
} // namespace

View File

@@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Apthorp <nornagon@nornagon.net>
Date: Thu, 20 Sep 2018 17:49:20 -0700
Subject: mas: avoid usage of _CFIsObjC
Removes usage of the _CFIsObjC private API.
diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
index 61641e1ad8a47a4910918ff61523a23854745b81..d4a3e2282256f5a43235b40b4c9f46caa725c507 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -30,12 +30,6 @@
#if !BUILDFLAG(IS_IOS)
CFTypeID SecACLGetTypeID();
CFTypeID SecTrustedApplicationGetTypeID();
-// The NSFont/CTFont toll-free bridging is broken before 10.15.
-// http://www.openradar.me/15341349 rdar://15341349
-//
-// TODO(https://crbug.com/1076527): This is fixed in 10.15. When 10.15 is the
-// minimum OS for Chromium, remove this SPI declaration.
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
#endif
} // extern "C"
@@ -316,8 +310,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
DCHECK(!cf_val ||
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
- (_CFIsObjC(CTFontGetTypeID(), cf_val) &&
- [ns_val isKindOfClass:[NSFont class]]));
+ ([ns_val isKindOfClass:[NSFont class]]));
return ns_val;
}
@@ -388,9 +381,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
return (CTFontRef)(cf_val);
}
- if (!_CFIsObjC(CTFontGetTypeID(), cf_val))
- return NULL;
-
id<NSObject> ns_val = reinterpret_cast<id>(const_cast<void*>(cf_val));
if ([ns_val isKindOfClass:[NSFont class]]) {
return (CTFontRef)(cf_val);

View File

@@ -6,10 +6,10 @@ Subject: mas: avoid usage of CGDisplayUsesForceToGray
Removes usage of the CGDisplayUsesForceToGray private API.
diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm
index 335e8a576f9a66a20b5720dfd083708bf490587e..0abf4ae5c58bd841c013775f6df0b6065d6d77b1 100644
index 21778ef0c7657937987fdc70bf9ceb9439aebf15..2f6e1390a3b824d80832e47f6c368e757e2d9806 100644
--- a/ui/display/mac/screen_mac.mm
+++ b/ui/display/mac/screen_mac.mm
@@ -156,7 +156,17 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) {
@@ -162,7 +162,17 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) {
display.set_color_depth(Display::kDefaultBitsPerPixel);
display.set_depth_per_component(Display::kDefaultBitsPerComponent);
}

View File

@@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <sattard@slack-corp.com>
Date: Mon, 4 Mar 2019 14:43:36 -0800
Subject: mas: avoid usage of abort_report_np
Disable usage of the private API abort_report_np in MAS builds.
diff --git a/sandbox/mac/sandbox_logging.cc b/sandbox/mac/sandbox_logging.cc
index 702224dce1871c07b07f6882e46d14fe532d6ed2..797cb6646171486797a5e5fbbb1b187e3a9f81d4 100644
--- a/sandbox/mac/sandbox_logging.cc
+++ b/sandbox/mac/sandbox_logging.cc
@@ -32,9 +32,11 @@
}
#endif
+#if !defined(MAS_BUILD)
extern "C" {
void abort_report_np(const char*, ...);
}
+#endif
namespace sandbox {
@@ -104,9 +106,11 @@ void SendAslLog(Level level, const char* message) {
asl_set(asl_message.get(), ASL_KEY_MSG, message);
asl_send(asl_client.get(), asl_message.get());
+#if !defined(MAS_BUILD)
if (level == Level::FATAL) {
abort_report_np(message);
}
+#endif
}
// |error| is strerror(errno) when a P* logging function is called. Pass

View File

@@ -1,233 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <sattard@slack-corp.com>
Date: Mon, 4 Mar 2019 14:43:36 -0800
Subject: mas: avoid usage of private macOS APIs
Disable usage of the following private APIs in MAS builds:
* abort_report_np
* pthread_fchdir_np
* pthread_chdir_np
* SetApplicationIsDaemon
* _LSSetApplicationLaunchServicesServerConnectionStatus
* AreDeviceAndUserJoinedToDomain
* _CFIsObjC
* AudioDeviceDuck
diff --git a/base/enterprise_util_mac.mm b/base/enterprise_util_mac.mm
index dd14c8cfa32ab0bb2e92f192c54a494c4f5b4fb7..2c6f0b336c97bc23995e9fe8cdc7f72a69f54e64 100644
--- a/base/enterprise_util_mac.mm
+++ b/base/enterprise_util_mac.mm
@@ -189,6 +189,13 @@ MacDeviceManagementStateNew IsDeviceRegisteredWithManagementNew() {
DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
static DeviceUserDomainJoinState state = [] {
DeviceUserDomainJoinState state{false, false};
+#if defined(MAS_BUILD)
+ return state;
+ }();
+
+ return state;
+}
+#else
@autoreleasepool {
ODSession* session = [ODSession defaultSession];
@@ -295,5 +302,6 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
return state;
}
+#endif
} // namespace base
diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
index 61641e1ad8a47a4910918ff61523a23854745b81..d4a3e2282256f5a43235b40b4c9f46caa725c507 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -30,12 +30,6 @@
#if !BUILDFLAG(IS_IOS)
CFTypeID SecACLGetTypeID();
CFTypeID SecTrustedApplicationGetTypeID();
-// The NSFont/CTFont toll-free bridging is broken before 10.15.
-// http://www.openradar.me/15341349 rdar://15341349
-//
-// TODO(https://crbug.com/1076527): This is fixed in 10.15. When 10.15 is the
-// minimum OS for Chromium, remove this SPI declaration.
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
#endif
} // extern "C"
@@ -316,8 +310,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
DCHECK(!cf_val ||
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
- (_CFIsObjC(CTFontGetTypeID(), cf_val) &&
- [ns_val isKindOfClass:[NSFont class]]));
+ ([ns_val isKindOfClass:[NSFont class]]));
return ns_val;
}
@@ -388,9 +381,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
return (CTFontRef)(cf_val);
}
- if (!_CFIsObjC(CTFontGetTypeID(), cf_val))
- return NULL;
-
id<NSObject> ns_val = reinterpret_cast<id>(const_cast<void*>(cf_val));
if ([ns_val isKindOfClass:[NSFont class]]) {
return (CTFontRef)(cf_val);
diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc
index 184cfa25dbc6cfa2a32be3f8d964ea359254f807..c9bfc4d8ca1408206244305d7634dcd51e99377c 100644
--- a/base/process/launch_mac.cc
+++ b/base/process/launch_mac.cc
@@ -26,8 +26,10 @@ extern "C" {
// descriptor. libpthread only exposes a syscall wrapper starting in
// macOS 10.12, but the system call dates back to macOS 10.5. On older OSes,
// the syscall is issued directly.
+#if !defined(MAS_BUILD)
int pthread_chdir_np(const char* dir) API_AVAILABLE(macosx(10.12));
int pthread_fchdir_np(int fd) API_AVAILABLE(macosx(10.12));
+#endif
int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs, int disclaim)
API_AVAILABLE(macosx(10.14));
@@ -96,21 +98,29 @@ class PosixSpawnFileActions {
};
int ChangeCurrentThreadDirectory(const char* path) {
+ #if defined(MAS_BUILD)
+ return syscall(SYS___pthread_chdir, path);
+ #else
if (__builtin_available(macOS 10.12, *)) {
return pthread_chdir_np(path);
} else {
return syscall(SYS___pthread_chdir, path);
}
+ #endif
}
// The recommended way to unset a per-thread cwd is to set a new value to an
// invalid file descriptor, per libpthread-218.1.3/private/private.h.
int ResetCurrentThreadDirectory() {
+ #if defined(MAS_BUILD)
+ return syscall(SYS___pthread_fchdir, -1);
+ #else
if (__builtin_available(macOS 10.12, *)) {
return pthread_fchdir_np(-1);
} else {
return syscall(SYS___pthread_fchdir, -1);
}
+ #endif
}
struct GetAppOutputOptions {
@@ -230,11 +240,13 @@ Process LaunchProcess(const std::vector<std::string>& argv,
file_actions.Inherit(STDERR_FILENO);
}
+#if 0
if (options.disclaim_responsibility) {
if (__builtin_available(macOS 10.14, *)) {
DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1));
}
}
+#endif
std::vector<char*> argv_cstr;
argv_cstr.reserve(argv.size() + 1);
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
index 0e842caf7b6487d94978c7b68fb5b222e330581f..5eafcd163ee1a05203a5eb76592a449f5a84e71f 100644
--- a/media/audio/mac/audio_low_latency_input_mac.cc
+++ b/media/audio/mac/audio_low_latency_input_mac.cc
@@ -34,19 +34,23 @@
namespace {
extern "C" {
+#ifndef MAS_BUILD
// See:
// https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/PAL/pal/spi/cf/CoreAudioSPI.h?rev=228264
OSStatus AudioDeviceDuck(AudioDeviceID inDevice,
Float32 inDuckedLevel,
const AudioTimeStamp* __nullable inStartTime,
Float32 inRampDuration) __attribute__((weak_import));
+#endif
}
void UndoDucking(AudioDeviceID output_device_id) {
+#ifndef MAS_BUILD
if (AudioDeviceDuck != nullptr) {
// Ramp the volume back up over half a second.
AudioDeviceDuck(output_device_id, 1.0, nullptr, 0.5);
}
+#endif
}
} // namespace
diff --git a/sandbox/mac/sandbox_logging.cc b/sandbox/mac/sandbox_logging.cc
index 702224dce1871c07b07f6882e46d14fe532d6ed2..797cb6646171486797a5e5fbbb1b187e3a9f81d4 100644
--- a/sandbox/mac/sandbox_logging.cc
+++ b/sandbox/mac/sandbox_logging.cc
@@ -32,9 +32,11 @@
}
#endif
+#if !defined(MAS_BUILD)
extern "C" {
void abort_report_np(const char*, ...);
}
+#endif
namespace sandbox {
@@ -104,9 +106,11 @@ void SendAslLog(Level level, const char* message) {
asl_set(asl_message.get(), ASL_KEY_MSG, message);
asl_send(asl_client.get(), asl_message.get());
+#if !defined(MAS_BUILD)
if (level == Level::FATAL) {
abort_report_np(message);
}
+#endif
}
// |error| is strerror(errno) when a P* logging function is called. Pass
diff --git a/sandbox/mac/system_services.cc b/sandbox/mac/system_services.cc
index 9f5261425162791668c2d15b7ffba091f831d652..c37f3dc05cb8372c7a6c4caef7a280b6f2f48e98 100644
--- a/sandbox/mac/system_services.cc
+++ b/sandbox/mac/system_services.cc
@@ -9,6 +9,7 @@
#include "base/mac/mac_logging.h"
+#if !defined(MAS_BUILD)
extern "C" {
OSStatus SetApplicationIsDaemon(Boolean isDaemon);
void _LSSetApplicationLaunchServicesServerConnectionStatus(
@@ -19,10 +20,12 @@ void _LSSetApplicationLaunchServicesServerConnectionStatus(
// https://github.com/WebKit/webkit/commit/8da694b0b3febcc262653d01a45e946ce91845ed.
void _CSCheckFixDisable() API_AVAILABLE(macosx(10.15));
} // extern "C"
+#endif
namespace sandbox {
void DisableLaunchServices() {
+ #if !defined(MAS_BUILD)
// Allow the process to continue without a LaunchServices ASN. The
// INIT_Process function in HIServices will abort if it cannot connect to
// launchservicesd to get an ASN. By setting this flag, HIServices skips
@@ -36,12 +39,15 @@ void DisableLaunchServices() {
0, ^bool(CFDictionaryRef options) {
return false;
});
+ #endif
}
void DisableCoreServicesCheckFix() {
+#if !defined(MAS_BUILD)
if (__builtin_available(macOS 10.15, *)) {
_CSCheckFixDisable();
}
+#endif
}
} // namespace sandbox

View File

@@ -0,0 +1,66 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <sattard@slack-corp.com>
Date: Mon, 4 Mar 2019 14:46:48 -0800
Subject: mas: avoid usage of pthread_fchdir_np
Disable usage of pthread_fchdir_np and pthread_chdir_np in MAS builds.
diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc
index 184cfa25dbc6cfa2a32be3f8d964ea359254f807..c9bfc4d8ca1408206244305d7634dcd51e99377c 100644
--- a/base/process/launch_mac.cc
+++ b/base/process/launch_mac.cc
@@ -26,8 +26,10 @@ extern "C" {
// descriptor. libpthread only exposes a syscall wrapper starting in
// macOS 10.12, but the system call dates back to macOS 10.5. On older OSes,
// the syscall is issued directly.
+#if !defined(MAS_BUILD)
int pthread_chdir_np(const char* dir) API_AVAILABLE(macosx(10.12));
int pthread_fchdir_np(int fd) API_AVAILABLE(macosx(10.12));
+#endif
int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs, int disclaim)
API_AVAILABLE(macosx(10.14));
@@ -96,21 +98,29 @@ class PosixSpawnFileActions {
};
int ChangeCurrentThreadDirectory(const char* path) {
+ #if defined(MAS_BUILD)
+ return syscall(SYS___pthread_chdir, path);
+ #else
if (__builtin_available(macOS 10.12, *)) {
return pthread_chdir_np(path);
} else {
return syscall(SYS___pthread_chdir, path);
}
+ #endif
}
// The recommended way to unset a per-thread cwd is to set a new value to an
// invalid file descriptor, per libpthread-218.1.3/private/private.h.
int ResetCurrentThreadDirectory() {
+ #if defined(MAS_BUILD)
+ return syscall(SYS___pthread_fchdir, -1);
+ #else
if (__builtin_available(macOS 10.12, *)) {
return pthread_fchdir_np(-1);
} else {
return syscall(SYS___pthread_fchdir, -1);
}
+ #endif
}
struct GetAppOutputOptions {
@@ -230,11 +240,13 @@ Process LaunchProcess(const std::vector<std::string>& argv,
file_actions.Inherit(STDERR_FILENO);
}
+#if 0
if (options.disclaim_responsibility) {
if (__builtin_available(macOS 10.14, *)) {
DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1));
}
}
+#endif
std::vector<char*> argv_cstr;
argv_cstr.reserve(argv.size() + 1);

View File

@@ -0,0 +1,50 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <sattard@slack-corp.com>
Date: Mon, 4 Mar 2019 14:51:45 -0800
Subject: mas: avoid usage of SetApplicationIsDaemon and
_LSSetApplicationLaunchServicesServerConnectionStatus
Disable usage of SetApplicationIsDaemon and
_LSSetApplicationLaunchServicesServerConnectionStatus in MAS builds
diff --git a/sandbox/mac/system_services.cc b/sandbox/mac/system_services.cc
index 9f5261425162791668c2d15b7ffba091f831d652..c37f3dc05cb8372c7a6c4caef7a280b6f2f48e98 100644
--- a/sandbox/mac/system_services.cc
+++ b/sandbox/mac/system_services.cc
@@ -9,6 +9,7 @@
#include "base/mac/mac_logging.h"
+#if !defined(MAS_BUILD)
extern "C" {
OSStatus SetApplicationIsDaemon(Boolean isDaemon);
void _LSSetApplicationLaunchServicesServerConnectionStatus(
@@ -19,10 +20,12 @@ void _LSSetApplicationLaunchServicesServerConnectionStatus(
// https://github.com/WebKit/webkit/commit/8da694b0b3febcc262653d01a45e946ce91845ed.
void _CSCheckFixDisable() API_AVAILABLE(macosx(10.15));
} // extern "C"
+#endif
namespace sandbox {
void DisableLaunchServices() {
+ #if !defined(MAS_BUILD)
// Allow the process to continue without a LaunchServices ASN. The
// INIT_Process function in HIServices will abort if it cannot connect to
// launchservicesd to get an ASN. By setting this flag, HIServices skips
@@ -36,12 +39,15 @@ void DisableLaunchServices() {
0, ^bool(CFDictionaryRef options) {
return false;
});
+ #endif
}
void DisableCoreServicesCheckFix() {
+#if !defined(MAS_BUILD)
if (__builtin_available(macOS 10.15, *)) {
_CSCheckFixDisable();
}
+#endif
}
} // namespace sandbox

View File

@@ -75,7 +75,7 @@ index 8416c7c6e052dafb2aad61c0bd3224c36e945d23..cd356beda023ab2409b16d58ca38c70b
+
@end
diff --git a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h
index 67ebc56bd7ee267c03a5543e10a6a41042fcaa38..af3ed27dea51c22ab32ce14686dd7807eb797316 100644
index 5a23ea7558814eec59eda349bc7194afcb70d01e..c9147bbe5a225291552082434e5db34239394139 100644
--- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h
+++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h
@@ -17,6 +17,7 @@ class NativeWidgetNSWindowBridge;
@@ -95,7 +95,7 @@ index 67ebc56bd7ee267c03a5543e10a6a41042fcaa38..af3ed27dea51c22ab32ce14686dd7807
// The NSWindow used by BridgedNativeWidget. Provides hooks into AppKit that
// can only be accomplished by overriding methods.
diff --git a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
index 622b25c637ba14f287cbcdb4781967564d7e9eff..a21fe0aa19069a748b41e7d0781e20031c40fbfc 100644
index 83e08e8e56f8fdfe5c321c33b451b9bde8ee819a..f48d8ac4816e2d775c16758e086eb56ad456bd01 100644
--- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
+++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
@@ -16,7 +16,9 @@
@@ -126,7 +126,7 @@ index 622b25c637ba14f287cbcdb4781967564d7e9eff..a21fe0aa19069a748b41e7d0781e2003
@implementation NativeWidgetMacNSWindow {
@private
base::scoped_nsobject<CommandDispatcher> _commandDispatcher;
@@ -209,6 +215,8 @@ - (BOOL)hasViewsMenuActive {
@@ -186,6 +192,8 @@ - (BOOL)hasViewsMenuActive {
// NSWindow overrides.
@@ -135,7 +135,7 @@ index 622b25c637ba14f287cbcdb4781967564d7e9eff..a21fe0aa19069a748b41e7d0781e2003
+ (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
if (windowStyle & NSWindowStyleMaskTitled) {
if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class])
@@ -220,6 +228,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
@@ -197,6 +205,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
return [super frameViewClassForStyleMask:windowStyle];
}

View File

@@ -11,7 +11,7 @@ needs to think it's coming from the PWA process). I think it can just be chopped
out -- if there are any side-effects, we should be able to work around them.
diff --git a/components/remote_cocoa/app_shim/application_bridge.mm b/components/remote_cocoa/app_shim/application_bridge.mm
index 306db835fe203f663b1d84dd3490b619eb3f60b2..7a41d7afe6197e0a78934206782b1063f77f707a 100644
index 04691696ee653b95cf046edfd464b1a800a38abe..b567b1e1fa9e5103a6219292a649f8807f0aa7ae 100644
--- a/components/remote_cocoa/app_shim/application_bridge.mm
+++ b/components/remote_cocoa/app_shim/application_bridge.mm
@@ -51,6 +51,7 @@
@@ -44,10 +44,10 @@ index 306db835fe203f663b1d84dd3490b619eb3f60b2..7a41d7afe6197e0a78934206782b1063
} // namespace
diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
index 26a2fa4c0f39ea0254bee322f355d92a55ba3b4e..e42de9720456161c187d41d39487ee3272fa1cf9 100644
index 6394980da8ab8b38e29693ccedfc3827ac111a4c..7fff28ee83475963f80987f7736ac866daa7dad2 100644
--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
+++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
@@ -583,10 +583,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
@@ -567,10 +567,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
// this should be treated as an error and caught early.
CHECK(bridged_view_);
@@ -61,10 +61,10 @@ index 26a2fa4c0f39ea0254bee322f355d92a55ba3b4e..e42de9720456161c187d41d39487ee32
// Beware: This view was briefly removed (in favor of a bare CALayer) in
// crrev/c/1236675. The ordering of unassociated layers relative to NSView
diff --git a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
index 60e99da4a9493dbaca871b08d75341a48488a65e..3328e9e90bd4904dd404b413fd4245f4fb37ae38 100644
index 2cd40c288f42937688e4f846a002779158ada68f..f4c7bb0ab75835bfdbd100ce852646bf77817c9e 100644
--- a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
+++ b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
@@ -74,8 +74,10 @@ id GetFocusedBrowserAccessibilityElement() override {
@@ -73,8 +73,10 @@ id GetFocusedBrowserAccessibilityElement() override {
return nil;
}
void SetAccessibilityWindow(NSWindow* window) override {
@@ -75,7 +75,7 @@ index 60e99da4a9493dbaca871b08d75341a48488a65e..3328e9e90bd4904dd404b413fd4245f4
}
void ForwardKeyboardEvent(const content::NativeWebKeyboardEvent& key_event,
@@ -137,8 +139,10 @@ void SmartMagnify(const blink::WebGestureEvent& web_event) override {
@@ -136,8 +138,10 @@ void SmartMagnify(const blink::WebGestureEvent& web_event) override {
mojo::AssociatedRemote<mojom::RenderWidgetHostNSViewHost> host_;
std::unique_ptr<RenderWidgetHostNSViewBridge> bridge_;
@@ -87,7 +87,7 @@ index 60e99da4a9493dbaca871b08d75341a48488a65e..3328e9e90bd4904dd404b413fd4245f4
}
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h
index 0048862cb89d519b8c1c111f923e6dd960c855d6..c7b9124462b0779ed4d1b27fe167e653bf5c6be5 100644
index 2b99d6a9f13f12a2a470fb6a5aa98c05f26a54c7..46d735add749d76c32f80512d00373b442248c6a 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
@@ -49,7 +49,9 @@ class ScopedPasswordInputEnabler;
@@ -114,10 +114,10 @@ index 0048862cb89d519b8c1c111f923e6dd960c855d6..c7b9124462b0779ed4d1b27fe167e653
// 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 3fbe8be5b94817d48622590cb3acd271bf07db31..c37193c2207fb4f20993a35e2ac6fde8f0727a45 100644
index 961c759eca96ffc0ffcf40cfdaf42388f47d9c2b..18c77a5520ea2ae7cfee4eea3ed01fa8a588829d 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -255,8 +255,10 @@
@@ -252,8 +252,10 @@
void RenderWidgetHostViewMac::MigrateNSViewBridge(
remote_cocoa::mojom::Application* remote_cocoa_application,
uint64_t parent_ns_view_id) {
@@ -128,7 +128,7 @@ index 3fbe8be5b94817d48622590cb3acd271bf07db31..c37193c2207fb4f20993a35e2ac6fde8
// Disconnect from the previous bridge (this will have the effect of
// destroying the associated bridge), and close the receiver (to allow it
@@ -1541,8 +1543,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
@@ -1519,8 +1521,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
gfx::NativeViewAccessible
RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() {
@@ -139,7 +139,7 @@ index 3fbe8be5b94817d48622590cb3acd271bf07db31..c37193c2207fb4f20993a35e2ac6fde8
return [GetInProcessNSView() window];
}
@@ -1586,9 +1590,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
@@ -1564,9 +1568,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
}
void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) {
@@ -151,7 +151,7 @@ index 3fbe8be5b94817d48622590cb3acd271bf07db31..c37193c2207fb4f20993a35e2ac6fde8
}
bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame(
@@ -2083,12 +2089,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
@@ -2061,12 +2067,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken(
const std::vector<uint8_t>& window_token) {
@@ -167,11 +167,11 @@ index 3fbe8be5b94817d48622590cb3acd271bf07db31..c37193c2207fb4f20993a35e2ac6fde8
///////////////////////////////////////////////////////////////////////////////
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
index 2e39255bdb26664e8bc2d0abb26c2359c9b84bd3..1425e9935b599b01fd53f43d0415a77002c92f00 100644
index 028a97becd88fb12481b1de0395c7c81857d3af3..4491be85cb82f050cc70c24e933e841a08b9123f 100644
--- a/ui/base/BUILD.gn
+++ b/ui/base/BUILD.gn
@@ -329,6 +329,13 @@ component("base") {
sources += [ "resource/resource_bundle_lacros.cc" ]
@@ -319,6 +319,13 @@ component("base") {
]
}
+ if (is_mas_build) {

View File

@@ -40,7 +40,7 @@ index 1b84c9df5990d0905d068ca822d5173313a74edd..89a90a5c8e0c3ede1b0fe63d45c5768b
gfx::Size pixel_size_;
diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.mm b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
index 547a5c4260b28d651d470e06c4c4e6bfa77ef966..01fee4e6b104aad68d52f30c9af3e9072f078e0c 100644
index 767d3f6454ef3150354911ed683f5485bb83fbbb..f273b56276c1b277b307f6c4c061e08d12daea42 100644
--- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm
+++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
@@ -60,7 +60,7 @@
@@ -60,7 +60,7 @@ index 547a5c4260b28d651d470e06c4c4e6bfa77ef966..01fee4e6b104aad68d52f30c9af3e907
}
template <typename BaseClass>
@@ -160,7 +161,9 @@
@@ -149,7 +150,9 @@
"GLImpl", static_cast<int>(gl::GetGLImplementation()),
"width", pixel_size_.width());
if (use_remote_layer_api_) {

View File

@@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: VerteDinde <khammond@slack-corp.com>
Date: Tue, 19 Oct 2021 16:56:25 -0700
Subject: fix: mas gate private enterprise APIs
Beginning in Electron 15.2.0, Chromium moved several formerly public
APIs into the AreDeviceAndUserJoinedToDomain method. Using these APIs
in a MAS build will result in rejection from the Apple Store. This
patch gates those APIs to non-MAS builds to comply with Apple
Store requirements, and returns the default state for MAS builds.
diff --git a/base/enterprise_util_mac.mm b/base/enterprise_util_mac.mm
index bbb851e1cafb37ebaa67e4577598fab25c90fde6..6ab12e5505b5ba545e7e0cc8c93d3ba9a6d0bacc 100644
--- a/base/enterprise_util_mac.mm
+++ b/base/enterprise_util_mac.mm
@@ -168,6 +168,13 @@ MacDeviceManagementStateNew IsDeviceRegisteredWithManagementNew() {
DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
static DeviceUserDomainJoinState state = [] {
DeviceUserDomainJoinState state{false, false};
+#if defined(MAS_BUILD)
+ return state;
+ }();
+
+ return state;
+}
+#else
@autoreleasepool {
ODSession* session = [ODSession defaultSession];
@@ -274,5 +281,6 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
return state;
}
+#endif
} // namespace base

View File

@@ -7,7 +7,7 @@ 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 12d74d8751802b06198952682bfc99f18e5f8df8..6a331146e6fbf23e4177176f67fe534141579eb7 100644
index ecc38d1584570c46826084054f0a3249f9e2eb92..f06a04983571623b542dba11933c4c95c3dcf398 100644
--- a/services/network/network_context.cc
+++ b/services/network/network_context.cc
@@ -128,6 +128,11 @@
@@ -139,10 +139,10 @@ index 12d74d8751802b06198952682bfc99f18e5f8df8..6a331146e6fbf23e4177176f67fe5341
builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier(
diff --git a/services/network/network_context.h b/services/network/network_context.h
index bcd47e726ad4d320cac3c3341d87b9a3ca2c4065..620d7b7b733cc9749775c2bcabcebdedafe6ba0b 100644
index 994712b56fb25fbfa7559ac034cfd7e1c76597de..2cd8707b120deb41683e13def5d446fd3bf93afe 100644
--- a/services/network/network_context.h
+++ b/services/network/network_context.h
@@ -105,6 +105,7 @@ class URLMatcher;
@@ -109,6 +109,7 @@ class URLMatcher;
namespace network {
class CertVerifierWithTrustAnchors;
@@ -150,7 +150,7 @@ index bcd47e726ad4d320cac3c3341d87b9a3ca2c4065..620d7b7b733cc9749775c2bcabcebded
class CookieManager;
class ExpectCTReporter;
class HostResolver;
@@ -236,6 +237,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
@@ -240,6 +241,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
void CreateURLLoaderFactory(
mojo::PendingReceiver<mojom::URLLoaderFactory> receiver,
mojom::URLLoaderFactoryParamsPtr params) override;
@@ -159,7 +159,7 @@ index bcd47e726ad4d320cac3c3341d87b9a3ca2c4065..620d7b7b733cc9749775c2bcabcebded
void ResetURLLoaderFactories() override;
void GetCookieManager(
mojo::PendingReceiver<mojom::CookieManager> receiver) override;
@@ -823,6 +826,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
@@ -827,6 +830,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
std::vector<base::OnceClosure> dismount_closures_;
#endif // BUILDFLAG(IS_DIRECTORY_TRANSFER_REQUIRED)
@@ -169,10 +169,10 @@ index bcd47e726ad4d320cac3c3341d87b9a3ca2c4065..620d7b7b733cc9749775c2bcabcebded
// CertNetFetcher is not used by the current platform, or if the actual
// net::CertVerifier is instantiated outside of the network service.
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
index cc3f99007db46a488d7f8dacd3ede4a90e1d2ae3..0450b50b5545d9b8f9025553167bed2e78157130 100644
index b2beaa762bfe88b56ac24d35646b6e6cbc630816..b52e5a2230e96d55d7886bde331a505c58dd093a 100644
--- a/services/network/public/mojom/network_context.mojom
+++ b/services/network/public/mojom/network_context.mojom
@@ -282,6 +282,17 @@ struct NetworkContextFilePaths {
@@ -281,6 +281,17 @@ struct NetworkContextFilePaths {
bool trigger_migration = false;
};
@@ -190,7 +190,7 @@ index cc3f99007db46a488d7f8dacd3ede4a90e1d2ae3..0450b50b5545d9b8f9025553167bed2e
// Parameters for constructing a network context.
struct NetworkContextParams {
// The user agent string.
@@ -833,6 +844,9 @@ interface NetworkContext {
@@ -830,6 +841,9 @@ interface NetworkContext {
// Sets a client for this network context.
SetClient(pending_remote<NetworkContextClient> client);

View File

@@ -7,7 +7,7 @@ Pass RenderFrameHost through to PlatformNotificationService
so Electron can identify which renderer a notification came from.
diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc
index 362fedd0a0b654db546a73ff84c7e0676097e824..f1f6e2a36a6764ef12827fdab16818061b007959 100644
index 83b33e3f521aa79942ba3446a8b161a4e4e23da1..24f409f673797b6e8bb1da680343ea1ddc083e4f 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.cc
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -195,6 +195,7 @@ bool PlatformNotificationServiceImpl::WasClosedProgrammatically(
@@ -31,7 +31,7 @@ index b0e64049d411305d58802fd290bb0480e9b36fee..4afcf3b7a5b841409b0e1c4c2f32fd48
const GURL& origin,
const GURL& document_url,
diff --git a/content/browser/notifications/blink_notification_service_impl.cc b/content/browser/notifications/blink_notification_service_impl.cc
index a3df152caabcadaba454f73f58763a89fdea4247..ba76f2f294a2eab8581b5ef8d879cb464f14cb1f 100644
index 32a61e73658d33dcd0fe1640094c8b79dde0be37..3c3650e0f8364a5c86bd11a6f11ca559a97f5900 100644
--- a/content/browser/notifications/blink_notification_service_impl.cc
+++ b/content/browser/notifications/blink_notification_service_impl.cc
@@ -82,10 +82,12 @@ BlinkNotificationServiceImpl::BlinkNotificationServiceImpl(
@@ -77,7 +77,7 @@ index dc8de24c86f1769680ce7830844d35dfef7eb7e7..fcd99361fa8c895d6bd89bacb9fb94e7
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
diff --git a/content/browser/notifications/blink_notification_service_impl_unittest.cc b/content/browser/notifications/blink_notification_service_impl_unittest.cc
index fe015fa7d7813115a2c6a23a00cb509c4c16cd93..88e04351204c786d0fc72a99ccc421f76fc26ef9 100644
index 7461d5079f9cb0f257fbb93248c98be9409d38e7..4ddb9e40f0441b378d73ac75d99ae64c90d32b58 100644
--- a/content/browser/notifications/blink_notification_service_impl_unittest.cc
+++ b/content/browser/notifications/blink_notification_service_impl_unittest.cc
@@ -129,7 +129,7 @@ class BlinkNotificationServiceImplTest : public ::testing::Test {
@@ -90,7 +90,7 @@ index fe015fa7d7813115a2c6a23a00cb509c4c16cd93..88e04351204c786d0fc72a99ccc421f7
notification_service_remote_.BindNewPipeAndPassReceiver());
diff --git a/content/browser/notifications/platform_notification_context_impl.cc b/content/browser/notifications/platform_notification_context_impl.cc
index fc24d16beb5a0ae61bf3123d0594287031d69ddf..6a6edfa8f919ffca815cc0f50fcde0b09067d494 100644
index 1195296c6f925e6c4f52f61866cf4b7f824af4e9..d3142bef0856c5cd7f4822ee9dcaedaef74a12d3 100644
--- a/content/browser/notifications/platform_notification_context_impl.cc
+++ b/content/browser/notifications/platform_notification_context_impl.cc
@@ -282,13 +282,14 @@ void PlatformNotificationContextImpl::Shutdown() {
@@ -130,10 +130,10 @@ index 69f000e5cd25c6d89c88238873f638923bafdf0e..4f0068a92a0e99e2b34f105954689c7b
const GURL& document_url,
mojo::PendingReceiver<blink::mojom::NotificationService> receiver);
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 36830abdfa49fed9b8294ca33065816faa672e18..36b4e75828436df4274b522bdf75e88e1112aab6 100644
index b74b4c2028ccb22349253960b9aa6c5bfe87579c..396377fd4041cced3c68f8d57c8f868098bb8923 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2085,7 +2085,8 @@ void RenderProcessHostImpl::CreateNotificationService(
@@ -2088,7 +2088,8 @@ void RenderProcessHostImpl::CreateNotificationService(
document_url = rfh->GetLastCommittedURL();
storage_partition_impl_->GetPlatformNotificationContext()->CreateService(

View File

@@ -8,11 +8,50 @@ chrome's generated resources for our own. This updates the #include so that we
don't get errors for Chrome's generated resources, which are non-existent
because we don't generate them in our build.
diff --git a/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc b/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc
index 7bc8d118f87b91baf1c3bd1d34374996ab1d3638..2d2c1c86f311b07f0c2b09d5a4c082cc5599600c 100644
--- a/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc
+++ b/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/ui/views/overlay/back_to_tab_image_button.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.h"
diff --git a/chrome/browser/ui/views/overlay/back_to_tab_label_button.cc b/chrome/browser/ui/views/overlay/back_to_tab_label_button.cc
index d566dbf99ea1164c6a8407026a9839218a6ba1fb..239cd53d70c547c79214988a82efdc8c472d553c 100644
--- a/chrome/browser/ui/views/overlay/back_to_tab_label_button.cc
+++ b/chrome/browser/ui/views/overlay/back_to_tab_label_button.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/ui/views/overlay/back_to_tab_label_button.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/l10n/l10n_util.h"
diff --git a/chrome/browser/ui/views/overlay/close_image_button.cc b/chrome/browser/ui/views/overlay/close_image_button.cc
index a3d9c0f03c8ade2553bad5721d4e15e6fd658074..b3b043cbf9144013bf7903121575b31b348ea87e 100644
--- a/chrome/browser/ui/views/overlay/close_image_button.cc
+++ b/chrome/browser/ui/views/overlay/close_image_button.cc
@@ -6,7 +6,7 @@
#include "build/chromeos_buildflags.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.h"
diff --git a/chrome/browser/ui/views/overlay/document_overlay_window_views.cc b/chrome/browser/ui/views/overlay/document_overlay_window_views.cc
index 27e776fcf770b0ef72151d98d07778badabe807e..f7fb7850497a289ca8627752ba952d9f59468079 100644
index 3309906bcae27ba89d73ce4fba49843a10cd31f6..9f828f70606238186b35b5e1ca8751134eaf3c33 100644
--- a/chrome/browser/ui/views/overlay/document_overlay_window_views.cc
+++ b/chrome/browser/ui/views/overlay/document_overlay_window_views.cc
@@ -15,15 +15,19 @@
@@ -15,24 +15,28 @@
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "chrome/app/vector_icons/vector_icons.h"
@@ -32,6 +71,16 @@ index 27e776fcf770b0ef72151d98d07778badabe807e..f7fb7850497a289ca8627752ba952d9f
#include "chrome/browser/ui/views/overlay/back_to_tab_image_button.h"
#include "chrome/browser/ui/views/overlay/close_image_button.h"
#include "chrome/browser/ui/views/overlay/resize_handle_button.h"
-#include "chrome/grit/generated_resources.h"
#include "components/omnibox/browser/location_bar_model_impl.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/document_picture_in_picture_window_controller.h"
#include "content/public/browser/picture_in_picture_window_controller.h"
#include "content/public/browser/web_contents.h"
+#include "electron/grit/electron_resources.h"
#include "content/public/common/content_constants.h"
#include "media/base/media_switches.h"
#include "media/base/video_util.h"
@@ -57,7 +61,7 @@
#include "ui/aura/window.h"
#endif
@@ -112,11 +161,24 @@ index b2b178ccadce82f8d4ec8e5a6dafe1c67bcecd74..603d82a461c4c443ac26c85a46fbd866
// OverlayWindowViews
bool ControlsHitTestContainsPoint(const gfx::Point& point) override;
diff --git a/chrome/browser/ui/views/overlay/hang_up_button.cc b/chrome/browser/ui/views/overlay/hang_up_button.cc
index 75bfe0f7a4d759f677cad5c365fa7f98121d54de..cb251381f1c77ad01d4906132f3d68865aaace10 100644
--- a/chrome/browser/ui/views/overlay/hang_up_button.cc
+++ b/chrome/browser/ui/views/overlay/hang_up_button.cc
@@ -6,7 +6,7 @@
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/views/overlay/constants.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
diff --git a/chrome/browser/ui/views/overlay/overlay_window_views.cc b/chrome/browser/ui/views/overlay/overlay_window_views.cc
index 55b53039e4db6afa197fbb61c40d0a21095c5bf9..9dfdd0288391aac31556c716d24c66d123fbd783 100644
index 850b34e3b40f7ff1848c66158976db079e0853bd..105dbc3661eb2710b2f10ca6584e85c36ad14705 100644
--- a/chrome/browser/ui/views/overlay/overlay_window_views.cc
+++ b/chrome/browser/ui/views/overlay/overlay_window_views.cc
@@ -14,9 +14,11 @@
@@ -14,13 +14,15 @@
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
@@ -124,10 +186,15 @@ index 55b53039e4db6afa197fbb61c40d0a21095c5bf9..9dfdd0288391aac31556c716d24c66d1
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/grit/generated_resources.h"
+#endif
#include "chrome/grit/generated_resources.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/picture_in_picture_window_controller.h"
#include "content/public/browser/web_contents.h"
+#include "electron/grit/electron_resources.h"
#include "ui/base/hit_test.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
@@ -36,7 +38,7 @@
#include "ui/aura/window.h"
#endif
@@ -137,8 +204,86 @@ index 55b53039e4db6afa197fbb61c40d0a21095c5bf9..9dfdd0288391aac31556c716d24c66d1
#include "chrome/browser/shell_integration_win.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
diff --git a/chrome/browser/ui/views/overlay/playback_image_button.cc b/chrome/browser/ui/views/overlay/playback_image_button.cc
index cb1621a9deefcec601d7537e2cc2fbd24e5f7f64..2d74ab12e1eaf77a6f9dde13e894172d6835e061 100644
--- a/chrome/browser/ui/views/overlay/playback_image_button.cc
+++ b/chrome/browser/ui/views/overlay/playback_image_button.cc
@@ -7,7 +7,7 @@
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/views/overlay/constants.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
diff --git a/chrome/browser/ui/views/overlay/resize_handle_button.cc b/chrome/browser/ui/views/overlay/resize_handle_button.cc
index 8bf217b9b0c2bd22d6940c24c58eccb9865c5286..91f061a1243135db475371dda00c2fe054f4e8e3 100644
--- a/chrome/browser/ui/views/overlay/resize_handle_button.cc
+++ b/chrome/browser/ui/views/overlay/resize_handle_button.cc
@@ -6,7 +6,7 @@
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "ui/base/hit_test.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
diff --git a/chrome/browser/ui/views/overlay/skip_ad_label_button.cc b/chrome/browser/ui/views/overlay/skip_ad_label_button.cc
index 51c7db1bfbd3c03b9cb2786c8c7482b33e3aca0b..2890f7420d2fd258f84019963eab6c9606e228db 100644
--- a/chrome/browser/ui/views/overlay/skip_ad_label_button.cc
+++ b/chrome/browser/ui/views/overlay/skip_ad_label_button.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/ui/views/overlay/skip_ad_label_button.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/gfx/color_palette.h"
diff --git a/chrome/browser/ui/views/overlay/toggle_camera_button.cc b/chrome/browser/ui/views/overlay/toggle_camera_button.cc
index 20b82ff4dcf7fef3315b2b47bb480446509c6541..244a50e57b6c12680405c92f0ecbdbdb8bcfcb4f 100644
--- a/chrome/browser/ui/views/overlay/toggle_camera_button.cc
+++ b/chrome/browser/ui/views/overlay/toggle_camera_button.cc
@@ -6,7 +6,7 @@
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/views/overlay/constants.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
diff --git a/chrome/browser/ui/views/overlay/toggle_microphone_button.cc b/chrome/browser/ui/views/overlay/toggle_microphone_button.cc
index 1a1edb6321490fdbf5cd347cb3d2cb9a6a5b1080..1e959cf1c8fe356ab4427e4bf4f8da1028f4575f 100644
--- a/chrome/browser/ui/views/overlay/toggle_microphone_button.cc
+++ b/chrome/browser/ui/views/overlay/toggle_microphone_button.cc
@@ -6,7 +6,7 @@
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/views/overlay/constants.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
diff --git a/chrome/browser/ui/views/overlay/track_image_button.cc b/chrome/browser/ui/views/overlay/track_image_button.cc
index 5e136488b37887e9523ac04a9ff4ccdfaf96c104..24899f4c2b6fe66b96a6728bf747f1aad66f20a9 100644
--- a/chrome/browser/ui/views/overlay/track_image_button.cc
+++ b/chrome/browser/ui/views/overlay/track_image_button.cc
@@ -6,7 +6,7 @@
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
-#include "chrome/grit/generated_resources.h"
+#include "electron/grit/electron_resources.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
index c1d2614f3ae3e7256db95a2cd3c5253ab6b25bd0..cabe6f261c863c35882deb8f850194e27f78a4f9 100644
index c24fdd1360e582293a8b21b2f29dc6bc02b564c9..24bb07ae2efaad2e7f5957a73585885168349109 100644
--- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
+++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
@@ -15,9 +15,11 @@
@@ -153,6 +298,18 @@ index c1d2614f3ae3e7256db95a2cd3c5253ab6b25bd0..cabe6f261c863c35882deb8f850194e2
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/views/overlay/back_to_tab_image_button.h"
#include "chrome/browser/ui/views/overlay/back_to_tab_label_button.h"
@@ -29,10 +31,10 @@
#include "chrome/browser/ui/views/overlay/toggle_camera_button.h"
#include "chrome/browser/ui/views/overlay/toggle_microphone_button.h"
#include "chrome/browser/ui/views/overlay/track_image_button.h"
-#include "chrome/grit/generated_resources.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/video_picture_in_picture_window_controller.h"
#include "content/public/browser/web_contents.h"
+#include "electron/grit/electron_resources.h"
#include "media/base/media_switches.h"
#include "media/base/video_util.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -56,7 +58,7 @@
#include "ui/aura/window.h"
#endif
@@ -162,7 +319,7 @@ index c1d2614f3ae3e7256db95a2cd3c5253ab6b25bd0..cabe6f261c863c35882deb8f850194e2
#include "chrome/browser/shell_integration_win.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
@@ -166,7 +168,7 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create(
@@ -167,7 +169,7 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create(
overlay_window->Init(std::move(params));
overlay_window->OnRootViewReady();

View File

@@ -8,7 +8,7 @@ needed in chromium but our autofill implementation uses them. This patch can be
our autofill implementation to work like Chromium's.
diff --git a/ui/color/color_id.h b/ui/color/color_id.h
index 14d91a0d19c01a856a9614b127a4ef3655614684..a243dd71886af7c5313b16a8522a50ae50af5959 100644
index 13c1a8c9760fa0f286c6c5adc8f74fdae910ab50..b7a967642ff059c97f55002a9a0962709d806959 100644
--- a/ui/color/color_id.h
+++ b/ui/color/color_id.h
@@ -128,6 +128,16 @@
@@ -37,10 +37,10 @@ index 14d91a0d19c01a856a9614b127a4ef3655614684..a243dd71886af7c5313b16a8522a50ae
#if BUILDFLAG(IS_CHROMEOS)
diff --git a/ui/color/ui_color_mixer.cc b/ui/color/ui_color_mixer.cc
index 8b5b8c6321aaf668ad90870a0567c1a97d268323..8296b2c017f1774c1a38d931add2b7cac4f57dfe 100644
index 3e44d34fe1317822c340ebbcc895d7d8b55bed0b..be1737a96058c29d03645cc00999b6d7fc315f48 100644
--- a/ui/color/ui_color_mixer.cc
+++ b/ui/color/ui_color_mixer.cc
@@ -149,6 +149,17 @@ void AddUiColorMixer(ColorProvider* provider,
@@ -148,6 +148,17 @@ void AddUiColorMixer(ColorProvider* provider,
SetAlpha(GetColorWithMaxContrast(kColorOverlayScrollbarFillHoveredLight),
gfx::kGoogleGreyAlpha500);
mixer[kColorProgressBar] = {kColorAccent};
@@ -58,7 +58,7 @@ index 8b5b8c6321aaf668ad90870a0567c1a97d268323..8296b2c017f1774c1a38d931add2b7ca
mixer[kColorSeparator] = {kColorMidground};
mixer[kColorShadowBase] = {dark_mode ? SK_ColorBLACK : gfx::kGoogleGrey800};
mixer[kColorShadowValueAmbientShadowElevationThree] =
@@ -228,6 +239,7 @@ void AddUiColorMixer(ColorProvider* provider,
@@ -223,6 +234,7 @@ void AddUiColorMixer(ColorProvider* provider,
mixer[kColorTreeNodeForegroundSelectedFocused] = {kColorTreeNodeForeground};
mixer[kColorTreeNodeForegroundSelectedUnfocused] = {
kColorTreeNodeForegroundSelectedFocused};

View File

@@ -0,0 +1,641 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Darshan Sen <raisinten@gmail.com>
Date: Fri, 17 Jun 2022 13:19:32 +0530
Subject: posix: Replace DoubleForkAndExec() with ForkAndSpawn()
The DoubleForkAndExec() function was taking over 622 milliseconds to run
on macOS 11 (BigSur) on Intel i5-1038NG7. I did some debugging by adding
some custom traces and found that the fork() syscall is the bottleneck
here, i.e., the first fork() takes around 359 milliseconds and the
nested fork() takes around 263 milliseconds. Replacing the nested fork()
and exec() with posix_spawn() reduces the time consumption to 257
milliseconds!
See https://github.com/libuv/libuv/pull/3064 to know why fork() is so
slow on macOS and why posix_spawn() is a better replacement.
Another point to note is that even base::LaunchProcess() from Chromium
calls posix_spawnp() on macOS -
https://source.chromium.org/chromium/chromium/src/+/8f8d82dea0fa8f11f57c74dbb65126f8daba58f7:base/process/launch_mac.cc;l=295-296
Change-Id: I25c6ee9629a1ae5d0c32b361b56a1ce0b4b0fd26
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3641386
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
diff --git a/third_party/crashpad/crashpad/AUTHORS b/third_party/crashpad/crashpad/AUTHORS
index 8dcac3238870920d374b86033d05d77ebde351e9..02103924332eddbd158c04f8a395bb4a247e8bd9 100644
--- a/third_party/crashpad/crashpad/AUTHORS
+++ b/third_party/crashpad/crashpad/AUTHORS
@@ -12,3 +12,4 @@ Opera Software ASA
Vewd Software AS
LG Electronics, Inc.
MIPS Technologies, Inc.
+Darshan Sen <raisinten@gmail.com>
diff --git a/third_party/crashpad/crashpad/client/crashpad_client_linux.cc b/third_party/crashpad/crashpad/client/crashpad_client_linux.cc
index 53c2dadac9d6cb74a3c3e07d9917e9162474b8a0..6761db0e8ac5edba6fac90cdf79e38dfd4cd9d70 100644
--- a/third_party/crashpad/crashpad/client/crashpad_client_linux.cc
+++ b/third_party/crashpad/crashpad/client/crashpad_client_linux.cc
@@ -45,7 +45,7 @@
#include "util/linux/socket.h"
#include "util/misc/address_sanitizer.h"
#include "util/misc/from_pointer_cast.h"
-#include "util/posix/double_fork_and_exec.h"
+#include "util/posix/fork_and_spawn.h"
#include "util/posix/scoped_mmap.h"
#include "util/posix/signals.h"
@@ -454,7 +454,7 @@ bool CrashpadClient::StartHandler(
argv.push_back(FormatArgumentInt("initial-client-fd", handler_sock.get()));
argv.push_back("--shared-client-connection");
- if (!DoubleForkAndExec(argv, nullptr, handler_sock.get(), false, nullptr)) {
+ if (!ForkAndSpawn(argv, nullptr, handler_sock.get(), false, nullptr)) {
return false;
}
@@ -609,7 +609,7 @@ bool CrashpadClient::StartJavaHandlerForClient(
int socket) {
std::vector<std::string> argv = BuildAppProcessArgs(
class_name, database, metrics_dir, url, annotations, arguments, socket);
- return DoubleForkAndExec(argv, env, socket, false, nullptr);
+ return ForkAndSpawn(argv, env, socket, false, nullptr);
}
bool CrashpadClient::StartHandlerWithLinkerAtCrash(
@@ -658,7 +658,7 @@ bool CrashpadClient::StartHandlerWithLinkerForClient(
annotations,
arguments,
socket);
- return DoubleForkAndExec(argv, env, socket, false, nullptr);
+ return ForkAndSpawn(argv, env, socket, false, nullptr);
}
#endif
@@ -692,7 +692,7 @@ bool CrashpadClient::StartHandlerForClient(
argv.push_back(FormatArgumentInt("initial-client-fd", socket));
- return DoubleForkAndExec(argv, nullptr, socket, true, nullptr);
+ return ForkAndSpawn(argv, nullptr, socket, true, nullptr);
}
// static
diff --git a/third_party/crashpad/crashpad/client/crashpad_client_mac.cc b/third_party/crashpad/crashpad/client/crashpad_client_mac.cc
index 39e35678ecdd036f8c8ae27c973c27102b77da96..84385f2569f2bd00ca8aed0aa332fb450b2de1d3 100644
--- a/third_party/crashpad/crashpad/client/crashpad_client_mac.cc
+++ b/third_party/crashpad/crashpad/client/crashpad_client_mac.cc
@@ -36,7 +36,7 @@
#include "util/mach/notify_server.h"
#include "util/misc/clock.h"
#include "util/misc/implicit_cast.h"
-#include "util/posix/double_fork_and_exec.h"
+#include "util/posix/fork_and_spawn.h"
namespace crashpad {
@@ -343,7 +343,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface {
// this parent process, which was probably using the exception server now
// being restarted. The handler cant monitor itself for its own crashes via
// this interface.
- if (!DoubleForkAndExec(
+ if (!ForkAndSpawn(
argv,
nullptr,
server_write_fd.get(),
diff --git a/third_party/crashpad/crashpad/handler/linux/cros_crash_report_exception_handler.cc b/third_party/crashpad/crashpad/handler/linux/cros_crash_report_exception_handler.cc
index 9e58d94aa499fdb7271a78ea21a1dcc1b12e3a52..3caa3b987b35be575558a312026cf6f19485c418 100644
--- a/third_party/crashpad/crashpad/handler/linux/cros_crash_report_exception_handler.cc
+++ b/third_party/crashpad/crashpad/handler/linux/cros_crash_report_exception_handler.cc
@@ -29,7 +29,7 @@
#include "util/linux/ptrace_client.h"
#include "util/misc/metrics.h"
#include "util/misc/uuid.h"
-#include "util/posix/double_fork_and_exec.h"
+#include "util/posix/fork_and_spawn.h"
namespace crashpad {
@@ -266,12 +266,11 @@ bool CrosCrashReportExceptionHandler::HandleExceptionWithConnection(
argv.push_back("--always_allow_feedback");
}
- if (!DoubleForkAndExec(argv,
- nullptr /* envp */,
- file_writer.fd() /* preserve_fd */,
- false /* use_path */,
- nullptr /* child_function */)) {
- LOG(ERROR) << "DoubleForkAndExec failed";
+ if (!ForkAndSpawn(argv,
+ nullptr /* envp */,
+ file_writer.fd() /* preserve_fd */,
+ false /* use_path */,
+ nullptr /* child_function */)) {
Metrics::ExceptionCaptureResult(
Metrics::CaptureResult::kFinishedWritingCrashReportFailed);
return false;
diff --git a/third_party/crashpad/crashpad/util/BUILD.gn b/third_party/crashpad/crashpad/util/BUILD.gn
index 30f03b13f3a018e6a96b0689452a344992675c23..64fa2e9e89b700d8a265a9737cb6a30a210cdffe 100644
--- a/third_party/crashpad/crashpad/util/BUILD.gn
+++ b/third_party/crashpad/crashpad/util/BUILD.gn
@@ -296,10 +296,10 @@ crashpad_static_library("util") {
sources += [
"posix/close_multiple.cc",
"posix/close_multiple.h",
- "posix/double_fork_and_exec.cc",
- "posix/double_fork_and_exec.h",
"posix/drop_privileges.cc",
"posix/drop_privileges.h",
+ "posix/fork_and_spawn.cc",
+ "posix/fork_and_spawn.h",
"posix/process_info.h",
# These map signals to and from strings. While Fuchsia defines some of
diff --git a/third_party/crashpad/crashpad/util/posix/double_fork_and_exec.cc b/third_party/crashpad/crashpad/util/posix/double_fork_and_exec.cc
deleted file mode 100644
index 1960430954d3f6459dce688493db5c42047567b0..0000000000000000000000000000000000000000
--- a/third_party/crashpad/crashpad/util/posix/double_fork_and_exec.cc
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright 2017 The Crashpad Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "util/posix/double_fork_and_exec.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include "base/check_op.h"
-#include "base/logging.h"
-#include "base/posix/eintr_wrapper.h"
-#include "base/strings/stringprintf.h"
-#include "util/posix/close_multiple.h"
-
-namespace crashpad {
-
-bool DoubleForkAndExec(const std::vector<std::string>& argv,
- const std::vector<std::string>* envp,
- int preserve_fd,
- bool use_path,
- void (*child_function)()) {
- DCHECK(!envp || !use_path);
-
- // argv_c contains const char* pointers and is terminated by nullptr. This is
- // suitable for passing to execv(). Although argv_c is not used in the parent
- // process, it must be built in the parent process because its unsafe to do
- // so in the child or grandchild process.
- std::vector<const char*> argv_c;
- argv_c.reserve(argv.size() + 1);
- for (const std::string& argument : argv) {
- argv_c.push_back(argument.c_str());
- }
- argv_c.push_back(nullptr);
-
- std::vector<const char*> envp_c;
- if (envp) {
- envp_c.reserve(envp->size() + 1);
- for (const std::string& variable : *envp) {
- envp_c.push_back(variable.c_str());
- }
- envp_c.push_back(nullptr);
- }
-
- // Double-fork(). The three processes involved are parent, child, and
- // grandchild. The grandchild will call execv(). The child exits immediately
- // after spawning the grandchild, so the grandchild becomes an orphan and its
- // parent process ID becomes 1. This relieves the parent and child of the
- // responsibility to reap the grandchild with waitpid() or similar. The
- // grandchild is expected to outlive the parent process, so the parent
- // shouldnt be concerned with reaping it. This approach means that accidental
- // early termination of the handler process will not result in a zombie
- // process.
- pid_t pid = fork();
- if (pid < 0) {
- PLOG(ERROR) << "fork";
- return false;
- }
-
- if (pid == 0) {
- // Child process.
-
- if (child_function) {
- child_function();
- }
-
- // Call setsid(), creating a new process group and a new session, both led
- // by this process. The new process group has no controlling terminal. This
- // disconnects it from signals generated by the parent process terminal.
- //
- // setsid() is done in the child instead of the grandchild so that the
- // grandchild will not be a session leader. If it were a session leader, an
- // accidental open() of a terminal device without O_NOCTTY would make that
- // terminal the controlling terminal.
- //
- // Its not desirable for the grandchild to have a controlling terminal. The
- // grandchild manages its own lifetime, such as by monitoring clients on its
- // own and exiting when it loses all clients and when it deems it
- // appropraite to do so. It may serve clients in different process groups or
- // sessions than its original client, and receiving signals intended for its
- // original clients process group could be harmful in that case.
- PCHECK(setsid() != -1) << "setsid";
-
- pid = fork();
- if (pid < 0) {
- PLOG(FATAL) << "fork";
- }
-
- if (pid > 0) {
- // Child process.
-
- // _exit() instead of exit(), because fork() was called.
- _exit(EXIT_SUCCESS);
- }
-
- // Grandchild process.
-
- CloseMultipleNowOrOnExec(STDERR_FILENO + 1, preserve_fd);
-
- // &argv_c[0] is a pointer to a pointer to const char data, but because of
- // how C (not C++) works, execvp() wants a pointer to a const pointer to
- // char data. It modifies neither the data nor the pointers, so the
- // const_cast is safe.
- char* const* argv_for_execv = const_cast<char* const*>(&argv_c[0]);
-
- if (envp) {
- // This cast is safe for the same reason that the argv_for_execv cast is.
- char* const* envp_for_execv = const_cast<char* const*>(&envp_c[0]);
- execve(argv_for_execv[0], argv_for_execv, envp_for_execv);
- PLOG(FATAL) << "execve " << argv_for_execv[0];
- }
-
- if (use_path) {
- execvp(argv_for_execv[0], argv_for_execv);
- PLOG(FATAL) << "execvp " << argv_for_execv[0];
- }
-
- execv(argv_for_execv[0], argv_for_execv);
- PLOG(FATAL) << "execv " << argv_for_execv[0];
- }
-
- // waitpid() for the child, so that it does not become a zombie process. The
- // child normally exits quickly.
- //
- // Failures from this point on may result in the accumulation of a zombie, but
- // should not be considered fatal. Log only warnings, but dont treat these
- // failures as a failure of the function overall.
- int status;
- pid_t wait_pid = HANDLE_EINTR(waitpid(pid, &status, 0));
- if (wait_pid == -1) {
- PLOG(WARNING) << "waitpid";
- return true;
- }
- DCHECK_EQ(wait_pid, pid);
-
- if (WIFSIGNALED(status)) {
- int sig = WTERMSIG(status);
- LOG(WARNING) << base::StringPrintf(
- "intermediate process terminated by signal %d (%s)%s",
- sig,
- strsignal(sig),
- WCOREDUMP(status) ? " (core dumped)" : "");
- } else if (!WIFEXITED(status)) {
- LOG(WARNING) << base::StringPrintf(
- "intermediate process: unknown termination 0x%x", status);
- } else if (WEXITSTATUS(status) != EXIT_SUCCESS) {
- LOG(WARNING) << "intermediate process exited with code "
- << WEXITSTATUS(status);
- }
-
- return true;
-}
-
-} // namespace crashpad
diff --git a/third_party/crashpad/crashpad/util/posix/fork_and_spawn.cc b/third_party/crashpad/crashpad/util/posix/fork_and_spawn.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c6a95bbfdcba45995b0034789c8bdb4423a25642
--- /dev/null
+++ b/third_party/crashpad/crashpad/util/posix/fork_and_spawn.cc
@@ -0,0 +1,235 @@
+// Copyright 2017 The Crashpad Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "util/posix/fork_and_spawn.h"
+
+#include <errno.h>
+#include <spawn.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#include "base/check.h"
+#include "base/check_op.h"
+#include "base/logging.h"
+#include "base/posix/eintr_wrapper.h"
+#include "base/strings/stringprintf.h"
+#include "build/build_config.h"
+#include "util/posix/close_multiple.h"
+
+extern char** environ;
+
+namespace crashpad {
+
+namespace {
+
+#if BUILDFLAG(IS_APPLE)
+
+class PosixSpawnAttr {
+ public:
+ PosixSpawnAttr() {
+ PCHECK((errno = posix_spawnattr_init(&attr_)) == 0)
+ << "posix_spawnattr_init";
+ }
+
+ PosixSpawnAttr(const PosixSpawnAttr&) = delete;
+ PosixSpawnAttr& operator=(const PosixSpawnAttr&) = delete;
+
+ ~PosixSpawnAttr() {
+ PCHECK((errno = posix_spawnattr_destroy(&attr_)) == 0)
+ << "posix_spawnattr_destroy";
+ }
+
+ void SetFlags(short flags) {
+ PCHECK((errno = posix_spawnattr_setflags(&attr_, flags)) == 0)
+ << "posix_spawnattr_setflags";
+ }
+
+ const posix_spawnattr_t* Get() const { return &attr_; }
+
+ private:
+ posix_spawnattr_t attr_;
+};
+
+class PosixSpawnFileActions {
+ public:
+ PosixSpawnFileActions() {
+ PCHECK((errno = posix_spawn_file_actions_init(&file_actions_)) == 0)
+ << "posix_spawn_file_actions_init";
+ }
+
+ PosixSpawnFileActions(const PosixSpawnFileActions&) = delete;
+ PosixSpawnFileActions& operator=(const PosixSpawnFileActions&) = delete;
+
+ ~PosixSpawnFileActions() {
+ PCHECK((errno = posix_spawn_file_actions_destroy(&file_actions_)) == 0)
+ << "posix_spawn_file_actions_destroy";
+ }
+
+ void AddInheritedFileDescriptor(int fd) {
+ PCHECK((errno = posix_spawn_file_actions_addinherit_np(&file_actions_,
+ fd)) == 0)
+ << "posix_spawn_file_actions_addinherit_np";
+ }
+
+ const posix_spawn_file_actions_t* Get() const { return &file_actions_; }
+
+ private:
+ posix_spawn_file_actions_t file_actions_;
+};
+
+#endif
+
+} // namespace
+
+bool ForkAndSpawn(const std::vector<std::string>& argv,
+ const std::vector<std::string>* envp,
+ int preserve_fd,
+ bool use_path,
+ void (*child_function)()) {
+ // argv_c contains const char* pointers and is terminated by nullptr. This is
+ // suitable for passing to posix_spawn() or posix_spawnp(). Although argv_c is
+ // not used in the parent process, it must be built in the parent process
+ // because its unsafe to do so in the child.
+ std::vector<const char*> argv_c;
+ argv_c.reserve(argv.size() + 1);
+ for (const std::string& argument : argv) {
+ argv_c.push_back(argument.c_str());
+ }
+ argv_c.push_back(nullptr);
+
+ std::vector<const char*> envp_c;
+ if (envp) {
+ envp_c.reserve(envp->size() + 1);
+ for (const std::string& variable : *envp) {
+ envp_c.push_back(variable.c_str());
+ }
+ envp_c.push_back(nullptr);
+ }
+
+ // The three processes involved are parent, child, and grandchild. The child
+ // exits immediately after spawning the grandchild, so the grandchild becomes
+ // an orphan and its parent process ID becomes 1. This relieves the parent and
+ // child of the responsibility to reap the grandchild with waitpid() or
+ // similar. The grandchild is expected to outlive the parent process, so the
+ // parent shouldnt be concerned with reaping it. This approach means that
+ // accidental early termination of the handler process will not result in a
+ // zombie process.
+ pid_t pid = fork();
+ if (pid < 0) {
+ PLOG(ERROR) << "fork";
+ return false;
+ }
+
+ if (pid == 0) {
+ // Child process.
+
+ if (child_function) {
+ child_function();
+ }
+
+ // Call setsid(), creating a new process group and a new session, both led
+ // by this process. The new process group has no controlling terminal. This
+ // disconnects it from signals generated by the parent process terminal.
+ //
+ // setsid() is done in the child instead of the grandchild so that the
+ // grandchild will not be a session leader. If it were a session leader, an
+ // accidental open() of a terminal device without O_NOCTTY would make that
+ // terminal the controlling terminal.
+ //
+ // Its not desirable for the grandchild to have a controlling terminal. The
+ // grandchild manages its own lifetime, such as by monitoring clients on its
+ // own and exiting when it loses all clients and when it deems it
+ // appropraite to do so. It may serve clients in different process groups or
+ // sessions than its original client, and receiving signals intended for its
+ // original clients process group could be harmful in that case.
+ PCHECK(setsid() != -1) << "setsid";
+
+ // &argv_c[0] is a pointer to a pointer to const char data, but because of
+ // how C (not C++) works, posix_spawn() and posix_spawnp() want a pointer to
+ // a const pointer to char data. They modifies neither the data nor the
+ // pointers, so the const_cast is safe.
+ char* const* argv_for_spawn = const_cast<char* const*>(argv_c.data());
+
+ // This cast is safe for the same reason that the argv_for_spawn cast is.
+ char* const* envp_for_spawn =
+ envp ? const_cast<char* const*>(envp_c.data()) : environ;
+
+#if BUILDFLAG(IS_APPLE)
+ PosixSpawnAttr attr;
+ attr.SetFlags(POSIX_SPAWN_CLOEXEC_DEFAULT);
+
+ PosixSpawnFileActions file_actions;
+ for (int fd = 0; fd <= STDERR_FILENO; ++fd) {
+ file_actions.AddInheritedFileDescriptor(fd);
+ }
+ file_actions.AddInheritedFileDescriptor(preserve_fd);
+
+ const posix_spawnattr_t* attr_p = attr.Get();
+ const posix_spawn_file_actions_t* file_actions_p = file_actions.Get();
+#else
+ CloseMultipleNowOrOnExec(STDERR_FILENO + 1, preserve_fd);
+
+ const posix_spawnattr_t* attr_p = nullptr;
+ const posix_spawn_file_actions_t* file_actions_p = nullptr;
+#endif
+
+ auto posix_spawn_fp = use_path ? posix_spawnp : posix_spawn;
+ if ((errno = posix_spawn_fp(&pid,
+ argv_for_spawn[0],
+ file_actions_p,
+ attr_p,
+ argv_for_spawn,
+ envp_for_spawn)) != 0) {
+ PLOG(FATAL) << (use_path ? "posix_spawnp" : "posix_spawn");
+ }
+
+ // _exit() instead of exit(), because fork() was called.
+ _exit(EXIT_SUCCESS);
+ }
+
+ // waitpid() for the child, so that it does not become a zombie process. The
+ // child normally exits quickly.
+ //
+ // Failures from this point on may result in the accumulation of a zombie, but
+ // should not be considered fatal. Log only warnings, but dont treat these
+ // failures as a failure of the function overall.
+ int status;
+ pid_t wait_pid = HANDLE_EINTR(waitpid(pid, &status, 0));
+ if (wait_pid == -1) {
+ PLOG(WARNING) << "waitpid";
+ return true;
+ }
+ DCHECK_EQ(wait_pid, pid);
+
+ if (WIFSIGNALED(status)) {
+ int sig = WTERMSIG(status);
+ LOG(WARNING) << base::StringPrintf(
+ "intermediate process terminated by signal %d (%s)%s",
+ sig,
+ strsignal(sig),
+ WCOREDUMP(status) ? " (core dumped)" : "");
+ } else if (!WIFEXITED(status)) {
+ LOG(WARNING) << base::StringPrintf(
+ "intermediate process: unknown termination 0x%x", status);
+ } else if (WEXITSTATUS(status) != EXIT_SUCCESS) {
+ LOG(WARNING) << "intermediate process exited with code "
+ << WEXITSTATUS(status);
+ }
+
+ return true;
+}
+
+} // namespace crashpad
diff --git a/third_party/crashpad/crashpad/util/posix/double_fork_and_exec.h b/third_party/crashpad/crashpad/util/posix/fork_and_spawn.h
similarity index 76%
rename from third_party/crashpad/crashpad/util/posix/double_fork_and_exec.h
rename to third_party/crashpad/crashpad/util/posix/fork_and_spawn.h
index 02fc0f28f196b447132a2dcfaebdaaa5a916a38a..fc55aa3a37652e4ba18c66db90124abd9cad2e51 100644
--- a/third_party/crashpad/crashpad/util/posix/double_fork_and_exec.h
+++ b/third_party/crashpad/crashpad/util/posix/fork_and_spawn.h
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#ifndef CRASHPAD_UTIL_POSIX_DOUBLE_FORK_AND_EXEC_H_
-#define CRASHPAD_UTIL_POSIX_DOUBLE_FORK_AND_EXEC_H_
+#ifndef CRASHPAD_UTIL_POSIX_FORK_AND_SPAWN_H_
+#define CRASHPAD_UTIL_POSIX_FORK_AND_SPAWN_H_
#include <string>
#include <vector>
@@ -23,7 +23,7 @@ namespace crashpad {
//! \brief Executes a (grand-)child process.
//!
//! The grandchild process will be started through the
-//! double-`fork()`-and-`execv()` pattern. This allows the grandchild to fully
+//! `fork()`-and-`posix_spawn()` pattern. This allows the grandchild to fully
//! disassociate from the parent. The grandchild will not be a member of the
//! parents process group or session and will not have a controlling terminal,
//! providing isolation from signals not intended for it. The grandchilds
@@ -37,7 +37,7 @@ namespace crashpad {
//! \param[in] argv The argument vector to start the grandchild process with.
//! `argv[0]` is used as the path to the executable.
//! \param[in] envp A vector of environment variables of the form `var=value` to
-//! be passed to `execve()`. If this value is `nullptr`, the current
+//! be passed to `posix_spawn()`. If this value is `nullptr`, the current
//! environment is used.
//! \param[in] preserve_fd A file descriptor to be inherited by the grandchild
//! process. This file descriptor is inherited in addition to the three file
@@ -45,16 +45,13 @@ namespace crashpad {
//! if no additional file descriptors are to be inherited.
//! \param[in] use_path Whether to consult the `PATH` environment variable when
//! requested to start an executable at a non-absolute path. If `false`,
-//! `execv()`, which does not consult `PATH`, will be used. If `true`,
-//! `execvp()`, which does consult `PATH`, will be used.
+//! `posix_spawn()`, which does not consult `PATH`, will be used. If `true`,
+//! `posix_spawnp()`, which does consult `PATH`, will be used.
//! \param[in] child_function If not `nullptr`, this function will be called in
-//! the intermediate child process, prior to the second `fork()`. Take note
+//! the intermediate child process, prior to the `posix_spawn()`. Take note
//! that this function will run in the context of a forked process, and must
//! be safe for that purpose.
//!
-//! Setting both \a envp to a value other than `nullptr` and \a use_path to
-//! `true` is not currently supported.
-//!
//! \return `true` on success, and `false` on failure with a message logged.
//! Only failures that occur in the parent process that indicate a definite
//! failure to start the the grandchild are reported in the return value.
@@ -63,12 +60,12 @@ namespace crashpad {
//! terminating. The caller assumes the responsibility for detecting such
//! failures, for example, by observing a failure to perform a successful
//! handshake with the grandchild process.
-bool DoubleForkAndExec(const std::vector<std::string>& argv,
- const std::vector<std::string>* envp,
- int preserve_fd,
- bool use_path,
- void (*child_function)());
+bool ForkAndSpawn(const std::vector<std::string>& argv,
+ const std::vector<std::string>* envp,
+ int preserve_fd,
+ bool use_path,
+ void (*child_function)());
} // namespace crashpad
-#endif // CRASHPAD_UTIL_POSIX_DOUBLE_FORK_AND_EXEC_H_
+#endif // CRASHPAD_UTIL_POSIX_FORK_AND_SPAWN_H_

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