Compare commits

..

95 Commits

Author SHA1 Message Date
trop[bot]
1ba3da738b docs: disablewebsecurity on webview-tag can not be changed for an active session (#38397)
disablewebsecurity on webview-tag can not be changed for an active session

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>
2023-05-22 15:20:12 -04:00
David Sanders
def64aba17 docs: fix typing of message box type value (#38376)
docs: fix typing of message box type value (#38336)

* docs: fix typing of dialog type value

* test: add smoke tests

* test: update test
2023-05-22 13:20:25 +02:00
trop[bot]
d5e1edf244 fix: getNormalBounds() for transparent windows on Windows (#38347)
fix: getNormalBounds for transparent windows on Windows

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-22 10:12:45 +02:00
Pedro Pontes
53d9cdbaf0 chore: cherry-pick cf90db14f2 from chromium (#38276)
* chore: cherry-pick cf90db14f2 from chromium

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-05-18 10:16:54 -04:00
trop[bot]
08ae619c5d build: modify gclient.py with unified patch (#38369)
* build: modify gclient.py with unified patch

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* ci: ensure depot_tools does not update

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* ci: move auto-update disable outside if

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-17 19:19:22 -04:00
trop[bot]
672c31283a fix: win.isMaximized() for transparent windows on Windows (#38344)
fix: win.isMaximized() for transparent windows

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-17 14:49:10 +02:00
Pedro Pontes
a7b58871a8 chore: cherry-pick 81d7b3e613 from chromium (#38273) 2023-05-17 10:21:24 +02:00
trop[bot]
f33a5c727f fix: isMaximized after minimize/fullscreen on macOS (#38306)
fix: isMaximized after isMinimized on macOS

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-17 10:20:51 +02:00
trop[bot]
912e211f17 fix: unify BrowserWindow.isVisible() logic cross-platform (#38315)
fix: unify BrowserWindow.isVisible() logic cross-platform

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-17 10:20:39 +02:00
David Sanders
be3e7bcd97 test: prewarm Node headers cache if specifying Electron version (#38299)
test: prewarm Node headers cache if specifying Electron version (#38287)
2023-05-16 17:35:30 -04:00
trop[bot]
da7b9a17e2 build: bump brew cache to v6 (#38317)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-16 11:08:43 -04:00
trop[bot]
3e6f5ca655 fix: enable BrowserWindow.id access post-destruction (#38309)
fix: enable BrowserWindow id access post-destruction

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-05-16 14:56:37 +02:00
David Sanders
e6dc9825cc docs: fix typing of session.setDevicePermissionHandler (#38279)
docs: fix typing of session.setDevicePermissionHandler (#38188)
2023-05-14 15:01:02 +02:00
Shelley Vohr
0eb53be29a fix: handle AXManualAccessibility attribute cross-protocol (#38225)
fix: handle `AXManualAccessibility` attribute cross-protocol (#38142)

* fix: handle AXManualAccessibility attribute cross-protocol

* Update shell/browser/mac/electron_application.mm



---------

Co-authored-by: Robo <hop2deep@gmail.com>
2023-05-09 12:06:02 -04:00
Alexey Kuzmin
c9e59173d7 test: use await to call "closeWindow" (#38171) 2023-05-04 14:27:05 +02:00
David Sanders
a4ac36f52e fix: falsy transparent shouldn't affect webContents background (#38159) 2023-05-03 20:58:43 +02:00
Shelley Vohr
22140a68fd fix: AXManualAccessibility showing failure (#38151)
fix: AXManualAccessibility showing failure

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
2023-05-02 20:45:06 -04:00
John Kleinschmidt
3d773ee528 build: fixup patches (#38124) 2023-04-26 14:09:19 -04:00
Black-Hole️
510abbe71b feat: add httpOnly cookies.get filter (#38043)
feat: add `httpOnly` `cookies.get` filter (#37255)

feat: add httpOnly cookies filter
2023-04-26 13:22:39 -04:00
Black-Hole️
c6e803acfc fix: webContents return type incorrect (#38112)
fix: webContents return type incorrect (#38026)

* fix: webContents type incorrect

* fix: ci failed

* fix: ci failed 2
2023-04-25 15:08:57 +02:00
Pedro Pontes
51ed765a20 chore: cherry-pick 1d491fff578b, f7b87bea19d7 and 549d92d7ef35 from chromium (#38067)
chore: cherry-pick 1d491fff578b from chromium
2023-04-25 13:56:01 +02:00
Pedro Pontes
3f7c8cbea4 chore: cherry-pick 2b30a50d0e62 from chromium (#38057)
* chore: [23-x-y] cherry-pick 2b30a50d0e62 from chromium

* chore: update patches

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-24 14:25:36 +02:00
Pedro Pontes
5259afc54a chore: cherry-pick aed05b609629 from angle (#38063)
* chore: cherry-pick aed05b609629 from angle

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-04-24 11:09:59 +02:00
Keeley Hammond
26abaeddf1 chore: cherry-pick 5 changes from Release-2-M112 (#38083)
* chore: [23-x-y] cherry-pick 5 changes from Release-2-M112

* 1d491fff578b from chromium
* 2b30a50d0e62 from chromium
* f58218891f8c from chromium
* ec53103cc72d from chromium
* f098ff0d1230 from chromium

* chore: update patches

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-24 10:13:01 +02:00
trop[bot]
4d8b9a8eec fix: crash in utilityProcess when generating code from strings (#38040)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2023-04-24 13:22:02 +09:00
Pedro Pontes
d362c30b1d chore: cherry-pick 8421a9eebd8a and 4dc670a8c557 from skia (#38065)
* chore: cherry-pick 8421a9eebd8a from skia

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-04-23 22:20:45 +02:00
Pedro Pontes
2d582221e7 chore: cherry-pick 63686953dc22 from chromium (#38061)
* chore: cherry-pick 63686953dc22 from chromium

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-04-23 22:15:40 +02:00
Milan Burda
1d87bcdbab fix: defaults broken in shell.openExternal() options (#38091)
fix: defaults broken in shell.openExternal() options (#38038)

Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-04-23 22:14:51 +02:00
trop[bot]
e2eda11b2f build: fix building with no PDF support (#38008)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Alexey Kuzmin <alex.s.kuzmin@gmail.com>
2023-04-17 21:10:29 -04:00
Keeley Hammond
d458be2761 chore: cherry-pick 9585757f9fad from chromium (#38011)
* chore: cherry-pick 9585757f9fad from chromium

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-04-17 21:10:06 -04:00
Pedro Pontes
025e3f5313 chore: cherry-pick c605df24af3c from v8 (#37981)
* chore: cherry-pick c605df24af3c from v8

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-17 11:32:36 -04:00
Shelley Vohr
42354e6b5d build: strip warnings from stdout in get_release (#37999)
build: strip warnings from stdout in get_release
2023-04-17 11:15:00 -04:00
Shelley Vohr
0c8fff74c6 fix: avoid using v8 on Isolate termination (#38000) 2023-04-17 09:33:51 -04:00
trop[bot]
9cfddc6cc5 docs: add note to win.setFullScreen(flag) (#37995)
docs: add note to win.setFullScreen(flag)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-17 12:11:05 +02:00
Pedro Pontes
826807c6a3 chore: cherry-pick f4b66ae451c2 from v8 (#37982) 2023-04-17 11:45:04 +02:00
trop[bot]
5ecf2e24e4 fix: menus on Linux after window modification (#37908)
* fix: menus on Linux after window modification

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* test: don't run on CI

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* Update .patches

* chore: update patches

* test: refactor since types are off

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-04-14 09:18:42 -07:00
trop[bot]
07debe81dd fix: defaultFontFamily in webPreferences (#37969)
* fix: defaultFontFamily in webPreferences

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* chore: check if default_font_family_ is empty

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-13 21:08:57 -04:00
trop[bot]
578624896f docs: Fix the syntax error for code fragment (#37962)
By using `app.on('ready').then(xxx)`, application will throw a TypeError

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Zenkie Bear <62818957+ZenkieBear@users.noreply.github.com>
2023-04-13 13:28:16 +02:00
trop[bot]
678f3c12e7 fix: exceptions during function/promise result conversions live in calling world (#37924)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-04-13 15:10:57 +09:00
Darshan Sen
3e9f1e65e5 fix: recommended node-gyp version in node.h error (#37941)
fix: recommended `node-gyp` version in `node.h` error (#37829)

fix: recommended node-gyp version in node.h error

In
https://github.com/electron/electron/blob/main/docs/tutorial/using-native-node-modules.md#using-npm,
we recommend setting the `npm_config_disturl` variable but doing that
does not work on node-gyp v8.4.0 because after
https://github.com/nodejs/node-gyp/pull/2497
landed, the dist URL was read only from `gyp.opts['dist-url']`. The fix
for reading the value from `npm_config_disturl` by parsing
`gyp.opts.disturl` was landed in
https://github.com/nodejs/node-gyp/pull/2547 and that change was
released in node-gyp v9.0.0, so this change updates the error macro to
recommend node-gyp v9.0.0 as the minimum required version.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
2023-04-12 11:18:42 +02:00
trop[bot]
f20c1350a0 fix: broken buttons in PDF viewer (#37919)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-12 11:11:32 +02:00
Pedro Pontes
ab7e58bee4 chore: cherry-pick d9081493c4b2 from chromium (#37851)
* chore: cherry-pick d9081493c4b2 from chromium

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
2023-04-11 21:13:24 +02:00
trop[bot]
d7d5ec5f00 chore: use emplace when possible (#37911)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-11 21:13:01 +02:00
trop[bot]
bae3380b38 chore: change some for loops to range-based (#37914)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-11 21:12:39 +02:00
trop[bot]
5161e961c0 chore: use nested namespaces (#37916)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-11 13:23:15 +02:00
trop[bot]
675c2eb9f8 test: support 'latest'/'latest@X' Electron version strings (#37868)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-11 15:21:52 +09:00
trop[bot]
03e02b62a1 fix: showAboutPanel also on linux (#37874)
showAboutPanel also on linux

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
2023-04-11 15:20:08 +09:00
trop[bot]
7d36a23efc fix: exceptions in nested conversions live in the target world (#37898)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2023-04-10 20:00:33 -07:00
trop[bot]
e6ef31273d fix: apply csp correctly when contextIsolation: false (#37844)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2023-04-10 11:29:10 -07:00
Pedro Pontes
b3ef435586 chore: cherry-pick d6946b70b431 from chromium (#37849)
* chore: cherry-pick d6946b70b431 from chromium

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-04-06 18:52:45 +09:00
trop[bot]
26873597a1 docs: fix app.getPreferredSystemLanguages() return type (#37837)
docs: fix app.getPreferredSystemLanguages() return type

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-05 11:20:08 -04:00
trop[bot]
922581af90 fix: Fn+F fullscreen transitioning on macOS (#37822)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-05 16:37:56 +09:00
trop[bot]
f5cb867dd2 fix: set background color for menu bar on Windows (#37784)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-04-04 10:38:13 +02:00
trop[bot]
347c02ec76 fix: record helper error messages in electron_main_mac (#37812)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2023-04-03 15:22:56 -07:00
trop[bot]
2dd225e4d5 build: fix build-tools schema in config (#37778)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-31 17:46:23 +02:00
trop[bot]
c96e3b9e60 fix: draggable regions shouldn't capture clicks on frames windows (#37740)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-31 12:20:19 +02:00
John Kleinschmidt
5c51515982 docs: fixup WebUSB fiddle (#37754)
docs: fixup WebUSB fiddle (#37455)

docs: fixup webusb fiddle
(cherry picked from commit 0d3aee26b9)
2023-03-30 19:34:42 -04:00
trop[bot]
dc7a49b873 docs: add links to IPC event structures (#37771)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-03-30 20:38:02 +02:00
trop[bot]
96ee0b7c36 docs: updated package.json content and electron version in build first app guide (#37742)
* Docs: updated package.json content and electron version in build first app guide

Co-authored-by: Mikołaj <32898551+dufipl@users.noreply.github.com>

* docs: removed caret from electron version

Co-authored-by: Mikołaj Sawicki <32898551+dufipl@users.noreply.github.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Mikołaj <32898551+dufipl@users.noreply.github.com>
2023-03-29 12:09:11 +02:00
John Kleinschmidt
9e4d81fb0b fix: allow cancelling of bluetooth requests (#37720)
fix: allow cancelling of bluetooth requests (#37601)

(cherry picked from commit 6a6908c4c8)
2023-03-28 10:51:06 -04:00
trop[bot]
9bcb5dc9f7 chore: generator objects can't be sent over the context bridge (#37729)
chore: generator objects can't be sent over the context bridge (#37593)

* chore: generator objects can't be sent over the context bridge

* Trigger Build

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-28 10:50:26 -04:00
trop[bot]
62540b9120 fix: crash in MessagePortMain with some postMessage params (#37724)
* fix: crash in MessagePortMain postMessage

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* Update shell/browser/api/message_port.cc

Co-authored-by: Charles Kerr <charles@charleskerr.com>

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-28 10:38:30 -04:00
trop[bot]
ee9484e05c docs: fixup incorrect value for disabling sandbox (#37721)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Peter Xu <sysu.peter.hsu@gmail.com>
2023-03-27 20:40:48 -04:00
trop[bot]
3adb49a831 ci: fixup gn check to actually run gn check (#37680)
* ci: fixup gn check to actually run gn check

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* chore: update filenames.libcxx.gni

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-03-27 12:53:05 -04:00
Pedro Pontes
6da4c2f12a chore: cherry-pick 6da1a8953313 from angle (#37708) 2023-03-27 09:53:20 -04:00
David Sanders
75ddfcc0e2 docs: change MSDN links to new Microsoft docs (#37706) 2023-03-27 09:37:43 -04:00
John Kleinschmidt
4e692e2211 ci: update appveyor image to e-110.0.5481.208 (#37685) 2023-03-23 20:05:25 -04:00
electron-roller[bot]
e508ef2b8c chore: bump chromium to 110.0.5481.208 (23-x-y) (#37645)
chore: bump chromium in DEPS to 110.0.5481.208

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2023-03-22 22:53:01 -04:00
trop[bot]
cb5b8a6311 docs: update notifications tutorial (#37641)
* docs: update notifications tutorial

Co-authored-by: Erick Zhao <erick@hotmail.ca>

* delete unused assets

Co-authored-by: Erick Zhao <erick@hotmail.ca>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2023-03-22 10:18:20 -04:00
trop[bot]
67788dd2ba fix: invoke app.dock.{hide|show} instead of duplicating logic (#37624)
fix: invoke app.dock.{hide|show} instead of duplicating logic

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-20 20:15:30 -04:00
trop[bot]
596cb9d1ed docs: update broken links (#37622)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-03-20 12:27:40 -04:00
trop[bot]
71cce1cdd7 fix: properly bubble up cookie creation failure message (#37596)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-16 17:52:46 +01:00
trop[bot]
9b338b91ec fix: don't set delegate for QLPreviewPanel (#37577)
fix: don't set delegate for QLPreviewPanel

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Spiegel <jeremy.spiegel@frontapp.com>
2023-03-16 13:48:26 +01:00
trop[bot]
cb3a169caa feat: add enableLocalEcho flag to setDisplayMediaRequestHandler() callback (#37529)
* feat: add enableLocalEcho flag to setDisplayMediaRequestHandler() callback

Co-authored-by: Theo Gravity <theo@switchboard.app>

* Fix lint

Co-authored-by: Theo Gravity <theo@switchboard.app>

* Update doc

Co-authored-by: Theo Gravity <theo@switchboard.app>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Theo Gravity <theo@switchboard.app>
2023-03-16 10:13:02 +01:00
trop[bot]
443699a22f fix: BroadcastChannel initialization location (#37444)
* fix: `BroadcastChannel` initialization location

* fix: BroadcastChannel initialization location

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* Update .patches

chore: fixup .patches file that trop botched

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-03-16 09:56:18 +01:00
trop[bot]
269e7ba7e4 docs: clarify open-url not preventable (#37573)
docs: clarify open-url not preventable

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-14 20:20:48 -04:00
trop[bot]
4382f2adc0 fix: don't double-log unhandled rejections (#37501)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-14 11:50:46 +01:00
trop[bot]
c1b8848fd7 docs: remove outdated ipc example (#37539)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2023-03-09 10:01:20 -05:00
electron-roller[bot]
66683e5caf chore: bump chromium to 110.0.5481.192 (23-x-y) (#37533)
* chore: bump chromium in DEPS to 110.0.5481.192

* 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>
2023-03-08 17:41:11 -05:00
trop[bot]
093a215296 fix: fallback to X11 capturer if pipewire fails on Wayland (#37526)
* fix: fallback to x11 desktop capturer on Wayland

Co-authored-by: VerteDinde <keeleymhammond@gmail.com>

* fix: sanitize window/screen capturer inputs

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

* chore: clean up patch description

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

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-03-07 18:34:17 -08:00
trop[bot]
c174ed70f5 fix: WebUSB on ARM64 macs (#37521)
* fix: WebUSB on ARM64 macs

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-03-07 21:15:08 -05:00
trop[bot]
12673d8caa docs: remove misleading info from will-finish-launching docs (#37517)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2023-03-07 10:26:43 +01:00
trop[bot]
eeea337757 refactor: leverage Skia helpers for NSColor ANSI logic (#37488)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-06 11:43:00 +01:00
electron-roller[bot]
e84dde4bad chore: bump chromium to 110.0.5481.179 (23-x-y) (#37471)
chore: bump chromium in DEPS to 110.0.5481.179

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2023-03-06 11:05:08 +01:00
trop[bot]
f5385bcdec fix: draggable regions on MAS (#37473)
* fix: draggable regions on MAS

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

* lint

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2023-03-03 09:46:05 +01:00
trop[bot]
c3dfd55224 fix: handle closing webContents in BrowserViews (#37451)
* fix: handle closing webContents in BrowserViews

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* test: add window.close() test

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-02 12:23:18 +01:00
trop[bot]
99f6ff430f fix: min/max width/height enforcement when aspectRatio is set (#37457)
fix: min/max width/height with aspect ratio

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-02 12:22:56 +01:00
trop[bot]
587594eb19 chore: improve contents.takeHeapSnapshot error messages (#37460)
* chore: improve contents.takeHeapSnapshot error messages

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* fix wstring conversion issue

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-01 19:09:48 +01:00
trop[bot]
d6a6ef203a fix: Notification with reply obscuring first action on macOS (#37448)
fix: Notification with reply obscuring first action

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-03-01 13:56:05 +01:00
trop[bot]
ceb76a5fa0 fix: cookies filter secure invalid (#37248)
fix: cookies filter secure and session invalid

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Black-Hole1 <158blackhole@gmail.com>
2023-02-26 23:48:43 -08:00
trop[bot]
38f4017dd7 fix: allow contextmenu event in draggable regions (#37394)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2023-02-26 21:24:00 -08:00
Samuel Attard
74baea7283 build: set base rev 23-x-y (#37410) 2023-02-26 20:19:34 -08:00
trop[bot]
0c47264c4b docs: document change in draggable region behavior on macOS (#37408)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2023-02-26 16:52:59 -08:00
trop[bot]
43deaa422e ci: rename Electron build step to include type of build being built (#37398)
ci: rename Electron build step to describe what is being built

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-02-26 16:52:17 -08:00
electron-roller[bot]
9fbc726385 chore: bump chromium to 110.0.5481.177 (23-x-y) (#37389)
* chore: bump chromium in DEPS to 110.0.5481.177

* 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>
2023-02-23 19:15:06 +01:00
180 changed files with 4059 additions and 931 deletions

View File

@@ -51,7 +51,7 @@ jobs:
steps:
- checkout
- path-filtering/set-parameters:
base-revision: main
base-revision: origin/23-x-y
mapping: |
^((?!docs/).)*$ run-build-mac true
^((?!docs/).)*$ run-build-linux true

View File

@@ -245,14 +245,27 @@ step-depot-tools-get: &step-depot-tools-get
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
# Remove swift-format dep from cipd on macOS until we send a patch upstream.
cd depot_tools
patch gclient.py -R \<<'EOF'
676,677c676
< packages = dep_value.get('packages', [])
< for package in (x for x in packages if "infra/3pp/tools/swift-format" not in x.get('package')):
---
> for package in dep_value.get('packages', []):
cat > gclient.diff \<< 'EOF'
diff --git a/gclient.py b/gclient.py
index 3a9c5c6..f222043 100755
--- a/gclient.py
+++ b/gclient.py
@@ -712,7 +712,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
if dep_type == 'cipd':
cipd_root = self.GetCipdRoot()
- for package in dep_value.get('packages', []):
+ packages = dep_value.get('packages', [])
+ for package in (x for x in packages if "infra/3pp/tools/swift-format" not in x.get('package')):
deps_to_add.append(
CipdDependency(
parent=self,
EOF
git apply --3way gclient.diff
fi
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
touch .disable_auto_update
step-depot-tools-add-to-path: &step-depot-tools-add-to-path
run:
@@ -357,14 +370,14 @@ step-restore-brew-cache: &step-restore-brew-cache
- /usr/local/Cellar/gnu-tar
- /usr/local/bin/gtar
keys:
- v5-brew-cache-{{ arch }}
- v6-brew-cache-{{ arch }}
step-save-brew-cache: &step-save-brew-cache
save_cache:
paths:
- /usr/local/Cellar/gnu-tar
- /usr/local/bin/gtar
key: v5-brew-cache-{{ arch }}
key: v6-brew-cache-{{ arch }}
name: Persisting brew cache
step-get-more-space-on-mac: &step-get-more-space-on-mac
@@ -962,26 +975,13 @@ step-ts-compile: &step-ts-compile
# List of all steps.
steps-electron-gn-check: &steps-electron-gn-check
steps:
- *step-checkout-electron
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- install-python2-mac
- *step-setup-env-for-build
- *step-setup-goma-for-build
- *step-generate-deps-hash
- *step-touch-sync-done
- maybe-restore-portaled-src-cache
- run:
name: Ensure src checkout worked
command: |
if [ ! -d "src/third_party/blink" ]; then
echo src cache was not restored for an unknown reason
exit 1
fi
- run:
name: Wipe Electron
command: rm -rf src/electron
- *step-checkout-electron
- checkout-from-cache
- *step-setup-env-for-build
- *step-wait-for-goma
- *step-gn-gen-default
- *step-gn-check
steps-electron-ts-compile-for-doc-change: &steps-electron-ts-compile-for-doc-change
steps:
@@ -1054,6 +1054,8 @@ commands:
parameters:
artifact-key:
type: string
build-type:
type: string
build-nonproprietary-ffmpeg:
type: boolean
default: true
@@ -1061,6 +1063,7 @@ commands:
- *step-gn-gen-default
- ninja_build_electron:
clean-prebuilt-snapshot: false
build-type: << parameters.build-type >>
- *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
@@ -1222,9 +1225,12 @@ commands:
clean-prebuilt-snapshot:
type: boolean
default: true
build-type:
type: string
steps:
- run:
name: Electron build
name: Electron << parameters.build-type >> build
no_output_timeout: 60m
command: |
cd src
@@ -1292,6 +1298,8 @@ commands:
default: true
artifact-key:
type: string
build-type:
type: string
after-build-and-save:
type: steps
default: []
@@ -1418,6 +1426,7 @@ commands:
steps:
- build_and_save_artifacts:
artifact-key: << parameters.artifact-key >>
build-type: << parameters.build-type >>
build-nonproprietary-ffmpeg: << parameters.build-nonproprietary-ffmpeg >>
- steps: << parameters.after-build-and-save >>
@@ -1563,6 +1572,8 @@ commands:
checkout:
type: boolean
default: true
build-type:
type: string
steps:
- when:
condition: << parameters.attach >>
@@ -1594,7 +1605,8 @@ commands:
- *step-gn-gen-default
# Electron app
- ninja_build_electron
- ninja_build_electron:
build-type: << parameters.build-type >>
- *step-show-goma-stats
- *step-maybe-generate-breakpad-symbols
- *step-maybe-electron-dist-strip
@@ -1657,6 +1669,7 @@ jobs:
save-git-cache: true
checkout-to-create-src-cache: true
artifact-key: 'nil'
build-type: 'nil'
mac-checkout:
executor:
@@ -1675,6 +1688,7 @@ jobs:
persist-checkout: true
restore-src-cache: false
artifact-key: 'nil'
build-type: 'nil'
mac-make-src-cache:
executor:
@@ -1693,6 +1707,7 @@ jobs:
save-git-cache: true
checkout-to-create-src-cache: true
artifact-key: 'nil'
build-type: 'nil'
# Layer 2: Builds.
linux-x64-testing:
@@ -1710,6 +1725,7 @@ jobs:
checkout: false
checkout-and-assume-cache: true
artifact-key: 'linux-x64'
build-type: 'Linux'
linux-x64-testing-asan:
executor:
@@ -1728,6 +1744,7 @@ jobs:
checkout: true
build-nonproprietary-ffmpeg: false
artifact-key: 'linux-x64-asan'
build-type: 'Linux'
linux-x64-testing-no-run-as-node:
executor:
@@ -1744,6 +1761,7 @@ jobs:
persist: false
checkout: true
artifact-key: 'linux-x64-no-run-as-node'
build-type: 'Linux'
linux-x64-testing-gn-check:
executor:
@@ -1775,6 +1793,7 @@ jobs:
- electron-publish:
attach: false
checkout: true
build-type: 'Linux'
linux-arm-testing:
@@ -1795,6 +1814,7 @@ jobs:
checkout: false
checkout-and-assume-cache: true
artifact-key: 'linux-arm'
build-type: 'Linux ARM'
linux-arm-publish:
executor:
@@ -1819,6 +1839,7 @@ jobs:
- electron-publish:
attach: false
checkout: true
build-type: 'Linux ARM'
linux-arm64-testing:
executor:
@@ -1838,6 +1859,7 @@ jobs:
checkout: false
checkout-and-assume-cache: true
artifact-key: 'linux-arm64'
build-type: 'Linux ARM64'
linux-arm64-testing-gn-check:
executor:
@@ -1872,6 +1894,7 @@ jobs:
- electron-publish:
attach: false
checkout: true
build-type: 'Linux ARM64'
osx-testing-x64:
executor:
@@ -1890,6 +1913,7 @@ jobs:
checkout-and-assume-cache: true
attach: true
artifact-key: 'darwin-x64'
build-type: 'Darwin'
after-build-and-save:
- run:
name: Configuring MAS build
@@ -1900,6 +1924,7 @@ jobs:
rm -rf src/out/Default/Electron*.app
- build_and_save_artifacts:
artifact-key: 'mas-x64'
build-type: 'MAS'
after-persist:
- persist_to_workspace:
root: .
@@ -1936,6 +1961,7 @@ jobs:
- electron-publish:
attach: true
checkout: false
build-type: 'Darwin'
osx-publish-arm64:
executor:
@@ -1958,6 +1984,7 @@ jobs:
- electron-publish:
attach: true
checkout: false
build-type: 'Darwin ARM64'
osx-testing-arm64:
executor:
@@ -1978,6 +2005,7 @@ jobs:
checkout-and-assume-cache: true
attach: true
artifact-key: 'darwin-arm64'
build-type: 'Darwin ARM64'
after-build-and-save:
- run:
name: Configuring MAS build
@@ -1988,6 +2016,7 @@ jobs:
rm -rf src/out/Default/Electron*.app
- build_and_save_artifacts:
artifact-key: 'mas-arm64'
build-type: 'MAS ARM64'
after-persist:
- persist_to_workspace:
root: .
@@ -2014,6 +2043,7 @@ jobs:
- electron-publish:
attach: true
checkout: false
build-type: 'MAS'
mas-publish-arm64:
executor:
@@ -2036,6 +2066,7 @@ jobs:
- electron-publish:
attach: true
checkout: false
build-type: 'MAS ARM64'
# Layer 3: Tests.
linux-x64-testing-tests:

View File

@@ -35,8 +35,13 @@ if [ ! -f $buildtools/configs/evm.testing.json ]; then
write_config() {
echo "
{
\"root\": \"/workspaces/gclient\",
\"goma\": \"$1\",
\"root\": \"/workspaces/gclient\",
\"remotes\": {
\"electron\": {
\"origin\": \"https://github.com/electron/electron.git\"
}
}
\"gen\": {
\"args\": [
\"import(\\\"//electron/build/args/testing.gn\\\")\",
@@ -48,11 +53,7 @@ if [ ! -f $buildtools/configs/evm.testing.json ]; then
\"CHROMIUM_BUILDTOOLS_PATH\": \"/workspaces/gclient/src/buildtools\",
\"GIT_CACHE_PATH\": \"/workspaces/gclient/.git-cache\"
},
\"remotes\": {
\"electron\": {
\"origin\": \"https://github.com/electron/electron.git\"
}
}
\"$schema\": \"file:///home/builduser/.electron_build_tools/evm-config.schema.json\"
}
" >$buildtools/configs/evm.testing.json
}

2
DEPS
View File

@@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'110.0.5481.104',
'110.0.5481.208',
'node_version':
'v18.12.1',
'nan_version':

View File

@@ -6,7 +6,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-111.0.5560.0-node18
image: e-110.0.5481.208
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default

View File

@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-110.0.5481.77
image: e-110.0.5481.208
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default

View File

@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-110.0.5481.77-node18
image: e-110.0.5481.208
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default

View File

@@ -23,8 +23,7 @@ The `app` object emits the following events:
Emitted when the application has finished basic startup. On Windows and Linux,
the `will-finish-launching` event is the same as the `ready` event; on macOS,
this event represents the `applicationWillFinishLaunching` notification of
`NSApplication`. You would usually set up listeners for the `open-file` and
`open-url` events here, and start the crash reporter and auto updater.
`NSApplication`.
In most cases, you should do everything in the `ready` event handler.
@@ -128,8 +127,6 @@ Emitted when the user wants to open a URL with the application. Your application
`Info.plist` file must define the URL scheme within the `CFBundleURLTypes` key, and
set `NSPrincipalClass` to `AtomApplication`.
You should call `event.preventDefault()` if you want to handle this event.
As with the `open-file` event, be sure to register a listener for the `open-url`
event early in your application startup to detect if the the application being
is being opened to handle a URL. If you register the listener in response to a
@@ -754,14 +751,21 @@ This API can be used for purposes such as deciding what language to present the
Here are some examples of return values of the various language and locale APIs with different configurations:
* For Windows, where the application locale is German, the regional format is Finnish (Finland), and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese (China), Finnish, and Spanish (Latin America):
* `app.getLocale()` returns `'de'`
* `app.getSystemLocale()` returns `'fi-FI'`
* `app.getPreferredSystemLanguages()` returns `['fr-CA', 'en-US', 'zh-Hans-CN', 'fi', 'es-419']`
* On macOS, where the application locale is German, the region is Finland, and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese, and Spanish (Latin America):
* `app.getLocale()` returns `'de'`
* `app.getSystemLocale()` returns `'fr-FI'`
* `app.getPreferredSystemLanguages()` returns `['fr-CA', 'en-US', 'zh-Hans-FI', 'es-419']`
On Windows, given application locale is German, the regional format is Finnish (Finland), and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese (China), Finnish, and Spanish (Latin America):
```js
app.getLocale() // 'de'
app.getSystemLocale() // 'fi-FI'
app.getPreferredSystemLanguages() // ['fr-CA', 'en-US', 'zh-Hans-CN', 'fi', 'es-419']
```
On macOS, given the application locale is German, the region is Finland, and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese, and Spanish (Latin America):
```js
app.getLocale() // 'de'
app.getSystemLocale() // 'fr-FI'
app.getPreferredSystemLanguages() // ['fr-CA', 'en-US', 'zh-Hans-FI', 'es-419']
```
Both the available languages and regions and the possible return values differ between the two operating systems.
@@ -1513,18 +1517,18 @@ dock on macOS.
A `boolean` property that returns `true` if the app is packaged, `false` otherwise. For many apps, this property can be used to distinguish development and production environments.
[tasks]:https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
[tasks]:https://learn.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#tasks
[app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
[electron-forge]: https://www.electronforge.io/
[electron-packager]: https://github.com/electron/electron-packager
[CFBundleURLTypes]: https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115
[LSCopyDefaultHandlerForURLScheme]: https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme
[LSCopyDefaultHandlerForURLScheme]: https://developer.apple.com/documentation/coreservices/1441725-lscopydefaulthandlerforurlscheme?language=objc
[handoff]: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html
[activity-type]: https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType
[unity-requirement]: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher
[mas-builds]: ../tutorial/mac-app-store-submission-guide.md
[Squirrel-Windows]: https://github.com/Squirrel/Squirrel.Windows
[JumpListBeginListMSDN]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx
[JumpListBeginListMSDN]: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-icustomdestinationlist-beginlist
[about-panel-options]: https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc
### `app.name`

View File

@@ -140,5 +140,5 @@ application starts.
[installer]: https://github.com/electron/grunt-electron-installer
[installer-lib]: https://github.com/electron/windows-installer
[electron-forge-lib]: https://github.com/electron/forge
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
[app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter

View File

@@ -629,7 +629,7 @@ Returns:
* `event` Event
* `command` string
Emitted when an [App Command](https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx)
Emitted when an [App Command](https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-appcommand)
is invoked. These are typically related to keyboard media keys or browser
commands, as well as the "Back" button built into some mice on Windows.
@@ -954,7 +954,7 @@ Hides the window.
#### `win.isVisible()`
Returns `boolean` - Whether the window is visible to the user.
Returns `boolean` - Whether the window is visible to the user in the foreground of the app.
#### `win.isModal()`
@@ -992,6 +992,8 @@ Returns `boolean` - Whether the window is minimized.
Sets whether the window should be in fullscreen mode.
**Note:** On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events.
#### `win.isFullScreen()`
Returns `boolean` - Whether the window is in fullscreen mode.
@@ -1657,13 +1659,13 @@ in the taskbar.
#### `win.setAppDetails(options)` _Windows_
* `options` Object
* `appId` string (optional) - Window's [App User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd391569(v=vs.85).aspx).
* `appId` string (optional) - Window's [App User Model ID](https://learn.microsoft.com/en-us/windows/win32/shell/appids).
It has to be set, otherwise the other options will have no effect.
* `appIconPath` string (optional) - Window's [Relaunch Icon](https://msdn.microsoft.com/en-us/library/windows/desktop/dd391573(v=vs.85).aspx).
* `appIconPath` string (optional) - Window's [Relaunch Icon](https://learn.microsoft.com/en-us/windows/win32/properties/props-system-appusermodel-relaunchiconresource).
* `appIconIndex` Integer (optional) - Index of the icon in `appIconPath`.
Ignored when `appIconPath` is not set. Default is `0`.
* `relaunchCommand` string (optional) - Window's [Relaunch Command](https://msdn.microsoft.com/en-us/library/windows/desktop/dd391571(v=vs.85).aspx).
* `relaunchDisplayName` string (optional) - Window's [Relaunch Display Name](https://msdn.microsoft.com/en-us/library/windows/desktop/dd391572(v=vs.85).aspx).
* `relaunchCommand` string (optional) - Window's [Relaunch Command](https://learn.microsoft.com/en-us/windows/win32/properties/props-system-appusermodel-relaunchcommand).
* `relaunchDisplayName` string (optional) - Window's [Relaunch Display Name](https://learn.microsoft.com/en-us/windows/win32/properties/props-system-appusermodel-relaunchdisplaynameresource).
Sets the properties for the window's taskbar button.

View File

@@ -78,6 +78,7 @@ The following methods are available on instances of `Cookies`:
* `path` string (optional) - Retrieves cookies whose path matches `path`.
* `secure` boolean (optional) - Filters cookies by their Secure property.
* `session` boolean (optional) - Filters out session or persistent cookies.
* `httpOnly` boolean (optional) - Filters cookies by httpOnly.
Returns `Promise<Cookie[]>` - A promise which resolves an array of cookie objects.

View File

@@ -223,10 +223,10 @@ expanding and collapsing the dialog.
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `message` string - Content of the message box.
* `type` string (optional) - Can be `"none"`, `"info"`, `"error"`, `"question"` or
`"warning"`. On Windows, `"question"` displays the same icon as `"info"`, unless
you set an icon using the `"icon"` option. On macOS, both `"warning"` and
`"error"` display the same warning icon.
* `type` string (optional) - Can be `none`, `info`, `error`, `question` or
`warning`. On Windows, `question` displays the same icon as `info`, unless
you set an icon using the `icon` option. On macOS, both `warning` and
`error` display the same warning icon.
* `buttons` string[]&#32;(optional) - Array of texts for buttons. On Windows, an empty array
will result in one button labeled "OK".
* `defaultId` Integer (optional) - Index of the button in the buttons array which will
@@ -266,10 +266,10 @@ If `browserWindow` is not shown dialog will not be attached to it. In such case
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `message` string - Content of the message box.
* `type` string (optional) - Can be `"none"`, `"info"`, `"error"`, `"question"` or
`"warning"`. On Windows, `"question"` displays the same icon as `"info"`, unless
you set an icon using the `"icon"` option. On macOS, both `"warning"` and
`"error"` display the same warning icon.
* `type` string (optional) - Can be `none`, `info`, `error`, `question` or
`warning`. On Windows, `question` displays the same icon as `info`, unless
you set an icon using the `icon` option. On macOS, both `warning` and
`error` display the same warning icon.
* `buttons` string[]&#32;(optional) - Array of texts for buttons. On Windows, an empty array
will result in one button labeled "OK".
* `defaultId` Integer (optional) - Index of the button in the buttons array which will

View File

@@ -49,7 +49,7 @@ quality, it is recommended to include at least the following sizes in the:
Check the *Size requirements* section in [this article][icons].
[icons]:https://msdn.microsoft.com/en-us/library/windows/desktop/dn742485(v=vs.85).aspx
[icons]: https://learn.microsoft.com/en-us/windows/win32/uxguide/vis-icons
## High Resolution Image

View File

@@ -4,9 +4,12 @@
Process: [Main](../glossary.md#main-process)
## Using in the renderer process
:::info Renderer process notifications
If you want to show Notifications from a renderer process you should use the [HTML5 Notification API](../tutorial/notifications.md)
If you want to show notifications from a renderer process you should use the
[web Notifications API](../tutorial/notifications.md)
:::
## Class: Notification
@@ -29,10 +32,10 @@ Returns `boolean` - Whether or not desktop notifications are supported on the cu
### `new Notification([options])`
* `options` Object (optional)
* `title` string (optional) - A title for the notification, which will be shown at the top of the notification window when it is shown.
* `title` string (optional) - A title for the notification, which will be displayed at the top of the notification window when it is shown.
* `subtitle` string (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
* `body` string (optional) - The body text of the notification, which will be displayed below the title or subtitle.
* `silent` boolean (optional) - Whether or not to emit an OS notification noise when showing the notification.
* `silent` boolean (optional) - Whether or not to suppress the OS notification noise when showing the notification.
* `icon` (string | [NativeImage](native-image.md)) (optional) - An icon to use in the notification.
* `hasReply` boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
* `timeoutType` string (optional) _Linux_ _Windows_ - The timeout duration of the notification. Can be 'default' or 'never'.
@@ -47,8 +50,11 @@ Returns `boolean` - Whether or not desktop notifications are supported on the cu
Objects created with `new Notification` emit the following events:
**Note:** Some events are only available on specific operating systems and are
labeled as such.
:::info
Some events are only available on specific operating systems and are labeled as such.
:::
#### Event: 'show'
@@ -56,7 +62,7 @@ Returns:
* `event` Event
Emitted when the notification is shown to the user, note this could be fired
Emitted when the notification is shown to the user. Note that this event can be fired
multiple times as a notification can be shown multiple times through the
`show()` method.
@@ -106,14 +112,13 @@ Emitted when an error is encountered while creating and showing the native notif
### Instance Methods
Objects created with `new Notification` have the following instance methods:
Objects created with the `new Notification()` constructor have the following instance methods:
#### `notification.show()`
Immediately shows the notification to the user, please note this means unlike the
HTML5 Notification implementation, instantiating a `new Notification` does
not immediately show it to the user, you need to call this method before the OS
will display it.
Immediately shows the notification to the user. Unlike the web notification API,
instantiating a `new Notification()` does not immediately show it to the user. Instead, you need to
call this method before the OS will display it.
If the notification has been shown before, this method will dismiss the previously
shown notification and create a new one with identical properties.
@@ -160,7 +165,7 @@ A `boolean` property representing whether the notification has a reply action.
A `string` property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.
Default is 'low' - see [NotifyUrgency](https://developer.gnome.org/notification-spec/#urgency-levels) for more information.
Default is 'low' - see [NotifyUrgency](https://developer-old.gnome.org/notification-spec/#urgency-levels) for more information.
#### `notification.timeoutType` _Linux_ _Windows_

View File

@@ -39,7 +39,7 @@ The `pushNotification` module has the following methods:
Returns `Promise<string>`
Registers the app with Apple Push Notification service (APNS) to receive [Badge, Sound, and Alert](https://developer.apple.com/documentation/appkit/sremotenotificationtype?language=objc) notifications. If registration is successful, the promise will be resolved with the APNS device token. Otherwise, the promise will be rejected with an error message.
Registers the app with Apple Push Notification service (APNS) to receive [Badge, Sound, and Alert](https://developer.apple.com/documentation/appkit/nsremotenotificationtype?language=objc) notifications. If registration is successful, the promise will be resolved with the APNS device token. Otherwise, the promise will be rejected with an error message.
See: https://developer.apple.com/documentation/appkit/nsapplication/1428476-registerforremotenotificationtyp?language=objc
### `pushNotifications.unregisterForAPNSNotifications()` _macOS_

View File

@@ -879,6 +879,10 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
Specifying a loopback device will capture system audio, and is
currently only supported on Windows. If a WebFrameMain is specified,
will capture audio from that frame.
* `enableLocalEcho` Boolean (optional) - If `audio` is a [WebFrameMain](web-frame-main.md)
and this is set to `true`, then local playback of audio will not be muted (e.g. using `MediaRecorder`
to record `WebFrameMain` with this flag set to `true` will allow audio to pass through to the speakers
while recording). Default is `false`.
This handler will be called when web content requests access to display media
via the `navigator.mediaDevices.getDisplayMedia` API. Use the
@@ -916,7 +920,7 @@ Passing `null` instead of a function resets the handler to its default state.
* `details` Object
* `deviceType` string - The type of device that permission is being requested on, can be `hid`, `serial`, or `usb`.
* `origin` string - The origin URL of the device permission check.
* `device` [HIDDevice](structures/hid-device.md) | [SerialPort](structures/serial-port.md)- the device that permission is being requested for.
* `device` [HIDDevice](structures/hid-device.md) | [SerialPort](structures/serial-port.md) | [USBDevice](structures/usb-device.md) - the device that permission is being requested for.
Sets the handler which can be used to respond to device permission checks for the `session`.
Returning `true` will allow the device to be permitted and `false` will reject it.

View File

@@ -3,9 +3,9 @@
* `processId` Integer - The internal ID of the renderer process that sent this message
* `frameId` Integer - The ID of the renderer frame that sent this message
* `returnValue` any - Set this to the value to be returned in a synchronous message
* `sender` WebContents - Returns the `webContents` that sent the message
* `senderFrame` WebFrameMain _Readonly_ - The frame that sent this message
* `ports` MessagePortMain[] - A list of MessagePorts that were transferred with this message
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
* `senderFrame` [WebFrameMain](../web-frame-main.md) _Readonly_ - The frame that sent this message
* `ports` [MessagePortMain](../message-port-main.md)[] - A list of MessagePorts that were transferred with this message
* `reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame.
* `channel` string
* `...args` any[]

View File

@@ -2,5 +2,5 @@
* `processId` Integer - The internal ID of the renderer process that sent this message
* `frameId` Integer - The ID of the renderer frame that sent this message
* `sender` WebContents - Returns the `webContents` that sent the message
* `senderFrame` WebFrameMain _Readonly_ - The frame that sent this message
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
* `senderFrame` [WebFrameMain](../web-frame-main.md) _Readonly_ - The frame that sent this message

View File

@@ -1,7 +1,8 @@
# IpcRendererEvent Object extends `Event`
* `sender` IpcRenderer - The `IpcRenderer` instance that emitted the event originally
* `sender` [IpcRenderer](../ipc-renderer.md) - The `IpcRenderer` instance that emitted the event originally
* `senderId` Integer - The `webContents.id` that sent the message, you can call `event.sender.sendTo(event.senderId, ...)` to reply to the message, see [ipcRenderer.sendTo][ipc-renderer-sendto] for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set `event.senderId` to `0`.
* `ports` MessagePort[] - A list of MessagePorts that were transferred with this message
* `ports` [MessagePort][][] - A list of MessagePorts that were transferred with this message
[ipc-renderer-sendto]: ../ipc-renderer.md#ipcrenderersendtowebcontentsid-channel-args
[MessagePort]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort

View File

@@ -235,7 +235,7 @@ if (browserOptions.transparent) {
}
```
[dwm-composition]:https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx
[dwm-composition]: https://learn.microsoft.com/en-us/windows/win32/dwm/composition-ovw
### `systemPreferences.getAccentColor()` _Windows_ _macOS_
@@ -336,8 +336,8 @@ See the [Windows docs][windows-colors] and the [macOS docs][macos-colors] for mo
The following colors are only available on macOS 10.14: `find-highlight`, `selected-content-background`, `separator`, `unemphasized-selected-content-background`, `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
[windows-colors]:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx
[macos-colors]:https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors
[windows-colors]: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsyscolor
[macos-colors]: https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors
### `systemPreferences.getSystemColor(color)` _macOS_

View File

@@ -35,28 +35,28 @@ for all windows, webviews, opened devtools, and devtools extension background pa
### `webContents.getFocusedWebContents()`
Returns `WebContents` | null - The web contents that is focused in this application, otherwise
Returns `WebContents | null` - The web contents that is focused in this application, otherwise
returns `null`.
### `webContents.fromId(id)`
* `id` Integer
Returns `WebContents` | undefined - A WebContents instance with the given ID, or
Returns `WebContents | undefined` - A WebContents instance with the given ID, or
`undefined` if there is no WebContents associated with the given ID.
### `webContents.fromFrame(frame)`
* `frame` WebFrameMain
Returns `WebContents` | undefined - A WebContents instance with the given WebFrameMain, or
Returns `WebContents | undefined` - A WebContents instance with the given WebFrameMain, or
`undefined` if there is no WebContents associated with the given WebFrameMain.
### `webContents.fromDevToolsTargetId(targetId)`
* `targetId` string - The Chrome DevTools Protocol [TargetID](https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID) associated with the WebContents instance.
Returns `WebContents` | undefined - A WebContents instance with the given TargetID, or
Returns `WebContents | undefined` - A WebContents instance with the given TargetID, or
`undefined` if there is no WebContents associated with the given TargetID.
When communicating with the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/),
@@ -713,20 +713,24 @@ Returns:
* `callback` Function
* `deviceId` string
Emitted when bluetooth device needs to be selected on call to
`navigator.bluetooth.requestDevice`. To use `navigator.bluetooth` api
`webBluetooth` should be enabled. If `event.preventDefault` is not called,
first available device will be selected. `callback` should be called with
`deviceId` to be selected, passing empty string to `callback` will
cancel the request.
Emitted when a bluetooth device needs to be selected when a call to
`navigator.bluetooth.requestDevice` is made. `callback` should be called with
the `deviceId` of the device to be selected. Passing an empty string to
`callback` will cancel the request.
If no event listener is added for this event, all bluetooth requests will be cancelled.
If an event listener is not added for this event, or if `event.preventDefault`
is not called when handling this event, the first available device will be
automatically selected.
```javascript
Due to the nature of bluetooth, scanning for devices when
`navigator.bluetooth.requestDevice` is called may take time and will cause
`select-bluetooth-device` to fire multiple times until `callback` is called
with either a device id or an empty string to cancel the request.
```javascript title='main.js'
const { app, BrowserWindow } = require('electron')
let win = null
app.commandLine.appendSwitch('enable-experimental-web-platform-features')
app.whenReady().then(() => {
win = new BrowserWindow({ width: 800, height: 600 })
@@ -736,6 +740,9 @@ app.whenReady().then(() => {
return device.deviceName === 'test'
})
if (!result) {
// The device wasn't found so we need to either wait longer (eg until the
// device is turned on) or cancel the request by calling the callback
// with an empty string.
callback('')
} else {
callback(result.deviceId)
@@ -1567,7 +1574,7 @@ ipcMain.on('open-devtools', (event, targetContentsId, devtoolsContentsId) => {
An example of showing devtools in a `BrowserWindow`:
```js
```js title='main.js'
const { app, BrowserWindow } = require('electron')
let win = null
@@ -1650,40 +1657,14 @@ Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
throw an exception.
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
> special Electron objects will throw an exception.
:::warning
The renderer process can handle the message by listening to `channel` with the
[`ipcRenderer`](ipc-renderer.md) module.
Sending non-standard JavaScript types such as DOM objects or
special Electron objects will throw an exception.
An example of sending messages from the main process to the renderer process:
:::
```javascript
// In the main process.
const { app, BrowserWindow } = require('electron')
let win = null
app.whenReady().then(() => {
win = new BrowserWindow({ width: 800, height: 600 })
win.loadURL(`file://${__dirname}/index.html`)
win.webContents.on('did-finish-load', () => {
win.webContents.send('ping', 'whoooooooh!')
})
})
```
```html
<!-- index.html -->
<html>
<body>
<script>
require('electron').ipcRenderer.on('ping', (event, message) => {
console.log(message) // Prints 'whoooooooh!'
})
</script>
</body>
</html>
```
For additional reading, refer to [Electron's IPC guide](../tutorial/ipc.md).
#### `contents.sendToFrame(frameId, channel, ...args)`

View File

@@ -184,6 +184,8 @@ page is loaded, use the `setUserAgent` method to change the user agent.
A `boolean`. When this attribute is present the guest page will have web security disabled.
Web security is enabled by default.
This value can only be modified before the first navigation.
### `partition`
```html

View File

@@ -14,6 +14,14 @@ This document uses the following convention to categorize breaking changes:
## Planned Breaking API Changes (23.0)
### Behavior Changed: Draggable Regions on macOS
The implementation of draggable regions (using the CSS property `-webkit-app-region: drag`) has changed on macOS to bring it in line with Windows and Linux. Previously, when a region with `-webkit-app-region: no-drag` overlapped a region with `-webkit-app-region: drag`, the `no-drag` region would always take precedence on macOS, regardless of CSS layering. That is, if a `drag` region was above a `no-drag` region, it would be ignored. Beginning in Electron 23, a `drag` region on top of a `no-drag` region will correctly cause the region to be draggable.
Additionally, the `customButtonsOnHover` BrowserWindow property previously created a draggable region which ignored the `-webkit-app-region` CSS property. This has now been fixed (see [#37210](https://github.com/electron/electron/issues/37210#issuecomment-1440509592) for discussion).
As a result, if your app uses a frameless window with draggable regions on macOS, the regions which are draggable in your app may change in Electron 23.
### Removed: Windows 7 / 8 / 8.1 support
[Windows 7, Windows 8, and Windows 8.1 are no longer supported](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice). Electron follows the planned Chromium deprecation policy, which will [deprecate Windows 7 support beginning in Chromium 109](https://support.google.com/chrome/thread/185534985/sunsetting-support-for-windows-7-8-8-1-in-early-2023?hl=en).

View File

@@ -158,7 +158,7 @@ We will need to create a new TypeScript file in the path that follows:
`"lib/browser/api/{electron_browser_{api_name}}.ts"`
An example of the contents of this file can be found [here](https://github.com/electron/electron/blob/main/lib/browser/api/native-image.ts).
An example of the contents of this file can be found [here](https://github.com/electron/electron/blob/main/lib/browser/api/native-theme.ts).
### Expose your module to TypeScript

View File

@@ -89,7 +89,7 @@ For an introduction to ProcMon's basic and advanced debugging features, go check
out [this video tutorial][procmon-instructions] provided by Microsoft.
[sys-internals]: https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx
[procmon-instructions]: https://channel9.msdn.com/shows/defrag-tools/defrag-tools-4-process-monitor
[procmon-instructions]: https://learn.microsoft.com/en-us/shows/defrag-tools/4-process-monitor
## Using WinDbg
<!-- TODO(@codebytere): add images and more information here? -->

View File

@@ -60,7 +60,7 @@ garbage collected.
If you encounter this problem, the following articles may prove helpful:
* [Memory Management][memory-management]
* [Variable Scope][variable-scope]
* [Closures][closures]
If you want a quick fix, you can make the variables global by changing your
code from this:
@@ -153,8 +153,7 @@ The effect is visible only on (some?) LCD screens. Even if you don't see a diffe
Notice that just setting the background in the CSS does not have the desired effect.
[memory-management]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management
[variable-scope]: https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx
[electron-module]: https://www.npmjs.com/package/electron
[closures]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures
[storage]: https://developer.mozilla.org/en-US/docs/Web/API/Storage
[local-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
[session-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage

View File

@@ -9,6 +9,7 @@
<h1>Web Bluetooth API</h1>
<button id="clickme">Test Bluetooth</button>
<button id="cancel">Cancel Bluetooth Request</button>
<p>Currently selected bluetooth device: <strong id="device-name""></strong></p>

View File

@@ -1,22 +1,37 @@
const {app, BrowserWindow, ipcMain} = require('electron')
const path = require('path')
let bluetoothPinCallback
let selectBluetoothCallback
function createWindow () {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
}
})
mainWindow.webContents.on('select-bluetooth-device', (event, deviceList, callback) => {
event.preventDefault()
if (deviceList && deviceList.length > 0) {
callback(deviceList[0].deviceId)
}
selectBluetoothCallback = callback
const result = deviceList.find((device) => {
return device.deviceName === 'test'
})
if (result) {
callback(result.deviceId)
} else {
// The device wasn't found so we need to either wait longer (eg until the
// device is turned on) or until the user cancels the request
}
})
ipcMain.on('cancel-bluetooth-request', (event) => {
selectBluetoothCallback('')
})
// Listen for a message from the renderer to get the response for the Bluetooth pairing.
ipcMain.on('bluetooth-pairing-response', (event, response) => {
bluetoothPinCallback(response)
@@ -27,14 +42,14 @@ function createWindow () {
bluetoothPinCallback = callback
// Send a message to the renderer to prompt the user to confirm the pairing.
mainWindow.webContents.send('bluetooth-pairing-request', details)
})
})
mainWindow.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})

View File

@@ -1,6 +1,7 @@
const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('electronAPI', {
cancelBluetoothRequest: (callback) => ipcRenderer.send('cancel-bluetooth-request', callback),
bluetoothPairingRequest: (callback) => ipcRenderer.on('bluetooth-pairing-request', callback),
bluetoothPairingResponse: (response) => ipcRenderer.send('bluetooth-pairing-response', response)
})

View File

@@ -7,9 +7,15 @@ async function testIt() {
document.getElementById('clickme').addEventListener('click',testIt)
function cancelRequest() {
window.electronAPI.cancelBluetoothRequest()
}
document.getElementById('cancel').addEventListener('click', cancelRequest)
window.electronAPI.bluetoothPairingRequest((event, details) => {
const response = {}
switch (details.pairingKind) {
case 'confirm': {
response.confirmed = confirm(`Do you want to connect to device ${details.deviceId}?`)
@@ -31,4 +37,4 @@ window.electronAPI.bluetoothPairingRequest((event, details) => {
}
window.electronAPI.bluetoothPairingResponse(response)
})
})

View File

@@ -1,5 +1,4 @@
const {app, BrowserWindow} = require('electron')
const e = require('express')
const path = require('path')
function createWindow () {
@@ -44,7 +43,6 @@ function createWindow () {
}
})
mainWindow.webContents.session.setDevicePermissionHandler((details) => {
if (details.deviceType === 'usb' && details.origin === 'file://') {
if (!grantedDeviceThroughPermHandler) {

View File

@@ -1,5 +1,5 @@
function getDeviceDetails(device) {
return grantedDevice.productName || `Unknown device ${grantedDevice.deviceId}`
return device.productName || `Unknown device ${device.deviceId}`
}
async function testIt() {

View File

@@ -70,7 +70,7 @@
</li>
<li>
<a
href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb226797(v=vs.85).aspx"
href="https://learn.microsoft.com/en-us/previous-versions/windows/desktop/bb226797"
>Windows<span
>(opens in new window)</span
></a

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -28,6 +28,8 @@ On macOS, third-party assistive technology can toggle accessibility features ins
Electron applications by setting the `AXManualAccessibility` attribute
programmatically:
Using Objective-C:
```objc
CFStringRef kAXManualAccessibility = CFSTR("AXManualAccessibility");
@@ -43,5 +45,16 @@ CFStringRef kAXManualAccessibility = CFSTR("AXManualAccessibility");
}
```
Using Swift:
```swift
import Cocoa
let name = CommandLine.arguments.count >= 2 ? CommandLine.arguments[1] : "Electron"
let pid = NSWorkspace.shared.runningApplications.first(where: {$0.localizedName == name})!.processIdentifier
let axApp = AXUIElementCreateApplication(pid)
let result = AXUIElementSetAttributeValue(axApp, "AXManualAccessibility" as CFString, true as CFTypeRef)
print("Setting 'AXManualAccessibility' \(error.rawValue == 0 ? "succeeded" : "failed")")
```
[a11y-docs]: https://www.chromium.org/developers/design-documents/accessibility#TOC-How-Chrome-detects-the-presence-of-Assistive-Technology
[setAccessibilitySupportEnabled]: ../api/app.md#appsetaccessibilitysupportenabledenabled-macos-windows

View File

@@ -95,7 +95,7 @@ Before signing Windows builds, you must do the following:
You can get a code signing certificate from a lot of resellers. Prices vary, so
it may be worth your time to shop around. Popular resellers include:
- [digicert](https://www.digicert.com/code-signing/microsoft-authenticode.htm)
- [digicert](https://www.digicert.com/dc/code-signing/microsoft-authenticode.htm)
- [Sectigo](https://sectigo.com/ssl-certificates-tls/code-signing)
- Amongst others, please shop around to find one that suits your needs! 😄

View File

@@ -129,7 +129,7 @@ Electron provides several APIs for working with the WebUSB API:
when handling the `select-usb-device` event.
**Note:** These two events only fire until the callback from `select-usb-device`
is called. They are not intended to be used as a generic usb device listener.
* The [`usb-device-revoked' event on the Session](../api/session.md#event-usb-device-revoked) can
* The [`usb-device-revoked` event on the Session](../api/session.md#event-usb-device-revoked) can
be used to respond when [device.forget()](https://developer.chrome.com/articles/usb/#revoke-access)
is called on a USB device.
* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler)

View File

@@ -1,98 +1,108 @@
# Notifications
## Overview
Each operating system has its own mechanism to display notifications to users. Electron's notification
APIs are cross-platform, but are different for each process type.
All three operating systems provide means for applications to send
notifications to the user. The technique of showing notifications is different
for the Main and Renderer processes.
If you want to use a renderer process API in the main process or vice-versa, consider using
[inter-process communication](./ipc.md).
For the Renderer process, Electron conveniently allows developers to send
notifications with the [HTML5 Notification API](https://notifications.spec.whatwg.org/),
using the currently running operating system's native notification APIs
to display it.
## Usage
To show notifications in the Main process, you need to use the
[Notification](../api/notification.md) module.
Below are two examples showing how to display notifications for each process type.
## Example
### Show notifications in the main process
### Show notifications in the Renderer process
Main process notifications are displayed using Electron's [Notification module](../api/notification.md).
Notification objects created using this module do not appear unless their `show()` instance
method is called.
Starting with a working application from the
[Quick Start Guide](quick-start.md), add the following line to the
`index.html` file before the closing `</body>` tag:
```js title='Main Process'
const { Notification } = require("electron");
```html
<script src="renderer.js"></script>
const NOTIFICATION_TITLE = "Basic Notification";
const NOTIFICATION_BODY = "Notification from the Main process";
new Notification({
title: NOTIFICATION_TITLE,
body: NOTIFICATION_BODY,
}).show();
```
...and add the `renderer.js` file:
```javascript fiddle='docs/fiddles/features/notifications/renderer'
const NOTIFICATION_TITLE = 'Title'
const NOTIFICATION_BODY = 'Notification from the Renderer process. Click to log to console.'
const CLICK_MESSAGE = 'Notification clicked'
new Notification(NOTIFICATION_TITLE, { body: NOTIFICATION_BODY })
.onclick = () => console.log(CLICK_MESSAGE)
```
After launching the Electron application, you should see the notification:
![Notification in the Renderer process](../images/notification-renderer.png)
Additionally, if you click on the notification, the DOM will update to show "Notification clicked!".
### Show notifications in the Main process
Starting with a working application from the
[Quick Start Guide](quick-start.md), update the `main.js` file with the following lines:
Here's a full example that you can open with Electron Fiddle:
```javascript fiddle='docs/fiddles/features/notifications/main'
const { Notification } = require('electron')
const { Notification } = require("electron");
const NOTIFICATION_TITLE = 'Basic Notification'
const NOTIFICATION_BODY = 'Notification from the Main process'
const NOTIFICATION_TITLE = "Basic Notification";
const NOTIFICATION_BODY = "Notification from the Main process";
const showNotification = () => {
new Notification({ title: NOTIFICATION_TITLE, body: NOTIFICATION_BODY }).show()
}
app.whenReady().then(createWindow).then(showNotification)
new Notification({
title: NOTIFICATION_TITLE,
body: NOTIFICATION_BODY,
}).show();
```
After launching the Electron application, you should see the system notification:
### Show notifications in the renderer process
![Notification in the Main process](../images/notification-main.png)
Notifications can be displayed directly from the renderer process with the
[web Notifications API](https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API).
## Additional information
```js title='Renderer Process'
const NOTIFICATION_TITLE = "Title";
const NOTIFICATION_BODY =
"Notification from the Renderer process. Click to log to console.";
const CLICK_MESSAGE = "Notification clicked";
new Notification(NOTIFICATION_TITLE, { body: NOTIFICATION_BODY }).onclick =
() => console.log(CLICK_MESSAGE);
```
Here's a full example that you can open with Electron Fiddle:
```javascript fiddle='docs/fiddles/features/notifications/renderer'
const NOTIFICATION_TITLE = "Title";
const NOTIFICATION_BODY =
"Notification from the Renderer process. Click to log to console.";
const CLICK_MESSAGE = "Notification clicked";
new Notification(NOTIFICATION_TITLE, { body: NOTIFICATION_BODY }).onclick =
() => console.log(CLICK_MESSAGE);
```
## Platform considerations
While code and user experience across operating systems are similar, there
are subtle differences.
### Windows
* On Windows 10, a shortcut to your app with an
[Application User Model ID][app-user-model-id] must be installed to the
Start Menu. This can be overkill during development, so adding
`node_modules\electron\dist\electron.exe` to your Start Menu also does the
trick. Navigate to the file in Explorer, right-click and 'Pin to Start Menu'.
You will then need to add the line `app.setAppUserModelId(process.execPath)` to
your main process to see notifications.
For notifications on Windows, your Electron app needs to have a Start Menu shortcut with an
[AppUserModelID][app-user-model-id] and a corresponding [ToastActivatorCLSID][toast-activator-clsid].
Electron attempts to automate the work around the Application User Model ID. When
Electron is used together with the installation and update framework Squirrel,
[shortcuts will automatically be set correctly][squirrel-events]. Furthermore,
Electron will detect that Squirrel was used and will automatically call
Electron attempts to automate the work around the AppUserModelID and ToastActivatorCLSID. When
Electron is used together with Squirrel.Windows (e.g. if you're using electron-winstaller),
[shortcuts will automatically be set correctly][squirrel-events].
In production, Electron will also detect that Squirrel was used and will automatically call
`app.setAppUserModelId()` with the correct value. During development, you may have
to call [`app.setAppUserModelId()`][set-app-user-model-id] yourself.
#### Advanced Notifications
:::info Notifications in development
Later versions of Windows allow for advanced notifications, with custom templates,
images, and other flexible elements. To send those notifications (from either the
main process or the renderer process), use the userland module
[electron-windows-notifications](https://github.com/felixrieseberg/electron-windows-notifications),
To quickly bootstrap notifications during development, adding
`node_modules\electron\dist\electron.exe` to your Start Menu also does the
trick. Navigate to the file in Explorer, right-click and 'Pin to Start Menu'.
Then, call `app.setAppUserModelId(process.execPath)` in the main process to see notifications.
:::
#### Use advanced notifications
Windows also allow for advanced notifications with custom templates, images, and other flexible
elements.
To send those notifications from the main process, you can use the userland module
[`electron-windows-notifications`](https://github.com/felixrieseberg/electron-windows-notifications),
which uses native Node addons to send `ToastNotification` and `TileNotification` objects.
While notifications including buttons work with `electron-windows-notifications`,
@@ -101,41 +111,41 @@ handling replies requires the use of
which helps with registering the required COM components and calling your
Electron app with the entered user data.
#### Quiet Hours / Presentation Mode
#### Query notification state
To detect whether or not you're allowed to send a notification, use the
userland module [electron-notification-state](https://github.com/felixrieseberg/electron-notification-state).
userland module [`windows-notification-state`][windows-notification-state].
This allows you to determine ahead of time whether or not Windows will
silently throw the notification away.
This module allows you to determine ahead of time whether or not Windows will silently throw the
notification away.
### macOS
Notifications are straight-forward on macOS, but you should be aware of
Notifications are straightforward on macOS, but you should be aware of
[Apple's Human Interface guidelines regarding notifications][apple-notification-guidelines].
Note that notifications are limited to 256 bytes in size and will be truncated
if you exceed that limit.
[apple-notification-guidelines]: https://developer.apple.com/macos/human-interface-guidelines/system-capabilities/notifications/
#### Do not disturb / Session State
#### Query notification state
To detect whether or not you're allowed to send a notification, use the userland module
[electron-notification-state][electron-notification-state].
[`macos-notification-state`][macos-notification-state].
This will allow you to detect ahead of time whether or not the notification will be displayed.
[electron-notification-state]: https://github.com/felixrieseberg/electron-notification-state
This module allows you to detect ahead of time whether or not the notification will be displayed.
### Linux
Notifications are sent using `libnotify` which can show notifications on any
Notifications are sent using `libnotify`, which can show notifications on any
desktop environment that follows [Desktop Notifications
Specification][notification-spec], including Cinnamon, Enlightenment, Unity,
GNOME, KDE.
GNOME, and KDE.
[notification-spec]: https://developer-old.gnome.org/notification-spec/
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
[app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
[set-app-user-model-id]: ../api/app.md#appsetappusermodelidid-windows
[squirrel-events]: https://github.com/electron/windows-installer/blob/main/README.md#handling-squirrel-events
[toast-activator-clsid]: https://learn.microsoft.com/en-us/windows/win32/properties/props-system-appusermodel-toastactivatorclsid
[apple-notification-guidelines]: https://developer.apple.com/macos/human-interface-guidelines/system-capabilities/notifications/
[windows-notification-state]: https://github.com/felixrieseberg/windows-notification-state
[macos-notification-state]: https://github.com/felixrieseberg/macos-notification-state

View File

@@ -138,5 +138,5 @@ of `app` module will be emitted for it.
[dock-menu-image]: https://cloud.githubusercontent.com/assets/639601/5069610/2aa80758-6e97-11e4-8cfb-c1a414a10774.png
[addrecentdocument]: ../api/app.md#appaddrecentdocumentpath-macos-windows
[clearrecentdocuments]: ../api/app.md#appclearrecentdocuments-macos-windows
[app-registration]: https://msdn.microsoft.com/en-us/library/cc144104(VS.85).aspx
[app-registration]: https://learn.microsoft.com/en-us/windows/win32/shell/app-registration
[menu-item-image]: https://user-images.githubusercontent.com/3168941/33003655-ea601c3a-cd70-11e7-97fa-7c062149cfb1.png

View File

@@ -84,7 +84,7 @@ the `sandbox: false` preference in the [`BrowserWindow`][browser-window] constru
app.whenReady().then(() => {
const win = new BrowserWindow({
webPreferences: {
sandbox: true
sandbox: false
}
})
win.loadURL('https://google.com')

View File

@@ -81,10 +81,13 @@ the exact dependency versions to install.
"version": "1.0.0",
"description": "Hello World!",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Jane Doe",
"license": "MIT",
"devDependencies": {
"electron": "19.0.0"
"electron": "23.1.3"
}
}
```
@@ -137,13 +140,14 @@ script in the current directory and run it in dev mode.
"version": "1.0.0",
"description": "Hello World!",
"main": "main.js",
"scripts": {
"start": "electron .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Jane Doe",
"license": "MIT",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"electron": "^19.0.0"
"electron": "23.1.3"
}
}
```
@@ -270,7 +274,7 @@ calling `createWindow()` once its promise is fulfilled.
You typically listen to Node.js events by using an emitter's `.on` function.
```diff
+ app.on('ready').then(() => {
+ app.on('ready', () => {
- app.whenReady().then(() => {
createWindow()
})

View File

@@ -231,7 +231,7 @@ rest of our docs and happy developing! If you have questions, please stop by our
[new-pat]: https://github.com/settings/tokens/new
[publish command]: https://www.electronforge.io/cli#publish
[publisher]: https://www.electronforge.io/config/publishers
[`publishergithubconfig`]: https://js.electronforge.io/publisher/github/interfaces/publishergithubconfig
[`publishergithubconfig`]: https://js.electronforge.io/interfaces/_electron_forge_publisher_github.PublisherGitHubConfig.html
[`update-electron-app`]: https://github.com/electron/update-electron-app
[update-server]: ./updates.md

View File

@@ -110,7 +110,7 @@ On Windows, by default, `node-gyp` links native modules against `node.dll`.
However, in Electron 4.x and higher, the symbols needed by native modules are
exported by `electron.exe`, and there is no `node.dll`. In order to load native
modules on Windows, `node-gyp` installs a [delay-load
hook](https://msdn.microsoft.com/en-us/library/z9h1h6ty.aspx) that triggers
hook](https://learn.microsoft.com/en-us/cpp/build/reference/error-handling-and-notification?view=msvc-170#notification-hooks) that triggers
when the native module is loaded, and redirects the `node.dll` reference to use
the loading executable instead of looking for `node.dll` in the library search
path (which would turn up nothing). As such, on Electron 4.x and higher,

View File

@@ -153,7 +153,7 @@ filenames = {
"shell/browser/notifications/mac/notification_presenter_mac.mm",
"shell/browser/relauncher_mac.cc",
"shell/browser/ui/certificate_trust_mac.mm",
"shell/browser/ui/cocoa/delayed_native_view_host.cc",
"shell/browser/ui/cocoa/delayed_native_view_host.mm",
"shell/browser/ui/cocoa/delayed_native_view_host.h",
"shell/browser/ui/cocoa/electron_bundle_mover.h",
"shell/browser/ui/cocoa/electron_bundle_mover.mm",
@@ -175,8 +175,6 @@ filenames = {
"shell/browser/ui/cocoa/electron_touch_bar.mm",
"shell/browser/ui/cocoa/event_dispatching_window.h",
"shell/browser/ui/cocoa/event_dispatching_window.mm",
"shell/browser/ui/cocoa/NSColor+Hex.h",
"shell/browser/ui/cocoa/NSColor+Hex.mm",
"shell/browser/ui/cocoa/NSString+ANSI.h",
"shell/browser/ui/cocoa/NSString+ANSI.mm",
"shell/browser/ui/cocoa/root_view_mac.h",

View File

@@ -271,6 +271,10 @@ libcxx_headers = [
"//buildtools/third_party/libc++/trunk/include/__debug",
"//buildtools/third_party/libc++/trunk/include/__debug_utils/randomize_range.h",
"//buildtools/third_party/libc++/trunk/include/__errc",
"//buildtools/third_party/libc++/trunk/include/__expected/bad_expected_access.h",
"//buildtools/third_party/libc++/trunk/include/__expected/expected.h",
"//buildtools/third_party/libc++/trunk/include/__expected/unexpect.h",
"//buildtools/third_party/libc++/trunk/include/__expected/unexpected.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/copy_options.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/directory_entry.h",
"//buildtools/third_party/libc++/trunk/include/__filesystem/directory_iterator.h",
@@ -670,6 +674,7 @@ libcxx_headers = [
"//buildtools/third_party/libc++/trunk/include/__type_traits/remove_reference.h",
"//buildtools/third_party/libc++/trunk/include/__type_traits/remove_volatile.h",
"//buildtools/third_party/libc++/trunk/include/__type_traits/result_of.h",
"//buildtools/third_party/libc++/trunk/include/__type_traits/strip_signature.h",
"//buildtools/third_party/libc++/trunk/include/__type_traits/type_identity.h",
"//buildtools/third_party/libc++/trunk/include/__type_traits/type_list.h",
"//buildtools/third_party/libc++/trunk/include/__type_traits/underlying_type.h",
@@ -742,6 +747,7 @@ libcxx_headers = [
"//buildtools/third_party/libc++/trunk/include/errno.h",
"//buildtools/third_party/libc++/trunk/include/exception",
"//buildtools/third_party/libc++/trunk/include/execution",
"//buildtools/third_party/libc++/trunk/include/expected",
"//buildtools/third_party/libc++/trunk/include/experimental/__config",
"//buildtools/third_party/libc++/trunk/include/experimental/__memory",
"//buildtools/third_party/libc++/trunk/include/experimental/algorithm",

View File

@@ -12,6 +12,14 @@ BrowserWindow.prototype._init = function (this: BWT) {
// Avoid recursive require.
const { app } = require('electron');
// Set ID at constructon time so it's accessible after
// underlying window destruction.
const id = this.id;
Object.defineProperty(this, 'id', {
value: id,
writable: false
});
const nativeSetBounds = this.setBounds;
this.setBounds = (bounds, ...opts) => {
bounds = {

View File

@@ -26,7 +26,7 @@ export const roleList: Record<RoleId, Role> = {
get label () {
return isLinux ? 'About' : `About ${app.name}`;
},
...(isWindows && { appMethod: () => app.showAboutPanel() })
...((isWindows || isLinux) && { appMethod: () => app.showAboutPanel() })
},
close: {
label: isMac ? 'Close Window' : 'Close',

View File

@@ -524,17 +524,10 @@ WebContents.prototype._callWindowOpenHandler = function (event: Electron.Event,
event.preventDefault();
return defaultResponse;
} else if (response.action === 'allow') {
if (typeof response.overrideBrowserWindowOptions === 'object' && response.overrideBrowserWindowOptions !== null) {
return {
browserWindowConstructorOptions: response.overrideBrowserWindowOptions,
outlivesOpener: typeof response.outlivesOpener === 'boolean' ? response.outlivesOpener : false
};
} else {
return {
browserWindowConstructorOptions: {},
outlivesOpener: typeof response.outlivesOpener === 'boolean' ? response.outlivesOpener : false
};
}
return {
browserWindowConstructorOptions: typeof response.overrideBrowserWindowOptions === 'object' ? response.overrideBrowserWindowOptions : null,
outlivesOpener: typeof response.outlivesOpener === 'boolean' ? response.outlivesOpener : false
};
} else {
event.preventDefault();
console.error('The window open handler response must be an object with an \'action\' property of \'allow\' or \'deny\'.');

View File

@@ -1 +1,3 @@
fix_rename_webswapcgllayer_to_webswapcgllayerchromium.patch
cherry-pick-6da1a8953313.patch
cherry-pick-aed05b609629.patch

View File

@@ -0,0 +1,134 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shahbaz Youssefi <syoussefi@chromium.org>
Date: Thu, 16 Feb 2023 23:16:46 -0500
Subject: M110: Vulkan: Don't close render pass if rebind to same fbo
In the Vulkan backend, the render pass can occasionally (and
transiently) be in a state of "open but inactive". This is when the
render pass is closed, but has the potential for future modifications
(for example to add a resolve attachment). Under many circumstances, it
is expected that an open render pass cannot be in such a state.
This assumption can be broken in this scenario:
- Open render pass, draw, etc
- Change framebuffer binding
- Change framebuffer binding back to original
- Masked Clear
When ContextVk is synced before clear, it sees that the framebuffer
binding is changed (though it hasn't really), and it closes the render
passes and sets the render pass dirty bit. If a draw were to follow, a
new render pass would have started (unnecessarily). However, in the
case of a masked clear, UtilsVk notices that the render pass is started,
assumes it must be active, and continues recording to it. While the
operation itself succeeds, the assumption that the render pass is active
is false (and fails assertion).
This change makes sure that framebuffer binding change is no-oped if the
framebuffer is the same one that has opened the current render pass. If
any application does unnecessary binding changes and back, it will be
optimized by this change as well.
Bug: chromium:1411210
Change-Id: I37a3a9f2eaa1a81a1b3393840b9458ec71a87377
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4261215
Reviewed-by: Charlie Lao <cclao@google.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
(cherry picked from commit 05e62f39412e8c6bfc98582f5e7a49041991c97b)
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4296296
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Prudhvikumar Bommana <pbommana@google.com>
Commit-Queue: Prudhvikumar Bommana <pbommana@google.com>
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.cpp b/src/libANGLE/renderer/vulkan/ContextVk.cpp
index ad5f83854f29c7245553fe3e98b7f6545d7ea91c..9f05c2a32ae2e0f6a4b1466d9f4423b3022b4975 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp
@@ -5224,6 +5224,15 @@ angle::Result ContextVk::syncState(const gl::Context *context,
// as some optimizations in non-draw commands require the render pass to remain
// open, such as invalidate or blit. Note that we always start a new command buffer
// because we currently can only support one open RenderPass at a time.
+ //
+ // The render pass is not closed if binding is changed to the same framebuffer as
+ // before.
+ if (hasStartedRenderPass() && hasStartedRenderPassWithQueueSerial(
+ drawFramebufferVk->getLastRenderPassQueueSerial()))
+ {
+ break;
+ }
+
onRenderPassFinished(RenderPassClosureReason::FramebufferBindingChange);
if (getFeatures().preferSubmitAtFBOBoundary.enabled &&
mRenderPassCommands->started())
diff --git a/src/tests/gl_tests/ClearTest.cpp b/src/tests/gl_tests/ClearTest.cpp
index bbe243281fce2b7503767b2553d2900b598b7e81..51a953019c53e8ed1f09184965164002f4cc4c79 100644
--- a/src/tests/gl_tests/ClearTest.cpp
+++ b/src/tests/gl_tests/ClearTest.cpp
@@ -2863,6 +2863,26 @@ TEST_P(ClearTest, DISABLED_ClearReachesWindow)
angle::Sleep(2000);
}
+// Tests that masked clear after a no-op framebuffer binding change with an open render pass works.
+TEST_P(ClearTest, DrawThenChangeFBOBindingAndBackThenMaskedClear)
+{
+ ANGLE_GL_PROGRAM(blueProgram, essl1_shaders::vs::Simple(), essl1_shaders::fs::Blue());
+
+ // Draw blue.
+ drawQuad(blueProgram, essl1_shaders::PositionAttrib(), 0.5f);
+
+ // Change framebuffer and back
+ glBindFramebuffer(GL_FRAMEBUFFER, mFBOs[0]);
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+
+ // Masked clear
+ glColorMask(1, 0, 0, 1);
+ glClearColor(1.0f, 0.5f, 0.5f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::magenta);
+}
+
// Test that clearing slices of a 3D texture and reading them back works.
TEST_P(ClearTestES3, ClearAndReadPixels3DTexture)
{
diff --git a/src/tests/gl_tests/VulkanPerformanceCounterTest.cpp b/src/tests/gl_tests/VulkanPerformanceCounterTest.cpp
index b62f434d5db1eac4bf5039db49d50ffd092b3621..bacac33673b9d2c2b8d62b9ff12a61773273eff1 100644
--- a/src/tests/gl_tests/VulkanPerformanceCounterTest.cpp
+++ b/src/tests/gl_tests/VulkanPerformanceCounterTest.cpp
@@ -5,7 +5,7 @@
//
// VulkanPerformanceCounterTest:
// Validates specific GL call patterns with ANGLE performance counters.
-// For example we can verify a certain call set doesn't break the RenderPass.
+// For example we can verify a certain call set doesn't break the render pass.
#include "test_utils/ANGLETest.h"
#include "test_utils/angle_test_instantiate.h"
@@ -7090,6 +7090,26 @@ TEST_P(VulkanPerformanceCounterTest, AsyncMonolithicPipelineCreation)
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
}
+// Verify that changing framebuffer and back doesn't break the render pass.
+TEST_P(VulkanPerformanceCounterTest, FBOChangeAndBackDoesNotBreakRenderPass)
+{
+ uint64_t expectedRenderPassCount = getPerfCounters().renderPasses + 1;
+
+ ANGLE_GL_PROGRAM(drawRed, essl3_shaders::vs::Simple(), essl3_shaders::fs::Red());
+ drawQuad(drawRed, essl1_shaders::PositionAttrib(), 0);
+
+ GLFramebuffer fbo;
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+
+ drawQuad(drawRed, essl1_shaders::PositionAttrib(), 0);
+
+ // Verify render pass count.
+ EXPECT_EQ(getPerfCounters().renderPasses, expectedRenderPassCount);
+
+ EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
+}
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VulkanPerformanceCounterTest);
ANGLE_INSTANTIATE_TEST(
VulkanPerformanceCounterTest,

View File

@@ -0,0 +1,108 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Geoff Lang <geofflang@chromium.org>
Date: Fri, 31 Mar 2023 16:44:35 -0400
Subject: M112: Mark RGBX and BGRX formats as having 8 unused bits.
This makes sure that pixelBytes ends up being 4 and fixes potential
buffer size validation.
Fix EGL configs using pixelBytes to compute EGL_BUFFER_SIZE which
is not supposed to include unused bits. This is covered by
dEQP-EGL.functional.query_config.constraints.color_buffer_size
Bug: chromium:1404790
Change-Id: Ie0480cbdc6229c4bb3a6c6242337eaed5a3ae3b7
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4428752
Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
diff --git a/src/libANGLE/formatutils.cpp b/src/libANGLE/formatutils.cpp
index a28db6081e0707c28e15ebbc0b0ef08a854fc785..d0dbb403961a5f32edc175e9d01f94728486e47f 100644
--- a/src/libANGLE/formatutils.cpp
+++ b/src/libANGLE/formatutils.cpp
@@ -549,6 +549,21 @@ bool InternalFormat::isDepthOrStencil() const
return depthBits != 0 || stencilBits != 0;
}
+GLuint InternalFormat::getEGLConfigBufferSize() const
+{
+ // EGL config's EGL_BUFFER_SIZE is measured in bits and is the sum of all the color channels for
+ // color formats or the luma channels for luma formats. It ignores unused bits so compute the
+ // bit count by summing instead of using pixelBytes.
+ if (isLUMA())
+ {
+ return luminanceBits + alphaBits;
+ }
+ else
+ {
+ return redBits + greenBits + blueBits + alphaBits;
+ }
+}
+
Format::Format(GLenum internalFormat) : Format(GetSizedInternalFormatInfo(internalFormat)) {}
Format::Format(const InternalFormat &internalFormat) : info(&internalFormat) {}
@@ -1141,10 +1156,10 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
AddRGBAFormat(&map, GL_BGR10_A2_ANGLEX, true, 10, 10, 10, 2, 0, GL_BGRA_EXT, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported, NeverSupported);
// Special format to emulate RGB8 with RGBA8 within ANGLE.
- AddRGBAFormat(&map, GL_RGBX8_ANGLE, true, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported, AlwaysSupported, NeverSupported);
+ AddRGBAXFormat(&map, GL_RGBX8_ANGLE, true, FB< 8, 8, 8, 0, 8, 0>(), GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported, AlwaysSupported, NeverSupported);
// Special format to emulate BGR8 with BGRA8 within ANGLE.
- AddRGBAFormat(&map, GL_BGRX8_ANGLEX, true, 8, 8, 8, 0, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, NeverSupported, AlwaysSupported, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAXFormat(&map, GL_BGRX8_ANGLEX, true, FB< 8, 8, 8, 0, 8, 0>(), GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, NeverSupported, AlwaysSupported, NeverSupported, NeverSupported, NeverSupported);
// This format is supported on ES 2.0 with two extensions, so keep it out-of-line to not widen the table above even more.
// | Internal format |sized| R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer | Blend
diff --git a/src/libANGLE/formatutils.h b/src/libANGLE/formatutils.h
index af7f6df09efd9b08586a6cebe0042bb9555d4b7f..a651ab8ffc4d51159b9f53c60594f43bf9b83ae5 100644
--- a/src/libANGLE/formatutils.h
+++ b/src/libANGLE/formatutils.h
@@ -205,6 +205,8 @@ struct InternalFormat
bool isInt() const;
bool isDepthOrStencil() const;
+ GLuint getEGLConfigBufferSize() const;
+
bool operator==(const InternalFormat &other) const;
bool operator!=(const InternalFormat &other) const;
diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index cf3c53ec00fff1eaacd5a9cce5742278a49aa314..abd3d5fa2a4c8a84aa6751bf1f6f64b3504a07b6 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -1263,7 +1263,7 @@ egl::ConfigSet Renderer11::generateConfigs()
egl::Config config;
config.renderTargetFormat = colorBufferInternalFormat;
config.depthStencilFormat = depthStencilBufferInternalFormat;
- config.bufferSize = colorBufferFormatInfo.pixelBytes * 8;
+ config.bufferSize = colorBufferFormatInfo.getEGLConfigBufferSize();
config.redSize = colorBufferFormatInfo.redBits;
config.greenSize = colorBufferFormatInfo.greenBits;
config.blueSize = colorBufferFormatInfo.blueBits;
diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
index cfe6ef850d9afb317bdc2c10a8f93b2f98a7a20b..66950965fdeb3d57b84f524920bc41823e6cf377 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
@@ -523,7 +523,7 @@ egl::ConfigSet Renderer9::generateConfigs()
egl::Config config;
config.renderTargetFormat = colorBufferInternalFormat;
config.depthStencilFormat = depthStencilBufferInternalFormat;
- config.bufferSize = colorBufferFormatInfo.pixelBytes * 8;
+ config.bufferSize = colorBufferFormatInfo.getEGLConfigBufferSize();
config.redSize = colorBufferFormatInfo.redBits;
config.greenSize = colorBufferFormatInfo.greenBits;
config.blueSize = colorBufferFormatInfo.blueBits;
diff --git a/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp b/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp
index 173a04c1ebb2b7d5f6997d696699fef09e5c0d9c..766750a163cae6ba22502fc0c8922e9421ef52eb 100644
--- a/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp
@@ -1257,7 +1257,7 @@ egl::Config GenerateDefaultConfig(DisplayVk *display,
config.renderTargetFormat = colorFormat.internalFormat;
config.depthStencilFormat = depthStencilFormat.internalFormat;
- config.bufferSize = colorFormat.pixelBytes * 8;
+ config.bufferSize = colorFormat.getEGLConfigBufferSize();
config.redSize = colorFormat.redBits;
config.greenSize = colorFormat.greenBits;
config.blueSize = colorFormat.blueBits;

View File

@@ -126,3 +126,18 @@ chore_patch_out_partition_attribute_dcheck_for_webviews.patch
expose_v8initializer_codegenerationcheckcallbackinmainthread.patch
chore_patch_out_profile_methods_in_profile_selections_cc.patch
fix_x11_window_restore_minimized_maximized_window.patch
chore_defer_usb_service_getdevices_request_until_usb_service_is.patch
cherry-pick-d9081493c4b2.patch
cherry-pick-d6946b70b431.patch
revert_x11_keep_windowcache_alive_for_a_time_interval.patch
cherry-pick-9585757f9fad.patch
cherry-pick-2b30a50d0e62.patch
cherry-pick-f58218891f8c.patch
cherry-pick-ec53103cc72d.patch
cherry-pick-f098ff0d1230.patch
cherry-pick-63686953dc22.patch
merge_m112_remove_the_second_weakptrfactory_from.patch
merge_m112_check_spdyproxyclientsocket_is_alive_after_write.patch
check_callback_availability_in.patch
m112_cherry_pick_libxml_cve_fix.patch
m112_fix_scopedobservation_uaf_in.patch

View File

@@ -46,7 +46,7 @@ index 21547000bf9097320825919238a3ad3e2979f4b4..fe6b4b52417c9c276c4f0a0ec4e8a453
sources += [ "certificate_viewer_stub.cc" ]
}
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 628af219b64dc8d84438abc758f920402b690a76..5b3db652d24f7197e4f6d665a19a45acf202c970 100644
index 494f6551b3e55763a3bf8d9b1bb7b9c685f2ee85..f963564afb8f2101399821d9e56009b589886687 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -6252,7 +6252,6 @@ test("unit_tests") {

View File

@@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kenichi Ishibashi <bashi@chromium.org>
Date: Tue, 18 Apr 2023 05:58:29 +0000
Subject: Check callback availability in
SpdyProxyClientSocket::RunWriteCallback
OnClose() could consume `write_callback_` so it may not be available
when RunWriteCallback() is invoked.
Bug: 1428820
Change-Id: I9a5ade62d67f5bf15e12d0915d1ad6098657ffd4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4437791
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Adam Rice <ricea@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1131689}
diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc
index 73ca8d0c2958e532ac9810f5de40405d6e91cdeb..e1b9ba74afc49a5ddef1f45ada996bad3db05d12 100644
--- a/net/spdy/spdy_proxy_client_socket.cc
+++ b/net/spdy/spdy_proxy_client_socket.cc
@@ -277,10 +277,11 @@ int SpdyProxyClientSocket::GetLocalAddress(IPEndPoint* address) const {
}
void SpdyProxyClientSocket::RunWriteCallback(int result) {
- CHECK(write_callback_);
-
base::WeakPtr<SpdyProxyClientSocket> weak_ptr = weak_factory_.GetWeakPtr();
- std::move(write_callback_).Run(result);
+ // `write_callback_` might be consumed by OnClose().
+ if (write_callback_) {
+ std::move(write_callback_).Run(result);
+ }
if (!weak_ptr) {
// `this` was already destroyed while running `write_callback_`. Must
// return immediately without touching any field member.

View File

@@ -0,0 +1,91 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Date: Mon, 10 Apr 2023 05:32:06 +0000
Subject: Use ScriptState::Scope instead of setting HandleScope.
Since `GetEffectiveFunction` may call `Get` if the given v8 listener is
an object, we need to prepare `v8::Context::Scope` before calling it.
Blink already have a helper class to prepare the environment for the
script execution, which has already been used used in other
ServiceWorkerGlobalScope member functions. It is `ScriptState::Scope`
This CL also use it instead.
(cherry picked from commit 299385e09d41d5ce3abd434879b5f9b0a8880cd7)
Bug: 1429197
Change-Id: Idbcfdfa9c06160a18b57155a9540f72eed4ec0b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4387655
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Commit-Queue: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1125148}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4411454
Reviewed-by: Shunya Shishido <sisidovski@chromium.org>
Cr-Commit-Position: refs/branch-heads/5615@{#1191}
Cr-Branched-From: 9c6408ef696e83a9936b82bbead3d41c93c82ee4-refs/heads/main@{#1109224}
diff --git a/content/browser/service_worker/service_worker_version_browsertest.cc b/content/browser/service_worker/service_worker_version_browsertest.cc
index 8ab1f54b2453fe100fdc9b4f1b41ce031c5ecf29..5834127a6e70389540cbf347e65ae4bc80495317 100644
--- a/content/browser/service_worker/service_worker_version_browsertest.cc
+++ b/content/browser/service_worker/service_worker_version_browsertest.cc
@@ -976,6 +976,18 @@ IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest,
version_->fetch_handler_type());
}
+IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest,
+ NonFunctionFetchHandlerWithHandleEventProperty) {
+ StartServerAndNavigateToSetup();
+ ASSERT_EQ(
+ Install("/service_worker/fetch_event_with_handle_event_property.js"),
+ blink::ServiceWorkerStatusCode::kOk);
+ EXPECT_EQ(ServiceWorkerVersion::FetchHandlerExistence::EXISTS,
+ version_->fetch_handler_existence());
+ EXPECT_EQ(ServiceWorkerVersion::FetchHandlerType::kNotSkippable,
+ version_->fetch_handler_type());
+}
+
// Check that fetch event handler added in the install event should result in a
// service worker that doesn't count as having a fetch event handler.
IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest,
diff --git a/content/test/data/service_worker/fetch_event_with_handle_event_property.js b/content/test/data/service_worker/fetch_event_with_handle_event_property.js
new file mode 100644
index 0000000000000000000000000000000000000000..2fe6153af242a10162f7ecb8eaab93c17d840211
--- /dev/null
+++ b/content/test/data/service_worker/fetch_event_with_handle_event_property.js
@@ -0,0 +1,11 @@
+// Copyright 2023 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let obj = {};
+Object.defineProperty(obj, "handleEvent", {
+ get: () => {},
+ configurable: true,
+ enumerable: true,
+});
+self.addEventListener('fetch', obj);
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
index bbbbcd3691ac646716d78a17251909fc4ba43ea0..9438405e331f1978a5c9b76bf8a7148064fb6b7d 100644
--- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
+++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
@@ -2619,12 +2619,15 @@ ServiceWorkerGlobalScope::FetchHandlerType() {
if (!elv) {
return mojom::blink::ServiceWorkerFetchHandlerType::kNoHandler;
}
- v8::Isolate* isolate = GetIsolate();
- v8::HandleScope handle_scope(isolate);
+
+ ScriptState* script_state = ScriptController()->GetScriptState();
+ // Do not remove this, |scope| is needed by `GetEffectiveFunction`.
+ ScriptState::Scope scope(script_state);
+
// TODO(crbug.com/1349613): revisit the way to implement this.
// The following code returns kEmptyFetchHandler if all handlers are nop.
for (RegisteredEventListener& e : *elv) {
- EventTarget* et = EventTarget::Create(ScriptController()->GetScriptState());
+ EventTarget* et = EventTarget::Create(script_state);
v8::Local<v8::Value> v =
To<JSBasedEventListener>(e.Callback())->GetEffectiveFunction(*et);
if (!v->IsFunction() ||

View File

@@ -0,0 +1,124 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Florian Leimgruber <fleimgruber@google.com>
Date: Thu, 6 Apr 2023 09:21:41 +0000
Subject: Add lock to AlternativeStateNameMap.
To prevent the class from accessing its localized_state_names_map_ and
localized_state_names_reverse_lookup_map_ members, a lock is added. It
locks all reads/write from the aforementioned members.
(cherry picked from commit dd848883aa0d7d88520846bbf6735eaae9f2b60e)
Bug: 1360571, 1414241, 1425951
Change-Id: Ic01b0cba3878748617863274deb04ec9e13645d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4352658
Reviewed-by: Christoph Schwering <schwering@google.com>
Commit-Queue: Florian Leimgruber <fleimgruber@google.com>
Cr-Original-Commit-Position: refs/heads/main@{#1119411}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4402262
Auto-Submit: Florian Leimgruber <fleimgruber@google.com>
Cr-Commit-Position: refs/branch-heads/5615@{#1147}
Cr-Branched-From: 9c6408ef696e83a9936b82bbead3d41c93c82ee4-refs/heads/main@{#1109224}
diff --git a/components/autofill/core/browser/geo/alternative_state_name_map.cc b/components/autofill/core/browser/geo/alternative_state_name_map.cc
index d217082a0faf23d2fd74dce8eec1043d83b5e509..ed22752c50f15e1f45e48b9ef561b0cb7134fba8 100644
--- a/components/autofill/core/browser/geo/alternative_state_name_map.cc
+++ b/components/autofill/core/browser/geo/alternative_state_name_map.cc
@@ -53,7 +53,6 @@ AlternativeStateNameMap::GetCanonicalStateName(
const CountryCode& country_code,
const StateName& state_name,
bool is_state_name_normalized) const {
- DCHECK_CALLED_ON_VALID_SEQUENCE(alternative_state_name_map_sequence_checker_);
// Example:
// Entries in |localized_state_names_map_| are:
// ("DE", "Bavaria") -> {
@@ -73,6 +72,7 @@ AlternativeStateNameMap::GetCanonicalStateName(
if (!is_state_name_normalized)
normalized_state_name = NormalizeStateName(state_name);
+ base::AutoLock lock(lock_);
auto it = localized_state_names_reverse_lookup_map_.find(
{country_code, normalized_state_name});
if (it != localized_state_names_reverse_lookup_map_.end())
@@ -84,8 +84,6 @@ AlternativeStateNameMap::GetCanonicalStateName(
absl::optional<StateEntry> AlternativeStateNameMap::GetEntry(
const CountryCode& country_code,
const StateName& state_string_from_profile) const {
- DCHECK_CALLED_ON_VALID_SEQUENCE(alternative_state_name_map_sequence_checker_);
-
StateName normalized_state_string_from_profile =
NormalizeStateName(state_string_from_profile);
absl::optional<CanonicalStateName> canonical_state_name =
@@ -93,6 +91,7 @@ absl::optional<StateEntry> AlternativeStateNameMap::GetEntry(
/*is_state_name_normalized=*/true);
if (canonical_state_name) {
+ base::AutoLock lock(lock_);
auto it = localized_state_names_map_.find(
{country_code, canonical_state_name.value()});
if (it != localized_state_names_map_.end())
@@ -108,8 +107,6 @@ void AlternativeStateNameMap::AddEntry(
const StateEntry& state_entry,
const std::vector<StateName>& normalized_alternative_state_names,
const CanonicalStateName& normalized_canonical_state_name) {
- DCHECK_CALLED_ON_VALID_SEQUENCE(alternative_state_name_map_sequence_checker_);
-
// Example:
// AddEntry("DE", "Bavaria", {
// "canonical_name": "Bayern",
@@ -126,12 +123,15 @@ void AlternativeStateNameMap::AddEntry(
// ("DE", "Bayern") -> "Bayern"
// ("DE", "BY") -> "Bayern"
// ("DE", "Bavaria") -> "Bayern"
- if (localized_state_names_map_.size() == kMaxMapSize ||
- GetCanonicalStateName(country_code, normalized_state_value_from_profile,
+ if (GetCanonicalStateName(country_code, normalized_state_value_from_profile,
/*is_state_name_normalized=*/true)) {
return;
}
+ base::AutoLock lock(lock_);
+ if (localized_state_names_map_.size() == kMaxMapSize) {
+ return;
+ }
localized_state_names_map_[{country_code, normalized_canonical_state_name}] =
state_entry;
for (const auto& alternative_name : normalized_alternative_state_names) {
@@ -141,12 +141,12 @@ void AlternativeStateNameMap::AddEntry(
}
bool AlternativeStateNameMap::IsLocalisedStateNamesMapEmpty() const {
- DCHECK_CALLED_ON_VALID_SEQUENCE(alternative_state_name_map_sequence_checker_);
+ base::AutoLock lock(lock_);
return localized_state_names_map_.empty();
}
void AlternativeStateNameMap::ClearAlternativeStateNameMap() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(alternative_state_name_map_sequence_checker_);
+ base::AutoLock lock(lock_);
localized_state_names_map_.clear();
localized_state_names_reverse_lookup_map_.clear();
}
diff --git a/components/autofill/core/browser/geo/alternative_state_name_map.h b/components/autofill/core/browser/geo/alternative_state_name_map.h
index d20cdf8a02fff5d3c3ea91ef3aa67c6522804692..58dd754bfbf39fd24c82e6d46ccb566008a4cd73 100644
--- a/components/autofill/core/browser/geo/alternative_state_name_map.h
+++ b/components/autofill/core/browser/geo/alternative_state_name_map.h
@@ -9,7 +9,7 @@
#include "base/i18n/case_conversion.h"
#include "base/no_destructor.h"
-#include "base/sequence_checker.h"
+#include "base/synchronization/lock.h"
#include "base/types/strong_alias.h"
#include "components/autofill/core/browser/proto/states.pb.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
@@ -177,7 +177,8 @@ class AlternativeStateNameMap {
CaseInsensitiveLessComparator>
localized_state_names_reverse_lookup_map_;
- SEQUENCE_CHECKER(alternative_state_name_map_sequence_checker_);
+ // TODO(crbug.com/1425951): Remove lock.
+ mutable base::Lock lock_;
};
} // namespace autofill

View File

@@ -0,0 +1,88 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom Anderson <thomasanderson@chromium.org>
Date: Thu, 19 Jan 2023 17:03:20 +0000
Subject: StatusIconLinuxDbus: Use default session bus name
The StatusNotifierItem spec requires status items register with the name
`org.kde.StatusNotifierItem-$PID-$ID`. However this causes problems
in sandboxed environments such as flatpak because extra permissions
are required to register the bus name. Additionally, the name
`org.kde.StatusNotifierItem-2-1` will be used every time when PID
namespaces are used for sandboxing.
To address this, just use the default bus name we were given on
initially connecting to the bus. This violates the spec, but there's
actually no consequence for doing this.
R=sky
Fixed: 1408315
Change-Id: I1abc4100c2899206eaa1804a3ff47dce7ad4e565
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4179380
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1094509}
diff --git a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc
index 88289caa2518a2888de596fd65b7dfb6efa3e1ab..c523874ecc329e5a722c5923334fc578ebdf6a84 100644
--- a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc
+++ b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc
@@ -101,12 +101,6 @@ int NextServiceId() {
return ++status_icon_count;
}
-std::string ServiceNameFromId(int service_id) {
- return std::string(kInterfaceStatusNotifierItem) + '-' +
- base::NumberToString(base::Process::Current().Pid()) + '-' +
- base::NumberToString(service_id);
-}
-
std::string PropertyIdFromId(int service_id) {
return "chrome_status_icon_" + base::NumberToString(service_id);
}
@@ -295,19 +289,6 @@ void StatusIconLinuxDbus::OnHostRegisteredResponse(dbus::Response* response) {
}
service_id_ = NextServiceId();
- bus_->RequestOwnership(ServiceNameFromId(service_id_),
- dbus::Bus::ServiceOwnershipOptions::REQUIRE_PRIMARY,
- base::BindOnce(&StatusIconLinuxDbus::OnOwnership,
- weak_factory_.GetWeakPtr()));
-}
-
-void StatusIconLinuxDbus::OnOwnership(const std::string& service_name,
- bool success) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (!success) {
- delegate_->OnImplInitializationFailed();
- return;
- }
static constexpr struct {
const char* name;
@@ -390,7 +371,7 @@ void StatusIconLinuxDbus::RegisterStatusNotifierItem() {
dbus::MethodCall method_call(kInterfaceStatusNotifierWatcher,
kMethodRegisterStatusNotifierItem);
dbus::MessageWriter writer(&method_call);
- writer.AppendString(ServiceNameFromId(service_id_));
+ writer.AppendString(bus_->GetConnectionName());
watcher_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::BindOnce(&StatusIconLinuxDbus::OnRegistered,
weak_factory_.GetWeakPtr()));
diff --git a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h
index eae1c332a0972aefb8843cac947aeb2f4c48d360..d4ad41f9a2a7e2df4bc38889d883f52ad90bd799 100644
--- a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h
+++ b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h
@@ -65,10 +65,7 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux,
// registered.
void OnHostRegisteredResponse(dbus::Response* response);
- // Step 3: register a StatusNotifierItem service.
- void OnOwnership(const std::string& service_name, bool success);
-
- // Step 4: export methods for the StatusNotifierItem and the properties
+ // Step 3: export methods for the StatusNotifierItem and the properties
// interface.
void OnExported(const std::string& interface_name,
const std::string& method_name,

View File

@@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dave Tapuska <dtapuska@chromium.org>
Date: Fri, 24 Mar 2023 19:32:54 +0000
Subject: Move the edit commands to an on stack variable
DevTools uses nested event loops and the usage of the class member can
be problematic for iteration because the nested loop can change the
variable's storage causing a UAF.
(cherry picked from commit d9b34f0f3a2d0dd73648eca3ef940fb66806227b)
Bug: 1420510
Change-Id: Ie08a71b60401fa4322cca0cc31062ba64672126a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4355811
Reviewed-by: David Bokan <bokan@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1120123}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4369603
Cr-Commit-Position: refs/branch-heads/5615@{#809}
Cr-Branched-From: 9c6408ef696e83a9936b82bbead3d41c93c82ee4-refs/heads/main@{#1109224}
diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc b/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc
index 7d3c2c0a0db83ae5b7980deedd605174837fa801..0da9bc6d464f09d81c0bd8943f74370ee81325b0 100644
--- a/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc
+++ b/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc
@@ -3198,11 +3198,18 @@ void WebFrameWidgetImpl::AddEditCommandForNextKeyEvent(const WebString& name,
}
bool WebFrameWidgetImpl::HandleCurrentKeyboardEvent() {
- bool did_execute_command = false;
+ if (edit_commands_.empty()) {
+ return false;
+ }
WebLocalFrame* frame = FocusedWebLocalFrameInWidget();
if (!frame)
frame = local_root_;
- for (const auto& command : edit_commands_) {
+ bool did_execute_command = false;
+ // Executing an edit command can run JS and we can end up reassigning
+ // `edit_commands_` so move it to a stack variable before iterating on it.
+ Vector<mojom::blink::EditCommandPtr> edit_commands =
+ std::move(edit_commands_);
+ for (const auto& command : edit_commands) {
// In gtk and cocoa, it's possible to bind multiple edit commands to one
// key (but it's the exception). Once one edit command is not executed, it
// seems safest to not execute the rest.

View File

@@ -0,0 +1,90 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kylechar <kylechar@chromium.org>
Date: Tue, 28 Feb 2023 21:02:51 +0000
Subject: Add CHECKs in HostFrameSinkManager
It looks like it's possible for a compromised renderer to get multiple
things to register the same FrameSinkId with HostFrameSinkManager. This
violates assumptions around ownership so turn DCHECKs here into CHECKs.
Also convert DCHECKs into CHECKs for registering/unregistering frame
sink hierarchy just in case.
(cherry picked from commit a707ac2d95e4726f4cf0267c9b0c038926c2a691)
Bug: 1414018
Change-Id: If948e758a8484024666f4066360620bc3a9cb493
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4283141
Reviewed-by: Martin Kreichgauer <martinkr@google.com>
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Commit-Queue: Kyle Charbonneau <kylechar@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1109533}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4298330
Cr-Commit-Position: refs/branch-heads/5615@{#69}
Cr-Branched-From: 9c6408ef696e83a9936b82bbead3d41c93c82ee4-refs/heads/main@{#1109224}
diff --git a/components/viz/host/host_frame_sink_manager.cc b/components/viz/host/host_frame_sink_manager.cc
index 923cd827c31fcaaf41bd0247ec5221704c0bb3ea..65241be62293d64f3b09e2cf2b68bb6d946bcdb2 100644
--- a/components/viz/host/host_frame_sink_manager.cc
+++ b/components/viz/host/host_frame_sink_manager.cc
@@ -68,7 +68,7 @@ void HostFrameSinkManager::RegisterFrameSinkId(
DCHECK(client);
FrameSinkData& data = frame_sink_data_map_[frame_sink_id];
- DCHECK(!data.IsFrameSinkRegistered());
+ CHECK(!data.IsFrameSinkRegistered());
DCHECK(!data.has_created_compositor_frame_sink);
data.client = client;
data.report_activation = report_activation;
@@ -87,7 +87,7 @@ void HostFrameSinkManager::InvalidateFrameSinkId(
DCHECK(frame_sink_id.is_valid());
FrameSinkData& data = frame_sink_data_map_[frame_sink_id];
- DCHECK(data.IsFrameSinkRegistered());
+ CHECK(data.IsFrameSinkRegistered());
const bool destroy_synchronously =
data.has_created_compositor_frame_sink && data.wait_on_destruction;
@@ -227,14 +227,14 @@ bool HostFrameSinkManager::RegisterFrameSinkHierarchy(
return false;
}
+ FrameSinkData& parent_data = iter->second;
+ CHECK(!base::Contains(parent_data.children, child_frame_sink_id));
+ parent_data.children.push_back(child_frame_sink_id);
+
// Register and store the parent.
frame_sink_manager_->RegisterFrameSinkHierarchy(parent_frame_sink_id,
child_frame_sink_id);
- FrameSinkData& parent_data = iter->second;
- DCHECK(!base::Contains(parent_data.children, child_frame_sink_id));
- parent_data.children.push_back(child_frame_sink_id);
-
return true;
}
@@ -243,8 +243,9 @@ void HostFrameSinkManager::UnregisterFrameSinkHierarchy(
const FrameSinkId& child_frame_sink_id) {
// Unregister and clear the stored parent.
FrameSinkData& parent_data = frame_sink_data_map_[parent_frame_sink_id];
- DCHECK(base::Contains(parent_data.children, child_frame_sink_id));
- base::Erase(parent_data.children, child_frame_sink_id);
+ size_t num_erased = base::Erase(parent_data.children, child_frame_sink_id);
+ CHECK_EQ(num_erased, 1u);
+
if (parent_data.IsEmpty())
frame_sink_data_map_.erase(parent_frame_sink_id);
diff --git a/components/viz/service/frame_sinks/frame_sink_manager_impl.cc b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc
index b55780a0e0c5c59d97a0123829dac512eca07029..ad2575c1666ea0be7d65774309447c89b199cf7a 100644
--- a/components/viz/service/frame_sinks/frame_sink_manager_impl.cc
+++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc
@@ -284,7 +284,7 @@ void FrameSinkManagerImpl::UnregisterFrameSinkHierarchy(
}
auto iter = frame_sink_source_map_.find(parent_frame_sink_id);
- DCHECK(iter != frame_sink_source_map_.end());
+ CHECK(iter != frame_sink_source_map_.end());
// Remove |child_frame_sink_id| from parents list of children.
auto& mapping = iter->second;

View File

@@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: chromium-autoroll
<chromium-autoroll@skia-public.iam.gserviceaccount.com>
Date: Wed, 12 Apr 2023 21:54:57 +0000
Subject: Roll Skia from 288bdaeb99a4 to d5846fb1f236 (5 revisions)
https://skia.googlesource.com/skia.git/+log/288bdaeb99a4..d5846fb1f236
2023-04-12 johnstiles@google.com Use packed contexts for binary ops in SkRP.
2023-04-12 kjlubick@google.com Add more stubs for encoders
2023-04-12 johnstiles@google.com Enforce program stack limits on function parameters.
2023-04-12 johnstiles@google.com Reland "Use packed contexts for copy/splat-constant ops in SkRP."
2023-04-12 jamesgk@google.com [graphite] Use replay translation in Dawn backend
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/skia-autoroll
Please CC borenet@google.com,lovisolo@google.com on the revert to ensure that a human
is aware of the problem.
To file a bug in Skia: https://bugs.chromium.org/p/skia/issues/entry
To file a bug in Chromium: https://bugs.chromium.org/p/chromium/issues/entry
To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux-blink-rel;luci.chromium.try:linux-chromeos-compile-dbg;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Cq-Do-Not-Cancel-Tryjobs: true
Bug: chromium:1432603
Tbr: lovisolo@google.com
Change-Id: I8e08120b5eabe293c64fecfd76ff60b2d73401c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4420129
Commit-Queue: chromium-autoroll <chromium-autoroll@skia-public.iam.gserviceaccount.com>
Bot-Commit: chromium-autoroll <chromium-autoroll@skia-public.iam.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1129520}
diff --git a/DEPS b/DEPS
index eefdda416ecc032bf2fad613c64efde49a59e9ad..7440c4f0394f9457b69da3ab41906650847ae6c8 100644
--- a/DEPS
+++ b/DEPS
@@ -299,7 +299,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling Skia
# and whatever else without interference from each other.
- 'skia_revision': 'aab9fb4100da797d25fe340e9a2fcb2ae30fc2e1',
+ 'skia_revision': 'd5846fb1f236b9a115f0acd432daa3de18a64419',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling V8
# and whatever else without interference from each other.

View File

@@ -0,0 +1,143 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andrey Kosyakov <caseq@chromium.org>
Date: Thu, 13 Apr 2023 03:55:24 +0000
Subject: Retain DevToolsAgentHost after ForceDetachAllSessions()
(cherry picked from commit 8c4aee2a90d08535cfb1bf0a59e00cae956b1762)
Bug: 1424337
Change-Id: Ie0ebe2a49ffbd2356b896c39446b93e09cd81f5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4378100
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Andrey Kosyakov <caseq@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1123772}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4420271
Commit-Queue: Srinivas Sista <srinivassista@chromium.org>
Cr-Commit-Position: refs/branch-heads/5615@{#1244}
Cr-Branched-From: 9c6408ef696e83a9936b82bbead3d41c93c82ee4-refs/heads/main@{#1109224}
diff --git a/content/browser/devtools/auction_worklet_devtools_agent_host.cc b/content/browser/devtools/auction_worklet_devtools_agent_host.cc
index 20a989999b6da5d269bca3d6c9bf181eea7180e7..34a13a884885926e3985098315fd9121902099e9 100644
--- a/content/browser/devtools/auction_worklet_devtools_agent_host.cc
+++ b/content/browser/devtools/auction_worklet_devtools_agent_host.cc
@@ -96,7 +96,7 @@ AuctionWorkletDevToolsAgentHost::~AuctionWorkletDevToolsAgentHost() = default;
void AuctionWorkletDevToolsAgentHost::WorkletDestroyed() {
worklet_ = nullptr;
- ForceDetachAllSessions();
+ auto retain_this = ForceDetachAllSessionsImpl();
associated_agent_remote_.reset();
}
diff --git a/content/browser/devtools/devtools_agent_host_impl.cc b/content/browser/devtools/devtools_agent_host_impl.cc
index 12779c33fd74ce96ebfd7da2666f9fa3865ccfae..002e41a67314327a9b1354c3d6ed79f17b4dace8 100644
--- a/content/browser/devtools/devtools_agent_host_impl.cc
+++ b/content/browser/devtools/devtools_agent_host_impl.cc
@@ -358,12 +358,18 @@ bool DevToolsAgentHostImpl::Inspect() {
}
void DevToolsAgentHostImpl::ForceDetachAllSessions() {
- scoped_refptr<DevToolsAgentHostImpl> protect(this);
+ std::ignore = ForceDetachAllSessionsImpl();
+}
+
+scoped_refptr<DevToolsAgentHost>
+DevToolsAgentHostImpl::ForceDetachAllSessionsImpl() {
+ scoped_refptr<DevToolsAgentHost> retain_this(this);
while (!sessions_.empty()) {
DevToolsAgentHostClient* client = (*sessions_.begin())->GetClient();
DetachClient(client);
client->AgentHostClosed(this);
}
+ return retain_this;
}
void DevToolsAgentHostImpl::ForceDetachRestrictedSessions(
diff --git a/content/browser/devtools/devtools_agent_host_impl.h b/content/browser/devtools/devtools_agent_host_impl.h
index 7c1bb43345084074b27d4b87aa99af582657fb0f..552b3ec81de3b6e5f222f94835802e6c6aac645f 100644
--- a/content/browser/devtools/devtools_agent_host_impl.h
+++ b/content/browser/devtools/devtools_agent_host_impl.h
@@ -62,7 +62,6 @@ class CONTENT_EXPORT DevToolsAgentHostImpl : public DevToolsAgentHost {
void DisconnectWebContents() override;
void ConnectWebContents(WebContents* wc) override;
RenderProcessHost* GetProcessHost() override;
- void ForceDetachAllSessions() override;
struct NetworkLoaderFactoryParamsAndInfo {
NetworkLoaderFactoryParamsAndInfo();
@@ -126,8 +125,18 @@ class CONTENT_EXPORT DevToolsAgentHostImpl : public DevToolsAgentHost {
DevToolsRendererChannel* GetRendererChannel() { return &renderer_channel_; }
const std::vector<DevToolsSession*>& sessions() const { return sessions_; }
+ // Returns refptr retaining `this`. All other references may be removed
+ // at this point, so `this` will become invalid as soon as returned refptr
+ // gets destroyed.
+ [[nodiscard]] scoped_refptr<DevToolsAgentHost> ForceDetachAllSessionsImpl();
private:
+ // Note that calling this may result in the instance being deleted,
+ // as instance may be owned by client sessions. This should not be
+ // used by methods of derived classes, use `ForceDetachAllSessionsImpl()`
+ // above instead.
+ void ForceDetachAllSessions() override;
+
friend class DevToolsAgentHost; // for static methods
friend class DevToolsSession;
friend class DevToolsRendererChannel;
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc
index 2e0ecd508c3b6b3b3593985b19c0b2d92ebbe4f4..c4da2a97f95c0e213c0ce3fddc96b5596fc8bc0b 100644
--- a/content/browser/devtools/render_frame_devtools_agent_host.cc
+++ b/content/browser/devtools/render_frame_devtools_agent_host.cc
@@ -541,9 +541,9 @@ void RenderFrameDevToolsAgentHost::RenderFrameDeleted(RenderFrameHost* rfh) {
}
void RenderFrameDevToolsAgentHost::DestroyOnRenderFrameGone() {
- scoped_refptr<RenderFrameDevToolsAgentHost> protect(this);
+ scoped_refptr<DevToolsAgentHost> retain_this;
if (IsAttached()) {
- ForceDetachAllSessions();
+ retain_this = ForceDetachAllSessionsImpl();
UpdateRawHeadersAccess(frame_host_);
}
ChangeFrameHostAndObservedProcess(nullptr);
diff --git a/content/browser/devtools/service_worker_devtools_agent_host.cc b/content/browser/devtools/service_worker_devtools_agent_host.cc
index 47d2d169a3eb6cf7c135beeb667cfa5b186987a2..14165045182712b71fef70b758f269b1cbbfc7e8 100644
--- a/content/browser/devtools/service_worker_devtools_agent_host.cc
+++ b/content/browser/devtools/service_worker_devtools_agent_host.cc
@@ -320,8 +320,9 @@ void ServiceWorkerDevToolsAgentHost::UpdateProcessHost() {
void ServiceWorkerDevToolsAgentHost::RenderProcessHostDestroyed(
RenderProcessHost* host) {
+ scoped_refptr<DevToolsAgentHost> retain_this;
if (context_wrapper_->process_manager()->IsShutdown())
- ForceDetachAllSessions();
+ retain_this = ForceDetachAllSessionsImpl();
GetRendererChannel()->SetRenderer(mojo::NullRemote(), mojo::NullReceiver(),
ChildProcessHost::kInvalidUniqueID);
process_observation_.Reset();
diff --git a/content/browser/devtools/web_contents_devtools_agent_host.cc b/content/browser/devtools/web_contents_devtools_agent_host.cc
index fb8e10a18bb725eb9280db8695ae12899dba2eef..2203dcef48c70ecc1758062ac871e80983059464 100644
--- a/content/browser/devtools/web_contents_devtools_agent_host.cc
+++ b/content/browser/devtools/web_contents_devtools_agent_host.cc
@@ -299,7 +299,7 @@ DevToolsAgentHostImpl* WebContentsDevToolsAgentHost::GetPrimaryFrameAgent() {
void WebContentsDevToolsAgentHost::WebContentsDestroyed() {
DCHECK_EQ(this, FindAgentHost(web_contents()));
- ForceDetachAllSessions();
+ auto retain_this = ForceDetachAllSessionsImpl();
auto_attacher_.reset();
g_agent_host_instances.Get().erase(web_contents());
Observe(nullptr);
diff --git a/content/browser/devtools/worker_devtools_agent_host.cc b/content/browser/devtools/worker_devtools_agent_host.cc
index db788e7298d6696ec5a354cb387dfdc4030d8ce0..0984b3ae35459d8676b903394577cc6a43601ac8 100644
--- a/content/browser/devtools/worker_devtools_agent_host.cc
+++ b/content/browser/devtools/worker_devtools_agent_host.cc
@@ -87,7 +87,7 @@ void WorkerDevToolsAgentHost::ChildWorkerCreated(
}
void WorkerDevToolsAgentHost::Disconnected() {
- ForceDetachAllSessions();
+ auto retain_this = ForceDetachAllSessionsImpl();
GetRendererChannel()->SetRenderer(mojo::NullRemote(), mojo::NullReceiver(),
ChildProcessHost::kInvalidUniqueID);
std::move(destroyed_callback_).Run(this);

View File

@@ -0,0 +1,98 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Date: Tue, 11 Apr 2023 07:12:34 +0000
Subject: Stop supporting { handleEvent }.
Make the code aligned with the following specification update:
https://github.com/w3c/ServiceWorker/pull/1676
With the previous specification and code, event listener vector
can be modified during the GetEffectiveFunction execution, which may
bring unexpected vector state.
(cherry picked from commit 5105ce37a6853d52ec97894bf6969b3c29a23afd)
Change-Id: I732c4c9ab2caebc49a7f4ef52640df7b8476d838
Bug: 1429201
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4394402
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Domenic Denicola <domenic@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1126483}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4408837
Reviewed-by: Shunya Shishido <sisidovski@chromium.org>
Reviewed-by: Minoru Chikamune <chikamune@chromium.org>
Cr-Commit-Position: refs/branch-heads/5615@{#1203}
Cr-Branched-From: 9c6408ef696e83a9936b82bbead3d41c93c82ee4-refs/heads/main@{#1109224}
diff --git a/content/browser/service_worker/service_worker_version_browsertest.cc b/content/browser/service_worker/service_worker_version_browsertest.cc
index 5834127a6e70389540cbf347e65ae4bc80495317..bff53482eb05f25542bcd9d7cb5b5a05932b9064 100644
--- a/content/browser/service_worker/service_worker_version_browsertest.cc
+++ b/content/browser/service_worker/service_worker_version_browsertest.cc
@@ -988,6 +988,17 @@ IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest,
version_->fetch_handler_type());
}
+IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest,
+ RemoveFetchEventListenersInGet) {
+ StartServerAndNavigateToSetup();
+ ASSERT_EQ(Install("/service_worker/fetch_event_object_removing_itself.js"),
+ blink::ServiceWorkerStatusCode::kOk);
+ EXPECT_EQ(ServiceWorkerVersion::FetchHandlerExistence::EXISTS,
+ version_->fetch_handler_existence());
+ EXPECT_EQ(ServiceWorkerVersion::FetchHandlerType::kNotSkippable,
+ version_->fetch_handler_type());
+}
+
// Check that fetch event handler added in the install event should result in a
// service worker that doesn't count as having a fetch event handler.
IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest,
diff --git a/content/test/data/service_worker/fetch_event_object_removing_itself.js b/content/test/data/service_worker/fetch_event_object_removing_itself.js
new file mode 100644
index 0000000000000000000000000000000000000000..110bc4821fae3a63a374d3dc6ca954d4bd744952
--- /dev/null
+++ b/content/test/data/service_worker/fetch_event_object_removing_itself.js
@@ -0,0 +1,19 @@
+// Copyright 2023 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let obj = {};
+function victim() {}
+
+Object.defineProperty(obj, 'handleEvent', {
+ get: () => {
+ // Remove the victim function from the listener vector to break the loop.
+ self.removeEventListener('fetch', victim);
+ return () => {};
+ },
+ configurable: true,
+ enumerable: true,
+});
+
+self.addEventListener('fetch', obj);
+self.addEventListener('fetch', victim);
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
index 9438405e331f1978a5c9b76bf8a7148064fb6b7d..75d728dd76aec7e5b5a6d2d15e65c65b4c036ca7 100644
--- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
+++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
@@ -2621,7 +2621,7 @@ ServiceWorkerGlobalScope::FetchHandlerType() {
}
ScriptState* script_state = ScriptController()->GetScriptState();
- // Do not remove this, |scope| is needed by `GetEffectiveFunction`.
+ // Do not remove this, |scope| is needed by `GetListenerObject`.
ScriptState::Scope scope(script_state);
// TODO(crbug.com/1349613): revisit the way to implement this.
@@ -2629,8 +2629,8 @@ ServiceWorkerGlobalScope::FetchHandlerType() {
for (RegisteredEventListener& e : *elv) {
EventTarget* et = EventTarget::Create(script_state);
v8::Local<v8::Value> v =
- To<JSBasedEventListener>(e.Callback())->GetEffectiveFunction(*et);
- if (!v->IsFunction() ||
+ To<JSBasedEventListener>(e.Callback())->GetListenerObject(*et);
+ if (v.IsEmpty() || !v->IsFunction() ||
!v.As<v8::Function>()->Experimental_IsNopFunction()) {
return mojom::blink::ServiceWorkerFetchHandlerType::kNotSkippable;
}

View File

@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <jkleinsc@electronjs.org>
Date: Thu, 2 Mar 2023 15:26:46 -0500
Subject: chore: defer USB service GetDevices request until USB service is
ready.
On macOS we need to wait until the USB service is ready before the list of
devices is available. This should no longer be necessary if/when
https://crbug.com/1096743 is completed.
diff --git a/services/device/usb/usb_service_impl.cc b/services/device/usb/usb_service_impl.cc
index 9acfb687b85986c2f2ba787e7b67556092a714d2..244fe386e499930e9a9f031edae216bb18b6fc4e 100644
--- a/services/device/usb/usb_service_impl.cc
+++ b/services/device/usb/usb_service_impl.cc
@@ -198,7 +198,7 @@ void UsbServiceImpl::GetDevices(GetDevicesCallback callback) {
return;
}
- if (enumeration_in_progress_) {
+ if (enumeration_in_progress_ || !enumeration_ready_) {
pending_enumeration_callbacks_.push_back(std::move(callback));
return;
}

View File

@@ -17,10 +17,10 @@ policy->CanCommitOriginAndUrl.
Upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/3856266.
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
index 8dcc8499e45be5127d80ac882d10a9a2c7a9e8dd..da992c06c75a1c7c48cb628ffa8ecd7e17489d8e 100644
index 3166af39da993beb4fc75b88bdada2821a8ce672..fd95d91a9a4efbfbbcfb117d9f2129b1b1c95011 100644
--- a/content/browser/renderer_host/navigation_request.cc
+++ b/content/browser/renderer_host/navigation_request.cc
@@ -6833,10 +6833,11 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
@@ -6842,10 +6842,11 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
if (IsForMhtmlSubframe())
return origin_with_debug_info;

View File

@@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joey Arhar <jarhar@chromium.org>
Date: Fri, 21 Apr 2023 20:53:40 +0000
Subject: M112: Cherry pick libxml CVE fix
This patch cherry-picks a fix for [CVE-2023-29469] from libxml:
https://gitlab.gnome.org/GNOME/libxml2/-/commit/547edbf1cbdccd46b2e8ff322a456eaa5931c5df
I cherry-picked these by going into my libxml checkout, checking out the
commit that libxml is at for this M112 branch, cherry-picking the CVE
fixes, then running the roll script on all platforms.
Bug: 1433328
Change-Id: Iaee58b0890f7190386cca3e430286f39ccbbdb02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4456592
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: David Baron <dbaron@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Auto-Submit: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/branch-heads/5615@{#1325}
Cr-Branched-From: 9c6408ef696e83a9936b82bbead3d41c93c82ee4-refs/heads/main@{#1109224}
diff --git a/third_party/libxml/README.chromium b/third_party/libxml/README.chromium
index 9813d7cd51b62164cd9cad86b57a0b660d22a223..182f0a73439a5e549aed0fa01b22bdca94a8ccbc 100644
--- a/third_party/libxml/README.chromium
+++ b/third_party/libxml/README.chromium
@@ -25,5 +25,6 @@ Modifications:
in chromium's copy of maldoca. See https://github.com/google/maldoca/issues/87
- Add helper classes in the chromium/ subdirectory.
- Delete various unused files, see chromium/roll.py
+- Cherry picked fix for CVE-2023-29469
This import was generated by the chromium/roll.py script.
diff --git a/third_party/libxml/src/dict.c b/third_party/libxml/src/dict.c
index 5c9ca71940ceea9f4aec9f1e7dfb6c3ba6bd8c76..300df7a55638f4c6728a88c336b3c3197ab05676 100644
--- a/third_party/libxml/src/dict.c
+++ b/third_party/libxml/src/dict.c
@@ -455,7 +455,8 @@ static unsigned long
xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
unsigned long value = seed;
- if (name == NULL) return(0);
+ if ((name == NULL) || (namelen <= 0))
+ return(value);
value += *name;
value <<= 5;
if (namelen > 10) {

View File

@@ -0,0 +1,43 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Keren Zhu <kerenzhu@chromium.org>
Date: Mon, 24 Apr 2023 15:36:21 +0000
Subject: Fix ScopedObservation UaF in
BubbleDialogDelegate::AnchorWidgetObserver
A ScopedObservation can outlive the aura::Window it observes, leading to
a use-after-free error in ~ScopedObservation(). The problem occurs in
BubbleDialogDelegate::AnchorWidgetObserver. This fix listens for
OnWindowDestroying() and resets the observation to prevent the UaF.
(cherry picked from commit 72bd6a1018548ee63a2ec06d6c7714d3a8cdf8a8)
Bug: 1423360
Change-Id: I742b4624b2664dea3fd97db7b399fcd15e45c8fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4455016
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Keren Zhu <kerenzhu@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1133511}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4466947
Reviewed-by: Allen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/branch-heads/5615@{#1353}
Cr-Branched-From: 9c6408ef696e83a9936b82bbead3d41c93c82ee4-refs/heads/main@{#1109224}
diff --git a/ui/views/bubble/bubble_dialog_delegate_view.cc b/ui/views/bubble/bubble_dialog_delegate_view.cc
index 83c8a188d455b0db143b4747ef79d8d72d7717ca..0fca4fa9786ae405cc9f9198f21a2aaae66f748d 100644
--- a/ui/views/bubble/bubble_dialog_delegate_view.cc
+++ b/ui/views/bubble/bubble_dialog_delegate_view.cc
@@ -320,6 +320,13 @@ class BubbleDialogDelegate::AnchorWidgetObserver : public WidgetObserver,
owner_->OnAnchorBoundsChanged();
}
}
+
+ // If the native window is closed by the OS, OnWidgetDestroying() won't
+ // fire. Instead, OnWindowDestroying() will fire before aura::Window
+ // destruction. See //docs/ui/views/widget_destruction.md.
+ void OnWindowDestroying(aura::Window* window) override {
+ window_observation_.Reset();
+ }
#endif
private:

View File

@@ -44,7 +44,7 @@ index 89b9323c08cfed0d3ea3a0ec1beaa0bdfabe343e..69ae95eb8537bab751d27749d6cf392a
} // 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 ae3ca6675522886e070c69c366e0970c17179b1d..06c0cf503095841bf5815f7823d7de13f5173b34 100644
index 17fc909047c9e9556458f1afc8aa303d8857aeae..6fb9a917aa5d659bdd41ca4d6dd81503006e9803 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
@@ -566,10 +566,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {

View File

@@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kenichi Ishibashi <bashi@chromium.org>
Date: Sat, 8 Apr 2023 04:16:50 +0000
Subject: Check SpdyProxyClientSocket is alive after write callback
To ensure that we don't use any member field.
(cherry picked from commit b71541b22ca19d5c3a7c01fedffe521b26577b72)
Bug: 1428820
Change-Id: Icf6677c652a47dc2fd2d01675e94cda031a015f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4394863
Reviewed-by: Adam Rice <ricea@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1125634}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4410322
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Kenichi Ishibashi <bashi@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5615@{#1172}
Cr-Branched-From: 9c6408ef696e83a9936b82bbead3d41c93c82ee4-refs/heads/main@{#1109224}
diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc
index 5af712b05af47bd207e9ef3fb9fe33342d152be0..73ca8d0c2958e532ac9810f5de40405d6e91cdeb 100644
--- a/net/spdy/spdy_proxy_client_socket.cc
+++ b/net/spdy/spdy_proxy_client_socket.cc
@@ -278,7 +278,14 @@ int SpdyProxyClientSocket::GetLocalAddress(IPEndPoint* address) const {
void SpdyProxyClientSocket::RunWriteCallback(int result) {
CHECK(write_callback_);
+
+ base::WeakPtr<SpdyProxyClientSocket> weak_ptr = weak_factory_.GetWeakPtr();
std::move(write_callback_).Run(result);
+ if (!weak_ptr) {
+ // `this` was already destroyed while running `write_callback_`. Must
+ // return immediately without touching any field member.
+ return;
+ }
if (end_stream_state_ == EndStreamState::kEndStreamReceived) {
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(

View File

@@ -0,0 +1,94 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kenichi Ishibashi <bashi@chromium.org>
Date: Sat, 8 Apr 2023 01:56:25 +0000
Subject: Remove the second WeakPtrFactory from SpdyProxyClientSocket
It was introduced [1] to work around an old issue that wouldn't happen
any more since we store a write callback in the class. Instead of having
the second WeakPtrFactory and moving the callback, we can just keep it
until RunWriteCallback() is called.
This is a speculative fix for the linked bug.
[1] https://codereview.chromium.org/338583003/
(cherry picked from commit 01b25615896b911e21103dd381fafc1f85886d91)
Bug: 1428820
Change-Id: I0b5af2675b68188e208c2ecd42293251b2722b28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4393905
Reviewed-by: Adam Rice <ricea@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1125216}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4410320
Auto-Submit: Kenichi Ishibashi <bashi@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5615@{#1171}
Cr-Branched-From: 9c6408ef696e83a9936b82bbead3d41c93c82ee4-refs/heads/main@{#1109224}
diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc
index 9b5b47ac05de773024e46f1cce534ddabed5ebd3..5af712b05af47bd207e9ef3fb9fe33342d152be0 100644
--- a/net/spdy/spdy_proxy_client_socket.cc
+++ b/net/spdy/spdy_proxy_client_socket.cc
@@ -122,7 +122,6 @@ void SpdyProxyClientSocket::Disconnect() {
write_buffer_len_ = 0;
write_callback_.Reset();
- write_callback_weak_factory_.InvalidateWeakPtrs();
next_state_ = STATE_DISCONNECTED;
@@ -277,9 +276,9 @@ int SpdyProxyClientSocket::GetLocalAddress(IPEndPoint* address) const {
return spdy_stream_->GetLocalAddress(address);
}
-void SpdyProxyClientSocket::RunWriteCallback(CompletionOnceCallback callback,
- int result) const {
- std::move(callback).Run(result);
+void SpdyProxyClientSocket::RunWriteCallback(int result) {
+ CHECK(write_callback_);
+ std::move(write_callback_).Run(result);
if (end_stream_state_ == EndStreamState::kEndStreamReceived) {
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
@@ -516,8 +515,7 @@ void SpdyProxyClientSocket::OnDataSent() {
// stream's write callback chain to unwind (see crbug.com/355511).
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE, base::BindOnce(&SpdyProxyClientSocket::RunWriteCallback,
- write_callback_weak_factory_.GetWeakPtr(),
- std::move(write_callback_), rv));
+ weak_factory_.GetWeakPtr(), rv));
}
void SpdyProxyClientSocket::OnTrailers(const spdy::Http2HeaderBlock& trailers) {
diff --git a/net/spdy/spdy_proxy_client_socket.h b/net/spdy/spdy_proxy_client_socket.h
index 7576ebed45d4983592528f90856c170ece0c04c6..87a731fe42159770098624e3073012061ed0b360 100644
--- a/net/spdy/spdy_proxy_client_socket.h
+++ b/net/spdy/spdy_proxy_client_socket.h
@@ -121,9 +121,9 @@ class NET_EXPORT_PRIVATE SpdyProxyClientSocket : public ProxyClientSocket,
STATE_CLOSED
};
- // Calls |callback.Run(result)|. Used to run a callback posted to the
+ // Calls `write_callback_(result)`. Used to run a callback posted to the
// message loop.
- void RunWriteCallback(CompletionOnceCallback callback, int result) const;
+ void RunWriteCallback(int result);
void OnIOComplete(int result);
@@ -195,13 +195,7 @@ class NET_EXPORT_PRIVATE SpdyProxyClientSocket : public ProxyClientSocket,
};
EndStreamState end_stream_state_ = EndStreamState::kNone;
- // The default weak pointer factory.
base::WeakPtrFactory<SpdyProxyClientSocket> weak_factory_{this};
-
- // Only used for posting write callbacks. Weak pointers created by this
- // factory are invalidated in Disconnect().
- base::WeakPtrFactory<SpdyProxyClientSocket> write_callback_weak_factory_{
- this};
};
} // namespace net

View File

@@ -8,10 +8,10 @@ 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 cabd236eaa3f24b8564d471587543eb5be9ec6bf..53812c4fd4103f60896b5c9b1c9ae811dba75fe2 100644
index f0f097e58303cbfd86acc38c65be30706c59b595..ab4fd53fa85ba85256f629fb1fe9417b3e225337 100644
--- a/ui/color/color_id.h
+++ b/ui/color/color_id.h
@@ -260,6 +260,10 @@
@@ -261,6 +261,10 @@
E_CPONLY(kColorScrollbarThumbInactive) \
E_CPONLY(kColorScrollbarThumbPressed) \
E_CPONLY(kColorScrollbarTrack) \
@@ -22,7 +22,7 @@ index cabd236eaa3f24b8564d471587543eb5be9ec6bf..53812c4fd4103f60896b5c9b1c9ae811
E_CPONLY(kColorSeparator) \
E_CPONLY(kColorShadowBase) \
E_CPONLY(kColorShadowValueAmbientShadowElevationSixteen) \
@@ -314,6 +318,7 @@
@@ -315,6 +319,7 @@
E_CPONLY(kColorTreeNodeForeground) \
E_CPONLY(kColorTreeNodeForegroundSelectedFocused) \
E_CPONLY(kColorTreeNodeForegroundSelectedUnfocused) \
@@ -31,10 +31,10 @@ index cabd236eaa3f24b8564d471587543eb5be9ec6bf..53812c4fd4103f60896b5c9b1c9ae811
#if BUILDFLAG(IS_CHROMEOS)
diff --git a/ui/color/ui_color_mixer.cc b/ui/color/ui_color_mixer.cc
index 80394f269c91cb1064f9f960e3ecca41704c8e03..0885bf11672d47544d067deb74dbe786aa227127 100644
index d23901f25760a33afd00302f6f88eafa87321b20..8b2e59f0a046a194302269555aaac0965fd2abc5 100644
--- a/ui/color/ui_color_mixer.cc
+++ b/ui/color/ui_color_mixer.cc
@@ -192,6 +192,17 @@ void AddUiColorMixer(ColorProvider* provider,
@@ -201,6 +201,17 @@ void AddUiColorMixer(ColorProvider* provider,
: SkColorSetA(SK_ColorBLACK, 0x80)};
mixer[kColorScrollbarTrack] = {dark_mode ? SkColorSetRGB(0x42, 0x42, 0x42)
: SkColorSetRGB(0xF1, 0xF1, 0xF1)};
@@ -52,7 +52,7 @@ index 80394f269c91cb1064f9f960e3ecca41704c8e03..0885bf11672d47544d067deb74dbe786
mixer[kColorSeparator] = {kColorMidground};
mixer[kColorShadowBase] = {dark_mode ? SK_ColorBLACK : gfx::kGoogleGrey800};
mixer[kColorShadowValueAmbientShadowElevationThree] =
@@ -273,6 +284,7 @@ void AddUiColorMixer(ColorProvider* provider,
@@ -291,6 +302,7 @@ void AddUiColorMixer(ColorProvider* provider,
mixer[kColorTreeNodeForegroundSelectedFocused] = {kColorTreeNodeForeground};
mixer[kColorTreeNodeForegroundSelectedUnfocused] = {
kColorTreeNodeForegroundSelectedFocused};

View File

@@ -0,0 +1,240 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: David Sanders <dsanders11@ucsbalum.com>
Date: Sun, 2 Apr 2023 05:52:30 -0700
Subject: Revert "[X11] Keep WindowCache alive for a time interval"
This reverts commit bbc20a9c1b91ac6d6035408748091369cc96d4d7.
While intended as a performance improvement, the commit breaks
Views menus on X11 after certain window events such as resizing,
or maximizing and unmaximizing.
The patch can be removed once the upstream issue is fixed. That
was reported in https://crbug.com/1429935.
diff --git a/ui/base/x/x11_whole_screen_move_loop.cc b/ui/base/x/x11_whole_screen_move_loop.cc
index 14b7a26e474f1a11937c3923d6ef715568c30f20..a0baf8a03c8f614af37954fecd543375fc56e2b1 100644
--- a/ui/base/x/x11_whole_screen_move_loop.cc
+++ b/ui/base/x/x11_whole_screen_move_loop.cc
@@ -26,6 +26,7 @@
#include "ui/events/x/x11_event_translation.h"
#include "ui/gfx/x/connection.h"
#include "ui/gfx/x/keysyms/keysyms.h"
+#include "ui/gfx/x/window_cache.h"
#include "ui/gfx/x/x11_window_event_manager.h"
#include "ui/gfx/x/xproto.h"
@@ -151,6 +152,10 @@ bool X11WholeScreenMoveLoop::RunMoveLoop(
auto* connection = x11::Connection::Get();
CreateDragInputWindow(connection);
+ // Keep a window cache alive for the duration of the drag so that the drop
+ // target under the drag window can be quickly determined.
+ x11::WindowCache cache(connection, connection->default_root(), true);
+
// Only grab mouse capture of |grab_input_window_| if |can_grab_pointer| is
// true aka the source that initiated the move loop doesn't have explicit
// grab.
diff --git a/ui/gfx/x/window_cache.cc b/ui/gfx/x/window_cache.cc
index 048a9068a8671ec40acc1f91fdc0ddce0b3645c7..e2ababce59750952dba1dc0976db47338ecfef87 100644
--- a/ui/gfx/x/window_cache.cc
+++ b/ui/gfx/x/window_cache.cc
@@ -11,8 +11,6 @@
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
-#include "base/task/single_thread_task_runner.h"
-#include "base/time/time.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/vector2d.h"
@@ -24,23 +22,19 @@
namespace x11 {
-const base::TimeDelta kDestroyTimerInterval = base::Seconds(3);
-
Window GetWindowAtPoint(const gfx::Point& point_px,
const base::flat_set<Window>* ignore) {
auto* connection = Connection::Get();
Window root = connection->default_root();
- if (!WindowCache::instance()) {
- auto instance =
- std::make_unique<WindowCache>(connection, connection->default_root());
- auto* cache = instance.get();
- cache->BeginDestroyTimer(std::move(instance));
+ if (auto* instance = WindowCache::instance()) {
+ instance->WaitUntilReady();
+ return instance->GetWindowAtPoint(point_px, root, ignore);
}
- auto* instance = WindowCache::instance();
- instance->WaitUntilReady();
- return instance->GetWindowAtPoint(point_px, root, ignore);
+ WindowCache cache(connection, connection->default_root(), false);
+ cache.WaitUntilReady();
+ return cache.GetWindowAtPoint(point_px, root, ignore);
}
ScopedShapeEventSelector::ScopedShapeEventSelector(Connection* connection,
@@ -62,21 +56,24 @@ WindowCache::WindowInfo::~WindowInfo() = default;
// static
WindowCache* WindowCache::instance_ = nullptr;
-WindowCache::WindowCache(Connection* connection, Window root)
+WindowCache::WindowCache(Connection* connection, Window root, bool track_events)
: connection_(connection),
root_(root),
+ track_events_(track_events),
gtk_frame_extents_(GetAtom("_GTK_FRAME_EXTENTS")) {
DCHECK(!instance_) << "Only one WindowCache should be active at a time";
instance_ = this;
connection_->AddEventObserver(this);
- // We select for SubstructureNotify events on all windows (to receive
- // CreateNotify events), which will cause events to be sent for all child
- // windows. This means we need to additionally select for StructureNotify
- // changes for the root window.
- root_events_ =
- std::make_unique<XScopedEventSelector>(root_, EventMask::StructureNotify);
+ if (track_events_) {
+ // We select for SubstructureNotify events on all windows (to receive
+ // CreateNotify events), which will cause events to be sent for all child
+ // windows. This means we need to additionally select for StructureNotify
+ // changes for the root window.
+ root_events_ = std::make_unique<XScopedEventSelector>(
+ root_, EventMask::StructureNotify);
+ }
AddWindow(root_, Window::None);
}
@@ -106,16 +103,6 @@ void WindowCache::WaitUntilReady() {
last_processed_event_ = events[event - 1].sequence();
}
-void WindowCache::BeginDestroyTimer(std::unique_ptr<WindowCache> self) {
- DCHECK_EQ(this, self.get());
- delete_when_destroy_timer_fires_ = false;
- base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
- FROM_HERE,
- base::BindOnce(&WindowCache::OnDestroyTimerExpired,
- base::Unretained(this), std::move(self)),
- kDestroyTimerInterval);
-}
-
void WindowCache::SyncForTest() {
do {
// Perform a blocking sync to prevent spinning while waiting for replies.
@@ -127,7 +114,6 @@ void WindowCache::SyncForTest() {
Window WindowCache::GetWindowAtPoint(gfx::Point point_px,
Window window,
const base::flat_set<Window>* ignore) {
- delete_when_destroy_timer_fires_ = true;
if (ignore && ignore->contains(window))
return Window::None;
auto* info = GetInfo(window);
@@ -265,10 +251,12 @@ void WindowCache::AddWindow(Window window, Window parent) {
return;
WindowInfo& info = windows_[window];
info.parent = parent;
- // Events must be selected before getting the initial window info to
- // prevent race conditions.
- info.events = std::make_unique<XScopedEventSelector>(
- window, EventMask::SubstructureNotify | EventMask::PropertyChange);
+ if (track_events_) {
+ // Events must be selected before getting the initial window info to
+ // prevent race conditions.
+ info.events = std::make_unique<XScopedEventSelector>(
+ window, EventMask::SubstructureNotify | EventMask::PropertyChange);
+ }
AddRequest(connection_->GetWindowAttributes(window),
&WindowCache::OnGetWindowAttributesResponse, window);
@@ -282,8 +270,10 @@ void WindowCache::AddWindow(Window window, Window parent) {
auto& shape = connection_->shape();
if (shape.present()) {
- info.shape_events =
- std::make_unique<ScopedShapeEventSelector>(connection_, window);
+ if (track_events_) {
+ info.shape_events =
+ std::make_unique<ScopedShapeEventSelector>(connection_, window);
+ }
for (auto kind : {Shape::Sk::Bounding, Shape::Sk::Input}) {
AddRequest(shape.GetRectangles(window, kind),
@@ -391,11 +381,4 @@ void WindowCache::OnGetRectanglesResponse(
}
}
-void WindowCache::OnDestroyTimerExpired(std::unique_ptr<WindowCache> self) {
- if (!delete_when_destroy_timer_fires_)
- return; // destroy `this`
-
- BeginDestroyTimer(std::move(self));
-}
-
} // namespace x11
diff --git a/ui/gfx/x/window_cache.h b/ui/gfx/x/window_cache.h
index f241d6c23855fad478813ff3029fa6a17d084d34..ebc05d311ed3719be98180086baae8230ec9c58e 100644
--- a/ui/gfx/x/window_cache.h
+++ b/ui/gfx/x/window_cache.h
@@ -78,7 +78,7 @@ class COMPONENT_EXPORT(X11) WindowCache : public EventObserver {
// If `track_events` is true, the WindowCache will keep the cache state synced
// with the server's state over time. It may be set to false if the cache is
// short-lived, if only a single GetWindowAtPoint call is made.
- WindowCache(Connection* connection, Window root);
+ WindowCache(Connection* connection, Window root, bool track_events);
WindowCache(const WindowCache&) = delete;
WindowCache& operator=(const WindowCache&) = delete;
~WindowCache() override;
@@ -92,10 +92,6 @@ class COMPONENT_EXPORT(X11) WindowCache : public EventObserver {
// Blocks until all outstanding requests are processed.
void WaitUntilReady();
- // Destroys |self| if no calls to GetWindowAtPoint() are made within
- // a time window.
- void BeginDestroyTimer(std::unique_ptr<WindowCache> self);
-
void SyncForTest();
const std::unordered_map<Window, WindowInfo>& windows() const {
@@ -147,12 +143,11 @@ class COMPONENT_EXPORT(X11) WindowCache : public EventObserver {
Shape::Sk kind,
Shape::GetRectanglesResponse response);
- void OnDestroyTimerExpired(std::unique_ptr<WindowCache> self);
-
static WindowCache* instance_;
const raw_ptr<Connection> connection_;
const Window root_;
+ const bool track_events_;
const Atom gtk_frame_extents_;
std::unique_ptr<XScopedEventSelector> root_events_;
@@ -164,9 +159,6 @@ class COMPONENT_EXPORT(X11) WindowCache : public EventObserver {
// processed in order.
absl::optional<uint32_t> last_processed_event_;
- // True iff GetWindowAtPoint() was called since the last timer interval.
- bool delete_when_destroy_timer_fires_ = false;
-
// Although only one instance of WindowCache may be created at a time, the
// instance will be created and destroyed as needed, so WeakPtrs are still
// necessary.
diff --git a/ui/gfx/x/window_cache_unittest.cc b/ui/gfx/x/window_cache_unittest.cc
index 2199ddac2577a33ff7a42f3d3752613cef00dd32..af0a2d3737c132b596096514b5ca4f572d6c9d64 100644
--- a/ui/gfx/x/window_cache_unittest.cc
+++ b/ui/gfx/x/window_cache_unittest.cc
@@ -21,7 +21,7 @@ class WindowCacheTest : public testing::Test {
protected:
void ResetCache() {
cache_.reset();
- cache_ = std::make_unique<WindowCache>(connection_, root_);
+ cache_ = std::make_unique<WindowCache>(connection_, root_, true);
cache_->SyncForTest();
}

View File

@@ -21,5 +21,9 @@
"src/electron/patches/Mantle": "src/third_party/squirrel.mac/vendor/Mantle",
"src/electron/patches/ReactiveObjC": "src/third_party/squirrel.mac/vendor/ReactiveObjC"
"src/electron/patches/ReactiveObjC": "src/third_party/squirrel.mac/vendor/ReactiveObjC",
"src/electron/patches/webrtc": "src/third_party/webrtc",
"src/electron/patches/skia": "src/third_party/skia"
}

View File

@@ -53,3 +53,5 @@ chore_add_missing_algorithm_include.patch
enable_crashpad_linux_node_processes.patch
allow_embedder_to_control_codegenerationfromstringscallback.patch
cherry-pick-09ae62b.patch
lib_fix_broadcastchannel_initialization_location.patch
src_allow_optional_isolation_termination_in_node.patch

View File

@@ -30,7 +30,7 @@ index b6981c37d5b286e22f24d11751eb05f72ca27619..c4a3a54753767e7686a0e32996bcda0c
Mutex::ScopedLock lock(node::per_process::cli_options_mutex);
if (per_process::cli_options->get_per_isolate_options()
diff --git a/src/node.h b/src/node.h
index bee494f9da8470530ee9ec58958f8f2c7ce6a302..387ce8e5edf6524db170e2d46ef501a1cd956d98 100644
index f8f2cde5c2e07e032955b0342a31db52f20460f3..7e1be61a9cca8205666a129bafa2b2f4f4dbcc4b 100644
--- a/src/node.h
+++ b/src/node.h
@@ -461,6 +461,8 @@ struct IsolateSettings {

View File

@@ -52,7 +52,7 @@ index 1b7a721585764aecfd855ee47c47a3bd235d2ef3..c152ea9f29478729ec3752132140e3ec
o['variables']['v8_enable_javascript_promise_hooks'] = 1
o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0
diff --git a/src/node.h b/src/node.h
index 10061d4298368bc0ad53c0c8c3a3c964c13d4c3c..bee494f9da8470530ee9ec58958f8f2c7ce6a302 100644
index 10061d4298368bc0ad53c0c8c3a3c964c13d4c3c..f8f2cde5c2e07e032955b0342a31db52f20460f3 100644
--- a/src/node.h
+++ b/src/node.h
@@ -22,6 +22,12 @@
@@ -61,7 +61,7 @@ index 10061d4298368bc0ad53c0c8c3a3c964c13d4c3c..bee494f9da8470530ee9ec58958f8f2c
+#ifdef ELECTRON_ENSURE_CONFIG_GYPI
+#ifndef USING_ELECTRON_CONFIG_GYPI
+#error "It looks like you are building this native module without using the right config.gypi. This normally means that you need to update electron-rebuild (>=3.2.8) or node-gyp (>=8.4.0) if you're building modules directly."
+#error "It looks like you are building this native module without using the right config.gypi. This normally means that you need to update electron-rebuild (>=3.2.8) or node-gyp (>=9.0.0) if you're building modules directly."
+#endif
+#endif
+

View File

@@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Mon, 27 Feb 2023 12:56:15 +0100
Subject: lib: fix BroadcastChannel initialization location
Refs https://github.com/nodejs/node/pull/40532.
Fixes a bug in the above, wherein BroadcastChannel should have been
initialized in bootstrap/browser instead of bootstrap/node. That
inadvertently made it such that there was incorrect handling of the
DOM vs Node.js implementations of BroadcastChannel.
This will be upstreamed.
diff --git a/lib/internal/bootstrap/browser.js b/lib/internal/bootstrap/browser.js
index d0c01ca2a512be549b0fea8a829c05eabbec799a..210a1bb7e929021725b04786bc11d9b3ce09ad04 100644
--- a/lib/internal/bootstrap/browser.js
+++ b/lib/internal/bootstrap/browser.js
@@ -12,6 +12,10 @@ const {
} = require('internal/util');
const config = internalBinding('config');
+// Non-standard extensions:
+const { BroadcastChannel } = require('internal/worker/io');
+exposeInterface(globalThis, 'BroadcastChannel', BroadcastChannel);
+
// https://console.spec.whatwg.org/#console-namespace
exposeNamespace(globalThis, 'console',
createGlobalConsole());
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
index 83ac636db19a66f43fc7d3c1fc1e8290eeadd334..cb5072df3c23b499292887c56501820aee5cbd0e 100644
--- a/lib/internal/bootstrap/node.js
+++ b/lib/internal/bootstrap/node.js
@@ -248,10 +248,6 @@ const {
queueMicrotask
} = require('internal/process/task_queues');
-// Non-standard extensions:
-const { BroadcastChannel } = require('internal/worker/io');
-exposeInterface(globalThis, 'BroadcastChannel', BroadcastChannel);
-
defineOperation(globalThis, 'queueMicrotask', queueMicrotask);
const timers = require('timers');

View File

@@ -0,0 +1,75 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Tue, 7 Feb 2023 10:53:11 +0100
Subject: src: allow optional isolation termination in node
This patch allows for node::Stop() to conditionally call
V8:Isolate::TerminateExecution().
We do not want to invoke a termination exception at exit when
we're running with only_terminate_in_safe_scope set to false. Heap and
coverage profilers run after environment exit and if there is a pending
exception at this stage then they will fail to generate the appropriate
profiles. Node.js does not call node::Stop(), which previously always
called isolate->TerminateExecution(), and therefore does not have this
issue when also running with only_terminate_in_safe_scope set to false.
diff --git a/src/env.cc b/src/env.cc
index de41e5b7f6ff9f818c661484a93b74db7569e31f..819fcfa6be46328a01a612315d48e93eb025423c 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -920,10 +920,11 @@ void Environment::InitializeLibuv() {
StartProfilerIdleNotifier();
}
-void Environment::ExitEnv() {
+void Environment::ExitEnv(bool terminate) {
set_can_call_into_js(false);
set_stopping(true);
- isolate_->TerminateExecution();
+ if (terminate)
+ isolate_->TerminateExecution();
SetImmediateThreadsafe([](Environment* env) { uv_stop(env->event_loop()); });
}
diff --git a/src/env.h b/src/env.h
index 34c88c1addc5f64bd46332451e5b4ba8343c8818..1d32bf5945ab814294b5b5676b228c86518a05cd 100644
--- a/src/env.h
+++ b/src/env.h
@@ -1100,7 +1100,7 @@ class Environment : public MemoryRetainer {
void RegisterHandleCleanups();
void CleanupHandles();
void Exit(int code);
- void ExitEnv();
+ void ExitEnv(bool terminate);
// Register clean-up cb to be called on environment destruction.
inline void RegisterHandleCleanup(uv_handle_t* handle,
diff --git a/src/node.cc b/src/node.cc
index 357ca1eb55652d88d6de60618e62cd54eaff6601..e0f84c3a7ba1c1866971eacfe0b508a52446bd7e 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1344,8 +1344,8 @@ int Start(int argc, char** argv) {
return LoadSnapshotDataAndRun(&snapshot_data, result.get());
}
-int Stop(Environment* env) {
- env->ExitEnv();
+int Stop(Environment* env, bool terminate) {
+ env->ExitEnv(terminate);
return 0;
}
diff --git a/src/node.h b/src/node.h
index 7e1be61a9cca8205666a129bafa2b2f4f4dbcc4b..00ff1d6d6560a2e97da1c675a46bcd6defe963d7 100644
--- a/src/node.h
+++ b/src/node.h
@@ -314,7 +314,7 @@ NODE_EXTERN int Start(int argc, char* argv[]);
// Tear down Node.js while it is running (there are active handles
// in the loop and / or actively executing JavaScript code).
-NODE_EXTERN int Stop(Environment* env);
+NODE_EXTERN int Stop(Environment* env, bool terminate = true);
// This runs a subset of the initialization performed by
// InitializeOncePerProcess(), which supersedes this function.

2
patches/skia/.patches Normal file
View File

@@ -0,0 +1,2 @@
reland_enforce_program_stack_limits_on_function_parameters.patch
enforce_size_limits_on_struct_and_array_declarations.patch

View File

@@ -0,0 +1,307 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Stiles <johnstiles@google.com>
Date: Thu, 13 Apr 2023 17:58:24 -0400
Subject: Enforce size limits on struct and array declarations.
This improves error reporting by more clearly attaching the error
message to the oversized type.
Bug: chromium:1432603
Change-Id: I26511f08aff22072cf4913abf7be2c49940a732c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/671377
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
(cherry picked from commit 1cbd33ecd73523f8d4bf88e9c5576303b39e5556)
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/671686
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
diff --git a/gn/sksl_tests.gni b/gn/sksl_tests.gni
index 3da854583d1d8c60aa20774abbc7537c2ca0aa04..1b329ff2665ab2ec1e35b2dfd6164c8895dda1ae 100644
--- a/gn/sksl_tests.gni
+++ b/gn/sksl_tests.gni
@@ -193,6 +193,7 @@ sksl_error_tests = [
"errors/ProgramTooLarge_Globals.rts",
"errors/ProgramTooLarge_Parameters.rts",
"errors/ProgramTooLarge_Stack.rts",
+ "errors/ProgramTooLarge_Struct.rts",
"errors/PrototypeInFuncBody.rts",
"errors/ReadonlyWriteonly.compute",
"errors/RedeclareBasicType.rts",
diff --git a/resources/sksl/BUILD.bazel b/resources/sksl/BUILD.bazel
index 98cb09574dc8b9fc0fea0e2876eb26111df394f5..654e78f44adede0430b3d2c5308efe9cce6061b3 100644
--- a/resources/sksl/BUILD.bazel
+++ b/resources/sksl/BUILD.bazel
@@ -334,6 +334,7 @@ skia_filegroup(
"errors/ProgramTooLarge_Globals.rts",
"errors/ProgramTooLarge_Parameters.rts",
"errors/ProgramTooLarge_Stack.rts",
+ "errors/ProgramTooLarge_Struct.rts",
"errors/PrototypeInFuncBody.rts",
"errors/RTAdjustType.sksl",
"errors/ReadonlyWriteonly.compute",
diff --git a/resources/sksl/errors/ProgramTooLarge_Globals.rts b/resources/sksl/errors/ProgramTooLarge_Globals.rts
index af0ad17ce7a591d99a9cbb062278b99046bd2fe8..ee2556bb1a99404ebe53641064bceff3a553ea9a 100644
--- a/resources/sksl/errors/ProgramTooLarge_Globals.rts
+++ b/resources/sksl/errors/ProgramTooLarge_Globals.rts
@@ -6,11 +6,10 @@ struct S {
};
int small;
-S medium;
-S large[10];
-S extra_large[100];
-S xxl[50000];
-
+S medium[30];
+S large[50];
+S extra_large[70];
+S xxl[90];
/*%%*
global variable 'extra_large' exceeds the size limit
diff --git a/resources/sksl/errors/ProgramTooLarge_Parameters.rts b/resources/sksl/errors/ProgramTooLarge_Parameters.rts
index cced977be40620ffc3b145837bd5ffe16b40295b..cb1225d2442a8da93237a3cc6dcf2948232abde7 100644
--- a/resources/sksl/errors/ProgramTooLarge_Parameters.rts
+++ b/resources/sksl/errors/ProgramTooLarge_Parameters.rts
@@ -1,14 +1,17 @@
struct S {
half4 ah4[1];
- half ah[99999];
+ half ah[99990];
half4 h4;
half h;
};
void func(int small,
+ int parameters,
+ int are,
+ int allowed,
S big_chungus,
S no_report /*we don't need to report overflows past the first*/) {}
/*%%*
variable 'big_chungus' exceeds the stack size limit
-*%%*/
+*%%*/
\ No newline at end of file
diff --git a/resources/sksl/errors/ProgramTooLarge_Stack.rts b/resources/sksl/errors/ProgramTooLarge_Stack.rts
index 4f004368a17b79d960e5cc142db35d82fb627cbd..a8f5217359ad9dab1fdcfcaac862938c1d205f0a 100644
--- a/resources/sksl/errors/ProgramTooLarge_Stack.rts
+++ b/resources/sksl/errors/ProgramTooLarge_Stack.rts
@@ -1,12 +1,12 @@
struct S {
half4 ah4[1];
- half ah[99999];
+ half ah[99990];
half4 h4;
half h;
};
void func() {
- int small;
+ int small, variables, are, allowed;
S big_chungus;
S no_report; // we don't need to report overflows past the first
}
diff --git a/resources/sksl/errors/ProgramTooLarge_Struct.rts b/resources/sksl/errors/ProgramTooLarge_Struct.rts
new file mode 100644
index 0000000000000000000000000000000000000000..690e1d37311b5d0745d20d71b48738a69c5c3ecb
--- /dev/null
+++ b/resources/sksl/errors/ProgramTooLarge_Struct.rts
@@ -0,0 +1,24 @@
+struct A {
+ int4 big[25001]; // 100,004 slots
+};
+
+struct B {
+ int4 a[12500]; // 50,000 slots
+ int b[49999]; // 99,999 slots
+ int c; // 100,000 slots
+};
+
+struct C {
+ int a[99999]; // 99,999 slots (safe)
+};
+
+struct D {
+ C a; // 99,999 slots
+ int b; // 100,000 slots
+};
+
+/*%%*
+array size is too large
+struct is too large
+struct is too large
+*%%*/
diff --git a/src/sksl/dsl/DSLType.cpp b/src/sksl/dsl/DSLType.cpp
index 6250795ed1e1d6accf362e764a5738cf9db332c2..d27c5c8bc6def2e94bfcb312de6e342676a046f6 100644
--- a/src/sksl/dsl/DSLType.cpp
+++ b/src/sksl/dsl/DSLType.cpp
@@ -270,7 +270,7 @@ DSLExpression DSLType::Construct(DSLType type, SkSpan<DSLExpression> argArray) {
DSLType Array(const DSLType& base, int count, Position pos) {
count = base.skslType().convertArraySize(ThreadContext::Context(), pos,
- DSLExpression(count, pos).release());
+ DSLExpression(count, pos).release());
if (!count) {
return DSLType(kPoison_Type);
}
@@ -282,7 +282,7 @@ DSLType UnsizedArray(const DSLType& base, Position pos) {
return DSLType(kPoison_Type);
}
return ThreadContext::SymbolTable()->addArrayDimension(&base.skslType(),
- SkSL::Type::kUnsizedArray);
+ SkSL::Type::kUnsizedArray);
}
DSLType StructType(std::string_view name,
diff --git a/src/sksl/ir/SkSLType.cpp b/src/sksl/ir/SkSLType.cpp
index 3c8d933bad324602dd6a9f0229f204e883210e3c..eff98031ef5f59e12a3be12c8a7d9607c0077229 100644
--- a/src/sksl/ir/SkSLType.cpp
+++ b/src/sksl/ir/SkSLType.cpp
@@ -9,9 +9,9 @@
#include "include/private/SkSLLayout.h"
#include "include/private/SkSLString.h"
-#include "include/private/SkTFitsIn.h"
#include "include/sksl/SkSLErrorReporter.h"
#include "src/core/SkMathPriv.h"
+#include "src/core/SkSafeMath.h"
#include "src/sksl/SkSLBuiltinTypes.h"
#include "src/sksl/SkSLConstantFolder.h"
#include "src/sksl/SkSLContext.h"
@@ -694,6 +694,17 @@ std::unique_ptr<Type> Type::MakeStructType(const Context& context,
break;
}
}
+ size_t slots = 0;
+ for (const Field& field : fields) {
+ if (field.fType->isUnsizedArray()) {
+ continue;
+ }
+ slots = SkSafeMath::Add(slots, field.fType->slotCount());
+ if (slots >= kVariableSlotLimit) {
+ context.fErrors->error(pos, "struct is too large");
+ break;
+ }
+ }
return std::make_unique<StructType>(pos, name, std::move(fields), interfaceBlock);
}
@@ -1164,8 +1175,9 @@ bool Type::checkIfUsableInArray(const Context& context, Position arrayPos) const
return true;
}
-SKSL_INT Type::convertArraySize(const Context& context, Position arrayPos,
- std::unique_ptr<Expression> size) const {
+SKSL_INT Type::convertArraySize(const Context& context,
+ Position arrayPos,
+ std::unique_ptr<Expression> size) const {
size = context.fTypes.fInt->coerceExpression(std::move(size), context);
if (!size) {
return 0;
@@ -1182,7 +1194,7 @@ SKSL_INT Type::convertArraySize(const Context& context, Position arrayPos,
context.fErrors->error(size->fPosition, "array size must be positive");
return 0;
}
- if (!SkTFitsIn<int32_t>(count)) {
+ if (SkSafeMath::Mul(this->slotCount(), count) > kVariableSlotLimit) {
context.fErrors->error(size->fPosition, "array size is too large");
return 0;
}
diff --git a/tests/sksl/errors/ProgramTooLarge_Globals.glsl b/tests/sksl/errors/ProgramTooLarge_Globals.glsl
index 406949ad38ecb6ea80bbba505cdf5ad9346c9446..ccb7706c3a66a7b41fd5c6444ea1e9967f314282 100644
--- a/tests/sksl/errors/ProgramTooLarge_Globals.glsl
+++ b/tests/sksl/errors/ProgramTooLarge_Globals.glsl
@@ -1,6 +1,6 @@
### Compilation failed:
error: 11: global variable 'extra_large' exceeds the size limit
-S extra_large[100];
-^^^^^^^^^^^^^^^^^^
+S extra_large[70];
+^^^^^^^^^^^^^^^^^
1 error
diff --git a/tests/sksl/errors/ProgramTooLarge_Parameters.glsl b/tests/sksl/errors/ProgramTooLarge_Parameters.glsl
index d92c3256e82d52115621cf96d6dba99f62cdd945..3ece6f379c8ab64dd846d856301217f95eb3e7ff 100644
--- a/tests/sksl/errors/ProgramTooLarge_Parameters.glsl
+++ b/tests/sksl/errors/ProgramTooLarge_Parameters.glsl
@@ -1,6 +1,6 @@
### Compilation failed:
-error: 10: variable 'big_chungus' exceeds the stack size limit
+error: 13: variable 'big_chungus' exceeds the stack size limit
S no_report /*we don't need to report overflows past the first*/) {}
^^
1 error
diff --git a/tests/sksl/errors/ProgramTooLarge_Struct.glsl b/tests/sksl/errors/ProgramTooLarge_Struct.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..ebe47f700dfad807fbd7b774f5f2ce851ff28e64
--- /dev/null
+++ b/tests/sksl/errors/ProgramTooLarge_Struct.glsl
@@ -0,0 +1,12 @@
+### Compilation failed:
+
+error: 2: array size is too large
+ int4 big[25001]; // 100,004 slots
+ ^^^^^^^^^^^^^^^
+error: 5: struct is too large
+struct B {
+^^^^^^^^^^...
+error: 15: struct is too large
+struct D {
+^^^^^^^^^^...
+3 errors
diff --git a/tests/sksl/shared/Ossfuzz37900.asm.frag b/tests/sksl/shared/Ossfuzz37900.asm.frag
index 9751821fc01e704a2f2851c52d1e9489b204c4f7..5fb2b3c5fd467857b653f617976cc3b8af3a15fb 100644
--- a/tests/sksl/shared/Ossfuzz37900.asm.frag
+++ b/tests/sksl/shared/Ossfuzz37900.asm.frag
@@ -1,6 +1,6 @@
### Compilation failed:
-error: 2: variable 'a' exceeds the stack size limit
+error: 2: array size is too large
int[2147483646] a, b=a, c=a, d=a, e=a, f=a, g=a, h=a, i=a, j=a, k=a;
- ^^^^^^^^^^^^^^^^^
+ ^^^^^^^^^^^^^^^
1 error
diff --git a/tests/sksl/shared/Ossfuzz37900.glsl b/tests/sksl/shared/Ossfuzz37900.glsl
index 9751821fc01e704a2f2851c52d1e9489b204c4f7..5fb2b3c5fd467857b653f617976cc3b8af3a15fb 100644
--- a/tests/sksl/shared/Ossfuzz37900.glsl
+++ b/tests/sksl/shared/Ossfuzz37900.glsl
@@ -1,6 +1,6 @@
### Compilation failed:
-error: 2: variable 'a' exceeds the stack size limit
+error: 2: array size is too large
int[2147483646] a, b=a, c=a, d=a, e=a, f=a, g=a, h=a, i=a, j=a, k=a;
- ^^^^^^^^^^^^^^^^^
+ ^^^^^^^^^^^^^^^
1 error
diff --git a/tests/sksl/shared/Ossfuzz37900.hlsl b/tests/sksl/shared/Ossfuzz37900.hlsl
index 9751821fc01e704a2f2851c52d1e9489b204c4f7..5fb2b3c5fd467857b653f617976cc3b8af3a15fb 100644
--- a/tests/sksl/shared/Ossfuzz37900.hlsl
+++ b/tests/sksl/shared/Ossfuzz37900.hlsl
@@ -1,6 +1,6 @@
### Compilation failed:
-error: 2: variable 'a' exceeds the stack size limit
+error: 2: array size is too large
int[2147483646] a, b=a, c=a, d=a, e=a, f=a, g=a, h=a, i=a, j=a, k=a;
- ^^^^^^^^^^^^^^^^^
+ ^^^^^^^^^^^^^^^
1 error
diff --git a/tests/sksl/shared/Ossfuzz37900.metal b/tests/sksl/shared/Ossfuzz37900.metal
index 9751821fc01e704a2f2851c52d1e9489b204c4f7..5fb2b3c5fd467857b653f617976cc3b8af3a15fb 100644
--- a/tests/sksl/shared/Ossfuzz37900.metal
+++ b/tests/sksl/shared/Ossfuzz37900.metal
@@ -1,6 +1,6 @@
### Compilation failed:
-error: 2: variable 'a' exceeds the stack size limit
+error: 2: array size is too large
int[2147483646] a, b=a, c=a, d=a, e=a, f=a, g=a, h=a, i=a, j=a, k=a;
- ^^^^^^^^^^^^^^^^^
+ ^^^^^^^^^^^^^^^
1 error

View File

@@ -0,0 +1,183 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Stiles <johnstiles@google.com>
Date: Fri, 14 Apr 2023 15:13:11 +0000
Subject: Reland "Enforce program stack limits on function parameters."
This reverts commit f5715362aac554ff3108b9e2a56b8ac8a6ef1acb.
Original change's description:
> Revert "Enforce program stack limits on function parameters."
>
> This reverts commit fa089d61014b77048daddb89300a3ab7cdf601bf.
>
>
> Original change's description:
> > Enforce program stack limits on function parameters.
> >
> > Previously, a function's parameter list did not count against its
> > stack size limit.
> >
> > Bug: chromium:1432603
> > Change-Id: If49dce98f3155f3144a766c26b5a3a39401ce1b2
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/670236
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Reviewed-by: Kevin Lubick <kjlubick@google.com>
> > Reviewed-by: Nicolette Prevost <nicolettep@google.com>
> > (cherry picked from commit 4dc748f14c6650cb45c7086a39af1760bfda41d2)
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/670339
> > Reviewed-by: John Stiles <johnstiles@google.com>
>
> Bug: chromium:1432603
> Change-Id: I44439362f560200e30e6eeb56a86b0f84ee2a930
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/671176
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bug: chromium:1432603
Change-Id: I953efbba3d5b004e213571a04bd4f3ad68c663b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/671876
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/gn/sksl_tests.gni b/gn/sksl_tests.gni
index 6c9bc54d6d990be542b1293d14af8b1f2e0311b0..3da854583d1d8c60aa20774abbc7537c2ca0aa04 100644
--- a/gn/sksl_tests.gni
+++ b/gn/sksl_tests.gni
@@ -191,6 +191,7 @@ sksl_error_tests = [
"errors/PrivateTypes.rts",
"errors/PrivateVariables.rts",
"errors/ProgramTooLarge_Globals.rts",
+ "errors/ProgramTooLarge_Parameters.rts",
"errors/ProgramTooLarge_Stack.rts",
"errors/PrototypeInFuncBody.rts",
"errors/ReadonlyWriteonly.compute",
diff --git a/resources/sksl/BUILD.bazel b/resources/sksl/BUILD.bazel
index 75ae21cad2996577985191500fb0d5c7c00e7fd1..98cb09574dc8b9fc0fea0e2876eb26111df394f5 100644
--- a/resources/sksl/BUILD.bazel
+++ b/resources/sksl/BUILD.bazel
@@ -332,6 +332,7 @@ skia_filegroup(
"errors/PrivateTypes.rts",
"errors/PrivateVariables.rts",
"errors/ProgramTooLarge_Globals.rts",
+ "errors/ProgramTooLarge_Parameters.rts",
"errors/ProgramTooLarge_Stack.rts",
"errors/PrototypeInFuncBody.rts",
"errors/RTAdjustType.sksl",
diff --git a/resources/sksl/errors/ProgramTooLarge_Parameters.rts b/resources/sksl/errors/ProgramTooLarge_Parameters.rts
new file mode 100644
index 0000000000000000000000000000000000000000..cced977be40620ffc3b145837bd5ffe16b40295b
--- /dev/null
+++ b/resources/sksl/errors/ProgramTooLarge_Parameters.rts
@@ -0,0 +1,14 @@
+struct S {
+ half4 ah4[1];
+ half ah[99999];
+ half4 h4;
+ half h;
+};
+
+void func(int small,
+ S big_chungus,
+ S no_report /*we don't need to report overflows past the first*/) {}
+
+/*%%*
+variable 'big_chungus' exceeds the stack size limit
+*%%*/
diff --git a/src/sksl/ir/SkSLFunctionDefinition.cpp b/src/sksl/ir/SkSLFunctionDefinition.cpp
index 54b1e5e445d65fb784eccbe1f3b9e97e29e8bffd..26425e492f4deb333e442764aed0053dd1d64981 100644
--- a/src/sksl/ir/SkSLFunctionDefinition.cpp
+++ b/src/sksl/ir/SkSLFunctionDefinition.cpp
@@ -37,6 +37,7 @@
#include <cstddef>
#include <forward_list>
#include <string_view>
+#include <vector>
namespace SkSL {
@@ -88,9 +89,29 @@ std::unique_ptr<FunctionDefinition> FunctionDefinition::Convert(const Context& c
bool builtin) {
class Finalizer : public ProgramWriter {
public:
- Finalizer(const Context& context, const FunctionDeclaration& function)
+ Finalizer(const Context& context, const FunctionDeclaration& function, Position pos)
: fContext(context)
- , fFunction(function) {}
+ , fFunction(function) {
+ // Function parameters count as local variables.
+ for (const Variable* var : function.parameters()) {
+ this->addLocalVariable(var, pos);
+ }
+ }
+
+ void addLocalVariable(const Variable* var, Position pos) {
+ // We count the number of slots used, but don't consider the precision of the base type.
+ // In practice, this reflects what GPUs actually do pretty well. (i.e., RelaxedPrecision
+ // math doesn't mean your variable takes less space.) We also don't attempt to reclaim
+ // slots at the end of a Block.
+ size_t prevSlotsUsed = fSlotsUsed;
+ fSlotsUsed = SkSafeMath::Add(fSlotsUsed, var->type().slotCount());
+ // To avoid overzealous error reporting, only trigger the error at the first
+ // place where the stack limit is exceeded.
+ if (prevSlotsUsed < kVariableSlotLimit && fSlotsUsed >= kVariableSlotLimit) {
+ fContext.fErrors->error(pos, "variable '" + std::string(var->name()) +
+ "' exceeds the stack size limit");
+ }
+ }
~Finalizer() override {
SkASSERT(fBreakableLevel == 0);
@@ -109,24 +130,12 @@ std::unique_ptr<FunctionDefinition> FunctionDefinition::Convert(const Context& c
bool visitStatement(Statement& stmt) override {
switch (stmt.kind()) {
case Statement::Kind::kVarDeclaration: {
- // We count the number of slots used, but don't consider the precision of the
- // base type. In practice, this reflects what GPUs really do pretty well.
- // (i.e., RelaxedPrecision math doesn't mean your variable takes less space.)
- // We also don't attempt to reclaim slots at the end of a Block.
- size_t prevSlotsUsed = fSlotsUsed;
const Variable* var = stmt.as<VarDeclaration>().var();
if (var->type().isOrContainsUnsizedArray()) {
fContext.fErrors->error(stmt.fPosition,
"unsized arrays are not permitted here");
- break;
- }
- fSlotsUsed = SkSafeMath::Add(fSlotsUsed, var->type().slotCount());
- // To avoid overzealous error reporting, only trigger the error at the first
- // place where the stack limit is exceeded.
- if (prevSlotsUsed < kVariableSlotLimit && fSlotsUsed >= kVariableSlotLimit) {
- fContext.fErrors->error(stmt.fPosition,
- "variable '" + std::string(var->name()) +
- "' exceeds the stack size limit");
+ } else {
+ this->addLocalVariable(var, stmt.fPosition);
}
break;
}
@@ -219,7 +228,7 @@ std::unique_ptr<FunctionDefinition> FunctionDefinition::Convert(const Context& c
using INHERITED = ProgramWriter;
};
- Finalizer(context, function).visitStatement(*body);
+ Finalizer(context, function, pos).visitStatement(*body);
if (function.isMain() && ProgramConfig::IsVertex(context.fConfig->fKind)) {
append_rtadjust_fixup_to_vertex_main(context, function, body->as<Block>());
}
diff --git a/tests/sksl/errors/ProgramTooLarge_Parameters.glsl b/tests/sksl/errors/ProgramTooLarge_Parameters.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..d92c3256e82d52115621cf96d6dba99f62cdd945
--- /dev/null
+++ b/tests/sksl/errors/ProgramTooLarge_Parameters.glsl
@@ -0,0 +1,6 @@
+### Compilation failed:
+
+error: 10: variable 'big_chungus' exceeds the stack size limit
+ S no_report /*we don't need to report overflows past the first*/) {}
+ ^^
+1 error

View File

@@ -6,7 +6,7 @@ workaround_an_undefined_symbol_error.patch
do_not_export_private_v8_symbols_on_windows.patch
fix_build_deprecated_attribute_for_older_msvc_versions.patch
fix_disable_implies_dcheck_for_node_stream_array_buffers.patch
revert_runtime_dhceck_terminating_exception_in_microtasks.patch
chore_disable_is_execution_terminating_dcheck.patch
force_cppheapcreateparams_to_be_noncopyable.patch
chore_allow_customizing_microtask_policy_per_context.patch
cherry-pick-c605df24af3c.patch
cherry-pick-f4b66ae451c2.patch

View File

@@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Igor Sheludko <ishell@chromium.org>
Date: Wed, 12 Apr 2023 16:12:16 +0200
Subject: Make Error.captureStackTrace() a no-op for global object
(cherry picked from commit fa81078cca6964def7a3833704e0dba7b05065d8)
Bug: chromium:1432210
Change-Id: I8aa4c3f1d9ecbfffce503085c2879416ff916c69
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4417690
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#87045}
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4419050
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Lutz Vahl <vahl@chromium.org>
Cr-Commit-Position: refs/branch-heads/11.2@{#31}
Cr-Branched-From: 755511a138609ac5939449a8ac615c15603a4454-refs/heads/11.2.214@{#1}
Cr-Branched-From: e6b1ccefb0f0f1ff8d310578878130dc53d73749-refs/heads/main@{#86014}
diff --git a/src/builtins/builtins-error.cc b/src/builtins/builtins-error.cc
index adb180fba89b61279895e0427caa71703769e28a..4a8dec419d3f483826467a7244b89ad03fa7ff1f 100644
--- a/src/builtins/builtins-error.cc
+++ b/src/builtins/builtins-error.cc
@@ -35,6 +35,9 @@ BUILTIN(ErrorCaptureStackTrace) {
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kInvalidArgument, object_obj));
}
+ if (object_obj->IsJSGlobalProxy()) {
+ return ReadOnlyRoots(isolate).undefined_value();
+ }
Handle<JSObject> object = Handle<JSObject>::cast(object_obj);
Handle<Object> caller = args.atOrUndefined(isolate, 2);

View File

@@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Darius M <dmercadier@chromium.org>
Date: Mon, 27 Mar 2023 13:39:50 +0200
Subject: Merged: [compiler] Prevent constant folding of TypeGuard
TypeGuard are used to prevent operations from floating before a
preceding check, and thus shouldn't be constant-folded.
Bug: chromium:1427388
(cherry picked from commit 867716437273c16dc6ef5bc85b9c18affa1fb242)
Change-Id: Ia334d079707f13974235f8c04ccb468ac16ff794
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4386487
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/branch-heads/11.2@{#23}
Cr-Branched-From: 755511a138609ac5939449a8ac615c15603a4454-refs/heads/11.2.214@{#1}
Cr-Branched-From: e6b1ccefb0f0f1ff8d310578878130dc53d73749-refs/heads/main@{#86014}
diff --git a/src/compiler/constant-folding-reducer.cc b/src/compiler/constant-folding-reducer.cc
index 5e74ba75352cc3e7bf29a83ee72273e45720907b..4059e47c2db00e0df82296fa63e09147095f7ba7 100644
--- a/src/compiler/constant-folding-reducer.cc
+++ b/src/compiler/constant-folding-reducer.cc
@@ -66,7 +66,8 @@ ConstantFoldingReducer::~ConstantFoldingReducer() = default;
Reduction ConstantFoldingReducer::Reduce(Node* node) {
if (!NodeProperties::IsConstant(node) && NodeProperties::IsTyped(node) &&
node->op()->HasProperty(Operator::kEliminatable) &&
- node->opcode() != IrOpcode::kFinishRegion) {
+ node->opcode() != IrOpcode::kFinishRegion &&
+ node->opcode() != IrOpcode::kTypeGuard) {
Node* constant = TryGetConstant(jsgraph(), node);
if (constant != nullptr) {
DCHECK(NodeProperties::IsTyped(constant));

View File

@@ -1,35 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Tue, 31 May 2022 19:58:01 +0200
Subject: chore: disable is_execution_terminating DCHECK
This causes a slew of crashes in Node.js.
Upstream issue opened at https://github.com/nodejs/node-v8/issues/227.
diff --git a/src/api/api-macros.h b/src/api/api-macros.h
index 149dd0555a69be576fd1eb97aa79b8aedafcac04..233e6d2ac511c4a7fa45d47bb7448beead52faf1 100644
--- a/src/api/api-macros.h
+++ b/src/api/api-macros.h
@@ -97,8 +97,6 @@
// Lightweight version for APIs that don't require an active context.
#define DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate) \
- /* Embedders should never enter V8 after terminating it */ \
- DCHECK(!i_isolate->is_execution_terminating()); \
DCHECK_NO_SCRIPT_NO_EXCEPTION_MAYBE_TEARDOWN(i_isolate)
#define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate) \
diff --git a/src/execution/microtask-queue.cc b/src/execution/microtask-queue.cc
index ac48de9b499aed29a09ba918ddabfa67cd5485da..aa50aeb1d4f3943f83ded5e328b4a65bcfbc7317 100644
--- a/src/execution/microtask-queue.cc
+++ b/src/execution/microtask-queue.cc
@@ -180,7 +180,7 @@ int MicrotaskQueue::RunMicrotasks(Isolate* isolate) {
if (isolate->is_execution_terminating()) {
DCHECK(isolate->has_scheduled_exception());
- DCHECK(maybe_result.is_null());
+ // DCHECK(maybe_result.is_null());
delete[] ring_buffer_;
ring_buffer_ = nullptr;
capacity_ = 0;

View File

@@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Rose <japthorp@slack-corp.com>
Date: Mon, 9 May 2022 17:09:21 -0700
Subject: Revert "[runtime] DHCECK terminating exception in Microtasks"
This reverts commit bccb536c98181e8a6e9cf0b6342311adbbf61aca.
diff --git a/src/builtins/builtins-microtask-queue-gen.cc b/src/builtins/builtins-microtask-queue-gen.cc
index f58636fee555d782e18b7521c0c4f28ed60b3a52..6b0c63b34ff09f70cb9a4fe419f3b9bb0adf6790 100644
--- a/src/builtins/builtins-microtask-queue-gen.cc
+++ b/src/builtins/builtins-microtask-queue-gen.cc
@@ -118,7 +118,6 @@ void MicrotaskQueueBuiltinsAssembler::PrepareForContext(
void MicrotaskQueueBuiltinsAssembler::RunSingleMicrotask(
TNode<Context> current_context, TNode<Microtask> microtask) {
CSA_DCHECK(this, TaggedIsNotSmi(microtask));
- CSA_DCHECK(this, Word32BinaryNot(IsExecutionTerminating()));
StoreRoot(RootIndex::kCurrentMicrotask, microtask);
TNode<IntPtrT> saved_entered_context_count = GetEnteredContextCount();
diff --git a/src/codegen/code-stub-assembler.cc b/src/codegen/code-stub-assembler.cc
index 23111e605f4390d311a0fac2b4335926315add38..2e3a2cbcac07e0e86254d4cb11eb3fe51fadff18 100644
--- a/src/codegen/code-stub-assembler.cc
+++ b/src/codegen/code-stub-assembler.cc
@@ -6390,12 +6390,6 @@ void CodeStubAssembler::SetPendingMessage(TNode<HeapObject> message) {
StoreFullTaggedNoWriteBarrier(pending_message, message);
}
-TNode<BoolT> CodeStubAssembler::IsExecutionTerminating() {
- TNode<HeapObject> pending_message = GetPendingMessage();
- return TaggedEqual(pending_message,
- LoadRoot(RootIndex::kTerminationException));
-}
-
TNode<BoolT> CodeStubAssembler::InstanceTypeEqual(TNode<Int32T> instance_type,
int type) {
return Word32Equal(instance_type, Int32Constant(type));
diff --git a/src/codegen/code-stub-assembler.h b/src/codegen/code-stub-assembler.h
index f7cdced051d23a755158bb73c91057bb1d801830..183bae89819584d48fc61e06cf9cf9792b02a61a 100644
--- a/src/codegen/code-stub-assembler.h
+++ b/src/codegen/code-stub-assembler.h
@@ -2583,7 +2583,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<HeapObject> GetPendingMessage();
void SetPendingMessage(TNode<HeapObject> message);
- TNode<BoolT> IsExecutionTerminating();
// Type checks.
// Check whether the map is for an object with special properties, such as a

View File

@@ -1 +1 @@
cherry-pick-e0efbd45ea74.patch
fix_fallback_to_x11_capturer_on_wayland.patch

View File

@@ -1,57 +0,0 @@
From e0efbd45ea7421fb944c7343254ac5dc22bee541 Mon Sep 17 00:00:00 2001
From: Henrik Boström <hbos@webrtc.org>
Date: Fri, 20 Jan 2023 10:48:31 +0100
Subject: [PATCH] [Merge-110] [Stats] Handle the case of missing certificates.
Certificates being missing is a sign of a bug (e.g. webrtc:14844, to be
fixed separately) which is why we have a DCHECK. But this DCHECK does
not protect against accessing the invalid iterator if it is a release
build. This CL makes that safe.
# Mobile bots not running properly
NOTRY=True
(cherry picked from commit 124d7c3fe5bdc79a355c9df02d07f25331631a68)
Bug: chromium:1408392
Change-Id: I97a82786028e41c58ef8ef15002c3f959bbec7f1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291109
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Original-Commit-Position: refs/heads/main@{#39159}
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291380
Cr-Commit-Position: refs/branch-heads/5481@{#2}
Cr-Branched-From: 2e1a9a4ae0234d4b1ea7a6fd4188afa1fb20379d-refs/heads/main@{#38901}
---
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index d500a7b..1d88566 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -2192,16 +2192,17 @@
// exist.
const auto& certificate_stats_it =
transport_cert_stats.find(transport_name);
+ std::string local_certificate_id, remote_certificate_id;
RTC_DCHECK(certificate_stats_it != transport_cert_stats.cend());
- std::string local_certificate_id;
- if (certificate_stats_it->second.local) {
- local_certificate_id = RTCCertificateIDFromFingerprint(
- certificate_stats_it->second.local->fingerprint);
- }
- std::string remote_certificate_id;
- if (certificate_stats_it->second.remote) {
- remote_certificate_id = RTCCertificateIDFromFingerprint(
- certificate_stats_it->second.remote->fingerprint);
+ if (certificate_stats_it != transport_cert_stats.cend()) {
+ if (certificate_stats_it->second.local) {
+ local_certificate_id = RTCCertificateIDFromFingerprint(
+ certificate_stats_it->second.local->fingerprint);
+ }
+ if (certificate_stats_it->second.remote) {
+ remote_certificate_id = RTCCertificateIDFromFingerprint(
+ certificate_stats_it->second.remote->fingerprint);
+ }
}
// There is one transport stats for each channel.

View File

@@ -0,0 +1,58 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: VerteDinde <keeleymhammond@gmail.com>
Date: Sun, 5 Mar 2023 21:04:37 -0800
Subject: fix: fallback to X11 capturer on Wayland
CL: https://webrtc-review.googlesource.com/c/src/+/279163
Desktop Capturer behaves inconsistently on Wayland. PipeWire does not
always successfully start; if it does not, we return a nullptr rather
than falling back on the X11 capturer, crashing the application.
If the X11 capturer is enabled, we should at minimum try to fallback
to X11 for desktop capturer. This patch re-enables that fallback,
which was previously default behavior.
This patch can be removed when 1) this fix is upstreamed, or 2) the
stability of PipeWire initialization is improved upstream.
Patch_Filename: fix_fallback_to_x11_desktop_capturer_wayland.patch
diff --git a/modules/desktop_capture/screen_capturer_linux.cc b/modules/desktop_capture/screen_capturer_linux.cc
index 44993837e8bbd84a11ec9d187349a95f83258910..cd9f8b0be6a19d057fe9150382fb72bc4032b343 100644
--- a/modules/desktop_capture/screen_capturer_linux.cc
+++ b/modules/desktop_capture/screen_capturer_linux.cc
@@ -34,11 +34,10 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
#endif // defined(WEBRTC_USE_PIPEWIRE)
#if defined(WEBRTC_USE_X11)
- if (!DesktopCapturer::IsRunningUnderWayland())
- return ScreenCapturerX11::CreateRawScreenCapturer(options);
-#endif // defined(WEBRTC_USE_X11)
-
+ return ScreenCapturerX11::CreateRawScreenCapturer(options);
+#else
return nullptr;
+#endif // defined(WEBRTC_USE_X11)
}
} // namespace webrtc
diff --git a/modules/desktop_capture/window_capturer_linux.cc b/modules/desktop_capture/window_capturer_linux.cc
index 4205bf9bc0eede48cdc39353c77ceb6e7529fd51..785dc01a1911fd027401b1461223668333e05558 100644
--- a/modules/desktop_capture/window_capturer_linux.cc
+++ b/modules/desktop_capture/window_capturer_linux.cc
@@ -34,11 +34,10 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
#endif // defined(WEBRTC_USE_PIPEWIRE)
#if defined(WEBRTC_USE_X11)
- if (!DesktopCapturer::IsRunningUnderWayland())
- return WindowCapturerX11::CreateRawWindowCapturer(options);
-#endif // defined(WEBRTC_USE_X11)
-
+ return WindowCapturerX11::CreateRawWindowCapturer(options);
+#else
return nullptr;
+#endif // defined(WEBRTC_USE_X11)
}
} // namespace webrtc

View File

@@ -14,8 +14,8 @@ const ROLLER_BRANCH_PATTERN = /^roller\/chromium$/;
const DEFAULT_BUILD_CLOUD_ID = '1598';
const DEFAULT_BUILD_CLOUD = 'electronhq-16-core';
const DEFAULT_BAKE_BASE_IMAGE = 'e-111.0.5560.0-node18';
const DEFAULT_BUILD_IMAGE = 'e-111.0.5560.0-node18';
const DEFAULT_BAKE_BASE_IMAGE = 'e-110.0.5481.208';
const DEFAULT_BUILD_IMAGE = 'e-110.0.5481.208';
const appveyorBakeJob = 'electron-bake-image';
const appVeyorJobs = {

View File

@@ -382,7 +382,11 @@ def upload_sha256_checksum(version, file_path, key_prefix=None):
def get_release(version):
script_path = os.path.join(
ELECTRON_DIR, 'script', 'release', 'find-github-release.js')
release_info = execute(['node', script_path, version])
# Strip warnings from stdout to ensure the only output is the desired object
release_env = os.environ.copy()
release_env['NODE_NO_WARNINGS'] = '1'
release_info = execute(['node', script_path, version], release_env)
release = json.loads(release_info)
return release

View File

@@ -5,6 +5,7 @@ const childProcess = require('child_process');
const crypto = require('crypto');
const fs = require('fs-extra');
const { hashElement } = require('folder-hash');
const os = require('os');
const path = require('path');
const unknownFlags = [];
@@ -64,10 +65,24 @@ if (args.runners !== undefined) {
async function main () {
if (args.electronVersion) {
const versions = await ElectronVersions.create();
if (!versions.isVersion(args.electronVersion)) {
if (args.electronVersion === 'latest') {
args.electronVersion = versions.latest.version;
} else if (args.electronVersion.startsWith('latest@')) {
const majorVersion = parseInt(args.electronVersion.slice('latest@'.length));
const ver = versions.inMajor(majorVersion).slice(-1)[0];
if (ver) {
args.electronVersion = ver.version;
} else {
console.log(`${fail} '${majorVersion}' is not a recognized Electron major version`);
process.exit(1);
}
} else if (!versions.isVersion(args.electronVersion)) {
console.log(`${fail} '${args.electronVersion}' is not a recognized Electron version`);
process.exit(1);
}
const versionString = `v${args.electronVersion}`;
console.log(`Running against Electron ${versionString.green}`);
}
const [lastSpecHash, lastSpecInstallHash] = loadLastSpecHash();
@@ -246,7 +261,18 @@ async function installSpecModules (dir) {
env.npm_config_target = args.electronVersion;
env.npm_config_disturl = 'https://electronjs.org/headers';
env.npm_config_runtime = 'electron';
env.npm_config_devdir = path.join(os.homedir(), '.electron-gyp');
env.npm_config_build_from_source = 'true';
const { status } = childProcess.spawnSync('npm', ['run', 'node-gyp-install', '--ensure'], {
env,
cwd: dir,
stdio: 'inherit',
shell: true
});
if (status !== 0) {
console.log(`${fail} Failed to "npm run node-gyp-install" install in '${dir}'`);
process.exit(1);
}
} else {
env.npm_config_nodedir = path.resolve(BASE, `out/${utils.getOutDir({ shouldLog: true })}/gen/node_headers`);
}

View File

@@ -40,6 +40,7 @@
#include "shell/common/logging.h"
#include "shell/common/options_switches.h"
#include "shell/common/platform_util.h"
#include "shell/common/process_util.h"
#include "shell/common/thread_restrictions.h"
#include "shell/renderer/electron_renderer_client.h"
#include "shell/renderer/electron_sandboxed_renderer_client.h"
@@ -83,11 +84,6 @@ constexpr base::StringPiece kElectronDisableSandbox("ELECTRON_DISABLE_SANDBOX");
constexpr base::StringPiece kElectronEnableStackDumping(
"ELECTRON_ENABLE_STACK_DUMPING");
bool IsBrowserProcess(base::CommandLine* cmd) {
std::string process_type = cmd->GetSwitchValueASCII(::switches::kProcessType);
return process_type.empty();
}
// Returns true if this subprocess type needs the ResourceBundle initialized
// and resources loaded.
bool SubprocessNeedsResourceBundle(const std::string& process_type) {
@@ -250,14 +246,12 @@ absl::optional<int> ElectronMainDelegate::BasicStartupComplete() {
// On Windows the terminal returns immediately, so we add a new line to
// prevent output in the same line as the prompt.
if (IsBrowserProcess(command_line))
if (IsBrowserProcess())
std::wcout << std::endl;
#endif // !BUILDFLAG(IS_WIN)
auto env = base::Environment::Create();
gin_helper::Locker::SetIsBrowserProcess(IsBrowserProcess(command_line));
// Enable convenient stack printing. This is enabled by default in
// non-official builds.
if (env->HasVar(kElectronEnableStackDumping))
@@ -290,7 +284,7 @@ absl::optional<int> ElectronMainDelegate::BasicStartupComplete() {
// bugs, but no use in Electron.
base::win::DisableHandleVerifier();
if (IsBrowserProcess(command_line))
if (IsBrowserProcess())
base::win::PinUser32();
#endif
@@ -386,7 +380,7 @@ void ElectronMainDelegate::PreSandboxStartup() {
crash_keys::SetPlatformCrashKey();
#endif
if (IsBrowserProcess(command_line)) {
if (IsBrowserProcess()) {
// Only append arguments for browser process.
// Allow file:// URIs to read other file:// URIs by default.

View File

@@ -18,6 +18,14 @@
#include "sandbox/mac/seatbelt_exec.h" // nogncheck
#endif
extern "C" {
// abort_report_np() records the message in a special section that both the
// system CrashReporter and Crashpad collect in crash reports. Using a Crashpad
// Annotation would be preferable, but this executable cannot depend on
// Crashpad directly.
void abort_report_np(const char* fmt, ...);
}
namespace {
[[maybe_unused]] bool IsEnvSet(const char* name) {
@@ -25,6 +33,20 @@ namespace {
return indicator && indicator[0] != '\0';
}
#if defined(HELPER_EXECUTABLE) && !IS_MAS_BUILD()
[[noreturn]] void FatalError(const char* format, ...) {
va_list valist;
va_start(valist, format);
char message[4096];
if (vsnprintf(message, sizeof(message), format, valist) >= 0) {
fputs(message, stderr);
abort_report_np("%s", message);
}
va_end(valist);
abort();
}
#endif
} // namespace
int main(int argc, char* argv[]) {
@@ -42,27 +64,23 @@ int main(int argc, char* argv[]) {
uint32_t exec_path_size = 0;
int rv = _NSGetExecutablePath(NULL, &exec_path_size);
if (rv != -1) {
fprintf(stderr, "_NSGetExecutablePath: get length failed\n");
abort();
FatalError("_NSGetExecutablePath: get length failed.");
}
auto exec_path = std::make_unique<char[]>(exec_path_size);
rv = _NSGetExecutablePath(exec_path.get(), &exec_path_size);
if (rv != 0) {
fprintf(stderr, "_NSGetExecutablePath: get path failed\n");
abort();
FatalError("_NSGetExecutablePath: get path failed.");
}
sandbox::SeatbeltExecServer::CreateFromArgumentsResult seatbelt =
sandbox::SeatbeltExecServer::CreateFromArguments(exec_path.get(), argc,
argv);
if (seatbelt.sandbox_required) {
if (!seatbelt.server) {
fprintf(stderr, "Failed to create seatbelt sandbox server.\n");
abort();
FatalError("Failed to create seatbelt sandbox server.");
}
if (!seatbelt.server->InitializeSandbox()) {
fprintf(stderr, "Failed to initialize sandbox.\n");
abort();
FatalError("Failed to initialize sandbox.");
}
}
#endif // defined(HELPER_EXECUTABLE) && !IS_MAS_BUILD

View File

@@ -222,7 +222,8 @@ int NodeMain(int argc, char* argv[]) {
uint64_t env_flags = node::EnvironmentFlags::kDefaultFlags |
node::EnvironmentFlags::kHideConsoleWindows;
env = node::CreateEnvironment(
isolate_data, gin_env.context(), result->args(), result->exec_args(),
isolate_data, isolate->GetCurrentContext(), result->args(),
result->exec_args(),
static_cast<node::EnvironmentFlags::Flags>(env_flags));
CHECK_NE(nullptr, env);
@@ -262,7 +263,7 @@ int NodeMain(int argc, char* argv[]) {
node::ResetStdio();
node::Stop(env);
node::Stop(env, false);
node::FreeEnvironment(env);
node::FreeIsolateData(isolate_data);
}

View File

@@ -126,6 +126,9 @@ BrowserView::~BrowserView() {
}
void BrowserView::WebContentsDestroyed() {
if (owner_window())
owner_window()->window()->RemoveDraggableRegionProvider(this);
api_web_contents_ = nullptr;
web_contents_.Reset();
Unpin();

View File

@@ -112,6 +112,7 @@ BrowserWindow::~BrowserWindow() {
api_web_contents_->RemoveObserver(this);
// Destroy the WebContents.
OnCloseContents();
api_web_contents_->Destroy();
}
}
@@ -139,7 +140,6 @@ void BrowserWindow::WebContentsDestroyed() {
void BrowserWindow::OnCloseContents() {
BaseWindow::ResetBrowserViews();
api_web_contents_->Destroy();
}
void BrowserWindow::OnRendererResponsive(content::RenderProcessHost*) {
@@ -198,7 +198,11 @@ void BrowserWindow::OnCloseButtonClicked(bool* prevent_default) {
// Trigger beforeunload events for associated BrowserViews.
for (NativeBrowserView* view : window_->browser_views()) {
auto* vwc = view->GetInspectableWebContents()->GetWebContents();
auto* iwc = view->GetInspectableWebContents();
if (!iwc)
continue;
auto* vwc = iwc->GetWebContents();
auto* api_web_contents = api::WebContents::From(vwc);
// Required to make beforeunload handler work.

View File

@@ -128,10 +128,13 @@ bool MatchesCookie(const base::Value::Dict& filter,
!MatchesDomain(*str, cookie.Domain()))
return false;
absl::optional<bool> secure_filter = filter.FindBool("secure");
if (secure_filter && *secure_filter == cookie.IsSecure())
if (secure_filter && *secure_filter != cookie.IsSecure())
return false;
absl::optional<bool> session_filter = filter.FindBool("session");
if (session_filter && *session_filter != !cookie.IsPersistent())
if (session_filter && *session_filter == cookie.IsPersistent())
return false;
absl::optional<bool> httpOnly_filter = filter.FindBool("httpOnly");
if (httpOnly_filter && *httpOnly_filter != cookie.IsHttpOnly())
return false;
return true;
}
@@ -177,7 +180,7 @@ std::string InclusionStatusToString(net::CookieInclusionStatus status) {
return "Failed to parse cookie";
if (status.HasExclusionReason(
net::CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN))
return "Failed to get cookie domain";
return "Failed to set cookie with an invalid domain attribute";
if (status.HasExclusionReason(
net::CookieInclusionStatus::EXCLUDE_INVALID_PREFIX))
return "Failed because the cookie violated prefix rules.";
@@ -315,19 +318,24 @@ v8::Local<v8::Promise> Cookies::Set(v8::Isolate* isolate,
return handle;
}
net::CookieInclusionStatus status;
auto canonical_cookie = net::CanonicalCookie::CreateSanitizedCookie(
url, name ? *name : "", value ? *value : "", domain ? *domain : "",
path ? *path : "", ParseTimeProperty(details.FindDouble("creationDate")),
ParseTimeProperty(details.FindDouble("expirationDate")),
ParseTimeProperty(details.FindDouble("lastAccessDate")), secure,
http_only, same_site, net::COOKIE_PRIORITY_DEFAULT, same_party,
absl::nullopt);
absl::nullopt, &status);
if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
promise.RejectWithErrorMessage(
InclusionStatusToString(net::CookieInclusionStatus(
net::CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE)));
promise.RejectWithErrorMessage(InclusionStatusToString(
!status.IsInclude()
? status
: net::CookieInclusionStatus(
net::CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE)));
return handle;
}
net::CookieOptions options;
if (http_only) {
options.set_include_httponly();

View File

@@ -207,27 +207,31 @@ void DesktopCapturer::StartHandling(bool capture_window,
// Initialize the source list.
// Apply the new thumbnail size and restart capture.
if (capture_window) {
window_capturer_ = std::make_unique<NativeDesktopMediaList>(
DesktopMediaList::Type::kWindow,
content::desktop_capture::CreateWindowCapturer());
window_capturer_->SetThumbnailSize(thumbnail_size);
window_capturer_->Update(
base::BindOnce(&DesktopCapturer::UpdateSourcesList,
weak_ptr_factory_.GetWeakPtr(),
window_capturer_.get()),
/* refresh_thumbnails = */ true);
if (auto capturer = content::desktop_capture::CreateWindowCapturer();
capturer) {
window_capturer_ = std::make_unique<NativeDesktopMediaList>(
DesktopMediaList::Type::kWindow, std::move(capturer));
window_capturer_->SetThumbnailSize(thumbnail_size);
window_capturer_->Update(
base::BindOnce(&DesktopCapturer::UpdateSourcesList,
weak_ptr_factory_.GetWeakPtr(),
window_capturer_.get()),
/* refresh_thumbnails = */ true);
}
}
if (capture_screen) {
screen_capturer_ = std::make_unique<NativeDesktopMediaList>(
DesktopMediaList::Type::kScreen,
content::desktop_capture::CreateScreenCapturer());
screen_capturer_->SetThumbnailSize(thumbnail_size);
screen_capturer_->Update(
base::BindOnce(&DesktopCapturer::UpdateSourcesList,
weak_ptr_factory_.GetWeakPtr(),
screen_capturer_.get()),
/* refresh_thumbnails = */ true);
if (auto capturer = content::desktop_capture::CreateScreenCapturer();
capturer) {
screen_capturer_ = std::make_unique<NativeDesktopMediaList>(
DesktopMediaList::Type::kScreen, std::move(capturer));
screen_capturer_->SetThumbnailSize(thumbnail_size);
screen_capturer_->Update(
base::BindOnce(&DesktopCapturer::UpdateSourcesList,
weak_ptr_factory_.GetWeakPtr(),
screen_capturer_.get()),
/* refresh_thumbnails = */ true);
}
}
}
}

View File

@@ -10,9 +10,7 @@
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/node_includes.h"
namespace electron {
namespace api {
namespace electron::api {
PushNotifications* g_push_notifications = nullptr;
@@ -55,9 +53,7 @@ const char* PushNotifications::GetTypeName() {
return "PushNotifications";
}
} // namespace api
} // namespace electron
} // namespace electron::api
namespace {

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