This patch is required to fix Ozone/Wayland on recent compositors (e.g. wlroots 15).
Chromium tries to bind to interface versions it does not support. This wasn't a problem
until wl_output version 4 got released because chromium supported every version up to this.
Fix#32487.
Upstream chromium issue: https://bugs.chromium.org/p/chromium/issues/detail?id=1279574
Co-authored-by: Milan Burda <milan.burda@gmail.com>
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
* chore: remove c-style conversion for vibrantView (#29724)
* fix: ensure set vibrancy with invalid value is a no-op (#29795)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
To enable/disable window resizing we set/unset WS_THICKFRAME style
flag on the window. Window's frame styles are cached so we need to
call SetWindowPos with the SWP_FRAMECHANGED flag set to update
cache properly.
Co-authored-by: Cezary Kulakowski <cezary@openfin.co>
* fix: maximized state calculation for non-resizable windows
* refactor: clean up NSRect comparison
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
chrome now use developer.chrome.com/docs/extensions/* instead of developer.chrome.com/extensions/*
Co-authored-by: 祈緒ちゃん - Kiochan <sunxingchen@live.com>
The text mentions that `preload` should be a property of `webPreferences`, but the code example shows something else.
Co-authored-by: Christian Engel <chrispy@parastudios.de>
* fix: show maximized frameless window
* test: show maximized transparent window
* fix: test using wrong bounds
BrowserWindow will be sized to the workArea when the Windows taskbar is
visible.
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
* Typo in launch-app-from-url-in-another-app.md
Code snippet for the info.plist example had html formatting. Removed.
* Fix paddings
Co-authored-by: Larry Kluger <larry.kluger@docusign.com>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
* fix: handle nullish WebContentsView in UpdateDraggableRegions
* build: nogncheck on webcontentsimpl include
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
* docs: fix camelcase in menu example and add hint to deal with TS error
hideothers -> hideOthers (the TS compiler caught this)
The TypeScript compiler also did not like the pattern used to
switch between platforms for submenus was loosing the type information
of the literal constants and generalized them as strings which
conflicts with the type definition of MenuItemConstructorOptions.
* docs: Fix spelling, added hint to TypeScript
Without explicitly stating the type for the const template TypeScript does not create a
with the correct shape due to generalization to strings.
* remove ts hints
Co-authored-by: a@b <a@b>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
* chore: more crash-keys for gin::Wrappable debugging
* fix namespace for Event
* Update crash_keys.cc
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* 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>
* chore: update releases to 8 weeks in CONTRIBUTING
* chore: update support.md for four version support
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Change app-quit link definition, so both window-all-closed and app-quit redirects to appropriate sites.
Co-authored-by: Davenury <57959794+Davenury@users.noreply.github.com>
* chore: bump chromium in DEPS to 91.0.4472.114
* chore: bump chromium in DEPS to 91.0.4472.124
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
* ci: run linux arm tests on CircleCI
* cleanup electron dirs after testing
(cherry picked from commit 1c0a6045fb)
* use start-stop-daemon to kill Xvfb
(cherry picked from commit 1d10a68c31)
* fix: do not cancel CORS preflight request on proxy auth. (#29266)
* fix: do not cancel CORS preflight request on proxy auth.
If connecting via proxy, preflight request can receive 407
header response from proxy. This does not mean request
was finished even though it received headers (from proxy,
not the destination server), so prevent "completing"
and most importantly deleting it, which causes request
to be canceled in network layer. Just continue to monitor it
and await proper response from server. Also add circut breaker
to cancel request if proxy auth failed 3 times (for example
user keeps cancelling auth). This behavior happens only
when app registered WebRequest api listeners.
* Port chromium webrequest changes to electron code.
Move relevant parts of chromium WebRequestProxyingURLLoaderFactory from
https://chromium-review.googlesource.com/c/chromium/src/+/2011781
into electron ProxyingURLLoaderFactory.
* Update code to upstreamed version and remove retyr count failsafe.
Co-authored-by: Milan Burda <milan.burda@gmail.com>
* chore: add required header
Co-authored-by: marekharanczyk <48673767+marekharanczyk@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
* fix: microtasks policy in CreateEnvironment
Microtasks policy should not be updated for the renderer because
`NodeBindings::CreateEnvironment` might be entered with or without
`UvRunOnce()` on stack. One of the examples of such calls is
`window.open()` which is possible to invoke while `uv_run()` is still
running (e.g. with `setImmediate()`).
All in all, it doesn't matter that much which policy we use since
`v8::MicrotasksScope` has a check for the policy in its destructor and
no commits will be made if the policy is `kExplicit`. It is important,
however, to not change the policy in the middle of `UvRunOnce()` so we
should respect whatever we currently have and move on.
Fix: #29463
* Move test to a better place
* Update spec-main/fixtures/crash-cases/setimmediate-window-open-crash/index.html
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* Update spec-main/fixtures/crash-cases/setimmediate-window-open-crash/index.html
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* simplify crash-case
* comment
* fix comment
Co-authored-by: Fedor Indutny <fedor@indutny.com>
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Fedor Indutny <indutny@signal.org>
* Update represented-file fiddle.
* add index and code back to guide
Co-authored-by: Kevin Hartman <kevin@hart.mn>
Co-authored-by: Ethan Arrowood <ethan.arrowood@gmail.com>
Unlike the other files, this file had its executable bit set in its file
mode. This change removes the executable bit to align its file mode with
the rest of the files.
Signed-off-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: Darshan Sen <raisinten@gmail.com>
* remove version information from html
* change format for readability
* clarify which console the message should appear in
* minor changes to renderer.md
* update UI on click instead of developer console
* remove node-integration and fix md
* update content
* chore: remove ****
Co-authored-by: Jeremy Foster <jeremy.foster@live.com>
Co-authored-by: Ethan Arrowood <ethan.arrowood@gmail.com>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
Right now, if executing `xcrun` fails, then the error message prints the
second argument to the `xcrun.py` script, which is the first argument to
the tool that `xcrun` is executing, making the whole error message quite
confusing.
Consider the following error:
```
python ../../third_party/squirrel.mac/build/xcrun.py dtrace -h -s /private/tmp/20210531211008-def376dc/src/third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACSignalProvider.d -o /private/tmp/20210531211008-def376dc/src/out/release/gen/third_party/squirrel.mac/dtrace/RACSignalProvider.h
xcrun script '-h' failed with code '71':
xcrun: error: can't exec '/tmp/20210531211008-def376dc/dtrace' (errno=Permission denied)
```
The command that `xcrun` is executing is `dtrace`, but the error just
mentions the `-h` flag.
Notes: none
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Co-authored-by: Juan Cruz Viotti <jv@jviotti.com>
* feat: add experimental cookie encryption support (#27524)
* 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>
* chore: update patches
Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Electron already seems to support `cygwin`, so `msys` is a natural
addition. This is the only required change as far as I can see on my
local development environment, as otherwise the build scripts don't
realize that msys = windows.
Notes: none
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Co-authored-by: Juan Cruz Viotti <jv@jviotti.com>
* improve progress bar fiddle
* add comments to code snippet
* edits to progress-bar tutorial
* remove versions and nodeIntegration
* limit line length to 100
* implement standard linter suggestions
* add indeterminate and clear timers
* update to have reader replace all of main.js
* remove extra button
* loop the progress bar
* add logic to show reset state briefly
* Update docs/tutorial/progress-bar.md
Co-authored-by: Erick Zhao <erick@hotmail.ca>
* chore: fix lint
Co-authored-by: Jeremy Foster <jeremy.foster@live.com>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
* refactor: use main in release-notes
* fix: use default_branch in release-notes (#29415)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* remove version info from index.html page
* remove nodeIntegration
* format code and update readme
* add note to user in index.html
Co-authored-by: Jeremy Foster <jeremy.foster@live.com>
* build: include mksnapshot args in arm64 mksnapshot.zip
* get gen/v8/embedded.S from proper location
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* test: rebuild nan tests with libc++ and libc++abi (#29281)
* test: re-enable nan test: typedarrays-test.js
Fixes#28414.
I've confirmed this fix wfm on Linux. Pushing into a PR to get CI to run
it out on Win and Mac platforms too.
* chore: clarify comment
* test: fix NAN test string alignment
* test: (wip) add ldflags, archive file for libc++
* test: (wip) add libc++ to CircleCI
* test: (wip) add llvm flags
* test: (wip) change ldflag syntax
* test: (wip) build libc++abi as static
* fix: correct ldflags
* test: add ld env
* fix: do not commit this
* test: add lld from src to circleci
* test: add lld link to ld
* chore: preserve third_party
* seems legit
* sam swears this works kinda sort of sometimes'
:
* build: add gn visibility patch
* chore: update patches
* build: check for flatten_relative_to = false
* build: upload zip files, add to release.js validation
* debug: what the hell gn
* build: add libcxx gni to lint ignore
Linting the file adjusted the licenses array, which only contains
one value, and causes the gn check to fail later
* build: also use nan-spec-runner flags on Windows
* build: add linked flags for win32 only
* build: build libc++ as source on win
* build: clean up patch, add -fPIC for IA32
* build: delete libcxx .a files from root
* build: rename libc++.zip, clean up upload per platform
* build: fix gni lint
* ci: add libcxx gen to circleci config
* build: correct libcxx-object syntax
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
* build: correct libcxx_objects build action name
* build: only upload libcxx headers on linux
* build: ensure object files are included even if unparsable
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
* fix: invoke the window open handler for _blank links
* feat: add disposition to setWindowOpenHandler details
* fix: pass postData to new-window event
* postData can be heterogeneous
* fix type of postBody
* fix type of UploadFile and UploadRawData to be discriminated unions
* exclude the empty string from additionalFeatures
* add a test
* add postBody and referrer to setWindowOpenHandler args
* appease typescript
* Update api-browser-window-spec.ts
* update snapshots
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Remove index.html from offscreen-rendering tutorial.
It is not used.
Update offscreen-rendering.md to reflect changes to fiddle.
Co-authored-by: Kevin Hartman <kevin@hart.mn>
* Update docs for keyboard shortcuts
* Add a fiddle for web-apis
* Apply suggestions from code review
Co-authored-by: Erick Zhao <erick@hotmail.ca>
* Cleanup a few formatting errors and missed copies
* Add descriptions to index.html
* Focus on renderer
Co-authored-by: Tony Ferrell <anf@microsoft.com>
Co-authored-by: Tony Ferrell <tonyjf@gmail.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
* chore: bump chromium in DEPS to 91.0.4472.57
* chore: update patches
* try disabling gpu on WOA to see if it helps with failures
* chore: bump chromium in DEPS to 91.0.4472.69
* update patches
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Electron Bot <electron@github.com>
* Update the macos Dock Instructions
* Remove preload and ;'s
* Mixed ;s
* Update dock doc
* Add informational text to index.html
Co-authored-by: Tony Ferrell <anf@microsoft.com>
* Working
* Working
* Make the native-file drag and drop documents use context bridge
* Add per-file sections
* Use the updated link format
* Use path.join instead of string interpolation.
Co-authored-by: Antón Molleda <molant@users.noreply.github.com>
* Use fs.promises
Co-authored-by: Antón Molleda <molant@users.noreply.github.com>
* Update docs/tutorial/native-file-drag-drop.md
Co-authored-by: Antón Molleda <molant@users.noreply.github.com>
* fix formatting
Co-authored-by: Antón Molleda <molant@users.noreply.github.com>
* Update docs/tutorial/native-file-drag-drop.md
Co-authored-by: Antón Molleda <molant@users.noreply.github.com>
* Use more path.join instead of interpolation
* Update with PR suggestions
* Remove process.cwd() and add more example elements
* Minor text fix
* Fix typo
Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Tony Ferrell <anf@microsoft.com>
Co-authored-by: Tony Ferrell <tonyjf@gmail.com>
Co-authored-by: Antón Molleda <molant@users.noreply.github.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
All the other argument headers were h3 (`###`) but `--force-fieldtrials` was h2 (`##`) for some reason.
I changed it to make it consistent with the others.
Co-authored-by: Noelle Leigh <5957867+noelleleigh@users.noreply.github.com>
* fix: prevent crash when error occurs during event emitter CallMethod
* wip: emit error event within trycatch
* fix: handle uncaught exceptions within node on web_contents init
* fix: create gin_helper::CallMethodCatchException
* test: add web-contents create crash to test cases
* test: clean up test data for web-contents crash
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* fix: convert CatchException to WebContents static helper method
* fix: restore try_catch to callsite
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* Add that that menu must be added on whenReady
When an application menu is added before 'whenReady' all items seem to work except 'recent documents'
This causes the issue listed here: https://github.com/electron/electron/issues/17388
* Make example more complete
* Remove semicolons
* Update docs/tutorial/recent-documents.md
Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Matthijs Groen <matthijs.groen@gmail.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
* fix: allow Node.js to manage microtasks queue
When `uv_run()` resulted in invocation of JS functions the microtask
queue checkpoint in Node's CallbackScope was a no-op because the
expected microtask queue policy was `kExplicit` and Electron ran under
`kScoped` policy. This change switches policy to `kExplicit` right
before `uv_run()` and reverts it back to original value after `uv_run()`
completes to provide better compatibility with Node.
* add comment
Co-authored-by: Fedor Indutny <fedor@indutny.com>
* feat: add session.storagePath to get path on disk for session data
* spec: add session.storagePath tests
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
* docs: remove reference to global Electron install
This is a pattern that we actively want to discourage.
* docs: update as per review suggestion
Co-authored-by: Erick Zhao <erick@hotmail.ca>
This PR ensures that all API modules are present in the README doc,
as there were a couple missing. It also formats all modules to contain
a level-1 heading and a blockquote description.
Co-authored-by: Erick Zhao <erick@hotmail.ca>
This page is just a table writing out the contents of an array in
the Chromium source code. We don't actively maintain it, and
it's only referenced in one API, so it makes sense to just
link directly to the code here.
Co-authored-by: Erick Zhao <erick@hotmail.ca>
* fix: shell.trashItem crash when called in renderer
* Update api-shell-spec.ts
* Update spec-main/api-shell-spec.ts
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
When creating a widget on linux the bounds are restricted to the screen
size, when calling SetSize / SetBounds they are not. This fixes this
initialization issue by calling SetBounds after widget creation.
Noticed this issue while running linux tests on xvfb with a screen size
smaller than the default electron window size (resulted in a failed
test).
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
This fixes a flake on linux CI which started recently where the "write"
promise is being rejected after the request has been aborted /
cancelled. In this case we should drop the error to the floor but
instead we pass it down the stack where it eventually emits a now
unhandled error event.
Example failure: https://app.circleci.com/pipelines/github/electron/electron/38072/workflows/c1faf19b-aa41-4f99-a564-165729222859/jobs/838813
Verified fix by running the test that caused it 10000 times before fix
and 10000 times after. ~50 failures before, 0 after.
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
* build: give ASAN tests more memory
* test: re-eanble asan tests
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
* docs: note that new-window event is deprecated
* Update breaking-changes.md
* Update docs/breaking-changes.md
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* fix: call `UnregisterIsolate` consistently
`JavascriptEnvironment` is the class that calls `RegisterIsolate()`
so it should be the one to call `UnregisterIsolate`, and this can happen
right before disposing the aforementioned `isolate`.
See: https://github.com/electron/electron/pull/28468
* fix
Co-authored-by: Fedor Indutny <fedor@indutny.com>
* fix: pass postData to new-window event
* fix type of postBody
* fix type of UploadFile and UploadRawData to be discriminated unions
* exclude the empty string from additionalFeatures
* add a test
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* fix: move widget maximization check
* fix linting error
* change workaround to only effect transparent windows
* disable menu maximize and restore for transparent windows
* disable double clicking title bar max/unmax for transparent windows
* add docs change and address review
Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
* fix: reject task when description exceeds 260 characters
* Switched out wcslen() for size() [linear -> constant time]
* Included comment describing the need for the additional check
* Added information about character limit to documentation
* Added newline character to end of jump-list-category.md
Co-authored-by: SushiJackal <weingaben@gmail.com>
* chore: the minimum supported version is now 10.11
Chromium bumped this version back in December
* Update support.md
Co-authored-by: Samuel Attard <sam@electronjs.org>
This seems to just have been missing here, leaking memory
(and breaking the API contract for Node.js embedding).
Co-authored-by: Anna Henningsen <anna@addaleax.net>
* Update web-contents.md
The text block was rendered as part of the `features` property, not the `handler`
* fix linting
Co-authored-by: Alexander Prinzhorn <alexander@prinzhorn.it>
* fix: isolate Pepper plugins
Following suit with a recent change to the same method in Chromium, we
should also isloate Pepper plugins.
* docs: add more context to comment
* fix: remove unsupported test flag behavior
Co-authored-by: clavin <cwatford@slack-corp.com>
* Fix custom scheme not registered as service worker scheme
* ServiceWorker loaders do not have WebContents associated
* Add test for service worker
* Revert "Fix custom scheme not registered as service worker scheme"
This reverts commit a249235b22.
* Add scheme to ServiceWorkerSchemes
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
desktopCapture.getSources() returns a promise which should resolve
when capturing finishes. Internally it creates an instance of
DesktopCapturer which is responsible for resolving or rejecting
the promise.
Between the time DesktopCapturer starts capturing frames and when
it finishes, it's possible for its handle to be GC'd leading to
it never resolving.
These changes pin the instance of DesktopCapturer until it either
finishes or errors.
fixes#25595
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
* docs: Update Quick Start Guide for Electron 12
With `contextIsolation` enabled by default in Electron 12, the Getting Started Guide no longer works as it is written. In order for the basic example to display values from `process.versions`, we need to add a `preload.js` to the example.
* Trigger Build
* docs: add missing curly brace to quick start example code
* test: running child app under ASan might receive SIGKILL
* test: renderer process of webview might receive SIGKILL under ASan
* test: increase timeout for asan build
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
* fix: handle a nil backgroundColor in win.getBackgroundColor()
* spec: add crash case
* fix: update to fix native_views transparent color
* chore: fix lint
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
* fix: ensure child window transparency works
Windows opened via window.open and intecepted via setWindowOpenHandler
or the `new-window` event should (a) have the correct background color
and (b) that background color should be transparent if specified.
The changes in api_web_contents fix (a) and the changes in
web_contents_preferences fix (b).
Notes: Child windows with specified background colors or transpency now
work as intended
* fix: set background_color in blink prefs apply logic
* chore: update for PR comments
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
@@ -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!_
"_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",
@@ -753,7 +753,8 @@ Overrides the current application's name.
### `app.getLocale()`
Returns `String` - The current application locale. Possible return values are documented [here](locales.md).
Returns `String` - The current application locale, fetched using Chromium's `l10n_util` library.
Possible return values are documented [here](https://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc).
To set the locale, you'll want to use a command line switch at app startup, which may be found [here](https://github.com/electron/electron/blob/master/docs/api/command-line-switches.md).
@@ -929,6 +930,10 @@ re-add a removed item to a custom category earlier than that will result in the
entire custom category being omitted from the Jump List. The list of removed
items can be obtained using `app.getJumpListSettings()`.
**Note:** The maximum length of a Jump List item's `description` property is
260 characters. Beyond this limit, the item will not be added to the Jump
List, nor will it be displayed.
Here's a very simple example of creating a custom Jump List:
```javascript
@@ -1188,8 +1193,8 @@ badge.
On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
for more information please read [Desktop Environment Integration][unity-requirement].
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
please read the [Unity integration documentation][unity-requirement].
### `app.getBadgeCount()` _Linux_ _macOS_
@@ -1427,8 +1432,8 @@ An `Integer` property that returns the badge count for current app. Setting the
On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
for more information please read [Desktop Environment Integration][unity-requirement].
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
please read the [Unity integration documentation][unity-requirement].
**Note:** On macOS, you need to ensure that your application has the permission
to display notifications for this property to take effect.
@@ -1456,7 +1461,7 @@ A `Boolean` property that returns `true` if the app is packaged, `false` otherw
@@ -187,9 +187,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
*`parent` BrowserWindow (optional) - Specify parent window. Default is `null`.
*`modal` Boolean (optional) - Whether this is a modal window. This only works when the
window is a child window. Default is `false`.
*`acceptFirstMouse` Boolean (optional) - Whether the web view accepts a single
mouse-down event that simultaneously activates the window. Default is
`false`.
*`acceptFirstMouse` Boolean (optional) - Whether clicking an inactive window will also
click through to the web contents. Default is `false` on macOS. This option is not
configurable on other platforms.
*`disableAutoHideCursor` Boolean (optional) - Whether to hide cursor when typing.
Default is `false`.
*`autoHideMenuBar` Boolean (optional) - Auto hide the menu bar unless the `Alt`
@@ -213,16 +213,13 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
*`followWindow` - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.
*`active` - The backdrop should always appear active.
*`inactive` - The backdrop should always appear inactive.
*`titleBarStyle` String (optional) - The style of window title bar.
*`titleBarStyle` String (optional)_macOS__Windows_ - The style of window title bar.
Default is `default`. Possible values are:
*`default` - Results in the standard gray opaque Mac title
bar.
*`hidden` - Results in a hidden title bar and a full size content window, yet
the title bar still has the standard window controls ("traffic lights") in
the top left.
*`hiddenInset` - Results in a hidden title bar with an alternative look
*`default` - Results in the standard title bar for macOS or Windows respectively.
*`hidden` - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with `titleBarOverlay: true` it will activate the Window Controls Overlay (see `titleBarOverlay` for more information), otherwise no window controls will be shown.
*`hiddenInset` - Only on macOS, results in a hidden title bar with an alternative look
where the traffic light buttons are slightly more inset from the window edge.
*`customButtonsOnHover` - Results in a hidden title bar and a full size
*`customButtonsOnHover` - Only on macOS, results in a hidden title bar and a full size
content window, the traffic light buttons will display when being hovered
over in the top left of the window. **Note:** This option is currently
experimental.
@@ -238,7 +235,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
window shadow and window animations. Default is `true`.
*`vibrancy` String (optional) - Add a type of vibrancy effect to the window, only on
macOS. Can be `appearance-based`, `light`, `dark`, `titlebar`, `selection`,
`menu`, `popover`, `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please note that using `frame: false` in combination with a vibrancy value requires that you use a non-default `titleBarStyle` as well. Also note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` are deprecated and have been removed in macOS Catalina (10.15).
`menu`, `popover`, `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` are deprecated and have been removed in macOS Catalina (10.15).
*`zoomToPageWidth` Boolean (optional) - Controls the behavior on macOS when
option-clicking the green stoplight button on the toolbar or by clicking the
Window > Zoom menu item. If `true`, the window will grow to the preferred
@@ -267,12 +264,12 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
be the absolute file path to the script.
When node integration is turned off, the preload script can reintroduce
Node global symbols back to the global scope. See example
*`sandbox` Boolean (optional) - If set, this will sandbox the renderer
associated with the window, making it compatible with the Chromium
OS-level sandbox and disabling the Node.js engine. This is not the same as
the `nodeIntegration` option and the APIs available to the preload script
are more limited. Read more about the option [here](sandbox-option.md).
are more limited. Read more about the option [here](../tutorial/sandbox.md).
*`enableRemoteModule` Boolean (optional) - Whether to enable the [`remote`](remote.md) module.
Default is `false`.
*`session` [Session](session.md#class-session) (optional) - Sets the session used by the
@@ -339,7 +336,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
more details.
*`contextIsolation` Boolean (optional) - Whether to run Electron APIs and
the specified `preload` script in a separate JavaScript context. Defaults
to `false`. The context that the `preload` script runs in will only have
to `true`. The context that the `preload` script runs in will only have
access to its own dedicated `document` and `window` globals, as well as
its own set of JavaScript builtins (`Array`, `Object`, `JSON`, etc.),
which are all invisible to the loaded content. The Electron API will only
@@ -351,8 +348,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
context in the dev tools by selecting the 'Electron Isolated Context'
entry in the combo box at the top of the Console tab.
*`worldSafeExecuteJavaScript` Boolean (optional) - If true, values returned from `webFrame.executeJavaScript` will be sanitized to ensure JS values
can't unsafely cross between worlds when using `contextIsolation`. The default
is `false`. In Electron 12, the default will be changed to `true`. _Deprecated_
can't unsafely cross between worlds when using `contextIsolation`. Defaults to `true`. _Deprecated_
*`nativeWindowOpen` Boolean (optional) - Whether to use native
`window.open()`. Defaults to `false`. Child windows will always have node
integration disabled unless `nodeIntegrationInSubFrames` is true. **Note:** This option is currently
@@ -404,6 +400,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
contain the layout of the document—without requiring scrolling. Enabling
this will cause the `preferred-size-changed` event to be emitted on the
`WebContents` when the preferred size changes. Default is `false`.
*`titleBarOverlay` [OverlayOptions](structures/overlay-options.md) | Boolean (optional) - When using a frameless window in conjuction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`. On Windows, the [OverlayOptions](structures/overlay-options.md) can be used instead of a boolean to specify colors for the overlay.
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
@@ -986,7 +983,7 @@ the player itself we would call this function with arguments of 16/9 and
are within the content view--only that they exist. Sum any extra width and
height areas you have within the overall content view.
The aspect ratio is not respected when window is resized programmingly with
The aspect ratio is not respected when window is resized programmatically with
APIs like `win.setSize`.
#### `win.setBackgroundColor(backgroundColor)`
@@ -1301,7 +1298,7 @@ can be be used to listen to changes to tablet mode.
#### `win.getMediaSourceId()`
Returns `String` - Window id in the format of DesktopCapturerSource's id. For example "window:1234:0".
Returns `String` - Window id in the format of DesktopCapturerSource's id. For example "window:1324:0".
More precisely the format is `window:id:other_id` where `id` is `HWND` on
Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
@@ -1319,6 +1316,8 @@ The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
*`message` Integer
*`callback` Function
*`wParam` any - The `wParam` provided to the WndProc
*`lParam` any - The `lParam` provided to the WndProc
Hooks a windows message. The `callback` is called when
the message is received in the WndProc.
@@ -1371,7 +1370,7 @@ Returns `Boolean` - Whether the window's document has been edited.
Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page.
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page. If the page is not visible, `rect` may be empty.
#### `win.loadURL(url[, options])`
@@ -1380,7 +1379,7 @@ Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
*`httpReferrer` (String | [Referrer](structures/referrer.md)) (optional) - An HTTP Referrer URL.
*`userAgent` String (optional) - A user agent originating the request.
*`extraHeaders` String (optional) - Extra headers separated by "\n"
*`baseURLForDataURL` String (optional) - Base URL (with trailing path separator) for files to be loaded by the data URL. This is needed only if the specified `url` is a data URL and needs to load other files.
Returns `Promise<void>` - the promise will resolve when the page has finished loading
@@ -1688,7 +1687,7 @@ current window into a top-level window.
#### `win.getParentWindow()`
Returns `BrowserWindow` - The parent window.
Returns `BrowserWindow | null` - The parent window or `null` if there is no parent.
#### `win.getChildWindows()`
@@ -1808,3 +1807,5 @@ removed in future Electron releases.
*`apiKey` String - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`.
*`api` any - Your API, more information on what this API can be and how it works is available below.
@@ -50,7 +50,7 @@ The `contextBridge` module has the following methods:
### API
The `api` provided to [`exposeInMainWorld`](#contextbridgeexposeinmainworldapikey-api-experimental) must be a `Function`, `String`, `Number`, `Array`, `Boolean`, or an object
The `api` provided to [`exposeInMainWorld`](#contextbridgeexposeinmainworldapikey-api) must be a `Function`, `String`, `Number`, `Array`, `Boolean`, or an object
whose keys are strings and values are a `Function`, `String`, `Number`, `Array`, `Boolean`, or another nested object that meets the same conditions.
`Function` values are proxied to the other context and all other values are **copied** and **frozen**. Any data / primitives sent in
@@ -110,3 +110,22 @@ has been included below for completeness:
| `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.
### Exposing Node Global Symbols
The `contextBridge` can be used by the preload script to give your renderer access to Node APIs.
The table of supported types described above also applies to Node APIs that you expose through `contextBridge`.
Please note that many Node APIs grant access to local system resources.
Be very cautious about which globals and APIs you expose to untrusted remote content.
*`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.
@@ -112,7 +112,7 @@ Returns `Promise<Object>` - Resolve with an object containing the following:
*`canceled` Boolean - whether or not the dialog was canceled.
*`filePaths` String[] - An array of file paths chosen by the user. If the dialog is cancelled this will be an empty array.
*`bookmarks` String[](optional) _macOS__mas_ - An array matching the `filePaths` array of base64 encoded strings which contains security scoped bookmark data. `securityScopedBookmarks` must be enabled for this to be populated. (For return values, see [table here](#bookmarks-array).)
*`bookmarks` String[] (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.
There's an alternative way to specify a chromeless window.
There's an alternative way to specify a chromeless window on macOS and Windows.
Instead of setting `frame` to `false` which disables both the titlebar and window controls,
you may want to have the title bar hidden and your content extend to the full window size,
yet still preserve the window controls ("traffic lights") for standard window actions.
yet still preserve the window controls ("traffic lights" on macOS) for standard window actions.
You can do so by specifying the `titleBarStyle` option:
#### `hidden`
Results in a hidden title bar and a full size content window, yet the title bar still has the standard window controls (“traffic lights”) in the top left.
Results in a hidden title bar and a full size content window. On macOS, the title bar still has the standard window controls (“traffic lights”) in the top left.
Results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.
@@ -61,6 +63,35 @@ const win = new BrowserWindow({ titleBarStyle: 'customButtonsOnHover', frame: fa
win.show()
```
## Windows Control Overlay
When using a frameless window in conjuction with `win.setWindowButtonVisibility(true)` on macOS, using one of the `titleBarStyle`s as described above so
that the traffic lights are visible, or using `titleBarStyle: hidden` on Windows, you can access the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and
[CSS Environment Variables][overlay-css-env-vars] by setting the `titleBarOverlay` option to true. Specifying `true` will result in an overlay with default system colors.
On Windows, you can also specify the color of the overlay and its symbols by setting `titleBarOverlay` to an object with the options `color` and `symbolColor`. If an option is not specified, the color will default to its system color for the window control buttons:
```javascript
const{BrowserWindow}=require('electron')
constwin=newBrowserWindow({
titleBarStyle:'hidden',
titleBarOverlay:true
})
win.show()
```
```javascript
const{BrowserWindow}=require('electron')
constwin=newBrowserWindow({
titleBarStyle:'hidden',
titleBarOverlay:{
color:'#2f3241',
symbolColor:'#74b1be'
}
})
win.show()
```
## Transparent window
By setting the `transparent` option to `true`, you can also make the frameless
@@ -83,8 +114,10 @@ win.show()
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
* 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
@@ -184,3 +217,5 @@ behave correctly on all platforms you should never use a custom context menu on
*`webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. Cross origin sub frames making permission checks will pass a `null` webContents to this handler. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
*`webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. All cross origin sub frames making permission checks will pass a `null` webContents to this handler, while certain other permission checks such as `notifications` checks will always pass `null`. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
*`permission` String - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, or `serial`.
*`requestingOrigin` String - The origin URL of the permission check
*`details` Object - Some properties are only available on certain permission types.
@@ -822,6 +823,11 @@ Returns `Extension[]` - A list of all loaded extensions.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
#### `ses.getStoragePath()`
A `String | null` indicating the absolute file system path where data for this
session is persisted on disk. For in memory sessions this returns `null`.
### Instance Properties
The following properties are available on instances of `Session`:
@@ -835,6 +841,11 @@ code to the `setSpellCheckerLanguages` API that isn't in this array will result
A `Boolean` indicating whether builtin spell checker is enabled.
#### `ses.storagePath` _Readonly_
A `String | null` indicating the absolute file system path where data for this
session is persisted on disk. For in memory sessions this returns `null`.
#### `ses.cookies` _Readonly_
A [`Cookies`](cookies.md) object for this session.
Returns `WebContents` | undefined - A WebContents instance with the given ID, or
`undefined` if there is no WebContents associated with the given ID.
### `webContents.fromDevToolsTargetId(targetId)`
*`targetId` String - The Chrome DevTools Protocol [TargetID](https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID) associated with the WebContents instance.
Returns `WebContents` | undefined - A WebContents instance with the given TargetID, or
`undefined` if there is no WebContents associated with the given TargetID.
When communicating with the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/),
it can be useful to lookup a WebContents instance based on its assigned TargetID.
*`baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
Returns `Promise<void>` - the promise will resolve when the page has finished loading
@@ -1184,6 +1206,16 @@ Ignore application menu shortcuts while this web contents is focused.
*`url` String - The _resolved_ version of the URL passed to `window.open()`. e.g. opening a window with `window.open('foo')` will yield something like `https://the-origin/the/current/path/foo`.
*`frameName` String - Name of the window provided in `window.open()`
*`features` String - Comma separated list of window features provided to `window.open()`.
*`disposition` String - Can be `default`, `foreground-tab`, `background-tab`,
`new-window`, `save-to-disk` or `other`.
*`referrer` [Referrer](structures/referrer.md) - The referrer that will be
passed to the new window. May or may not result in the `Referer` header being
sent, depending on the referrer policy.
*`postBody` [PostBody](structures/post-body.md) (optional) - The post data that
will be sent to the new window, along with the appropriate headers that will
be set. If no post data is to be sent, the value will be `null`. Only defined
when the window is being created by a form that set `target=_blank`.
Returns `{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}` - `deny` cancels the creation of the new
window. `allow` will allow the new window to be created. Specifying `overrideBrowserWindowOptions` allows customization of the created window.
Returning an unrecognized value such as a null, undefined, or an object
@@ -1320,8 +1352,7 @@ Inserts `text` to the focused element.
*`text` String - Content to be searched, must not be empty.
*`options` Object (optional)
*`forward` Boolean (optional) - Whether to search forward or backward, defaults to `true`.
*`findNext` Boolean (optional) - Whether the operation is first request or a followup,
defaults to `false`.
*`findNext` Boolean (optional) - Whether to begin a new text finding session with this request. Should be `true` for initial requests, and `false` for follow-up requests. Defaults to `false`.
*`matchCase` Boolean (optional) - Whether search should be case-sensitive,
defaults to `false`.
@@ -1363,19 +1394,21 @@ Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
Returns `Boolean` - Whether this page is being captured. It returns true when the capturer count
*`baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
Returns `Promise<void>` - The promise will resolve when the page has finished loading
@@ -515,8 +519,7 @@ Inserts `text` to the focused element.
*`text` String - Content to be searched, must not be empty.
*`options` Object (optional)
*`forward` Boolean (optional) - Whether to search forward or backward, defaults to `true`.
*`findNext` Boolean (optional) - Whether the operation is first request or a followup,
defaults to `false`.
*`findNext` Boolean (optional) - Whether to begin a new text finding session with this request. Should be `true` for initial requests, and `false` for follow-up requests. Defaults to `false`.
*`matchCase` Boolean (optional) - Whether search should be case-sensitive,
defaults to `false`.
@@ -719,6 +722,10 @@ Corresponds to the points in time when the spinner of the tab starts spinning.
Corresponds to the points in time when the spinner of the tab stops spinning.
### Event: 'did-attach'
Fired when attached to the embedder web contents.
### Event: 'dom-ready'
Fired when document in the given frame is loaded.
@@ -839,6 +846,19 @@ this purpose.
Calling `event.preventDefault()` does __NOT__ have any effect.
### Event: 'did-start-navigation'
Returns:
*`url` String
*`isInPlace` Boolean
*`isMainFrame` Boolean
*`frameProcessId` Integer
*`frameRoutingId` Integer
Emitted when any frame (including main) starts navigating. `isInPlace` will be
`true` for in-page navigations.
### Event: 'did-navigate'
Returns:
@@ -851,6 +871,23 @@ This event is not emitted for in-page navigations, such as clicking anchor links
or updating the `window.location.hash`. Use `did-navigate-in-page` event for
this purpose.
### Event: 'did-frame-navigate'
Returns:
*`url` String
*`httpResponseCode` Integer - -1 for non HTTP navigations
*`httpStatusText` String - empty for non HTTP navigations,
*`isMainFrame` Boolean
*`frameProcessId` Integer
*`frameRoutingId` Integer
Emitted when any frame navigation is done.
This event is not emitted for in-page navigations, such as clicking anchor links
or updating the `window.location.hash`. Use `did-navigate-in-page` event for
this purpose.
### Event: 'did-navigate-in-page'
Returns:
@@ -967,3 +1004,78 @@ Emitted when DevTools is focused / opened.
*`linkURL` String - URL of the link that encloses the node the context menu
was invoked on.
*`linkText` String - Text associated with the link. May be an empty
string if the contents of the link are an image.
*`pageURL` String - URL of the top level page that the context menu was
invoked on.
*`frameURL` String - URL of the subframe that the context menu was invoked
on.
*`srcURL` String - Source URL for the element that the context menu
was invoked on. Elements with source URLs are images, audio and video.
*`mediaType` String - Type of the node the context menu was invoked on. Can
be `none`, `image`, `audio`, `video`, `canvas`, `file` or `plugin`.
*`hasImageContents` Boolean - Whether the context menu was invoked on an image
which has non-empty contents.
*`isEditable` Boolean - Whether the context is editable.
*`selectionText` String - Text of the selection that the context menu was
invoked on.
*`titleText` String - Title text of the selection that the context menu was
invoked on.
*`altText` String - Alt text of the selection that the context menu was
invoked on.
*`suggestedFilename` String - Suggested filename to be used when saving file through 'Save
Link As' option of context menu.
*`selectionRect` [Rectangle](structures/rectangle.md) - Rect representing the coordinates in the document space of the selection.
*`selectionStartOffset` Number - Start position of the selection text.
*`referrerPolicy` [Referrer](structures/referrer.md) - The referrer policy of the frame on which the menu is invoked.
*`misspelledWord` String - The misspelled word under the cursor, if any.
*`dictionarySuggestions` String[] - An array of suggested words to show the
user to replace the `misspelledWord`. Only available if there is a misspelled
word and spellchecker is enabled.
*`frameCharset` String - The character encoding of the frame on which the
menu was invoked.
*`inputFieldType` String - If the context menu was invoked on an input
field, the type of that field. Possible values are `none`, `plainText`,
`password`, `other`.
*`spellcheckEnabled` Boolean - If the context is editable, whether or not spellchecking is enabled.
*`menuSourceType` String - Input source that invoked the context menu.
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.
*`mediaFlags` Object - The flags for the media element the context menu was
invoked on.
*`inError` Boolean - Whether the media element has crashed.
*`isPaused` Boolean - Whether the media element is paused.
*`isMuted` Boolean - Whether the media element is muted.
*`hasAudio` Boolean - Whether the media element has audio.
*`isLooping` Boolean - Whether the media element is looping.
*`isControlsVisible` Boolean - Whether the media element's controls are
visible.
*`canToggleControls` Boolean - Whether the media element's controls are
toggleable.
*`canPrint` Boolean - Whether the media element can be printed.
*`canSave` Boolean - Whether or not the media element can be downloaded.
*`canShowPictureInPicture` Boolean - Whether the media element can show picture-in-picture.
*`isShowingPictureInPicture` Boolean - Whether the media element is currently showing picture-in-picture.
*`canRotate` Boolean - Whether the media element can be rotated.
*`canLoop` Boolean - Whether the media element can be looped.
*`editFlags` Object - These flags indicate whether the renderer believes it
is able to perform the corresponding action.
*`canUndo` Boolean - Whether the renderer believes it can undo.
*`canRedo` Boolean - Whether the renderer believes it can redo.
*`canCut` Boolean - Whether the renderer believes it can cut.
*`canCopy` Boolean - Whether the renderer believes it can copy.
*`canPaste` Boolean - Whether the renderer believes it can paste.
*`canDelete` Boolean - Whether the renderer believes it can delete.
*`canSelectAll` Boolean - Whether the renderer believes it can select all.
*`canEditRichly` Boolean - Whether the renderer believes it can edit text richly.
Emitted when there is a new context menu that needs to be handled.
The `new-window` event of WebContents has been deprecated. It is replaced by [`webContents.setWindowOpenHandler()`](api/web-contents.md#contentssetwindowopenhandlerhandler).
```js
// Deprecated in Electron 13
webContents.on('new-window',(event)=>{
event.preventDefault()
})
// Replace with
webContents.setWindowOpenHandler((details)=>{
return{action:'deny'}
})
```
## Planned Breaking API Changes (12.0)
### Removed: Pepper Flash support
@@ -160,6 +176,9 @@ the previous behavior, `contextIsolation: false` must be specified in WebPrefere
We [recommend having contextIsolation enabled](https://github.com/electron/electron/blob/master/docs/tutorial/security.md#3-enable-context-isolation-for-remote-content) for the security of your application.
Another implication is that `require()` cannot be used in the renderer process unless
`nodeIntegration` is `true` and `contextIsolation` is `false`.
For more details see: https://github.com/electron/electron/issues/23506
Follow the guidelines below for building Electron.
Follow the guidelines below for building **Electron itself**, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the [application distribution][application-distribution] guide.
Follow the guidelines below for building Electron on Linux.
Follow the guidelines below for building **Electron itself** on Linux, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the [application distribution][application-distribution] guide.
Follow the guidelines below for building Electron on macOS.
Follow the guidelines below for building **Electron itself** on macOS, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the [application distribution][application-distribution] guide.
Follow the guidelines below for building Electron on Windows.
Follow the guidelines below for building **Electron itself** on Windows, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the [application distribution][application-distribution] guide.
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.