Compare commits

...

349 Commits

Author SHA1 Message Date
Sudowoodo Release Bot
582eb5c9bd Bump v14.2.3 2021-12-16 09:12:59 -08:00
trop[bot]
8fe397cecc fix: ensure bluetooth devices are not returned by default (#32196)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-12-15 19:51:32 -08:00
Keeley Hammond
972213b032 build: add CI path-filtering for docs-only changes (#32058)
* build: add CI path-filtering for docs-only changes (#31741)

build: (wip) initial dynamic config research

* build: (wip) test path filtering option

* build: (wip) remove doc-only script, use path filtering to check changes

* build: (wip) add docker image with Electron dependencies

* build: (wip) clean up config

* build (wip): readd parameters, executors and env*s

* build: re-add steps and commands

* build: change doc-only to ts-compile-doc-only

* build: re-add workflows and jobs

* build: split configs to setup & build

* build: move lint to "always run" config

* build: clean up, remove old reference config

* build: bump to path-filtering 0.1.0

* build: remove ts-compile step from build-linux

* build: remove nightly-linux-release-test, linux-checks-nightly

* build: don't run build on publish

* build: set base-revision to main (runs branch vs commit)

* build: update config from chromium roll

* build: don't use python3 on sync-step

reverts ea6087e343, which doesn't apply to 14-x-y

* build: account for path-filtering workflow in release-build script (#32063)

* build: account for path-filtering workflow in release-build script

* build: update syntax for workflow id

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

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

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-12-06 11:36:34 +09:00
trop[bot]
5e36eed062 fix: gtk_native_dialog_run() calls show() internally (#32080)
In the synchronous code path, gtk_native_dialog_run() will call
gtk_native_dialog_show(). Previously this was causing an assertion to be
hit at run time.

Co-authored-by: Tristan Partin <tristan@partin.io>
2021-12-06 11:30:14 +09:00
Sudowoodo Release Bot
dbe8546e1b Bump v14.2.2 2021-11-30 13:29:29 -08:00
trop[bot]
5462e954b7 fix: aspect ratio when max width/height is set (#31955)
* fix: fix aspect ratio when max width/height is set

Add the native frame border size to the minimum and maximum size if
the view reports its size as the client size. It allows to enlarge
window to proper values when aspect ratio and max width/height are
set. It also fixes DCHECK which was triggered when user tried to
enlarge window above dimensions set during creation of the
BrowserWindow.

* chore: update patches

Co-authored-by: Cezary Kulakowski <cezary@openfin.co>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-24 17:07:37 -05:00
Pedro Pontes
376812fccd chore: cherry-pick 1a8af2da50e4 from chromium (#31903)
* chore: cherry-pick 1a8af2da50e4 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-11-24 16:24:48 -05:00
Pedro Pontes
a1a1ffca2c chore: cherry-pick 1fcfb942bd from chromium (#31928)
Co-authored-by: Electron Bot <electron@github.com>
2021-11-22 16:54:25 -05:00
Pedro Pontes
6aefbacce3 chore: cherry-pick 56de3b2004, bbca3704f9 and f2b0985ac3 from chromium (#31920)
Co-authored-by: Electron Bot <electron@github.com>
2021-11-22 08:34:19 -08:00
Pedro Pontes
9e21ebf6ea chore: cherry-pick 5d2b5e7c006c from v8 (#31911)
* chore: cherry-pick 5d2b5e7c006c from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-22 01:45:18 -08:00
Pedro Pontes
51bb4c1e7b chore: cherry-pick a5f54612590d from chromium (#31900) 2021-11-22 01:38:09 -08:00
trop[bot]
e4fbf3852a fix: BrowserView setBackgroundColor needs two calls (#31945)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-22 16:41:46 +09:00
trop[bot]
20fc69ec99 fix: ninja build failed on some system (#31941)
Co-authored-by: Black-Hole1 <158blackhole@gmail.com>
2021-11-22 16:36:48 +09:00
trop[bot]
d2b758240d fix: lint Objective-C header files (#31937)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-11-22 16:35:32 +09:00
trop[bot]
7351f65482 docs: fix typo in distribution docs (#31879)
Co-authored-by: Sergey Zolotarev <sryze@protonmail.com>
2021-11-18 20:32:49 +09:00
Shelley Vohr
173cc8e904 fix: BrowserView setBackgroundColor() (#31845) 2021-11-16 20:39:45 +01:00
trop[bot]
0fca1b536d chore: use std::forward() in ConvertToV8() (#31857)
The variable `input` is accepted by a universal reference, so it doesn't
make sense to cast a potential lvalue reference into an rvalue
reference. In case `input` is an lvalue reference, we should rather
forward the value as is to `ToV8()`.

Signed-off-by: Darshan Sen <darshan.sen@postman.com>

Co-authored-by: Darshan Sen <darshan.sen@postman.com>
2021-11-16 10:04:25 -05:00
trop[bot]
c5bdabbb77 fix: make BrowserView aware of owning window (#31840)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-16 12:00:14 +01:00
trop[bot]
df8eb2aeb0 fix: setContentProtection affects BrowserWindow frame (#31831)
Co-authored-by: Micha Hanselmann <micha.hanselmann@gmail.com>
2021-11-15 16:37:02 +01:00
trop[bot]
7478c82233 fix: in GTK open dialog, do not preview huge files (#31819)
* fix: in GTK open dialog, do not preview huge files

Previewing images whose files are larger than a GB can crash Electron.

* refactor: tweak CanPreview()

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-15 16:35:53 +01:00
trop[bot]
e60d3a7d27 fix: correct default text for button labels in gtk dialogs (#31822) 2021-11-15 16:24:14 +01:00
trop[bot]
484c90d4eb fix: crash on browserView.webContents.destroy() (#31825)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-15 16:19:06 +01:00
trop[bot]
a978735582 chore: cleanup obsolete lib/common/remote/ipc-messages.ts (#31765)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-11-09 13:00:29 -05:00
trop[bot]
8335d24684 test: fix crash in electron::NativeWindowMac::Close() (#31759)
* test: fix crash in electron::NativeWindowMac::Close()

* remove extra close

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-09 12:09:57 -05:00
Sudowoodo Release Bot
71cd259b7b Bump v14.2.1 2021-11-08 10:41:28 -08:00
trop[bot]
27fb917577 fix: <webview> background transparency (#31727)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2021-11-05 20:09:30 -07:00
trop[bot]
b763478ae5 test: deflake <webview> tag loads devtools extensions on WOA (#31714)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-04 19:46:49 -04:00
Pedro Pontes
8417c5ae41 chore: cherry-pick 656c2769c5 from v8 (#31677)
Co-authored-by: Electron Bot <electron@github.com>
2021-11-04 16:07:57 +09:00
trop[bot]
4f3003dd40 fix: incorrect Content-Disposition serialization (#31692)
* fix: incorrect Content-Disposition serialization

* test: fixup test

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-04 10:00:28 +09:00
Pedro Pontes
38ca1aeab7 chore: cherry-pick 91dd4f79ab5b from chromium (#31681)
* chore: cherry-pick 91dd4f79ab5b 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-11-03 13:44:14 -04:00
Pedro Pontes
a6636c3ca6 chore: cherry-pick 014e1f857c33 from v8 (#31672)
* chore: cherry-pick 014e1f857c33 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-11-03 20:39:22 +09:00
Pedro Pontes
20c63a644b chore: cherry-pick 45f9dcf5021d from chromium (#31670)
* chore: cherry-pick 45f9dcf5021d from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-03 20:39:07 +09:00
Pedro Pontes
e446b29afb chore: cherry-pick feef10137b16 from v8 (#31664)
* chore: cherry-pick feef10137b16 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-02 13:29:56 -04:00
trop[bot]
a5c6a79a08 fix: crash on close window when webContents destroyed (#31645)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-01 16:50:03 -04:00
Milan Burda
bb418b6e06 chore: update chore_add_context_to_context_aware_module_prevention.patch (#31579) (#31627)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2021-11-01 16:43:41 -04:00
Shelley Vohr
8638e8cea9 fix: silent print settings (#31617) 2021-11-01 10:03:49 -04:00
Pedro Pontes
cb206b8a9f chore: cherry-pick 0894af410c4e from chromium (#31544)
* chore: cherry-pick 0894af410c4e 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-26 17:45:28 +09:00
trop[bot]
47364ace72 build: retry hasher function if it fails first time (#31580)
* build: retry hasher function if it fails first time

* Update script/release/get-url-hash.js

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>

Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-10-26 17:41:33 +09:00
trop[bot]
7746f1d13e docs: win.getParentWindow() returns BrowserWindow | null (#31575)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-26 17:38:33 +09:00
Pedro Pontes
58dd15f165 chore: cherry-pick 36028012d897 from chromium (#31540)
Co-authored-by: Electron Bot <electron@github.com>
2021-10-25 13:28:58 -04:00
trop[bot]
d9a25cff7c fix: MediaMetadata not working properly (#31533)
* 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:01:14 +02:00
Pedro Pontes
018bee38bc chore: cherry-pick 8af66de55aad from chromium (#31524)
* chore: cherry-pick 8af66de55aad from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-25 09:47:33 +09:00
Pedro Pontes
9f76b99382 chore: cherry-pick c69dddfe1cde from chromium (#31520)
* 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:22 +09:00
trop[bot]
35be7656ba fix: black window on screen capture when content protection is enabled (#31551)
Co-authored-by: Micha Hanselmann <mhanselmann@microsoft.com>
2021-10-22 21:16:23 +09:00
Pedro Pontes
eecda4656e chore: cherry-pick 6de4e210688e from v8 (#31502)
* chore: cherry-pick 6de4e210688e from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-22 21:14:52 +09:00
Pedro Pontes
22bd03d54b chore: cherry-pick 29be6884cb8a from v8 (#31517) 2021-10-21 15:45:35 -04:00
Pedro Pontes
a641468b12 chore: cherry-pick 2e7c9b33453b from chromium (#31498) 2021-10-21 15:18:18 -04:00
Pedro Pontes
2764c06d0e chore: cherry-pick 8a822e28adea from pdfium (#31494) 2021-10-21 15:04:49 -04:00
trop[bot]
0d6a3d27c2 fix: event with invalid timestamp in trace log (#31421)
* fix: event with invalid timestamp in trace log

When node is started within Electron's environment it doesn't
initialize v8 and time of v8's start is never set. As a result
we log v8's start time as 0 and it breaks timestamps in the
trace log. With this change we log v8's start time only when
it was initialized by node.

* fixup patch for 14-x-y

Co-authored-by: Cezary Kulakowski <cezary@openfin.co>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-10-21 14:44:02 -04:00
trop[bot]
76e9225c2b feat: warn when ipcRenderer.sendSync() called with no listeners for channel (#31433)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-21 09:09:17 +09:00
trop[bot]
1e23632184 fix: ensure TracingAgent in place for SWs (#31475)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-10-21 09:08:04 +09:00
Sudowoodo Release Bot
c2b3c974e0 Bump v14.2.0 2021-10-20 09:56:28 -07:00
trop[bot]
9062352dd8 fix: don't use private enterprise APIs in MAS build (#31487)
* fix: don't use private enterprise APIs in MAS build

* Update .patches

Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-10-20 09:19:02 -07:00
trop[bot]
ca1d4784b7 fix: link to image windows progress bar image was linked with square brackets [] insted of parenthesis () and to github asset storage instead of local image directory. (#31471)
Co-authored-by: Daniel Ramp <12480131+DanielRamp@users.noreply.github.com>
2021-10-19 20:40:31 +09:00
trop[bot]
857f5a8794 Avoid Undefined Variable In printToPdf Example (#31464)
Co-authored-by: universalstrapping <90921972+universalstrapping@users.noreply.github.com>
2021-10-19 17:41:50 +09:00
trop[bot]
90c5f930fa fix: add isDestroyed check (#31467)
* Added isDestroyed check

fix: https://github.com/electron/electron/issues/31196

* fix: unregister frame name

Unregister the frame name so that we do not accidentally unregister the wrong window later on in case there is a timing issue with the events

* fix; check if webContents is destroyed

* fix: check if window/webContents is destroyed

Co-authored-by: Cheng Zhao <github@zcbenz.com>

Co-authored-by: t57ser <seve@live.at>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2021-10-19 17:40:30 +09:00
Cheng Zhao
c5a7ccc48b fix: generate valid config.gypi (#31443)
* fix: generate valid config.gypi

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-18 12:20:24 -05:00
trop[bot]
d8802f8b4c chore: refactor persisting permission granted to serial ports (#31440)
(cherry picked from commit 515785aabe)

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-10-18 10:42:36 -04:00
trop[bot]
6fd689eb11 fix: also pass securityOrigin to media permissions request handler (#31436)
Co-authored-by: Maxime Serrano <mserrano@alumni.cmu.edu>
2021-10-15 13:32:27 +09:00
trop[bot]
2eb43ede35 fix: reset render_frame_disposed_ after render frame host change (#31425)
* fix: reset render_frame_disposed_ after hang

* fix: handle exception in webContents.send

Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-10-15 09:06:57 +09:00
trop[bot]
15454fd693 fix: mac window crash native theme update (#31428)
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2021-10-15 09:06:21 +09:00
trop[bot]
de1eef75dc docs: update Versioning doc (#31387)
* fix information

* move historical section to bottom

* Update docs/tutorial/electron-versioning.md

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

* chore: fix small typo

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2021-10-13 11:25:13 +09:00
trop[bot]
7a3541d5af fix: correctly notify WebViewGuestDelegate when webview is detached (#31374)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-10-11 14:36:11 +09:00
trop[bot]
6be63fe11e chore: add logging for print_backend failures (#31287)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-10-11 14:33:02 +09:00
trop[bot]
bd6b139b16 docs: add missing 'context-menu' event to webview-tag.md (#31310)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-11 14:28:36 +09:00
Pedro Pontes
911f966be3 chore: cherry-pick 3a5bafa35def from chromium (#31364)
* 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:22 +09:00
Pedro Pontes
5302dcf5ed chore: cherry-pick b2c4e4dc21e5 from chromium (#31362)
* 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:47:06 +09:00
trop[bot]
25159f3ee1 fix: crash on missing render frame (#31333)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-10-11 09:34:32 +09:00
Pedro Pontes
042f00d25a chore: cherry-pick 6a8a2098f9fa from chromium (#31230)
* chore: cherry-pick 6a8a2098f9fa from chromium

* chore: update patches

* fix: cherry-pick 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-10 05:41:58 -07:00
Pedro Pontes
dfc9cb6e7f chore: cherry-pick 6584528aeb0f0 from webrtc and 36e370cf4db9a from chromium (#31358)
* chore: cherry-pick 6584528aeb0f0 from webrtc and 36e370cf4db9a from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-09 23:25:09 -07:00
Sudowoodo Release Bot
3b1127ccbd Bump v14.1.1 2021-10-08 14:09:22 -07:00
Sudowoodo Release Bot
efdce183d2 Revert "Bump v14.1.1"
This reverts commit f1455d26a8.
2021-10-08 14:08:26 -07:00
Sudowoodo Release Bot
f1455d26a8 Bump v14.1.1 2021-10-08 12:48:16 -07:00
Sudowoodo Release Bot
ed04f73fc2 Revert "Bump v14.1.1"
This reverts commit 34ee012262.
2021-10-08 12:47:19 -07:00
Sudowoodo Release Bot
34ee012262 Bump v14.1.1 2021-10-08 11:17:27 -07:00
Sudowoodo Release Bot
154aee0f3d Revert "Bump v14.1.1"
This reverts commit fb6e837110.
2021-10-08 09:47:07 -07:00
Sudowoodo Release Bot
fb6e837110 Bump v14.1.1 2021-10-08 09:42:52 -07:00
Robo
01dd6b61ba refactor: only access memory coordinator interface from browser process (#31295) (#31304)
Refs https://chromium-review.googlesource.com/c/chromium/src/+/3174305
2021-10-06 15:42:23 -07:00
trop[bot]
a13ea19b3c fix: return HTNOWHERE in resize hit test to allow draggable regions to kick in when required (#31298)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-10-06 09:22:32 +09:00
Pedro Pontes
d5537f620e chore: cherry-pick f2fd53c6d706 from chromium (#31242)
* chore: cherry-pick f2fd53c6d706 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 07:02:26 -07:00
Pedro Pontes
951c8322a5 chore: cherry-pick 096afc1c5428 from chromium (#31245)
* 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:02:40 -07:00
Pedro Pontes
0c78c21c13 chore: cherry-pick 4e528a5a8d83 from chromium (#31239)
* 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:11 -07:00
Pedro Pontes
bf1fada136 chore: cherry-pick e8cb0e7aa32 from angle (#31235) 2021-10-03 23:47:21 -07:00
Pedro Pontes
40b994cfab chore: cherry-pick 5c4acf2ae64a from v8 (#31227)
* chore: cherry-pick 5c4acf2ae64a from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-03 23:37:30 -07:00
trop[bot]
6ec7b15b06 fix: dialog is not defined (#31271)
Corrects the following error in Electron Fiddle:

```
Uncaught Exception:
ReferenceError: dialog is not defined
...
```

Co-authored-by: Ryan Johnson <CITguy@users.noreply.github.com>
2021-10-04 12:14:48 +09:00
Robo
78c2f495ad fix: remove expired DST Root CA X3 (#31221)
* Revert "fix: Enable X509_V_FLAG_TRUSTED_FIRST flag in BoringSSL (#31216)"

This reverts commit 0742df7436.

* fix: remove expired DST Root CA X3
2021-10-04 09:57:50 +09:00
Sudowoodo Release Bot
02ce2d108c Bump v14.1.0 2021-09-30 14:02:25 -07:00
trop[bot]
0742df7436 fix: Enable X509_V_FLAG_TRUSTED_FIRST flag in BoringSSL (#31216)
* 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

Co-authored-by: Juan Cruz Viotti <jv@jviotti.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-09-30 17:00:02 -04:00
Pedro Pontes
a739737d0f chore: cherry-pick f8a74d72f328 from chromium (#31210)
* chore: cherry-pick f8a74d72f328 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-30 15:33:22 -04:00
trop[bot]
6230d95684 fix: draggable regions in BrowserViews are independent (#31200)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-30 11:02:43 -04:00
trop[bot]
54e103afa5 feat: add support for WebHID (#31192)
* feat: add support for WebHID (#30213)

* feat: add support for WebHID

* Apply suggestions from code review

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

* Address review feedback

* Address review feedback

* chore: clear granted_devices on navigation

Also added test to verify devices get cleared

* fixup testing for device clear

* make sure navigator.hid.getDevices is run on correct frame

* clear granted devices on RenderFrameHost deletion/change

* manage device permissions per RenderFrameHost

This change makes sure we don't clear device permission prematurely due to child frame navigation

* Update shell/browser/api/electron_api_web_contents.cc

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

* apply review feedback from @zcbenz

* Match upstream ObjectMap

This change matches what ObjectPermissionContextBase uses to cache object permissions: https://source.chromium.org/chromium/chromium/src/+/main:components/permissions/object_permission_context_base.h;l=52;drc=8f95b5eab2797a3e26bba299f3b0df85bfc98bf5;bpv=1;bpt=0

The main reason for this was to resolve this crash on Win x64:
ok 2 WebContentsView doesn't crash when GCed during allocation
Received fatal exception EXCEPTION_ACCESS_VIOLATION
Backtrace:
        gin::WrappableBase::SecondWeakCallback [0x00007FF6F2AFA005+133] (o:\gin\wrappable.cc:53)
        v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacks [0x00007FF6F028F9AB+171] (o:\v8\src\handles\global-handles.cc:1400)
        v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacksFromTask [0x00007FF6F028F867+391] (o:\v8\src\handles\global-handles.cc:1387)
        node::PerIsolatePlatformData::RunForegroundTask [0x00007FF6F3B4D065+317] (o:\third_party\electron_node\src\node_platform.cc:415)
        node::PerIsolatePlatformData::FlushForegroundTasksInternal [0x00007FF6F3B4C424+776] (o:\third_party\electron_node\src\node_platform.cc:479)
        uv_run [0x00007FF6F2DDD07C+492] (o:\third_party\electron_node\deps\uv\src\win\core.c:609)
        electron::NodeBindings::UvRunOnce [0x00007FF6EEE1E036+294] (o:\electron\shell\common\node_bindings.cc:631)
        base::TaskAnnotator::RunTask [0x00007FF6F2318A19+457] (o:\base\task\common\task_annotator.cc:178)
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl [0x00007FF6F2E6F553+963] (o:\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:361)
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork [0x00007FF6F2E6EC69+137] (o:\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:266)
        base::MessagePumpForUI::DoRunLoop [0x00007FF6F235AA58+216] (o:\base\message_loop\message_pump_win.cc:221)
        base::MessagePumpWin::Run [0x00007FF6F235A01A+106] (o:\base\message_loop\message_pump_win.cc:79)
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run [0x00007FF6F2E702DA+682] (o:\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:470)
        base::RunLoop::Run [0x00007FF6F22F95BA+842] (o:\base\run_loop.cc:136)
        content::BrowserMainLoop::RunMainMessageLoop [0x00007FF6F14423CC+208] (o:\content\browser\browser_main_loop.cc:990)
        content::BrowserMainRunnerImpl::Run [0x00007FF6F144402F+143] (o:\content\browser\browser_main_runner_impl.cc:153)
        content::BrowserMain [0x00007FF6F143F911+257] (o:\content\browser\browser_main.cc:49)
        content::RunBrowserProcessMain [0x00007FF6EFFA7D18+112] (o:\content\app\content_main_runner_impl.cc:608)
        content::ContentMainRunnerImpl::RunBrowser [0x00007FF6EFFA8CF4+1220] (o:\content\app\content_main_runner_impl.cc:1104)
        content::ContentMainRunnerImpl::Run [0x00007FF6EFFA87C9+393] (o:\content\app\content_main_runner_impl.cc:971)
        content::RunContentProcess [0x00007FF6EFFA73BD+733] (o:\content\app\content_main.cc:394)
        content::ContentMain [0x00007FF6EFFA79E1+54] (o:\content\app\content_main.cc:422)
        wWinMain [0x00007FF6EECA1535+889] (o:\electron\shell\app\electron_main.cc:291)
        __scrt_common_main_seh [0x00007FF6F6F88482+262] (d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
        BaseThreadInitThunk [0x00007FFEC0087034+20]
        RtlUserThreadStart [0x00007FFEC1F02651+33]
✗ Electron tests failed with code 0xc0000005.

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
(cherry picked from commit 6aece4a83d)

* fixup for 14-x-y

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-09-30 09:52:00 -04:00
trop[bot]
00969fe1e5 fix: BrowserView drag now delegates to the OS when possible (#31176)
Co-authored-by: @anulman <@anulman>
2021-09-30 08:39:21 -04:00
Keeley Hammond
447c073788 chore: remove gin::Wrappable crash keys (#31075) (#31188) 2021-09-29 17:20:31 -04:00
Keeley Hammond
fed38c1c01 fix: ensure web_contents() is alive before grabbing view (#31187) 2021-09-29 17:18:22 -04:00
Sudowoodo Release Bot
086aea1ad8 Bump v14.0.2 2021-09-29 08:21:36 -07:00
Milan Burda
fac32ebde4 fix: running tests with release build (#31148)
* fix: running tests with release build (#31092)

* Update electron_api_v8_util.cc

https://github.com/electron/electron/pull/31155

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-09-29 11:19:45 -04:00
Sudowoodo Release Bot
83bafaeede Revert "Bump v14.0.2"
This reverts commit 9ea58e456c.
2021-09-29 06:57:33 -07:00
Sudowoodo Release Bot
9ea58e456c Bump v14.0.2 2021-09-29 06:22:47 -07:00
Shelley Vohr
4831aa56bf fix: ensure set vibrancy with invalid value is a no-op (#31162)
* 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 11:42:32 +02:00
trop[bot]
717a3f4c40 fix: crash in v8 due to regexp reentrancy (#31143)
* 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 15:20:57 -07:00
trop[bot]
c7b4f41a59 refactor: use native WeakRef instead of v8util.weaklyTrackValue() (#31164)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-09-28 10:15:55 +02:00
trop[bot]
cd0792c6e8 fix: avoid double free when destroying WebContents (#31131)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-09-28 10:11:36 +02:00
trop[bot]
6595bc726e fix: .lldbinit config stale (unavailable) (#31160)
Co-authored-by: Black-Hole1 <158blackhole@gmail.com>
2021-09-28 09:53:45 +02:00
trop[bot]
81298886f7 fix: first mouse not dragging BrowserView (#31099)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-27 21:26:36 +02:00
Darshan Sen
a7ce797bce refactor: make InitWithWebContents and InspectableWebContents take a unique_ptr (#31125) 2021-09-27 09:26:24 +02:00
trop[bot]
78a1e4d1dd fix: startDrag params type incorrect (#31082)
Co-authored-by: Black-Hole1 <158blackhole@gmail.com>
2021-09-23 19:50:21 +09:00
trop[bot]
98ed314d55 fix: update Windows' cache after changing window's style (#31079)
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:48:54 +09:00
trop[bot]
f410e43a14 fix: proper localization when using GtkFileChooserNative (#31065)
* fix: proper localization when using GtkFileChooserNative

* fix: iwyu

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-23 16:35:58 +09:00
trop[bot]
e0ff967bfb docs: update glossary (#31055)
* docs: update glossary

* remove nsis entry

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-09-23 16:32:29 +09:00
trop[bot]
43e47a8e53 chore: clarify new-window fix comment (#31071)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-09-22 17:26:58 -07:00
trop[bot]
84d81df878 fix: prevent navigator.fonts.query() from crashing (#30984)
* fix: prevent navigator.fonts.query() from crashing

* refactor: use base::PostTask instead

* Update .patches

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-09-22 14:17:28 -04:00
trop[bot]
29f6a92a76 fix: propagate window.open settings to child window (#31048)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-09-22 09:31:44 +09:00
trop[bot]
3819a78a97 fix: maximized state calculation for non-resizable windows (#31040)
* 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:29:03 +09:00
trop[bot]
b286bf5ba6 docs: update public timeline for E16 (#31050)
Co-authored-by: Sofia Nguy <sofianguy@gmail.com>
2021-09-21 14:36:46 -07:00
trop[bot]
6297655df6 fix: suppress insecure resource warning for more local hostnames (#31037) 2021-09-21 10:47:11 +02:00
trop[bot]
33b8d5195e fix: disabling and enabling resizability on macOS (#31013)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-20 09:35:14 +09:00
trop[bot]
c7e36d778e fix: links to images (#31004)
Images that used the inline link format do not show up on Docusaurus or
the old website infrastructure. There are only 2 guides using it so it
is faster to change the format rather than figuring out why the parsin
logic does not work.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Ref: https://github.com/electron/electronjs.org-new/issues/84

Co-authored-by: Antón Molleda <amolleda@gmail.com>
2021-09-17 16:48:42 +09:00
trop[bot]
1b64468510 fix: add casing for WCO edge (#30994)
Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
2021-09-17 16:48:00 +09:00
trop[bot]
9838ace413 chore: update links of documentation of chromes (#31007)
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:47:26 +09:00
electron-roller[bot]
f9cba8a120 chore: bump chromium to 93.0.4577.82 (14-x-y) (#30954)
* chore: bump chromium in DEPS to 93.0.4577.82

* 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-09-16 15:34:32 -04:00
trop[bot]
c8ec178176 fix: always include pepper flash font file (#30971)
Co-authored-by: Micha Hanselmann <micha.hanselmann@gmail.com>
2021-09-16 09:29:54 +09:00
Keeley Hammond
7a08807887 chore: update E14 node module version (#30772)
Ref: https://github.com/nodejs/node/pull/39950/files
2021-09-15 16:33:03 -07:00
trop[bot]
d1afbaa6c9 chore: correct hierarchy of BrowserWindow headings (#30972)
* chore: correct hierarchy of BrowserWindow headings

* Update docs/api/browser-window.md

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

* Update docs/api/browser-window.md

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

* Update docs/api/browser-window.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-09-15 15:41:52 +09:00
trop[bot]
5b221b1084 docs: update context isolation doc (#30976)
* docs: update context isolation doc

* Apply suggestions from code review

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

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2021-09-15 15:40:48 +09:00
Sudowoodo Release Bot
735a01edce Bump v14.0.1 2021-09-13 08:47:43 -07:00
trop[bot]
5e9dca52a5 refactor: remove dead code in NeedsCompleteGpuInfoCollection (#30876)
Refs https://chromium-review.googlesource.com/c/chromium/src/+/1208362

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-08 15:19:38 +09:00
Mark Lee
6f67e50242 docs(protocols): simplify packaging section & cleanup (#30882)
Backport of #30832
2021-09-08 15:18:47 +09:00
trop[bot]
5451744c64 docs: Update windows info for auto-updater (#30869)
Squirrel.Mac can be served from a static host as well.

Co-authored-by: Finn Behrens <me@kloenk.dev>
2021-09-08 08:44:15 +09:00
trop[bot]
8c4f467c8c fix: show maximized frameless window (#30864)
* 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-07 17:02:38 +02:00
trop[bot]
81ee511031 docs: updated webview tag documentation to accurately reflect preload behavior with asar archives (#30849)
Co-authored-by: ike <isaactaylor124@gmail.com>
2021-09-06 19:18:25 +09:00
trop[bot]
1bdd60e91b fix: devtools not resizable on Windows (#30847)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-06 19:17:18 +09:00
trop[bot]
cffc1a2381 fix: BrowserWindow backgroundColor (#30819)
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-09-03 13:50:11 -07:00
Samuel Maddock
9799589648 fix: remove CHECK_EQ for swapped RFH (#30820)
|old_host| may be nullptr if the previous RFH was shutdown.
2021-09-03 13:48:51 -07:00
Erick Zhao
c0da647170 docs: fix code example in process-model.md (#30690) (#30800)
* Update process-model.md

the demo have two error:
- at macos, close all window, the app will not quite, unless press cmd + q
- attach preload.js, use preload prop that is member of `webPreferences` property of `BrowserWindow` controller argument

* Update docs/tutorial/process-model.md

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

Co-authored-by: Cheng Zhao <github@zcbenz.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>

Co-authored-by: Cheng Zhao <github@zcbenz.com>
2021-09-01 16:53:18 -07:00
electron-roller[bot]
4553ce050f chore: bump chromium to 93.0.4577.63 (14-x-y) (#30794)
* chore: bump chromium in DEPS to 93.0.4577.63

* 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-09-01 15:03:49 -04:00
trop[bot]
bdf156894a ci: ignore pdb download failure (#30795)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-09-01 13:25:12 -04:00
trop[bot]
d2da6de114 fix(linux): OpenURI portal support for shell.showItemInFolder() (#30783)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-01 20:49:09 +09:00
trop[bot]
42d8be64fc docs: improve documentation about macOS entitlement usage security (#30780)
Co-authored-by: ComplexSpaces <complexspacescode@gmail.com>
2021-09-01 20:47:26 +09:00
trop[bot]
663a260976 docs: add remote removal to E14 breaking changes (#30771)
* docs: add remote removal to E14 breaking changes

* docs: trigger lint check

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2021-08-31 11:50:55 -07:00
Sudowoodo Release Bot
9aa2608ca7 Bump v14.0.0 2021-08-30 12:40:15 -07:00
trop[bot]
8c6240ad4a fix: repl crash when SharedArrayBuffer disabled (#30484)
* repl: fix crash when SharedArrayBuffer disabled

* fixup node .patches file

* update patch for 14-x-y

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-30 12:21:33 -07:00
electron-roller[bot]
1d84b38c71 chore: bump chromium to 93.0.4577.58 (14-x-y) (#30695)
* chore: bump chromium in DEPS to 93.0.4577.58

* 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-08-30 14:04:26 -04:00
trop[bot]
3cdb74e9bd feat: add webContents.fromDevToolsTargetId() (#30732)
* feat: add webContents.fromDevToolsTargetId()

* refactor: avoid using FromOrCreate

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-08-30 12:43:45 -04:00
John Kleinschmidt
9cc2d3f60e 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>
2021-08-30 10:08:00 -04:00
Sudowoodo Release Bot
d73539bbc4 Bump v14.0.0-beta.25 2021-08-30 06:32:09 -07:00
Jeremy Rose
b4d7fbcb04 fix: remove ipc wrapper for nativeImage.createThumbnailFromPath (#30735) 2021-08-30 19:31:56 +09:00
Sudowoodo Release Bot
7cb4a7a298 Bump v14.0.0-beta.24 2021-08-26 06:33:19 -07:00
trop[bot]
43d3395f39 docs: explain the null webContents case in permission checks (#30687)
* 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:57 +09:00
trop[bot]
f2a04508c3 fix: titlebar and buttons state under simple fullscreen (#30707)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-08-26 15:46:52 +09:00
trop[bot]
832c6c0296 fix: change gin::Wrappable crash key type to ScopedCrashKey (#30609)
* fix: change gin_wrappable to scoped crash key

* fix: build dependency

Dependency was missed in cbeae20438

Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-08-26 08:29:24 +09:00
trop[bot]
7c52bd6a7f fix: media key globalShortcuts on macOS (#30569)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-25 15:24:30 +02:00
trop[bot]
2cbacddea6 fix: crash when using TouchBarScrubber arrow button (#30679)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-25 10:05:38 +09:00
electron-roller[bot]
a279250935 chore: bump chromium to 93.0.4577.51 (14-x-y) (#30520)
* chore: bump chromium in DEPS to 93.0.4577.42

* ci: update git on CI machines

(cherry picked from commit 9b2e028f50)

* chore: update patches

* test fix for (unrelated) bug showing up on linux-asan

(cherry picked from commit a65d2dacd3)

* Disable kDesktopCaptureMacV2

https: //chromium-review.googlesource.com/c/chromium/src/+/3069272
(cherry picked from commit 4b308cb8c37b8d84bce8f037d11c242ce9d45845)
Co-Authored-By: Robo <hop2deep@gmail.com>

* chore: fix lint

(cherry picked from commit ed0d9adef6b9c5fb8c2b4bcf6783a3bd58605d51)

* fixup Disable kDesktopCaptureMacV2

* chore: bump chromium in DEPS to 93.0.4577.51

* chore: update patches

* Disable kDesktopCaptureMacV2

https://chromium-review.googlesource.com/c/chromium/src/+/3069272
(cherry picked from commit 205e477037)

* ci: run main and remote woa tests separately

(cherry picked from commit 1de8f746b5)

* fixup! Disable kDesktopCaptureMacV2

(cherry picked from commit bc6b974647)

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Robo <hop2deep@gmail.com>
2021-08-23 18:06:41 -04:00
Sudowoodo Release Bot
e52c9e3954 Bump v14.0.0-beta.23 2021-08-19 06:32:23 -07:00
trop[bot]
5b7c5add62 fix: WebFrameMain mojo pipe not reset (#30631)
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2021-08-19 16:55:47 +09:00
trop[bot]
c578d6f2de docs: typo in launch-app-from-url-in-another-app.md (#30627)
* 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:11:08 +09:00
trop[bot]
a5e4a23e41 fix: cross-origin navigation disposing WebFrameMain instances (#30599)
* 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:01 +09:00
trop[bot]
22b98cf390 fix: handle nullish WebContentsView in UpdateDraggableRegions (#30559)
* fix: handle nullish WebContentsView in UpdateDraggableRegions

* build: nogncheck on webcontentsimpl include

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-08-19 10:39:13 +09:00
trop[bot]
f229bc1032 docs: remove unused Desktop Environment Integration doc (#30620)
* 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 09:54:24 +09:00
trop[bot]
2f3ab58a12 docs: update Hazel information (#30622)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-19 09:53:20 +09:00
trop[bot]
627a29964c fix: {exit|enter}-html-fullscreen emitted after esc in webview (#30561)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-19 08:39:06 +09:00
trop[bot]
94f2a1d438 fix: documentEdited with non-default titlebarStyle (#30605)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-18 14:15:32 -07:00
Sudowoodo Release Bot
5cc4fb83b3 Bump v14.0.0-beta.22 2021-08-17 08:43:00 -07:00
Sudowoodo Release Bot
4048a580a6 Revert "Bump v14.0.0-beta.22"
This reverts commit 9b08950054.
2021-08-16 22:01:16 -07:00
trop[bot]
99af7e3f50 fix: persist BrowserView background color when bounds offscreen (#30541)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-16 15:09:30 -04:00
trop[bot]
fbe39223ef fix: disable kWindowCaptureMacV2 for desktopCapturer (#30524)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-08-16 11:17:35 -07:00
trop[bot]
d8ea9eed3e docs: uniformize tutorial titles (#30545)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-16 14:09:32 -04:00
trop[bot]
2567f30267 docs: clarify usage of option (#30549)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-16 14:05:42 -04:00
Sudowoodo Release Bot
9b08950054 Bump v14.0.0-beta.22 2021-08-16 06:31:47 -07:00
electron-roller[bot]
43490c6300 chore: bump chromium to 93.0.4577.25 (14-x-y) (#30349)
* chore: bump chromium in DEPS to 93.0.4577.18

* chore: update patches

* chore: bump chromium in DEPS to 93.0.4577.25

* 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>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-12 14:40:18 -04:00
Sudowoodo Release Bot
8fa3fc6731 Bump v14.0.0-beta.21 2021-08-12 06:37:10 -07:00
Keeley Hammond
e4fcbe9dc8 fix: explicitly define REFGUID from ::GUID&, not base::GUID (#30442) (#30499)
* 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:38 -07:00
trop[bot]
51d7e1138e ci: make arm64 macos test cleanup more resilient (#30501)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-11 17:47:02 -04:00
trop[bot]
2c0cfbfa55 docs: add missing <webview> event documentation (#30466)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-08-11 09:44:13 +09:00
trop[bot]
e89e3ec8b4 ci: cleanup keychain after tests on arm64 mac (#30476)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-11 09:43:08 +09:00
trop[bot]
85e565f97f docs: fix camelcase in menu example (#30462)
* 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:05 +09:00
trop[bot]
b3cca6e88d fix: mouse doesn't work on frameless browserwindows (#30459)
Fixes #30402. This bug is from the "CanResize has been de-virtualized"
refactor in https://github.com/electron/electron/pull/29256

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-08-11 09:37:49 +09:00
trop[bot]
702f30c584 chore: more crash-keys for gin::Wrappable debugging (#30422)
* 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:31 +09:00
Electron Bot
2d8df9c5ba Bump v14.0.0-beta.20 2021-08-09 06:32:25 -07:00
trop[bot]
0ce4455092 build: rebase release branch before reverting bump (#30417)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-08-09 09:54:55 +02:00
trop[bot]
c3403299fe fix: move window buttons in-place on macOS (#30391)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-08-09 16:00:13 +09:00
Electron Bot
4de9d115bf Bump v14.0.0-beta.19 2021-08-05 06:32:12 -07:00
trop[bot]
b31441505e fix: console window popping up when --enable-logging passed on windows (#30385)
* fix: console window popping up when --enable-logging passed on windows

* chore: update patches

* clang format

* chore: update patches

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-05 08:58:37 +09:00
trop[bot]
94c5348c1e build: fix building with enable_desktop_capturer = false (#30388)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-08-04 09:55:52 +09:00
Electron Bot
36226a4e0e Bump v14.0.0-beta.18 2021-08-02 06:31:37 -07:00
trop[bot]
08f5ef174a docs: mention sandboxing in security docs (#30191)
* docs: mention sandboxing in security docs

* link to sandboxing tutorial

* Update security.md

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-08-02 11:24:15 +09:00
trop[bot]
8161ae8c93 fix: handle redirects within registered protocols (#30156)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-08-02 10:29:36 +09:00
trop[bot]
36b8e297da fix: respect LogJsConsoleMessages feature in InspectableWebContents::DidAddMessageToConsole (#30312) (#30355)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-08-02 09:59:58 +09:00
trop[bot]
dd244958c7 fix: use contentAspectRatio not aspectRatio (#30331)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-02 09:58:54 +09:00
trop[bot]
1222d12d1e chore: remove experimental from navigator.serial implementation (#30333)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-02 09:58:23 +09:00
trop[bot]
207c158536 fix: guard against missing native view (#30327)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-02 09:57:43 +09:00
trop[bot]
f73d55bb6c build: set the export goma auth fallback flag for the control process (#30318)
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-08-02 09:56:58 +09:00
trop[bot]
773783e006 chore: update deps (#30344)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-07-30 14:56:29 -07:00
trop[bot]
4eedc68ec6 fix: BrowserViews not painting their WebContents (#30335)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-30 02:23:23 -07:00
electron-roller[bot]
de679a181a chore: bump chromium to 93.0.4577.15 (14-x-y) (#30029)
* chore: bump chromium in DEPS to 93.0.4567.0

* chore: update patches

* chore: bump chromium in DEPS to 93.0.4568.0

* chore: bump chromium in DEPS to 93.0.4569.0

* chore: update patches

(cherry picked from commit e710b8ea15f0ec08966e89d37e6ff73414180e6b)

* 3000931: Code health: remove base::ListValue from DevToolsEmbedderMessageDispatcher

https://chromium-review.googlesource.com/c/chromium/src/+/3000931
(cherry picked from commit 44c00b98f27621f6345bcf5d78f3e2649147135b)

* chore: bump chromium in DEPS to 93.0.4570.0

* chore: update patches

* chore: bump chromium in DEPS to 93.0.4571.0

* chore: update patches

* chore: bump chromium in DEPS to 93.0.4573.0

* chore: bump chromium in DEPS to 93.0.4574.0

* chore: bump chromium in DEPS to 93.0.4575.0

* chore: bump chromium in DEPS to 93.0.4576.0

* chore: bump chromium in DEPS to 93.0.4577.0

* chore: bump chromium in DEPS to 93.0.4577.3

* chore: bump chromium in DEPS to 93.0.4577.4

* 3011898: Reland "Roll src/buildtools/third_party/libc++/trunk/ 8fa879467..79a2e924d (426 commits)"

https://chromium-review.googlesource.com/c/chromium/src/+/3011898
(cherry picked from commit c46148eed8)

* 2974072: Swap base/stl_util.h to base/cxx17_backports.h in many files.

https://chromium-review.googlesource.com/c/chromium/src/+/2974072
(cherry picked from commit 4d725e44ca)

* chore: add missing header

(cherry picked from commit f3993e71ce)

* Reland "Roll src/buildtools/third_party/libc++/trunk/ 8fa879467..79a2e924d (426 commits)"

https://chromium-review.googlesource.com/c/chromium/src/+/2988699
(cherry picked from commit 797723ec83)
(cherry picked from commit 4a325c9b24)

* 2925476: Migrate t/b/{public,renderer}/platform/media to blink ns [4/6]

https://chromium-review.googlesource.com/c/chromium/src/+/2925476
(cherry picked from commit 0930c0ee41)

* 2974074: Remove base/cxx17_backports.h from stl_util.h.

https://chromium-review.googlesource.com/c/chromium/src/+/2974074
(cherry picked from commit a7b53b61f4)

* fixup: 2974074: Remove base/cxx17_backports.h from stl_util.h.

(cherry picked from commit af5da4dcb1)

* chore: update patches

* fix: invalid operands compilation error

(cherry picked from commit 6fa6f8acb9)

* 3001416: Fix -Wimplicit-int-float-conversion.

https://chromium-review.googlesource.com/c/chromium/src/+/3001416
(cherry picked from commit b2e9f2212e)

* 3022548: Removing windows.h includes from some base headers

https://chromium-review.googlesource.com/c/chromium/src/+/3022548
(cherry picked from commit 8b48103907)

* 3029258: Remove unused JobEventDetails::Type enum values

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

Cherry picked from c15df3a109

Co-Authored-By: Shelley Vohr <shelley.vohr@gmail.com>

* 3029185: printing: Use mojom::PrinterType instead of PrinterType

https://chromium-review.googlesource.com/c/chromium/src/+/3029185
(cherry picked from commit d16fab76fb)

* Update application_info_win.cc

(cherry picked from commit 6e187f8617)

* include windows.h in process_singleton_win.cc

(cherry picked from commit af58ad2d9d)

* chore: bump chromium in DEPS to 93.0.4577.8

* chore: update patches

* do not create a new UserScriptManager every time the accessor is called

(cherry picked from commit 24a71035ab)

* chore: Revert "Roll clang llvmorg-13-init-14732-g8a7b5ebf-2 :  llvmorg-13-init-15040-gc10947b5-1"

* chore: remove no longer needed patch

* Update the "py" wheel to a version that is compatible with pytest-6.2.2.

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

* chore: bump chromium in DEPS to 93.0.4577.15

* chore: update patches

* chore: fixup parallel/test-errors-systemerror node test

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-29 11:09:43 -04:00
Electron Bot
c04cfe3986 Revert "Bump v14.0.0-beta.18"
This reverts commit c9ebf6dc56.
2021-07-29 06:50:40 -07:00
Electron Bot
c9ebf6dc56 Bump v14.0.0-beta.18 2021-07-29 06:31:17 -07:00
trop[bot]
62e4493d1c chore: update publish to npm to use GitHub token (#30291)
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:41 -07:00
trop[bot]
f9d4b7d709 fix: update traffic lights position for macOS 11 (#30269)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-07-28 12:01:59 +02:00
trop[bot]
38cf678ec2 fix: Add missing items to menuItem.role documentation (#30303) 2021-07-28 11:54:59 +02:00
trop[bot]
ea17c915af docs: update default branch for Electron Packager API links (#30186)
Co-authored-by: Mark Lee <electronjs@lazymalevolence.com>
2021-07-27 09:17:11 +09:00
trop[bot]
32c14a8255 fix: allow colored tray titles when font type is specified (#30164)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-27 09:15:37 +09:00
Electron Bot
e38d14e6ac Bump v14.0.0-beta.17 2021-07-26 06:32:08 -07:00
trop[bot]
ee491c0719 fix: increase stack size on windows x86 (#30242)
* 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 20:19:33 +09:00
trop[bot]
e0c61ed1ae docs: update title of guide (#30259)
Co-authored-by: Antón Molleda <amolleda@gmail.com>
2021-07-26 20:18:37 +09:00
trop[bot]
5a8a4dd1eb chore: add additional crash key to gin::Wrappable (#30225)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-07-22 12:16:03 -04:00
trop[bot]
407a005ffb fix: process.exit crash in nativeWindowOpen (#30235)
* fix: process.exit crash in nativeWindowOpen

* spec: add regression crash case

* chore: fix main -> index

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-22 12:15:27 -04:00
Electron Bot
4d4346ce65 Bump v14.0.0-beta.16 2021-07-22 06:31:02 -07:00
trop[bot]
b158159351 build: handle release failure by existing with code 1 (#30222)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-07-21 11:13:13 -04:00
Electron Bot
4f75b0423a Bump v14.0.0-beta.15 2021-07-20 11:29:34 -07:00
trop[bot]
0c72bf0431 fix: BrowserWindow transparency not working (#30159)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-19 09:31:33 -07:00
Electron Bot
d8cdc5932f Bump v14.0.0-beta.14 2021-07-15 06:31:22 -07:00
trop[bot]
60778a7bf5 fix: use correct userData path when unbundled (#30142)
* fix: use correct userData path when unbundled

* fix linux

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-15 15:26:54 +09:00
trop[bot]
3ae3e53f7d docs: fix fiddle path (#30145)
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-15 15:26:25 +09:00
trop[bot]
3190771c2d docs: add runtime.reload as supported extension api (#30148)
* docs: Add runtime.reload as supported extension api

* Fix typo

Co-authored-by: Utkarsh <utkarsh@crusher.dev>
2021-07-15 15:25:57 +09:00
trop[bot]
34f9bdb8d3 fix: double traffic lights on exit fullscreen (#30150)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-15 15:25:13 +09:00
trop[bot]
341dd0518f fix: pressing ESC should exit fullscreen from webview (#30127)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-07-15 11:41:45 +09:00
trop[bot]
63bac14885 docs: add <webview> 'did-attach' event documentation (#30131)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-07-15 10:41:19 +09:00
trop[bot]
9e78d82f4a docs: update quick-start.md (#30134)
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:46 +09:00
trop[bot]
0bd4f67589 fix: crash when invoking login callback synchronously (#30090)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-14 20:47:16 +09:00
trop[bot]
05d71aead6 build: decode error output as utf8 (#30095)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-14 20:46:35 +09:00
trop[bot]
8ca6d978d3 fix: return RGBA values from getSystemColor (#30087)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-14 20:45:43 +09:00
trop[bot]
84fd791c04 docs: Update timeline for E15 alpha announcement (#30118)
* docs: Update timeline for E15 alpha announcement

* fix line break

Co-authored-by: Sofia Nguy <sofianguy@gmail.com>
2021-07-13 16:18:40 -07:00
trop[bot]
dac75c4094 chore: update releases to 8 weeks in CONTRIBUTING (#30120)
* 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-13 15:24:04 -07:00
trop[bot]
c8cc2d86ad spec: fix check for electron_common_testing binding in logging-spec.ts (#30104)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-07-13 12:15:00 -07:00
trop[bot]
ee29959ac4 test: disable failing node tests (#30097)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-13 09:05:17 -07:00
trop[bot]
2ae1c823cd chore: cherry-pick 9bab573a37 from chromium (#30101)
* 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:06:47 -07:00
Electron Bot
38ecb5d927 Bump v14.0.0-beta.13 2021-07-12 13:42:54 -07:00
Samuel Attard
bf28ac8990 Revert "Bump v14.0.0-beta.13"
This reverts commit 6699fea2db.
2021-07-12 13:31:12 -07:00
trop[bot]
39feb876df fix: window ordering on mac (#30066)
* fix: window ordering on mac

* chore: fix flaky fullscreen inheritance test

* chore: disable fullscreen test on mac arm

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-07-12 08:54:40 -07:00
trop[bot]
43a4299bd9 feat: add missing resourceType conversions for webRequest listener details (#30050)
* feat: add missing resourceType conversions for webRequest listener details

* chore: update patches

Co-authored-by: Milan Burda <milan.burda@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-07-09 15:43:29 -04:00
trop[bot]
de33e61874 docs: modernize protocol-handler docs (#30058)
* 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:35:59 -04:00
trop[bot]
8ea5dcd44f build: fix building with enable_plugins = false (#30049)
* build: fix building with enable_plugins = false

* chore: update patches

Co-authored-by: Milan Burda <milan.burda@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-07-08 11:09:55 -04:00
trop[bot]
2a5c47fea6 docs: mention contextIsolation in ipc-main example (#30032)
* docs: mention contextIsolation in ipc-main example

* chore: update patches

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-07-08 10:33:39 -04:00
trop[bot]
9abfbeecf1 feat: enable window controls overlay on macOS (#29986)
* 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: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-07-08 10:31:27 -04:00
Electron Bot
6699fea2db Bump v14.0.0-beta.13 2021-07-08 06:31:48 -07:00
trop[bot]
db789bed86 docs: match css filename in dark-mode.md (#30021)
* Update dark-mode.md

Fix the unmatched css file name

* Update docs/tutorial/dark-mode.md

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

Co-authored-by: Jenux <ijenux@gmail.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-07 15:01:36 +09:00
electron-roller[bot]
ae630f45b8 chore: bump chromium to 93.0.4566.0 (14-x-y) (#29979)
* chore: bump chromium in DEPS to 93.0.4562.0

* chore: update patches

* [base] Made Value::Take{Dict,List}() rvalue ref-qualified.

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

* Revert "Reland "Roll src/buildtools/third_party/libc++/trunk/ 8fa879467..79a2e924d (426 commits)""

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

This reverts commit 9691d6c265 and 797723ec83

* Pass gfx::Insets to GetHTComponentForFrame

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

* chore: bump chromium in DEPS to 93.0.4563.0

* chore: bump chromium in DEPS to 93.0.4564.0

* chore: bump chromium in DEPS to 93.0.4565.0

* chore: bump chromium in DEPS to 93.0.4566.0

* [Clipboard API] Clipboard Custom Formats implementation Part 2.

https://chromium-review.googlesource.com/c/chromium/src/+/2967649
(cherry picked from commit 607ca0a09b)

* Prevent use of base::NoDestructor for trivially-destructible types

https://chromium-review.googlesource.com/c/chromium/src/+/2998672
(cherry picked from commit 3983afda29)

* fixup! [Clipboard API] Clipboard Custom Formats implementation Part 2.

(cherry picked from commit 3a1dbc649c)

* chore: add missing header

(cherry picked from commit a291f4864e)

* chore: update patches

* ci: do not run clipboard tests on WOA

(cherry picked from commit 0e3aedfbde)

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: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-07-05 22:02:50 -04:00
trop[bot]
2b1f0ace7a docs: remove requestHeaders in webRequest.onHeadersReceived (#29934)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-07-06 10:34:32 +09:00
trop[bot]
2dfcbefcf3 fix: honor user-defined Downloads directory (#29967)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-06 10:32:44 +09:00
trop[bot]
fd09f5cd49 fix: do not leak NSUUID (#30008)
* fix: do not leak NSUUID

* Fix build error

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-07-05 12:52:47 -04:00
trop[bot]
0f45cd6938 fix: webview should maximize on requestFullscreen (#29989)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-07-05 12:28:23 -04:00
Electron Bot
678c8382e2 Bump v14.0.0-beta.12 2021-07-05 06:30:52 -07:00
Jeremy Rose
aab2479d94 feat: bring --enable-logging functionality in line with Chromium (#25089) (#29963)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-07-05 15:29:35 +09:00
trop[bot]
6b530bf62d docs: remove Experimental from contextBridge.exposeInMainWorld (#30011)
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:34 +09:00
trop[bot]
a32c39955e fix: self.module.paths not working in web workers (#30014)
* fix: global.module.paths in workers

* spec: add a regression test

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-05 15:26:59 +09:00
Erick Zhao
d27adae569 docs: added guide and updated docs for Tray (#29964)
* docs: added guide and updated docs for Tray (#29385) (#29762)

* docs: added guide and updated docs for Tray

* docs: improve clarity

* docs: fix frontmatter for Tray tutorial (#29788)

Co-authored-by: George Xu <33054982+georgexu99@users.noreply.github.com>
2021-07-05 08:47:20 +09:00
trop[bot]
2a3aa7ee0d docs: remove mention of node-mac-notifier (#30003)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-07-05 08:44:02 +09:00
trop[bot]
6d89edf590 fix: correctly propagate title updates for window with no navigation entries (#29959)
* 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:34 +09:00
trop[bot]
ebd1261e58 fix: potential crash on macOS app exit (#29962)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-02 08:43:40 +09:00
trop[bot]
9957887412 chore: set python interpreter to python3 in script/spec-runner.js (#29944)
The new installs of the python module, python-dbusmock, is broken for
python2. The tests still run fine on linux machine in Electron's
pipeline setup on CircleCI, because the docker image used has
the non-broken version of python-dbusmock for python2 installed.
But running electron tests on any other linux machine would fail if
they don't have this non-broken version of python-dbusmock for python2
installed, already, which is the case for most of the machines.
Moreover, Python2 is deprecated now. So it would be better if we change
the python interpreter in script/spec-runner.js file to python3, for
which all the python modules are updated and working.

Notes: none

Co-authored-by: Rituka Patwal <rituka.patwal@postman.com>
2021-07-01 17:27:30 -04:00
Samuel Attard
a5a8b92894 build: add support for spawning builds for a specific commit on appveyor (#29971) (#29973) 2021-07-01 10:09:53 -04:00
Electron Bot
94bce49d0f Bump v14.0.0-beta.11 2021-07-01 06:31:09 -07:00
electron-roller[bot]
4b59ebefb8 chore: bump chromium to 93.0.4557.4 (14-x-y) (#29954)
* chore: bump chromium in DEPS to 93.0.4557.4

* chore: update patches

* Fix warnings for -Wc++11-narrowing.

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

* chore: run gen-libc++-filenames.js

* Reland "Roll src/buildtools/third_party/libc++/trunk/ 8fa879467..79a2e924d (426 commits)"

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

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: Charles Kerr <charles@charleskerr.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-07-01 00:37:37 -07:00
trop[bot]
5a202219b6 fix: crash when clicking links with target=_blank from webview (#29949)
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-06-30 09:40:34 -07:00
Omar Kilani
f5392751d1 fix: geolocation crashes electron on macOS (#29343) (#29914) 2021-06-29 13:45:12 -07:00
trop[bot]
8486a73b86 chore: bump chromium to 93.0.4552.0 (14-x-y) (#29522)
* chore: bump chromium to 93.0.4550.0 (main) (#29751)

* chore: bump chromium to 93.0.4552.0 (main) (#29862)

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: Charles Kerr <charles@charleskerr.com>

Co-authored-by: deepak1556 <hop2deep@gmail.com>
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: Charles Kerr <charles@charleskerr.com>
2021-06-29 12:56:10 -07:00
Electron Bot
23a5789af6 Bump v14.0.0-beta.10 2021-06-28 06:30:53 -07:00
trop[bot]
9a6ac40593 chore: remove unused and broken ipcRendererInternal.sendTo() (#29897)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-06-28 15:54:02 +09:00
Jeremy Rose
5530497c82 feat: undo nativeWindowOpen default change, warn instead (#29869)
* Revert "feat: enable nativeWindowOpen by default (#28552)"

This reverts commit f8bdef5349.

* warn when nativeWindowOpen is undefined

* Update browser-window.md
2021-06-28 15:40:29 +09:00
trop[bot]
5d6b8919b7 fix: stop window.open from hanging when prevented (#29883)
* fix: stop window.open from hanging when prevented

* add test

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-06-28 15:23:49 +09:00
trop[bot]
755af34e1c fix: properly order out child windows (#29889)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-25 17:54:54 +09:00
trop[bot]
b49248d34c fix: Inspector method overrides when contextIsolation enabled (#29886)
* 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:51:07 +09:00
trop[bot]
272f9db3f8 fix: deny instead of canceling when certificate-error passes false (#29826) (#29870)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-06-25 17:11:01 +09:00
Electron Bot
5c3670c68c Bump v14.0.0-beta.9 2021-06-24 06:30:34 -07:00
Robo
dfe061017f chore: remove revert_remove_contentrendererclient_shouldfork.patch (#29858) 2021-06-24 00:27:43 -07:00
Jeremy Rose
d79d073513 refactor: use PathProvider for user-data-dir and others (#29649) (#29865) 2021-06-23 16:40:02 -07:00
Jeremy Rose
2dbe781ea3 chore: bump chromium to 93.0.4539.0 (main) (#29608) (#29864)
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: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-06-23 13:12:35 -07:00
trop[bot]
c0d5a148e5 fix: child window alwaysOnTop level persistence (#29855)
* fix: child window alwaysOnTop level

* chore: add undocumented getAlwaysOnTopLevel

* test: add test for level persistence

* Address feedback from review

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-23 17:51:33 +09:00
trop[bot]
fe2f8c31c2 docs: fix broken markdown in dialog.md (#29849)
* docs: fix broken markdown in dialog.md

* &#32;

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-06-23 15:10:40 +09:00
trop[bot]
3f8f78de50 fix: properly handle optional requestHeaders with onBeforeSendHeaders (#29835)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-23 10:08:56 +09:00
trop[bot]
8cd0c8152e fix: allow ppapi processes access to resource bundle on all platforms (#29831)
* 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:19 +09:00
Electron Bot
0fe50bb64e Bump v14.0.0-beta.8 2021-06-21 06:31:02 -07:00
trop[bot]
e203029c4c fix: update Squirel.Mac to fix CPU spin during update (#29806)
* 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:24 +09:00
trop[bot]
19cbb030d0 fix: do not cancel CORS preflight request on proxy auth. (#29812)
* 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 19:05:41 +09:00
trop[bot]
12f835858e fix: microtasks policy in CreateEnvironment (#29809)
* 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:36 +09:00
trop[bot]
6d39c35de7 fix: flakey extension bg page test (#29802)
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-06-21 14:00:11 +09:00
trop[bot]
879b32840b fix: fix hover state not clear bug when BrowserWindow is not resizable (#611) (#29801)
Co-authored-by: sssooonnnggg <sssooonnnggg111@gmail.com>
2021-06-21 13:59:51 +09:00
trop[bot]
5b2a6f6a2b docs: clarify use of ELECTRON_SKIP_BINARY_DOWNLOAD (#29746)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-06-21 10:10:11 +09:00
trop[bot]
0d72f4ee48 fix: select element not working on Windows (#29771)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-21 10:09:32 +09:00
John Kleinschmidt
1666664502 ci: run linux arm tests on CircleCI (#29765)
* 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-18 14:27:14 -04:00
trop[bot]
4055bf0d58 fix: color select eyedropper not working within DevTools (#29752)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-17 12:00:17 -04:00
Electron Bot
bc0cd83447 Bump v14.0.0-beta.7 2021-06-17 06:31:23 -07:00
trop[bot]
17c3649811 fix: ensure detached devtools are not always draggable (#29738)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-06-17 15:29:05 +09:00
trop[bot]
56926d9bee fix: draggable regions with devtools open (#29735)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-17 15:23:00 +09:00
trop[bot]
2f4e729f8d fix: potential crash when setting vibrancy (#29723)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-17 15:20:27 +09:00
trop[bot]
1789cfa5d3 fix: setWindowOpenHandler call syntax (#29727)
Co-authored-by: kdau <kevin@kdau.com>
2021-06-16 10:12:51 -07:00
trop[bot]
5e3bdfd920 fix: disable CET as v8 deoptimization is incompatible with it (#29688)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-06-16 09:57:44 -07:00
trop[bot]
6128e25ace chore: bumping NAN dep to include test changes (#29713)
Co-authored-by: clavin <clavin@electronjs.org>
2021-06-16 09:57:25 -07:00
trop[bot]
2fcd000f0c chore: disable default async spellchecker on Windows (#29705)
* chore: disable default async spellchecker on Windows

* chore: disable kWinRetrieveSuggestionsOnlyOnDemand in feature list

Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-06-15 14:09:47 -04:00
trop[bot]
f1fcdbd4a0 docs: Update represented-file fiddle tutorial (#29694)
* 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:51 +09:00
trop[bot]
014409f98e build: restore workspace on osx builds to get docs-only-change file (#29687)
* build: restore workspace on osx builds to get docs-only-change file

* build: clean up attached workspace before checking out from cache

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-06-14 13:39:22 -07:00
trop[bot]
3b39ff300b docs: fix typo in process-model.md (#29684)
Co-authored-by: Luke Ingalls <45518011+lukeingalls@users.noreply.github.com>
2021-06-14 10:13:07 -07:00
trop[bot]
e81d3756d5 docs: fix file mode of versioning-sketch-2.png (#29682)
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:45 -07:00
Electron Bot
789bfe627b Bump v14.0.0-beta.6 2021-06-14 06:31:26 -07:00
trop[bot]
f465439843 fix: check DCHECK_IS_ON() instead of #ifdef DCHECK_IS_ON (#29675)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-06-14 21:00:03 +09:00
trop[bot]
066e356ada fix: use correct spelling of attachment with Content-Disposition header (#29673)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-14 20:58:49 +09:00
trop[bot]
7665ba0838 fix: copy received data in URLPipeLoader to prevent corruption (#29670)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-14 17:47:37 +09:00
trop[bot]
b884381311 docs: fix typo (#29583)
* Typo fix

* Update main.js

Co-authored-by: ZReC <contact.zrec@gmail.com>
2021-06-14 09:34:52 +09:00
trop[bot]
1d0be9d6ed docs: fix image links in performance.md (#29632)
* 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:34:12 +09:00
trop[bot]
f4ed98c43b fix: ensure custom traffic lights float to top (#29628)
* fix: ensure custom traffic lights float to top

* chore: split into separate function

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-14 09:33:24 +09:00
trop[bot]
faf3477388 fix: select-bluetooth-device on Windows (#29613)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-06-10 11:02:16 -04:00
Electron Bot
8cf7c46570 Bump v14.0.0-beta.5 2021-06-10 06:31:14 -07:00
trop[bot]
dd5dd2a426 chore: bump chromium to 93.0.4536.0 (14-x-y) (#29617)
* chore: bump chromium in DEPS to 93.0.4536.0

* chore: update patches

* Make InkDrop a View class property

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

Replace old views::Button::ink_drop() calls with views::InkDrop::Get()

* Convert use of gfx::ImageSkia to ui::ImageModel for WidgetDelegates

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

Update GetWindowIcon(), GetWindowAppIcon(), and GetDevToolsWindowIcon()
to return ui::ImageModel instead of gfx::ImageSkia.

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: Charles Kerr <charles@charleskerr.com>
2021-06-09 11:34:08 -07:00
trop[bot]
0e673d069d chore: bump chromium to 93.0.4535.0 (14-x-y) (#29597)
* chore: bump chromium in DEPS to 93.0.4533.0

* chore: update patches

* chore: bump chromium in DEPS to 93.0.4534.0

* chore: update patches

* chore: bump chromium in DEPS to 93.0.4535.0

* chore: remove PdfViewerDocumentProperties from feature-flag conditional

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

This feature is now enabled by default upstream.

* chore: remove kPdfViewerPresentationMode from feature-flag conditional

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

This feature is now enabled by default upstream.

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: Charles Kerr <charles@charleskerr.com>
2021-06-09 09:49:04 -07:00
trop[bot]
d24de10707 fix: ensure fuse order is read in a stable way (#29616)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-06-09 09:27:13 -07:00
trop[bot]
6a429e9d04 chore: bump chromium to 93.0.4532.2 (14-x-y) (#29596)
* chore: bump chromium in DEPS to 93.0.4531.0

* chore: update patches

* Remove IPC::Listener from WebContentsObserver

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

* serial: Move serial policy from profile to local state

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

* chore: fix pip test

* chore: bump chromium in DEPS to 93.0.4532.2

* chore: update patches

* Follow up ColorChooser clean ups

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

* Distinguish between no default printer vs. query error

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

* chore: remove build_do_not_include_vr_directx_helpers_when_enable_vr.patch

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-06-08 14:45:37 -07:00
trop[bot]
172ac25013 chore: bump chromium to 93.0.4530.0 (master) (#29594)
* chore: bump chromium in DEPS to 92.0.4512.6

* 2887336: [CaptureHandle][#2] Propagate CaptureHandleConfig in browser process

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

* refactor: base::Optional -> absl::optional

* chore: fixup patch indices

* chore: bump chromium in DEPS to 92.0.4514.0

* 2899417: Make build work when enable_pdf is set to false.

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

* 2904731: use BrowserContext instead of Profile in PreconnectManager

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

* 2295749: fix: check IsSecureEventInputEnabled in constructor before setting SetPasswordInputEnabled to true

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

* 2893803: Add a GetWebView to RenderFrame.

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

* 2892345: Implement WebContents::ForEachRenderFrameHost

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

* chore: fixup patch indices

* 2892048: Real instance methods for BrowserContext: remaining 5 methods.

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

* 2902821: [mojo] Don't require full header includes for referenced interfaces

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

* 2496500: Remove last deprecated extension Event ctor.

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

* chore: fixup malformed pepper support patch

* chore: bump chromium in DEPS to 92.0.4515.0

* 2908461: Add CreateEmptyPrintPagesParamsPtr() inside print_view_manager_base.cc.

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

* 2880838: viz: add optional HDRMetadata to TransferableResource

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

* chore: fixup patch indices

* chore: bump chromium in DEPS to 92.0.4515.5

* chore: update patches

* chore: bump chromium in DEPS to 92.0.4515.7

* chore: bump chromium in DEPS to 92.0.4515.9

* chore: bump chromium in DEPS to 93.0.4522.0

* chore: bump chromium in DEPS to 93.0.4523.0

* chore: bump chromium in DEPS to 93.0.4524.0

* chore: update patches

* chore: enable_pak_file_integrity_checks was reverted

* chore: update patches

* refactor: base/optional was replaced with absl::optional

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

* refactor: replace all usages of base::nullopt with absl::nullopt

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

* chore: add missing base::Contains include

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

* refactor: replace all usages of base::make_optional with
absl::make_optional

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

* refactor: replace WorldScriptContext() with GetScriptContextFromWorldId

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

* chore: clean up left over opening namespace

Refs: 95bfe6d08f

* chore: add missing base::Contains include

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

* refactor: replace GetCurrentDisplayIterator with the hard checker
GetCurrentDisplay

This code looks suspicious but if the iterator was invalid before it
will also be invalid now.

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

* refactor: headers are now passed directly in extensions client

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

* refactor: base::DictionaryValue::empty() has been removed

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

* chore: add missing includes for network URLLoaderFactory

Refs: unknown, probably a side effect of header changes

* refactor: make convenience wrapper around AppendArg

There is no converter FromV8 for base::StringPiece (apparently its not
possible).  So we now take in an std::string and use the construct for
StringPiece to do implicit conversion.

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

* chore: add patch

* chore: bump chromium in DEPS to 93.0.4525.0

* chore: update patches

* refactor: CanResize has been de-virtualized

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

* chore: update resource integrity patch

* chore: add character encoding idl patch

* chore: bump chromium in DEPS to 93.0.4526.0

* chore: update patches

* chore: bump chromium in DEPS to 93.0.4527.0

* chore: bump chromium in DEPS to 93.0.4528.0

* chore: update patches

* chore: update idl encoding patch

* chore: bump chromium in DEPS to 93.0.4529.0

* chore: update patches

* chore: bump chromium in DEPS to 93.0.4530.0

* chore: update patches

* fix: only SetCanResize after the widget has been initialized

* chore: add patch for vr on windows gn gen

* spec: fix focus related tests on linux due to delay in focus swap

* chore: remove new usages of base::Optional from main

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-06-08 13:19:11 -07:00
trop[bot]
e3a613d103 fix: improper wrapping of fs.promises.readFile (#29577) 2021-06-08 10:31:14 +02:00
trop[bot]
73696eadde fix: make intermediates work with 'select-client-certificate' (#29570)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-08 11:40:33 +09:00
Electron Bot
bdbf78dca8 Bump v14.0.0-beta.4 2021-06-07 06:31:35 -07:00
trop[bot]
40dbeb6836 docs: Update notifications (renderer) docs (#29566)
* 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:44:26 +09:00
trop[bot]
3ff100521d docs: Updated "recent documents" fiddle tutorial (#29562)
* 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:43:24 +09:00
trop[bot]
f1752a0b6f chore: return early on promise rejection (#29539)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-07 10:17:00 +09:00
trop[bot]
e67b244571 fix: change ASAR archive cache to per-process to fix leak (#29536)
* 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:18:58 +09:00
Electron Bot
fef79701e0 Bump v14.0.0-beta.3 2021-06-03 06:31:50 -07:00
trop[bot]
c2877a342c chore: fix typos in comments (#29519)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-03 01:00:01 -07:00
trop[bot]
4e610b1948 build: Improve squirrel.mac BUILD.gn xcrun_action error (#29514)
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-03 00:53:46 -07:00
trop[bot]
4d30e7618a fix: keep shifted character in menu accelerator (#29481)
* fix: correctly handle shifted char in accelerator

* test: use actual accelerator of NSMenuItem

* chore: simplify KeyboardCodeFromStr

* chore: GetAcceleratorTextAt is testing only

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-06-03 00:53:09 -07:00
trop[bot]
7381738d85 docs: link to IncomingMessage (#29517)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-03 16:20:21 +09:00
trop[bot]
0f2ad3e384 chore: remove unused methods (#29475)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-03 14:47:59 +09:00
trop[bot]
b8812c8942 build: update support.md on stable version bumps (#29500)
* build: update support.md on stable version bumps

* build: update supported on major stable & nightly bumps

* test: updateSupported tests

* chore: fix syntax

* chore: use fspromise in version-bumper script/spec

Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-06-03 14:47:30 +09:00
Milan Burda
7a11390b8a test: add spec for --require filtering in NODE_OPTIONS (#29508) 2021-06-03 14:43:28 +09:00
trop[bot]
6ab2684234 feat: support loading debug urls with loadURL() (#29466)
* feat: support loading debug urls with loadURL()

* use FROM_ADDRESS_BAR

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-06-02 17:04:08 -07:00
Samuel Attard
80f051d859 feat: add experimental cookie encryption support (#27524) (#29492)
* feat: add experimental cookie encryption support on macOS

* chore: fix TODO

* update patches

* feat: make cookie encryption work on windows

* chore: update cookie encryption support comments

* fix: only call OSCrypt::Init on windows

* chore: make cookie encryption work on linux

* Update shell/browser/net/system_network_context_manager.cc

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

* chore: fix lint

* chore: update patches

* chore: update patches to upstreamed variants

* chore: use chrome ::switches constants

* chore: remove bad patch

* build: disable cookie encryption by default

* chore: update patches

* fix: provide std::string to NoDestructor

* chore: fix macos, nodestructor syntax

* build: fix macOS build due to mismatch in DEFINE

Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-06-02 16:54:35 -07:00
trop[bot]
95e7c6d53a refactor: point prepare-release at main (#29498)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-06-02 14:05:30 -07:00
trop[bot]
1b4c3428a9 chore: don't use after move (#29480)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-02 22:25:31 +09:00
trop[bot]
8edb7b456f build: Support building Electron on msys2 (#29476)
Electron already seems to support `cygwin`, so `msys` is a natural
addition. This is the only required change as far as I can see on my
local development environment, as otherwise the build scripts don't
realize that msys = windows.

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

Co-authored-by: Juan Cruz Viotti <jv@jviotti.com>
2021-06-02 22:24:37 +09:00
trop[bot]
6362736703 fix: inspector context menu throwing an error (#29472)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-06-02 16:17:57 +09:00
trop[bot]
670ae438b9 docs: Updated "progress bar" fiddle feature in docs (#29471)
* improve progress bar fiddle

* add comments to code snippet

* edits to progress-bar tutorial

* remove versions and nodeIntegration

* limit line length to 100

* implement standard linter suggestions

* add indeterminate and clear timers

* update to have reader replace all of main.js

* remove extra button

* loop the progress bar

* add logic to show reset state briefly

* Update docs/tutorial/progress-bar.md

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

* chore: fix lint

Co-authored-by: Jeremy Foster <jeremy.foster@live.com>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-06-02 16:17:35 +09:00
trop[bot]
10c6959c7f refactor: use main in release-notes (#29410)
* refactor: use main in release-notes

* fix: use default_branch in release-notes (#29415)

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-06-01 14:06:56 -07:00
trop[bot]
1066dce975 chore: remove duplicate option get for CustomScheme (#29455)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-01 19:12:59 +09:00
trop[bot]
d584afdf5b fix: Alt+Click should not toggle menu bar (#29452)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-06-01 19:11:54 +09:00
trop[bot]
0d69ba8ca2 fix: add service worker schemes from command line in renderer (#29440)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-01 17:51:42 +09:00
trop[bot]
c2ba3ab114 chore: use consistent parameter names (#29441)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-06-01 15:25:46 +09:00
trop[bot]
72a33e79d0 fix: correctly handle Alt+Key shortcuts (#29444)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-06-01 15:25:04 +09:00
trop[bot]
3ee0536b1d Fixes issue with reference links (#29429)
Co-authored-by: Vishal <34849822+vthukral94@users.noreply.github.com>
2021-06-01 10:38:12 +09:00
Electron Bot
846a12056d Bump v14.0.0-beta.2 2021-05-31 06:33:28 -07:00
trop[bot]
e0f6313739 refactor: publish-to-npm respects main (#29408) 2021-05-31 10:33:01 +02:00
trop[bot]
8866b312ad docs: update link to Chromium's coding style guide (#29398)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-05-31 10:19:48 +02:00
trop[bot]
cb8fada7a0 fix: close autoHide menu bar when focus is lost (#29349)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-05-28 19:00:55 +09:00
trop[bot]
b983bda721 Update quick-start.md (#29371)
In version 13.0.1 preload process should added to webPreferences.

Co-authored-by: aydon <41415004+congjiye@users.noreply.github.com>
2021-05-27 18:52:56 -07:00
trop[bot]
3125ec093d docs: fix typos in clang-tidy examples (#29355)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-05-27 18:52:44 -07:00
trop[bot]
a27329d9ad refactor: version-utils respects main (#29392)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-05-27 18:44:59 -07:00
trop[bot]
5362882cf6 refactor: getCurrentBranch respects main (#29386)
* refactor: getCurrentBranch respects main

* add note about migration

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-05-27 18:43:44 -07:00
trop[bot]
c58446d9d7 docs: remove freenode channel from support list (#29383)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-05-27 17:24:25 -07:00
trop[bot]
1c2ed2ba95 docs: Update notifications (main) docs (#29357)
* remove version info from index.html page

* remove nodeIntegration

* format code and update readme

* add note to user in index.html

Co-authored-by: Jeremy Foster <jeremy.foster@live.com>
2021-05-27 12:41:33 -07:00
trop[bot]
1c0e496ee2 docs: fix link to docs/fiddle/quick-start (#29353)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-05-27 12:38:48 -07:00
Electron Bot
0f32b0f1ce Bump v14.0.0-beta.1 2021-05-26 10:13:55 -07:00
606 changed files with 21006 additions and 6480 deletions

2409
.circleci/build_config.yml Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
import("//build/config/locales.gni")
import("//build/config/ui.gni")
import("//build/config/win/manifest.gni")
import("//components/os_crypt/features.gni")
import("//components/spellcheck/spellcheck_build_features.gni")
import("//content/public/app/mac_helpers.gni")
import("//extensions/buildflags/buildflags.gni")
@@ -186,6 +187,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") {
@@ -296,7 +303,7 @@ templated_file("electron_version_header") {
action("electron_fuses") {
script = "build/fuses/build.py"
inputs = [ "build/fuses/fuses.json" ]
inputs = [ "build/fuses/fuses.json5" ]
outputs = [
"$target_gen_dir/fuses.h",
@@ -335,6 +342,7 @@ source_set("electron_lib") {
"//components/network_hints/common:mojo_bindings",
"//components/network_hints/renderer",
"//components/network_session_configurator/common",
"//components/os_crypt",
"//components/pref_registry",
"//components/prefs",
"//components/security_state/content",
@@ -350,7 +358,6 @@ source_set("electron_lib") {
"//device/bluetooth",
"//device/bluetooth/public/cpp",
"//gin",
"//media/blink:blink",
"//media/capture/mojom:video_capture",
"//media/mojo/mojom",
"//net:extras",
@@ -360,6 +367,7 @@ source_set("electron_lib") {
"//ppapi/shared_impl",
"//printing/buildflags",
"//services/device/public/cpp/geolocation",
"//services/device/public/cpp/hid",
"//services/device/public/mojom",
"//services/proxy_resolver:lib",
"//services/video_capture/public/mojom:constants",
@@ -367,6 +375,7 @@ source_set("electron_lib") {
"//skia",
"//third_party/blink/public:blink",
"//third_party/blink/public:blink_devtools_inspector_resources",
"//third_party/blink/public/platform/media",
"//third_party/boringssl",
"//third_party/electron_node:node_lib",
"//third_party/inspector_protocol:crdtp",
@@ -684,6 +693,10 @@ source_set("electron_lib") {
]
libs += [ "uxtheme.lib" ]
}
if (allow_runtime_configurable_key_storage) {
defines += [ "ALLOW_RUNTIME_CONFIGURABLE_KEY_STORAGE" ]
}
}
electron_paks("packed_resources") {
@@ -1398,7 +1411,8 @@ dist_zip("hunspell_dictionaries_zip") {
}
copy("libcxx_headers") {
sources = libcxx_headers + libcxx_licenses
sources = libcxx_headers + libcxx_licenses +
[ "//buildtools/third_party/libc++/__config_site" ]
outputs = [ "$target_gen_dir/electron_libcxx_include/{{source_root_relative_dir}}/{{source_file_part}}" ]
}

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!_

12
DEPS
View File

@@ -10,17 +10,21 @@ gclient_gn_args = [
'checkout_openxr',
'checkout_google_benchmark',
'mac_xcode_version',
'generate_location_tags',
]
vars = {
'chromium_version':
'92.0.4511.0',
'93.0.4577.82',
'node_version':
'v14.17.0',
'nan_version':
'v2.14.2',
# The following commit hash of NAN is v2.14.2 with *only* changes to the
# test suite. This should be updated to a specific tag when one becomes
# available.
'65b32af46e9d7fab2e4ff657751205b3865f4920',
'squirrel.mac_version':
'cdc0729c8bf8576bfef18629186e1e9ecf1b0d9f',
'0e5d146ba13101a1302d59ea6e6e0b3cace4ae38',
'pyyaml_version': '3.12',
@@ -52,6 +56,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 @@
14.0.0-nightly.20210524
14.2.3

View File

@@ -53,6 +53,22 @@ steps:
env:
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
- powershell: |
try {
$localArtifactPath = "$pwd\src\pdb.zip"
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/pdb.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
cd src
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y pdb.zip
} catch {
Write-Host "There was an exception encountered while downloading pdb files:" $_.Exception.Message
} finally {
$global:LASTEXITCODE = 0
}
displayName: 'Download pdb files for detailed stacktraces'
env:
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
- powershell: |
New-Item src\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path src\out\Default\electron.lib -destination src\out\Default\gen\node_headers\Release\node.lib
@@ -63,15 +79,30 @@ steps:
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
set npm_config_arch=arm64
cd electron
# CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022
node script/yarn test -- --enable-logging --verbose --disable-features=CalculateNativeWinOcclusion
displayName: 'Run Electron tests'
node script/yarn test --runners=main --runTestFilesSeperately --enable-logging --disable-features=CalculateNativeWinOcclusion
displayName: 'Run Electron Main process tests'
env:
ELECTRON_ENABLE_STACK_DUMPING: true
ELECTRON_OUT_DIR: Default
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters
- script: |
cd src
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
set npm_config_arch=arm64
cd electron
node script/yarn test --runners=remote --enable-logging --disable-features=CalculateNativeWinOcclusion
displayName: 'Run Electron Remote based tests'
env:
ELECTRON_OUT_DIR: Default
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters
condition: always()
- task: PublishTestResults@2
displayName: 'Publish Test Results'

View File

@@ -2,7 +2,7 @@ is_electron_build = true
root_extra_deps = [ "//electron" ]
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
node_module_version = 89
node_module_version = 97
v8_promise_internal_field_count = 1
v8_typed_array_max_size_in_heap = 0
@@ -29,4 +29,7 @@ enable_pseudolocales = false
is_cfi = false
enable_pak_file_integrity_checks = 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
@@ -49,8 +50,8 @@ const volatile char kFuseWire[] = { /* sentinel */ {sentinel}, /* fuse_version *
}
"""
with open(os.path.join(dir_path, "fuses.json"), 'r') as f:
fuse_defaults = json.load(f)
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] == "/"), object_pairs_hook=OrderedDict)
fuse_version = fuse_defaults['_version']
del fuse_defaults['_version']

View File

@@ -2,5 +2,6 @@
"_comment": "Modifying the fuse schema in any breaking way should result in the _version prop being incremented. NEVER remove a fuse or change its meaning, instead mark it as removed with 'r'",
"_schema": "0 == off, 1 == on, r == removed fuse",
"_version": 1,
"run_as_node": "1"
"run_as_node": "1",
"cookie_encryption": "0"
}

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

@@ -64,8 +64,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",
]
@@ -88,6 +91,10 @@ static_library("chrome") {
"//components/optimization_guide/proto:optimization_guide_proto",
]
if (enable_basic_printing && is_win) {
deps += [ "//chrome/common:cloud_print_utility_mojom" ]
}
if (is_linux) {
sources += [ "//chrome/browser/icon_loader_auralinux.cc" ]
if (use_x11 || use_ozone) {
@@ -142,6 +149,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",
@@ -340,17 +349,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

@@ -157,15 +157,14 @@ void CertificateManagerModel::GetCertDBOnIOThread(
CreationCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
auto did_get_cert_db_callback = base::AdaptCallbackForRepeating(
base::BindOnce(&CertificateManagerModel::DidGetCertDBOnIOThread,
std::move(callback)));
auto split_callback = base::SplitOnceCallback(base::BindOnce(
&CertificateManagerModel::DidGetCertDBOnIOThread, std::move(callback)));
net::NSSCertDatabase* cert_db =
GetNSSCertDatabaseForResourceContext(context, did_get_cert_db_callback);
net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext(
context, std::move(split_callback.first));
// If the NSS database was already available, |cert_db| is non-null and
// |did_get_cert_db_callback| has not been called. Call it explicitly.
if (cert_db)
did_get_cert_db_callback.Run(cert_db);
std::move(split_callback.second).Run(cert_db);
}

View File

@@ -4,6 +4,7 @@
#include "chrome/browser/process_singleton.h"
#include <windows.h>
#include <shellapi.h>
#include "base/base_paths.h"

View File

@@ -109,7 +109,7 @@ function loadApplicationPackage (packagePath: string) {
try {
const filePath = Module._resolveFilename(packagePath, module, true);
app._setDefaultAppPaths(appPath || path.dirname(filePath));
app.setAppPath(appPath || path.dirname(filePath));
} catch (e) {
showErrorMessage(`Unable to find Electron app at ${packagePath}\n\n${e.message}`);
return;

View File

@@ -1135,8 +1135,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_
@@ -1374,8 +1374,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.
@@ -1403,7 +1403,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

@@ -22,12 +22,13 @@ win.loadFile('index.html')
To create a window without chrome, or a transparent window in arbitrary shape,
you can use the [Frameless Window](frameless-window.md) API.
## Showing window gracefully
## Showing the window gracefully
When loading a page in the window directly, users may see the page load incrementally, which is not a good experience for a native app. To make the window display
without visual flash, there are two solutions for different situations.
When loading a page in the window directly, users may see the page load incrementally,
which is not a good experience for a native app. To make the window display
without a visual flash, there are two solutions for different situations.
## Using `ready-to-show` event
### Using the `ready-to-show` event
While loading the page, the `ready-to-show` event will be emitted when the renderer
process has rendered the page for the first time if the window has not been shown yet. Showing
@@ -48,7 +49,7 @@ event.
Please note that using this event implies that the renderer will be considered "visible" and
paint even though `show` is false. This event will never fire if you use `paintWhenInitiallyHidden: false`
## Setting `backgroundColor`
### Setting the `backgroundColor` property
For a complex app, the `ready-to-show` event could be emitted too late, making
the app feel slow. In this case, it is recommended to show the window
@@ -187,9 +188,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 +214,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.
@@ -342,8 +340,9 @@ 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.
* `nativeWindowOpen` Boolean (optional) - Whether to use native
`window.open()`. Defaults to `true`. Child windows will always have node
integration disabled unless `nodeIntegrationInSubFrames` is true.
`window.open()`. Defaults to `false`. Child windows will always have node
integration disabled unless `nodeIntegrationInSubFrames` is true. **Note:** The default
value will be changing to `true` in Electron 15.
* `webviewTag` Boolean (optional) - Whether to enable the [`<webview>` tag](webview-tag.md).
Defaults to `false`. **Note:** The
`preload` script configured for the `<webview>` will have node integration
@@ -391,6 +390,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
@@ -977,7 +977,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)`
@@ -1685,7 +1685,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()`
@@ -1805,3 +1805,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

@@ -199,7 +199,7 @@ const { clipboard } = require('electron')
const hasFormat = clipboard.has('<p>selection</p>')
console.log(hasFormat)
// 'true' or 'false
// 'true' or 'false'
```
### `clipboard.read(format)` _Experimental_
@@ -208,6 +208,10 @@ console.log(hasFormat)
Returns `String` - Reads `format` type from the clipboard.
`format` should contain valid ASCII characters and have `/` separator.
`a/c`, `a/bc` are valid formats while `/abc`, `abc/`, `a/`, `/a`, `a`
are not valid.
### `clipboard.readBuffer(format)` _Experimental_
* `format` String
@@ -218,9 +222,9 @@ Returns `Buffer` - Reads `format` type from the clipboard.
const { clipboard } = require('electron')
const buffer = Buffer.from('this is binary', 'utf8')
clipboard.writeBuffer('public.utf8-plain-text', buffer)
clipboard.writeBuffer('public/utf8-plain-text', buffer)
const ret = clipboard.readBuffer('public.utf8-plain-text')
const ret = clipboard.readBuffer('public/utf8-plain-text')
console.log(buffer.equals(out))
// true
@@ -238,7 +242,7 @@ Writes the `buffer` into the clipboard as `format`.
const { clipboard } = require('electron')
const buffer = Buffer.from('writeBuffer', 'utf8')
clipboard.writeBuffer('public.utf8-plain-text', buffer)
clipboard.writeBuffer('public/utf8-plain-text', buffer)
```
### `clipboard.write(data[, type])`

View File

@@ -67,13 +67,22 @@ Enables caller stack logging for the following APIs (filtering events):
* `desktopCapturer.getSources()` / `desktop-capturer-get-sources`
### --enable-logging
### --enable-logging[=file]
Prints Chromium's logging into console.
Prints Chromium's logging to stderr (or a log file).
This switch can not be used in `app.commandLine.appendSwitch` since it is parsed
earlier than user's app is loaded, but you can set the `ELECTRON_ENABLE_LOGGING`
environment variable to achieve the same effect.
The `ELECTRON_ENABLE_LOGGING` environment variable has the same effect as
passing `--enable-logging`.
Passing `--enable-logging` will result in logs being printed on stderr.
Passing `--enable-logging=file` will result in logs being saved to the file
specified by `--log-file=...`, or to `electron_debug.log` in the user-data
directory if `--log-file` is not specified.
> **Note:** On Windows, logs from child processes cannot be sent to stderr.
> Logging to a file is the most reliable way to collect logs on Windows.
See also `--log-file`, `--log-level`, `--v`, and `--vmodule`.
### --force-fieldtrials=`trials`
@@ -126,10 +135,37 @@ See the [Node.js documentation][node-cli] or run `node --help` in your terminal
Set a custom locale.
### --log-file=`path`
If `--enable-logging` is specified, logs will be written to the given path. The
parent directory must exist.
Setting the `ELECTRON_LOG_FILE` environment variable is equivalent to passing
this flag. If both are present, the command-line switch takes precedence.
### --log-net-log=`path`
Enables net log events to be saved and writes them to `path`.
### --log-level=`N`
Sets the verbosity of logging when used together with `--enable-logging`.
`N` should be one of [Chrome's LogSeverities][severities].
Note that two complimentary logging mechanisms in Chromium -- `LOG()`
and `VLOG()` -- are controlled by different switches. `--log-level`
controls `LOG()` messages, while `--v` and `--vmodule` control `VLOG()`
messages. So you may want to use a combination of these three switches
depending on the granularity you want and what logging calls are made
by the code you're trying to watch.
See [Chromium Logging source][logging] for more information on how
`LOG()` and `VLOG()` interact. Loosely speaking, `VLOG()` can be thought
of as sub-levels / per-module levels inside `LOG(INFO)` to control the
firehose of `LOG(INFO)` data.
See also `--enable-logging`, `--log-level`, `--v`, and `--vmodule`.
### --no-proxy-server
Don't use a proxy server and always make direct connections. Overrides any other
@@ -181,6 +217,8 @@ positive values are used for V-logging levels.
This switch only works when `--enable-logging` is also passed.
See also `--enable-logging`, `--log-level`, and `--vmodule`.
### --vmodule=`pattern`
Gives the per-module maximal V-logging levels to override the value given by
@@ -193,6 +231,8 @@ logging level for all code in the source files under a `foo/bar` directory.
This switch only works when `--enable-logging` is also passed.
See also `--enable-logging`, `--log-level`, and `--v`.
### --force_high_performance_gpu
Force using discrete GPU when there are multiple GPUs available.
@@ -240,4 +280,8 @@ By default inspector websocket url is available in stderr and under /json/list e
[ready]: app.md#event-ready
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
[debugging-main-process]: ../tutorial/debugging-main-process.md
[logging]: https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h
[node-cli]: https://nodejs.org/api/cli.html
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
[ready]: app.md#event-ready
[severities]: https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h?q=logging::LogSeverity&ss=chromium

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.
@@ -269,7 +269,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

@@ -118,7 +118,19 @@ debugging purposes.
### `ELECTRON_ENABLE_LOGGING`
Prints Chrome's internal logging to the console.
Prints Chromium's internal logging to the console.
Setting this variable is the same as passing `--enable-logging`
on the command line. For more info, see `--enable-logging` in [command-line
switches](./command-line-switches.md#enable-loggingfile).
### `ELECTRON_LOG_FILE`
Sets the file destination for Chromium's internal logging.
Setting this variable is the same as passing `--log-file`
on the command line. For more info, see `--log-file` in [command-line
switches](./command-line-switches.md#log-filepath).
### `ELECTRON_DEBUG_DRAG_REGIONS`
@@ -127,7 +139,8 @@ green and non-draggable regions will be colored red to aid debugging.
### `ELECTRON_DEBUG_NOTIFICATIONS`
Adds extra logs to [`Notification`](./notification.md) lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common actions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.
Adds extra logs to [`Notification`](./notification.md) lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common a
tions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.
Sample output:

View File

@@ -78,6 +78,7 @@ The following methods of `chrome.runtime` are supported:
- `chrome.runtime.getURL`
- `chrome.runtime.connect`
- `chrome.runtime.sendMessage`
- `chrome.runtime.reload`
The following events of `chrome.runtime` are supported:

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

@@ -40,6 +40,8 @@ ipcMain.on('synchronous-message', (event, arg) => {
```javascript
// In renderer process (web page).
// NB. Electron APIs are only accessible from preload, unless contextIsolation is disabled.
// See https://www.electronjs.org/docs/tutorial/process-model#preload-scripts for more details.
const { ipcRenderer } = require('electron')
console.log(ipcRenderer.sendSync('synchronous-message', 'ping')) // prints "pong"

View File

@@ -14,7 +14,7 @@ See [`Menu`](menu.md) for examples.
* `menuItem` MenuItem
* `browserWindow` [BrowserWindow](browser-window.md) | undefined - This will not be defined if no window is open.
* `event` [KeyboardEvent](structures/keyboard-event.md)
* `role` String (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
* `role` String (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
`click` property will be ignored. See [roles](#roles).
* `type` String (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
`radio`.
@@ -155,7 +155,7 @@ A `String` indicating the type of the item. Can be `normal`, `separator`, `subme
#### `menuItem.role`
A `String` (optional) indicating the item's role, if set. Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
A `String` (optional) indicating the item's role, if set. Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
#### `menuItem.accelerator`

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

@@ -179,7 +179,97 @@ Emitted when a hunspell dictionary file download fails. For details
on the failure you should collect a netlog and inspect the download
request.
#### Event: 'select-serial-port' _Experimental_
#### Event: 'select-hid-device'
Returns:
* `event` Event
* `details` Object
* `deviceList` [HIDDevice[]](structures/hid-device.md)
* `frame` [WebFrameMain](web-frame-main.md)
* `callback` Function
* `deviceId` String | null (optional)
Emitted when a HID device needs to be selected when a call to
`navigator.hid.requestDevice` is made. `callback` should be called with
`deviceId` to be selected; passing no arguments to `callback` will
cancel the request. Additionally, permissioning on `navigator.hid` can
be further managed by using [ses.setPermissionCheckHandler(handler)](#sessetpermissioncheckhandlerhandler)
and [ses.setDevicePermissionHandler(handler)`](#sessetdevicepermissionhandlerhandler).
```javascript
const { app, BrowserWindow } = require('electron')
let win = null
app.whenReady().then(() => {
win = new BrowserWindow()
win.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin, details) => {
if (permission === 'hid') {
// Add logic here to determine if permission should be given to allow HID selection
return true
}
return false
})
// Optionally, retrieve previously persisted devices from a persistent store
const grantedDevices = fetchGrantedDevices()
win.webContents.session.setDevicePermissionHandler((details) => {
if (new URL(details.origin).hostname === 'some-host' && details.deviceType === 'hid') {
if (details.device.vendorId === 123 && details.device.productId === 345) {
// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)
return true
}
// Search through the list of devices that have previously been granted permission
return grantedDevices.some((grantedDevice) => {
return grantedDevice.vendorId === details.device.vendorId &&
grantedDevice.productId === details.device.productId &&
grantedDevice.serialNumber && grantedDevice.serialNumber === details.device.serialNumber
})
}
return false
})
win.webContents.session.on('select-hid-device', (event, details, callback) => {
event.preventDefault()
const selectedDevice = details.deviceList.find((device) => {
return device.vendorId === '9025' && device.productId === '67'
})
callback(selectedPort?.deviceId)
})
})
```
#### Event: 'hid-device-added'
Returns:
* `event` Event
* `details` Object
* `device` [HIDDevice[]](structures/hid-device.md)
* `frame` [WebFrameMain](web-frame-main.md)
Emitted when a new HID device becomes available. For example, when a new USB device is plugged in.
This event will only be emitted after `navigator.hid.requestDevice` has been called and `select-hid-device` has fired.
#### Event: 'hid-device-removed'
Returns:
* `event` Event
* `details` Object
* `device` [HIDDevice[]](structures/hid-device.md)
* `frame` [WebFrameMain](web-frame-main.md)
Emitted when a HID device has been removed. For example, this event will fire when a USB device is unplugged.
This event will only be emitted after `navigator.hid.requestDevice` has been called and `select-hid-device` has fired.
#### Event: 'select-serial-port'
Returns:
@@ -196,20 +286,45 @@ cancel the request. Additionally, permissioning on `navigator.serial` can
be managed by using [ses.setPermissionCheckHandler(handler)](#sessetpermissioncheckhandlerhandler)
with the `serial` permission.
Because this is an experimental feature it is disabled by default. To enable this feature, you
will need to use the `--enable-features=ElectronSerialChooser` command line switch.
```javascript
const { app, BrowserWindow } = require('electron')
let win = null
app.commandLine.appendSwitch('enable-features', 'ElectronSerialChooser')
app.whenReady().then(() => {
win = new BrowserWindow({
width: 800,
height: 600
})
win.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin, details) => {
if (permission === 'serial') {
// Add logic here to determine if permission should be given to allow serial selection
return true
}
return false
})
// Optionally, retrieve previously persisted devices from a persistent store
const grantedDevices = fetchGrantedDevices()
win.webContents.session.setDevicePermissionHandler((details) => {
if (new URL(details.origin).hostname === 'some-host' && details.deviceType === 'serial') {
if (details.device.vendorId === 123 && details.device.productId === 345) {
// Always allow this type of device (this allows skipping the call to `navigator.serial.requestPort` first)
return true
}
// Search through the list of devices that have previously been granted permission
return grantedDevices.some((grantedDevice) => {
return grantedDevice.vendorId === details.device.vendorId &&
grantedDevice.productId === details.device.productId &&
grantedDevice.serialNumber && grantedDevice.serialNumber === details.device.serialNumber
})
}
return false
})
win.webContents.session.on('select-serial-port', (event, portList, webContents, callback) => {
event.preventDefault()
const selectedPort = portList.find((device) => {
@@ -224,7 +339,7 @@ app.whenReady().then(() => {
})
```
#### Event: 'serial-port-added' _Experimental_
#### Event: 'serial-port-added'
Returns:
@@ -234,7 +349,7 @@ Returns:
Emitted after `navigator.serial.requestPort` has been called and `select-serial-port` has fired if a new serial port becomes available. For example, this event will fire when a new USB device is plugged in.
#### Event: 'serial-port-removed' _Experimental_
#### Event: 'serial-port-removed'
Returns:
@@ -501,6 +616,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
@@ -526,8 +642,8 @@ 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.
* `permission` String - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, or `serial`.
* `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`, `hid`, or `serial`.
* `requestingOrigin` String - The origin URL of the permission check
* `details` Object - Some properties are only available on certain permission types.
* `embeddingOrigin` String (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
@@ -555,6 +671,78 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
})
```
#### `ses.setDevicePermissionHandler(handler)`
* `handler` Function\<Boolean> | null
* `details` Object
* `deviceType` String - The type of device that permission is being requested on, can be `hid` or `serial`.
* `origin` String - The origin URL of the device permission check.
* `device` [HIDDevice](structures/hid-device.md) | [SerialPort](structures/serial-port.md)- the device that permission is being requested for.
* `frame` [WebFrameMain](web-frame-main.md) - WebFrameMain checking the device permission.
Sets the handler which can be used to respond to device permission checks for the `session`.
Returning `true` will allow the device to be permitted and `false` will reject it.
To clear the handler, call `setDevicePermissionHandler(null)`.
This handler can be used to provide default permissioning to devices without first calling for permission
to devices (eg via `navigator.hid.requestDevice`). If this handler is not defined, the default device
permissions as granted through device selection (eg via `navigator.hid.requestDevice`) will be used.
Additionally, the default behavior of Electron is to store granted device permision through the lifetime
of the corresponding WebContents. If longer term storage is needed, a developer can store granted device
permissions (eg when handling the `select-hid-device` event) and then read from that storage with `setDevicePermissionHandler`.
```javascript
const { app, BrowserWindow } = require('electron')
let win = null
app.whenReady().then(() => {
win = new BrowserWindow()
win.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin, details) => {
if (permission === 'hid') {
// Add logic here to determine if permission should be given to allow HID selection
return true
} else if (permission === 'serial') {
// Add logic here to determine if permission should be given to allow serial port selection
}
return false
})
// Optionally, retrieve previously persisted devices from a persistent store
const grantedDevices = fetchGrantedDevices()
win.webContents.session.setDevicePermissionHandler((details) => {
if (new URL(details.origin).hostname === 'some-host' && details.deviceType === 'hid') {
if (details.device.vendorId === 123 && details.device.productId === 345) {
// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)
return true
}
// Search through the list of devices that have previously been granted permission
return grantedDevices.some((grantedDevice) => {
return grantedDevice.vendorId === details.device.vendorId &&
grantedDevice.productId === details.device.productId &&
grantedDevice.serialNumber && grantedDevice.serialNumber === details.device.serialNumber
})
} else if (details.deviceType === 'serial') {
if (details.device.vendorId === 123 && details.device.productId === 345) {
// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)
return true
}
}
return false
})
win.webContents.session.on('select-hid-device', (event, details, callback) => {
event.preventDefault()
const selectedDevice = details.deviceList.find((device) => {
return device.vendorId === '9025' && device.productId === '67'
})
callback(selectedPort?.deviceId)
})
})
```
#### `ses.clearHostResolverCache()`
Returns `Promise<void>` - Resolves when the operation is complete.

View File

@@ -0,0 +1,8 @@
# HIDDevice Object
* `deviceId` String - Unique identifier for the device.
* `name` String - Name of the device.
* `vendorId` Integer - The USB vendor ID.
* `productId` Integer - The USB product ID.
* `serialNumber` String (optional) - The USB device serial number.
* `guid` String (optional) - Unique identifier for the HID interface. A device may have multiple HID interfaces.

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.
@@ -711,6 +731,8 @@ first available device will be selected. `callback` should be called with
`deviceId` to be selected, passing empty string to `callback` will
cancel the request.
If no event listener is added for this event, all bluetooth requests will be cancelled.
```javascript
const { app, BrowserWindow } = require('electron')
@@ -1459,8 +1481,8 @@ win.loadURL('http://github.com')
win.webContents.on('did-finish-load', () => {
// Use default printing options
const pdfPath = path.join(os.homedir(), 'Desktop', 'temp.pdf')
win.webContents.printToPDF({}).then(data => {
const pdfPath = path.join(os.homedir(), 'Desktop', 'temp.pdf')
fs.writeFile(pdfPath, data, (error) => {
if (error) throw error
console.log(`Wrote PDF successfully to ${pdfPath}`)
@@ -1792,7 +1814,8 @@ End subscribing for frame presentation events.
#### `contents.startDrag(item)`
* `item` Object
* `file` String[] | String - The path(s) to the file(s) being dragged.
* `file` String - The path to the file being dragged.
* `files` String[] (optional) - The paths to the files being dragged. (`files` will override `file` field)
* `icon` [NativeImage](native-image.md) | String - The image must be
non-empty on macOS.

View File

@@ -53,7 +53,7 @@ The following methods are available on instances of `WebRequest`:
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
* `frame` WebFrameMain (optional)
* `resourceType` String
* `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` String
* `timestamp` Double
* `uploadData` [UploadData[]](structures/upload-data.md)
@@ -98,7 +98,7 @@ Some examples of valid `urls`:
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
* `frame` WebFrameMain (optional)
* `resourceType` String
* `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` String
* `timestamp` Double
* `requestHeaders` Record<string, string>
@@ -127,7 +127,7 @@ The `callback` has to be called with a `response` object.
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
* `frame` WebFrameMain (optional)
* `resourceType` String
* `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` String
* `timestamp` Double
* `requestHeaders` Record<string, string>
@@ -149,12 +149,11 @@ response are visible by the time this listener is fired.
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
* `frame` WebFrameMain (optional)
* `resourceType` String
* `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` String
* `timestamp` Double
* `statusLine` String
* `statusCode` Integer
* `requestHeaders` Record<string, string>
* `responseHeaders` Record<string, string[]> (optional)
* `callback` Function
* `headersReceivedResponse` Object
@@ -183,7 +182,7 @@ The `callback` has to be called with a `response` object.
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
* `frame` WebFrameMain (optional)
* `resourceType` String
* `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` String
* `timestamp` Double
* `responseHeaders` Record<string, string[]> (optional)
@@ -209,7 +208,7 @@ and response headers are available.
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
* `frame` WebFrameMain (optional)
* `resourceType` String
* `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` String
* `timestamp` Double
* `redirectURL` String
@@ -236,7 +235,7 @@ redirect is about to occur.
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
* `frame` WebFrameMain (optional)
* `resourceType` String
* `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` String
* `timestamp` Double
* `responseHeaders` Record<string, string[]> (optional)
@@ -261,7 +260,7 @@ completed.
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
* `frame` WebFrameMain (optional)
* `resourceType` String
* `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` String
* `timestamp` Double
* `fromCache` Boolean

View File

@@ -142,12 +142,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
@@ -709,6 +713,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.
@@ -829,6 +837,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:
@@ -841,6 +862,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:
@@ -957,3 +995,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

@@ -6,15 +6,16 @@ untrusted content within a renderer. Windows can be created from the renderer in
* clicking on links or submitting forms adorned with `target=_blank`
* JavaScript calling `window.open()`
For same-origin content, the new window is created within the same process,
enabling the parent to access the child window directly. This can be very
useful for app sub-windows that act as preference panels, or similar, as the
parent can render to the sub-window directly, as if it were a `div` in the
parent. This is the same behavior as in the browser.
In non-sandboxed renderers, or when `nativeWindowOpen` is false (the default), this results in the creation of a
[`BrowserWindowProxy`](browser-window-proxy.md), a light wrapper around
`BrowserWindow`.
When `nativeWindowOpen` is set to false, `window.open` instead results in the
creation of a [`BrowserWindowProxy`](browser-window-proxy.md), a light wrapper
around `BrowserWindow`.
However, when the `sandbox` (or directly, `nativeWindowOpen`) option is set, a
`Window` instance is created, as you'd expect in the browser. For same-origin
content, the new window is created within the same process, enabling the parent
to access the child window directly. This can be very useful for app sub-windows that act
as preference panels, or similar, as the parent can render to the sub-window
directly, as if it were a `div` in the parent.
Electron pairs this native Chrome `Window` with a BrowserWindow under the hood.
You can take advantage of all the customization available when creating a
@@ -67,50 +68,18 @@ window.open('https://github.com', '_blank', 'top=500,left=200,frame=false,nodeIn
To customize or cancel the creation of the window, you can optionally set an
override handler with `webContents.setWindowOpenHandler()` from the main
process. Returning `{ action: 'deny' }` cancels the window. Returning `{
action: 'allow', overrideBrowserWindowOptions: { ... } }` will allow opening
the window and setting the `BrowserWindowConstructorOptions` to be used when
creating the window. Note that this is more powerful than passing options
through the feature string, as the renderer has more limited privileges in
deciding security preferences than the main process.
### Native `Window` example
```javascript
// main.js
const mainWindow = new BrowserWindow()
// In this example, only windows with the `about:blank` url will be created.
// All other urls will be blocked.
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
if (url === 'about:blank') {
return {
frame: false,
fullscreenable: false,
backgroundColor: 'black',
webPreferences: {
preload: 'my-child-window-preload-script.js'
}
}
}
return false
})
```
```javascript
// renderer process (mainWindow)
const childWindow = window.open('', 'modal')
childWindow.document.write('<h1>Hello</h1>')
```
process. Returning `false` cancels the window, while returning an object sets
the `BrowserWindowConstructorOptions` used when creating the window. Note that
this is more powerful than passing options through the feature string, as the
renderer has more limited privileges in deciding security preferences than the
main process.
### `BrowserWindowProxy` example
```javascript
// main.js
const mainWindow = new BrowserWindow({
webPreferences: { nativeWindowOpen: false }
})
const mainWindow = new BrowserWindow()
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
if (url.startsWith('https://github.com/')) {
@@ -132,3 +101,39 @@ mainWindow.webContents.on('did-create-window', (childWindow) => {
const windowProxy = window.open('https://github.com/', null, 'minimizable=false')
windowProxy.postMessage('hi', '*')
```
### Native `Window` example
```javascript
// main.js
const mainWindow = new BrowserWindow({
webPreferences: {
nativeWindowOpen: true
}
})
// In this example, only windows with the `about:blank` url will be created.
// All other urls will be blocked.
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
if (url === 'about:blank') {
return {
action: 'allow',
overrideBrowserWindowOptions: {
frame: false,
fullscreenable: false,
backgroundColor: 'black',
webPreferences: {
preload: 'my-child-window-preload-script.js'
}
}
}
}
return { action: 'deny' }
})
```
```javascript
// renderer process (mainWindow)
const childWindow = window.open('', 'modal')
childWindow.document.write('<h1>Hello</h1>')
```

View File

@@ -12,8 +12,39 @@ This document uses the following convention to categorize breaking changes:
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
## Planned Breaking API Changes (15.0)
### Default Changed: `nativeWindowOpen` defaults to `true`
Prior to Electron 15, `window.open` was by default shimmed to use
`BrowserWindowProxy`. This meant that `window.open('about:blank')` did not work
to open synchronously scriptable child windows, among other incompatibilities.
`nativeWindowOpen: true` is no longer experimental, and is now the default.
See the documentation for [window.open in Electron](api/window-open.md)
for more details.
## Planned Breaking API Changes (14.0)
### Removed: `remote` module
The `remote` module was deprecated in Electron 12, and will be removed in
Electron 14. It is replaced by the
[`@electron/remote`](https://github.com/electron/remote) module.
```js
// Deprecated in Electron 12:
const { BrowserWindow } = require('electron').remote
```
```js
// Replace with:
const { BrowserWindow } = require('@electron/remote')
// In the main process:
require('@electron/remote/main').initialize()
```
### Removed: `app.allowRendererProcessReuse`
The `app.allowRendererProcessReuse` property will be removed as part of our plan to
@@ -37,22 +68,12 @@ If you were using this parameter to set the title of a window, you can instead u
### Removed: `worldSafeExecuteJavaScript`
In Electron 14, `worldSafeExecuteJavaScript` will be removed. There is no alternative, please
ensure your code works with this property enabled. It has been enabled by default since Electron
In Electron 14, `worldSafeExecuteJavaScript` will be removed. There is no alternative, please
ensure your code works with this property enabled. It has been enabled by default since Electron
12.
You will be affected by this change if you use either `webFrame.executeJavaScript` or `webFrame.executeJavaScriptInIsolatedWorld`. You will need to ensure that values returned by either of those methods are supported by the [Context Bridge API](api/context-bridge.md#parameter--error--return-type-support) as these methods use the same value passing semantics.
### Default Changed: `nativeWindowOpen` defaults to `true`
Prior to Electron 14, `window.open` was by default shimmed to use
`BrowserWindowProxy`. This meant that `window.open('about:blank')` did not work
to open synchronously scriptable child windows, among other incompatibilities.
`nativeWindowOpen` is no longer experimental, and is now the default.
See the documentation for [window.open in Electron](api/window-open.md)
for more details.
### Removed: BrowserWindowConstructorOptions inheriting from parent windows
Prior to Electron 14, windows opened with `window.open` would inherit

View File

@@ -10,12 +10,12 @@ files, you need to have built Electron so that it knows which compiler flags
were used. There is one required option for the script `--output-dir`, which
tells the script which build directory to pull the compilation information
from. A typical usage would be:
`npm run lint:clang-tiy --out-dir ../out/Testing`
`npm run lint:clang-tidy --out-dir ../out/Testing`
With no filenames provided, all C/C++/Objective-C files will be checked.
You can provide a list of files to be checked by passing the filenames after
the options:
`npm run lint:clang-tiy --out-dir ../out/Testing shell/browser/api/electron_api_app.cc`
`npm run lint:clang-tidy --out-dir ../out/Testing shell/browser/api/electron_api_app.cc`
While `clang-tidy` has a
[long list](https://clang.llvm.org/extra/clang-tidy/checks/list.html)

View File

@@ -25,7 +25,7 @@ You can run `npm run lint` to show any style issues detected by `cpplint` and
## C++ and Python
For C++ and Python, we follow Chromium's [Coding
Style](https://www.chromium.org/developers/coding-style). You can use
Style](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/styleguide.md). You can use
[clang-format](clang-format.md) to format the C++ code automatically. There is
also a script `script/cpplint.py` to check whether all files conform.

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,10 +7,6 @@
</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>
</body>
</html>

View File

@@ -3,21 +3,17 @@ const { app, BrowserWindow, Notification } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
height: 600
})
win.loadFile('index.html')
}
const NOTIFICATION_TITLE = 'Basic Notification'
const NOTIFICATION_BODY = 'Notification from the Main process'
function showNotification () {
const notification = {
title: 'Basic Notification',
body: 'Notification from the Main process'
}
new Notification(notification).show()
new Notification({ title: NOTIFICATION_TITLE, body: NOTIFICATION_BODY }).show()
}
app.whenReady().then(createWindow).then(showNotification)

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

@@ -7,10 +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>Keep an eye on the dock (Mac) or taskbar (Windows, Unity) for this application!</p>
<p>It should indicate a progress that advances from 0 to 100%.</p>
<p>It should then show indeterminate (Windows) or pin at 100% (other operating systems)
briefly and then loop.</p>
</body>
</html>

View File

@@ -1,21 +1,39 @@
const { app, BrowserWindow } = require('electron')
let progressInterval
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
height: 600
})
win.loadFile('index.html')
win.setProgressBar(0.5)
}
const INCREMENT = 0.03
const INTERVAL_DELAY = 100 // ms
let c = 0
progressInterval = setInterval(() => {
// update progress bar to next value
// values between 0 and 1 will show progress, >1 will show indeterminate or stick at 100%
win.setProgressBar(c)
// increment or reset progress bar
if (c < 2) {
c += INCREMENT
} else {
c = (-INCREMENT * 5) // reset to a bit less than 0 to show reset state
}
}, INTERVAL_DELAY)
}
app.whenReady().then(createWindow)
// before the app is terminated, clear both timers
app.on('before-quit', () => {
clearInterval(progressInterval)
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {

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

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Web Bluetooth API</title>
</head>
<body>
<h1>Web Bluetooth API</h1>
<button id="clickme">Test Bluetooth</button>
<p>Currently selected bluetooth device: <strong id="device-name""></strong></p>
<script src="./renderer.js"></script>
</body>
</html>

View File

@@ -0,0 +1,30 @@
const {app, BrowserWindow} = require('electron')
const path = require('path')
function createWindow () {
const mainWindow = new BrowserWindow({
width: 800,
height: 600
})
mainWindow.webContents.on('select-bluetooth-device', (event, deviceList, callback) => {
event.preventDefault()
if (deviceList && deviceList.length > 0) {
callback(deviceList[0].deviceId)
}
})
mainWindow.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})

View File

@@ -0,0 +1,8 @@
async function testIt() {
const device = await navigator.bluetooth.requestDevice({
acceptAllDevices: true
})
document.getElementById('device-name').innerHTML = device.name || `ID: ${device.id}`
}
document.getElementById('clickme').addEventListener('click',testIt)

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>WebHID API</title>
</head>
<body>
<h1>WebHID API</h1>
<button id="clickme">Test WebHID</button>
<h3>HID devices automatically granted access via <i>setDevicePermissionHandler</i></h3>
<div id="granted-devices"></div>
<h3>HID devices automatically granted access via <i>select-hid-device</i></h3>
<div id="granted-devices2"></div>
<script src="./renderer.js"></script>
</body>
</html>

View File

@@ -0,0 +1,50 @@
const {app, BrowserWindow} = require('electron')
const path = require('path')
function createWindow () {
const mainWindow = new BrowserWindow({
width: 800,
height: 600
})
mainWindow.webContents.session.on('select-hid-device', (event, details, callback) => {
event.preventDefault()
if (details.deviceList && details.deviceList.length > 0) {
callback(details.deviceList[0].deviceId)
}
})
mainWindow.webContents.session.on('hid-device-added', (event, device) => {
console.log('hid-device-added FIRED WITH', device)
})
mainWindow.webContents.session.on('hid-device-removed', (event, device) => {
console.log('hid-device-removed FIRED WITH', device)
})
mainWindow.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin, details) => {
if (permission === 'hid' && details.securityOrigin === 'file:///') {
return true
}
})
mainWindow.webContents.session.setDevicePermissionHandler((details) => {
if (details.deviceType === 'hid' && details.origin === 'file://') {
return true
}
})
mainWindow.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})

View File

@@ -0,0 +1,19 @@
async function testIt() {
const grantedDevices = await navigator.hid.getDevices()
let grantedDeviceList = ''
grantedDevices.forEach(device => {
grantedDeviceList += `<hr>${device.productName}</hr>`
})
document.getElementById('granted-devices').innerHTML = grantedDeviceList
const grantedDevices2 = await navigator.hid.requestDevice({
filters: []
})
grantedDeviceList = ''
grantedDevices2.forEach(device => {
grantedDeviceList += `<hr>${device.productName}</hr>`
})
document.getElementById('granted-devices2').innerHTML = grantedDeviceList
}
document.getElementById('clickme').addEventListener('click',testIt)

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Web Serial API</title>
<body>
<h1>Web Serial API</h1>
<button id="clickme">Test Web Serial API</button>
<p>Matching Arduino Uno device: <strong id="device-name""></strong></p>
<script src="./renderer.js"></script>
</body>
</html>

View File

@@ -0,0 +1,54 @@
const {app, BrowserWindow} = require('electron')
const path = require('path')
function createWindow () {
const mainWindow = new BrowserWindow({
width: 800,
height: 600
})
mainWindow.webContents.session.on('select-serial-port', (event, portList, webContents, callback) => {
event.preventDefault()
if (portList && portList.length > 0) {
callback(portList[0].portId)
} else {
callback('') //Could not find any matching devices
}
})
mainWindow.webContents.session.on('serial-port-added', (event, port) => {
console.log('serial-port-added FIRED WITH', port)
})
mainWindow.webContents.session.on('serial-port-removed', (event, port) => {
console.log('serial-port-removed FIRED WITH', port)
})
mainWindow.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin, details) => {
if (permission === 'serial' && details.securityOrigin === 'file:///') {
return true
}
})
mainWindow.webContents.session.setDevicePermissionHandler((details) => {
if (details.deviceType === 'serial' && details.origin === 'file://') {
return true
}
})
mainWindow.loadFile('index.html')
mainWindow.webContents.openDevTools()
}
app.whenReady().then(() => {
createWindow()
app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})

View File

@@ -0,0 +1,19 @@
async function testIt() {
const filters = [
{ usbVendorId: 0x2341, usbProductId: 0x0043 },
{ usbVendorId: 0x2341, usbProductId: 0x0001 }
];
try {
const port = await navigator.serial.requestPort({filters});
const portInfo = port.getInfo();
document.getElementById('device-name').innerHTML = `vendorId: ${portInfo.usbVendorId} | productId: ${portInfo.usbProductId} `
} catch (ex) {
if (ex.name === 'NotFoundError') {
document.getElementById('device-name').innerHTML = 'Device NOT found'
} else {
document.getElementById('device-name').innerHTML = ex
}
}
}
document.getElementById('clickme').addEventListener('click',testIt)

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, dialog } = 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();
});

View File

@@ -4,15 +4,39 @@ This page defines some terminology that is commonly used in Electron development
### ASAR
ASAR stands for Atom Shell Archive Format. An [asar][asar] archive is a simple
ASAR stands for Atom Shell Archive Format. An [asar] archive is a simple
`tar`-like format that concatenates files into a single file. Electron can read
arbitrary files from it without unpacking the whole file.
The ASAR format was created primarily to improve performance on Windows... TODO
The ASAR format was created primarily to improve performance on Windows when
reading large quantities of small files (e.g. when loading your app's JavaScript
dependency tree from `node_modules`).
### code signing
Code signing is a process where an app developer digitally signs their code to
ensure that it hasn't been tampered with after packaging. Both Windows and
macOS implement their own version of code signing. As a desktop app developer,
it's important that you sign your code if you plan on distributing it to the
general public.
For more information, read the [Code Signing] tutorial.
### context isolation
Context isolation is a security measure in Electron that ensures that your
preload script cannot leak privileged Electron or Node.js APIs to the web
contents in your renderer process. With context isolation enabled, the
only way to expose APIs from your preload script is through the
`contextBridge` API.
For more information, read the [Context Isolation] tutorial.
See also: [preload script](#preload-script), [renderer process](#renderer-process)
### CRT
The C Run-time Library (CRT) is the part of the C++ Standard Library that
The C Runtime Library (CRT) is the part of the C++ Standard Library that
incorporates the ISO C99 standard library. The Visual C++ libraries that
implement the CRT support native code development, and both mixed native and
managed code, and pure managed code for .NET development.
@@ -20,8 +44,7 @@ managed code, and pure managed code for .NET development.
### DMG
An Apple Disk Image is a packaging format used by macOS. DMG files are
commonly used for distributing application "installers". [electron-builder]
supports `dmg` as a build target.
commonly used for distributing application "installers".
### IME
@@ -31,19 +54,15 @@ keyboards to input Chinese, Japanese, Korean and Indic characters.
### IDL
Interface description language. Write function signatures and data types in a format that can be used to generate interfaces in Java, C++, JavaScript, etc.
Interface description language. Write function signatures and data types in a
format that can be used to generate interfaces in Java, C++, JavaScript, etc.
### IPC
IPC stands for Inter-Process Communication. Electron uses IPC to send
serialized JSON messages between the [main] and [renderer] processes.
IPC stands for inter-process communication. Electron uses IPC to send
serialized JSON messages between the main and renderer processes.
### libchromiumcontent
A shared library that includes the [Chromium Content module] and all its
dependencies (e.g., Blink, [V8], etc.). Also referred to as "libcc".
- [github.com/electron/libchromiumcontent](https://github.com/electron/libchromiumcontent)
see also: [main process](#main-process), [renderer process](#renderer-process)
### main process
@@ -68,10 +87,22 @@ MAS, see the [Mac App Store Submission Guide].
### Mojo
An IPC system for communicating intra- or inter-process, and that's important because Chrome is keen on being able to split its work into separate processes or not, depending on memory pressures etc.
An IPC system for communicating intra- or inter-process, and that's important
because Chrome is keen on being able to split its work into separate processes
or not, depending on memory pressures etc.
See https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md
See also: [IPC](#ipc)
### MSI
On Windows, MSI packages are used by the Windows Installer
(also known as Microsoft Installer) service to install and configure
applications.
More information can be found in [Microsoft's documentation][msi].
### native modules
Native modules (also called [addons] in
@@ -85,22 +116,33 @@ likely to use a different V8 version from the Node binary installed in your
system, you have to manually specify the location of Electrons headers when
building native modules.
See also [Using Native Node Modules].
For more information, read the [Native Node Modules] tutorial.
### NSIS
### notarization
Nullsoft Scriptable Install System is a script-driven Installer
authoring tool for Microsoft Windows. It is released under a combination of
free software licenses, and is a widely-used alternative to commercial
proprietary products like InstallShield. [electron-builder] supports NSIS
as a build target.
Notarization is a macOS-specific process where a developer can send a
code-signed app to Apple servers to get verified for malicious
components through an automated service.
See also: [code signing](#code-signing)
### OSR
OSR (Off-screen rendering) can be used for loading heavy page in
OSR (offscreen rendering) can be used for loading heavy page in
background and then displaying it after (it will be much faster).
It allows you to render page without showing it on screen.
For more information, read the [Offscreen Rendering][osr] tutorial.
### preload script
Preload scripts contain code that executes in a renderer process
before its web contents begin loading. These scripts run within
the renderer context, but are granted more privileges by having
access to Node.js APIs.
See also: [renderer process](#renderer-process), [context isolation](#context-isolation)
### process
A process is an instance of a computer program that is being executed. Electron
@@ -120,13 +162,17 @@ The renderer process is a browser window in your app. Unlike the main process,
there can be multiple of these and each is run in a separate process.
They can also be hidden.
In normal browsers, web pages usually run in a sandboxed environment and are not
allowed access to native resources. Electron users, however, have the power to
use Node.js APIs in web pages allowing lower level operating system
interactions.
See also: [process](#process), [main process](#main-process)
### sandbox
The sandbox is a security feature inherited from Chromium that restricts
your renderer processes to a limited set of permissions.
For more information, read the [Process Sandboxing] tutorial.
See also: [process](#process)
### Squirrel
Squirrel is an open-source framework that enables Electron apps to update
@@ -174,13 +220,15 @@ embedded content.
[addons]: https://nodejs.org/api/addons.html
[asar]: https://github.com/electron/asar
[autoUpdater]: api/auto-updater.md
[Chromium Content module]: https://www.chromium.org/developers/content-module
[electron-builder]: https://github.com/electron-userland/electron-builder
[libchromiumcontent]: #libchromiumcontent
[Mac App Store Submission Guide]: tutorial/mac-app-store-submission-guide.md
[autoupdater]: api/auto-updater.md
[code signing]: tutorial/code-signing.md
[context isolation]: tutorial/context-isolation.md
[mac app store submission guide]: tutorial/mac-app-store-submission-guide.md
[main]: #main-process
[msi]: https://docs.microsoft.com/en-us/windows/win32/msi/windows-installer-portal
[offscreen rendering]: tutorial/offscreen-rendering.md
[process sandboxing]: tutorial/sandbox.md
[renderer]: #renderer-process
[userland]: #userland
[Using Native Node Modules]: tutorial/using-native-node-modules.md
[V8]: #v8
[using native node modules]: tutorial/using-native-node-modules.md
[v8]: #v8

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -45,4 +45,4 @@ If the V8 context crashes, the DevTools will display this message.
Chromium logs can be enabled via the `ELECTRON_ENABLE_LOGGING` environment variable. For more information, see the [environment variables documentation](../api/environment-variables.md#electron_enable_logging).
Alternatively, the command line argument `--enable-logging` can be passed. More information is available in the [command line switches documentation](../api/command-line-switches.md#--enable-logging).
Alternatively, the command line argument `--enable-logging` can be passed. More information is available in the [command line switches documentation](../api/command-line-switches.md#--enable-loggingfile).

View File

@@ -56,7 +56,7 @@ will then be your distribution to deliver to users.
### With an app source code archive
Instead of from shipping your app by copying all of its source files, you can
Instead of shipping your app by copying all of its source files, you can
package your app into an [asar] archive to improve the performance of reading
files on platforms like Windows, if you are not already using a bundler such
as Parcel or Webpack.

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

@@ -4,39 +4,38 @@
Context Isolation is a feature that ensures that both your `preload` scripts and Electron's internal logic run in a separate context to the website you load in a [`webContents`](../api/web-contents.md). This is important for security purposes as it helps prevent the website from accessing Electron internals or the powerful APIs your preload script has access to.
This means that the `window` object that your preload script has access to is actually a **different** object than the website would have access to. For example, if you set `window.hello = 'wave'` in your preload script and context isolation is enabled `window.hello` will be undefined if the website tries to access it.
This means that the `window` object that your preload script has access to is actually a **different** object than the website would have access to. For example, if you set `window.hello = 'wave'` in your preload script and context isolation is enabled, `window.hello` will be undefined if the website tries to access it.
Every single application should have context isolation enabled and from Electron 12 it will be enabled by default.
## How do I enable it?
From Electron 12, it will be enabled by default. For lower versions it is an option in the `webPreferences` option when constructing `new BrowserWindow`'s.
```javascript
const mainWindow = new BrowserWindow({
webPreferences: {
contextIsolation: true
}
})
```
Context isolation has been enabled by default since Electron 12, and it is a recommended security setting for _all applications_.
## Migration
> I used to provide APIs from my preload script using `window.X = apiObject` now what?
> Without context isolation, I used to provide APIs from my preload script using `window.X = apiObject`. Now what?
Exposing APIs from your preload script to the loaded website is a common usecase and there is a dedicated module in Electron to help you do this in a painless way.
### Before: context isolation disabled
**Before: With context isolation disabled**
Exposing APIs from your preload script to a loaded website in the renderer process is a common use-case. With context isolation disabled, your preload script would share a common global `window` object with the renderer. You could then attach arbitrary properties to a preload script:
```javascript
```javascript title='preload.js'
// preload with contextIsolation disabled
window.myAPI = {
doAThing: () => {}
}
```
**After: With context isolation enabled**
The `doAThing()` function could then be used directly in the renderer process:
```javascript
```javascript title='renderer.js'
// use the exposed API in the renderer
window.myAPI.doAThing()
```
### After: context isolation enabled
There is a dedicated module in Electron to help you do this in a painless way. The [`contextBridge`](../api/context-bridge.md) module can be used to **safely** expose APIs from your preload script's isolated context to the context the website is running in. The API will also be accessible from the website on `window.myAPI` just like it was before.
```javascript title='preload.js'
// preload with contextIsolation enabled
const { contextBridge } = require('electron')
contextBridge.exposeInMainWorld('myAPI', {
@@ -44,26 +43,63 @@ contextBridge.exposeInMainWorld('myAPI', {
})
```
The [`contextBridge`](../api/context-bridge.md) module can be used to **safely** expose APIs from the isolated context your preload script runs in to the context the website is running in. The API will also be accessible from the website on `window.myAPI` just like it was before.
```javascript title='renderer.js'
// use the exposed API in the renderer
window.myAPI.doAThing()
```
You should read the `contextBridge` documentation linked above to fully understand its limitations. For instance you can't send custom prototypes or symbols over the bridge.
Please read the `contextBridge` documentation linked above to fully understand its limitations. For instance, you can't send custom prototypes or symbols over the bridge.
## Security Considerations
## Security considerations
Just enabling `contextIsolation` and using `contextBridge` does not automatically mean that everything you do is safe. For instance this code is **unsafe**.
Just enabling `contextIsolation` and using `contextBridge` does not automatically mean that everything you do is safe. For instance, this code is **unsafe**.
```javascript
```javascript title='preload.js'
// ❌ Bad code
contextBridge.exposeInMainWorld('myAPI', {
send: ipcRenderer.send
})
```
It directly exposes a powerful API without any kind of argument filtering. This would allow any website to send arbitrary IPC messages which you do not want to be possible. The correct way to expose IPC-based APIs would instead be to provide one method per IPC message.
It directly exposes a powerful API without any kind of argument filtering. This would allow any website to send arbitrary IPC messages, which you do not want to be possible. The correct way to expose IPC-based APIs would instead be to provide one method per IPC message.
```javascript
```javascript title='preload.js'
// ✅ Good code
contextBridge.exposeInMainWorld('myAPI', {
loadPreferences: () => ipcRenderer.invoke('load-prefs')
})
```
## Usage with TypeScript
If you're building your Electron app with TypeScript, you'll want to add types to your APIs exposed over the context bridge. The renderer's `window` object won't have the correct typings unless you extend the types with a [declaration file].
For example, given this `preload.ts` script:
```typescript title='preload.ts'
contextBridge.exposeInMainWorld('electronAPI', {
loadPreferences: () => ipcRenderer.invoke('load-prefs')
})
```
You can create a `renderer.d.ts` declaration file and globally augment the `Window` interface:
```typescript title='renderer.d.ts'
export interface IElectronAPI {
loadPreferences: () => Promise<void>,
}
declare global {
interface Window {
electronAPI: IElectronAPI
}
}
```
Doing so will ensure that the TypeScript compiler will know about the `electronAPI` property on your global `window` object when writing scripts in your renderer process:
```typescript title='renderer.ts'
window.electronAPI.loadPreferences()
```
[declaration file]: https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html

View File

@@ -80,9 +80,9 @@ Starting with the `index.html` file:
</html>
```
And the `style.css` file:
And the `styles.css` file:
```css title='style.css'
```css title='styles.css'
@media (prefers-color-scheme: dark) {
body { background: #333; color: white; }
}
@@ -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

108
docs/tutorial/devices.md Normal file
View File

@@ -0,0 +1,108 @@
# Device Access
Like Chromium based browsers, Electron provides access to device hardware
through web APIs. For the most part these APIs work like they do in a browser,
but there are some differences that need to be taken into account. The primary
difference between Electron and browsers is what happens when device access is
requested. In a browser, users are presented with a popup where they can grant
access to an individual device. In Electron APIs are provided which can be
used by a developer to either automatically pick a device or prompt users to
pick a device via a developer created interface.
## Web Bluetooth API
The [Web Bluetooth API](https://web.dev/bluetooth/) can be used to communicate
with bluetooth devices. In order to use this API in Electron, developers will
need to handle the [`select-bluetooth-device` event on the webContents](../api/web-contents.md#event-select-bluetooth-device)
associated with the device request.
### Example
This example demonstrates an Electron application that automatically selects
the first available bluetooth device when the `Test Bluetooth` button is
clicked.
```javascript fiddle='docs/fiddles/features/web-bluetooth'
```
## WebHID API
The [WebHID API](https://web.dev/hid/) can be used to access HID devices such
as keyboards and gamepads. Electron provides several APIs for working with
the WebHID API:
* The [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device)
can be used to select a HID device when a call to
`navigator.hid.requestDevice` is made. Additionally the [`hid-device-added`](../api/session.md#event-hid-device-added)
and [`hid-device-removed`](../api/session.md#event-hid-device-removed) events
on the Session can be used to handle devices being plugged in or unplugged during the
`navigator.hid.requestDevice` process.
* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler)
can be used to provide default permissioning to devices without first calling
for permission to devices via `navigator.hid.requestDevice`. Additionally,
the default behavior of Electron is to store granted device permision through
the lifetime of the corresponding WebContents. If longer term storage is
needed, a developer can store granted device permissions (eg when handling
the `select-hid-device` event) and then read from that storage with
`setDevicePermissionHandler`.
* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler)
can be used to disable HID access for specific origins.
### Blocklist
By default Electron employs the same [blocklist](https://github.com/WICG/webhid/blob/main/blocklist.txt)
used by Chromium. If you wish to override this behavior, you can do so by
setting the `disable-hid-blocklist` flag:
```javascript
app.commandLine.appendSwitch('disable-hid-blocklist')
```
### Example
This example demonstrates an Electron application that automatically selects
HID devices through [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler)
and through [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device)
when the `Test WebHID` button is clicked.
```javascript fiddle='docs/fiddles/features/web-hid'
```
## Web Serial API
The [Web Serial API](https://web.dev/serial/) can be used to access serial
devices that are connected via serial port, USB, or Bluetooth. In order to use
this API in Electron, developers will need to handle the
[`select-serial-port` event on the Session](../api/session.md#event-select-serial-port)
associated with the serial port request.
There are several additional APIs for working with the Web Serial API:
* The [`serial-port-added`](../api/session.md#event-serial-port-added)
and [`serial-port-removed`](../api/session.md#event-serial-port-removed) events
on the Session can be used to handle devices being plugged in or unplugged during the
`navigator.serial.requestPort` process.
* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler)
can be used to provide default permissioning to devices without first calling
for permission to devices via `navigator.serial.requestPort`. Additionally,
the default behavior of Electron is to store granted device permision through
the lifetime of the corresponding WebContents. If longer term storage is
needed, a developer can store granted device permissions (eg when handling
the `select-serial-port` event) and then read from that storage with
`setDevicePermissionHandler`.
* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler)
can be used to disable serial access for specific origins.
### Example
This example demonstrates an Electron application that automatically selects
serial devices through [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler)
as well as demonstrating selecting the first available Arduino Uno serial device (if connected) through
[`select-serial-port` event on the Session](../api/session.md#event-select-serial-port)
when the `Test Web Serial` button is clicked.
```javascript fiddle='docs/fiddles/features/web-serial'
```

View File

@@ -1,23 +1,28 @@
# 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 | v14.17 |
| 15.0.0 | 2021-Jul-20 | 2021-Sep-01 | 2021-Sep-21 | M94 | v16.5 |
| 16.0.0 | -- | 2021-Sep-23 | 2021-Nov-16 | M96 | TBD |

View File

@@ -2,43 +2,31 @@
> A detailed look at our versioning policy and implementation.
As of version 2.0.0, Electron follows [SemVer](#semver). The following command will install the most recent stable build of Electron:
As of version 2.0.0, Electron follows the [SemVer](#semver) spec. The following command will install the most recent stable build of Electron:
```sh
```sh npm2yarn
npm install --save-dev electron
```
To update an existing project to use the latest stable version:
```sh
```sh npm2yarn
npm install --save-dev electron@latest
```
## Version 1.x
Electron versions *< 2.0* did not conform to the [SemVer](https://semver.org) spec: major versions corresponded to end-user API changes, minor versions corresponded to Chromium major releases, and patch versions corresponded to new features and bug fixes. While convenient for developers merging features, it creates problems for developers of client-facing applications. The QA testing cycles of major apps like Slack, Stride, Teams, Skype, VS Code, Atom, and Desktop can be lengthy and stability is a highly desired outcome. There is a high risk in adopting new features while trying to absorb bug fixes.
Here is an example of the 1.x strategy:
![1.x Versioning](../images/versioning-sketch-0.png)
An app developed with `1.8.1` cannot take the `1.8.3` bug fix without either absorbing the `1.8.2` feature, or by backporting the fix and maintaining a new release line.
## Version 2.0 and Beyond
## Versioning scheme
There are several major changes from our 1.x strategy outlined below. Each change is intended to satisfy the needs and priorities of developers/maintainers and app developers.
1. Strict use of SemVer
1. Strict use of the [SemVer](#semver) spec
2. Introduction of semver-compliant `-beta` tags
3. Introduction of [conventional commit messages](https://conventionalcommits.org/)
4. Well-defined stabilization branches
5. The `master` branch is versionless; only stabilization branches contain version information
5. The `main` branch is versionless; only stabilization branches contain version information
We will cover in detail how git branching works, how npm tagging works, what developers should expect to see, and how one can backport changes.
# SemVer
From 2.0 onward, Electron will follow SemVer.
## SemVer
Below is a table explicitly mapping types of changes to their corresponding category of SemVer (e.g. Major, Minor, Patch).
@@ -48,22 +36,25 @@ Below is a table explicitly mapping types of changes to their corresponding cate
| Node.js major version updates | Node.js minor version updates | Node.js patch version updates |
| Chromium version updates | | fix-related chromium patches |
For more information, see the [Semantic Versioning 2.0.0](https://semver.org/) spec.
Note that most Chromium updates will be considered breaking. Fixes that can be backported will likely be cherry-picked as patches.
# Stabilization Branches
## Stabilization branches
Stabilization branches are branches that run parallel to master, taking in only cherry-picked commits that are related to security or stability. These branches are never merged back to master.
Stabilization branches are branches that run parallel to `main`, taking in only cherry-picked commits that are related to security or stability. These branches are never merged back to `main`.
![Stabilization Branches](../images/versioning-sketch-1.png)
Since Electron 8, stabilization branches are always **major** version lines, and named against the following template `$MAJOR-x-y` e.g. `8-x-y`. Prior to that we used **minor** version lines and named them as `$MAJOR-$MINOR-x` e.g. `2-0-x`
Since Electron 8, stabilization branches are always **major** version lines, and named against the following template `$MAJOR-x-y` e.g. `8-x-y`. Prior to that we used **minor** version lines and named them as `$MAJOR-$MINOR-x` e.g. `2-0-x`.
We allow for multiple stabilization branches to exist simultaneously, one for each supported version. For more details on which versions are supported, see our [Electron Release Timelines](./electron-timelines.md) doc.
We allow for multiple stabilization branches to exist simultaneously, and intend to support at least two in parallel at all times, backporting security fixes as necessary.
![Multiple Stability Branches](../images/versioning-sketch-2.png)
Older lines will not be supported by GitHub, but other groups can take ownership and backport stability and security fixes on their own. We discourage this, but recognize that it makes life easier for many app developers.
Older lines will not be supported by the Electron project, but other groups can take ownership and backport stability and security fixes on their own. We discourage this, but recognize that it makes life easier for many app developers.
# Beta Releases and Bug Fixes
## Beta releases and bug fixes
Developers want to know which releases are _safe_ to use. Even seemingly innocent features can introduce regressions in complex applications. At the same time, locking to a fixed version is dangerous because youre ignoring security patches and bug fixes that may have come out since your version. Our goal is to allow the following standard semver ranges in `package.json` :
@@ -116,15 +107,7 @@ A few examples of how various SemVer ranges will pick up new releases:
![Semvers and Releases](../images/versioning-sketch-7.png)
# Missing Features: Alphas
Our strategy has a few tradeoffs, which for now we feel are appropriate. Most importantly that new features in master may take a while before reaching a stable release line. If you want to try a new feature immediately, you will have to build Electron yourself.
As a future consideration, we may introduce one or both of the following:
* alpha releases that have looser stability constraints to betas; for example it would be allowable to admit new features while a stability channel is in _alpha_
# Feature Flags
## Feature flags
Feature flags are a common practice in Chromium, and are well-established in the web-development ecosystem. In the context of Electron, a feature flag or **soft branch** must have the following properties:
@@ -132,20 +115,29 @@ Feature flags are a common practice in Chromium, and are well-established in the
* it completely segments new and old code paths; refactoring old code to support a new feature _violates_ the feature-flag contract
* feature flags are eventually removed after the feature is released
# Semantic Commits
## Semantic commits
We seek to increase clarity at all levels of the update and releases process. Starting with `2.0.0` we will require pull requests adhere to the [Conventional Commits](https://conventionalcommits.org/) spec, which can be summarized as follows:
All pull requests must adhere to the [Conventional Commits](https://conventionalcommits.org/) spec, which can be summarized as follows:
* Commits that would result in a SemVer **major** bump must start their body with `BREAKING CHANGE:`.
* Commits that would result in a SemVer **minor** bump must start with `feat:`.
* Commits that would result in a SemVer **patch** bump must start with `fix:`.
* We allow squashing of commits, provided that the squashed message adheres to the above message format.
* It is acceptable for some commits in a pull request to not include a semantic prefix, as long as the pull request title contains a meaningful encompassing semantic message.
The `electron/electron` repository also enforces squash merging, so you only need to make sure that your pull request has the correct title prefix.
# Versioned `master`
## Versioned `main` branch
* The `master` branch will always contain the next major version `X.0.0-nightly.DATE` in its `package.json`
* Release branches are never merged back to master
* Release branches _do_ contain the correct version in their `package.json`
* As soon as a release branch is cut for a major, master must be bumped to the next major. I.e. `master` is always versioned as the next theoretical release branch
* The `main` branch will always contain the next major version `X.0.0-nightly.DATE` in its `package.json`.
* Release branches are never merged back to `main`.
* Release branches _do_ contain the correct version in their `package.json`.
* As soon as a release branch is cut for a major, `main` must be bumped to the next major (i.e. `main` is always versioned as the next theoretical release branch).
## Historical versioning (Electron 1.X)
Electron versions *< 2.0* did not conform to the [SemVer](https://semver.org) spec: major versions corresponded to end-user API changes, minor versions corresponded to Chromium major releases, and patch versions corresponded to new features and bug fixes. While convenient for developers merging features, it creates problems for developers of client-facing applications. The QA testing cycles of major apps like Slack, Teams, Skype, VS Code, and GitHub Desktop can be lengthy and stability is a highly desired outcome. There is a high risk in adopting new features while trying to absorb bug fixes.
Here is an example of the 1.x strategy:
![1.x Versioning](../images/versioning-sketch-0.png)
An app developed with `1.8.1` cannot take the `1.8.3` bug fix without either absorbing the `1.8.2` feature, or by backporting the fix and maintaining a new release line.

View File

@@ -51,4 +51,4 @@ Somewhere in the Electron binary there will be a sequence of bytes that look lik
To flip a fuse you find its position in the fuse wire and change it to "0" or "1" depending on the state you'd like.
You can view the current schema [here](https://github.com/electron/electron/blob/master/build/fuses/fuses.json).
You can view the current schema [here](https://github.com/electron/electron/blob/master/build/fuses/fuses.json5).

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

@@ -49,11 +49,11 @@ is a great place to get advice from other Electron app developers.
the [GitHub issue tracker][issue-tracker] to see if any existing issues match your
problem. If not, feel free to fill out our bug report template and submit a new issue.
[chromium](https://www.chromium.org/)
[node](https://nodejs.org/)
[mdn-guide](https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web)
[node-guide](https://nodejs.dev/learn)
[comic](https://www.google.com/googlebooks/chrome/)
[fiddle](https://electronjs.org/fiddle)
[issue-tracker](https://github.com/electron/electron/issues)
[discord](https://discord.gg/electron)
[chromium]: https://www.chromium.org/
[node]: https://nodejs.org/
[mdn-guide]: https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web
[node-guide]: https://nodejs.dev/learn
[comic]: https://www.google.com/googlebooks/chrome/
[fiddle]: https://electronjs.org/fiddle
[issue-tracker]: https://github.com/electron/electron/issues
[discord]: https://discord.gg/electron

View File

@@ -0,0 +1,214 @@
---
title: Launching Your Electron App From a 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 lifecycle and create a native browser window.
```javascript
const { app, BrowserWindow, shell } = require('electron')
const path = require('path')
```
Next, we will proceed to register our application to handle all "`electron-fiddle://`" protocols.
```javascript
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.
```javascript
const 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 Windows 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:
```javascript
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()
})
// Handle 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:
```javascript
// 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()
})
// Handle 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.
```javascript
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
```
## Important notes
### Packaging
On macOS and Linux, this feature will only work 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 `Info.plist` and the Linux `.desktop` files for the app are updated to include
the new protocol handler. Some of the Electron tools for bundling and distributing apps handle
this for you.
#### [Electron Forge](https://electronforge.io)
If you're using Electron Forge, adjust `packagerConfig` for macOS support, and the configuration for
the appropriate Linux makers for Linux support, in your [Forge
configuration](https://www.electronforge.io/configuration) _(please note the following example only
shows the bare minimum needed to add the configuration changes)_:
```json
{
"config": {
"forge": {
"packagerConfig": {
"protocols": [
{
"name": "Electron Fiddle",
"schemes": ["electron-fiddle"]
}
]
},
"makers": [
{
"name": "@electron-forge/maker-deb",
"config": {
"mimeType": ["x-scheme-handler/electron-fiddle"]
}
}
]
}
}
}
```
#### [Electron Packager](https://github.com/electron/electron-packager)
For macOS support:
If you're using Electron Packager's API, adding support for protocol handlers is similar to how
Electron Forge is handled, except
`protocols` is part of the Packager options passed to the `packager` function.
```javascript
const packager = require('electron-packager')
packager({
// ...other options...
protocols: [
{
name: 'Electron Fiddle',
schemes: ['electron-fiddle']
}
]
}).then(paths => console.log(`SUCCESS: Created ${paths.join(', ')}`))
.catch(err => console.error(`ERROR: ${err.message}`))
```
If you're using Electron Packager's CLI, use the `--protocol` and `--protocol-name` flags. For
example:
```shell
npx electron-packager . --protocol=electron-fiddle --protocol-name="Electron Fiddle"
```
## Conclusion
After you start your Electron app, you can 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
@@ -55,18 +51,17 @@ Starting with a working application from the
```javascript fiddle='docs/fiddles/features/notifications/main'
const { Notification } = require('electron')
const NOTIFICATION_TITLE = 'Basic Notification'
const NOTIFICATION_BODY = 'Notification from the Main process'
function showNotification () {
const notification = {
title: 'Basic Notification',
body: 'Notification from the Main process'
}
new Notification(notification).show()
new Notification({ title: NOTIFICATION_TITLE, body: NOTIFICATION_BODY }).show()
}
app.whenReady().then(createWindow).then(showNotification)
```
After launching the Electron application, you should see the notification:
After launching the Electron application, you should see the system notification:
![Notification in the Main process](../images/notification-main.png)
@@ -135,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](../images/performance-cpu-prof.png)
![performance-heap-prof]
![Performance Heap Memory Profile](../images/performance-heap-prof.png)
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
@@ -412,8 +412,6 @@ As of writing this article, the popular choices include [Webpack][webpack],
[Parcel][parcel], and [rollup.js][rollup].
[security]: ./security.md
[performance-cpu-prof]: ../images/performance-cpu-prof.png
[performance-heap-prof]: ../images/performance-heap-prof.png
[chrome-devtools-tutorial]: https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/
[worker-threads]: https://nodejs.org/api/worker_threads.html
[web-workers]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers

View File

@@ -83,7 +83,7 @@ As a practical example, the app shown in the [quick start guide][quick-start-lif
uses `app` APIs to create a more native application window experience.
```js title='main.js'
// quitting the app when no windows are open on macOS
// quitting the app when no windows are open on non-macOS platforms
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})
@@ -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
@@ -7,16 +7,16 @@ without the need of switching to the window itself.
On Windows, you can use a taskbar button to display a progress bar.
![Windows Progress Bar][windows-progress-bar]
![Windows Progress Bar](../images/windows-progress-bar.png)
On macOS, the progress bar will be displayed as a part of the dock icon.
![macOS Progress Bar][macos-progress-bar]
![macOS Progress Bar](../images/macos-progress-bar.png)
On Linux, the Unity graphical interface also has a similar feature that allows
you to specify the progress bar in the launcher.
![Linux Progress Bar][linux-progress-bar]
![Linux Progress Bar](../images/linux-progress-bar.png)
> NOTE: on Windows, each window can have its own progress bar, whereas on macOS
and Linux (Unity) there can be only one progress bar for the application.
@@ -31,30 +31,70 @@ currently at 63% towards completion, you would call it as
`setProgressBar(0.63)`.
Setting the parameter to negative values (e.g. `-1`) will remove the progress
bar, whereas setting it to values greater than `1` (e.g. `2`) will switch the
progress bar to indeterminate mode (Windows-only -- it will clamp to 100%
otherwise). In this mode, a progress bar remains active but does not show an
actual percentage. Use this mode for situations when you do not know how long
an operation will take to complete.
bar. Setting it to a value greater than `1` will indicate an indeterminate progress bar
in Windows or clamp to 100% in other operating systems. An indeterminate progress bar
remains active but does not show an actual percentage, and is used for situations when
you do not know how long an operation will take to complete.
See the [API documentation for more options and modes][setprogressbar].
## Example
Starting with a working application from the
[Quick Start Guide](quick-start.md), add the following lines to the
`main.js` file:
In this example, we add a progress bar to the main window that increments over time
using Node.js timers.
```javascript fiddle='docs/fiddles/features/progress-bar'
const { BrowserWindow } = require('electron')
const win = new BrowserWindow()
const { app, BrowserWindow } = require('electron')
win.setProgressBar(0.5)
let progressInterval
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600
})
win.loadFile('index.html')
const INCREMENT = 0.03
const INTERVAL_DELAY = 100 // ms
let c = 0
progressInterval = setInterval(() => {
// update progress bar to next value
// values between 0 and 1 will show progress, >1 will show indeterminate or stick at 100%
win.setProgressBar(c)
// increment or reset progress bar
if (c < 2) c += INCREMENT
else c = 0
}, INTERVAL_DELAY)
}
app.whenReady().then(createWindow)
// before the app is terminated, clear both timers
app.on('before-quit', () => {
clearInterval(progressInterval)
})
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, you should see the bar in
the dock (macOS) or taskbar (Windows, Unity), indicating the progress
percentage you just defined.
After launching the Electron application, the dock (macOS) or taskbar (Windows, Unity)
should show a progress bar that starts at zero and progresses through 100% to completion.
It should then show indeterminate (Windows) or pin to 100% (other operating systems)
briefly and then loop.
![macOS dock progress bar](../images/dock-progress-bar.png)
@@ -62,8 +102,4 @@ For macOS, the progress bar will also be indicated for your application
when using [Mission Control](https://support.apple.com/en-us/HT204100):
![Mission Control Progress Bar](../images/mission-control-progress-bar.png)
[windows-progress-bar]: https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png
[macos-progress-bar]: ../images/macos-progress-bar.png
[linux-progress-bar]: ../images/linux-progress-bar.png
[setprogressbar]: ../api/browser-window.md#winsetprogressbarprogress-options

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)
@@ -299,7 +299,9 @@ function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
preload: path.join(__dirname, 'preload.js')
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
win.loadFile('index.html')
@@ -440,7 +442,7 @@ window.addEventListener('DOMContentLoaded', () => {
</html>
```
```fiddle docs/fiddles/quickstart
```fiddle docs/fiddles/quick-start
```
To summarize all the steps we've done:

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

@@ -44,7 +44,7 @@ Chromium shared library and Node.js. Vulnerabilities affecting these components
may impact the security of your application. By updating Electron to the latest
version, you ensure that critical vulnerabilities (such as *nodeIntegration bypasses*)
are already patched and cannot be exploited in your application. For more information,
see "[Use a current version of Electron](#15-use-a-current-version-of-electron)".
see "[Use a current version of Electron](#16-use-a-current-version-of-electron)".
* **Evaluate your dependencies.** While NPM provides half a million reusable packages,
it is your responsibility to choose trusted 3rd-party libraries. If you use outdated
@@ -88,18 +88,19 @@ You should at least follow these steps to improve the security of your applicati
1. [Only load secure content](#1-only-load-secure-content)
2. [Disable the Node.js integration in all renderers that display remote content](#2-do-not-enable-nodejs-integration-for-remote-content)
3. [Enable context isolation in all renderers that display remote content](#3-enable-context-isolation-for-remote-content)
4. [Use `ses.setPermissionRequestHandler()` in all sessions that load remote content](#4-handle-session-permission-requests-from-remote-content)
5. [Do not disable `webSecurity`](#5-do-not-disable-websecurity)
6. [Define a `Content-Security-Policy`](#6-define-a-content-security-policy) and use restrictive rules (i.e. `script-src 'self'`)
7. [Do not set `allowRunningInsecureContent` to `true`](#7-do-not-set-allowrunninginsecurecontent-to-true)
8. [Do not enable experimental features](#8-do-not-enable-experimental-features)
9. [Do not use `enableBlinkFeatures`](#9-do-not-use-enableblinkfeatures)
10. [`<webview>`: Do not use `allowpopups`](#10-do-not-use-allowpopups)
11. [`<webview>`: Verify options and params](#11-verify-webview-options-before-creation)
12. [Disable or limit navigation](#12-disable-or-limit-navigation)
13. [Disable or limit creation of new windows](#13-disable-or-limit-creation-of-new-windows)
14. [Do not use `openExternal` with untrusted content](#14-do-not-use-openexternal-with-untrusted-content)
15. [Use a current version of Electron](#15-use-a-current-version-of-electron)
4. [Enable sandboxing](#4-enable-sandboxing)
5. [Use `ses.setPermissionRequestHandler()` in all sessions that load remote content](#5-handle-session-permission-requests-from-remote-content)
6. [Do not disable `webSecurity`](#6-do-not-disable-websecurity)
7. [Define a `Content-Security-Policy`](#7-define-a-content-security-policy) and use restrictive rules (i.e. `script-src 'self'`)
8. [Do not set `allowRunningInsecureContent` to `true`](#8-do-not-set-allowrunninginsecurecontent-to-true)
9. [Do not enable experimental features](#9-do-not-enable-experimental-features)
10. [Do not use `enableBlinkFeatures`](#10-do-not-use-enableblinkfeatures)
11. [`<webview>`: Do not use `allowpopups`](#11-do-not-use-allowpopups)
12. [`<webview>`: Verify options and params](#12-verify-webview-options-before-creation)
13. [Disable or limit navigation](#13-disable-or-limit-navigation)
14. [Disable or limit creation of new windows](#14-disable-or-limit-creation-of-new-windows)
15. [Do not use `openExternal` with untrusted content](#15-do-not-use-openexternal-with-untrusted-content)
16. [Use a current version of Electron](#16-use-a-current-version-of-electron)
To automate the detection of misconfigurations and insecure patterns, it is
possible to use
@@ -239,7 +240,26 @@ and prevent the use of Node primitives `contextIsolation` **must** also be used.
For more information on what `contextIsolation` is and how to enable it please
see our dedicated [Context Isolation](context-isolation.md) document.
## 4) Handle Session Permission Requests From Remote Content
## 4) Enable Sandboxing
[Sandboxing](sandbox.md) is a Chromium feature that uses the operating system to
significantly limit what renderer processes have access to. You should enable
the sandbox in all renderers. Loading, reading or processing any untrusted
content in an unsandboxed process, including the main process, is not advised.
### How?
When creating a window, pass the `sandbox: true` option in `webPreferences`:
```js
const win = new BrowserWindow({
webPreferences: {
sandbox: true
}
})
```
## 5) Handle Session Permission Requests From Remote Content
You may have seen permission requests while using Chrome: They pop up whenever
the website attempts to use a feature that the user has to manually approve (
@@ -277,7 +297,7 @@ session
})
```
## 5) Do Not Disable WebSecurity
## 6) Do Not Disable WebSecurity
_Recommendation is Electron's default_
@@ -318,7 +338,7 @@ const mainWindow = new BrowserWindow()
<webview src="page.html"></webview>
```
## 6) Define a Content Security Policy
## 7) Define a Content Security Policy
A Content Security Policy (CSP) is an additional layer of protection against
cross-site-scripting attacks and data injection attacks. We recommend that they
@@ -374,7 +394,7 @@ on a page directly in the markup using a `<meta>` tag:
<meta http-equiv="Content-Security-Policy" content="default-src 'none'">
```
## 7) Do Not Set `allowRunningInsecureContent` to `true`
## 8) Do Not Set `allowRunningInsecureContent` to `true`
_Recommendation is Electron's default_
@@ -407,7 +427,7 @@ const mainWindow = new BrowserWindow({
const mainWindow = new BrowserWindow({})
```
## 8) Do Not Enable Experimental Features
## 9) Do Not Enable Experimental Features
_Recommendation is Electron's default_
@@ -439,7 +459,7 @@ const mainWindow = new BrowserWindow({
const mainWindow = new BrowserWindow({})
```
## 9) Do Not Use `enableBlinkFeatures`
## 10) Do Not Use `enableBlinkFeatures`
_Recommendation is Electron's default_
@@ -471,7 +491,7 @@ const mainWindow = new BrowserWindow({
const mainWindow = new BrowserWindow()
```
## 10) Do Not Use `allowpopups`
## 11) Do Not Use `allowpopups`
_Recommendation is Electron's default_
@@ -498,7 +518,7 @@ you know it needs that feature.
<webview src="page.html"></webview>
```
## 11) Verify WebView Options Before Creation
## 12) Verify WebView Options Before Creation
A WebView created in a renderer process that does not have Node.js integration
enabled will not be able to enable integration itself. However, a WebView will
@@ -545,7 +565,7 @@ app.on('web-contents-created', (event, contents) => {
Again, this list merely minimizes the risk, it does not remove it. If your goal
is to display a website, a browser will be a more secure option.
## 12) Disable or limit navigation
## 13) Disable or limit navigation
If your app has no need to navigate or only needs to navigate to known pages,
it is a good idea to limit navigation outright to that known scope, disallowing
@@ -589,7 +609,7 @@ app.on('web-contents-created', (event, contents) => {
})
```
## 13) Disable or limit creation of new windows
## 14) Disable or limit creation of new windows
If you have a known set of windows, it's a good idea to limit the creation of
additional windows in your app.
@@ -636,7 +656,7 @@ app.on('web-contents-created', (event, contents) => {
})
```
## 14) Do not use `openExternal` with untrusted content
## 15) Do not use `openExternal` with untrusted content
Shell's [`openExternal`][open-external] allows opening a given protocol URI with
the desktop's native utilities. On macOS, for instance, this function is similar
@@ -663,7 +683,7 @@ const { shell } = require('electron')
shell.openExternal('https://example.com/index.html')
```
## 15) Use a current version of Electron
## 16) Use a current version of Electron
You should strive for always using the latest available version of Electron.
Whenever a new major version is released, you should attempt to update your

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

@@ -16,7 +16,6 @@ you can interact with the community in these locations:
* Sharing ideas with other Electron app developers
* And more!
* [`electron`](https://discuss.atom.io/c/electron) category on the Atom forums
* `#atom-shell` channel on Freenode
* `#electron` channel on [Atom's Slack](https://discuss.atom.io/t/join-us-on-slack/16638?source_topic_id=25406)
* [`electron-ru`](https://telegram.me/electron_ru) *(Russian)*
* [`electron-br`](https://electron-br.slack.com) *(Brazilian Portuguese)*
@@ -38,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
@@ -64,9 +70,9 @@ until the maintainers feel the maintenance burden is too high to continue doing
### Currently supported versions
* 14.x.y
* 13.x.y
* 12.x.y
* 11.x.y
### End-of-life

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