Compare commits

..

220 Commits

Author SHA1 Message Date
Sudowoodo Release Bot
e298bf46e4 Bump v15.3.1 2021-11-08 09:26:37 -08:00
trop[bot]
5426d2c920 fix: clipboard.writeBuffer raw format access (#31720)
* fix: clipboard.writeBuffer raw format access (#31116)

* fix: clipboard.writeBuffer raw format access

* test: clipboard.writeBuffer raw format access

* test: clipboard win32 test skip

* fixup spec

* cleanup patch

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

* fixup .patches file

Co-authored-by: henrit <henrit@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-08 11:36:14 -05:00
Milan Burda
3e0a2edec4 fix: <webview> background transparency (#31701)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2021-11-05 14:43:08 -07:00
trop[bot]
f74d89ba80 fix: crash dump location on Linux (#31712)
* fix: crash dump location on Linux

* fix: ignore client_id for Zygote process

* chore: update comment

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-11-04 17:18:50 -04:00
trop[bot]
4e14dca687 test: deflake <webview> tag loads devtools extensions on WOA (#31716)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-04 16:36:11 -04:00
Pedro Pontes
1aaf1e7241 chore: cherry-pick 91dd4f79ab5b from chromium (#31680)
* chore: cherry-pick 91dd4f79ab5b from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-04 14:28:26 -04:00
Keeley Hammond
1e7c8a3c63 docs: update test automation doc (#31506) (#31699)
* Update WebdriverIO documentation

* Update docs/tutorial/using-selenium-and-webdriver.md

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

* Update docs/tutorial/using-selenium-and-webdriver.md

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

* docs: update automated testing docs

* lint

* update

* Update docs/tutorial/automated-testing.md

Co-authored-by: Christian Bromann <github@christian-bromann.com>

* fixes

Co-authored-by: Christian Bromann <github@christian-bromann.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>

Co-authored-by: Christian Bromann <github@christian-bromann.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-11-04 09:52:23 -07:00
trop[bot]
8496a12321 fix: incorrect Content-Disposition serialization (#31693)
* fix: incorrect Content-Disposition serialization

* test: fixup test

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-04 10:00:12 +09:00
trop[bot]
98bab0ca28 fix: do not run dialog callback inside transaction commit (#31658)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-11-02 13:22:23 +01:00
trop[bot]
a630db8c86 test: fix test-datetime-change-notify after daylight change (#31655)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-01 20:57:41 -04:00
trop[bot]
7e19dbad6f fix: use disable-hid-blocklist to allow FIDO devices (#31649)
* fix: use disable-hid-blocklist to allow FIDO

* Trigger Build

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-01 17:09:53 -04:00
Milan Burda
2b8fc8a139 chore: update chore_add_context_to_context_aware_module_prevention.patch (#31579) (#31628)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2021-11-01 15:39:42 -04:00
trop[bot]
30b9d15af0 fix: crash on close window when webContents destroyed (#31644)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-01 15:30:46 -04:00
trop[bot]
bcf04f5878 fix: clipboard.read() to recognize custom types (#31651)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-01 13:45:48 -04:00
Shelley Vohr
9fba8b35cb fix: silent print settings (#31616) 2021-11-01 10:03:27 -04:00
trop[bot]
ad3563687f docs: link to Apple developer docs for app.ready event (#31599)
Changes some links around. There was no link for `NSUserNotification`, and
`UNNotificationResponse` incorrectly linked to our own `NotificationResponse`
API structure doc.

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-10-28 11:17:10 +09:00
trop[bot]
4e2c19944f fix: clipboard.read() crash (#31591)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-10-26 11:29:58 -04:00
trop[bot]
95814288cf build: retry hasher function if it fails first time (#31582)
* 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:40:41 +09:00
trop[bot]
b711b8f98d docs: win.getParentWindow() returns BrowserWindow | null (#31576)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-26 17:38:12 +09:00
Pedro Pontes
a1744e5de0 chore: cherry-pick 36028012d897 from chromium (#31539)
Co-authored-by: Electron Bot <electron@github.com>
2021-10-25 13:27:14 -04:00
trop[bot]
e9446f0dc4 fix: MediaMetadata not working properly (#31534)
* 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 16:55:16 +02:00
Pedro Pontes
1cda1d0e86 chore: cherry-pick 0894af410c4e from chromium (#31543)
* chore: cherry-pick 0894af410c4e from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-25 13:03:10 +02:00
Pedro Pontes
c2023dd9f5 chore: cherry-pick 8af66de55aad from chromium (#31523)
* chore: cherry-pick 8af66de55aad 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-25 09:47:11 +09:00
Pedro Pontes
c98059abd9 chore: cherry-pick c69dddfe1cde from chromium (#31519)
* 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:03 +09:00
Pedro Pontes
df726b619d chore: cherry-pick 6de4e210688e from v8 (#31501)
* chore: cherry-pick 6de4e210688e 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-10-22 21:14:15 +09:00
trop[bot]
c2b1db192d fix: event with invalid timestamp in trace log (#31422)
* 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 patches for 15-x-y

Co-authored-by: Cezary Kulakowski <cezary@openfin.co>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-10-22 21:13:02 +09:00
Pedro Pontes
235c32ee55 chore: cherry-pick 29be6884cb8a from v8 (#31516) 2021-10-21 16:08:48 -04:00
Pedro Pontes
7e66d6a952 chore: cherry-pick 2e7c9b33453b from chromium (#31497)
* chore: cherry-pick 2e7c9b33453b from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-21 15:15:43 -04:00
Erick Zhao
0db4d5add5 docs: add window customization guide (#31054) (#31507)
* docs: add window customization guide

* fixes

* 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/fiddles/windows/manage-windows/frameless-window/index.html

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

* Update docs/tutorial/window-customization.md

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

* Update docs/tutorial/window-customization.md

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

* Update docs/tutorial/window-customization.md

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

* Update docs/tutorial/window-customization.md

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

* Update docs/tutorial/window-customization.md

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

* Update docs/tutorial/window-customization.md

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

* Update docs/tutorial/window-customization.md

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

* Update docs/tutorial/window-customization.md

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

* Update docs/tutorial/window-customization.md

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

* Update docs/tutorial/window-customization.md

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

* Update docs/tutorial/window-customization.md

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

* fix code fence

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

Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2021-10-21 14:07:57 -04:00
trop[bot]
9380803004 feat: warn when ipcRenderer.sendSync() called with no listeners for channel (#31434)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-21 09:09:01 +09:00
trop[bot]
2a12d5fa7f fix: ensure TracingAgent in place for SWs (#31476)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-10-21 09:07:41 +09:00
trop[bot]
93e8de87a5 fix: remove 'NOTREACHED()' from 'GetWindowResizeEdge' (#31480)
Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
2021-10-21 09:05:45 +09:00
Sudowoodo Release Bot
b6c9110923 Bump v15.3.0 2021-10-20 07:51:47 -07:00
Keeley Hammond
5e815df20f fix: don't use private enterprise APIs in MAS build (#31483) 2021-10-19 23:14:22 -07:00
trop[bot]
e676b3862c 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. (#31472)
Co-authored-by: Daniel Ramp <12480131+DanielRamp@users.noreply.github.com>
2021-10-19 20:40:12 +09:00
trop[bot]
cd8f678a8d Avoid Undefined Variable In printToPdf Example (#31465)
Co-authored-by: universalstrapping <90921972+universalstrapping@users.noreply.github.com>
2021-10-19 17:41:24 +09:00
trop[bot]
79554ba989 fix: add isDestroyed check (#31468)
* 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:39:49 +09:00
Cheng Zhao
ad67a27dcf fix: generate valid config.gypi (#31442) 2021-10-19 09:39:47 +09:00
trop[bot]
c9476eb821 fix: also pass securityOrigin to media permissions request handler (#31417)
Co-authored-by: Maxime Serrano <mserrano@alumni.cmu.edu>
2021-10-15 13:31:48 +09:00
John Kleinschmidt
2c6321c9af chore: refactor persisting permission granted to serial ports (#31418)
(cherry picked from commit 515785aabe)
2021-10-15 09:07:24 +09:00
trop[bot]
715de396d4 fix: mac window crash native theme update (#31429)
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2021-10-15 09:06:05 +09:00
Sudowoodo Release Bot
98d6b9bf15 Bump v15.2.0 2021-10-14 12:54:57 -07:00
trop[bot]
a05ed73f43 fix: reset render_frame_disposed_ after render frame host change (#31426)
* 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-14 12:52:46 -07:00
trop[bot]
f7fdd34c45 docs: update Versioning doc (#31388)
* 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:24:56 +09:00
trop[bot]
55e6ce81e0 fix: black window on screen capture when content protection is enabled (#31385)
Co-authored-by: Micha Hanselmann <mhanselmann@microsoft.com>
2021-10-12 09:09:10 +09:00
trop[bot]
b5c81db591 feat: add commandLine.removeSwitch (#31326)
* feat: add commandLine.removeSwitch

In some cases apps may want to remove Chromium command line switches to avoid certain Chromium behaviors being used, E.g. remote-debugging-port or gpu-launcher

* fix: add missing removeSwitch to app.ts

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-12 09:05:52 +09:00
electron-roller[bot]
cffbeeaefa chore: bump chromium to 94.0.4606.81 (15-x-y) (#31351) 2021-10-11 13:28:17 +02:00
trop[bot]
c81380848f fix: correctly notify WebViewGuestDelegate when webview is detached (#31376)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-10-11 14:35:33 +09:00
Milan Burda
45a1d81315 docs: nativeWindowOpen default was changed in Electron 15 (#31345) (#31367)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2021-10-10 15:50:48 -07:00
Sudowoodo Release Bot
ded013e4a7 Bump v15.1.2 2021-10-08 09:10:28 -07:00
Samuel Attard
2cabee9128 chore: cherry-pick 39090918efac from chromium (#31297)
* chore: cherry-pick 39090918efac from chromium

* chore: cherry-pick ec42dfd3545f from chromium

* chore: reconcile FPS patch differences

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2021-10-08 09:07:58 -07:00
trop[bot]
0c9571c89f docs: add missing 'context-menu' event to webview-tag.md (#31309)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-08 08:57:45 -07:00
electron-roller[bot]
c93204ec0d chore: bump chromium to 94.0.4606.71 (15-x-y) (#31234)
* chore: bump chromium in DEPS to 94.0.4606.71

* 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-10-07 22:02:54 -04:00
trop[bot]
3c47d9e0d7 fix: crash on missing render frame (#31334)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-10-07 20:15:48 +02:00
Robo
9c54bf7973 refactor: only access memory coordinator interface from browser process (#31295) (#31303)
Refs https://chromium-review.googlesource.com/c/chromium/src/+/3174305
2021-10-06 15:44:14 -07:00
trop[bot]
d6f44a75d2 test: add missing context-menu event spec for <webview> (#31306)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-06 15:16:28 -05:00
trop[bot]
259f27070c chore: add logging for print_backend failures (#31286)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-10-06 16:55:17 +02:00
trop[bot]
6d1fa337c2 fix: return HTNOWHERE in resize hit test to allow draggable regions to kick in when required (#31299)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-10-06 09:22:21 +09:00
Sudowoodo Release Bot
b51f82c73f Bump v15.1.1 2021-10-04 12:42:12 -07:00
trop[bot]
e19f7fbaf7 fix: "Failed to serialize arguments" when emitting 'context-menu' for webview (#31259) (#31279)
* fix: sanitize params for 'context-menu' event sent over IPC for webview

* Revert "fix: sanitize params for 'context-menu' event sent over IPC for webview"

This reverts commit 7fee455138.

* fix: make frame property non-enumerable in params for 'context-menu' event

Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-04 15:40:46 -04:00
trop[bot]
955d6c82ff fix: dialog is not defined (#31272)
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:59 +09:00
trop[bot]
5fbb4fd8c9 fix: fix typo in description of secureDnsMode (#31267)
Co-authored-by: Tobias Nießen <tniessen@users.noreply.github.com>
2021-10-04 12:13:57 +09:00
Robo
9407a3ee09 fix: remove expired DST Root CA X3 (#31219)
* Revert "fix: Enable X509_V_FLAG_TRUSTED_FIRST flag in BoringSSL (#31218)"

This reverts commit d788d817ee.

* fix: remove expired DST Root CA X3
2021-10-01 07:56:31 -07:00
Sudowoodo Release Bot
86bb866ffb Bump v15.1.0 2021-10-01 07:32:00 -07:00
Keeley Hammond
2b22f02354 Revert "Bump v15.1.0" (#31238)
This reverts commit c3ee7b4bd1.
2021-10-01 10:29:43 -04:00
Sudowoodo Release Bot
c3ee7b4bd1 Bump v15.1.0 2021-09-30 14:38:16 -07:00
trop[bot]
d788d817ee fix: Enable X509_V_FLAG_TRUSTED_FIRST flag in BoringSSL (#31218)
* 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:29 -04:00
trop[bot]
6fbd50ab37 fix: draggable regions in BrowserViews are independent (#31198)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-30 12:04:29 -04:00
trop[bot]
097fd4c206 fix: first mouse not dragging BrowserView (#31100)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-30 11:06:04 -04:00
Alexey Kuzmin
844d104d06 chore: fix pylint (#31207)
* chore: fix pylint

* chore: fix linter errors
2021-09-30 09:48:59 -04:00
trop[bot]
b62cef5a01 fix: running tests with release build (#31140)
* fix: running tests with release build

* Update electron_api_v8_util.cc

Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-09-29 17:18:06 -04:00
Keeley Hammond
4cdb2c4bd4 chore: remove gin::Wrappable crash keys (#31075) (#31189) 2021-09-29 17:06:46 -04:00
Darshan Sen
bc655b8eaf refactor: make InitWithWebContents and InspectableWebContents take a unique_ptr (#30920) (#31124)
* refactor: make InitWithWebContents take a unique_ptr

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

* refactor: make InspectableWebContents take a unique_ptr

Signed-off-by: Darshan Sen <darshan.sen@postman.com>
2021-09-29 17:05:53 -04:00
trop[bot]
4891e92f32 feat: add width option to dialog.showMessageBox() (#31088)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-09-29 14:28:16 -04:00
John Kleinschmidt
62b88b2a0b feat: add support for WebHID (#30213) (#31095)
* 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)
2021-09-29 13:05:26 -04:00
trop[bot]
2cbfd19d94 fix: crash creating private key with unsupported algorithm (#31137)
* fix: crash creating private key with unsupported algorithm

* test: add regression test

* chore: update patches

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-29 11:56:45 -04:00
trop[bot]
da132e0289 fix: .lldbinit config stale (unavailable) (#31158)
Co-authored-by: Black-Hole1 <158blackhole@gmail.com>
2021-09-29 12:33:07 +02:00
trop[bot]
622b79cd9d fix: BrowserView drag now delegates to the OS when possible (#31177)
Co-authored-by: @anulman <@anulman>
2021-09-29 12:28:38 +02:00
trop[bot]
2e91d6e10c docs: update branch name (#31149) 2021-09-28 09:51:57 +02:00
trop[bot]
4a495542cb refactor: use native WeakRef instead of v8util.weaklyTrackValue() (#31165)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-09-28 09:44:31 +02:00
trop[bot]
45813a0342 fix: crash in v8 due to regexp reentrancy (#31144)
* 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-27 16:54:46 -07:00
trop[bot]
b55362b588 fix: avoid double free when destroying WebContents (#31133)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-09-27 22:00:44 +02:00
electron-roller[bot]
b39b6cde8c chore: bump chromium to 94.0.4606.61 (15-x-y) (#31112)
* chore: bump chromium in DEPS to 94.0.4606.61

* 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-27 12:38:07 -04:00
trop[bot]
6919520c88 fix: startDrag params type incorrect (#31083)
Co-authored-by: Black-Hole1 <158blackhole@gmail.com>
2021-09-23 19:50:10 +09:00
trop[bot]
71fcb8d8f8 fix: update Windows' cache after changing window's style (#31081)
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:12 +09:00
trop[bot]
ee23788acf fix: proper localization when using GtkFileChooserNative (#31066)
* fix: proper localization when using GtkFileChooserNative

* fix: iwyu

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-23 16:35:46 +09:00
trop[bot]
52196791b9 feat: add isMainFrame argument to 'certificate-error' event (#31038)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-09-23 16:32:56 +09:00
trop[bot]
6dbf0c52ec docs: update glossary (#31056)
* docs: update glossary

* remove nsis entry

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-09-23 16:30:13 +09:00
trop[bot]
5d95688753 chore: clarify new-window fix comment (#31073)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-09-22 17:26:41 -07:00
electron-roller[bot]
6e60fa6d59 chore: bump chromium to 94.0.4606.54 (15-x-y) (#31046)
* chore: bump chromium in DEPS to 94.0.4606.54

* 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-22 14:12:04 -04:00
trop[bot]
d072d408c0 feat: add frame to context-menu event params (#31057)
* feat: add frame to context-menu event params

* doc: rephrase frame description

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-09-22 14:11:48 -04:00
trop[bot]
cde7f04409 fix: prevent navigator.fonts.query() from crashing (#30985) 2021-09-22 08:25:18 +02:00
trop[bot]
e143f654ca fix: maximized state calculation for non-resizable windows (#31041)
* 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:28:44 +09:00
trop[bot]
cc62c4a33a docs: update public timeline for E16 (#31051)
Co-authored-by: Sofia Nguy <sofianguy@gmail.com>
2021-09-21 14:37:02 -07:00
Sudowoodo Release Bot
c3e6746fa9 Bump v15.0.0 2021-09-21 11:50:28 -07:00
Samuel Attard
436c3ba644 Revert "Bump v15.0.0"
This reverts commit dc6f951f43.
2021-09-21 11:48:38 -07:00
Samuel Attard
599babae00 Revert "Bump v15.0.1"
This reverts commit 5f7da14447.
2021-09-21 11:48:31 -07:00
Sudowoodo Release Bot
5f7da14447 Bump v15.0.1 2021-09-21 11:43:53 -07:00
Sudowoodo Release Bot
dc6f951f43 Bump v15.0.0 2021-09-21 11:40:26 -07:00
trop[bot]
f4fa6c0cf4 fix: propagate window.open settings to child window (#31049)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-09-21 10:34:32 -07:00
trop[bot]
98de50451a fix: suppress insecure resource warning for more local hostnames (#31036) 2021-09-21 10:48:26 +02:00
Sudowoodo Release Bot
c78ab7a1f2 Revert "Bump v15.0.0"
This reverts commit 0928f322fa.
2021-09-20 17:16:32 -07:00
Sudowoodo Release Bot
0928f322fa Bump v15.0.0 2021-09-20 11:31:33 -07:00
trop[bot]
c6c59bf0b3 build: fix release CI jobs start script (#31026)
* build: fix release CI jobs start script

This broke in #30492, we weren't handled 20X status codes and weren't authing to appveyor correctly.

* build: do not pass undefined to Auth header in CI scripts

(cherry picked from commit a48968c1ce)

* build: use basic auth to trigger CI if either a username OR password is provided

(cherry picked from commit d1bd9afbbf)

* build: manually pull 64bit dugite for 32bit tests (#30531)

(cherry picked from commit 8b9d0092cb)

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-09-20 11:02:51 -07:00
Keeley Hammond
9d3bcfc559 fix: ensure web_contents() is alive before grabbing view (#31027) 2021-09-20 10:14:12 -07:00
Sudowoodo Release Bot
fb2473bb5e Revert "Bump v15.0.0-beta.8"
This reverts commit 18c5401d08.
2021-09-20 07:43:58 -07:00
electron-roller[bot]
4664b5da57 chore: bump chromium to 94.0.4606.51 (15-x-y) (#30895)
* chore: bump chromium in DEPS to 94.0.4606.41

* chore: bump chromium in DEPS to 94.0.4606.50

* chore: bump chromium in DEPS to 94.0.4606.51

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2021-09-20 10:42:16 -04:00
Sudowoodo Release Bot
18c5401d08 Bump v15.0.0-beta.8 2021-09-20 06:31:53 -07:00
trop[bot]
3f81697e48 fix: disabling and enabling resizability on macOS (#31014)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-20 09:34:55 +09:00
trop[bot]
a00a43ba25 chore: update links of documentation of chromes (#31008)
chrome now use developer.chrome.com/docs/extensions/* instead of developer.chrome.com/extensions/*

Co-authored-by: 祈緒ちゃん - Kiochan <sunxingchen@live.com>
2021-09-17 22:10:48 +09:00
trop[bot]
ce1435be30 fix: links to images (#31005)
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:49:03 +09:00
trop[bot]
c625b77bde fix: add casing for WCO edge (#30995)
Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
2021-09-16 18:49:03 -04:00
Samuel Attard
4969c4ab19 build: ensure we await correctly in npm publish script 2021-09-16 13:48:53 -07:00
Sudowoodo Release Bot
9e1736f5bc Bump v15.0.0-beta.7 2021-09-16 07:36:07 -07:00
Sudowoodo Release Bot
200e26c602 Revert "Bump v15.0.0-beta.7"
This reverts commit bbc4545742.
2021-09-16 07:32:57 -07:00
Sudowoodo Release Bot
bbc4545742 Bump v15.0.0-beta.7 2021-09-16 06:33:26 -07:00
trop[bot]
9874e940ab build: embed binary checksums in the npm package (#30647)
* build: embed binary checksums in the npm package

* Update docs/tutorial/installation.md

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

* refactor: replace reduce with loop

* refactor: remove all usages of the legacy request module (#30492)

* Replaces request with got
* Replaces nugget with got streams
* Replaces request in docs with got
* Upgrades dugite to drop requests dependency

* build: do not excessively log response bodies

* build: fix publish-to-npm script post requests migration

* chore: revert accidental package bumps

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-09-16 09:36:54 +09:00
trop[bot]
304453fa5c fix: always include pepper flash font file (#30970)
Co-authored-by: Micha Hanselmann <micha.hanselmann@gmail.com>
2021-09-16 09:29:34 +09:00
Keeley Hammond
16a32a30d9 chore: update E15 node module version (#30773)
Ref: https://github.com/nodejs/node/pull/39950/files
2021-09-15 16:33:08 -07:00
trop[bot]
a227474809 chore: correct hierarchy of BrowserWindow headings (#30974)
* 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:29 +09:00
trop[bot]
3a2055ebba docs: update context isolation doc (#30977)
* 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:35 +09:00
Sudowoodo Release Bot
87042e1493 Bump v15.0.0-beta.6 2021-09-14 06:03:11 -07:00
Sudowoodo Release Bot
86f3aa0376 Revert "Bump v15.0.0-beta.6"
This reverts commit 33eb6263c0.
2021-09-13 20:35:36 -07:00
Sudowoodo Release Bot
33eb6263c0 Bump v15.0.0-beta.6 2021-09-13 15:31:50 -07:00
trop[bot]
05d5ee4486 fix: remove conflicting RunFileChooserEnd for Mac (#30936)
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2021-09-13 15:26:00 -07:00
trop[bot]
98845392d8 feat: add support for validating asar archives on macOS (#30900)
* feat: add support for validating asar archives on macOS

* chore: fix lint

* chore: update as per feedback

* feat: switch implementation to asar integrity hash checks

* feat: make ranged requests work with the asar file validator DataSourceFilter

* chore: fix lint

* chore: fix missing log include on non-darwin

* fix: do not pull block size out of missing optional

* fix: match ValidateOrDie symbol on non-darwin

* chore: fix up asar specs by repacking archives

* fix: maintain integrity chain, do not load file integrity if header integrity was not loaded

* debug test

* Update node-spec.ts

* fix: initialize header_validated_

* chore: update PR per feedback

* chore: update per feedback

* build: use final asar module

* Update fuses.json5

* chore: fix compile errors

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-09-13 09:58:59 -07:00
Sudowoodo Release Bot
946baab086 Bump v15.0.0-beta.5 2021-09-13 08:46:53 -07:00
trop[bot]
e3aeba3581 fix: delete rfh after open/save dialog done (#30927)
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2021-09-13 08:37:33 -07:00
Sudowoodo Release Bot
e03c11598e Bump v15.0.0-beta.4 2021-09-09 06:32:23 -07:00
trop[bot]
3b1c9dfc54 refactor: remove dead code in NeedsCompleteGpuInfoCollection (#30877)
Refs https://chromium-review.googlesource.com/c/chromium/src/+/1208362

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-08 15:19:25 +09:00
Mark Lee
2724456dc7 docs(protocols): simplify packaging section & cleanup (#30881)
Backport of #30194
Backport of #30566
Backport of #30832
2021-09-08 15:18:33 +09:00
trop[bot]
9333b091f5 docs: Update windows info for auto-updater (#30871)
Squirrel.Mac can be served from a static host as well.

Co-authored-by: Finn Behrens <me@kloenk.dev>
2021-09-08 08:43:50 +09:00
trop[bot]
cb12c4e392 refactor: use getter for frame in webrequest details (#30861)
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-09-08 08:42:18 +09:00
trop[bot]
1d38e14e92 fix: show maximized frameless window (#30865)
* 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:14 +02:00
Robo
9f39865999 chore: enable v8 oilpan (#30853)
* chore: enable v8 oilpan

* chore: update patches
2021-09-07 09:41:50 +02:00
Sudowoodo Release Bot
2d5b45659a Bump v15.0.0-beta.3 2021-09-06 19:03:15 -07:00
Sudowoodo Release Bot
dab8ec7711 Revert "Bump v15.0.0-beta.3"
This reverts commit 8f81c73908.
2021-09-06 18:47:42 -07:00
Sudowoodo Release Bot
8f81c73908 Bump v15.0.0-beta.3 2021-09-06 18:11:46 -07:00
Sudowoodo Release Bot
79580b1809 Revert "Bump v15.0.0-beta.3"
This reverts commit 835c4a1bb4.
2021-09-06 18:10:45 -07:00
Sudowoodo Release Bot
835c4a1bb4 Bump v15.0.0-beta.3 2021-09-06 06:32:28 -07:00
trop[bot]
81f773eb6f docs: updated webview tag documentation to accurately reflect preload behavior with asar archives (#30851)
Co-authored-by: ike <isaactaylor124@gmail.com>
2021-09-06 19:17:42 +09:00
trop[bot]
2708f66627 fix: devtools not resizable on Windows (#30848)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-06 19:16:57 +09:00
trop[bot]
190085141c feat: add webContents.fromDevToolsTargetId() (#30733)
* feat: add webContents.fromDevToolsTargetId()

* refactor: avoid using FromOrCreate

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-09-03 10:24:32 +02:00
electron-roller[bot]
4111f2b3a7 chore: bump chromium to 94.0.4606.31 (15-x-y) (#30813)
* chore: bump chromium in DEPS to 94.0.4606.31

* 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-02 14:19:04 -04:00
trop[bot]
f894f8a92d feat: add <webview> 'did-redirect-navigation' event (#30664)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-09-02 13:25:40 -04:00
Samuel Maddock
439a295776 fix: BrowserWindow backgroundColor (#30777) 2021-09-02 10:53:11 -04:00
Sudowoodo Release Bot
99868688f1 Bump v15.0.0-beta.2 2021-09-02 06:33:03 -07:00
Milan Burda
3dc92be74c feat: add <webview>.sendToFrame() / frameId to 'ipc-message' event (#30451) (#30704) 2021-09-02 11:13:06 +02:00
trop[bot]
a9e141305b feat: add 'dom-ready' event to WebFrameMain (#30801) 2021-09-02 10:13:13 +02:00
trop[bot]
4fb3b585f9 feat: add app.configureHostResolver (#30775)
* feat: add app.configureHostResolver (#30576)

* fix tests

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-09-01 20:22:53 -04:00
Erick Zhao
ceb65338a5 docs: fix code example in process-model.md (#30690) (#30802)
* 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:52:57 -07:00
trop[bot]
30a2a0bf8d repl: fix crash when SharedArrayBuffer disabled (#30483)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-01 14:23:40 -04:00
trop[bot]
1401789817 ci: ignore pdb download failure (#30796)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-09-01 13:24:30 -04:00
trop[bot]
a20f19bc8f fix(linux): OpenURI portal support for shell.showItemInFolder() (#30784)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-01 20:48:13 +09:00
trop[bot]
87f07534b1 docs: improve documentation about macOS entitlement usage security (#30781)
Co-authored-by: ComplexSpaces <complexspacescode@gmail.com>
2021-09-01 20:47:45 +09:00
Sudowoodo Release Bot
326de41302 Bump v15.0.0-beta.1 2021-08-31 13:02:28 -07:00
trop[bot]
53fee846d4 docs: add remote removal to E14 breaking changes (#30770)
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2021-08-31 11:51:29 -07:00
trop[bot]
2c406ff566 fix: remove ipc wrapper for nativeImage.createThumbnailFromPath (#30734)
* fix: remove ipc wrapper for nativeImage.createThumbnailFromPath

* ScopedCOMInitializer

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-08-30 19:31:40 +09:00
electron-roller[bot]
a2ae0e16b5 chore: bump chromium to 94.0.4606.20 (15-x-y) (#30715)
* chore: bump chromium in DEPS to 94.0.4606.20

* 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-26 12:16:54 -04:00
Sudowoodo Release Bot
b69d7af656 Bump v15.0.0-alpha.10 2021-08-26 09:03:25 -07:00
trop[bot]
4b4bd037e1 docs: explain the null webContents case in permission checks (#30688)
* 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:48:18 +09:00
trop[bot]
ebc21d751a fix: titlebar and buttons state under simple fullscreen (#30708)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-08-26 15:46:34 +09:00
trop[bot]
ea17543800 fix: crash when using TouchBarScrubber arrow button (#30681)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-25 10:06:41 +09:00
electron-roller[bot]
2bc618e7ac chore: bump chromium to 94.0.4606.12 (15-x-y) (#30370)
* chore: bump chromium in DEPS to 94.0.4595.0

* chore: bump chromium in DEPS to 94.0.4596.0

* chore: bump chromium in DEPS to 94.0.4597.0

* chore: bump chromium in DEPS to 94.0.4598.2

* chore: bump chromium in DEPS to 94.0.4599.2

* chore: bump chromium in DEPS to 94.0.4600.0

* chore: bump chromium in DEPS to 94.0.4601.0

* chore: bump chromium in DEPS to 94.0.4602.0

* chore: bump chromium in DEPS to 94.0.4603.0

* chore: bump chromium in DEPS to 94.0.4604.0

* chore: bump chromium in DEPS to 94.0.4603.0

* chore: bump chromium in DEPS to 94.0.4605.0

* chore: bump chromium in DEPS to 94.0.4606.0

* chore: bump chromium in DEPS to 94.0.4606.3

* chore: bump chromium in DEPS to 94.0.4606.5

* build: 3-way merge of chromium patches

(cherry picked from commit d77d456a369c07dbc06e4c2eade23e4029a4c169)

* build: 3-way merge of chromium patches

(cherry picked from commit e495584d5c8a36a469946ada24fa75b30776e1b9)

* 3076040: Reland Remove delete_children RemoveAllChildViews arg

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3076040
(cherry picked from commit 22e131c7b5e146ac57b813a6906d87f98a51c3c3)

* 3069287: Remove the remaining uses and delete the deprecated API

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

* 2297212: Replace RemoveWithoutPathExpansion(.*, nullptr) with Value::RemoveKey()

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

Also: https://chromium-review.googlesource.com/c/chromium/src/+/3060296
(cherry picked from commit 10854b7cb26b1cd259b067e3f5aa2b266bf8eb9a)

* 3082756: Change transport_security_persister_path param to be a path to a file.

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

> this CL intentionally changes the name of the parameter
> in the network context parameters and the order of the constructor
> parameters to ensure all callers update their code to pass a full
> file path rather than a path to a directory.

The 'path' in this diff is already an absolute path, coming from
`CHECK(base::PathService::Get(chrome::DIR_USER_DATA, &path_));` at
08ff1c2cbf/shell/browser/electron_browser_context.cc (L126)

(cherry picked from commit 3e310964ffc592b0a0af4eeededeab3cadbec5a5)

* iwyu: network::mojom::HttpRawHeaderPair

(cherry picked from commit 51c73ea7fd65711eaf26f545b39b8e4a52435182)

* fixup! 3076040: Reland Remove delete_children RemoveAllChildViews arg

Missed one.

(cherry picked from commit f6f9de30780e6b1c677dc55f081af34e4f44fd9c)

* 2999884: CodeHealth: Remove DictionaryValue::GetStringWithoutPathExpansion

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2999884
(example of replacing GetStringWithoutPathExpansion() w/FindStringKey())

Also: https://chromium-review.googlesource.com/c/chromium/src/+/3060296
(removal of DictionaryValue::GetStringWithoutPathExpansion)

(cherry picked from commit 5f7fd94d71480e05ad8badf4be1cfc5d2bd685ce)

* 3059260: Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure

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

We had both of these in a 'disable_features' list. Since these feature have
been removed upstream, remove them from our disable list, too.

IMPORTANT: this commit should not be backported to older branches that
still have these features, because doing so would un-disable them.

(cherry picked from commit a09154d0b20af4680d7c7be6cafd40f84408df2e)

* 2920890: Load reroute_info from download in-progress and history db back into DownloadItem.

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2920890
(cherry picked from commit 66a3797a3f798a368c7630d6c6a1ebc3d8606880)

* 3039323: [Clipboard API] Clipboard Custom Formats implementation Part 5.

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3039323
(cherry picked from commit 136b2ed9aa601bd59b3416d11c1109d249850faa)

* 3084502: Add a new PrintRasterizePdfDpi policy.

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3084502
(cherry picked from commit effbe639741a0ae7929691b1ec174aa61bdfd921)

* chore: update patches

(cherry picked from commit 4b03542e425f73ef7742ee272f30feac350d9bd0)

* chore: update patches

* Disable kDesktopCaptureMacV2

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

* [DevTools] Remove report_raw_headers from network::ResourceRequest (Attempt #2)

https://chromium-review.googlesource.com/c/chromium/src/+/2856099
(cherry picked from commit 5e72ee04519bfbcc524ad198175f5d28006f55c8)

* Add a new PrintRasterizePdfDpi policy.

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

* chore: update patches

* chore: fix lint

(cherry picked from commit ed0d9adef6b9c5fb8c2b4bcf6783a3bd58605d51)

* Linux: use chrome_crashpad_handler instead of crashpad_handler

https://chromium-review.googlesource.com/c/chromium/src/+/3054290
(cherry picked from commit 0c63c9c1312422180c85bedac5ba8cfb6418649f)

* DCHECK that predictor always has a non-empty NetworkIsolationKey.

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

* fixup! Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure

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

* chore: bump chromium in DEPS to 94.0.4606.12

* chore: update patches

* Disable kDesktopCaptureMacV2

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

* Convert PrintManager to RenderFrameHostReceiverSet.

https://chromium-review.googlesource.com/c/chromium/src/+/3072019
(cherry picked from commit 6bf73bce81)

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

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

* Convert ExtensionFrameHost to RenderFrameHostReceiverSet.

https://chromium-review.googlesource.com/c/chromium/src/+/3063358
(cherry picked from commit 5e50771835)

* cleanup after merge

* chore: fix lint

(cherry picked from commit b4ea757281)

* chore: disable v8 oilpan

(cherry picked from commit 19a5afd264)

* fixup! Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure

(cherry picked from commit d0a1a8b51a)

* fixup! Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure

(cherry picked from commit c49b5a9277)

* 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: Charles Kerr <charles@charleskerr.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-24 17:07:19 -04:00
trop[bot]
ba8f4660fd feat: enable windows control overlay on Windows (#29600) (#30497)
* rebase "feat: enable windows control overlay on Windows"

* correct compilation error

* fix linting errors

* modify includes and build file

* change `hidden` option to `overlay`

* add patch to fix visual layout

* add button background color parameter

* add button text color parameter

* modify `overlay` in docs and modify button hover/press transition color

* change `text` to `symbol`

* remove todo and fix `text` replacement

* add new titleBarOverlay property and remove titleBarStyle `overlay`

* update browser and frameless window docs

* remove chromium patches

* chore: update patches

* change button hover color, update trailing `_`, update test file

* add dchecks, update title bar drawing checks, update test file

* modify for mac and linux builds

* update docs with overlayColor and overlaySymbolColor

* add corner and side hit test info

* modify docs and copyright info

* modify `titlebar_overlay_` as boolean or object

* move `title_bar_style_ to `NativeWindow`

* update docs with boolean and object titlebar_overlay_

* add `IsEmpty` checks

* move get options for boolean and object checks

* fix linting error

* disable `use_lld` for macos

* Update docs/api/frameless-window.md

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

* Update docs/api/frameless-window.md

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

* Update docs/api/frameless-window.md

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

* Apply docs suggestions from code review

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

* modify `true` option description `titleBarOverlay`

* ci: cleanup keychain after tests on arm64 mac (#30472)

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: Michaela Laurencin <35157522+mlaurencin@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 <jeremya@chromium.org>
2021-08-23 20:52:45 -04:00
trop[bot]
b19ccb708e fix: change gin::Wrappable crash key type to ScopedCrashKey (#30610)
* 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-23 17:19:28 -07:00
trop[bot]
24b3ee8444 feat: add electron.safeStorage encryption API (#30020) (#30430)
* feat: add SafeStorage api; first commit

* chore: rename files to fit semantically

* chore: add linkedBindings

* chore: fix function signatures

* chore: refactor eisCookieEncryptionEnabled() fuse

* chore: create test file

* chore: add tests and documentation

* chore: add copyright and lint

* chore: add additional tests

* chore: fix constructor

* chore: commit for pair programming

* wip: commit for keeley pairing

* chore: docs change and code cleanup

* chore: add linux import

* chore: add description to documentation

* chore: fixing tests

* chore: modify behaviour to not allow unencrypted strings as decyption input

* fix add patch for enabling default v11 encryption on Linux

* chore: remove file after each test

* chore: fix patch

* chore: remove chromium patch

* chore: add linux specific tests

* chore: fix path

* chore: add checker for linuux file deletion

* chore: add dcheck back

* chore: remove reference to headless mode

* chore: remove tests for linux

* chore: edit commit message

* chore: refactor safeStorage to not be a class

* chore: remove static variable from header

* chore:  spec file remove settimeout

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

Co-authored-by: George Xu <33054982+georgexu99@users.noreply.github.com>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-23 15:21:40 -07:00
Sudowoodo Release Bot
941ab704e1 Bump v15.0.0-alpha.9 2021-08-23 08:08:12 -07:00
trop[bot]
9d9c7a2f70 fix: media key globalShortcuts on macOS (#30570)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-19 19:54:59 -04:00
Sudowoodo Release Bot
e406ebd472 Bump v15.0.0-alpha.8 2021-08-19 09:11:24 -07:00
trop[bot]
e44b02b9ad fix: WebFrameMain mojo pipe not reset (#30632)
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2021-08-19 16:55:21 +09:00
trop[bot]
b26760bed5 docs: typo in launch-app-from-url-in-another-app.md (#30628)
* 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:22 +09:00
trop[bot]
33fd679843 fix: cross-origin navigation disposing WebFrameMain instances (#30600)
* 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:08:08 +09:00
trop[bot]
87399cc4f4 fix: handle nullish WebContentsView in UpdateDraggableRegions (#30558)
* 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:38:51 +09:00
trop[bot]
33631b44f8 docs: remove unused Desktop Environment Integration doc (#30619)
* 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:07 +09:00
trop[bot]
10a8752e70 docs: update Hazel information (#30623)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-19 09:53:35 +09:00
trop[bot]
12c54ab670 fix: persist BrowserView background color when bounds offscreen (#30542)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-19 08:39:53 +09:00
trop[bot]
1ca52e9b93 fix: {exit|enter}-html-fullscreen emitted after esc in webview (#30562)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-19 08:38:34 +09:00
trop[bot]
b444944a6d fix: documentEdited with non-default titlebarStyle (#30604)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-18 14:13:41 -07:00
trop[bot]
766a58e465 fix: disable kWindowCaptureMacV2 for desktopCapturer (#30525)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-08-16 11:17:59 -07:00
trop[bot]
8130613364 docs: uniformize tutorial titles (#30547)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-16 14:07:59 -04:00
trop[bot]
e1859a3657 docs: clarify usage of option (#30550)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-16 14:04:43 -04:00
Sudowoodo Release Bot
daf533dabb Bump v15.0.0-alpha.7 2021-08-16 08:37:31 -07:00
John Kleinschmidt
6cf9e12dd4 chore: bump chromium to 94.0.4590.2 (15-x-y) (#30512)
* chore: bump chromium to 94.0.4590.2 (main) (#30274)

* chore: bump chromium in DEPS to 94.0.4587.0

* chore: update patches

* 2823155: fix GPU video decoding capabilities enumeration

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

* 3041383: Reduce includes in url_request_mojom_traits.h

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

* chore: bump chromium in DEPS to 94.0.4588.0

* chore: update patches

* chore: bump chromium in DEPS to 94.0.4589.0

* chore: update patches

* 3050633: Rename ScaleFactor to ResourceScaleFactor

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

* 3048296: Create new mojo target to prevent traits header spreading

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

* 3046186: Rename base::ClampToRange

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

* chore: update picture-in-picture patch

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

* chore: bump chromium in DEPS to 94.0.4590.0

* chore: update patches

* 3057495: Fix base::NoDestructor usage in Mac KeychainPassword

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

* 3056134: Remove NetworkIsolationKey unused methods

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

* 3035091: [rab/gsab] Fix gsab maxByteLength after transferring to worker

Adds a patch to v8 to disable a DCHECK that is also firing on node streams
in child processes.

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

* chore: bump chromium in DEPS to 94.0.4590.2

* chore: fix mas_no_private_api.patch

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

* 3049555: [views] Add CHECK to prevent fallthrough to global NativeTheme

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

* chore: empty commit

* chore: fix whitespace for lint

* chore: cherry-pick chromium woa fix

* Revert "chore: cherry-pick chromium woa fix"

This reverts commit 64f3082e2d.

* chore: fix the build on Windows on ARM

* chore: remove commented code in printing.patch

* fixup! chore: remove commented code in printing.patch

do not remove the new weak_ptr check

* build: sync disable_use_lld_for_macos.patch

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
(cherry picked from commit 81c143318b)

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

(cherry picked from commit a65d2dacd3)

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-08-16 10:12:39 -04:00
trop[bot]
0b5c95abdf ci: update git on CI machines (#30532)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-16 10:48:26 +02:00
Sudowoodo Release Bot
84df964d2f Bump v15.0.0-alpha.6 2021-08-12 08:18:31 -07:00
trop[bot]
6781a2c6e0 ci: make arm64 macos test cleanup more resilient (#30502)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-11 17:46:48 -04:00
Keeley Hammond
5dce02a3bb fix: explicitly define REFGUID from ::GUID&, not base::GUID (#30442) (#30498)
* 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 14:13:01 -07:00
trop[bot]
9aafee9cf0 docs: add missing <webview> event documentation (#30467)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-08-11 09:43:50 +09:00
trop[bot]
5df3e7e8fb ci: cleanup keychain after tests on arm64 mac (#30477)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-11 09:43:22 +09:00
trop[bot]
889be2327f docs: fix camelcase in menu example (#30463)
* 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:38:39 +09:00
trop[bot]
68e87ea4f5 fix: mouse doesn't work on frameless browserwindows (#30460)
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:38:06 +09:00
trop[bot]
d3462596fa feat: add fuses for NODE_OPTIONS and --inspect (#30420)
* feat: add fuses for NODE_OPTIONS and --inspect

* chore: add node patch to ensure NODE_OPTIONS are never parsed when fuse is disabledd

* chore: fix lint

* chore: flip boolean logic

* chore: update patches

* chore: add trailing _ to static member

* Update add_should_read_node_options_from_env_option_to_disable_node_options.patch

* chore: update patches

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-08-09 22:07:18 -04:00
trop[bot]
f3fd8492cf chore: more crash-keys for gin::Wrappable debugging (#30423)
* 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:10 +09:00
trop[bot]
a3ca79f883 build: rebase release branch before reverting bump (#30419)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-08-09 17:17:33 -04:00
trop[bot]
e2aaf5d18a build: set the export goma auth fallback flag for the control process (#30315)
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-08-09 11:54:09 -04:00
Electron Bot
e49b33cad8 Bump v15.0.0-alpha.5 2021-08-09 08:25:06 -07:00
trop[bot]
5ac3192dd0 fix: move window buttons in-place on macOS (#30392)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-08-09 16:00:29 +09:00
Electron Bot
ea63f2ea98 Bump v15.0.0-alpha.4 2021-08-05 08:41:46 -07:00
trop[bot]
73b280d6b4 fix: console window popping up when --enable-logging passed on windows (#30386)
* fix: console window popping up when --enable-logging passed on windows

* chore: update patches

* clang format

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-05 08:58:14 +09:00
trop[bot]
2de6939db0 build: fix building with enable_desktop_capturer = false (#30389)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-08-04 09:56:10 +09:00
Electron Bot
022620f4cd Bump v15.0.0-alpha.3 2021-08-02 08:16:27 -07:00
trop[bot]
d1894977de build: update build images to update npm and node (#30364)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-08-02 13:00:45 +09:00
trop[bot]
6765eec7a9 fix: respect LogJsConsoleMessages feature in InspectableWebContents::DidAddMessageToConsole (#30356)
* fix: respect LogJsConsoleMessages feature in InspectableWebContents::DidAddMessageToConsole

* just delete the method

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-08-02 10:00:30 +09:00
trop[bot]
d462204dce fix: guard against missing native view (#30328)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-02 09:57:58 +09:00
trop[bot]
52d9bf41e6 chore: update deps (#30346)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-07-30 14:56:10 -07:00
trop[bot]
0cd714a3bb fix: use contentAspectRatio not aspectRatio (#30332)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-30 02:24:30 -07:00
trop[bot]
1228c69e1d fix: BrowserViews not painting their WebContents (#30336)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-30 02:23:08 -07:00
trop[bot]
c09b22bf85 chore: remove experimental from navigator.serial implementation (#30334)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-07-29 21:55:48 -04:00
trop[bot]
65d83f2054 chore: update publish to npm to use GitHub token (#30292)
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:29 -07:00
trop[bot]
6fa95afd71 test: deflake crashReporter.getLastCrashReport test (#30309)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-28 12:21:04 -07:00
trop[bot]
d58211304b fix: update traffic lights position for macOS 11 (#30270)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-07-28 12:02:09 +02:00
trop[bot]
760cb4ab50 fix: Add missing items to menuItem.role documentation (#30302) 2021-07-28 11:54:41 +02:00
trop[bot]
4acdb97543 chore: bump chromium to 94.0.4584.0 (main) (#30030) (#30268)
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: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>

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: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-07-26 16:11:58 -07:00
Electron Bot
011a874021 Bump v15.0.0-alpha.2 2021-07-26 10:07:59 -07:00
trop[bot]
bac728a134 fix: process.exit crash in nativeWindowOpen (#30238)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-26 18:28:37 +02:00
trop[bot]
9d6c37ac88 docs: update title of guide (#30260)
Co-authored-by: Antón Molleda <amolleda@gmail.com>
2021-07-26 20:18:20 +09:00
trop[bot]
25fc9acec6 fix: increase stack size on windows x86 (#30243)
* fix: increace main thread stack size on windows x86

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

* chore: add debug logs

* Revert "chore: add debug logs"

This reverts commit 0be81ae07c.

* chore: use a reliable crash endpoint

Co-authored-by: Stephen Wang <wangwenqiang.wwq@bytedance.com>
Co-authored-by: Deepak Mohan <hop2deep@gmail.com>
2021-07-26 17:45:36 +09:00
Electron Bot
edb65a07f1 Bump v15.0.0-alpha.1 2021-07-21 15:05:18 -07:00
Samuel Attard
82b5fbc396 build: handle alpha tag existing before beta line has finished 2021-07-21 14:50:06 -07:00
1522 changed files with 35067 additions and 45918 deletions

View File

@@ -1 +0,0 @@
config-staging

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,34 +0,0 @@
const cp = require('child_process');
const fs = require('fs-extra');
const path = require('path');
const yaml = require('js-yaml');
const STAGING_DIR = path.resolve(__dirname, '..', 'config-staging');
function copyAndExpand(dir = './') {
const absDir = path.resolve(__dirname, dir);
const targetDir = path.resolve(STAGING_DIR, dir);
if (!fs.existsSync(targetDir)) {
fs.mkdirSync(targetDir);
}
for (const file of fs.readdirSync(absDir)) {
if (!file.endsWith('.yml')) {
if (fs.statSync(path.resolve(absDir, file)).isDirectory()) {
copyAndExpand(path.join(dir, file));
}
continue;
}
fs.writeFileSync(path.resolve(targetDir, file), yaml.dump(yaml.load(fs.readFileSync(path.resolve(absDir, file), 'utf8')), {
noRefs: true,
}));
}
}
if (fs.pathExists(STAGING_DIR)) fs.removeSync(STAGING_DIR);
copyAndExpand();
const output = cp.spawnSync(process.env.CIRCLECI_BINARY || 'circleci', ['config', 'pack', STAGING_DIR]);
fs.writeFileSync(path.resolve(STAGING_DIR, 'built.yml'), output.stdout.toString());

View File

@@ -1,51 +0,0 @@
executor:
name: linux-docker
size: medium
steps:
- checkout:
path: src/electron
- run:
name: Setup third_party Depot Tools
command: |
# "depot_tools" has to be checkout into "//third_party/depot_tools" so pylint.py can a "pylintrc" file.
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git src/third_party/depot_tools
echo 'export PATH="$PATH:'"$PWD"'/src/third_party/depot_tools"' >> $BASH_ENV
- run:
name: Download GN Binary
command: |
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
gn_version="$(curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/DEPS?format=TEXT" | base64 -d | grep gn_version | head -n1 | cut -d\' -f4)"
cipd ensure -ensure-file - -root . \<<-CIPD
\$ServiceURL https://chrome-infra-packages.appspot.com/
@Subdir src/buildtools/linux64
gn/gn/linux-amd64 $gn_version
CIPD
echo 'export CHROMIUM_BUILDTOOLS_PATH="'"$PWD"'/src/buildtools"' >> $BASH_ENV
- run:
name: Download clang-format Binary
command: |
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
sha1_path='buildtools/linux64/clang-format.sha1'
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/${sha1_path}?format=TEXT" | base64 -d > "src/${sha1_path}"
download_from_google_storage.py --no_resume --no_auth --bucket chromium-clang-format -s "src/${sha1_path}"
- run:
name: Run Lint
command: |
# gn.py tries to find a gclient root folder starting from the current dir.
# When it fails and returns "None" path, the whole script fails. Let's "fix" it.
touch .gclient
# Another option would be to checkout "buildtools" inside the Electron checkout,
# but then we would lint its contents (at least gn format), and it doesn't pass it.
cd src/electron
node script/yarn install --frozen-lockfile
node script/yarn lint
- run:
name: Run Script Typechecker
command: |
cd src/electron
node script/yarn tsc -p tsconfig.script.json

View File

@@ -1,10 +0,0 @@
{
"name": "@electron/circleci-config",
"version": "0.0.0",
"private": true,
"license": "MIT",
"dependencies": {
"fs-extra": "^10.1.0",
"js-yaml": "^4.1.0"
}
}

View File

@@ -1,43 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
argparse@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
fs-extra@^10.1.0:
version "10.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
dependencies:
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^2.0.0"
graceful-fs@^4.1.6, graceful-fs@^4.2.0:
version "4.2.10"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==
js-yaml@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
dependencies:
argparse "^2.0.1"
jsonfile@^6.0.1:
version "6.1.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
dependencies:
universalify "^2.0.0"
optionalDependencies:
graceful-fs "^4.1.6"
universalify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==

View File

@@ -1,59 +0,0 @@
# Electron Dev on Codespaces
Welcome to the Codespaces Electron Developer Environment.
## Quick Start
Upon creation of your codespace you should have [build tools](https://github.com/electron/build-tools) installed and an initialized gclient checkout of Electron. In order to build electron you'll need to run the following commands.
```bash
e sync -vv
e build
```
The initial sync will take approximately ~30 minutes and the build will take ~8 minutes. Incremental syncs and incremental builds are substantially quicker.
## Directory Structure
Codespaces doesn't lean very well into gclient based checkouts, the directory structure is slightly strange. There are two locations for the `electron` checkout that both map to the same files under the hood.
```graphql
# Primary gclient checkout container
/workspaces/gclient/*
src/* - # Chromium checkout
electron - # Electron checkout
# Symlinked Electron checkout (identical to the above)
/workspaces/electron
```
## Goma
If you are a maintainer [with Goma access](../docs/development/goma.md) it should be automatically configured and authenticated when you spin up a new codespaces instance. You can validate this by checking `e d goma_auth info` or by checking that your build-tools configuration has a goma mode of `cluster`.
## Running Electron
You can run Electron in a few ways. If you just want to see if it launches:
```bash
# Enter an interactive JS prompt headlessly
xvfb-run e start -i
```
But if you want to actually see Electron you will need to use the built-in VNC capability. If you click "Ports" in codespaces and then open the `VNC web client` forwarded port you should see a web based VNC portal in your browser. When you are asked for a password use `builduser`.
Once in the VNC UI you can open `Applications -> System -> XTerm` which will open a VNC based terminal app and then you can run `e start` like normal and Electron will open in your VNC session.
## Running Tests
You run tests via build-tools and `xvfb`.
```bash
# Run all tests
xvfb-run e test
# Run the main process tests
xvfb-run e test --runners=main
# Run the old remote tests
xvfb-run e test --runners=remote
```

View File

@@ -1,43 +0,0 @@
{
"dockerComposeFile": "docker-compose.yml",
"service": "buildtools",
"onCreateCommand": ".devcontainer/on-create-command.sh",
"workspaceFolder": "/workspaces/gclient/src/electron",
"extensions": [
"joeleinbinder.mojom-language",
"rafaelmaiolla.diff",
"surajbarkale.ninja",
"ms-vscode.cpptools",
"mutantdino.resourcemonitor",
"dbaeumer.vscode-eslint",
"shakram02.bash-beautify",
"marshallofsound.gnls-electron"
],
"settings": {
"[gn]": {
"editor.formatOnSave": true
},
"editor.tabSize": 2,
"bashBeautify.tabSize": 2
},
"forwardPorts": [8088, 6080, 5901],
"portsAttributes": {
"8088": {
"label": "Goma Control Panel",
"onAutoForward": "silent"
},
"6080": {
"label": "VNC web client (noVNC)",
"onAutoForward": "silent"
},
"5901": {
"label": "VNC TCP port",
"onAutoForward": "silent"
}
},
"hostRequirements": {
"storage": "32gb",
"cpus": 8
},
"remoteUser": "builduser"
}

View File

@@ -1,19 +0,0 @@
version: '3'
services:
buildtools:
image: ghcr.io/electron/devcontainer:27db4a3e3512bfd2e47f58cea69922da0835f1d9
volumes:
- ..:/workspaces/gclient/src/electron:cached
- /var/run/docker.sock:/var/run/docker.sock
command: /bin/sh -c "while sleep 1000; do :; done"
user: builduser
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined

View File

@@ -1,74 +0,0 @@
#!/bin/bash
set -eo pipefail
buildtools=$HOME/.electron_build_tools
gclient_root=/workspaces/gclient
buildtools_configs=/workspaces/buildtools-configs
export PATH="$PATH:$buildtools/src"
# Create the persisted buildtools config folder
mkdir -p $buildtools_configs
rm -f $buildtools/configs
ln -s $buildtools_configs $buildtools/configs
# Write the gclient config if it does not already exist
if [ ! -f $gclient_root/.gclient ]; then
echo "solutions = [
{ \"name\" : \"src/electron\",
\"url\" : \"https://github.com/electron/electron\",
\"deps_file\" : \"DEPS\",
\"managed\" : False,
\"custom_deps\" : {
},
\"custom_vars\": {},
},
]
" >$gclient_root/.gclient
fi
# Write the default buildtools config file if it does
# not already exist
if [ ! -f $buildtools/configs/evm.testing.json ]; then
write_config() {
echo "
{
\"root\": \"/workspaces/gclient\",
\"goma\": \"$1\",
\"gen\": {
\"args\": [
\"import(\\\"//electron/build/args/testing.gn\\\")\",
\"import(\\\"/home/builduser/.electron_build_tools/third_party/goma.gn\\\")\"
],
\"out\": \"Testing\"
},
\"env\": {
\"CHROMIUM_BUILDTOOLS_PATH\": \"/workspaces/gclient/src/buildtools\",
\"GIT_CACHE_PATH\": \"/workspaces/gclient/.git-cache\"
},
\"remotes\": {
\"electron\": {
\"origin\": \"https://github.com/electron/electron.git\"
}
}
}
" >$buildtools/configs/evm.testing.json
}
# Start out as cache only
write_config cache-only
e use testing
# Attempt to auth to the goma service via codespaces tokens
# if it works we can use the goma cluster
export NOTGOMA_CODESPACES_TOKEN=$GITHUB_TOKEN
if e d goma_auth login; then
write_config cluster
fi
else
# Even if the config file existed we still need to re-auth with the goma
# cluster
NOTGOMA_CODESPACES_TOKEN=$GITHUB_TOKEN e d goma_auth login || true
fi

View File

@@ -1,5 +1,4 @@
{
"root": true,
"extends": "standard",
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],

View File

@@ -1,5 +0,0 @@
# Atom --> Electron rename
d9321f4df751fa32813fab1b6387bbd61bd681d0
34c4c8d5088fa183f56baea28809de6f2a427e02
# Enable JS Semicolons
5d657dece4102e5e5304d42e8004b6ad64c0fcda

3
.github/CODEOWNERS vendored
View File

@@ -4,7 +4,7 @@
# https://git-scm.com/docs/gitignore
# Upgrades WG
/patches/ @electron/wg-upgrades @electron/wg-security
/patches/ @electron/wg-upgrades
DEPS @electron/wg-upgrades
# Releases WG
@@ -16,4 +16,3 @@ DEPS @electron/wg-upgrades
/lib/browser/guest-view-manager.ts @electron/wg-security
/lib/browser/guest-window-proxy.ts @electron/wg-security
/lib/browser/rpc-server.ts @electron/wg-security
/lib/renderer/security-warnings.ts @electron/wg-security

View File

@@ -12,16 +12,13 @@ body:
required: true
- label: I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
required: true
- label: I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a bug report that matches the one I want to file, without success.
- label: I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.
required: true
- type: input
attributes:
label: Electron Version
description: |
What version of Electron are you using?
Note: Please only report issues for [currently supported versions of Electron](https://www.electronjs.org/docs/latest/tutorial/support#currently-supported-versions).
placeholder: 17.0.0
description: What version of Electron are you using?
placeholder: 12.0.0
validations:
required: true
- type: dropdown
@@ -56,7 +53,7 @@ body:
attributes:
label: Last Known Working Electron version
description: What is the last version of Electron this worked in, if applicable?
placeholder: 16.0.0
placeholder: 11.0.0
- type: textarea
attributes:
label: Expected Behavior

View File

@@ -37,4 +37,4 @@ body:
label: Additional Information
description: Add any other context about the problem here.
validations:
required: false
required: true

2
.github/semantic.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
# Always validate the PR title, and ignore the commits
titleOnly: true

View File

@@ -1,178 +0,0 @@
name: Electron WOA Testing
on:
push:
branches: '**'
workflow_dispatch:
inputs:
appveyor_job_id:
description: 'Job Id of Appveyor WOA job to test'
type: text
required: true
jobs:
electron-woa-init:
if: ${{ github.event_name == 'push' && github.repository == 'electron/electron' }}
runs-on: ubuntu-latest
steps:
- name: Dummy step for push event
run: |
echo "This job is a needed initialization step for Electron WOA testing. Another test result will appear once the electron-woa-testing build is done."
electron-woa-testing:
if: ${{ github.event_name == 'workflow_dispatch' && github.repository == 'electron/electron' }}
runs-on: [self-hosted, woa]
permissions:
checks: write
pull-requests: write
steps:
- uses: LouisBrunner/checks-action@v1.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: electron-woa-testing
status: in_progress
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
output: |
{"summary":"Test In Progress","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
- name: Clean Workspace
run: |
Remove-Item * -Recurse -Force
shell: powershell
- name: Checkout
uses: actions/checkout@v3
with:
path: src\electron
fetch-depth: 0
- name: Yarn install
run: |
cd src\electron
node script/yarn.js install --frozen-lockfile
- name: Download and extract dist.zip for test
run: |
$localArtifactPath = "$pwd\dist.zip"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/dist.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\Default -y $localArtifactPath
shell: powershell
- name: Download and extract native test executables for test
run: |
$localArtifactPath = "src\out\Default\shell_browser_ui_unittests.exe"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/shell_browser_ui_unittests.exe"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
shell: powershell
- name: Download and extract ffmpeg.zip for test
run: |
$localArtifactPath = "$pwd\ffmpeg.zip"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/ffmpeg.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\ffmpeg $localArtifactPath
shell: powershell
- name: Download node headers for test
run: |
$localArtifactPath = "src\node_headers.zip"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/node_headers.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
cd src
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y node_headers.zip
shell: powershell
- name: Download electron.lib for test
run: |
$localArtifactPath = "src\out\Default\electron.lib"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/electron.lib"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
shell: powershell
# Uncomment the following block if pdb files are needed to debug issues
# - name: Download pdb files for detailed stacktraces
# if: ${{ github.event_name == 'workflow_dispatch' }}
# run: |
# try {
# $localArtifactPath = "src\pdb.zip"
# $serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/pdb.zip"
# Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.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
# }
# shell: powershell
- name: Setup node headers
run: |
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
shell: powershell
- name: Run Electron Main process tests
run: |
cd src
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
set npm_config_arch=arm64
cd electron
node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
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
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
- name: Run Electron Remote based tests
if: ${{ success() || failure() }}
run: |
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
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
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
- name: Verify ffmpeg
run: |
cd src
echo "Verifying non proprietary ffmpeg"
python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
shell: cmd
- name: Kill processes left running from last test run
if: ${{ always() }}
run: |
Get-Process | Where Name -Like "electron*" | Stop-Process
Get-Process | Where Name -Like "msedge*" | Stop-Process
shell: powershell
- name: Delete user app data directories
if: ${{ always() }}
run: |
Remove-Item -path $env:APPDATA/Electron* -Recurse -Force -ErrorAction Ignore
shell: powershell
- uses: LouisBrunner/checks-action@v1.1.1
if: ${{ success() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: electron-woa-testing
conclusion: "${{ job.status }}"
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
output: |
{"summary":"${{ job.status }}","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
- uses: LouisBrunner/checks-action@v1.1.1
if: ${{ success() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: electron-woa-testing
conclusion: "${{ job.status }}"
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
output: |
{"summary":"Job Succeeded","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
- uses: LouisBrunner/checks-action@v1.1.1
if: ${{ ! success() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: electron-woa-testing
conclusion: "${{ job.status }}"
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
output: |
{"summary":"Job Failed","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}

View File

@@ -1,31 +0,0 @@
name: Trigger Major Release Dependency Updates
on:
release:
types: [published]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
check_tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check Tag
run: |
if [[ ${{ github.event.release.tag_name }} =~ ^v[0-9]+\.0\.0$ ]]; then
echo ::set-output name=should_release::true
fi
trigger:
runs-on: ubuntu-latest
needs: check_tag
if: needs.check_tag.outputs.should_release == 'true'
steps:
- uses: actions/checkout@v3
- name: Trigger New chromedriver Release
run: |
gh api /repos/:owner/chromedriver/actions/workflows/release.yml/dispatches --input - <<< '{"ref":"main","inputs":{"version":"${{ github.event.release.tag_name }}"}}'
- name: Trigger New mksnapshot Release
run: |
gh api /repos/:owner/mksnapshot/actions/workflows/release.yml/dispatches --input - <<< '{"ref":"main","inputs":{"version":"${{ github.event.release.tag_name }}"}}'

View File

@@ -1,26 +0,0 @@
name: "Check Semantic Commit"
on:
pull_request_target:
types:
- opened
- edited
- synchronize
permissions:
contents: read
jobs:
main:
permissions:
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
name: Validate PR Title
runs-on: ubuntu-latest
steps:
- name: semantic-pull-request
uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
validateSingleCommit: false

1
.husky/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
_

View File

@@ -23,5 +23,7 @@
"br_spaces": 0
},
"single-h1": false,
"no-inline-html": false
"no-inline-html": {
"allowed_elements": ["br"]
}
}

1
.nvmrc
View File

@@ -1 +0,0 @@
16

314
BUILD.gn
View File

@@ -37,13 +37,12 @@ if (is_mac) {
import("build/rules.gni")
assert(
mac_deployment_target == "10.13",
mac_deployment_target == "10.11.0",
"Chromium has updated the mac_deployment_target, please update this assert, update the supported versions documentation (docs/tutorial/support.md) and flag this as a breaking change")
}
if (is_linux) {
import("//build/config/linux/pkg_config.gni")
import("//tools/generate_stubs/rules.gni")
pkg_config("gio_unix") {
packages = [ "gio-unix-2.0" ]
@@ -55,48 +54,6 @@ if (is_linux) {
"gdk-pixbuf-2.0",
]
}
generate_library_loader("libnotify_loader") {
name = "LibNotifyLoader"
output_h = "libnotify_loader.h"
output_cc = "libnotify_loader.cc"
header = "<libnotify/notify.h>"
config = ":libnotify_config"
functions = [
"notify_is_initted",
"notify_init",
"notify_get_server_caps",
"notify_get_server_info",
"notify_notification_new",
"notify_notification_add_action",
"notify_notification_set_image_from_pixbuf",
"notify_notification_set_timeout",
"notify_notification_set_urgency",
"notify_notification_set_hint_string",
"notify_notification_show",
"notify_notification_close",
]
}
# Generates electron_gtk_stubs.h header which contains
# stubs for extracting function ptrs from the gtk library.
# Function signatures for which stubs are required should be
# declared in electron_gtk.sigs, currently this file contains
# signatures for the functions used with native file chooser
# implementation. In future, this file can be extended to contain
# gtk4 stubs to switch gtk version in runtime.
generate_stubs("electron_gtk_stubs") {
sigs = [
"shell/browser/ui/electron_gdk_pixbuf.sigs",
"shell/browser/ui/electron_gtk.sigs",
]
extra_header = "shell/browser/ui/electron_gtk.fragment"
output_name = "electron_gtk_stubs"
public_deps = [ "//ui/gtk:gtk_config" ]
logging_function = "LogNoop()"
logging_include = "ui/gtk/log_noop.h"
}
}
declare_args() {
@@ -107,14 +64,6 @@ branding = read_file("shell/app/BRANDING.json", "json")
electron_project_name = branding.project_name
electron_product_name = branding.product_name
electron_mac_bundle_id = branding.mac_bundle_id
electron_version = exec_script("script/print-version.py",
[],
"trim string",
[
".git/packed-refs",
".git/HEAD",
"script/lib/get-version.js",
])
if (is_mas_build) {
assert(is_mac,
@@ -143,7 +92,7 @@ config("electron_lib_config") {
include_dirs = [ "." ]
}
# We generate the definitions twice here, once in //electron/electron.d.ts
# We geneate the definitions twice here, once in //electron/electron.d.ts
# and once in $target_gen_dir
# The one in $target_gen_dir is used for the actual TSC build later one
# and the one in //electron/electron.d.ts is used by your IDE (vscode)
@@ -241,7 +190,6 @@ action("electron_js2c") {
action("generate_config_gypi") {
outputs = [ "$root_gen_dir/config.gypi" ]
script = "script/generate-config-gypi.py"
inputs = [ "//third_party/electron_node/configure.py" ]
args = rebase_path(outputs) + [ target_cpu ]
}
@@ -305,14 +253,42 @@ copy("copy_shell_devtools_discovery_page") {
outputs = [ "$target_gen_dir/shell_devtools_discovery_page.html" ]
}
if (is_linux) {
generate_library_loader("libnotify_loader") {
name = "LibNotifyLoader"
output_h = "libnotify_loader.h"
output_cc = "libnotify_loader.cc"
header = "<libnotify/notify.h>"
config = ":libnotify_config"
functions = [
"notify_is_initted",
"notify_init",
"notify_get_server_caps",
"notify_get_server_info",
"notify_notification_new",
"notify_notification_add_action",
"notify_notification_set_image_from_pixbuf",
"notify_notification_set_timeout",
"notify_notification_set_urgency",
"notify_notification_set_hint_string",
"notify_notification_show",
"notify_notification_close",
]
}
}
npm_action("electron_version_args") {
script = "generate-version-json"
outputs = [ "$target_gen_dir/electron_version.args" ]
args = rebase_path(outputs) + [ "$electron_version" ]
args = rebase_path(outputs)
inputs = [ "script/generate-version-json.js" ]
inputs = [
"ELECTRON_VERSION",
"script/generate-version-json.js",
]
}
templated_file("electron_version_header") {
@@ -324,39 +300,6 @@ templated_file("electron_version_header") {
args_files = get_target_outputs(":electron_version_args")
}
templated_file("electron_win_rc") {
deps = [ ":electron_version_args" ]
template = "build/templates/electron_rc.tmpl"
output = "$target_gen_dir/win-resources/electron.rc"
args_files = get_target_outputs(":electron_version_args")
}
copy("electron_win_resource_files") {
sources = [
"shell/browser/resources/win/electron.ico",
"shell/browser/resources/win/resource.h",
]
outputs = [ "$target_gen_dir/win-resources/{{source_file_part}}" ]
}
templated_file("electron_version_file") {
deps = [ ":electron_version_args" ]
template = "build/templates/version_string.tmpl"
output = "$root_build_dir/version"
args_files = get_target_outputs(":electron_version_args")
}
group("electron_win32_resources") {
public_deps = [
":electron_win_rc",
":electron_win_resource_files",
]
}
action("electron_fuses") {
script = "build/fuses/build.py"
@@ -370,23 +313,6 @@ action("electron_fuses") {
args = rebase_path(outputs)
}
action("electron_generate_node_defines") {
script = "build/generate_node_defines.py"
inputs = [
"//third_party/electron_node/src/tracing/trace_event_common.h",
"//third_party/electron_node/src/tracing/trace_event.h",
"//third_party/electron_node/src/util.h",
]
outputs = [
"$target_gen_dir/push_and_undef_node_defines.h",
"$target_gen_dir/pop_node_defines.h",
]
args = [ rebase_path(target_gen_dir) ] + rebase_path(inputs)
}
source_set("electron_lib") {
configs += [ "//v8:external_startup_data" ]
configs += [ "//third_party/electron_node:node_internals" ]
@@ -398,7 +324,6 @@ source_set("electron_lib") {
deps = [
":electron_fuses",
":electron_generate_node_defines",
":electron_js2c",
":electron_version_header",
":resources",
@@ -408,19 +333,15 @@ source_set("electron_lib") {
"shell/common/api:mojo",
"//base:base_static",
"//base/allocator:buildflags",
"//chrome:strings",
"//chrome/app:command_ids",
"//chrome/app/resources:platform_locale_settings",
"//components/autofill/core/common:features",
"//components/certificate_transparency",
"//components/embedder_support:browser_util",
"//components/language/core/browser",
"//components/net_log",
"//components/network_hints/browser",
"//components/network_hints/common:mojo_bindings",
"//components/network_hints/renderer",
"//components/network_session_configurator/common",
"//components/omnibox/browser:buildflags",
"//components/os_crypt",
"//components/pref_registry",
"//components/prefs",
@@ -429,7 +350,6 @@ source_set("electron_lib") {
"//components/user_prefs",
"//components/viz/host",
"//components/viz/service",
"//components/webrtc",
"//content/public/browser",
"//content/public/child",
"//content/public/gpu",
@@ -442,6 +362,9 @@ source_set("electron_lib") {
"//media/mojo/mojom",
"//net:extras",
"//net:net_resources",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/shared_impl",
"//printing/buildflags",
"//services/device/public/cpp/geolocation",
"//services/device/public/cpp/hid",
@@ -478,6 +401,7 @@ source_set("electron_lib") {
]
include_dirs = [
"chromium_src",
".",
"$target_gen_dir",
@@ -530,8 +454,8 @@ source_set("electron_lib") {
if (is_linux) {
deps += [
"//build/config/linux/gtk:gtkprint",
"//components/crash/content/browser",
"//ui/gtk:gtk_config",
]
}
@@ -559,8 +483,6 @@ source_set("electron_lib") {
"StoreKit.framework",
]
weak_frameworks = [ "QuickLookThumbnailing.framework" ]
sources += [
"shell/browser/ui/views/autofill_popup_view.cc",
"shell/browser/ui/views/autofill_popup_view.h",
@@ -594,25 +516,18 @@ source_set("electron_lib") {
if (is_linux) {
libs = [ "xshmfence" ]
deps += [
":electron_gtk_stubs",
":libnotify_loader",
"//build/config/linux/gtk",
"//dbus",
"//device/bluetooth",
"//ui/base/ime/linux",
"//ui/events/devices/x11",
"//ui/events/platform/x11",
"//ui/linux:linux_ui",
"//ui/linux:linux_ui_factory",
"//ui/gtk",
"//ui/views/controls/webview",
"//ui/wm",
]
if (ozone_platform_x11) {
if (use_x11) {
sources += filenames.lib_sources_linux_x11
public_deps += [
"//ui/base/x",
"//ui/ozone/platform/x11",
]
}
configs += [ ":gio_unix" ]
defines += [
@@ -620,9 +535,8 @@ source_set("electron_lib") {
"GLIB_DISABLE_DEPRECATION_WARNINGS",
]
sources += filenames.lib_sources_nss
sources += [
"shell/browser/certificate_manager_model.cc",
"shell/browser/certificate_manager_model.h",
"shell/browser/ui/gtk/app_indicator_icon.cc",
"shell/browser/ui/gtk/app_indicator_icon.h",
"shell/browser/ui/gtk/app_indicator_icon_menu.cc",
@@ -660,14 +574,6 @@ source_set("electron_lib") {
]
}
if (enable_ppapi) {
deps += [
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/shared_impl",
]
}
if (enable_run_as_node) {
sources += [
"shell/app/node_main.cc",
@@ -702,6 +608,12 @@ source_set("electron_lib") {
}
if (enable_desktop_capturer) {
if (is_component_build && !is_linux) {
# On windows the implementation relies on unexported
# DxgiDuplicatorController class. On macOS the implementation
# relies on unexported webrtc::GetWindowOwnerPid method.
deps += [ "//third_party/webrtc/modules/desktop_capture" ]
}
sources += [
"shell/browser/api/electron_api_desktop_capturer.cc",
"shell/browser/api/electron_api_desktop_capturer.h",
@@ -717,6 +629,8 @@ source_set("electron_lib") {
if (enable_basic_printing) {
sources += [
"shell/browser/printing/print_preview_message_handler.cc",
"shell/browser/printing/print_preview_message_handler.h",
"shell/browser/printing/print_view_manager_electron.cc",
"shell/browser/printing/print_view_manager_electron.h",
"shell/renderer/printing/print_render_frame_helper_delegate.cc",
@@ -761,10 +675,8 @@ source_set("electron_lib") {
deps += [
"//chrome/browser/resources/pdf:resources",
"//components/pdf/browser",
"//components/pdf/browser:interceptors",
"//components/pdf/common",
"//components/pdf/renderer",
"//pdf",
"//pdf:pdf_ppapi",
]
sources += [
"shell/browser/electron_pdf_web_contents_helper_client.cc",
@@ -774,6 +686,14 @@ source_set("electron_lib") {
sources += get_target_outputs(":electron_fuses")
if (is_win && enable_win_dark_mode_window_ui) {
sources += [
"shell/browser/win/dark_mode.cc",
"shell/browser/win/dark_mode.h",
]
libs += [ "uxtheme.lib" ]
}
if (allow_runtime_configurable_key_storage) {
defines += [ "ALLOW_RUNTIME_CONFIGURABLE_KEY_STORAGE" ]
}
@@ -793,6 +713,7 @@ if (is_mac) {
electron_helper_name = "$electron_product_name Helper"
electron_login_helper_name = "$electron_product_name Login Helper"
electron_framework_version = "A"
electron_version = read_file("ELECTRON_VERSION", "trim string")
mac_xib_bundle_data("electron_xibs") {
sources = [ "shell/common/resources/mac/MainMenu.xib" ]
@@ -857,11 +778,16 @@ if (is_mac) {
# Add the SwiftShader .dylibs in the Libraries directory of the Framework.
bundle_data("electron_swiftshader_binaries") {
sources = [
"$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
"$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
"$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
"$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
]
outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
public_deps = [ "//ui/gl:swiftshader_vk_library_copy" ]
public_deps = [
"//ui/gl:swiftshader_egl_library_copy",
"//ui/gl:swiftshader_vk_library_copy",
]
}
}
group("electron_angle_library") {
@@ -943,13 +869,6 @@ if (is_mac) {
"@executable_path/../../../../../..",
]
}
# For component ffmpeg under non-component build, it is linked from
# @loader_path. However the ffmpeg.dylib is moved to a different place
# when generating app bundle, and we should change to link from @rpath.
if (is_component_ffmpeg && !is_component_build) {
ldflags += [ "-Wcrl,installnametool,-change,@loader_path/libffmpeg.dylib,@rpath/libffmpeg.dylib" ]
}
}
template("electron_helper_app") {
@@ -957,20 +876,13 @@ if (is_mac) {
assert(defined(invoker.helper_name_suffix))
output_name = electron_helper_name + invoker.helper_name_suffix
deps = [
":electron_framework+link",
"//base/allocator:early_zone_registration_mac",
]
deps = [ ":electron_framework+link" ]
if (!is_mas_build) {
deps += [ "//sandbox/mac:seatbelt" ]
}
defines = [ "HELPER_EXECUTABLE" ]
sources = [
"shell/app/electron_main_mac.cc",
"shell/app/uv_stdio_fix.cc",
"shell/app/uv_stdio_fix.h",
"shell/common/electron_constants.cc",
]
sources = filenames.app_sources
sources += [ "shell/common/electron_constants.cc" ]
include_dirs = [ "." ]
info_plist = "shell/renderer/resources/mac/Info.plist"
extra_substitutions =
@@ -1068,14 +980,14 @@ if (is_mac) {
action("electron_app_lproj_dirs") {
outputs = []
foreach(locale, locales_as_apple_outputs) {
foreach(locale, locales_as_mac_outputs) {
outputs += [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
}
script = "build/mac/make_locale_dirs.py"
args = rebase_path(outputs)
}
foreach(locale, locales_as_apple_outputs) {
foreach(locale, locales_as_mac_outputs) {
bundle_data("electron_app_strings_${locale}_bundle_data") {
sources = [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
outputs = [ "{{bundle_resources_dir}}/$locale.lproj" ]
@@ -1084,7 +996,7 @@ if (is_mac) {
}
group("electron_app_strings_bundle_data") {
public_deps = []
foreach(locale, locales_as_apple_outputs) {
foreach(locale, locales_as_mac_outputs) {
public_deps += [ ":electron_app_strings_${locale}_bundle_data" ]
}
}
@@ -1109,18 +1021,15 @@ if (is_mac) {
mac_app_bundle("electron_app") {
output_name = electron_product_name
sources = [
"shell/app/electron_main_mac.cc",
"shell/app/uv_stdio_fix.cc",
"shell/app/uv_stdio_fix.h",
]
sources = filenames.app_sources
sources += [ "shell/common/electron_constants.cc" ]
include_dirs = [ "." ]
deps = [
":electron_app_framework_bundle_data",
":electron_app_plist",
":electron_app_resources",
":electron_fuses",
"//base/allocator:early_zone_registration_mac",
"//base",
"//electron/buildflags",
]
if (is_mas_build) {
@@ -1164,18 +1073,21 @@ if (is_mac) {
deps = [ ":electron_app" ]
}
extract_symbols("egl_syms") {
binary = "$root_out_dir/libEGL.dylib"
extract_symbols("swiftshader_egl_syms") {
binary = "$root_out_dir/libswiftshader_libEGL.dylib"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/libEGL.dylib.dSYM/Contents/Resources/DWARF/libEGL.dylib"
deps = [ "//third_party/angle:libEGL" ]
dsym_file = "$root_out_dir/libswiftshader_libEGL.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libEGL.dylib"
deps =
[ "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL" ]
}
extract_symbols("gles_syms") {
binary = "$root_out_dir/libGLESv2.dylib"
extract_symbols("swiftshader_gles_syms") {
binary = "$root_out_dir/libswiftshader_libGLESv2.dylib"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/libGLESv2.dylib.dSYM/Contents/Resources/DWARF/libGLESv2.dylib"
deps = [ "//third_party/angle:libGLESv2" ]
dsym_file = "$root_out_dir/libswiftshader_libGLESv2.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libGLESv2.dylib"
deps = [
"//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
]
}
extract_symbols("crashpad_handler_syms") {
@@ -1187,10 +1099,10 @@ if (is_mac) {
group("electron_symbols") {
deps = [
":egl_syms",
":electron_app_syms",
":electron_framework_syms",
":gles_syms",
":swiftshader_egl_syms",
":swiftshader_gles_syms",
]
if (!is_mas_build) {
@@ -1219,21 +1131,12 @@ if (is_mac) {
executable("electron_app") {
output_name = electron_project_name
if (is_win) {
sources = [ "shell/app/electron_main_win.cc" ]
} else if (is_linux) {
sources = [
"shell/app/electron_main_linux.cc",
"shell/app/uv_stdio_fix.cc",
"shell/app/uv_stdio_fix.h",
]
}
sources = filenames.app_sources
include_dirs = [ "." ]
deps = [
":default_app_asar",
":electron_app_manifest",
":electron_lib",
":electron_win32_resources",
":packed_resources",
"//components/crash/core/app",
"//content:sandbox_helper_win",
@@ -1249,7 +1152,7 @@ if (is_mac) {
if (enable_hidpi) {
data += [ "$root_out_dir/chrome_200_percent.pak" ]
}
foreach(locale, platform_pak_locales) {
foreach(locale, locales) {
data += [ "$root_out_dir/locales/$locale.pak" ]
}
@@ -1267,7 +1170,8 @@ if (is_mac) {
if (is_win) {
sources += [
"$target_gen_dir/win-resources/electron.rc",
# TODO: we should be generating our .rc files more like how chrome does
"shell/browser/resources/win/electron.rc",
"shell/browser/resources/win/resource.h",
]
@@ -1327,10 +1231,6 @@ if (is_mac) {
if (!is_component_build && is_component_ffmpeg) {
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
if (is_linux) {
deps += [ "//sandbox/linux:chrome_sandbox" ]
}
}
}
@@ -1349,23 +1249,27 @@ if (is_mac) {
deps = [ ":electron_app" ]
}
extract_symbols("egl_symbols") {
binary = "$root_out_dir/libEGL$_target_shared_library_suffix"
extract_symbols("swiftshader_egl_symbols") {
binary = "$root_out_dir/swiftshader/libEGL$_target_shared_library_suffix"
symbol_dir = "$root_out_dir/breakpad_symbols"
deps = [ "//third_party/angle:libEGL" ]
deps =
[ "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL" ]
}
extract_symbols("gles_symbols") {
binary = "$root_out_dir/libGLESv2$_target_shared_library_suffix"
extract_symbols("swiftshader_gles_symbols") {
binary =
"$root_out_dir/swiftshader/libGLESv2$_target_shared_library_suffix"
symbol_dir = "$root_out_dir/breakpad_symbols"
deps = [ "//third_party/angle:libGLESv2" ]
deps = [
"//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
]
}
group("electron_symbols") {
deps = [
":egl_symbols",
":electron_app_symbols",
":gles_symbols",
":swiftshader_egl_symbols",
":swiftshader_gles_symbols",
]
}
}
@@ -1449,22 +1353,25 @@ group("licenses") {
]
}
copy("electron_version") {
sources = [ "ELECTRON_VERSION" ]
outputs = [ "$root_build_dir/version" ]
}
dist_zip("electron_dist_zip") {
data_deps = [
":electron_app",
":electron_version_file",
":electron_version",
":licenses",
]
if (is_linux) {
data_deps += [ "//sandbox/linux:chrome_sandbox" ]
}
deps = data_deps
outputs = [ "$root_build_dir/dist.zip" ]
}
dist_zip("electron_ffmpeg_zip") {
data_deps = [ "//third_party/ffmpeg" ]
deps = data_deps
outputs = [ "$root_build_dir/ffmpeg.zip" ]
}
@@ -1482,7 +1389,6 @@ group("electron_chromedriver") {
dist_zip("electron_chromedriver_zip") {
testonly = true
data_deps = electron_chromedriver_deps
deps = data_deps
outputs = [ "$root_build_dir/chromedriver.zip" ]
}
@@ -1501,7 +1407,6 @@ group("electron_mksnapshot") {
dist_zip("electron_mksnapshot_zip") {
data_deps = mksnapshot_deps
deps = data_deps
outputs = [ "$root_build_dir/mksnapshot.zip" ]
}
@@ -1512,7 +1417,6 @@ copy("hunspell_dictionaries") {
dist_zip("hunspell_dictionaries_zip") {
data_deps = [ ":hunspell_dictionaries" ]
deps = data_deps
flatten = true
outputs = [ "$root_build_dir/hunspell_dictionaries.zip" ]
@@ -1526,7 +1430,6 @@ copy("libcxx_headers") {
dist_zip("libcxx_headers_zip") {
data_deps = [ ":libcxx_headers" ]
deps = data_deps
flatten = true
flatten_relative_to = rebase_path(
"$target_gen_dir/electron_libcxx_include/buildtools/third_party/libc++/trunk",
@@ -1542,7 +1445,6 @@ copy("libcxxabi_headers") {
dist_zip("libcxxabi_headers_zip") {
data_deps = [ ":libcxxabi_headers" ]
deps = data_deps
flatten = true
flatten_relative_to = rebase_path(
"$target_gen_dir/electron_libcxxabi_include/buildtools/third_party/libc++abi/trunk",

24
DEPS
View File

@@ -1,12 +1,28 @@
gclient_gn_args_from = 'src'
gclient_gn_args_file = 'src/build/config/gclient_args.gni'
gclient_gn_args = [
'build_with_chromium',
'checkout_android',
'checkout_android_native_support',
'checkout_libaom',
'checkout_nacl',
'checkout_pgo_profiles',
'checkout_oculus_sdk',
'checkout_openxr',
'checkout_google_benchmark',
'mac_xcode_version',
'generate_location_tags',
]
vars = {
'chromium_version':
'106.0.5249.165',
'94.0.4606.81',
'node_version':
'v16.16.0',
'v16.5.0',
'nan_version':
'16fa32231e2ccd89d2804b3f765319128b20c4ac',
# The following commit hash of NAN is v2.14.2 with *only* changes to the
# test suite. This should be updated to a specific tag when one becomes
# available.
'65b32af46e9d7fab2e4ff657751205b3865f4920',
'squirrel.mac_version':
'0e5d146ba13101a1302d59ea6e6e0b3cace4ae38',

1
ELECTRON_VERSION Normal file
View File

@@ -0,0 +1 @@
15.3.1

View File

@@ -2,7 +2,7 @@
[![CircleCI Build Status](https://circleci.com/gh/electron/electron/tree/main.svg?style=shield)](https://circleci.com/gh/electron/electron/tree/main)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/4lggi9dpjc1qob7k/branch/main?svg=true)](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/main)
[![Electron Discord Invite](https://img.shields.io/discord/745037351163527189?color=%237289DA&label=chat&logo=discord&logoColor=white)](https://discord.gg/electronjs)
[![Electron Discord Invite](https://img.shields.io/discord/745037351163527189?color=%237289DA&label=chat&logo=discord&logoColor=white)](https://discord.com/invite/electron)
:memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪.
View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/).
@@ -34,17 +34,6 @@ For more installation options and troubleshooting tips, see
[installation](docs/tutorial/installation.md). For info on how to manage Electron versions in your apps, see
[Electron versioning](docs/tutorial/electron-versioning.md).
## Platform support
Each Electron release provides binaries for macOS, Windows, and Linux.
* macOS (High Sierra and up): Electron provides 64-bit Intel and ARM binaries for macOS. Apple Silicon support was added in Electron 11.
* Windows (Windows 7 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8.
* Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on:
* Ubuntu 14.04 and newer
* Fedora 24 and newer
* Debian 8 and newer
## Quick start & Electron Fiddle
Use [`Electron Fiddle`](https://github.com/electron/fiddle)
@@ -65,10 +54,13 @@ npm start
## Resources for learning Electron
* [electronjs.org/docs](https://electronjs.org/docs) - All of Electron's documentation
* [electron/fiddle](https://github.com/electron/fiddle) - A tool to build, run, and package small Electron experiments
* [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - A very basic starter Electron app
* [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - Sample starter apps created by the community
- [electronjs.org/docs](https://electronjs.org/docs) - All of Electron's documentation
- [electron/fiddle](https://github.com/electron/fiddle) - A tool to build, run, and package small Electron experiments
- [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - A very basic starter Electron app
- [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - Sample starter apps created by the community
- [electron/simple-samples](https://github.com/electron/simple-samples) - Small applications with ideas for taking them further
- [electron/electron-api-demos](https://github.com/electron/electron-api-demos) - An Electron app that teaches you how to use Electron
- [hokein/electron-sample-apps](https://github.com/hokein/electron-sample-apps) - Small demo apps for the various Electron APIs
## Programmatic usage
@@ -89,15 +81,11 @@ const child = proc.spawn(electron)
### Mirrors
* [China](https://npmmirror.com/mirrors/electron/)
- [China](https://npm.taobao.org/mirrors/electron)
See the [Advanced Installation Instructions](https://www.electronjs.org/docs/latest/tutorial/installation#mirror) to learn how to use a custom mirror.
## Documentation Translations
## Documentation translations
We crowdsource translations for our documentation via [Crowdin](https://crowdin.com/project/electron).
We currently accept translations for Chinese (Simplified), French, German, Japanese, Portuguese,
Russian, and Spanish.
Find documentation translations in [electron/i18n](https://github.com/electron/i18n).
## Contributing
@@ -106,10 +94,10 @@ If you are interested in reporting/fixing issues and contributing directly to th
## Community
Info on reporting bugs, getting help, finding third-party tools and sample apps,
and more can be found on the [Community page](https://www.electronjs.org/community).
and more can be found in the [support document](docs/tutorial/support.md#finding-support).
## License
[MIT](https://github.com/electron/electron/blob/main/LICENSE)
When using Electron logos, make sure to follow [OpenJS Foundation Trademark Policy](https://openjsf.org/wp-content/uploads/sites/84/2021/01/OpenJS-Foundation-Trademark-Policy-2021-01-12.docx.pdf).
When using the Electron or other GitHub logos, be sure to follow the [GitHub logo guidelines](https://github.com/logos).

View File

@@ -3,7 +3,7 @@
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
# https://gn.googlesource.com/gn/+/master/docs/reference.md#target_cpu
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordningly
# if you pass a custom value for 'target_cpu'.
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
@@ -11,8 +11,8 @@
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64', 'mips64el'}.
# Is used in some publishing scripts, but does NOT affect the Electron binary.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
# Otherwise the release will be uploaded to the GitHub Releases.
# - "UPLOAD_TO_S3" Set it to '1' upload a release to the S3 bucket.
# Otherwise the release will be uploaded to the Github Releases.
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
#
# The publishing scripts expect access tokens to be defined as env vars,
@@ -23,292 +23,211 @@
# https://www.appveyor.com/docs/build-configuration/#secure-variables
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
# Uncomment these lines to enable RDP
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
version: 1.0.{build}
build_cloud: electron-16-core
image: vs2019bt-16.16.11
image: vs2019bt-16.6.2
environment:
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
GOMA_FALLBACK_ON_AUTH_FAILURE: true
matrix:
- job_name: Build
- job_name: Test
job_depends_on: Build
clone_folder: C:\projects\src\electron
# the first failed job cancels other jobs and fails entire build
matrix:
fast_finish: true
for:
-
matrix:
only:
- job_name: Build
init:
- ps: >-
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
}
build_script:
- ps: |
notifications:
- provider: Webhook
url: https://electron-mission-control.herokuapp.com/rest/appveyor-hook
method: POST
headers:
x-mission-control-secret:
secure: 90BLVPcqhJPG7d24v0q/RRray6W3wDQ8uVQlQjOHaBWkw1i8FoA1lsjr2C/v1dVok+tS2Pi6KxDctPUkwIb4T27u4RhvmcPzQhVpfwVJAG9oNtq+yKN7vzHfg7k/pojEzVdJpQLzeJGcSrZu7VY39Q==
on_build_success: false
on_build_failure: true
on_build_status_changed: false
build_script:
- ps: >-
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
} else {
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping tests for doc only change"; Exit-AppveyorBuild
$result = node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
Write-Output $result
if ($result.ExitCode -eq 0) {
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
}
$global:LASTEXITCODE = 0
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- update_depot_tools.bat
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npm install
- mkdir third_party
- ps: >-
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
- ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
- ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
- cd ..\..
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$goma_login = python $env:LOCAL_GOMA_DIR\goma_auth.py info
if ($goma_login -eq 'Login as Fermi Planck') {
Write-warning "Goma authentication is correct";
} else {
Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
$host.SetShouldExit(1)
}
}
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- >-
gclient config
--name "src\electron"
--unmanaged
%GCLIENT_EXTRA_ARGS%
"https://github.com/electron/electron"
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
$env:RUN_GCLIENT_SYNC="true"
} else {
cd src\electron
node script\generate-deps-hash.js
$depshash = Get-Content .\.depshash -Raw
$zipfile = "Z:\$depshash.7z"
cd ..\..
if (Test-Path -Path $zipfile) {
# file exists, unzip and then gclient sync
7z x -y $zipfile -mmt=14 -aoa
if (-not (Test-Path -Path "src\buildtools")) {
# the zip file must be corrupt - resync
$env:RUN_GCLIENT_SYNC="true"
if ($env:TARGET_ARCH -ne 'ia32') {
# only save on x64/woa to avoid contention saving
$env:SAVE_GCLIENT_SRC="true"
}
} else {
# update angle
cd src\third_party\angle
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
git fetch
cd ..\..\..
}
} else {
# file does not exist, gclient sync, then zip
}
- echo "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- cd ..
- mkdir src
- update_depot_tools.bat
- ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- >-
gclient config
--name "src\electron"
--unmanaged
%GCLIENT_EXTRA_ARGS%
"https://github.com/electron/electron"
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
$env:RUN_GCLIENT_SYNC="true"
} else {
cd src\electron
node script\generate-deps-hash.js
$depshash = Get-Content .\.depshash -Raw
$zipfile = "Z:\$depshash.7z"
cd ..\..
if (Test-Path -Path $zipfile) {
# file exists, unzip and then gclient sync
7z x -y $zipfile -mmt=30 -aoa
if (-not (Test-Path -Path "src\buildtools")) {
# the zip file must be corrupt - resync
$env:RUN_GCLIENT_SYNC="true"
if ($env:TARGET_ARCH -ne 'ia32') {
# only save on x64/woa to avoid contention saving
$env:SAVE_GCLIENT_SRC="true"
}
} else {
# update angle
cd src\third_party\angle
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
git fetch
cd ..\..\..
}
} else {
# file does not exist, gclient sync, then zip
$env:RUN_GCLIENT_SYNC="true"
if ($env:TARGET_ARCH -ne 'ia32') {
# only save on x64/woa to avoid contention saving
$env:SAVE_GCLIENT_SRC="true"
}
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync )
- ps: >-
if ($env:SAVE_GCLIENT_SRC -eq 'true') {
# archive current source for future use
# only run on x64/woa to avoid contention saving
$(7z a $zipfile src -xr!android_webview -xr!electron -xr'!*\.git' -xr!third_party\blink\web_tests -xr!third_party\blink\perf_tests -slp -t7z -mmt=30)
if ($LASTEXITCODE -ne 0) {
Write-warning "Could not save source to shared drive; continuing anyway"
}
# build time generation of file gen/angle/angle_commit.h depends on
# third_party/angle/.git
# https://chromium-review.googlesource.com/c/angle/angle/+/2074924
$(7z a $zipfile src\third_party\angle\.git)
if ($LASTEXITCODE -ne 0) {
Write-warning "Failed to add third_party\angle\.git; continuing anyway"
}
# build time generation of file dawn/common/Version_autogen.h depends on third_party/dawn/.git/HEAD
# https://dawn-review.googlesource.com/c/dawn/+/83901
$(7z a $zipfile src\third_party\dawn\.git)
if ($LASTEXITCODE -ne 0) {
Write-warning "Failed to add third_party\dawn\.git; continuing anyway"
}
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags --ignore_locks)
- ps: >-
if ($env:SAVE_GCLIENT_SRC -eq 'true') {
# archive current source for future use
# only run on x64/woa to avoid contention saving
$(7z a $zipfile src -xr!android_webview -xr!electron -xr'!*\.git' -xr!third_party\WebKit\LayoutTests! -xr!third_party\blink\web_tests -xr!third_party\blink\perf_tests -slp -t7z -mmt=30)
if ($LASTEXITCODE -ne 0) {
Write-warning "Could not save source to shared drive; continuing anyway"
}
- cd src
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common/api:mojo
- if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
- ninja -C out/ffmpeg electron:electron_ffmpeg_zip
- ninja -C out/Default electron:electron_dist_zip
- ninja -C out/Default shell_browser_ui_unittests
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
- ninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- ninja -C out/Default electron:hunspell_dictionaries_zip
- ninja -C out/Default electron:electron_chromedriver_zip
- ninja -C out/Default third_party/electron_node:headers
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
- 7z a builtins-pgo.zip v8\tools\builtins-pgo
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
ninja -C out/Default electron:electron_symbols
# build time generation of file gen/angle/angle_commit.h depends on
# third_party/angle/.git
# https://chromium-review.googlesource.com/c/angle/angle/+/2074924
$(7z a $zipfile src\third_party\angle\.git)
if ($LASTEXITCODE -ne 0) {
Write-warning "Failed to add third_party\angle\.git; continuing anyway"
}
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
}
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npm install
- mkdir third_party
- ps: >-
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
- ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
- ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
- cd ..
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
- cd src
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common/api:mojo
- if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
- ninja -C out/ffmpeg electron:electron_ffmpeg_zip
- ninja -C out/Default electron:electron_dist_zip
- ninja -C out/Default shell_browser_ui_unittests
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
- ninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- ninja -C out/Default electron:hunspell_dictionaries_zip
- ninja -C out/Default electron:electron_chromedriver_zip
- ninja -C out/Default third_party/electron_node:headers
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
- python electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- appveyor PushArtifact out/Default/windows_toolchain_profile.json
- appveyor PushArtifact out/Default/dist.zip
- appveyor PushArtifact out/Default/shell_browser_ui_unittests.exe
- appveyor PushArtifact out/Default/chromedriver.zip
- appveyor PushArtifact out/ffmpeg/ffmpeg.zip
- 7z a node_headers.zip out\Default\gen\node_headers
- appveyor PushArtifact node_headers.zip
- appveyor PushArtifact out/Default/mksnapshot.zip
- appveyor PushArtifact out/Default/hunspell_dictionaries.zip
- appveyor PushArtifact out/Default/electron.lib
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
ninja -C out/Default electron:electron_symbols
}
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
appveyor-retry appveyor PushArtifact pdb.zip
}
- python electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
- ps: >-
if ((-Not (Test-Path Env:\TEST_WOA)) -And (-Not (Test-Path Env:\ELECTRON_RELEASE)) -And ($env:GN_CONFIG -in "testing", "release")) {
$env:RUN_TESTS="true"
}
- ps: >-
if ($env:RUN_TESTS -eq 'true') {
New-Item .\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
} else {
echo "Skipping tests for $env:GN_CONFIG build"
}
- cd electron
# CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022
- if "%RUN_TESTS%"=="true" ( echo Running test suite & node script/yarn test -- --trace-uncaught --enable-logging --disable-features=CalculateNativeWinOcclusion )
- cd ..
- if "%RUN_TESTS%"=="true" ( echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg )
- echo "About to verify mksnapshot"
- if "%RUN_TESTS%"=="true" ( echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd% )
- echo "Done verifying mksnapshot"
- if "%RUN_TESTS%"=="true" ( echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd% )
- echo "Done verifying chromedriver"
deploy_script:
- cd electron
- ps: >-
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_S3) {
Write-Output "Uploading Electron release distribution to s3"
& python script\release\uploaders\upload.py --verbose --upload_to_s3
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
Write-Output "Uploading Electron release distribution to github releases"
& python script\release\uploaders\upload.py --verbose
}
- python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
deploy_script:
- cd electron
- ps: >-
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
Write-Output "Uploading Electron release distribution to azure"
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
} else {
Write-Output "Uploading Electron release distribution to github releases"
& python3 script\release\uploaders\upload.py --verbose
}
} elseif (Test-Path Env:\TEST_WOA) {
node script/release/ci-release-build.js --job=electron-woa-testing --ci=GHA --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
}
on_finish:
# Uncomment this lines to enable RDP
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
- if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- if exist builtins-pgo.zip (appveyor-retry appveyor PushArtifact builtins-pgo.zip)
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
}
-
matrix:
only:
- job_name: Test
init:
- ps: |
if ($env:RUN_TESTS -ne 'true') {
Write-warning "Skipping tests for $env:APPVEYOR_PROJECT_NAME"; Exit-AppveyorBuild
}
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
}
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping tests for doc only change"; Exit-AppveyorBuild
}
$global:LASTEXITCODE = 0
- ps: |
cd ..
mkdir out\Default
cd ..
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','builtins-pgo.zip')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build") {
$jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name"
} else {
$outfile = $artifact_name
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
}
}
- ps: |
$out_default_zips = @('dist.zip','chromedriver.zip','mksnapshot.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip
- ps: 7z x -y -osrc builtins-pgo.zip
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
- ps: |
cd src
New-Item .\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
- cd electron
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log
- echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log
- cd ..
- echo Verifying non proprietary ffmpeg & python3 electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
- echo "About to verify mksnapshot"
- echo Verifying mksnapshot & python3 electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd%
- echo "Done verifying mksnapshot"
- echo Verifying chromedriver & python3 electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd%
- echo "Done verifying chromedriver"
on_finish:
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )
} elseif (Test-Path Env:\TEST_WOA) {
node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
}

121
azure-pipelines-arm.yml Normal file
View File

@@ -0,0 +1,121 @@
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: src/electron'
inputs:
TargetFolder: src/electron
- bash: |
cd src/electron
node script/yarn.js install --frozen-lockfile
displayName: 'Yarn install'
- bash: |
export ZIP_DEST=$PWD/src/out/Default
echo "##vso[task.setvariable variable=ZIP_DEST]$ZIP_DEST"
mkdir -p $ZIP_DEST
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=dist.zip --dest=$ZIP_DEST
cd $ZIP_DEST
unzip -o dist.zip
xattr -cr Electron.app
displayName: 'Download and unzip dist files for test'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
export FFMPEG_ZIP_DEST=$PWD/src/out/ffmpeg
mkdir -p $FFMPEG_ZIP_DEST
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=ffmpeg.zip --dest=$FFMPEG_ZIP_DEST
cd $FFMPEG_ZIP_DEST
unzip -o ffmpeg.zip
displayName: 'Download and unzip ffmpeg for test'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
export NODE_HEADERS_DEST=$PWD/src/out/Default/gen
mkdir -p $NODE_HEADERS_DEST
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=node_headers.tar.gz --dest=$NODE_HEADERS_DEST
cd $NODE_HEADERS_DEST
tar xzf node_headers.tar.gz
displayName: 'Download and untar node header files for test'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
export CROSS_ARCH_SNAPSHOTS=$PWD/src/out/Default/cross-arch-snapshots
mkdir -p $CROSS_ARCH_SNAPSHOTS
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/snapshot_blob.bin --dest=$CROSS_ARCH_SNAPSHOTS
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/v8_context_snapshot.arm64.bin --dest=$CROSS_ARCH_SNAPSHOTS
displayName: 'Download cross arch snapshot files'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
cd src
export ELECTRON_OUT_DIR=Default
export npm_config_arch=arm64
(cd electron && node script/yarn test --enable-logging --runners main)
displayName: 'Run Electron main tests'
timeoutInMinutes: 20
env:
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
- bash: |
cd src
export ELECTRON_OUT_DIR=Default
export npm_config_arch=arm64
(cd electron && node script/yarn test --enable-logging --runners remote)
displayName: 'Run Electron remote tests'
timeoutInMinutes: 20
condition: succeededOrFailed()
env:
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
- bash: |
cd src
python electron/script/verify-ffmpeg.py --source-root "$PWD" --build-dir out/Default --ffmpeg-path out/ffmpeg
displayName: Verify non proprietary ffmpeg
timeoutInMinutes: 5
condition: succeededOrFailed()
env:
TARGET_ARCH: arm64
- bash: |
cd src
echo Verify cross arch snapshot
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --snapshot-files-dir $PWD/out/Default/cross-arch-snapshots
displayName: Verify cross arch snapshot
timeoutInMinutes: 5
condition: succeededOrFailed()
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFiles: '*.xml'
searchFolder: '$(System.DefaultWorkingDirectory)/src/junit/'
condition: succeededOrFailed()
- bash: killall Electron || echo "No Electron processes left running"
displayName: 'Kill processes left running from last test run'
condition: always()
- bash: |
rm -rf ~/Library/Application\ Support/Electron*
rm -rf ~/Library/Application\ Support/electron*
displayName: 'Delete user app data directories'
condition: always()
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
displayName: 'Clean Agent Directories'
condition: always()

129
azure-pipelines-woa.yml Normal file
View File

@@ -0,0 +1,129 @@
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: src\electron'
inputs:
TargetFolder: src\electron
- script: |
cd src\electron
node script/yarn.js install --frozen-lockfile
displayName: 'Yarn install'
- powershell: |
$localArtifactPath = "$pwd\dist.zip"
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/dist.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\Default -y $localArtifactPath
displayName: 'Download and extract dist.zip for test'
env:
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
- powershell: |
$localArtifactPath = "$pwd\src\out\Default\shell_browser_ui_unittests.exe"
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/shell_browser_ui_unittests.exe"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
displayName: 'Download and extract native test executables for test'
env:
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
- powershell: |
$localArtifactPath = "$pwd\ffmpeg.zip"
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/ffmpeg.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\ffmpeg $localArtifactPath
displayName: 'Download and extract ffmpeg.zip for test'
env:
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
- powershell: |
$localArtifactPath = "$pwd\src\node_headers.zip"
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/node_headers.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 node_headers.zip
displayName: 'Download node headers for test'
env:
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
- powershell: |
$localArtifactPath = "$pwd\src\out\Default\electron.lib"
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/electron.lib"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
displayName: 'Download electron.lib for test'
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
displayName: 'Setup node headers'
- 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=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'
inputs:
testResultsFiles: '*.xml'
searchFolder: '$(System.DefaultWorkingDirectory)/src/junit/'
condition: always()
- script: |
cd src
echo "Verifying non proprietary ffmpeg"
python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
displayName: 'Verify ffmpeg'
- powershell: |
Get-Process | Where Name Like "electron*" | Stop-Process
Get-Process | Where Name Like "msedge*" | Stop-Process
displayName: 'Kill processes left running from last test run'
condition: always()
- powershell: |
Remove-Item -path $env:APPDATA/Electron* -Recurse -Force -ErrorAction Ignore
displayName: 'Delete user app data directories'
condition: always()

View File

@@ -2,46 +2,34 @@ 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 = 109
node_module_version = 98
v8_promise_internal_field_count = 1
v8_typed_array_max_size_in_heap = 0
v8_embedder_string = "-electron.0"
# TODO: this breaks mksnapshot
v8_enable_snapshot_native_code_counters = false
# TODO(codebytere): remove when Node.js handles https://chromium-review.googlesource.com/c/v8/v8/+/3211575
v8_scriptormodule_legacy_lifetime = true
# we use this api
v8_enable_javascript_promise_hooks = true
enable_cdm_host_verification = false
proprietary_codecs = true
ffmpeg_branding = "Chrome"
enable_basic_printing = true
# Removes DLLs from the build, which are only meant to be used for Chromium development.
# See https://github.com/electron/electron/pull/17985
angle_enable_vulkan_validation_layers = false
dawn_enable_vulkan_validation_layers = false
# This breaks native node modules
libcxx_abi_unstable = false
# These are disabled because they cause the zip manifest to differ between
# testing and release builds.
# See https://chromium-review.googlesource.com/c/chromium/src/+/2774898.
enable_pseudolocales = false
is_cfi = false
# Make application name configurable at runtime for cookie crypto
allow_runtime_configurable_key_storage = true
# CET shadow stack is incompatible with v8, until v8 is CET compliant
# enabling this flag causes main process crashes where CET is enabled
# Ref: https://source.chromium.org/chromium/chromium/src/+/45fba672185aae233e75d6ddc81ea1e0b30db050:v8/BUILD.gn;l=357
enable_cet_shadow_stack = false
# For similar reasons, disable CFI, which is not well supported in V8.
# Chromium doesn't have any problems with this because they do not run
# V8 in the browser process.
# Ref: https://source.chromium.org/chromium/chromium/src/+/45fba672185aae233e75d6ddc81ea1e0b30db050:v8/BUILD.gn;l=281
is_cfi = false

View File

@@ -1,22 +1,33 @@
template("node_action") {
assert(defined(invoker.script), "Need script path to run")
assert(defined(invoker.args), "Need script arguments")
import("node.gni")
# TODO(MarshallOfSound): Move to electron/node, this is the only place it is used now
# Run an action with a given working directory. Behaves identically to the
# action() target type, with the exception that it changes directory before
# running the script.
#
# Parameters:
# cwd [required]: Directory to change to before running the script.
template("chdir_action") {
action(target_name) {
forward_variables_from(invoker,
"*",
[
"deps",
"public_deps",
"sources",
"inputs",
"outputs",
"script",
"args",
])
if (!defined(inputs)) {
inputs = []
assert(defined(cwd), "Need cwd in $target_name")
script = "//electron/build/run-in-dir.py"
if (defined(sources)) {
sources += [ invoker.script ]
} else {
assert(defined(inputs))
inputs += [ invoker.script ]
}
inputs += [ invoker.script ]
script = "//electron/build/run-node.py"
args = [ rebase_path(invoker.script) ] + invoker.args
args = [
rebase_path(cwd),
rebase_path(invoker.script),
]
args += invoker.args
}
}

View File

@@ -1,3 +1,23 @@
config("build_time_executable") {
configs = []
if (is_electron_build && !is_component_build) {
# The executables which have this config applied are dependent on ffmpeg,
# which is always a shared library in an Electron build. However, in the
# non-component build, executables don't have rpath set to search for
# libraries in the executable's directory, so ffmpeg cannot be found. So
# let's make sure rpath is set here.
# See '//build/config/gcc/BUILD.gn' for details on the rpath setting.
if (is_linux) {
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
if (is_mac) {
ldflags = [ "-Wl,-rpath,@loader_path/." ]
}
}
}
# For MAS build, we force defining "MAS_BUILD".
config("mas_build") {
if (is_mas_build) {

View File

@@ -24,11 +24,7 @@ template("extract_symbols") {
assert(defined(invoker.binary), "Need binary to dump")
assert(defined(invoker.symbol_dir), "Need directory for symbol output")
if (host_os == "win" && target_cpu == "x86") {
dump_syms_label = "//third_party/breakpad:dump_syms(//build/toolchain/win:win_clang_x64)"
} else {
dump_syms_label = "//third_party/breakpad:dump_syms($host_toolchain)"
}
dump_syms_label = "//third_party/breakpad:dump_syms($host_toolchain)"
dump_syms_binary = get_label_info(dump_syms_label, "root_out_dir") +
"/dump_syms$_host_executable_suffix"

View File

@@ -19,13 +19,17 @@ TEMPLATE_H = """
#define FUSE_EXPORT __attribute__((visibility("default")))
#endif
namespace electron::fuses {
namespace electron {
namespace fuses {
extern const volatile char kFuseWire[];
{getters}
} // namespace electron::fuses
} // namespace fuses
} // namespace electron
#endif // ELECTRON_FUSES_H_
"""
@@ -33,13 +37,17 @@ extern const volatile char kFuseWire[];
TEMPLATE_CC = """
#include "electron/fuses.h"
namespace electron::fuses {
namespace electron {
namespace fuses {
const volatile char kFuseWire[] = { /* sentinel */ {sentinel}, /* fuse_version */ {fuse_version}, /* fuse_wire_length */ {fuse_wire_length}, /* fuse_wire */ {initial_config}};
{getters}
} // namespace electron:fuses
}
}
"""
with open(os.path.join(dir_path, "fuses.json5"), 'r') as f:

View File

@@ -7,6 +7,5 @@
"node_options": "1",
"node_cli_inspect": "1",
"embedded_asar_integrity_validation": "0",
"only_load_app_from_asar": "0",
"load_browser_process_specific_v8_snapshot": "0"
"only_load_app_from_asar": "0"
}

View File

@@ -1,34 +0,0 @@
import os
import re
import sys
DEFINE_EXTRACT_REGEX = re.compile('^ *# *define (\w*)', re.MULTILINE)
def main(outDir, headers):
defines = []
for filename in headers:
with open(filename, 'r') as f:
content = f.read()
defines += read_defines(content)
push_and_undef = ''
for define in defines:
push_and_undef += '#pragma push_macro("%s")\n' % define
push_and_undef += '#undef %s\n' % define
with open(os.path.join(outDir, 'push_and_undef_node_defines.h'), 'w') as o:
o.write(push_and_undef)
pop = ''
for define in defines:
pop += '#pragma pop_macro("%s")\n' % define
with open(os.path.join(outDir, 'pop_node_defines.h'), 'w') as o:
o.write(pop)
def read_defines(content):
defines = []
for match in DEFINE_EXTRACT_REGEX.finditer(content):
defines.append(match.group(1))
return defines
if __name__ == '__main__':
main(sys.argv[1], sys.argv[2:])

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
import os
import subprocess
@@ -8,7 +8,9 @@ TEMPLATE = """
#include "node_native_module.h"
#include "node_internals.h"
namespace node::native_module {{
namespace node {{
namespace native_module {{
{definitions}
@@ -16,7 +18,9 @@ void NativeModuleLoader::LoadEmbedderJavaScriptSource() {{
{initializers}
}}
}} // namespace node::native_module
}} // namespace native_module
}} // namespace node
"""
def main():

View File

@@ -4,7 +4,7 @@
# Cocoa .app bundle. The presence of these empty directories is sufficient to
# convince Cocoa that the application supports the named localization, even if
# an InfoPlist.strings file is not provided. Chrome uses these empty locale
# directories for its helper executable bundles, which do not otherwise
# directoires for its helper executable bundles, which do not otherwise
# require any direct Cocoa locale support.
import os

21
build/node.gni Normal file
View File

@@ -0,0 +1,21 @@
template("node_action") {
assert(defined(invoker.script), "Need script path to run")
assert(defined(invoker.args), "Need script argumets")
action(target_name) {
forward_variables_from(invoker,
[
"deps",
"public_deps",
"sources",
"inputs",
"outputs",
])
if (!defined(inputs)) {
inputs = []
}
inputs += [ invoker.script ]
script = "//electron/build/run-node.py"
args = [ rebase_path(invoker.script) ] + invoker.args
}
}

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
from __future__ import print_function
import os
import subprocess

View File

@@ -1,12 +1,12 @@
template("npm_action") {
assert(defined(invoker.script),
"Need script name to run (must be defined in package.json)")
assert(defined(invoker.args), "Need script arguments")
assert(defined(invoker.args), "Need script argumets")
action("npm_pre_flight_" + target_name) {
inputs = [
"//electron/package.json",
"//electron/yarn.lock",
"package.json",
"yarn.lock",
]
script = "//electron/build/npm-run.py"

View File

@@ -1,12 +1,9 @@
from __future__ import unicode_literals
from __future__ import with_statement
import contextlib
import sys
import os
import optparse
import json
import re
import subprocess
sys.path.append("%s/../../build" % os.path.dirname(os.path.realpath(__file__)))
@@ -36,56 +33,36 @@ def calculate_hash(root):
return CalculateHash('.', None)
def windows_installed_software():
powershell_command = [
"Get-CimInstance",
"-Namespace",
"root\cimv2",
"-Class",
"Win32_product",
"|",
"Select",
"vendor,",
"description,",
"@{l='install_location';e='InstallLocation'},",
"@{l='install_date';e='InstallDate'},",
"@{l='install_date_2';e='InstallDate2'},",
"caption,",
"version,",
"name,",
"@{l='sku_number';e='SKUNumber'}",
"|",
"ConvertTo-Json",
]
import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer, "root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_Product")
items = []
proc = subprocess.Popen(
["powershell.exe", "-Command", "-"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
)
for objItem in colItems:
item = {}
if objItem.Caption:
item['caption'] = objItem.Caption
if objItem.Caption:
item['description'] = objItem.Description
if objItem.InstallDate:
item['install_date'] = objItem.InstallDate
if objItem.InstallDate2:
item['install_date_2'] = objItem.InstallDate2
if objItem.InstallLocation:
item['install_location'] = objItem.InstallLocation
if objItem.Name:
item['name'] = objItem.Name
if objItem.SKUNumber:
item['sku_number'] = objItem.SKUNumber
if objItem.Vendor:
item['vendor'] = objItem.Vendor
if objItem.Version:
item['version'] = objItem.Version
items.append(item)
stdout, _ = proc.communicate(" ".join(powershell_command).encode("utf-8"))
if proc.returncode != 0:
raise RuntimeError("Failed to get list of installed software")
# On AppVeyor there's other output related to PSReadline,
# so grab only the JSON output and ignore everything else
json_match = re.match(
r".*(\[.*{.*}.*\]).*", stdout.decode("utf-8"), re.DOTALL
)
if not json_match:
raise RuntimeError(
"Couldn't find JSON output for list of installed software"
)
# Filter out missing keys
return list(
map(
lambda info: {k: info[k] for k in info if info[k]},
json.loads(json_match.group(1)),
)
)
return items
def windows_profile():
@@ -112,7 +89,7 @@ def windows_profile():
def main(options):
if sys.platform == 'win32':
with open(options.output_json, 'w') as f:
with open(options.output_json, 'wb') as f:
json.dump(windows_profile(), f)
else:
raise OSError("Unsupported OS")

View File

@@ -51,7 +51,7 @@ template("compile_ib_files") {
# Template to compile and package Mac XIB files as bundle data.
# Arguments
# sources:
# list of string, sources to compile
# list of string, sources to comiple
# output_path:
# (optional) string, the path to use for the outputs list in the
# bundle_data step. If unspecified, defaults to bundle_resources_dir.

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
import os
import subprocess
import sys

View File

@@ -1 +0,0 @@
$full_version

View File

@@ -36,7 +36,7 @@ template("webpack_build") {
rebase_path("$target_gen_dir/buildflags/buildflags.h"),
"--env.mode=" + mode,
]
deps += [ "//electron/buildflags" ]
deps += [ "buildflags" ]
outputs = [ invoker.out_file ]
}

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
from __future__ import print_function
import os
import subprocess

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
from __future__ import print_function
import os
import subprocess

View File

@@ -19,6 +19,7 @@ buildflag_header("buildflags") {
"ENABLE_ELECTRON_EXTENSIONS=$enable_electron_extensions",
"ENABLE_BUILTIN_SPELLCHECKER=$enable_builtin_spellchecker",
"ENABLE_PICTURE_IN_PICTURE=$enable_picture_in_picture",
"ENABLE_WIN_DARK_MODE_WINDOW_UI=$enable_win_dark_mode_window_ui",
"OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider",
]
}

View File

@@ -31,4 +31,7 @@ declare_args() {
# Enable Spellchecker support
enable_builtin_spellchecker = true
# Undocumented Windows dark mode API
enable_win_dark_mode_window_ui = false
}

View File

@@ -6,7 +6,6 @@ import("//build/config/ozone.gni")
import("//build/config/ui.gni")
import("//components/spellcheck/spellcheck_build_features.gni")
import("//electron/buildflags/buildflags.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni")
import("//third_party/widevine/cdm/widevine.gni")
@@ -16,10 +15,6 @@ static_library("chrome") {
sources = [
"//chrome/browser/accessibility/accessibility_ui.cc",
"//chrome/browser/accessibility/accessibility_ui.h",
"//chrome/browser/app_mode/app_mode_utils.cc",
"//chrome/browser/app_mode/app_mode_utils.h",
"//chrome/browser/browser_features.cc",
"//chrome/browser/browser_features.h",
"//chrome/browser/browser_process.cc",
"//chrome/browser/browser_process.h",
"//chrome/browser/devtools/devtools_contents_resizing_strategy.cc",
@@ -30,7 +25,6 @@ static_library("chrome") {
"//chrome/browser/devtools/devtools_eye_dropper.h",
"//chrome/browser/devtools/devtools_file_system_indexer.cc",
"//chrome/browser/devtools/devtools_file_system_indexer.h",
"//chrome/browser/devtools/devtools_settings.h",
"//chrome/browser/extensions/global_shortcut_listener.cc",
"//chrome/browser/extensions/global_shortcut_listener.h",
"//chrome/browser/icon_loader.cc",
@@ -53,36 +47,8 @@ static_library("chrome") {
"//chrome/browser/predictors/proxy_lookup_client_impl.h",
"//chrome/browser/predictors/resolve_host_client_impl.cc",
"//chrome/browser/predictors/resolve_host_client_impl.h",
"//chrome/browser/process_singleton.h",
"//chrome/browser/process_singleton_internal.cc",
"//chrome/browser/process_singleton_internal.h",
"//chrome/browser/themes/browser_theme_pack.cc",
"//chrome/browser/themes/browser_theme_pack.h",
"//chrome/browser/themes/custom_theme_supplier.cc",
"//chrome/browser/themes/custom_theme_supplier.h",
"//chrome/browser/themes/theme_properties.cc",
"//chrome/browser/themes/theme_properties.h",
"//chrome/browser/ui/color/chrome_color_mixers.cc",
"//chrome/browser/ui/color/chrome_color_mixers.h",
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.cc",
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h",
"//chrome/browser/ui/exclusive_access/exclusive_access_controller_base.cc",
"//chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h",
"//chrome/browser/ui/exclusive_access/exclusive_access_manager.cc",
"//chrome/browser/ui/exclusive_access/exclusive_access_manager.h",
"//chrome/browser/ui/exclusive_access/fullscreen_controller.cc",
"//chrome/browser/ui/exclusive_access/fullscreen_controller.h",
"//chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.cc",
"//chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.h",
"//chrome/browser/ui/exclusive_access/keyboard_lock_controller.cc",
"//chrome/browser/ui/exclusive_access/keyboard_lock_controller.h",
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.cc",
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.h",
"//chrome/browser/ui/frame/window_frame_util.cc",
"//chrome/browser/ui/frame/window_frame_util.h",
"//chrome/browser/ui/native_window_tracker.h",
"//chrome/browser/ui/ui_features.cc",
"//chrome/browser/ui/ui_features.h",
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.cc",
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.cc",
@@ -91,10 +57,6 @@ static_library("chrome") {
"//extensions/browser/app_window/size_constraints.h",
]
if (is_posix) {
sources += [ "//chrome/browser/process_singleton_posix.cc" ]
}
if (is_mac) {
sources += [
"//chrome/browser/extensions/global_shortcut_listener_mac.h",
@@ -102,11 +64,7 @@ static_library("chrome") {
"//chrome/browser/icon_loader_mac.mm",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
"//chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm",
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
"//chrome/browser/platform_util_mac.mm",
"//chrome/browser/process_singleton_mac.mm",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
]
@@ -118,13 +76,10 @@ static_library("chrome") {
"//chrome/browser/extensions/global_shortcut_listener_win.h",
"//chrome/browser/icon_loader_win.cc",
"//chrome/browser/media/webrtc/window_icon_util_win.cc",
"//chrome/browser/process_singleton_win.cc",
"//chrome/browser/ui/frame/window_frame_util.h",
"//chrome/browser/ui/view_ids.h",
"//chrome/browser/win/chrome_process_finder.cc",
"//chrome/browser/win/chrome_process_finder.h",
"//chrome/browser/win/titlebar_config.cc",
"//chrome/browser/win/titlebar_config.h",
"//chrome/browser/win/titlebar_config.h",
"//chrome/child/v8_crashpad_support_win.cc",
"//chrome/child/v8_crashpad_support_win.h",
@@ -132,35 +87,49 @@ static_library("chrome") {
}
if (is_linux) {
sources += [ "//chrome/browser/media/webrtc/window_icon_util_ozone.cc" ]
sources += [ "//chrome/browser/media/webrtc/window_icon_util_linux.cc" ]
}
if (use_aura) {
sources += [
"//chrome/browser/platform_util_aura.cc",
"//chrome/browser/ui/aura/native_window_tracker_aura.cc",
"//chrome/browser/ui/aura/native_window_tracker_aura.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_aura.cc",
]
}
public_deps = [
"//chrome/browser:dev_ui_browser_resources",
"//chrome/browser/ui/color:mixers",
"//chrome/common",
"//chrome/common:version_header",
"//components/keyed_service/content",
"//components/paint_preview/buildflags",
"//components/proxy_config",
"//components/services/language_detection/public/mojom",
"//content/public/browser",
"//services/strings",
]
deps = [ "//chrome/browser:resource_prefetch_predictor_proto" ]
deps = [
"//chrome/browser:resource_prefetch_predictor_proto",
"//chrome/services/speech:buildflags",
"//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) {
sources +=
[ "//chrome/browser/extensions/global_shortcut_listener_linux.cc" ]
}
if (use_x11) {
sources += [
"//chrome/browser/extensions/global_shortcut_listener_x11.cc",
"//chrome/browser/extensions/global_shortcut_listener_x11.h",
]
}
if (use_ozone) {
deps += [ "//ui/ozone" ]
sources += [
@@ -190,7 +159,6 @@ static_library("chrome") {
if (enable_desktop_capturer) {
sources += [
"//chrome/browser/media/webrtc/desktop_media_list.cc",
"//chrome/browser/media/webrtc/desktop_media_list.h",
"//chrome/browser/media/webrtc/desktop_media_list_base.cc",
"//chrome/browser/media/webrtc/desktop_media_list_base.h",
@@ -214,35 +182,20 @@ static_library("chrome") {
if (enable_basic_printing) {
sources += [
"//chrome/browser/bad_message.cc",
"//chrome/browser/bad_message.h",
"//chrome/browser/printing/print_job.cc",
"//chrome/browser/printing/print_job.h",
"//chrome/browser/printing/print_job_manager.cc",
"//chrome/browser/printing/print_job_manager.h",
"//chrome/browser/printing/print_job_worker.cc",
"//chrome/browser/printing/print_job_worker.h",
"//chrome/browser/printing/print_job_worker_oop.cc",
"//chrome/browser/printing/print_job_worker_oop.h",
"//chrome/browser/printing/print_view_manager_base.cc",
"//chrome/browser/printing/print_view_manager_base.h",
"//chrome/browser/printing/printer_query.cc",
"//chrome/browser/printing/printer_query.h",
"//chrome/browser/printing/printing_service.cc",
"//chrome/browser/printing/printing_service.h",
"//components/printing/browser/print_to_pdf/pdf_print_job.cc",
"//components/printing/browser/print_to_pdf/pdf_print_job.h",
"//components/printing/browser/print_to_pdf/pdf_print_utils.cc",
"//components/printing/browser/print_to_pdf/pdf_print_utils.h",
]
if (enable_oop_printing) {
sources += [
"//chrome/browser/printing/print_backend_service_manager.cc",
"//chrome/browser/printing/print_backend_service_manager.h",
]
}
public_deps += [
"//chrome/services/printing:lib",
"//components/printing/browser",
@@ -250,7 +203,6 @@ static_library("chrome") {
"//components/services/print_compositor",
"//components/services/print_compositor/public/cpp",
"//components/services/print_compositor/public/mojom",
"//printing/backend",
]
deps += [
@@ -262,6 +214,8 @@ static_library("chrome") {
sources += [
"//chrome/browser/printing/pdf_to_emf_converter.cc",
"//chrome/browser/printing/pdf_to_emf_converter.h",
"//chrome/utility/printing_handler.cc",
"//chrome/utility/printing_handler.h",
]
}
}
@@ -276,12 +230,8 @@ static_library("chrome") {
"//chrome/browser/ui/views/overlay/close_image_button.cc",
"//chrome/browser/ui/views/overlay/close_image_button.h",
"//chrome/browser/ui/views/overlay/constants.h",
"//chrome/browser/ui/views/overlay/document_overlay_window_views.cc",
"//chrome/browser/ui/views/overlay/document_overlay_window_views.h",
"//chrome/browser/ui/views/overlay/hang_up_button.cc",
"//chrome/browser/ui/views/overlay/hang_up_button.h",
"//chrome/browser/ui/views/overlay/overlay_window_image_button.cc",
"//chrome/browser/ui/views/overlay/overlay_window_image_button.h",
"//chrome/browser/ui/views/overlay/overlay_window_views.cc",
"//chrome/browser/ui/views/overlay/overlay_window_views.h",
"//chrome/browser/ui/views/overlay/playback_image_button.cc",
@@ -296,14 +246,11 @@ static_library("chrome") {
"//chrome/browser/ui/views/overlay/toggle_microphone_button.h",
"//chrome/browser/ui/views/overlay/track_image_button.cc",
"//chrome/browser/ui/views/overlay/track_image_button.h",
"//chrome/browser/ui/views/overlay/video_overlay_window_views.cc",
"//chrome/browser/ui/views/overlay/video_overlay_window_views.h",
]
deps += [
"//chrome/app/vector_icons",
"//components/vector_icons:vector_icons",
"//ui/views/controls/webview",
]
}
@@ -321,18 +268,10 @@ static_library("chrome") {
if (enable_pdf_viewer) {
sources += [
"//chrome/browser/pdf/chrome_pdf_stream_delegate.cc",
"//chrome/browser/pdf/chrome_pdf_stream_delegate.h",
"//chrome/browser/pdf/pdf_extension_util.cc",
"//chrome/browser/pdf/pdf_extension_util.h",
"//chrome/browser/pdf/pdf_frame_util.cc",
"//chrome/browser/pdf/pdf_frame_util.h",
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.cc",
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.h",
]
deps += [
"//components/pdf/browser",
"//components/pdf/renderer",
"//chrome/renderer/pepper/chrome_pdf_print_client.cc",
"//chrome/renderer/pepper/chrome_pdf_print_client.h",
]
}
}
@@ -361,32 +300,37 @@ source_set("plugins") {
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
]
deps += [
"//media:media_buildflags",
"//ppapi/buildflags",
"//ppapi/proxy:ipc",
"//services/device/public/mojom",
]
if (enable_pdf_viewer) {
deps += [ "//components/pdf/browser" ]
}
# renderer side
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) {
deps += [ "//components/pdf/renderer" ]
}
deps += [
"//components/strings",
"//media:media_buildflags",
"//services/device/public/mojom",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/proxy:ipc",
"//ppapi/shared_impl",
"//skia",
"//storage/browser",
]
if (enable_ppapi) {
deps += [
"//ppapi/buildflags",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/proxy:ipc",
"//ppapi/shared_impl",
]
}
}
# This source set is just so we don't have to depend on all of //chrome/browser
@@ -408,19 +352,14 @@ source_set("chrome_spellchecker") {
"//chrome/browser/spellchecker/spellcheck_factory.h",
"//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc",
"//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h",
"//chrome/browser/spellchecker/spellcheck_language_blocklist_policy_handler.cc",
"//chrome/browser/spellchecker/spellcheck_language_blocklist_policy_handler.h",
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.cc",
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.h",
"//chrome/browser/spellchecker/spellcheck_service.cc",
"//chrome/browser/spellchecker/spellcheck_service.h",
]
if (!is_mac) {
sources += [
"//chrome/browser/spellchecker/spellcheck_language_blocklist_policy_handler.cc",
"//chrome/browser/spellchecker/spellcheck_language_blocklist_policy_handler.h",
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.cc",
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.h",
]
}
if (has_spellcheck_panel) {
sources += [
"//chrome/browser/spellchecker/spell_check_panel_host_impl.cc",

View File

@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "shell/browser/certificate_manager_model.h"
#include "chrome/browser/certificate_manager_model.h"
#include <utility>
#include "base/bind.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
@@ -71,8 +72,8 @@ net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext(
void CertificateManagerModel::Create(content::BrowserContext* browser_context,
CreationCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::GetIOThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(&CertificateManagerModel::GetCertDBOnIOThread,
base::PostTask(FROM_HERE, {BrowserThread::IO},
base::BindOnce(&CertificateManagerModel::GetCertDBOnIOThread,
browser_context->GetResourceContext(),
std::move(callback)));
}
@@ -144,8 +145,8 @@ void CertificateManagerModel::DidGetCertDBOnIOThread(
DCHECK_CURRENTLY_ON(BrowserThread::IO);
bool is_user_db_available = !!cert_db->GetPublicSlot();
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE,
base::PostTask(
FROM_HERE, {BrowserThread::UI},
base::BindOnce(&CertificateManagerModel::DidGetCertDBOnUIThread, cert_db,
is_user_db_available, std::move(callback)));
}

View File

@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_BROWSER_CERTIFICATE_MANAGER_MODEL_H_
#define ELECTRON_SHELL_BROWSER_CERTIFICATE_MANAGER_MODEL_H_
#ifndef CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_
#define CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_
#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "net/cert/nss_cert_database.h"
@@ -30,10 +31,6 @@ class CertificateManagerModel {
static void Create(content::BrowserContext* browser_context,
CreationCallback callback);
// disable copy
CertificateManagerModel(const CertificateManagerModel&) = delete;
CertificateManagerModel& operator=(const CertificateManagerModel&) = delete;
~CertificateManagerModel();
bool is_user_db_available() const { return is_user_db_available_; }
@@ -111,6 +108,8 @@ class CertificateManagerModel {
// Whether the certificate database has a public slot associated with the
// profile. If not set, importing certificates is not allowed with this model.
bool is_user_db_available_;
DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel);
};
#endif // ELECTRON_SHELL_BROWSER_CERTIFICATE_MANAGER_MODEL_H_
#endif // CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_

View File

@@ -0,0 +1,185 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_PROCESS_SINGLETON_H_
#define CHROME_BROWSER_PROCESS_SINGLETON_H_
#if defined(OS_WIN)
#include <windows.h>
#endif // defined(OS_WIN)
#include "base/callback.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/process/process.h"
#include "base/sequence_checker.h"
#include "ui/gfx/native_widget_types.h"
#if defined(OS_POSIX) && !defined(OS_ANDROID)
#include "base/files/scoped_temp_dir.h"
#endif
#if defined(OS_WIN)
#include "base/win/message_window.h"
#endif // defined(OS_WIN)
namespace base {
class CommandLine;
}
// ProcessSingleton ----------------------------------------------------------
//
// This class allows different browser processes to communicate with
// each other. It is named according to the user data directory, so
// we can be sure that no more than one copy of the application can be
// running at once with a given data directory.
//
// Implementation notes:
// - the Windows implementation uses an invisible global message window;
// - the Linux implementation uses a Unix domain socket in the user data dir.
class ProcessSingleton {
public:
enum NotifyResult {
PROCESS_NONE,
PROCESS_NOTIFIED,
PROFILE_IN_USE,
LOCK_ERROR,
};
// Implement this callback to handle notifications from other processes. The
// callback will receive the command line and directory with which the other
// Chrome process was launched. Return true if the command line will be
// handled within the current browser instance or false if the remote process
// should handle it (i.e., because the current process is shutting down).
using NotificationCallback = base::RepeatingCallback<bool(
const base::CommandLine::StringVector& command_line,
const base::FilePath& current_directory)>;
ProcessSingleton(const base::FilePath& user_data_dir,
const NotificationCallback& notification_callback);
~ProcessSingleton();
// Notify another process, if available. Otherwise sets ourselves as the
// singleton instance. Returns PROCESS_NONE if we became the singleton
// instance. Callers are guaranteed to either have notified an existing
// process or have grabbed the singleton (unless the profile is locked by an
// unreachable process).
// TODO(brettw): Make the implementation of this method non-platform-specific
// by making Linux re-use the Windows implementation.
NotifyResult NotifyOtherProcessOrCreate();
void StartListeningOnSocket();
void OnBrowserReady();
// Sets ourself up as the singleton instance. Returns true on success. If
// false is returned, we are not the singleton instance and the caller must
// exit.
// NOTE: Most callers should generally prefer NotifyOtherProcessOrCreate() to
// this method, only callers for whom failure is preferred to notifying
// another process should call this directly.
bool Create();
// Clear any lock state during shutdown.
void Cleanup();
#if defined(OS_POSIX) && !defined(OS_ANDROID)
static void DisablePromptForTesting();
#endif
#if defined(OS_WIN)
// Called to query whether to kill a hung browser process that has visible
// windows. Return true to allow killing the hung process.
using ShouldKillRemoteProcessCallback = base::RepeatingCallback<bool()>;
void OverrideShouldKillRemoteProcessCallbackForTesting(
const ShouldKillRemoteProcessCallback& display_dialog_callback);
#endif
protected:
// Notify another process, if available.
// Returns true if another process was found and notified, false if we should
// continue with the current process.
// On Windows, Create() has to be called before this.
NotifyResult NotifyOtherProcess();
#if defined(OS_POSIX) && !defined(OS_ANDROID)
// Exposed for testing. We use a timeout on Linux, and in tests we want
// this timeout to be short.
NotifyResult NotifyOtherProcessWithTimeout(
const base::CommandLine& command_line,
int retry_attempts,
const base::TimeDelta& timeout,
bool kill_unresponsive);
NotifyResult NotifyOtherProcessWithTimeoutOrCreate(
const base::CommandLine& command_line,
int retry_attempts,
const base::TimeDelta& timeout);
void OverrideCurrentPidForTesting(base::ProcessId pid);
void OverrideKillCallbackForTesting(
const base::RepeatingCallback<void(int)>& callback);
#endif
private:
NotificationCallback notification_callback_; // Handler for notifications.
#if defined(OS_WIN)
HWND remote_window_ = nullptr; // The HWND_MESSAGE of another browser.
base::win::MessageWindow window_; // The message-only window.
bool is_virtualized_ =
false; // Stuck inside Microsoft Softricity VM environment.
HANDLE lock_file_ = INVALID_HANDLE_VALUE;
base::FilePath user_data_dir_;
ShouldKillRemoteProcessCallback should_kill_remote_process_callback_;
#elif defined(OS_POSIX) && !defined(OS_ANDROID)
// Start listening to the socket.
void StartListening(int sock);
// Return true if the given pid is one of our child processes.
// Assumes that the current pid is the root of all pids of the current
// instance.
bool IsSameChromeInstance(pid_t pid);
// Extract the process's pid from a symbol link path and if it is on
// the same host, kill the process, unlink the lock file and return true.
// If the process is part of the same chrome instance, unlink the lock file
// and return true without killing it.
// If the process is on a different host, return false.
bool KillProcessByLockPath();
// Default function to kill a process, overridable by tests.
void KillProcess(int pid);
// Allow overriding for tests.
base::ProcessId current_pid_;
// Function to call when the other process is hung and needs to be killed.
// Allows overriding for tests.
base::RepeatingCallback<void(int)> kill_callback_;
// Path in file system to the socket.
base::FilePath socket_path_;
// Path in file system to the lock.
base::FilePath lock_path_;
// Path in file system to the cookie file.
base::FilePath cookie_path_;
// Temporary directory to hold the socket.
base::ScopedTempDir socket_dir_;
// Helper class for linux specific messages. LinuxWatcher is ref counted
// because it posts messages between threads.
class LinuxWatcher;
scoped_refptr<LinuxWatcher> watcher_;
int sock_ = -1;
bool listen_on_ready_ = false;
#endif
SEQUENCE_CHECKER(sequence_checker_);
DISALLOW_COPY_AND_ASSIGN(ProcessSingleton);
};
#endif // CHROME_BROWSER_PROCESS_SINGLETON_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,315 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/process_singleton.h"
#include <windows.h>
#include <shellapi.h>
#include "base/base_paths.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/process/process.h"
#include "base/process/process_info.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "chrome/browser/win/chrome_process_finder.h"
#include "content/public/common/result_codes.h"
#include "net/base/escape.h"
#include "ui/gfx/win/hwnd_util.h"
namespace {
const char kLockfile[] = "lockfile";
// A helper class that acquires the given |mutex| while the AutoLockMutex is in
// scope.
class AutoLockMutex {
public:
explicit AutoLockMutex(HANDLE mutex) : mutex_(mutex) {
DWORD result = ::WaitForSingleObject(mutex_, INFINITE);
DPCHECK(result == WAIT_OBJECT_0) << "Result = " << result;
}
~AutoLockMutex() {
BOOL released = ::ReleaseMutex(mutex_);
DPCHECK(released);
}
private:
HANDLE mutex_;
DISALLOW_COPY_AND_ASSIGN(AutoLockMutex);
};
// A helper class that releases the given |mutex| while the AutoUnlockMutex is
// in scope and immediately re-acquires it when going out of scope.
class AutoUnlockMutex {
public:
explicit AutoUnlockMutex(HANDLE mutex) : mutex_(mutex) {
BOOL released = ::ReleaseMutex(mutex_);
DPCHECK(released);
}
~AutoUnlockMutex() {
DWORD result = ::WaitForSingleObject(mutex_, INFINITE);
DPCHECK(result == WAIT_OBJECT_0) << "Result = " << result;
}
private:
HANDLE mutex_;
DISALLOW_COPY_AND_ASSIGN(AutoUnlockMutex);
};
// Checks the visibility of the enumerated window and signals once a visible
// window has been found.
BOOL CALLBACK BrowserWindowEnumeration(HWND window, LPARAM param) {
bool* result = reinterpret_cast<bool*>(param);
*result = ::IsWindowVisible(window) != 0;
// Stops enumeration if a visible window has been found.
return !*result;
}
bool ParseCommandLine(const COPYDATASTRUCT* cds,
base::CommandLine::StringVector* parsed_command_line,
base::FilePath* current_directory) {
// We should have enough room for the shortest command (min_message_size)
// and also be a multiple of wchar_t bytes. The shortest command
// possible is L"START\0\0" (empty current directory and command line).
static const int min_message_size = 7;
if (cds->cbData < min_message_size * sizeof(wchar_t) ||
cds->cbData % sizeof(wchar_t) != 0) {
LOG(WARNING) << "Invalid WM_COPYDATA, length = " << cds->cbData;
return false;
}
// We split the string into 4 parts on NULLs.
DCHECK(cds->lpData);
const std::wstring msg(static_cast<wchar_t*>(cds->lpData),
cds->cbData / sizeof(wchar_t));
const std::wstring::size_type first_null = msg.find_first_of(L'\0');
if (first_null == 0 || first_null == std::wstring::npos) {
// no NULL byte, don't know what to do
LOG(WARNING) << "Invalid WM_COPYDATA, length = " << msg.length()
<< ", first null = " << first_null;
return false;
}
// Decode the command, which is everything until the first NULL.
if (msg.substr(0, first_null) == L"START") {
// Another instance is starting parse the command line & do what it would
// have done.
VLOG(1) << "Handling STARTUP request from another process";
const std::wstring::size_type second_null =
msg.find_first_of(L'\0', first_null + 1);
if (second_null == std::wstring::npos || first_null == msg.length() - 1 ||
second_null == msg.length()) {
LOG(WARNING) << "Invalid format for start command, we need a string in 4 "
"parts separated by NULLs";
return false;
}
// Get current directory.
*current_directory =
base::FilePath(msg.substr(first_null + 1, second_null - first_null));
const std::wstring::size_type third_null =
msg.find_first_of(L'\0', second_null + 1);
if (third_null == std::wstring::npos || third_null == msg.length()) {
LOG(WARNING) << "Invalid format for start command, we need a string in 4 "
"parts separated by NULLs";
}
// Get command line.
const std::wstring cmd_line =
msg.substr(second_null + 1, third_null - second_null);
*parsed_command_line = base::CommandLine::FromString(cmd_line).argv();
return true;
}
return false;
}
bool ProcessLaunchNotification(
const ProcessSingleton::NotificationCallback& notification_callback,
UINT message,
WPARAM wparam,
LPARAM lparam,
LRESULT* result) {
if (message != WM_COPYDATA)
return false;
// Handle the WM_COPYDATA message from another process.
const COPYDATASTRUCT* cds = reinterpret_cast<COPYDATASTRUCT*>(lparam);
base::CommandLine::StringVector parsed_command_line;
base::FilePath current_directory;
if (!ParseCommandLine(cds, &parsed_command_line, &current_directory)) {
*result = TRUE;
return true;
}
*result = notification_callback.Run(parsed_command_line, current_directory)
? TRUE
: FALSE;
return true;
}
bool TerminateAppWithError() {
// TODO: This is called when the secondary process can't ping the primary
// process. Need to find out what to do here.
return false;
}
} // namespace
ProcessSingleton::ProcessSingleton(
const base::FilePath& user_data_dir,
const NotificationCallback& notification_callback)
: notification_callback_(notification_callback),
user_data_dir_(user_data_dir),
should_kill_remote_process_callback_(
base::BindRepeating(&TerminateAppWithError)) {
// The user_data_dir may have not been created yet.
base::CreateDirectoryAndGetError(user_data_dir, nullptr);
}
ProcessSingleton::~ProcessSingleton() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (lock_file_ != INVALID_HANDLE_VALUE)
::CloseHandle(lock_file_);
}
// Code roughly based on Mozilla.
ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
if (is_virtualized_)
return PROCESS_NOTIFIED; // We already spawned the process in this case.
if (lock_file_ == INVALID_HANDLE_VALUE && !remote_window_) {
return LOCK_ERROR;
} else if (!remote_window_) {
return PROCESS_NONE;
}
switch (chrome::AttemptToNotifyRunningChrome(remote_window_)) {
case chrome::NOTIFY_SUCCESS:
return PROCESS_NOTIFIED;
case chrome::NOTIFY_FAILED:
remote_window_ = NULL;
return PROCESS_NONE;
case chrome::NOTIFY_WINDOW_HUNG:
// Fall through and potentially terminate the hung browser.
break;
}
DWORD process_id = 0;
DWORD thread_id = ::GetWindowThreadProcessId(remote_window_, &process_id);
if (!thread_id || !process_id) {
remote_window_ = NULL;
return PROCESS_NONE;
}
base::Process process = base::Process::Open(process_id);
// The window is hung. Scan for every window to find a visible one.
bool visible_window = false;
::EnumThreadWindows(thread_id, &BrowserWindowEnumeration,
reinterpret_cast<LPARAM>(&visible_window));
// If there is a visible browser window, ask the user before killing it.
if (visible_window && !should_kill_remote_process_callback_.Run()) {
// The user denied. Quit silently.
return PROCESS_NOTIFIED;
}
// Time to take action. Kill the browser process.
process.Terminate(content::RESULT_CODE_HUNG, true);
remote_window_ = NULL;
return PROCESS_NONE;
}
ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessOrCreate() {
ProcessSingleton::NotifyResult result = PROCESS_NONE;
if (!Create()) {
result = NotifyOtherProcess();
if (result == PROCESS_NONE)
result = PROFILE_IN_USE;
}
return result;
}
void ProcessSingleton::StartListeningOnSocket() {}
void ProcessSingleton::OnBrowserReady() {}
// Look for a Chrome instance that uses the same profile directory. If there
// isn't one, create a message window with its title set to the profile
// directory path.
bool ProcessSingleton::Create() {
static const wchar_t kMutexName[] = L"Local\\AtomProcessSingletonStartup!";
remote_window_ = chrome::FindRunningChromeWindow(user_data_dir_);
if (!remote_window_) {
// Make sure we will be the one and only process creating the window.
// We use a named Mutex since we are protecting against multi-process
// access. As documented, it's clearer to NOT request ownership on creation
// since it isn't guaranteed we will get it. It is better to create it
// without ownership and explicitly get the ownership afterward.
base::win::ScopedHandle only_me(::CreateMutex(NULL, FALSE, kMutexName));
if (!only_me.IsValid()) {
DPLOG(FATAL) << "CreateMutex failed";
return false;
}
AutoLockMutex auto_lock_only_me(only_me.Get());
// We now own the mutex so we are the only process that can create the
// window at this time, but we must still check if someone created it
// between the time where we looked for it above and the time the mutex
// was given to us.
remote_window_ = chrome::FindRunningChromeWindow(user_data_dir_);
if (!remote_window_) {
// We have to make sure there is no Chrome instance running on another
// machine that uses the same profile.
base::FilePath lock_file_path = user_data_dir_.AppendASCII(kLockfile);
lock_file_ =
::CreateFile(lock_file_path.value().c_str(), GENERIC_WRITE,
FILE_SHARE_READ, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL);
DWORD error = ::GetLastError();
LOG_IF(WARNING, lock_file_ != INVALID_HANDLE_VALUE &&
error == ERROR_ALREADY_EXISTS)
<< "Lock file exists but is writable.";
LOG_IF(ERROR, lock_file_ == INVALID_HANDLE_VALUE)
<< "Lock file can not be created! Error code: " << error;
if (lock_file_ != INVALID_HANDLE_VALUE) {
// Set the window's title to the path of our user data directory so
// other Chrome instances can decide if they should forward to us.
bool result =
window_.CreateNamed(base::BindRepeating(&ProcessLaunchNotification,
notification_callback_),
user_data_dir_.value());
// NB: Ensure that if the primary app gets started as elevated
// admin inadvertently, secondary windows running not as elevated
// will still be able to send messages
::ChangeWindowMessageFilterEx(window_.hwnd(), WM_COPYDATA, MSGFLT_ALLOW,
NULL);
CHECK(result && window_.hwnd());
}
}
}
return window_.hwnd() != NULL;
}
void ProcessSingleton::Cleanup() {}
void ProcessSingleton::OverrideShouldKillRemoteProcessCallbackForTesting(
const ShouldKillRemoteProcessCallback& display_dialog_callback) {
should_kill_remote_process_callback_ = display_dialog_callback;
}

View File

@@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "shell/browser/ui/views/global_menu_bar_registrar_x11.h"
#include <string>
#include "chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h"
#include "base/bind.h"
#include "base/debug/leak_annotations.h"
@@ -51,7 +49,7 @@ GlobalMenuBarRegistrarX11::GlobalMenuBarRegistrarX11() {
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START),
nullptr, kAppMenuRegistrarName, kAppMenuRegistrarPath,
kAppMenuRegistrarName,
nullptr, // Probably want a real cancelable.
nullptr, // TODO: Probalby want a real cancelable.
static_cast<GAsyncReadyCallback>(OnProxyCreatedThunk), this);
}

View File

@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_BROWSER_UI_VIEWS_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
#define ELECTRON_SHELL_BROWSER_UI_VIEWS_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
#define CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
#include <gio/gio.h>
@@ -33,11 +33,6 @@ class GlobalMenuBarRegistrarX11 {
GlobalMenuBarRegistrarX11();
~GlobalMenuBarRegistrarX11();
// disable copy
GlobalMenuBarRegistrarX11(const GlobalMenuBarRegistrarX11&) = delete;
GlobalMenuBarRegistrarX11& operator=(const GlobalMenuBarRegistrarX11&) =
delete;
// Sends the actual message.
void RegisterXWindow(x11::Window window);
void UnregisterXWindow(x11::Window window);
@@ -58,6 +53,8 @@ class GlobalMenuBarRegistrarX11 {
// x11::Window which want to be registered, but haven't yet been because
// we're waiting for the proxy to become available.
std::set<x11::Window> live_windows_;
DISALLOW_COPY_AND_ASSIGN(GlobalMenuBarRegistrarX11);
};
#endif // ELECTRON_SHELL_BROWSER_UI_VIEWS_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_REGISTRAR_X11_H_

View File

@@ -1,5 +1,4 @@
import { shell } from 'electron/common';
import { app, dialog, BrowserWindow, ipcMain } from 'electron/main';
import { app, dialog, BrowserWindow, shell, ipcMain } from 'electron';
import * as path from 'path';
import * as url from 'url';
@@ -66,9 +65,9 @@ async function createWindow (backgroundColor?: string) {
mainWindow = new BrowserWindow(options);
mainWindow.on('ready-to-show', () => mainWindow!.show());
mainWindow.webContents.setWindowOpenHandler(details => {
shell.openExternal(decorateURL(details.url));
return { action: 'deny' };
mainWindow.webContents.on('new-window', (event, url) => {
event.preventDefault();
shell.openExternal(decorateURL(url));
});
mainWindow.webContents.session.setPermissionRequestHandler((webContents, permission, done) => {

View File

@@ -1,4 +1,4 @@
import * as electron from 'electron/main';
import * as electron from 'electron';
import * as fs from 'fs';
import * as path from 'path';
@@ -83,7 +83,7 @@ function loadApplicationPackage (packagePath: string) {
});
try {
// Override app's package.json data.
// Override app name and version.
packagePath = path.resolve(packagePath);
const packageJsonPath = path.join(packagePath, 'package.json');
let appPath;
@@ -92,7 +92,7 @@ function loadApplicationPackage (packagePath: string) {
try {
packageJson = require(packageJsonPath);
} catch (e) {
showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${(e as Error).message}`);
showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${e.message}`);
return;
}
@@ -104,16 +104,6 @@ function loadApplicationPackage (packagePath: string) {
} else if (packageJson.name) {
app.name = packageJson.name;
}
if (packageJson.desktopName) {
app.setDesktopName(packageJson.desktopName);
} else {
app.setDesktopName(`${app.name}.desktop`);
}
// Set v8 flags, deliberately lazy load so that apps that do not use this
// feature do not pay the price
if (packageJson.v8Flags) {
require('v8').setFlagsFromString(packageJson.v8Flags);
}
appPath = packagePath;
}
@@ -121,7 +111,7 @@ function loadApplicationPackage (packagePath: string) {
const filePath = Module._resolveFilename(packagePath, module, true);
app.setAppPath(appPath || path.dirname(filePath));
} catch (e) {
showErrorMessage(`Unable to find Electron app at ${packagePath}\n\n${(e as Error).message}`);
showErrorMessage(`Unable to find Electron app at ${packagePath}\n\n${e.message}`);
return;
}
@@ -129,7 +119,7 @@ function loadApplicationPackage (packagePath: string) {
Module._load(packagePath, module, true);
} catch (e) {
console.error('App threw an error during load');
console.error((e as Error).stack || e);
console.error(e.stack || e);
throw e;
}
}

View File

@@ -1,4 +1,4 @@
import { ipcRenderer, contextBridge } from 'electron/renderer';
import { ipcRenderer, contextBridge } from 'electron';
const policy = window.trustedTypes.createPolicy('electron-default-app', {
// we trust the SVG contents

View File

@@ -64,12 +64,15 @@ an issue:
* [Automated Testing](tutorial/automated-testing.md)
* [REPL](tutorial/repl.md)
* [Distribution](tutorial/application-distribution.md)
* [Supported Platforms](tutorial/support.md#supported-platforms)
* [Code Signing](tutorial/code-signing.md)
* [Mac App Store](tutorial/mac-app-store-submission-guide.md)
* [Windows Store](tutorial/windows-store-guide.md)
* [Snapcraft](tutorial/snapcraft.md)
* [ASAR Archives](tutorial/asar-archives.md)
* [Updates](tutorial/updates.md)
* [Deploying an Update Server](tutorial/updates.md#deploying-an-update-server)
* [Implementing Updates in Your App](tutorial/updates.md#implementing-updates-in-your-app)
* [Applying Updates](tutorial/updates.md#applying-updates)
* [Getting Support](tutorial/support.md)
## Detailed Tutorials
@@ -83,6 +86,7 @@ These individual tutorials expand on topics discussed in the guide above.
* Electron Releases & Developer Feedback
* [Versioning Policy](tutorial/electron-versioning.md)
* [Release Timelines](tutorial/electron-timelines.md)
* [Testing Widevine CDM](tutorial/testing-widevine-cdm.md)
---
@@ -102,6 +106,7 @@ These individual tutorials expand on topics discussed in the guide above.
* [`File` Object](api/file-object.md)
* [`<webview>` Tag](api/webview-tag.md)
* [`window.open` Function](api/window-open.md)
* [`BrowserWindowProxy` Object](api/browser-window-proxy.md)
### Modules for the Main Process:

View File

@@ -2,7 +2,7 @@
> Define keyboard shortcuts.
Accelerators are strings that can contain multiple modifiers and a single key code,
Accelerators are Strings that can contain multiple modifiers and a single key code,
combined by the `+` character, and are used to define keyboard shortcuts
throughout your application.

View File

@@ -103,7 +103,7 @@ to a shutdown/restart of the system or a user logout.
Returns:
* `event` Event
* `path` string
* `path` String
Emitted when the user wants to open a file with the application. The `open-file`
event is usually emitted when the application is already open and the OS wants
@@ -122,7 +122,7 @@ filepath.
Returns:
* `event` Event
* `url` string
* `url` String
Emitted when the user wants to open a URL with the application. Your application's
`Info.plist` file must define the URL scheme within the `CFBundleURLTypes` key, and
@@ -130,17 +130,12 @@ set `NSPrincipalClass` to `AtomApplication`.
You should call `event.preventDefault()` if you want to handle this event.
As with the `open-file` event, be sure to register a listener for the `open-url`
event early in your application startup to detect if the the application being
is being opened to handle a URL. If you register the listener in response to a
`ready` event, you'll miss URLs that trigger the launch of your application.
### Event: 'activate' _macOS_
Returns:
* `event` Event
* `hasVisibleWindows` boolean
* `hasVisibleWindows` Boolean
Emitted when the application is activated. Various actions can trigger
this event, such as launching the application for the first time, attempting
@@ -162,12 +157,12 @@ when Dock icon is clicked or application is re-launched.
Returns:
* `event` Event
* `type` string - A string identifying the activity. Maps to
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` unknown - Contains app-specific state stored by the activity on
another device.
* `details` Object
* `webpageURL` string (optional) - A string identifying the URL of the webpage accessed by the activity on another device, if available.
* `webpageURL` String (optional) - A string identifying the URL of the webpage accessed by the activity on another device, if available.
Emitted during [Handoff][handoff] when an activity from a different device wants
to be resumed. You should call `event.preventDefault()` if you want to handle
@@ -183,7 +178,7 @@ Supported activity types are specified in the app's `Info.plist` under the
Returns:
* `event` Event
* `type` string - A string identifying the activity. Maps to
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
Emitted during [Handoff][handoff] before an activity from a different device wants
@@ -195,9 +190,9 @@ this event.
Returns:
* `event` Event
* `type` string - A string identifying the activity. Maps to
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `error` string - A string with the error's localized description.
* `error` String - A string with the error's localized description.
Emitted during [Handoff][handoff] when an activity from a different device
fails to be resumed.
@@ -207,7 +202,7 @@ fails to be resumed.
Returns:
* `event` Event
* `type` string - A string identifying the activity. Maps to
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` unknown - Contains app-specific state stored by the activity.
@@ -219,7 +214,7 @@ resumed on another one.
Returns:
* `event` Event
* `type` string - A string identifying the activity. Maps to
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` unknown - Contains app-specific state stored by the activity.
@@ -277,12 +272,12 @@ Returns:
* `event` Event
* `webContents` [WebContents](web-contents.md)
* `url` string
* `error` string - The error code
* `url` String
* `error` String - The error code
* `certificate` [Certificate](structures/certificate.md)
* `callback` Function
* `isTrusted` boolean - Whether to consider the certificate as trusted
* `isMainFrame` boolean
* `isTrusted` Boolean - Whether to consider the certificate as trusted
* `isMainFrame` Boolean
Emitted when failed to verify the `certificate` for `url`, to trust the
certificate you should prevent the default behavior with
@@ -338,14 +333,14 @@ Returns:
* `authenticationResponseDetails` Object
* `url` URL
* `authInfo` Object
* `isProxy` boolean
* `scheme` string
* `host` string
* `isProxy` Boolean
* `scheme` String
* `host` String
* `port` Integer
* `realm` string
* `realm` String
* `callback` Function
* `username` string (optional)
* `password` string (optional)
* `username` String (optional)
* `password` String (optional)
Emitted when `webContents` wants to do basic auth.
@@ -375,7 +370,7 @@ Emitted whenever there is a GPU info update.
Returns:
* `event` Event
* `killed` boolean
* `killed` Boolean
Emitted when the GPU process crashes or is killed.
@@ -390,7 +385,7 @@ Returns:
* `event` Event
* `webContents` [WebContents](web-contents.md)
* `killed` boolean
* `killed` Boolean
Emitted when the renderer process of `webContents` crashes or is killed.
@@ -406,7 +401,7 @@ Returns:
* `event` Event
* `webContents` [WebContents](web-contents.md)
* `details` Object
* `reason` string - The reason the render process is gone. Possible values:
* `reason` String - The reason the render process is gone. Possible values:
* `clean-exit` - Process exited with an exit code of zero
* `abnormal-exit` - Process exited with a non-zero exit code
* `killed` - Process was sent a SIGTERM or otherwise killed externally
@@ -427,7 +422,7 @@ Returns:
* `event` Event
* `details` Object
* `type` string - Process type. One of the following values:
* `type` String - Process type. One of the following values:
* `Utility`
* `Zygote`
* `Sandbox helper`
@@ -435,7 +430,7 @@ Returns:
* `Pepper Plugin`
* `Pepper Plugin Broker`
* `Unknown`
* `reason` string - The reason the child process is gone. Possible values:
* `reason` String - The reason the child process is gone. Possible values:
* `clean-exit` - Process exited with an exit code of zero
* `abnormal-exit` - Process exited with a non-zero exit code
* `killed` - Process was sent a SIGTERM or otherwise killed externally
@@ -443,10 +438,10 @@ Returns:
* `oom` - Process ran out of memory
* `launch-failed` - Process never successfully launched
* `integrity-failure` - Windows code integrity checks failed
* `exitCode` number - The exit code for the process
* `exitCode` Number - The exit code for the process
(e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).
* `serviceName` string (optional) - The non-localized name of the process.
* `name` string (optional) - The name of the process.
* `serviceName` String (optional) - The non-localized name of the process.
* `name` String (optional) - The name of the process.
Examples for utility: `Audio Service`, `Content Decryption Module Service`, `Network Service`, `Video Capture`, etc.
Emitted when the child process unexpectedly disappears. This is normally
@@ -457,7 +452,7 @@ because it was crashed or killed. It does not include renderer processes.
Returns:
* `event` Event
* `accessibilitySupportEnabled` boolean - `true` when Chrome's accessibility
* `accessibilitySupportEnabled` Boolean - `true` when Chrome's accessibility
support is enabled, `false` otherwise.
Emitted when Chrome's accessibility support changes. This event fires when
@@ -486,9 +481,8 @@ app.on('session-created', (session) => {
Returns:
* `event` Event
* `argv` string[] - An array of the second instance's command line arguments
* `workingDirectory` string - The second instance's working directory
* `additionalData` unknown - A JSON object of additional data passed from the second instance
* `argv` String[] - An array of the second instance's command line arguments
* `workingDirectory` String - The second instance's working directory
This event will be emitted inside the primary instance of your application
when a second instance has been executed and calls `app.requestSingleInstanceLock()`.
@@ -506,6 +500,16 @@ gets emitted.
**Note:** Extra command line arguments might be added by Chromium,
such as `--original-process-start-time`.
### Event: 'desktop-capturer-get-sources'
Returns:
* `event` Event
* `webContents` [WebContents](web-contents.md)
Emitted when `desktopCapturer.getSources()` is called in the renderer process of `webContents`.
Calling `event.preventDefault()` will make it return empty sources.
## Methods
The `app` object has the following methods:
@@ -535,8 +539,8 @@ and `will-quit` events will not be emitted.
### `app.relaunch([options])`
* `options` Object (optional)
* `args` string[] (optional)
* `execPath` string (optional)
* `args` String[] (optional)
* `execPath` String (optional)
Relaunches the app when current instance exits.
@@ -563,7 +567,7 @@ app.exit(0)
### `app.isReady()`
Returns `boolean` - `true` if Electron has finished initializing, `false` otherwise.
Returns `Boolean` - `true` if Electron has finished initializing, `false` otherwise.
See also `app.whenReady()`.
### `app.whenReady()`
@@ -575,7 +579,7 @@ and subscribing to the `ready` event if the app is not ready yet.
### `app.focus([options])`
* `options` Object (optional)
* `steal` boolean _macOS_ - Make the receiver the active app even if another app is
* `steal` Boolean _macOS_ - Make the receiver the active app even if another app is
currently active.
On Linux, focuses on the first visible window. On macOS, makes the application
@@ -587,10 +591,6 @@ You should seek to use the `steal` option as sparingly as possible.
Hides all application windows without minimizing them.
### `app.isHidden()` _macOS_
Returns `boolean` - `true` if the application—including all of its windows—is hidden (e.g. with `Command-H`), `false` otherwise.
### `app.show()` _macOS_
Shows application windows after they were hidden. Does not automatically focus
@@ -598,7 +598,7 @@ them.
### `app.setAppLogsPath([path])`
* `path` string (optional) - A custom path for your logs. Must be absolute.
* `path` String (optional) - A custom path for your logs. Must be absolute.
Sets or creates a directory your app's logs which can then be manipulated with `app.getPath()` or `app.setPath(pathName, newPath)`.
@@ -606,28 +606,19 @@ Calling `app.setAppLogsPath()` without a `path` parameter will result in this di
### `app.getAppPath()`
Returns `string` - The current application directory.
Returns `String` - The current application directory.
### `app.getPath(name)`
* `name` string - You can request the following paths by the name:
* `name` String - You can request the following paths by the name:
* `home` User's home directory.
* `appData` Per-user application data directory, which by default points to:
* `%APPDATA%` on Windows
* `$XDG_CONFIG_HOME` or `~/.config` on Linux
* `~/Library/Application Support` on macOS
* `userData` The directory for storing your app's configuration files, which
by default is the `appData` directory appended with your app's name. By
convention files storing user data should be written to this directory, and
it is not recommended to write large files here because some environments
may backup this directory to cloud storage.
* `sessionData` The directory for storing data generated by `Session`, such
as localStorage, cookies, disk cache, downloaded dictionaries, network
state, devtools files. By default this points to `userData`. Chromium may
write very large disk cache here, so if your app does not rely on browser
storage like localStorage or cookies to save user data, it is recommended
to set this directory to other locations to avoid polluting the `userData`
directory.
* `userData` The directory for storing your app's configuration files, which by
default it is the `appData` directory appended with your app's name.
* `cache`
* `temp` Temporary directory.
* `exe` The current executable file.
* `module` The `libchromiumcontent` library.
@@ -641,16 +632,16 @@ Returns `string` - The current application directory.
* `logs` Directory for your app's log folder.
* `crashDumps` Directory where crash dumps are stored.
Returns `string` - A path to a special directory or file associated with `name`. On
Returns `String` - A path to a special directory or file associated with `name`. On
failure, an `Error` is thrown.
If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being called first, a default log directory will be created equivalent to calling `app.setAppLogsPath()` without a `path` parameter.
### `app.getFileIcon(path[, options])`
* `path` string
* `path` String
* `options` Object (optional)
* `size` string
* `size` String
* `small` - 16x16
* `normal` - 32x32
* `large` - 48x48 on _Linux_, 32x32 on _Windows_, unsupported on _macOS_.
@@ -668,8 +659,8 @@ On _Linux_ and _macOS_, icons depend on the application associated with file mim
### `app.setPath(name, path)`
* `name` string
* `path` string
* `name` String
* `path` String
Overrides the `path` to a special directory or file associated with `name`.
If the path specifies a directory that does not exist, an `Error` is thrown.
@@ -677,19 +668,19 @@ In that case, the directory should be created with `fs.mkdirSync` or similar.
You can only override paths of a `name` defined in `app.getPath`.
By default, web pages' cookies and caches will be stored under the `sessionData`
By default, web pages' cookies and caches will be stored under the `userData`
directory. If you want to change this location, you have to override the
`sessionData` path before the `ready` event of the `app` module is emitted.
`userData` path before the `ready` event of the `app` module is emitted.
### `app.getVersion()`
Returns `string` - The version of the loaded application. If no version is found in the
Returns `String` - The version of the loaded application. If no version is found in the
application's `package.json` file, the version of the current bundle or
executable is returned.
### `app.getName()`
Returns `string` - The current application's name, which is the name in the application's
Returns `String` - The current application's name, which is the name in the application's
`package.json` file.
Usually the `name` field of `package.json` is a short lowercase name, according
@@ -699,7 +690,7 @@ preferred over `name` by Electron.
### `app.setName(name)`
* `name` string
* `name` String
Overrides the current application's name.
@@ -707,31 +698,25 @@ Overrides the current application's name.
### `app.getLocale()`
Returns `string` - The current application locale, fetched using Chromium's `l10n_util` library.
Possible return values are documented [here](https://source.chromium.org/chromium/chromium/src/+/main:ui/base/l10n/l10n_util.cc).
Returns `String` - The current application locale, fetched using Chromium's `l10n_util` library.
Possible return values are documented [here](https://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc).
To set the locale, you'll want to use a command line switch at app startup, which may be found [here](command-line-switches.md).
**Note:** When distributing your packaged app, you have to also ship the
`locales` folder.
**Note:** This API must be called after the `ready` event is emitted.
**Note:** On Windows, you have to call it after the `ready` events gets emitted.
### `app.getLocaleCountryCode()`
Returns `string` - User operating system's locale two-letter [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) country code. The value is taken from native OS APIs.
Returns `String` - User operating system's locale two-letter [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) country code. The value is taken from native OS APIs.
**Note:** When unable to detect locale country code, it returns empty string.
### `app.getSystemLocale()`
Returns `string` - The current system locale. On Windows and Linux, it is fetched using Chromium's `i18n` library. On macOS, the `NSLocale` object is used instead.
**Note:** This API must be called after the `ready` event is emitted.
### `app.addRecentDocument(path)` _macOS_ _Windows_
* `path` string
* `path` String
Adds `path` to the recent documents list.
@@ -744,15 +729,15 @@ Clears the recent documents list.
### `app.setAsDefaultProtocolClient(protocol[, path, args])`
* `protocol` string - The name of your protocol, without `://`. For example,
* `protocol` String - The name of your protocol, without `://`. For example,
if you want your app to handle `electron://` links, call this method with
`electron` as the parameter.
* `path` string (optional) _Windows_ - The path to the Electron executable.
* `path` String (optional) _Windows_ - The path to the Electron executable.
Defaults to `process.execPath`
* `args` string[] (optional) _Windows_ - Arguments passed to the executable.
* `args` String[] (optional) _Windows_ - Arguments passed to the executable.
Defaults to an empty array
Returns `boolean` - Whether the call succeeded.
Returns `Boolean` - Whether the call succeeded.
Sets the current executable as the default handler for a protocol (aka URI
scheme). It allows you to integrate your app deeper into the operating system.
@@ -775,22 +760,22 @@ The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme` internal
### `app.removeAsDefaultProtocolClient(protocol[, path, args])` _macOS_ _Windows_
* `protocol` string - The name of your protocol, without `://`.
* `path` string (optional) _Windows_ - Defaults to `process.execPath`
* `args` string[] (optional) _Windows_ - Defaults to an empty array
* `protocol` String - The name of your protocol, without `://`.
* `path` String (optional) _Windows_ - Defaults to `process.execPath`
* `args` String[] (optional) _Windows_ - Defaults to an empty array
Returns `boolean` - Whether the call succeeded.
Returns `Boolean` - Whether the call succeeded.
This method checks if the current executable as the default handler for a
protocol (aka URI scheme). If so, it will remove the app as the default handler.
### `app.isDefaultProtocolClient(protocol[, path, args])`
* `protocol` string - The name of your protocol, without `://`.
* `path` string (optional) _Windows_ - Defaults to `process.execPath`
* `args` string[] (optional) _Windows_ - Defaults to an empty array
* `protocol` String - The name of your protocol, without `://`.
* `path` String (optional) _Windows_ - Defaults to `process.execPath`
* `args` String[] (optional) _Windows_ - Defaults to an empty array
Returns `boolean` - Whether the current executable is the default handler for a
Returns `Boolean` - Whether the current executable is the default handler for a
protocol (aka URI scheme).
**Note:** On macOS, you can use this method to check if the app has been
@@ -803,11 +788,11 @@ The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme` interna
### `app.getApplicationNameForProtocol(url)`
* `url` string - a URL with the protocol name to check. Unlike the other
* `url` String - a URL with the protocol name to check. Unlike the other
methods in this family, this accepts an entire URL, including `://` at a
minimum (e.g. `https://`).
Returns `string` - Name of the application handling the protocol, or an empty
Returns `String` - Name of the application handling the protocol, or an empty
string if there is no handler. For instance, if Electron is the default
handler of the URL, this could be `Electron` on Windows and Mac. However,
don't rely on the precise format which is not guaranteed to remain unchanged.
@@ -818,15 +803,15 @@ This method returns the application name of the default handler for the protocol
### `app.getApplicationInfoForProtocol(url)` _macOS_ _Windows_
* `url` string - a URL with the protocol name to check. Unlike the other
* `url` String - a URL with the protocol name to check. Unlike the other
methods in this family, this accepts an entire URL, including `://` at a
minimum (e.g. `https://`).
Returns `Promise<Object>` - Resolve with an object containing the following:
* `icon` NativeImage - the display icon of the app handling the protocol.
* `path` string - installation path of the app handling the protocol.
* `name` string - display name of the app handling the protocol.
* `path` String - installation path of the app handling the protocol.
* `name` String - display name of the app handling the protocol.
This method returns a promise that contains the application name, icon and path of the default handler for the protocol
(aka URI scheme) of a URL.
@@ -839,7 +824,7 @@ Adds `tasks` to the [Tasks][tasks] category of the Jump List on Windows.
`tasks` is an array of [`Task`](structures/task.md) objects.
Returns `boolean` - Whether the call succeeded.
Returns `Boolean` - Whether the call succeeded.
**Note:** If you'd like to customize the Jump List even more use
`app.setJumpList(categories)` instead.
@@ -861,8 +846,6 @@ Returns `Object`:
* `categories` [JumpListCategory[]](structures/jump-list-category.md) | `null` - Array of `JumpListCategory` objects.
Returns `string`
Sets or removes a custom Jump List for the application, and returns one of the
following strings:
@@ -956,11 +939,9 @@ app.setJumpList([
])
```
### `app.requestSingleInstanceLock([additionalData])`
### `app.requestSingleInstanceLock()`
* `additionalData` Record<any, any> (optional) - A JSON object containing additional data to send to the first instance.
Returns `boolean`
Returns `Boolean`
The return value of this method indicates whether or not this instance of your
application successfully obtained the lock. If it failed to obtain the lock,
@@ -985,16 +966,12 @@ starts:
const { app } = require('electron')
let myWindow = null
const additionalData = { myKey: 'myValue' }
const gotTheLock = app.requestSingleInstanceLock(additionalData)
const gotTheLock = app.requestSingleInstanceLock()
if (!gotTheLock) {
app.quit()
} else {
app.on('second-instance', (event, commandLine, workingDirectory, additionalData) => {
// Print out data received from the second instance.
console.log(additionalData)
app.on('second-instance', (event, commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (myWindow) {
if (myWindow.isMinimized()) myWindow.restore()
@@ -1011,7 +988,7 @@ if (!gotTheLock) {
### `app.hasSingleInstanceLock()`
Returns `boolean`
Returns `Boolean`
This method returns whether or not this instance of your app is currently
holding the single instance lock. You can request the lock with
@@ -1025,10 +1002,10 @@ allow multiple instances of the application to once again run side by side.
### `app.setUserActivity(type, userInfo[, webpageURL])` _macOS_
* `type` string - Uniquely identifies the activity. Maps to
* `type` String - Uniquely identifies the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` any - App-specific state to store for use by another device.
* `webpageURL` string (optional) - The webpage to load in a browser if no suitable app is
* `webpageURL` String (optional) - The webpage to load in a browser if no suitable app is
installed on the resuming device. The scheme must be `http` or `https`.
Creates an `NSUserActivity` and sets it as the current activity. The activity
@@ -1036,7 +1013,7 @@ is eligible for [Handoff][handoff] to another device afterward.
### `app.getCurrentActivityType()` _macOS_
Returns `string` - The type of the currently running activity.
Returns `String` - The type of the currently running activity.
### `app.invalidateCurrentActivity()` _macOS_
@@ -1048,7 +1025,7 @@ Marks the current [Handoff][handoff] user activity as inactive without invalidat
### `app.updateCurrentActivity(type, userInfo)` _macOS_
* `type` string - Uniquely identifies the activity. Maps to
* `type` String - Uniquely identifies the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` any - App-specific state to store for use by another device.
@@ -1057,13 +1034,13 @@ Updates the current activity if its type matches `type`, merging the entries fro
### `app.setAppUserModelId(id)` _Windows_
* `id` string
* `id` String
Changes the [Application User Model ID][app-user-model-id] to `id`.
### `app.setActivationPolicy(policy)` _macOS_
* `policy` string - Can be 'regular', 'accessory', or 'prohibited'.
* `policy` String - Can be 'regular', 'accessory', or 'prohibited'.
Sets the activation policy for a given app.
@@ -1076,35 +1053,35 @@ Activation policy types:
### `app.importCertificate(options, callback)` _Linux_
* `options` Object
* `certificate` string - Path for the pkcs12 file.
* `password` string - Passphrase for the certificate.
* `certificate` String - Path for the pkcs12 file.
* `password` String - Passphrase for the certificate.
* `callback` Function
* `result` Integer - Result of import.
Imports the certificate in pkcs12 format into the platform certificate store.
`callback` is called with the `result` of import operation, a value of `0`
indicates success while any other value indicates failure according to Chromium [net_error_list](https://source.chromium.org/chromium/chromium/src/+/main:net/base/net_error_list.h).
indicates success while any other value indicates failure according to Chromium [net_error_list](https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h).
### `app.configureHostResolver(options)`
* `options` Object
* `enableBuiltInResolver` boolean (optional) - Whether the built-in host
* `enableBuiltInResolver` Boolean (optional) - Whether the built-in host
resolver is used in preference to getaddrinfo. When enabled, the built-in
resolver will attempt to use the system's DNS settings to do DNS lookups
itself. Enabled by default on macOS, disabled by default on Windows and
Linux.
* `secureDnsMode` string (optional) - Can be "off", "automatic" or "secure".
* `secureDnsMode` String (optional) - Can be "off", "automatic" or "secure".
Configures the DNS-over-HTTP mode. When "off", no DoH lookups will be
performed. When "automatic", DoH lookups will be performed first if DoH is
available, and insecure DNS lookups will be performed as a fallback. When
"secure", only DoH lookups will be performed. Defaults to "automatic".
* `secureDnsServers` string[]&#32;(optional) - A list of DNS-over-HTTP
* `secureDnsServers` String[]&#32;(optional) - A list of DNS-over-HTTP
server templates. See [RFC8484 § 3][] for details on the template format.
Most servers support the POST method; the template for such servers is
simply a URI. Note that for [some DNS providers][doh-providers], the
resolver will automatically upgrade to DoH unless DoH is explicitly
disabled, even if there are no DoH servers provided in this list.
* `enableAdditionalDnsQueryTypes` boolean (optional) - Controls whether additional DNS
* `enableAdditionalDnsQueryTypes` Boolean (optional) - Controls whether additional DNS
query types, e.g. HTTPS (DNS type 65) will be allowed besides the
traditional A and AAAA queries when a request is being made via insecure
DNS. Has no effect on Secure DNS which always allows additional types.
@@ -1166,7 +1143,7 @@ Returns [`GPUFeatureStatus`](structures/gpu-feature-status.md) - The Graphics Fe
### `app.getGPUInfo(infoType)`
* `infoType` string - Can be `basic` or `complete`.
* `infoType` String - Can be `basic` or `complete`.
Returns `Promise<unknown>`
@@ -1209,7 +1186,7 @@ Using `basic` should be preferred if only basic information like `vendorId` or `
* `count` Integer (optional) - If a value is provided, set the badge to the provided value otherwise, on macOS, display a plain white dot (e.g. unknown number of notifications). On Linux, if a value is not provided the badge will not display.
Returns `boolean` - Whether the call succeeded.
Returns `Boolean` - Whether the call succeeded.
Sets the counter badge for current app. Setting the count to `0` will hide the
badge.
@@ -1225,14 +1202,14 @@ Returns `Integer` - The current value displayed in the counter badge.
### `app.isUnityRunning()` _Linux_
Returns `boolean` - Whether the current desktop environment is Unity launcher.
Returns `Boolean` - Whether the current desktop environment is Unity launcher.
### `app.getLoginItemSettings([options])` _macOS_ _Windows_
* `options` Object (optional)
* `path` string (optional) _Windows_ - The executable path to compare against.
* `path` String (optional) _Windows_ - The executable path to compare against.
Defaults to `process.execPath`.
* `args` string[] (optional) _Windows_ - The command-line arguments to compare
* `args` String[] (optional) _Windows_ - The command-line arguments to compare
against. Defaults to an empty array.
If you provided `path` and `args` options to `app.setLoginItemSettings`, then you
@@ -1240,43 +1217,43 @@ need to pass the same arguments here for `openAtLogin` to be set correctly.
Returns `Object`:
* `openAtLogin` boolean - `true` if the app is set to open at login.
* `openAsHidden` boolean _macOS_ - `true` if the app is set to open as hidden at login.
* `openAtLogin` Boolean - `true` if the app is set to open at login.
* `openAsHidden` Boolean _macOS_ - `true` if the app is set to open as hidden at login.
This setting is not available on [MAS builds][mas-builds].
* `wasOpenedAtLogin` boolean _macOS_ - `true` if the app was opened at login
* `wasOpenedAtLogin` Boolean _macOS_ - `true` if the app was opened at login
automatically. This setting is not available on [MAS builds][mas-builds].
* `wasOpenedAsHidden` boolean _macOS_ - `true` if the app was opened as a hidden login
* `wasOpenedAsHidden` Boolean _macOS_ - `true` if the app was opened as a hidden login
item. This indicates that the app should not open any windows at startup.
This setting is not available on [MAS builds][mas-builds].
* `restoreState` boolean _macOS_ - `true` if the app was opened as a login item that
* `restoreState` Boolean _macOS_ - `true` if the app was opened as a login item that
should restore the state from the previous session. This indicates that the
app should restore the windows that were open the last time the app was
closed. This setting is not available on [MAS builds][mas-builds].
* `executableWillLaunchAtLogin` boolean _Windows_ - `true` if app is set to open at login and its run key is not deactivated. This differs from `openAtLogin` as it ignores the `args` option, this property will be true if the given executable would be launched at login with **any** arguments.
* `executableWillLaunchAtLogin` Boolean _Windows_ - `true` if app is set to open at login and its run key is not deactivated. This differs from `openAtLogin` as it ignores the `args` option, this property will be true if the given executable would be launched at login with **any** arguments.
* `launchItems` Object[] _Windows_
* `name` string _Windows_ - name value of a registry entry.
* `path` string _Windows_ - The executable to an app that corresponds to a registry entry.
* `args` string[] _Windows_ - the command-line arguments to pass to the executable.
* `scope` string _Windows_ - one of `user` or `machine`. Indicates whether the registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
* `enabled` boolean _Windows_ - `true` if the app registry key is startup approved and therefore shows as `enabled` in Task Manager and Windows settings.
* `name` String _Windows_ - name value of a registry entry.
* `path` String _Windows_ - The executable to an app that corresponds to a registry entry.
* `args` String[] _Windows_ - the command-line arguments to pass to the executable.
* `scope` String _Windows_ - one of `user` or `machine`. Indicates whether the registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
* `enabled` Boolean _Windows_ - `true` if the app registry key is startup approved and therefore shows as `enabled` in Task Manager and Windows settings.
### `app.setLoginItemSettings(settings)` _macOS_ _Windows_
* `settings` Object
* `openAtLogin` boolean (optional) - `true` to open the app at login, `false` to remove
* `openAtLogin` Boolean (optional) - `true` to open the app at login, `false` to remove
the app as a login item. Defaults to `false`.
* `openAsHidden` boolean (optional) _macOS_ - `true` to open the app as hidden. Defaults to
* `openAsHidden` Boolean (optional) _macOS_ - `true` to open the app as hidden. Defaults to
`false`. The user can edit this setting from the System Preferences so
`app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app
is opened to know the current value. This setting is not available on [MAS builds][mas-builds].
* `path` string (optional) _Windows_ - The executable to launch at login.
* `path` String (optional) _Windows_ - The executable to launch at login.
Defaults to `process.execPath`.
* `args` string[] (optional) _Windows_ - The command-line arguments to pass to
* `args` String[] (optional) _Windows_ - The command-line arguments to pass to
the executable. Defaults to an empty array. Take care to wrap paths in
quotes.
* `enabled` boolean (optional) _Windows_ - `true` will change the startup approved registry key and `enable / disable` the App in Task Manager and Windows Settings.
* `enabled` Boolean (optional) _Windows_ - `true` will change the startup approved registry key and `enable / disable` the App in Task Manager and Windows Settings.
Defaults to `true`.
* `name` string (optional) _Windows_ - value name to write into registry. Defaults to the app's AppUserModelId().
* `name` String (optional) _Windows_ - value name to write into registry. Defaults to the app's AppUserModelId().
Set the app's login item settings.
To work with Electron's `autoUpdater` on Windows, which uses [Squirrel][Squirrel-Windows],
@@ -1300,7 +1277,7 @@ app.setLoginItemSettings({
### `app.isAccessibilitySupportEnabled()` _macOS_ _Windows_
Returns `boolean` - `true` if Chrome's accessibility support is enabled,
Returns `Boolean` - `true` if Chrome's accessibility support is enabled,
`false` otherwise. This API will return `true` if the use of assistive
technologies, such as screen readers, has been detected. See
https://www.chromium.org/developers/design-documents/accessibility for more
@@ -1308,7 +1285,7 @@ details.
### `app.setAccessibilitySupportEnabled(enabled)` _macOS_ _Windows_
* `enabled` boolean - Enable or disable [accessibility tree](https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree) rendering
* `enabled` Boolean - Enable or disable [accessibility tree](https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree) rendering
Manually enables Chrome's accessibility support, allowing to expose accessibility switch to users in application settings. See [Chromium's accessibility docs](https://www.chromium.org/developers/design-documents/accessibility) for more
details. Disabled by default.
@@ -1324,14 +1301,14 @@ Show the app's about panel options. These options can be overridden with `app.se
### `app.setAboutPanelOptions(options)`
* `options` Object
* `applicationName` string (optional) - The app's name.
* `applicationVersion` string (optional) - The app's version.
* `copyright` string (optional) - Copyright information.
* `version` string (optional) _macOS_ - The app's build version number.
* `credits` string (optional) _macOS_ _Windows_ - Credit information.
* `authors` string[] (optional) _Linux_ - List of app authors.
* `website` string (optional) _Linux_ - The app's website.
* `iconPath` string (optional) _Linux_ _Windows_ - Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
* `applicationName` String (optional) - The app's name.
* `applicationVersion` String (optional) - The app's version.
* `copyright` String (optional) - Copyright information.
* `version` String (optional) _macOS_ - The app's build version number.
* `credits` String (optional) _macOS_ _Windows_ - Credit information.
* `authors` String[] (optional) _Linux_ - List of app authors.
* `website` String (optional) _Linux_ - The app's website.
* `iconPath` String (optional) _Linux_ _Windows_ - Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
Set the about panel options. This will override the values defined in the app's `.plist` file on macOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.
@@ -1339,7 +1316,7 @@ If you do not set `credits` but still wish to surface them in your app, AppKit w
### `app.isEmojiPanelSupported()`
Returns `boolean` - whether or not the current OS version allows for native emoji pickers.
Returns `Boolean` - whether or not the current OS version allows for native emoji pickers.
### `app.showEmojiPanel()` _macOS_ _Windows_
@@ -1347,7 +1324,7 @@ Show the platform's native emoji picker.
### `app.startAccessingSecurityScopedResource(bookmarkData)` _mas_
* `bookmarkData` string - The base64 encoded security scoped bookmark data returned by the `dialog.showOpenDialog` or `dialog.showSaveDialog` methods.
* `bookmarkData` String - The base64 encoded security scoped bookmark data returned by the `dialog.showOpenDialog` or `dialog.showSaveDialog` methods.
Returns `Function` - This function **must** be called once you have finished accessing the security scoped file. If you do not remember to stop accessing the bookmark, [kernel resources will be leaked](https://developer.apple.com/reference/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc) and your app will lose its ability to reach outside the sandbox completely, until your app is restarted.
@@ -1370,16 +1347,16 @@ This method can only be called before app is ready.
### `app.isInApplicationsFolder()` _macOS_
Returns `boolean` - Whether the application is currently running from the
Returns `Boolean` - Whether the application is currently running from the
systems Application folder. Use in combination with `app.moveToApplicationsFolder()`
### `app.moveToApplicationsFolder([options])` _macOS_
* `options` Object (optional)
* `conflictHandler` Function\<boolean> (optional) - A handler for potential conflict in move failure.
* `conflictType` string - The type of move conflict encountered by the handler; can be `exists` or `existsAndRunning`, where `exists` means that an app of the same name is present in the Applications directory and `existsAndRunning` means both that it exists and that it's presently running.
* `conflictHandler` Function\<Boolean> (optional) - A handler for potential conflict in move failure.
* `conflictType` String - The type of move conflict encountered by the handler; can be `exists` or `existsAndRunning`, where `exists` means that an app of the same name is present in the Applications directory and `existsAndRunning` means both that it exists and that it's presently running.
Returns `boolean` - Whether the move was successful. Please note that if
Returns `Boolean` - Whether the move was successful. Please note that if
the move is successful, your application will quit and relaunch.
No confirmation dialog will be presented by default. If you wish to allow
@@ -1392,7 +1369,7 @@ method returns false. If we fail to perform the copy, then this method will
throw an error. The message in the error should be informative and tell
you exactly what went wrong.
By default, if an app of the same name as the one being moved exists in the Applications directory and is _not_ running, the existing app will be trashed and the active app moved into its place. If it _is_ running, the preexisting running app will assume focus and the previously active app will quit itself. This behavior can be changed by providing the optional conflict handler, where the boolean returned by the handler determines whether or not the move conflict is resolved with default behavior. i.e. returning `false` will ensure no further action is taken, returning `true` will result in the default behavior and the method continuing.
By default, if an app of the same name as the one being moved exists in the Applications directory and is _not_ running, the existing app will be trashed and the active app moved into its place. If it _is_ running, the pre-existing running app will assume focus and the previously active app will quit itself. This behavior can be changed by providing the optional conflict handler, where the boolean returned by the handler determines whether or not the move conflict is resolved with default behavior. i.e. returning `false` will ensure no further action is taken, returning `true` will result in the default behavior and the method continuing.
For example:
@@ -1415,13 +1392,13 @@ Would mean that if an app already exists in the user directory, if the user choo
### `app.isSecureKeyboardEntryEnabled()` _macOS_
Returns `boolean` - whether `Secure Keyboard Entry` is enabled.
Returns `Boolean` - whether `Secure Keyboard Entry` is enabled.
By default this API will return `false`.
### `app.setSecureKeyboardEntryEnabled(enabled)` _macOS_
* `enabled` boolean - Enable or disable `Secure Keyboard Entry`
* `enabled` Boolean - Enable or disable `Secure Keyboard Entry`
Set the `Secure Keyboard Entry` is enabled in your application.
@@ -1436,7 +1413,7 @@ details.
### `app.accessibilitySupportEnabled` _macOS_ _Windows_
A `boolean` property that's `true` if Chrome's accessibility support is enabled, `false` otherwise. This property will be `true` if the use of assistive technologies, such as screen readers, has been detected. Setting this property to `true` manually enables Chrome's accessibility support, allowing developers to expose accessibility switch to users in application settings.
A `Boolean` property that's `true` if Chrome's accessibility support is enabled, `false` otherwise. This property will be `true` if the use of assistive technologies, such as screen readers, has been detected. Setting this property to `true` manually enables Chrome's accessibility support, allowing developers to expose accessibility switch to users in application settings.
See [Chromium's accessibility docs](https://www.chromium.org/developers/design-documents/accessibility) for more details. Disabled by default.
@@ -1473,7 +1450,7 @@ dock on macOS.
### `app.isPackaged` _Readonly_
A `boolean` property that returns `true` if the app is packaged, `false` otherwise. For many apps, this property can be used to distinguish development and production environments.
A `Boolean` property that returns `true` if the app is packaged, `false` otherwise. For many apps, this property can be used to distinguish development and production environments.
[dock-menu]:https://developer.apple.com/macos/human-interface-guidelines/menus/dock-menus/
[tasks]:https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
@@ -1492,7 +1469,7 @@ A `boolean` property that returns `true` if the app is packaged, `false` otherw
### `app.name`
A `string` property that indicates the current application's name, which is the name in the application's `package.json` file.
A `String` property that indicates the current application's name, which is the name in the application's `package.json` file.
Usually the `name` field of `package.json` is a short lowercase name, according
to the npm modules spec. You should usually also specify a `productName`
@@ -1501,7 +1478,7 @@ preferred over `name` by Electron.
### `app.userAgentFallback`
A `string` which is the user agent string Electron will use as a global fallback.
A `String` which is the user agent string Electron will use as a global fallback.
This is the user agent that will be used when no user agent is set at the
`webContents` or `session` level. It is useful for ensuring that your entire
@@ -1510,7 +1487,7 @@ in your app's initialization to ensure that your overridden value is used.
### `app.runningUnderRosettaTranslation` _macOS_ _Readonly_ _Deprecated_
A `boolean` which when `true` indicates that the app is currently running
A `Boolean` which when `true` indicates that the app is currently running
under the [Rosetta Translator Environment](https://en.wikipedia.org/wiki/Rosetta_(software)).
You can use this property to prompt users to download the arm64 version of
@@ -1523,7 +1500,7 @@ and Windows.
### `app.runningUnderARM64Translation` _Readonly_ _macOS_ _Windows_
A `boolean` which when `true` indicates that the app is currently running under
A `Boolean` which when `true` indicates that the app is currently running under
an ARM64 translator (like the macOS
[Rosetta Translator Environment](https://en.wikipedia.org/wiki/Rosetta_(software))
or Windows [WOW](https://en.wikipedia.org/wiki/Windows_on_Windows)).

View File

@@ -77,10 +77,10 @@ Emitted when there is no available update.
Returns:
* `event` Event
* `releaseNotes` string
* `releaseName` string
* `releaseNotes` String
* `releaseName` String
* `releaseDate` Date
* `updateURL` string
* `updateURL` String
Emitted when an update has been downloaded.
@@ -102,16 +102,16 @@ The `autoUpdater` object has the following methods:
### `autoUpdater.setFeedURL(options)`
* `options` Object
* `url` string
* `headers` Record<string, string> (optional) _macOS_ - HTTP request headers.
* `serverType` string (optional) _macOS_ - Can be `json` or `default`, see the [Squirrel.Mac][squirrel-mac]
* `url` String
* `headers` Record<String, String> (optional) _macOS_ - HTTP request headers.
* `serverType` String (optional) _macOS_ - Can be `json` or `default`, see the [Squirrel.Mac][squirrel-mac]
README for more information.
Sets the `url` and initialize the auto updater.
### `autoUpdater.getFeedURL()`
Returns `string` - The current update feed URL.
Returns `String` - The current update feed URL.
### `autoUpdater.checkForUpdates()`

View File

@@ -11,23 +11,18 @@ relative to its owning window. It is meant to be an alternative to the
Process: [Main](../glossary.md#main-process)
This module cannot be used until the `ready` event of the `app`
module is emitted.
### Example
```javascript
// In the main process.
const { app, BrowserView, BrowserWindow } = require('electron')
const { BrowserView, BrowserWindow } = require('electron')
app.whenReady().then(() => {
const win = new BrowserWindow({ width: 800, height: 600 })
const win = new BrowserWindow({ width: 800, height: 600 })
const view = new BrowserView()
win.setBrowserView(view)
view.setBounds({ x: 0, y: 0, width: 300, height: 300 })
view.webContents.loadURL('https://electronjs.org')
})
const view = new BrowserView()
win.setBrowserView(view)
view.setBounds({ x: 0, y: 0, width: 300, height: 300 })
view.webContents.loadURL('https://electronjs.org')
```
### `new BrowserView([options])` _Experimental_
@@ -50,13 +45,13 @@ Objects created with `new BrowserView` have the following instance methods:
#### `view.setAutoResize(options)` _Experimental_
* `options` Object
* `width` boolean (optional) - If `true`, the view's width will grow and shrink together
* `width` Boolean (optional) - If `true`, the view's width will grow and shrink together
with the window. `false` by default.
* `height` boolean (optional) - If `true`, the view's height will grow and shrink
* `height` Boolean (optional) - If `true`, the view's height will grow and shrink
together with the window. `false` by default.
* `horizontal` boolean (optional) - If `true`, the view's x position and width will grow
* `horizontal` Boolean (optional) - If `true`, the view's x position and width will grow
and shrink proportionally with the window. `false` by default.
* `vertical` boolean (optional) - If `true`, the view's y position and height will grow
* `vertical` Boolean (optional) - If `true`, the view's y position and height will grow
and shrink proportionally with the window. `false` by default.
#### `view.setBounds(bounds)` _Experimental_
@@ -73,31 +68,5 @@ The `bounds` of this BrowserView instance as `Object`.
#### `view.setBackgroundColor(color)` _Experimental_
* `color` string - Color in Hex, RGB, ARGB, HSL, HSLA or named CSS color format. The alpha channel is
optional for the hex type.
Examples of valid `color` values:
* Hex
* #fff (RGB)
* #ffff (ARGB)
* #ffffff (RRGGBB)
* #ffffffff (AARRGGBB)
* RGB
* rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)
* e.g. rgb(255, 255, 255)
* RGBA
* rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)
* e.g. rgba(255, 255, 255, 1.0)
* HSL
* hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)
* e.g. hsl(200, 20%, 50%)
* HSLA
* hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)
* e.g. hsla(200, 20%, 50%, 0.5)
* Color name
* Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148)
* Similar to CSS Color Module Level 3 keywords, but case-sensitive.
* e.g. `blueviolet` or `red`
**Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBA` or `RGA`.
* `color` String - Color in `#aarrggbb` or `#argb` form. The alpha channel is
optional.

View File

@@ -0,0 +1,54 @@
## Class: BrowserWindowProxy
> Manipulate the child browser window
Process: [Renderer](../glossary.md#renderer-process)<br />
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
The `BrowserWindowProxy` object is returned from `window.open` and provides
limited functionality with the child window.
### Instance Methods
The `BrowserWindowProxy` object has the following instance methods:
#### `win.blur()`
Removes focus from the child window.
#### `win.close()`
Forcefully closes the child window without calling its unload event.
#### `win.eval(code)`
* `code` String
Evaluates the code in the child window.
#### `win.focus()`
Focuses the child window (brings the window to front).
#### `win.print()`
Invokes the print dialog on the child window.
#### `win.postMessage(message, targetOrigin)`
* `message` any
* `targetOrigin` String
Sends a message to the child window with the specified origin or `*` for no
origin preference.
In addition to these methods, the child window implements `window.opener` object
with no properties and a single method.
### Instance Properties
The `BrowserWindowProxy` object has the following instance properties:
#### `win.closed`
A `Boolean` that is set to true after the child window gets closed.

File diff suppressed because it is too large Load Diff

View File

@@ -10,20 +10,20 @@ interface and is therefore an [EventEmitter][event-emitter].
### `new ClientRequest(options)`
* `options` (Object | string) - If `options` is a string, it is interpreted as
* `options` (Object | String) - If `options` is a String, it is interpreted as
the request URL. If it is an object, it is expected to fully specify an HTTP request via the
following properties:
* `method` string (optional) - The HTTP request method. Defaults to the GET
* `method` String (optional) - The HTTP request method. Defaults to the GET
method.
* `url` string (optional) - The request URL. Must be provided in the absolute
* `url` String (optional) - The request URL. Must be provided in the absolute
form with the protocol scheme specified as http or https.
* `session` Session (optional) - The [`Session`](session.md) instance with
which the request is associated.
* `partition` string (optional) - The name of the [`partition`](session.md)
* `partition` String (optional) - The name of the [`partition`](session.md)
with which the request is associated. Defaults to the empty string. The
`session` option supersedes `partition`. Thus if a `session` is explicitly
specified, `partition` is ignored.
* `credentials` string (optional) - Can be `include` or `omit`. Whether to
* `credentials` String (optional) - Can be `include` or `omit`. Whether to
send [credentials](https://fetch.spec.whatwg.org/#credentials) with this
request. If set to `include`, credentials from the session associated with
the request will be used. If set to `omit`, credentials will not be sent
@@ -33,22 +33,22 @@ following properties:
option of the same name. If this option is not specified, authentication
data from the session will be sent, and cookies will not be sent (unless
`useSessionCookies` is set).
* `useSessionCookies` boolean (optional) - Whether to send cookies with this
* `useSessionCookies` Boolean (optional) - Whether to send cookies with this
request from the provided session. If `credentials` is specified, this
option has no effect. Default is `false`.
* `protocol` string (optional) - Can be `http:` or `https:`. The protocol
* `protocol` String (optional) - Can be `http:` or `https:`. The protocol
scheme in the form 'scheme:'. Defaults to 'http:'.
* `host` string (optional) - The server host provided as a concatenation of
* `host` String (optional) - The server host provided as a concatenation of
the hostname and the port number 'hostname:port'.
* `hostname` string (optional) - The server host name.
* `hostname` String (optional) - The server host name.
* `port` Integer (optional) - The server's listening port number.
* `path` string (optional) - The path part of the request URL.
* `redirect` string (optional) - Can be `follow`, `error` or `manual`. The
* `path` String (optional) - The path part of the request URL.
* `redirect` String (optional) - Can be `follow`, `error` or `manual`. The
redirect mode for this request. When mode is `error`, any redirection will
be aborted. When mode is `manual` the redirection will be cancelled unless
[`request.followRedirect`](#requestfollowredirect) is invoked synchronously
during the [`redirect`](#event-redirect) event. Defaults to `follow`.
* `origin` string (optional) - The origin URL of the request.
* `origin` String (optional) - The origin URL of the request.
`options` properties such as `protocol`, `host`, `hostname`, `port` and `path`
strictly follow the Node.js model as described in the
@@ -79,21 +79,21 @@ Returns:
Returns:
* `authInfo` Object
* `isProxy` boolean
* `scheme` string
* `host` string
* `isProxy` Boolean
* `scheme` String
* `host` String
* `port` Integer
* `realm` string
* `realm` String
* `callback` Function
* `username` string (optional)
* `password` string (optional)
* `username` String (optional)
* `password` String (optional)
Emitted when an authenticating proxy is asking for user credentials.
The `callback` function is expected to be called back with user credentials:
* `username` string
* `password` string
* `username` String
* `password` String
```JavaScript
request.on('login', (authInfo, callback) => {
@@ -147,9 +147,9 @@ event indicates that no more events will be emitted on either the `request` or
Returns:
* `statusCode` Integer
* `method` string
* `redirectUrl` string
* `responseHeaders` Record<string, string[]>
* `method` String
* `redirectUrl` String
* `responseHeaders` Record<String, String[]>
Emitted when the server returns a redirect response (e.g. 301 Moved
Permanently). Calling [`request.followRedirect`](#requestfollowredirect) will
@@ -161,7 +161,7 @@ continue with the redirection. If this event is handled,
#### `request.chunkedEncoding`
A `boolean` specifying whether the request will use HTTP chunked transfer encoding
A `Boolean` specifying whether the request will use HTTP chunked transfer encoding
or not. Defaults to false. The property is readable and writable, however it can
be set only before the first write operation as the HTTP headers are not yet put
on the wire. Trying to set the `chunkedEncoding` property after the first write
@@ -175,17 +175,17 @@ internally buffered inside Electron process memory.
#### `request.setHeader(name, value)`
* `name` string - An extra HTTP header name.
* `value` string - An extra HTTP header value.
* `name` String - An extra HTTP header name.
* `value` String - An extra HTTP header value.
Adds an extra HTTP header. The header name will be issued as-is without
lowercasing. It can be called only before first write. Calling this method after
the first write will throw an error. If the passed value is not a `string`, its
the first write will throw an error. If the passed value is not a `String`, its
`toString()` method will be called to obtain the final value.
Certain headers are restricted from being set by apps. These headers are
listed below. More information on restricted headers can be found in
[Chromium's header utils](https://source.chromium.org/chromium/chromium/src/+/main:services/network/public/cpp/header_util.cc;drc=1562cab3f1eda927938f8f4a5a91991fefde66d3;bpv=1;bpt=1;l=22).
[Chromium's header utils](https://source.chromium.org/chromium/chromium/src/+/master:services/network/public/cpp/header_util.cc;drc=1562cab3f1eda927938f8f4a5a91991fefde66d3;bpv=1;bpt=1;l=22).
* `Content-Length`
* `Host`
@@ -199,22 +199,22 @@ Additionally, setting the `Connection` header to the value `upgrade` is also dis
#### `request.getHeader(name)`
* `name` string - Specify an extra header name.
* `name` String - Specify an extra header name.
Returns `string` - The value of a previously set extra header name.
Returns `String` - The value of a previously set extra header name.
#### `request.removeHeader(name)`
* `name` string - Specify an extra header name.
* `name` String - Specify an extra header name.
Removes a previously set extra header name. This method can be called only
before first write. Trying to call it after the first write will throw an error.
#### `request.write(chunk[, encoding][, callback])`
* `chunk` (string | Buffer) - A chunk of the request body's data. If it is a
* `chunk` (String | Buffer) - A chunk of the request body's data. If it is a
string, it is converted into a Buffer using the specified encoding.
* `encoding` string (optional) - Used to convert string chunks into Buffer
* `encoding` String (optional) - Used to convert string chunks into Buffer
objects. Defaults to 'utf-8'.
* `callback` Function (optional) - Called after the write operation ends.
@@ -230,8 +230,8 @@ it is not allowed to add or remove a custom header.
#### `request.end([chunk][, encoding][, callback])`
* `chunk` (string | Buffer) (optional)
* `encoding` string (optional)
* `chunk` (String | Buffer) (optional)
* `encoding` String (optional)
* `callback` Function (optional)
Sends the last chunk of the request data. Subsequent write or end operations
@@ -253,9 +253,9 @@ event.
Returns `Object`:
* `active` boolean - Whether the request is currently active. If this is false
* `active` Boolean - Whether the request is currently active. If this is false
no other properties will be set
* `started` boolean - Whether the upload has started. If this is false both
* `started` Boolean - Whether the upload has started. If this is false both
`current` and `total` will be set to 0.
* `current` Integer - The number of bytes that have been uploaded so far
* `total` Integer - The number of bytes that will be uploaded this request

View File

@@ -10,7 +10,7 @@ you need to pass `selection` to each method:
```javascript
const { clipboard } = require('electron')
clipboard.writeText('Example string', 'selection')
clipboard.writeText('Example String', 'selection')
console.log(clipboard.readText('selection'))
```
@@ -22,9 +22,9 @@ The `clipboard` module has the following methods:
### `clipboard.readText([type])`
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Returns `string` - The content in the clipboard as plain text.
Returns `String` - The content in the clipboard as plain text.
```js
const { clipboard } = require('electron')
@@ -38,8 +38,8 @@ console.log(text)
### `clipboard.writeText(text[, type])`
* `text` string
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `text` String
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Writes the `text` into the clipboard as plain text.
@@ -52,9 +52,9 @@ clipboard.writeText(text)
### `clipboard.readHTML([type])`
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Returns `string` - The content in the clipboard as markup.
Returns `String` - The content in the clipboard as markup.
```js
const { clipboard } = require('electron')
@@ -68,35 +68,35 @@ console.log(html)
### `clipboard.writeHTML(markup[, type])`
* `markup` string
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `markup` String
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Writes `markup` to the clipboard.
```js
const { clipboard } = require('electron')
clipboard.writeHTML('<b>Hi</b>')
clipboard.writeHTML('<b>Hi</b')
```
### `clipboard.readImage([type])`
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Returns [`NativeImage`](native-image.md) - The image content in the clipboard.
### `clipboard.writeImage(image[, type])`
* `image` [NativeImage](native-image.md)
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Writes `image` to the clipboard.
### `clipboard.readRTF([type])`
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Returns `string` - The content in the clipboard as RTF.
Returns `String` - The content in the clipboard as RTF.
```js
const { clipboard } = require('electron')
@@ -110,8 +110,8 @@ console.log(rtf)
### `clipboard.writeRTF(text[, type])`
* `text` string
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `text` String
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Writes the `text` into the clipboard in RTF.
@@ -126,20 +126,20 @@ clipboard.writeRTF(rtf)
Returns `Object`:
* `title` string
* `url` string
* `title` String
* `url` String
Returns an Object containing `title` and `url` keys representing the bookmark in
the clipboard. The `title` and `url` values will be empty strings when the
bookmark is unavailable. The `title` value will always be empty on Windows.
bookmark is unavailable.
### `clipboard.writeBookmark(title, url[, type])` _macOS_ _Windows_
* `title` string - Unused on Windows
* `url` string
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `title` String
* `url` String
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Writes the `title` (macOS only) and `url` into the clipboard as a bookmark.
Writes the `title` and `url` into the clipboard as a bookmark.
**Note:** Most apps on Windows don't support pasting bookmarks into them so
you can use `clipboard.write` to write both a bookmark and fallback text to the
@@ -156,28 +156,28 @@ clipboard.writeBookmark({
### `clipboard.readFindText()` _macOS_
Returns `string` - The text on the find pasteboard, which is the pasteboard that holds information about the current state of the active applications find panel.
Returns `String` - The text on the find pasteboard, which is the pasteboard that holds information about the current state of the active applications find panel.
This method uses synchronous IPC when called from the renderer process.
The cached value is reread from the find pasteboard whenever the application is activated.
### `clipboard.writeFindText(text)` _macOS_
* `text` string
* `text` String
Writes the `text` into the find pasteboard (the pasteboard that holds information about the current state of the active applications find panel) as plain text. This method uses synchronous IPC when called from the renderer process.
### `clipboard.clear([type])`
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Clears the clipboard content.
### `clipboard.availableFormats([type])`
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Returns `string[]` - An array of supported formats for the clipboard `type`.
Returns `String[]` - An array of supported formats for the clipboard `type`.
```js
const { clipboard } = require('electron')
@@ -189,10 +189,10 @@ console.log(formats)
### `clipboard.has(format[, type])` _Experimental_
* `format` string
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `format` String
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Returns `boolean` - Whether the clipboard supports the specified `format`.
Returns `Boolean` - Whether the clipboard supports the specified `format`.
```js
const { clipboard } = require('electron')
@@ -204,9 +204,9 @@ console.log(hasFormat)
### `clipboard.read(format)` _Experimental_
* `format` string
* `format` String
Returns `string` - Reads `format` type from the clipboard.
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`
@@ -214,7 +214,7 @@ are not valid.
### `clipboard.readBuffer(format)` _Experimental_
* `format` string
* `format` String
Returns `Buffer` - Reads `format` type from the clipboard.
@@ -232,9 +232,9 @@ console.log(buffer.equals(out))
### `clipboard.writeBuffer(format, buffer[, type])` _Experimental_
* `format` string
* `format` String
* `buffer` Buffer
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Writes the `buffer` into the clipboard as `format`.
@@ -248,12 +248,12 @@ clipboard.writeBuffer('public/utf8-plain-text', buffer)
### `clipboard.write(data[, type])`
* `data` Object
* `text` string (optional)
* `html` string (optional)
* `text` String (optional)
* `html` String (optional)
* `image` [NativeImage](native-image.md) (optional)
* `rtf` string (optional)
* `bookmark` string (optional) - The title of the URL at `text`.
* `type` string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
* `rtf` String (optional)
* `bookmark` String (optional) - The title of the URL at `text`.
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Writes `data` to the clipboard.

View File

@@ -61,6 +61,12 @@ throttling in one window, you can take the hack of
Forces the maximum disk space to be used by the disk cache, in bytes.
### --enable-api-filtering-logging
Enables caller stack logging for the following APIs (filtering events):
* `desktopCapturer.getSources()` / `desktop-capturer-get-sources`
### --enable-logging[=file]
Prints Chromium's logging to stderr (or a log file).
@@ -274,8 +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/+/main:base/logging.h
[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/+/main:base/logging.h?q=logging::LogSeverity&ss=chromium
[severities]: https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h?q=logging::LogSeverity&ss=chromium

View File

@@ -20,8 +20,8 @@ document.
#### `commandLine.appendSwitch(switch[, value])`
* `switch` string - A command-line switch, without the leading `--`
* `value` string (optional) - A value for the given switch
* `switch` String - A command-line switch, without the leading `--`
* `value` String (optional) - A value for the given switch
Append a switch (with optional `value`) to Chromium's command line.
@@ -30,7 +30,7 @@ control Chromium's behavior.
#### `commandLine.appendArgument(value)`
* `value` string - The argument to append to the command line
* `value` String - The argument to append to the command line
Append an argument to Chromium's command line. The argument will be quoted
correctly. Switches will precede arguments regardless of appending order.
@@ -42,21 +42,21 @@ control Chromium's behavior.
#### `commandLine.hasSwitch(switch)`
* `switch` string - A command-line switch
* `switch` String - A command-line switch
Returns `boolean` - Whether the command-line switch is present.
Returns `Boolean` - Whether the command-line switch is present.
#### `commandLine.getSwitchValue(switch)`
* `switch` string - A command-line switch
* `switch` String - A command-line switch
Returns `string` - The command-line switch value.
Returns `String` - The command-line switch value.
**Note:** When the switch is not present or has no value, it returns empty string.
#### `commandLine.removeSwitch(switch)`
* `switch` string - A command-line switch
* `switch` String - A command-line switch
Removes the specified switch from Chromium's command line.

View File

@@ -32,11 +32,11 @@ The `contentTracing` module has the following methods:
### `contentTracing.getCategories()`
Returns `Promise<string[]>` - resolves with an array of category groups once all child processes have acknowledged the `getCategories` request
Returns `Promise<String[]>` - resolves with an array of category groups once all child processes have acknowledged the `getCategories` request
Get a set of category groups. The category groups can change as new code paths
are reached. See also the [list of built-in tracing
categories](https://chromium.googlesource.com/chromium/src/+/main/base/trace_event/builtin_categories.h).
categories](https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h).
> **NOTE:** Electron adds a non-default tracing category called `"electron"`.
> This category can be used to capture Electron-specific tracing events.
@@ -57,9 +57,9 @@ only one trace operation can be in progress at a time.
### `contentTracing.stopRecording([resultFilePath])`
* `resultFilePath` string (optional)
* `resultFilePath` String (optional)
Returns `Promise<string>` - resolves with a path to a file that contains the traced data once all child processes have acknowledged the `stopRecording` request
Returns `Promise<String>` - resolves with a path to a file that contains the traced data once all child processes have acknowledged the `stopRecording` request
Stop recording on all processes.
@@ -77,8 +77,8 @@ will be returned in the promise.
Returns `Promise<Object>` - Resolves with an object containing the `value` and `percentage` of trace buffer maximum usage
* `value` number
* `percentage` number
* `value` Number
* `percentage` Number
Get the maximum usage across processes of trace buffer as a percentage of the
full state.

View File

@@ -35,7 +35,7 @@ page you load in your renderer executes code in this world.
When `contextIsolation` is enabled in your `webPreferences` (this is the default behavior since Electron 12.0.0), your `preload` scripts run in an
"Isolated World". You can read more about context isolation and what it affects in the
[security](../tutorial/security.md#3-enable-context-isolation) docs.
[security](../tutorial/security.md#3-enable-context-isolation-for-remote-content) docs.
## Methods
@@ -43,15 +43,15 @@ The `contextBridge` module has the following methods:
### `contextBridge.exposeInMainWorld(apiKey, api)`
* `apiKey` string - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`.
* `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.
## Usage
### API
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.
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
the API become immutable and updates on either side of the bridge do not result in an update on the other side.
@@ -97,13 +97,13 @@ has been included below for completeness:
| Type | Complexity | Parameter Support | Return Value Support | Limitations |
| ---- | ---------- | ----------------- | -------------------- | ----------- |
| `string` | Simple | ✅ | ✅ | N/A |
| `number` | Simple | ✅ | ✅ | N/A |
| `boolean` | Simple | ✅ | ✅ | N/A |
| `String` | Simple | ✅ | ✅ | N/A |
| `Number` | Simple | ✅ | ✅ | N/A |
| `Boolean` | Simple | ✅ | ✅ | N/A |
| `Object` | Complex | ✅ | ✅ | Keys must be supported using only "Simple" types in this table. Values must be supported in this table. Prototype modifications are dropped. Sending custom classes will copy values but not the prototype. |
| `Array` | Complex | ✅ | ✅ | Same limitations as the `Object` type |
| `Error` | Complex | ✅ | ✅ | Errors that are thrown are also copied, this can result in the message and stack trace of the error changing slightly due to being thrown in a different context, and any custom properties on the Error object [will be lost](https://github.com/electron/electron/issues/25596) |
| `Promise` | Complex | ✅ | ✅ | N/A
| `Error` | Complex | ✅ | ✅ | Errors that are thrown are also copied, this can result in the message and stack trace of the error changing slightly due to being thrown in a different context |
| `Promise` | Complex | ✅ | ✅ | Promises are only proxied if they are the return value or exact parameter. Promises nested in arrays or objects will be dropped. |
| `Function` | Complex | ✅ | ✅ | Prototype modifications are dropped. Sending classes or constructors will not work. |
| [Cloneable Types](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) | Simple | ✅ | ✅ | See the linked document on cloneable types |
| `Element` | Complex | ✅ | ✅ | Prototype modifications are dropped. Sending custom elements will not work. |

View File

@@ -50,7 +50,7 @@ Returns:
* `event` Event
* `cookie` [Cookie](structures/cookie.md) - The cookie that was changed.
* `cause` string - The cause of the change with one of the following values:
* `cause` String - The cause of the change with one of the following values:
* `explicit` - The cookie was changed directly by a consumer's action.
* `overwrite` - The cookie was automatically removed due to an insert
operation that overwrote it.
@@ -58,7 +58,7 @@ Returns:
* `evicted` - The cookie was automatically evicted during garbage collection.
* `expired-overwrite` - The cookie was overwritten with an already-expired
expiration date.
* `removed` boolean - `true` if the cookie was removed, `false` otherwise.
* `removed` Boolean - `true` if the cookie was removed, `false` otherwise.
Emitted when a cookie is changed because it was added, edited, removed, or
expired.
@@ -70,14 +70,14 @@ The following methods are available on instances of `Cookies`:
#### `cookies.get(filter)`
* `filter` Object
* `url` string (optional) - Retrieves cookies which are associated with
* `url` String (optional) - Retrieves cookies which are associated with
`url`. Empty implies retrieving cookies of all URLs.
* `name` string (optional) - Filters cookies by name.
* `domain` string (optional) - Retrieves cookies whose domains match or are
* `name` String (optional) - Filters cookies by name.
* `domain` String (optional) - Retrieves cookies whose domains match or are
subdomains of `domains`.
* `path` string (optional) - Retrieves cookies whose path matches `path`.
* `secure` boolean (optional) - Filters cookies by their Secure property.
* `session` boolean (optional) - Filters out session or persistent cookies.
* `path` String (optional) - Retrieves cookies whose path matches `path`.
* `secure` Boolean (optional) - Filters cookies by their Secure property.
* `session` Boolean (optional) - Filters out session or persistent cookies.
Returns `Promise<Cookie[]>` - A promise which resolves an array of cookie objects.
@@ -87,19 +87,19 @@ the response.
#### `cookies.set(details)`
* `details` Object
* `url` string - The URL to associate the cookie with. The promise will be rejected if the URL is invalid.
* `name` string (optional) - The name of the cookie. Empty by default if omitted.
* `value` string (optional) - The value of the cookie. Empty by default if omitted.
* `domain` string (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. Empty by default if omitted.
* `path` string (optional) - The path of the cookie. Empty by default if omitted.
* `secure` boolean (optional) - Whether the cookie should be marked as Secure. Defaults to
* `url` String - The URL to associate the cookie with. The promise will be rejected if the URL is invalid.
* `name` String (optional) - The name of the cookie. Empty by default if omitted.
* `value` String (optional) - The value of the cookie. Empty by default if omitted.
* `domain` String (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. Empty by default if omitted.
* `path` String (optional) - The path of the cookie. Empty by default if omitted.
* `secure` Boolean (optional) - Whether the cookie should be marked as Secure. Defaults to
false unless [Same Site=None](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#samesitenone_requires_secure) attribute is used.
* `httpOnly` boolean (optional) - Whether the cookie should be marked as HTTP only.
* `httpOnly` Boolean (optional) - Whether the cookie should be marked as HTTP only.
Defaults to false.
* `expirationDate` Double (optional) - The expiration date of the cookie as the number of
seconds since the UNIX epoch. If omitted then the cookie becomes a session
cookie and will not be retained between sessions.
* `sameSite` string (optional) - The [Same Site](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies) policy to apply to this cookie. Can be `unspecified`, `no_restriction`, `lax` or `strict`. Default is `lax`.
* `sameSite` String (optional) - The [Same Site](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies) policy to apply to this cookie. Can be `unspecified`, `no_restriction`, `lax` or `strict`. Default is `no_restriction`.
Returns `Promise<void>` - A promise which resolves when the cookie has been set
@@ -107,8 +107,8 @@ Sets a cookie with `details`.
#### `cookies.remove(url, name)`
* `url` string - The URL associated with the cookie.
* `name` string - The name of cookie to remove.
* `url` String - The URL associated with the cookie.
* `name` String - The name of cookie to remove.
Returns `Promise<void>` - A promise which resolves when the cookie has been removed

View File

@@ -19,23 +19,56 @@ following projects:
* [socorro](https://github.com/mozilla/socorro)
* [mini-breakpad-server](https://github.com/electron/mini-breakpad-server)
> **Note:** Electron uses Crashpad, not Breakpad, to collect and upload
> crashes, but for the time being, the [upload protocol is the same](https://chromium.googlesource.com/crashpad/crashpad/+/HEAD/doc/overview_design.md#Upload-to-collection-server).
Or use a 3rd party hosted solution:
* [Backtrace](https://backtrace.io/electron/)
* [Sentry](https://docs.sentry.io/clients/electron)
* [BugSplat](https://www.bugsplat.com/docs/platforms/electron)
* [Bugsnag](https://docs.bugsnag.com/platforms/electron/)
Crash reports are stored temporarily before being uploaded in a directory
underneath the app's user data directory, called 'Crashpad'. You can override
this directory by calling `app.setPath('crashDumps', '/path/to/crashes')`
before starting the crash reporter.
underneath the app's user data directory (called 'Crashpad' on Windows and Mac,
or 'Crash Reports' on Linux). You can override this directory by calling
`app.setPath('crashDumps', '/path/to/crashes')` before starting the crash
reporter.
Electron uses [crashpad](https://chromium.googlesource.com/crashpad/crashpad/+/refs/heads/main/README.md)
to monitor and report crashes.
On Windows and macOS, Electron uses
[crashpad](https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md)
to monitor and report crashes. On Linux, Electron uses
[breakpad](https://chromium.googlesource.com/breakpad/breakpad/+/master/). This
is an implementation detail driven by Chromium, and it may change in future. In
particular, crashpad is newer and will likely eventually replace breakpad on
all platforms.
### Note about Node child processes on Linux
If you are using the Node.js `child_process` module and want to report crashes
from those processes on Linux, there is an extra step you will need to take to
properly initialize the crash reporter in the child process. This is not
necessary on Mac or Windows, as those platforms use Crashpad, which
automatically monitors child processes.
Since `require('electron')` is not available in Node child processes, the
following APIs are available on the `process` object in Node child processes.
Note that, on Linux, each Node child process has its own separate instance of
the breakpad crash reporter. This is dissimilar to renderer child processes,
which have a "stub" breakpad reporter which returns information to the main
process for reporting.
#### `process.crashReporter.start(options)`
See [`crashReporter.start()`](#crashreporterstartoptions).
#### `process.crashReporter.getParameters()`
See [`crashReporter.getParameters()`](#crashreportergetparameters).
#### `process.crashReporter.addExtraParameter(key, value)`
See [`crashReporter.addExtraParameter(key, value)`](#crashreporteraddextraparameterkey-value).
#### `process.crashReporter.removeExtraParameter(key)`
See [`crashReporter.removeExtraParameter(key)`](#crashreporterremoveextraparameterkey).
## Methods
@@ -44,29 +77,29 @@ The `crashReporter` module has the following methods:
### `crashReporter.start(options)`
* `options` Object
* `submitURL` string (optional) - URL that crash reports will be sent to as
* `submitURL` String (optional) - URL that crash reports will be sent to as
POST. Required unless `uploadToServer` is `false`.
* `productName` string (optional) - Defaults to `app.name`.
* `companyName` string (optional) _Deprecated_ - Deprecated alias for
* `productName` String (optional) - Defaults to `app.name`.
* `companyName` String (optional) _Deprecated_ - Deprecated alias for
`{ globalExtra: { _companyName: ... } }`.
* `uploadToServer` boolean (optional) - Whether crash reports should be sent
* `uploadToServer` Boolean (optional) - Whether crash reports should be sent
to the server. If false, crash reports will be collected and stored in the
crashes directory, but not uploaded. Default is `true`.
* `ignoreSystemCrashHandler` boolean (optional) - If true, crashes generated
* `ignoreSystemCrashHandler` Boolean (optional) - If true, crashes generated
in the main process will not be forwarded to the system crash handler.
Default is `false`.
* `rateLimit` boolean (optional) _macOS_ _Windows_ - If true, limit the
* `rateLimit` Boolean (optional) _macOS_ _Windows_ - If true, limit the
number of crashes uploaded to 1/hour. Default is `false`.
* `compress` boolean (optional) - If true, crash reports will be compressed
* `compress` Boolean (optional) - If true, crash reports will be compressed
and uploaded with `Content-Encoding: gzip`. Default is `true`.
* `extra` Record<string, string> (optional) - Extra string key/value
* `extra` Record<String, String> (optional) - Extra string key/value
annotations that will be sent along with crash reports that are generated
in the main process. Only string values are supported. Crashes generated in
child processes will not contain these extra
parameters to crash reports generated from child processes, call
[`addExtraParameter`](#crashreporteraddextraparameterkey-value) from the
child process.
* `globalExtra` Record<string, string> (optional) - Extra string key/value
* `globalExtra` Record<String, String> (optional) - Extra string key/value
annotations that will be sent along with any crash reports generated in any
process. These annotations cannot be changed once the crash reporter has
been started. If a key is present in both the global extra parameters and
@@ -118,14 +151,14 @@ ID.
### `crashReporter.getUploadToServer()`
Returns `boolean` - Whether reports should be submitted to the server. Set through
Returns `Boolean` - Whether reports should be submitted to the server. Set through
the `start` method or `setUploadToServer`.
**Note:** This method is only available in the main process.
### `crashReporter.setUploadToServer(uploadToServer)`
* `uploadToServer` boolean - Whether reports should be submitted to the server.
* `uploadToServer` Boolean - Whether reports should be submitted to the server.
This would normally be controlled by user preferences. This has no effect if
called before `start` is called.
@@ -134,8 +167,8 @@ called before `start` is called.
### `crashReporter.addExtraParameter(key, value)`
* `key` string - Parameter key, must be no longer than 39 bytes.
* `value` string - Parameter value, must be no longer than 127 bytes.
* `key` String - Parameter key, must be no longer than 39 bytes.
* `value` String - Parameter value, must be no longer than 127 bytes.
Set an extra parameter to be sent with the crash report. The values specified
here will be sent in addition to any values set via the `extra` option when
@@ -153,57 +186,37 @@ names must be no longer than 39 bytes, and values must be no longer than 20320
bytes. Keys with names longer than the maximum will be silently ignored. Key
values longer than the maximum length will be truncated.
**Note:** On linux values that are longer than 127 bytes will be chunked into
multiple keys, each 127 bytes in length. E.g. `addExtraParameter('foo', 'a'.repeat(130))`
will result in two chunked keys `foo__1` and `foo__2`, the first will contain
the first 127 bytes and the second will contain the remaining 3 bytes. On
your crash reporting backend you should stitch together keys in this format.
### `crashReporter.removeExtraParameter(key)`
* `key` string - Parameter key, must be no longer than 39 bytes.
* `key` String - Parameter key, must be no longer than 39 bytes.
Remove an extra parameter from the current set of parameters. Future crashes
will not include this parameter.
### `crashReporter.getParameters()`
Returns `Record<string, string>` - The current 'extra' parameters of the crash reporter.
## In Node child processes
Since `require('electron')` is not available in Node child processes, the
following APIs are available on the `process` object in Node child processes.
#### `process.crashReporter.start(options)`
See [`crashReporter.start()`](#crashreporterstartoptions).
Note that if the crash reporter is started in the main process, it will
automatically monitor child processes, so it should not be started in the child
process. Only use this method if the main process does not initialize the crash
reporter.
#### `process.crashReporter.getParameters()`
See [`crashReporter.getParameters()`](#crashreportergetparameters).
#### `process.crashReporter.addExtraParameter(key, value)`
See [`crashReporter.addExtraParameter(key, value)`](#crashreporteraddextraparameterkey-value).
#### `process.crashReporter.removeExtraParameter(key)`
See [`crashReporter.removeExtraParameter(key)`](#crashreporterremoveextraparameterkey).
Returns `Record<String, String>` - The current 'extra' parameters of the crash reporter.
## Crash Report Payload
The crash reporter will send the following data to the `submitURL` as
a `multipart/form-data` `POST`:
* `ver` string - The version of Electron.
* `platform` string - e.g. 'win32'.
* `process_type` string - e.g. 'renderer'.
* `guid` string - e.g. '5e1286fc-da97-479e-918b-6bfb0c3d1c72'.
* `_version` string - The version in `package.json`.
* `_productName` string - The product name in the `crashReporter` `options`
* `ver` String - The version of Electron.
* `platform` String - e.g. 'win32'.
* `process_type` String - e.g. 'renderer'.
* `guid` String - e.g. '5e1286fc-da97-479e-918b-6bfb0c3d1c72'.
* `_version` String - The version in `package.json`.
* `_productName` String - The product name in the `crashReporter` `options`
object.
* `prod` string - Name of the underlying product. In this case Electron.
* `_companyName` string - The company name in the `crashReporter` `options`
* `prod` String - Name of the underlying product. In this case Electron.
* `_companyName` String - The company name in the `crashReporter` `options`
object.
* `upload_file_minidump` File - The crash report in the format of `minidump`.
* All level one properties of the `extra` object in the `crashReporter`

View File

@@ -40,7 +40,7 @@ win.webContents.debugger.sendCommand('Network.enable')
Returns:
* `event` Event
* `reason` string - Reason for detaching debugger.
* `reason` String - Reason for detaching debugger.
Emitted when the debugging session is terminated. This happens either when
`webContents` is closed or devtools is invoked for the attached `webContents`.
@@ -50,10 +50,10 @@ Emitted when the debugging session is terminated. This happens either when
Returns:
* `event` Event
* `method` string - Method name.
* `method` String - Method name.
* `params` any - Event parameters defined by the 'parameters'
attribute in the remote debugging protocol.
* `sessionId` string - Unique identifier of attached debugging session,
* `sessionId` String - Unique identifier of attached debugging session,
will match the value sent from `debugger.sendCommand`.
Emitted whenever the debugging target issues an instrumentation event.
@@ -65,13 +65,13 @@ Emitted whenever the debugging target issues an instrumentation event.
#### `debugger.attach([protocolVersion])`
* `protocolVersion` string (optional) - Requested debugging protocol version.
* `protocolVersion` String (optional) - Requested debugging protocol version.
Attaches the debugger to the `webContents`.
#### `debugger.isAttached()`
Returns `boolean` - Whether a debugger is attached to the `webContents`.
Returns `Boolean` - Whether a debugger is attached to the `webContents`.
#### `debugger.detach()`
@@ -79,10 +79,10 @@ Detaches the debugger from the `webContents`.
#### `debugger.sendCommand(method[, commandParams, sessionId])`
* `method` string - Method name, should be one of the methods defined by the
* `method` String - Method name, should be one of the methods defined by the
[remote debugging protocol][rdp].
* `commandParams` any (optional) - JSON object with request parameters.
* `sessionId` string (optional) - send command to the target with associated
* `sessionId` String (optional) - send command to the target with associated
debugging session id. The initial value can be obtained by sending
[Target.attachToTarget][attachToTarget] message.

View File

@@ -3,49 +3,40 @@
> Access information about media sources that can be used to capture audio and
> video from the desktop using the [`navigator.mediaDevices.getUserMedia`] API.
Process: [Main](../glossary.md#main-process)
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
The following example shows how to capture video from a desktop window whose
title is `Electron`:
```javascript
// In the main process.
// In the renderer process.
const { desktopCapturer } = require('electron')
desktopCapturer.getSources({ types: ['window', 'screen'] }).then(async sources => {
for (const source of sources) {
if (source.name === 'Electron') {
mainWindow.webContents.send('SET_SOURCE', source.id)
try {
const stream = await navigator.mediaDevices.getUserMedia({
audio: false,
video: {
mandatory: {
chromeMediaSource: 'desktop',
chromeMediaSourceId: source.id,
minWidth: 1280,
maxWidth: 1280,
minHeight: 720,
maxHeight: 720
}
}
})
handleStream(stream)
} catch (e) {
handleError(e)
}
return
}
}
})
```
```javascript
// In the preload script.
const { ipcRenderer } = require('electron')
ipcRenderer.on('SET_SOURCE', async (event, sourceId) => {
try {
const stream = await navigator.mediaDevices.getUserMedia({
audio: false,
video: {
mandatory: {
chromeMediaSource: 'desktop',
chromeMediaSourceId: sourceId,
minWidth: 1280,
maxWidth: 1280,
minHeight: 720,
maxHeight: 720
}
}
})
handleStream(stream)
} catch (e) {
handleError(e)
}
})
function handleStream (stream) {
const video = document.querySelector('video')
@@ -88,13 +79,13 @@ The `desktopCapturer` module has the following methods:
### `desktopCapturer.getSources(options)`
* `options` Object
* `types` string[] - An array of strings that lists the types of desktop sources
* `types` String[] - An array of Strings that lists the types of desktop sources
to be captured, available types are `screen` and `window`.
* `thumbnailSize` [Size](structures/size.md) (optional) - The size that the media source thumbnail
should be scaled to. Default is `150` x `150`. Set width or height to 0 when you do not need
the thumbnails. This will save the processing time required for capturing the content of each
window and screen.
* `fetchWindowIcons` boolean (optional) - Set to true to enable fetching window icons. The default
* `fetchWindowIcons` Boolean (optional) - Set to true to enable fetching window icons. The default
value is false. When false the appIcon property of the sources return null. Same if a source has
the type screen.

View File

@@ -19,12 +19,12 @@ The `dialog` module has the following methods:
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `title` string (optional)
* `defaultPath` string (optional)
* `buttonLabel` string (optional) - Custom label for the confirmation button, when
* `title` String (optional)
* `defaultPath` String (optional)
* `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[]&#32;(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.
@@ -41,11 +41,11 @@ The `dialog` module has the following methods:
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
as a directory instead of a file.
* `dontAddToRecent` _Windows_ - Do not add the item being opened to the recent documents list.
* `message` string (optional) _macOS_ - Message to display above input
* `message` String (optional) _macOS_ - Message to display above input
boxes.
* `securityScopedBookmarks` boolean (optional) _macOS_ _mas_ - Create [security scoped bookmarks](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store.
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create [security scoped bookmarks](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store.
Returns `string[] | undefined`, the file paths chosen by the user; if the dialog is cancelled it returns `undefined`.
Returns `String[] | undefined`, the file paths chosen by the user; if the dialog is cancelled it returns `undefined`.
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
@@ -82,12 +82,12 @@ dialog.showOpenDialogSync(mainWindow, {
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `title` string (optional)
* `defaultPath` string (optional)
* `buttonLabel` string (optional) - Custom label for the confirmation button, when
* `title` String (optional)
* `defaultPath` String (optional)
* `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[]&#32;(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.
@@ -104,15 +104,15 @@ dialog.showOpenDialogSync(mainWindow, {
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
as a directory instead of a file.
* `dontAddToRecent` _Windows_ - Do not add the item being opened to the recent documents list.
* `message` string (optional) _macOS_ - Message to display above input
* `message` String (optional) _macOS_ - Message to display above input
boxes.
* `securityScopedBookmarks` boolean (optional) _macOS_ _mas_ - Create [security scoped bookmarks](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store.
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create [security scoped bookmarks](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store.
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[]&#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).)
* `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[]&#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.
@@ -154,27 +154,27 @@ dialog.showOpenDialog(mainWindow, {
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `title` string (optional) - The dialog title. Cannot be displayed on some _Linux_ desktop environments.
* `defaultPath` string (optional) - Absolute directory path, absolute file
* `title` String (optional) - The dialog title. Cannot be displayed on some _Linux_ desktop environments.
* `defaultPath` String (optional) - Absolute directory path, absolute file
path, or file name to use by default.
* `buttonLabel` string (optional) - Custom label for the confirmation button, when
* `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)
* `message` string (optional) _macOS_ - Message to display above text fields.
* `nameFieldLabel` string (optional) _macOS_ - Custom label for the text
* `message` String (optional) _macOS_ - Message to display above text fields.
* `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,
* `showsTagField` Boolean (optional) _macOS_ - Show the tags input box,
defaults to `true`.
* `properties` string[]&#32;(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,
as a directory instead of a file.
* `showOverwriteConfirmation` _Linux_ - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.
* `dontAddToRecent` _Windows_ - Do not add the item being saved to the recent documents list.
* `securityScopedBookmarks` boolean (optional) _macOS_ _mas_ - Create a [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create a [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.
Returns `string | undefined`, the path of the file chosen by the user; if the dialog is cancelled it returns `undefined`.
Returns `String | undefined`, the path of the file chosen by the user; if the dialog is cancelled it returns `undefined`.
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
@@ -185,30 +185,30 @@ The `filters` specifies an array of file types that can be displayed, see
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `title` string (optional) - The dialog title. Cannot be displayed on some _Linux_ desktop environments.
* `defaultPath` string (optional) - Absolute directory path, absolute file
* `title` String (optional) - The dialog title. Cannot be displayed on some _Linux_ desktop environments.
* `defaultPath` String (optional) - Absolute directory path, absolute file
path, or file name to use by default.
* `buttonLabel` string (optional) - Custom label for the confirmation button, when
* `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)
* `message` string (optional) _macOS_ - Message to display above text fields.
* `nameFieldLabel` string (optional) _macOS_ - Custom label for the text
* `message` String (optional) _macOS_ - Message to display above text fields.
* `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[]&#32;(optional)
* `showsTagField` Boolean (optional) _macOS_ - Show the tags input box, defaults to `true`.
* `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,
as a directory instead of a file.
* `showOverwriteConfirmation` _Linux_ - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.
* `dontAddToRecent` _Windows_ - Do not add the item being saved to the recent documents list.
* `securityScopedBookmarks` boolean (optional) _macOS_ _mas_ - Create a [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create a [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.
Returns `Promise<Object>` - Resolve with an object containing the following:
* `canceled` boolean - whether or not the dialog was canceled.
* `filePath` string (optional) - If the dialog is canceled, this will be `undefined`.
* `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which contains the security scoped bookmark data for the saved file. `securityScopedBookmarks` must be enabled for this to be present. (For return values, see [table here](#bookmarks-array).)
* `canceled` Boolean - whether or not the dialog was canceled.
* `filePath` String (optional) - If the dialog is canceled, this will be `undefined`.
* `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which contains the security scoped bookmark data for the saved file. `securityScopedBookmarks` must be enabled for this to be present. (For return values, see [table here](#bookmarks-array).)
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
@@ -222,29 +222,29 @@ expanding and collapsing the dialog.
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `message` string - Content of the message box.
* `type` string (optional) - Can be `"none"`, `"info"`, `"error"`, `"question"` or
* `message` String - Content of the message box.
* `type` String (optional) - Can be `"none"`, `"info"`, `"error"`, `"question"` or
`"warning"`. On Windows, `"question"` displays the same icon as `"info"`, unless
you set an icon using the `"icon"` option. On macOS, both `"warning"` and
`"error"` display the same warning icon.
* `buttons` string[]&#32;(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.
* `title` string (optional) - Title of the message box, some platforms will not show it.
* `detail` string (optional) - Extra information of the message.
* `icon` ([NativeImage](native-image.md) | string) (optional)
* `title` String (optional) - Title of the message box, some platforms will not show it.
* `detail` String (optional) - Extra information of the message.
* `icon` ([NativeImage](native-image.md) | String) (optional)
* `textWidth` Integer (optional) _macOS_ - Custom width of the text in the message box.
* `cancelId` Integer (optional) - The index of the button to be used to cancel the dialog, via
the `Esc` key. By default this is assigned to the first button with "cancel" or "no" as the
label. If no such labeled buttons exist and this option is not set, `0` will be used as the
return value.
* `noLink` boolean (optional) - On Windows Electron will try to figure out which one of
* `noLink` Boolean (optional) - On Windows Electron will try to figure out which one of
the `buttons` are common buttons (like "Cancel" or "Yes"), and show the
others as command links in the dialog. This can make the dialog appear in
the style of modern Windows apps. If you don't like this behavior, you can
set `noLink` to `true`.
* `normalizeAccessKeys` boolean (optional) - Normalize the keyboard access keys
* `normalizeAccessKeys` Boolean (optional) - Normalize the keyboard access keys
across platforms. Default is `false`. Enabling this assumes `&` is used in
the button labels for the placement of the keyboard shortcut access key
and labels will be converted so they work correctly on each platform, `&`
@@ -265,12 +265,12 @@ If `browserWindow` is not shown dialog will not be attached to it. In such case
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `message` string - Content of the message box.
* `type` string (optional) - Can be `"none"`, `"info"`, `"error"`, `"question"` or
* `message` String - Content of the message box.
* `type` String (optional) - Can be `"none"`, `"info"`, `"error"`, `"question"` or
`"warning"`. On Windows, `"question"` displays the same icon as `"info"`, unless
you set an icon using the `"icon"` option. On macOS, both `"warning"` and
`"error"` display the same warning icon.
* `buttons` string[]&#32;(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.
@@ -279,24 +279,24 @@ If `browserWindow` is not shown dialog will not be attached to it. In such case
cancelled by the user. On macOS, `signal` does not work with message boxes
that do not have a parent window, since those message boxes run
synchronously due to platform limitations.
* `title` string (optional) - Title of the message box, some platforms will not show it.
* `detail` string (optional) - Extra information of the message.
* `checkboxLabel` string (optional) - If provided, the message box will
* `title` String (optional) - Title of the message box, some platforms will not show it.
* `detail` String (optional) - Extra information of the message.
* `checkboxLabel` String (optional) - If provided, the message box will
include a checkbox with the given label.
* `checkboxChecked` boolean (optional) - Initial checked state of the
* `checkboxChecked` Boolean (optional) - Initial checked state of the
checkbox. `false` by default.
* `icon` ([NativeImage](native-image.md) | string) (optional)
* `icon` [NativeImage](native-image.md) (optional)
* `textWidth` Integer (optional) _macOS_ - Custom width of the text in the message box.
* `cancelId` Integer (optional) - The index of the button to be used to cancel the dialog, via
the `Esc` key. By default this is assigned to the first button with "cancel" or "no" as the
label. If no such labeled buttons exist and this option is not set, `0` will be used as the
return value.
* `noLink` boolean (optional) - On Windows Electron will try to figure out which one of
* `noLink` Boolean (optional) - On Windows Electron will try to figure out which one of
the `buttons` are common buttons (like "Cancel" or "Yes"), and show the
others as command links in the dialog. This can make the dialog appear in
the style of modern Windows apps. If you don't like this behavior, you can
set `noLink` to `true`.
* `normalizeAccessKeys` boolean (optional) - Normalize the keyboard access keys
* `normalizeAccessKeys` Boolean (optional) - Normalize the keyboard access keys
across platforms. Default is `false`. Enabling this assumes `&` is used in
the button labels for the placement of the keyboard shortcut access key
and labels will be converted so they work correctly on each platform, `&`
@@ -307,8 +307,8 @@ If `browserWindow` is not shown dialog will not be attached to it. In such case
Returns `Promise<Object>` - resolves with a promise containing the following properties:
* `response` number - The index of the clicked button.
* `checkboxChecked` boolean - The checked state of the checkbox if
* `response` Number - The index of the clicked button.
* `checkboxChecked` Boolean - The checked state of the checkbox if
`checkboxLabel` was set. Otherwise `false`.
Shows a message box.
@@ -317,8 +317,8 @@ The `browserWindow` argument allows the dialog to attach itself to a parent wind
### `dialog.showErrorBox(title, content)`
* `title` string - The title to display in the error box.
* `content` string - The text content to display in the error box.
* `title` String - The title to display in the error box.
* `content` String - The text content to display in the error box.
Displays a modal dialog that shows an error message.
@@ -332,7 +332,7 @@ and no GUI dialog will appear.
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `certificate` [Certificate](structures/certificate.md) - The certificate to trust/import.
* `message` string - The message to display to the user.
* `message` String - The message to display to the user.
Returns `Promise<void>` - resolves when the certificate trust dialog is shown.

View File

@@ -16,7 +16,7 @@ app.dock.bounce()
#### `dock.bounce([type])` _macOS_
* `type` string (optional) - Can be `critical` or `informational`. The default is
* `type` String (optional) - Can be `critical` or `informational`. The default is
`informational`
Returns `Integer` - an ID representing the request.
@@ -28,7 +28,7 @@ When `informational` is passed, the dock icon will bounce for one second.
However, the request remains active until either the application becomes active
or the request is canceled.
**Note:** This method can only be used while the app is not focused; when the app is focused it will return -1.
**Nota Bene:** This method can only be used while the app is not focused; when the app is focused it will return -1.
#### `dock.cancelBounce(id)` _macOS_
@@ -38,19 +38,19 @@ Cancel the bounce of `id`.
#### `dock.downloadFinished(filePath)` _macOS_
* `filePath` string
* `filePath` String
Bounces the Downloads stack if the filePath is inside the Downloads folder.
#### `dock.setBadge(text)` _macOS_
* `text` string
* `text` String
Sets the string to be displayed in the docks badging area.
#### `dock.getBadge()` _macOS_
Returns `string` - The badge string of the dock.
Returns `String` - The badge string of the dock.
#### `dock.hide()` _macOS_
@@ -62,7 +62,7 @@ Returns `Promise<void>` - Resolves when the dock icon is shown.
#### `dock.isVisible()` _macOS_
Returns `boolean` - Whether the dock icon is visible.
Returns `Boolean` - Whether the dock icon is visible.
#### `dock.setMenu(menu)` _macOS_
@@ -76,6 +76,6 @@ Returns `Menu | null` - The application's [dock menu][dock-menu].
#### `dock.setIcon(image)` _macOS_
* `image` ([NativeImage](native-image.md) | string)
* `image` ([NativeImage](native-image.md) | String)
Sets the `image` associated with this dock icon.

View File

@@ -45,7 +45,7 @@ win.webContents.session.on('will-download', (event, item, webContents) => {
Returns:
* `event` Event
* `state` string - Can be `progressing` or `interrupted`.
* `state` String - Can be `progressing` or `interrupted`.
Emitted when the download has been updated and is not done.
@@ -59,7 +59,7 @@ The `state` can be one of following:
Returns:
* `event` Event
* `state` string - Can be `completed`, `cancelled` or `interrupted`.
* `state` String - Can be `completed`, `cancelled` or `interrupted`.
Emitted when the download is in a terminal state. This includes a completed
download, a cancelled download (via `downloadItem.cancel()`), and interrupted
@@ -77,7 +77,7 @@ The `downloadItem` object has the following methods:
#### `downloadItem.setSavePath(path)`
* `path` string - Set the save file path of the download item.
* `path` String - Set the save file path of the download item.
The API is only available in session's `will-download` callback function.
If `path` doesn't exist, Electron will try to make the directory recursively.
@@ -86,7 +86,7 @@ routine to determine the save path; this usually prompts a save dialog.
#### `downloadItem.getSavePath()`
Returns `string` - The save path of the download item. This will be either the path
Returns `String` - The save path of the download item. This will be either the path
set via `downloadItem.setSavePath(path)` or the path selected from the shown
save dialog.
@@ -109,7 +109,7 @@ Pauses the download.
#### `downloadItem.isPaused()`
Returns `boolean` - Whether the download is paused.
Returns `Boolean` - Whether the download is paused.
#### `downloadItem.resume()`
@@ -119,7 +119,7 @@ Resumes the download that has been paused.
#### `downloadItem.canResume()`
Returns `boolean` - Whether the download can resume.
Returns `Boolean` - Whether the download can resume.
#### `downloadItem.cancel()`
@@ -127,19 +127,19 @@ Cancels the download operation.
#### `downloadItem.getURL()`
Returns `string` - The origin URL where the item is downloaded from.
Returns `String` - The origin URL where the item is downloaded from.
#### `downloadItem.getMimeType()`
Returns `string` - The files mime type.
Returns `String` - The files mime type.
#### `downloadItem.hasUserGesture()`
Returns `boolean` - Whether the download has user gesture.
Returns `Boolean` - Whether the download has user gesture.
#### `downloadItem.getFilename()`
Returns `string` - The file name of the download item.
Returns `String` - The file name of the download item.
**Note:** The file name is not always the same as the actual one saved in local
disk. If user changes the file name in a prompted download saving dialog, the
@@ -157,27 +157,27 @@ Returns `Integer` - The received bytes of the download item.
#### `downloadItem.getContentDisposition()`
Returns `string` - The Content-Disposition field from the response
Returns `String` - The Content-Disposition field from the response
header.
#### `downloadItem.getState()`
Returns `string` - The current state. Can be `progressing`, `completed`, `cancelled` or `interrupted`.
Returns `String` - The current state. Can be `progressing`, `completed`, `cancelled` or `interrupted`.
**Note:** The following methods are useful specifically to resume a
`cancelled` item when session is restarted.
#### `downloadItem.getURLChain()`
Returns `string[]` - The complete URL chain of the item including any redirects.
Returns `String[]` - The complete URL chain of the item including any redirects.
#### `downloadItem.getLastModifiedTime()`
Returns `string` - Last-Modified header value.
Returns `String` - Last-Modified header value.
#### `downloadItem.getETag()`
Returns `string` - ETag header value.
Returns `String` - ETag header value.
#### `downloadItem.getStartTime()`
@@ -188,7 +188,7 @@ started.
#### `downloadItem.savePath`
A `string` property that determines the save file path of the download item.
A `String` property that determines the save file path of the download item.
The property is only available in session's `will-download` callback function.
If user doesn't set the save path via the property, Electron will use the original

View File

@@ -122,7 +122,7 @@ 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).
switches](./command-line-switches.md#enable-loggingfile).
### `ELECTRON_LOG_FILE`
@@ -130,7 +130,7 @@ 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).
switches](./command-line-switches.md#log-filepath).
### `ELECTRON_DEBUG_DRAG_REGIONS`
@@ -139,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

@@ -99,10 +99,7 @@ Only `chrome.storage.local` is supported; `chrome.storage.sync` and
The following methods of `chrome.tabs` are supported:
- `chrome.tabs.sendMessage`
- `chrome.tabs.reload`
- `chrome.tabs.executeScript`
- `chrome.tabs.update` (partial support)
- supported properties: `url`, `muted`.
> **Note:** In Chrome, passing `-1` as a tab ID signifies the "currently active
> tab". Since Electron has no such concept, passing `-1` as a tab ID is not

View File

@@ -47,7 +47,7 @@ The `globalShortcut` module has the following methods:
* `accelerator` [Accelerator](accelerator.md)
* `callback` Function
Returns `boolean` - Whether or not the shortcut was registered successfully.
Returns `Boolean` - Whether or not the shortcut was registered successfully.
Registers a global shortcut of `accelerator`. The `callback` is called when
the registered shortcut is pressed by the user.
@@ -66,7 +66,7 @@ the app has been authorized as a [trusted accessibility client](https://develope
### `globalShortcut.registerAll(accelerators, callback)`
* `accelerators` string[] - an array of [Accelerator](accelerator.md)s.
* `accelerators` String[] - an array of [Accelerator](accelerator.md)s.
* `callback` Function
Registers a global shortcut of all `accelerator` items in `accelerators`. The `callback` is called when any of the registered shortcuts are pressed by the user.
@@ -87,7 +87,7 @@ the app has been authorized as a [trusted accessibility client](https://develope
* `accelerator` [Accelerator](accelerator.md)
Returns `boolean` - Whether this application has registered `accelerator`.
Returns `Boolean` - Whether this application has registered `accelerator`.
When the accelerator is already taken by other applications, this call will
still return `false`. This behavior is intended by operating systems, since they

View File

@@ -23,16 +23,16 @@ The `inAppPurchase` module has the following methods:
### `inAppPurchase.purchaseProduct(productID[, quantity])`
* `productID` string - The identifiers of the product to purchase. (The identifier of `com.example.app.product1` is `product1`).
* `productID` String - The identifiers of the product to purchase. (The identifier of `com.example.app.product1` is `product1`).
* `quantity` Integer (optional) - The number of items the user wants to purchase.
Returns `Promise<boolean>` - Returns `true` if the product is valid and added to the payment queue.
Returns `Promise<Boolean>` - Returns `true` if the product is valid and added to the payment queue.
You should listen for the `transactions-updated` event as soon as possible and certainly before you call `purchaseProduct`.
### `inAppPurchase.getProducts(productIDs)`
* `productIDs` string[] - The identifiers of the products to get.
* `productIDs` String[] - The identifiers of the products to get.
Returns `Promise<Product[]>` - Resolves with an array of [`Product`](structures/product.md) objects.
@@ -40,7 +40,7 @@ Retrieves the product descriptions.
### `inAppPurchase.canMakePayments()`
Returns `boolean` - whether a user can make a payment.
Returns `Boolean` - whether a user can make a payment.
### `inAppPurchase.restoreCompletedTransactions()`
@@ -50,7 +50,7 @@ Restores finished transactions. This method can be called either to install purc
### `inAppPurchase.getReceiptURL()`
Returns `string` - the path to the receipt.
Returns `String` - the path to the receipt.
### `inAppPurchase.finishAllTransactions()`
@@ -58,6 +58,6 @@ Completes all pending transactions.
### `inAppPurchase.finishTransactionByDate(date)`
* `date` string - The ISO formatted date of the transaction to finish.
* `date` String - The ISO formatted date of the transaction to finish.
Completes the pending transactions corresponding to the date.

View File

@@ -48,7 +48,7 @@ An `Integer` indicating the HTTP response status code.
#### `response.statusMessage`
A `string` representing the HTTP status message.
A `String` representing the HTTP status message.
#### `response.headers`
@@ -66,7 +66,7 @@ formatted as follows:
#### `response.httpVersion`
A `string` indicating the HTTP protocol version number. Typical values are '1.0'
A `String` indicating the HTTP protocol version number. Typical values are '1.0'
or '1.1'. Additionally `httpVersionMajor` and `httpVersionMinor` are two
Integer-valued readable properties that return respectively the HTTP major and
minor version numbers.
@@ -80,25 +80,3 @@ An `Integer` indicating the HTTP protocol major version number.
An `Integer` indicating the HTTP protocol minor version number.
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
#### `response.rawHeaders`
A `string[]` containing the raw HTTP response headers exactly as they were
received. The keys and values are in the same list. It is not a list of
tuples. So, the even-numbered offsets are key values, and the odd-numbered
offsets are the associated values. Header names are not lowercased, and
duplicates are not merged.
```javascript
// Prints something like:
//
// [ 'user-agent',
// 'this is invalid because there can be only one',
// 'User-Agent',
// 'curl/7.22.0',
// 'Host',
// '127.0.0.1:8000',
// 'ACCEPT',
// '*/*' ]
console.log(request.rawHeaders)
```

View File

@@ -1,10 +1,3 @@
---
title: "ipcMain"
description: "Communicate asynchronously from the main process to renderer processes."
slug: ipc-main
hide_title: false
---
# ipcMain
> Communicate asynchronously from the main process to renderer processes.
@@ -16,9 +9,7 @@ process, it handles asynchronous and synchronous messages sent from a renderer
process (web page). Messages sent from a renderer will be emitted to this
module.
For usage examples, check out the [IPC tutorial].
## Sending messages
## Sending Messages
It is also possible to send messages from the main process to the renderer
process, see [webContents.send][web-contents-send] for more information.
@@ -30,15 +21,45 @@ process, see [webContents.send][web-contents-send] for more information.
coming from frames that aren't the main frame (e.g. iframes) whereas
`event.sender.send(...)` will always send to the main frame.
An example of sending and handling messages between the render and main
processes:
```javascript
// In main process.
const { ipcMain } = require('electron')
ipcMain.on('asynchronous-message', (event, arg) => {
console.log(arg) // prints "ping"
event.reply('asynchronous-reply', 'pong')
})
ipcMain.on('synchronous-message', (event, arg) => {
console.log(arg) // prints "ping"
event.returnValue = 'pong'
})
```
```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"
ipcRenderer.on('asynchronous-reply', (event, arg) => {
console.log(arg) // prints "pong"
})
ipcRenderer.send('asynchronous-message', 'ping')
```
## Methods
The `ipcMain` module has the following method to listen for events:
### `ipcMain.on(channel, listener)`
* `channel` string
* `channel` String
* `listener` Function
* `event` [IpcMainEvent][ipc-main-event]
* `event` IpcMainEvent
* `...args` any[]
Listens to `channel`, when a new message arrives `listener` would be called with
@@ -46,9 +67,9 @@ Listens to `channel`, when a new message arrives `listener` would be called with
### `ipcMain.once(channel, listener)`
* `channel` string
* `channel` String
* `listener` Function
* `event` [IpcMainEvent][ipc-main-event]
* `event` IpcMainEvent
* `...args` any[]
Adds a one time `listener` function for the event. This `listener` is invoked
@@ -56,7 +77,7 @@ only the next time a message is sent to `channel`, after which it is removed.
### `ipcMain.removeListener(channel, listener)`
* `channel` string
* `channel` String
* `listener` Function
* `...args` any[]
@@ -65,15 +86,15 @@ Removes the specified `listener` from the listener array for the specified
### `ipcMain.removeAllListeners([channel])`
* `channel` string (optional)
* `channel` String (optional)
Removes listeners of the specified `channel`.
### `ipcMain.handle(channel, listener)`
* `channel` string
* `listener` Function<Promise\<void&#62; | any&#62;
* `event` [IpcMainInvokeEvent][ipc-main-invoke-event]
* `channel` String
* `listener` Function<Promise\<void> | any>
* `event` IpcMainInvokeEvent
* `...args` any[]
Adds a handler for an `invoke`able IPC. This handler will be called whenever a
@@ -83,14 +104,14 @@ If `listener` returns a Promise, the eventual result of the promise will be
returned as a reply to the remote caller. Otherwise, the return value of the
listener will be used as the value of the reply.
```js title='Main Process'
```js
// Main process
ipcMain.handle('my-invokable-ipc', async (event, ...args) => {
const result = await somePromise(...args)
return result
})
```
```js title='Renderer Process'
// Renderer process
async () => {
const result = await ipcRenderer.invoke('my-invokable-ipc', arg1, arg2)
// ...
@@ -108,8 +129,8 @@ provided to the renderer process. Please refer to
### `ipcMain.handleOnce(channel, listener)`
* `channel` string
* `listener` Function<Promise\<void&#62; | any&#62;
* `channel` String
* `listener` Function<Promise\<void> | any>
* `event` IpcMainInvokeEvent
* `...args` any[]
@@ -118,23 +139,20 @@ Handles a single `invoke`able IPC message, then removes the listener. See
### `ipcMain.removeHandler(channel)`
* `channel` string
* `channel` String
Removes any handler for `channel`, if present.
## IpcMainEvent object
The documentation for the `event` object passed to the `callback` can be found
in the [`ipc-main-event`][ipc-main-event] structure docs.
in the [`ipc-main-event`](structures/ipc-main-event.md) structure docs.
## IpcMainInvokeEvent object
The documentation for the `event` object passed to `handle` callbacks can be
found in the [`ipc-main-invoke-event`][ipc-main-invoke-event]
found in the [`ipc-main-invoke-event`](structures/ipc-main-invoke-event.md)
structure docs.
[IPC tutorial]: ../tutorial/ipc.md
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
[web-contents-send]: ../api/web-contents.md#contentssendchannel-args
[ipc-main-event]:../api/structures/ipc-main-event.md
[ipc-main-invoke-event]:../api/structures/ipc-main-invoke-event.md
[web-contents-send]: web-contents.md#contentssendchannel-args

View File

@@ -1,10 +1,3 @@
---
title: "ipcRenderer"
description: "Communicate asynchronously from a renderer process to the main process."
slug: ipc-renderer
hide_title: false
---
# ipcRenderer
> Communicate asynchronously from a renderer process to the main process.
@@ -16,7 +9,7 @@ methods so you can send synchronous and asynchronous messages from the render
process (web page) to the main process. You can also receive replies from the
main process.
See [IPC tutorial](../tutorial/ipc.md) for code examples.
See [ipcMain](ipc-main.md) for code examples.
## Methods
@@ -24,7 +17,7 @@ The `ipcRenderer` module has the following method to listen for events and send
### `ipcRenderer.on(channel, listener)`
* `channel` string
* `channel` String
* `listener` Function
* `event` IpcRendererEvent
* `...args` any[]
@@ -34,7 +27,7 @@ Listens to `channel`, when a new message arrives `listener` would be called with
### `ipcRenderer.once(channel, listener)`
* `channel` string
* `channel` String
* `listener` Function
* `event` IpcRendererEvent
* `...args` any[]
@@ -44,7 +37,7 @@ only the next time a message is sent to `channel`, after which it is removed.
### `ipcRenderer.removeListener(channel, listener)`
* `channel` string
* `channel` String
* `listener` Function
* `...args` any[]
@@ -53,13 +46,13 @@ Removes the specified `listener` from the listener array for the specified
### `ipcRenderer.removeAllListeners(channel)`
* `channel` string
* `channel` String
Removes all listeners, or those of the specified `channel`.
### `ipcRenderer.send(channel, ...args)`
* `channel` string
* `channel` String
* `...args` any[]
Send an asynchronous message to the main process via `channel`, along with
@@ -77,7 +70,7 @@ throw an exception.
> them. Attempting to send such objects over IPC will result in an error.
The main process handles it by listening for `channel` with the
[`ipcMain`](./ipc-main.md) module.
[`ipcMain`](ipc-main.md) module.
If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRenderer.postMessage`](#ipcrendererpostmessagechannel-message-transfer).
@@ -85,7 +78,7 @@ If you want to receive a single response from the main process, like the result
### `ipcRenderer.invoke(channel, ...args)`
* `channel` string
* `channel` String
* `...args` any[]
Returns `Promise<any>` - Resolves with the response from the main process.
@@ -96,8 +89,16 @@ Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will no
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
throw an exception.
> **NOTE:** Sending non-standard JavaScript types such as DOM objects or
> special Electron objects will throw an exception.
>
> Since the main process does not have support for DOM objects such as
> `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
> Electron's IPC to the main process, as the main process would have no way to decode
> them. Attempting to send such objects over IPC will result in an error.
The main process should listen for `channel` with
[`ipcMain.handle()`](./ipc-main.md#ipcmainhandlechannel-listener).
[`ipcMain.handle()`](ipc-main.md#ipcmainhandlechannel-listener).
For example:
@@ -118,31 +119,16 @@ If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRender
If you do not need a response to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
> **Note**
> Sending non-standard JavaScript types such as DOM objects or
> special Electron objects will throw an exception.
>
> Since the main process does not have support for DOM objects such as
> `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
> Electron's IPC to the main process, as the main process would have no way to decode
> them. Attempting to send such objects over IPC will result in an error.
> **Note**
> If the handler in the main process throws an error,
> the promise returned by `invoke` will reject.
> However, the `Error` object in the renderer process
> will not be the same as the one thrown in the main process.
### `ipcRenderer.sendSync(channel, ...args)`
* `channel` string
* `channel` String
* `...args` any[]
Returns `any` - The value sent back by the [`ipcMain`](./ipc-main.md) handler.
Returns `any` - The value sent back by the [`ipcMain`](ipc-main.md) handler.
Send a message to the main process via `channel` and expect a result
synchronously. Arguments will be serialized with the [Structured Clone
Algorithm][SCA], just like [`window.postMessage`], so prototype chains will not be
Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will not be
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
throw an exception.
@@ -154,17 +140,17 @@ throw an exception.
> Electron's IPC to the main process, as the main process would have no way to decode
> them. Attempting to send such objects over IPC will result in an error.
The main process handles it by listening for `channel` with [`ipcMain`](./ipc-main.md) module,
The main process handles it by listening for `channel` with [`ipcMain`](ipc-main.md) module,
and replies by setting `event.returnValue`.
> :warning: **WARNING**: Sending a synchronous message will block the whole
> renderer process until the reply is received, so use this method only as a
> last resort. It's much better to use the asynchronous version,
> [`invoke()`](./ipc-renderer.md#ipcrendererinvokechannel-args).
> [`invoke()`](ipc-renderer.md#ipcrendererinvokechannel-args).
### `ipcRenderer.postMessage(channel, message, [transfer])`
* `channel` string
* `channel` String
* `message` any
* `transfer` MessagePort[] (optional)
@@ -172,7 +158,7 @@ Send a message to the main process, optionally transferring ownership of zero
or more [`MessagePort`][] objects.
The transferred `MessagePort` objects will be available in the main process as
[`MessagePortMain`](./message-port-main.md) objects by accessing the `ports`
[`MessagePortMain`](message-port-main.md) objects by accessing the `ports`
property of the emitted event.
For example:
@@ -194,15 +180,15 @@ documentation](https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel).
### `ipcRenderer.sendTo(webContentsId, channel, ...args)`
* `webContentsId` number
* `channel` string
* `webContentsId` Number
* `channel` String
* `...args` any[]
Sends a message to a window with `webContentsId` via `channel`.
### `ipcRenderer.sendToHost(channel, ...args)`
* `channel` string
* `channel` String
* `...args` any[]
Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
@@ -211,7 +197,7 @@ the host page instead of the main process.
## Event object
The documentation for the `event` object passed to the `callback` can be found
in the [`ipc-renderer-event`](./structures/ipc-renderer-event.md) structure docs.
in the [`ipc-renderer-event`](structures/ipc-renderer-event.md) structure docs.
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm

View File

@@ -14,40 +14,40 @@ 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`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`, `toggleTextReplacement`, `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
* `type` String (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
`radio`.
* `label` string (optional)
* `sublabel` string (optional)
* `toolTip` string (optional) _macOS_ - Hover text for this menu item.
* `label` String (optional)
* `sublabel` String (optional)
* `toolTip` String (optional) _macOS_ - Hover text for this menu item.
* `accelerator` [Accelerator](accelerator.md) (optional)
* `icon` ([NativeImage](native-image.md) | string) (optional)
* `enabled` boolean (optional) - If false, the menu item will be greyed out and
* `icon` ([NativeImage](native-image.md) | String) (optional)
* `enabled` Boolean (optional) - If false, the menu item will be greyed out and
unclickable.
* `acceleratorWorksWhenHidden` boolean (optional) _macOS_ - default is `true`, and when `false` will prevent the accelerator from triggering the item if the item is not visible`.
* `visible` boolean (optional) - If false, the menu item will be entirely hidden.
* `checked` boolean (optional) - Should only be specified for `checkbox` or `radio` type
* `acceleratorWorksWhenHidden` Boolean (optional) _macOS_ - default is `true`, and when `false` will prevent the accelerator from triggering the item if the item is not visible`.
* `visible` Boolean (optional) - If false, the menu item will be entirely hidden.
* `checked` Boolean (optional) - Should only be specified for `checkbox` or `radio` type
menu items.
* `registerAccelerator` boolean (optional) _Linux_ _Windows_ - If false, the accelerator won't be registered
* `registerAccelerator` Boolean (optional) _Linux_ _Windows_ - If false, the accelerator won't be registered
with the system, but it will still be displayed. Defaults to true.
* `sharingItem` SharingItem (optional) _macOS_ - The item to share when the `role` is `shareMenu`.
* `submenu` (MenuItemConstructorOptions[] | [Menu](menu.md)) (optional) - Should be specified
for `submenu` type menu items. If `submenu` is specified, the `type: 'submenu'` can be omitted.
If the value is not a [`Menu`](menu.md) then it will be automatically converted to one using
`Menu.buildFromTemplate`.
* `id` string (optional) - Unique within a single menu. If defined then it can be used
* `id` String (optional) - Unique within a single menu. If defined then it can be used
as a reference to this item by the position attribute.
* `before` string[] (optional) - Inserts this item before the item with the specified label. If
* `before` String[] (optional) - Inserts this item before the item with the specified label. If
the referenced item doesn't exist the item will be inserted at the end of the menu. Also implies
that the menu item in question should be placed in the same “group” as the item.
* `after` string[] (optional) - Inserts this item after the item with the specified label. If the
* `after` String[] (optional) - Inserts this item after the item with the specified label. If the
referenced item doesn't exist the item will be inserted at the end of
the menu.
* `beforeGroupContaining` string[] (optional) - Provides a means for a single context menu to declare
* `beforeGroupContaining` String[] (optional) - Provides a means for a single context menu to declare
the placement of their containing group before the containing group of the item
with the specified label.
* `afterGroupContaining` string[] (optional) - Provides a means for a single context menu to declare
* `afterGroupContaining` String[] (optional) - Provides a means for a single context menu to declare
the placement of their containing group after the containing group of the item
with the specified label.
@@ -100,10 +100,6 @@ The following additional roles are available on _macOS_:
* `hide` - Map to the `hide` action.
* `hideOthers` - Map to the `hideOtherApplications` action.
* `unhide` - Map to the `unhideAllApplications` action.
* `showSubstitutions` - Map to the `orderFrontSubstitutionsPanel` action.
* `toggleSmartQuotes` - Map to the `toggleAutomaticQuoteSubstitution` action.
* `toggleSmartDashes` - Map to the `toggleAutomaticDashSubstitution` action.
* `toggleTextReplacement` - Map to the `toggleAutomaticTextReplacement` action.
* `startSpeaking` - Map to the `startSpeaking` action.
* `stopSpeaking` - Map to the `stopSpeaking` action.
* `front` - Map to the `arrangeInFront` action.
@@ -124,7 +120,7 @@ When specifying a `role` on macOS, `label` and `accelerator` are the only
options that will affect the menu item. All other options will be ignored.
Lowercase `role`, e.g. `toggledevtools`, is still supported.
**Note:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
**Nota Bene:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
### Instance Properties
@@ -132,12 +128,12 @@ The following properties are available on instances of `MenuItem`:
#### `menuItem.id`
A `string` indicating the item's unique id, this property can be
A `String` indicating the item's unique id, this property can be
dynamically changed.
#### `menuItem.label`
A `string` indicating the item's visible label.
A `String` indicating the item's visible label.
#### `menuItem.click`
@@ -155,11 +151,11 @@ item's submenu, if present.
#### `menuItem.type`
A `string` indicating the type of the item. Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
A `String` indicating the type of the item. Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
#### `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`, `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`
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`
@@ -173,30 +169,30 @@ An `Accelerator | null` indicating the item's [user-assigned accelerator](https:
#### `menuItem.icon`
A `NativeImage | string` (optional) indicating the
A `NativeImage | String` (optional) indicating the
item's icon, if set.
#### `menuItem.sublabel`
A `string` indicating the item's sublabel.
A `String` indicating the item's sublabel.
#### `menuItem.toolTip` _macOS_
A `string` indicating the item's hover text.
A `String` indicating the item's hover text.
#### `menuItem.enabled`
A `boolean` indicating whether the item is enabled, this property can be
A `Boolean` indicating whether the item is enabled, this property can be
dynamically changed.
#### `menuItem.visible`
A `boolean` indicating whether the item is visible, this property can be
A `Boolean` indicating whether the item is visible, this property can be
dynamically changed.
#### `menuItem.checked`
A `boolean` indicating whether the item is checked, this property can be
A `Boolean` indicating whether the item is checked, this property can be
dynamically changed.
A `checkbox` menu item will toggle the `checked` property on and off when
@@ -209,7 +205,7 @@ You can add a `click` function for additional behavior.
#### `menuItem.registerAccelerator`
A `boolean` indicating if the accelerator should be registered with the
A `Boolean` indicating if the accelerator should be registered with the
system or just displayed.
This property can be dynamically changed.
@@ -222,7 +218,7 @@ This property can be dynamically changed.
#### `menuItem.commandId`
A `number` indicating an item's sequential unique id.
A `Number` indicating an item's sequential unique id.
#### `menuItem.menu`

View File

@@ -45,7 +45,7 @@ be dynamically modified.
#### `Menu.sendActionToFirstResponder(action)` _macOS_
* `action` string
* `action` String
Sends the `action` to the first responder of application. This is used for
emulating default macOS menu behaviors. Usually you would use the
@@ -73,11 +73,11 @@ The `menu` object has the following instance methods:
* `options` Object (optional)
* `window` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
* `x` number (optional) - Default is the current mouse cursor position.
* `x` Number (optional) - Default is the current mouse cursor position.
Must be declared if `y` is declared.
* `y` number (optional) - Default is the current mouse cursor position.
* `y` Number (optional) - Default is the current mouse cursor position.
Must be declared if `x` is declared.
* `positioningItem` number (optional) _macOS_ - The index of the menu item to
* `positioningItem` Number (optional) _macOS_ - The index of the menu item to
be positioned under the mouse cursor at the specified coordinates. Default
is -1.
* `callback` Function (optional) - Called when menu is closed.
@@ -98,7 +98,7 @@ Appends the `menuItem` to the menu.
#### `menu.getMenuItemById(id)`
* `id` string
* `id` String
Returns `MenuItem | null` the item with the specified `id`

View File

@@ -8,7 +8,7 @@ In Electron, for the APIs that take images, you can pass either file paths or
`NativeImage` instances. An empty image will be used when `null` is passed.
For example, when creating a tray or setting a window's icon, you can pass an
image file path as a `string`:
image file path as a `String`:
```javascript
const { BrowserWindow, Tray } = require('electron')
@@ -121,14 +121,14 @@ Creates an empty `NativeImage` instance.
### `nativeImage.createThumbnailFromPath(path, maxSize)` _macOS_ _Windows_
* `path` string - path to a file that we intend to construct a thumbnail out of.
* `path` String - path to a file that we intend to construct a thumbnail out of.
* `maxSize` [Size](structures/size.md) - the maximum width and height (positive numbers) the thumbnail returned can be. The Windows implementation will ignore `maxSize.height` and scale the height according to `maxSize.width`.
Returns `Promise<NativeImage>` - fulfilled with the file's thumbnail preview image, which is a [NativeImage](native-image.md).
### `nativeImage.createFromPath(path)`
* `path` string
* `path` String
Returns `NativeImage`
@@ -149,7 +149,7 @@ console.log(image)
* `options` Object
* `width` Integer
* `height` Integer
* `scaleFactor` Number (optional) - Defaults to 1.0.
* `scaleFactor` Double (optional) - Defaults to 1.0.
Returns `NativeImage`
@@ -162,7 +162,7 @@ pixel data returned by `toBitmap()`. The specific format is platform-dependent.
* `options` Object (optional)
* `width` Integer (optional) - Required for bitmap buffers.
* `height` Integer (optional) - Required for bitmap buffers.
* `scaleFactor` Number (optional) - Defaults to 1.0.
* `scaleFactor` Double (optional) - Defaults to 1.0.
Returns `NativeImage`
@@ -170,7 +170,7 @@ Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or JP
### `nativeImage.createFromDataURL(dataURL)`
* `dataURL` string
* `dataURL` String
Returns `NativeImage`
@@ -178,8 +178,8 @@ Creates a new `NativeImage` instance from `dataURL`.
### `nativeImage.createFromNamedImage(imageName[, hslShift])` _macOS_
* `imageName` string
* `hslShift` number[] (optional)
* `imageName` String
* `hslShift` Number[] (optional)
Returns `NativeImage`
@@ -225,7 +225,7 @@ The following methods are available on instances of the `NativeImage` class:
#### `image.toPNG([options])`
* `options` Object (optional)
* `scaleFactor` Number (optional) - Defaults to 1.0.
* `scaleFactor` Double (optional) - Defaults to 1.0.
Returns `Buffer` - A [Buffer][buffer] that contains the image's `PNG` encoded data.
@@ -238,7 +238,7 @@ Returns `Buffer` - A [Buffer][buffer] that contains the image's `JPEG` encoded d
#### `image.toBitmap([options])`
* `options` Object (optional)
* `scaleFactor` Number (optional) - Defaults to 1.0.
* `scaleFactor` Double (optional) - Defaults to 1.0.
Returns `Buffer` - A [Buffer][buffer] that contains a copy of the image's raw bitmap pixel
data.
@@ -246,14 +246,14 @@ data.
#### `image.toDataURL([options])`
* `options` Object (optional)
* `scaleFactor` Number (optional) - Defaults to 1.0.
* `scaleFactor` Double (optional) - Defaults to 1.0.
Returns `string` - The data URL of the image.
Returns `String` - The data URL of the image.
#### `image.getBitmap([options])`
* `options` Object (optional)
* `scaleFactor` Number (optional) - Defaults to 1.0.
* `scaleFactor` Double (optional) - Defaults to 1.0.
Returns `Buffer` - A [Buffer][buffer] that contains the image's raw bitmap pixel data.
@@ -272,11 +272,11 @@ image instead of a copy, so you _must_ ensure that the associated
#### `image.isEmpty()`
Returns `boolean` - Whether the image is empty.
Returns `Boolean` - Whether the image is empty.
#### `image.getSize([scaleFactor])`
* `scaleFactor` Number (optional) - Defaults to 1.0.
* `scaleFactor` Double (optional) - Defaults to 1.0.
Returns [`Size`](structures/size.md).
@@ -284,13 +284,13 @@ If `scaleFactor` is passed, this will return the size corresponding to the image
#### `image.setTemplateImage(option)`
* `option` boolean
* `option` Boolean
Marks the image as a template image.
#### `image.isTemplateImage()`
Returns `boolean` - Whether the image is a template image.
Returns `Boolean` - Whether the image is a template image.
#### `image.crop(rect)`
@@ -303,7 +303,7 @@ Returns `NativeImage` - The cropped image.
* `options` Object
* `width` Integer (optional) - Defaults to the image's width.
* `height` Integer (optional) - Defaults to the image's height.
* `quality` string (optional) - The desired quality of the resize image.
* `quality` String (optional) - The desired quality of the resize image.
Possible values are `good`, `better`, or `best`. The default is `best`.
These values express a desired quality/speed tradeoff. They are translated
into an algorithm-specific method that depends on the capabilities
@@ -317,26 +317,26 @@ will be preserved in the resized image.
#### `image.getAspectRatio([scaleFactor])`
* `scaleFactor` Number (optional) - Defaults to 1.0.
* `scaleFactor` Double (optional) - Defaults to 1.0.
Returns `Number` - The image's aspect ratio.
Returns `Float` - The image's aspect ratio.
If `scaleFactor` is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.
#### `image.getScaleFactors()`
Returns `Number[]` - An array of all scale factors corresponding to representations for a given nativeImage.
Returns `Float[]` - An array of all scale factors corresponding to representations for a given nativeImage.
#### `image.addRepresentation(options)`
* `options` Object
* `scaleFactor` Number (optional) - The scale factor to add the image representation for.
* `scaleFactor` Double - The scale factor to add the image representation for.
* `width` Integer (optional) - Defaults to 0. Required if a bitmap buffer
is specified as `buffer`.
* `height` Integer (optional) - Defaults to 0. Required if a bitmap buffer
is specified as `buffer`.
* `buffer` Buffer (optional) - The buffer containing the raw image data.
* `dataURL` string (optional) - The data URL containing either a base 64
* `dataURL` String (optional) - The data URL containing either a base 64
encoded PNG or JPEG image.
Add an image representation for a specific scale factor. This can be used
@@ -349,6 +349,6 @@ can be called on empty images.
#### `nativeImage.isMacTemplateImage` _macOS_
A `boolean` property that determines whether the image is considered a [template image](https://developer.apple.com/documentation/appkit/nsimage/1520017-template).
A `Boolean` property that determines whether the image is considered a [template image](https://developer.apple.com/documentation/appkit/nsimage/1520017-template).
Please note that this property only has an effect on macOS.

View File

@@ -21,13 +21,13 @@ The `nativeTheme` module has the following properties:
### `nativeTheme.shouldUseDarkColors` _Readonly_
A `boolean` for if the OS / Chromium currently has a dark mode enabled or is
A `Boolean` for if the OS / Chromium currently has a dark mode enabled or is
being instructed to show a dark-style UI. If you want to modify this value you
should use `themeSource` below.
### `nativeTheme.themeSource`
A `string` property that can be `system`, `light` or `dark`. It is used to override and supersede
A `String` property that can be `system`, `light` or `dark`. It is used to override and supersede
the value that Chromium has chosen to use internally.
Setting this property to `system` will remove the override and
@@ -60,15 +60,10 @@ Your application should then always use `shouldUseDarkColors` to determine what
### `nativeTheme.shouldUseHighContrastColors` _macOS_ _Windows_ _Readonly_
A `boolean` for if the OS / Chromium currently has high-contrast mode enabled
A `Boolean` for if the OS / Chromium currently has high-contrast mode enabled
or is being instructed to show a high-contrast UI.
### `nativeTheme.shouldUseInvertedColorScheme` _macOS_ _Windows_ _Readonly_
A `boolean` for if the OS / Chromium currently has an inverted color scheme
A `Boolean` for if the OS / Chromium currently has an inverted color scheme
or is being instructed to use an inverted color scheme.
### `nativeTheme.inForcedColorsMode` _Windows_ _Readonly_
A `boolean` indicating whether Chromium is in forced colors mode, controlled by system accessibility settings.
Currently, Windows high contrast is the only system setting that triggers forced colors mode.

View File

@@ -24,14 +24,14 @@ of the `app` module gets emitted.
### `netLog.startLogging(path[, options])`
* `path` string - File path to record network logs.
* `path` String - File path to record network logs.
* `options` Object (optional)
* `captureMode` string (optional) - What kinds of data should be captured. By
* `captureMode` String (optional) - What kinds of data should be captured. By
default, only metadata about requests will be captured. Setting this to
`includeSensitive` will include cookies and authentication data. Setting
it to `everything` will include all bytes transferred on sockets. Can be
`default`, `includeSensitive` or `everything`.
* `maxFileSize` number (optional) - When the log grows beyond this size,
* `maxFileSize` Number (optional) - When the log grows beyond this size,
logging will automatically stop. Defaults to unlimited.
Returns `Promise<void>` - resolves when the net log has begun recording.
@@ -48,4 +48,4 @@ Stops recording network events. If not called, net logging will automatically en
### `netLog.currentlyLogging` _Readonly_
A `boolean` property that indicates whether network logs are currently being recorded.
A `Boolean` property that indicates whether network logs are currently being recorded.

View File

@@ -54,7 +54,7 @@ The `net` module has the following methods:
### `net.request(options)`
* `options` (ClientRequestConstructorOptions | string) - The `ClientRequest` constructor options.
* `options` (ClientRequestConstructorOptions | String) - The `ClientRequest` constructor options.
Returns [`ClientRequest`](./client-request.md)
@@ -65,7 +65,7 @@ requests according to the specified protocol scheme in the `options` object.
### `net.isOnline()`
Returns `boolean` - Whether there is currently internet connection.
Returns `Boolean` - Whether there is currently internet connection.
A return value of `false` is a pretty strong indicator that the user
won't be able to connect to remote sites. However, a return value of
@@ -77,7 +77,7 @@ will be successful.
### `net.online` _Readonly_
A `boolean` property. Whether there is currently internet connection.
A `Boolean` property. Whether there is currently internet connection.
A return value of `false` is a pretty strong indicator that the user
won't be able to connect to remote sites. However, a return value of

View File

@@ -24,24 +24,24 @@ The `Notification` class has the following static methods:
#### `Notification.isSupported()`
Returns `boolean` - Whether or not desktop notifications are supported on the current system
Returns `Boolean` - Whether or not desktop notifications are supported on the current system
### `new Notification([options])`
* `options` Object (optional)
* `title` string (optional) - A title for the notification, which will be shown at the top of the notification window when it is shown.
* `subtitle` string (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
* `body` string (optional) - The body text of the notification, which will be displayed below the title or subtitle.
* `silent` boolean (optional) - Whether or not to emit an OS notification noise when showing the notification.
* `icon` (string | [NativeImage](native-image.md)) (optional) - An icon to use in the notification.
* `hasReply` boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
* `timeoutType` string (optional) _Linux_ _Windows_ - The timeout duration of the notification. Can be 'default' or 'never'.
* `replyPlaceholder` string (optional) _macOS_ - The placeholder to write in the inline reply input field.
* `sound` string (optional) _macOS_ - The name of the sound file to play when the notification is shown.
* `urgency` string (optional) _Linux_ - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
* `title` String (optional) - A title for the notification, which will be shown at the top of the notification window when it is shown.
* `subtitle` String (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
* `body` String (optional) - The body text of the notification, which will be displayed below the title or subtitle.
* `silent` Boolean (optional) - Whether or not to emit an OS notification noise when showing the notification.
* `icon` (String | [NativeImage](native-image.md)) (optional) - An icon to use in the notification.
* `hasReply` Boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
* `timeoutType` String (optional) _Linux_ _Windows_ - The timeout duration of the notification. Can be 'default' or 'never'.
* `replyPlaceholder` String (optional) _macOS_ - The placeholder to write in the inline reply input field.
* `sound` String (optional) _macOS_ - The name of the sound file to play when the notification is shown.
* `urgency` String (optional) _Linux_ - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
* `actions` [NotificationAction[]](structures/notification-action.md) (optional) _macOS_ - Actions to add to the notification. Please read the available actions and limitations in the `NotificationAction` documentation.
* `closeButtonText` string (optional) _macOS_ - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.
* `toastXml` string (optional) _Windows_ - A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.
* `closeButtonText` String (optional) _macOS_ - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.
* `toastXml` String (optional) _Windows_ - A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.
### Instance Events
@@ -84,7 +84,7 @@ is closed.
Returns:
* `event` Event
* `reply` string - The string the user entered into the inline reply field.
* `reply` String - The string the user entered into the inline reply field.
Emitted when the user clicks the "Reply" button on a notification with `hasReply: true`.
@@ -93,14 +93,14 @@ Emitted when the user clicks the "Reply" button on a notification with `hasReply
Returns:
* `event` Event
* `index` number - The index of the action that was activated.
* `index` Number - The index of the action that was activated.
#### Event: 'failed' _Windows_
Returns:
* `event` Event
* `error` string - The error encountered during execution of the `show()` method.
* `error` String - The error encountered during execution of the `show()` method.
Emitted when an error is encountered while creating and showing the native notification.
@@ -126,45 +126,45 @@ Dismisses the notification.
#### `notification.title`
A `string` property representing the title of the notification.
A `String` property representing the title of the notification.
#### `notification.subtitle`
A `string` property representing the subtitle of the notification.
A `String` property representing the subtitle of the notification.
#### `notification.body`
A `string` property representing the body of the notification.
A `String` property representing the body of the notification.
#### `notification.replyPlaceholder`
A `string` property representing the reply placeholder of the notification.
A `String` property representing the reply placeholder of the notification.
#### `notification.sound`
A `string` property representing the sound of the notification.
A `String` property representing the sound of the notification.
#### `notification.closeButtonText`
A `string` property representing the close button text of the notification.
A `String` property representing the close button text of the notification.
#### `notification.silent`
A `boolean` property representing whether the notification is silent.
A `Boolean` property representing whether the notification is silent.
#### `notification.hasReply`
A `boolean` property representing whether the notification has a reply action.
A `Boolean` property representing whether the notification has a reply action.
#### `notification.urgency` _Linux_
A `string` property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.
A `String` property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.
Default is 'low' - see [NotifyUrgency](https://developer.gnome.org/notification-spec/#urgency-levels) for more information.
#### `notification.timeoutType` _Linux_ _Windows_
A `string` property representing the type of timeout duration for the notification. Can be 'default' or 'never'.
A `String` property representing the type of timeout duration for the notification. Can be 'default' or 'never'.
If `timeoutType` is set to 'never', the notification never expires. It stays open until closed by the calling API or the user.
@@ -174,7 +174,7 @@ A [`NotificationAction[]`](structures/notification-action.md) property represent
#### `notification.toastXml` _Windows_
A `string` property representing the custom Toast XML of the notification.
A `String` property representing the custom Toast XML of the notification.
### Playing Sounds

View File

@@ -55,7 +55,7 @@ The `powerMonitor` module has the following methods:
* `idleThreshold` Integer
Returns `string` - The system's current state. Can be `active`, `idle`, `locked` or `unknown`.
Returns `String` - The system's current state. Can be `active`, `idle`, `locked` or `unknown`.
Calculate the system idle state. `idleThreshold` is the amount of time (in seconds)
before considered idle. `locked` is available on supported systems only.
@@ -68,7 +68,7 @@ Calculate system idle time in seconds.
### `powerMonitor.isOnBatteryPower()`
Returns `boolean` - Whether the system is on battery power.
Returns `Boolean` - Whether the system is on battery power.
To monitor for changes in this property, use the `on-battery` and `on-ac`
events.
@@ -77,6 +77,6 @@ events.
### `powerMonitor.onBatteryPower`
A `boolean` property. True if the system is on battery power.
A `Boolean` property. True if the system is on battery power.
See [`powerMonitor.isOnBatteryPower()`](#powermonitorisonbatterypower).

View File

@@ -21,7 +21,7 @@ The `powerSaveBlocker` module has the following methods:
### `powerSaveBlocker.start(type)`
* `type` string - Power save blocker type.
* `type` String - Power save blocker type.
* `prevent-app-suspension` - Prevent the application from being suspended.
Keeps system active but allows screen to be turned off. Example use cases:
downloading a file or playing audio.
@@ -53,4 +53,4 @@ Stops the specified power save blocker.
* `id` Integer - The power save blocker id returned by `powerSaveBlocker.start`.
Returns `boolean` - Whether the corresponding `powerSaveBlocker` has started.
Returns `Boolean` - Whether the corresponding `powerSaveBlocker` has started.

View File

@@ -49,66 +49,66 @@ beginning to load the web page or the main script.
### `process.defaultApp` _Readonly_
A `boolean`. When app is started by being passed as parameter to the default app, this
A `Boolean`. When app is started by being passed as parameter to the default app, this
property is `true` in the main process, otherwise it is `undefined`.
### `process.isMainFrame` _Readonly_
A `boolean`, `true` when the current renderer context is the "main" renderer
A `Boolean`, `true` when the current renderer context is the "main" renderer
frame. If you want the ID of the current frame you should use `webFrame.routingId`.
### `process.mas` _Readonly_
A `boolean`. For Mac App Store build, this property is `true`, for other builds it is
A `Boolean`. For Mac App Store build, this property is `true`, for other builds it is
`undefined`.
### `process.noAsar`
A `boolean` that controls ASAR support inside your application. Setting this to `true`
A `Boolean` that controls ASAR support inside your application. Setting this to `true`
will disable the support for `asar` archives in Node's built-in modules.
### `process.noDeprecation`
A `boolean` that controls whether or not deprecation warnings are printed to `stderr`.
A `Boolean` that controls whether or not deprecation warnings are printed to `stderr`.
Setting this to `true` will silence deprecation warnings. This property is used
instead of the `--no-deprecation` command line flag.
### `process.resourcesPath` _Readonly_
A `string` representing the path to the resources directory.
A `String` representing the path to the resources directory.
### `process.sandboxed` _Readonly_
A `boolean`. When the renderer process is sandboxed, this property is `true`,
A `Boolean`. When the renderer process is sandboxed, this property is `true`,
otherwise it is `undefined`.
### `process.contextIsolated` _Readonly_
A `boolean` that indicates whether the current renderer context has `contextIsolation` enabled.
A `Boolean` that indicates whether the current renderer context has `contextIsolation` enabled.
It is `undefined` in the main process.
### `process.throwDeprecation`
A `boolean` that controls whether or not deprecation warnings will be thrown as
A `Boolean` that controls whether or not deprecation warnings will be thrown as
exceptions. Setting this to `true` will throw errors for deprecations. This
property is used instead of the `--throw-deprecation` command line flag.
### `process.traceDeprecation`
A `boolean` that controls whether or not deprecations printed to `stderr` include
A `Boolean` that controls whether or not deprecations printed to `stderr` include
their stack trace. Setting this to `true` will print stack traces for deprecations.
This property is instead of the `--trace-deprecation` command line flag.
### `process.traceProcessWarnings`
A `boolean` that controls whether or not process warnings printed to `stderr` include
A `Boolean` that controls whether or not process warnings printed to `stderr` include
their stack trace. Setting this to `true` will print stack traces for process warnings
(including deprecations). This property is instead of the `--trace-warnings` command
line flag.
### `process.type` _Readonly_
A `string` representing the current process's type, can be:
A `String` representing the current process's type, can be:
* `browser` - The main process
* `renderer` - A renderer process
@@ -116,20 +116,20 @@ A `string` representing the current process's type, can be:
### `process.versions.chrome` _Readonly_
A `string` representing Chrome's version string.
A `String` representing Chrome's version string.
### `process.versions.electron` _Readonly_
A `string` representing Electron's version string.
A `String` representing Electron's version string.
### `process.windowsStore` _Readonly_
A `boolean`. If the app is running as a Windows Store app (appx), this property is `true`,
A `Boolean`. If the app is running as a Windows Store app (appx), this property is `true`,
for otherwise it is `undefined`.
### `process.contextId` _Readonly_
A `string` (optional) representing a globally unique ID of the current JavaScript context.
A `String` (optional) representing a globally unique ID of the current JavaScript context.
Each frame has its own JavaScript context. When contextIsolation is enabled, the isolated
world also has a separate JavaScript context.
This property is only available in the renderer process.
@@ -144,7 +144,7 @@ Causes the main thread of the current process crash.
### `process.getCreationTime()`
Returns `number | null` - The number of milliseconds since epoch, or `null` if the information is unavailable
Returns `Number | null` - The number of milliseconds since epoch, or `null` if the information is unavailable
Indicates the creation time of the application.
The time is represented as number of milliseconds since epoch. It returns null if it is unable to get the process creation time.
@@ -169,7 +169,7 @@ Returns `Object`:
* `heapSizeLimit` Integer
* `mallocedMemory` Integer
* `peakMallocedMemory` Integer
* `doesZapGarbage` boolean
* `doesZapGarbage` Boolean
Returns an object with V8 heap statistics. Note that all statistics are reported in Kilobytes.
@@ -178,6 +178,7 @@ Returns an object with V8 heap statistics. Note that all statistics are reported
Returns `Object`:
* `allocated` Integer - Size of all allocated objects in Kilobytes.
* `marked` Integer - Size of all marked objects in Kilobytes.
* `total` Integer - Total allocated space in Kilobytes.
Returns an object with Blink memory information.
@@ -216,7 +217,7 @@ that all statistics are reported in Kilobytes.
### `process.getSystemVersion()`
Returns `string` - The version of the host operating system.
Returns `String` - The version of the host operating system.
Example:
@@ -232,9 +233,9 @@ console.log(version)
### `process.takeHeapSnapshot(filePath)`
* `filePath` string - Path to the output file.
* `filePath` String - Path to the output file.
Returns `boolean` - Indicates whether the snapshot has been created successfully.
Returns `Boolean` - Indicates whether the snapshot has been created successfully.
Takes a V8 heap snapshot and saves it to `filePath`.

View File

@@ -10,12 +10,11 @@ An example of implementing a protocol that has the same effect as the
```javascript
const { app, protocol } = require('electron')
const path = require('path')
const url = require('url')
app.whenReady().then(() => {
protocol.registerFileProtocol('atom', (request, callback) => {
const filePath = url.fileURLToPath('file://' + request.url.slice('atom://'.length))
callback(filePath)
const url = request.url.substr(7)
callback({ path: path.normalize(`${__dirname}/${url}`) })
})
})
```
@@ -111,13 +110,13 @@ expect streaming responses.
### `protocol.registerFileProtocol(scheme, handler)`
* `scheme` string
* `scheme` String
* `handler` Function
* `request` [ProtocolRequest](structures/protocol-request.md)
* `callback` Function
* `response` (string | [ProtocolResponse](structures/protocol-response.md))
* `response` (String | [ProtocolResponse](structures/protocol-response.md))
Returns `boolean` - Whether the protocol was successfully registered
Returns `Boolean` - Whether the protocol was successfully registered
Registers a protocol of `scheme` that will send a file as the response. The
`handler` will be called with `request` and `callback` where `request` is
@@ -132,13 +131,13 @@ from protocols that follow the "generic URI syntax" like `file:`.
### `protocol.registerBufferProtocol(scheme, handler)`
* `scheme` string
* `scheme` String
* `handler` Function
* `request` [ProtocolRequest](structures/protocol-request.md)
* `callback` Function
* `response` (Buffer | [ProtocolResponse](structures/protocol-response.md))
Returns `boolean` - Whether the protocol was successfully registered
Returns `Boolean` - Whether the protocol was successfully registered
Registers a protocol of `scheme` that will send a `Buffer` as a response.
@@ -156,29 +155,29 @@ protocol.registerBufferProtocol('atom', (request, callback) => {
### `protocol.registerStringProtocol(scheme, handler)`
* `scheme` string
* `scheme` String
* `handler` Function
* `request` [ProtocolRequest](structures/protocol-request.md)
* `callback` Function
* `response` (string | [ProtocolResponse](structures/protocol-response.md))
* `response` (String | [ProtocolResponse](structures/protocol-response.md))
Returns `boolean` - Whether the protocol was successfully registered
Returns `Boolean` - Whether the protocol was successfully registered
Registers a protocol of `scheme` that will send a `string` as a response.
Registers a protocol of `scheme` that will send a `String` as a response.
The usage is the same with `registerFileProtocol`, except that the `callback`
should be called with either a `string` or an object that has the `data`
should be called with either a `String` or an object that has the `data`
property.
### `protocol.registerHttpProtocol(scheme, handler)`
* `scheme` string
* `scheme` String
* `handler` Function
* `request` [ProtocolRequest](structures/protocol-request.md)
* `callback` Function
* `response` [ProtocolResponse](structures/protocol-response.md)
* `response` ProtocolResponse
Returns `boolean` - Whether the protocol was successfully registered
Returns `Boolean` - Whether the protocol was successfully registered
Registers a protocol of `scheme` that will send an HTTP request as a response.
@@ -187,13 +186,13 @@ should be called with an object that has the `url` property.
### `protocol.registerStreamProtocol(scheme, handler)`
* `scheme` string
* `scheme` String
* `handler` Function
* `request` [ProtocolRequest](structures/protocol-request.md)
* `callback` Function
* `response` (ReadableStream | [ProtocolResponse](structures/protocol-response.md))
Returns `boolean` - Whether the protocol was successfully registered
Returns `Boolean` - Whether the protocol was successfully registered
Registers a protocol of `scheme` that will send a stream as a response.
@@ -236,95 +235,95 @@ protocol.registerStreamProtocol('atom', (request, callback) => {
### `protocol.unregisterProtocol(scheme)`
* `scheme` string
* `scheme` String
Returns `boolean` - Whether the protocol was successfully unregistered
Returns `Boolean` - Whether the protocol was successfully unregistered
Unregisters the custom protocol of `scheme`.
### `protocol.isProtocolRegistered(scheme)`
* `scheme` string
* `scheme` String
Returns `boolean` - Whether `scheme` is already registered.
Returns `Boolean` - Whether `scheme` is already registered.
### `protocol.interceptFileProtocol(scheme, handler)`
* `scheme` string
* `scheme` String
* `handler` Function
* `request` [ProtocolRequest](structures/protocol-request.md)
* `callback` Function
* `response` (string | [ProtocolResponse](structures/protocol-response.md))
* `response` (String | [ProtocolResponse](structures/protocol-response.md))
Returns `boolean` - Whether the protocol was successfully intercepted
Returns `Boolean` - Whether the protocol was successfully intercepted
Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
which sends a file as a response.
### `protocol.interceptStringProtocol(scheme, handler)`
* `scheme` string
* `scheme` String
* `handler` Function
* `request` [ProtocolRequest](structures/protocol-request.md)
* `callback` Function
* `response` (string | [ProtocolResponse](structures/protocol-response.md))
* `response` (String | [ProtocolResponse](structures/protocol-response.md))
Returns `boolean` - Whether the protocol was successfully intercepted
Returns `Boolean` - Whether the protocol was successfully intercepted
Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
which sends a `string` as a response.
which sends a `String` as a response.
### `protocol.interceptBufferProtocol(scheme, handler)`
* `scheme` string
* `scheme` String
* `handler` Function
* `request` [ProtocolRequest](structures/protocol-request.md)
* `callback` Function
* `response` (Buffer | [ProtocolResponse](structures/protocol-response.md))
Returns `boolean` - Whether the protocol was successfully intercepted
Returns `Boolean` - Whether the protocol was successfully intercepted
Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
which sends a `Buffer` as a response.
### `protocol.interceptHttpProtocol(scheme, handler)`
* `scheme` string
* `scheme` String
* `handler` Function
* `request` [ProtocolRequest](structures/protocol-request.md)
* `callback` Function
* `response` [ProtocolResponse](structures/protocol-response.md)
Returns `boolean` - Whether the protocol was successfully intercepted
Returns `Boolean` - Whether the protocol was successfully intercepted
Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
which sends a new HTTP request as a response.
### `protocol.interceptStreamProtocol(scheme, handler)`
* `scheme` string
* `scheme` String
* `handler` Function
* `request` [ProtocolRequest](structures/protocol-request.md)
* `callback` Function
* `response` (ReadableStream | [ProtocolResponse](structures/protocol-response.md))
Returns `boolean` - Whether the protocol was successfully intercepted
Returns `Boolean` - Whether the protocol was successfully intercepted
Same as `protocol.registerStreamProtocol`, except that it replaces an existing
protocol handler.
### `protocol.uninterceptProtocol(scheme)`
* `scheme` string
* `scheme` String
Returns `boolean` - Whether the protocol was successfully unintercepted
Returns `Boolean` - Whether the protocol was successfully unintercepted
Remove the interceptor installed for `scheme` and restore its original handler.
### `protocol.isProtocolIntercepted(scheme)`
* `scheme` string
* `scheme` String
Returns `boolean` - Whether `scheme` is already intercepted.
Returns `Boolean` - Whether `scheme` is already intercepted.
[file-system-api]: https://developer.mozilla.org/en-US/docs/Web/API/LocalFileSystem

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