* Rename patch file to .patch to conform to naming standard which utilizes .gitattributes settings
* chore: remove backport patches
* chore: rename patch (previously added as new patch)
Co-authored-by: stsean <stsean@justin.tv>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
* build: add CI path-filtering for docs-only changes (#31741)
build: (wip) initial dynamic config research
* build: (wip) test path filtering option
* build: (wip) remove doc-only script, use path filtering to check changes
* build: (wip) add docker image with Electron dependencies
* build: (wip) clean up config
* build (wip): readd parameters, executors and env*s
* build: re-add steps and commands
* build: change doc-only to ts-compile-doc-only
* build: re-add workflows and jobs
* build: split configs to setup & build
* build: move lint to "always run" config
* build: clean up, remove old reference config
* build: bump to path-filtering 0.1.0
* build: remove ts-compile step from build-linux
* build: remove nightly-linux-release-test, linux-checks-nightly
* build: don't run build on publish
* build: set base-revision to main (runs branch vs commit)
* build: update config from chromium roll
* build: don't use python3 on sync-step
reverts ea6087e343, which doesn't apply to 14-x-y
* build: account for path-filtering workflow in release-build script (#32063)
* build: account for path-filtering workflow in release-build script
* build: update syntax for workflow id
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
In the synchronous code path, gtk_native_dialog_run() will call
gtk_native_dialog_show(). Previously this was causing an assertion to be
hit at run time.
Co-authored-by: Tristan Partin <tristan@partin.io>
* fix: fix aspect ratio when max width/height is set
Add the native frame border size to the minimum and maximum size if
the view reports its size as the client size. It allows to enlarge
window to proper values when aspect ratio and max width/height are
set. It also fixes DCHECK which was triggered when user tried to
enlarge window above dimensions set during creation of the
BrowserWindow.
* chore: update patches
Co-authored-by: Cezary Kulakowski <cezary@openfin.co>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
The variable `input` is accepted by a universal reference, so it doesn't
make sense to cast a potential lvalue reference into an rvalue
reference. In case `input` is an lvalue reference, we should rather
forward the value as is to `ToV8()`.
Signed-off-by: Darshan Sen <darshan.sen@postman.com>
Co-authored-by: Darshan Sen <darshan.sen@postman.com>
* fix: in GTK open dialog, do not preview huge files
Previewing images whose files are larger than a GB can crash Electron.
* refactor: tweak CanPreview()
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* build: retry hasher function if it fails first time
* Update script/release/get-url-hash.js
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
* fix: event with invalid timestamp in trace log
When node is started within Electron's environment it doesn't
initialize v8 and time of v8's start is never set. As a result
we log v8's start time as 0 and it breaks timestamps in the
trace log. With this change we log v8's start time only when
it was initialized by node.
* fixup patch for 14-x-y
Co-authored-by: Cezary Kulakowski <cezary@openfin.co>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* fix: don't use private enterprise APIs in MAS build
* Update .patches
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
* Added isDestroyed check
fix: https://github.com/electron/electron/issues/31196
* fix: unregister frame name
Unregister the frame name so that we do not accidentally unregister the wrong window later on in case there is a timing issue with the events
* fix; check if webContents is destroyed
* fix: check if window/webContents is destroyed
Co-authored-by: Cheng Zhao <github@zcbenz.com>
Co-authored-by: t57ser <seve@live.at>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
Corrects the following error in Electron Fiddle:
```
Uncaught Exception:
ReferenceError: dialog is not defined
...
```
Co-authored-by: Ryan Johnson <CITguy@users.noreply.github.com>
* feat: add support for WebHID (#30213)
* feat: add support for WebHID
* Apply suggestions from code review
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* Address review feedback
* Address review feedback
* chore: clear granted_devices on navigation
Also added test to verify devices get cleared
* fixup testing for device clear
* make sure navigator.hid.getDevices is run on correct frame
* clear granted devices on RenderFrameHost deletion/change
* manage device permissions per RenderFrameHost
This change makes sure we don't clear device permission prematurely due to child frame navigation
* Update shell/browser/api/electron_api_web_contents.cc
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* apply review feedback from @zcbenz
* Match upstream ObjectMap
This change matches what ObjectPermissionContextBase uses to cache object permissions: https://source.chromium.org/chromium/chromium/src/+/main:components/permissions/object_permission_context_base.h;l=52;drc=8f95b5eab2797a3e26bba299f3b0df85bfc98bf5;bpv=1;bpt=0
The main reason for this was to resolve this crash on Win x64:
ok 2 WebContentsView doesn't crash when GCed during allocation
Received fatal exception EXCEPTION_ACCESS_VIOLATION
Backtrace:
gin::WrappableBase::SecondWeakCallback [0x00007FF6F2AFA005+133] (o:\gin\wrappable.cc:53)
v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacks [0x00007FF6F028F9AB+171] (o:\v8\src\handles\global-handles.cc:1400)
v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacksFromTask [0x00007FF6F028F867+391] (o:\v8\src\handles\global-handles.cc:1387)
node::PerIsolatePlatformData::RunForegroundTask [0x00007FF6F3B4D065+317] (o:\third_party\electron_node\src\node_platform.cc:415)
node::PerIsolatePlatformData::FlushForegroundTasksInternal [0x00007FF6F3B4C424+776] (o:\third_party\electron_node\src\node_platform.cc:479)
uv_run [0x00007FF6F2DDD07C+492] (o:\third_party\electron_node\deps\uv\src\win\core.c:609)
electron::NodeBindings::UvRunOnce [0x00007FF6EEE1E036+294] (o:\electron\shell\common\node_bindings.cc:631)
base::TaskAnnotator::RunTask [0x00007FF6F2318A19+457] (o:\base\task\common\task_annotator.cc:178)
base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl [0x00007FF6F2E6F553+963] (o:\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:361)
base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork [0x00007FF6F2E6EC69+137] (o:\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:266)
base::MessagePumpForUI::DoRunLoop [0x00007FF6F235AA58+216] (o:\base\message_loop\message_pump_win.cc:221)
base::MessagePumpWin::Run [0x00007FF6F235A01A+106] (o:\base\message_loop\message_pump_win.cc:79)
base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run [0x00007FF6F2E702DA+682] (o:\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:470)
base::RunLoop::Run [0x00007FF6F22F95BA+842] (o:\base\run_loop.cc:136)
content::BrowserMainLoop::RunMainMessageLoop [0x00007FF6F14423CC+208] (o:\content\browser\browser_main_loop.cc:990)
content::BrowserMainRunnerImpl::Run [0x00007FF6F144402F+143] (o:\content\browser\browser_main_runner_impl.cc:153)
content::BrowserMain [0x00007FF6F143F911+257] (o:\content\browser\browser_main.cc:49)
content::RunBrowserProcessMain [0x00007FF6EFFA7D18+112] (o:\content\app\content_main_runner_impl.cc:608)
content::ContentMainRunnerImpl::RunBrowser [0x00007FF6EFFA8CF4+1220] (o:\content\app\content_main_runner_impl.cc:1104)
content::ContentMainRunnerImpl::Run [0x00007FF6EFFA87C9+393] (o:\content\app\content_main_runner_impl.cc:971)
content::RunContentProcess [0x00007FF6EFFA73BD+733] (o:\content\app\content_main.cc:394)
content::ContentMain [0x00007FF6EFFA79E1+54] (o:\content\app\content_main.cc:422)
wWinMain [0x00007FF6EECA1535+889] (o:\electron\shell\app\electron_main.cc:291)
__scrt_common_main_seh [0x00007FF6F6F88482+262] (d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
BaseThreadInitThunk [0x00007FFEC0087034+20]
RtlUserThreadStart [0x00007FFEC1F02651+33]
✗ Electron tests failed with code 0xc0000005.
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
(cherry picked from commit 6aece4a83d)
* fixup for 14-x-y
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
* 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>
Images that used the inline link format do not show up on Docusaurus or
the old website infrastructure. There are only 2 guides using it so it
is faster to change the format rather than figuring out why the parsin
logic does not work.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ref: https://github.com/electron/electronjs.org-new/issues/84
Co-authored-by: Antón Molleda <amolleda@gmail.com>
chrome now use developer.chrome.com/docs/extensions/* instead of developer.chrome.com/extensions/*
Co-authored-by: 祈緒ちゃん - Kiochan <sunxingchen@live.com>
* 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>
* Update process-model.md
the demo have two error:
- at macos, close all window, the app will not quite, unless press cmd + q
- attach preload.js, use preload prop that is member of `webPreferences` property of `BrowserWindow` controller argument
* Update docs/tutorial/process-model.md
Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
* 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: console window popping up when --enable-logging passed on windows
* chore: update patches
* clang format
* chore: update patches
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
* docs: mention sandboxing in security docs
* link to sandboxing tutorial
* Update security.md
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* chore: bump chromium in DEPS to 93.0.4567.0
* chore: update patches
* chore: bump chromium in DEPS to 93.0.4568.0
* chore: bump chromium in DEPS to 93.0.4569.0
* chore: update patches
(cherry picked from commit e710b8ea15f0ec08966e89d37e6ff73414180e6b)
* 3000931: Code health: remove base::ListValue from DevToolsEmbedderMessageDispatcher
https://chromium-review.googlesource.com/c/chromium/src/+/3000931
(cherry picked from commit 44c00b98f27621f6345bcf5d78f3e2649147135b)
* chore: bump chromium in DEPS to 93.0.4570.0
* chore: update patches
* chore: bump chromium in DEPS to 93.0.4571.0
* chore: update patches
* chore: bump chromium in DEPS to 93.0.4573.0
* chore: bump chromium in DEPS to 93.0.4574.0
* chore: bump chromium in DEPS to 93.0.4575.0
* chore: bump chromium in DEPS to 93.0.4576.0
* chore: bump chromium in DEPS to 93.0.4577.0
* chore: bump chromium in DEPS to 93.0.4577.3
* chore: bump chromium in DEPS to 93.0.4577.4
* 3011898: Reland "Roll src/buildtools/third_party/libc++/trunk/ 8fa879467..79a2e924d (426 commits)"
https://chromium-review.googlesource.com/c/chromium/src/+/3011898
(cherry picked from commit c46148eed8)
* 2974072: Swap base/stl_util.h to base/cxx17_backports.h in many files.
https://chromium-review.googlesource.com/c/chromium/src/+/2974072
(cherry picked from commit 4d725e44ca)
* chore: add missing header
(cherry picked from commit f3993e71ce)
* Reland "Roll src/buildtools/third_party/libc++/trunk/ 8fa879467..79a2e924d (426 commits)"
https://chromium-review.googlesource.com/c/chromium/src/+/2988699
(cherry picked from commit 797723ec83)
(cherry picked from commit 4a325c9b24)
* 2925476: Migrate t/b/{public,renderer}/platform/media to blink ns [4/6]
https://chromium-review.googlesource.com/c/chromium/src/+/2925476
(cherry picked from commit 0930c0ee41)
* 2974074: Remove base/cxx17_backports.h from stl_util.h.
https://chromium-review.googlesource.com/c/chromium/src/+/2974074
(cherry picked from commit a7b53b61f4)
* fixup: 2974074: Remove base/cxx17_backports.h from stl_util.h.
(cherry picked from commit af5da4dcb1)
* chore: update patches
* fix: invalid operands compilation error
(cherry picked from commit 6fa6f8acb9)
* 3001416: Fix -Wimplicit-int-float-conversion.
https://chromium-review.googlesource.com/c/chromium/src/+/3001416
(cherry picked from commit b2e9f2212e)
* 3022548: Removing windows.h includes from some base headers
https://chromium-review.googlesource.com/c/chromium/src/+/3022548
(cherry picked from commit 8b48103907)
* 3029258: Remove unused JobEventDetails::Type enum values
https://chromium-review.googlesource.com/c/chromium/src/+/3029258
Cherry picked from c15df3a109
Co-Authored-By: Shelley Vohr <shelley.vohr@gmail.com>
* 3029185: printing: Use mojom::PrinterType instead of PrinterType
https://chromium-review.googlesource.com/c/chromium/src/+/3029185
(cherry picked from commit d16fab76fb)
* Update application_info_win.cc
(cherry picked from commit 6e187f8617)
* include windows.h in process_singleton_win.cc
(cherry picked from commit af58ad2d9d)
* chore: bump chromium in DEPS to 93.0.4577.8
* chore: update patches
* do not create a new UserScriptManager every time the accessor is called
(cherry picked from commit 24a71035ab)
* chore: Revert "Roll clang llvmorg-13-init-14732-g8a7b5ebf-2 : llvmorg-13-init-15040-gc10947b5-1"
* chore: remove no longer needed patch
* Update the "py" wheel to a version that is compatible with pytest-6.2.2.
https://chromium-review.googlesource.com/c/chromium/src/+/3044950
* chore: bump chromium in DEPS to 93.0.4577.15
* chore: update patches
* chore: fixup parallel/test-errors-systemerror node test
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* 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>
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: 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>
* fix: window ordering on mac
* chore: fix flaky fullscreen inheritance test
* chore: disable fullscreen test on mac arm
Co-authored-by: deepak1556 <hop2deep@gmail.com>
* build: fix building with enable_plugins = false
* chore: update patches
Co-authored-by: Milan Burda <milan.burda@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
* docs: mention contextIsolation in ipc-main example
* chore: update patches
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
* feat: enable windows control overlay on macOS
* address review feedback
* chore: address review feedback
* Address review feedback
* update doc per review
* only enable WCO when titleBarStyle is overlay
* Revert "only enable WCO when titleBarStyle is overlay"
This reverts commit 1b58b5b1fc.
* Add new titleBarOverlay property to manage feature
* spelling fix
* Update docs/api/frameless-window.md
Co-authored-by: Samuel Attard <sam@electronjs.org>
* Update shell/browser/api/electron_api_browser_window.cc
Co-authored-by: Samuel Attard <sam@electronjs.org>
* update per review feedback
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Samuel Attard <sam@electronjs.org>
* Update dark-mode.md
Fix the unmatched css file name
* Update docs/tutorial/dark-mode.md
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jenux <ijenux@gmail.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
The new installs of the python module, python-dbusmock, is broken for
python2. The tests still run fine on linux machine in Electron's
pipeline setup on CircleCI, because the docker image used has
the non-broken version of python-dbusmock for python2 installed.
But running electron tests on any other linux machine would fail if
they don't have this non-broken version of python-dbusmock for python2
installed, already, which is the case for most of the machines.
Moreover, Python2 is deprecated now. So it would be better if we change
the python interpreter in script/spec-runner.js file to python3, for
which all the python modules are updated and working.
Notes: none
Co-authored-by: Rituka Patwal <rituka.patwal@postman.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* fix: 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>
* 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)
* 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>
* build: restore workspace on osx builds to get docs-only-change file
* build: clean up attached workspace before checking out from cache
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
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>
* chore: bump chromium in DEPS to 93.0.4536.0
* chore: update patches
* Make InkDrop a View class property
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2918475
Replace old views::Button::ink_drop() calls with views::InkDrop::Get()
* Convert use of gfx::ImageSkia to ui::ImageModel for WidgetDelegates
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2935942
Update GetWindowIcon(), GetWindowAppIcon(), and GetDevToolsWindowIcon()
to return ui::ImageModel instead of gfx::ImageSkia.
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: bump chromium in DEPS to 93.0.4533.0
* chore: update patches
* chore: bump chromium in DEPS to 93.0.4534.0
* chore: update patches
* chore: bump chromium in DEPS to 93.0.4535.0
* chore: remove PdfViewerDocumentProperties from feature-flag conditional
https://chromium-review.googlesource.com/c/chromium/src/+/2938363
This feature is now enabled by default upstream.
* chore: remove kPdfViewerPresentationMode from feature-flag conditional
https://chromium-review.googlesource.com/c/chromium/src/+/2938037
This feature is now enabled by default upstream.
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* remove version information from html
* change format for readability
* clarify which console the message should appear in
* minor changes to renderer.md
* update UI on click instead of developer console
* remove node-integration and fix md
* update content
* chore: remove ****
Co-authored-by: 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>
* fix: correctly handle shifted char in accelerator
* test: use actual accelerator of NSMenuItem
* chore: simplify KeyboardCodeFromStr
* chore: GetAcceleratorTextAt is testing only
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
* feat: add experimental cookie encryption support on macOS
* chore: fix TODO
* update patches
* feat: make cookie encryption work on windows
* chore: update cookie encryption support comments
* fix: only call OSCrypt::Init on windows
* chore: make cookie encryption work on linux
* Update shell/browser/net/system_network_context_manager.cc
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
* chore: fix lint
* chore: update patches
* chore: update patches to upstreamed variants
* chore: use chrome ::switches constants
* chore: remove bad patch
* build: disable cookie encryption by default
* chore: update patches
* fix: provide std::string to NoDestructor
* chore: fix macos, nodestructor syntax
* build: fix macOS build due to mismatch in DEFINE
Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
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>
@@ -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",
To create a window without chrome, or a transparent window in arbitrary shape,
you can use the [Frameless Window](frameless-window.md) API.
## Showing window gracefully
## Showing the window gracefully
When loading a page in the window directly, users may see the page load incrementally, which is not a good experience for a native app. To make the window display
without visual flash, there are two solutions for different situations.
When loading a page in the window directly, users may see the page load incrementally,
which is not a good experience for a native app. To make the window display
without a visual flash, there are two solutions for different situations.
## Using `ready-to-show` event
### Using the `ready-to-show` event
While loading the page, the `ready-to-show` event will be emitted when the renderer
process has rendered the page for the first time if the window has not been shown yet. Showing
@@ -48,7 +49,7 @@ event.
Please note that using this event implies that the renderer will be considered "visible" and
paint even though `show` is false. This event will never fire if you use `paintWhenInitiallyHidden: false`
## Setting `backgroundColor`
### Setting the `backgroundColor` property
For a complex app, the `ready-to-show` event could be emitted too late, making
the app feel slow. In this case, it is recommended to show the window
@@ -187,9 +188,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
*`parent` BrowserWindow (optional) - Specify parent window. Default is `null`.
*`modal` Boolean (optional) - Whether this is a modal window. This only works when the
window is a child window. Default is `false`.
*`acceptFirstMouse` Boolean (optional) - Whether the web view accepts a single
mouse-down event that simultaneously activates the window. Default is
`false`.
*`acceptFirstMouse` Boolean (optional) - Whether clicking an inactive window will also
click through to the web contents. Default is `false` on macOS. This option is not
configurable on other platforms.
*`disableAutoHideCursor` Boolean (optional) - Whether to hide cursor when typing.
Default is `false`.
*`autoHideMenuBar` Boolean (optional) - Auto hide the menu bar unless the `Alt`
@@ -213,16 +214,13 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
*`followWindow` - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.
*`active` - The backdrop should always appear active.
*`inactive` - The backdrop should always appear inactive.
*`titleBarStyle` String (optional) - The style of window title bar.
*`titleBarStyle` String (optional)_macOS__Windows_ - The style of window title bar.
Default is `default`. Possible values are:
*`default` - Results in the standard gray opaque Mac title
bar.
*`hidden` - Results in a hidden title bar and a full size content window, yet
the title bar still has the standard window controls ("traffic lights") in
the top left.
*`hiddenInset` - Results in a hidden title bar with an alternative look
*`default` - Results in the standard title bar for macOS or Windows respectively.
*`hidden` - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with `titleBarOverlay: true` it will activate the Window Controls Overlay (see `titleBarOverlay` for more information), otherwise no window controls will be shown.
*`hiddenInset` - Only on macOS, results in a hidden title bar with an alternative look
where the traffic light buttons are slightly more inset from the window edge.
*`customButtonsOnHover` - Results in a hidden title bar and a full size
*`customButtonsOnHover` - Only on macOS, results in a hidden title bar and a full size
content window, the traffic light buttons will display when being hovered
over in the top left of the window. **Note:** This option is currently
experimental.
@@ -342,8 +340,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
context in the dev tools by selecting the 'Electron Isolated Context'
entry in the combo box at the top of the Console tab.
*`nativeWindowOpen` Boolean (optional) - Whether to use native
`window.open()`. Defaults to `true`. Child windows will always have node
integration disabled unless `nodeIntegrationInSubFrames` is true.
`window.open()`. Defaults to `false`. Child windows will always have node
integration disabled unless `nodeIntegrationInSubFrames` is true.**Note:** The default
value will be changing to `true` in Electron 15.
*`webviewTag` Boolean (optional) - Whether to enable the [`<webview>` tag](webview-tag.md).
Defaults to `false`. **Note:** The
`preload` script configured for the `<webview>` will have node integration
@@ -391,6 +390,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
contain the layout of the document—without requiring scrolling. Enabling
this will cause the `preferred-size-changed` event to be emitted on the
`WebContents` when the preferred size changes. Default is `false`.
*`titleBarOverlay` [OverlayOptions](structures/overlay-options.md) | Boolean (optional) - When using a frameless window in conjuction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`. On Windows, the [OverlayOptions](structures/overlay-options.md) can be used instead of a boolean to specify colors for the overlay.
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
@@ -977,7 +977,7 @@ the player itself we would call this function with arguments of 16/9 and
are within the content view--only that they exist. Sum any extra width and
height areas you have within the overall content view.
The aspect ratio is not respected when window is resized programmingly with
The aspect ratio is not respected when window is resized programmatically with
APIs like `win.setSize`.
#### `win.setBackgroundColor(backgroundColor)`
@@ -1685,7 +1685,7 @@ current window into a top-level window.
#### `win.getParentWindow()`
Returns `BrowserWindow` - The parent window.
Returns `BrowserWindow | null` - The parent window or `null` if there is no parent.
#### `win.getChildWindows()`
@@ -1805,3 +1805,5 @@ removed in future Electron releases.
*`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
*`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.
@@ -127,7 +139,8 @@ green and non-draggable regions will be colored red to aid debugging.
### `ELECTRON_DEBUG_NOTIFICATIONS`
Adds extra logs to [`Notification`](./notification.md) lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common actions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.
Adds extra logs to [`Notification`](./notification.md) lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common a
tions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.
There's an alternative way to specify a chromeless window.
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
@@ -186,3 +217,5 @@ behave correctly on all platforms you should never use a custom context menu on
Emitted after `navigator.serial.requestPort` has been called and `select-serial-port` has fired if a new serial port becomes available. For example, this event will fire when a new USB device is plugged in.
*`webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. Cross origin sub frames making permission checks will pass a `null` webContents to this handler. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
*`permission` String - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, or `serial`.
*`webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. All cross origin sub frames making permission checks will pass a `null` webContents to this handler, while certain other permission checks such as `notifications` checks will always pass `null`. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
*`permission` String - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`,`hid`, or `serial`.
*`requestingOrigin` String - The origin URL of the permission check
*`details` Object - Some properties are only available on certain permission types.
*`embeddingOrigin` String (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
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.
*`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.
`features` will be passed to any registered `webContents`'s
`did-create-window` event handler in the `options` argument.
*`frameName` follows the specification of `windowName` located in the [native documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters).
* When opening `about:blank`, the child window's `WebPreferences` will be copied
from the parent window, and there is no way to override it because Chromium
skips browser side navigation in this case.
To customize or cancel the creation of the window, you can optionally set an
override handler with `webContents.setWindowOpenHandler()` from the main
@@ -12,8 +12,39 @@ This document uses the following convention to categorize breaking changes:
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
## Planned Breaking API Changes (15.0)
### Default Changed: `nativeWindowOpen` defaults to `true`
Prior to Electron 15, `window.open` was by default shimmed to use
`BrowserWindowProxy`. This meant that `window.open('about:blank')` did not work
to open synchronously scriptable child windows, among other incompatibilities.
`nativeWindowOpen: true` is no longer experimental, and is now the default.
See the documentation for [window.open in Electron](api/window-open.md)
for more details.
## Planned Breaking API Changes (14.0)
### Removed: `remote` module
The `remote` module was deprecated in Electron 12, and will be removed in
The `app.allowRendererProcessReuse` property will be removed as part of our plan to
@@ -37,22 +68,12 @@ If you were using this parameter to set the title of a window, you can instead u
### Removed: `worldSafeExecuteJavaScript`
In Electron 14, `worldSafeExecuteJavaScript` will be removed. There is no alternative, please
ensure your code works with this property enabled. It has been enabled by default since Electron
In Electron 14, `worldSafeExecuteJavaScript` will be removed. There is no alternative, please
ensure your code works with this property enabled. It has been enabled by default since Electron
12.
You will be affected by this change if you use either `webFrame.executeJavaScript` or `webFrame.executeJavaScriptInIsolatedWorld`. You will need to ensure that values returned by either of those methods are supported by the [Context Bridge API](api/context-bridge.md#parameter--error--return-type-support) as these methods use the same value passing semantics.
### Default Changed: `nativeWindowOpen` defaults to `true`
Prior to Electron 14, `window.open` was by default shimmed to use
`BrowserWindowProxy`. This meant that `window.open('about:blank')` did not work
to open synchronously scriptable child windows, among other incompatibilities.
`nativeWindowOpen` is no longer experimental, and is now the default.
See the documentation for [window.open in Electron](api/window-open.md)
for more details.
### Removed: BrowserWindowConstructorOptions inheriting from parent windows
Prior to Electron 14, windows opened with `window.open` would inherit
<h3>The <code>app</code> module provides methods for handling protocols.</h3>
<p>These methods allow you to set and unset the protocols your app should be the default app for. Similar to when a browser asks to be your default for viewing web pages.</p>
<h1>App Default Protocol Demo</h1>
<p>Open the <ahref="https://electronjs.org/docs/api/app">full app API documentation<spanclass="u-visible-to-screen-reader">(opens in new window)</span></a> in your browser.</p>
</header>
<p>The protocol API allows us to register a custom protocol and intercept existing protocol requests.</p>
<p>These methods allow you to set and unset the protocols your app should be the default app for. Similar to when a
browser asks to be your default for viewing web pages.</p>
<div>
<buttonid="open-in-browser"class="js-container-target demo-toggle-button">Launch current page in browser
<ahref="electron-api-demos://open">Now... launch the app from a web link</a>
</section>
<div>
<p>You can set your app as the default app to open for a specific protocol. For instance, in this demo we set this app as the default for <code>electron-api-demos://</code>. The demo button above will launch a page in your default browser with a link. Click that link and it will re-launch this app.</p>
<h5>Packaging</h5>
<p>This feature will only work on macOS when your app is packaged. It will not work when you're launching it in development from the command-line. When you package your app you'll need to make sure the macOS <code>plist</code> for the app is updated to include the new protocol handler. If you're using <code>electron-packager</code> then you can add the flag <code>--extend-info</code> with a path to the <code>plist</code> you've created. The one for this app is below.</p>
@@ -4,15 +4,39 @@ This page defines some terminology that is commonly used in Electron development
### ASAR
ASAR stands for Atom Shell Archive Format. An [asar][asar] archive is a simple
ASAR stands for Atom Shell Archive Format. An [asar] archive is a simple
`tar`-like format that concatenates files into a single file. Electron can read
arbitrary files from it without unpacking the whole file.
The ASAR format was created primarily to improve performance on Windows... TODO
The ASAR format was created primarily to improve performance on Windows when
reading large quantities of small files (e.g. when loading your app's JavaScript
dependency tree from `node_modules`).
### code signing
Code signing is a process where an app developer digitally signs their code to
ensure that it hasn't been tampered with after packaging. Both Windows and
macOS implement their own version of code signing. As a desktop app developer,
it's important that you sign your code if you plan on distributing it to the
general public.
For more information, read the [Code Signing] tutorial.
### context isolation
Context isolation is a security measure in Electron that ensures that your
preload script cannot leak privileged Electron or Node.js APIs to the web
contents in your renderer process. With context isolation enabled, the
only way to expose APIs from your preload script is through the
`contextBridge` API.
For more information, read the [Context Isolation] tutorial.
See also: [preload script](#preload-script), [renderer process](#renderer-process)
### CRT
The C Run-time Library (CRT) is the part of the C++ Standard Library that
The C Runtime Library (CRT) is the part of the C++ Standard Library that
incorporates the ISO C99 standard library. The Visual C++ libraries that
implement the CRT support native code development, and both mixed native and
managed code, and pure managed code for .NET development.
@@ -20,8 +44,7 @@ managed code, and pure managed code for .NET development.
### DMG
An Apple Disk Image is a packaging format used by macOS. DMG files are
commonly used for distributing application "installers". [electron-builder]
supports `dmg` as a build target.
commonly used for distributing application "installers".
### IME
@@ -31,19 +54,15 @@ keyboards to input Chinese, Japanese, Korean and Indic characters.
### IDL
Interface description language. Write function signatures and data types in a format that can be used to generate interfaces in Java, C++, JavaScript, etc.
Interface description language. Write function signatures and data types in a
format that can be used to generate interfaces in Java, C++, JavaScript, etc.
### IPC
IPC stands for Inter-Process Communication. Electron uses IPC to send
serialized JSON messages between the [main] and [renderer] processes.
IPC stands for inter-process communication. Electron uses IPC to send
serialized JSON messages between the main and renderer processes.
### libchromiumcontent
A shared library that includes the [Chromium Content module] and all its
dependencies (e.g., Blink, [V8], etc.). Also referred to as "libcc".
see also: [main process](#main-process), [renderer process](#renderer-process)
### main process
@@ -68,10 +87,22 @@ MAS, see the [Mac App Store Submission Guide].
### Mojo
An IPC system for communicating intra- or inter-process, and that's important because Chrome is keen on being able to split its work into separate processes or not, depending on memory pressures etc.
An IPC system for communicating intra- or inter-process, and that's important
because Chrome is keen on being able to split its work into separate processes
or not, depending on memory pressures etc.
See https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md
See also: [IPC](#ipc)
### MSI
On Windows, MSI packages are used by the Windows Installer
(also known as Microsoft Installer) service to install and configure
applications.
More information can be found in [Microsoft's documentation][msi].
### native modules
Native modules (also called [addons] in
@@ -85,22 +116,33 @@ likely to use a different V8 version from the Node binary installed in your
system, you have to manually specify the location of Electron’s headers when
building native modules.
See also [Using Native Node Modules].
For more information, read the [Native Node Modules] tutorial.
### NSIS
### notarization
Nullsoft Scriptable Install System is a script-driven Installer
authoring tool for Microsoft Windows. It is released under a combination of
free software licenses, and is a widely-used alternative to commercial
proprietary products like InstallShield. [electron-builder] supports NSIS
as a build target.
Notarization is a macOS-specific process where a developer can send a
code-signed app to Apple servers to get verified for malicious
components through an automated service.
See also: [code signing](#code-signing)
### OSR
OSR (Off-screen rendering) can be used for loading heavy page in
OSR (offscreen rendering) can be used for loading heavy page in
background and then displaying it after (it will be much faster).
It allows you to render page without showing it on screen.
For more information, read the [Offscreen Rendering][osr] tutorial.
### preload script
Preload scripts contain code that executes in a renderer process
before its web contents begin loading. These scripts run within
the renderer context, but are granted more privileges by having
access to Node.js APIs.
See also: [renderer process](#renderer-process), [context isolation](#context-isolation)
### process
A process is an instance of a computer program that is being executed. Electron
@@ -120,13 +162,17 @@ The renderer process is a browser window in your app. Unlike the main process,
there can be multiple of these and each is run in a separate process.
They can also be hidden.
In normal browsers, web pages usually run in a sandboxed environment and are not
allowed access to native resources. Electron users, however, have the power to
use Node.js APIs in web pages allowing lower level operating system
interactions.
See also: [process](#process), [main process](#main-process)
### sandbox
The sandbox is a security feature inherited from Chromium that restricts
your renderer processes to a limited set of permissions.
For more information, read the [Process Sandboxing] tutorial.
See also: [process](#process)
### Squirrel
Squirrel is an open-source framework that enables Electron apps to update
@@ -45,4 +45,4 @@ If the V8 context crashes, the DevTools will display this message.
Chromium logs can be enabled via the `ELECTRON_ENABLE_LOGGING` environment variable. For more information, see the [environment variables documentation](../api/environment-variables.md#electron_enable_logging).
Alternatively, the command line argument `--enable-logging` can be passed. More information is available in the [command line switches documentation](../api/command-line-switches.md#--enable-logging).
Alternatively, the command line argument `--enable-logging` can be passed. More information is available in the [command line switches documentation](../api/command-line-switches.md#--enable-loggingfile).
Context Isolation is a feature that ensures that both your `preload` scripts and Electron's internal logic run in a separate context to the website you load in a [`webContents`](../api/web-contents.md). This is important for security purposes as it helps prevent the website from accessing Electron internals or the powerful APIs your preload script has access to.
This means that the `window` object that your preload script has access to is actually a **different** object than the website would have access to. For example, if you set `window.hello = 'wave'` in your preload script and context isolation is enabled `window.hello` will be undefined if the website tries to access it.
This means that the `window` object that your preload script has access to is actually a **different** object than the website would have access to. For example, if you set `window.hello = 'wave'` in your preload script and context isolation is enabled,`window.hello` will be undefined if the website tries to access it.
Every single application should have context isolation enabled and from Electron 12 it will be enabled by default.
## How do I enable it?
From Electron 12, it will be enabled by default. For lower versions it is an option in the `webPreferences` option when constructing `new BrowserWindow`'s.
```javascript
constmainWindow=newBrowserWindow({
webPreferences:{
contextIsolation:true
}
})
```
Context isolation has been enabled by default since Electron 12, and it is a recommended security setting for _all applications_.
## Migration
> I used to provide APIs from my preload script using `window.X = apiObject` now what?
> Without context isolation, I used to provide APIs from my preload script using `window.X = apiObject`. Now what?
Exposing APIs from your preload script to the loaded website is a common usecase and there is a dedicated module in Electron to help you do this in a painless way.
### Before: context isolation disabled
**Before: With context isolation disabled**
Exposing APIs from your preload script to a loaded website in the renderer process is a common use-case. With context isolation disabled, your preload script would share a common global `window` object with the renderer. You could then attach arbitrary properties to a preload script:
```javascript
```javascript title='preload.js'
// preload with contextIsolation disabled
window.myAPI = {
doAThing: () => {}
}
```
**After: With context isolation enabled**
The `doAThing()` function could then be used directly in the renderer process:
```javascript
```javascript title='renderer.js'
// use the exposed API in the renderer
window.myAPI.doAThing()
```
### After: context isolation enabled
There is a dedicated module in Electron to help you do this in a painless way. The [`contextBridge`](../api/context-bridge.md) module can be used to **safely** expose APIs from your preload script's isolated context to the context the website is running in. The API will also be accessible from the website on `window.myAPI` just like it was before.
The [`contextBridge`](../api/context-bridge.md) module can be used to **safely** expose APIs from the isolated context your preload script runs in to the context the website is running in. The API will also be accessible from the website on `window.myAPI` just like it was before.
```javascript title='renderer.js'
// use the exposed API in the renderer
window.myAPI.doAThing()
```
You should read the `contextBridge` documentation linked above to fully understand its limitations. For instance you can't send custom prototypes or symbols over the bridge.
Please read the `contextBridge` documentation linked above to fully understand its limitations. For instance, you can't send custom prototypes or symbols over the bridge.
## Security Considerations
## Security considerations
Just enabling `contextIsolation` and using `contextBridge` does not automatically mean that everything you do is safe. For instance this code is **unsafe**.
Just enabling `contextIsolation` and using `contextBridge` does not automatically mean that everything you do is safe. For instance, this code is **unsafe**.
```javascript
```javascript title='preload.js'
// ❌ Bad code
contextBridge.exposeInMainWorld('myAPI', {
send: ipcRenderer.send
})
```
It directly exposes a powerful API without any kind of argument filtering. This would allow any website to send arbitrary IPC messages which you do not want to be possible. The correct way to expose IPC-based APIs would instead be to provide one method per IPC message.
It directly exposes a powerful API without any kind of argument filtering. This would allow any website to send arbitrary IPC messages, which you do not want to be possible. The correct way to expose IPC-based APIs would instead be to provide one method per IPC message.
If you're building your Electron app with TypeScript, you'll want to add types to your APIs exposed over the context bridge. The renderer's `window` object won't have the correct typings unless you extend the types with a [declaration file].
You can create a `renderer.d.ts` declaration file and globally augment the `Window` interface:
```typescript title='renderer.d.ts'
export interface IElectronAPI {
loadPreferences: () => Promise<void>,
}
declare global {
interface Window {
electronAPI: IElectronAPI
}
}
```
Doing so will ensure that the TypeScript compiler will know about the `electronAPI` property on your global `window` object when writing scripts in your renderer process:
* The `-beta.1` and `stable` dates are our solid release dates.
* We strive for weekly beta releases, however we often release more betas than scheduled.
* All dates are our goals but there may be reasons for adjusting the stable deadline, such as security bugs.
* Take a look at the [5.0.0 Timeline blog post](https://electronjs.org/blog/electron-5-0-timeline) for info about publicizing our release dates.
* Since Electron 6.0, we've been targeting every other Chromium version and releasing our stable on the same day as Chrome stable. You can reference Chromium's release schedule [here](https://chromiumdash.appspot.com/schedule). See [Electron's new release cadence blog post](https://www.electronjs.org/blog/12-week-cadence) for more details on our release schedule.
* Electron 15.0 only will include a special Alpha release. Starting in Electron 16.0, we will release on an 8-week cadence. See [Electron's new 8-week cadence blog post](https://www.electronjs.org/blog/8-week-cadence) for more details.
> A detailed look at our versioning policy and implementation.
As of version 2.0.0, Electron follows [SemVer](#semver). The following command will install the most recent stable build of Electron:
As of version 2.0.0, Electron follows the [SemVer](#semver) spec. The following command will install the most recent stable build of Electron:
```sh
```sh npm2yarn
npm install --save-dev electron
```
To update an existing project to use the latest stable version:
```sh
```sh npm2yarn
npm install --save-dev electron@latest
```
## Version 1.x
Electron versions *< 2.0* did not conform to the [SemVer](https://semver.org) spec: major versions corresponded to end-user API changes, minor versions corresponded to Chromium major releases, and patch versions corresponded to new features and bug fixes. While convenient for developers merging features, it creates problems for developers of client-facing applications. The QA testing cycles of major apps like Slack, Stride, Teams, Skype, VS Code, Atom, and Desktop can be lengthy and stability is a highly desired outcome. There is a high risk in adopting new features while trying to absorb bug fixes.
An app developed with `1.8.1` cannot take the `1.8.3` bug fix without either absorbing the `1.8.2` feature, or by backporting the fix and maintaining a new release line.
## Version 2.0 and Beyond
## Versioning scheme
There are several major changes from our 1.x strategy outlined below. Each change is intended to satisfy the needs and priorities of developers/maintainers and app developers.
1. Strict use of SemVer
1. Strict use of the [SemVer](#semver) spec
2. Introduction of semver-compliant `-beta` tags
3. Introduction of [conventional commit messages](https://conventionalcommits.org/)
4. Well-defined stabilization branches
5. The `master` branch is versionless; only stabilization branches contain version information
5. The `main` branch is versionless; only stabilization branches contain version information
We will cover in detail how git branching works, how npm tagging works, what developers should expect to see, and how one can backport changes.
# SemVer
From 2.0 onward, Electron will follow SemVer.
## SemVer
Below is a table explicitly mapping types of changes to their corresponding category of SemVer (e.g. Major, Minor, Patch).
@@ -48,22 +36,25 @@ Below is a table explicitly mapping types of changes to their corresponding cate
| Node.js major version updates | Node.js minor version updates | Node.js patch version updates |
| Chromium version updates | | fix-related chromium patches |
For more information, see the [Semantic Versioning 2.0.0](https://semver.org/) spec.
Note that most Chromium updates will be considered breaking. Fixes that can be backported will likely be cherry-picked as patches.
# Stabilization Branches
## Stabilization branches
Stabilization branches are branches that run parallel to master, taking in only cherry-picked commits that are related to security or stability. These branches are never merged back to master.
Stabilization branches are branches that run parallel to `main`, taking in only cherry-picked commits that are related to security or stability. These branches are never merged back to `main`.
Since Electron 8, stabilization branches are always **major** version lines, and named against the following template `$MAJOR-x-y` e.g. `8-x-y`. Prior to that we used **minor** version lines and named them as `$MAJOR-$MINOR-x` e.g. `2-0-x`
Since Electron 8, stabilization branches are always **major** version lines, and named against the following template `$MAJOR-x-y` e.g. `8-x-y`. Prior to that we used **minor** version lines and named them as `$MAJOR-$MINOR-x` e.g. `2-0-x`.
We allow for multiple stabilization branches to exist simultaneously, one for each supported version. For more details on which versions are supported, see our [Electron Release Timelines](./electron-timelines.md) doc.
We allow for multiple stabilization branches to exist simultaneously, and intend to support at least two in parallel at all times, backporting security fixes as necessary.
Older lines will not be supported by GitHub, but other groups can take ownership and backport stability and security fixes on their own. We discourage this, but recognize that it makes life easier for many app developers.
Older lines will not be supported by the Electron project, but other groups can take ownership and backport stability and security fixes on their own. We discourage this, but recognize that it makes life easier for many app developers.
# Beta Releases and Bug Fixes
## Beta releases and bug fixes
Developers want to know which releases are _safe_ to use. Even seemingly innocent features can introduce regressions in complex applications. At the same time, locking to a fixed version is dangerous because you’re ignoring security patches and bug fixes that may have come out since your version. Our goal is to allow the following standard semver ranges in `package.json` :
@@ -116,15 +107,7 @@ A few examples of how various SemVer ranges will pick up new releases:

# Missing Features: Alphas
Our strategy has a few tradeoffs, which for now we feel are appropriate. Most importantly that new features in master may take a while before reaching a stable release line. If you want to try a new feature immediately, you will have to build Electron yourself.
As a future consideration, we may introduce one or both of the following:
* alpha releases that have looser stability constraints to betas; for example it would be allowable to admit new features while a stability channel is in _alpha_
# Feature Flags
## Feature flags
Feature flags are a common practice in Chromium, and are well-established in the web-development ecosystem. In the context of Electron, a feature flag or **soft branch** must have the following properties:
@@ -132,20 +115,29 @@ Feature flags are a common practice in Chromium, and are well-established in the
* it completely segments new and old code paths; refactoring old code to support a new feature _violates_ the feature-flag contract
* feature flags are eventually removed after the feature is released
# Semantic Commits
## Semantic commits
We seek to increase clarity at all levels of the update and releases process. Starting with `2.0.0` we will require pull requests adhere to the [Conventional Commits](https://conventionalcommits.org/) spec, which can be summarized as follows:
All pull requests must adhere to the [Conventional Commits](https://conventionalcommits.org/) spec, which can be summarized as follows:
* Commits that would result in a SemVer **major** bump must start their body with `BREAKING CHANGE:`.
* Commits that would result in a SemVer **minor** bump must start with `feat:`.
* Commits that would result in a SemVer **patch** bump must start with `fix:`.
* We allow squashing of commits, provided that the squashed message adheres to the above message format.
* It is acceptable for some commits in a pull request to not include a semantic prefix, as long as the pull request title contains a meaningful encompassing semantic message.
The `electron/electron` repository also enforces squash merging, so you only need to make sure that your pull request has the correct title prefix.
# Versioned `master`
## Versioned `main` branch
* The `master` branch will always contain the next major version `X.0.0-nightly.DATE` in its `package.json`
* Release branches are never merged back to master
* Release branches _do_ contain the correct version in their `package.json`
* As soon as a release branch is cut for a major, master must be bumped to the next major. I.e. `master` is always versioned as the next theoretical release branch
* The `main` branch will always contain the next major version `X.0.0-nightly.DATE` in its `package.json`.
* Release branches are never merged back to `main`.
* Release branches _do_ contain the correct version in their `package.json`.
* As soon as a release branch is cut for a major, `main` must be bumped to the next major (i.e. `main` is always versioned as the next theoretical release branch).
## Historical versioning (Electron 1.X)
Electron versions *< 2.0* did not conform to the [SemVer](https://semver.org) spec: major versions corresponded to end-user API changes, minor versions corresponded to Chromium major releases, and patch versions corresponded to new features and bug fixes. While convenient for developers merging features, it creates problems for developers of client-facing applications. The QA testing cycles of major apps like Slack, Teams, Skype, VS Code, and GitHub Desktop can be lengthy and stability is a highly desired outcome. There is a high risk in adopting new features while trying to absorb bug fixes.
An app developed with `1.8.1` cannot take the `1.8.3` bug fix without either absorbing the `1.8.2` feature, or by backporting the fix and maintaining a new release line.
To install prebuilt Electron binaries, use [`npm`][npm].
The preferred method is to install Electron as a development dependency in your
@@ -135,14 +135,18 @@ a text file. A typical cache might look like this:
## Skip binary download
When installing the `electron` NPM package, it automatically downloads the electron binary.
Under the hood, Electron's JavaScript API binds to a binary that contains its
implementations. Because this binary is crucial to the function of any Electron app,
it is downloaded by default in the `postinstall` step every time you install `electron`
from the npm registry.
This can sometimes be unnecessary, e.g. in a CI environment, when testing another component.
However, if you want to install your project's dependencies but don't need to use
Electron functionality, you can set the `ELECTRON_SKIP_BINARY_DOWNLOAD` environment
variable to prevent the binary from being downloaded. For instance, this feature can
be useful in continuous integration environments when running unit tests that mock
out the `electron` module.
To prevent the binary from being downloaded when you install all npm dependencies you can set the environment variable `ELECTRON_SKIP_BINARY_DOWNLOAD`.
We will now define the function in charge of creating our browser window and load our application's `index.html` file.
```javascript
constcreateWindow=()=>{
// Create the browser window.
mainWindow=newBrowserWindow({
width:800,
height:600,
webPreferences:{
preload:path.join(__dirname,'preload.js')
}
})
mainWindow.loadFile('index.html')
}
```
In this next step, we will create our `BrowserWindow` and tell our application how to handle an event in which an external protocol is clicked.
This code will be different in Windows compared to MacOS and Linux. This is due to Windows requiring additional code in order to open the contents of the protocol link within the same Electron instance. Read more about this [here](https://www.electronjs.org/docs/api/app#apprequestsingleinstancelock).
In this guide, the list of documents is cleared once all windows have been
closed.
## Additional information
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.