Compare commits

..

252 Commits

Author SHA1 Message Date
Sudowoodo Release Bot
aa9d2dbef7 Bump v13.6.3 2021-11-30 16:24:58 -08:00
Pedro Pontes
39d55f0b6a chore: cherry-pick a5f54612590d from chromium (#31901) 2021-11-30 16:51:51 -05:00
trop[bot]
b07b268fd0 fix: generate valid config.gypi (#31989)
* fix: generate valid config.gypi

* chore: update patches

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-30 16:41:32 -05:00
Pedro Pontes
daa220f84e chore: cherry-pick 5d2b5e7c006c from v8 (#31912)
* chore: cherry-pick 5d2b5e7c006c from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-24 15:53:18 -05:00
Pedro Pontes
f22fb9c25d chore: cherry-pick 56de3b2004, bbca3704f9 and f2b0985ac3 from chromium (#31921) 2021-11-24 15:50:25 -05:00
trop[bot]
c804d638fa fix: setContentProtection affects BrowserWindow frame (#31829)
Co-authored-by: Micha Hanselmann <micha.hanselmann@gmail.com>
2021-11-17 19:36:39 +09:00
Sudowoodo Release Bot
2ee43f9ece Bump v13.6.2 2021-11-16 11:10:11 -08:00
trop[bot]
33b54d7a8f fix: incorrect Content-Disposition serialization (#31691)
* fix: incorrect Content-Disposition serialization

* test: fixup test

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-08 11:55:35 -05:00
trop[bot]
574ee7d219 test: deflake <webview> tag loads devtools extensions on WOA (#31713)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-08 10:29:50 +01:00
Pedro Pontes
4aa6b8d001 chore: cherry-pick 91dd4f79ab5b from chromium (#31682)
* chore: cherry-pick 91dd4f79ab5b from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-04 17:26:50 -04:00
Pedro Pontes
2dd1034146 chore: cherry-pick 014e1f857c33 from v8 (#31673) 2021-11-03 13:08:55 -04:00
Pedro Pontes
14c533c256 chore: cherry-pick 656c2769c5 from v8 (#31678)
Co-authored-by: Electron Bot <electron@github.com>
2021-11-03 10:50:25 -04:00
Pedro Pontes
f8ba210b21 chore: cherry-pick feef10137b16 from v8 (#31665)
* chore: cherry-pick feef10137b16 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-02 14:36:37 -04:00
Pedro Pontes
2f645042c2 chore: cherry-pick 45f9dcf5021d from chromium (#31671) 2021-11-02 13:30:05 -04:00
Shelley Vohr
be34c32e38 fix: silent print settings (#31618) 2021-11-01 15:52:40 -04:00
Sudowoodo Release Bot
a7f4e03e1b Bump v13.6.1 2021-10-27 14:25:28 -07:00
trop[bot]
b09dc5c4a0 docs: win.getParentWindow() returns BrowserWindow | null (#31574)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-26 15:55:32 -04:00
Pedro Pontes
ac1f5b159f chore: cherry-pick 36028012d897 from chromium (#31541)
Co-authored-by: Electron Bot <electron@github.com>
2021-10-26 17:42:07 +09:00
trop[bot]
9fe4fe6725 fix: MediaMetadata not working properly (#31532)
* fix: MediaMetadata not working properly

* chore: update patches

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-25 14:52:24 +02:00
Pedro Pontes
51e4b47177 chore: cherry-pick 0894af410c4e from chromium (#31545)
* chore: cherry-pick 0894af410c4e from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-25 13:03:02 +02:00
Pedro Pontes
f2c078ecb6 chore: cherry-pick c69dddfe1cde from chromium (#31521)
* chore: cherry-pick c69dddfe1cde from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-10-22 21:19:42 +09:00
trop[bot]
930dde396d fix: black window on screen capture when content protection is enabled (#31550)
Co-authored-by: Micha Hanselmann <mhanselmann@microsoft.com>
2021-10-22 21:16:28 +09:00
Pedro Pontes
42aa56a575 chore: cherry-pick 6de4e210688e from v8 (#31503)
* chore: cherry-pick 6de4e210688e from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-22 21:15:13 +09:00
Pedro Pontes
d91e53e57c chore: cherry-pick 2e7c9b33453b from chromium (#31499)
Co-authored-by: Electron Bot <electron@github.com>
2021-10-22 21:13:49 +09:00
Pedro Pontes
1f1d139f0e chore: cherry-pick 8a822e28adea from pdfium (#31495) 2021-10-21 16:52:17 -04:00
Pedro Pontes
18b685e397 chore: cherry-pick 8af66de55aad from chromium (#31525)
* chore: cherry-pick 8af66de55aad from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-21 14:46:19 -04:00
Sudowoodo Release Bot
9d3baaae58 Bump v13.6.0 2021-10-20 17:28:06 -07:00
trop[bot]
23713aa10b fix: don't use private enterprise APIs in MAS build (#31486)
* fix: don't use private enterprise APIs in MAS build

* Update .patches

* fix: update mas patch

Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2021-10-21 09:16:04 +09:00
trop[bot]
883f692dad feat: warn when ipcRenderer.sendSync() called with no listeners for channel (#31432)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-21 09:09:33 +09:00
trop[bot]
cef7a28136 fix: also pass securityOrigin to media permissions request handler (#31437)
Co-authored-by: Maxime Serrano <mserrano@alumni.cmu.edu>
2021-10-15 13:33:03 +09:00
trop[bot]
d552fa0c07 fix: return HTNOWHERE in resize hit test to allow draggable regions to kick in when required (#31414)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-10-13 14:39:02 -07:00
Sudowoodo Release Bot
2727847aca Bump v13.5.2 2021-10-11 09:03:32 -07:00
trop[bot]
072158bf8c docs: add missing 'context-menu' event to webview-tag.md (#31308)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-11 14:28:48 +09:00
Pedro Pontes
a733074c8c chore: cherry-pick 3a5bafa35def from chromium (#31365)
* chore: cherry-pick 3a5bafa35def from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-10-11 14:27:42 +09:00
Pedro Pontes
bc25056770 chore: cherry-pick b2c4e4dc21e5 from chromium (#31363)
* chore: cherry-pick b2c4e4dc21e5 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-10-11 09:46:50 +09:00
trop[bot]
f0b37841ea fix: crash on missing render frame (#31335)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-10-11 09:34:13 +09:00
Pedro Pontes
1caf4e695d chore: cherry-pick 6584528aeb0f0 from webrtc and 36e370cf4db9a from chromium (#31359)
* chore: cherry-pick 6584528aeb0f0 from webrtc and 36e370cf4db9a from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-10-10 05:42:50 -07:00
Pedro Pontes
bba04ea788 chore: cherry-pick 6a8a2098f9fa from chromium (#31231)
* chore: cherry-pick 6a8a2098f9fa from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-09 23:17:17 -07:00
Robo
3b3430fba6 refactor: only access memory coordinator interface from browser process (#31305)
* refactor: only access memory coordinator interface from browser process (#31295)

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

* chore: fix build

* chore: fix lint
2021-10-06 15:43:45 -07:00
Pedro Pontes
c53ffadb8a chore: cherry-pick efd8e01ac1a6 from chromium (#31243)
* chore: cherry-pick f2fd53c6d706 from chromium

* chore: update patches

* fix: cherry-pick fix for chromium:1243622 from M90 instead.

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-10-04 06:57:41 -07:00
Pedro Pontes
e714d729b1 chore: cherry-pick 096afc1c5428 from chromium (#31246)
* chore: cherry-pick 096afc1c5428 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-10-04 03:03:30 -07:00
Pedro Pontes
627bf64263 chore: cherry-pick 4e528a5a8d83 from chromium (#31240)
* chore: cherry-pick 4e528a5a8d83 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-03 23:56:36 -07:00
Pedro Pontes
a7bbb47ec2 chore: cherry-pick e8cb0e7aa32 from angle (#31236) 2021-10-03 23:47:52 -07:00
Pedro Pontes
cf9ae70dbc chore: cherry-pick 5c4acf2ae64a from v8 (#31228)
* chore: cherry-pick 5c4acf2ae64a from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-03 23:38:47 -07:00
John Kleinschmidt
044c980e96 fix: persist permission granted to serial ports (#31190) 2021-10-04 10:09:21 +09:00
Robo
9a71ca545f fix: remove expired DST Root CA X3 (#31220)
* Revert "fix: Enable X509_V_FLAG_TRUSTED_FIRST flag in BoringSSL (#31215)"

This reverts commit 3bb36a62cb.

* fix: remove expired DST Root CA X3
2021-10-04 09:58:05 +09:00
Sudowoodo Release Bot
e64966641c Bump v13.5.1 2021-09-30 14:02:01 -07:00
trop[bot]
3bb36a62cb fix: Enable X509_V_FLAG_TRUSTED_FIRST flag in BoringSSL (#31215)
* fix: Enable X509_V_FLAG_TRUSTED_FIRST flag in BoringSSL

Fixes: https://github.com/electron/electron/issues/31212
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>

* Update .patches

* chore: update patches

Co-authored-by: Juan Cruz Viotti <jv@jviotti.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-30 17:00:55 -04:00
Pedro Pontes
e58a04ea5a chore: cherry-pick f8a74d72f3 from chromium. (#31209)
Co-authored-by: Electron Bot <electron@github.com>
2021-09-30 16:20:34 -04:00
trop[bot]
5e32f51cf6 fix: draggable regions in BrowserViews are independent (#31197)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-30 11:04:01 -04:00
trop[bot]
75349f58ad fix: media key globalShortcuts on macOS (#30568)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-09-30 10:26:05 -04:00
Pedro Pontes
879b98c922 chore: cherry-pick 85123ea32b from chromium (#31202) 2021-09-30 09:54:45 -04:00
Milan Burda
9d34c83089 fix: running tests with release build (#31147)
* fix: running tests with release build (#31092)

* Update electron_api_v8_util.cc
2021-09-29 23:42:42 -04:00
trop[bot]
8d8949ac60 fix: BrowserView drag now delegates to the OS when possible (#31175)
Co-authored-by: @anulman <@anulman>
2021-09-29 17:09:47 -04:00
Shelley Vohr
acb2209668 refactor: use native WeakRef instead of v8util.weaklyTrackValue() (#31164) (#31169)
Co-authored-by: Milan Burda <milan.burda@gmail.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-09-29 15:31:33 -04:00
Shelley Vohr
4bd655a093 fix: ensure set vibrancy with invalid value is a no-op (#31163)
* chore: remove c-style conversion for vibrantView (#29724)

* fix: ensure set vibrancy with invalid value is a no-op (#29795)

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-09-29 13:10:26 -04:00
trop[bot]
9c976b4f3d fix: .lldbinit config stale (unavailable) (#31159)
Co-authored-by: Black-Hole1 <158blackhole@gmail.com>
2021-09-29 12:33:13 +02:00
trop[bot]
d70c5d1e6a fix: crash in v8 due to regexp reentrancy (#31142)
* fix: crash in v8 due to regexp reentrancy

Check failed: !regexp_stack_->is_in_use()

Refs https://bugs.chromium.org/p/chromium/issues/detail?id=1250646
Refs https://bugs.chromium.org/p/v8/issues/detail?id=11382

* chore: update patches

* chore: update patches

Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-28 06:10:19 -07:00
Sudowoodo Release Bot
d93629321e Bump v13.5.0 2021-09-27 12:26:06 -07:00
trop[bot]
b505de0765 fix: first mouse not dragging BrowserView (#31098)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-27 21:24:57 +02:00
Michaela Laurencin
4c4d29eb73 fix: add casing for WCO edge (#31097)
* fix: add casing for WCO edge

* fix linting error

* apply fix for linting error
2021-09-27 12:00:35 -04:00
Robo
993ecb5bdd fix: crash in seccomp sandbox with glibc 2.34 (#31091)
Refs https://bugs.chromium.org/p/chromium/issues/detail?id=1244383
Refs https://bugs.chromium.org/p/chromium/issues/detail?id=1213452
2021-09-23 13:53:08 -07:00
Michaela Laurencin
d0ba8d1f69 feat: enable windows control overlay on Windows (#30887)
* feat: enable window controls overlay on macOS (#29253)

* feat: enable windows control overlay on macOS

* address review feedback

* chore: address review feedback

* Address review feedback

* update doc per review

* only enable WCO when titleBarStyle is overlay

* Revert "only enable WCO when titleBarStyle is overlay"

This reverts commit 1b58b5b1fc.

* Add new titleBarOverlay property to manage feature

* spelling fix

* Update docs/api/frameless-window.md

Co-authored-by: Samuel Attard <sam@electronjs.org>

* Update shell/browser/api/electron_api_browser_window.cc

Co-authored-by: Samuel Attard <sam@electronjs.org>

* update per review feedback

Co-authored-by: Samuel Attard <sam@electronjs.org>
(cherry picked from commit 1f8a46c9c6)

* feat: enable windows control overlay on Windows (#30678)

cherry-picked from 41646d1

Co-Authored-By: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>

Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>

* modify included header files and update patches

* kick off missed ci

* fix lint error

* chore: update patches

* chore: update patches

* remove version control marker

* correct `resizeable_` backport

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-09-23 13:04:13 -07:00
trop[bot]
d03fd85a90 fix: update Windows' cache after changing window's style (#31078)
To enable/disable window resizing we set/unset WS_THICKFRAME style
flag on the window. Window's frame styles are cached so we need to
call SetWindowPos with the SWP_FRAMECHANGED flag set to update
cache properly.

Co-authored-by: Cezary Kulakowski <cezary@openfin.co>
2021-09-23 19:49:10 +09:00
trop[bot]
2387d10956 fix: maximized state calculation for non-resizable windows (#31039)
* fix: maximized state calculation for non-resizable windows

* refactor: clean up NSRect comparison

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-22 09:30:44 +09:00
Pedro Pontes
558350e4bf chore: cherry pick 9723e3c13c from chromium (#30964)
Co-authored-by: Electron Bot <electron@github.com>
2021-09-22 08:49:04 +09:00
trop[bot]
4d960873a4 fix: BrowserViews not painting their WebContents (#31047)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-21 22:02:35 +02:00
trop[bot]
dfcb2afffd fix: suppress insecure resource warning for more local hostnames (#31035) 2021-09-21 11:29:02 +02:00
Pedro Pontes
221fd9d6ce chore: cherry-pick 6215793f008f from chromium (#30952)
* chore: cherry-pick 6215793f008f from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-09-21 16:25:26 +09:00
Pedro Pontes
ecad7c2441 chore: cherry-pick ddc4cf156505 from chromium (#30962)
* chore: cherry-pick ddc4cf156505 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-09-21 15:23:31 +09:00
Pedro Pontes
a9acc050ee chore: cherry-pick 72473550f6ff from angle (#30960)
* chore: cherry-pick 72473550f6ff from angle

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-09-21 14:41:16 +09:00
Pedro Pontes
29311b7d1d chore: cherry-pick 6048fcd52f42 from chromium (#30943)
* chore: cherry-pick 6048fcd52f42 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-09-21 14:39:56 +09:00
Pedro Pontes
949ec0c7c9 chore: cherry-pick 0c6f5c65fa from chromium (#30950)
Co-authored-by: Electron Bot <electron@github.com>
2021-09-21 10:35:51 +09:00
Pedro Pontes
91b1c0162e chore: cherry-pick 13842c96c2 from chromium and 018f85dea1 from angle (#30957) 2021-09-21 08:49:27 +09:00
Pedro Pontes
e20eab42d3 chore: cherry-pick 7699615c0d and 2f5740f50f from chromium (#30941)
Co-authored-by: Electron Bot <electron@github.com>
2021-09-21 08:48:36 +09:00
Pedro Pontes
fe44e01dbb chore: cherry-pick 034c2003be31 from v8 (#30939)
* chore: cherry-pick 034c2003be31 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-21 08:47:22 +09:00
trop[bot]
bc987209f8 chore: update links of documentation of chromes (#31006)
chrome now use developer.chrome.com/docs/extensions/* instead of developer.chrome.com/extensions/*

Co-authored-by: 祈緒ちゃん - Kiochan <sunxingchen@live.com>
2021-09-17 16:46:50 +09:00
Pedro Pontes
7c2889d93a chore: cherry-pick 8623d711677d from chromium (#30945)
* chore: cherry-pick 8623d711677d from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-16 18:13:22 -04:00
John Kleinschmidt
fa46c67bd3 feat: enable window controls overlay on macOS (#29253) (#30698)
* feat: enable windows control overlay on macOS

* address review feedback

* chore: address review feedback

* Address review feedback

* update doc per review

* only enable WCO when titleBarStyle is overlay

* Revert "only enable WCO when titleBarStyle is overlay"

This reverts commit 1b58b5b1fc.

* Add new titleBarOverlay property to manage feature

* spelling fix

* Update docs/api/frameless-window.md

Co-authored-by: Samuel Attard <sam@electronjs.org>

* Update shell/browser/api/electron_api_browser_window.cc

Co-authored-by: Samuel Attard <sam@electronjs.org>

* update per review feedback

Co-authored-by: Samuel Attard <sam@electronjs.org>
(cherry picked from commit 1f8a46c9c6)
2021-09-16 09:34:32 +09:00
trop[bot]
82679f4335 fix: always include pepper flash font file (#30969)
Co-authored-by: Micha Hanselmann <micha.hanselmann@gmail.com>
2021-09-16 09:30:11 +09:00
Sudowoodo Release Bot
75f366f4d0 Bump v13.4.0 2021-09-13 08:48:20 -07:00
Robo
1d531f29ee fix: crash when launching app with systemd v249 (#30893)
* fix: crash when launching app with systemd v249

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

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-09 14:34:57 -07:00
trop[bot]
f75b755f21 feat: add webContents.fromDevToolsTargetId() (#30731)
* feat: add webContents.fromDevToolsTargetId()

* refactor: avoid using FromOrCreate

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-09-09 11:54:13 +02:00
trop[bot]
a2929226d2 Fix wrong code example for preload property (#30872)
The text mentions that `preload` should be a property of `webPreferences`, but the code example shows something else.

Co-authored-by: Christian Engel <chrispy@parastudios.de>
2021-09-08 15:20:59 +09:00
trop[bot]
6655694cc7 refactor: remove dead code in NeedsCompleteGpuInfoCollection (#30875)
Refs https://chromium-review.googlesource.com/c/chromium/src/+/1208362

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-08 15:20:10 +09:00
Robo
1ac4d27e22 fix: crash when navigating with render process reuse disabled (#30852) 2021-09-07 18:50:39 -07:00
trop[bot]
681d02a77d docs: Update windows info for auto-updater (#30870)
Squirrel.Mac can be served from a static host as well.

Co-authored-by: Finn Behrens <me@kloenk.dev>
2021-09-08 08:44:34 +09:00
trop[bot]
14eefd58c1 fix: show maximized frameless window (#30862)
* fix: show maximized frameless window

* test: show maximized transparent window

* fix: test using wrong bounds

BrowserWindow will be sized to the workArea when the Windows taskbar is
visible.

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-09-08 08:42:44 +09:00
Pedro Pontes
2beec61a50 chore: cherry-pick 490c04beac from chromium (#30824)
Co-authored-by: Electron Bot <electron@github.com>
2021-09-08 08:24:18 +09:00
Pedro Pontes
e1ae36210b chore: cherry-pick d1eade9d39 from chromium (#30817)
* chore: cherry-pick d1eade9d39 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-09-07 08:48:58 +09:00
trop[bot]
e74eac61ae docs: updated webview tag documentation to accurately reflect preload behavior with asar archives (#30850)
Co-authored-by: ike <isaactaylor124@gmail.com>
2021-09-06 19:18:03 +09:00
trop[bot]
f8a5c3d8ee fix: remove CHECK_EQ for swapped RFH (#30834)
|old_host| may be nullptr if the previous RFH was shutdown.

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-09-06 14:52:16 +09:00
Pedro Pontes
efd18b09ca chore: cherry-pick fbfd2557c2ab from v8 (#30821)
* chore: cherry-pick fbfd2557c2ab from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-06 14:48:26 +09:00
Pedro Pontes
cd062ac26e chore: cherry-pick d727013bb543 from chromium (#30815)
* chore: cherry-pick d727013bb543 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-06 14:48:01 +09:00
Cheng Zhao
a3e47196f7 chore: cherry-pick fix for 1230767 from chromium (#30638)
* chore: cherry-pick fix for 1230767 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-01 20:49:59 +09:00
trop[bot]
1930d972fc fix(linux): OpenURI portal support for shell.showItemInFolder() (#30782)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-01 20:49:29 +09:00
trop[bot]
0c4ac78dea docs: improve documentation about macOS entitlement usage security (#30779)
Co-authored-by: ComplexSpaces <complexspacescode@gmail.com>
2021-09-01 20:47:09 +09:00
Sudowoodo Release Bot
5771f3826a Bump v13.3.0 2021-08-31 12:08:57 -07:00
Cheng Zhao
a55bc6a870 chore: cherry-pick fix for 1231134 from chromium (#30637)
* chore: cherry-pick fix for 1231134 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-31 10:37:30 +09:00
Cheng Zhao
dcb311d5c9 chore: cherry-pick fix for 1228036 from v8 (#30639)
* chore: cherry-pick fix for 1228036 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-30 21:26:58 +09:00
Cheng Zhao
e5935eaff9 chore: cherry-pick fix for 1233564 from chromium (#30636)
* chore: cherry-pick fix for 1233564 from chromium

Protect HRTF database loader thread from access by different threads

This patch add a new mutex locker around the HRTF database loader
thread to ensure the safe exclusive access of the loader thread
and the HRTF database.

(cherry picked from commit 6811e850ee10847da16c4d5fdc0f845494586b65)

Bug: 1233564
Change-Id: Ie12b99ffe520d3747e34af387a37637a10aab38a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3068260
Auto-Submit: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>

[modify] https://crrev.com/033f0bdcbe538c61f532e97b03cb9c092a94b413/third_party/blink/renderer/platform/audio/hrtf_database_loader.cc
[modify] https://crrev.com/033f0bdcbe538c61f532e97b03cb9c092a94b413/third_party/blink/renderer/platform/audio/hrtf_database_loader.h

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-30 21:26:27 +09:00
Cheng Zhao
d927f1dc02 chore: cherry-pick fix for 1234009 from chromium (#30635)
* chore: cherry-pick for for 1234009 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-30 19:34:56 +09:00
Jeremy Rose
ca1cae64d9 fix: remove ipc wrapper for nativeImage.createThumbnailFromPath (#30736) 2021-08-30 19:32:21 +09:00
Sudowoodo Release Bot
69df216a9c Bump v13.2.3 2021-08-27 10:18:31 -07:00
trop[bot]
2917eb1589 docs: explain the null webContents case in permission checks (#30686)
* docs: explain the null webContents case in permission checks

* Update docs/api/session.md

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

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-26 15:47:37 +09:00
trop[bot]
ec282ff385 fix: titlebar and buttons state under simple fullscreen (#30706)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-08-26 15:47:05 +09:00
trop[bot]
5d98e5e78a fix: crash when using TouchBarScrubber arrow button (#30680)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-25 10:06:12 +09:00
Sudowoodo Release Bot
251e7bb227 Bump v13.2.2 2021-08-23 13:52:26 -07:00
Sudowoodo Release Bot
d4881625b8 Revert "Bump v13.3.0"
This reverts commit 348f991563.
2021-08-23 13:50:34 -07:00
Sudowoodo Release Bot
348f991563 Bump v13.3.0 2021-08-23 12:00:40 -07:00
Cheng Zhao
6308fc4c4e chore: cherry-pick fix for 1234764 from v8 (#30587)
* chore: cherry-pick fix for 1234764 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-23 17:06:57 +09:00
trop[bot]
7fb719f261 fix: WebFrameMain mojo pipe not reset (#30630)
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2021-08-19 16:58:29 +09:00
Cheng Zhao
d7d9d58c8b chore: cherry-pick fix for 1234770 from v8 (#30586)
* chore: cherry-pick fix for 1234770 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-19 15:11:56 +09:00
trop[bot]
acc861dbaf docs: typo in launch-app-from-url-in-another-app.md (#30626)
* Typo in launch-app-from-url-in-another-app.md

Code snippet for the info.plist example had html formatting. Removed.

* Fix paddings

Co-authored-by: Larry Kluger <larry.kluger@docusign.com>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2021-08-19 15:10:54 +09:00
trop[bot]
18de6be607 fix: cross-origin navigation disposing WebFrameMain instances (#30598)
* refactor: call methods directly from electron:WebContents

Writing static method boilerplate isn't fun

* fix: cross-origin navigation disposing WebFrameMain instances

* fix: move call to WFM::Connect

* refactor: use base::NoDestructor<T>

* Update shell/browser/api/electron_api_web_frame_main.cc

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-08-19 15:09:16 +09:00
trop[bot]
1ae50bbeff docs: remove unused Desktop Environment Integration doc (#30618)
* docs: remove unused Desktop Environment Integration doc

* Update docs/api/app.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/api/app.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2021-08-19 10:28:38 +09:00
Cheng Zhao
7d129ac5c9 chore: cherry-pick fix for 1234829 from angle (#30585)
* chore: cherry-pick 1234829 from angle

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-19 10:08:34 +09:00
trop[bot]
2cca38c036 docs: update Hazel information (#30621)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-19 09:53:05 +09:00
trop[bot]
f616c85061 fix: persist BrowserView background color when bounds offscreen (#30540)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-19 08:40:08 +09:00
trop[bot]
393045a7e5 fix: {exit|enter}-html-fullscreen emitted after esc in webview (#30560)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-19 08:39:21 +09:00
trop[bot]
4a7dd267ec fix: change gin_wrappable to scoped crash key (#30608)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-08-18 16:29:17 -07:00
Cheng Zhao
f2275ec32e chore: cherry-pick fix for 1231950 from v8 (#30584)
* chore: cherry-pick 1231950 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-19 08:27:21 +09:00
Cheng Zhao
e70c39ed60 chore: cherry-pick fix for 1227933 from chromium (#30583)
* chore: cherry-pick 1227933 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-19 08:26:31 +09:00
trop[bot]
db12e7f08b fix: documentEdited with non-default titlebarStyle (#30603)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-18 14:13:53 -07:00
Sudowoodo Release Bot
6a1c6f8d7f Bump v13.2.1 2021-08-17 15:00:33 -07:00
Sudowoodo Release Bot
7bd6479573 Revert "Bump v13.3.0"
This reverts commit c2de2eaaa0.
2021-08-17 14:58:38 -07:00
Sudowoodo Release Bot
c2de2eaaa0 Bump v13.3.0 2021-08-17 14:23:19 -07:00
Keeley Hammond
62b3a6b724 fix: ensure web_contents() is alive before grabbing view (#30572) 2021-08-17 14:08:25 -07:00
Sudowoodo Release Bot
c3d8337058 Bump v13.2.0 2021-08-17 01:25:11 -07:00
trop[bot]
b3eff8ef13 fix: handle nullish WebContentsView in UpdateDraggableRegions (#30557)
* fix: handle nullish WebContentsView in UpdateDraggableRegions

* build: nogncheck on webcontentsimpl include

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-08-17 01:23:26 -07:00
trop[bot]
6cef0d9118 fix: disable kWindowCaptureMacV2 for desktopCapturer (#30523)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-08-16 12:25:07 -07:00
trop[bot]
65d03deacd docs: uniformize tutorial titles (#30546)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-16 14:08:33 -04:00
trop[bot]
39e55225a0 docs: clarify usage of option (#30548)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-16 14:06:54 -04:00
Steven Barbaro
bb83758378 chore: cherry-pick 4ce2abc17078 from chromium (#30449)
* chore: cherry-pick 4ce2abc17078 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-08-13 09:42:51 +09:00
trop[bot]
2716a25fcf feat: expose des-ede3 cipher (#30453)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-08-12 11:48:54 -07:00
Keeley Hammond
2745d70d25 fix: explicitly define REFGUID from ::GUID&, not base::GUID (#30442) (#30500)
* fix: explicitly define REFGUID from ::GUID&

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

* fix: duplicate GUID_NULL symbol, add comment
2021-08-11 15:07:59 -07:00
trop[bot]
b6ffa799c5 docs: add missing <webview> event documentation (#30465)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-08-11 09:44:29 +09:00
trop[bot]
c9bb6cd134 docs: fix camelcase in menu example (#30461)
* docs: fix camelcase in menu example and add hint to deal with TS error

hideothers -> hideOthers (the TS compiler caught this)
The TypeScript compiler also did not like the pattern used to
switch between platforms for submenus was loosing the type information
of the literal constants and generalized them as strings which
conflicts with the type definition of MenuItemConstructorOptions.

* docs: Fix spelling, added hint to TypeScript

Without explicitly stating the type for the const template TypeScript does not create a
with the correct shape due to generalization to strings.

* remove ts hints

Co-authored-by: a@b <a@b>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2021-08-11 09:39:32 +09:00
trop[bot]
ac2515dd0d chore: more crash-keys for gin::Wrappable debugging (#30421)
* chore: more crash-keys for gin::Wrappable debugging

* fix namespace for Event

* Update crash_keys.cc

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-08-10 09:50:46 +09:00
Sudowoodo Release Bot
49436f298b Bump v13.1.9 2021-08-09 16:03:12 -07:00
Sudowoodo Release Bot
542874d13b Revert "Bump v13.1.9"
This reverts commit 2a8e1a6de1.
2021-08-09 16:01:53 -07:00
Sudowoodo Release Bot
2a8e1a6de1 Bump v13.1.9 2021-08-09 16:00:57 -07:00
trop[bot]
f5bffae462 build: rebase release branch before reverting bump (#30418)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-08-09 09:54:52 +02:00
Steven Barbaro
9f80f4aa76 chore: cherry-pick e2123a8e0943 from chromium (#30452)
* chore: cherry-pick e2123a8e0943 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-09 09:50:39 +02:00
Cheng Zhao
736150672c fix: move window buttons in-place on macOS (#30393) 2021-08-09 16:00:43 +09:00
trop[bot]
7434547d97 build: fix building with enable_desktop_capturer = false (#30390)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-08-04 09:56:26 +09:00
Electron Bot
0436a27d4f Bump v13.1.8 2021-08-03 10:22:52 -07:00
trop[bot]
6627bebdbd fix: use contentAspectRatio not aspectRatio (#30330)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-02 09:59:14 +09:00
trop[bot]
4a24a28467 fix: guard against missing native view (#30326)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-02 09:57:25 +09:00
trop[bot]
390ed798f0 build: set the export goma auth fallback flag for the control process (#30317)
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-08-02 09:56:26 +09:00
trop[bot]
cdd2176bb6 chore: update deps (#30345)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-07-30 14:56:22 -07:00
Pedro Pontes
e57b74858f chore: cherry-pick 1168f81092 from sqlite (#30294)
* chore: cherry-pick 1168f81092 from sqlite

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-07-30 09:00:50 +09:00
Robo
3805e3c0fc fix: update traffic lights position for macOS 11 (#30319)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-07-29 21:15:47 +09:00
trop[bot]
5fb34249c6 chore: add additional crash key to gin::Wrappable (#30224)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-07-29 19:46:47 +09:00
trop[bot]
06997edc3a chore: update publish to npm to use GitHub token (#30290)
ensures that we don't get hit with a rate limit while trying to publish a release.

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-07-28 12:24:55 -07:00
Pedro Pontes
e2b961d73c chore: cherry-pick e38d55313ad9 from v8 (#30246)
* chore: cherry-pick e38d55313ad9 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-07-28 15:56:40 +02:00
Pedro Pontes
867ea38cd0 chore: cherry-pick ac9dc1235e28 from chromium (#30265)
* chore: cherry-pick ac9dc1235e28 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-07-28 15:56:13 +02:00
trop[bot]
2e8f2a2f51 docs: update default branch for Electron Packager API links (#30187)
Co-authored-by: Mark Lee <electronjs@lazymalevolence.com>
2021-07-27 09:17:16 +09:00
trop[bot]
4da1162ffe fix: allow colored tray titles when font type is specified (#30163)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-27 09:14:51 +09:00
Pedro Pontes
9d3ebb1888 chore: cherry-pick cd98d7c0dae9 from chromium (#30251)
* chore: cherry-pick cd98d7c0dae9 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-07-26 17:50:18 +09:00
trop[bot]
0b8971dec2 fix: increase stack size on windows x86 (#30241)
* fix: increace main thread stack size on windows x86

* chore: improve quit-on-crashed-event spec

* chore: add debug logs

* Revert "chore: add debug logs"

This reverts commit 0be81ae07c.

* chore: use a reliable crash endpoint

Co-authored-by: Stephen Wang <wangwenqiang.wwq@bytedance.com>
Co-authored-by: Deepak Mohan <hop2deep@gmail.com>
2021-07-26 17:47:16 +09:00
Cheng Zhao
c8ab43a766 fix: pressing ESC should exit fullscreen from webview (#30128) 2021-07-26 17:34:04 +09:00
Jeremy Rose
64c6737bb2 chore: cherry-pick 5487040a284a from chromium (#30203) 2021-07-22 10:14:14 -07:00
Pedro Pontes
30b6330189 chore: cherry-pick e60cc80ff744 from chromium (#30229)
* chore: cherry-pick e60cc80ff744 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-07-22 11:08:12 -04:00
trop[bot]
177bdd207c build: handle release failure by existing with code 1 (#30221)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-07-21 11:15:06 -04:00
electron-roller[bot]
77fbad0333 chore: bump chromium to 91.0.4472.164 (13-x-y) (#30169)
* chore: bump chromium in DEPS to 91.0.4472.164

* chore: update patches

* fix DEPS

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-21 09:34:32 -04:00
Electron Bot
971ec77b96 Bump v13.1.7 2021-07-15 10:15:20 -07:00
trop[bot]
1b0c15f742 fix: double traffic lights on exit fullscreen (#30149)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-15 15:25:09 +09:00
trop[bot]
52cddbcd92 docs: add <webview> 'did-attach' event documentation (#30129)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-07-15 10:40:33 +09:00
trop[bot]
6d0feb8b79 docs: fix fiddle path (#30144)
This is breaking the build in `electron/electronjs.org-new` and will
most likely not work when clicking the "Fiddle" button.

Rel: https://github.com/electron/electronjs.org-new/pull/65

Co-authored-by: Antón Molleda <amolleda@gmail.com>
2021-07-14 17:51:08 -04:00
trop[bot]
2e096ac6bc fix: adjust initial webContents focus calculation (#29234)
* fix: adjust initial webContents focus calculation

* fix: active window check on mac

* fix: about:blank focus behavior

* chore: add spec

* fix: window ordering on mac

* chore: focus <webview> after navigation

* chore: fix flaky fullscreen inheritance test

* chore: disable fullscreen test on mac arm

* chore: simplify found-in-page spec

* chore: fix lint

* chore: move found-in-page spec to main process

* chore: fix lint

* chore: remove focus workaround

* chore: improve found-in-page spec

Co-authored-by: Raymond Zhao <raymondzhao@microsoft.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-07-14 11:03:01 -07:00
trop[bot]
3afe390805 chore: update releases to 8 weeks in CONTRIBUTING (#30119)
* chore: update releases to 8 weeks in CONTRIBUTING

* chore: update support.md for four version support

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-07-14 08:09:55 -07:00
trop[bot]
d5097dd2e6 docs: Update timeline for E15 alpha announcement (#30117)
* docs: Update timeline for E15 alpha announcement

* fix line break

Co-authored-by: Sofia Nguy <sofianguy@gmail.com>
2021-07-14 08:09:28 -07:00
trop[bot]
257b214cb5 docs: update quick-start.md (#30133)
Change app-quit link definition, so both window-all-closed and app-quit redirects to appropriate sites.

Co-authored-by: Davenury <57959794+Davenury@users.noreply.github.com>
2021-07-14 22:26:30 +09:00
Jeremy Rose
945ecdd709 fix: crash when invoking login callback synchronously (#30068) (#30091) 2021-07-14 20:48:16 +09:00
trop[bot]
cb614d15aa build: decode error output as utf8 (#30094)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-14 20:46:39 +09:00
trop[bot]
5fbcee074d fix: return RGBA values from getSystemColor (#30088)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-14 20:46:08 +09:00
trop[bot]
dc14161a98 test: disable failing node tests (#30098)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-13 09:05:14 -07:00
trop[bot]
299fa3a3c4 chore: cherry-pick 9bab573a37 from chromium (#30100)
* chore: cherry-pick 9bab573a37 from chromium

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

* chore: update patches

Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-07-12 22:07:50 -07:00
trop[bot]
d09e7f851b docs: modernize protocol-handler docs (#30057)
* docs: modernize protocol-handler docs

* docs: iadd contextIsolation

* docs: add guide for launch-app-from-URL-in-other-app

* docs: address comments

* chore: fix brackets

* chore: add escaped brackets

Co-authored-by: George Xu <gxu@slack-corp.com>
2021-07-09 14:36:51 -04:00
Shelley Vohr
84eea6fa79 fix: fsPromises.readFile renderer crash (#29928) 2021-07-06 10:36:31 +09:00
trop[bot]
0cd80cd424 docs: remove requestHeaders in webRequest.onHeadersReceived (#29933)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-07-06 10:34:58 +09:00
trop[bot]
78f037f639 fix: honor user-defined Downloads directory (#29968)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-05 15:53:55 -04:00
trop[bot]
fc75bf0a9e fix: webview should maximize on requestFullscreen (#29987)
* fix: webview should maximize on requestFullscreen

* chore: update patches

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-07-05 14:36:39 -04:00
Electron Bot
ddc44e1af4 Bump v13.1.6 2021-07-05 11:12:13 -07:00
trop[bot]
5ab2749acc fix: do not leak NSUUID (#30009)
* fix: do not leak NSUUID

* Fix build error

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-07-05 12:53:04 -04:00
trop[bot]
642c458c31 docs: remove Experimental from contextBridge.exposeInMainWorld (#30010)
The API has been around for about 3 years. It should no longer be
considered experimental.

Co-authored-by: Antón Molleda <amolleda@gmail.com>
2021-07-05 15:28:56 +09:00
trop[bot]
2195890a46 fix: self.module.paths not working in web workers (#30013)
* fix: global.module.paths in workers

* spec: add a regression test

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-05 15:27:20 +09:00
Samuel Attard
3413e89572 chore: cherry-pick cc20b36a5845 from chromium (#29997)
* chore: cherry-pick cc20b36a5845 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-07-05 08:45:52 +09:00
trop[bot]
7bf69ce4ee docs: remove mention of node-mac-notifier (#30002)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-07-05 08:44:20 +09:00
trop[bot]
49f5006ef0 fix: crash when clicking links with target=_blank from webview (#29951)
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-07-01 19:57:59 -07:00
trop[bot]
fea59c5601 fix: correctly propagate title updates for window with no navigation entries (#29958)
* fix: correctly propagate title updates for window with no navigation entries

* test

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-02 09:49:58 +09:00
trop[bot]
6feed17387 fix: potential crash on macOS app exit (#29961)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-02 08:43:22 +09:00
Electron Bot
ec0fa836d2 Bump v13.1.5 2021-07-01 11:36:42 -07:00
trop[bot]
56a34d3b10 build: add support for spawning builds for a specific commit on appveyor (#29971) (#29983)
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-07-01 10:53:33 -07:00
Shelley Vohr
bde3d403a8 fix: child window alwaysOnTop level persistence (#29956) 2021-07-01 10:22:37 -04:00
John Kleinschmidt
8779a3ac0f ci: fixup arm testing (#29927)
* ci: fixup arm testing

* update patch for 13-x-y

* also check against kPartitionAllocPCScan
2021-06-30 14:12:47 -04:00
Omar Kilani
b465ee721e fix: geolocation crashes electron on macOS (#29343) (#29912) 2021-06-28 20:31:04 -07:00
trop[bot]
50b0750df3 docs: fix broken markdown in dialog.md (#29848)
* docs: fix broken markdown in dialog.md

* &#32;

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-06-29 09:15:47 +09:00
electron-roller[bot]
1a3da54563 chore: bump chromium to 91.0.4472.124 (13-x-y) (#29774)
* chore: bump chromium in DEPS to 91.0.4472.114

* chore: bump chromium in DEPS to 91.0.4472.124

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2021-06-28 14:06:13 -04:00
trop[bot]
fa3767564a fix: stop window.open from hanging when prevented (#29882)
* fix: stop window.open from hanging when prevented

* add test

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-06-28 15:24:18 +09:00
trop[bot]
85db7e7077 fix: properly order out child windows (#29888)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-25 17:55:45 +09:00
trop[bot]
9b1d2d5b88 fix: Inspector method overrides when contextIsolation enabled (#29885)
* fix: Inspector method overrides when contextIsolation enabled

* fix: handle DevToolsAPI call

* refactor: always use webFrame.executeJavaScript

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-25 17:50:39 +09:00
trop[bot]
e8621de3f5 fix: properly handle optional requestHeaders with onBeforeSendHeaders (#29836)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-23 10:09:25 +09:00
Electron Bot
9942b2ba80 Bump v13.1.4 2021-06-22 10:20:05 -07:00
trop[bot]
2bf125f82a fix: allow ppapi processes access to resource bundle on all platforms (#29830)
* wip: debug resource bundle failure

* fix: include ppapi subprocesses for windows resource bundle

* fix: allow ppapi plugin processes access to resource bundle on all platforms.

Aligns with chrome_main_delegate here: https://chromium-review.googlesource.com/c/chromium/src/+/2619003

* chore: remove incorrectly backported patches

Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2021-06-22 14:59:06 +09:00
John Kleinschmidt
69493ac51e ci: run linux arm tests on CircleCI (#29766)
* ci: run linux arm tests on CircleCI

* cleanup electron dirs after testing

(cherry picked from commit 1c0a6045fb)

* use start-stop-daemon to kill Xvfb

(cherry picked from commit 1d10a68c31)
2021-06-22 14:58:07 +09:00
Electron Bot
6504c4bbc8 Bump v13.1.3 2021-06-21 10:03:02 -07:00
trop[bot]
5c1e1ee5ec fix: do not cancel CORS preflight request on proxy auth. (#29811)
* fix: do not cancel CORS preflight request on proxy auth. (#29266)

* fix: do not cancel CORS preflight request on proxy auth.

If connecting via proxy, preflight request can receive 407
header response from proxy. This does not mean request
was finished even though it received headers (from proxy,
not the destination server), so prevent "completing"
and most importantly deleting it, which causes request
to be canceled in network layer. Just continue to monitor it
and await proper response from server. Also add circut breaker
to cancel request if proxy auth failed 3 times (for example
user keeps cancelling auth). This behavior happens only
when app registered WebRequest api listeners.

* Port chromium webrequest changes to electron code.

Move relevant parts of chromium WebRequestProxyingURLLoaderFactory from
https://chromium-review.googlesource.com/c/chromium/src/+/2011781
into electron ProxyingURLLoaderFactory.

* Update code to upstreamed version and remove retyr count failsafe.

Co-authored-by: Milan Burda <milan.burda@gmail.com>

* chore: add required header

Co-authored-by: marekharanczyk <48673767+marekharanczyk@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-06-21 21:20:05 +09:00
trop[bot]
f39ac0764d fix: update Squirel.Mac to fix CPU spin during update (#29805)
* fix: update Squirel.Mac to fix CPU spin during update

Refs: https://github.com/Squirrel/Squirrel.Mac/pull/259
Closes: #29119

* chore: update patches

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-06-21 19:06:06 +09:00
trop[bot]
252805ddb4 fix: microtasks policy in CreateEnvironment (#29808)
* fix: microtasks policy in CreateEnvironment

Microtasks policy should not be updated for the renderer because
`NodeBindings::CreateEnvironment` might be entered with or without
`UvRunOnce()` on stack. One of the examples of such calls is
`window.open()` which is possible to invoke while `uv_run()` is still
running (e.g. with `setImmediate()`).

All in all, it doesn't matter that much which policy we use since
`v8::MicrotasksScope` has a check for the policy in its destructor and
no commits will be made if the policy is `kExplicit`. It is important,
however, to not change the policy in the middle of `UvRunOnce()` so we
should respect whatever we currently have and move on.

Fix: #29463

* Move test to a better place

* Update spec-main/fixtures/crash-cases/setimmediate-window-open-crash/index.html

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>

* Update spec-main/fixtures/crash-cases/setimmediate-window-open-crash/index.html

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>

* simplify crash-case

* comment

* fix comment

Co-authored-by: Fedor Indutny <fedor@indutny.com>
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Fedor Indutny <indutny@signal.org>
2021-06-21 15:49:17 +09:00
trop[bot]
df27597c05 docs: fix frontmatter for Tray tutorial (#29803)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-06-21 14:00:25 +09:00
trop[bot]
fa683ef8b7 fix: fix hover state not clear bug when BrowserWindow is not resizable (#611) (#29800)
Co-authored-by: sssooonnnggg <sssooonnnggg111@gmail.com>
2021-06-21 13:59:36 +09:00
trop[bot]
16b09a676f docs: clarify use of ELECTRON_SKIP_BINARY_DOWNLOAD (#29745)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-06-21 10:10:05 +09:00
George Xu
301108ece4 docs: Add clarification for Visual Zoom behavior (#28860) (#29764)
* Add clarification for visual zoom documentation

Co-authored-by: Michael Kozakov <michael.kozakov@snapchat.com>
2021-06-18 11:02:42 -07:00
Keeley Hammond
5d36cdf485 fix: color select eyedropper not working within DevTools (#29729) (#29760)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-18 11:34:03 +02:00
George Xu
c94ab729dd docs: added guide and updated docs for Tray (#29385) (#29762)
* docs: added guide and updated docs for Tray

* docs: improve clarity
2021-06-17 14:03:07 -07:00
trop[bot]
b35f904e58 fix: ensure detached devtools are not always draggable (#29737)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-06-17 15:29:27 +09:00
trop[bot]
b143042c7f fix: draggable regions with devtools open (#29734)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-17 15:21:27 +09:00
trop[bot]
10c238c0ea fix: potential crash when setting vibrancy (#29722)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-17 15:20:05 +09:00
trop[bot]
ad2f34491c fix setWindowOpenHandler call syntax (#29726)
Co-authored-by: kdau <kevin@kdau.com>
2021-06-16 10:13:02 -07:00
electron-roller[bot]
d6c51bc456 chore: bump chromium in DEPS to 91.0.4472.106 (#29700)
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2021-06-15 13:23:07 -07:00
trop[bot]
f313d00083 docs: update WebPreferences default values for Electron 12 (#29710)
Updates the values for `contextIsolation` and `worldSafeExecuteJavaScript` for Electron 12.

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-06-15 16:15:51 -04:00
trop[bot]
2ef55e1e9e chore: disable default async spellchecker on Windows (#29706)
* chore: disable default async spellchecker on Windows

* chore: disable kWinRetrieveSuggestionsOnlyOnDemand in feature list

* chore: remove incorrectly backported patches

Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2021-06-15 12:49:52 -07:00
Milan Burda
62402870fd fix: warnAboutRemoteModuleWithRemoteContent (#29691)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2021-06-15 12:02:03 +02:00
trop[bot]
7b2a4c9984 docs: Update represented-file fiddle tutorial (#29693)
* Update represented-file fiddle.

* add index and code back to guide

Co-authored-by: Kevin Hartman <kevin@hart.mn>
Co-authored-by: Ethan Arrowood <ethan.arrowood@gmail.com>
2021-06-15 11:36:57 +09:00
trop[bot]
7958f3efbb docs: fix typo in process-model.md (#29683)
Co-authored-by: Luke Ingalls <45518011+lukeingalls@users.noreply.github.com>
2021-06-14 10:12:58 -07:00
trop[bot]
3e90aff6fd docs: fix file mode of versioning-sketch-2.png (#29681)
Unlike the other files, this file had its executable bit set in its file
mode. This change removes the executable bit to align its file mode with
the rest of the files.

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

Co-authored-by: Darshan Sen <raisinten@gmail.com>
2021-06-14 10:12:35 -07:00
trop[bot]
192fc3ee2c fix: check DCHECK_IS_ON() instead of #ifdef DCHECK_IS_ON (#29674)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-06-14 21:00:20 +09:00
trop[bot]
e0e7b14bdc fix: use correct spelling of attachment with Content-Disposition header (#29672)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-14 20:59:05 +09:00
trop[bot]
4cecc87c55 fix: copy received data in URLPipeLoader to prevent corruption (#29669)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-14 17:47:17 +09:00
Shelley Vohr
46e7511af9 fix: ensure custom traffic lights float to top (#29663)
* fix: ensure custom traffic lights float to top

* chore: split into separate function
2021-06-14 09:36:15 +09:00
trop[bot]
72733bae8a docs: fix typo (#29582)
* Typo fix

* Update main.js

Co-authored-by: ZReC <contact.zrec@gmail.com>
2021-06-14 09:35:07 +09:00
trop[bot]
38fce95417 docs: fix image links in performance.md (#29631)
* docs: fix image links in performance.md

Fixes https://github.com/electron/electron/issues/29580

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

* Apply suggestions from code review

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

Co-authored-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-14 09:33:53 +09:00
electron-roller[bot]
54de33464d chore: bump chromium to 91.0.4472.101 (13-x-y) (#29629)
* chore: bump chromium in DEPS to 91.0.4472.101

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-06-10 15:59:28 -07:00
trop[bot]
6c4c66d2cd fix: select-bluetooth-device on Windows (#29611)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-06-09 12:48:41 -04:00
Electron Bot
839dcbbbdb Bump v13.1.2 2021-06-09 09:39:07 -07:00
trop[bot]
05ae55d131 fix: ensure fuse order is read in a stable way (#29615)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-06-09 09:26:51 -07:00
trop[bot]
d7736e5924 fix: improper wrapping of fs.promises.readFile (#29576) 2021-06-08 10:31:27 +02:00
trop[bot]
30921548ed fix: make intermediates work with 'select-client-certificate' (#29569)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-08 11:40:09 +09:00
Cheng Zhao
9059a50f93 fix: keep shifted character in menu accelerator (#29482)
* fix: keep shifted character in menu accelerator

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-06-07 10:25:35 -04:00
trop[bot]
78569e9b91 docs: Update notifications (renderer) docs (#29564)
* remove version information from html

* change format for readability

* clarify which console the message should appear in

* minor changes to renderer.md

* update UI on click instead of developer console

* remove node-integration and fix md

* update content

* chore: remove ****

Co-authored-by: Jeremy Foster <jeremy.foster@live.com>
Co-authored-by: Ethan Arrowood <ethan.arrowood@gmail.com>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2021-06-07 14:43:42 +09:00
trop[bot]
07b8b2ffdd docs: Updated "recent documents" fiddle tutorial (#29561)
* Port recent-documents fiddle to 12-x-y.

* Update recent-documents tutorial.

* update for review comments

Co-authored-by: Kevin Hartman <kevin@hart.mn>
Co-authored-by: Ethan Arrowood <ethan.arrowood@gmail.com>
2021-06-07 14:42:58 +09:00
trop[bot]
2d18829b43 build: Improve squirrel.mac BUILD.gn xcrun_action error (#29513)
Right now, if executing `xcrun` fails, then the error message prints the
second argument to the `xcrun.py` script, which is the first argument to
the tool that `xcrun` is executing, making the whole error message quite
confusing.

Consider the following error:

```
python ../../third_party/squirrel.mac/build/xcrun.py dtrace -h -s /private/tmp/20210531211008-def376dc/src/third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACSignalProvider.d -o /private/tmp/20210531211008-def376dc/src/out/release/gen/third_party/squirrel.mac/dtrace/RACSignalProvider.h
xcrun script '-h' failed with code '71':
xcrun: error: can't exec '/tmp/20210531211008-def376dc/dtrace' (errno=Permission denied)
```

The command that `xcrun` is executing is `dtrace`, but the error just
mentions the `-h` flag.

Notes: none
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>

Co-authored-by: Juan Cruz Viotti <jv@jviotti.com>
2021-06-07 10:23:51 +09:00
trop[bot]
f0a9e56741 chore: return early on promise rejection (#29538)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-07 10:17:15 +09:00
Samuel Attard
314e627df1 Revert "Revert "fix: change ASAR archive cache to per-process to fix leak (#29535)""
This reverts commit 0dcc660794.
2021-06-04 10:29:42 -07:00
Electron Bot
b5c79632ef Bump v13.1.1 2021-06-04 10:29:05 -07:00
Samuel Attard
0dcc660794 Revert "fix: change ASAR archive cache to per-process to fix leak (#29535)"
This reverts commit ff2a0a4bd3.
2021-06-04 10:28:20 -07:00
Samuel Attard
0753e4911c fix: disable CET as v8 deoptimization is incompatible with it (#29546) 2021-06-04 10:27:55 -07:00
trop[bot]
ff2a0a4bd3 fix: change ASAR archive cache to per-process to fix leak (#29535)
* fix: change ASAR archive cache to per-process to fix leak (#29292)

* chore: address code review comments

* chore: tighten up thread-safety

* chore: better address code review comments

* chore: more code review changes

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-04 13:19:31 +09:00
trop[bot]
5860b70189 docs: link to IncomingMessage (#29516)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-03 16:19:49 +09:00
Milan Burda
d84b7fc4d4 test: add spec for --require filtering in NODE_OPTIONS (#29507) 2021-06-03 14:43:50 +09:00
329 changed files with 19940 additions and 1613 deletions

View File

@@ -57,6 +57,16 @@ parameters:
type: boolean
default: false
# Executors
executors:
linux-arm:
resource_class: electronjs/linux-arm
machine: true
linux-arm64:
resource_class: electronjs/linux-arm64
machine: true
# The config expects the following environment variables to be set:
# - "SLACK_WEBHOOK" Slack hook URL to send notifications.
#
@@ -239,7 +249,14 @@ step-maybe-cleanup-arm64-mac: &step-maybe-cleanup-arm64-mac
killall Safari || echo "No Safari processes left running"
rm -rf ~/Library/Application\ Support/Electron*
rm -rf ~/Library/Application\ Support/electron*
elif [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
XVFB=/usr/bin/Xvfb
/sbin/start-stop-daemon --stop --exec $XVFB || echo "Xvfb not running"
pkill electron || echo "electron not running"
rm -rf ~/.config/Electron*
rm -rf ~/.config/electron*
fi
when: always
step-checkout-electron: &step-checkout-electron
@@ -325,6 +342,7 @@ step-setup-goma-for-build: &step-setup-goma-for-build
npm install
mkdir third_party
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
export GOMA_FALLBACK_ON_AUTH_FAILURE=true
third_party/goma/goma_ctl.py ensure_start
echo 'export GN_GOMA_FILE='`node -e "console.log(require('./src/utils/goma.js').gnFilePath)"` >> $BASH_ENV
echo 'export LOCAL_GOMA_DIR='`node -e "console.log(require('./src/utils/goma.js').dir)"` >> $BASH_ENV
@@ -763,7 +781,7 @@ step-verify-mksnapshot: &step-verify-mksnapshot
command: |
if [ "$IS_ASAN" != "1" ]; then
cd src
if [ "$TARGET_ARCH" == "arm64" ] &&[ "`uname`" == "Darwin" ]; then
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --snapshot-files-dir $PWD/cross-arch-snapshots
else
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default
@@ -908,28 +926,6 @@ step-maybe-cross-arch-snapshot-store: &step-maybe-cross-arch-snapshot-store
path: src/cross-arch-snapshots
destination: cross-arch-snapshots
step-maybe-trigger-arm-test: &step-maybe-trigger-arm-test
run:
name: Trigger an arm test on VSTS if applicable
command: |
cd src
# Only run for non-fork prs
if [ "$TRIGGER_ARM_TEST" == "true" ] && [ -z "$CIRCLE_PR_NUMBER" ]; then
#Trigger VSTS job, passing along CircleCI job number and branch to build
if [ "`uname`" == "Darwin" ]; then
if [ x"$MAS_BUILD" == x"true" ]; then
export DEVOPS_BUILD="electron-mas-arm64-testing"
else
export DEVOPS_BUILD="electron-osx-arm64-testing"
fi
echo "Triggering $DEVOPS_BUILD build on Azure DevOps"
node electron/script/release/ci-release-build.js --job=$DEVOPS_BUILD --ci=DevOps --armTest --circleBuildNum=$CIRCLE_BUILD_NUM $CIRCLE_BRANCH
else
echo "Triggering electron-$TARGET_ARCH-testing build on VSTS"
node electron/script/release/ci-release-build.js --job=electron-$TARGET_ARCH-testing --ci=VSTS --armTest --circleBuildNum=$CIRCLE_BUILD_NUM $CIRCLE_BRANCH
fi
fi
step-maybe-generate-typescript-defs: &step-maybe-generate-typescript-defs
run:
name: Generate type declarations
@@ -1344,7 +1340,7 @@ steps-tests: &steps-tests
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split)) 2>&1 | $ASAN_SYMBOLIZE
(cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split)) 2>&1 | $ASAN_SYMBOLIZE
else
if [ "$TARGET_ARCH" == "arm64" ] &&[ "`uname`" == "Darwin" ]; then
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
export ELECTRON_SKIP_NATIVE_MODULE_TESTS=true
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging)
(cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging)
@@ -1635,9 +1631,6 @@ commands:
steps:
- *step-save-out-cache
# Trigger tests on arm hardware if needed
- *step-maybe-trigger-arm-test
- *step-maybe-notify-slack-failure
electron-publish:
@@ -1981,7 +1974,7 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
steps:
- electron-build:
persist: false
persist: true
checkout: true
use-out-cache: false
@@ -2040,7 +2033,7 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
steps:
- electron-build:
persist: false
persist: true
checkout: true
use-out-cache: false
@@ -2437,6 +2430,24 @@ jobs:
<<: *env-send-slack-notifications
<<: *steps-verify-ffmpeg
linux-arm-testing-tests:
executor: linux-arm
environment:
<<: *env-arm
<<: *env-global
<<: *env-headless-testing
<<: *env-stack-dumping
<<: *steps-tests
linux-arm64-testing-tests:
executor: linux-arm64
environment:
<<: *env-arm64
<<: *env-global
<<: *env-headless-testing
<<: *env-stack-dumping
<<: *steps-tests
osx-testing-x64-tests:
<<: *machine-mac-large
environment:
@@ -2689,8 +2700,23 @@ workflows:
- linux-ia32-testing
- linux-arm-testing
- linux-arm-testing-tests:
filters:
branches:
# Do not run this on forked pull requests
ignore: /pull\/[0-9]+/
requires:
- linux-arm-testing
- linux-arm64-testing
- linux-arm64-testing-tests:
filters:
branches:
# Do not run this on forked pull requests
ignore: /pull\/[0-9]+/
requires:
- linux-arm64-testing
- linux-arm64-testing-gn-check:
requires:
- linux-checkout-fast

View File

@@ -183,6 +183,12 @@ action("electron_js2c") {
rebase_path(sources, root_build_dir)
}
action("generate_config_gypi") {
outputs = [ "$root_gen_dir/config.gypi" ]
script = "script/generate-config-gypi.py"
args = rebase_path(outputs) + [ target_cpu ]
}
target_gen_default_app_js = "$target_gen_dir/js/default_app"
typescript_build("default_app_js") {

View File

@@ -22,7 +22,7 @@ Issues are created [here](https://github.com/electron/electron/issues/new).
### Issue Closure
Bug reports will be closed if the issue has been inactive and the latest affected version no longer receives support. At the moment, Electron maintains its three latest major versions, with a new major version being released every 12 weeks. (For more information on Electron's release cadence, see [this blog post](https://electronjs.org/blog/12-week-cadence).)
Bug reports will be closed if the issue has been inactive and the latest affected version no longer receives support. At the moment, Electron maintains its three latest major versions, with a new major version being released every 8 weeks. (For more information on Electron's release cadence, see [this blog post](https://electronjs.org/blog/8-week-cadence).)
_If an issue has been closed and you still feel it's relevant, feel free to ping a maintainer or add a comment!_

7
DEPS
View File

@@ -10,17 +10,18 @@ gclient_gn_args = [
'checkout_openxr',
'checkout_google_benchmark',
'mac_xcode_version',
'generate_location_tags',
]
vars = {
'chromium_version':
'91.0.4472.77',
'91.0.4472.164',
'node_version':
'v14.16.0',
'nan_version':
'v2.14.2',
'squirrel.mac_version':
'cdc0729c8bf8576bfef18629186e1e9ecf1b0d9f',
'0e5d146ba13101a1302d59ea6e6e0b3cace4ae38',
'pyyaml_version': '3.12',
@@ -52,6 +53,8 @@ vars = {
'mac_xcode_version': 'default',
'generate_location_tags': False,
# To allow running hooks without parsing the DEPS tree
'process_deps': True,

View File

@@ -1 +1 @@
13.1.0
13.6.3

View File

@@ -31,3 +31,5 @@ is_cfi = false
# Make application name configurable at runtime for cookie crypto
allow_runtime_configurable_key_storage = true
enable_cet_shadow_stack = false

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python3
from collections import OrderedDict
import json
import os
import sys
@@ -50,7 +51,7 @@ const volatile char kFuseWire[] = { /* sentinel */ {sentinel}, /* fuse_version *
"""
with open(os.path.join(dir_path, "fuses.json5"), 'r') as f:
fuse_defaults = json.loads(''.join(line for line in f.readlines() if not line.strip()[0] == "/"))
fuse_defaults = json.loads(''.join(line for line in f.readlines() if not line.strip()[0] == "/"), object_pairs_hook=OrderedDict)
fuse_version = fuse_defaults['_version']
del fuse_defaults['_version']

View File

@@ -16,5 +16,5 @@ try:
subprocess.check_output(args, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
error_msg = "NPM script '{}' failed with code '{}':\n".format(sys.argv[2], e.returncode)
print(error_msg + e.output.decode('ascii'))
print(error_msg + e.output.decode('utf8'))
sys.exit(e.returncode)

View File

@@ -66,8 +66,11 @@ static_library("chrome") {
"//chrome/browser/extensions/global_shortcut_listener_win.cc",
"//chrome/browser/extensions/global_shortcut_listener_win.h",
"//chrome/browser/icon_loader_win.cc",
"//chrome/browser/ui/frame/window_frame_util.h",
"//chrome/browser/ui/view_ids.h",
"//chrome/browser/win/chrome_process_finder.cc",
"//chrome/browser/win/chrome_process_finder.h",
"//chrome/browser/win/titlebar_config.h",
"//chrome/child/v8_crashpad_support_win.cc",
"//chrome/child/v8_crashpad_support_win.h",
]
@@ -145,6 +148,8 @@ static_library("chrome") {
if (enable_color_chooser) {
sources += [
"//chrome/browser/devtools/devtools_eye_dropper.cc",
"//chrome/browser/devtools/devtools_eye_dropper.h",
"//chrome/browser/platform_util.cc",
"//chrome/browser/platform_util.h",
"//chrome/browser/ui/browser_dialogs.h",
@@ -345,17 +350,13 @@ source_set("plugins") {
sources += [
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc",
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h",
"//chrome/renderer/pepper/pepper_flash_font_file_host.cc",
"//chrome/renderer/pepper/pepper_flash_font_file_host.h",
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
]
if (enable_pdf_viewer) {
sources += [
"//chrome/renderer/pepper/pepper_flash_font_file_host.cc",
"//chrome/renderer/pepper/pepper_flash_font_file_host.h",
]
if (enable_pdf_viewer) {
deps += [ "//components/pdf/renderer" ]
}
deps += [ "//components/pdf/renderer" ]
}
deps += [
"//components/strings",

View File

@@ -1193,8 +1193,8 @@ badge.
On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
for more information please read [Desktop Environment Integration][unity-requirement].
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
please read the [Unity integration documentation][unity-requirement].
### `app.getBadgeCount()` _Linux_ _macOS_
@@ -1432,8 +1432,8 @@ An `Integer` property that returns the badge count for current app. Setting the
On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
for more information please read [Desktop Environment Integration][unity-requirement].
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
please read the [Unity integration documentation][unity-requirement].
**Note:** On macOS, you need to ensure that your application has the permission
to display notifications for this property to take effect.
@@ -1461,7 +1461,7 @@ A `Boolean` property that returns `true` if the app is packaged, `false` otherw
[LSCopyDefaultHandlerForURLScheme]: https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme
[handoff]: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html
[activity-type]: https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType
[unity-requirement]: ../tutorial/desktop-environment-integration.md#unity-launcher
[unity-requirement]: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher
[mas-builds]: ../tutorial/mac-app-store-submission-guide.md
[Squirrel-Windows]: https://github.com/Squirrel/Squirrel.Windows
[JumpListBeginListMSDN]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx

View File

@@ -43,7 +43,7 @@ The installer generated with Squirrel will create a shortcut icon with an
same ID for your app with `app.setAppUserModelId` API, otherwise Windows will
not be able to pin your app properly in task bar.
Unlike Squirrel.Mac, Windows can host updates on S3 or any other static file host.
Like Squirrel.Mac, Windows can host updates on S3 or any other static file host.
You can read the documents of [Squirrel.Windows][squirrel-windows] to get more details
about how Squirrel.Windows works.

View File

@@ -187,9 +187,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
* `parent` BrowserWindow (optional) - Specify parent window. Default is `null`.
* `modal` Boolean (optional) - Whether this is a modal window. This only works when the
window is a child window. Default is `false`.
* `acceptFirstMouse` Boolean (optional) - Whether the web view accepts a single
mouse-down event that simultaneously activates the window. Default is
`false`.
* `acceptFirstMouse` Boolean (optional) - Whether clicking an inactive window will also
click through to the web contents. Default is `false` on macOS. This option is not
configurable on other platforms.
* `disableAutoHideCursor` Boolean (optional) - Whether to hide cursor when typing.
Default is `false`.
* `autoHideMenuBar` Boolean (optional) - Auto hide the menu bar unless the `Alt`
@@ -213,16 +213,13 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
* `followWindow` - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.
* `active` - The backdrop should always appear active.
* `inactive` - The backdrop should always appear inactive.
* `titleBarStyle` String (optional) - The style of window title bar.
* `titleBarStyle` String (optional) _macOS_ _Windows_ - The style of window title bar.
Default is `default`. Possible values are:
* `default` - Results in the standard gray opaque Mac title
bar.
* `hidden` - Results in a hidden title bar and a full size content window, yet
the title bar still has the standard window controls ("traffic lights") in
the top left.
* `hiddenInset` - Results in a hidden title bar with an alternative look
* `default` - Results in the standard title bar for macOS or Windows respectively.
* `hidden` - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with `titleBarOverlay: true` it will activate the Window Controls Overlay (see `titleBarOverlay` for more information), otherwise no window controls will be shown.
* `hiddenInset` - Only on macOS, results in a hidden title bar with an alternative look
where the traffic light buttons are slightly more inset from the window edge.
* `customButtonsOnHover` - Results in a hidden title bar and a full size
* `customButtonsOnHover` - Only on macOS, results in a hidden title bar and a full size
content window, the traffic light buttons will display when being hovered
over in the top left of the window. **Note:** This option is currently
experimental.
@@ -339,7 +336,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
more details.
* `contextIsolation` Boolean (optional) - Whether to run Electron APIs and
the specified `preload` script in a separate JavaScript context. Defaults
to `false`. The context that the `preload` script runs in will only have
to `true`. The context that the `preload` script runs in will only have
access to its own dedicated `document` and `window` globals, as well as
its own set of JavaScript builtins (`Array`, `Object`, `JSON`, etc.),
which are all invisible to the loaded content. The Electron API will only
@@ -351,8 +348,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
context in the dev tools by selecting the 'Electron Isolated Context'
entry in the combo box at the top of the Console tab.
* `worldSafeExecuteJavaScript` Boolean (optional) - If true, values returned from `webFrame.executeJavaScript` will be sanitized to ensure JS values
can't unsafely cross between worlds when using `contextIsolation`. The default
is `false`. In Electron 12, the default will be changed to `true`. _Deprecated_
can't unsafely cross between worlds when using `contextIsolation`. Defaults to `true`. _Deprecated_
* `nativeWindowOpen` Boolean (optional) - Whether to use native
`window.open()`. Defaults to `false`. Child windows will always have node
integration disabled unless `nodeIntegrationInSubFrames` is true. **Note:** This option is currently
@@ -404,6 +400,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
contain the layout of the document—without requiring scrolling. Enabling
this will cause the `preferred-size-changed` event to be emitted on the
`WebContents` when the preferred size changes. Default is `false`.
* `titleBarOverlay` [OverlayOptions](structures/overlay-options.md) | Boolean (optional) - When using a frameless window in conjuction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`. On Windows, the [OverlayOptions](structures/overlay-options.md) can be used instead of a boolean to specify colors for the overlay.
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
@@ -986,7 +983,7 @@ the player itself we would call this function with arguments of 16/9 and
are within the content view--only that they exist. Sum any extra width and
height areas you have within the overall content view.
The aspect ratio is not respected when window is resized programmingly with
The aspect ratio is not respected when window is resized programmatically with
APIs like `win.setSize`.
#### `win.setBackgroundColor(backgroundColor)`
@@ -1690,7 +1687,7 @@ current window into a top-level window.
#### `win.getParentWindow()`
Returns `BrowserWindow` - The parent window.
Returns `BrowserWindow | null` - The parent window or `null` if there is no parent.
#### `win.getChildWindows()`
@@ -1810,3 +1807,5 @@ removed in future Electron releases.
[window-levels]: https://developer.apple.com/documentation/appkit/nswindow/level
[chrome-content-scripts]: https://developer.chrome.com/extensions/content_scripts#execution-environment
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis
[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables

View File

@@ -71,7 +71,7 @@ const request = net.request({
Returns:
* `response` IncomingMessage - An object representing the HTTP response message.
* `response` [IncomingMessage](incoming-message.md) - An object representing the HTTP response message.
#### Event: 'login'

View File

@@ -41,7 +41,7 @@ When `contextIsolation` is enabled in your `webPreferences` (this is the default
The `contextBridge` module has the following methods:
### `contextBridge.exposeInMainWorld(apiKey, api)` _Experimental_
### `contextBridge.exposeInMainWorld(apiKey, api)`
* `apiKey` String - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`.
* `api` any - Your API, more information on what this API can be and how it works is available below.
@@ -50,7 +50,7 @@ The `contextBridge` module has the following methods:
### API
The `api` provided to [`exposeInMainWorld`](#contextbridgeexposeinmainworldapikey-api-experimental) must be a `Function`, `String`, `Number`, `Array`, `Boolean`, or an object
The `api` provided to [`exposeInMainWorld`](#contextbridgeexposeinmainworldapikey-api) must be a `Function`, `String`, `Number`, `Array`, `Boolean`, or an object
whose keys are strings and values are a `Function`, `String`, `Number`, `Array`, `Boolean`, or another nested object that meets the same conditions.
`Function` values are proxied to the other context and all other values are **copied** and **frozen**. Any data / primitives sent in

View File

@@ -24,7 +24,7 @@ The `dialog` module has the following methods:
* `buttonLabel` String (optional) - Custom label for the confirmation button, when
left empty the default label will be used.
* `filters` [FileFilter[]](structures/file-filter.md) (optional)
* `properties` String[] (optional) - Contains which features the dialog should
* `properties` String[]&#32;(optional) - Contains which features the dialog should
use. The following values are supported:
* `openFile` - Allow files to be selected.
* `openDirectory` - Allow directories to be selected.
@@ -87,7 +87,7 @@ dialog.showOpenDialogSync(mainWindow, {
* `buttonLabel` String (optional) - Custom label for the confirmation button, when
left empty the default label will be used.
* `filters` [FileFilter[]](structures/file-filter.md) (optional)
* `properties` String[] (optional) - Contains which features the dialog should
* `properties` String[]&#32;(optional) - Contains which features the dialog should
use. The following values are supported:
* `openFile` - Allow files to be selected.
* `openDirectory` - Allow directories to be selected.
@@ -112,7 +112,7 @@ Returns `Promise<Object>` - Resolve with an object containing the following:
* `canceled` Boolean - whether or not the dialog was canceled.
* `filePaths` String[] - An array of file paths chosen by the user. If the dialog is cancelled this will be an empty array.
* `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the `filePaths` array of base64 encoded strings which contains security scoped bookmark data. `securityScopedBookmarks` must be enabled for this to be populated. (For return values, see [table here](#bookmarks-array).)
* `bookmarks` String[]&#32;(optional) _macOS_ _mas_ - An array matching the `filePaths` array of base64 encoded strings which contains security scoped bookmark data. `securityScopedBookmarks` must be enabled for this to be populated. (For return values, see [table here](#bookmarks-array).)
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
@@ -165,7 +165,7 @@ dialog.showOpenDialog(mainWindow, {
displayed in front of the filename text field.
* `showsTagField` Boolean (optional) _macOS_ - Show the tags input box,
defaults to `true`.
* `properties` String[] (optional)
* `properties` String[]&#32;(optional)
* `showHiddenFiles` - Show hidden files in dialog.
* `createDirectory` _macOS_ - Allow creating new directories from dialog.
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
@@ -195,7 +195,7 @@ The `filters` specifies an array of file types that can be displayed, see
* `nameFieldLabel` String (optional) _macOS_ - Custom label for the text
displayed in front of the filename text field.
* `showsTagField` Boolean (optional) _macOS_ - Show the tags input box, defaults to `true`.
* `properties` String[] (optional)
* `properties` String[]&#32;(optional)
* `showHiddenFiles` - Show hidden files in dialog.
* `createDirectory` _macOS_ - Allow creating new directories from dialog.
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
@@ -227,7 +227,7 @@ expanding and collapsing the dialog.
`"warning"`. On Windows, `"question"` displays the same icon as `"info"`, unless
you set an icon using the `"icon"` option. On macOS, both `"warning"` and
`"error"` display the same warning icon.
* `buttons` String[] (optional) - Array of texts for buttons. On Windows, an empty array
* `buttons` String[]&#32;(optional) - Array of texts for buttons. On Windows, an empty array
will result in one button labeled "OK".
* `defaultId` Integer (optional) - Index of the button in the buttons array which will
be selected by default when the message box opens.
@@ -273,7 +273,7 @@ If `browserWindow` is not shown dialog will not be attached to it. In such case
`"warning"`. On Windows, `"question"` displays the same icon as `"info"`, unless
you set an icon using the `"icon"` option. On macOS, both `"warning"` and
`"error"` display the same warning icon.
* `buttons` String[] (optional) - Array of texts for buttons. On Windows, an empty array
* `buttons` String[]&#32;(optional) - Array of texts for buttons. On Windows, an empty array
will result in one button labeled "OK".
* `defaultId` Integer (optional) - Index of the button in the buttons array which will
be selected by default when the message box opens.

View File

@@ -18,17 +18,17 @@ const win = new BrowserWindow({ width: 800, height: 600, frame: false })
win.show()
```
### Alternatives on macOS
### Alternatives
There's an alternative way to specify a chromeless window.
There's an alternative way to specify a chromeless window on macOS and Windows.
Instead of setting `frame` to `false` which disables both the titlebar and window controls,
you may want to have the title bar hidden and your content extend to the full window size,
yet still preserve the window controls ("traffic lights") for standard window actions.
yet still preserve the window controls ("traffic lights" on macOS) for standard window actions.
You can do so by specifying the `titleBarStyle` option:
#### `hidden`
Results in a hidden title bar and a full size content window, yet the title bar still has the standard window controls (“traffic lights”) in the top left.
Results in a hidden title bar and a full size content window. On macOS, the title bar still has the standard window controls (“traffic lights”) in the top left.
```javascript
const { BrowserWindow } = require('electron')
@@ -36,6 +36,8 @@ const win = new BrowserWindow({ titleBarStyle: 'hidden' })
win.show()
```
### Alternatives on macOS
#### `hiddenInset`
Results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.
@@ -61,6 +63,35 @@ const win = new BrowserWindow({ titleBarStyle: 'customButtonsOnHover', frame: fa
win.show()
```
## Windows Control Overlay
When using a frameless window in conjuction with `win.setWindowButtonVisibility(true)` on macOS, using one of the `titleBarStyle`s as described above so
that the traffic lights are visible, or using `titleBarStyle: hidden` on Windows, you can access the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and
[CSS Environment Variables][overlay-css-env-vars] by setting the `titleBarOverlay` option to true. Specifying `true` will result in an overlay with default system colors.
On Windows, you can also specify the color of the overlay and its symbols by setting `titleBarOverlay` to an object with the options `color` and `symbolColor`. If an option is not specified, the color will default to its system color for the window control buttons:
```javascript
const { BrowserWindow } = require('electron')
const win = new BrowserWindow({
titleBarStyle: 'hidden',
titleBarOverlay: true
})
win.show()
```
```javascript
const { BrowserWindow } = require('electron')
const win = new BrowserWindow({
titleBarStyle: 'hidden',
titleBarOverlay: {
color: '#2f3241',
symbolColor: '#74b1be'
}
})
win.show()
```
## Transparent window
By setting the `transparent` option to `true`, you can also make the frameless
@@ -186,3 +217,5 @@ behave correctly on all platforms you should never use a custom context menu on
draggable areas.
[ignore-mouse-events]: browser-window.md#winsetignoremouseeventsignore-options
[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis
[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables

View File

@@ -162,7 +162,7 @@ const template = [
{ role: 'services' },
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideothers' },
{ role: 'hideOthers' },
{ role: 'unhide' },
{ type: 'separator' },
{ role: 'quit' }

View File

@@ -506,6 +506,7 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
* `permissionGranted` Boolean - Allow or deny the permission.
* `details` Object - Some properties are only available on certain permission types.
* `externalURL` String (optional) - The url of the `openExternal` request.
* `securityOrigin` String (optional) - The security origin of the `media` request.
* `mediaTypes` String[] (optional) - The types of media access being requested, elements can be `video`
or `audio`
* `requestingUrl` String - The last URL the requesting frame loaded
@@ -531,7 +532,7 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
#### `ses.setPermissionCheckHandler(handler)`
* `handler` Function\<Boolean> | null
* `webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. Cross origin sub frames making permission checks will pass a `null` webContents to this handler. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
* `webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. All cross origin sub frames making permission checks will pass a `null` webContents to this handler, while certain other permission checks such as `notifications` checks will always pass `null`. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
* `permission` String - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, or `serial`.
* `requestingOrigin` String - The origin URL of the permission check
* `details` Object - Some properties are only available on certain permission types.

View File

@@ -0,0 +1,4 @@
# OverlayOptions Object
* `color` String (optional) _Windows_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.

View File

@@ -14,7 +14,7 @@ Process: [Main](../glossary.md#main-process)
* `highlightedIndex` Integer - The index of the item the user touched.
* `selectedStyle` String (optional) - Selected item style. Can be `background`, `outline` or `none`. Defaults to `none`.
* `overlayStyle` String (optional) - Selected overlay item style. Can be `background`, `outline` or `none`. Defaults to `none`.
* `showArrowButtons` Boolean (optional) - Defaults to `false`.
* `showArrowButtons` Boolean (optional) - Whether to show arrow buttons. Defaults to `false` and is only shown if `items` is non-empty.
* `mode` String (optional) - Can be `fixed` or `free`. The default is `free`.
* `continuous` Boolean (optional) - Defaults to `true`.

View File

@@ -45,6 +45,26 @@ returns `null`.
Returns `WebContents` | undefined - A WebContents instance with the given ID, or
`undefined` if there is no WebContents associated with the given ID.
### `webContents.fromDevToolsTargetId(targetId)`
* `targetId` String - The Chrome DevTools Protocol [TargetID](https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID) associated with the WebContents instance.
Returns `WebContents` | undefined - A WebContents instance with the given TargetID, or
`undefined` if there is no WebContents associated with the given TargetID.
When communicating with the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/),
it can be useful to lookup a WebContents instance based on its assigned TargetID.
```js
async function lookupTargetId (browserWindow) {
const wc = browserWindow.webContents
await wc.debugger.attach('1.3')
const { targetInfo } = await wc.debugger.sendCommand('Target.getTargetInfo')
const { targetId } = targetInfo
const targetWebContents = await webContents.fromDevToolsTargetId(targetId)
}
```
## Class: WebContents
> Render and control the contents of a BrowserWindow instance.

View File

@@ -62,6 +62,11 @@ Sets the maximum and minimum pinch-to-zoom level.
> webFrame.setVisualZoomLevelLimits(1, 3)
> ```
> **NOTE**: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are
> controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem roles in the application
> Menu. To disable shortcuts, manually [define the Menu](./menu.md#examples) and omit zoom roles
> from the definition.
### `webFrame.setSpellCheckProvider(language, provider)`
* `language` String

View File

@@ -154,7 +154,6 @@ response are visible by the time this listener is fired.
* `timestamp` Double
* `statusLine` String
* `statusCode` Integer
* `requestHeaders` Record<string, string>
* `responseHeaders` Record<string, string[]> (optional)
* `callback` Function
* `headersReceivedResponse` Object

View File

@@ -151,12 +151,16 @@ browser plugins. Plugins are disabled by default.
### `preload`
```html
<!-- from a file -->
<webview src="https://www.github.com/" preload="./test.js"></webview>
<!-- or if you want to load from an asar archive -->
<webview src="https://www.github.com/" preload="./app.asar/test.js"></webview>
```
A `String` that specifies a script that will be loaded before other scripts run in the guest
page. The protocol of script's URL must be either `file:` or `asar:`, because it
will be loaded by `require` in guest page under the hood.
page. The protocol of script's URL must be `file:` (even when using `asar:` archives) because
it will be loaded by Node's `require` under the hood, which treats `asar:` archives as virtual
directories.
When the guest page doesn't have node integration this script will still have
access to all Node APIs, but global objects injected by Node will be deleted
@@ -718,6 +722,10 @@ Corresponds to the points in time when the spinner of the tab starts spinning.
Corresponds to the points in time when the spinner of the tab stops spinning.
### Event: 'did-attach'
Fired when attached to the embedder web contents.
### Event: 'dom-ready'
Fired when document in the given frame is loaded.
@@ -838,6 +846,19 @@ this purpose.
Calling `event.preventDefault()` does __NOT__ have any effect.
### Event: 'did-start-navigation'
Returns:
* `url` String
* `isInPlace` Boolean
* `isMainFrame` Boolean
* `frameProcessId` Integer
* `frameRoutingId` Integer
Emitted when any frame (including main) starts navigating. `isInPlace` will be
`true` for in-page navigations.
### Event: 'did-navigate'
Returns:
@@ -850,6 +871,23 @@ This event is not emitted for in-page navigations, such as clicking anchor links
or updating the `window.location.hash`. Use `did-navigate-in-page` event for
this purpose.
### Event: 'did-frame-navigate'
Returns:
* `url` String
* `httpResponseCode` Integer - -1 for non HTTP navigations
* `httpStatusText` String - empty for non HTTP navigations,
* `isMainFrame` Boolean
* `frameProcessId` Integer
* `frameRoutingId` Integer
Emitted when any frame navigation is done.
This event is not emitted for in-page navigations, such as clicking anchor links
or updating the `window.location.hash`. Use `did-navigate-in-page` event for
this purpose.
### Event: 'did-navigate-in-page'
Returns:
@@ -966,3 +1004,78 @@ Emitted when DevTools is focused / opened.
[runtime-enabled-features]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70
[chrome-webview]: https://developer.chrome.com/docs/extensions/reference/webviewTag/
### Event: 'context-menu'
Returns:
* `params` Object
* `x` Integer - x coordinate.
* `y` Integer - y coordinate.
* `linkURL` String - URL of the link that encloses the node the context menu
was invoked on.
* `linkText` String - Text associated with the link. May be an empty
string if the contents of the link are an image.
* `pageURL` String - URL of the top level page that the context menu was
invoked on.
* `frameURL` String - URL of the subframe that the context menu was invoked
on.
* `srcURL` String - Source URL for the element that the context menu
was invoked on. Elements with source URLs are images, audio and video.
* `mediaType` String - Type of the node the context menu was invoked on. Can
be `none`, `image`, `audio`, `video`, `canvas`, `file` or `plugin`.
* `hasImageContents` Boolean - Whether the context menu was invoked on an image
which has non-empty contents.
* `isEditable` Boolean - Whether the context is editable.
* `selectionText` String - Text of the selection that the context menu was
invoked on.
* `titleText` String - Title text of the selection that the context menu was
invoked on.
* `altText` String - Alt text of the selection that the context menu was
invoked on.
* `suggestedFilename` String - Suggested filename to be used when saving file through 'Save
Link As' option of context menu.
* `selectionRect` [Rectangle](structures/rectangle.md) - Rect representing the coordinates in the document space of the selection.
* `selectionStartOffset` Number - Start position of the selection text.
* `referrerPolicy` [Referrer](structures/referrer.md) - The referrer policy of the frame on which the menu is invoked.
* `misspelledWord` String - The misspelled word under the cursor, if any.
* `dictionarySuggestions` String[] - An array of suggested words to show the
user to replace the `misspelledWord`. Only available if there is a misspelled
word and spellchecker is enabled.
* `frameCharset` String - The character encoding of the frame on which the
menu was invoked.
* `inputFieldType` String - If the context menu was invoked on an input
field, the type of that field. Possible values are `none`, `plainText`,
`password`, `other`.
* `spellcheckEnabled` Boolean - If the context is editable, whether or not spellchecking is enabled.
* `menuSourceType` String - Input source that invoked the context menu.
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.
* `mediaFlags` Object - The flags for the media element the context menu was
invoked on.
* `inError` Boolean - Whether the media element has crashed.
* `isPaused` Boolean - Whether the media element is paused.
* `isMuted` Boolean - Whether the media element is muted.
* `hasAudio` Boolean - Whether the media element has audio.
* `isLooping` Boolean - Whether the media element is looping.
* `isControlsVisible` Boolean - Whether the media element's controls are
visible.
* `canToggleControls` Boolean - Whether the media element's controls are
toggleable.
* `canPrint` Boolean - Whether the media element can be printed.
* `canSave` Boolean - Whether or not the media element can be downloaded.
* `canShowPictureInPicture` Boolean - Whether the media element can show picture-in-picture.
* `isShowingPictureInPicture` Boolean - Whether the media element is currently showing picture-in-picture.
* `canRotate` Boolean - Whether the media element can be rotated.
* `canLoop` Boolean - Whether the media element can be looped.
* `editFlags` Object - These flags indicate whether the renderer believes it
is able to perform the corresponding action.
* `canUndo` Boolean - Whether the renderer believes it can undo.
* `canRedo` Boolean - Whether the renderer believes it can redo.
* `canCut` Boolean - Whether the renderer believes it can cut.
* `canCopy` Boolean - Whether the renderer believes it can copy.
* `canPaste` Boolean - Whether the renderer believes it can paste.
* `canDelete` Boolean - Whether the renderer believes it can delete.
* `canSelectAll` Boolean - Whether the renderer believes it can select all.
* `canEditRichly` Boolean - Whether the renderer believes it can edit text richly.
Emitted when there is a new context menu that needs to be handled.

View File

@@ -117,15 +117,18 @@ const mainWindow = new BrowserWindow({
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
if (url === 'about:blank') {
return {
frame: false,
fullscreenable: false,
backgroundColor: 'black',
webPreferences: {
preload: 'my-child-window-preload-script.js'
action: 'allow',
overrideBrowserWindowOptions: {
frame: false,
fullscreenable: false,
backgroundColor: 'black',
webPreferences: {
preload: 'my-child-window-preload-script.js'
}
}
}
}
return false
return { action: 'deny' }
})
```

View File

@@ -26,7 +26,9 @@ you prefer a graphical interface.
* **.lldbinit**: Create or edit `~/.lldbinit` to allow Chromium code to be properly source-mapped.
```text
command script import ~/electron/src/tools/lldb/lldbinit.py
# e.g: ['~/electron/src/tools/lldb']
script sys.path[:0] = ['<...path/to/electron/src/tools/lldb>']
script import lldbinit
```
## Attaching to and Debugging Electron

View File

@@ -22,7 +22,7 @@ function createWindow () {
})
ipcMain.handle('dark-mode:system', () => {
nativeTheme.themeSouce = 'system'
nativeTheme.themeSource = 'system'
})
}

View File

@@ -7,11 +7,9 @@
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<p>After launching this application, you should see the system notification.</p>
<p id="output">Click it to see the effect in this interface.</p>
<script src="renderer.js"></script>
</body>
</html>

View File

@@ -3,10 +3,7 @@ const { app, BrowserWindow } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
height: 600
})
win.loadFile('index.html')

View File

@@ -1,7 +1,6 @@
const myNotification = new Notification('Title', {
body: 'Notification from the Renderer process'
})
const NOTIFICATION_TITLE = 'Title'
const NOTIFICATION_BODY = 'Notification from the Renderer process. Click to log to console.'
const CLICK_MESSAGE = 'Notification clicked!'
myNotification.onclick = () => {
console.log('Notification clicked')
}
new Notification(NOTIFICATION_TITLE, { body: NOTIFICATION_BODY })
.onclick = () => document.getElementById("output").innerText = CLICK_MESSAGE

View File

@@ -2,15 +2,14 @@
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<title>Recent Documents</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<h1>Recent Documents</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
Right click on the app icon to see recent documents.
You should see `recently-used.md` added to the list of recent files
</p>
</body>
</html>

View File

@@ -5,17 +5,15 @@ const path = require('path')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
height: 600
})
win.loadFile('index.html')
}
const fileName = 'recently-used.md'
fs.writeFile(fileName, 'Lorem Ipsum', () => {
app.addRecentDocument(path.join(process.cwd(), `${fileName}`))
app.addRecentDocument(path.join(__dirname, fileName))
})
app.whenReady().then(createWindow)

View File

@@ -4,13 +4,14 @@
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<link rel="stylesheet" type="text/css" href="./styles.css">
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
Click on the title with the <pre>Command</pre> or <pre>Control</pre> key pressed.
You should see a popup with the represented file at the top.
</p>
</body>
</body>
</html>

View File

@@ -4,10 +4,7 @@ const os = require('os');
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
height: 600
})
win.loadFile('index.html')

View File

@@ -16,91 +16,12 @@
<p>
Open the
<a href="https://electronjs.org/docs/api/tray">
full API documentation (opens in new window)
full API documentation
</a>
in your browser.
</p>
</div>
<div>
<div>
<div>
<div>
<button id="put-in-tray">View Demo</button>
<span id="tray-countdown"></span>
</div>
<p>
The demo button sends a message to the main process using the
<code>ipc</code> module. In the main process the app is told to
place an icon, with a context menu, in the tray.
</p>
<p>
In this example the tray icon can be removed by clicking 'Remove' in
the context menu or selecting the demo button again.
</p>
<h5>Main Process</h5>
<pre>
<code>
const path = require('path')
const {ipcMain, app, Menu, Tray} = require('electron')
let appIcon = null
ipcMain.on('put-in-tray', (event) => {
const iconName = process.platform === 'win32' ? 'windows-icon.png' : 'iconTemplate.png'
const iconPath = path.join(__dirname, iconName)
appIcon = new Tray(iconPath)
const contextMenu = Menu.buildFromTemplate([{
label: 'Remove',
click: () => {
event.sender.send('tray-removed')
}
}])
appIcon.setToolTip('Electron Demo in the tray.')
appIcon.setContextMenu(contextMenu)
})
ipcMain.on('remove-tray', () => {
appIcon.destroy()
})
app.on('window-all-closed', () => {
if (appIcon) appIcon.destroy()
})
</code>
</pre>
<h5>Renderer Process</h5>
<pre>
<code>
const ipc = require('electron').ipcRenderer
const trayBtn = document.getElementById('put-in-tray')
let trayOn = false
trayBtn.addEventListener('click', function (event) {
if (trayOn) {
trayOn = false
document.getElementById('tray-countdown').innerHTML = ''
ipc.send('remove-tray')
} else {
trayOn = true
const message = 'Click demo again to remove.'
document.getElementById('tray-countdown').innerHTML = message
ipc.send('put-in-tray')
}
})
// Tray removed from context menu on icon
ipc.on('tray-removed', function () {
ipc.send('remove-tray')
trayOn = false
document.getElementById('tray-countdown').innerHTML = ''
})
</code>
</pre>
<div>
<h2>ProTip</h2>
<strong>Tray support in Linux.</strong>
@@ -109,7 +30,7 @@ ipc.on('tray-removed', function () {
will need to install <code>libappindicator1</code> to make the
tray icon work. See the
<a href="https://electronjs.org/docs/api/tray">
full API documentation (opens in new window)
full API documentation
</a>
for more details about using Tray on Linux.
</p>

File diff suppressed because one or more lines are too long

View File

@@ -1,35 +0,0 @@
const { ipcRenderer, shell } = require('electron')
const trayBtn = document.getElementById('put-in-tray')
const links = document.querySelectorAll('a[href]')
let trayOn = false
trayBtn.addEventListener('click', function (event) {
if (trayOn) {
trayOn = false
document.getElementById('tray-countdown').innerHTML = ''
ipcRenderer.send('remove-tray')
} else {
trayOn = true
const message = 'Click demo again to remove.'
document.getElementById('tray-countdown').innerHTML = message
ipcRenderer.send('put-in-tray')
}
})
// Tray removed from context menu on icon
ipcRenderer.on('tray-removed', function () {
ipcRenderer.send('remove-tray')
trayOn = false
document.getElementById('tray-countdown').innerHTML = ''
})
Array.prototype.forEach.call(links, (link) => {
const url = link.getAttribute('href')
if (url.indexOf('http') === 0) {
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal(url)
})
}
})

View File

@@ -1,92 +1,81 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<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'">
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>app.setAsDefaultProtocol Demo</title>
</head>
<body>
<section>
<header>
<h1>
Protocol Handler
</h1>
<h3>The <code>app</code> module provides methods for handling protocols.</h3>
<p>These methods allow you to set and unset the protocols your app should be the default app for. Similar to when a browser asks to be your default for viewing web pages.</p>
<h1>App Default Protocol Demo</h1>
<p>Open the <a href="https://electronjs.org/docs/api/app">full app API documentation<span class="u-visible-to-screen-reader">(opens in new window)</span></a> in your browser.</p>
</header>
<p>The protocol API allows us to register a custom protocol and intercept existing protocol requests.</p>
<p>These methods allow you to set and unset the protocols your app should be the default app for. Similar to when a
browser asks to be your default for viewing web pages.</p>
<div >
<button id="open-in-browser" class="js-container-target demo-toggle-button">Launch current page in browser
<div class="demo-meta u-avoid-clicks">Supports: Win, macOS <span class="demo-meta-divider">|</span> Process: Main</div>
</button>
<section id='open-app-link'>
<a href="electron-api-demos://open">Now... launch the app from a web link</a>
</section>
<div >
<p>You can set your app as the default app to open for a specific protocol. For instance, in this demo we set this app as the default for <code>electron-api-demos://</code>. The demo button above will launch a page in your default browser with a link. Click that link and it will re-launch this app.</p>
<h5>Packaging</h5>
<p>This feature will only work on macOS when your app is packaged. It will not work when you're launching it in development from the command-line. When you package your app you'll need to make sure the macOS <code>plist</code> for the app is updated to include the new protocol handler. If you're using <code>electron-packager</code> then you can add the flag <code>--extend-info</code> with a path to the <code>plist</code> you've created. The one for this app is below.</p>
<h5>Renderer Process</h5>
<pre><code>
const {shell} = require('electron')
const path = require('path')
const protocolHandlerBtn = document.getElementById('protocol-handler')
protocolHandlerBtn.addEventListener('click', () => {
const pageDirectory = __dirname.replace('app.asar', 'app.asar.unpacked')
const pagePath = path.join('file://', pageDirectory, '../../sections/system/protocol-link.html')
shell.openExternal(pagePath)
})
</code></pre>
<h5>Main Process</h5>
<pre><code>
const {app, dialog} = require('electron')
const path = require('path')
<p>Open the <a href="https://www.electronjs.org/docs/api/protocol">full protocol API documentation</a> in your
browser.</p>
if (process.defaultApp) {
if (process.argv.length >= 2) {
app.setAsDefaultProtocolClient('electron-api-demos', process.execPath, [path.resolve(process.argv[1])])
}
} else {
app.setAsDefaultProtocolClient('electron-api-demos')
}
-----
app.on('open-url', (event, url) => {
dialog.showErrorBox('Welcome Back', `You arrived from: ${url}`)
})
<h3>Demo</h3>
<p>
First: Launch current page in browser
<button id="open-in-browser" class="js-container-target demo-toggle-button">
Click to Launch Browser
</button>
</p>
</code></pre>
<h5>macOS plist</h5>
<pre><code>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>electron-api-demos</string>
</array>
<key>CFBundleURLName</key>
<string>Electron API Demos Protocol</string>
</dict>
</array>
<key>ElectronTeamID</key>
<string>VEKTX9H2N7</string>
</dict>
</plist>
</code>
</pre>
</div>
</div>
<script type="text/javascript">
require('./renderer.js')
</script>
</section>
<p>
Then: Launch the app from a web link!
<a href="electron-fiddle://open">Click here to launch the app</a>
</p>
----
<p>You can set your app as the default app to open for a specific protocol. For instance, in this demo we set this app
as the default for <code>electron-fiddle://</code>. The demo button above will launch a page in your default
browser with a link. Click that link and it will re-launch this app.</p>
<h3>Packaging</h3>
<p>This feature will only work on macOS when your app is packaged. It will not work when you're launching it in
development from the command-line. When you package your app you'll need to make sure the macOS <code>plist</code>
for the app is updated to include the new protocol handler. If you're using <code>electron-packager</code> then you
can add the flag <code>--extend-info</code> with a path to the <code>plist</code> you've created. The one for this
app is below:</p>
<p>
<h5>macOS plist</h5>
<pre><code>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
&lt;key&gt;CFBundleURLTypes&lt;/key&gt;
&lt;array&gt;
&lt;dict&gt;
&lt;key&gt;CFBundleURLSchemes&lt;/key&gt;
&lt;array&gt;
&lt;string&gt;electron-api-demos&lt;/string&gt;
&lt;/array&gt;
&lt;key&gt;CFBundleURLName&lt;/key&gt;
&lt;string&gt;Electron API Demos Protocol&lt;/string&gt;
&lt;/dict&gt;
&lt;/array&gt;
&lt;key&gt;ElectronTeamID&lt;/key&gt;
&lt;string&gt;VEKTX9H2N7&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</code>
</pre>
<p>
<!-- You can also require other files to run in this process -->
<script src="./renderer.js"></script>
</body>
</html>
</body>
</html>
</html>

View File

@@ -1,10 +1,39 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow, dialog } = require('electron')
const { app, BrowserWindow, ipcMain, shell } = require('electron')
const path = require('path')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
let mainWindow;
if (process.defaultApp) {
if (process.argv.length >= 2) {
app.setAsDefaultProtocolClient('electron-fiddle', process.execPath, [path.resolve(process.argv[1])])
}
} else {
app.setAsDefaultProtocolClient('electron-fiddle')
}
const gotTheLock = app.requestSingleInstanceLock()
if (!gotTheLock) {
app.quit()
} else {
app.on('second-instance', (event, commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore()
mainWindow.focus()
}
})
// Create mainWindow, load the rest of the app, etc...
app.whenReady().then(() => {
createWindow()
})
app.on('open-url', (event, url) => {
dialog.showErrorBox('Welcome Back', `You arrived from: ${url}`)
})
}
function createWindow () {
// Create the browser window.
@@ -12,58 +41,23 @@ function createWindow () {
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
preload: path.join(__dirname, 'preload.js'),
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// 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)
// Quit when all windows are closed.
// 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', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
if (process.platform !== 'darwin') app.quit()
})
app.on('activate', function () {
// On macOS it is common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
// 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.
if (process.defaultApp) {
if (process.argv.length >= 2) {
app.setAsDefaultProtocolClient('electron-api-demos', process.execPath, [path.resolve(process.argv[1])])
}
} else {
app.setAsDefaultProtocolClient('electron-api-demos')
}
app.on('open-url', (event, url) => {
dialog.showErrorBox('Welcome Back', `You arrived from: ${url}`)
// Handle window controls via IPC
ipcMain.on('shell:open', () => {
const pageDirectory = __dirname.replace('app.asar', 'app.asar.unpacked')
const pagePath = path.join('file://', pageDirectory, 'index.html')
shell.openExternal(pagePath)
})

View File

@@ -0,0 +1,11 @@
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
const { contextBridge, ipcRenderer } = require('electron')
// Set up context bridge between the renderer process and the main process
contextBridge.exposeInMainWorld(
'shell',
{
open: () => ipcRenderer.send('shell:open'),
}
)

View File

@@ -1,14 +1,8 @@
const { shell } = require('electron')
const path = require('path')
// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// All APIs exposed by the context bridge are available here.
const openInBrowserButton = document.getElementById('open-in-browser')
const openAppLink = document.getElementById('open-app-link')
// Hides openAppLink when loaded inside Electron
openAppLink.style.display = 'none'
openInBrowserButton.addEventListener('click', () => {
console.log('clicked')
const pageDirectory = __dirname.replace('app.asar', 'app.asar.unpacked')
const pagePath = path.join('file://', pageDirectory, 'index.html')
shell.openExternal(pagePath)
})
// Binds the buttons to the context bridge API.
document.getElementById('open-in-browser').addEventListener('click', () => {
shell.open();
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 32 KiB

0
docs/images/versioning-sketch-2.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -88,14 +88,15 @@ without meaning any harm:
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
```
Note that up until Electron 12, the `com.apple.security.cs.allow-unsigned-executable-memory` entitlement was required
as well. However, it should not be used anymore if it can be avoided.
To see all of this in action, check out Electron Fiddle's source code,
[especially its `electron-forge` configuration
file](https://github.com/electron/fiddle/blob/master/forge.config.js).
@@ -133,7 +134,7 @@ are likely using [`electron-packager`], which includes [`electron-osx-sign`] and
If you're using Packager's API, you can pass [in configuration that both signs
and notarizes your
application](https://electron.github.io/electron-packager/master/interfaces/electronpackager.options.html).
application](https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html).
```js
const packager = require('electron-packager')
@@ -165,14 +166,15 @@ without meaning any harm:
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
```
Up until Electron 12, the `com.apple.security.cs.allow-unsigned-executable-memory` entitlement was required
as well. However, it should not be used anymore if it can be avoided.
## Mac App Store
See the [Mac App Store Guide].

View File

@@ -159,7 +159,7 @@ function createWindow () {
})
ipcMain.handle('dark-mode:system', () => {
nativeTheme.themeSouce = 'system'
nativeTheme.themeSource = 'system'
})
}
@@ -200,6 +200,6 @@ Run the example using Electron Fiddle and then click the "Toggle Dark Mode" butt
[system-wide-dark-mode]: https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/dark-mode/
[electron-forge]: https://www.electronforge.io/
[electron-packager]: https://github.com/electron/electron-packager
[packager-darwindarkmode-api]: https://electron.github.io/electron-packager/master/interfaces/electronpackager.options.html#darwindarkmodesupport
[packager-darwindarkmode-api]: https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#darwindarkmodesupport
[prefers-color-scheme]: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme
[event-listeners]: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener

View File

@@ -1,35 +0,0 @@
# Desktop Environment Integration
Different operating systems provide different features for integrating desktop
applications into their desktop environments. For example, on Windows,
applications can put shortcuts in the JumpList of task bar, and on Mac,
applications can put a custom menu in the dock menu.
This guide explains how to integrate your application into those desktop
environments with Electron APIs.
## Notifications
See the [Notifications documentation](notifications.md).
## Recent Documents
See [Recent Documents documentation](recent-documents.md).
## Progress Bar
See the [Progress Bar documentation](progress-bar.md).
## Unity Launcher
See the [Unity Launcher documentation][unity-launcher].
## Represented File for macOS Window
See the [Represented File documentation](represented-file.md).
## Dragging files out of the window
See the [Native File Drag & Drop documentation](native-file-drag-drop.md).
[unity-launcher]: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher

View File

@@ -1,23 +1,27 @@
# Electron Release Timelines
Special notes:
* The `-beta.1` and `stable` dates are our solid release dates.
* We strive for weekly beta releases, however we often release more betas than scheduled.
* All dates are our goals but there may be reasons for adjusting the stable deadline, such as security bugs.
* Take a look at the [5.0.0 Timeline blog post](https://electronjs.org/blog/electron-5-0-timeline) for info about publicizing our release dates.
* Since Electron 6.0, we've been targeting every other Chromium version and releasing our stable on the same day as Chrome stable. You can reference Chromium's release schedule [here](https://chromiumdash.appspot.com/schedule). See [Electron's new release cadence blog post](https://www.electronjs.org/blog/12-week-cadence) for more details on our release schedule.
* Electron 15.0 only will include a special Alpha release. Starting in Electron 16.0, we will release on an 8-week cadence. See [Electron's new 8-week cadence blog post](https://www.electronjs.org/blog/8-week-cadence) for more details.
| Version | -beta.1 | Stable | Chrome | Node |
| ------- | ------- | ------ | ------ | ---- |
| 2.0.0 | 2018-02-21 | 2018-05-01 | M61 | v8.9 |
| 3.0.0 | 2018-06-21 | 2018-09-18 | M66 | v10.2 |
| 4.0.0 | 2018-10-11 | 2018-12-20 | M69 | v10.11 |
| 5.0.0 | 2019-01-22 | 2019-04-24 | M73 | v12.0 |
| 6.0.0 | 2019-05-01 | 2019-07-30 | M76 | v12.4 |
| 7.0.0 | 2019-08-01 | 2019-10-22 | M78 | v12.8 |
| 8.0.0 | 2019-10-24 | 2020-02-04 | M80 | v12.13 |
| 9.0.0 | 2020-02-06 | 2020-05-19 | M83 | v12.14 |
| 10.0.0 | 2020-05-21 | 2020-08-25 | M85 | v12.16 |
| 11.0.0 | 2020-08-27 | 2020-11-17 | M87 | v12.18 |
| 12.0.0 | 2020-11-19 | 2021-03-02 | M89 | v14.16 |
| 13.0.0 | 2021-03-04 | 2021-05-25 | M91 | v14.16 |
| 14.0.0 | 2021-05-27 | 2021-08-31 | M93 | TBD |
| Electron | Alpha | Beta | Stable | Chrome | Node |
| ------- | ----- | ------- | ------ | ------ | ---- |
| 2.0.0 | -- | 2018-Feb-21 | 2018-May-01 | M61 | v8.9 |
| 3.0.0 | -- | 2018-Jun-21 | 2018-Sep-18 | M66 | v10.2 |
| 4.0.0 | -- | 2018-Oct-11 | 2018-Dec-20 | M69 | v10.11 |
| 5.0.0 | -- | 2019-Jan-22 | 2019-Apr-24 | M73 | v12.0 |
| 6.0.0 | -- | 2019-May-01 | 2019-Jul-30 | M76 | v12.4 |
| 7.0.0 | -- | 2019-Aug-01 | 2019-Oct-22 | M78 | v12.8 |
| 8.0.0 | -- | 2019-Oct-24 | 2020-Feb-04 | M80 | v12.13 |
| 9.0.0 | -- | 2020-Feb-06 | 2020-May-19 | M83 | v12.14 |
| 10.0.0 | -- | 2020-May-21 | 2020-Aug-25 | M85 | v12.16 |
| 11.0.0 | -- | 2020-Aug-27 | 2020-Nov-17 | M87 | v12.18 |
| 12.0.0 | -- | 2020-Nov-19 | 2021-Mar-02 | M89 | v14.16 |
| 13.0.0 | -- | 2021-Mar-04 | 2021-May-25 | M91 | v14.16 |
| 14.0.0 | -- | 2021-May-27 | 2021-Aug-31 | M93 | TBD |
| 15.0.0 | 2021-Jul-20 | 2021-Sep-01 | 2021-Sep-21 | M94 | TBD |

View File

@@ -1,4 +1,4 @@
# In-App Purchase (macOS)
# In-App Purchases (macOS)
## Preparing

View File

@@ -1,4 +1,4 @@
# Installation
# Advanced Installation Instructions
To install prebuilt Electron binaries, use [`npm`][npm].
The preferred method is to install Electron as a development dependency in your
@@ -135,14 +135,18 @@ a text file. A typical cache might look like this:
## Skip binary download
When installing the `electron` NPM package, it automatically downloads the electron binary.
Under the hood, Electron's JavaScript API binds to a binary that contains its
implementations. Because this binary is crucial to the function of any Electron app,
it is downloaded by default in the `postinstall` step every time you install `electron`
from the npm registry.
This can sometimes be unnecessary, e.g. in a CI environment, when testing another component.
However, if you want to install your project's dependencies but don't need to use
Electron functionality, you can set the `ELECTRON_SKIP_BINARY_DOWNLOAD` environment
variable to prevent the binary from being downloaded. For instance, this feature can
be useful in continuous integration environments when running unit tests that mock
out the `electron` module.
To prevent the binary from being downloaded when you install all npm dependencies you can set the environment variable `ELECTRON_SKIP_BINARY_DOWNLOAD`.
E.g.:
```sh
```sh npm2yarn
ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install
```

View File

@@ -0,0 +1,169 @@
---
title: launch-app-from-URL-in-another-app
description: This guide will take you through the process of setting your electron app as the default handler for a specific protocol.
slug: launch-app-from-url-in-another-app
hide_title: true
---
# Launching Your Electron App From A URL In Another App
## Overview
<!-- ✍ Update this section if you want to provide more details -->
This guide will take you through the process of setting your electron app as the default
handler for a specific [protocol](https://www.electronjs.org/docs/api/protocol).
By the end of this tutorial, we will have set our app to intercept and handle
any clicked URLs that start with a specific protocol. In this guide, the protocol
we will use will be "`electron-fiddle://`".
## Examples
### Main Process (main.js)
First we will import the required modules from `electron`. These modules help control our application life and create a native browser window.
```js
const { app, BrowserWindow, shell } = require('electron')
const path = require('path')
```
Next, we will proceed to register our application to handle all "`electron-fiddle://`" protocols.
```js
if (process.defaultApp) {
if (process.argv.length >= 2) {
app.setAsDefaultProtocolClient('electron-fiddle', process.execPath, [path.resolve(process.argv[1])])
}
} else {
app.setAsDefaultProtocolClient('electron-fiddle')
}
```
We will now define the function in charge of creating our browser window and load our application's `index.html` file.
```js
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
mainWindow.loadFile('index.html')
}
```
In this next step, we will create our `BrowserWindow` and tell our application how to handle an event in which an external protocol is clicked.
This code will be different in WindowsOS compared to MacOS and Linux. This is due to Windows requiring additional code in order to open the contents of the protocol link within the same electron instance. Read more about this [here](https://www.electronjs.org/docs/api/app#apprequestsingleinstancelock).
### Windows code:
```js
const gotTheLock = app.requestSingleInstanceLock()
if (!gotTheLock) {
app.quit()
} else {
app.on('second-instance', (event, commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore()
mainWindow.focus()
}
})
// Create mainWindow, load the rest of the app, etc...
app.whenReady().then(() => {
createWindow()
})
// handling the protocol. In this case, we choose to show an Error Box.
app.on('open-url', (event, url) => {
dialog.showErrorBox('Welcome Back', `You arrived from: ${url}`)
})
}
```
### MacOS and Linux code:
```js
// 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()
})
// handling the protocol. In this case, we choose to show an Error Box.
app.on('open-url', (event, url) => {
dialog.showErrorBox('Welcome Back', `You arrived from: ${url}`)
})
```
Finally, we will add some additional code to handle when someone closes our application
```js
// 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', function () {
if (process.platform !== 'darwin') app.quit()
})
```
## Important Note:
### Packaging
This feature will only work on macOS when your app is packaged. It will not work when you're launching it in development from the command-line. When you package your app you'll need to make sure the macOS `plist` for the app is updated to include the new protocol handler. If you're using [`electron-packager`](https://github.com/electron/electron-packager) then you
can add the flag `--extend-info` with a path to the `plist` you've created. The one for this app is below:
### Plist
```XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>electron-api-demos</string>
</array>
<key>CFBundleURLName</key>
<string>Electron API Demos Protocol</string>
</dict>
</array>
<key>ElectronTeamID</key>
<string>VEKTX9H2N7</string>
</dict>
</plist>
```
## Conclusion
After you start your electron app, you can now enter in a URL in your browser that contains the custom protocol, for example `"electron-fiddle://open"` and observe that the application will respond and show an error dialog box.
<!--
Because Electron examples usually require multiple files (HTML, CSS, JS
for the main and renderer process, etc.), we use this custom code block
for Fiddle (https://www.electronjs.org/fiddle).
Please modify any of the files in the referenced folder to fit your
example.
The content in this codeblock will not be rendered in the website so you
can leave it empty.
-->
```fiddle docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app
```
<!-- ✍ Explanation of the code below -->

View File

@@ -1,4 +1,4 @@
# Custom Linux Desktop Launcher Actions
# Desktop Launcher Actions (Linux)
## Overview

View File

@@ -1,4 +1,4 @@
# Configuring the macOS Dock
# Dock (macOS)
Electron has APIs to configure the app's icon in the macOS Dock. A macOS-only
API exists to create a custom dock menu, but Electron also uses the app dock

View File

@@ -1,4 +1,4 @@
# Notifications (Windows, Linux, macOS)
# Notifications
## Overview
@@ -18,7 +18,7 @@ To show notifications in the Main process, you need to use the
### Show notifications in the Renderer process
Assuming you have a working Electron application from the
Starting with a working application from the
[Quick Start Guide](quick-start.md), add the following line to the
`index.html` file before the closing `</body>` tag:
@@ -26,26 +26,22 @@ Assuming you have a working Electron application from the
<script src="renderer.js"></script>
```
and add the `renderer.js` file:
...and add the `renderer.js` file:
```javascript fiddle='docs/fiddles/features/notifications/renderer'
const myNotification = new Notification('Title', {
body: 'Notification from the Renderer process'
})
const NOTIFICATION_TITLE = 'Title'
const NOTIFICATION_BODY = 'Notification from the Renderer process. Click to log to console.'
const CLICK_MESSAGE = 'Notification clicked'
myNotification.onclick = () => {
console.log('Notification clicked')
}
new Notification(NOTIFICATION_TITLE, { body: NOTIFICATION_BODY })
.onclick = () => console.log(CLICK_MESSAGE)
```
After launching the Electron application, you should see the notification:
![Notification in the Renderer process](../images/notification-renderer.png)
If you open the Console and then click the notification, you will see the
message that was generated after triggering the `onclick` event:
![Onclick message for the notification](../images/message-notification-renderer.png)
Additionally, if you click on the notification, the DOM will update to show "Notification clicked!".
### Show notifications in the Main process
@@ -134,14 +130,6 @@ if you exceed that limit.
[apple-notification-guidelines]: https://developer.apple.com/macos/human-interface-guidelines/system-capabilities/notifications/
#### Advanced Notifications
Later versions of macOS allow for notifications with an input field, allowing the user
to quickly reply to a notification. In order to send notifications with an input field,
use the userland module [node-mac-notifier][node-mac-notifier].
[node-mac-notifier]: https://github.com/CharlieHess/node-mac-notifier
#### Do not disturb / Session State
To detect whether or not you're allowed to send a notification, use the userland module

View File

@@ -120,9 +120,9 @@ file in the directory you executed it in. Both files can be analyzed using
the Chrome Developer Tools, using the `Performance` and `Memory` tabs
respectively.
![performance-cpu-prof]
![Performance CPU Profile][performance-cpu-prof]
![performance-heap-prof]
![Performance Heap Memory Profile][performance-heap-prof]
In this example, on the author's machine, we saw that loading `request` took
almost half a second, whereas `node-fetch` took dramatically less memory

View File

@@ -138,7 +138,7 @@ way to import Electron's content scripts.
<!-- Note: This guide doesn't take sandboxing into account, which might fundamentally
change the statements here. -->
Preload scripts contain code that executes in a renderer process before its web content
begins loading. These scripts runs within the renderer context, but are granted more
begins loading. These scripts run within the renderer context, but are granted more
privileges by having access to Node.js APIs.
A preload script can be attached to the main process in the `BrowserWindow` constructor's
@@ -148,7 +148,9 @@ A preload script can be attached to the main process in the `BrowserWindow` cons
const { BrowserWindow } = require('electron')
//...
const win = new BrowserWindow({
preload: 'path/to/preload.js'
webPreferences: {
preload: 'path/to/preload.js'
}
})
//...
```

View File

@@ -1,4 +1,4 @@
# Progress Bar in Taskbar (Windows, macOS, Unity)
# Taskbar Progress Bar (Windows & macOS)
## Overview

View File

@@ -223,7 +223,7 @@ app.on('window-all-closed', function () {
[node-platform]: https://nodejs.org/api/process.html#process_process_platform
[window-all-closed]: ../api/app.md#event-window-all-closed
[window-all-closed]: ../api/app.md#appquit
[app-quit]: ../api/app.md#appquit
#### Open a window if none are open (macOS)

View File

@@ -13,39 +13,62 @@ __Application dock menu:__
![macOS Dock Menu][dock-menu-image]
To add a file to recent documents, you need to use the
[app.addRecentDocument][addrecentdocument] API.
## Example
### Add an item to recent documents
Starting with a working application from the
[Quick Start Guide](quick-start.md), add the following lines to the
`main.js` file:
### Managing recent documents
```javascript fiddle='docs/fiddles/features/recent-documents'
const { app } = require('electron')
const { app, BrowserWindow } = require('electron')
const fs = require('fs')
const path = require('path')
app.addRecentDocument('/Users/USERNAME/Desktop/work.type')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600
})
win.loadFile('index.html')
}
const fileName = 'recently-used.md'
fs.writeFile(fileName, 'Lorem Ipsum', () => {
app.addRecentDocument(path.join(__dirname, fileName))
})
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
app.clearRecentDocuments()
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
```
#### Adding a recent document
To add a file to recent documents, use the
[app.addRecentDocument][addrecentdocument] API.
After launching the Electron application, right click the application icon.
You should see the item you just added. In this guide, the item is a Markdown
file located in the root of the project:
In this guide, the item is a Markdown file located in the root of the project.
You should see `recently-used.md` added to the list of recent files:
![Recent document](../images/recent-documents.png)
### Clear the list of recent documents
#### Clearing the list of recent documents
To clear the list of recent documents, you need to use
[app.clearRecentDocuments][clearrecentdocuments] API in the `main.js` file:
```javascript
const { app } = require('electron')
app.clearRecentDocuments()
```
To clear the list of recent documents, use the
[app.clearRecentDocuments][clearrecentdocuments] API.
In this guide, the list of documents is cleared once all windows have been
closed.
## Additional information

View File

@@ -1,4 +1,4 @@
# Represented File for macOS BrowserWindows
# Representing Files in a BrowserWindow (macOS)
## Overview
@@ -20,23 +20,40 @@ To set the represented file of window, you can use the
## Example
Starting with a working application from the
[Quick Start Guide](quick-start.md), add the following lines to the
`main.js` file:
```javascript fiddle='docs/fiddles/features/represented-file'
const { app, BrowserWindow } = require('electron')
const os = require('os');
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600
})
}
app.whenReady().then(() => {
const win = new BrowserWindow()
win.setRepresentedFilename('/etc/passwd')
win.setRepresentedFilename(os.homedir())
win.setDocumentEdited(true)
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
```
After launching the Electron application, click on the title with `Command` or
`Control` key pressed. You should see a popup with the file you just defined:
`Control` key pressed. You should see a popup with the represented file at the top.
In this guide, this is the current user's home directory:
![Represented file](../images/represented-file.png)

View File

@@ -1,4 +1,4 @@
# Snapcraft Guide (Ubuntu Software Center & More)
# Snapcraft Guide (Linux)
This guide provides information on how to package your Electron application
for any Snapcraft environment, including the Ubuntu Software Center.

View File

@@ -37,6 +37,13 @@ tools and resources.
## Supported Versions
_**Note:** Beginning in September 2021 with Electron 15, the Electron team
will temporarily support the latest **four** stable major versions. This
extended support is intended to help Electron developers transition to
the [new eight week release cadence](https://electronjs.org/blog/8-week-cadence), and will continue until May 2022, with
the release of Electron 19. At that time, the Electron team will drop support
back to the latest three stable major versions._
The latest three *stable* major versions are supported by the Electron team.
For example, if the latest release is 6.1.x, then the 5.0.x as well
as the 4.2.x series are supported. We only support the latest minor release

83
docs/tutorial/tray.md Normal file
View File

@@ -0,0 +1,83 @@
---
title: Tray
description: This guide will take you through the process of creating
a Tray icon with its own context menu to the system's notification area.
slug: tray
hide_title: true
---
# Tray
## Overview
<!-- ✍ Update this section if you want to provide more details -->
This guide will take you through the process of creating a
[Tray](https://www.electronjs.org/docs/api/tray) icon with
its own context menu to the system's notification area.
On MacOS and Ubuntu, the Tray will be located on the top
right corner of your screen, adjacent to your battery and wifi icons.
On Windows, the Tray will usually be located in the bottom right corner.
## Example
### main.js
First we must import `app`, `Tray`, `Menu`, `nativeImage` from `electron`.
```js
const { app, Tray, Menu, nativeImage } = require('electron')
```
Next we will create our Tray. To do this, we will use a
[`NativeImage`](https://www.electronjs.org/docs/api/native-image) icon,
which can be created through any one of these
[methods](https://www.electronjs.org/docs/api/native-image#methods).
Note that we wrap our Tray creation code within an
[`app.whenReady`](https://www.electronjs.org/docs/api/app#appwhenready)
as we will need to wait for our electron app to finish initializing.
```js title='main.js'
let tray
app.whenReady().then(() => {
const icon = nativeImage.createFromPath('path/to/asset.png')
tray = new Tray(icon)
// note: your contextMenu, Tooltip and Title code will go here!
})
```
Great! Now we can start attaching a context menu to our Tray, like so:
```js
const contextMenu = Menu.buildFromTemplate([
{ label: 'Item1', type: 'radio' },
{ label: 'Item2', type: 'radio' },
{ label: 'Item3', type: 'radio', checked: true },
{ label: 'Item4', type: 'radio' }
])
tray.setContextMenu(contextMenu)
```
The code above will create 4 separate radio-type items in the context menu.
To read more about constructing native menus, click
[here](https://www.electronjs.org/docs/api/menu#menubuildfromtemplatetemplate).
Finally, let's give our tray a tooltip and a title.
```js
tray.setToolTip('This is my application')
tray.setTitle('This is my title')
```
## Conclusion
After you start your electron app, you should see the Tray residing
in either the top or bottom right of your screen, depending on your
operating system.
```fiddle docs/fiddles/native-ui/tray
```

View File

@@ -49,7 +49,7 @@ update server.
Depending on your needs, you can choose from one of these:
- [Hazel][hazel] Update server for private or open-source apps which can be
deployed for free on [Now][now]. It pulls from [GitHub Releases][gh-releases]
deployed for free on [Vercel][vercel]. It pulls from [GitHub Releases][gh-releases]
and leverages the power of GitHub's CDN.
- [Nuts][nuts] Also uses [GitHub Releases][gh-releases], but caches app
updates on disk and supports private repositories.
@@ -64,7 +64,7 @@ to minify server cost.
Once you've deployed your update server, continue with importing the required
modules in your code. The following code might vary for different server
software, but it works like described when using
[Hazel](https://github.com/zeit/hazel).
[Hazel][hazel].
**Important:** Please ensure that the code below will only be executed in
your packaged app, and not in development. You can use
@@ -136,8 +136,8 @@ autoUpdater.on('error', message => {
Because the requests made by Auto Update aren't under your direct control, you may find situations that are difficult to handle (such as if the update server is behind authentication). The `url` field does support files, which means that with some effort, you can sidestep the server-communication aspect of the process. [Here's an example of how this could work](https://github.com/electron/electron/issues/5020#issuecomment-477636990).
[now]: https://zeit.co/now
[hazel]: https://github.com/zeit/hazel
[vercel]: https://vercel.com
[hazel]: https://github.com/vercel/hazel
[nuts]: https://github.com/GitbookIO/nuts
[gh-releases]: https://help.github.com/articles/creating-releases/
[electron-release-server]: https://github.com/ArekSredzki/electron-release-server

View File

@@ -1,4 +1,4 @@
# Using Native Node Modules
# Native Node Modules
Native Node.js modules are supported by Electron, but since Electron has a different
[application binary interface (ABI)][abi] from a given Node.js binary (due to

View File

@@ -1,4 +1,4 @@
# Using Pepper Flash Plugin
# Pepper Flash Plugin
Electron no longer supports the Pepper Flash plugin, as Chrome has removed support.

View File

@@ -1,4 +1,4 @@
# Using Selenium and WebDriver
# Selenium and WebDriver
From [ChromeDriver - WebDriver for Chrome][chrome-driver]:

View File

@@ -1,4 +1,4 @@
# Web embeds
# Web Embeds
## Overview

View File

@@ -1,4 +1,4 @@
# Windows 10 on Arm
# Windows on ARM
If your app runs with Electron 6.0.8 or later, you can now build it for Windows 10 on Arm. This considerably improves performance, but requires recompilation of any native modules used in your app. It may also require small fixups to your build and packaging scripts.

View File

@@ -1,4 +1,4 @@
# Windows Taskbar
# Taskbar Customization (Windows)
## Overview

View File

@@ -1,5 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<!-- Windows Caption Buttons -->
<message name="IDS_APP_ACCNAME_CLOSE" desc="The accessible name for the Close button.">
Close
</message>
<message name="IDS_APP_ACCNAME_MINIMIZE" desc="The accessible name for the Minimize button.">
Minimize
</message>
<message name="IDS_APP_ACCNAME_MAXIMIZE" desc="The accessible name for the Maximize button.">
Maximize
</message>
<message name="IDS_APP_ACCNAME_RESTORE" desc="The accessible name for the Restore button.">
Restore
</message>
<!-- Printing Service -->
<message name="IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME" desc="The name of the utility process used for printing conversions.">
Printing Service

View File

@@ -101,6 +101,7 @@ auto_filenames = {
"docs/api/structures/new-window-web-contents-event.md",
"docs/api/structures/notification-action.md",
"docs/api/structures/notification-response.md",
"docs/api/structures/overlay-options.md",
"docs/api/structures/point.md",
"docs/api/structures/post-body.md",
"docs/api/structures/printer-info.md",

View File

@@ -90,6 +90,10 @@ filenames = {
"shell/browser/ui/views/electron_views_delegate_win.cc",
"shell/browser/ui/views/win_frame_view.cc",
"shell/browser/ui/views/win_frame_view.h",
"shell/browser/ui/views/win_caption_button.cc",
"shell/browser/ui/views/win_caption_button.h",
"shell/browser/ui/views/win_caption_button_container.cc",
"shell/browser/ui/views/win_caption_button_container.h",
"shell/browser/ui/win/dialog_thread.cc",
"shell/browser/ui/win/dialog_thread.h",
"shell/browser/ui/win/electron_desktop_native_widget_aura.cc",
@@ -180,8 +184,8 @@ filenames = {
"shell/browser/ui/cocoa/root_view_mac.mm",
"shell/browser/ui/cocoa/views_delegate_mac.h",
"shell/browser/ui/cocoa/views_delegate_mac.mm",
"shell/browser/ui/cocoa/window_buttons_view.h",
"shell/browser/ui/cocoa/window_buttons_view.mm",
"shell/browser/ui/cocoa/window_buttons_proxy.h",
"shell/browser/ui/cocoa/window_buttons_proxy.mm",
"shell/browser/ui/drag_util_mac.mm",
"shell/browser/ui/file_dialog_mac.mm",
"shell/browser/ui/inspectable_web_contents_view_mac.h",

View File

@@ -490,63 +490,83 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
}
};
function fsReadFileAsar (pathArgument: string, options: any, callback: any) {
const pathInfo = splitPath(pathArgument);
if (pathInfo.isAsar) {
const { asarPath, filePath } = pathInfo;
if (typeof options === 'function') {
callback = options;
options = { encoding: null };
} else if (typeof options === 'string') {
options = { encoding: options };
} else if (options === null || options === undefined) {
options = { encoding: null };
} else if (typeof options !== 'object') {
throw new TypeError('Bad arguments');
}
const { encoding } = options;
const archive = getOrCreateArchive(asarPath);
if (!archive) {
const error = createError(AsarError.INVALID_ARCHIVE, { asarPath });
nextTick(callback, [error]);
return;
}
const info = archive.getFileInfo(filePath);
if (!info) {
const error = createError(AsarError.NOT_FOUND, { asarPath, filePath });
nextTick(callback, [error]);
return;
}
if (info.size === 0) {
nextTick(callback, [null, encoding ? '' : Buffer.alloc(0)]);
return;
}
if (info.unpacked) {
const realPath = archive.copyFileOut(filePath);
return fs.readFile(realPath, options, callback);
}
const buffer = Buffer.alloc(info.size);
const fd = archive.getFd();
if (!(fd >= 0)) {
const error = createError(AsarError.NOT_FOUND, { asarPath, filePath });
nextTick(callback, [error]);
return;
}
logASARAccess(asarPath, filePath, info.offset);
fs.read(fd, buffer, 0, info.size, info.offset, (error: Error) => {
callback(error, encoding ? buffer.toString(encoding) : buffer);
});
}
}
const { readFile } = fs;
fs.readFile = function (pathArgument: string, options: any, callback: any) {
const pathInfo = splitPath(pathArgument);
if (!pathInfo.isAsar) return readFile.apply(this, arguments);
const { asarPath, filePath } = pathInfo;
if (typeof options === 'function') {
callback = options;
options = { encoding: null };
} else if (typeof options === 'string') {
options = { encoding: options };
} else if (options === null || options === undefined) {
options = { encoding: null };
} else if (typeof options !== 'object') {
throw new TypeError('Bad arguments');
if (!pathInfo.isAsar) {
return readFile.apply(this, arguments);
}
const { encoding } = options;
const archive = getOrCreateArchive(asarPath);
if (!archive) {
const error = createError(AsarError.INVALID_ARCHIVE, { asarPath });
nextTick(callback, [error]);
return;
}
const info = archive.getFileInfo(filePath);
if (!info) {
const error = createError(AsarError.NOT_FOUND, { asarPath, filePath });
nextTick(callback, [error]);
return;
}
if (info.size === 0) {
nextTick(callback, [null, encoding ? '' : Buffer.alloc(0)]);
return;
}
if (info.unpacked) {
const realPath = archive.copyFileOut(filePath);
return fs.readFile(realPath, options, callback);
}
const buffer = Buffer.alloc(info.size);
const fd = archive.getFd();
if (!(fd >= 0)) {
const error = createError(AsarError.NOT_FOUND, { asarPath, filePath });
nextTick(callback, [error]);
return;
}
logASARAccess(asarPath, filePath, info.offset);
fs.read(fd, buffer, 0, info.size, info.offset, (error: Error) => {
callback(error, encoding ? buffer.toString(encoding) : buffer);
});
return fsReadFileAsar(pathArgument, options, callback);
};
fs.promises.readFile = util.promisify(fs.readFile);
const { readFile: readFilePromise } = fs.promises;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
fs.promises.readFile = function (pathArgument: string, options: any) {
const pathInfo = splitPath(pathArgument);
if (!pathInfo.isAsar) {
return readFilePromise.apply(this, arguments);
}
const p = util.promisify(fsReadFileAsar);
return p(pathArgument, options);
};
const { readFileSync } = fs;
fs.readFileSync = function (pathArgument: string, options: any) {

View File

@@ -20,20 +20,6 @@ BrowserWindow.prototype._init = function (this: BWT) {
nativeSetBounds.call(this, bounds, ...opts);
};
// Sometimes the webContents doesn't get focus when window is shown, so we
// have to force focusing on webContents in this case. The safest way is to
// focus it when we first start to load URL, if we do it earlier it won't
// have effect, if we do it later we might move focus in the page.
//
// Though this hack is only needed on macOS when the app is launched from
// Finder, we still do it on all platforms in case of other bugs we don't
// know.
if (this.webContents._initiallyShown) {
this.webContents.once('load-url' as any, function (this: WebContents) {
this.focus();
});
}
// Redirect focus/blur event to app instance too.
this.on('blur', (event: Event) => {
app.emit('browser-window-blur', event, this);

View File

@@ -541,6 +541,9 @@ WebContents.prototype._init = function () {
ipcMainInternal.emit(channel, event, ...args);
} else {
addReplyToEvent(event);
if (this.listenerCount('ipc-message-sync') === 0 && ipcMain.listenerCount(channel) === 0) {
console.warn(`WebContents #${this.id} called ipcRenderer.sendSync() with '${channel}' channel without listeners.`);
}
this.emit('ipc-message-sync', event, channel, ...args);
ipcMain.emit(channel, event, ...args);
}
@@ -723,6 +726,10 @@ export function fromId (id: string) {
return binding.fromId(id);
}
export function fromDevToolsTargetId (targetId: string) {
return binding.fromDevToolsTargetId(targetId);
}
export function getFocusedWebContents () {
let focused = null;
for (const contents of binding.getAllWebContents()) {

View File

@@ -76,6 +76,7 @@ ipcMainInternal.on(
const referrer: Electron.Referrer = { url: '', policy: 'strict-origin-when-cross-origin' };
const browserWindowOptions = event.sender._callWindowOpenHandler(event, { url, frameName, features, disposition: 'new-window', referrer });
if (event.defaultPrevented) {
event.returnValue = null;
return;
}
const guest = openGuestWindow({

View File

@@ -1,6 +1,6 @@
import { app } from 'electron/main';
import type { WebContents } from 'electron/main';
import { clipboard, nativeImage } from 'electron/common';
import { clipboard } from 'electron/common';
import * as fs from 'fs';
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
@@ -37,6 +37,10 @@ ipcMainInternal.handle(IPC_MESSAGES.BROWSER_GET_LAST_WEB_PREFERENCES, function (
return event.sender.getLastWebPreferences();
});
ipcMainInternal.handle(IPC_MESSAGES.BROWSER_GET_PROCESS_MEMORY_INFO, function (event) {
return event.sender._getProcessMemoryInfo();
});
// Methods not listed in this set are called directly in the renderer process.
const allowedClipboardMethods = (() => {
switch (process.platform) {
@@ -119,7 +123,3 @@ ipcMainInternal.on(IPC_MESSAGES.NAVIGATION_CONTROLLER_LENGTH, function (event) {
ipcMainInternal.on(IPC_MESSAGES.BROWSER_PRELOAD_ERROR, function (event, preloadPath: string, error: Error) {
event.sender.emit('preload-error', event, preloadPath, error);
});
ipcMainInternal.handle(IPC_MESSAGES.NATIVE_IMAGE_CREATE_THUMBNAIL_FROM_PATH, async (_, path: string, size: Electron.Size) => {
return typeUtils.serialize(await nativeImage.createThumbnailFromPath(path, size));
});

View File

@@ -4,6 +4,7 @@ export const enum IPC_MESSAGES {
BROWSER_PRELOAD_ERROR = 'BROWSER_PRELOAD_ERROR',
BROWSER_SANDBOX_LOAD = 'BROWSER_SANDBOX_LOAD',
BROWSER_WINDOW_CLOSE = 'BROWSER_WINDOW_CLOSE',
BROWSER_GET_PROCESS_MEMORY_INFO = 'BROWSER_GET_PROCESS_MEMORY_INFO',
GUEST_INSTANCE_VISIBILITY_CHANGE = 'GUEST_INSTANCE_VISIBILITY_CHANGE',
@@ -39,5 +40,4 @@ export const enum IPC_MESSAGES {
INSPECTOR_SELECT_FILE = 'INSPECTOR_SELECT_FILE',
DESKTOP_CAPTURER_GET_SOURCES = 'DESKTOP_CAPTURER_GET_SOURCES',
NATIVE_IMAGE_CREATE_THUMBNAIL_FROM_PATH = 'NATIVE_IMAGE_CREATE_THUMBNAIL_FROM_PATH',
}

View File

@@ -1,11 +1,3 @@
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import { deserialize } from '@electron/internal/common/type-utils';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
const { nativeImage } = process._linkedBinding('electron_common_native_image');
nativeImage.createThumbnailFromPath = async (path: string, size: Electron.Size) => {
return deserialize(await ipcRendererInternal.invoke(IPC_MESSAGES.NATIVE_IMAGE_CREATE_THUMBNAIL_FROM_PATH, path, size));
};
export default nativeImage;

View File

@@ -1,5 +1,6 @@
import * as path from 'path';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import type * as ipcRendererInternalModule from '@electron/internal/renderer/ipc-renderer-internal';
const Module = require('module');
@@ -43,7 +44,7 @@ const v8Util = process._linkedBinding('electron_common_v8_util');
const contextId = v8Util.getHiddenValue<string>(global, 'contextId');
Object.defineProperty(process, 'contextId', { enumerable: true, value: contextId });
const { ipcRendererInternal } = require('@electron/internal/renderer/ipc-renderer-internal');
const { ipcRendererInternal } = require('@electron/internal/renderer/ipc-renderer-internal') as typeof ipcRendererInternalModule;
const ipcRenderer = require('@electron/internal/renderer/api/ipc-renderer').default;
v8Util.setHiddenValue(global, 'ipcNative', {
@@ -57,6 +58,10 @@ v8Util.setHiddenValue(global, 'ipcNative', {
}
});
process.getProcessMemoryInfo = () => {
return ipcRendererInternal.invoke<Electron.ProcessMemoryInfo>(IPC_MESSAGES.BROWSER_GET_PROCESS_MEMORY_INFO);
};
// Use electron module after everything is ready.
const { webFrameInit } = require('@electron/internal/renderer/web-frame-init');
webFrameInit();

View File

@@ -1,16 +1,32 @@
import { internalContextBridge } from '@electron/internal/renderer/api/context-bridge';
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
import { webFrame } from 'electron/renderer';
import { IPC_MESSAGES } from '../common/ipc-messages';
const { contextIsolationEnabled } = internalContextBridge;
/* Corrects for some Inspector adaptations needed in Electron.
* 1) Use menu API to show context menu.
* 2) Correct for Chromium returning undefined for filesystem.
* 3) Use dialog API to override file chooser dialog.
*/
window.onload = function () {
// Use menu API to show context menu.
window.InspectorFrontendHost!.showContextMenuAtPoint = createMenu;
// correct for Chromium returning undefined for filesystem
window.Persistence!.FileSystemWorkspaceBinding.completeURL = completeURL;
// Use dialog API to override file chooser dialog.
window.UI!.createFileSelectorElement = createFileSelectorElement;
if (contextIsolationEnabled) {
internalContextBridge.overrideGlobalValueFromIsolatedWorld([
'InspectorFrontendHost', 'showContextMenuAtPoint'
], createMenu);
internalContextBridge.overrideGlobalValueFromIsolatedWorld([
'Persistence', 'FileSystemWorkspaceBinding', 'completeURL'
], completeURL);
internalContextBridge.overrideGlobalValueFromIsolatedWorld([
'UI', 'createFileSelectorElement'
], createFileSelectorElement);
} else {
window.InspectorFrontendHost!.showContextMenuAtPoint = createMenu;
window.Persistence!.FileSystemWorkspaceBinding.completeURL = completeURL;
window.UI!.createFileSelectorElement = createFileSelectorElement;
}
};
// Extra / is needed as a result of MacOS requiring absolute paths
@@ -36,9 +52,10 @@ const createMenu = function (x: number, y: number, items: ContextMenuItem[]) {
const isEditMenu = useEditMenuItems(x, y, items);
ipcRendererInternal.invoke<number>(IPC_MESSAGES.INSPECTOR_CONTEXT_MENU, items, isEditMenu).then(id => {
if (typeof id === 'number') {
window.DevToolsAPI!.contextMenuItemSelected(id);
webFrame.executeJavaScript(`window.DevToolsAPI.contextMenuItemSelected(${JSON.stringify(id)})`);
}
window.DevToolsAPI!.contextMenuCleared();
webFrame.executeJavaScript('window.DevToolsAPI.contextMenuCleared()');
});
};

View File

@@ -104,10 +104,14 @@ const warnAboutInsecureResources = function () {
return;
}
const isLocal = (url: URL): boolean =>
['localhost', '127.0.0.1', '[::1]', ''].includes(url.hostname);
const isInsecure = (url: URL): boolean =>
['http:', 'ftp:'].includes(url.protocol) && !isLocal(url);
const resources = window.performance
.getEntriesByType('resource')
.filter(({ name }) => /^(http|ftp):/gi.test(name || ''))
.filter(({ name }) => new URL(name).hostname !== 'localhost')
.filter(({ name }) => isInsecure(new URL(name)))
.map(({ name }) => `- ${name}`)
.join('\n');
@@ -270,9 +274,7 @@ const warnAboutAllowedPopups = function () {
// Logs a warning message about the remote module
const warnAboutRemoteModuleWithRemoteContent = function (webPreferences?: Electron.WebPreferences) {
if (!webPreferences || isLocalhost()) return;
const remoteModuleEnabled = webPreferences.enableRemoteModule != null ? !!webPreferences.enableRemoteModule : true;
if (!remoteModuleEnabled) return;
if (!webPreferences || !webPreferences.enableRemoteModule || isLocalhost()) return;
if (getIsRemoteProtocol()) {
const warning = `This renderer process has "enableRemoteModule" enabled
@@ -298,7 +300,9 @@ const logSecurityWarnings = function (
warnAboutEnableBlinkFeatures(webPreferences);
warnAboutInsecureCSP();
warnAboutAllowedPopups();
warnAboutRemoteModuleWithRemoteContent(webPreferences);
if (BUILDFLAG(ENABLE_REMOTE_MODULE)) {
warnAboutRemoteModuleWithRemoteContent(webPreferences);
}
};
const getWebPreferences = async function () {

View File

@@ -2,6 +2,7 @@
/* global binding */
import * as events from 'events';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import type * as ipcRendererInternalModule from '@electron/internal/renderer/ipc-renderer-internal';
const { EventEmitter } = events;
@@ -20,7 +21,7 @@ for (const prop of Object.keys(EventEmitter.prototype) as (keyof typeof process)
}
Object.setPrototypeOf(process, EventEmitter.prototype);
const { ipcRendererInternal } = require('@electron/internal/renderer/ipc-renderer-internal');
const { ipcRendererInternal } = require('@electron/internal/renderer/ipc-renderer-internal') as typeof ipcRendererInternalModule;
const ipcRendererUtils = require('@electron/internal/renderer/ipc-renderer-internal-utils');
const { preloadScripts, process: processProps } = ipcRendererUtils.invokeSync(IPC_MESSAGES.BROWSER_SANDBOX_LOAD);
@@ -80,6 +81,10 @@ Object.assign(preloadProcess, processProps);
Object.assign(process, binding.process);
Object.assign(process, processProps);
process.getProcessMemoryInfo = preloadProcess.getProcessMemoryInfo = () => {
return ipcRendererInternal.invoke<Electron.ProcessMemoryInfo>(IPC_MESSAGES.BROWSER_GET_PROCESS_MEMORY_INFO);
};
Object.defineProperty(preloadProcess, 'noDeprecation', {
get () {
return process.noDeprecation;

View File

@@ -12,6 +12,9 @@ require('../common/reset-search-paths');
// Import common settings.
require('@electron/internal/common/init');
// Process command line arguments.
const { hasSwitch, getSwitchValue } = process._linkedBinding('electron_common_command_line');
// Export node bindings to global.
const { makeRequireFunction } = __non_webpack_require__('internal/modules/cjs/helpers') // eslint-disable-line
global.module = new Module('electron/js2c/worker_init');
@@ -32,4 +35,10 @@ if (self.location.protocol === 'file:') {
// For backwards compatibility we fake these two paths here
global.__filename = path.join(process.resourcesPath, 'electron.asar', 'worker', 'init.js');
global.__dirname = path.join(process.resourcesPath, 'electron.asar', 'worker');
const appPath = hasSwitch('app-path') ? getSwitchValue('app-path') : null;
if (appPath) {
// Search for module under the app directory.
global.module.paths = Module._nodeModulePaths(appPath);
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "electron",
"version": "13.1.0",
"version": "13.6.3",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {

5
patches/angle/.patches Normal file
View File

@@ -0,0 +1,5 @@
cherry-pick-d8cb996.patch
cherry-pick-1fb846c.patch
cherry-pick-72473550f6ff.patch
webgl_make_unsuccessful_links_fail_subsequent_draw_calls.patch
fix_integer_overflow_in_blocklayoutencoder.patch

View File

@@ -0,0 +1,90 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alexey Knyazev <lexa.knyazev@gmail.com>
Date: Tue, 3 Aug 2021 01:57:49 +0400
Subject: Validate texStorage dimensions with compressed formats
Bug: angleproject:6230
Change-Id: I501ec1e6974bdc7e6731dcb88045edb0aa22b888
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3067329
Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES3.cpp b/src/libANGLE/validationES3.cpp
index 53e1afd6e26ef8cc099e51c66457a968ca82b1c8..5c69d568ee45b9e8bf1d4d0da7b9a48b123a47c0 100644
--- a/src/libANGLE/validationES3.cpp
+++ b/src/libANGLE/validationES3.cpp
@@ -1339,17 +1339,26 @@ bool ValidateES3TexStorageParametersBase(const Context *context,
return false;
}
- if (formatInfo.compressed && target == TextureType::Rectangle)
+ if (formatInfo.compressed)
{
- context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed);
- return false;
- }
+ if (target == TextureType::Rectangle)
+ {
+ context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed);
+ return false;
+ }
- if (formatInfo.compressed && target == TextureType::_3D)
- {
- if (!ValidateES3CompressedFormatForTexture3D(context, formatInfo.internalFormat))
+ if (target == TextureType::_3D)
{
- // Error already generated.
+ if (!ValidateES3CompressedFormatForTexture3D(context, formatInfo.internalFormat))
+ {
+ // Error already generated.
+ return false;
+ }
+ }
+
+ if (!ValidCompressedImageSize(context, formatInfo.internalFormat, 0, width, height, depth))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidCompressedImageSize);
return false;
}
}
diff --git a/src/tests/gl_tests/SRGBTextureTest.cpp b/src/tests/gl_tests/SRGBTextureTest.cpp
index 271fe6dbaa1d5684f7c2e16bdef18bce30943e8b..a0eab1af9e34a5de75e226efef9c0af4a50c63ff 100644
--- a/src/tests/gl_tests/SRGBTextureTest.cpp
+++ b/src/tests/gl_tests/SRGBTextureTest.cpp
@@ -340,7 +340,7 @@ TEST_P(SRGBTextureTestES3, SRGBOverrideFormats)
{
GLTexture tex;
glBindTexture(GL_TEXTURE_2D, tex.get());
- glTexStorage2D(GL_TEXTURE_2D, 1, format, 1, 1);
+ glTexStorage2D(GL_TEXTURE_2D, 1, format, 4, 4);
GLenum error = glGetError();
if (error == GL_INVALID_ENUM)
{
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index fabaefbe33c94a048ec7c974951ac9ef886826ef..efbd9ebdb2bb29cf9673750e1e3e7b492bfbf87e 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -5073,6 +5073,21 @@ void WebGLCompatibilityTest::testCompressedTexLevelDimension(GLenum format,
{
EXPECT_GL_ERROR(expectedError) << explanation;
}
+
+ if (level == 0 && width > 0 && getClientMajorVersion() >= 3)
+ {
+ GLTexture sourceTextureStorage;
+ glBindTexture(GL_TEXTURE_2D, sourceTextureStorage);
+ glTexStorage2D(GL_TEXTURE_2D, 1, format, width, height);
+ if (expectedError == 0)
+ {
+ EXPECT_GL_NO_ERROR() << explanation << " (texStorage)";
+ }
+ else
+ {
+ EXPECT_GL_ERROR(expectedError) << explanation << " (texStorage)";
+ }
+ }
}
void WebGLCompatibilityTest::testCompressedTexImage(GLenum format)

View File

@@ -0,0 +1,69 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jamie Madill <jmadill@chromium.org>
Date: Wed, 1 Sep 2021 12:17:26 -0400
Subject: D3D11: Fix overflow in GenerateInitialTextureData.
Our use of unchecked math was causing OOB accesses with very large
textures. Unfortunately it's not easy to make a passing test that
reproduces this OOB access.
Bug: chromium:1241036
Change-Id: Icd2749f5b3116bb51390ce769fef22c49a11f307
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3136733
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
(cherry picked from commit 794b13ce9f874d472729ebd69897bc7ab9340a4b)
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3149277
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
index 3915a89de6fd161fa72519d4b9b6e82db68c6c66..6d721bd6e72d21454a868965993d930fe138b58c 100644
--- a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
@@ -2181,28 +2181,35 @@ angle::Result GenerateInitialTextureData(
const d3d11::DXGIFormatSize &dxgiFormatInfo =
d3d11::GetDXGIFormatSizeInfo(d3dFormatInfo.texFormat);
- unsigned int rowPitch = dxgiFormatInfo.pixelBytes * width;
- unsigned int depthPitch = rowPitch * height;
- unsigned int maxImageSize = depthPitch * depth;
+ using CheckedSize = angle::CheckedNumeric<size_t>;
+ CheckedSize rowPitch = CheckedSize(dxgiFormatInfo.pixelBytes) * CheckedSize(width);
+ CheckedSize depthPitch = rowPitch * CheckedSize(height);
+ CheckedSize maxImageSize = depthPitch * CheckedSize(depth);
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_CHECK_GL_ALLOC(context11, maxImageSize.IsValid());
angle::MemoryBuffer *scratchBuffer = nullptr;
- ANGLE_CHECK_GL_ALLOC(GetImplAs<Context11>(context),
- context->getScratchBuffer(maxImageSize, &scratchBuffer));
+ ANGLE_CHECK_GL_ALLOC(context11,
+ context->getScratchBuffer(maxImageSize.ValueOrDie(), &scratchBuffer));
- d3dFormatInfo.dataInitializerFunction(width, height, depth, scratchBuffer->data(), rowPitch,
- depthPitch);
+ d3dFormatInfo.dataInitializerFunction(width, height, depth, scratchBuffer->data(),
+ rowPitch.ValueOrDie(), depthPitch.ValueOrDie());
for (unsigned int i = 0; i < mipLevels; i++)
{
unsigned int mipWidth = std::max(width >> i, 1U);
unsigned int mipHeight = std::max(height >> i, 1U);
- unsigned int mipRowPitch = dxgiFormatInfo.pixelBytes * mipWidth;
- unsigned int mipDepthPitch = mipRowPitch * mipHeight;
+ using CheckedUINT = angle::CheckedNumeric<UINT>;
+ CheckedUINT mipRowPitch = CheckedUINT(dxgiFormatInfo.pixelBytes) * CheckedUINT(mipWidth);
+ CheckedUINT mipDepthPitch = mipRowPitch * CheckedUINT(mipHeight);
+
+ ANGLE_CHECK_GL_ALLOC(context11, mipRowPitch.IsValid() && mipDepthPitch.IsValid());
outSubresourceData->at(i).pSysMem = scratchBuffer->data();
- outSubresourceData->at(i).SysMemPitch = mipRowPitch;
- outSubresourceData->at(i).SysMemSlicePitch = mipDepthPitch;
+ outSubresourceData->at(i).SysMemPitch = mipRowPitch.ValueOrDie();
+ outSubresourceData->at(i).SysMemSlicePitch = mipDepthPitch.ValueOrDie();
}
return angle::Result::Continue;

View File

@@ -0,0 +1,300 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kenneth Russell <kbr@chromium.org>
Date: Wed, 4 Aug 2021 18:15:51 -0700
Subject: In WebGL, constrain base level of compressed textures.
Enforce that if a mipmap level > 0 is specified for a compressed
texture, that it implies that the size of the base level of the
texture is a multiple of the format's block size.
Makes the test changes in
https://github.com/KhronosGroup/WebGL/pull/3304 largely pass. There
are some needed follow-on fixes to that PR, and this CL changes a
sub-test result in the existing S3TC and S3TC-sRGB tests which will
need to be suppressed Chromium-side first.
Bug: angleproject:6245
Change-Id: I7723d7882091b78a353d8d273e80b819dd384021
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3072568
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 656e51f17724af9e0959fcd741ceeebf25ee0f24..412b9aa0f1d75c40ce02522589c53e943d049228 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -1006,6 +1006,15 @@ bool ValidCompressedDimension(GLsizei size, GLuint blockSize, GLint level)
return (level > 0) || (size % blockSize == 0);
}
+bool ValidCompressedBaseLevelForWebGL(GLsizei size, GLuint blockSize, GLint level)
+{
+ // Avoid C++ undefined behavior.
+ constexpr int maxValidShifts = 31;
+ if (level > maxValidShifts)
+ return false;
+ return ((size << level) % blockSize) == 0;
+}
+
bool ValidCompressedImageSize(const Context *context,
GLenum internalFormat,
GLint level,
@@ -1043,11 +1052,27 @@ bool ValidCompressedImageSize(const Context *context,
if (CompressedTextureFormatRequiresExactSize(internalFormat))
{
- if (!ValidCompressedDimension(width, formatInfo.compressedBlockWidth, level) ||
- !ValidCompressedDimension(height, formatInfo.compressedBlockHeight, level) ||
- !ValidCompressedDimension(depth, formatInfo.compressedBlockDepth, level))
+ // In WebGL compatibility mode, enforce that the base level implied
+ // by the compressed texture's mip level would conform to the block
+ // size. This is more strict than the non-WebGL check.
+ if (context->getExtensions().webglCompatibility)
{
- return false;
+ if (!ValidCompressedBaseLevelForWebGL(width, formatInfo.compressedBlockWidth, level) ||
+ !ValidCompressedBaseLevelForWebGL(height, formatInfo.compressedBlockHeight,
+ level) ||
+ !ValidCompressedBaseLevelForWebGL(depth, formatInfo.compressedBlockDepth, level))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if (!ValidCompressedDimension(width, formatInfo.compressedBlockWidth, level) ||
+ !ValidCompressedDimension(height, formatInfo.compressedBlockHeight, level) ||
+ !ValidCompressedDimension(depth, formatInfo.compressedBlockDepth, level))
+ {
+ return false;
+ }
}
}
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index 40c9a02e3eafe9d437e20e72a391bad73c783516..fabaefbe33c94a048ec7c974951ac9ef886826ef 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -296,6 +296,16 @@ void main()
GLsizei blockSize,
const std::string &extName,
bool subImageAllowed);
+
+ GLint expectedByteLength(GLenum format, GLsizei width, GLsizei height);
+ void testCompressedTexLevelDimension(GLenum format,
+ GLint level,
+ GLsizei width,
+ GLsizei height,
+ GLsizei expectedByteLength,
+ GLenum expectedError,
+ const char *explanation);
+ void testCompressedTexImage(GLenum format);
};
class WebGL2CompatibilityTest : public WebGLCompatibilityTest
@@ -3040,6 +3050,84 @@ TEST_P(WebGLCompatibilityTest, CompressedTextureS3TC)
ASSERT_GL_ERROR(GL_INVALID_OPERATION);
}
+// Test WebGL-specific constraints on sizes of S3TC textures' mipmap levels.
+TEST_P(WebGLCompatibilityTest, CompressedTexImageS3TC)
+{
+ const char *extensions[] = {
+ "GL_EXT_texture_compression_dxt1",
+ "GL_ANGLE_texture_compression_dxt3",
+ "GL_ANGLE_texture_compression_dxt5",
+ };
+
+ for (const char *extension : extensions)
+ {
+ if (IsGLExtensionRequestable(extension))
+ {
+ glRequestExtensionANGLE(extension);
+ }
+
+ ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled(extension));
+ }
+
+ // Ported from WebGL conformance suite:
+ // sdk/tests/conformance/extensions/s3tc-and-srgb.html
+ constexpr GLenum formats[] = {
+ GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
+ GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
+ GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
+ GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
+ };
+
+ for (GLenum format : formats)
+ {
+ testCompressedTexImage(format);
+ }
+}
+
+// Test WebGL-specific constraints on sizes of RGTC textures' mipmap levels.
+TEST_P(WebGLCompatibilityTest, CompressedTexImageRGTC)
+{
+ if (IsGLExtensionRequestable("GL_EXT_texture_compression_rgtc"))
+ {
+ glRequestExtensionANGLE("GL_EXT_texture_compression_rgtc");
+ }
+
+ ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_texture_compression_rgtc"));
+
+ // Ported from WebGL conformance suite:
+ // sdk/tests/conformance/extensions/ext-texture-compression-rgtc.html
+ constexpr GLenum formats[] = {GL_COMPRESSED_RED_RGTC1_EXT, GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
+ GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
+ GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT};
+
+ for (GLenum format : formats)
+ {
+ testCompressedTexImage(format);
+ }
+}
+
+// Test WebGL-specific constraints on sizes of BPTC textures' mipmap levels.
+TEST_P(WebGLCompatibilityTest, CompressedTexImageBPTC)
+{
+ if (IsGLExtensionRequestable("GL_EXT_texture_compression_bptc"))
+ {
+ glRequestExtensionANGLE("GL_EXT_texture_compression_bptc");
+ }
+
+ ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_texture_compression_bptc"));
+
+ // Ported from WebGL conformance suite:
+ // sdk/tests/conformance/extensions/ext-texture-compression-bptc.html
+ constexpr GLenum formats[] = {
+ GL_COMPRESSED_RGBA_BPTC_UNORM_EXT, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
+ GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT};
+
+ for (GLenum format : formats)
+ {
+ testCompressedTexImage(format);
+ }
+}
+
TEST_P(WebGLCompatibilityTest, L32FTextures)
{
constexpr float textureData[] = {15.1f, 0.0f, 0.0f, 0.0f};
@@ -4937,6 +5025,119 @@ void WebGLCompatibilityTest::validateCompressedTexImageExtensionFormat(GLenum fo
}
}
+GLint WebGLCompatibilityTest::expectedByteLength(GLenum format, GLsizei width, GLsizei height)
+{
+ switch (format)
+ {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RED_RGTC1_EXT:
+ case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT:
+ return ((width + 3) / 4) * ((height + 3) / 4) * 8;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ case GL_COMPRESSED_RED_GREEN_RGTC2_EXT:
+ case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:
+ case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:
+ case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT:
+ case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT:
+ return ((width + 3) / 4) * ((height + 3) / 4) * 16;
+ }
+
+ UNREACHABLE();
+ return 0;
+}
+
+void WebGLCompatibilityTest::testCompressedTexLevelDimension(GLenum format,
+ GLint level,
+ GLsizei width,
+ GLsizei height,
+ GLsizei expectedByteLength,
+ GLenum expectedError,
+ const char *explanation)
+{
+ std::vector<uint8_t> tempVector(expectedByteLength, 0);
+
+ EXPECT_GL_NO_ERROR();
+
+ GLTexture sourceTexture;
+ glBindTexture(GL_TEXTURE_2D, sourceTexture);
+ glCompressedTexImage2D(GL_TEXTURE_2D, level, format, width, height, 0, expectedByteLength,
+ tempVector.data());
+ if (expectedError == 0)
+ {
+ EXPECT_GL_NO_ERROR() << explanation;
+ }
+ else
+ {
+ EXPECT_GL_ERROR(expectedError) << explanation;
+ }
+}
+
+void WebGLCompatibilityTest::testCompressedTexImage(GLenum format)
+{
+ struct TestCase
+ {
+ GLint level;
+ GLsizei width;
+ GLsizei height;
+ GLenum expectedError;
+ const char *explanation;
+ };
+
+ constexpr TestCase testCases[] = {
+ {0, 4, 3, GL_INVALID_OPERATION, "level is 0, height is not a multiple of 4"},
+ {0, 3, 4, GL_INVALID_OPERATION, "level is 0, width is not a multiple of 4"},
+ {0, 2, 2, GL_INVALID_OPERATION, "level is 0, width is not a multiple of 4"},
+ {0, 4, 4, GL_NO_ERROR, "is valid"},
+ {1, 1, 1, GL_INVALID_OPERATION, "implied base mip 2x2 is invalid"},
+ {1, 1, 2, GL_INVALID_OPERATION, "implied base mip 2x4 is invalid"},
+ {1, 2, 1, GL_INVALID_OPERATION, "implied base mip 4x2 is invalid"},
+ {1, 2, 2, GL_NO_ERROR, "implied base mip 4x4 is valid"},
+ };
+
+ constexpr TestCase webgl2TestCases[] = {
+ {0, 0, 0, GL_NO_ERROR, "0: 0x0 is valid"},
+ {0, 1, 1, GL_INVALID_OPERATION, "0: 1x1 is invalid"},
+ {0, 2, 2, GL_INVALID_OPERATION, "0: 2x2 is invalid"},
+ {0, 3, 3, GL_INVALID_OPERATION, "0: 3x3 is invalid"},
+ {0, 10, 10, GL_INVALID_OPERATION, "0: 10x10 is invalid"},
+ {0, 11, 11, GL_INVALID_OPERATION, "0: 11x11 is invalid"},
+ {0, 11, 12, GL_INVALID_OPERATION, "0: 11x12 is invalid"},
+ {0, 12, 11, GL_INVALID_OPERATION, "0: 12x11 is invalid"},
+ {0, 12, 12, GL_NO_ERROR, "0: 12x12 is valid"},
+ {1, 0, 0, GL_NO_ERROR, "1: 0x0 is valid"},
+ {1, 3, 3, GL_INVALID_OPERATION, "1: 3x3 is invalid"},
+ {1, 5, 5, GL_INVALID_OPERATION, "1: 5x5 is invalid"},
+ {1, 5, 6, GL_INVALID_OPERATION, "1: 5x6 is invalid"},
+ {1, 6, 5, GL_INVALID_OPERATION, "1: 6x5 is invalid"},
+ {1, 6, 6, GL_NO_ERROR, "1: 6x6 is valid"},
+ {2, 0, 0, GL_NO_ERROR, "2: 0x0 is valid"},
+ {2, 3, 3, GL_NO_ERROR, "2: 3x3 is valid"},
+ {3, 1, 3, GL_NO_ERROR, "3: 1x3 is valid"},
+ {3, 1, 1, GL_NO_ERROR, "3: 1x1 is valid"},
+ {2, 1, 3, GL_NO_ERROR, "implied base mip 4x12 is valid"},
+ };
+
+ for (const TestCase &test : testCases)
+ {
+ testCompressedTexLevelDimension(format, test.level, test.width, test.height,
+ expectedByteLength(format, test.width, test.height),
+ test.expectedError, test.explanation);
+ }
+
+ if (getClientMajorVersion() >= 3)
+ {
+ for (const TestCase &test : webgl2TestCases)
+ {
+ testCompressedTexLevelDimension(format, test.level, test.width, test.height,
+ expectedByteLength(format, test.width, test.height),
+ test.expectedError, test.explanation);
+ }
+ }
+}
+
// Test enabling GL_EXT_texture_compression_dxt1 for GL_COMPRESSED_RGB_S3TC_DXT1_EXT
TEST_P(WebGLCompatibilityTest, EnableCompressedTextureExtensionDXT1RGB)
{

View File

@@ -0,0 +1,112 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alexis Hetu <sugoi@google.com>
Date: Wed, 15 Sep 2021 13:40:28 -0400
Subject: Fix integer overflow in BlockLayoutEncoder
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
BlockLayoutEncoder::mCurrentOffset's computation had the
possibility of causing integer overflows in multiple places,
so this CL adds CheckedNumeric variables in a number of
these occurrences in order to prevent integer overflows and
causing issues.
The issue in this case was an integer overflow causing the
code in ValidateTypeSizeLimitations.cpp to use an invalid
result from "layoutEncoder.getCurrentOffset()", which ended
up compiling a shader which would later cause an OOM error.
Bug: chromium:1248665
Change-Id: I688d669f21c6dc2957e43bdf91f8f8f08180a6f7
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3163356
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Alexis Hétu <sugoi@chromium.org>
(cherry picked from commit 158ef351fc8b827c201e056a8ddba50fd4235671)
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3194392
diff --git a/src/compiler/translator/blocklayout.cpp b/src/compiler/translator/blocklayout.cpp
index 0539923bc75f5b88228dcb387c8aba4c701edc1b..1e6b143a1e1ee9a127b71685febd36416a8840f6 100644
--- a/src/compiler/translator/blocklayout.cpp
+++ b/src/compiler/translator/blocklayout.cpp
@@ -199,6 +199,13 @@ BlockMemberInfo BlockLayoutEncoder::encodeType(GLenum type,
return memberInfo;
}
+size_t BlockLayoutEncoder::getCurrentOffset() const
+{
+ angle::base::CheckedNumeric<size_t> checkedOffset(mCurrentOffset);
+ checkedOffset *= kBytesPerComponent;
+ return checkedOffset.ValueOrDefault(std::numeric_limits<size_t>::max());
+}
+
size_t BlockLayoutEncoder::getShaderVariableSize(const ShaderVariable &structVar, bool isRowMajor)
{
size_t currentOffset = mCurrentOffset;
@@ -226,7 +233,13 @@ size_t BlockLayoutEncoder::GetBlockRegisterElement(const BlockMemberInfo &info)
void BlockLayoutEncoder::align(size_t baseAlignment)
{
- mCurrentOffset = rx::roundUp<size_t>(mCurrentOffset, baseAlignment);
+ angle::base::CheckedNumeric<size_t> checkedOffset(mCurrentOffset);
+ checkedOffset += baseAlignment;
+ checkedOffset -= 1;
+ angle::base::CheckedNumeric<size_t> checkedAlignmentOffset = checkedOffset;
+ checkedAlignmentOffset %= baseAlignment;
+ checkedOffset -= checkedAlignmentOffset.ValueOrDefault(std::numeric_limits<size_t>::max());
+ mCurrentOffset = checkedOffset.ValueOrDefault(std::numeric_limits<size_t>::max());
}
// StubBlockEncoder implementation.
@@ -289,7 +302,7 @@ void Std140BlockEncoder::getBlockLayoutInfo(GLenum type,
baseAlignment = ComponentAlignment(numComponents);
}
- mCurrentOffset = rx::roundUp(mCurrentOffset, baseAlignment);
+ align(baseAlignment);
*matrixStrideOut = matrixStride;
*arrayStrideOut = arrayStride;
@@ -303,16 +316,23 @@ void Std140BlockEncoder::advanceOffset(GLenum type,
{
if (!arraySizes.empty())
{
- mCurrentOffset += arrayStride * gl::ArraySizeProduct(arraySizes);
+ angle::base::CheckedNumeric<size_t> checkedOffset(arrayStride);
+ checkedOffset *= gl::ArraySizeProduct(arraySizes);
+ checkedOffset += mCurrentOffset;
+ mCurrentOffset = checkedOffset.ValueOrDefault(std::numeric_limits<size_t>::max());
}
else if (gl::IsMatrixType(type))
{
- const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
- mCurrentOffset += matrixStride * numRegisters;
+ angle::base::CheckedNumeric<size_t> checkedOffset(matrixStride);
+ checkedOffset *= gl::MatrixRegisterCount(type, isRowMajorMatrix);
+ checkedOffset += mCurrentOffset;
+ mCurrentOffset = checkedOffset.ValueOrDefault(std::numeric_limits<size_t>::max());
}
else
{
- mCurrentOffset += gl::VariableComponentCount(type);
+ angle::base::CheckedNumeric<size_t> checkedOffset(mCurrentOffset);
+ checkedOffset += gl::VariableComponentCount(type);
+ mCurrentOffset = checkedOffset.ValueOrDefault(std::numeric_limits<size_t>::max());
}
}
diff --git a/src/compiler/translator/blocklayout.h b/src/compiler/translator/blocklayout.h
index 726d76fa178f77a978ff2c82ec20fb8f1ad03f0b..ff90a2487830b365697ce41d660a689857b75319 100644
--- a/src/compiler/translator/blocklayout.h
+++ b/src/compiler/translator/blocklayout.h
@@ -80,7 +80,7 @@ class BlockLayoutEncoder
const std::vector<unsigned int> &arraySizes,
bool isRowMajorMatrix);
- size_t getCurrentOffset() const { return mCurrentOffset * kBytesPerComponent; }
+ size_t getCurrentOffset() const;
size_t getShaderVariableSize(const ShaderVariable &structVar, bool isRowMajor);
// Called when entering/exiting a structure variable.

View File

@@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jamie Madill <jmadill@chromium.org>
Date: Fri, 3 Sep 2021 09:34:10 -0400
Subject: WebGL: Make unsuccessful links fail subsequent draw calls.
This protects against incomplete state updates during a failed
link call that can interfere with draw calls.
Bug: angleproject:6358
Bug: chromium:1241123
Change-Id: Ie892654c3a58c69d6e35ba3c41758ab6269d8193
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3140496
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3152556
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 412b9aa0f1d75c40ce02522589c53e943d049228..7826233f206b2ae7b926cd2564c887c726b79930 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -3958,6 +3958,12 @@ const char *ValidateDrawStates(const Context *context)
{
return kVertexBufferBoundForTransformFeedback;
}
+
+ // Validate that we are rendering with a linked program.
+ if (!program->isLinked())
+ {
+ return kProgramNotLinked;
+ }
}
}

View File

@@ -1,2 +1,3 @@
expose_ripemd160.patch
expose_aes-cfb.patch
expose_des-ede3.patch

View File

@@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Rose <nornagon@nornagon.net>
Date: Wed, 24 Feb 2021 11:08:34 -0800
Subject: expose des-ede3
This should be upstreamed.
diff --git a/crypto/cipher_extra/cipher_extra.c b/crypto/cipher_extra/cipher_extra.c
index 588a4773437c311877f275bf3679f9688cda3c46..e771ed6589b4579cc35300d5b2a1b68d92e444f5 100644
--- a/crypto/cipher_extra/cipher_extra.c
+++ b/crypto/cipher_extra/cipher_extra.c
@@ -93,6 +93,8 @@ const EVP_CIPHER *EVP_get_cipherbyname(const char *name) {
return EVP_rc4();
} else if (OPENSSL_strcasecmp(name, "des-cbc") == 0) {
return EVP_des_cbc();
+ } else if (OPENSSL_strcasecmp(name, "des-ede3") == 0) {
+ return EVP_des_ede3();
} else if (OPENSSL_strcasecmp(name, "des-ede3-cbc") == 0 ||
// This is not a name used by OpenSSL, but tcpdump registers it
// with |EVP_add_cipher_alias|. Our |EVP_add_cipher_alias| is a
diff --git a/decrepit/evp/evp_do_all.c b/decrepit/evp/evp_do_all.c
index 84af06fc56e4aa72d4d48801d7c037add0221747..fe412e350f43ad20758025da6b9754952d164938 100644
--- a/decrepit/evp/evp_do_all.c
+++ b/decrepit/evp/evp_do_all.c
@@ -39,6 +39,7 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
callback(EVP_des_cbc(), "DES-CBC", NULL, arg);
callback(EVP_des_ecb(), "DES-ECB", NULL, arg);
callback(EVP_des_ede(), "DES-EDE", NULL, arg);
+ callback(EVP_des_ede3(), "DES-EDE3", NULL, arg);
callback(EVP_des_ede_cbc(), "DES-EDE-CBC", NULL, arg);
callback(EVP_des_ede3_cbc(), "DES-EDE3-CBC", NULL, arg);
callback(EVP_rc2_cbc(), "RC2-CBC", NULL, arg);
@@ -65,6 +66,7 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
callback(EVP_des_cbc(), "des-cbc", NULL, arg);
callback(EVP_des_ecb(), "des-ecb", NULL, arg);
callback(EVP_des_ede(), "des-ede", NULL, arg);
+ callback(EVP_des_ede3(), "des-ede3", NULL, arg);
callback(EVP_des_ede_cbc(), "des-ede-cbc", NULL, arg);
callback(EVP_des_ede3_cbc(), "des-ede3-cbc", NULL, arg);
callback(EVP_rc2_cbc(), "rc2-cbc", NULL, arg);

View File

@@ -102,6 +102,7 @@ fix_export_zlib_symbols.patch
don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch
web_contents.patch
fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch
webview_fullscreen.patch
disable_unload_metrics.patch
fix_add_check_for_sandbox_then_result.patch
moves_background_color_setter_of_webview_to_blinks_webprefs_logic.patch
@@ -113,3 +114,57 @@ build_libc_as_static_library.patch
cherry-pick-3299d70b7d0f.patch
support_runtime_configurable_key_storage_on_linux_os_crypto.patch
make_keychain_service_account_optionally_configurable_at_runtime.patch
don_t_run_pcscan_notifythreadcreated_if_pcscan_is_disabled.patch
cherry-pick-cc20b36a5845.patch
set_svgimage_page_after_document_install.patch
cherry-pick-5487040a284a.patch
cherry-pick-e60cc80ff744.patch
add_gin_wrappable_crash_key.patch
cherry-pick-cd98d7c0dae9.patch
cherry-pick-ac9dc1235e28.patch
cherry-pick-4ce2abc17078.patch
cherry-pick-e2123a8e0943.patch
cherry-pick-1227933.patch
cherry-pick-1230767.patch
cherry-pick-1231134.patch
cherry-pick-1233564.patch
cherry-pick-1234009.patch
fix_media_key_usage_with_globalshortcuts.patch
attach_to_correct_frame_in.patch
merge_m92_speculative_fix_for_crash_in.patch
cherry-pick-d727013bb543.patch
pa_make_getusablesize_handle_nullptr_gracefully.patch
dpwas_window_control_overlay_api_values_account_for_page_zoom_factor.patch
reland_make_clientview_a_child_of_the_nonclientframeview.patch
content-visibility_force_range_base_extent_when_computing_visual.patch
cherry-pick-6215793f008f.patch
cherry-pick-6048fcd52f42.patch
contentindex_add_origin_checks_to_mojo_methods.patch
m93_indexeddb_add_browser-side_checks_for_committing_transactions.patch
m93_indexeddb_don_t_reportbadmessage_for_commit_calls.patch
cherry-pick-8623d711677d.patch
cherry-pick-ddc4cf156505.patch
skip_webgl_conformance_programs_program-test_html_on_all_platforms.patch
linux_sandbox_update_syscall_numbers_for_all_platforms.patch
linux_sandbox_return_enosys_for_clone3.patch
content-visibility_add_a_clipper_fix_for_content-visibility.patch
kill_a_renderer_if_it_provides_an_unexpected_frameownerelementtype.patch
m90-lts_backgroundfetch_check_whether_the_sw_id_is_valid_for.patch
cherry-pick-096afc1c5428.patch
cherry-pick-4e528a5a8d83.patch
cherry-pick-3a5bafa35def.patch
cherry-pick-b2c4e4dc21e5.patch
check_direction_of_rtcencodedframes.patch
cherry-pick-6a8a2098f9fa.patch
speculative_fix_for_eye_dropper_getcolor_crash.patch
mas_gate_private_enterprise_APIs
cherry-pick-c69dddfe1cde.patch
cherry-pick-8af66de55aad.patch
move_networkstateobserver_from_document_to_window.patch
cherry-pick-0894af410c4e.patch
disable_quictransport_explicitly_in_the_network_service.patch
cherry-pick-91dd4f79ab5b.patch
introduce_crossthreadcopier_skbitmap.patch
allow_null_skbitmap_to_be_transferred_across_threads.patch
use_weakptrs_for_the_threadediconloader_s_background_tasks.patch
cherry-pick-a5f54612590d.patch

View File

@@ -1,16 +1,16 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cheng Zhao <zcbenz@gmail.com>
Date: Thu, 4 Oct 2018 14:57:02 -0700
Subject: accelerator.patch
Subject: fix: improve shortcut text of Accelerator
This patch makes three changes to Accelerator::GetShortcutText to improve shortcut display text in menus:
1. Ctrl-Alt-<Key> accelerators show as Ctrl-Alt-<Key> instead of as Ctrl-<Key>
2. F2-F24 accelerators show up as such
3. Ctrl-Shift-= should show as Ctrl-+
3. Ctrl-Shift-= and Ctrl-Plus show up as such
diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc
index c44f3d3752025bd3f11db790a97a48e8ba856034..8e0c1446315823a391614b19aa2c4ba2e5faed0d 100644
index c44f3d3752025bd3f11db790a97a48e8ba856034..8b1859b18aa7ebcecf4c2a90b4ced0186d258ddc 100644
--- a/ui/base/accelerators/accelerator.cc
+++ b/ui/base/accelerators/accelerator.cc
@@ -11,6 +11,7 @@
@@ -21,61 +21,39 @@ index c44f3d3752025bd3f11db790a97a48e8ba856034..8e0c1446315823a391614b19aa2c4ba2
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
@@ -27,9 +28,7 @@
#include <windows.h>
@@ -209,6 +210,11 @@ std::u16string Accelerator::GetShortcutText() const {
#endif
-#if !defined(OS_WIN) && (defined(USE_AURA) || defined(OS_MAC))
#include "ui/events/keycodes/keyboard_code_conversion.h"
-#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ui/base/ui_base_features.h"
@@ -208,7 +207,15 @@ std::u16string Accelerator::GetShortcutText() const {
shortcut = KeyCodeToName();
#endif
+ unsigned int flags = 0;
if (shortcut.empty()) {
+ const uint16_t c = DomCodeToUsLayoutCharacter(
+ UsLayoutKeyboardCodeToDomCode(key_code_), flags);
+ if (c != 0) {
+ shortcut =
+ static_cast<std::u16string::value_type>(
+ base::ToUpperASCII(static_cast<char16_t>(c)));
+ }
+ // When a shifted char is explicitly specified, for example Ctrl+Plus,
+ // use the shifted char directly.
+ if (shifted_char) {
+ shortcut += *shifted_char;
+ } else {
#if defined(OS_WIN)
// Our fallback is to try translate the key code to a regular character
// unless it is one of digits (VK_0 to VK_9). Some keyboard
@@ -217,21 +224,14 @@ std::u16string Accelerator::GetShortcutText() const {
// accent' for '0'). For display in the menu (e.g. Ctrl-0 for the
// default zoom level), we leave VK_[0-9] alone without translation.
wchar_t key;
- if (base::IsAsciiDigit(key_code_))
+ if (base::IsAsciiDigit(key_code_)) {
key = static_cast<wchar_t>(key_code_);
- else
- key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR));
- // If there is no translation for the given |key_code_| (e.g.
- // VKEY_UNKNOWN), |::MapVirtualKeyW| returns 0.
- if (key != 0)
- shortcut += key;
-#elif defined(USE_AURA) || defined(OS_MAC) || defined(OS_ANDROID)
- const uint16_t c = DomCodeToUsLayoutCharacter(
- UsLayoutKeyboardCodeToDomCode(key_code_), false);
- if (c != 0)
- shortcut +=
- static_cast<std::u16string::value_type>(base::ToUpperASCII(c));
+ shortcut = key;
+ }
@@ -232,6 +238,10 @@ std::u16string Accelerator::GetShortcutText() const {
shortcut +=
static_cast<std::u16string::value_type>(base::ToUpperASCII(c));
#endif
+ }
+ if (key_code_ > VKEY_F1 && key_code_ <= VKEY_F24)
+ shortcut = base::UTF8ToUTF16(
+ base::StringPrintf("F%d", key_code_ - VKEY_F1 + 1));
}
#if defined(OS_MAC)
@@ -427,7 +427,7 @@ std::u16string Accelerator::ApplyLongFormModifiers(
@@ -419,7 +429,7 @@ std::u16string Accelerator::ApplyLongFormModifiers(
const std::u16string& shortcut) const {
std::u16string result = shortcut;
- if (IsShiftDown())
+ if (!shifted_char && IsShiftDown())
result = ApplyModifierToAcceleratorString(result, IDS_APP_SHIFT_KEY);
// Note that we use 'else-if' in order to avoid using Ctrl+Alt as a shortcut.
@@ -427,7 +437,7 @@ std::u16string Accelerator::ApplyLongFormModifiers(
// more information.
if (IsCtrlDown())
result = ApplyModifierToAcceleratorString(result, IDS_APP_CTRL_KEY);
@@ -84,3 +62,24 @@ index c44f3d3752025bd3f11db790a97a48e8ba856034..8e0c1446315823a391614b19aa2c4ba2
result = ApplyModifierToAcceleratorString(result, IDS_APP_ALT_KEY);
if (IsCmdDown()) {
diff --git a/ui/base/accelerators/accelerator.h b/ui/base/accelerators/accelerator.h
index 62eacbe23f949cf62b86a775d331459ae3934048..008b753809f34b72d0c1de46916c0d36eb90a8f5 100644
--- a/ui/base/accelerators/accelerator.h
+++ b/ui/base/accelerators/accelerator.h
@@ -16,6 +16,7 @@
#include <utility>
#include "base/component_export.h"
+#include "base/optional.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "ui/events/event_constants.h"
@@ -100,6 +101,8 @@ class COMPONENT_EXPORT(UI_BASE) Accelerator {
return interrupted_by_mouse_event_;
}
+ base::Optional<char16_t> shifted_char;
+
private:
std::u16string ApplyLongFormModifiers(const std::u16string& shortcut) const;
std::u16string ApplyShortFormModifiers(const std::u16string& shortcut) const;

View File

@@ -0,0 +1,48 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: VerteDinde <khammond@slack-corp.com>
Date: Thu, 15 Jul 2021 12:16:50 -0700
Subject: chore: add gin::wrappable wrapperinfo crash key
This patch adds an additional crash key for gin::Wrappable, to help
debug a crash that is occurring during garbage collection in SecondWeakCallback.
The crash seems to be due to a class that is holding a reference to
gin::Wrappable even after being deleted. This added crash key compares
the soon-to-be-deleted WrapperInfo with known WrapperInfo components to
help determine where the crash originated from.
This patch should not be upstreamed, and can be removed in Electron 15 and
beyond once we identify the cause of the crash.
diff --git a/gin/wrappable.cc b/gin/wrappable.cc
index fe07eb94a8e679859bba6d76ff0d6ee86bd0c67e..ecb0aa2c4ec57e1814f4c94194e775440f4e35ee 100644
--- a/gin/wrappable.cc
+++ b/gin/wrappable.cc
@@ -8,6 +8,11 @@
#include "gin/object_template_builder.h"
#include "gin/per_isolate_data.h"
+#if !defined(MAS_BUILD)
+#include "components/crash/core/common/crash_key.h"
+#include "electron/shell/common/crash_keys.h"
+#endif
+
namespace gin {
WrappableBase::WrappableBase() = default;
@@ -36,6 +41,15 @@ void WrappableBase::FirstWeakCallback(
void WrappableBase::SecondWeakCallback(
const v8::WeakCallbackInfo<WrappableBase>& data) {
WrappableBase* wrappable = data.GetParameter();
+
+#if !defined(MAS_BUILD)
+ WrapperInfo* wrapperInfo = static_cast<WrapperInfo*>(data.GetInternalField(0));
+ std::string location = electron::crash_keys::GetCrashValueForGinWrappable(wrapperInfo);
+
+ static crash_reporter::CrashKeyString<32> crash_key("gin-wrappable-fatal.location");
+ crash_reporter::ScopedCrashKeyString auto_clear(&crash_key, location);
+#endif
+
delete wrappable;
}

View File

@@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Yutaka Hirano <yhirano@chromium.org>
Date: Tue, 9 Nov 2021 09:03:17 +0000
Subject: Allow null SkBitmap to be transferred across threads
(cherry picked from commit dad0c0e5162bcc49b8f60354d3bca92224d8381b)
Bug: 1241091
Change-Id: Ie96932c14c8884d6d3eafa76dab5043e7aa31888
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3251815
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#936861}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3268018
Auto-Submit: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/branch-heads/4664@{#893}
Cr-Branched-From: 24dc4ee75e01a29d390d43c9c264372a169273a7-refs/heads/main@{#929512}
diff --git a/third_party/blink/renderer/platform/graphics/skia/skia_utils.h b/third_party/blink/renderer/platform/graphics/skia/skia_utils.h
index 3bd49cac3f5dfcad0fcc1140fcf876fe37558930..c037b85210bf2dedeb8478cf918633ad94885048 100644
--- a/third_party/blink/renderer/platform/graphics/skia/skia_utils.h
+++ b/third_party/blink/renderer/platform/graphics/skia/skia_utils.h
@@ -209,11 +209,13 @@ struct CrossThreadCopier<SkBitmap> {
using Type = SkBitmap;
static SkBitmap Copy(const SkBitmap& bitmap) {
- CHECK(bitmap.isImmutable()) << "Only immutable bitmaps can be transferred.";
+ CHECK(bitmap.isImmutable() || bitmap.isNull())
+ << "Only immutable bitmaps can be transferred.";
return bitmap;
}
static SkBitmap Copy(SkBitmap&& bitmap) {
- CHECK(bitmap.isImmutable()) << "Only immutable bitmaps can be transferred.";
+ CHECK(bitmap.isImmutable() || bitmap.isNull())
+ << "Only immutable bitmaps can be transferred.";
return std::move(bitmap);
}
};

View File

@@ -0,0 +1,353 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kevin McNee <mcnee@chromium.org>
Date: Fri, 4 Jun 2021 22:52:55 +0000
Subject: Attach to correct frame in
WebContentsImplBrowserTest.AttachNestedInnerWebContents
This test attempts to attach an inner contents at the outer contents'
main frame which is incorrect. This appears to have been done for
testing convenience rather than being part of the repro case based on
the comments on the CL that introduced it [1]. Indeed, the inner
contents don't render with the test as is.
We adjust the test, enforce the assumption of a subframe in
|AttachInnerWebContents|, and remove a bail-out from a
WebContentsObserver that was confused by this.
Furthermore, in the corrected version of the test, we experience a bad
cast on Mac and Android, but not Aura, as replacing the platform
WebContentsView does not necessarily destroy the platform
RenderWidgetHostView which is later assumed to be a
RenderWidgetHostViewChildFrame. We now perform that destruction if
needed.
[1] https://chromium-review.googlesource.com/c/chromium/src/+/1498458/6#message-c6af19c82b27d707044a5c1cbbecf48f491bc1bd
Bug: 1133361, 1208438, 1216595
Change-Id: I4de002ab25726f1c05044c764156b69a15bdde41
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2895924
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Reviewed-by: Chris Hamilton <chrisha@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: W. James MacLean <wjmaclean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#889495}
diff --git a/components/performance_manager/performance_manager_tab_helper.cc b/components/performance_manager/performance_manager_tab_helper.cc
index 7b2672713e705060ea3d2100492f29d6aa4ad35b..7463423c065e0b74b65b41c2bcf80e9b2025d574 100644
--- a/components/performance_manager/performance_manager_tab_helper.cc
+++ b/components/performance_manager/performance_manager_tab_helper.cc
@@ -394,16 +394,7 @@ void PerformanceManagerTabHelper::InnerWebContentsAttached(
// severed.
}
DCHECK_NE(PageNode::OpenedType::kInvalid, opened_type);
- if (!frame) {
- DCHECK(!render_frame_host->IsRenderFrameCreated());
- DCHECK(!inner_web_contents->IsPortal());
- // TODO(crbug.com/1133361):
- // WebContentsImplBrowserTest.AttachNestedInnerWebContents calls
- // WebContents::AttachInnerWebContents without creating RenderFrame.
- // Removing this conditional once either the test is fixed or this function
- // is adjusted to handle the case without the render frame.
- return;
- }
+ DCHECK(frame);
PerformanceManagerImpl::CallOnGraphImpl(
FROM_HERE, base::BindOnce(&PageNodeImpl::SetOpenerFrameNodeAndOpenedType,
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index 4af3384ebbd000926a1f7606511fd6b94dc8aabe..29571b8ab59518fe93e35c1cc7f113e65ed39420 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -5714,11 +5714,10 @@ void RenderFrameHostImpl::AdoptPortal(const blink::PortalToken& portal_token,
// |frame_sink_id| should be set to the associated frame. See
// https://crbug.com/966119 for details.
- viz::FrameSinkId frame_sink_id =
- static_cast<RenderWidgetHostViewBase*>(proxy_host->frame_tree_node()
- ->render_manager()
- ->GetRenderWidgetHostView())
- ->GetFrameSinkId();
+ viz::FrameSinkId frame_sink_id = proxy_host->frame_tree_node()
+ ->render_manager()
+ ->GetRenderWidgetHostView()
+ ->GetFrameSinkId();
proxy_host->GetAssociatedRemoteFrame()->SetFrameSinkId(frame_sink_id);
std::move(callback).Run(
diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc
index 74f9fe3a0a0de20d48bc8b2d397109381ea66481..ce524db677e36ca60f3f9be5493d974975eb82c5 100644
--- a/content/browser/renderer_host/render_frame_host_manager.cc
+++ b/content/browser/renderer_host/render_frame_host_manager.cc
@@ -43,6 +43,8 @@
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
+#include "content/browser/renderer_host/render_widget_host_view_base.h"
+#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/webui/web_ui_controller_factory_registry.h"
#include "content/common/content_navigation_policy.h"
@@ -282,9 +284,11 @@ void RenderFrameHostManager::InitChild(
/*renderer_initiated_creation=*/false));
}
-RenderWidgetHostView* RenderFrameHostManager::GetRenderWidgetHostView() const {
+RenderWidgetHostViewBase* RenderFrameHostManager::GetRenderWidgetHostView()
+ const {
if (render_frame_host_)
- return render_frame_host_->GetView();
+ return static_cast<RenderWidgetHostViewBase*>(
+ render_frame_host_->GetView());
return nullptr;
}
@@ -2793,8 +2797,9 @@ void RenderFrameHostManager::SwapOuterDelegateFrame(
}
void RenderFrameHostManager::SetRWHViewForInnerContents(
- RenderWidgetHostView* child_rwhv) {
+ RenderWidgetHostViewChildFrame* child_rwhv) {
DCHECK(IsMainFrameForInnerDelegate());
+ DCHECK(GetProxyToOuterDelegate());
GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv, nullptr);
}
@@ -3400,8 +3405,11 @@ void RenderFrameHostManager::CommitPending(
// Note: We do this after unloading the old RFH because that may create
// the proxy we're looking for.
RenderFrameProxyHost* proxy_to_parent = GetProxyToParent();
- if (proxy_to_parent)
- proxy_to_parent->SetChildRWHView(new_view, old_size ? &*old_size : nullptr);
+ if (proxy_to_parent) {
+ proxy_to_parent->SetChildRWHView(
+ static_cast<RenderWidgetHostViewChildFrame*>(new_view),
+ old_size ? &*old_size : nullptr);
+ }
if (render_frame_host_->is_local_root()) {
// RenderFrames are created with a hidden RenderWidgetHost. When navigation
diff --git a/content/browser/renderer_host/render_frame_host_manager.h b/content/browser/renderer_host/render_frame_host_manager.h
index f4ff686226002e926190829a192993cb92ed0a3e..6ca00c16ac6031bb0357cf8a43e6b77e63455807 100644
--- a/content/browser/renderer_host/render_frame_host_manager.h
+++ b/content/browser/renderer_host/render_frame_host_manager.h
@@ -44,7 +44,8 @@ class RenderFrameHostManagerTest;
class RenderFrameProxyHost;
class RenderViewHost;
class RenderViewHostImpl;
-class RenderWidgetHostView;
+class RenderWidgetHostViewBase;
+class RenderWidgetHostViewChildFrame;
class TestWebContents;
using PageBroadcastMethodCallback =
@@ -196,7 +197,7 @@ class CONTENT_EXPORT RenderFrameHostManager
// Returns the view associated with the current RenderViewHost, or null if
// there is no current one.
- RenderWidgetHostView* GetRenderWidgetHostView() const;
+ RenderWidgetHostViewBase* GetRenderWidgetHostView() const;
// Returns whether this manager is a main frame and belongs to a FrameTreeNode
// that belongs to an inner WebContents.
@@ -453,7 +454,7 @@ class CONTENT_EXPORT RenderFrameHostManager
// Sets the child RenderWidgetHostView for this frame, which must be part of
// an inner WebContents.
- void SetRWHViewForInnerContents(RenderWidgetHostView* child_rwhv);
+ void SetRWHViewForInnerContents(RenderWidgetHostViewChildFrame* child_rwhv);
// Returns the number of RenderFrameProxyHosts for this frame.
size_t GetProxyCount();
diff --git a/content/browser/renderer_host/render_frame_proxy_host.cc b/content/browser/renderer_host/render_frame_proxy_host.cc
index 54fa3b7a788de7f80a096badeac11a2b6f9b9771..343ea5e1821f55cdea16ae93a055302016d2198f 100644
--- a/content/browser/renderer_host/render_frame_proxy_host.cc
+++ b/content/browser/renderer_host/render_frame_proxy_host.cc
@@ -214,10 +214,9 @@ RenderFrameProxyHost::~RenderFrameProxyHost() {
}
void RenderFrameProxyHost::SetChildRWHView(
- RenderWidgetHostView* view,
+ RenderWidgetHostViewChildFrame* view,
const gfx::Size* initial_frame_size) {
- cross_process_frame_connector_->SetView(
- static_cast<RenderWidgetHostViewChildFrame*>(view));
+ cross_process_frame_connector_->SetView(view);
if (initial_frame_size)
cross_process_frame_connector_->SetLocalFrameSize(*initial_frame_size);
}
@@ -226,13 +225,6 @@ RenderViewHostImpl* RenderFrameProxyHost::GetRenderViewHost() {
return render_view_host_.get();
}
-RenderWidgetHostView* RenderFrameProxyHost::GetRenderWidgetHostView() {
- return frame_tree_node_->parent()
- ->frame_tree_node()
- ->render_manager()
- ->GetRenderWidgetHostView();
-}
-
bool RenderFrameProxyHost::Send(IPC::Message* msg) {
return GetAgentSchedulingGroup().Send(msg);
}
diff --git a/content/browser/renderer_host/render_frame_proxy_host.h b/content/browser/renderer_host/render_frame_proxy_host.h
index cd6c90f3b7f77de0df9de1228628cde8c4333b98..e414a1665d43cc773850b23b6fcd568f9baa494a 100644
--- a/content/browser/renderer_host/render_frame_proxy_host.h
+++ b/content/browser/renderer_host/render_frame_proxy_host.h
@@ -36,7 +36,7 @@ class CrossProcessFrameConnector;
class FrameTreeNode;
class RenderProcessHost;
class RenderViewHostImpl;
-class RenderWidgetHostView;
+class RenderWidgetHostViewChildFrame;
// When a page's frames are rendered by multiple processes, each renderer has a
// full copy of the frame tree. It has full RenderFrames for the frames it is
@@ -121,11 +121,10 @@ class CONTENT_EXPORT RenderFrameProxyHost
// the child frame will wait until the CrossProcessFrameConnector
// receives its size from the parent via FrameHostMsg_UpdateResizeParams
// before it begins parsing the content.
- void SetChildRWHView(RenderWidgetHostView* view,
+ void SetChildRWHView(RenderWidgetHostViewChildFrame* view,
const gfx::Size* initial_frame_size);
RenderViewHostImpl* GetRenderViewHost();
- RenderWidgetHostView* GetRenderWidgetHostView();
// IPC::Sender
bool Send(IPC::Message* msg) override;
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 14eadcb063b2b9d4734db3d6160f320ab26ffe04..ca51a8a45570fafc0dfe2b400cbb7172a9be632d 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2164,6 +2164,7 @@ void WebContentsImpl::AttachInnerWebContents(
auto* render_frame_host_impl =
static_cast<RenderFrameHostImpl*>(render_frame_host);
DCHECK_EQ(&frame_tree_, render_frame_host_impl->frame_tree());
+ DCHECK(render_frame_host_impl->GetParent());
// Mark |render_frame_host_impl| as outer delegate frame.
render_frame_host_impl->SetIsOuterDelegateFrame(true);
@@ -2184,6 +2185,16 @@ void WebContentsImpl::AttachInnerWebContents(
GetContentClient()->browser()->GetWebContentsViewDelegate(
inner_web_contents_impl),
&inner_web_contents_impl->render_view_host_delegate_view_);
+ // On platforms where destroying the WebContents' view does not also destroy
+ // the platform RenderWidgetHostView, we need to destroy it if it exists.
+ // TODO(mcnee): Should all platforms' WebContentsView destroy the platform
+ // RWHV?
+ if (RenderWidgetHostViewBase* prev_rwhv =
+ inner_render_manager->GetRenderWidgetHostView()) {
+ if (!prev_rwhv->IsRenderWidgetHostViewChildFrame()) {
+ prev_rwhv->Destroy();
+ }
+ }
// When the WebContents being initialized has an opener, the browser side
// Render{View,Frame}Host must be initialized and the RenderWidgetHostView
@@ -2330,8 +2341,11 @@ void WebContentsImpl::ReattachToOuterWebContentsFrame() {
auto* render_manager = GetRenderManager();
auto* parent_frame =
node_.OuterContentsFrameTreeNode()->current_frame_host()->GetParent();
+ auto* child_rwhv = render_manager->GetRenderWidgetHostView();
+ DCHECK(child_rwhv);
+ DCHECK(child_rwhv->IsRenderWidgetHostViewChildFrame());
render_manager->SetRWHViewForInnerContents(
- render_manager->GetRenderWidgetHostView());
+ static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv));
RecursivelyRegisterFrameSinkIds();
diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc
index cd32d333d2810fde1fc25c80b2bc443b04568c8d..2e75cbf168dbfa48d9f094ed84398197fd0487aa 100644
--- a/content/browser/web_contents/web_contents_impl_browsertest.cc
+++ b/content/browser/web_contents/web_contents_impl_browsertest.cc
@@ -3550,44 +3550,70 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, SetVisibilityBeforeLoad) {
IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
AttachNestedInnerWebContents) {
ASSERT_TRUE(embedded_test_server()->Start());
- GURL main_url(embedded_test_server()->GetURL(
+ const GURL url_a(embedded_test_server()->GetURL(
"a.com", "/cross_site_iframe_factory.html?a(a)"));
- EXPECT_TRUE(NavigateToURL(shell(), main_url));
-
+ const GURL url_b(embedded_test_server()->GetURL(
+ "b.com", "/cross_site_iframe_factory.html?b(b)"));
+ ASSERT_TRUE(NavigateToURL(shell(), url_a));
auto* root_web_contents =
static_cast<WebContentsImpl*>(shell()->web_contents());
- FrameTreeNode* root = root_web_contents->GetFrameTree()->root();
- ASSERT_EQ(1u, root->child_count());
- FrameTreeNode* child_to_replace = root->child_at(0);
- auto* child_to_replace_rfh = child_to_replace->current_frame_host();
+ // Create a child WebContents but don't attach it to the root contents yet.
WebContents::CreateParams inner_params(
root_web_contents->GetBrowserContext());
-
std::unique_ptr<WebContents> child_contents_ptr =
WebContents::Create(inner_params);
- auto* child_rfh =
- static_cast<RenderFrameHostImpl*>(child_contents_ptr->GetMainFrame());
+ WebContents* child_contents = child_contents_ptr.get();
+ // Navigate the child to a page with a subframe, at which we will attach the
+ // grandchild.
+ ASSERT_TRUE(NavigateToURL(child_contents, url_b));
+ // Create and attach grandchild to child.
std::unique_ptr<WebContents> grandchild_contents_ptr =
WebContents::Create(inner_params);
-
- // Attach grandchild to child.
- child_contents_ptr->AttachInnerWebContents(
- std::move(grandchild_contents_ptr), child_rfh, false /* is_full_page */);
+ WebContents* grandchild_contents = grandchild_contents_ptr.get();
+ RenderFrameHost* child_contents_subframe =
+ ChildFrameAt(child_contents->GetMainFrame(), 0);
+ ASSERT_TRUE(child_contents_subframe);
+ child_contents->AttachInnerWebContents(std::move(grandchild_contents_ptr),
+ child_contents_subframe,
+ false /* is_full_page */);
// At this point the child hasn't been attached to the root.
- EXPECT_EQ(1U, root_web_contents->GetInputEventRouter()
- ->RegisteredViewCountForTesting());
+ {
+ auto* root_view = static_cast<RenderWidgetHostViewBase*>(
+ root_web_contents->GetRenderWidgetHostView());
+ ASSERT_TRUE(root_view);
+ auto* root_event_router = root_web_contents->GetInputEventRouter();
+ EXPECT_EQ(1U, root_event_router->RegisteredViewCountForTesting());
+ EXPECT_TRUE(root_event_router->IsViewInMap(root_view));
+ }
// Attach child+grandchild subtree to root.
+ RenderFrameHost* root_contents_subframe =
+ ChildFrameAt(root_web_contents->GetMainFrame(), 0);
+ ASSERT_TRUE(root_contents_subframe);
root_web_contents->AttachInnerWebContents(std::move(child_contents_ptr),
- child_to_replace_rfh,
+ root_contents_subframe,
false /* is_full_page */);
// Verify views registered for both child and grandchild.
- EXPECT_EQ(3U, root_web_contents->GetInputEventRouter()
- ->RegisteredViewCountForTesting());
+ {
+ auto* root_view = static_cast<RenderWidgetHostViewBase*>(
+ root_web_contents->GetRenderWidgetHostView());
+ auto* child_view = static_cast<RenderWidgetHostViewBase*>(
+ child_contents->GetRenderWidgetHostView());
+ auto* grandchild_view = static_cast<RenderWidgetHostViewBase*>(
+ grandchild_contents->GetRenderWidgetHostView());
+ ASSERT_TRUE(root_view);
+ ASSERT_TRUE(child_view);
+ ASSERT_TRUE(grandchild_view);
+ auto* root_event_router = root_web_contents->GetInputEventRouter();
+ EXPECT_EQ(3U, root_event_router->RegisteredViewCountForTesting());
+ EXPECT_TRUE(root_event_router->IsViewInMap(root_view));
+ EXPECT_TRUE(root_event_router->IsViewInMap(child_view));
+ EXPECT_TRUE(root_event_router->IsViewInMap(grandchild_view));
+ }
}
IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,

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 08a3eb686360e7a53cca75437cbe5f4d15cb9a17..78d3287ef7a708f44bd8ef0290618ef781f09d9c 100644
index 7f7e6adf57128f1e8b0890aa14102fe4db452cb2..59d855ec17efe9117ee9bca5074b1ab28dfb40fa 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -5440,6 +5440,7 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -5430,6 +5430,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,

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