The isFocused() method on macOS works by checking if the selected
BrowserWindow is a key window. Unfortunately, this didn't work well
with blur() because it wasn't calling any macOS APIs that would change
the key status of the window. Hence, this changes the implementation of
blur() to call orderOut first, which removes the key
status of the window. Then when the orderBack function is called, it
moves the window to the back of its level in the screen list, without
changing the key window.
Fixes: https://github.com/electron/electron/issues/33732
Signed-off-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: Darshan Sen <raisinten@gmail.com>
* build: improve CI speeds and reduce CI costs (#33904)
* rely on src cache instead of workspace
* run some tasks in the background and "thread join" later
* merge some ninja build commands to reduce overhead
* remove third_party/electron_node:overlapped-checker
Target is not present in older branches
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* chore: bump chromium in DEPS to 102.0.5005.3
* chore: bump chromium in DEPS to 102.0.5005.2
* chore: bump chromium in DEPS to 102.0.5005.12
* chore: bump chromium to 102.0.4999.0 (main) (#33731)
* chore: bump chromium in DEPS to 102.0.4999.0
* 3576640: Set OOM handler during V8 initialization
https://chromium-review.googlesource.com/c/chromium/src/+/3576640
* 3574964: Remove deprecated base::Value usage in print_settings_conversion code.
https://chromium-review.googlesource.com/c/chromium/src/+/3574964
* 3570062: Replicate Active state to render process for all RenderViews.
https://chromium-review.googlesource.com/c/chromium/src/+/3570062
* chore: fixup patch indices
* 3380402: Remove legacy SwiftShader
https://chromium-review.googlesource.com/c/chromium/src/+/3380402
* 3570254: [Local Fonts] Rename permission name from FONT_ACCESS to LOCAL_FONTS.
https://chromium-review.googlesource.com/c/chromium/src/+/3570254
* 3572172: Rename or remove several parameters involved in creation of MimeHandler streams
https://chromium-review.googlesource.com/c/chromium/src/+/3572172
* fix: add missing base/bits include
* chore: fix lint
* chore: remove ia32 Linux support
* chore: patch out swift-format cipd dep on macOS
* build: apply patch better
* build: reset all caches
* build: update zip manifests to remove swiftshared libraries
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3380402
* Revert "build: update zip manifests to remove swiftshared libraries"
This reverts commit 6aeec01ef1a79425a7b7d8c1cfb131a26b91c494.
* Revert "3380402: Remove legacy SwiftShader"
This reverts commit 4c7eebbbf2d0a459cc192959e17ae20f970c2da2.
* build: remove unused swiftshader egl libraries
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Attard <sattard@salesforce.com>
(cherry picked from commit f3e0517b6e)
* chore: update patch after cherry-pick from main roller pr
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* chore: bump chromium in DEPS to 102.0.4975.0
* chore: bump chromium in DEPS to 102.0.4977.0
* chore: bump chromium in DEPS to 102.0.4979.0
* chore: bump chromium in DEPS to 102.0.4981.0
* chore: bump chromium in DEPS to 102.0.4983.0
* chore: bump chromium in DEPS to 102.0.4985.0
* chore: bump chromium in DEPS to 102.0.4987.0
* chore: bump chromium in DEPS to 102.0.4989.0
* chore: bump chromium in DEPS to 102.0.4991.0
* chore: bump chromium in DEPS to 102.0.4993.0
* chore: bump chromium in DEPS to 102.0.4995.0
* chore: bump chromium in DEPS to 102.0.4997.0
* chore: bump chromium in DEPS to 102.0.4999.0
* chore: bump chromium in DEPS to 102.0.5001.0
* chore: bump chromium in DEPS to 102.0.5003.0
* chore: bump chromium in DEPS to 102.0.5005.0
* chore: bump chromium in DEPS to 102.0.5005.3
* chore: bump chromium to 102.0.4989.0 (main) (#33557)
* chore: bump chromium in DEPS to 102.0.4975.0
* chore: bump chromium in DEPS to 102.0.4977.0
* chore: update patches
* Remove parameter of OnGpuProcessCrashed()
https://chromium-review.googlesource.com/c/chromium/src/+/3543396
* hid: Add exclusionFilters option to requestDevice
https://chromium-review.googlesource.com/c/chromium/src/+/3478175
* chore: bump chromium in DEPS to 102.0.4979.0
* chore: bump chromium in DEPS to 102.0.4981.0
* chore: update patches
* Deny notification/push permission for documents in non-standard StoragePartitions
https://chromium-review.googlesource.com/c/chromium/src/+/3257305
* Improve FrameTreeNode tracking in URLLoaderNetworkContext
https://chromium-review.googlesource.com/c/chromium/src/+/3341866
* fixup! Remove parameter of OnGpuProcessCrashed()
* chore: fix lint
* Reland "Use gfx::Insets[F]::TLBR() and gfx::Insets[F]::VH() in the rest of Chrome"
https://chromium-review.googlesource.com/c/chromium/src/+/3554236
* chore: bump chromium in DEPS to 102.0.4983.0
* Ensure EyeDropperView does not access a destroyed window
https://chromium-review.googlesource.com/c/chromium/src/+/3561542
* ci: don't delete dawn .git directory
83901: Adds a generated file with the dawn git hash encoded at build time. | https://dawn-review.googlesource.com/c/dawn/+/83901
* ci: update Windows toolchain
3550827: New toolchain for Windows 10 20348 SDK | https://chromium-review.googlesource.com/c/chromium/src/+/3550827
* chore: bump chromium in DEPS to 102.0.4985.0
* chore: update patches
* chore: bump chromium in DEPS to 102.0.4987.0
* chore: update patches
* 3563432: codehealth: remove uses of DictionaryValue in cbui/webui
https://chromium-review.googlesource.com/c/chromium/src/+/3563432
* chore: update patches after rebase
* Use gfx::Insets[F]::TLBR() and gfx::Insets[F]::VH() in the rest of Chrome
https://chromium-review.googlesource.com/c/chromium/src/+/3554236
* 3565724: Preserve "proper method names" as-is in error.stack.
https://chromium-review.googlesource.com/c/v8/v8/+/3565724
* chore: bump chromium in DEPS to 102.0.4989.0
* chore: update patches
* fixup ci: don't delete dawn .git directory for Windows
* 3560843: Remove multi-parameter version of gfx::Rect[F]::Inset()
https://chromium-review.googlesource.com/c/chromium/src/+/3560843
* 3572711: Remove unused IDS_PDF_TOOLTIP_ROTATE_CW resource.
https://chromium-review.googlesource.com/c/chromium/src/+/3572711
* 3572926: Reland "[Sysroot] Switch to Debian Bullseye stable"
https://chromium-review.googlesource.com/c/chromium/src/+/3572926
* build: fixup sysroots with electron specific dependencies
* fixup Remove multi-parameter version of gfx::Rect[F]::Inset()
* fixup 3565724: Preserve "proper method names" as-is in error.stack.
* fixup Remove multi-parameter version of gfx::Rect[F]::Inset()
* test: add spec for navigator.hid.requestDevice({ exclusionFilters: [...] }
* fixup 3565724: Preserve "proper method names" as-is in error.stack.
* ci: use python3 to get the windows toolchain profile
3525960: Explicitly run everything with python3 | https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3525960
* chore: add diagnostic logging
* fix: try calling process.crash()
* chore: remove logging
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
(cherry picked from commit 59dd17f2cf)
* chore: update patches after rebase
* chore: bump chromium in DEPS to 102.0.5005.3
* Revert "chore: bump chromium in DEPS to 102.0.5005.3"
This reverts commit 958cfb2aff.
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* build: explicitly run scripts with python3
* chore: update patches
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
* chore: bump chromium in DEPS to 102.0.4973.0
* chore: bump chromium to 102.0.4971.0 (main) (#33454)
* chore: bump chromium in DEPS to 102.0.4965.0
* chore: 3-way merge of chromium/printing.patch
* chore: update patch shear in chromium/picture-in-picture.patch
* chore: update patches
* 3101519: Window Placement: Prototype fullscreen companion window support
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3101519
build: add popup_preventer.cc, .h to our library. It's needed because
FullscreenController, we were already using, started aggregating a
PopupPreventer in 3101519.
* chore: bump chromium in DEPS to 102.0.4967.0
* Revert "3101519: Window Placement: Prototype fullscreen companion window support"
This reverts commit fc215cb99c464e939882ed3f5cf8e9874a8e3311.
Adding popup_preventer might not be the right solution; there are
cascading dependencies.
* 3551449: Add service-based usage for system print settings
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3551449
chore: fix code shear in patches/chromium/printing.patch
* chore: update patches
* chore: bump chromium in DEPS to 102.0.4969.0
* chore: update patches
* chore: bump chromium in DEPS to 102.0.4971.0
* chore: update fix_patch_out_permissions_checks_in_exclusive_access.patch
Refs https://chromium-review.googlesource.com/c/chromium/src/+/3101519
PopupunderPreventer is not useful in //electron since the window
attributes are controlled by the user via setWindowOpenHandler.
* chore: update patches
* Add FirstPartySetsHandler as a interface class in content API.
https://chromium-review.googlesource.com/c/chromium/src/+/3503410
* Create a new MediaStreamRequestType for GetOpenDevice
https://chromium-review.googlesource.com/c/chromium/src/+/3541939
* Support site isolation for <webview> tags in WebViewRendererState.
https://chromium-review.googlesource.com/c/chromium/src/+/3537735
* ci: update xcode version
Refs https://chromium-review.googlesource.com/c/chromium/src/+/3544199https://developer.apple.com/documentation/screencapturekit/capturing_screen_content_in_macos
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
(cherry picked from commit b711860d21)
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
* chore: update node types version
* update express types to solve type conflict
* one more yarn.lock type bump
* update another types package to fix incompatible global declarations
* remove incompatible type magicks
* update our ambient types to match the node types
* fix test type
Rule 13 recommends using Node's URL parser for handling url inputs. At
the moment, this is not being followed in the code example for rule 5,
which falls back on checking that the url ends with a '/'. If this was
forgotten when a user copies this code it could introduce security
vulnerabilities if an attacker uses an URL in the following way:
"https://example.com.attacker.com"
Using Node's URL parser fixes this potential missuse and enables the
'/' to be omited from the code example.
Co-authored-by: Baitinq <you@example.com>
* fix: don't call X11 functions in file dialog and message box
* refactor: remove unused GtkUiPlatform declaration
* fix: set gtk darktheme only when running under X11
* fix: replace X11 window state watcher with implementation using ozone
* fix: make sure global menu barr is used only when supported
* fix: don't call X11 function in native window views under wayland
* style: fix lint issues
* fix: use GtkUiPlatform::ShowGtkWindow instead of gtk_window_present directly
* refactor: extract CreateGlobalMenuBar into separate function
* refactor: move checking for WaylandWindowDecorations inside class
* fix: check if we run under X11 only in ozone build
* refactor: drop including unused ui/base/ui_base_features.h header
* fix: modify ui_gtk_public_header.patch to also export gtk_ui.h
* fix: refactor guarding of X11 calls
- Introduce patch exposing new electron_can_call_x11 property
- Replace defined(USE_OZONE) with BUILDFLAG(OZONE_PLATFORM_X11) flags
* fix: remove the last remaining usage of USE_X11
* fix: usage of BUILDFLAG(OZONE_PLATFORM_X11) not building on non ozone
* fix: call UpdateWindowState from OnBoundsChanged only under X11
* fix: initialize asar support in worker threads
Use `ObjectWrap` instead of gin's Wrap in `electron_api_asar.cc` because
gin isn't fully initialized (and apparently not possible to initialize
without ruining the isolate configuration and array buffer allocator) in
worker threads. In the worker thread call `setupAsarSupport` just as we
do for the main process.
* Update lib/asar/fs-wrapper.ts
Co-authored-by: Darshan Sen <raisinten@gmail.com>
* Update patches/node/worker_thread_add_asar_support.patch
Co-authored-by: Darshan Sen <raisinten@gmail.com>
* Add a test
Co-authored-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* fix: use stricter options in SecStaticCodeCheckValidity
* Update patches/squirrel.mac/fix_use_kseccschecknestedcode_kseccsstrictvalidate_in_the_sec.patch
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* fix: ensure ElectronBrowser mojo service is only bound to authorized render frames
Notes: no-notes
* refactor: extract electron API IPC to its own mojo interface
* fix: just check main frame not primary main frame
* fix: race condition where webContents can be nullptr during re-focus and a multi-window close sequence
* chore: update electron_inspectable_web_contents_view.mm
* docs: Updated list numbering
The steps to package and distribute an application using electron had incorrect numbering
* Indented text within ordered list sections
* Removed single space
* Fixed indentation
* build: remove use_thin_lto = false
* ci: enabling if things get really bad (all darwin)
* build: lol don't enable that
* build: add patch to disable thin lto for mac
* feat: Added ability to configure if window should close when opener closes
* fix: check if embedder is destroyed
* fix: correctly take over closeWithOpener property
* chore: Added documentation
* Update docs/api/window-open.md
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
* chore: refactor
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* chore: changed property name from `closeWithOpener` to `outlivesOpener`
* dummy change to kick lint
* undo above
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
This commit backports three commits from libuv's 1.x branch to fix
issues with CPU going to 100% on macOS when EPROTOTYPE is returned.
See: abb109f30f
See: 3a7b95593a
See: de24da8c11
* build: add stack_trace.h to main delegate
* build: trigger circleci
* build: free up a tiny bit more space
* build: disable use_thin_lto
* fixup build/args/all.gn
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* docs: add IPC doc
* fix: use "string" primitive
* use 'string' ipcrenderer
* use "number" primitive
* Update docs/tutorial/ipc.md
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* Update docs/tutorial/ipc.md
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* add code sample
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* build: rebuild the dist_zips when the deps get modified
The dist.zip generated by the electron_dist_zip action was not getting
updated when changes were being made to the dependencies, like the
source files. It turns out, we were using data_deps for the dependencies
instead of deps. Here is the difference:
data_deps: things needed to ultimately run the thing built by a target
deps: things needed to build the target
So the difference in treatment of both sets of dependencies is actually
intentional.
Signed-off-by: Darshan Sen <raisinten@gmail.com>
* fixup! build: rebuild the dist_zips when the deps get modified
Signed-off-by: Darshan Sen <raisinten@gmail.com>
test: add focus and blur WebContents event tests
test: confirm that webcontents focus event is fired on browserwindow focus
fix: mac focus event test timeout
* Update context bridge docs about Promises
From my testing it doesn't remove Promises in nested objects,
also according to the test suite it does not:
80577a4f08/spec-main/api-context-bridge-spec.ts (L693)
* docs: Update docs for errors too
* fix: re-enable PartitionAlloc on macOS
* no need to copy ignore_result on linux
* factor out FixStdioStreams
* include buildflags.h in electron_main_linux
* #include electron/fuses
* more missing includes
* script: Python3 compatibility for utf8 conversion
The unicode() method has been renamed to str() in Python3,
add a wrapper around it to support running against both versions.
* script: don't require python2 for git-[import,export]-patches
The scripts work just fine with python3 too, so use the generic
python executable as the script interpreter.
Most setups don't even require or provide python 2 anymore,
so this saves one from having to install it just for the scripts.
* feat: Add onFirstInstanceAck event for requestSingleInstanceLock
* Add tests
* Apply patch fix
* Add back missing docs
* Rebase
* Listen for exit earlier in test
* Rebase
* fix: Don't create console window when creating process
* Update patches/node/fix_don_t_create_console_window_when_creating_process.patch
Co-authored-by: Robo <hop2deep@gmail.com>
* Remove extra line in description
Co-authored-by: Robo <hop2deep@gmail.com>
CFLocaleGetValue() returned null and crashed the process when
app.getLocaleCountryCode() was run on a CircleCI metal resource class
macOS instance with Xcode 12.5.1. This change fixes that logic and adds
further checks to make the code future-proof.
Here too people are complaining that the returned country code migth be
null: https://stackoverflow.com/questions/15202454/nslocalecountrycode-returns-nil
Signed-off-by: Darshan Sen <darshan.sen@postman.com>
WebRTC has changed how they integrate into Chromium, they don't
expose their dependencies externally anymore. Instead, one must
now go through webrtc_overrides:
https://chromium.googlesource.com/chromium/src.git/+/cbc90fd093956
We're already including webrtc_overrides as a dependency which
includes the modules, so this extra deps isn't needed anymore.
In the synchronous code path, gtk_native_dialog_run() will call
gtk_native_dialog_show(). Previously this was causing an assertion to be
hit at run time.
* build: account for path-filtering workflow in release-build script
* build: update syntax for workflow id
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Add the native frame border size to the minimum and maximum size if
the view reports its size as the client size. It allows to enlarge
window to proper values when aspect ratio and max width/height are
set. It also fixes DCHECK which was triggered when user tried to
enlarge window above dimensions set during creation of the
BrowserWindow.
The variable `input` is accepted by a universal reference, so it doesn't
make sense to cast a potential lvalue reference into an rvalue
reference. In case `input` is an lvalue reference, we should rather
forward the value as is to `ToV8()`.
Signed-off-by: Darshan Sen <darshan.sen@postman.com>
* fix: provide paths for all NetworkContextFilePaths keys
* chore: include chrome features header
* chore: build browser_features
* yolo
* add pref service
* fix: include sandbox policy features
* fix pref key
* fix: gate pref key to OS_WIN
Co-authored-by: VerteDinde <khammond@slack-corp.com>
* fix: media shouldn't open permissions dialog
Playing media shouldn't open Accessibility permissions dialog on macOS.
However, we still need to watch for media events, just not globally and
`media_keys_listener_` is an API over global capture of the media keys.
The fix is to let chromium call `UpdateWhichKeysAreListenedFor` which
will call `UpdateSystemMediaControlsEnabledControls` and watch for
events on `system_media_controls_` without triggering permissions popup.
* chore: update patches
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
* 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>
Changes some links around. There was no link for `NSUserNotification`, and
`UNNotificationResponse` incorrectly linked to our own `NotificationResponse`
API structure doc.
* 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: Cheng Zhao <zcbenz@gmail.com>
This deprecates the synchronous and blocking `webContents.getPrinters()`
function and introduces `webContents.getPrintersAsync()`, which is
asynchronous and non-blocking.
Signed-off-by: Darshan Sen <darshan.sen@postman.com>
* 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: Cheng Zhao <github@zcbenz.com>
* WIP
* Use serialization
* Rebase windows impl of new app requestSingleInstanceLock parameter
* Fix test
* Implement posix side
* Add backwards compatibility test
* Apply PR feedback Windows
* Fix posix impl
* Switch mac impl back to vector
* Refactor Windows impl
* Use vectors, inline make_span
* Use blink converter
* fix: ownership across sequences
* Fix upstream merge from Chromium
Co-authored-by: deepak1556 <hop2deep@gmail.com>
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.
* fix information
* move historical section to bottom
* Update docs/tutorial/electron-versioning.md
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* 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: Milan Burda <milan.burda@gmail.com>
* 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
* feat: make desktopCapturer main-process-only
* remove --enable-api-filtering-logging
* remove test
* merge lib/browser/api/desktop-capturer.ts with lib/browser/desktop-capturer.ts
* remove desktop-capturer-get-sources event
* fix specs
* getSources needs to be async
Co-authored-by: Milan Burda <milan.burda@gmail.com>
In order to validate that header guards match the corresponding file
names, `cpplint.py` determines the root of the project based on the
presence of a `.git` directory.
For space reasons, our Electron.js fork running on CircleCI deletes the
`.git` directories as upstream Electron.js does here:
cd09a54365/.circleci/config.yml (L426)
If the C++ linter is ran *after* deleting git directories, `cpplint.py`
gets the root wrong and throws errors for every single header guard in
the project.
Making sure we run the C++ linter *before* deleting git directories
fixes the issue. In any case, this commit always manually passes
`--project_root` to `cpplint.py` so that the implicit default is
explicitly declared and saves some confusion for the next person hitting
this.
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
* docs: Update CI Badge Branch Name
The CI badges were still pointing at builds for the master branch, which
are stale since the rename to main.
* docs: Update electron/electron Branch Name
Update electron/electron branch name from master to main.
* docs: Update electron/governance Branch Name
Update electron/governance branch name from master to main.
* 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>
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.
* 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>
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
* 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
* 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>
* 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
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* 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: Cheng Zhao <github@zcbenz.com>
* build: @jasonetco said that this will make codespaces work
* tmp
* Codespaces
* Update docker-compose.yml
* Update docker-compose.yml
* tada?
* e use
* do not use pizza...
* point at correct goma file
* use ghcr for codespaces
* pass --yes to npx
* build: use auth.notgoma codespace token auth to auto-auth goma
* build: move build-tools set up to Dockerfile
* build: provide default extensions list
* Fix locale tests
* add vnc support
* use prebuilt devcontainer image
* update docker images
* update docker images
* update docker images
* add docs for codespaces
* chore: update docker images
* build: do not overwrite modified buildtools configs on container rebuilds
* use gn language server
* update docker images
* update docker images
* fill in missing links
Co-authored-by: Codespaces <codespaces@github.com>
* 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>
* 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 <a@b>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
* docs: Update to the use of arrow functions in line with the style guide
* docs: Fixed unmatched bracket typo in previous commit 9ebe3e58f7948c6636d77f3c58a2693683b69691
* fix linting
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
* feat: Allow detection of MITM HTTPS proxies like ZScaler
For security purposes, Figma heavily restrics the origins that are
allowed to load within our Electron app. Unfortunately some corporate
environments use MITM proxies like ZScaler, which intercepts our
connection to `https://www.figma.com` and serves a redirect to e.g.
`https://gateway.zscloud.net` before finally redirecting back to
`https://www.figma.com`.
In order to detect this situation and handle it gracefully, we need to
be able to know whether or not the certificate for our own origin
(`https://www.figma.com`) is chained to a known root. We do this by
exposesing `CertVerifyResult::is_issued_by_known_root`.
If the certification verification passed without the certificate being
tied to a known root, we can safely assume that we are dealing with a
MITM proxy that has its root CA installed locally on the machine. This
means that HTTPS can't be trusted so we might as well make life easier
for corporate users by loosening our origin restrictions without any
manual steps.
* Tweak docs wording
* 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>
* build: update version-bumper to support alpha
* build: seperate alpha bump version tests
For easier deletion. If we want to continue supporting an alpha channel,
they can be reintegrated with main tests.
* chore: fix regex
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Samuel Attard <sam@electronjs.org>
* mac: add dialog.closeMessageBox API
* win: Implement dialog.closeMessageBox
* mac: Return cancelId with closeMessageBox
* gtk: Implement dialog.closeMessageBox
* win: Fix 32bit build
* win: Reduce the scope of lock
* fix: Build error after rebase
* feat: Use AbortSignal to close message box
* chore: silently handle duplicate ID
* win: Add more notes about the threads
* chore: apply reviews
* fix: base::NoDestructor should be warpped in function
* chore: fix style on windows
* Update dark-mode.md
Fix the unmatched css file name
* Update docs/tutorial/dark-mode.md
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* feat: add MenuItem.userAccelerator property
This allows folks to read the user-assigned accelerator that macOS users can provide in system preferences. Useful for showing in-app shortcut help dialogs, you need to know if the accelerator you provided is not being used in favor of a user assigned one.
* chore: update syntax
* chore: add safety check for command index being -1
The new installs of the python module, python-dbusmock, is broken for
python2. The tests still run fine on linux machine in Electron's
pipeline setup on CircleCI, because the docker image used has
the non-broken version of python-dbusmock for python2 installed.
But running electron tests on any other linux machine would fail if
they don't have this non-broken version of python-dbusmock for python2
installed, already, which is the case for most of the machines.
Moreover, Python2 is deprecated now. So it would be better if we change
the python interpreter in script/spec-runner.js file to python3, for
which all the python modules are updated and working.
Co-authored-by: Rituka Patwal <rituka.patwal@postman.com>
* wip: debug resource bundle failure
* fix: include ppapi subprocesses for windows resource bundle
* fix: allow ppapi plugin processes access to resource bundle on all platforms.
Aligns with chrome_main_delegate here: https://chromium-review.googlesource.com/c/chromium/src/+/2619003
* fix: do not cancel CORS preflight request on proxy auth.
If connecting via proxy, preflight request can receive 407
header response from proxy. This does not mean request
was finished even though it received headers (from proxy,
not the destination server), so prevent "completing"
and most importantly deleting it, which causes request
to be canceled in network layer. Just continue to monitor it
and await proper response from server. Also add circut breaker
to cancel request if proxy auth failed 3 times (for example
user keeps cancelling auth). This behavior happens only
when app registered WebRequest api listeners.
* Port chromium webrequest changes to electron code.
Move relevant parts of chromium WebRequestProxyingURLLoaderFactory from
https://chromium-review.googlesource.com/c/chromium/src/+/2011781
into electron ProxyingURLLoaderFactory.
* Update code to upstreamed version and remove retyr count failsafe.
Co-authored-by: Milan Burda <milan.burda@gmail.com>
* fix: microtasks policy in CreateEnvironment
Microtasks policy should not be updated for the renderer because
`NodeBindings::CreateEnvironment` might be entered with or without
`UvRunOnce()` on stack. One of the examples of such calls is
`window.open()` which is possible to invoke while `uv_run()` is still
running (e.g. with `setImmediate()`).
All in all, it doesn't matter that much which policy we use since
`v8::MicrotasksScope` has a check for the policy in its destructor and
no commits will be made if the policy is `kExplicit`. It is important,
however, to not change the policy in the middle of `UvRunOnce()` so we
should respect whatever we currently have and move on.
Fix: #29463
* Move test to a better place
* Update spec-main/fixtures/crash-cases/setimmediate-window-open-crash/index.html
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* Update spec-main/fixtures/crash-cases/setimmediate-window-open-crash/index.html
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* simplify crash-case
* comment
* fix comment
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Fedor Indutny <indutny@signal.org>
If the app is run with LC_ALL=C on Linux, the test would fail as
app.getLocaleCountryCode() would return "".
Signed-off-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* fix: ensure the typescript definitions only export correct value types
In typescript there are two main types of "types" you can export, value types (class, const) and definition types (type, interface). The typescript compiler will let anything declared via const or class be used as a value. Unfortunately we were exporting a bunch of things (see the diff) as class/const when they weren't actually exported values. This lead to typescript being happy but the runtime throwing errors (not something we want).
This change passes "exported-in" context through our docs, to the parser and then to the definitions generator to ensure we only mark things as exported in the ts defs that we actually export.
Fixes#22167
* chore: update typescript-defs
* chore: update typescript-defs
* chore: fix bad typescript in IPC test
* docs: test rendering of new syntax
* chore: update per feedback, use same syntax but with 'this is not exportedd' line
* refactor: use PathProvider for user-data-dir and others
* consolidate logic for DIR_RECENT and DIR_APP_LOGS into path provider
* fix bad include
* remove debugging code
* fix build on mac
* fix build on win
* create app logs dir on both mac and non-mac
Unlike the other files, this file had its executable bit set in its file
mode. This change removes the executable bit to align its file mode with
the rest of the files.
Signed-off-by: Darshan Sen <raisinten@gmail.com>
* chore: bump chromium in DEPS to 93.0.4536.0
* chore: update patches
* [2918475] Make InkDrop a View class property
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2918475
Replace old views::Button::ink_drop() calls with views::InkDrop::Get()
* [2935942] Convert use of gfx::ImageSkia to ui::ImageModel for WidgetDelegates
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2935942
Update GetWindowIcon(), GetWindowAppIcon(), and GetDevToolsWindowIcon()
to return ui::ImageModel instead of gfx::ImageSkia.
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: bump chromium in DEPS to 93.0.4533.0
* chore: update patches
* chore: bump chromium in DEPS to 93.0.4534.0
* chore: update patches
* chore: bump chromium in DEPS to 93.0.4535.0
* chore: remove PdfViewerDocumentProperties from feature-flag conditional
https://chromium-review.googlesource.com/c/chromium/src/+/2938363
This feature is now enabled by default upstream.
* chore: remove kPdfViewerPresentationMode from feature-flag conditional
https://chromium-review.googlesource.com/c/chromium/src/+/2938037
This feature is now enabled by default upstream.
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* remove version information from html
* change format for readability
* clarify which console the message should appear in
* minor changes to renderer.md
* update UI on click instead of developer console
* remove node-integration and fix md
* update content
* chore: remove ****
Co-authored-by: Ethan Arrowood <ethan.arrowood@gmail.com>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
Right now, if executing `xcrun` fails, then the error message prints the
second argument to the `xcrun.py` script, which is the first argument to
the tool that `xcrun` is executing, making the whole error message quite
confusing.
Consider the following error:
```
python ../../third_party/squirrel.mac/build/xcrun.py dtrace -h -s /private/tmp/20210531211008-def376dc/src/third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACSignalProvider.d -o /private/tmp/20210531211008-def376dc/src/out/release/gen/third_party/squirrel.mac/dtrace/RACSignalProvider.h
xcrun script '-h' failed with code '71':
xcrun: error: can't exec '/tmp/20210531211008-def376dc/dtrace' (errno=Permission denied)
```
The command that `xcrun` is executing is `dtrace`, but the error just
mentions the `-h` flag.
Notes: none
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
* fix: correctly handle shifted char in accelerator
* test: use actual accelerator of NSMenuItem
* chore: simplify KeyboardCodeFromStr
* chore: GetAcceleratorTextAt is testing only
Electron already seems to support `cygwin`, so `msys` is a natural
addition. This is the only required change as far as I can see on my
local development environment, as otherwise the build scripts don't
realize that msys = windows.
Notes: none
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
* feat: add new runningUnderARM64Translation property to detect x64 translated apps running on Windows ARM
* docs: add documentation for the new runningUnderARM64Translation property
* refactor: clean up `IsRunningUnderARM64Translation` Windows implementation
* Return false if IsWow64Process2 doesn't exist
* Emit deprecation warning in runningUnderRosettaTranslation
* improve progress bar fiddle
* add comments to code snippet
* edits to progress-bar tutorial
* remove versions and nodeIntegration
* limit line length to 100
* implement standard linter suggestions
* add indeterminate and clear timers
* update to have reader replace all of main.js
* remove extra button
* loop the progress bar
* add logic to show reset state briefly
* Update docs/tutorial/progress-bar.md
Co-authored-by: Erick Zhao <erick@hotmail.ca>
* chore: fix lint
Co-authored-by: Cheng Zhao <github@zcbenz.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
* feat: emit resize edge with will-resize event
fix: wparam type
fix: private member usage on mac
docs: will-resize event edge option
refactor: 'info' -> 'details' for better type gen
* Update docs/api/browser-window.md
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
* Update docs/api/browser-window.md
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
* feat: add experimental cookie encryption support on macOS
* chore: fix TODO
* update patches
* feat: make cookie encryption work on windows
* chore: update cookie encryption support comments
* fix: only call OSCrypt::Init on windows
* chore: make cookie encryption work on linux
* Update shell/browser/net/system_network_context_manager.cc
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* chore: fix lint
* chore: update patches
* chore: update patches to upstreamed variants
* chore: use chrome ::switches constants
* chore: remove bad patch
* build: disable cookie encryption by default
* chore: update patches
* fix: provide std::string to NoDestructor
* chore: fix macos, nodestructor syntax
* build: fix macOS build due to mismatch in DEFINE
Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
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.
description:Please ensure you've completed all of the following.
options:
- label:I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
- label:I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
required:true
- label:I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
- 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 feature request 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 bug report 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?
placeholder:12.0.0
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
validations:
required:true
- type:dropdown
@@ -53,7 +56,7 @@ body:
attributes:
label:Last Known Working Electron version
description:What is the last version of Electron this worked in, if applicable?
description:Please ensure you've completed all of the following.
options:
- label:I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
- label:I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
required:true
- label:I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
- 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 feature request that matches the one I want to file, without success.
required:true
@@ -37,4 +37,4 @@ body:
label:Additional Information
description:Add any other context about the problem here.
- [ ] PR description included and stakeholders cc'd
- [ ]`npm test` passes
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/master/docs/development/testing.md)
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
- [ ] relevant documentation is changed or added
- [ ] [PR release notes](https://github.com/electron/clerk/blob/master/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/master/README.md#examples).
We use [semantic commit messages](https://github.com/electron/electron/blob/master/docs/development/pull-requests.md#commit-message-guidelines) to streamline the release process. Before your pull request can be merged, you should **update your pull request title** to start with a semantic prefix.
We use [semantic commit messages](https://github.com/electron/electron/blob/main/docs/development/pull-requests.md#commit-message-guidelines) to streamline the release process. Before your pull request can be merged, you should **update your pull request title** to start with a semantic prefix.
Examples of commit messages with semantic prefixes:
@@ -12,9 +12,9 @@ newPRWelcomeComment: |
Things that will help get your PR across the finish line:
- Follow the JavaScript, C++, and Python [coding style](https://github.com/electron/electron/blob/master/docs/development/coding-style.md).
- Follow the JavaScript, C++, and Python [coding style](https://github.com/electron/electron/blob/main/docs/development/coding-style.md).
- Run `npm run lint` locally to catch formatting errors earlier.
- Document any user-facing changes you've made following the [documentation styleguide](https://github.com/electron/electron/blob/master/docs/styleguide.md).
- Document any user-facing changes you've made following the [documentation styleguide](https://github.com/electron/electron/blob/main/docs/styleguide.md).
- Include tests when adding/changing behavior.
- Include screenshots and animated GIFs whenever possible.
@@ -22,7 +22,7 @@ Issues are created [here](https://github.com/electron/electron/issues/new).
### Issue Closure
Bug reports will be closed if the issue has been inactive and the latest affected version no longer receives support. At the moment, Electron maintains its three latest major versions, with a new major version being released every 12 weeks. (For more information on Electron's release cadence, see [this blog post](https://electronjs.org/blog/12-week-cadence).)
Bug reports will be closed if the issue has been inactive and the latest affected version no longer receives support. At the moment, Electron maintains its three latest major versions, with a new major version being released every 8 weeks. (For more information on Electron's release cadence, see [this blog post](https://electronjs.org/blog/8-week-cadence).)
_If an issue has been closed and you still feel it's relevant, feel free to ping a maintainer or add a comment!_
@@ -36,7 +36,7 @@ Having the original text _as well as_ the translation can help mitigate translat
Responses to posted issues may or may not be in the original language.
**Please note** that using non-English as an attempt to circumvent our [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) will be an immediate, and possibly indefinite, ban from the project.
**Please note** that using non-English as an attempt to circumvent our [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) will be an immediate, and possibly indefinite, ban from the project.
Each Electron release provides binaries for macOS, Windows, and Linux.
* macOS (El Capitan 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)
@@ -55,13 +65,10 @@ 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
- [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
* [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
When using the Electron or other GitHub logos, be sure to follow the [GitHub logo guidelines](https://github.com/logos).
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).
@@ -10,7 +10,7 @@ Report security bugs in third-party modules to the person or team maintaining th
## The Electron Security Notification Process
For context on Electron's security notification process, please see the [Notifications](https://github.com/electron/governance/blob/master/wg-security/membership-and-notifications.md#notifications) section of the Security WG's [Membership and Notifications](https://github.com/electron/governance/blob/master/wg-security/membership-and-notifications.md) Governance document.
For context on Electron's security notification process, please see the [Notifications](https://github.com/electron/governance/blob/main/wg-security/membership-and-notifications.md#notifications) section of the Security WG's [Membership and Notifications](https://github.com/electron/governance/blob/main/wg-security/membership-and-notifications.md) Governance document.
# 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 )
- if "%RUN_TESTS%"=="true" ( echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
- if "%RUN_TESTS%"=="true" ( echo Running remote test suite & node script/yarn test -- --trace-uncaught --runners=remote --runTestFilesSeperately --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
- if "%RUN_TESTS%"=="true" ( echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log --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 )
"_comment": "Modifying the fuse schema in any breaking way should result in the _version prop being incremented. NEVER remove a fuse or change its meaning, instead mark it as removed with 'r'",
"_schema": "0 == off, 1 == on, r == removed fuse",
*`argv`String[] - An array of the second instance's command line arguments
*`workingDirectory`String - The second instance's working directory
*`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
*`ackCallback` unknown - A function that can be used to send data back to the second instance
This event will be emitted inside the primary instance of your application
when a second instance has been executed and calls `app.requestSingleInstanceLock()`.
@@ -491,21 +496,34 @@ non-minimized.
**Note:** If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
**Note:**`ackCallback` allows the user to send data back to the
second instance during the `app.requestSingleInstanceLock()` flow.
This callback can be used for cases where the second instance
needs to obtain additional information from the first instance
before quitting.
Currently, the limit on the message size is kMaxMessageLength,
or around 32kB. To be safe, keep the amount of data passed to 31kB at most.
In order to call the callback, `event.preventDefault()` must be called, first.
If the callback is not called in either case, `null` will be sent back.
If `event.preventDefault()` is not called, but `ackCallback` is called
by the user in the event, then the behaviour is undefined.
This event is guaranteed to be emitted after the `ready` event of `app`
gets emitted.
**Note:** Extra command line arguments might be added by Chromium,
such as `--original-process-start-time`.
### Event: 'desktop-capturer-get-sources'
### Event: 'first-instance-ack'
Returns:
*`event` Event
*`webContents` [WebContents](web-contents.md)
*`additionalData` unknown - A JSON object of additional data passed from the first instance, in response to the first instance's `second-instance` event.
Emitted when `desktopCapturer.getSources()` is called in the renderer process of `webContents`.
Calling `event.preventDefault()` will make it return empty sources.
This event will be emitted within the second instance during the call to `app.requestSingleInstanceLock()`, when the first instance calls the `ackCallback` provided by the `second-instance` event handler.
## Methods
@@ -536,8 +554,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.
@@ -564,7 +582,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()`
@@ -576,7 +594,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
@@ -595,7 +613,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)`.
@@ -603,11 +621,11 @@ 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
@@ -629,16 +647,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_.
@@ -656,8 +674,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.
@@ -671,13 +689,13 @@ directory. If you want to change this location, you have to override the
### `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
@@ -687,7 +705,7 @@ preferred over `name` by Electron.
### `app.setName(name)`
*`name`String
*`name`string
Overrides the current application's name.
@@ -695,10 +713,10 @@ 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/+/master: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/+/main: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](https://github.com/electron/electron/blob/master/docs/api/command-line-switches.md).
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.
@@ -707,13 +725,13 @@ To set the locale, you'll want to use a command line switch at app startup, whic
### `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.
*`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/+/master: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/+/main:net/base/net_error_list.h).
### `app.configureHostResolver(options)`
*`options` Object
*`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".
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[] (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
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.
Defaults to true.
Configures host resolution (DNS and DNS-over-HTTPS). By default, the following
resolvers will be used, in order:
1. DNS-over-HTTPS, if the [DNS provider supports it][doh-providers], then
2. the built-in resolver (enabled on macOS only by default), then
3. the system's resolver (e.g. `getaddrinfo`).
This can be configured to either restrict usage of non-encrypted DNS
(`secureDnsMode: "secure"`), or disable DNS-over-HTTPS (`secureDnsMode:
"off"`). It is also possible to enable or disable the built-in resolver.
To disable insecure DNS, you can specify a `secureDnsMode` of `"secure"`. If you do
so, you should make sure to provide a list of DNS-over-HTTPS servers to use, in
case the user's DNS configuration does not include a provider that supports
DoH.
```js
app.configureHostResolver({
secureDnsMode:'secure',
secureDnsServers:[
'https://cloudflare-dns.com/dns-query'
]
})
```
This API must be called after the `ready` event is emitted.
@@ -1085,7 +1178,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>`
@@ -1128,15 +1221,15 @@ 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.
On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
for more information please read [Desktop Environment Integration][unity-requirement].
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
please read the [Unity integration documentation][unity-requirement].
### `app.getBadgeCount()` _Linux_ _macOS_
@@ -1144,14 +1237,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.
*`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
@@ -1159,43 +1252,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.
*`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],
* `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.
@@ -1243,14 +1336,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.
* `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.
* `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.
@@ -1258,7 +1351,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_
@@ -1266,7 +1359,7 @@ Show the platform's native emoji picker.
* `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.
@@ -1289,16 +1382,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()`
* `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
@@ -1334,13 +1427,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.
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.
@@ -1374,8 +1467,8 @@ An `Integer` property that returns the badge count for current app. Setting the
On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
for more information please read [Desktop Environment Integration][unity-requirement].
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
please read the [Unity integration documentation][unity-requirement].
**Note:** On macOS, you need to ensure that your application has the permission
to display notifications for this property to take effect.
@@ -1392,7 +1485,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.
* 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`.
*`type`String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
*`title`string - Unused on Windows
*`url`string
*`type`string (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Writes the `title` and `url` into the clipboard as a bookmark.
Writes the `title` (macOS only) 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 application’s find panel.
Returns `string` - The text on the find pasteboard, which is the pasteboard that holds information about the current state of the active application’s 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 application’s 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`.
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
*`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-experimental) 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,16 +97,17 @@ has been included below for completeness:
| Type | Complexity | Parameter Support | Return Value Support | Limitations |
| `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 |
| `Promise` | Complex | ✅ | ✅ | Promises are only proxied if they are the return value or exact parameter. Promises nested in arrays or objects will be dropped. |
| `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
| `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. |
| `Blob` | Complex | ✅ | ✅ | N/A |
| `Symbol` | N/A | ❌ | ❌ | Symbols cannot be copied across contexts so they are dropped |
If the type you care about is not in the above table, it is probably not supported.
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
Instances of the `Cookies` class are accessed by using `cookies` property of
a `Session`.
@@ -49,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.
@@ -57,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.
@@ -69,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.
@@ -86,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
false.
*`httpOnly`Boolean (optional) - Whether the cookie should be marked as HTTP only.
*`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.
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 `no_restriction`.
*`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`.
Returns `Promise<void>` - A promise which resolves when the cookie has been set
@@ -106,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
> **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).
*`properties`String[](optional) - Contains which features the dialog should
*`properties`string[] (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.
*`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[](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[] (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.
*`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[](optional)
*`properties`string[] (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
*`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[](optional)
*`showsTagField`boolean (optional) _macOS_ - Show the tags input box, defaults to `true`.
*`properties`string[] (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,28 +222,29 @@ expanding and collapsing the dialog.
@@ -127,7 +139,8 @@ green and non-draggable regions will be colored red to aid debugging.
### `ELECTRON_DEBUG_NOTIFICATIONS`
Adds extra logs to [`Notification`](./notification.md) lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common actions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.
Adds extra logs to [`Notification`](./notification.md) lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common a
tions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.
There's an alternative way to specify a chromeless window.
Instead of setting `frame` to `false` which disables both the titlebar and window controls,
you may want to have the title bar hidden and your content extend to the full window size,
yet still preserve the window controls ("traffic lights") for standard window actions.
You can do so by specifying the `titleBarStyle` option:
#### `hidden`
Results in a hidden title bar and a full size content window, yet the title bar still has the standard window controls (“traffic lights”) in the top left.
* You can not click through the transparent area. We are going to introduce an
API to set window shape to solve this, see
[our issue](https://github.com/electron/electron/issues/1335) for details.
* Transparent windows are not resizable. Setting `resizable` to `true` may make
a transparent window stop working on some platforms.
* The `blur` filter only applies to the web page, so there is no way to apply
blur effect to the content below the window (i.e. other applications open on
the user's system).
* The window will not be transparent when DevTools is opened.
* On Windows operating systems,
* transparent windows will not work when DWM is
disabled.
* transparent windows can not be maximized using the Windows system menu or by double clicking the title bar. The reasoning behind this can be seen on [this pull request](https://github.com/electron/electron/pull/28207).
* On Linux, users have to put `--enable-transparent-visuals --disable-gpu` in
the command line to disable GPU and allow ARGB to make transparent window,
this is caused by an upstream bug that [alpha channel doesn't work on some
NVidia drivers](https://bugs.chromium.org/p/chromium/issues/detail?id=369209) on
Linux.
* On Mac, the native window shadow will not be shown on a transparent window.
## Click-through window
To create a click-through window, i.e. making the window ignore all mouse
events, you can call the [win.setIgnoreMouseEvents(ignore)][ignore-mouse-events]
API:
```javascript
const{BrowserWindow}=require('electron')
constwin=newBrowserWindow()
win.setIgnoreMouseEvents(true)
```
### Forwarding
Ignoring mouse messages makes the web page oblivious to mouse movement, meaning
that mouse movement events will not be emitted. On Windows operating systems an
optional parameter can be used to forward mouse move messages to the web page,
allowing events such as `mouseleave` to be emitted:
This makes the web page click-through when over `el`, and returns to normal
outside it.
## Draggable region
By default, the frameless window is non-draggable. Apps need to specify
`-webkit-app-region: drag` in CSS to tell Electron which regions are draggable
(like the OS's standard titlebar), and apps can also use
`-webkit-app-region: no-drag` to exclude the non-draggable area from the
draggable region. Note that only rectangular shapes are currently supported.
Note: `-webkit-app-region: drag` is known to have problems while the developer tools are open. See this [GitHub issue](https://github.com/electron/electron/issues/3647) for more information including a workaround.
To make the whole window draggable, you can add `-webkit-app-region: drag` as
`body`'s style:
```html
<bodystyle="-webkit-app-region: drag">
</body>
```
And note that if you have made the whole window draggable, you must also mark
buttons as non-draggable, otherwise it would be impossible for users to click on
them:
```css
button{
-webkit-app-region:no-drag;
}
```
If you're only setting a custom titlebar as draggable, you also need to make all
buttons in titlebar non-draggable.
## Text selection
In a frameless window the dragging behavior may conflict with selecting text.
For example, when you drag the titlebar you may accidentally select the text on
the titlebar. To prevent this, you need to disable text selection within a
draggable area like this:
```css
.titlebar{
-webkit-user-select:none;
-webkit-app-region:drag;
}
```
## Context menu
On some platforms, the draggable area will be treated as a non-client frame, so
when you right click on it a system menu will pop up. To make the context menu
behave correctly on all platforms you should never use a custom context menu on
*`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
*`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,6 +100,10 @@ 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.
@@ -120,7 +124,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.
**Nota Bene:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
**Note:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
### Instance Properties
@@ -128,12 +132,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`
@@ -151,42 +155,48 @@ 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`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
A `string` (optional) indicating the item's role, if set. Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`,`toggleSpellChecker`,`togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`,`shareMenu`,`recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
#### `menuItem.accelerator`
A `Accelerator` (optional) indicating the item's accelerator, if set.
An`Accelerator` (optional) indicating the item's accelerator, if set.
An `Accelerator | null` indicating the item's [user-assigned accelerator](https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc) for the menu item.
**Note:** This property is only initialized after the `MenuItem` has been added to a `Menu`. Either via `Menu.buildFromTemplate` or via `Menu.append()/insert()`. Accessing before initialization will just return `null`.
#### `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
@@ -199,7 +209,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.
@@ -212,7 +222,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.
*`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`
@@ -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`.
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
### Instance Methods
@@ -247,7 +248,7 @@ data.
*`options` Object (optional)
*`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])`
@@ -271,7 +272,7 @@ 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])`
@@ -283,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)`
@@ -302,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
@@ -335,7 +336,7 @@ Returns `Float[]` - An array of all scale factors corresponding to representatio
*`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
@@ -348,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.
@@ -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.
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
Instances of the `ServiceWorkers` class are accessed by using `serviceWorkers` property of
a `Session`.
@@ -36,12 +37,12 @@ Returns:
*`event` Event
*`messageDetails` Object - Information about the console message
*`message`String - The actual console message
*`versionId`Number - The version ID of the service worker that sent the log message
*`source`String - The type of source for this message. Can be `javascript`, `xml`, `network`, `console-api`, `storage`,`app-cache`,`rendering`, `security`, `deprecation`, `worker`, `violation`, `intervention`, `recommendation` or `other`.
*`level`Number - The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and `error`.
*`sourceUrl`String - The URL the message came from
*`lineNumber`Number - The line number of the source that triggered this console message
*`message`string - The actual console message
*`versionId`number - The version ID of the service worker that sent the log message
*`source`string - The type of source for this message. Can be `javascript`, `xml`, `network`, `console-api`, `storage`, `rendering`, `security`, `deprecation`, `worker`, `violation`, `intervention`, `recommendation` or `other`.
*`level`number - The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and `error`.
*`sourceUrl`string - The URL the message came from
*`lineNumber`number - The line number of the source that triggered this console message
Emitted when a service worker logs something to the console.
@@ -51,7 +52,7 @@ Returns:
*`event` Event
*`details` Object - Information about the registered service worker
*`scope`String - The base URL that a service worker is registered for
*`scope`string - The base URL that a service worker is registered for
Emitted when a service worker has been registered. Can occur after a call to [`navigator.serviceWorker.register('/sw.js')`](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register) successfully resolves or when a Chrome extension is loaded.
@@ -61,11 +62,11 @@ The following methods are available on instances of `ServiceWorkers`:
#### `serviceWorkers.getAllRunning()`
Returns `Record<Number, ServiceWorkerInfo>` - A [ServiceWorkerInfo](structures/service-worker-info.md) object where the keys are the service worker version ID and the values are the information about that service worker.
Returns `Record<number, ServiceWorkerInfo>` - A [ServiceWorkerInfo](structures/service-worker-info.md) object where the keys are the service worker version ID and the values are the information about that service worker.
#### `serviceWorkers.getFromVersionID(versionId)`
*`versionId`Number
*`versionId`number
Returns [`ServiceWorkerInfo`](structures/service-worker-info.md) - Information about this service worker
Emitted after `navigator.serial.requestPort` has been called and `select-serial-port` has fired if a new serial port becomes available. For example, this event will fire when a new USB device is plugged in.
#### Event: 'serial-port-removed' _Experimental_
#### Event: 'serial-port-removed'
Returns:
@@ -261,13 +377,13 @@ Clears the session’s HTTP cache.
#### `ses.clearStorageData([options])`
*`options` Object (optional)
*`origin`String (optional) - Should follow `window.location.origin`’s representation
*`origin`string (optional) - Should follow `window.location.origin`’s representation
`scheme://host:port`.
*`storages`String[] (optional) - The types of storages to clear, can contain:
*`storages`string[] (optional) - The types of storages to clear, can contain:
*`verificationResult` String - Verification result from chromium.
*`isIssuedByKnownRoot` boolean - `true` if Chromium recognises the root CA as a standard root. If it isn't then it's probably the case that this certificate was generated by a MITM proxy whose root has been installed locally (for example, by a corporate proxy). This should not be trusted if the `verificationResult` is not `OK`.
*`verificationResult` string - `OK` if the certificate is trusted, otherwise an error like `CERT_REVOKED`.
*`errorCode` Integer - Error code.
*`callback` Function
*`verificationResult` Integer - Value can be one of certificate error codes
from [here](https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h).
from [here](https://source.chromium.org/chromium/chromium/src/+/main:net/base/net_error_list.h).
Apart from the certificate error codes, the following special codes can be used.
*`0` - Indicates success and disables Certificate Transparency verification.
*`webContents` [WebContents](web-contents.md) - WebContents requesting the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin.
*`permission`String - The type of requested permission.
*`permission`string - The type of requested permission.
*`clipboard-read` - Request access to read from the clipboard.
*`media` - Request access to media devices such as camera, microphone and speakers.
*`display-capture` - Request access to capture the screen.
*`webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. Cross origin sub frames making permission checks will pass a `null` webContents to this handler. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
*`permission`String - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, or `serial`.
*`requestingOrigin`String - The origin URL of the permission check
*`handler` Function\<boolean> | null
*`webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. All cross origin sub frames making permission checks will pass a `null` webContents to this handler, while certain other permission checks such as `notifications` checks will always pass `null`. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
*`permission`string - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`,`hid`, or `serial`.
*`requestingOrigin`string - The origin URL of the permission check
*`details` Object - Some properties are only available on certain permission types.
*`embeddingOrigin`String (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
*`securityOrigin`String (optional) - The security origin of the `media` check.
*`mediaType`String (optional) - The type of media access being requested, can be `video`,
*`embeddingOrigin`string (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
*`securityOrigin`string (optional) - The security origin of the `media` check.
*`mediaType`string (optional) - The type of media access being requested, can be `video`,
`audio` or `unknown`
*`requestingUrl`String (optional) - The last URL the requesting frame loaded. This is not provided for cross-origin sub frames making permission checks.
*`isMainFrame`Boolean - Whether the frame making the request is the main frame
*`requestingUrl`string (optional) - The last URL the requesting frame loaded. This is not provided for cross-origin sub frames making permission checks.
*`isMainFrame`boolean - Whether the frame making the request is the main frame
Sets the handler which can be used to respond to permission checks for the `session`.
Returning `true` will allow the permission and `false` will reject it. Please note that
*`startTime` Double (optional) - Time when download was started in
number of seconds since UNIX epoch.
@@ -668,29 +858,43 @@ Returns `Promise<void>` - resolves when the session’s HTTP authentication cach
#### `ses.setPreloads(preloads)`
*`preloads`String[] - An array of absolute path to preload scripts
*`preloads`string[] - An array of absolute path to preload scripts
Adds scripts that will be executed on ALL web contents that are associated with
this session just before normal `preload` scripts run.
#### `ses.getPreloads()`
Returns `String[]` an array of paths to preload scripts that have been
Returns `string[]` an array of paths to preload scripts that have been
registered.
#### `ses.setCodeCachePath(path)`
*`path` String - Absolute path to store the v8 generated JS code cache from the renderer.
Sets the directory to store the generated JS [code cache](https://v8.dev/blog/code-caching-for-devs) for this session. The directory is not required to be created by the user before this call, the runtime will create if it does not exist otherwise will use the existing directory. If directory cannot be created, then code cache will not be used and all operations related to code cache will fail silently inside the runtime. By default, the directory will be `Code Cache` under the
respective user data folder.
#### `ses.clearCodeCaches(options)`
*`options` Object
*`urls` String[] (optional) - An array of url corresponding to the resource whose generated code cache needs to be removed. If the list is empty then all entries in the cache directory will be removed.
Returns `Promise<void>` - resolves when the code cache clear operation is complete.
#### `ses.setSpellCheckerEnabled(enable)`
*`enable`Boolean
*`enable`boolean
Sets whether to enable the builtin spell checker.
#### `ses.isSpellCheckerEnabled()`
Returns `Boolean` - Whether the builtin spell checker is enabled.
Returns `boolean` - Whether the builtin spell checker is enabled.
#### `ses.setSpellCheckerLanguages(languages)`
*`languages`String[] - An array of language codes to enable the spellchecker for.
*`languages`string[] - An array of language codes to enable the spellchecker for.
The built in spellchecker does not automatically detect what language a user is typing in. In order for the
spell checker to correctly check their words you must call this API with an array of language codes. You can
@@ -700,7 +904,7 @@ get the list of supported language codes with the `ses.availableSpellCheckerLang
#### `ses.getSpellCheckerLanguages()`
Returns `String[]` - An array of language codes the spellchecker is enabled for. If this list is empty the spellchecker
Returns `string[]` - An array of language codes the spellchecker is enabled for. If this list is empty the spellchecker
will fallback to using `en-US`. By default on launch if this setting is an empty list Electron will try to populate this
setting with the current OS locale. This setting is persisted across restarts.
@@ -708,13 +912,15 @@ setting with the current OS locale. This setting is persisted across restarts.
*`issuer` [CertificatePrincipal](certificate-principal.md) - Issuer principal
*`issuerName`String - Issuer's Common Name
*`issuerName`string - Issuer's Common Name
*`issuerCert` Certificate - Issuer certificate (if not self-signed)
*`subject` [CertificatePrincipal](certificate-principal.md) - Subject principal
*`subjectName`String - Subject's Common Name
*`serialNumber`String - Hex value represented string
*`validStart`Number - Start date of the certificate being valid in seconds
*`validExpiry`Number - End date of the certificate being valid in seconds
*`fingerprint`String - Fingerprint of the certificate
*`subjectName`string - Subject's Common Name
*`serialNumber`string - Hex value represented string
*`validStart`number - Start date of the certificate being valid in seconds
*`validExpiry`number - End date of the certificate being valid in seconds
*`fingerprint`string - Fingerprint of the certificate
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.