Compare commits

...

150 Commits

Author SHA1 Message Date
Pedro Pontes
289a1861fc chore: cherry-pick 1 changes from 0-M133 (#45704)
chore: [34-x-y] cherry-pick 3 changes from 0-M133

* 51cd241b7b13 from chromium
* 1c7ff4d5477f from v8
* 8834c16acfcc from v8
* ee9db7d1348f from skia

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-26 15:48:57 +01:00
trop[bot]
b19995e623 refactor: remove unused gin_helper::WrappableBase::GetWrapper(v8::Isolate*) (#45807)
refactor: remove unused EventEmitter::GetWrapper(v8::Isolate*)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-25 22:52:04 -06:00
electron-roller[bot]
47ab952bb1 chore: bump chromium to 132.0.6834.210 (34-x-y) (#45805)
chore: bump chromium in DEPS to 132.0.6834.210

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-02-25 22:23:02 -05:00
trop[bot]
0c73c66438 refactor: remove unused v8::Isolate* arg from GlobalShortcut constructor (#45794)
refactor: remove unused isolate arg from GlobalShortcut constructor

has not been used since f1a0d5e811 (#22755)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-24 22:15:49 -06:00
trop[bot]
289168a1ad fix: drag and drop icons on Windows (#45778)
* fix: drag and drop icons on Windows

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

* chore: fix patch merge conflict

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-02-24 21:02:09 -06:00
trop[bot]
9f27479a11 refactor: do not use AdaptCallbackForRepeating() in electron_api_url_loader.cc (#45782)
refactor: do not use AdaptCallbackForRepeating in electron_api_url_loader.cc

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-24 14:42:50 -06:00
trop[bot]
01b8069ada docs: clarify navigationhistory offsets (#45765)
* docs: clarify navigationhistory offsets

Co-authored-by: Erick Zhao <ezhao@slack-corp.com>

* "relative offset"

Co-authored-by: Erick Zhao <ezhao@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <ezhao@slack-corp.com>
2025-02-21 18:13:29 -06:00
trop[bot]
31a95f7857 refactor: use base's map utills in WebFrameMain (#45759)
refactor: use base::FindPtrOrNull() in WebFrameMain::FromFrameTreeNodeId()

refactor: use base::FindPtrOrNull() in WebFrameMain::FromFrameToken()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-21 18:04:06 -06:00
trop[bot]
70b354643e fix: crash on getUserMedia with invalid chromeMediaSourceId (#45756)
* fix: crash on getUserMedia with invalid chromeMediaSourceId

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

* test: add a 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>
2025-02-21 22:18:59 +01:00
trop[bot]
4fdfc66706 refactor: use base::as_byte_span() in EncodeToken(). (#45750)
This matches the change in upstream's serial_chooser_context.cc.

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

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-21 10:56:27 -06:00
trop[bot]
9d7c3a65fe build: skip chromium git cookie on forks (#45736)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-02-21 11:53:00 -05:00
trop[bot]
66d1227cc4 refactor: use base::as_bytes() in WriteAsciiChunk() (#45749)
refactor: use base::as_bytes() in WriteAsciiChunk()

this avoids a reinterpret_cast and a static_cast

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-21 10:40:00 -06:00
trop[bot]
ccb7fc05b3 refactor: bluetooth in serial chooser when exclusively wireless serial ports are expected (#45744)
* refactor: bluetooth in serial chooser when exclusively wireless serial ports are expected

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

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

* chore: review feedback

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>
2025-02-21 10:30:44 -06:00
trop[bot]
d507cf63d1 feat: allow setting roundedCorners on Windows (#45739)
* feat: allow setting roundedCorners on Windows

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

* Update docs/api/structures/base-window-options.md

Co-authored-by: Will Anderson <will@itsananderson.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>
2025-02-21 10:15:14 -06:00
trop[bot]
95bce0bce1 refactor: use base::as_string_view() (#45746)
Use `base::as_string_view()` as a safer alternative to `reinterpret_cast`
in a couple of places.

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

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-21 10:14:12 -06:00
trop[bot]
727e218c47 fix: possible timing issue in utility-process spec (#45728)
This fixture has been calling process.exit() immediately after writing
to stdout and stderr, which the Node.js docs say is risky behavior:

> Calling process.exit() will force the process to exit as quickly as
> possible even if there are still asynchronous operations pending that
> have not yet completed fully, including I/O operations to
> process.stdout and process.stderr.

This fixture's been around for years without problems (AFAIK).
The writes are very small ('hello\n' and 'world') and finish quickly.
But recently I've been testing on a very slow CI machine. There, I see
this spec flaking when it expects stderr to be 'world' but it gets ''.

This PR changes the fixture to wait for stdout & stderr to flush
before calling process.exit().

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-20 08:54:45 +01:00
trop[bot]
16cb1e46c8 refactor: track downloads by guid (#45717)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-20 08:17:21 +01:00
trop[bot]
435facd8e4 fix: extension web workers net request failing (#45710)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2025-02-19 23:00:08 -05:00
trop[bot]
75ce54614e fix: osr stutter fix backport for electron. (#45659)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: reito <cnschwarzer@qq.com>
2025-02-19 14:43:07 -06:00
electron-roller[bot]
de958d0dab chore: bump chromium to 132.0.6834.209 (34-x-y) (#45695)
chore: bump chromium in DEPS to 132.0.6834.209

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-02-19 15:19:51 -05:00
Sam Maddock
0af85fc5f0 fix: dangling speculative frames (#45687)
fix: dangling speculative frames (#45609)

* fix: dangling speculative frames

* harden lifecycle state checks

* feedback

* add const
2025-02-19 15:19:19 -05:00
John Kleinschmidt
f927d1dd92 build: remove appveyor bake (#45683)
build: remove appveyor bake (#45073)
2025-02-19 12:09:55 +01:00
trop[bot]
f2ec3763c2 fix: osr crash on window close (#45629)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-18 16:19:48 -05:00
trop[bot]
c8c5f9c986 fix: win.closeFilePreview recreates panel when called twice (#45662)
* fix: close quick look during tests on macOS

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* use longer delay 🤷

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* fix: sharedPreviewPanel being recreated on close

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* test: ensure preview panel gets closed

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-02-18 10:01:53 +01:00
trop[bot]
c1c9c1d001 build: run source cache clean daily (#45654)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-18 09:59:42 +01:00
Robo
3b89a5e183 fix: support for v8.setHeapSnapshotNearHeapLimit api (#45644)
* fix: support for v8.setHeapSnapshotNearHeapLimit api

* chore: fix lint
2025-02-17 15:48:02 +01:00
trop[bot]
e2042de483 fix: asan build on macOS (#45567)
* fix: asan build on macOS

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* chore: fix build

Co-authored-by: deepak1556 <hop2deep@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-02-17 11:14:38 +01:00
trop[bot]
dd5def7f46 build: make sure chromium cookie is set everywhere (#45634)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-02-14 16:02:11 -05:00
trop[bot]
6210a9e82c fix: pointer lock permission after focus loss and regain (#45627)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-14 12:58:49 -05:00
Charles Kerr
eb7216be1c refactor: use node::tracing::Agent() directly (34-x-y) (#45620)
* refactor: use node::tracing::Agent()

* chore: e patches all

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-14 10:18:24 +01:00
trop[bot]
32830de5b6 chore: change node test timeout from 20m to 30m (#45624)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-14 10:17:54 +01:00
Charles Kerr
a9f3754d22 docs: fix powerMonitor event types (34-x-y) (#45615)
docs: fix powerMonitor event types (#45518)

* fix: powerMonitor event types

* fix: thermal-state-change missing Returns

Co-authored-by: Sam Maddock <samuelmaddock@electronjs.org>
2025-02-13 17:25:36 -05:00
electron-roller[bot]
eb7a5c2548 chore: bump node to v20.18.3 (34-x-y) (#45575)
* chore: bump node in DEPS to v20.18.3

* src: fix outdated js2c.cc references

https://github.com/nodejs/node/pull/56133

* lib: remove startsWith/endsWith primordials for char checks

https://github.com/nodejs/node/pull/55407

* test,crypto: make crypto tests work with BoringSSL

https://github.com/nodejs/node/pull/55491

* fix: potential WIN32_LEAN_AND_MEAN redefinition

https://github.com/c-ares/c-ares/pull/869

* chore: fixup patch indices

* deps: update c-ares to v1.34.1

https://github.com/nodejs/node/pull/55369

* chore: fix bssl test

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-13 19:26:54 +01:00
electron-roller[bot]
cb1c7b447b chore: bump chromium to 132.0.6834.207 (34-x-y) (#45605)
chore: bump chromium in DEPS to 132.0.6834.207

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-02-13 11:04:24 -05:00
Shelley Vohr
d33905c5d9 fix: cppgc crashes on Linux with 16KiB pages (#45571) 2025-02-13 10:12:17 +01:00
trop[bot]
ddc7afd3f0 feat: Restore webContents navigation history and page state (#45584)
* feat: Working navigationHistory.restore with just title/url

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* feat: Restore page state, too

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* chore: Docs, lint, tests

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* Implement feedback

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* More magic

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* Make _awaitNextLoad truly private

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* Implement API group feedback

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* One more round of feedback

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Felix Rieseberg <fr@makenotion.com>
2025-02-12 21:29:32 +01:00
trop[bot]
d04491dff0 build: set chromium cookie on depot tools requests (#45600)
* build: set chromium cookie on depot tools requests

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* build: correct secrets syntax

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* build: handle windows cmd

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2025-02-12 10:37:33 -08:00
trop[bot]
88286e8f16 build: bump actions/cache past deprecated version (#45203)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2025-02-12 10:07:01 +01:00
trop[bot]
a6eb660a3d build: make gen-libc++-filenames.js produce the same results on Windows (#45577)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Will Anderson <will@itsananderson.com>
2025-02-11 11:08:35 -05:00
electron-roller[bot]
bb6d76a07a chore: bump node to v20.18.2 (34-x-y) (#45300)
chore: bump node in DEPS to v20.18.2

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-02-11 11:39:09 +01:00
trop[bot]
27349fc233 fix: fix mksnapshot gen/v8 path (#45544)
* fix: fix mksnapshot gen/v8 path

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* build: use 7z compression

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* build: unzip mksnapshot on Windows and update zip

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

* chore: escape backslashes

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

* chore: try another attempt

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

* chore: remove rmdir for now

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-02-11 10:02:45 +01:00
trop[bot]
c1a9e79d08 fix: window maximizing with Mica (#45526)
* fix: window maximizing with Mica

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

* Fix rounded corners after restore

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>
2025-02-10 15:36:51 -05:00
Keeley Hammond
b3bb3c5be0 chore: clean up web secure context patch (#45528)
chore: clean up patch application
2025-02-09 21:36:25 +01:00
trop[bot]
882bcb9435 build: make sure there is at least 35GB free for source cache (#45515)
build: make sure there is at least 35GB free for cache

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-02-09 21:35:54 +01:00
electron-roller[bot]
d2fce89969 chore: bump chromium to 132.0.6834.196 (34-x-y) (#45516)
chore: bump chromium in DEPS to 132.0.6834.196

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-02-07 13:59:02 -05:00
trop[bot]
78adaed2c6 refactor: only pass v8::Context to gin_helper::MicrotasksScope constructor (#45505)
refactor: forward v8::Context to v8::MicrotasksScope constructor

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2025-02-07 10:03:21 +01:00
trop[bot]
bba618f4d3 fix: RenderFrameHost nullptr dereference (#45510)
* fix: add nullptr tests before using render_frame_

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

* refactor: extract-method HasRenderFrame()

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-02-07 10:02:55 +01:00
Samuel Attard
b83b8ef851 chore: cherry-pick dd8e2822e507 from chromium (#45497) 2025-02-06 14:42:57 -08:00
trop[bot]
e4df33053c test: dump Electron process PID to path if environment variable set (#45492)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-02-06 12:09:19 -06:00
Shelley Vohr
dc149e6d3f build: remove outdated Node.js serdes patch (#45431) 2025-02-06 10:38:04 +01:00
trop[bot]
c1918f96cb feat: view.getVisible() (#45410)
* feat: view.getVisible()

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* test: visible apis

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* docs: clarify getVisible

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-02-05 14:35:12 -05:00
Robo
9fe5f566a4 feat: route deprecated sync clipboard read through permission checks (#45472)
feat: route deprecated sync clipboard read through permission checks (#45377)
2025-02-05 14:10:18 -05:00
trop[bot]
3053e33739 fix: WCO not working with some window configurations (#45478)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-05 14:09:46 -05:00
electron-roller[bot]
d857946d6e chore: bump chromium to 132.0.6834.194 (34-x-y) (#45480)
chore: bump chromium in DEPS to 132.0.6834.194

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-02-05 14:08:35 -05:00
trop[bot]
082d43e022 build: add NSPrefersDisplaySafeAreaCompatibilityMode = false to Info.plist (#45469)
build: add NSPrefersDisplaySafeAreaCompatibilityMode = false to Info.plist

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2025-02-05 10:50:50 +01:00
Keeley Hammond
18ee5c25c6 build: migrate Windows release builds to GHA (#45466)
* build: migrate Windows release builds to GHA (#45137)

* build: migrate release builds to GHA

* build: alter CI jobs release script

* build: remove generate-sas-token (#45347)

* build: use windows builders for win-publish (#45340)

* build: add win toolchain for release builds (#45380)

* build: add win toolchain for release builds

* build: fix installed_software.json script

* chore: run pwsh script within src

* build: fixup uploader arch
2025-02-04 13:57:30 -08:00
trop[bot]
69333ae82f build: always use python3 in script/lib/get-version.js (#45441)
build: always use python3 in script/lib/get-version.js

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-02-04 19:35:28 +01:00
trop[bot]
614c987401 docs: document deletion of databases directory (#45449)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-02-04 08:28:27 -06:00
trop[bot]
2ce5fdbec8 docs: mention C++20 requirement in breaking changes document (#45446)
* docs: mention C++20 requirement in breaking changes document

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

* chore: fix linter issue

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-02-03 16:29:16 -05:00
trop[bot]
54e5f1d8b2 fix: default path not working on KDE Linux (#45419)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-03 22:01:23 +01:00
trop[bot]
5ccd987f61 fix: incorrect WCO tooltip in RTL (#45426)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-03 14:02:23 +01:00
electron-roller[bot]
754ac14e78 chore: bump chromium to 132.0.6834.161 (34-x-y) (#45391)
chore: bump chromium in DEPS to 132.0.6834.161

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-01-31 12:22:14 -05:00
trop[bot]
608d89e447 fix: multiple directory selection on Linux (#45395)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-31 11:28:28 -05:00
trop[bot]
45f633e0f9 build: fix slack-github-action for backports (#45404)
build: fix slack-github-action for backports

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-31 09:53:31 -05:00
trop[bot]
505e02284b build: fixup concurrent builds on protected branches (#45385)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-01-30 10:36:17 +01:00
trop[bot]
1472c5b090 docs: reference security guide in ipcRenderer.on docs (#45372)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-01-29 15:44:30 -05:00
trop[bot]
61cddcaf76 fix: crash in gin::wrappable::secondweakcallback (#45376)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-01-29 12:10:57 -08:00
electron-roller[bot]
0fed0b74e0 chore: bump chromium to 132.0.6834.159 (34-x-y) (#45313)
* chore: bump chromium in DEPS to 132.0.6834.110

* chore: bump chromium in DEPS to 132.0.6834.159

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-01-29 19:55:29 +01:00
trop[bot]
af9ea0b422 fix: crash parsing CLSID in shell.readShortcutLink() (#45350)
* fix: crash parsing CLSID in shell.readShortcutLink

Co-authored-by: David Lönnhager <david.l@mullvad.net>

* fix: ignore clsid if it could not be set

Co-authored-by: David Lönnhager <david.l@mullvad.net>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Lönnhager <david.l@mullvad.net>
2025-01-29 17:29:07 +01:00
trop[bot]
a41a0b1c1d build: use Python311 exe (#45362)
build: yse Python311 exe

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2025-01-28 20:43:29 -08:00
trop[bot]
600551766d docs: fix broken code in drag and drop example (#45337)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-01-27 13:06:04 -05:00
trop[bot]
c538aa8e6c docs: Add note about directly exposing Electron APIs in preload (#45323)
* docs: Add note about directly exposing Electron APIs in preload

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* Implement feedback

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Felix Rieseberg <fr@makenotion.com>
2025-01-23 16:29:22 -08:00
trop[bot]
2d6dd64a5e fix: potential crash in chrome.tabs.update() (#45304)
fix: potential crash in chrome.tabs.update()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-23 12:08:40 +01:00
Shelley Vohr
bb616ba5ca fix: page scaling in silent mode printing (#45283)
* fix: page scaling in silent mode printing

* fix: FTBFS in print_renderer_frame_helper.cc

* chore: e patches all

---------

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-01-22 13:18:36 -05:00
trop[bot]
4a1c029f94 refactor: in StopTracing(), use string literals instead of optional<string> (#45291)
refactor: simplify StopTracing() a little by using a string_view instead of an optional<string>

We have compile-time string literals that we're passing to a method
that takes a string_view argument, so we don't need all this extra
optional<string> scaffolding

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-01-22 09:43:19 -06:00
trop[bot]
a1816f3587 docs: add DocCardList component for index doc (#45295)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <ezhao@slack-corp.com>
2025-01-22 10:53:17 +01:00
trop[bot]
db84f39e5e refactor: simplify ParseUserScript() (#45289)
refactor: simplify ParseUserScript()

local variable user_script no longer needed after #43205

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-01-22 10:11:19 +01:00
trop[bot]
7ecb8ad7a5 chore: align clipboard blink::web_pref::WebPreferences with upstream (#45279)
chore: align clipboard blink::web_pref::WebPreferences with upstream

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-21 09:38:52 -08:00
trop[bot]
973c344f1b fix: getAsFileSystemHandle failure when drag-dropping two directories (#45258)
fix: drag-dropping two directories

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-20 14:39:09 -06:00
trop[bot]
01c5db032a build: fix clang-format duplicate message (#45264)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-20 11:07:39 -06:00
trop[bot]
2c22507dfb fix: two possible FSA crashes (#45260)
* 5786874: Change Observer: Fix crash when navigating to new page

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

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

* 5794141: Change Observer: Fix Get*PermissionGrant crash

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

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>
2025-01-20 10:36:09 -06:00
trop[bot]
41c1161dd9 fix: session.clearData avoidClosingConnections default to false (#45208)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
2025-01-17 10:36:43 +01:00
Anny Yang
b36aaf36e7 docs: remove quickstart (#45227) 2025-01-17 10:36:15 +01:00
Erick Zhao
5728e6dc81 docs: Why Electron? (#45211)
docs: Why Electron? (#45191)

* docs: Why Electron?

* Apply suggestions from code review




* Update docs/why-electron.md

---------

Co-authored-by: Felix Rieseberg <fr@makenotion.com>
Co-authored-by: Sam Maddock <samuel.maddock@gmail.com>
2025-01-16 14:37:45 -08:00
Keeley Hammond
c86896312f docs: correct breaking changes versions (#45189)
docs: correct breaking changes versions (#45173)
2025-01-13 14:45:57 -08:00
trop[bot]
b9b6aebe32 docs: update timelines for E35 (#45174)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Michaela Laurencin <mlaurencin@electronjs.org>
2025-01-11 18:07:02 -08:00
trop[bot]
6bc6d10308 perf: cache whether or not ELECTRON_DEBUG_NOTIFICATIONS env var is set (#45163)
* perf: cache whether or not ELECTRON_DEBUG_NOTIFICATIONS env var is set

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

* chore: remove unused #include

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-01-09 09:22:51 -06:00
electron-roller[bot]
1323e223a4 chore: bump chromium to 132.0.6834.83 (34-x-y) (#45164)
chore: bump chromium in DEPS to 132.0.6834.83

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2025-01-09 09:21:56 -06:00
trop[bot]
bc00450a31 refactor: remove redundant CreateExtensionsClient() (#45155)
* refactor: have CreateExtensionsClient return a unique_ptr, not a raw pointer

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

* refactor: remove CreateExtensionsClient()

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-01-08 16:04:52 -06:00
trop[bot]
1ecc57465d test: reenable disabled GHA windows tests (#45075)
* test: renable GHA on Windows disabled tests

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

* test: close edge after shell.openExternal

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

* test: close edge sync after shell.openExternal

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-01-06 12:49:16 -05:00
q234rty
0b12d0e6c5 chore: cherry-pick 3dc17c46 from chromium (#45127) 2025-01-06 12:48:36 -05:00
electron-roller[bot]
68a410de9b chore: bump chromium to 132.0.6834.57 (34-x-y) (#45066)
chore: bump chromium in DEPS to 132.0.6834.57

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2024-12-23 15:32:12 +09:00
trop[bot]
314bc3e1a1 fix: better prompt not supported message in window-setup.ts (#45045)
Update window-setup.ts

The message should simply read "is not supported" or, alternatively, "is not, and will not, be supported", but not "is and will not be supported".

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Quinn <qdirks@gmail.com>
2024-12-17 12:42:15 +01:00
trop[bot]
33065a8654 docs: remove extra " (#45041)
remove extra "

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Kavindu Udara <karunasinghesampath38@gmail.com>
2024-12-16 13:43:10 -05:00
trop[bot]
52484b0ccd fix: chrome.i18n unavailable in extension service workers (#45036)
https://chromium-review.googlesource.com/c/chromium/src/+/3362491

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Sam Maddock <samuelmaddock@electronjs.org>
2024-12-16 13:14:32 -05:00
John Kleinschmidt
b5ed025267 build: use github actions for windows (#45011)
* build: use github actions for windows (#44136)

* build: test windows runner

* build: try build windows on windows?

* build: take win/cross changes

* build: use bash as default shell always

* build: configure git for windows build tools

* build: bash as default

* build: configure windows correctly

* build: use sha1sum

* build: force windows cipd init and python3 existence

* just pain

* build: restore cache on windows

* build: use build-tools gclient

* build: sync gclient vars to build windows job

* build: output depshash for debugging

* build: past sam was a silly goose

* build: depshash logging

* build: force lf endings for lock and DEPS

* build: platform strings are hard

* build: checkout on windows host

* sup

* no check

* idk

* sigh

* ...

* no double checkout

* build: yolo some stuff

* build: run gn-check for windows on linux hosts for speed

* use container...

* cry ?

* build: e d

* e d

* no log

* fix toolchain on windows cross check

* build: use powershell to add mksnapshot_args

* build: enable x86 and arm64 windows builds too

* clean up

* maybe not needed

* build: keep action around for post step

* build: configure git global on win

* build: ia32 zip manifest

* build: no patch depot_tools for tests

* build: get arm64 windows closer to working

* build: windows tar is ass

* 32 bit on 32 bit

* maybe bash

* build: set up nodejs

* correct windows sharding

* fix some spec runner stuff

* fix windows tests

* overwrite -Force

* sigh

* screen res

* wat

* logs

* ... more logs

* line endings will be the death of me

* remove 1080p force thing

* vsctools + logging

* disable some fullscreen tests on GHA

* no progress

* run all CI

* install visual studio on arm64

* windows hax for non windows

* maybe arm sdk

* clean up depshash logic

* build: use single check per platform

* ensure clean args

* fix loop

* remove debug

* update default build image sha for dispatch

* plzzzz

* one more try

* arm64 vctools

* sad

* build: fix non-dispatch windows gn check

* chore: debug datadog-ci location

* chore: update build-tools for newer toolchain

* chore: set path for datadog-ci

* try this

* chore: fixup gn check

* fixup gn-check some more

* fixup windows gn check

* chore: fixup windows gn check

* test: use cmd for Windows testing

* fixup use cmd for testing on Windows

* fixup windows GN check

* fixup npm config arch for x86

* Can we set test files via powershell

* fixup to set test files via powershell

* fixup set test files via powershell

* Don't check cross instance cache disk space on Windows

* Use separate step to set env variables for testing

* fixup Use separate step to set env variables for testing

* fixup Use separate step to set env variables for testing

* fixup Use separate step to set env variables for testing (AGAIN)

* use powershell if in powershell

* fixup use powershell if in powershell

* chore: remove no longer needed changes to depot_tools

xref: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5669094
and https://chromium-review.googlesource.com/c/chromium/src/+/5844046

* chore: try using 7zip on Windows to extract tarball

* Revert "chore: try using 7zip on Windows to extract tarball"

This reverts commit c7432b6a37.

* test: debug failing tests on GHA windows

* fix: ftbfs when including simdjson in Node.js

(cherry picked from commit 48e44c40d6)

* chore: try to track down Windows testing hang

* use correct timeout

* try this

* see if this helps

* try to figure out why node is running

* shard tests to try to narrow down WOA lockup

* try to narrow down problem test

* Narrow down blocking test more

* do we need a combo to repro

* see if this cleans up the tests

* fixup navigator.usb test

* remove logging from problematic tests

* Revert "shard tests to try to narrow down WOA lockup"

This reverts commit a180658376.

* remove logging

* debug keyboard test

* add timeout for Windows since arm64 sometimes hangs

* see if this helps

* put back original timeout

* try to use screenCapture to get screenshots of what is going on on WOA

* try using electron screencapture to debug WOA hang

* chore: turn off privacy experience

* run screenshot on both shards

* fixup screencap

* try to narrow down hanging spec

* chore: cleanup servers left open

* cleanup tests

* Revert "try to narrow down hanging spec"

This reverts commit a0f959f538.

* cleanup test debugging

* fixup extensions spec

* cleanup unneeded items

* run wtf with 2 shards instead of 6

* Revert "run wtf with 2 shards instead of 6"

This reverts commit ca2d282129.

* debug windows version on woa

* dump more info

* Get detailed CPU info

* revert debugging

* use same args as AppVeyor WOA for GHA WOA

* fixup use same args as AppVeyor WOA for GHA WOA

* fixup use same args as AppVeyor WOA for GHA WOA

* try to track down which tests trigger hang

* one or more of these combinations should hang

* break up web contents spec to find hang

* further break down api-web-contents to find hang

* test: ensure all webContents are closed

* test: fix require is not defined error

* see if api-web-contents spec is now good

* test: ensure all webContents are closed

* Revert "try to track down which tests trigger hang"

This reverts commit 07298d6ffe.

* chore: use alternate location for windows toolchain

* Reapply "try to track down which tests trigger hang"

This reverts commit 0321f76d01.

* try to narrow down problem test

* fix TEST_SHARD env var

* no, really fix TEST_SHARD env var

* see if this fixes it

* test: cleanup any remaining windows and webcontents

* see if new cleanup helps

* dont destroy webcontents for now

* fixup dont destroy webcontents for now

* Only cleanup right before process.exit

* see if this fixes the hang

* actually destroy webcontents

* Revert "Reapply "try to track down which tests trigger hang""

This reverts commit cdee7de049.

* see if this helps

* Revert "see if this helps"

This reverts commit 9a15a69cf7.

* Is it all about the web contents?

* it is all about the webcontents

but which one?

* Narrow down problem webcontents test

* try to speed up git install on WOA

* disable problematic test on WOA

* remove debugging

* remove debugging from choco installs

* Revert "disable problematic test on WOA"

This reverts commit e060fb0839.

* Revert "remove debugging"

This reverts commit f18dd8b1a5.

* run against all the tests in the failing shard

* don't run visibility tests first

* remove debugging

* 3 is a magic number

* Revert "3 is a magic number"

This reverts commit 36b91ccf9f.

* match what Appveyor runs exactly

* Revert "match what Appveyor runs exactly"

This reverts commit 7260dd4322.

* chore: sort files alphabetically

* find out what spec is leaving stuff open

* chore: Checkout PR HEAD commit

 instead of merge commit

* try using app.exit instead of process.exit

* test: cleanup BrowserWindows and webContents

* Revert "chore: sort files alphabetically"

This reverts commit d9e217ffb1.

* chore: use win32 to match process.platform

Needed for build-tools to download from PRs

* chore: cache yarn dir

* fixup cache yarn

* fixup use win32 to match process.platform

* fixup use win32 to match process.platform

* fixup cache yarn

* Add debugging for WOA hang

* Add debugging for failing keyboard lock test

* Revert "Add debugging for WOA hang"

This reverts commit 8df03d568d.

* try using process.kill

* add more debugging to keyboard.lock test

* Revert "Add debugging for failing keyboard lock test"

* remove debugging

* test: disable keyboard.lock on Windows

* test: disable fullscreen tests on Windows

* test: only force test suite exit on WOA

* fixup test: only force test suite exit on WOA

* cleanup tests

* extract yarn caching/install to action

* try using bash to run windows tests

* remove left over debugging

* standardize on 'win' for Windows builds

* use 'x86' for arch for manifest files

* fixup try using bash to run windows tests

* fixup use 'x86' for arch for manifest files

* standardize on 'win' for Windows builds

* fixup use 'x86' for arch for manifest files

* fixup try using bash to run windows tests

---------

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
(cherry picked from commit be1a3dce83)

* chore: update build tools to correct sha

---------

Co-authored-by: Samuel Attard <sam@electronjs.org>
2024-12-15 22:54:56 -08:00
trop[bot]
bcbd3063a3 fix: custom spell-checker stuck in infinite loop (#45020)
`ReadUnicodeCharacter` updates index to the last character read, and not after it. We need to manually increment it to move to the next character.

It also doesn't validate that the index is valid, so we need to check that index is within bounds.

Refs: #44336

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jesper Ek <deadbeef84@gmail.com>
2024-12-13 17:26:44 -08:00
Keeley Hammond
686bc86042 chore: cherry-pick 1282289030ab from chromium (#45023) 2024-12-13 17:26:01 -08:00
trop[bot]
fd117af7ce fix: add missing index arg in navigationHistory.canGoToOffset (#45008)
fix: add missing arg

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: alice <alice@makenotion.com>
2024-12-12 16:21:36 -05:00
electron-roller[bot]
40dd1b76bc chore: bump chromium to 132.0.6834.46 (34-x-y) (#45005)
chore: bump chromium in DEPS to 132.0.6834.46

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2024-12-12 10:49:55 -05:00
trop[bot]
521835d70b fix: context-menu emitted twice (#44997)
* fix: context-menu emitted twice

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* refactor: simplify disabling draggable regions

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* cleanup

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2024-12-11 13:24:32 -05:00
trop[bot]
cfe549c739 fix: build failure when PDF viewer is disabled (#44964)
* fix: unused variable warning when the PDF viewer is disabled

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

* fix: unused function error when PDF viewer is disabled

error: unused function ParseManifest [-Werror,-Wunused-function]

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-06 17:28:55 -06:00
trop[bot]
2d45b7df34 fix: context-menu event with BaseWindows (#44952)
fix: context-menu event with BaseWindows

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-12-04 16:03:02 -08:00
trop[bot]
9a7848ced1 feat: Add shared dictionary management APIs (#44950)
* Add bare-bones GetSharedDictionaryUsageInfo

* Add GetSharedDictionaryInfo()

* Improve API, use isolation keys

* Add documentation

* Update docs/api/session.md



* Update shell/browser/api/electron_api_session.cc



* Add tests

* Implement feedback <3

* Improve tests

* chore: lint

* docs: add note about clearing cache in ses.clearData

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Felix Rieseberg <fr@makenotion.com>
2024-12-04 13:35:08 -08:00
electron-roller[bot]
c54f1f98fe chore: bump chromium to 132.0.6834.32 (34-x-y) (#44949)
chore: bump chromium in DEPS to 132.0.6834.32

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2024-12-04 14:02:31 -05:00
trop[bot]
a7066af0f9 fix: modernize-use-equals-default warnings (#44944)
fix: use '= default' to define a trivial destructor [modernize-use-equals-default]

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-03 21:19:32 -06:00
trop[bot]
7f6594654c docs: fix grammar in app.relaunch docs (#44942)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2024-12-03 10:12:47 -08:00
trop[bot]
f383391c0e feat: WebFrameMain.collectJavaScriptCallStack() (#44938)
* feat: WebFrameMain.unresponsiveDocumentJSCallStack

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* Revert "feat: WebFrameMain.unresponsiveDocumentJSCallStack"

This reverts commit e0612bc1a00a5282cba5df97da3c9c90e96ef244.

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* feat: frame.collectJavaScriptCallStack()

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* feat: frame.collectJavaScriptCallStack()

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* Update web-frame-main.md

Co-authored-by: Sam Maddock <smaddock@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2024-12-03 09:55:52 -08:00
trop[bot]
ed0946c880 chore: remove unused registry arg from GetPrivilegeRequiredByUrl() (#44931)
this has never been used; introduced by 91071570

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-02 15:37:21 -06:00
trop[bot]
d1eee44b19 docs: clarify what session.clearData() with data type 'cache' deletes (#44930)
* docs: clarify what session.clearData() with data type 'cache' deletes

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

* docs: include `shadercache`, too

Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2024-12-02 14:03:12 -05:00
trop[bot]
498a7d82cc chore: remove unused arg from BaseWindow::GetBackgroundColor() (#44924)
chore: remove unused gin_helper::Arguments* arg from BaseWindow::GetBackgroundColor()

looks like this was added in db79734b but never used

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-02 13:58:52 -05:00
trop[bot]
dc53f6e73b docs: clarify session.clearData() can delete more types than listed (#44927)
docs: warn that session.clearData() might delete more than expected

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2024-12-02 13:51:00 -05:00
trop[bot]
fa98b4d542 fix: don't use deprecated ui::MouseEvent constructor (#44919)
* refactor: do not use deprecated gfx::Point constructor for MouseEvent

Deprecated in https://chromium-review.googlesource.com/c/1444251

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

* refactor: use WebInputEvent::GetTypeAsUiEventType() instead of rolling our own

Added in https://chromium-review.googlesource.com/c/chromium/src/+/2180291

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-02 13:30:50 -05:00
trop[bot]
1c2015ed1f chore: remove unused isolate argument from Cookies constructor (#44923)
* chore: remove unused isolate argument from Cookies constructor

unused since the ginify cookies refactor in Mar 2020, commit 22202255

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

* fix: constructor only takes one arg now, so mark it explicit

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-02 13:25:44 -05:00
trop[bot]
d0668e6a3a fix: remove unused id argument from TranslateToStock() (#44912)
unused since fb537d91fc

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-12-02 08:36:48 -06:00
trop[bot]
d7284f0262 docs: specify default value for respondToAuthRequestsFromMainProcess (#44901)
docs: specify default value for respondToAuthRequestsFromMainProcess

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2024-12-01 07:13:39 -06:00
trop[bot]
b33ea0d72d docs: fix a syntax issue in document breaking changes (#44905)
fix: syntax issue in docs

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: illusory-dream <37270118+illusory-dream@users.noreply.github.com>
2024-12-01 07:12:11 -06:00
trop[bot]
c63613f290 refactor: return-braced-init-list pt 2 of 2 (#44891)
* refactor: more return-braced-init-list, this time for v8 and gin objects

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

* refactor: more return-braced-init-list, this time for v8, gin, std, and base objects

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-30 16:47:30 -06:00
trop[bot]
dc0c6c6f3f refactor: reduce scope of relauncher's internal constants (#44892)
* refactor: make kRelauncherArgSeparator private to relauncher.cc

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

* refactor: make kRelauncherTypeArg private to relauncher.cc

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

* refactor: remove unused type relauncher::CharType

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

* refactor: move private constants into standalone private namespace

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

* refactor: move kWaitEventName into the only function that uses it

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-30 16:46:45 -06:00
trop[bot]
a92b3944a1 fix: misc-use-internal-linkage warnings (#44872)
* refactor: fix misc-use-internal-linkage warnings:

move impl functions into anonymous namespace so that they're not visible
to other compilation units
2024-11-27 12:35:37 -06:00
trop[bot]
5ca3f950e9 refactor: use base::Extend in AddAdditionalSchemes() (#44866)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-27 10:09:55 -06:00
trop[bot]
99f2bab4a4 refactor: fix modernize-return-braced-init-list warnings (#44856)
* refactor: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]

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

* refactor: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]

NB: using the braced-initializer list uncovered an error here:
the float returned by std::floor() can't be implicitly cast to
an int. This is solved by using base::ClampFloor<int>() instead.
std::floor()

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-26 22:18:13 -06:00
trop[bot]
c0d1c3481a fix: modernize-use-nodiscard clang-tidy warnings (#44833)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-25 13:55:56 -05:00
trop[bot]
5a0e1ccf73 fix: modernize-avoid-c-arrays (#44834)
use string_view for constants used in methods that take string_view args

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-25 13:55:19 -05:00
trop[bot]
d8a7c57506 fix: modernize-use-using clang-tidy warnings (#44835)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-25 13:53:59 -05:00
trop[bot]
a30cf5b551 docs: correct stable release dates for v34.0.0 (#44829)
* docs: correct stable release dates for v34.0.0

Co-authored-by: Ajay Kemparaj <ajaykemparaj@gmail.com>

* docs: correct stable release dates for v34.0.0

Co-authored-by: Ajay Kemparaj <ajaykemparaj@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Ajay Kemparaj <ajaykemparaj@gmail.com>
2024-11-25 11:04:30 -05:00
trop[bot]
6208b61a38 refactor: remove unnecessary constructor code (#44827)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-24 12:15:04 -06:00
trop[bot]
73243cb9c4 fix: remove unused local variables (#44823)
* chore: remove unused local non-trivial variable relaunch_executable

became unused in June 2016 in 0d066de5

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

* chore: only declare program_name local variable if used

We declared it everywhere but only used it on Windows

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

* chore: remove unused local non-trivial variable path from UnregisterXWindow

it became unused in 2020 by 72a08926

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-24 08:54:56 -06:00
trop[bot]
5670b17b40 docs: update new GitHub issue link (#44811)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2024-11-22 16:50:54 -06:00
trop[bot]
103a7c1838 fix: crash calling shell.readShortcutLink (#44804)
* fix: crash calling shell.readShortcutLink

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

* chore: update .patches after trop

---------

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>
2024-11-22 11:00:12 -06:00
trop[bot]
cfdf7992d3 build: remove duplicate line in gn file (#44792)
style: remove duplicate line in gn file

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: bill.shen <15865969+cucbin@users.noreply.github.com>
2024-11-22 15:36:23 +01:00
trop[bot]
7d260a1305 fix: big endian bug in V8 serialization (#44797)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-22 15:35:55 +01:00
trop[bot]
d2bafe870e fix: ensure context-menu emitted for draggable regions (#44799)
* fix: ensure context-menu emitted for draggable regions

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

* chore: address suggestions from review

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>
2024-11-22 09:28:12 -05:00
electron-roller[bot]
bbdce52b12 chore: bump node to v20.18.1 (34-x-y) (#44782)
* chore: bump node in DEPS to v20.18.1

* chore: update patches

* lib: remove lib/internal/idna.js

https://github.com/nodejs/node/pull/55050

* buffer: fix out of range for toString

https://github.com/nodejs/node/pull/54553

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-11-22 10:21:55 +01:00
electron-roller[bot]
b72b661f3c chore: bump chromium to 132.0.6834.15 (34-x-y) (#44783)
* chore: bump chromium in DEPS to 132.0.6834.15

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-11-21 16:56:48 -05:00
trop[bot]
b6f97b7952 fix: windows save dialog extension bug (#44770)
* fix: windows save dialog extension bug

* refactor: simplify firstSpec extraction



* refactor: split when necessary



---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: nilaoda <nilaoda@live.com>
2024-11-21 22:36:31 +01:00
trop[bot]
787d4c3859 fix: clang-tidy performance-inefficient-vector-operation warnings (#44775)
* fix: performance-inefficient-vector-operation warning in Clipboard::WriteFilesForTesting()

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

* fix: performance-inefficient-vector-operation warning in GetUploadedReports()

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-21 14:30:45 -05:00
trop[bot]
19e6ca921f docs: sync 34.0.0 release date to Chromium 132 release date (#44788)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-21 11:32:56 -06:00
trop[bot]
14c705349e fix: performance-no-automatic-move clang-tidy warnings (#44773)
* fix: performance-no-automatic-move in GetLogFileName()

remove `const` from log_filename.

Warning fixed by this commit:

../../electron/shell/common/logging.cc:40:12: warning: constness of 'log_filename' prevents automatic move [performance-no-automatic-move]

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

* fix: performance-no-automatic-move in GetBundleResourcePath()

remove `const` from request_relative_path.

Warning fixed by this commit:

electron/shell/browser/extensions/electron_extensions_browser_client.cc:187:10: warning: constness of 'request_relative_path' prevents automatic move [performance-no-automatic-move]

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-21 15:29:52 +01:00
trop[bot]
8c7a253d6a test: run script to help target discovery and reduce flakes (#44762)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2024-11-20 15:50:33 -08:00
trop[bot]
bf110c9467 chore: fix textured window conditional on macOS (#44768)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-11-20 14:56:38 -05:00
trop[bot]
aaa5ec8dfa fix: tooltips in WCO caption buttons (#44759)
fix: tooltips in WCO capton buttons

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-11-20 15:34:58 +01:00
trop[bot]
9dc7ac48fe fix: bugprone-narrowing-conversions warnings in NativeImage (#44740)
* fix: bugprone-narrowing-conversions warning in NativeImage::memory_usage_

- fix signed / unsigned math by using base/numerics/safe_conversions

- make memory_usage_ an int64_t so it can safely take the size_t
  returned by computeByteSize()
2024-11-19 19:31:10 -06:00
trop[bot]
b78e06974e fix: cyclical #include dependency between autofill_popup.h and autofill_popup_view.h (#44735)
fix: AutofillPopup warning: use '= default' to define a trivial default constructor [modernize-use-equals-default]

refactor: reduce #indclude scope in autofill_popup.h and autofill_popup_view.h

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-11-19 16:01:35 -06:00
trop[bot]
39e50be043 fix: utility process exit code for graceful termination (reland) (#44733)
* chore: reland "fix: utility process exit code for graceful termination"

This reverts commit 1cae73ba09.

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* fix: exit code on posix when killed via api

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* chore: fix code style

Co-authored-by: Robo <hop2deep@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2024-11-19 22:09:53 +01:00
trop[bot]
d477926b5d fix: destroy url loader wrapper when JS env exits (#44731)
* fix: destroy url loader wrapper when JS env exits

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* Revert "fix: destroy url loader wrapper when JS env exits"

This reverts commit 419151a98a16814ea63e9abc197c6ae27f48128c.

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* Revert "Revert "fix: destroy url loader wrapper when JS env exits""

This reverts commit 4b401b03c62aca79498660f995825491ae52f179.

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* fix: double free of JSChunkedDataPipeGetter

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* fix: crash on process exit after stream completes

Co-authored-by: deepak1556 <hop2deep@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2024-11-19 20:48:43 +01:00
trop[bot]
ca8e1e4af6 fix: improve single-pixel resize handling on Windows (#44722)
* fix: improve single-pixel resize handling

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

* Update spec/api-browser-window-spec.ts

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

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

* Update shell/browser/native_window_views.cc

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

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>
2024-11-19 10:53:04 -05:00
trop[bot]
3764c4d0b3 docs: Make ipcRenderer and ipcMain listener API docs consistent (#44711)
* docs: Make ipcRenderer and ipcMain listener API docs consistent

Co-authored-by: Will Anderson <will@itsananderson.com>

* test: add some unit tests for ipcRenderer/ipcMain listener behavior

Co-authored-by: Will Anderson <will@itsananderson.com>

* fix: Mark on/off methods as primary and addListener/removeListener as aliases

Co-authored-by: Will Anderson <will@itsananderson.com>

* fix: clear all listeners before running ipcMain removeAllListeners tests

Co-authored-by: Will Anderson <will@itsananderson.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Will Anderson <will@itsananderson.com>
2024-11-19 09:47:45 +01:00
trop[bot]
d5ece2a033 docs: document why to use the loadBrowserProcessSpecificV8Snapshot fuse (#44709)
Fixes #44450

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2024-11-18 17:51:10 -06:00
trop[bot]
5fc13009cb fix: utilityProcess pid should be undefined after exit (#44695)
fix: utilityProcess pid should be undefined after exit

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-11-18 14:44:14 +01:00
361 changed files with 23113 additions and 3713 deletions

4
.gitattributes vendored
View File

@@ -1,6 +1,8 @@
# `git apply` and friends don't understand CRLF, even on windows. Force those
# files to be checked out with LF endings even if core.autocrlf is true.
*.patch text eol=lf
DEPS text eol=lf
yarn.lock text eol=lf
script/zip_manifests/*.manifest text eol=lf
patches/**/.patches merge=union
# Source code and markdown files should always use LF as line ending.

View File

@@ -5,10 +5,10 @@ inputs:
description: 'Target arch'
required: true
target-platform:
description: 'Target platform'
description: 'Target platform, should be linux, win, macos'
required: true
artifact-platform:
description: 'Artifact platform, should be linux, darwin or mas'
description: 'Artifact platform, should be linux, win, darwin or mas'
required: true
step-suffix:
description: 'Suffix for build steps'
@@ -71,7 +71,7 @@ runs:
cd src
e build --target electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES
if [ "${{ inputs.is-asan }}" != "true" ]; then
target_os=${{ inputs.target-platform == 'linux' && 'linux' || 'mac'}}
target_os=${{ inputs.target-platform == 'macos' && 'mac' || inputs.target-platform }}
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
target_os="${target_os}_mas"
fi
@@ -82,7 +82,7 @@ runs:
run: |
cd src
e build --target electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
ELECTRON_DEPOT_TOOLS_DISABLE_LOG=1 e d gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
# Remove unused args from mksnapshot_args
SEDOPTION="-i"
if [ "`uname`" = "Darwin" ]; then
@@ -91,7 +91,7 @@ runs:
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
if [ "`uname`" = "Linux" ]; then
if [ "${{ inputs.target-platform }}" = "linux" ]; then
if [ "${{ inputs.target-arch }}" = "arm" ]; then
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/mksnapshot
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/v8_context_snapshot_generator
@@ -105,7 +105,15 @@ runs:
fi
e build --target electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
if [ "${{ inputs.target-platform }}" = "win" ]; then
cd out/Default
powershell Compress-Archive -update mksnapshot_args mksnapshot.zip
powershell mkdir mktmp\\gen\\v8
powershell Copy-Item gen\\v8\\embedded.S mktmp\\gen\\v8
powershell Compress-Archive -update -Path mktmp\\gen mksnapshot.zip
else
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
fi
- name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }}
shell: bash
if: ${{ (inputs.target-arch == 'arm' || inputs.target-arch == 'arm64') && inputs.target-platform == 'linux' }}
@@ -137,6 +145,25 @@ runs:
run: |
cd src
e build --target electron:node_headers
- name: Create installed_software.json ${{ inputs.step-suffix }}
shell: powershell
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
cd src
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- name: Profile Windows Toolchain ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
cd src
python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- name: Add msdia140.dll to Path ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
# Needed for msdia140.dll on 64-bit windows
cd src
export PATH="$PATH:$(pwd)/third_party/llvm-build/Release+Asserts/bin"
- name: Generate & Zip Symbols ${{ inputs.step-suffix }}
shell: bash
run: |

View File

@@ -5,6 +5,10 @@ inputs:
description: 'Whether to generate and persist a SAS token for the item in the cache'
required: false
default: 'false'
use-cache:
description: 'Whether to persist the cache to the shared drive'
required: false
default: 'true'
runs:
using: "composite"
steps:
@@ -13,31 +17,29 @@ runs:
run: |
echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
- name: Install Dependencies
shell: bash
run: |
cd src/electron
node script/yarn install --frozen-lockfile
uses: ./src/electron/.github/actions/install-dependencies
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Set Chromium Git Cookie
uses: ./src/electron/.github/actions/set-chromium-cookie
- name: Get Depot Tools
shell: bash
run: |
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
if [[ ! -d depot_tools ]]; then
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
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
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
touch .disable_auto_update
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
touch .disable_auto_update
fi
- name: Add Depot Tools to PATH
shell: bash
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- name: Generate DEPS Hash
shell: bash
run: |
node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
echo "DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
node src/electron/script/generate-deps-hash.js
echo "DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)" >> $GITHUB_ENV
- name: Generate SAS Key
if: ${{ inputs.generate-sas-token == 'true' }}
shell: bash
@@ -45,7 +47,7 @@ runs:
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$DEPSHASH.tar" > sas-token
- name: Save SAS Key
if: ${{ inputs.generate-sas-token == 'true' }}
uses: actions/cache/save@v4
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
path: |
sas-token
@@ -54,24 +56,29 @@ runs:
id: check-cache
shell: bash
run: |
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
echo "Using cache key: $DEPSHASH"
echo "Checking for cache in: $cache_path"
if [ ! -f "$cache_path" ] || [ `du $cache_path | cut -f1` = "0" ]; then
if [[ "${{ inputs.use-cache }}" == "false" ]]; then
echo "Not using cache this time..."
echo "cache_exists=false" >> $GITHUB_OUTPUT
echo "Cache Does Not Exist for $DEPSHASH"
else
echo "cache_exists=true" >> $GITHUB_OUTPUT
echo "Cache Already Exists for $DEPSHASH, Skipping.."
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
echo "Using cache key: $DEPSHASH"
echo "Checking for cache in: $cache_path"
if [ ! -f "$cache_path" ] || [ `du $cache_path | cut -f1` = "0" ]; then
echo "cache_exists=false" >> $GITHUB_OUTPUT
echo "Cache Does Not Exist for $DEPSHASH"
else
echo "cache_exists=true" >> $GITHUB_OUTPUT
echo "Cache Already Exists for $DEPSHASH, Skipping.."
fi
fi
- name: Check cross instance cache disk space
if: steps.check-cache.outputs.cache_exists == 'false'
if: steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true'
shell: bash
run: |
# if there is less than 20 GB free space then creating the cache might fail so exit early
# if there is less than 35 GB free space then creating the cache might fail so exit early
freespace=`df -m /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
freespace_human=`df -h /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
if [ $freespace -le 20000 ]; then
if [ $freespace -le 35000 ]; then
echo "The cross mount cache has $freespace_human free space which is not enough - exiting"
exit 1
else
@@ -81,13 +88,17 @@ runs:
if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash
run: |
gclient config \
e d gclient config \
--name "src/electron" \
--unmanaged \
${GCLIENT_EXTRA_ARGS} \
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags -vvvvv
if [ "$TARGET_OS" != "" ]; then
echo "target_os=['$TARGET_OS']" >> ./.gclient
fi
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 e d gclient sync --with_branch_heads --with_tags -vv
if [ "${{ inputs.is-release }}" != "true" && -n "${{ env.PATCH_UP_APP_CREDS }}" ]; then
# Re-export all the patches to check if there were changes.
python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
@@ -128,13 +139,13 @@ runs:
# https://dawn-review.googlesource.com/c/dawn/+/83901
# TODO: maybe better to always leave out */.git/HEAD file for all targets ?
- name: Delete .git directories under src to free space
if: steps.check-cache.outputs.cache_exists == 'false'
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }}
shell: bash
run: |
cd src
( find . -type d -name ".git" -not -path "./third_party/angle/*" -not -path "./third_party/dawn/*" -not -path "./electron/*" ) | xargs rm -rf
- name: Minimize Cache Size for Upload
if: steps.check-cache.outputs.cache_exists == 'false'
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }}
shell: bash
run: |
rm -rf src/android_webview
@@ -145,9 +156,12 @@ runs:
rm -rf src/third_party/angle/third_party/VK-GL-CTS/src
rm -rf src/third_party/swift-toolchain
rm -rf src/third_party/swiftshader/tests/regres/testlists
cp src/electron/.github/actions/checkout/action.yml ./
rm -rf src/electron
mkdir -p src/electron/.github/actions/checkout
mv action.yml src/electron/.github/actions/checkout
- name: Compress Src Directory
if: steps.check-cache.outputs.cache_exists == 'false'
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }}
shell: bash
run: |
echo "Uncompressed src size: $(du -sh src | cut -f1 -d' ')"
@@ -155,7 +169,7 @@ runs:
echo "Compressed src to $(du -sh $DEPSHASH.tar | cut -f1 -d' ')"
cp ./$DEPSHASH.tar /mnt/cross-instance-cache/
- name: Persist Src Cache
if: steps.check-cache.outputs.cache_exists == 'false'
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }}
shell: bash
run: |
final_cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar

View File

@@ -6,6 +6,15 @@ runs:
- name: Install Build Tools
shell: bash
run: |
export BUILD_TOOLS_SHA=eeb1a11392e4cec08fd926c93b31ab556dc0c23b
if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then
git config --global core.filemode false
git config --global core.autocrlf false
git config --global branch.autosetuprebase always
fi
export BUILD_TOOLS_SHA=8246e57791b0af4ae5975eb96f09855f9269b1cd
npm i -g @electron/build-tools
e auto-update disable
if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then
e d cipd.bat --version
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
fi

View File

@@ -0,0 +1,21 @@
name: 'Install Dependencies'
description: 'Installs yarn depdencies using cache when available'
runs:
using: "composite"
steps:
- name: Get yarn cache directory path
shell: bash
id: yarn-cache-dir-path
run: echo "dir=$(node src/electron/script/yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('src/electron/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
shell: bash
run: |
cd src/electron
node script/yarn install --frozen-lockfile --prefer-offline

View File

@@ -5,14 +5,14 @@ runs:
steps:
- name: Obtain SAS Key
continue-on-error: true
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
path: |
sas-token
key: sas-key-${{ github.run_number }}-1
- name: Obtain SAS Key
continue-on-error: true
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
path: |
sas-token

View File

@@ -0,0 +1,26 @@
name: 'Set Chromium Git Cookie'
description: 'Sets an authenticated cookie from Chromium to allow for a higher request limit'
runs:
using: "composite"
steps:
- name: Set the git cookie from chromium.googlesource.com (Unix)
if: ${{ runner.os != 'Windows' && env.CHROMIUM_GIT_COOKIE }}
shell: bash
run: |
eval 'set +o history' 2>/dev/null || setopt HIST_IGNORE_SPACE 2>/dev/null
touch ~/.gitcookies
chmod 0600 ~/.gitcookies
git config --global http.cookiefile ~/.gitcookies
tr , \\t <<\__END__ >>~/.gitcookies
${{ env.CHROMIUM_GIT_COOKIE }}
__END__
eval 'set -o history' 2>/dev/null || unsetopt HIST_IGNORE_SPACE 2>/dev/null
- name: Set the git cookie from chromium.googlesource.com (Windows)
if: ${{ runner.os == 'Windows' && env.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
shell: cmd
run: |
git config --global http.cookiefile "%USERPROFILE%\.gitcookies"
powershell -noprofile -nologo -command Write-Output "${{ env.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}" >>"%USERPROFILE%\.gitcookies"

View File

@@ -18,6 +18,11 @@ on:
description: 'Skip Linux builds'
default: false
required: false
skip-windows:
type: boolean
description: 'Skip Windows builds'
default: false
required: false
skip-lint:
type: boolean
description: 'Skip lint check'
@@ -28,7 +33,11 @@ on:
- main
- '[1-9][0-9]-x-y'
pull_request:
defaults:
run:
shell: bash
jobs:
setup:
runs-on: ubuntu-latest
@@ -40,7 +49,9 @@ jobs:
build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
docs-only: ${{ steps.set-output.outputs.docs-only }}
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.0.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
@@ -89,6 +100,7 @@ jobs:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas
env:
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
outputs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
@@ -98,6 +110,7 @@ jobs:
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout
with:
@@ -114,6 +127,7 @@ jobs:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas
env:
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
PATCH_UP_APP_CREDS: ${{ secrets.PATCH_UP_APP_CREDS }}
outputs:
@@ -124,9 +138,70 @@ jobs:
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout
checkout-windows:
needs: setup
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
runs-on: electron-arc-linux-amd64-32core
container:
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
volumes:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
env:
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
TARGET_OS: 'win'
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
outputs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
steps:
- name: Checkout Electron
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout
# GN Check Jobs
macos-gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
needs: checkout-macos
with:
target-platform: macos
target-archs: x64 arm64
check-runs-on: macos-14
gn-build-type: testing
secrets: inherit
linux-gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
needs: checkout-linux
with:
target-platform: linux
target-archs: x64 arm arm64
check-runs-on: electron-arc-linux-amd64-8core
check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
gn-build-type: testing
secrets: inherit
windows-gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
needs: checkout-windows
with:
target-platform: win
target-archs: x64 x86 arm64
check-runs-on: electron-arc-linux-amd64-8core
check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
gn-build-type: testing
secrets: inherit
# Build Jobs - These cascade into testing jobs
macos-x64:
permissions:
@@ -137,7 +212,6 @@ jobs:
needs: checkout-macos
with:
build-runs-on: macos-14-xlarge
check-runs-on: macos-14
test-runs-on: macos-13
target-platform: macos
target-arch: x64
@@ -156,7 +230,6 @@ jobs:
needs: checkout-macos
with:
build-runs-on: macos-14-xlarge
check-runs-on: macos-14
test-runs-on: macos-14
target-platform: macos
target-arch: arm64
@@ -175,7 +248,6 @@ jobs:
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
check-runs-on: electron-arc-linux-amd64-8core
test-runs-on: electron-arc-linux-amd64-4core
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
@@ -196,7 +268,6 @@ jobs:
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
check-runs-on: electron-arc-linux-amd64-8core
test-runs-on: electron-arc-linux-amd64-4core
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
@@ -218,7 +289,6 @@ jobs:
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
check-runs-on: electron-arc-linux-amd64-8core
test-runs-on: electron-arc-linux-arm64-4core
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/test:arm32v7-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init","volumes":["/home/runner/externals:/mnt/runner-externals"]}'
@@ -239,7 +309,6 @@ jobs:
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
check-runs-on: electron-arc-linux-amd64-8core
test-runs-on: electron-arc-linux-arm64-4core
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/test:arm64v8-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
@@ -251,10 +320,67 @@ jobs:
upload-to-storage: '0'
secrets: inherit
windows-x64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: setup
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-windows-amd64-16core
test-runs-on: windows-latest
target-platform: win
target-arch: x64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
windows-x86:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: setup
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-windows-amd64-16core
test-runs-on: windows-latest
target-platform: win
target-arch: x86
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
windows-arm64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: setup
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-windows-amd64-16core
test-runs-on: electron-hosted-windows-arm64-4core
target-platform: win
target-arch: arm64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
gha-done:
name: GitHub Actions Completed
runs-on: ubuntu-latest
needs: [docs-only, macos-x64, macos-arm64, linux-x64, linux-x64-asan, linux-arm, linux-arm64]
needs: [docs-only, macos-x64, macos-arm64, linux-x64, linux-x64-asan, linux-arm, linux-arm64, windows-x64, windows-x86, windows-arm64]
if: always() && !contains(needs.*.result, 'failure')
steps:
- name: GitHub Actions Jobs Done

View File

@@ -1,8 +1,12 @@
name: Clean Source Cache
description: |
This workflow cleans up the source cache on the cross-instance cache volume
to free up space. It runs daily at midnight and clears files older than 15 days.
on:
schedule:
- cron: "0 0 * * SUN" # Run at midnight every Sunday
- cron: "0 0 * * *"
jobs:
clean-src-cache:
@@ -17,5 +21,5 @@ jobs:
shell: bash
run: |
df -h /mnt/cross-instance-cache
find /mnt/cross-instance-cache -type f -mtime +30 -delete
find /mnt/cross-instance-cache -type f -mtime +15 -delete
df -h /mnt/cross-instance-cache

View File

@@ -1,14 +0,0 @@
diff --git a/gclient.py b/gclient.py
index 59e2b4c5197928bdba1ef69bdbe637d7dfe471c1..b4bae5e48c83c84bd867187afaf40eed16e69851 100755
--- a/gclient.py
+++ b/gclient.py
@@ -783,7 +783,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
not condition or "non_git_source" not in condition):
continue
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,
name=name,

View File

@@ -5,7 +5,7 @@ on:
inputs:
target-platform:
type: string
description: 'Platform to run on, can be macos or linux'
description: 'Platform to run on, can be macos, win or linux.'
required: true
target-arch:
type: string
@@ -15,10 +15,6 @@ on:
type: string
description: 'What host to run the build'
required: true
check-runs-on:
type: string
description: 'What host to run the gn-check'
required: true
test-runs-on:
type: string
description: 'What host to run the tests on'
@@ -60,8 +56,8 @@ on:
default: false
concurrency:
group: electron-build-and-test-and-nan-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
group: electron-build-and-test-and-nan-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }}
jobs:
build:
@@ -76,16 +72,6 @@ jobs:
generate-symbols: ${{ inputs.generate-symbols }}
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
with:
target-platform: ${{ inputs.target-platform }}
target-arch: ${{ inputs.target-arch }}
check-runs-on: ${{ inputs.check-runs-on }}
check-container: ${{ inputs.build-container }}
gn-build-type: ${{ inputs.gn-build-type }}
is-asan: ${{ inputs.is-asan }}
secrets: inherit
test:
uses: ./.github/workflows/pipeline-segment-electron-test.yml
needs: build

View File

@@ -5,7 +5,7 @@ on:
inputs:
target-platform:
type: string
description: 'Platform to run on, can be macos or linux'
description: 'Platform to run on, can be macos, win or linux'
required: true
target-arch:
type: string
@@ -15,10 +15,6 @@ on:
type: string
description: 'What host to run the build'
required: true
check-runs-on:
type: string
description: 'What host to run the gn-check'
required: true
test-runs-on:
type: string
description: 'What host to run the tests on'
@@ -60,8 +56,8 @@ on:
default: false
concurrency:
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }}
permissions:
contents: read
@@ -82,16 +78,6 @@ jobs:
upload-to-storage: ${{ inputs.upload-to-storage }}
is-asan: ${{ inputs.is-asan}}
secrets: inherit
gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
with:
target-platform: ${{ inputs.target-platform }}
target-arch: ${{ inputs.target-arch }}
check-runs-on: ${{ inputs.check-runs-on }}
check-container: ${{ inputs.build-container }}
gn-build-type: ${{ inputs.gn-build-type }}
is-asan: ${{ inputs.is-asan }}
secrets: inherit
test:
uses: ./.github/workflows/pipeline-segment-electron-test.yml
needs: build

View File

@@ -24,10 +24,9 @@ jobs:
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies
run: |
cd src/electron
node script/yarn install --frozen-lockfile
uses: ./src/electron/.github/actions/install-dependencies
- name: Run TS/JS compile
shell: bash
run: |

View File

@@ -9,8 +9,11 @@ on:
type: string
concurrency:
group: electron-lint-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
group: electron-lint-${{ github.ref_protected == true && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }}
env:
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
jobs:
lint:
@@ -24,10 +27,11 @@ jobs:
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies
run: |
cd src/electron
node script/yarn install --frozen-lockfile
uses: ./src/electron/.github/actions/install-dependencies
- name: Set Chromium Git Cookie
uses: ./src/electron/.github/actions/set-chromium-cookie
- name: Setup third_party Depot Tools
shell: bash
run: |

View File

@@ -9,11 +9,11 @@ on:
type: string
target-platform:
type: string
description: 'Platform to run on, can be macos or linux'
description: 'Platform to run on, can be macos, win or linux'
required: true
target-arch:
type: string
description: 'Arch to build for, can be x64, arm64 or arm'
description: 'Arch to build for, can be x64, arm64, ia32 or arm'
required: true
target-variant:
type: string
@@ -61,19 +61,24 @@ on:
concurrency:
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }}
env:
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }}
SUDOWOODO_EXCHANGE_TOKEN: ${{ secrets.SUDOWOODO_EXCHANGE_TOKEN }}
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || inputs.target-platform == 'win' && '--custom-var=checkout_win=True' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
ELECTRON_OUT_DIR: Default
jobs:
build:
defaults:
run:
shell: bash
runs-on: ${{ inputs.build-runs-on }}
container: ${{ fromJSON(inputs.build-container) }}
environment: ${{ inputs.environment }}
@@ -81,12 +86,14 @@ jobs:
TARGET_ARCH: ${{ inputs.target-arch }}
steps:
- name: Create src dir
run: mkdir src
run: |
mkdir src
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Free up space (macOS)
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/free-space-macos
@@ -101,9 +108,7 @@ jobs:
cache: yarn
cache-dependency-path: src/electron/yarn.lock
- name: Install Dependencies
run: |
cd src/electron
node script/yarn install --frozen-lockfile
uses: ./src/electron/.github/actions/install-dependencies
- name: Install AZCopy
if: ${{ inputs.target-platform == 'macos' }}
run: brew install azcopy
@@ -122,6 +127,8 @@ jobs:
GN_EXTRA_ARGS='is_asan=true'
fi
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
- name: Set Chromium Git Cookie
uses: ./src/electron/.github/actions/set-chromium-cookie
- name: Get Depot Tools
timeout-minutes: 5
run: |
@@ -137,16 +144,13 @@ jobs:
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
if [ "`uname`" = "Linux" ]; then
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
fi
touch .disable_auto_update
- name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- name: Generate DEPS Hash
run: |
node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')
node src/electron/script/generate-deps-hash.js
DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
- name: Restore src cache via AZCopy
@@ -155,11 +159,17 @@ jobs:
- name: Restore src cache via AKS
if: ${{ inputs.target-platform == 'linux' }}
uses: ./src/electron/.github/actions/restore-cache-aks
- name: Checkout src via gclient sync
if: ${{ inputs.target-platform == 'win' }}
uses: ./src/electron/.github/actions/checkout
with:
use-cache: 'false'
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools
@@ -167,11 +177,11 @@ jobs:
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
- name: Run Electron Only Hooks
run: |
gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
e d gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
- name: Regenerate DEPS Hash
run: |
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
echo "DEPSHASH=$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js
echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
- name: Fix Sync (macOS)
@@ -179,7 +189,7 @@ jobs:
uses: ./src/electron/.github/actions/fix-sync-macos
- name: Setup Number of Ninja Processes
run: |
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform == 'linux' && '300' || '200' }}" >> $GITHUB_ENV
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform != 'macos' && '300' || '200' }}" >> $GITHUB_ENV
- name: Free up space (macOS)
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/free-space-macos
@@ -189,7 +199,7 @@ jobs:
with:
target-arch: ${{ inputs.target-arch }}
target-platform: ${{ inputs.target-platform }}
artifact-platform: ${{ inputs.target-platform == 'linux' && 'linux' || 'darwin' }}
artifact-platform: ${{ inputs.target-platform == 'macos' && 'darwin' || inputs.target-platform }}
is-release: '${{ inputs.is-release }}'
generate-symbols: '${{ inputs.generate-symbols }}'
strip-binaries: '${{ inputs.strip-binaries }}'

View File

@@ -5,11 +5,11 @@ on:
inputs:
target-platform:
type: string
description: 'Platform to run on, can be macos or linux'
description: 'Platform to run on, can be macos, win or linux'
required: true
target-arch:
target-archs:
type: string
description: 'Arch to build for, can be x64, arm64 or arm'
description: 'Archs to check for, can be x64, x86, arm64 or arm space separated'
required: true
check-runs-on:
type: string
@@ -25,35 +25,30 @@ on:
required: true
type: string
default: testing
is-asan:
description: 'Building the Address Sanitizer (ASan) Linux build'
required: false
type: boolean
default: false
concurrency:
group: electron-gn-check-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
group: electron-gn-check-${{ inputs.target-platform }}-${{ github.ref }}
cancel-in-progress: true
env:
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || (inputs.target-platform == 'linux' && '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' || '--custom-var=checkout_win=True') }}
ELECTRON_OUT_DIR: Default
TARGET_ARCH: ${{ inputs.target-arch }}
jobs:
gn-check:
# TODO(codebytere): Change this to medium VM
defaults:
run:
shell: bash
runs-on: ${{ inputs.check-runs-on }}
container: ${{ fromJSON(inputs.check-container) }}
env:
TARGET_ARCH: ${{ inputs.target-arch }}
steps:
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Cleanup disk space on macOS
if: ${{ inputs.target-platform == 'macos' }}
shell: bash
@@ -73,58 +68,40 @@ jobs:
run: df -h
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools
- name: Enable windows toolchain
if: ${{ inputs.target-platform == 'win' }}
run: |
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
- name: Get Depot Tools
timeout-minutes: 5
run: |
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
SEDOPTION="-i"
if [ "`uname`" = "Darwin" ]; then
SEDOPTION="-i ''"
fi
# remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
sed $SEDOPTION '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
if [ "`uname`" = "Linux" ]; then
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
fi
touch .disable_auto_update
- name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- name: Set GN_EXTRA_ARGS for Linux
if: ${{ inputs.target-platform == 'linux' }}
run: |
if [ "${{ inputs.target-arch }}" = "arm" ]; then
GN_EXTRA_ARGS='build_tflite_with_xnnpack=false'
elif [ "${{ inputs.target-arch }}" = "arm64" ]; then
GN_EXTRA_ARGS='fatal_linker_warnings=false enable_linux_installer=false'
fi
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV
- name: Generate DEPS Hash
run: |
node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')
node src/electron/script/generate-deps-hash.js
DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
- name: Restore src cache via AZCopy
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/restore-cache-azcopy
- name: Restore src cache via AKS
if: ${{ inputs.target-platform == 'linux' }}
if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'win' }}
uses: ./src/electron/.github/actions/restore-cache-aks
- name: Run Electron Only Hooks
run: |
gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient
if [ "${{ inputs.target-platform }}" = "win" ]; then
echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False,'install_sysroot':False,'checkout_win':True},'managed':False}]" > tmpgclient
echo "target_os=['win']" >> tmpgclient
fi
e d gclient runhooks --gclientfile=tmpgclient
# Fix VS Toolchain
if [ "${{ inputs.target-platform }}" = "win" ]; then
rm -rf src/third_party/depot_tools/win_toolchain/vs_files
e d python3 src/build/vs_toolchain.py update --force
fi
- name: Regenerate DEPS Hash
run: |
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
echo "DEPSHASH=$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js
echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
- name: Checkout Electron
@@ -132,30 +109,46 @@ jobs:
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies
run: |
cd src/electron
node script/yarn install --frozen-lockfile
uses: ./src/electron/.github/actions/install-dependencies
- name: Default GN gen
run: |
cd src/electron
git pack-refs
cd ..
e build --only-gen
- name: Run GN Check
- name: Run GN Check for ${{ inputs.target-archs }}
run: |
cd src
gn check out/Default //electron:electron_lib
gn check out/Default //electron:electron_app
gn check out/Default //electron/shell/common:mojo
gn check out/Default //electron/shell/common:plugin
for target_cpu in ${{ inputs.target-archs }}
do
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu $target_cpu
cd src
export GN_EXTRA_ARGS="target_cpu=\"$target_cpu\""
if [ "${{ inputs.target-platform }}" = "linux" ]; then
if [ "$target_cpu" = "arm" ]; then
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS build_tflite_with_xnnpack=false"
elif [ "$target_cpu" = "arm64" ]; then
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS fatal_linker_warnings=false enable_linux_installer=false"
fi
fi
if [ "${{ inputs.target-platform }}" = "win" ]; then
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS use_v8_context_snapshot=true target_os=\"win\""
fi
# Check the hunspell filenames
node electron/script/gen-hunspell-filenames.js --check
node electron/script/gen-libc++-filenames.js --check
e build --only-gen
e d gn check out/Default //electron:electron_lib
e d gn check out/Default //electron:electron_app
e d gn check out/Default //electron/shell/common:mojo
e d gn check out/Default //electron/shell/common:plugin
# Check the hunspell filenames
node electron/script/gen-hunspell-filenames.js --check
node electron/script/gen-libc++-filenames.js --check
cd ..
done
- name: Wait for active SSH sessions
if: always() && !cancelled()
shell: bash
run: |
while [ -f /var/.ssh-lock ]
do

View File

@@ -5,7 +5,7 @@ on:
inputs:
target-platform:
type: string
description: 'Platform to run on, can be macos or linux'
description: 'Platform to run on, can be macos, win or linux'
required: true
target-arch:
type: string
@@ -27,8 +27,8 @@ on:
default: false
concurrency:
group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }}
permissions:
contents: read
@@ -36,27 +36,52 @@ permissions:
pull-requests: read
env:
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
ELECTRON_OUT_DIR: Default
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
jobs:
test:
defaults:
run:
shell: bash
runs-on: ${{ inputs.test-runs-on }}
container: ${{ fromJSON(inputs.test-container) }}
strategy:
fail-fast: false
matrix:
build-type: ${{ inputs.target-platform == 'macos' && fromJSON('["darwin","mas"]') || fromJSON('["linux"]') }}
shard: ${{ inputs.target-platform == 'macos' && fromJSON('[1, 2]') || fromJSON('[1, 2, 3]') }}
build-type: ${{ inputs.target-platform == 'macos' && fromJSON('["darwin","mas"]') || (inputs.target-platform == 'win' && fromJSON('["win"]') || fromJSON('["linux"]')) }}
shard: ${{ inputs.target-platform == 'linux' && fromJSON('[1, 2, 3]') || fromJSON('[1, 2]') }}
env:
BUILD_TYPE: ${{ matrix.build-type }}
TARGET_ARCH: ${{ inputs.target-arch }}
ARTIFACT_KEY: ${{ matrix.build-type }}_${{ inputs.target-arch }}
steps:
- name: Fix node20 on arm32 runners
if: ${{ inputs.target-arch == 'arm' }}
if: ${{ inputs.target-arch == 'arm' && inputs.target-platform == 'linux' }}
run: |
cp $(which node) /mnt/runner-externals/node20/bin/
- name: Install Git on Windows arm64 runners
if: ${{ inputs.target-arch == 'arm64' && inputs.target-platform == 'win' }}
shell: powershell
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install -y --no-progress git.install --params "'/GitAndUnixToolsOnPath'"
choco install -y --no-progress git
choco install -y --no-progress python --version 3.11.9
choco install -y --no-progress visualstudio2022-workload-vctools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.ARM64"
echo "C:\Program Files\Git\cmd" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\Python311" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
- name: Setup Node.js/npm
if: ${{ inputs.target-platform == 'win' }}
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
with:
node-version: 20.11.x
- name: Add TCC permissions on macOS
if: ${{ inputs.target-platform == 'macos' }}
run: |
@@ -95,24 +120,20 @@ jobs:
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies
run: |
cd src/electron
node script/yarn install --frozen-lockfile
uses: ./src/electron/.github/actions/install-dependencies
- name: Set Chromium Git Cookie
uses: ./src/electron/.github/actions/set-chromium-cookie
- name: Get Depot Tools
timeout-minutes: 5
run: |
git config --global core.filemode false
git config --global core.autocrlf false
git config --global branch.autosetuprebase always
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
if [ "`uname`" = "Darwin" ]; then
# remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
sed -i '' '/ninjalog_uploader_wrapper.py/d' ./autoninja
else
sed -i '/ninjalog_uploader_wrapper.py/d' ./autoninja
# Remove swift-format dep from cipd on macOS until we send a patch upstream.
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
fi
touch .disable_auto_update
- name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
@@ -134,7 +155,17 @@ jobs:
path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
- name: Restore Generated Artifacts
run: ./src/electron/script/actions/restore-artifacts.sh
- name: Unzip Dist, Mksnapshot & Chromedriver
- name: Unzip Dist, Mksnapshot & Chromedriver (win)
if: ${{ inputs.target-platform == 'win' }}
shell: powershell
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force
cd src/out/Default
Expand-Archive -Force dist.zip -DestinationPath ./
Expand-Archive -Force chromedriver.zip -DestinationPath ./
Expand-Archive -Force mksnapshot.zip -DestinationPath ./
- name: Unzip Dist, Mksnapshot & Chromedriver (unix)
if: ${{ inputs.target-platform != 'win' }}
run: |
cd src/out/Default
unzip -:o dist.zip
@@ -158,15 +189,24 @@ jobs:
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
DISPLAY: ':99.0'
NPM_CONFIG_MSVS_VERSION: '2022'
run: |
cd src/electron
export ELECTRON_TEST_RESULTS_DIR=`pwd`/junit
# Get which tests are on this shard
tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ inputs.target-platform == 'macos' && 2 || 3 }})
tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ inputs.target-platform == 'linux' && 3 || 2 }})
# Run tests
if [ "`uname`" = "Darwin" ]; then
if [ "${{ inputs.target-platform }}" != "linux" ]; then
echo "About to start tests"
if [ "${{ inputs.target-platform }}" = "win" ]; then
if [ "${{ inputs.target-arch }}" = "x86" ]; then
export npm_config_arch="ia32"
fi
if [ "${{ inputs.target-arch }}" = "arm64" ]; then
export ELECTRON_FORCE_TEST_SUITE_EXIT="true"
fi
fi
node script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
else
chown :builduser .. && chmod g+w ..
@@ -197,19 +237,21 @@ jobs:
DD_CIVISIBILITY_LOGS_ENABLED: true
DD_TAGS: "os.architecture:${{ inputs.target-arch }},os.family:${{ inputs.target-platform }},os.platform:${{ inputs.target-platform }},asan:${{ inputs.is-asan }}"
run: |
if ! [ -z $DD_API_KEY ]; then
datadog-ci junit upload src/electron/junit/test-results-main.xml
if ! [ -z $DD_API_KEY ] && [ -f src/electron/junit/test-results-main.xml ]; then
export DATADOG_PATH=`node src/electron/script/yarn global bin`
$DATADOG_PATH/datadog-ci junit upload src/electron/junit/test-results-main.xml
fi
if: always() && !cancelled()
- name: Upload Test Artifacts
if: always() && !cancelled()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
with:
name: test_artifacts_${{ env.ARTIFACT_KEY }}
name: test_artifacts_${{ env.ARTIFACT_KEY }}_${{ matrix.shard }}
path: src/electron/spec/artifacts
if-no-files-found: ignore
- name: Wait for active SSH sessions
if: always() && !cancelled()
shell: bash
run: |
while [ -f /var/.ssh-lock ]
do

View File

@@ -5,7 +5,7 @@ on:
inputs:
target-platform:
type: string
description: 'Platform to run on, can be macos or linux'
description: 'Platform to run on, can be macos, win or linux'
required: true
target-arch:
type: string
@@ -27,10 +27,11 @@ on:
default: testing
concurrency:
group: electron-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
group: electron-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }}
env:
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
ELECTRON_OUT_DIR: Default
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
@@ -38,7 +39,7 @@ jobs:
node-tests:
name: Run Node.js Tests
runs-on: electron-arc-linux-amd64-8core
timeout-minutes: 20
timeout-minutes: 30
env:
TARGET_ARCH: ${{ inputs.target-arch }}
BUILD_TYPE: linux
@@ -49,23 +50,22 @@ jobs:
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools
run: |
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
- name: Install Dependencies
run: |
cd src/electron
node script/yarn install --frozen-lockfile
uses: ./src/electron/.github/actions/install-dependencies
- name: Set Chromium Git Cookie
uses: ./src/electron/.github/actions/set-chromium-cookie
- name: Get Depot Tools
timeout-minutes: 5
run: |
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
touch .disable_auto_update
- name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
@@ -93,6 +93,7 @@ jobs:
node electron/script/node-spec-runner.js --default --jUnitDir=junit
- name: Wait for active SSH sessions
if: always() && !cancelled()
shell: bash
run: |
while [ -f /var/.ssh-lock ]
do
@@ -101,7 +102,7 @@ jobs:
nan-tests:
name: Run Nan Tests
runs-on: electron-arc-linux-amd64-4core
timeout-minutes: 20
timeout-minutes: 30
env:
TARGET_ARCH: ${{ inputs.target-arch }}
BUILD_TYPE: linux
@@ -112,23 +113,22 @@ jobs:
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools
run: |
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
- name: Install Dependencies
run: |
cd src/electron
node script/yarn install --frozen-lockfile
uses: ./src/electron/.github/actions/install-dependencies
- name: Set Chromium Git Cookie
uses: ./src/electron/.github/actions/set-chromium-cookie
- name: Get Depot Tools
timeout-minutes: 5
run: |
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
touch .disable_auto_update
- name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
@@ -155,6 +155,7 @@ jobs:
cd src
node electron/script/nan-spec-runner.js
- name: Wait for active SSH sessions
shell: bash
if: always() && !cancelled()
run: |
while [ -f /var/.ssh-lock ]

View File

@@ -15,12 +15,12 @@ jobs:
- name: Trigger Slack workflow
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
with:
webhook: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
{
"url": "${{ github.event.pull_request.html_url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
pull-request-labeled-deprecation-review-complete:
name: deprecation-review/complete label added
if: github.event.label.name == 'deprecation-review/complete ✅'

View File

@@ -1,73 +0,0 @@
name: Update AppVeyor Image
# Run chron daily Mon-Fri
on:
workflow_dispatch:
schedule:
- cron: '0 8 * * 1-5' # runs 8:00 every business day (see https://crontab.guru)
permissions: {}
jobs:
bake-appveyor-image:
name: Bake AppVeyor Image
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token
with:
creds: ${{ secrets.APPVEYOR_UPDATER_GH_APP_CREDS }}
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}
- name: Yarn install
run: |
node script/yarn.js install --frozen-lockfile
- name: Set Repo for Commit
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Check AppVeyor Image
env:
APPVEYOR_TOKEN: ${{ secrets.APPVEYOR_TOKEN }}
run: |
node ./script/prepare-appveyor
if [ -f ./image_version.txt ]; then
echo "APPVEYOR_IMAGE_VERSION="$(cat image_version.txt)"" >> $GITHUB_ENV
rm image_version.txt
fi
- name: (Optionally) Update Appveyor Image
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
uses: mikefarah/yq@bbdd97482f2d439126582a59689eb1c855944955 # v4.44.3
with:
cmd: |
yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor.yml" > "appveyor2.yml"
yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor-woa.yml" > "appveyor-woa2.yml"
- name: (Optionally) Generate Commit Diff
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
diff -w -B appveyor.yml appveyor2.yml > appveyor.diff || true
patch -f appveyor.yml < appveyor.diff
rm appveyor2.yml appveyor.diff
git add appveyor.yml
- name: (Optionally) Generate Commit Diff for WOA
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
diff -w -B appveyor-woa.yml appveyor-woa2.yml > appveyor-woa.diff || true
patch -f appveyor-woa.yml < appveyor-woa.diff
rm appveyor-woa2.yml appveyor-woa.diff
git add appveyor-woa.yml
- name: (Optionally) Commit to Branch
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
uses: dsanders11/github-app-commit-action@43de6da2f4d927e997c0784c7a0b61bd19ad6aac # v1.5.0
with:
message: 'build: update appveyor image to latest version'
ref: bump-appveyor-image
token: ${{ steps.generate-token.outputs.token }}
- name: (Optionally) Create Pull Request
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
printf "This PR updates appveyor.yml to the latest baked image, ${{ env.APPVEYOR_IMAGE_VERSION }}.\n\nNotes: none" | gh pr create --head bump-appveyor-image --label no-backport --label semver/none --title 'build: update appveyor image to latest version' --body-file=-
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}

84
.github/workflows/windows-publish.yml vendored Normal file
View File

@@ -0,0 +1,84 @@
name: Publish Windows
on:
workflow_dispatch:
inputs:
build-image-sha:
type: string
description: 'SHA for electron/build image'
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
required: true
upload-to-storage:
description: 'Uploads to Azure storage'
required: false
default: '1'
type: string
run-windows-publish:
description: 'Run the publish jobs vs just the build jobs'
type: boolean
default: false
jobs:
checkout-windows:
runs-on: electron-arc-linux-amd64-32core
container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
volumes:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
env:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
TARGET_OS: 'win'
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
outputs:
build-image-sha: ${{ inputs.build-image-sha }}
steps:
- name: Checkout Electron
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with:
path: src/electron
fetch-depth: 0
- name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout
publish-x64-win:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-windows
with:
environment: production-release
build-runs-on: electron-arc-windows-amd64-16core
target-platform: win
target-arch: x64
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-arm64-win:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-windows
with:
environment: production-release
build-runs-on: electron-arc-windows-amd64-16core
target-platform: win
target-arch: arm64
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-x86-win:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-windows
with:
environment: production-release
build-runs-on: electron-arc-windows-amd64-16core
target-platform: win
target-arch: x86
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit

1
.gitignore vendored
View File

@@ -48,7 +48,6 @@ ts-gen
# Used to accelerate CI builds
.depshash
.depshash-target
# Used to accelerate builds after sync
patches/mtime-cache.json

View File

@@ -427,6 +427,7 @@ source_set("electron_lib") {
"chromium_src:chrome_spellchecker",
"shell/common:mojo",
"shell/common:plugin",
"shell/common:web_contents_utility",
"shell/services/node/public/mojom",
"//base:base_static",
"//base/allocator:buildflags",

View File

@@ -12,7 +12,7 @@ propose changes to this document in a pull request.
## [Issues](https://electronjs.org/docs/development/issues)
Issues are created [here](https://github.com/electron/electron/issues/new).
Issues are created [here](https://github.com/electron/electron/issues/new/choose).
* [How to Contribute in Issues](https://electronjs.org/docs/development/issues#how-to-contribute-in-issues)
* [Asking for General Help](https://electronjs.org/docs/development/issues#asking-for-general-help)

4
DEPS
View File

@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'132.0.6834.6',
'132.0.6834.210',
'node_version':
'v20.18.0',
'v20.18.3',
'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version':

View File

@@ -1,107 +0,0 @@
# The config is used to bake appveyor images, not for running CI jobs.
# The config expects the following environment variables to be set:
# - "APPVEYOR_BAKE_IMAGE" e.g. 'electron-99.0.4767.0'. Name of the image to be baked.
# Typically named after the Chromium version on which the image is built.
# This can be set dynamically in the prepare-appveyor script.
version: 1.0.{build}
build_cloud: electronhq-16-core
image: base-bake-image
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
PYTHONIOENCODING: UTF-8
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# init:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - appveyor version
# - ps: $ErrorActionPreference = 'Stop'
# - ps: 'Write-Host "OS Build: $((Get-CimInstance Win32_OperatingSystem).BuildNumber)"'
# clone_folder: '%USERPROFILE%\image-bake-scripts'
# clone_script:
# - ps: Invoke-WebRequest "https://github.com/appveyor/build-images/archive/1f90d94e74c8243c909a09b994e527584dfcb838.zip" -OutFile "$env:temp\scripts.zip"
# - ps: Expand-Archive -Path "$env:temp\scripts.zip" -DestinationPath "$env:temp\scripts" -Force
# - ps: Copy-Item -Path "$env:temp\scripts\build-images-1f90d94e74c8243c909a09b994e527584dfcb838\scripts\Windows\*" -Destination $env:APPVEYOR_BUILD_FOLDER -Recurse
build_script:
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# - ps: .\init_server.ps1
# - ps: .\extend_system_volume.ps1
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# - appveyor version
# - ps: .\install_path_utils.ps1
# - ps: .\install_powershell_core.ps1
# - ps: .\install_powershell_get.ps1
# - ps: .\install_7zip.ps1
# - ps: .\install_chocolatey.ps1
# - ps: .\install_webpi.ps1
# - ps: .\install_nuget.ps1
# - ps: .\install_pstools.ps1
# - ps: .\install_git.ps1
# - ps: .\install_git_lfs.ps1
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# END LINES FOR COMPLETELY NEW IMAGE
- git config --global core.longpaths true
- ps: >-
if (-not (Test-Path -Path C:\projects\src)) {
New-Item -Path C:\projects\src -ItemType Directory
}
- cd C:\projects\
- git clone -q --branch=%APPVEYOR_REPO_BRANCH% https://github.com/electron/electron.git C:\projects\src\electron
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- update_depot_tools.bat
# Uncomment the following line if windows deps change
- src\electron\script\setup-win-for-dev.bat
- >-
gclient config
--name "src\electron"
--unmanaged
%GCLIENT_EXTRA_ARGS%
"https://github.com/electron/electron"
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: Copy-Item -path .\.depshash -destination ..\.depshash
- ps: cd ..\..
- gclient sync --with_branch_heads --with_tags --nohooks
- ps: regsvr32 /s "C:\Program Files\Microsoft Visual Studio\2022\Community\DIA SDK\bin\amd64\msdia140.dll"
- ps: set vs2022_install="C:\Program Files\Microsoft Visual Studio\2022\Community"
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# - cd %USERPROFILE%\image-bake-scripts
# - appveyor version
# - ps: .\optimize_dotnet_runtime.ps1
# - ps: .\disable_windows_background_services.ps1
# - ps: .\enforce_windows_firewall.ps1
# - ps: .\cleanup_windows.ps1
# END LINES FOR COMPLETELY NEW IMAGE
on_image_bake:
- ps: >-
echo "Baking image: $env:APPVEYOR_BAKE_IMAGE at dir $PWD"
- ps: Remove-Item -Recurse -Force C:\projects\depot_tools
- ps: Remove-Item -Recurse -Force C:\projects\src\electron
# Uncomment these lines and set APPVEYOR_RDP_PASSWORD in project settings to enable RDP after bake is done
# # on_finish:
# - ps: >-
# $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

View File

@@ -1,352 +0,0 @@
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor.yml
# IF APPLICABLE!!!!
#
#
# The config expects the following environment variables to be set:
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
# https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
# if you pass a custom value for 'target_cpu'.
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64'}.
# Is used in some publishing scripts, but does NOT affect the Electron binary.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
# Otherwise the release will be uploaded to the GitHub Releases.
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
#
# The publishing scripts expect access tokens to be defined as env vars,
# but those are not covered here.
#
# AppVeyor docs on variables:
# https://www.appveyor.com/docs/environment-variables/
# https://www.appveyor.com/docs/build-configuration/#secure-variables
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-132.0.6824.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-reporter, tap"
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_7393122652: 3ba76c5c20
PYTHONIOENCODING: UTF-8
matrix:
- job_name: Build Arm on X64 Windows
- job_name: Test On Windows On Arm Hardware 1
job_depends_on: Build Arm on X64 Windows
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
shard: 1
- job_name: Test On Windows On Arm Hardware 2
job_depends_on: Build Arm on X64 Windows
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
shard: 2
clone_script:
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
clone_folder: C:\projects\src\electron
skip_branch_with_pr: true
# the first failed job cancels other jobs and fails entire build
matrix:
fast_finish: true
for:
- matrix:
only:
- job_name: Build Arm on X64 Windows
build_script:
# TODO: Remove --ignore-engines once WOA image is up to node 20
- ps: |
node script/yarn.js install --frozen-lockfile --ignore-engines
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc-only change"
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- ps: >-
if (Test-Path -Path "$pwd\depot_tools") {
Remove-Item -Recurse -Force $pwd\depot_tools
}
- ps: >-
if (Test-Path -Path "$pwd\build-tools") {
Remove-Item -Recurse -Force $pwd\build-tools
}
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
- depot_tools\bootstrap\win_tools.bat
- ps: |
Set-Content -Path $pwd\depot_tools\build_telemetry.cfg -Value '{"user": "info@electronjs.org", "status": "opt-out", "countdown": 10, "version": 1}'
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npx yarn --ignore-engines
- mkdir third_party
- ps: >-
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
- ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})"
- ps: >-
& $env:RECLIENT_HELPER login
- ps: >-
$env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
- ps: >-
$env:RBE_credentials_helper = $env:RECLIENT_HELPER
- ps: >-
$env:RBE_credentials_helper_args = "print"
- ps: >-
if ($env:ELECTRON_RBE_JWT -eq '') {
$env:RBE_fail_early_min_action_count = "0"
$env:RBE_fail_early_min_fallback_ratio = "0"
}
- cd ..\..
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
# Patches are applied in the image bake. Check depshash to see if patches have changed.
- ps: $env:RUN_GCLIENT_SYNC="false"
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: cd ..\..
- ps: >-
if ($depshash_baked -ne $depshash) {
$env:RUN_GCLIENT_SYNC="true"
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
- cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common:mojo
- gn check out/Default //electron/shell/common:plugin
- autoninja -j 300 -C out/Default electron:electron_app
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
- autoninja -C out/Default electron:electron_dist_zip
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args
- ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
- autoninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- autoninja -C out/Default electron:hunspell_dictionaries_zip
- autoninja -C out/Default electron:electron_chromedriver_zip
- autoninja -C out/Default electron:node_headers
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
- 7z a nan.zip third_party\nan
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
}
- if "%GN_CONFIG%"=="release" ( autoninja -C out/Default electron:electron_symbols )
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
}
- ps: |
$manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:TARGET_ARCH.manifest"
python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
if ($LASTEXITCODE -ne 0) {
throw "Zip contains files not listed in the manifest $manifest_file"
}
- ps: |
cd C:\projects\src
$missing_artifacts = $false
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
} else {
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip','nan.zip'
foreach($artifact_name in $artifacts_to_validate) {
if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\ffmpeg\ffmpeg.zip"
} elseif (
$artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name
} elseif (
$artifact_name -eq 'nan.zip') {
$artifact_file = $artifact_name
} else {
$artifact_file = "out\Default\$artifact_name"
}
if (-not(Test-Path $artifact_file)) {
Write-warning "$artifact_name is missing and cannot be added to artifacts"
$missing_artifacts = $true
}
}
}
if ($missing_artifacts) {
throw "Build failed due to missing artifacts"
}
deploy_script:
- cd electron
- ps: >-
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
Write-Output "Uploading Electron release distribution to azure"
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
} else {
Write-Output "Uploading Electron release distribution to github releases"
& python3 script\release\uploaders\upload.py --verbose
}
}
on_finish:
# Uncomment this lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist nan.zip (appveyor-retry appveyor PushArtifact nan.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
}
- matrix:
only:
- job_name: Test On Windows On Arm Hardware 1
- job_name: Test On Windows On Arm Hardware 2
environment:
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: C:\projects\src\electron\junit
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-reporter, tap"
MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
DD_ENV: ci
DD_SERVICE: electron
DD_CIVISIBILITY_LOGS_ENABLED: true
DD_GIT_REPOSITORY_URL: "https://github.com/electron/electron.git"
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile --ignore-engines
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- ps: Invoke-WebRequest -Uri "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_win-x64" -OutFile "C:\projects\src\electron\datadog-ci.exe"
- cd ..
- mkdir out\Default
- cd ..
- ps: |
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','electron.lib', 'nan.zip')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build Arm on X64 Windows") {
$jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name"
} else {
$outfile = $artifact_name
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
7z x -y -osrc pdb.zip
}
}
- ps: |
$out_default_zips = @('dist.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip
- ps: 7z x -y -osrc nan.zip
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
- ps: |
cd src
New-Item .\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
- set npm_config_nodedir=%cd%\out\Default\gen\node_headers
- set npm_config_arch=arm64
- cd electron
# Explicitly set npm_config_arch because the .env doesn't persist
- ps: >-
if ($env:TARGET_ARCH -eq 'ia32') {
$env:npm_config_arch = "ia32"
}
- ps: $env:tests_files=node script\split-tests $env:shard 2
- echo "Running shard %shard% specs %tests_files%"
- echo Running main test suite & node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion --files %tests_files%
- cd ..
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
on_finish:
# Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if exist electron\junit\test-results-main.xml ( appveyor-retry appveyor PushArtifact electron\junit\test-results-main.xml )
- ps: |
if ($env:DD_API_KEY) {
$env:DD_GIT_COMMIT_SHA = $env:APPVEYOR_REPO_COMMIT
$env:DD_GIT_BRANCH = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH
$env:DD_TAGS = "os.architecture:$env:TARGET_ARCH,os.family:windows,os.platform:win32"
if (Test-Path -Path "C:\projects\src\electron\junit\test-results-main.xml") {
C:\projects\src\electron\datadog-ci.exe junit upload --verbose C:\projects\src\electron\junit\test-results-main.xml
}
}

View File

@@ -1,345 +0,0 @@
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor-woa.yml
# IF APPLICABLE!!!!
#
#
# The config expects the following environment variables to be set:
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
# https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
# if you pass a custom value for 'target_cpu'.
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64'}.
# Is used in some publishing scripts, but does NOT affect the Electron binary.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
# Otherwise the release will be uploaded to the GitHub Releases.
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
#
# The publishing scripts expect access tokens to be defined as env vars,
# but those are not covered here.
#
# AppVeyor docs on variables:
# https://www.appveyor.com/docs/environment-variables/
# https://www.appveyor.com/docs/build-configuration/#secure-variables
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-132.0.6824.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-reporter, tap"
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_7393122652: 3ba76c5c20
PYTHONIOENCODING: UTF-8
matrix:
- job_name: Build
- job_name: Test 1
job_depends_on: Build
shard: 1
- job_name: Test 2
job_depends_on: Build
shard: 2
clone_script:
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
clone_folder: C:\projects\src\electron
skip_branch_with_pr: true
# the first failed job cancels other jobs and fails entire build
matrix:
fast_finish: true
for:
- matrix:
only:
- job_name: Build
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc-only change"
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- ps: >-
if (Test-Path -Path "$pwd\depot_tools") {
Remove-Item -Recurse -Force $pwd\depot_tools
}
- ps: >-
if (Test-Path -Path "$pwd\build-tools") {
Remove-Item -Recurse -Force $pwd\build-tools
}
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
- depot_tools\bootstrap\win_tools.bat
- ps: |
Set-Content -Path $pwd\depot_tools\build_telemetry.cfg -Value '{"user": "info@electronjs.org", "status": "opt-out", "countdown": 10, "version": 1}'
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npx yarn --ignore-engines
- mkdir third_party
- ps: >-
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
- ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})"
- ps: >-
& $env:RECLIENT_HELPER login
- ps: >-
$env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
- ps: >-
$env:RBE_credentials_helper = $env:RECLIENT_HELPER
- ps: >-
$env:RBE_credentials_helper_args = "print"
- ps: >-
if ($env:ELECTRON_RBE_JWT -eq '') {
$env:RBE_fail_early_min_action_count = "0"
$env:RBE_fail_early_min_fallback_ratio = "0"
}
- cd ..\..
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
# Patches are applied in the image bake. Check depshash to see if patches have changed.
- ps: $env:RUN_GCLIENT_SYNC="false"
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: cd ..\..
- ps: >-
if ($depshash_baked -ne $depshash) {
$env:RUN_GCLIENT_SYNC="true"
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
- cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common:mojo
- gn check out/Default //electron/shell/common:plugin
- autoninja -j 300 -C out/Default electron:electron_app
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
- autoninja -C out/Default electron:electron_dist_zip
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args
- ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
- autoninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- autoninja -C out/Default electron:hunspell_dictionaries_zip
- autoninja -C out/Default electron:electron_chromedriver_zip
- autoninja -C out/Default electron:node_headers
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
}
- if "%GN_CONFIG%"=="release" ( autoninja -C out/Default electron:electron_symbols )
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
}
- ps: |
$manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:TARGET_ARCH.manifest"
python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
if ($LASTEXITCODE -ne 0) {
throw "Zip contains files not listed in the manifest $manifest_file"
}
- ps: |
cd C:\projects\src
$missing_artifacts = $false
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
} else {
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip'
foreach($artifact_name in $artifacts_to_validate) {
if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\ffmpeg\ffmpeg.zip"
} elseif (
$artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name
} else {
$artifact_file = "out\Default\$artifact_name"
}
if (-not(Test-Path $artifact_file)) {
Write-warning "$artifact_name is missing and cannot be added to artifacts"
$missing_artifacts = $true
}
}
}
if ($missing_artifacts) {
throw "Build failed due to missing artifacts"
}
deploy_script:
- cd electron
- ps: >-
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
Write-Output "Uploading Electron release distribution to azure"
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
} else {
Write-Output "Uploading Electron release distribution to github releases"
& python3 script\release\uploaders\upload.py --verbose
}
}
on_finish:
# Uncomment this lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
}
- matrix:
only:
- job_name: Test 1
- job_name: Test 2
environment:
DD_ENV: ci
DD_SERVICE: electron
DD_CIVISIBILITY_LOGS_ENABLED: true
DD_GIT_REPOSITORY_URL: "https://github.com/electron/electron.git"
ELECTRON_TEST_RESULTS_DIR: C:\projects\src\electron\junit
init:
- ps: |
if ($env:RUN_TESTS -ne 'true') {
Write-warning "Skipping tests for $env:APPVEYOR_PROJECT_NAME"; Exit-AppveyorBuild
}
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- npm install -g @datadog/datadog-ci
- cd ..
- mkdir out\Default
- cd ..
- ps: |
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build") {
$jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name"
} else {
$outfile = $artifact_name
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
7z x -y -osrc pdb.zip
}
}
- ps: |
$out_default_zips = @('dist.zip','chromedriver.zip','mksnapshot.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
- ps: |
cd src
New-Item .\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
- cd electron
# Explicitly set npm_config_arch because the .env doesn't persist
- ps: >-
if ($env:TARGET_ARCH -eq 'ia32') {
$env:npm_config_arch = "ia32"
}
- ps: $env:tests_files=node script\split-tests $env:shard 2
- echo "Running shard %shard% specs %tests_files%"
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging --files %tests_files%
- cd ..
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
- echo "About to verify mksnapshot"
- echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd%
- echo "Done verifying mksnapshot"
- echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd%
- echo "Done verifying chromedriver"
on_finish:
# Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if exist electron\junit\test-results-main.xml ( appveyor-retry appveyor PushArtifact electron\junit\test-results-main.xml )
- ps: |
if ($env:RUN_TESTS -eq 'true' -And $env:DD_API_KEY) {
$env:DD_GIT_COMMIT_SHA = $env:APPVEYOR_REPO_COMMIT
$env:DD_GIT_BRANCH = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH
$env:DD_TAGS = "os.architecture:$env:TARGET_ARCH,os.family:windows,os.platform:win32"
if (Test-Path -Path "C:\projects\src\electron\junit\test-results-main.xml") {
C:\Users\appveyor\AppData\Roaming\npm\datadog-ci.ps1 junit upload --verbose C:\projects\src\electron\junit\test-results-main.xml
}
}

View File

@@ -59,7 +59,7 @@ def skip_path(dep, dist_zip, target_cpu):
and dep == "snapshot_blob.bin"
)
)
if should_skip:
if should_skip and os.environ.get('ELECTRON_DEBUG_ZIP_SKIP') == '1':
print("Skipping {}".format(dep))
return should_skip

View File

@@ -160,14 +160,12 @@ static_library("chrome") {
"//chrome/browser/icon_loader_win.cc",
"//chrome/browser/media/webrtc/window_icon_util_win.cc",
"//chrome/browser/process_singleton_win.cc",
"//chrome/browser/ui/frame/window_frame_util.h",
"//chrome/browser/win/chrome_process_finder.cc",
"//chrome/browser/win/chrome_process_finder.h",
"//chrome/browser/win/chrome_select_file_dialog_factory.cc",
"//chrome/browser/win/chrome_select_file_dialog_factory.h",
"//chrome/browser/win/titlebar_config.cc",
"//chrome/browser/win/titlebar_config.h",
"//chrome/browser/win/titlebar_config.h",
"//chrome/browser/win/util_win_service.cc",
"//chrome/browser/win/util_win_service.h",
"//chrome/child/v8_crashpad_support_win.cc",

View File

@@ -21,7 +21,6 @@ an issue:
### Getting started
* [Introduction](tutorial/introduction.md)
* [Quick Start](tutorial/quick-start.md)
* [Process Model](tutorial/process-model.md)
### Learning the basics

View File

@@ -514,20 +514,20 @@ and `will-quit` events will not be emitted.
* `args` string[] (optional)
* `execPath` string (optional)
Relaunches the app when current instance exits.
Relaunches the app when the current instance exits.
By default, the new instance will use the same working directory and command line
arguments with current instance. When `args` is specified, the `args` will be
passed as command line arguments instead. When `execPath` is specified, the
`execPath` will be executed for relaunch instead of current app.
arguments as the current instance. When `args` is specified, the `args` will be
passed as the command line arguments instead. When `execPath` is specified, the
`execPath` will be executed for the relaunch instead of the current app.
Note that this method does not quit the app when executed, you have to call
Note that this method does not quit the app when executed. You have to call
`app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
When `app.relaunch` is called for multiple times, multiple instances will be
started after current instance exited.
When `app.relaunch` is called multiple times, multiple instances will be
started after the current instance exits.
An example of restarting current instance immediately and adding a new command
An example of restarting the current instance immediately and adding a new command
line argument to the new instance:
```js

View File

@@ -313,6 +313,12 @@ Set the default value of the `verbatim` parameter in the Node.js [`dns.lookup()`
The default is `verbatim` and `dns.setDefaultResultOrder()` have higher priority than `--dns-result-order`.
### `--diagnostic-dir=directory`
Set the directory to which all Node.js diagnostic output files are written. Defaults to current working directory.
Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https://nodejs.org/docs/latest/api/v8.html#v8setheapsnapshotnearheaplimitlimit).
[app]: app.md
[append-switch]: command-line.md#commandlineappendswitchswitch-value
[debugging-main-process]: ../tutorial/debugging-main-process.md

View File

@@ -32,7 +32,7 @@ process, see [webContents.send][web-contents-send] for more information.
## Methods
The `ipcMain` module has the following method to listen for events:
The `ipcMain` module has the following methods to listen for events:
### `ipcMain.on(channel, listener)`
@@ -44,6 +44,16 @@ The `ipcMain` module has the following method to listen for events:
Listens to `channel`, when a new message arrives `listener` would be called with
`listener(event, args...)`.
### `ipcMain.off(channel, listener)`
* `channel` string
* `listener` Function
* `event` [IpcMainEvent][ipc-main-event]
* `...args` any[]
Removes the specified `listener` from the listener array for the specified
`channel`.
### `ipcMain.once(channel, listener)`
* `channel` string
@@ -54,20 +64,28 @@ Listens to `channel`, when a new message arrives `listener` would be called with
Adds a one time `listener` function for the event. This `listener` is invoked
only the next time a message is sent to `channel`, after which it is removed.
### `ipcMain.addListener(channel, listener)`
* `channel` string
* `listener` Function
* `event` [IpcMainEvent][ipc-main-event]
* `...args` any[]
Alias for [`ipcMain.on`](#ipcmainonchannel-listener).
### `ipcMain.removeListener(channel, listener)`
* `channel` string
* `listener` Function
* `...args` any[]
Removes the specified `listener` from the listener array for the specified
`channel`.
Alias for [`ipcMain.off`](#ipcmainoffchannel-listener).
### `ipcMain.removeAllListeners([channel])`
* `channel` string (optional)
Removes listeners of the specified `channel`.
Removes all listeners from the specified `channel`. Removes all listeners from all channels if no channel is specified.
### `ipcMain.handle(channel, listener)`

View File

@@ -41,6 +41,16 @@ The `ipcRenderer` module has the following method to listen for events and send
Listens to `channel`, when a new message arrives `listener` would be called with
`listener(event, args...)`.
:::warning
Do not expose the `event` argument to the renderer for security reasons! Wrap any
callback that you receive from the renderer in another function like this:
`ipcRenderer.on('my-channel', (event, ...args) => callback(...args))`.
Not wrapping the callback in such a function would expose dangerous Electron APIs
to the renderer process. See the
[security guide](../tutorial/security.md#20-do-not-expose-electron-apis-to-untrusted-web-content)
for more info.
:::
### `ipcRenderer.off(channel, listener)`
* `channel` string
@@ -48,7 +58,8 @@ Listens to `channel`, when a new message arrives `listener` would be called with
* `event` [IpcRendererEvent][ipc-renderer-event]
* `...args` any[]
Alias for [`ipcRenderer.removeListener`](#ipcrendererremovelistenerchannel-listener).
Removes the specified `listener` from the listener array for the specified
`channel`.
### `ipcRenderer.once(channel, listener)`
@@ -76,14 +87,13 @@ Alias for [`ipcRenderer.on`](#ipcrendereronchannel-listener).
* `event` [IpcRendererEvent][ipc-renderer-event]
* `...args` any[]
Removes the specified `listener` from the listener array for the specified
`channel`.
Alias for [`ipcRenderer.off`](#ipcrendereroffchannel-listener).
### `ipcRenderer.removeAllListeners(channel)`
### `ipcRenderer.removeAllListeners([channel])`
* `channel` string
* `channel` string (optional)
Removes all listeners, or those of the specified `channel`.
Removes all listeners from the specified `channel`. Removes all listeners from all channels if no channel is specified.
### `ipcRenderer.send(channel, ...args)`

View File

@@ -72,7 +72,7 @@ The `menu` object has the following instance methods:
#### `menu.popup([options])`
* `options` Object (optional)
* `window` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
* `x` number (optional) - Default is the current mouse cursor position.
Must be declared if `y` is declared.
* `y` number (optional) - Default is the current mouse cursor position.
@@ -86,13 +86,13 @@ The `menu` object has the following instance methods:
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.
* `callback` Function (optional) - Called when menu is closed.
Pops up this menu as a context menu in the [`BrowserWindow`](browser-window.md).
Pops up this menu as a context menu in the [`BaseWindow`](base-window.md).
#### `menu.closePopup([browserWindow])`
#### `menu.closePopup([window])`
* `browserWindow` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
Closes the context menu in the `browserWindow`.
Closes the context menu in the `window`.
#### `menu.append(menuItem)`

View File

@@ -5,7 +5,16 @@
Process: [Main](../glossary.md#main-process)<br />
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
Each navigation entry corresponds to a specific page. The indexing system follows a sequential order, where the first available navigation entry is at index 0, representing the earliest visited page, and the latest navigation entry is at index N, representing the most recent page. Maintaining this ordered list of navigation entries enables seamless navigation both backward and forward through the user's browsing history.
Each [NavigationEntry](./structures/navigation-entry.md) corresponds to a specific visited page.
The indexing system follows a sequential order, where the entry for the earliest visited
page is at index 0 and the entry for the most recent visited page is at index N.
Some APIs in this class also accept an _offset_, which is an integer representing the relative
position of an index from the current entry according to the above indexing system (i.e. an offset
value of `1` would represent going forward in history by one page).
Maintaining this ordered list of navigation entries enables seamless navigation both backward and
forward through the user's browsing history.
### Instance Methods
@@ -21,7 +30,7 @@ Returns `boolean` - Whether the browser can go forward to next web page.
* `offset` Integer
Returns `boolean` - Whether the web page can go to the specified `offset` from the current entry.
Returns `boolean` - Whether the web page can go to the specified relative `offset` from the current entry.
#### `navigationHistory.clear()`
@@ -57,7 +66,7 @@ Navigates browser to the specified absolute web page index.
* `offset` Integer
Navigates to the specified offset from the current entry.
Navigates to the specified relative offset from the current entry.
#### `navigationHistory.length()`
@@ -74,3 +83,22 @@ Returns `boolean` - Whether the navigation entry was removed from the webContent
#### `navigationHistory.getAllEntries()`
Returns [`NavigationEntry[]`](structures/navigation-entry.md) - WebContents complete history.
#### `navigationHistory.restore(options)`
Restores navigation history and loads the given entry in the in stack. Will make a best effort
to restore not just the navigation stack but also the state of the individual pages - for instance
including HTML form values or the scroll position. It's recommended to call this API before any
navigation entries are created, so ideally before you call `loadURL()` or `loadFile()` on the
`webContents` object.
This API allows you to create common flows that aim to restore, recreate, or clone other webContents.
* `options` Object
* `entries` [NavigationEntry[]](structures/navigation-entry.md) - Result of a prior `getAllEntries()` call
* `index` Integer (optional) - Index of the stack that should be loaded. If you set it to `0`, the webContents will load the first (oldest) entry. If you leave it undefined, Electron will automatically load the last (newest) entry.
Returns `Promise<void>` - the promise will resolve when the page has finished loading the selected navigation entry
(see [`did-finish-load`](web-contents.md#event-did-finish-load)), and rejects
if the page fails to load (see
[`did-fail-load`](web-contents.md#event-did-fail-load)). A noop rejection handler is already attached, which avoids unhandled rejection errors.

View File

@@ -26,7 +26,10 @@ Emitted when system changes to battery power.
### Event: 'thermal-state-change' _macOS_
* `state` string - The system's new thermal state. Can be `unknown`, `nominal`, `fair`, `serious`, `critical`.
Returns:
* `details` Event\<\>
* `state` string - The system's new thermal state. Can be `unknown`, `nominal`, `fair`, `serious`, `critical`.
Emitted when the thermal state of the system changes. Notification of a change
in the thermal status of the system, such as entering a critical temperature
@@ -42,7 +45,8 @@ See https://developer.apple.com/library/archive/documentation/Performance/Concep
### Event: 'speed-limit-change' _macOS_ _Windows_
* `limit` number - The operating system's advertised speed limit for CPUs, in percent.
* `details` Event\<\>
* `limit` number - The operating system's advertised speed limit for CPUs, in percent.
Notification of a change in the operating system's advertised speed limit for
CPUs, in percent. Values below 100 indicate that the system is impairing

View File

@@ -933,6 +933,7 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
* `storage-access` - Allows content loaded in a third-party context to request access to third-party cookies using the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API).
* `top-level-storage-access` - Allow top-level sites to request third-party cookie access on behalf of embedded content originating from another site in the same related website set using the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API).
* `usb` - Expose non-standard Universal Serial Bus (USB) compatible devices services to the web with the [WebUSB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API).
* `deprecated-sync-clipboard-read` _Deprecated_ - Request access to run `document.execCommand("paste")`
* `requestingOrigin` string - The origin URL of the permission check
* `details` Object - Some properties are only available on certain permission types.
* `embeddingOrigin` string (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
@@ -1360,6 +1361,36 @@ specified when registering the protocol.
Returns `Promise<void>` - resolves when the code cache clear operation is complete.
#### `ses.getSharedDictionaryUsageInfo()`
Returns `Promise<SharedDictionaryUsageInfo[]>` - an array of shared dictionary information entries in Chromium's networking service's storage.
Shared dictionaries are used to power advanced compression of data sent over the wire, specifically with Brotli and ZStandard. You don't need to call any of the shared dictionary APIs in Electron to make use of this advanced web feature, but if you do, they allow deeper control and inspection of the shared dictionaries used during decompression.
To get detailed information about a specific shared dictionary entry, call `getSharedDictionaryInfo(options)`.
#### `ses.getSharedDictionaryInfo(options)`
* `options` Object
* `frameOrigin` string - The origin of the frame where the request originates. Its specific to the individual frame making the request and is defined by its scheme, host, and port. In practice, will look like a URL.
* `topFrameSite` string - The site of the top-level browsing context (the main frame or tab that contains the request). Its less granular than `frameOrigin` and focuses on the broader "site" scope. In practice, will look like a URL.
Returns `Promise<SharedDictionaryInfo[]>` - an array of shared dictionary information entries in Chromium's networking service's storage.
To get information about all present shared dictionaries, call `getSharedDictionaryUsageInfo()`.
#### `ses.clearSharedDictionaryCache()`
Returns `Promise<void>` - resolves when the dictionary cache has been cleared, both in memory and on disk.
#### `ses.clearSharedDictionaryCacheForIsolationKey(options)`
* `options` Object
* `frameOrigin` string - The origin of the frame where the request originates. Its specific to the individual frame making the request and is defined by its scheme, host, and port. In practice, will look like a URL.
* `topFrameSite` string - The site of the top-level browsing context (the main frame or tab that contains the request). Its less granular than `frameOrigin` and focuses on the broader "site" scope. In practice, will look like a URL.
Returns `Promise<void>` - resolves when the dictionary cache has been cleared for the specified isolation key, both in memory and on disk.
#### `ses.setSpellCheckerEnabled(enable)`
* `enable` boolean
@@ -1509,9 +1540,11 @@ session is persisted on disk. For in memory sessions this returns `null`.
#### `ses.clearData([options])`
* `options` Object (optional)
* `dataTypes` String[] (optional) - The types of data to clear. By default, this will clear all types of data.
* `dataTypes` String[] (optional) - The types of data to clear. By default, this will clear all types of data. This
can potentially include data types not explicitly listed here. (See Chromium's
[`BrowsingDataRemover`][browsing-data-remover] for the full list.)
* `backgroundFetch` - Background Fetch
* `cache` - Cache
* `cache` - Cache (includes `cachestorage` and `shadercache`)
* `cookies` - Cookies
* `downloads` - Downloads
* `fileSystems` - File Systems
@@ -1535,7 +1568,9 @@ This method clears more types of data and is more thorough than the
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
For more information, refer to Chromium's [`BrowsingDataRemover` interface](https://source.chromium.org/chromium/chromium/src/+/main:content/public/browser/browsing_data_remover.h).
**Note:** Clearing cache data will also clear the shared dictionary cache. This means that any dictionaries used for compression may be reloaded after clearing the cache. If you wish to clear the shared dictionary cache but leave other cached data intact, you may want to use the `clearSharedDictionaryCache` method.
For more information, refer to Chromium's [`BrowsingDataRemover` interface][browsing-data-remover].
### Instance Properties
@@ -1601,3 +1636,5 @@ app.whenReady().then(async () => {
console.log('Net-logs written to', path)
})
```
[browsing-data-remover]: https://source.chromium.org/chromium/chromium/src/+/main:content/public/browser/browsing_data_remover.h

View File

@@ -97,9 +97,10 @@
* `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
Set a custom position for the traffic light buttons in frameless windows.
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
should have rounded corners on macOS. Default is `true`. Setting this property
to `false` will prevent the window from being fullscreenable.
* `roundedCorners` boolean (optional) _macOS_ _Windows_ - Whether frameless window
should have rounded corners. Default is `true`. Setting this property
to `false` will prevent the window from being fullscreenable on macOS.
On Windows versions older than Windows 11 Build 22000 this property has no effect, and frameless windows will not have rounded corners.
* `thickFrame` boolean (optional) - Use `WS_THICKFRAME` style for frameless windows on
Windows, which adds standard window frame. Setting it to `false` will remove
window shadow and window animations. Default is `true`.

View File

@@ -2,3 +2,6 @@
* `url` string
* `title` string
* `pageState` string (optional) - A base64 encoded data string containing Chromium page state
including information like the current scroll position or form values. It is committed by
Chromium before a navigation event and on a regular interval.

View File

@@ -0,0 +1,12 @@
# SharedDictionaryInfo Object
* `match` string - The matching path pattern for the dictionary which was declared in 'use-as-dictionary' response header's `match` option.
* `matchDestinations` string[] - An array of matching destinations for the dictionary which was declared in 'use-as-dictionary' response header's `match-dest` option.
* `id` string - The Id for the dictionary which was declared in 'use-as-dictionary' response header's `id` option.
* `dictionaryUrl` string - URL of the dictionary.
* `lastFetchTime` Date - The time of when the dictionary was received from the network layer.
* `responseTime` Date - The time of when the dictionary was received from the server. For cached responses, this time could be "far" in the past.
* `expirationDuration` number - The expiration time for the dictionary which was declared in 'use-as-dictionary' response header's `expires` option in seconds.
* `lastUsedTime` Date - The time when the dictionary was last used.
* `size` number - The amount of bytes stored for this shared dictionary information object in Chromium's internal storage (usually Sqlite).
* `hash` string - The sha256 hash of the dictionary binary.

View File

@@ -0,0 +1,5 @@
# SharedDictionaryUsageInfo Object
* `frameOrigin` string - The origin of the frame where the request originates. Its specific to the individual frame making the request and is defined by its scheme, host, and port. In practice, will look like a URL.
* `topFrameSite` string - The site of the top-level browsing context (the main frame or tab that contains the request). Its less granular than `frameOrigin` and focuses on the broader "site" scope. In practice, will look like a URL.
* `totalSizeBytes` number - The amount of bytes stored for this shared dictionary information object in Chromium's internal storage (usually Sqlite).

View File

@@ -148,6 +148,7 @@
this will cause the `preferred-size-changed` event to be emitted on the
`WebContents` when the preferred size changes. Default is `false`.
* `transparent` boolean (optional) - Whether to enable background transparency for the guest page. Default is `true`. **Note:** The guest page's text and background colors are derived from the [color scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme) of its root element. When transparency is enabled, the text color will still change accordingly but the background will remain transparent.
* `enableDeprecatedPaste` boolean (optional) _Deprecated_ - Whether to enable the `paste` [execCommand](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand). Default is `false`.
[chrome-content-scripts]: https://developer.chrome.com/extensions/content_scripts#execution-environment
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5

View File

@@ -37,7 +37,10 @@ Process: [Main](../glossary.md#main-process)<br />
to load unsigned libraries. Unless you specifically need this capability, it is best to leave this disabled.
Default is `false`.
* `respondToAuthRequestsFromMainProcess` boolean (optional) - With this flag, all HTTP 401 and 407 network
requests created via the [net module](net.md) will allow responding to them via the [`app#login`](app.md#event-login) event in the main process instead of the default [`login`](client-request.md#event-login) event on the [`ClientRequest`](client-request.md) object.
requests created via the [net module](net.md) will allow responding to them via the
[`app#login`](app.md#event-login) event in the main process instead of the default
[`login`](client-request.md#event-login) event on the [`ClientRequest`](client-request.md) object. Default is
`false`.
Returns [`UtilityProcess`](utility-process.md#class-utilityprocess)
@@ -92,6 +95,8 @@ the child process exits, then the value is `undefined` after the `exit` event is
```js
const child = utilityProcess.fork(path.join(__dirname, 'test.js'))
console.log(child.pid) // undefined
child.on('spawn', () => {
console.log(child.pid) // Integer
})
@@ -101,6 +106,8 @@ child.on('exit', () => {
})
```
**Note:** You can use the `pid` to determine if the process is currently running.
#### `child.stdout`
A `NodeJS.ReadableStream | null` that represents the child process's stdout.

View File

@@ -106,6 +106,12 @@ Examples of valid `color` values:
* `visible` boolean - If false, the view will be hidden from display.
#### `view.getVisible()`
Returns `boolean` - Whether the view should be drawn. Note that this is
different from whether the view is visible on screen—it may still be obscured
or out of view.
### Instance Properties
Objects created with `new View` have the following properties:

View File

@@ -142,6 +142,29 @@ ipcRenderer.on('port', (e, msg) => {
})
```
#### `frame.collectJavaScriptCallStack()` _Experimental_
Returns `Promise<string> | Promise<void>` - A promise that resolves with the currently running JavaScript call
stack. If no JavaScript runs in the frame, the promise will never resolve. In cases where the call stack is
otherwise unable to be collected, it will return `undefined`.
This can be useful to determine why the frame is unresponsive in cases where there's long-running JavaScript.
For more information, see the [proposed Crash Reporting API.](https://wicg.github.io/crash-reporting/)
```js
const { app } = require('electron')
app.commandLine.appendSwitch('enable-features', 'DocumentPolicyIncludeJSCallStacksInCrashReports')
app.on('web-contents-created', (_, webContents) => {
webContents.on('unresponsive', async () => {
// Interrupt execution and collect call stack from unresponsive renderer
const callStack = await webContents.mainFrame.collectJavaScriptCallStack()
console.log('Renderer unresponsive\n', callStack)
})
})
```
### Instance Properties
#### `frame.ipc` _Readonly_

View File

@@ -12,8 +12,42 @@ This document uses the following convention to categorize breaking changes:
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
## Planned Breaking API Changes (35.0)
### Deprecated: `level`, `message`, `line`, and `sourceId` arguments in `console-message` event on `WebContents`
The `console-message` event on `WebContents` has been updated to provide details on the `Event`
argument.
```js
// Deprecated
webContents.on('console-message', (event, level, message, line, sourceId) => {})
// Replace with:
webContents.on('console-message', ({ level, message, lineNumber, sourceId, frame }) => {})
```
Additionally, `level` is now a string with possible values of `info`, `warning`, `error`, and `debug`.
## Planned Breaking API Changes (34.0)
### Behavior Changed: menu bar will be hidden during fullscreen on Windows
This brings the behavior to parity with Linux. Prior behavior: Menu bar is still visible during fullscreen on Windows. New behavior: Menu bar is hidden during fullscreen on Windows.
**Correction**: This was previously listed as a breaking change in Electron 33, but was first released in Electron 34.
## Planned Breaking API Changes (33.0)
### Deprecated: `document.execCommand("paste")`
The synchronous clipboard read API [document.execCommand("paste")](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard) has been
deprecated in favor of [async clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API). This is to align with the browser defaults.
The `enableDeprecatedPaste` option on `WebPreferences` that triggers the permission
checks for this API and the associated permission type `deprecated-sync-clipboard-read`
are also deprecated.
### Behavior Changed: frame properties may retrieve detached WebFrameMain instances or none at all
APIs which provide access to a `WebFrameMain` instance may return an instance
@@ -69,10 +103,6 @@ mainWindow.loadURL('data:text/html,<script src="loaded-from-dataurl.js"></script
mainWindow.loadURL('other://index.html')
```
### Behavior Changed: menu bar will be hidden during fullscreen on Windows
This brings the behavior to parity with Linux. Prior behavior: Menu bar is still visible during fullscreen on Windows. New behavior: Menu bar is hidden during fullscreen on Windows.
### Behavior Changed: `webContents` property on `login` on `app`
The `webContents` property in the `login` event from `app` will be `null`
@@ -90,6 +120,16 @@ macOS 10.15 (Catalina) is no longer supported by [Chromium](https://chromium-rev
Older versions of Electron will continue to run on Catalina, but macOS 11 (Big Sur)
or later will be required to run Electron v33.0.0 and higher.
### Behavior Changed: Native modules now require C++20
Due to changes made upstream, both
[V8](https://chromium-review.googlesource.com/c/v8/v8/+/5587859) and
[Node.js](https://github.com/nodejs/node/pull/45427) now require C++20 as a
minimum version. Developers using native node modules should build their
modules with `--std=c++20` rather than `--std=c++17`. Images using gcc9 or
lower may need to update to gcc10 in order to compile. See
[#43555](https://github.com/electron/electron/pull/43555) for more details.
### Deprecated: `systemPreferences.accessibilityDisplayShouldReduceTransparency`
The `systemPreferences.accessibilityDisplayShouldReduceTransparency` property is now deprecated in favor of the new `nativeTheme.prefersReducedTransparency`, which provides identical information and works cross-platform.
@@ -111,14 +151,14 @@ The nonstandard `path` property of the Web `File` object was added in an early v
```js
// Before (renderer)
const file = document.querySelector('input[type=file]')
const file = document.querySelector('input[type=file]').files[0]
alert(`Uploaded file path was: ${file.path}`)
```
```js
// After (renderer)
const file = document.querySelector('input[type=file]')
const file = document.querySelector('input[type=file]').files[0]
electron.showFilePath(file)
// (preload)
@@ -161,6 +201,14 @@ win.webContents.navigationHistory.canGoToOffset()
win.webContents.navigationHistory.goToOffset(index)
```
### Behavior changed: Directory `databases` in `userData` will be deleted
If you have a directory called `databases` in the directory returned by
`app.getPath('userData')`, it will be deleted when Electron 32 is first run.
The `databases` directory was used by WebSQL, which was removed in Electron 31.
Chromium now performs a cleanup that deletes this directory. See
[issue #45396](https://github.com/electron/electron/issues/45396).
## Planned Breaking API Changes (31.0)
### Removed: `WebSQL` support

View File

@@ -11,7 +11,7 @@
<button id="clickme">Test Bluetooth</button>
<button id="cancel">Cancel Bluetooth Request</button>
<p>Currently selected bluetooth device: <strong id="device-name""></strong></p>
<p>Currently selected bluetooth device: <strong id="device-name"></strong></p>
<script src="./renderer.js"></script>
</body>

View File

@@ -9,10 +9,11 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
| ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- |
| 34.0.0 | 2024-Oct-17 | 2024-Nov-13 | 2024-Jan-07 | 2025-Jun-24 | M132 | TBD | ✅ |
| 35.0.0 | 2025-Jan-16 | 2025-Feb-05 | 2025-Mar-04 | 2025-Sep-02 | M134 | TBD | ✅ |
| 34.0.0 | 2024-Oct-17 | 2024-Nov-13 | 2025-Jan-14 | 2025-Jun-24 | M132 | v20.18 | ✅ |
| 33.0.0 | 2024-Aug-22 | 2024-Sep-18 | 2024-Oct-15 | 2025-Apr-29 | M130 | v20.18 | ✅ |
| 32.0.0 | 2024-Jun-14 | 2024-Jul-24 | 2024-Aug-20 | 2025-Mar-04 | M128 | v20.16 | ✅ |
| 31.0.0 | 2024-Apr-18 | 2024-May-15 | 2024-Jun-11 | 2025-Jan-07 | M126 | v20.14 | |
| 31.0.0 | 2024-Apr-18 | 2024-May-15 | 2024-Jun-11 | 2025-Jan-14 | M126 | v20.14 | 🚫 |
| 30.0.0 | 2024-Feb-22 | 2024-Mar-20 | 2024-Apr-16 | 2024-Oct-15 | M124 | v20.11 | 🚫 |
| 29.0.0 | 2023-Dec-07 | 2024-Jan-24 | 2024-Feb-20 | 2024-Aug-20 | M122 | v20.9 | 🚫 |
| 28.0.0 | 2023-Oct-11 | 2023-Nov-06 | 2023-Dec-05 | 2024-Jun-11 | M120 | v18.18 | 🚫 |

View File

@@ -68,6 +68,10 @@ The onlyLoadAppFromAsar fuse changes the search system that Electron uses to loc
The loadBrowserProcessSpecificV8Snapshot fuse changes which V8 snapshot file is used for the browser process. By default Electron's processes will all use the same V8 snapshot file. When this fuse is enabled the browser process uses the file called `browser_v8_context_snapshot.bin` for its V8 snapshot. The other processes will use the V8 snapshot file that they normally do.
V8 snapshots can be useful to improve app startup performance. V8 lets you take snapshots of initialized heaps and then load them back in to avoid the cost of initializing the heap.
Using separate snapshots for renderer processes and the main process can improve security, especially to make sure that the renderer doesn't use a snapshot with `nodeIntegration` enabled. See [#35170](https://github.com/electron/electron/issues/35170) for details.
### `grantFileProtocolExtraPrivileges`
**Default:** Enabled

View File

@@ -14,7 +14,7 @@ To configure a local keyboard shortcut, you need to specify an [`accelerator`][]
property when creating a [MenuItem][] within the [Menu][] module.
Starting with a working application from the
[Quick Start Guide](quick-start.md), update the `main.js` to be:
[tutorial starter code][tutorial-starter-code], update the `main.js` to be:
```fiddle docs/fiddles/features/keyboard-shortcuts/local
const { app, BrowserWindow, Menu, MenuItem } = require('electron/main')
@@ -75,7 +75,7 @@ module to detect keyboard events even when the application does not have
keyboard focus.
Starting with a working application from the
[Quick Start Guide](quick-start.md), update the `main.js` to be:
[tutorial starter code][tutorial-starter-code], update the `main.js` to be:
```fiddle docs/fiddles/features/keyboard-shortcuts/global
const { app, BrowserWindow, globalShortcut } = require('electron/main')
@@ -144,7 +144,7 @@ is emitted before dispatching `keydown` and `keyup` events in the page. It can
be used to catch and handle custom shortcuts that are not visible in the menu.
Starting with a working application from the
[Quick Start Guide](quick-start.md), update the `main.js` file with the
[tutorial starter code][tutorial-starter-code], update the `main.js` file with the
following lines:
```fiddle docs/fiddles/features/keyboard-shortcuts/interception-from-main
@@ -207,3 +207,4 @@ Mousetrap.bind('up up down down left right left right b a enter', () => {
[mousetrap]: https://github.com/ccampbell/mousetrap
[dom-events]: https://developer.mozilla.org/en-US/docs/Web/Events
[addEventListener-api]: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
[tutorial-starter-code]: tutorial-2-first-app.md#final-starter-code

View File

@@ -22,12 +22,9 @@ In `preload.js` use the [`contextBridge`][] to inject a method `window.electron.
```js
const { contextBridge, ipcRenderer } = require('electron')
const path = require('node:path')
contextBridge.exposeInMainWorld('electron', {
startDrag: (fileName) => {
ipcRenderer.send('ondragstart', path.join(process.cwd(), fileName))
}
startDrag: (fileName) => ipcRenderer.send('ondragstart', fileName)
})
```

View File

@@ -69,8 +69,25 @@ if (navigationHistory.canGoToOffset(2)) {
}
```
## Restoring history
A common flow is that you want to restore the history of a webContents - for instance to implement an "undo close tab" feature. To do so, you can call `navigationHistory.restore({ index, entries })`. This will restore the webContent's navigation history and the webContents location in said history, meaning that `goBack()` and `goForward()` navigate you through the stack as expected.
```js @ts-type={navigationHistory:Electron.NavigationHistory}
const firstWindow = new BrowserWindow()
// Later, you want a second window to have the same history and navigation position
async function restore () {
const entries = firstWindow.webContents.navigationHistory.getAllEntries()
const index = firstWindow.webContents.navigationHistory.getActiveIndex()
const secondWindow = new BrowserWindow()
await secondWindow.webContents.navigationHistory.restore({ index, entries })
}
```
Here's a full example that you can open with Electron Fiddle:
```fiddle docs/fiddles/features/navigation-history
```

View File

@@ -86,7 +86,7 @@ The main process also controls your application's lifecycle through Electron's
that you can use to add custom application behavior (for instance, programmatically
quitting your application, modifying the application dock, or showing an About panel).
As a practical example, the app shown in the [quick start guide][quick-start-lifecycle]
As a practical example, the app shown in the [tutorial starter code][tutorial-lifecycle]
uses `app` APIs to create a more native application window experience.
```js title='main.js'
@@ -97,7 +97,7 @@ app.on('window-all-closed', () => {
```
[app]: ../api/app.md
[quick-start-lifecycle]: ../tutorial/quick-start.md#manage-your-windows-lifecycle
[tutorial-lifecycle]: ../tutorial/tutorial-2-first-app.md#quit-the-app-when-all-windows-are-closed-windows--linux
### Native APIs

View File

@@ -1,513 +0,0 @@
# Quick Start
This guide will step you through the process of creating a barebones Hello World app in
Electron, similar to [`electron/electron-quick-start`][quick-start].
By the end of this tutorial, your app will open a browser window that displays a web page
with information about which Chromium, Node.js, and Electron versions are running.
[quick-start]: https://github.com/electron/electron-quick-start
## Prerequisites
To use Electron, you need to install [Node.js][node-download]. We recommend that you
use the latest `LTS` version available.
> Please install Node.js using pre-built installers for your platform.
> You may encounter incompatibility issues with different development tools otherwise.
To check that Node.js was installed correctly, type the following commands in your
terminal client:
```sh
node -v
npm -v
```
The commands should print the versions of Node.js and npm accordingly.
**Note:** Since Electron embeds Node.js into its binary, the version of Node.js running
your code is unrelated to the version running on your system.
[node-download]: https://nodejs.org/en/download/
## Create your application
### Scaffold the project
Electron apps follow the same general structure as other Node.js projects.
Start by creating a folder and initializing an npm package.
```sh npm2yarn
mkdir my-electron-app && cd my-electron-app
npm init
```
The interactive `init` command will prompt you to set some fields in your config.
There are a few rules to follow for the purposes of this tutorial:
* `entry point` should be `main.js`.
* `author` and `description` can be any value, but are necessary for
[app packaging](#package-and-distribute-your-application).
Your `package.json` file should look something like this:
```json
{
"name": "my-electron-app",
"version": "1.0.0",
"description": "Hello World!",
"main": "main.js",
"author": "Jane Doe",
"license": "MIT"
}
```
Then, install the `electron` package into your app's `devDependencies`.
```sh npm2yarn
npm install --save-dev electron
```
> Note: If you're encountering any issues with installing Electron, please
> refer to the [Advanced Installation][advanced-installation] guide.
Finally, you want to be able to execute Electron. In the [`scripts`][package-scripts]
field of your `package.json` config, add a `start` command like so:
```json
{
"scripts": {
"start": "electron ."
}
}
```
This `start` command will let you open your app in development mode.
```sh npm2yarn
npm start
```
> Note: This script tells Electron to run on your project's root folder. At this stage,
> your app will immediately throw an error telling you that it cannot find an app to run.
[advanced-installation]: ./installation.md
[package-scripts]: https://docs.npmjs.com/cli/v7/using-npm/scripts
### Run the main process
The entry point of any Electron application is its `main` script. This script controls the
**main process**, which runs in a full Node.js environment and is responsible for
controlling your app's lifecycle, displaying native interfaces, performing privileged
operations, and managing renderer processes (more on that later).
During execution, Electron will look for this script in the [`main`][package-json-main]
field of the app's `package.json` config, which you should have configured during the
[app scaffolding](#scaffold-the-project) step.
To initialize the `main` script, create an empty file named `main.js` in the root folder
of your project.
> Note: If you run the `start` script again at this point, your app will no longer throw
> any errors! However, it won't do anything yet because we haven't added any code into
> `main.js`.
[package-json-main]: https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main
### Create a web page
Before we can create a window for our application, we need to create the content that
will be loaded into it. In Electron, each window displays web contents that can be loaded
from either a local HTML file or a remote URL.
For this tutorial, you will be doing the former. Create an `index.html` file in the root
folder of your project:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using Node.js <span id="node-version"></span>,
Chromium <span id="chrome-version"></span>,
and Electron <span id="electron-version"></span>.
</body>
</html>
```
> Note: Looking at this HTML document, you can observe that the version numbers are
> missing from the body text. We'll manually insert them later using JavaScript.
### Opening your web page in a browser window
Now that you have a web page, load it into an application window. To do so, you'll
need two Electron modules:
* The [`app`][app] module, which controls your application's event lifecycle.
* The [`BrowserWindow`][browser-window] module, which creates and manages application
windows.
Because the main process runs Node.js, you can import these as [CommonJS][commonjs]
modules at the top of your `main.js` file:
```js
const { app, BrowserWindow } = require('electron')
```
Then, add a `createWindow()` function that loads `index.html` into a new `BrowserWindow`
instance.
```js
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600
})
win.loadFile('index.html')
}
```
Next, call this `createWindow()` function to open your window.
In Electron, browser windows can only be created after the `app` module's
[`ready`][app-ready] event is fired. You can wait for this event by using the
[`app.whenReady()`][app-when-ready] API. Call `createWindow()` after `whenReady()`
resolves its Promise.
```js @ts-type={createWindow:()=>void}
app.whenReady().then(() => {
createWindow()
})
```
> Note: At this point, your Electron application should successfully
> open a window that displays your web page!
[app]: ../api/app.md
[browser-window]: ../api/browser-window.md
[commonjs]: https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules
[app-ready]: ../api/app.md#event-ready
[app-when-ready]: ../api/app.md#appwhenready
### Manage your window's lifecycle
Although you can now open a browser window, you'll need some additional boilerplate code
to make it feel more native to each platform. Application windows behave differently on
each OS, and Electron puts the responsibility on developers to implement these
conventions in their app.
In general, you can use the `process` global's [`platform`][node-platform] attribute
to run code specifically for certain operating systems.
#### Quit the app when all windows are closed (Windows & Linux)
On Windows and Linux, exiting all windows generally quits an application entirely.
To implement this, listen for the `app` module's [`'window-all-closed'`][window-all-closed]
event, and call [`app.quit()`][app-quit] if the user is not on macOS (`darwin`).
```js
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
```
[node-platform]: https://nodejs.org/api/process.html#process_process_platform
[window-all-closed]: ../api/app.md#event-window-all-closed
[app-quit]: ../api/app.md#appquit
#### Open a window if none are open (macOS)
Whereas Linux and Windows apps quit when they have no windows open, macOS apps generally
continue running even without any windows open, and activating the app when no windows
are available should open a new one.
To implement this feature, listen for the `app` module's [`activate`][activate]
event, and call your existing `createWindow()` method if no browser windows are open.
Because windows cannot be created before the `ready` event, you should only listen for
`activate` events after your app is initialized. Do this by attaching your event listener
from within your existing `whenReady()` callback.
[activate]: ../api/app.md#event-activate-macos
```js @ts-type={createWindow:()=>void}
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
```
> Note: At this point, your window controls should be fully functional!
### Access Node.js from the renderer with a preload script
Now, the last thing to do is print out the version numbers for Electron and its
dependencies onto your web page.
Accessing this information is trivial to do in the main process through Node's
global `process` object. However, you can't just edit the DOM from the main
process because it has no access to the renderer's `document` context.
They're in entirely different processes!
> Note: If you need a more in-depth look at Electron processes, see the
> [Process Model][] document.
This is where attaching a **preload** script to your renderer comes in handy.
A preload script runs before the renderer process is loaded, and has access to both
renderer globals (e.g. `window` and `document`) and a Node.js environment.
Create a new script named `preload.js` as such:
```js
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {
const element = document.getElementById(selector)
if (element) element.innerText = text
}
for (const dependency of ['chrome', 'node', 'electron']) {
replaceText(`${dependency}-version`, process.versions[dependency])
}
})
```
The above code accesses the Node.js `process.versions` object and runs a basic `replaceText`
helper function to insert the version numbers into the HTML document.
To attach this script to your renderer process, pass in the path to your preload script
to the `webPreferences.preload` option in your existing `BrowserWindow` constructor.
```js
const { app, BrowserWindow } = require('electron')
// include the Node.js 'path' module at the top of your file
const path = require('node:path')
// modify your existing createWindow() function
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
win.loadFile('index.html')
}
// ...
```
There are two Node.js concepts that are used here:
* The [`__dirname`][dirname] string points to the path of the currently executing script
(in this case, your project's root folder).
* The [`path.join`][path-join] API joins multiple path segments together, creating a
combined path string that works across all platforms.
We use a path relative to the currently executing JavaScript file so that your relative
path will work in both development and packaged mode.
[Process Model]: ./process-model.md
[dirname]: https://nodejs.org/api/modules.html#modules_dirname
[path-join]: https://nodejs.org/api/path.html#path_path_join_paths
### Bonus: Add functionality to your web contents
At this point, you might be wondering how to add more functionality to your application.
For any interactions with your web contents, you want to add scripts to your
renderer process. Because the renderer runs in a normal web environment, you can add a
`<script>` tag right before your `index.html` file's closing `</body>` tag to include
any arbitrary scripts you want:
```html
<script src="./renderer.js"></script>
```
The code contained in `renderer.js` can then use the same JavaScript APIs and tooling
you use for typical front-end development, such as using [`webpack`][webpack] to bundle
and minify your code or [React][react] to manage your user interfaces.
[webpack]: https://webpack.js.org
[react]: https://reactjs.org
### Recap
After following the above steps, you should have a fully functional
Electron application that looks like this:
![Simplest Electron app](../images/simplest-electron-app.png)
<!--TODO(erickzhao): Remove the individual code blocks for static website -->
The full code is available below:
```js
// main.js
// Modules to control application life and create native browser window
const { app, BrowserWindow } = require('electron')
const path = require('node:path')
const createWindow = () => {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
```
```js
// preload.js
// All the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {
const element = document.getElementById(selector)
if (element) element.innerText = text
}
for (const dependency of ['chrome', 'node', 'electron']) {
replaceText(`${dependency}-version`, process.versions[dependency])
}
})
```
```html
<!--index.html-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using Node.js <span id="node-version"></span>,
Chromium <span id="chrome-version"></span>,
and Electron <span id="electron-version"></span>.
<!-- You can also require other files to run in this process -->
<script src="./renderer.js"></script>
</body>
</html>
```
```fiddle docs/fiddles/quick-start
```
To summarize all the steps we've done:
* We bootstrapped a Node.js application and added Electron as a dependency.
* We created a `main.js` script that runs our main process, which controls our app
and runs in a Node.js environment. In this script, we used Electron's `app` and
`BrowserWindow` modules to create a browser window that displays web content
in a separate process (the renderer).
* In order to access certain Node.js functionality in the renderer, we attached
a preload script to our `BrowserWindow` constructor.
## Package and distribute your application
The fastest way to distribute your newly created app is using
[Electron Forge](https://www.electronforge.io).
:::info
To build an RPM package for Linux, you will need to [install its required system dependencies](https://www.electronforge.io/config/makers/rpm).
:::
1. Add a description to your `package.json` file, otherwise rpmbuild will fail. Blank description are not valid.
2. Add Electron Forge as a development dependency of your app, and use its `import` command to set up
Forge's scaffolding:
```sh npm2yarn
npm install --save-dev @electron-forge/cli
npx electron-forge import
✔ Checking your system
✔ Initializing Git Repository
✔ Writing modified package.json file
✔ Installing dependencies
✔ Writing modified package.json file
✔ Fixing .gitignore
We have ATTEMPTED to convert your app to be in a format that electron-forge understands.
Thanks for using "electron-forge"!!!
```
3. Create a distributable using Forge's `make` command:
```sh npm2yarn
npm run make
> my-electron-app@1.0.0 make /my-electron-app
> electron-forge make
✔ Checking your system
✔ Resolving Forge Config
We need to package your application before we can make it
✔ Preparing to Package Application for arch: x64
✔ Preparing native dependencies
✔ Packaging Application
Making for the following targets: zip
✔ Making for target: zip - On platform: darwin - For arch: x64
```
Electron Forge creates the `out` folder where your package will be located:
```plain
// Example for macOS
out/
├── out/make/zip/darwin/x64/my-electron-app-darwin-x64-1.0.0.zip
├── ...
└── out/my-electron-app-darwin-x64/my-electron-app.app/Contents/MacOS/my-electron-app
```

View File

@@ -116,6 +116,7 @@ You should at least follow these steps to improve the security of your applicati
17. [Validate the `sender` of all IPC messages](#17-validate-the-sender-of-all-ipc-messages)
18. [Avoid usage of the `file://` protocol and prefer usage of custom protocols](#18-avoid-usage-of-the-file-protocol-and-prefer-usage-of-custom-protocols)
19. [Check which fuses you can change](#19-check-which-fuses-you-can-change)
20. [Do not expose Electron APIs to untrusted web content](#20-do-not-expose-electron-apis-to-untrusted-web-content)
To automate the detection of misconfigurations and insecure patterns, it is
possible to use
@@ -229,7 +230,7 @@ API to remotely loaded content via the [contextBridge API](../api/context-bridge
### 3. Enable Context Isolation
:::info
This recommendation is the default behavior in Electron since 12.0.0.
Context Isolation is the default behavior in Electron since 12.0.0.
:::
Context isolation is an Electron feature that allows developers to run code
@@ -804,6 +805,48 @@ flipping these fuses easy. Check out the README of that module for more details
potential error cases, and refer to
[How do I flip the fuses?](./fuses.md#how-do-i-flip-the-fuses) in our documentation.
### 20. Do not expose Electron APIs to untrusted web content
You should not directly expose Electron's APIs, especially IPC, to untrusted web content in your
preload scripts.
### Why?
Exposing raw APIs like `ipcRenderer.on` is dangerous because it gives renderer processes direct
access to the entire IPC event system, allowing them to listen for any IPC events, not just the ones
intended for them.
To avoid that exposure, we also cannot pass callbacks directly through: The first
argument to IPC event callbacks is an `IpcRendererEvent` object, which includes properties like `sender`
that provide access to the underlying `ipcRenderer` instance. Even if you only listen for specific
events, passing the callback directly means the renderer gets access to this event object.
In short, we want the untrusted web content to only have access to necessary information and APIs.
### How?
```js title='preload'.js'
// Bad
contextBridge.exposeInMainWorld('electronAPI', {
on: ipcRenderer.on
})
// Also bad
contextBridge.exposeInMainWorld('electronAPI', {
onUpdateCounter: (callback) => ipcRenderer.on('update-counter', callback)
})
// Good
contextBridge.exposeInMainWorld('electronAPI', {
onUpdateCounter: (callback) => ipcRenderer.on('update-counter', (_event, value) => callback(value))
})
```
:::info
For more information on what `contextIsolation` is and how to use it to secure your app,
please see the [Context Isolation](context-isolation.md) document.
:::
[breaking-changes]: ../breaking-changes.md
[browser-window]: ../api/browser-window.md
[webview-tag]: ../api/webview-tag.md

View File

@@ -1,3 +1,5 @@
import DocCardList from '@theme/DocCardList';
# Window Customization
The [`BrowserWindow`][] module is the foundation of your Electron application, and
@@ -5,13 +7,15 @@ it exposes many APIs that let you customize the look and behavior of your app
This section covers how to implement various use cases for window customization on macOS,
Windows, and Linux.
:::info
`BrowserWindow` is a subclass of the [`BaseWindow`][] module. Both modules allow
you to create and manage application windows in Electron, with the main difference
being that `BrowserWindow` supports a single, full size web view while `BaseWindow`
supports composing many web views. `BaseWindow` can be used interchangeably with `BrowserWindow`
in the examples of the documents in this section.
:::
> [!NOTE]
> `BrowserWindow` is a subclass of the [`BaseWindow`][] module. Both modules allow
> you to create and manage application windows in Electron, with the main difference
> being that `BrowserWindow` supports a single, full size web view while `BaseWindow`
> supports composing many web views. `BaseWindow` can be used interchangeably with `BrowserWindow`
> in the examples of the documents in this section.
<!-- markdownlint-disable-next-line MD033 -->
<DocCardList />
[`BaseWindow`]: ../api/base-window.md
[`BrowserWindow`]: ../api/browser-window.md

View File

@@ -8,7 +8,7 @@ If your app doesn't use any native modules, then it's really easy to create an A
1. Make sure that your app's `node_modules` directory is empty.
2. Using a _Command Prompt_, run `set npm_config_arch=arm64` before running `npm install`/`yarn install` as usual.
3. [If you have Electron installed as a development dependency](quick-start.md#prerequisites), npm will download and unpack the arm64 version. You can then package and distribute your app as normal.
3. [If you have Electron installed as a development dependency](tutorial-2-first-app.md#initializing-your-npm-project), npm will download and unpack the arm64 version. You can then package and distribute your app as normal.
## General considerations

View File

@@ -57,7 +57,7 @@ To set user tasks for your application, you can use
##### Set user tasks
Starting with a working application from the
[Quick Start Guide](quick-start.md), update the `main.js` file with the
[tutorial starter code][tutorial-starter-code], update the `main.js` file with the
following lines:
```js
@@ -121,7 +121,7 @@ To set thumbnail toolbar in your application, you need to use
##### Set thumbnail toolbar
Starting with a working application from the
[Quick Start Guide](quick-start.md), update the `main.js` file with the
[tutorial starter code][tutorial-starter-code], update the `main.js` file with the
following lines:
```js
@@ -185,7 +185,7 @@ To set the overlay icon for a window, you need to use the
#### Example
Starting with a working application from the
[Quick Start Guide](quick-start.md), update the `main.js` file with the
[tutorial starter code][tutorial-starter-code], update the `main.js` file with the
following lines:
```js
@@ -214,7 +214,7 @@ To flash the BrowserWindow taskbar button, you need to use the
#### Example
Starting with a working application from the
[Quick Start Guide](quick-start.md), update the `main.js` file with the
[tutorial starter code][tutorial-starter-code], update the `main.js` file with the
following lines:
```js
@@ -231,10 +231,10 @@ In the above example, it is called when the window comes into focus,
but you might use a timeout or some other event to disable it.
[msdn-flash-frame]: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindow#remarks
[setthumbarbuttons]: ../api/browser-window.md#winsetthumbarbuttonsbuttons-windows
[setusertaskstasks]: ../api/app.md#appsetusertaskstasks-windows
[setoverlayicon]: ../api/browser-window.md#winsetoverlayiconoverlay-description-windows
[flashframe]: ../api/browser-window.md#winflashframeflag
[recent-documents]: ./recent-documents.md
[progress-bar]: ./progress-bar.md
[tutorial-starter-code]: ../tutorial/tutorial-2-first-app.md#final-starter-code

103
docs/why-electron.md Normal file
View File

@@ -0,0 +1,103 @@
# Why Electron
Electron is a framework enabling developers to build cross-platform desktop applications for macOS, Windows, and Linux by combining web technologies (HTML, JavaScript, CSS) with Node.js and native code. It is open-source, MIT-licensed, and free for both commercial and personal use. In this document, well explain why companies and developers choose Electron.
We can split up the benefits of Electron in two questions: First, why should you use web technologies to build your application? Then, why should you choose Electron as the framework to do so?
If youre already using web technologies for your application, you can skip straight to the `Why Electron?` section below.
## Why choose web technologies
Web technologies include HTML, CSS, JavaScript, and WebAssembly. Theyre the storefront of the modern Internet. Those technologies have emerged as the best choice for building user interfaces — both for consumer applications as well as mission-critical business applications. This is true both for applications that need to run in a browser as well as desktop applications that are not accessible from a browser. Our bold claim here is that this isnt just true for cross-platform applications that need to run on multiple operating systems but true overall.
As an example, NASAs actual [Mission Control](https://github.com/nasa/openmct) is written with web technologies. The [Bloomberg Terminal](https://en.wikipedia.org/wiki/Bloomberg_Terminal), the computer system found at every financial institution, is written with web technologies and runs inside Chromium. It costs $25,000 per user, per year. The McDonalds ordering kiosk, powering the worlds biggest food retailer, is entirely built with Chromium. The [SpaceXs Dragon 2 space capsule](https://old.reddit.com/r/spacex/comments/gxb7j1/we_are_the_spacex_software_team_ask_us_anything/ft62781/?context=3) uses Chromium to display its interface. You get the point: web technologies are a great tech stack to build user interfaces.
Here are the reasons we, the Electron maintainers, are betting on the web.
### Versatility
Modern versions of HTML and CSS enable your developers and designers to fully express themselves. The webs showcase includes Google Earth, Netflix, Spotify, Gmail, Facebook, Airbnb, or GitHub. Whatever interface your application needs, you will be able to express it with HTML, CSS, and JavaScript.
If you want to focus on building a great product without figuring out how you can realize your designers vision in a specific UI framework, the web is a safe bet.
### Reliability
Web technologies are the most-used foundation for user interfaces on the planet. The have been hardened accordingly. Modern computers have been optimized from the CPU to the operating system to be good at running web technologies. The manufacturers of your users devices—be that an Android phone or the latest MacBook—will ensure that they can visit websites, play videos on YouTube, or display emails. In turn, theyll also ensure that your app has a stable foundation, even if you have just one user.
If you want to focus on building a great product without debugging a weird quirk that nobody has found before, the web is a safe bet.
### Interoperability
Whatever provider or customer data you need to interact with, they will have probably thought of an integration path with the web. Depending on your technology choice, embedding a YouTube video either takes 30 seconds or requires you to hire a team devoted to streaming and hardware-accelerated video decoding. In the case of YouTube, using anything other than the provided players is actually against their terms and conditions, so youll likely embed a browser frame before you implement your own video streaming decoder.
There will be virtually no platform where your app cannot run if you build it with web technologies. Virtually all devices with a display—be that an ATM, a car infotainment system, a smart TV, a fridge, or a Nintendo Switch—come with means to display web technologies. The web is safe bet if you want to be cross-platform.
### Ubiquity
Its easy to find developers with experience building with web technologies. If youre a developer, itll be easy to find answers to your questions on Google, Stack Overflow, GitHub, or a coding AI of your choice. Whatever problem you need to solve, its likely that somebody has solved it well before—and that you can find the answer to the puzzle online.
If you want to focus on building a great product with ample access to resources and materials, the web is a safe bet.
## Why choose Electron
Electron combines Chromium, Node.js, and the ability to write custom native code into one framework for building powerful desktop applications. There are three main reasons to use Electron:
### Enterprise-grade
Electron is reliable, secure, stable, and mature. It is the premier choice for companies building their flagship product. We have a list of some of those companies on our homepage, but just among chat apps, Slack, Discord, and Skype are built with Electron. Among AI applications, both OpenAIs ChatGPT and Anthropics Claude use Electron. Visual Studio Code, Loom, Canva, Notion, Docker, and countless other leading developers of software bet on Electron.
We did make it a priority to make Electron easy to work with and a delight for developers. Thats likely the main reason why Electron became as popular as it is today — but what keeps Electron alive and thriving is the maintainers focus on making Electron as stable, secure, performant, and capable of mission-critical use cases for end users as possible. Were building an Electron that is ready to be used in scenarios where unfixable bugs, unpatched security holes, and outages of any kind are worst-case scenarios.
### Mature
Our current estimation is that most desktop computers on the planet run at least one Electron app. Electron has grown by prioritizing talent in its maintainer group, fostering excellent and sustainable engineering practices in managing the ongoing maintenance, and proactively inviting companies betting on Electron to directly contribute to the project. Were an impact project with the OpenJS foundation, which is itself a part of the Linux foundation. We share resources and expertise with other foundation projects like Node.js, ESLint, Webpack - or the Linux Kernel or Kubernetes.
What does all of that mean for you, a developer, in practice?
- **Reliable release schedule**: Electron will release a new major version in lockstep with every second major Chromium release, usually on the same day as Chromium. A lot of work, both in the form of building processes and tools, but also in terms of raw invested hours every week, has to go into making that happen.
- **No dictators**: Sometimes, betting on a technology also requires you to bet on a single person or company. In turn, it requires you to trust that the person or company never has a breakdown, starts fighting you directly, or does anything else drastic thatll force you rethink your entire tech stack. Electron is maintained by a diverse set of companies (Microsoft, Slack/Salesforce, Notion, and more) and will continue to welcome more companies interested in ensuring their “seat at the decision-making table”.
### Stability, security, performance
Electron delivers the best experience on all target platforms (macOS, Windows, Linux) by bundling the latest version of Chromium, V8, and Node.js directly with the application binary. When it comes to running and rendering web content with upmost stability, security, and performance, we currently believe that stack to be “best in class”.
#### Why bundle anything at all
You might wonder why we bundle Chromiums web stack with our apps when most modern operating systems already ship a browser and some form of web view. Bundling doesnt just increase the amount of work for Electron maintainers dramatically, it also increases the total disk size of Electron apps (most apps are >100MB). Many Electron maintainers once developed applications that did make use of embedded web views — and have since accepted the increased disk size and maintainer work as a worthy trade-off.
When using an operating system's built-in web view, you're limited by the browser version included in the oldest operating system version you need to support. We have found the following problems with this approach:
- **Stability**: The modern web technology stack is complex, and as a result, youll sooner or later encounter bugs. If you use the operating systems web view, your only recourse will be to ask your customers to upgrade their operating system. If no upgrade is available for that machine (because of no ability to upgrade to the latest macOS or Windows 11), youll have to ask them to buy a new computer. If youre unlucky, youre now losing a major customer because they will not upgrade their entire fleet of thousands of machines just because one team wanted to try your startups app. You have _no recourse_ in this situation. Even the risk of that happening is unacceptable to the companies that employ the Electron maintainers.
- **Security:** Similar to how you can fix stability bugs by releasing an app update, you can also release security fixes to your application without asking your customer to upgrade their operating system. Even if operating system providers prioritize updates to their built-in browser, we have not seen them reliably update the built-in web views with similar urgency. Bundling a web renderer gives you, the developer, control.
- **Performance:** For simple HTML documents, a built-in web view will sometimes use fewer resources than an app with a bundled framework. For bigger apps, it is our experience that we can deliver better performance with the latest version of Chromium than we can with built-in web views. You might think that the built-in view can share a lot of resources with other apps and the operating system— but for security reasons, apps have to run in their own sandboxes, isolated from each other. At that point, the question is whether the OS web view is more performant than Chromium. Across many apps, our experience is that bundling Chromium and Node.js enables us to build better and more performant experiences.
#### Why bundle Chromium and Node.js
Electron aims to enable the apps it supports to deliver the best possible user experience, followed by the best possible developer experience. Chromium is currently the best cross-platform rendering stack available. Node.js uses Chromiums JavaScript engine V8, allowing us to combine the powers of both.
- **Native code when you want it**: Thanks to Node.js mature native addon system, you can always write native code. There is no system API out of reach for you. Whatever macOS, Windows, or Linux feature youll want to integrate with —as long as you can do it in C, C++, Objective-C, Rust, or another native language, youll be able to do it in Electron. Again, this gives you, the developer, maximum control. With Electron, you can use web technologies without choosing _only_ web technologies.
### Developer experience
To summarize, we aim to build an Electron that is mature, enterprise-grade, and ready for mission-critical applications. We prioritize reliability, stability, security, and performance. That said, you might also choose Electron for its developer experience:
- **Powerful ecosystem**: Anything you find on npm will run inside Electron. Any resource available to you about how to work with Node.js also applies to Electron. In addition, Electron itself has a [thriving ecosystem](https://www.npmjs.com/search?q=electron) — including plenty of choices for installers, updaters, deeper operating system-integration, and more.
- **Plenty of built-in capabilities:** Over the last ten years, Electrons core has gained plenty of native capabilities that you might need to build your application. Written in C++ and Objective-C, Electron has [dozens of easy-to-use APIs for deeper operating-system integration](https://www.electronjs.org/docs/latest/api/app) — like advanced window customization for transparent or oddly shaped widgets, receiving push notifications from the Apple Push Notification Network, or handling a custom URL protocol for your app.
- **Open source**: The entire stack is open source and open to your inspection. This ensures your freedom to add any feature or fix any bug you might encounter in the future.
- **Native code when you need it:** It bears repeating that Electron allows you to mix and match web technologies and C++, C, Objective-C, Rust, and other native languages. Whether it be SQLite, a whole LLM, or just the ability to call one specific native API, Electron will make it easy.
---
## Why choose something else
As outlined above, the web is an amazing platform for building interfaces. That doesnt mean that we, the maintainers, would build _everything_ with HTML and CSS. Here are some notable exceptions:
**Resource-Constrained Environments and IoT:** In scenarios with very limited memory or processing power (say, one megabyte of memory and 100MHz of processing power on a low-powered ARM Cortex-M), you will likely need to use a low-level language to directly talk to the display to output basic text and images. Even on slightly higher-powered single-chip devices you might want to consider an embedded UI framework. A classic example is a smart watch.
**Small Disk Footprint**: Zipped Electron apps are usually around 80 to 100 Megabytes. If a smaller disk footprint is a hard requirement, youll have to use something else.
**Operating System UI Frameworks and Libraries**: By allowing you to write native code, Electron can do anything a native application can do, including the use of the operating systems UI components, like WinUI, SwiftUI, or AppKit. In practice, most Electron apps make rare use of that ability. If you want the majority of your app to be built with operating system-provided interface components, youll likely be better off building fully native apps for each operating system youd like to target. Its not that its impossible with Electron, itll just likely be an overall easier development process.
**Games and Real-Time Graphics:** If you're building a high-performance game or application requiring complex real-time 3D graphics, native frameworks like Unity, Unreal Engine, or DirectX/OpenGL will provide better performance and more direct access to graphics hardware. Web fans might point out caveats, like the fact that even Unreal Engine ships with Chromium — or that WebGPU and WebGL are developing rapidly and many game engines, including the ones listed here, can now output their games in a format that runs in a browser. That said, if you asked us to build the next AAA game, wed likely use something else than just web technologies.
**Embedding Lightweight Websites**: Electron apps typically are mostly web apps with native code sprinkled in where useful. Processing-heavy Electron applications tend to write the UI in HTML/CSS and build the backend in Rust, C++, or another native language. If youre planning to build a primarily native application that also wants to display a little website in a specific view, you might be better off using the OS-provided web view or something like [ultralight](https://ultralig.ht/).

View File

@@ -133,6 +133,8 @@ auto_filenames = {
"docs/api/structures/segmented-control-segment.md",
"docs/api/structures/serial-port.md",
"docs/api/structures/service-worker-info.md",
"docs/api/structures/shared-dictionary-info.md",
"docs/api/structures/shared-dictionary-usage-info.md",
"docs/api/structures/shared-worker-info.md",
"docs/api/structures/sharing-item.md",
"docs/api/structures/shortcut-details.md",

View File

@@ -8,7 +8,7 @@ import * as deprecate from '@electron/internal/common/deprecate';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import { app, ipcMain, session, webFrameMain, dialog } from 'electron/main';
import type { BrowserWindowConstructorOptions, MessageBoxOptions } from 'electron/main';
import type { BrowserWindowConstructorOptions, MessageBoxOptions, NavigationEntry } from 'electron/main';
import * as path from 'path';
import * as url from 'url';
@@ -343,8 +343,8 @@ WebContents.prototype.loadFile = function (filePath, options = {}) {
type LoadError = { errorCode: number, errorDescription: string, url: string };
WebContents.prototype.loadURL = function (url, options) {
const p = new Promise<void>((resolve, reject) => {
function _awaitNextLoad (this: Electron.WebContents, navigationUrl: string) {
return new Promise<void>((resolve, reject) => {
const resolveAndCleanup = () => {
removeListeners();
resolve();
@@ -402,7 +402,7 @@ WebContents.prototype.loadURL = function (url, options) {
// the only one is with a bad scheme, perhaps ERR_INVALID_ARGUMENT
// would be more appropriate.
if (!error) {
error = { errorCode: -2, errorDescription: 'ERR_FAILED', url };
error = { errorCode: -2, errorDescription: 'ERR_FAILED', url: navigationUrl };
}
finishListener();
};
@@ -426,6 +426,10 @@ WebContents.prototype.loadURL = function (url, options) {
this.on('did-stop-loading', stopLoadingListener);
this.on('destroyed', stopLoadingListener);
});
};
WebContents.prototype.loadURL = function (url, options) {
const p = _awaitNextLoad.call(this, url);
// Add a no-op rejection handler to silence the unhandled rejection error.
p.catch(() => {});
this._loadURL(url, options ?? {});
@@ -514,9 +518,9 @@ WebContents.prototype.canGoForward = function () {
};
const canGoToOffsetDeprecated = deprecate.warnOnce('webContents.canGoToOffset', 'webContents.navigationHistory.canGoToOffset');
WebContents.prototype.canGoToOffset = function () {
WebContents.prototype.canGoToOffset = function (index: number) {
canGoToOffsetDeprecated();
return this._canGoToOffset();
return this._canGoToOffset(index);
};
const clearHistoryDeprecated = deprecate.warnOnce('webContents.clearHistory', 'webContents.navigationHistory.clear');
@@ -609,7 +613,27 @@ WebContents.prototype._init = function () {
length: this._historyLength.bind(this),
getEntryAtIndex: this._getNavigationEntryAtIndex.bind(this),
removeEntryAtIndex: this._removeNavigationEntryAtIndex.bind(this),
getAllEntries: this._getHistory.bind(this)
getAllEntries: this._getHistory.bind(this),
restore: ({ index, entries }: { index?: number, entries: NavigationEntry[] }) => {
if (index === undefined) {
index = entries.length - 1;
}
if (index < 0 || !entries[index]) {
throw new Error('Invalid index. Index must be a positive integer and within the bounds of the entries length.');
}
const p = _awaitNextLoad.call(this, entries[index].url);
p.catch(() => {});
try {
this._restoreHistory(index, entries);
} catch (error) {
return Promise.reject(error);
}
return p;
}
},
writable: false,
enumerable: true

View File

@@ -15,7 +15,7 @@ export const windowSetup = (isWebView: boolean, isHiddenPage: boolean) => {
// But we do not support prompt().
window.prompt = function () {
throw new Error('prompt() is and will not be supported.');
throw new Error('prompt() is not supported.');
};
if (contextIsolationEnabled) internalContextBridge.overrideGlobalValueFromIsolatedWorld(['prompt'], window.prompt);

View File

@@ -128,9 +128,19 @@ fix_font_face_resolution_when_renderer_is_blocked.patch
feat_enable_passing_exit_code_on_service_process_crash.patch
chore_remove_reference_to_chrome_browser_themes.patch
feat_enable_customizing_symbol_color_in_framecaptionbutton.patch
build_expose_webplugininfo_interface_to_electron.patch
build_allow_electron_mojom_interfaces_to_depend_on_blink.patch
osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch
feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch
chore_partial_revert_of.patch
fix_software_compositing_infinite_loop.patch
refactor_unfilter_unresponsive_events.patch
support_bstr_pkey_appusermodel_id_in_windows_shortcuts.patch
cherry-pick-1282289030ab.patch
cherry-pick-3dc17c461b12.patch
ignore_parse_errors_for_pkey_appusermodel_toastactivatorclsid.patch
feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch
feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch
cherry-pick-dd8e2822e507.patch
fix_osr_stutter_in_both_cpu_and_gpu_capture_when_page_has_animation.patch
reland_lzma_sdk_update_to_24_09.patch
fix_drag_and_drop_icons_on_windows.patch

View File

@@ -23,7 +23,7 @@ index ad0092ef2e13853e4bb8b923481559a043b00ab7..1c2dfd23f18733e21312992877ae1499
int32_t world_id) {}
virtual void DidClearWindowObject() {}
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 3d0544422f05e2edc02921fc39335bf10184028e..bf44c1ffef7df44448ee7b5b176c33348599f0be 100644
index 6f932370352cb64a218ab93fa04f70a00947c228..df0a2685638b8f9b75f97ec96dd4c8706c013e7e 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4792,6 +4792,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,

View File

@@ -116,10 +116,10 @@ index 083af135d890c2837e72c314e170e81931bd2a20..5245ea88441ef84c15b8052a9011ce70
// Visibility -----------------------------------------------------------
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc
index f5fe2e061448673c788315a167efff1fb70c3ef0..ed0c77c14e8dcf3e6d7328c8a9c640388b7be92d 100644
index ad134361e0b9c9a9db4cec06c429102d5dbe0c4e..82aef58c0a3c00c818e0d60df9a5296162c57cc3 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -2452,6 +2452,10 @@ void WebViewImpl::SetPageLifecycleStateInternal(
@@ -2456,6 +2456,10 @@ void WebViewImpl::SetPageLifecycleStateInternal(
TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal",
"old_state", old_state, "new_state", new_state);
@@ -130,7 +130,7 @@ index f5fe2e061448673c788315a167efff1fb70c3ef0..ed0c77c14e8dcf3e6d7328c8a9c64038
bool storing_in_bfcache = new_state->is_in_back_forward_cache &&
!old_state->is_in_back_forward_cache;
bool restoring_from_bfcache = !new_state->is_in_back_forward_cache &&
@@ -3984,10 +3988,23 @@ PageScheduler* WebViewImpl::Scheduler() const {
@@ -3988,10 +3992,23 @@ PageScheduler* WebViewImpl::Scheduler() const {
return GetPage()->GetPageScheduler();
}
@@ -155,7 +155,7 @@ index f5fe2e061448673c788315a167efff1fb70c3ef0..ed0c77c14e8dcf3e6d7328c8a9c64038
// Do not throttle if the page should be painting.
bool is_visible =
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h
index d5397c53559ba239e46c9485fb30daea89bd392b..4989d9f6a28d519098b16e832c2a36c61ab04c15 100644
index e4784453b357e2a9c18ccf5acfde43f5afd583ae..2c5a9f08ac34ae4106f25c42dca04f78ae703618 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.h
+++ b/third_party/blink/renderer/core/exported/web_view_impl.h
@@ -448,6 +448,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
@@ -166,7 +166,7 @@ index d5397c53559ba239e46c9485fb30daea89bd392b..4989d9f6a28d519098b16e832c2a36c6
void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state,
bool is_initial_state) override;
mojom::blink::PageVisibilityState GetVisibilityState() override;
@@ -933,6 +934,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
@@ -936,6 +937,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
// If true, we send IPC messages when |preferred_size_| changes.
bool send_preferred_size_changes_ = false;

View File

@@ -49,7 +49,7 @@ index 2f33ec660a975522c473ecd50e633b5edaca707f..65221a51927d9f44bd6adbad88fa1144
// its owning reference back to our owning LocalFrame.
client_->Detached(type);
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
index 5c8c50fc2025a160bfb0587cd46ba45f8d58a175..d918e9d165acefa8ba3a225aec261ebf028c40f7 100644
index 6a071e614bfd44fce79bf6db80d026f24eefdd7f..1daf1d65e2e6ac494790aa9201609c9ca9af6828 100644
--- a/third_party/blink/renderer/core/frame/local_frame.cc
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -746,10 +746,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {

View File

@@ -1,20 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Fri, 9 Aug 2024 22:39:47 +0900
Subject: build: expose webplugininfo interface to electron
Subject: build: allow electron mojom interfaces to depend on blink
mojom_platform
Allows implementing electron::mojom::ElectronPluginInfoHost interface
which provides plugin details between browser<->renderer.
Needed for:
1) //electron/shell/common:plugin
2) //electron/shell/common:web_contents_utility
diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn
index b84e3a73036b0bc2b782d35c04359ba401521917..2d8b206a118592f15a93c2a7bcb2c37c80571cd8 100644
index b84e3a73036b0bc2b782d35c04359ba401521917..0099cf78779215bcc85ce3fb57cb34827337111e 100644
--- a/content/public/common/BUILD.gn
+++ b/content/public/common/BUILD.gn
@@ -377,6 +377,7 @@ mojom("interfaces") {
@@ -377,6 +377,8 @@ mojom("interfaces") {
"//content/common/*",
"//extensions/common:mojom",
"//extensions/common:mojom_blink",
+ "//electron/shell/common:plugin",
+ "//electron/shell/common:web_contents_utility",
]
sources = [

View File

@@ -33,10 +33,10 @@ index 9580623c57cb02f7e924742c6cb1638676881115..ad80d8e63dfebbbdb8eaa63bfe38a6f8
"//base",
"//build:branding_buildflags",
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 1a136cdeb8aea796a8b3f81e4f791c29ae02cf02..9033419bb880830076835e8400276e738b71f428 100644
index c2c22a92bccb2487319affed384cac10dbc839a8..d3bccc91ebe651d3075325aaf9d0c5114e238b85 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -4525,7 +4525,7 @@ static_library("browser") {
@@ -4524,7 +4524,7 @@ static_library("browser") {
]
}

View File

@@ -9,10 +9,10 @@ potentially prevent a window from being created.
TODO(loc): this patch is currently broken.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index d29dac893805535bbbd9aefe096a0ca2825a01aa..4f31803e492d0d05b29659f8bf75b6fee7aff25e 100644
index 469e49a552a2229e8686953d5b10b5d1ac974d4e..01367204ab9d872077547c2b2c33c58d9a1653b9 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -9170,6 +9170,7 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -9188,6 +9188,7 @@ void RenderFrameHostImpl::CreateNewWindow(
last_committed_origin_, params->window_container_type,
params->target_url, params->referrer.To<Referrer>(),
params->frame_name, params->disposition, *params->features,
@@ -21,10 +21,10 @@ index d29dac893805535bbbd9aefe096a0ca2825a01aa..4f31803e492d0d05b29659f8bf75b6fe
&no_javascript_access);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index c93722f2fc5340edeeace5a1690d0fa7d84dffb2..e7e47a9aa5a22aea2aa0eeab7bd661b47c9cbdae 100644
index 62420958702cebe16423f0ea42ca200f5a93d45a..d35ae086793a52ea38da97b9236e073b806a67a6 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4887,6 +4887,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -4895,6 +4895,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
SetPartitionedPopinOpenerOnNewWindowIfNeeded(new_contents_impl, params,
opener);
@@ -37,7 +37,7 @@ index c93722f2fc5340edeeace5a1690d0fa7d84dffb2..e7e47a9aa5a22aea2aa0eeab7bd661b4
// If the new frame has a name, make sure any SiteInstances that can find
// this named frame have proxies for it. Must be called after
// SetSessionStorageNamespace, since this calls CreateRenderView, which uses
@@ -4928,12 +4934,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -4936,12 +4942,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
AddWebContentsDestructionObserver(new_contents_impl);
}
@@ -148,10 +148,10 @@ index 77ee6ba6c65c95622e41f86906ea813be62f72e9..7f38098505afabe1887a6d98a705f1ad
// typically happens when popups are created.
virtual void WebContentsCreated(WebContents* source_contents,
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 6fed6b4c7ad72bd90aeb9f6eea7a3081972c88f8..3d0544422f05e2edc02921fc39335bf10184028e 100644
index a0e45dfcf20ed570f2751a8f194b4a82b46c87b6..6f932370352cb64a218ab93fa04f70a00947c228 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -6849,6 +6849,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
@@ -6865,6 +6865,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
request.HasUserGesture(), GetWebFrame()->IsAdFrame(),
GetWebFrame()->IsAdScriptInStack());
@@ -210,10 +210,10 @@ index c576ace24e81cc877aa2595d40e0a13a7af9f6a2..210fb97d44c19c29af424cc7b9cb3169
} // namespace blink
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc
index 00a4ed4f0625981e3bef338399957419d2cffdf0..d0db7f8727dc2fbe0a9ae0489a6aa4e278e1cb34 100644
index ba53e2576ff7944071fd46c2d4d8635084738cb3..fb38a3b96cd32720096b106845f706d113f1794e 100644
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -2234,6 +2234,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
@@ -2235,6 +2235,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
WebWindowFeatures window_features =
GetWindowFeaturesFromString(features, entered_window);

View File

@@ -0,0 +1,264 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kevin Ellis <kevers@google.com>
Date: Thu, 12 Dec 2024 06:47:30 -0800
Subject: Prune superfluous calls to SetCompositorPending
We only need to call SetCompositorPending with the pending cancel
reason if the animation is running on the compositor.
The stack trace on the bug report showed a significant time being
spent in HasProperty. The timing was also optimized in this CL to
prevent unnecessary duplicate calculations.
Bug: 382394791
Change-Id: I03ffa1b486b267e05f63328212d192dfca26eb53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6076354
Reviewed-by: Robert Flack <flackr@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Reviewed-by: Claire Chambers <clchambers@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1395390}
diff --git a/third_party/blink/renderer/core/animation/animation.cc b/third_party/blink/renderer/core/animation/animation.cc
index 1b384beef682c87b4bec3c9233d45529c5569b56..694ca51b1a59270289fabe70dbb381167fc89a83 100644
--- a/third_party/blink/renderer/core/animation/animation.cc
+++ b/third_party/blink/renderer/core/animation/animation.cc
@@ -1269,14 +1269,7 @@ void Animation::setEffect(AnimationEffect* new_effect) {
ResolveTimelineOffsets(timeline_ ? timeline_->GetTimelineRange()
: TimelineRange());
- SetOutdated();
-
- // 7. Run the procedure to update an animations finished state for animation
- // with the did seek flag set to false (continuous), and the synchronously
- // notify flag set to false (async).
- UpdateFinishedState(UpdateType::kContinuous, NotificationType::kAsync);
-
- SetCompositorPending(CompositorPendingReason::kPendingEffectChange);
+ EffectInvalidated();
// Notify of a potential state change.
NotifyProbe();
@@ -2373,6 +2366,26 @@ void Animation::StartAnimationOnCompositor(
timeline()->IsMonotonicallyIncreasing(), boundary_aligned);
}
+Animation::NativePaintWorkletReasons Animation::GetNativePaintWorkletReasons() {
+ if (native_paint_worklet_reasons_) {
+ return native_paint_worklet_reasons_.value();
+ }
+ NativePaintWorkletReasons reasons = kNoPaintWorklet;
+ if (KeyframeEffect* keyframe_effect = DynamicTo<KeyframeEffect>(effect())) {
+ if (RuntimeEnabledFeatures::CompositeBGColorAnimationEnabled() &&
+ keyframe_effect->Affects(
+ PropertyHandle(GetCSSPropertyBackgroundColor()))) {
+ reasons |= kBackgroundColorPaintWorklet;
+ }
+ if (RuntimeEnabledFeatures::CompositeClipPathAnimationEnabled() &&
+ keyframe_effect->Affects(PropertyHandle(GetCSSPropertyClipPath()))) {
+ reasons |= kClipPathPaintWorklet;
+ }
+ }
+ native_paint_worklet_reasons_ = reasons;
+ return reasons;
+}
+
// TODO(crbug.com/960944): Rename to SetPendingCommit. This method handles both
// composited and non-composited animations. The use of 'compositor' in the name
// is confusing.
@@ -2831,7 +2844,7 @@ bool Animation::Update(TimingUpdateReason reason) {
// After updating the animation time if the animation is no longer current
// blink will no longer composite the element (see
// CompositingReasonFinder::RequiresCompositingFor*Animation).
- if (!content_->IsCurrent()) {
+ if (!content_->IsCurrent() && HasActiveAnimationsOnCompositor()) {
SetCompositorPending(CompositorPendingReason::kPendingCancel);
}
}
@@ -2872,6 +2885,9 @@ void Animation::UpdateIfNecessary() {
}
void Animation::EffectInvalidated() {
+ prior_native_paint_worklet_reasons_ = native_paint_worklet_reasons_;
+ native_paint_worklet_reasons_ = std::nullopt;
+
SetOutdated();
UpdateFinishedState(UpdateType::kContinuous, NotificationType::kAsync);
// FIXME: Needs to consider groups when added.
@@ -3379,15 +3395,22 @@ bool Animation::IsInDisplayLockedSubtree() {
}
void Animation::UpdateCompositedPaintStatus() {
- if (!NativePaintImageGenerator::NativePaintWorkletAnimationsEnabled()) {
- return;
+ if (GetNativePaintWorkletReasons() == Animation::kNoPaintWorklet) {
+ if (!prior_native_paint_worklet_reasons_ ||
+ prior_native_paint_worklet_reasons_ == Animation::kNoPaintWorklet) {
+ return;
+ }
}
+ prior_native_paint_worklet_reasons_ = GetNativePaintWorkletReasons();
+
KeyframeEffect* keyframe_effect = DynamicTo<KeyframeEffect>(content_.Get());
if (!keyframe_effect) {
return;
}
+ // TODO(crbug.com/383562308): If the target changed since the last update, we
+ // need to trigger an update for the previous and current target.
Element* target = keyframe_effect->EffectTarget();
if (!target) {
return;
@@ -3396,14 +3419,7 @@ void Animation::UpdateCompositedPaintStatus() {
ElementAnimations* element_animations = target->GetElementAnimations();
DCHECK(element_animations);
- if (RuntimeEnabledFeatures::CompositeBGColorAnimationEnabled()) {
- element_animations->RecalcCompositedStatus(target,
- GetCSSPropertyBackgroundColor());
- }
- if (RuntimeEnabledFeatures::CompositeClipPathAnimationEnabled()) {
- element_animations->RecalcCompositedStatus(target,
- GetCSSPropertyClipPath());
- }
+ element_animations->RecalcCompositedStatus(target);
}
void Animation::Trace(Visitor* visitor) const {
diff --git a/third_party/blink/renderer/core/animation/animation.h b/third_party/blink/renderer/core/animation/animation.h
index c20180d785ca62417ba5e05417462fec5beeae5b..cfd2b44724c86b272982dee4db54ed5191e51d22 100644
--- a/third_party/blink/renderer/core/animation/animation.h
+++ b/third_party/blink/renderer/core/animation/animation.h
@@ -393,6 +393,15 @@ class CORE_EXPORT Animation : public EventTarget,
start_time_ = start_time;
}
+ enum NativePaintWorkletProperties {
+ kNoPaintWorklet = 0,
+ kBackgroundColorPaintWorklet = 1,
+ kClipPathPaintWorklet = 2
+ };
+
+ using NativePaintWorkletReasons = uint32_t;
+ NativePaintWorkletReasons GetNativePaintWorkletReasons();
+
protected:
DispatchEventResult DispatchEventInternal(Event&) override;
void AddedEventListener(const AtomicString& event_type,
@@ -583,6 +592,13 @@ class CORE_EXPORT Animation : public EventTarget,
Member<Event> pending_remove_event_;
+ // Cache whether animation can potentially have native paint worklets.
+ // In the event of the keyframes changing, we need a new evaluation, of
+ // the composited status for native paint worklet eligible properties.
+ // A change in the playState can also necessitate a composited style update.
+ std::optional<NativePaintWorkletReasons> native_paint_worklet_reasons_;
+ std::optional<NativePaintWorkletReasons> prior_native_paint_worklet_reasons_;
+
// TODO(crbug.com/960944): Consider reintroducing kPause and cleanup use of
// mutually exclusive pending_play_ and pending_pause_ flags.
enum class CompositorAction { kNone, kStart, kCancel };
diff --git a/third_party/blink/renderer/core/animation/element_animations.cc b/third_party/blink/renderer/core/animation/element_animations.cc
index ca2864f2f7ef8b8969d63a25e85f23f5c9a97b74..b1f3b32332af4f948bb2598f1646f29c97660413 100644
--- a/third_party/blink/renderer/core/animation/element_animations.cc
+++ b/third_party/blink/renderer/core/animation/element_animations.cc
@@ -97,43 +97,59 @@ void ElementAnimations::RecalcCompositedStatusForKeyframeChange(
Element& element,
AnimationEffect* effect) {
if (KeyframeEffect* keyframe_effect = DynamicTo<KeyframeEffect>(effect)) {
- if (CompositedBackgroundColorStatus() ==
- ElementAnimations::CompositedPaintStatus::kComposited &&
- keyframe_effect->Affects(
- PropertyHandle(GetCSSPropertyBackgroundColor())) &&
- element.GetLayoutObject()) {
- SetCompositedBackgroundColorStatus(
- ElementAnimations::CompositedPaintStatus::kNeedsRepaint);
- element.GetLayoutObject()->SetShouldDoFullPaintInvalidation();
+ if (RuntimeEnabledFeatures::CompositeBGColorAnimationEnabled()) {
+ if (CompositedBackgroundColorStatus() ==
+ ElementAnimations::CompositedPaintStatus::kComposited &&
+ keyframe_effect->Affects(
+ PropertyHandle(GetCSSPropertyBackgroundColor())) &&
+ element.GetLayoutObject()) {
+ SetCompositedBackgroundColorStatus(
+ ElementAnimations::CompositedPaintStatus::kNeedsRepaint);
+ element.GetLayoutObject()->SetShouldDoFullPaintInvalidation();
+ }
}
- if (CompositedClipPathStatus() ==
- ElementAnimations::CompositedPaintStatus::kComposited &&
- keyframe_effect->Affects(PropertyHandle(GetCSSPropertyClipPath())) &&
- element.GetLayoutObject()) {
- SetCompositedClipPathStatus(
- ElementAnimations::CompositedPaintStatus::kNeedsRepaint);
- element.GetLayoutObject()->SetShouldDoFullPaintInvalidation();
- // For clip paths, we also need to update the paint properties to switch
- // from path based to mask based clip.
- element.GetLayoutObject()->SetNeedsPaintPropertyUpdate();
+ if (RuntimeEnabledFeatures::CompositeClipPathAnimationEnabled()) {
+ if (CompositedClipPathStatus() ==
+ ElementAnimations::CompositedPaintStatus::kComposited &&
+ keyframe_effect->Affects(PropertyHandle(GetCSSPropertyClipPath())) &&
+ element.GetLayoutObject()) {
+ SetCompositedClipPathStatus(
+ ElementAnimations::CompositedPaintStatus::kNeedsRepaint);
+ element.GetLayoutObject()->SetShouldDoFullPaintInvalidation();
+ // For clip paths, we also need to update the paint properties to switch
+ // from path based to mask based clip.
+ element.GetLayoutObject()->SetNeedsPaintPropertyUpdate();
+ }
}
}
}
-void ElementAnimations::RecalcCompositedStatus(Element* element,
- const CSSProperty& property) {
- ElementAnimations::CompositedPaintStatus status =
- HasAnimationForProperty(property)
- ? ElementAnimations::CompositedPaintStatus::kNeedsRepaint
- : ElementAnimations::CompositedPaintStatus::kNoAnimation;
+void ElementAnimations::RecalcCompositedStatus(Element* element) {
+ Animation::NativePaintWorkletReasons reasons = Animation::kNoPaintWorklet;
+ for (auto& entry : Animations()) {
+ if (entry.key->CalculateAnimationPlayState() ==
+ V8AnimationPlayState::Enum::kIdle) {
+ continue;
+ }
+ reasons |= entry.key->GetNativePaintWorkletReasons();
+ }
- if (property.PropertyID() == CSSPropertyID::kBackgroundColor) {
+ if (RuntimeEnabledFeatures::CompositeBGColorAnimationEnabled()) {
+ ElementAnimations::CompositedPaintStatus status =
+ reasons & Animation::kBackgroundColorPaintWorklet
+ ? ElementAnimations::CompositedPaintStatus::kNeedsRepaint
+ : ElementAnimations::CompositedPaintStatus::kNoAnimation;
if (SetCompositedBackgroundColorStatus(status) &&
element->GetLayoutObject()) {
element->GetLayoutObject()->SetShouldDoFullPaintInvalidation();
}
- } else if (property.PropertyID() == CSSPropertyID::kClipPath) {
+ }
+ if (RuntimeEnabledFeatures::CompositeClipPathAnimationEnabled()) {
+ ElementAnimations::CompositedPaintStatus status =
+ reasons & Animation::kClipPathPaintWorklet
+ ? ElementAnimations::CompositedPaintStatus::kNeedsRepaint
+ : ElementAnimations::CompositedPaintStatus::kNoAnimation;
if (SetCompositedClipPathStatus(status) && element->GetLayoutObject()) {
element->GetLayoutObject()->SetShouldDoFullPaintInvalidation();
// For clip paths, we also need to update the paint properties to switch
diff --git a/third_party/blink/renderer/core/animation/element_animations.h b/third_party/blink/renderer/core/animation/element_animations.h
index 624f542785befe6ce92e7f75eb8595a2015a77ef..3171061ceb1a0dad426481454d3698c1eee22fd0 100644
--- a/third_party/blink/renderer/core/animation/element_animations.h
+++ b/third_party/blink/renderer/core/animation/element_animations.h
@@ -120,7 +120,7 @@ class CORE_EXPORT ElementAnimations final
void RecalcCompositedStatusForKeyframeChange(Element& element,
AnimationEffect* effect);
- void RecalcCompositedStatus(Element* element, const CSSProperty& property);
+ void RecalcCompositedStatus(Element* element);
// TODO(crbug.com/1301961): Consider converting to an array or flat map of
// fields for paint properties that can be composited.

View File

@@ -0,0 +1,114 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Orko Garai <orko@igalia.com>
Date: Fri, 29 Nov 2024 16:17:04 +0000
Subject: Wayland IME: Underline composition text fallback
At this time text-input-v3 does not provide any styling information.
As a quality-of-life improvement, ensure that a default composition
style is applied so that the composition text is underlined.
This will also ensure that the user experience is consistent with
ozone/x11.
Bug: 355238629
Change-Id: I8d4bce5e5700510d72f114bb57171f43646be098
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5741768
Commit-Queue: Orko Garai <orko@igalia.com>
Reviewed-by: Darren Shen <shend@chromium.org>
Reviewed-by: Kramer Ge <fangzhoug@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1389833}
diff --git a/ui/ozone/platform/wayland/host/wayland_input_method_context.cc b/ui/ozone/platform/wayland/host/wayland_input_method_context.cc
index a063ff09e6c388242b94dca73d31b586f12e80a1..23d9918afde6847a3776d810ed60738c59f80c30 100644
--- a/ui/ozone/platform/wayland/host/wayland_input_method_context.cc
+++ b/ui/ozone/platform/wayland/host/wayland_input_method_context.cc
@@ -552,6 +552,7 @@ void WaylandInputMethodContext::OnPreeditString(
const gfx::Range& preedit_cursor) {
CompositionText composition_text;
composition_text.text = base::UTF8ToUTF16(text);
+ bool has_composition_style = false;
for (const auto& span : spans) {
auto start_offset = OffsetFromUTF8Offset(text, span.index);
if (!start_offset)
@@ -562,9 +563,18 @@ void WaylandInputMethodContext::OnPreeditString(
const auto& style = span.style;
if (!style.has_value())
continue;
+ if (style->type == ImeTextSpan::Type::kComposition) {
+ has_composition_style = true;
+ }
composition_text.ime_text_spans.emplace_back(style->type, *start_offset,
*end_offset, style->thickness);
}
+ if (!composition_text.text.empty() && !has_composition_style) {
+ // If no explicit composition style is specified, add default composition
+ // style to the composition text.
+ composition_text.ime_text_spans.emplace_back(
+ ImeTextSpan::Type::kComposition, 0, composition_text.text.length());
+ }
if (!preedit_cursor.IsValid()) {
// This is the case if a preceding preedit_cursor event in text-input-v1 was
// not received or an explicit negative value was requested to hide the
diff --git a/ui/ozone/platform/wayland/host/wayland_input_method_context_unittest.cc b/ui/ozone/platform/wayland/host/wayland_input_method_context_unittest.cc
index 7fed0c0a206c98764abbe2fc22110dc31b9fdbd8..24b90a83f2dad3a29634549fc4716980fe409d52 100644
--- a/ui/ozone/platform/wayland/host/wayland_input_method_context_unittest.cc
+++ b/ui/ozone/platform/wayland/host/wayland_input_method_context_unittest.cc
@@ -1174,6 +1174,34 @@ TEST_P(WaylandInputMethodContextTest, SetInputTypeAfterFocus) {
});
}
+TEST_P(WaylandInputMethodContextTest, OnPreeditChangedDefaultCompositionStyle) {
+ constexpr std::string_view kPreeditString("PreeditString");
+ constexpr gfx::Range kSelection{7, 13};
+ input_method_context_->OnPreeditString(
+ kPreeditString,
+ // No composition style provided.
+ {{1,
+ 3,
+ {{ImeTextSpan::Type::kMisspellingSuggestion,
+ ImeTextSpan::Thickness::kNone}}}},
+ kSelection);
+ EXPECT_TRUE(input_method_context_delegate_->was_on_preedit_changed_called());
+ EXPECT_EQ(input_method_context_delegate_->last_preedit()->ime_text_spans,
+ (ImeTextSpans{ImeTextSpan(ImeTextSpan::Type::kMisspellingSuggestion,
+ 1, 4, ImeTextSpan::Thickness::kNone),
+ // Default composition should be applied.
+ ImeTextSpan(ImeTextSpan::Type::kComposition, 0,
+ kPreeditString.size(),
+ ImeTextSpan::Thickness::kThin)}));
+ EXPECT_EQ(
+ input_method_context_->predicted_state_for_testing().surrounding_text,
+ u"PreeditString");
+ EXPECT_EQ(input_method_context_->predicted_state_for_testing().composition,
+ gfx::Range(0, kPreeditString.size()));
+ EXPECT_EQ(input_method_context_->predicted_state_for_testing().selection,
+ kSelection);
+}
+
TEST_P(WaylandInputMethodContextTest, OnPreeditChanged) {
constexpr std::string_view kPreeditString("PreeditString");
constexpr gfx::Range kSelection{7, 13};
@@ -1181,13 +1209,19 @@ TEST_P(WaylandInputMethodContextTest, OnPreeditChanged) {
kPreeditString,
{{0,
static_cast<uint32_t>(kPreeditString.size()),
- {{ImeTextSpan::Type::kComposition, ImeTextSpan::Thickness::kThin}}}},
+ {{ImeTextSpan::Type::kComposition, ImeTextSpan::Thickness::kThick}}},
+ {1,
+ 3,
+ {{ImeTextSpan::Type::kMisspellingSuggestion,
+ ImeTextSpan::Thickness::kNone}}}},
kSelection);
EXPECT_TRUE(input_method_context_delegate_->was_on_preedit_changed_called());
EXPECT_EQ(input_method_context_delegate_->last_preedit()->ime_text_spans,
- ImeTextSpans{ImeTextSpan(ImeTextSpan::Type::kComposition, 0,
- kPreeditString.size(),
- ImeTextSpan::Thickness::kThin)});
+ (ImeTextSpans{ImeTextSpan(ImeTextSpan::Type::kComposition, 0,
+ kPreeditString.size(),
+ ImeTextSpan::Thickness::kThick),
+ ImeTextSpan(ImeTextSpan::Type::kMisspellingSuggestion,
+ 1, 4, ImeTextSpan::Thickness::kNone)}));
EXPECT_EQ(
input_method_context_->predicted_state_for_testing().surrounding_text,
u"PreeditString");

View File

@@ -0,0 +1,71 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Patrick Meenan <pmeenan@chromium.org>
Date: Thu, 6 Feb 2025 07:41:40 -0800
Subject: Set is_web_secure_context when initializing Service Worker from disk
The value of is_web_secure_context is not serialized to disk when
storing the service worker registration (only a few select policies
are).
When instantiating the policy container for an already-registered
worker, it uses the default value (false) which is wrong.
Since Service Workers are guaranteed to ALWAYS be a web secure
context, this change explicitly sets it to true when restoring a
serialized policy.
See: https://w3c.github.io/webappsec-secure-contexts/#examples-service-workers
Bug: 387258077,383070811
Change-Id: I75efe895662ab4e6d68cacace6d05e004c5dfd33
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6236205
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Patrick Meenan <pmeenan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416795}
diff --git a/content/browser/renderer_host/policy_container_host.cc b/content/browser/renderer_host/policy_container_host.cc
index b17c33c425da7bc98a6669c6595a7e6185a96644..9630f39ee4570d084c877f69658534affef226d2 100644
--- a/content/browser/renderer_host/policy_container_host.cc
+++ b/content/browser/renderer_host/policy_container_host.cc
@@ -135,9 +135,11 @@ PolicyContainerPolicies::PolicyContainerPolicies(
allow_cross_origin_isolation(allow_cross_origin_isolation) {}
PolicyContainerPolicies::PolicyContainerPolicies(
- const blink::mojom::PolicyContainerPolicies& policies)
+ const blink::mojom::PolicyContainerPolicies& policies,
+ bool is_web_secure_context)
: referrer_policy(policies.referrer_policy),
ip_address_space(policies.ip_address_space),
+ is_web_secure_context(is_web_secure_context),
content_security_policies(
mojo::Clone(policies.content_security_policies)),
cross_origin_embedder_policy(policies.cross_origin_embedder_policy),
diff --git a/content/browser/renderer_host/policy_container_host.h b/content/browser/renderer_host/policy_container_host.h
index 394bd53bb5c1dfea5abe24b9047eb190884c2648..7add42348ef28079196b447feda78210815d1551 100644
--- a/content/browser/renderer_host/policy_container_host.h
+++ b/content/browser/renderer_host/policy_container_host.h
@@ -49,7 +49,8 @@ struct CONTENT_EXPORT PolicyContainerPolicies {
bool allow_cross_origin_isolation);
explicit PolicyContainerPolicies(
- const blink::mojom::PolicyContainerPolicies& policies);
+ const blink::mojom::PolicyContainerPolicies& policies,
+ bool is_web_secure_context);
// Used when loading workers from network schemes.
// WARNING: This does not populate referrer policy.
diff --git a/content/browser/service_worker/service_worker_registry.cc b/content/browser/service_worker/service_worker_registry.cc
index 8ce6875c21522032e8eb448338558c2a28f78613..efa037a599a38af655fd593767f35a601badd3a1 100644
--- a/content/browser/service_worker/service_worker_registry.cc
+++ b/content/browser/service_worker/service_worker_registry.cc
@@ -1076,7 +1076,8 @@ ServiceWorkerRegistry::GetOrCreateRegistration(
if (data.policy_container_policies) {
version->set_policy_container_host(
base::MakeRefCounted<PolicyContainerHost>(
- PolicyContainerPolicies(*data.policy_container_policies)));
+ PolicyContainerPolicies(*data.policy_container_policies,
+ /*is_web_secure_context=*/true)));
}
if (data.router_rules && version->IsStaticRouterEnabled()) {
auto error = version->SetupRouterEvaluator(*data.router_rules);

View File

@@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it
by changing something in Electron.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 1b748a2e0d803217985847014855b095b53c58e5..0e742f196367bbbe8c4e147ef4db4f8dbbe4cbbe 100644
index ce65cb2aec41faa58a1dfa43f5c1ac8e5bc66641..784a7536eec5a248e4725253c091b039047ff1ea 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4813,9 +4813,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -4821,9 +4821,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
bool renderer_started_hidden =
params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB;

View File

@@ -190,10 +190,10 @@ index 6c89a03712b9449e1a7b0e38ed9d019b30029c15..50b324ef3f1163e462ad145e58b42bf3
void SetContentsBounds(content::WebContents* source,
const gfx::Rect& bounds) override;
diff --git a/components/offline_pages/content/background_loader/background_loader_contents.cc b/components/offline_pages/content/background_loader/background_loader_contents.cc
index 072e7d0dde701a8f2d1de2704c8a056363324390..9e5ace2b1f32d5e5c542439f5365f9d9458cbf37 100644
index e0e9a5a8c1d8c242d39935e2456052619af33cc6..80518793447c70e8fc1dae9b42a59d40427ae52b 100644
--- a/components/offline_pages/content/background_loader/background_loader_contents.cc
+++ b/components/offline_pages/content/background_loader/background_loader_contents.cc
@@ -85,8 +85,7 @@ bool BackgroundLoaderContents::IsWebContentsCreationOverridden(
@@ -89,8 +89,7 @@ bool BackgroundLoaderContents::IsWebContentsCreationOverridden(
content::SiteInstance* source_site_instance,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
@@ -218,10 +218,10 @@ index c6838c83ef971b88769b1f3fba8095025ae25464..2da6a4e08340e72ba7de5d03444c2f17
content::WebContents* AddNewContents(
content::WebContents* source,
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index de6b544df67c9702b6771b08b003805b4f5fb5a4..4de45e398ec013714302c8cbaafa3bb6aa01ef8e 100644
index d88c3b6a3625c2f4d0c67677777202f7db85ea88..71835a747d6732b963c5cdc289539665aa988c47 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4782,8 +4782,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -4790,8 +4790,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
if (delegate_ && delegate_->IsWebContentsCreationOverridden(
source_site_instance, params.window_container_type,

View File

@@ -24,10 +24,10 @@ This patch temporarily disables the metrics so we can have green CI, and we
should continue seeking for a real fix.
diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc
index 53e54257aabbede66de278b0248c1c9959175143..69942e83c88d9c7eb99bd7b0eeae5c7b97356f17 100644
index adbe15bbbde7096970ec4098b1aa4fbb5ba48df5..9207aff59ec5fc9733e1e161ba2688a614e8e069 100644
--- a/content/browser/renderer_host/navigator.cc
+++ b/content/browser/renderer_host/navigator.cc
@@ -1435,6 +1435,7 @@ void Navigator::RecordNavigationMetrics(
@@ -1450,6 +1450,7 @@ void Navigator::RecordNavigationMetrics(
.InMilliseconds());
}
@@ -35,7 +35,7 @@ index 53e54257aabbede66de278b0248c1c9959175143..69942e83c88d9c7eb99bd7b0eeae5c7b
// If this is a same-process navigation and we have timestamps for unload
// durations, fill those metrics out as well.
if (params.unload_start && params.unload_end &&
@@ -1484,6 +1485,7 @@ void Navigator::RecordNavigationMetrics(
@@ -1499,6 +1500,7 @@ void Navigator::RecordNavigationMetrics(
first_before_unload_start_time)
.InMilliseconds());
}

View File

@@ -33,10 +33,10 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4
} // namespace net
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
index 4be02fdb03038ee4c30ea699cbbf56d1f5aaa7aa..b0a994b7c6d4be648d905bc1e4157bc03b56a428 100644
index c5199a66320bfdb7abda0878b7ae24e02f49b420..4f043e19acecfd7defcb79d397538168bb6bd42a 100644
--- a/services/network/network_context.cc
+++ b/services/network/network_context.cc
@@ -1793,6 +1793,13 @@ void NetworkContext::SetNetworkConditions(
@@ -1796,6 +1796,13 @@ void NetworkContext::SetNetworkConditions(
std::move(network_conditions));
}

View File

@@ -12,7 +12,7 @@ Ideally we could add an embedder observer pattern here but that can be
done in future work.
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc
index ed0c77c14e8dcf3e6d7328c8a9c640388b7be92d..7bf2296e1a3b48cc3aa7f031d5b835fab8488267 100644
index 82aef58c0a3c00c818e0d60df9a5296162c57cc3..930e6160134897a91d4ed8f1517bc90d708cfd04 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -169,6 +169,7 @@
@@ -23,7 +23,7 @@ index ed0c77c14e8dcf3e6d7328c8a9c640388b7be92d..7bf2296e1a3b48cc3aa7f031d5b835fa
#include "third_party/blink/renderer/platform/graphics/image.h"
#include "third_party/blink/renderer/platform/graphics/paint/cull_rect.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h"
@@ -1850,6 +1851,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
@@ -1854,6 +1855,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
#if BUILDFLAG(IS_MAC)
web_view_impl->SetMaximumLegibleScale(
prefs.default_maximum_page_scale_factor);

View File

@@ -0,0 +1,168 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Wed, 29 Jan 2025 17:01:03 +0900
Subject: feat: add signals when embedder cleanup callbacks run for
gin::wrappable
Current setup of finalization callbacks does not work well with
gin_helper::CleanedUpAtExit for wrappables specifically on environment
shutdown leading to UAF in the second pass.
Details at https://github.com/microsoft/vscode/issues/192119#issuecomment-2375851531
The signals exposed in this patch does the following 2 things,
1) Fix weak state of the wrapped object when the finializer callbacks
have not yet been processed
2) Avoid calling into the second pass when the embedder has already
destroyed the wrapped object via CleanedUpAtExit.
This patch is more of a bandaid fix to improve the lifetime
management with existing finalizer callbacks. We should be able to
remove this patch once gin::Wrappable can be managed by V8 Oilpan
Refs https://issues.chromium.org/issues/40210365 which is blocked
on https://issues.chromium.org/issues/42203693
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
index e5ee2c6b3cb787ff9f8272d4344a1e18c44971e2..22469cf0ab1025eefcf94e2cd351087e52182130 100644
--- a/gin/isolate_holder.cc
+++ b/gin/isolate_holder.cc
@@ -34,6 +34,8 @@ v8::ArrayBuffer::Allocator* g_array_buffer_allocator = nullptr;
const intptr_t* g_reference_table = nullptr;
v8::FatalErrorCallback g_fatal_error_callback = nullptr;
v8::OOMErrorCallback g_oom_error_callback = nullptr;
+bool g_initialized_microtasks_runner = false;
+bool g_destroyed_microtasks_runner = false;
std::unique_ptr<v8::Isolate::CreateParams> getModifiedIsolateParams(
std::unique_ptr<v8::Isolate::CreateParams> params,
@@ -194,10 +196,26 @@ IsolateHolder::getDefaultIsolateParams() {
return params;
}
+// static
+bool IsolateHolder::DestroyedMicrotasksRunner() {
+ return g_initialized_microtasks_runner &&
+ g_destroyed_microtasks_runner;
+}
+
void IsolateHolder::EnableIdleTasks(
std::unique_ptr<V8IdleTaskRunner> idle_task_runner) {
DCHECK(isolate_data_.get());
isolate_data_->EnableIdleTasks(std::move(idle_task_runner));
}
+void IsolateHolder::WillCreateMicrotasksRunner() {
+ DCHECK(!g_initialized_microtasks_runner);
+ g_initialized_microtasks_runner = true;
+}
+
+void IsolateHolder::WillDestroyMicrotasksRunner() {
+ DCHECK(g_initialized_microtasks_runner);
+ g_destroyed_microtasks_runner = true;
+}
+
} // namespace gin
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
index c22b0a7f9af621573e888a518ccdc22293ce07ef..d3e5ced425df54f42534cec5cc0c5bbfb9d79c6c 100644
--- a/gin/public/isolate_holder.h
+++ b/gin/public/isolate_holder.h
@@ -130,6 +130,8 @@ class GIN_EXPORT IsolateHolder {
// Should only be called after v8::IsolateHolder::Initialize() is invoked.
static std::unique_ptr<v8::Isolate::CreateParams> getDefaultIsolateParams();
+ static bool DestroyedMicrotasksRunner();
+
v8::Isolate* isolate() { return isolate_; }
// This method returns if v8::Locker is needed to access isolate.
@@ -143,6 +145,9 @@ class GIN_EXPORT IsolateHolder {
void EnableIdleTasks(std::unique_ptr<V8IdleTaskRunner> idle_task_runner);
+ void WillCreateMicrotasksRunner();
+ void WillDestroyMicrotasksRunner();
+
// This method returns V8IsolateMemoryDumpProvider of this isolate, used for
// testing.
V8IsolateMemoryDumpProvider* isolate_memory_dump_provider_for_testing()
diff --git a/gin/wrappable.cc b/gin/wrappable.cc
index 402355cb836cea14e9ee725a142a4bad44fd5bed..7e7f028dcfb87c7b80adebabac19ced8791f642e 100644
--- a/gin/wrappable.cc
+++ b/gin/wrappable.cc
@@ -13,6 +13,9 @@ namespace gin {
WrappableBase::WrappableBase() = default;
WrappableBase::~WrappableBase() {
+ if (!wrapper_.IsEmpty()) {
+ wrapper_.ClearWeak();
+ }
wrapper_.Reset();
}
@@ -28,15 +31,24 @@ const char* WrappableBase::GetTypeName() {
void WrappableBase::FirstWeakCallback(
const v8::WeakCallbackInfo<WrappableBase>& data) {
WrappableBase* wrappable = data.GetParameter();
- wrappable->dead_ = true;
- wrappable->wrapper_.Reset();
- data.SetSecondPassCallback(SecondWeakCallback);
+ WrappableBase* wrappable_from_field =
+ static_cast<WrappableBase*>(data.GetInternalField(1));
+ if (wrappable && wrappable == wrappable_from_field) {
+ wrappable->dead_ = true;
+ wrappable->wrapper_.Reset();
+ data.SetSecondPassCallback(SecondWeakCallback);
+ }
}
void WrappableBase::SecondWeakCallback(
const v8::WeakCallbackInfo<WrappableBase>& data) {
+ if (IsolateHolder::DestroyedMicrotasksRunner()) {
+ return;
+ }
WrappableBase* wrappable = data.GetParameter();
- delete wrappable;
+ if (wrappable) {
+ delete wrappable;
+ }
}
v8::MaybeLocal<v8::Object> WrappableBase::GetWrapperImpl(v8::Isolate* isolate,
@@ -71,10 +83,16 @@ v8::MaybeLocal<v8::Object> WrappableBase::GetWrapperImpl(v8::Isolate* isolate,
void* values[] = {info, this};
wrapper->SetAlignedPointerInInternalFields(2, indices, values);
wrapper_.Reset(isolate, wrapper);
- wrapper_.SetWeak(this, FirstWeakCallback, v8::WeakCallbackType::kParameter);
+ wrapper_.SetWeak(this, FirstWeakCallback, v8::WeakCallbackType::kInternalFields);
return v8::MaybeLocal<v8::Object>(wrapper);
}
+void WrappableBase::ClearWeak() {
+ if (!wrapper_.IsEmpty()) {
+ wrapper_.ClearWeak();
+ }
+}
+
namespace internal {
void* FromV8Impl(v8::Isolate* isolate, v8::Local<v8::Value> val,
diff --git a/gin/wrappable.h b/gin/wrappable.h
index 4e7115685a5bf6997e78edcc1851e28bd00b1aa2..ca51fe33605e855438e88969e3d3cc734ef4523e 100644
--- a/gin/wrappable.h
+++ b/gin/wrappable.h
@@ -80,6 +80,13 @@ class GIN_EXPORT WrappableBase {
v8::MaybeLocal<v8::Object> GetWrapperImpl(v8::Isolate* isolate,
WrapperInfo* wrapper_info);
+ // Make this wrappable strong again. This is useful when the wrappable is
+ // destroyed outside the finalizer callbacks and we want to avoid scheduling
+ // the weak callbacks if they haven't been scheduled yet.
+ // NOTE!!! this does not prevent finalization callbacks from running if they
+ // have already been processed.
+ void ClearWeak();
+
private:
static void FirstWeakCallback(
const v8::WeakCallbackInfo<WrappableBase>& data);

View File

@@ -14,10 +14,25 @@ It also:
This may be partially upstreamed to Chromium in the future.
diff --git a/ui/gtk/select_file_dialog_linux_gtk.cc b/ui/gtk/select_file_dialog_linux_gtk.cc
index b83f0177a2adb0a19be49684f865941e6708f626..f313c766ddc2b79f082e70138dd566a846f0d923 100644
index b83f0177a2adb0a19be49684f865941e6708f626..a8c7032cfc122b97665c41da9e1191e747b95a33 100644
--- a/ui/gtk/select_file_dialog_linux_gtk.cc
+++ b/ui/gtk/select_file_dialog_linux_gtk.cc
@@ -407,9 +407,11 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateFileOpenHelper(
@@ -259,8 +259,12 @@ void SelectFileDialogLinuxGtk::SelectFileImpl(
case SELECT_EXISTING_FOLDER:
dialog = CreateSelectFolderDialog(type, title_string, default_path,
owning_window);
- connect("response",
- &SelectFileDialogLinuxGtk::OnSelectSingleFolderDialogResponse);
+ if (allow_multiple_selection())
+ connect("response",
+ &SelectFileDialogLinuxGtk::OnSelectMultiFolderDialogResponse);
+ else
+ connect("response",
+ &SelectFileDialogLinuxGtk::OnSelectSingleFolderDialogResponse);
break;
case SELECT_OPEN_FILE:
dialog = CreateFileOpenDialog(title_string, default_path, owning_window);
@@ -407,9 +411,11 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateFileOpenHelper(
const std::string& title,
const base::FilePath& default_path,
gfx::NativeWindow parent) {
@@ -30,7 +45,7 @@ index b83f0177a2adb0a19be49684f865941e6708f626..f313c766ddc2b79f082e70138dd566a8
SetGtkTransientForAura(dialog, parent);
AddFilters(GTK_FILE_CHOOSER(dialog));
@@ -425,6 +427,7 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateFileOpenHelper(
@@ -425,6 +431,7 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateFileOpenHelper(
GtkFileChooserSetCurrentFolder(GTK_FILE_CHOOSER(dialog),
*last_opened_path());
}
@@ -38,7 +53,7 @@ index b83f0177a2adb0a19be49684f865941e6708f626..f313c766ddc2b79f082e70138dd566a8
return dialog;
}
@@ -440,11 +443,15 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSelectFolderDialog(
@@ -440,11 +447,15 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSelectFolderDialog(
? l10n_util::GetStringUTF8(IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE)
: l10n_util::GetStringUTF8(IDS_SELECT_FOLDER_DIALOG_TITLE);
}
@@ -59,7 +74,7 @@ index b83f0177a2adb0a19be49684f865941e6708f626..f313c766ddc2b79f082e70138dd566a8
GtkWidget* dialog = GtkFileChooserDialogNew(
title_string.c_str(), nullptr, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
@@ -466,7 +473,8 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSelectFolderDialog(
@@ -466,7 +477,8 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSelectFolderDialog(
gtk_file_filter_add_mime_type(only_folders, "inode/directory");
gtk_file_filter_add_mime_type(only_folders, "text/directory");
gtk_file_chooser_add_filter(chooser, only_folders);
@@ -69,7 +84,7 @@ index b83f0177a2adb0a19be49684f865941e6708f626..f313c766ddc2b79f082e70138dd566a8
return dialog;
}
@@ -503,10 +511,11 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSaveAsDialog(
@@ -503,10 +515,11 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSaveAsDialog(
std::string title_string =
!title.empty() ? title
: l10n_util::GetStringUTF8(IDS_SAVE_AS_DIALOG_TITLE);
@@ -83,7 +98,7 @@ index b83f0177a2adb0a19be49684f865941e6708f626..f313c766ddc2b79f082e70138dd566a8
GTK_RESPONSE_ACCEPT);
SetGtkTransientForAura(dialog, parent);
@@ -532,9 +541,10 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSaveAsDialog(
@@ -532,9 +545,10 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSaveAsDialog(
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
// Overwrite confirmation is always enabled in GTK4.
if (!GtkCheckVersion(4)) {
@@ -96,6 +111,65 @@ index b83f0177a2adb0a19be49684f865941e6708f626..f313c766ddc2b79f082e70138dd566a8
return dialog;
}
@@ -589,15 +603,29 @@ void SelectFileDialogLinuxGtk::OnSelectSingleFolderDialogResponse(
void SelectFileDialogLinuxGtk::OnSelectMultiFileDialogResponse(
GtkWidget* dialog,
int response_id) {
+ SelectMultiFileHelper(dialog, response_id, false);
+}
+
+void SelectFileDialogLinuxGtk::OnSelectMultiFolderDialogResponse(
+ GtkWidget* dialog,
+ int response_id) {
+ SelectMultiFileHelper(dialog, response_id, true);
+}
+
+void SelectFileDialogLinuxGtk::SelectMultiFileHelper(GtkWidget* dialog,
+ int response_id,
+ bool allow_folder) {
if (IsCancelResponse(response_id)) {
FileNotSelected(dialog);
return;
}
auto filenames = GtkFileChooserGetFilenames(dialog);
- std::erase_if(filenames, [this](const base::FilePath& path) {
- return CallDirectoryExistsOnUIThread(path);
+ std::erase_if(filenames, [this, &allow_folder](const base::FilePath& path) {
+ bool directory_exists = CallDirectoryExistsOnUIThread(path);
+ return !allow_folder && directory_exists;
});
+
if (filenames.empty()) {
FileNotSelected(dialog);
return;
diff --git a/ui/gtk/select_file_dialog_linux_gtk.h b/ui/gtk/select_file_dialog_linux_gtk.h
index 213eaa5ec6d657a659726cb38103e8bd671fe907..f497447c598198bf690758b1d1c5c6fe4112627f 100644
--- a/ui/gtk/select_file_dialog_linux_gtk.h
+++ b/ui/gtk/select_file_dialog_linux_gtk.h
@@ -108,6 +108,12 @@ class SelectFileDialogLinuxGtk : public ui::SelectFileDialogLinux,
gint response_id,
bool allow_folder);
+ // Common function for OnSelectMultiFileDialogResponse and
+ // OnSelectMultiFolderDialogResponse.
+ void SelectMultiFileHelper(GtkWidget* dialog,
+ gint response_id,
+ bool allow_folder);
+
// Common function for CreateFileOpenDialog and CreateMultiFileOpenDialog.
GtkWidget* CreateFileOpenHelper(const std::string& title,
const base::FilePath& default_path,
@@ -122,6 +128,9 @@ class SelectFileDialogLinuxGtk : public ui::SelectFileDialogLinux,
// Callback for when the user responds to a Open Multiple Files dialog.
void OnSelectMultiFileDialogResponse(GtkWidget* dialog, int response_id);
+ // Callback for when the user responds to a Select Multiple Folders dialog.
+ void OnSelectMultiFolderDialogResponse(GtkWidget* dialog, int response_id);
+
// Callback for when the file chooser gets destroyed.
void OnFileChooserDestroy(GtkWidget* dialog);
diff --git a/ui/shell_dialogs/select_file_dialog.h b/ui/shell_dialogs/select_file_dialog.h
index eb3d997598631b220c3566748f23a5cdac3e4692..b4b2f7294ce6e9349a4a8a05f614e93359eca25a 100644
--- a/ui/shell_dialogs/select_file_dialog.h
@@ -186,18 +260,118 @@ index 61683d0eddb04c494ca5e650e7d556b44968ec49..5492456a9138b250e97a5479838bb443
} // namespace ui
diff --git a/ui/shell_dialogs/select_file_dialog_linux_kde.cc b/ui/shell_dialogs/select_file_dialog_linux_kde.cc
index 64a79ebe2e2d21d5a6b4a98042d1cdb7b6edad52..16f2ae01a8d33e6341ed52638e963c340455ebf8 100644
index 64a79ebe2e2d21d5a6b4a98042d1cdb7b6edad52..400cce91b020ecd5e48566f125515d2cfe3ea6af 100644
--- a/ui/shell_dialogs/select_file_dialog_linux_kde.cc
+++ b/ui/shell_dialogs/select_file_dialog_linux_kde.cc
@@ -468,7 +468,7 @@ void SelectFileDialogLinuxKde::CreateSelectFolderDialog(
@@ -8,6 +8,7 @@
#include <string_view>
#include "base/command_line.h"
+#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
@@ -154,9 +155,20 @@ class SelectFileDialogLinuxKde : public SelectFileDialogLinux {
void OnSelectMultiFileDialogResponse(
gfx::AcceleratedWidget parent,
std::unique_ptr<KDialogOutputParams> results);
+
+ // Common function for OnSelectSingleFolderDialogResponse and
+ // OnSelectMultiFileDialogResponse.
+ void SelectMultiFileDialogHelper(
+ bool allow_folder,
+ gfx::AcceleratedWidget parent,
+ std::unique_ptr<KDialogOutputParams> results);
+
void OnSelectSingleFolderDialogResponse(
gfx::AcceleratedWidget parent,
std::unique_ptr<KDialogOutputParams> results);
+ void OnSelectMultiFolderDialogResponse(
+ gfx::AcceleratedWidget parent,
+ std::unique_ptr<KDialogOutputParams> results);
// Should be either DESKTOP_ENVIRONMENT_KDE3, KDE4, KDE5, or KDE6.
base::nix::DesktopEnvironment desktop_;
@@ -413,10 +425,16 @@ void SelectFileDialogLinuxKde::GetKDialogCommandLine(
}
command_line->AppendSwitch(type);
// The path should never be empty. If it is, set it to PWD.
- if (path.empty())
- command_line->AppendArgPath(base::FilePath("."));
- else
+ auto pwd = base::FilePath(".");
+ if (path.empty()) {
+ command_line->AppendArgPath(pwd);
+ } else if (path.IsAbsolute()) {
command_line->AppendArgPath(path);
+ } else {
+ // KDialog won't set the default name in the Name field for relative paths.
+ auto abs_path = base::MakeAbsoluteFilePathNoResolveSymbolicLinks(path);
+ command_line->AppendArgPath(abs_path.value_or(pwd));
+ }
// Depending on the type of the operation we need, get the path to the
// file/folder and set up mime type filters.
if (file_operation)
@@ -461,6 +479,7 @@ void SelectFileDialogLinuxKde::CreateSelectFolderDialog(
int title_message_id = (type == SELECT_UPLOAD_FOLDER)
? IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE
: IDS_SELECT_FOLDER_DIALOG_TITLE;
+ bool multiple_selection = allow_multiple_selection();
pipe_task_runner_->PostTaskAndReplyWithResult(
FROM_HERE,
base::BindOnce(
@@ -468,10 +487,12 @@ void SelectFileDialogLinuxKde::CreateSelectFolderDialog(
KDialogParams(
"--getexistingdirectory", GetTitle(title, title_message_id),
default_path.empty() ? *last_opened_path() : default_path, parent,
- false, false)),
+ false, allow_multiple_selection())),
+ false, multiple_selection)),
base::BindOnce(
&SelectFileDialogLinuxKde::OnSelectSingleFolderDialogResponse, this,
parent));
- &SelectFileDialogLinuxKde::OnSelectSingleFolderDialogResponse, this,
- parent));
+ multiple_selection
+ ? &SelectFileDialogLinuxKde::OnSelectMultiFolderDialogResponse
+ : &SelectFileDialogLinuxKde::OnSelectSingleFolderDialogResponse,
+ this, parent));
}
void SelectFileDialogLinuxKde::CreateFileOpenDialog(
@@ -561,7 +582,8 @@ void SelectFileDialogLinuxKde::OnSelectSingleFolderDialogResponse(
SelectSingleFileHelper(true, std::move(results));
}
-void SelectFileDialogLinuxKde::OnSelectMultiFileDialogResponse(
+void SelectFileDialogLinuxKde::SelectMultiFileDialogHelper(
+ bool allow_folder,
gfx::AcceleratedWidget parent,
std::unique_ptr<KDialogOutputParams> results) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -579,7 +601,7 @@ void SelectFileDialogLinuxKde::OnSelectMultiFileDialogResponse(
base::SplitStringPiece(results->output, "\n", base::KEEP_WHITESPACE,
base::SPLIT_WANT_NONEMPTY)) {
base::FilePath path(line);
- if (CallDirectoryExistsOnUIThread(path))
+ if (!allow_folder && CallDirectoryExistsOnUIThread(path))
continue;
filenames_fp.push_back(path);
}
@@ -591,4 +613,16 @@ void SelectFileDialogLinuxKde::OnSelectMultiFileDialogResponse(
MultiFilesSelected(filenames_fp);
}
+void SelectFileDialogLinuxKde::OnSelectMultiFolderDialogResponse(
+ gfx::AcceleratedWidget parent,
+ std::unique_ptr<KDialogOutputParams> results) {
+ SelectMultiFileDialogHelper(true, parent, std::move(results));
+}
+
+void SelectFileDialogLinuxKde::OnSelectMultiFileDialogResponse(
+ gfx::AcceleratedWidget parent,
+ std::unique_ptr<KDialogOutputParams> results) {
+ SelectMultiFileDialogHelper(false, parent, std::move(results));
+}
+
} // namespace ui
diff --git a/ui/shell_dialogs/select_file_dialog_linux_portal.cc b/ui/shell_dialogs/select_file_dialog_linux_portal.cc
index 143f5fe1028e154192767599a1e68b45301a894d..132e670dc3ccd9a0f904a8869e516f4556fbf0af 100644
--- a/ui/shell_dialogs/select_file_dialog_linux_portal.cc

View File

@@ -11,7 +11,7 @@ ServiceProcessHost::Observer functions, but we need to pass the exit code to
the observer.
diff --git a/content/browser/service_process_host_impl.cc b/content/browser/service_process_host_impl.cc
index f6082bada22c5f4e70af60ea6f555b0f363919c5..228f947edbe04bce242df62080052d9c383f1709 100644
index f6082bada22c5f4e70af60ea6f555b0f363919c5..f691676a629bf82f81117599ae0bd0a4870c9f61 100644
--- a/content/browser/service_process_host_impl.cc
+++ b/content/browser/service_process_host_impl.cc
@@ -73,12 +73,15 @@ class ServiceProcessTracker {
@@ -33,19 +33,7 @@ index f6082bada22c5f4e70af60ea6f555b0f363919c5..228f947edbe04bce242df62080052d9c
processes_.erase(iter);
}
@@ -87,6 +90,11 @@ class ServiceProcessTracker {
observers_.AddObserver(observer);
}
+ bool HasObserver(ServiceProcessHost::Observer* observer) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ return observers_.HasObserver(observer);
+ }
+
void RemoveObserver(ServiceProcessHost::Observer* observer) {
// NOTE: Some tests may remove observers after BrowserThreads are shut down.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
@@ -154,7 +162,7 @@ class UtilityProcessClient : public UtilityProcessHost::Client {
@@ -154,7 +157,7 @@ class UtilityProcessClient : public UtilityProcessHost::Client {
process_info_->service_process_id());
}
@@ -54,7 +42,7 @@ index f6082bada22c5f4e70af60ea6f555b0f363919c5..228f947edbe04bce242df62080052d9c
// TODO(crbug.com/40654042): It is unclear how we can observe
// |OnProcessCrashed()| without observing |OnProcessLaunched()| first, but
// it can happen on Android. Ignore the notification in this case.
@@ -162,7 +170,7 @@ class UtilityProcessClient : public UtilityProcessHost::Client {
@@ -162,7 +165,7 @@ class UtilityProcessClient : public UtilityProcessHost::Client {
return;
GetServiceProcessTracker().NotifyCrashed(
@@ -63,18 +51,6 @@ index f6082bada22c5f4e70af60ea6f555b0f363919c5..228f947edbe04bce242df62080052d9c
}
private:
@@ -232,6 +240,11 @@ void ServiceProcessHost::AddObserver(Observer* observer) {
GetServiceProcessTracker().AddObserver(observer);
}
+// static
+bool ServiceProcessHost::HasObserver(Observer* observer) {
+ return GetServiceProcessTracker().HasObserver(observer);
+}
+
// static
void ServiceProcessHost::RemoveObserver(Observer* observer) {
GetServiceProcessTracker().RemoveObserver(observer);
diff --git a/content/browser/utility_process_host.cc b/content/browser/utility_process_host.cc
index cdc2046f465110b60285da81fb0db7cdce064a59..8feca9f1c294b3de15d74dfc94508ee2a43e5fc3 100644
--- a/content/browser/utility_process_host.cc
@@ -101,23 +77,8 @@ index 66cbabae31236758eef35bab211d4874f8a5c699..88515741fa08176ba9e952759c3a52e1
};
// This class is self-owned. It must be instantiated using new, and shouldn't
diff --git a/content/public/browser/service_process_host.h b/content/public/browser/service_process_host.h
index 611a52e908f4cb70fbe5628e220a082e45320b70..d7fefab99f86515007aff5f523a423a421850c47 100644
--- a/content/public/browser/service_process_host.h
+++ b/content/public/browser/service_process_host.h
@@ -235,6 +235,10 @@ class CONTENT_EXPORT ServiceProcessHost {
// removed before destruction. Must be called from the UI thread only.
static void AddObserver(Observer* observer);
+ // Returns true if the given observer is currently registered.
+ // Must be called from the UI thread only.
+ static bool HasObserver(Observer* observer);
+
// Removes a registered observer. This must be called some time before
// |*observer| is destroyed and must be called from the UI thread only.
static void RemoveObserver(Observer* observer);
diff --git a/content/public/browser/service_process_info.h b/content/public/browser/service_process_info.h
index 1a8656aef341cd3b23af588fb00569b79d6cd100..f904af7ee6bbacf4474e0939855ecf9f2c9a5eaa 100644
index 1a8656aef341cd3b23af588fb00569b79d6cd100..6af523eb27a8c1e5529721c029e5b3ba0708b9fc 100644
--- a/content/public/browser/service_process_info.h
+++ b/content/public/browser/service_process_info.h
@@ -64,7 +64,13 @@ class CONTENT_EXPORT ServiceProcessInfo {
@@ -129,7 +90,7 @@ index 1a8656aef341cd3b23af588fb00569b79d6cd100..f904af7ee6bbacf4474e0939855ecf9f
+
private:
+ // The exit code of the process, if it has exited.
+ int exit_code_;
+ int exit_code_ = 0;
+
// The name of the service interface for which the process was launched.
std::string service_interface_name_;

View File

@@ -0,0 +1,114 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Thu, 30 Jan 2025 20:28:38 +0900
Subject: feat: separate content settings callback for sync and async clipboard
`AllowReadFromClipboard` is called from both the types without a way to differentiate.
[sync path] - third_party/blink/renderer/core/editing/commands/clipboard_commands.cc
[async path] - third_party/blink/renderer/modules/clipboard/clipboard_promise.cc
This patch adds a new callback to separate these two paths so that we
can have sync permission checks for the sync path.
Additionally, `blink::PermissionType::DEPRECATED_SYNC_CLIPBOARD_READ`
has been added to support type conversion in permission policy checks. We have extended
`blink::PermissionType` in `electron::WebContentsPermissionHelper::PermissionType`
but it is hard to import the latter into the content permission layer checks.
This patch will be removed when the deprecated sync api support is
removed.
diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc
index d21e492cac6b6750dfab320e35c94841df54e2e4..3c05ae9bf223e9b3b6ca6d4c05be31c517e2a996 100644
--- a/components/permissions/permission_util.cc
+++ b/components/permissions/permission_util.cc
@@ -364,6 +364,7 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe(
return ContentSettingsType::AUTOMATIC_FULLSCREEN;
case PermissionType::WEB_APP_INSTALLATION:
return ContentSettingsType::WEB_APP_INSTALLATION;
+ case PermissionType::DEPRECATED_SYNC_CLIPBOARD_READ:
case PermissionType::NUM:
break;
}
diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc
index 4e6b9b4073892051a72e40808365fe59c1e77903..e4403c1e95510b7846cc57f3c5a95a41480149f5 100644
--- a/content/browser/permissions/permission_controller_impl.cc
+++ b/content/browser/permissions/permission_controller_impl.cc
@@ -94,6 +94,7 @@ PermissionToSchedulingFeature(PermissionType permission_name) {
case PermissionType::POINTER_LOCK:
case PermissionType::AUTOMATIC_FULLSCREEN:
case PermissionType::WEB_APP_INSTALLATION:
+ case PermissionType::DEPRECATED_SYNC_CLIPBOARD_READ:
return std::nullopt;
}
}
diff --git a/third_party/blink/common/permissions/permission_utils.cc b/third_party/blink/common/permissions/permission_utils.cc
index baa74bd6c7bf6350f4ef06f00d94d1d517b43943..2d4f846f08383e22e42c55f783eb1041de4cd258 100644
--- a/third_party/blink/common/permissions/permission_utils.cc
+++ b/third_party/blink/common/permissions/permission_utils.cc
@@ -99,6 +99,8 @@ std::string GetPermissionString(PermissionType permission) {
return "AutomaticFullscreen";
case PermissionType::WEB_APP_INSTALLATION:
return "WebAppInstallation";
+ case PermissionType::DEPRECATED_SYNC_CLIPBOARD_READ:
+ return "DeprecatedSyncClipboardRead";
case PermissionType::NUM:
NOTREACHED();
}
@@ -171,6 +173,7 @@ PermissionTypeToPermissionsPolicyFeature(PermissionType permission) {
case PermissionType::NOTIFICATIONS:
case PermissionType::KEYBOARD_LOCK:
case PermissionType::POINTER_LOCK:
+ case PermissionType::DEPRECATED_SYNC_CLIPBOARD_READ:
return std::nullopt;
case PermissionType::NUM:
diff --git a/third_party/blink/public/common/permissions/permission_utils.h b/third_party/blink/public/common/permissions/permission_utils.h
index ae03b7f099d30c157cfda7d1beb7c535d3615471..ca287e7a5271ee83c393de6c1fe347973f4292ba 100644
--- a/third_party/blink/public/common/permissions/permission_utils.h
+++ b/third_party/blink/public/common/permissions/permission_utils.h
@@ -64,6 +64,7 @@ enum class PermissionType {
AUTOMATIC_FULLSCREEN = 40,
HAND_TRACKING = 41,
WEB_APP_INSTALLATION = 42,
+ DEPRECATED_SYNC_CLIPBOARD_READ = 43,
// Always keep this at the end.
NUM,
diff --git a/third_party/blink/public/platform/web_content_settings_client.h b/third_party/blink/public/platform/web_content_settings_client.h
index 28f616f21f998c7cd1c794e58efaccf9e6c11e6e..c64896642209124e500db2ed6fe2357e426cd10b 100644
--- a/third_party/blink/public/platform/web_content_settings_client.h
+++ b/third_party/blink/public/platform/web_content_settings_client.h
@@ -55,6 +55,9 @@ class WebContentSettingsClient {
// Controls whether access to write the clipboard is allowed for this frame.
virtual bool AllowWriteToClipboard() { return false; }
+ // Controls whether synchronous access to read the clipboard is allowed for this frame.
+ virtual bool AllowReadFromClipboardSync() { return false; }
+
// Controls whether to enable MutationEvents for this frame.
// The common use case of this method is actually to selectively disable
// MutationEvents, but it's been named for consistency with the rest of the
diff --git a/third_party/blink/renderer/core/editing/commands/clipboard_commands.cc b/third_party/blink/renderer/core/editing/commands/clipboard_commands.cc
index 20ebd3f2f5fa7b16ad1b2081ca41b007bc78a354..b248e3135182d36a6524c2e626157a0e4c759d14 100644
--- a/third_party/blink/renderer/core/editing/commands/clipboard_commands.cc
+++ b/third_party/blink/renderer/core/editing/commands/clipboard_commands.cc
@@ -121,7 +121,7 @@ bool ClipboardCommands::CanReadClipboard(LocalFrame& frame,
return true;
}
return frame.GetContentSettingsClient() &&
- frame.GetContentSettingsClient()->AllowReadFromClipboard();
+ frame.GetContentSettingsClient()->AllowReadFromClipboardSync();
}
bool ClipboardCommands::CanWriteClipboard(LocalFrame& frame,
@@ -300,7 +300,7 @@ bool ClipboardCommands::PasteSupported(LocalFrame* frame) {
return true;
}
return frame->GetContentSettingsClient() &&
- frame->GetContentSettingsClient()->AllowReadFromClipboard();
+ frame->GetContentSettingsClient()->AllowReadFromClipboardSync();
}
bool ClipboardCommands::ExecuteCopy(LocalFrame& frame,

View File

@@ -16,13 +16,13 @@ Linux or Windows to un-fullscreen in some circumstances without this
change.
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588efdfb0619 100644
index 47d494f0c3c02bc65ca18521cc1049e766e050cb..40262c3b77980be3208387d64a685beef2035619 100644
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
@@ -21,12 +21,16 @@
@@ -20,12 +20,16 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
+#if 0
#include "chrome/browser/ui/blocked_content/popunder_preventer.h"
+#endif
@@ -36,7 +36,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
#include "chrome/common/chrome_switches.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_types.h"
@@ -259,10 +263,12 @@ void FullscreenController::EnterFullscreenModeForTab(
@@ -260,10 +264,12 @@ void FullscreenController::EnterFullscreenModeForTab(
return;
}
@@ -49,7 +49,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
// Keep the current state. |SetTabWithExclusiveAccess| may change the return
// value of |IsWindowFullscreenForTabOrPending|.
@@ -374,12 +380,14 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
@@ -375,12 +381,14 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
void FullscreenController::FullscreenTabOpeningPopup(
content::WebContents* opener,
content::WebContents* popup) {
@@ -64,7 +64,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
}
void FullscreenController::OnTabDeactivated(
@@ -465,10 +473,12 @@ void FullscreenController::FullscreenTransitionCompleted() {
@@ -466,10 +474,12 @@ void FullscreenController::FullscreenTransitionCompleted() {
#endif // DCHECK_IS_ON()
tab_fullscreen_target_display_id_ = display::kInvalidDisplayId;
started_fullscreen_transition_ = false;
@@ -77,7 +77,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
}
void FullscreenController::RunOrDeferUntilTransitionIsComplete(
@@ -576,18 +586,17 @@ void FullscreenController::EnterFullscreenModeInternal(
@@ -577,18 +587,17 @@ void FullscreenController::EnterFullscreenModeInternal(
// Do not enter fullscreen mode if disallowed by pref. This prevents the user
// from manually entering fullscreen mode and also disables kiosk mode on
// desktop platforms.
@@ -101,7 +101,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
if (option == TAB) {
url = GetRequestingOrigin();
tab_fullscreen_ = true;
@@ -620,6 +629,7 @@ void FullscreenController::EnterFullscreenModeInternal(
@@ -621,6 +630,7 @@ void FullscreenController::EnterFullscreenModeInternal(
if (!extension_caused_fullscreen_.is_empty())
url = extension_caused_fullscreen_;
}
@@ -109,7 +109,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
fullscreen_start_time_ = base::TimeTicks::Now();
if (option == BROWSER)
@@ -640,6 +650,7 @@ void FullscreenController::ExitFullscreenModeInternal() {
@@ -641,6 +651,7 @@ void FullscreenController::ExitFullscreenModeInternal() {
return;
}
@@ -117,7 +117,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
// `fullscreen_start_time_` is null if a fullscreen tab moves to a new window.
if (fullscreen_start_time_ && exclusive_access_tab()) {
ukm::SourceId source_id =
@@ -651,15 +662,16 @@ void FullscreenController::ExitFullscreenModeInternal() {
@@ -652,15 +663,16 @@ void FullscreenController::ExitFullscreenModeInternal() {
.Record(ukm::UkmRecorder::Get());
fullscreen_start_time_.reset();
}
@@ -137,7 +137,7 @@ index 176f02f0abb4220564caa1d794faabc5b22bd8bc..4b08918cef83a84076e452b41302588e
exclusive_access_manager()->context()->ExitFullscreen();
extension_caused_fullscreen_ = GURL();
exclusive_access_manager()->UpdateBubble(base::NullCallback());
@@ -721,8 +733,12 @@ GURL FullscreenController::GetEmbeddingOrigin() const {
@@ -722,8 +734,12 @@ GURL FullscreenController::GetEmbeddingOrigin() const {
void FullscreenController::RecordMetricsOnFullscreenApiRequested(
content::RenderFrameHost* requesting_frame) {
history::HistoryService* service =

View File

@@ -23,10 +23,10 @@ Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397.
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 f8e18b15a19517b28057dd007adccc0fd222e2e1..6e1656f3bd62b597952528bfee884666111277fc 100644
index 4f76cfa33ea68a49e1c7cec096cd34a1587042a2..0ee902a2ff5f82b75f4b6cb2eb0f96209e260183 100644
--- a/content/browser/renderer_host/navigation_request.cc
+++ b/content/browser/renderer_host/navigation_request.cc
@@ -10802,6 +10802,12 @@ NavigationRequest::GetOriginForURLLoaderFactoryUncheckedWithDebugInfo() {
@@ -10806,6 +10806,12 @@ NavigationRequest::GetOriginForURLLoaderFactoryUncheckedWithDebugInfo() {
"blob");
}

View File

@@ -13,10 +13,10 @@ This patch can be removed should we choose to support chrome.fileSystem
or support it enough to fix the crash.
diff --git a/chrome/browser/resources/pdf/pdf_viewer.ts b/chrome/browser/resources/pdf/pdf_viewer.ts
index f7e98f2c94ac9802062880f9341214f88c85a669..86b0b3b7596e7da68c536c0dea3d95b22bdd9481 100644
index a861c34084b90561beab221ac13929bef295ac6d..94ea00dba8a6bb314421e6bd0ccef32e3ac02829 100644
--- a/chrome/browser/resources/pdf/pdf_viewer.ts
+++ b/chrome/browser/resources/pdf/pdf_viewer.ts
@@ -1076,28 +1076,27 @@ export class PdfViewerElement extends PdfViewerBaseElement {
@@ -1086,28 +1086,27 @@ export class PdfViewerElement extends PdfViewerBaseElement {
dataArray = [result.dataToSave];
}
@@ -65,7 +65,7 @@ index f7e98f2c94ac9802062880f9341214f88c85a669..86b0b3b7596e7da68c536c0dea3d95b2
}
/**
@@ -1288,36 +1287,33 @@ export class PdfViewerElement extends PdfViewerBaseElement {
@@ -1298,36 +1297,33 @@ export class PdfViewerElement extends PdfViewerBaseElement {
fileName = fileName + '.pdf';
}
@@ -128,7 +128,7 @@ index f7e98f2c94ac9802062880f9341214f88c85a669..86b0b3b7596e7da68c536c0dea3d95b2
// <if expr="enable_pdf_ink2">
// Ink2 doesn't need to exit annotation mode after save.
@@ -1464,6 +1460,9 @@ declare global {
@@ -1474,6 +1470,9 @@ declare global {
interface HTMLElementTagNameMap {
'pdf-viewer': PdfViewerElement;
}

View File

@@ -0,0 +1,161 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: David Sanders <dsanders11@ucsbalum.com>
Date: Fri, 21 Feb 2025 00:46:48 -0800
Subject: fix: drag and drop icons on Windows
This is a backport from Chromium of
https://chromium-review.googlesource.com/c/chromium/src/+/6279834
Change-Id: Ic642228f3a0a073b9b45fbec68de37be6cfd3934
diff --git a/chrome/browser/ui/views/tabs/tab_close_button.cc b/chrome/browser/ui/views/tabs/tab_close_button.cc
index 281d6c6fcccbf3bfc3396056e495ee8d19424f5a..ac335a68f3fd0e3931cb37c915de51e410734850 100644
--- a/chrome/browser/ui/views/tabs/tab_close_button.cc
+++ b/chrome/browser/ui/views/tabs/tab_close_button.cc
@@ -18,7 +18,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/pointer/touch_ui_controller.h"
-#include "ui/compositor/layer.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/geometry/insets.h"
@@ -63,8 +62,6 @@ TabCloseButton::TabCloseButton(PressedCallback pressed_callback,
views::InkDrop::Get(this)->GetInkDrop()->SetHoverHighlightFadeDuration(
base::TimeDelta());
- image_container_view()->DestroyLayer();
-
// The ink drop highlight path is the same as the focus ring highlight path,
// but needs to be explicitly mirrored for RTL.
// TODO(http://crbug.com/1056490): Make ink drops in RTL work the same way as
@@ -145,20 +142,6 @@ void TabCloseButton::OnGestureEvent(ui::GestureEvent* event) {
event->SetHandled();
}
-void TabCloseButton::AddLayerToRegion(ui::Layer* new_layer,
- views::LayerRegion region) {
- image_container_view()->SetPaintToLayer();
- image_container_view()->layer()->SetFillsBoundsOpaquely(false);
- ink_drop_container()->SetVisible(true);
- ink_drop_container()->AddLayerToRegion(new_layer, region);
-}
-
-void TabCloseButton::RemoveLayerFromRegions(ui::Layer* old_layer) {
- ink_drop_container()->RemoveLayerFromRegions(old_layer);
- ink_drop_container()->SetVisible(false);
- image_container_view()->DestroyLayer();
-}
-
gfx::Size TabCloseButton::CalculatePreferredSize(
const views::SizeBounds& available_size) const {
return kButtonSize;
diff --git a/chrome/browser/ui/views/tabs/tab_close_button.h b/chrome/browser/ui/views/tabs/tab_close_button.h
index f23bf862d987d8d6ba59aef781c51034e9a3debe..f688214ef883994d09b7a428b8af9b7f14c93af9 100644
--- a/chrome/browser/ui/views/tabs/tab_close_button.h
+++ b/chrome/browser/ui/views/tabs/tab_close_button.h
@@ -46,9 +46,6 @@ class TabCloseButton : public views::LabelButton,
void OnMouseReleased(const ui::MouseEvent& event) override;
void OnMouseMoved(const ui::MouseEvent& event) override;
void OnGestureEvent(ui::GestureEvent* event) override;
- void AddLayerToRegion(ui::Layer* new_layer,
- views::LayerRegion region) override;
- void RemoveLayerFromRegions(ui::Layer* old_layer) override;
protected:
// Set/reset the image models for the icon with new colors.
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button.cc b/chrome/browser/ui/views/toolbar/toolbar_button.cc
index 08c4a2164f25ca3b363c13558b04dc5c10855fb2..6d01c1077014bbc7d8bd6bf895825ce9be9a66ca 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_button.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_button.cc
@@ -128,6 +128,12 @@ ToolbarButton::ToolbarButton(PressedCallback callback,
if (model_) {
GetViewAccessibility().SetHasPopup(ax::mojom::HasPopup::kMenu);
}
+#if BUILDFLAG(IS_WIN)
+ // Paint image(s) to a layer so that the canvas is snapped to pixel
+ // boundaries.
+ image_container_view()->SetPaintToLayer();
+ image_container_view()->layer()->SetFillsBoundsOpaquely(false);
+#endif
}
ToolbarButton::~ToolbarButton() = default;
@@ -724,6 +730,24 @@ ToolbarButton::GetActionViewInterface() {
return std::make_unique<ToolbarButtonActionViewInterface>(this);
}
+void ToolbarButton::AddLayerToRegion(ui::Layer* new_layer,
+ views::LayerRegion region) {
+#if !BUILDFLAG(IS_WIN)
+ image_container_view()->SetPaintToLayer();
+ image_container_view()->layer()->SetFillsBoundsOpaquely(false);
+#endif
+ ink_drop_container()->SetVisible(true);
+ ink_drop_container()->AddLayerToRegion(new_layer, region);
+}
+
+void ToolbarButton::RemoveLayerFromRegions(ui::Layer* old_layer) {
+ ink_drop_container()->RemoveLayerFromRegions(old_layer);
+ ink_drop_container()->SetVisible(false);
+#if !BUILDFLAG(IS_WIN)
+ image_container_view()->DestroyLayer();
+#endif
+}
+
ToolbarButtonActionViewInterface::ToolbarButtonActionViewInterface(
ToolbarButton* action_view)
: views::LabelButtonActionViewInterface(action_view),
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button.h b/chrome/browser/ui/views/toolbar/toolbar_button.h
index 9d46beda5f6811e728dad5c5e2ddf04fe52b24f5..602e966ec72fd026e0ab3c454e9f15c08ddf11c2 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_button.h
+++ b/chrome/browser/ui/views/toolbar/toolbar_button.h
@@ -132,6 +132,9 @@ class ToolbarButton : public views::LabelButton,
void OnGestureEvent(ui::GestureEvent* event) override;
std::u16string GetTooltipText(const gfx::Point& p) const override;
std::unique_ptr<views::ActionViewInterface> GetActionViewInterface() override;
+ void AddLayerToRegion(ui::Layer* new_layer,
+ views::LayerRegion region) override;
+ void RemoveLayerFromRegions(ui::Layer* old_layer) override;
// views::ContextMenuController:
void ShowContextMenuForViewImpl(
diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc
index f17cd72dbe014adc51301ef6e07d9a6ca94c5d67..5b675ae814e09eca55f9eea6772acc8f9a6b0a1e 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -78,13 +78,6 @@ LabelButton::LabelButton(
SetTextInternal(text);
SetLayoutManager(std::make_unique<DelegatingLayoutManager>(this));
GetViewAccessibility().SetIsDefault(is_default_);
-
-#if BUILDFLAG(IS_WIN)
- // Paint image(s) to a layer so that the canvas is snapped to pixel
- // boundaries.
- image_container_view()->SetPaintToLayer();
- image_container_view()->layer()->SetFillsBoundsOpaquely(false);
-#endif
}
LabelButton::~LabelButton() {
@@ -508,10 +501,8 @@ void LabelButton::UpdateImage() {
void LabelButton::AddLayerToRegion(ui::Layer* new_layer,
views::LayerRegion region) {
-#if !BUILDFLAG(IS_WIN)
image_container_view()->SetPaintToLayer();
image_container_view()->layer()->SetFillsBoundsOpaquely(false);
-#endif
ink_drop_container()->SetVisible(true);
ink_drop_container()->AddLayerToRegion(new_layer, region);
}
@@ -519,9 +510,7 @@ void LabelButton::AddLayerToRegion(ui::Layer* new_layer,
void LabelButton::RemoveLayerFromRegions(ui::Layer* old_layer) {
ink_drop_container()->RemoveLayerFromRegions(old_layer);
ink_drop_container()->SetVisible(false);
-#if !BUILDFLAG(IS_WIN)
image_container_view()->DestroyLayer();
-#endif
}
std::unique_ptr<ActionViewInterface> LabelButton::GetActionViewInterface() {

View File

@@ -87,10 +87,10 @@ index 51522e60d6dc14f1113cc438558b6b393c3fe73a..153ed02f493a83ef9ca354cc18736f93
// The view with active text input state, i.e., a focused <input> element.
// It will be nullptr if no such view exists. Note that the active view
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 9b84cc06795a5bef730cd81908254cf9ad11c836..1b748a2e0d803217985847014855b095b53c58e5 100644
index ec55a5a2807bb9fc328b33d18ee10444f4b98126..ce65cb2aec41faa58a1dfa43f5c1ac8e5bc66641 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -9384,7 +9384,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame(
@@ -9397,7 +9397,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame(
"WebContentsImpl::OnFocusedElementChangedInFrame",
"render_frame_host", frame);
RenderWidgetHostViewBase* root_view =

View File

@@ -0,0 +1,236 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: reito <cnschwarzer@qq.com>
Date: Wed, 12 Feb 2025 20:42:02 +0800
Subject: fix: osr stutter in both cpu and gpu capture when page has animation.
https://crrev.org/c/6232721
https://crbug.com/391118566
There's bug in VideoCaptureOracle that cause stutter in both cpu and gpu capture when page has animation.
The upstream has a fix, which will be available in Chromium M135.
Backport this fix for Electron versions before that.
diff --git a/media/capture/content/video_capture_oracle.cc b/media/capture/content/video_capture_oracle.cc
index dad9598799a670b3cfb14965bc8a7b4ea3b4f95f..05a82788ae1e5c304ee150a2390f346d7b454630 100644
--- a/media/capture/content/video_capture_oracle.cc
+++ b/media/capture/content/video_capture_oracle.cc
@@ -118,8 +118,9 @@ void VideoCaptureOracle::SetCaptureSizeConstraints(
void VideoCaptureOracle::SetAutoThrottlingEnabled(bool enabled) {
const bool was_enabled =
(capture_size_throttling_mode_ != kThrottlingDisabled);
- if (was_enabled == enabled)
+ if (was_enabled == enabled) {
return;
+ }
capture_size_throttling_mode_ =
enabled ? kThrottlingEnabled : kThrottlingDisabled;
VLOG(1) << "Capture size auto-throttling is now "
@@ -127,19 +128,22 @@ void VideoCaptureOracle::SetAutoThrottlingEnabled(bool enabled) {
// When not auto-throttling, have the CaptureResolutionChooser target the max
// resolution within constraints.
- if (!enabled)
+ if (!enabled) {
resolution_chooser_.SetTargetFrameArea(std::numeric_limits<int>::max());
+ }
- if (next_frame_number_ > 0)
+ if (next_frame_number_ > 0) {
CommitCaptureSizeAndReset(GetFrameTimestamp(next_frame_number_ - 1));
+ }
}
void VideoCaptureOracle::SetSourceSize(const gfx::Size& source_size) {
resolution_chooser_.SetSourceSize(source_size);
// If the |resolution_chooser_| computed a new capture size, that will become
// visible via a future call to ObserveEventAndDecideCapture().
- source_size_change_time_ = (next_frame_number_ == 0) ?
- base::TimeTicks() : GetFrameTimestamp(next_frame_number_ - 1);
+ source_size_change_time_ = (next_frame_number_ == 0)
+ ? base::TimeTicks()
+ : GetFrameTimestamp(next_frame_number_ - 1);
}
bool VideoCaptureOracle::ObserveEventAndDecideCapture(
@@ -172,6 +176,15 @@ bool VideoCaptureOracle::ObserveEventAndDecideCapture(
if (should_sample) {
event_time = content_sampler_.frame_timestamp();
duration_of_next_frame_ = content_sampler_.sampling_period();
+ } else {
+ // https://crbug.com/391118566
+ // The content sampler may not sample the frame, if the
+ // `detected_region_` does not match the `damage_rect`. In this case,
+ // the capture may halt up to kNonAnimatingThreshold (250ms) and cause
+ // the video stutter, until it recovers and do another animation
+ // detection. To avoid this, we should use the smoothing sampler as a
+ // fallback to prevent the bad output.
+ should_sample = smoothing_sampler_.ShouldSample();
}
last_time_animation_was_detected_ = event_time;
} else {
@@ -198,8 +211,9 @@ bool VideoCaptureOracle::ObserveEventAndDecideCapture(
NOTREACHED();
}
- if (!should_sample)
+ if (!should_sample) {
return false;
+ }
// If the exact duration of the next frame has not been determined, estimate
// it using the difference between the current and last frame.
@@ -373,16 +387,18 @@ void VideoCaptureOracle::RecordConsumerFeedback(
// resource_utilization feedback.
- if (capture_size_throttling_mode_ == kThrottlingDisabled)
+ if (capture_size_throttling_mode_ == kThrottlingDisabled) {
return;
+ }
if (!std::isfinite(feedback.resource_utilization)) {
LOG(DFATAL) << "Non-finite utilization provided by consumer for frame #"
<< frame_number << ": " << feedback.resource_utilization;
return;
}
- if (feedback.resource_utilization <= 0.0)
+ if (feedback.resource_utilization <= 0.0) {
return; // Non-positive values are normal, meaning N/A.
+ }
if (capture_size_throttling_mode_ != kThrottlingActive) {
VLOG(1) << "Received consumer feedback at frame #" << frame_number
@@ -553,12 +569,14 @@ int VideoCaptureOracle::AnalyzeForIncreasedArea(base::TimeTicks analyze_time) {
const int current_area = capture_size_.GetArea();
const int increased_area =
resolution_chooser_.FindLargerFrameSize(current_area, 1).GetArea();
- if (increased_area <= current_area)
+ if (increased_area <= current_area) {
return -1;
+ }
// Determine whether the buffer pool could handle an increase in area.
- if (!HasSufficientRecentFeedback(buffer_pool_utilization_, analyze_time))
+ if (!HasSufficientRecentFeedback(buffer_pool_utilization_, analyze_time)) {
return -1;
+ }
if (buffer_pool_utilization_.current() > 0.0) {
const int buffer_capable_area = base::saturated_cast<int>(
current_area / buffer_pool_utilization_.current());
@@ -593,8 +611,9 @@ int VideoCaptureOracle::AnalyzeForIncreasedArea(base::TimeTicks analyze_time) {
// At this point, the system is currently under-utilized. Reset the start
// time if the system was not under-utilized when the last analysis was made.
- if (start_time_of_underutilization_.is_null())
+ if (start_time_of_underutilization_.is_null()) {
start_time_of_underutilization_ = analyze_time;
+ }
// If the under-utilization started soon after the last source size change,
// permit an immediate increase in the capture area. This allows the system
diff --git a/media/capture/content/video_capture_oracle_unittest.cc b/media/capture/content/video_capture_oracle_unittest.cc
index 066676fa998db6782270ddbf42fe176d88eb30d4..6cd7567e91bc8c496846a685aa1506c7548f3a21 100644
--- a/media/capture/content/video_capture_oracle_unittest.cc
+++ b/media/capture/content/video_capture_oracle_unittest.cc
@@ -158,21 +158,26 @@ TEST(VideoCaptureOracleTest, TransitionsSmoothlyBetweenSamplers) {
const bool provide_animated_content_event =
(i % 100) >= 25 && (i % 100) < 75;
- // Only the few events that trigger the lock-out transition should be
- // dropped, because the AnimatedContentSampler doesn't yet realize the
- // animation ended. Otherwise, the oracle should always decide to sample
- // because one of its samplers says to.
- const bool require_oracle_says_sample = (i % 100) < 75 || (i % 100) >= 78;
+ // https://crbug.com/391118566
+ // Previously the AnimatedContentSampler has a bug that cause jank.
+ // The oracle should always use SmoothEventSampler as a fallback. If
+ // AnimatedContentSampler doesn't yet realize the animation ended or
+ // doesn't keep up with the prediction it make, and it will wait for
+ // kNonAnimatingThreshold before it lock-out and hand over to smooth
+ // handler. This will cause the video to stutter and it is unacceptable.
+ // So, when the AnimatedContentSampler goes into wrong state, we now
+ // use SmoothEventSampler's decision as a fallback to prevent jank output
+ // and still has a overall limit on capture frequency.
const bool oracle_says_sample = oracle.ObserveEventAndDecideCapture(
VideoCaptureOracle::kCompositorUpdate,
provide_animated_content_event ? animation_damage_rect : gfx::Rect(),
t);
- if (require_oracle_says_sample)
- ASSERT_TRUE(oracle_says_sample);
- if (!oracle_says_sample) {
- ASSERT_EQ(base::TimeDelta(), oracle.estimated_frame_duration());
- continue;
- }
+
+ // Because we now use SmoothEventSampler as a fallback, oracle should
+ // always say sample. The previous AnimatedContentSampler lock-out
+ // dropped frame are now revived by SmoothEventSampler, since this test's
+ // capture frequency always meets min capture limit requirement.
+ ASSERT_TRUE(oracle_says_sample);
ASSERT_LT(base::TimeDelta(), oracle.estimated_frame_duration());
const int frame_number = oracle.next_frame_number();
@@ -184,12 +189,9 @@ TEST(VideoCaptureOracleTest, TransitionsSmoothlyBetweenSamplers) {
if (!last_frame_timestamp.is_null()) {
const base::TimeDelta delta = frame_timestamp - last_frame_timestamp;
EXPECT_LE(event_increment.InMicroseconds(), delta.InMicroseconds());
- // Right after the AnimatedContentSampler lock-out transition, there were
- // a few frames dropped, so allow a gap in the timestamps. Otherwise, the
- // delta between frame timestamps should never be more than 2X the
+ // The delta between frame timestamps should never be more than 2X the
// |event_increment|.
- const base::TimeDelta max_acceptable_delta =
- (i % 100) == 78 ? event_increment * 5 : event_increment * 2;
+ const base::TimeDelta max_acceptable_delta = event_increment * 2;
EXPECT_GE(max_acceptable_delta.InMicroseconds(), delta.InMicroseconds());
}
last_frame_timestamp = frame_timestamp;
@@ -444,9 +446,9 @@ void RunAutoThrottleTest(bool is_content_animating,
// expect the resolution to remain constant. Repeat.
for (int i = 0; i < 2; ++i) {
const gfx::Size starting_size = oracle.capture_size();
- SCOPED_TRACE(::testing::Message() << "Stepping down from "
- << starting_size.ToString()
- << ", i=" << i);
+ SCOPED_TRACE(::testing::Message()
+ << "Stepping down from " << starting_size.ToString()
+ << ", i=" << i);
gfx::Size stepped_down_size;
end_t = t + base::Seconds(10);
@@ -471,9 +473,10 @@ void RunAutoThrottleTest(bool is_content_animating,
oracle.RecordCapture(with_consumer_feedback ? 0.25 : utilization);
base::TimeTicks ignored;
ASSERT_TRUE(oracle.CompleteCapture(frame_number, true, &ignored));
- if (with_consumer_feedback)
+ if (with_consumer_feedback) {
oracle.RecordConsumerFeedback(frame_number,
media::VideoCaptureFeedback(utilization));
+ }
}
}
@@ -482,9 +485,9 @@ void RunAutoThrottleTest(bool is_content_animating,
// utilization and expect the resolution to remain constant. Repeat.
for (int i = 0; i < 2; ++i) {
const gfx::Size starting_size = oracle.capture_size();
- SCOPED_TRACE(::testing::Message() << "Stepping up from "
- << starting_size.ToString()
- << ", i=" << i);
+ SCOPED_TRACE(::testing::Message()
+ << "Stepping up from " << starting_size.ToString()
+ << ", i=" << i);
gfx::Size stepped_up_size;
end_t = t + base::Seconds(is_content_animating ? 90 : 10);
@@ -513,9 +516,10 @@ void RunAutoThrottleTest(bool is_content_animating,
oracle.RecordCapture(with_consumer_feedback ? 0.25 : utilization);
base::TimeTicks ignored;
ASSERT_TRUE(oracle.CompleteCapture(frame_number, true, &ignored));
- if (with_consumer_feedback)
+ if (with_consumer_feedback) {
oracle.RecordConsumerFeedback(frame_number,
media::VideoCaptureFeedback(utilization));
+ }
}
}
}

View File

@@ -64,10 +64,10 @@ index cba373664bec3a32abad6fe0396bd67b53b7e67f..7a985067b1371604644d48159f2f5aa7
#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
index d918e9d165acefa8ba3a225aec261ebf028c40f7..d6cbf553961137429c40fe768f28b104bda0f89b 100644
index 1daf1d65e2e6ac494790aa9201609c9ca9af6828..a4e649e4c63160e6152d3ff0d6a414ccd4f8b4cc 100644
--- a/third_party/blink/renderer/core/frame/local_frame.cc
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -3130,6 +3130,7 @@ void LocalFrame::RequestExecuteScript(
@@ -3136,6 +3136,7 @@ void LocalFrame::RequestExecuteScript(
mojom::blink::EvaluationTiming evaluation_timing,
mojom::blink::LoadEventBlockingOption blocking_option,
WebScriptExecutionCallback callback,
@@ -75,7 +75,7 @@ index d918e9d165acefa8ba3a225aec261ebf028c40f7..d6cbf553961137429c40fe768f28b104
BackForwardCacheAware back_forward_cache_aware,
mojom::blink::WantResultOption want_result_option,
mojom::blink::PromiseResultOption promise_behavior) {
@@ -3162,7 +3163,7 @@ void LocalFrame::RequestExecuteScript(
@@ -3168,7 +3169,7 @@ void LocalFrame::RequestExecuteScript(
PausableScriptExecutor::CreateAndRun(
script_state, std::move(script_sources), execute_script_policy,
user_gesture, evaluation_timing, blocking_option, want_result_option,
@@ -85,7 +85,7 @@ index d918e9d165acefa8ba3a225aec261ebf028c40f7..d6cbf553961137429c40fe768f28b104
void LocalFrame::SetEvictCachedSessionStorageOnFreezeOrUnload() {
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h
index 13d1bea90341efbf51c476d3eacae49c8b960537..f508e3e9df98c167740b0574ef554bd17f41447f 100644
index 7e65f92dbeb987836be447dee2c660cdde8295ed..b5484a84fea067938a9e3d15f49f4c12c3739c20 100644
--- a/third_party/blink/renderer/core/frame/local_frame.h
+++ b/third_party/blink/renderer/core/frame/local_frame.h
@@ -824,6 +824,7 @@ class CORE_EXPORT LocalFrame final
@@ -204,7 +204,7 @@ index fa65331f40b90d812b71a489fd560e9359152d2b..390714d631dc88ef92d59ef9618a5706
const mojom::blink::UserActivationOption user_activation_option_;
const mojom::blink::LoadEventBlockingOption blocking_option_;
diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc
index 3979c3987da3dd49218407c41977d9ce7d114edb..7e00f6bdd1d398f22d39823088caf5cde3a34dd9 100644
index 0802173ce891bcaca8b6bba2762ad2b80d4d5c75..6d31ccae7e6a9e204999d8475808afc11a0665c8 100644
--- a/third_party/blink/renderer/core/frame/web_frame_test.cc
+++ b/third_party/blink/renderer/core/frame/web_frame_test.cc
@@ -291,6 +291,7 @@ void ExecuteScriptsInMainWorld(

View File

@@ -10,10 +10,10 @@ process CompositingModeFallbackToSoftware IPC to disable GPU compositing.
https://issues.chromium.org/345275130
diff --git a/third_party/blink/renderer/platform/widget/compositing/layer_tree_view.cc b/third_party/blink/renderer/platform/widget/compositing/layer_tree_view.cc
index 001e931ba705a1a52dfbcb717fe8e30b7014fde8..c545a7257e561f86aecc336769c0dd22c9772465 100644
index b2569e7ce111e9fd8ab76a0adebfa35c8487f53e..898528a7a0ffa279eda5ba9f81eb73b84431577b 100644
--- a/third_party/blink/renderer/platform/widget/compositing/layer_tree_view.cc
+++ b/third_party/blink/renderer/platform/widget/compositing/layer_tree_view.cc
@@ -381,9 +381,13 @@ void LayerTreeView::DidFailToInitializeLayerTreeFrameSink() {
@@ -387,9 +387,13 @@ void LayerTreeView::DidFailToInitializeLayerTreeFrameSink() {
// unable to be killed after Chrome is closed.
// https://issues.chromium.org/336164423
if (!Platform::Current()->IsGpuRemoteDisconnected()) {

View File

@@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20L=C3=B6nnhager?= <dv.lnh.d@gmail.com>
Date: Fri, 17 Jan 2025 14:30:48 +0100
Subject: Ignore parse errors for PKEY_AppUserModel_ToastActivatorCLSID
Some shortcuts store this as a string UUID as opposed to VT_CLSID,
hitting NOTREACHED() and sometimes breaking parsing in Electron.
Ignore this error instead.
Bug: N/A
Change-Id: I9fc472212b2d3afac2c8e18a2159bc2d50bbdf98
diff --git a/AUTHORS b/AUTHORS
index 897b6678b6d583f3361c41f62b960e46165d288d..13afc62098608e79faf02d504b54d9d6326b8ed3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -336,6 +336,7 @@ David Futcher <david.mike.futcher@gmail.com>
David Jin <davidjin@amazon.com>
David Lechner <david@pybricks.com>
David Leen <davileen@amazon.com>
+David Lönnhager <dv.lnh.d@gmail.com>
David Manouchehri <david@davidmanouchehri.com>
David McAllister <mcdavid@amazon.com>
David Michael Barr <david.barr@samsung.com>
diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc
index 02f3e63d16c3324f546f6155d722900f0a81131a..1dfdb0c8dc5a7368382e73a0db1b4d135b4d2176 100644
--- a/base/win/shortcut.cc
+++ b/base/win/shortcut.cc
@@ -342,8 +342,9 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path,
*(pv_toast_activator_clsid.get().puuid));
break;
default:
- NOTREACHED() << "Unexpected variant type: "
- << pv_toast_activator_clsid.get().vt;
+ // Shortcuts may use strings to represent the CLSID. This case is
+ // ignored.
+ break;
}
}
}

View File

@@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement
session.setCertificateVerifyCallback.
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
index cae84c27a26d6198d9da5913b008e748d6680037..4be02fdb03038ee4c30ea699cbbf56d1f5aaa7aa 100644
index f03bc67fbd15625b4935c0333f1b3f129a8ce246..c5199a66320bfdb7abda0878b7ae24e02f49b420 100644
--- a/services/network/network_context.cc
+++ b/services/network/network_context.cc
@@ -158,6 +158,11 @@
@@ -122,7 +122,7 @@ index cae84c27a26d6198d9da5913b008e748d6680037..4be02fdb03038ee4c30ea699cbbf56d1
constexpr uint32_t NetworkContext::kMaxOutstandingRequestsPerProcess;
NetworkContext::NetworkContextHttpAuthPreferences::
@@ -1000,6 +1098,13 @@ void NetworkContext::SetClient(
@@ -1003,6 +1101,13 @@ void NetworkContext::SetClient(
client_.Bind(std::move(client));
}
@@ -136,7 +136,7 @@ index cae84c27a26d6198d9da5913b008e748d6680037..4be02fdb03038ee4c30ea699cbbf56d1
void NetworkContext::CreateURLLoaderFactory(
mojo::PendingReceiver<mojom::URLLoaderFactory> receiver,
mojom::URLLoaderFactoryParamsPtr params) {
@@ -2569,6 +2674,9 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
@@ -2572,6 +2677,9 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
std::move(cert_verifier));
cert_verifier = std::move(cert_verifier_with_trust_anchors);
#endif // BUILDFLAG(IS_CHROMEOS)

View File

@@ -133,10 +133,10 @@ index 05d3a12dd84c7005d46cc73b312f97ef418d96f5..4765de982802541b3efc7211d106acc7
const GURL& document_url,
const WeakDocumentPtr& weak_document_ptr,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 07907372f37d3ef5c9eaef7011ebcd4ed6a2fed6..ec5e553d93caf8a24de97465a870567d95944000 100644
index 10a3e987def641bc3504d20a591cc95f1b9fe84f..eca2f5da88dd911ce64824479aac01320840cc22 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2105,7 +2105,7 @@ void RenderProcessHostImpl::CreateNotificationService(
@@ -2106,7 +2106,7 @@ void RenderProcessHostImpl::CreateNotificationService(
case RenderProcessHost::NotificationServiceCreatorType::kSharedWorker:
case RenderProcessHost::NotificationServiceCreatorType::kDedicatedWorker: {
storage_partition_impl_->GetPlatformNotificationContext()->CreateService(
@@ -145,7 +145,7 @@ index 07907372f37d3ef5c9eaef7011ebcd4ed6a2fed6..ec5e553d93caf8a24de97465a870567d
creator_type, std::move(receiver));
break;
}
@@ -2113,7 +2113,7 @@ void RenderProcessHostImpl::CreateNotificationService(
@@ -2114,7 +2114,7 @@ void RenderProcessHostImpl::CreateNotificationService(
CHECK(rfh);
storage_partition_impl_->GetPlatformNotificationContext()->CreateService(

View File

@@ -10,7 +10,7 @@ an about:blank check to this area.
Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5403876
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index 174b6cb9531237528664bcaff06a6e8dc1677349..144490c1ad76dce306e7e4a25270456d60bbb7f5 100644
index 2d82c283867cf78fc63275bffbd9eff4d8a606e9..7222a4475e77d4f44ee155825d5cb5238d22e107 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -784,8 +784,8 @@ void VerifyThatBrowserAndRendererCalculatedOriginsToCommitMatch(

View File

@@ -653,7 +653,7 @@ index 3c2fdc9f9a6c60efc4b0afacbfb83eef55917791..8fd9aff538fa03da6c171927c316d4f6
PrintingFailed(int32 cookie, PrintFailureReason reason);
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
index 423cea4420bc868baad6260fb7c6b33430eaaf95..2b105dc1fb2a7b06fe717df9edf897446aca606c 100644
index 423cea4420bc868baad6260fb7c6b33430eaaf95..4a51a5156b9e15e2bbfac521cfbb3f397acaeccc 100644
--- a/components/printing/renderer/print_render_frame_helper.cc
+++ b/components/printing/renderer/print_render_frame_helper.cc
@@ -52,6 +52,7 @@
@@ -771,7 +771,7 @@ index 423cea4420bc868baad6260fb7c6b33430eaaf95..2b105dc1fb2a7b06fe717df9edf89744
// Check if `this` is still valid.
if (!self)
return;
@@ -2360,29 +2375,37 @@ void PrintRenderFrameHelper::IPCProcessed() {
@@ -2360,29 +2375,44 @@ void PrintRenderFrameHelper::IPCProcessed() {
}
bool PrintRenderFrameHelper::InitPrintSettings(blink::WebLocalFrame* frame,
@@ -801,12 +801,22 @@ index 423cea4420bc868baad6260fb7c6b33430eaaf95..2b105dc1fb2a7b06fe717df9edf89744
return false;
}
bool center_on_paper = !IsPrintingPdfFrame(frame, node);
- bool center_on_paper = !IsPrintingPdfFrame(frame, node);
- settings.params->print_scaling_option =
+ settings->params->print_scaling_option =
center_on_paper ? mojom::PrintScalingOption::kCenterShrinkToFitPaper
: mojom::PrintScalingOption::kSourceSize;
- center_on_paper ? mojom::PrintScalingOption::kCenterShrinkToFitPaper
- : mojom::PrintScalingOption::kSourceSize;
- RecordDebugEvent(settings.params->printed_doc_type ==
+ bool silent = new_settings.FindBool("silent").value_or(false);
+ if (silent) {
+ settings->params->print_scaling_option = mojom::PrintScalingOption::kFitToPrintableArea;
+ } else {
+ const auto plugin_node = delegate_->GetPdfElement(frame);
+ const bool center_on_paper = !IsPrintingPdfFrame(frame, plugin_node);
+ settings->params->print_scaling_option =
+ center_on_paper ? mojom::PrintScalingOption::kCenterShrinkToFitPaper
+ : mojom::PrintScalingOption::kSourceSize;
+ }
+
+ RecordDebugEvent(settings->params->printed_doc_type ==
mojom::SkiaDocumentType::kMSKP
? DebugEvent::kSetPrintSettings5

View File

@@ -44,10 +44,10 @@ index 886d70636aedfa714b29625f58420ad11ede9ffd..7906b94983733a9deb2365fb2a134619
void RenderWidgetHostImpl::ShowContextMenuAtPoint(
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index e7e47a9aa5a22aea2aa0eeab7bd661b47c9cbdae..de6b544df67c9702b6771b08b003805b4f5fb5a4 100644
index d35ae086793a52ea38da97b9236e073b806a67a6..d88c3b6a3625c2f4d0c67677777202f7db85ea88 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -5612,6 +5612,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
@@ -5620,6 +5620,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
return text_input_manager_.get();
}
@@ -60,10 +60,10 @@ index e7e47a9aa5a22aea2aa0eeab7bd661b47c9cbdae..de6b544df67c9702b6771b08b003805b
RenderWidgetHostImpl* render_widget_host) {
return render_widget_host == GetPrimaryMainFrame()->GetRenderWidgetHost();
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 88282f2880d2443aca30ec1754bf5e43ed67acfc..60c94fd4508e166e0dd1be9c6eb97dd45e418853 100644
index 2a098761bc3b67af3ada46596613152c136583b0..1d0df8595a89642a0eb33cdf76fd9cafc1e4b4b0 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -1128,6 +1128,7 @@ class CONTENT_EXPORT WebContentsImpl
@@ -1130,6 +1130,7 @@ class CONTENT_EXPORT WebContentsImpl
void SendScreenRects() override;
void SendActiveState(bool active) override;
TextInputManager* GetTextInputManager() override;
@@ -72,7 +72,7 @@ index 88282f2880d2443aca30ec1754bf5e43ed67acfc..60c94fd4508e166e0dd1be9c6eb97dd4
RenderWidgetHostImpl* render_widget_host) override;
bool IsShowingContextMenuOnPage() const override;
diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h
index 0379a5ca835e3e9d1b90543bbbe5971148d6c73e..03ed25d04ff0f54d412e1a3044b7770f75384a96 100644
index f3284b11c2a9d020e85af2fea2057926de4cdd0b..9d58a654ddbabeecef2d9f17e0229c72c0afe6fd 100644
--- a/content/public/browser/web_contents_observer.h
+++ b/content/public/browser/web_contents_observer.h
@@ -37,6 +37,7 @@

View File

@@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be
accessed from our JS event. The filtering is moved into Electron's code.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 0e742f196367bbbe8c4e147ef4db4f8dbbe4cbbe..7026b28c4f228971f74a706b6ad99777e4ca0773 100644
index 784a7536eec5a248e4725253c091b039047ff1ea..6939dbd68fbdde3710b13a4158893d859910034a 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -9518,25 +9518,13 @@ void WebContentsImpl::RendererUnresponsive(
@@ -9531,25 +9531,13 @@ void WebContentsImpl::RendererUnresponsive(
base::RepeatingClosure hang_monitor_restarter) {
OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive",
"render_widget_host", render_widget_host);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Thu, 21 Nov 2024 14:23:17 +0100
Subject: Support BSTR PKEY_AppUserModel_ID in Windows Shortcuts
It's possible for a shortcut link on Windows to be BSTR format;
this resulted in a DCHECK previously but as of the NOTREACHED
fatal migration now will crash a given app. This has created an
issue for Electron, which allows providing the shortcut information
to end users. This CL thus allows for supporting VT_BSTR variants
for PKEY_AppUserModel_ID and mitigates a crash. One such example
is https://github.com/wez/wezterm, which after this change
correctly gets an appUserModelId of 'org.wezfurlong.wezterm'.
Bug: N/A
Change-Id: I5ad114bc345059637465b68a53a2f3f8c42de898
diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc
index d4a54d1afdc121192f9c0321c6ced584ee066486..02f3e63d16c3324f546f6155d722900f0a81131a 100644
--- a/base/win/shortcut.cc
+++ b/base/win/shortcut.cc
@@ -289,14 +289,22 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path,
return false;
}
switch (pv_app_id.get().vt) {
- case VT_EMPTY:
+ case VT_EMPTY: {
properties->set_app_id(std::wstring());
break;
- case VT_LPWSTR:
+ }
+ case VT_LPWSTR: {
properties->set_app_id(pv_app_id.get().pwszVal);
break;
- default:
+ }
+ case VT_BSTR: {
+ BSTR bs = pv_app_id.get().bstrVal;
+ properties->set_app_id(std::wstring(bs, ::SysStringLen(bs)));
+ break;
+ }
+ default: {
NOTREACHED() << "Unexpected variant type: " << pv_app_id.get().vt;
+ }
}
}

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