* feat: add will-navigate-in-frame event to webContents
* docs: add documentation for webview will-frame-navigate event
* feat: Eliminate isInPlace argument from will-frame-navigate event
* fix: Fire will-frame-navigate before will-navigate
* feat: send will-frame-navigate with a WebFrameMain in the event details
* docs: Update WebContents docs for new API signature
* feat: Add custom event forwarding for <webview> will-frame-navigate
* fix: wrap WebFrameMain so it can be sent as an event
* test: update webContents and <webview> tests to match new signatures
* chore: undo unnecessary change
* fix: don't switch will-navigate to use EmitNavigationEventDetails
* test: clean up will-navigate and will-frame-navigate tests for <webview>
* chore: apply lint fixes
* chore: move GetRenderFrameHost helper into anonymous namespace
* docs: auto-generate WillFrameNavigateDetails rather than defining it manually
* test: Update <webview> tests to actually pass under new spec runner
* docs: Add section explaining relationship between various nav events
* test: Add some tests to ensure navigation event order doesn't silently change
* test: Always monitor all nav events to ensure unexpected ones don't fire
* test: Add test to verify in-page navigation event order
* feat: Change to new style where extra params are exposed as event props
* fix: Remove unused EmitNavigationEventDetails
* fix: Update tests to use new async helpers
* docs: Rename and reorder sections documenting navigation events
---------
Co-authored-by: Milan Burda <milan.burda@gmail.com>
* fix: allow cancelling of bluetooth requests
allows cancelling of bluetooth requests when no devices present
* docs: update docs to reflect how bluetooth works.
* fix: use base::Value::Dict:::Remove() instead of RemoveKe()
the latter is deprecated.
* fix: use base::Value::Dict::FindString() instead of base::Value::FindStringKey()
The latter is deprecated.
* chore: make lint happy
* Allow an absolute path to be used for creating sessions
Allows an absolute path to be used for creating sessions
by adding the session.fromPath() API.
* Fixup! Clarify that an emptry string is not permitted as a parameter to fromPath()
* chore: bump chromium in DEPS to 113.0.5645.0
* chore: update patches/chromium/mas_avoid_usage_of_private_macos_apis.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4300129
Fix simple code shear
* chore: update patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4297496
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4327491
patch-fuzz update; no manual changes
* chore: remove patches/chromium/fix_x11_window_restore_minimized_maximized_window.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4252946
Upstreamed by zcbenz, so local patch is no longer needed
* chore: update chromium/printing.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4313019
Remove cookie parameter from PrintViewManagerBase::UpdatePrintSettings()
* chore: remove NOTIMPLEMENTED BrowserProcessImpl::GetBreadcrumbPersistentStorageManager()
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4247145
method removed upstream, so we do not need to add a stub for it in the subclass
* chore: remove PrintViewManagerElectron::UpdatePrintSettings()
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4313019
Previously, our implementation checked to see if we recognized the
cookie param that was passed in. If so, we reported a bad message.
Otherwise, we passed it up to the base class' UpdatePrintSettings().
CL4313019 removed the cookie param, so checking for a bad cookie
param is no longer necessary / no longer possible. Since the only
remaining task was to pass the work up to the base class, this commit
removes the subclass implmentation entirely.
* chore: update patches
* chore: bump chromium in DEPS to 113.0.5647.0
* chore: bump chromium in DEPS to 113.0.5649.2
* chore: bump chromium in DEPS to 113.0.5651.0
* chore: update patches
---------
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: deepak1556 <hop2deep@gmail.com>
* fix: about panel is a base::Value::Dict
* nix this test for a diff PR
* what if the about dialog was not blocking
* add this test back in
* document synchronicity
* github editor is a fan of spaces
* build: ignore makeLatest on pre-releases
* chore: set makeLatest to false by default
Co-authored-by: Samuel Attard <sam@electronjs.org>
---------
Co-authored-by: Samuel Attard <sam@electronjs.org>
* feat: enable whole-program optimization
Enable whole-program optimization in electron native modules by default.
* pass --with-ltcg to configure.py instead of setting variable
* enable ltcg only on windows
Co-authored-by: Kyrylo Hrechykhin <khrechykhin@microsoft.com>
Change factuality and word choice.
Added "or WOW" to the phrase, "when they are running the x64 version under Rosetta", to reflect the use of a supported platform, Windows, as a possible scenario.
Changed the wording of that same sentence to make it appear clearer. "incorrectly" to "mistakenly" and moved this word to before the verb instead of the end of the sentence.
#### Description of Change
The first sentence within the documentation "[Important: signing your code](https://www.electronjs.org/docs/latest/tutorial/tutorial-packaging#important-signing-your-code)" is grammatically incorrect.
> In order to distribute desktop applications to end users, we highly recommended for you to code sign your Electron app.
I've adjusted the copy to switch "highly recommended" to "highly recommend". I've also switched out "for you to code sign" for "that you code sign" for clarity.
> In order to distribute desktop applications to end users, we _highly recommend_ that you **code sign** your Electron app.
docs: fix code highlighting in preload tutorial
The highlighted lines in the code snippets were unaligned,
which could cause a newcomer unneeded confusion on what
lines need to be changed.
Fix incorrect highlight in an example snippet
At the moment, the "Communicating between processes" `main.js` snippet highlights the line containing `})` when the relevant line is `ipcMain.handle('ping', () => 'pong')`.
* fix: use the process cache to reduce the memory for asar file
* Update shell/common/api/electron_api_asar.cc
Co-authored-by: webster.xu <webster.xu@ringcentral.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
When creating branded release builds and using scripts/strip-binaries.py
on Linux, the final artifacts end up unstripped due to the static set of
binaries considered for stripping.
With this patch the name of the electron binary is taken from the
BRANDING.json `project_name` key.
Signed-off-by: Robert Günzler <r@gnzler.io>
Signed-off-by: Robert Günzler <r@gnzler.io>
* Add MDN link to web-request-filter.md
When I was using the Electron docs I wanted to know how to use [webRequest.onBeforeSendHeaders](https://www.electronjs.org/docs/latest/api/web-request#webrequestonbeforesendheadersfilter-listener) but I was unable to correctly guess the correct format for the `WebRequestFilter` URL strings, and there was no explanation in the Electron docs. Eventually I googled it and found the MDN article which helped me.
* Update docs/api/structures/web-request-filter.md
Co-authored-by: Black-Hole <158blackhole@gmail.com>
* Update docs/api/structures/web-request-filter.md
Co-authored-by: Black-Hole <158blackhole@gmail.com>
Co-authored-by: Black-Hole <158blackhole@gmail.com>
* docs: fix broken links
* docs: change link to navigator.getUserMedia
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* docs: fix link in examples.md
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* chore: drop support for Windows 7 & 8
* chore: remove disable-redraw-lock.patch
* chore: update patches
* Update docs/breaking-changes.md
Co-authored-by: Erick Zhao <erick@hotmail.ca>
* Update docs/breaking-changes.md
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
* fix breaking-changes.md
* chore: note last supported version
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* chore: add link to deprecation policy
* Update docs/breaking-changes.md
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* update README.md
Co-authored-by: Milan Burda <miburda@microsoft.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* feat: add support for WebUSB
* fixup for gn check
* fixup gn check on Windows
* Apply review feedback
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: address review feedback
* chore: removed unneeded code
* Migrate non-default ScopedObservation<> instantiations to ScopedObservationTraits<> in chrome/browser/
https://chromium-review.googlesource.com/c/chromium/src/+/4016595
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* build: update devcontainer to latest build image
* build: add update-content-command
* build: set good vscode config
* build: be less noisy in update command
* build: only run sync in prebuild environment
* build: list env vars
* build: run sync always
* refactor: change defined(MAS_BUILD) to IS_MAS_BUILD()
This is missing-definition safe and thus allows us to move the definition of this macro away from "all compilation targets" to "just the compilation targets that depend on this macro".
In turn this makes the rebuild time changing from mas <-> darwin only 80 seconds on my machine, instead of the 12-15 minutes it used to take. This will also allow us in the future to build both MAS and darwin on the same CI machine. Costing us ~2 minutes on one machine but saving us anywhere from 30 minutes to an hour of CI time on other parts of the matrix.
* build: always define IS_MAS_BUILD even on non-mac builds
* build: use extra_configs
* fix: abort ShipIt installation attempt at the final mile if the app is running
* chore: remove only
* Update patches/squirrel.mac/fix_abort_installation_attempt_at_the_final_mile_if_the_app_is.patch
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* chore: update patches
* spec: make the ShipIt process lister helper more resilient
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
* feat: add app.getSystemLanguage() API
* Change the API to getPreferredSystemLanguages
* Fix test
* Clarify docs and add Linux impl
* Remove USE_GLIB
* Don't add C to list
* Remove examples since there's a lot of edge cases
* Fix lint
* Add examples
* Fix compile error
* Apply PR feedback
* Update the example
* Updated docs on uploading
- replaced mention of Application Loader with Apple Transporter, its replacement
- replaced mention of iTunes Connect with App Store Connect
- updated link for creating a record
* Update mac-app-store-submission-guide.md
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
* feat: Add BrowserWindow option to ignore Mission Control (macOS)
* There are many circumstances when app developers may want to hide their
windows from mission control. E.g., full screen overlays, small helper
windows, dialogs, etc.
* This PR adds the functionality, docs, and tests.
* chore:Rename variables
* Update shell/browser/native_window_mac.h
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Correcting main example
The entry `*://electron.github.io` is invalid and produces an exception. i.e.
> UnhandledPromiseRejectionWarning: TypeError: Invalid url pattern *://electron.github.io: Empty path.
Setting a valid path to resolve this issue
* build: determine electron version from tags not files
* build: make electron_version dependent on packed-refs and git HEAD
* build: do not delete electron/.git
* build: do not revert a commit we didn't make
* build: gen version file instead of just writing it
* build: update cache and ninja targets
* build: copy resource.h to generated electron.rc
* build: electron_win32_resources should be public deps
* build: also copy the icon
Fixed MenuItem documentation
Some of the items in the list of possible roles were formatted differently, which made it harder to read.
Sorry if this was intended, but I found it easier to read with them all formatted the same.
* hore: Move draggable regions implementation from NativeBrowserView into InspectableWebContentsView
The draggable regions implementation is related to WebView, so
InspectableWebContentsView is a more appropriate place to put it there.
Also, this refactoring will allow the subsequent extension of the
WebContentsView API, which will eventually replace BrowserView API.
* fix: Lint error
* fix: Adjusted owner-window
* refactor: use views NonClientHitTest for draggable regions on mac
* iwyu
* add backport of 9bb5f0316
* chore: update patches
* remove some unneeded functions
* remove test for triggering when BW is focused
* chore: update patches
* simplify views/mac split now that the draggable logic is the same
* Apply suggestions from code review
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* Update shell/browser/native_window.h
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix build
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* docs: use webContents.mainFrame.on() in MessagePort tutorial
* Update docs/tutorial/message-ports.md
Co-authored-by: Samuel Maddock <smaddock@salesforce.com>
Co-authored-by: Samuel Maddock <smaddock@salesforce.com>
feat: ensure mas builds of the same application can use safestorage
This change ensures that MAS builds of applications with an equivilant darwin build that share the same name do not fight over access to the same Safe Storage account.
Specifically this changes the account name for app "My App" from "My App" to "My App AppStore" if the app is using a MAS build of Electron.
We attempt to migrate the safe storage key from the old account, if that migration succeeds we delete the old key and move on.
Existing apps that aren't built for the app store should be unimpacted, there is one edge case where a user uses BOTH an AppStore and a darwin build of the same app only one will keep it's access to the safestorage key as during the migration we delete the old account. This is an acceptable edge case as no one should be actively using two versions of the same app.
* build: move from stale GH app to stale action
* Update .github/workflows/stale.yml
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* Update stale.yml
* Update .github/workflows/stale.yml
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* Update stale.yml
* Update .github/workflows/stale.yml
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* Update stale.yml
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Previously, display_id was an empty string, pending Chrome support for
sharing individual screens. Now that this has been added, it is
desirable to have this property set correctly.
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* fix: potential exception when calling webFrameMainBinding.fromIdOrNull()
* replace try/catch in getWebFrameForEvent
Co-authored-by: Milan Burda <miburda@microsoft.com>
* docs: changed event.data to data under the message.port in docs
* docs: corrected BrowserWindow wrong usage and change window.messagePort to window.electronMessagePort
* fix: WebAuthn Discoverable Credential (Resident Credential) #33353
Enables support for Webauthn discoverable credentials (aka resident
credentials). This allows users to authenticate without first having to
select or type a username.
To decide if discoverable credentials are supported, the class
'AuthenticatorCommon', in the chrome content code, indirectly calls the
method 'context::WebAuthenticationDelegate.SupportsResidentKeys(..)'.
The default implementation of this returns false, leaving it up to
specific implementations to override.
This change adds a new class 'ElectronWebAuthenticationDelegate' to
subclass 'WebAuthenticationDelegate' and override the behaviour of the
'SupportsResidentKeys' method to return true.
The implementation is copied from the Chrome browser equivalent
'ChromeWebAuthenticationDelegate', though the chrome class includes
other methods that don't seem to be required for this functionality.
The 'ElectronContentClient' class was also updated to store an instance
of 'ElectronWebAuthenticationDelegate', and to provide an accessor
method, GetWebAuthenticationDelegate().
* Remove redundant, commented-out code
* style: comment cleanup
* style: updated comments and formatting based on pull request review
* style: fix lint error on header guard clause
Update security.md
Under "4. Process Sandboxing", it said "For mor information on what `contextIsolation` is..." which was the previous section (copied from there). This updates it to say "For more information on what Process Sandboxing is..."
Update `.nvmrc` Node.js version from 14 to 16
The `DEPS` file states that Electron is on Node.js ^16.x. I am guessing that the PR bumping to Node.js 16 overlooked the `.nvmrc` file, which is updated in this PR. If leaving the `.nvmrc` file on 14 was intentional, please disregard this PR.
* build: add stale configuration
* Update .github/stale.yml
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* Update stale.yml
* Update stale.yml
* Update .github/stale.yml
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* Updates to allow for using a custom v8 snapshot file name
* Allow using a custom v8 snapshot file name
* Fix up patch due to merge
* Use fuse to set up custom v8 snapshot file in browser process
* Refactor to use delegate instead of command line parameter
* Refactoring
* Update due to merge
* PR comments
* Rename patch
* Rename patch
Right now the `check-symlinks.js` assumes that the branding product name
is "Electron". If users change `BRANDING.json` on custom builds, the
script will fail.
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
* Fix reference definitions should be needed
* typo
* typo
* typo and style
* Fix reference definitions should be needed
* Fix typo
* restore to previous
* Use absolute URL in faq.md image link
The relative link is rendered relative to the host domain, which works fine when viewing it on Github, but since you also use the same generated HTML in your doc site, the link is broken. See here: https://www.electronjs.org/docs/latest/faq#the-font-looks-blurry-what-is-this-and-what-can-i-do
Using an absolute URL here should fix the issue on the main site.
* Use inline image reference for subpixel rendering example
As suggested by @dsanders11
* fix: session.getBlobData never resolves with blob sizes > 65536 (#34398)
* Add unit test case for session.getBlobData
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* fix: pass rfh instances through to the permission helper
* refactor: use WeakDocumentPtr instead of frame node id
* fix: handle missing initiator document
* fix: dispatch openExternal event for top level webview navs still
* fix: ensure chrome colors are initialized
* build: fix linking on windows
* build: fix linking on windows
* build: add needed files to chromium_src/BUILD
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
* build: allow Linux distros to build against system shared libraries
Add GN flags to build the embedded nodejs copy against system libraries
instead of vendored copies in `third_party/electron_node/deps`:
* cares
* llhttp
* nghttp2
* hdr_histogram
See also chromium's build/linux/unbundle/README for more
Electron-relevant information about vendored dependencies.
* Update patches/node/build_add_gn_build_files.patch
Co-authored-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: Darshan Sen <raisinten@gmail.com>
* test: drop the now-empty remote runner from CI
* move fixtures to spec-main
* remove remote runner
* fix stuff
* remove global-paths hack
* move ts-smoke to spec/
* fix test after merge
* rename spec-main to spec
* no need to ignore spec/node_modules twice
* simplify spec-runner a little
* no need to hash pj/yl twice
* undo lint change to verify-mksnapshot.py
* excessive ..
* update electron_woa_testing.yml
* don't search for test-results-remote.xml
it is never produced now
* Remove unused import of path
This import gives out the error in the preload script:
Error: module not found: path
at preloadRequire
* Removes unused import in preload script
notes: Removes unused import which causes issue in preload script of drag and drop tutorial
* Remove import path as it is not used in the script
note: Removes import path as it is not used in the script
* test: temporarily disable test on mas arm64 that is causing crash
* disable the right test
* chore: speculative fix for CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER crash
* enable all the tests
* Revert "chore: speculative fix for CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER crash"
This reverts commit b7c8ef364c.
* test: disable tests that crash on mas arm64
* Update tutorial-6-publishing-updating.md
The dot at the end of the URL will depend on the site that cannot open. Because it will open `https://update.electronjs.org./` which does not exist.
* docs: fix the URL problems at tutorial-6-publishing-updating.md
The dot at the end of the URL will depend on the site that cannot open. Because it will open `https://update.electronjs.org./` which does not exist.
* docs: fix the URL problems at tutorial-6-publishing-updating.md
* docs: fix the URL problems at tutorial-6-publishing-updating.md
* fix: broken wayland window decorations due to botched chromium update
The `GetTitlebarBounds().height()` is obviously intended to be placed in
the `top` parameter, which used to be the second one before upstream
removed multi-parameter `gfx::Rect::Inset`, but it's the first parameter
for `gfx::Insets::TLBR`, which was intended to replace the removed
`Inset` function. However, whoever updated Chromium kept the parameter
unchanged, causing the title bar height to be passed to the `left`
parameter, causing the window title bar to be unclickable.
* fix: wayland window top bar buttons unclickable
Use NonClientFrameView::TargetForRect for the ClientFrameViewLinux
implementation because the default inherited from FramelessView blocks
any non-HTCLIENT events.
* fix: add maximized parameter to LinuxUI::GetWindowFrameProvider
* fix: pass frame_->IsMaximized() to GetWindowFrameProvider
This ensures that the toolkit renders the window decorations in maximized mode
while the window is maximized to ensure that there is no empty space around the window.
* fix: modify file extension generation on Windows
* modify includes
* include vector in header
* add win build flags
* remove hardcoded strings
* Update shell/browser/electron_download_manager_delegate.h
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix string manipulation and function definitions
* Update electron_download_manager_delegate.h
* convert to std::string and modify for electron
* Update shell/browser/electron_download_manager_delegate.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* remove vector include and update conversion
* add vectr include for lint
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix: ensure native modules are built with config.gypi
This works by patching node.h to check that two defines are set using the equivilant of an XNOR operation. One define "ELECTRON_ENSURE_CONFIG_GYPI" is set via common.gypi which is _already_ used to build native modules and has been since the dawn of time. Therefore this define will be set for all native module compilations targetting the Electron runtime. The second define "USING_ELECTRON_CONFIG_GYPI" is only defined when the gypi argument "using_electron_config_gypi" is set to 1 which is only done so via config.gypi. Only new enough versions of node-gyp correctly use the config.gypi file thus resulting in a compilation error on version of node-gyp that are too old.
* chore: fix lint
Co-authored-by: Samuel Attard <sattard@salesforce.com>
* docs: new main -> renderers messageChannel example
* consistent use of your
* fix a typo
* linting
* markdown linting
* Update docs/tutorial/message-ports.md
Co-authored-by: Erick Zhao <erick@hotmail.ca>
* update code example headings, reference contextIsolation example
* remove nodeIntegration: false from browserWindows
* rename "messagePort" to "electronMessagePort" for compatibility
Co-authored-by: Erick Zhao <erick@hotmail.ca>
* refactor: unduplicate MediaStreamDevicesController
* restore old logic for GUM_* request types
* lint
* gn format
* add test for unsupported getDisplayMedia
* simplify + comment
This define is only needed when linking against Chromiums libc++ which we currently
do not ship / expose the symbols of. We probably should make those symbols visible and
actually ensure that electron-rebuild et. al link against our libc++ instead of the system libc++
but for now this fixes compilation issues on macOS where the default system clang links to the system libc++
which does not (obviously) use the Chromium ABI namespace.
For our nan tests which do link against Chromiums libc++ we define the ABI namespace in the spec runner.
When widevine was disabled at the build level we never dealt with the callback passed into GetSupportedKeySystems. This was ok until requests became marked pending in https://chromium-review.googlesource.com/c/chromium/src/+/3430502 until the callback was called. This resulted in a promise never resolving / rejecting and certain media websites (E.g. spotify) hanging on load waiting for a signal that would never arrive.
* build: test disabling security
* build: install python2 during tests
* build: do not install python2 on arm64 runners
* attempt 2
* build: only allow 13.3.0 xcode
* build: fix building with enable_basic_printing false
* temp flags for ci builds
* fix other systems
* disable cups
* disable print preview
* revert changes
* merge with printing.patch
* chore: modernize ListValue usage in dict_util.mm and related files
* use base::Value::{Dict,List} instead of raw base::Value
* fix compile
* fix build
* fix build again
* chore: chunk filenames when linting C++ files
* chore: refactor code for better readability
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: further tweak
* chore: limit all platforms to 4095 characters on command line
* chore: use python3
* Revert "chore: use python3"
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
Extending the `testing` GN profile with the arguments documented to
allow breakpoint debugging
(https://www.electronjs.org/docs/latest/development/debugging#breakpoint-debugging)
doesn't quite work on macOS:
```sh
is_debug = true
symbol_level = 2
forbid_non_component_debug_builds = false
```
The build eventually fails on both Intel and Apple Silicon with the
following (summarized) error:
```sh
[S:41062 R:1 (41062:41247) (C/s:0.1 O/s:13.6)] SOLINK 'obj/electron/electron_framework_shared_library/Electron Framework' 'obj/electron/electron_framework_shared_library/Electron Framework.TOC'
FAILED: obj/electron/electron_framework_shared_library/Electron Framework obj/electron/electron_framework_shared_library/Electron Framework.TOC
...
Undefined symbols for architecture x86_64:
"platform_util::GetViewForWindow(gfx::NativeWindow)", referenced from:
BoundsOverlapWithAnyOpenPrompt(gfx::Rect const&, content::WebContents*) in libchrome.a(autofill_popup_view_utils.o)
"platform_util::GetParent(gfx::NativeView)", referenced from:
BoundsOverlapWithAnyOpenPrompt(gfx::Rect const&, content::WebContents*) in libchrome.a(autofill_popup_view_utils.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
...
```
This symbol is defined on a file that is not declared as a dependency of
`libchrome` on the GN definitions. Why the problem is not reproducible
on plain testing or release builds remains a mystery to me. I'm guessing
some non-debug path somewhere in the GN definitions does eventually
require that file.
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
fix: performance problem in crashReporter.start() on macOS
This change reduces the duration of crashReporter.start() on Intel macOS
from 622 milliseconds to 257 milliseconds!
Backports https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3641386
posix: Replace DoubleForkAndExec() with ForkAndSpawn()
The DoubleForkAndExec() function was taking over 622 milliseconds to run
on macOS 11 (BigSur) on Intel i5-1038NG7. I did some debugging by adding
some custom traces and found that the fork() syscall is the bottleneck
here, i.e., the first fork() takes around 359 milliseconds and the
nested fork() takes around 263 milliseconds. Replacing the nested fork()
and exec() with posix_spawn() reduces the time consumption to 257
milliseconds!
See https://github.com/libuv/libuv/pull/3064 to know why fork() is so
slow on macOS and why posix_spawn() is a better replacement.
Another point to note is that even base::LaunchProcess() from Chromium
calls posix_spawnp() on macOS -
8f8d82dea0:base/process/launch_mac.cc;l=295-296
Change-Id: I25c6ee9629a1ae5d0c32b361b56a1ce0b4b0fd26
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3641386
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Fixes: https://github.com/electron/electron/issues/34321
Signed-off-by: Darshan Sen <raisinten@gmail.com>
* feat: add immersive dark mode
* fix syntax and add header
* add me
* Update fuses.json5
* fix: redraw title bar on dark mode change
* chore: SetWindowTheme doesn't seem to be needed
* chore: separate out Win 10 dark mode implementation
* final touches
* final touches
* chore: limit Win 10 to >= 20H1 and drop fuse
* fix types
* fix lint
Co-authored-by: Micha Hanselmann <micha.hanselmann@gmail.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
* fix: crash when renderer process is reused
Could occur when a renderer crashes and the same-origin URL is loaded again
which leads to reusing the renderer process.
* test: renderer process crash recovery
* fix: handle case which leads to render frame DCHECK
* fix: lint
* ci: cache python install to better deal with download errors.
* chore: use our CDN to download python2
* build: DRY up the python install steps
Co-authored-by: Samuel Attard <sattard@salesforce.com>
@@ -4,14 +4,13 @@ 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.
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 command.
```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.
The initial build will take ~8 minutes. Incremental builds are substantially quicker. If you pull changes from upstream that touch either the `patches` folder or the `DEPS` folder you will have to run `e sync` in order to keep your checkout up to date.
Note: Please only report issues for [currently supported versions of Electron](https://www.electronjs.org/docs/latest/tutorial/support#currently-supported-versions).
- [ ] PR description included and stakeholders cc'd
- [ ]`npm test` passes
- [ ] 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).
- [ ] relevant documentation, tutorials, templates and examples are changed or added
- [ ] [PR release notes](https://github.com/electron/clerk/blob/main/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/main/README.md#examples).
#### Release Notes
Notes: <!-- Please add a one-line description for app developers to read in the release notes, or 'none' if no notes relevant to app developers. Examples and help on special cases: https://github.com/electron/clerk/blob/master/README.md#examples -->
Notes: <!-- Please add a one-line description for app developers to read in the release notes, or 'none' if no notes relevant to app developers. Examples and help on special cases: https://github.com/electron/clerk/blob/main/README.md#examples -->
Hello @${{ github.event.issue.user.login }}. Thanks for reporting this and helping to make Electron better!
Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, [Electron Fiddle](https://www.electronjs.org/fiddle) is a great tool for making small test cases and makes it easy to publish your test case to a [gist](https://gist.github.com) that Electron maintainers can use.
Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.
Now adding the `blocked/need-repro` label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.
This issue has been automatically marked as stale. **If this issue is still affecting you, please leave any comment** (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the [latest version of Electron](https://www.electronjs.org/releases/stable) or in the [beta](https://www.electronjs.org/releases/beta)—please include it with your comment!
close-issue-message:>
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a [supported version of Electron](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline) please open a new issue and include instructions for reproducing the issue.
Unfortunately, without a way to reproduce this issue, we're unable to continue investigation. This issue has been closed and will not be monitored further. If you're able to provide a minimal test case that reproduces this issue on a [supported version of Electron](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline) please open a new issue and include instructions for reproducing the issue.
"Chromium has updated the mac_deployment_target, please update this assert, update the supported versions documentation (docs/tutorial/support.md) and flag this as a breaking change")
}
@@ -87,7 +87,10 @@ if (is_linux) {
# implementation. In future, this file can be extended to contain
View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/).
View these docs in other languages on our [Crowdin](https://crowdin.com/project/electron) project.
The Electron framework lets you write cross-platform desktop applications
using JavaScript, HTML and CSS. It is based on [Node.js](https://nodejs.org/) and
[Chromium](https://www.chromium.org) and is used by the [Atom
editor](https://github.com/atom/atom) and many other [apps](https://electronjs.org/apps).
Follow [@ElectronJS](https://twitter.com/electronjs) on Twitter for important
Follow [@electronjs](https://twitter.com/electronjs) on Twitter for important
announcements.
This project adheres to the Contributor Covenant
@@ -38,8 +38,8 @@ For more installation options and troubleshooting tips, see
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.
* macOS (High Sierra and up): Electron provides 64-bit Intel and ARM binaries for macOS. Apple Silicon support was added in Electron 11.
* Windows (Windows 10 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8. Support for Windows 7, 8 and 8.1 was [removed in Electron 23, in line with Chromium's Windows deprecation policy](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice).
* Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on:
The Electron team and community take security bugs in Electron seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
To report a security issue, email [security@electronjs.org](mailto:security@electronjs.org) and include the word "SECURITY" in the subject line.
To report a security issue, please use the GitHub Security Advisory ["Report a Vulnerability"](https://github.com/electron/electron/security/advisories/new) tab.
The Electron team will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
# The config is used to bake appveyor images, not for running CI jobs.
# The config expects the following environment variables to be set:
# - "APPVEYOR_BAKE_IMAGE" e.g. 'electron-99.0.4767.0'. Name of the image to be baked.
# Typically named after the Chromium version on which the image is built.
# This can be set dynamically in the prepare-appveyor script.
version:1.0.{build}
build_cloud:electronhq-16-core
image:e-112.0.5607.0-vs2022
environment:
GIT_CACHE_PATH:C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR:Default
ELECTRON_ENABLE_STACK_DUMPING:1
MOCHA_REPORTER:mocha-multi-reporters
MOCHA_MULTI_REPORTERS:mocha-appveyor-reporter, tap
GOMA_FALLBACK_ON_AUTH_FAILURE:true
DEPOT_TOOLS_WIN_TOOLCHAIN:0
PYTHONIOENCODING:UTF-8
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# - cd %USERPROFILE%\image-bake-scripts
# - appveyor version
# - ps: .\optimize_dotnet_runtime.ps1
# - ps: .\disable_windows_background_services.ps1
# - ps: .\enforce_windows_firewall.ps1
# - ps: .\cleanup_windows.ps1
# END LINES FOR COMPLETELY NEW IMAGE
on_image_bake:
- ps:>-
echo "Baking image: $env:APPVEYOR_BAKE_IMAGE at dir $PWD"
# CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022
- 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 )
@@ -23,8 +23,7 @@ The `app` object emits the following events:
Emitted when the application has finished basic startup. On Windows and Linux,
the `will-finish-launching` event is the same as the `ready` event; on macOS,
this event represents the `applicationWillFinishLaunching` notification of
`NSApplication`. You would usually set up listeners for the `open-file` and
`open-url` events here, and start the crash reporter and auto updater.
`NSApplication`.
In most cases, you should do everything in the `ready` event handler.
@@ -64,7 +63,7 @@ Calling `event.preventDefault()` will prevent the default behavior, which is
terminating the application.
**Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
then `before-quit` is emitted *after* emitting `close` event on all windows and
then `before-quit` is emitted _after_ emitting `close` event on all windows and
closing them.
**Note:** On Windows, this event will not be emitted if the app is closed due
@@ -128,7 +127,10 @@ Emitted when the user wants to open a URL with the application. Your application
`Info.plist` file must define the URL scheme within the `CFBundleURLTypes` key, and
set `NSPrincipalClass` to `AtomApplication`.
You should call `event.preventDefault()` if you want to handle this event.
As with the `open-file` event, be sure to register a listener for the `open-url`
event early in your application startup to detect if the the application being
is being opened to handle a URL. If you register the listener in response to a
`ready` event, you'll miss URLs that trigger the launch of your application.
### Event: 'activate' _macOS_
@@ -493,6 +495,10 @@ and `workingDirectory` is its current working directory. Usually
applications respond to this by making their primary window focused and
non-minimized.
**Note:**`argv` will not be exactly the same list of arguments as those passed
to the second instance. The order might change and additional arguments might be appended.
If you need to maintain the exact same arguments, it's advised to use `additionalData` instead.
**Note:** If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
This event is guaranteed to be emitted after the `ready` event of `app`
@@ -710,7 +716,9 @@ To set the locale, you'll want to use a command line switch at app startup, whic
**Note:** When distributing your packaged app, you have to also ship the
`locales` folder.
**Note:**On Windows, you have to call it after the `ready` events gets emitted.
**Note:**This API must be called after the `ready` event is emitted.
**Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
**Note:** When unable to detect locale country code, it returns empty string.
### `app.getSystemLocale()`
Returns `string` - The current system locale. On Windows and Linux, it is fetched using Chromium's `i18n` library. On macOS, `[NSLocale currentLocale]` is used instead. To get the user's current system language, which is not always the same as the locale, it is better to use [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
Different operating systems also use the regional data differently:
* Windows 11 uses the regional format for numbers, dates, and times.
* macOS Monterey uses the region for formatting numbers, dates, times, and for selecting the currency symbol to use.
Therefore, this API can be used for purposes such as choosing a format for rendering dates and times in a calendar app, especially when the developer wants the format to be consistent with the OS.
**Note:** This API must be called after the `ready` event is emitted.
**Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
### `app.getPreferredSystemLanguages()`
Returns `string[]` - The user's preferred system languages from most preferred to least preferred, including the country codes if applicable. A user can modify and add to this list on Windows or macOS through the Language and Region settings.
The API uses `GlobalizationPreferences` (with a fallback to `GetSystemPreferredUILanguages`) on Windows, `\[NSLocale preferredLanguages\]` on macOS, and `g_get_language_names` on Linux.
This API can be used for purposes such as deciding what language to present the application in.
Here are some examples of return values of the various language and locale APIs with different configurations:
On Windows, given application locale is German, the regional format is Finnish (Finland), and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese (China), Finnish, and Spanish (Latin America):
On macOS, given the application locale is German, the region is Finland, and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese, and Spanish (Latin America):
Both the available languages and regions and the possible return values differ between the two operating systems.
As can be seen with the example above, on Windows, it is possible that a preferred system language has no country code, and that one of the preferred system languages corresponds with the language used for the regional format. On macOS, the region serves more as a default country code: the user doesn't need to have Finnish as a preferred language to use Finland as the region,and the country code `FI` is used as the country code for preferred system languages that do not have associated countries in the language name.
@@ -758,7 +811,7 @@ editor. Please refer to [Apple's documentation][CFBundleURLTypes] for details.
**Note:** In a Windows Store environment (when packaged as an `appx`) this API
will return `true` for all calls but the registry key it sets won't be accessible
by other applications. In order to register your Windows Store application
as a default protocol handler you must [declare the protocol in your manifest](https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
as a default protocol handler you must [declare the protocol in your manifest](https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme` internally.
@@ -1192,7 +1245,7 @@ For `infoType` equal to `basic`:
}
```
Using `basic` should be preferred if only basic information like `vendorId` or `driverId` is needed.
Using `basic` should be preferred if only basic information like `vendorId` or `deviceId` is needed.
### `app.setBadgeCount([count])` _Linux_ _macOS_
@@ -1308,7 +1361,7 @@ This API must be called after the `ready` event is emitted.
### `app.showAboutPanel()`
Show the app's about panel options. These options can be overridden with `app.setAboutPanelOptions(options)`.
Show the app's about panel options. These options can be overridden with `app.setAboutPanelOptions(options)`. This function runs asynchronously.
### `app.setAboutPanelOptions(options)`
@@ -1381,7 +1434,7 @@ method returns false. If we fail to perform the copy, then this method will
throw an error. The message in the error should be informative and tell
you exactly what went wrong.
By default, if an app of the same name as the one being moved exists in the Applications directory and is _not_ running, the existing app will be trashed and the active app moved into its place. If it _is_ running, the pre-existing running app will assume focus and the previously active app will quit itself. This behavior can be changed by providing the optional conflict handler, where the boolean returned by the handler determines whether or not the move conflict is resolved with default behavior. i.e. returning `false` will ensure no further action is taken, returning `true` will result in the default behavior and the method continuing.
By default, if an app of the same name as the one being moved exists in the Applications directory and is _not_ running, the existing app will be trashed and the active app moved into its place. If it _is_ running, the preexisting running app will assume focus and the previously active app will quit itself. This behavior can be changed by providing the optional conflict handler, where the boolean returned by the handler determines whether or not the move conflict is resolved with default behavior. i.e. returning `false` will ensure no further action is taken, returning `true` will result in the default behavior and the method continuing.
For example:
@@ -1464,19 +1517,18 @@ dock on macOS.
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.
@@ -32,9 +32,9 @@ This is a requirement of `Squirrel.Mac`.
On Windows, you have to install your app into a user's machine before you can
use the `autoUpdater`, so it is recommended that you use the
[electron-winstaller][installer-lib], [electron-forge][electron-forge-lib] or the [grunt-electron-installer][installer] package to generate a Windows installer.
[electron-winstaller][installer-lib], [Electron Forge][electron-forge-lib] or the [grunt-electron-installer][installer] package to generate a Windows installer.
When using [electron-winstaller][installer-lib] or [electron-forge][electron-forge-lib] make sure you do not try to update your app [the first time it runs](https://github.com/electron/windows-installer#handling-squirrel-events) (Also see [this issue for more info](https://github.com/electron/electron/issues/7155)). It's also recommended to use [electron-squirrel-startup](https://github.com/mongodb-js/electron-squirrel-startup) to get desktop shortcuts for your app.
When using [electron-winstaller][installer-lib] or [Electron Forge][electron-forge-lib] make sure you do not try to update your app [the first time it runs](https://github.com/electron/windows-installer#handling-squirrel-events) (Also see [this issue for more info](https://github.com/electron/electron/issues/7155)). It's also recommended to use [electron-squirrel-startup](https://github.com/mongodb-js/electron-squirrel-startup) to get desktop shortcuts for your app.
The installer generated with Squirrel will create a shortcut icon with an
[Application User Model ID][app-user-model-id] in the format of
* 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)
@@ -192,6 +192,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
macOS. Default is `false`.
*`skipTaskbar` boolean (optional) _macOS__Windows_ - Whether to show the window in taskbar.
Default is `false`.
*`hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control.
*`kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`.
*`title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored.
*`icon` ([NativeImage](native-image.md) | string) (optional) - The window icon. On Windows it is
@@ -246,7 +247,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
* 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)
@@ -1232,6 +1258,16 @@ Returns `boolean` - Whether the window can be manually closed by user.
Starts or stops flashing the window to attract user's attention.
#### `win.setSkipTaskbar(skip)`
#### `win.setSkipTaskbar(skip)` _macOS_ _Windows_
*`skip` boolean
@@ -1366,8 +1402,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
*`wParam`Buffer - The `wParam` provided to the WndProc
*`lParam`Buffer - The `lParam` provided to the WndProc
Hooks a windows message. The `callback` is called when
the message is received in the WndProc.
@@ -1414,13 +1450,16 @@ Returns `boolean` - Whether the window's document has been edited.
#### `win.blurWebView()`
#### `win.capturePage([rect])`
#### `win.capturePage([rect, opts])`
*`rect` [Rectangle](structures/rectangle.md) (optional) - The bounds to capture
*`opts` Object (optional)
*`stayHidden` boolean (optional) - Keep the page hidden instead of visible. Default is `false`.
*`stayAwake` boolean (optional) - Keep the system awake instead of allowing it to sleep. Default is `false`.
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. If the page is not visible, `rect` may be empty.
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. The page is considered visible when its browser window is hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that `stayHidden` is set to true.
#### `win.loadURL(url[, options])`
@@ -1504,7 +1543,7 @@ Remove the window's menu bar.
*`options` Object (optional)
*`mode` string _Windows_ - Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or `paused`.
Sets progress value in progress bar. Valid range is [0, 1.0].
Sets progress value in progress bar. Valid range is \[0, 1.0].
Remove progress bar when progress < 0;
Change to indeterminate mode when progress > 1.
@@ -1528,6 +1567,13 @@ screen readers
Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
convey some sort of application status or to passively notify the user.
#### `win.invalidateShadow()` _macOS_
Invalidates the window shadow so that it is recomputed based on the current window shape.
`BrowserWindows` that are transparent can sometimes leave behind visual artifacts on macOS.
This method can be used to clear these artifacts when, for example, performing an animation.
#### `win.setHasShadow(hasShadow)`
*`hasShadow` boolean
@@ -1543,7 +1589,7 @@ Returns `boolean` - Whether the window has a shadow.
*`opacity` number - between 0.0 (fully transparent) and 1.0 (fully opaque)
Sets the opacity of the window. On Linux, does nothing. Out of bound number
values are clamped to the [0, 1] range.
values are clamped to the \[0, 1] range.
#### `win.getOpacity()`
@@ -1618,13 +1664,13 @@ in the taskbar.
#### `win.setAppDetails(options)` _Windows_
*`options` Object
*`appId` string (optional) - Window's [App User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd391569(v=vs.85).aspx).
*`appId` string (optional) - Window's [App User Model ID](https://learn.microsoft.com/en-us/windows/win32/shell/appids).
It has to be set, otherwise the other options will have no effect.
@@ -61,7 +61,7 @@ throttling in one window, you can take the hack of
Forces the maximum disk space to be used by the disk cache, in bytes.
### --enable-logging[=file]
### --enable-logging\[=file]
Prints Chromium's logging to stderr (or a log file).
@@ -241,19 +241,19 @@ Electron supports some of the [CLI flags][node-cli] supported by Node.js.
**Note:** Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
### --inspect-brk[=[host:]port]
### --inspect-brk\[=\[host:]port]
Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.
Aliased to `--debug-brk=[host:]port`.
### --inspect-port=[host:]port
### --inspect-port=\[host:]port
Set the `host:port` to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is `127.0.0.1`.
Aliased to `--debug-port=[host:]port`.
### --inspect[=[host:]port]
### --inspect\[=\[host:]port]
Activate inspector on `host:port`. Default is `127.0.0.1:9229`.
@@ -271,8 +271,6 @@ By default inspector websocket url is available in stderr and under /json/list e
*`worldId` Integer - The ID of the world to inject the API into. `0` is the default world, `999` is the world used by Electron's `contextIsolation` feature. Using 999 would expose the object for preload context. We recommend using 1000+ while creating isolated world.
*`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
@@ -59,7 +65,7 @@ the API become immutable and updates on either side of the bridge do not result
> Access information about media sources that can be used to capture audio and
> video from the desktop using the [`navigator.mediaDevices.getUserMedia`] API.
> video from the desktop using the [`navigator.mediaDevices.getUserMedia`][] API.
Process: [Main](../glossary.md#main-process)
@@ -59,11 +59,11 @@ function handleError (e) {
```
To capture video from a source provided by `desktopCapturer` the constraints
passed to [`navigator.mediaDevices.getUserMedia`] must include
passed to [`navigator.mediaDevices.getUserMedia`][] must include
`chromeMediaSource: 'desktop'`, and `audio: false`.
To capture both audio and video from the entire desktop the constraints passed
to [`navigator.mediaDevices.getUserMedia`] must include `chromeMediaSource: 'desktop'`,
to [`navigator.mediaDevices.getUserMedia`][] must include `chromeMediaSource: 'desktop'`,
for both `audio` and `video`, but should not include a `chromeMediaSourceId` constraint.
```javascript
@@ -101,7 +101,7 @@ The `desktopCapturer` module has the following methods:
Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`DesktopCapturerSource`](structures/desktop-capturer-source.md) objects, each `DesktopCapturerSource` represents a screen or an individual window that can be captured.
**Note** Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
which can detected by [`systemPreferences.getMediaAccessStatus`].
which can detected by [`systemPreferences.getMediaAccessStatus`][].
@@ -139,8 +139,7 @@ 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 a
tions 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 actions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.
*`accelerators`string[] - an array of [Accelerator](accelerator.md)s.
*`accelerators`[Accelerator](accelerator.md)[] - 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.
*`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`.
*`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.
@@ -51,7 +51,7 @@ See [`Menu`](menu.md) for examples.
the placement of their containing group after the containing group of the item
with the specified label.
**Note:**`acceleratorWorksWhenHidden` is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development. This property is only usable on macOS High Sierra 10.13 or newer.
**Note:**`acceleratorWorksWhenHidden` is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development.
### Roles
@@ -115,7 +115,7 @@ The following additional roles are available on _macOS_:
*`moveTabToNewWindow` - Map to the `moveTabToNewWindow` action.
*`window` - The submenu is a "Window" menu.
*`help` - The submenu is a "Help" menu.
*`services` - The submenu is a ["Services"](https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc) menu. This is only intended for use in the Application Menu and is *not* the same as the "Services" submenu used in context menus in macOS apps, which is not implemented in Electron.
*`services` - The submenu is a ["Services"](https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc) menu. This is only intended for use in the Application Menu and is _not_ the same as the "Services" submenu used in context menus in macOS apps, which is not implemented in Electron.
*`recentDocuments` - The submenu is an "Open Recent" menu.
*`clearRecentDocuments` - Map to the `clearRecentDocuments` action.
*`shareMenu` - The submenu is [share menu][ShareMenu]. The `sharingItem` property must also be set to indicate the item to share.
*`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`.
*`size` [Size](structures/size.md) - the desired width and height (positive numbers) of the thumbnail.
Returns `Promise<NativeImage>` - fulfilled with the file's thumbnail preview image, which is a [NativeImage](native-image.md).
Note: The Windows implementation will ignore `size.height` and scale the height according to `size.width`.
### `nativeImage.createFromPath(path)`
*`path` string
@@ -149,7 +151,7 @@ console.log(image)
*`options` Object
*`width` Integer
*`height` Integer
*`scaleFactor`Double (optional) - Defaults to 1.0.
*`scaleFactor`Number (optional) - Defaults to 1.0.
Returns `NativeImage`
@@ -162,7 +164,7 @@ pixel data returned by `toBitmap()`. The specific format is platform-dependent.
*`options` Object (optional)
*`width` Integer (optional) - Required for bitmap buffers.
*`height` Integer (optional) - Required for bitmap buffers.
*`scaleFactor`Double (optional) - Defaults to 1.0.
*`scaleFactor`Number (optional) - Defaults to 1.0.
Returns `NativeImage`
@@ -225,7 +227,7 @@ The following methods are available on instances of the `NativeImage` class:
#### `image.toPNG([options])`
*`options` Object (optional)
*`scaleFactor`Double (optional) - Defaults to 1.0.
*`scaleFactor`Number (optional) - Defaults to 1.0.
Returns `Buffer` - A [Buffer][buffer] that contains the image's `PNG` encoded data.
@@ -238,7 +240,7 @@ Returns `Buffer` - A [Buffer][buffer] that contains the image's `JPEG` encoded d
#### `image.toBitmap([options])`
*`options` Object (optional)
*`scaleFactor`Double (optional) - Defaults to 1.0.
*`scaleFactor`Number (optional) - Defaults to 1.0.
Returns `Buffer` - A [Buffer][buffer] that contains a copy of the image's raw bitmap pixel
data.
@@ -246,14 +248,14 @@ data.
#### `image.toDataURL([options])`
*`options` Object (optional)
*`scaleFactor`Double (optional) - Defaults to 1.0.
*`scaleFactor`Number (optional) - Defaults to 1.0.
Returns `string` - The data URL of the image.
#### `image.getBitmap([options])`
*`options` Object (optional)
*`scaleFactor`Double (optional) - Defaults to 1.0.
*`scaleFactor`Number (optional) - Defaults to 1.0.
Returns `Buffer` - A [Buffer][buffer] that contains the image's raw bitmap pixel data.
@@ -276,7 +278,7 @@ Returns `boolean` - Whether the image is empty.
#### `image.getSize([scaleFactor])`
*`scaleFactor`Double (optional) - Defaults to 1.0.
*`scaleFactor`Number (optional) - Defaults to 1.0.
Returns [`Size`](structures/size.md).
@@ -317,20 +319,20 @@ will be preserved in the resized image.
#### `image.getAspectRatio([scaleFactor])`
*`scaleFactor`Double (optional) - Defaults to 1.0.
*`scaleFactor`Number (optional) - Defaults to 1.0.
Returns `Float` - The image's aspect ratio.
Returns `Number` - The image's aspect ratio.
If `scaleFactor` is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.
#### `image.getScaleFactors()`
Returns `Float[]` - An array of all scale factors corresponding to representations for a given nativeImage.
Returns `Number[]` - An array of all scale factors corresponding to representations for a given nativeImage.
#### `image.addRepresentation(options)`
*`options` Object
*`scaleFactor`Double - The scale factor to add the image representation for.
*`scaleFactor`Number (optional) - The scale factor to add the image representation for.
*`width` Integer (optional) - Defaults to 0. Required if a bitmap buffer
is specified as `buffer`.
*`height` Integer (optional) - Defaults to 0. Required if a bitmap buffer
See the MDN docs for [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) and [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) for more details.
### `protocol.unhandle(scheme)`
*`scheme` string - scheme for which to remove the handler.
Removes a protocol handler registered with `protocol.handle`.
### `protocol.isProtocolHandled(scheme)`
*`scheme` string
Returns `boolean` - Whether `scheme` is already handled.
Registers the app with Apple Push Notification service (APNS) to receive [Badge, Sound, and Alert](https://developer.apple.com/documentation/appkit/nsremotenotificationtype?language=objc) notifications. If registration is successful, the promise will be resolved with the APNS device token. Otherwise, the promise will be rejected with an error message.
// Add logic here to determine if permission should be given to allow USB selection
returntrue
}
returnfalse
})
// Optionally, retrieve previously persisted devices from a persistent store (fetchGrantedDevices needs to be implemented by developer to fetch persisted permissions)
*`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.
*`clipboard-read` - Request access to read from the clipboard.
*`clipboard-sanitized-write` - Request access to write to the clipboard.
*`media` - Request access to media devices such as camera, microphone and speakers.
*`display-capture` - Request access to capture the screen.
*`mediaKeySystem` - Request access to DRM protected content.
*`notifications` - Request notification creation and the ability to display them in the user's system tray.
*`midi` - Request MIDI access in the `webmidi` API.
*`midiSysex` - Request the use of system exclusive messages in the `webmidi` API.
*`pointerLock` - Request to directly interpret mouse movements as an input method. Click [here](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API) to know more.
*`pointerLock` - Request to directly interpret mouse movements as an input method. Click [here](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API) to know more. These requests always appear to originate from the main frame.
*`fullscreen` - Request for the app to enter fullscreen mode.
*`openExternal` - Request to open links in external applications.
*`window-management` - Request access to enumerate screens using the [`getScreenDetails`](https://developer.chrome.com/en/articles/multi-screen-window-placement/) API.
*`unknown` - An unrecognized permission request
*`callback` Function
*`permissionGranted` boolean - Allow or deny the permission.
*`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`.
*`permission` string - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, `hid`, `serial`, or `usb`.
*`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.
Returns `Promise<void>` - Resolves when the operation is complete.
@@ -933,7 +1321,7 @@ Returns `string[]` - An array of language codes the spellchecker is enabled for.
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.
**Note:** On macOS the OS spellchecker is used and has its own list of languages. This API is a no-op on macOS.
**Note:** On macOS the OS spellchecker is used and has its own list of languages. On macOS, this API will return whichever languages have been configured by the OS.
*`processId` Integer - The internal ID of the renderer process that sent this message
*`frameId` Integer - The ID of the renderer frame that sent this message
*`returnValue` any - Set this to the value to be returned in a synchronous message
*`sender` WebContents - Returns the `webContents` that sent the message
*`senderFrame` WebFrameMain _Readonly_ - The frame that sent this message
*`ports` MessagePortMain[] - A list of MessagePorts that were transferred with this message
*`sender`[WebContents](../web-contents.md) - Returns the `webContents` that sent the message
*`senderFrame`[WebFrameMain](../web-frame-main.md)_Readonly_ - The frame that sent this message
*`ports`[MessagePortMain](../message-port-main.md)[] - A list of MessagePorts that were transferred with this message
*`reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame.
*`sender` IpcRenderer - The `IpcRenderer` instance that emitted the event originally
*`sender`[IpcRenderer](../ipc-renderer.md) - The `IpcRenderer` instance that emitted the event originally
*`senderId` Integer - The `webContents.id` that sent the message, you can call `event.sender.sendTo(event.senderId, ...)` to reply to the message, see [ipcRenderer.sendTo][ipc-renderer-sendto] for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set `event.senderId` to `0`.
*`ports` MessagePort[] - A list of MessagePorts that were transferred with this message
*`ports`[MessagePort][][] - A list of MessagePorts that were transferred with this message
*`isDefault` boolean - whether or not a given printer is set as the default printer on the OS.
*`options` Object - an object containing a variable number of platform-specific printer information.
The number represented by `status` means different things on different platforms: on Windows its potential values can be found [here](https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2), and on Linux and macOS they can be found [here](https://www.cups.org/doc/cupspm.html).
The number represented by `status` means different things on different platforms: on Windows its potential values can be found [here](https://learn.microsoft.com/en-us/windows/win32/printdocs/printer-info-2), and on Linux and macOS they can be found [here](https://www.cups.org/doc/cupspm.html).
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.