Compare commits

...

351 Commits

Author SHA1 Message Date
Electron Bot
bbdd71dd54 Bump v11.4.1 2021-03-23 08:10:33 -07:00
trop[bot]
0a6d4a9875 fix: escape URL passed to shell.openExternal on windows (#28340)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-03-23 00:04:45 -07:00
Pedro Pontes
3159edeff6 chore: cherry-pick a66dbdcf6493 from chromium (#28294)
* chore: cherry-pick a66dbdcf6493 from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2021-03-22 08:09:05 -07:00
trop[bot]
6665d2be19 fix: DesktopCapturer gc'd prior to capture completion (#28282)
desktopCapture.getSources() returns a promise which should resolve
when capturing finishes. Internally it creates an instance of
DesktopCapturer which is responsible for resolving or rejecting
the promise.

Between the time DesktopCapturer starts capturing frames and when
it finishes, it's possible for its handle to be GC'd leading to
it never resolving.

These changes pin the instance of DesktopCapturer until it either
finishes or errors.

fixes #25595

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-03-22 11:02:33 +09:00
Pedro Pontes
bf3ddcaeb8 chore: cherry-pick 93ce5606cd9a from chromium (#28247)
* chore: cherry-pick 93ce5606cd9a from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-03-22 11:00:28 +09:00
trop[bot]
2783fbf550 fix: drag region offsets in BrowserViews (#28297)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-22 10:59:12 +09:00
trop[bot]
3cba3f4d7e test: use new uuid for each ServiceWorker test (#28310)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-03-22 10:58:00 +09:00
trop[bot]
418e0c174f fix: bad menu position when no positioning item specified (#28278)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-03-19 10:22:00 +09:00
Pedro Pontes
c38a7c1a7a chore: cherry-pick c6d6f7aee733 from chromium (#28249)
* chore: cherry-pick c6d6f7aee733 from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-18 16:53:05 -04:00
Pedro Pontes
18e10fe1a9 chore: cherry-pick 53c4d05797 and 6e8f04c980 from v8 (#28236)
* cherry-pick 53c4d05797 and 6e8f04c980 from v8

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2021-03-18 15:15:03 +09:00
Pedro Pontes
5fa579c607 chore: cherry-pick e1505713dc31 from chromium (#28233)
* chore: cherry-pick e1505713dc31 from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2021-03-18 15:14:20 +09:00
trop[bot]
27045abeeb docs: document the parameter structure of hookWindowMessage (#28212)
Fixes #28178

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-03-16 15:43:52 -07:00
trop[bot]
fb75073955 fix: revert "refactor: mmap asar files (#24470)" (#28201)
This reverts commit 01a2e23194.

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-03-16 19:20:41 +09:00
Keeley Hammond
fce83c48f2 fix: values return from the ctx bridge with dynamic property support should themselves support dynamic properties (#28161)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-03-16 17:33:12 +09:00
Pedro Pontes
f790637e12 chore: cherry-pick 33861dcf6d15 from chromium (#28132)
* chore: cherry-pick 33861dcf6d15 from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-03-16 17:32:10 +09:00
Pedro Pontes
56c9e259a1 chore: cherry-pick 5651fb858b75 from chromium (#28198)
* chore: cherry-pick 5651fb858b75 from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2021-03-15 20:35:21 -04:00
Electron Bot
f1f0ed1ecd Bump v11.4.0 2021-03-15 10:25:31 -07:00
Pedro Pontes
570db18ef2 chore: cherry-pick 6e8856624cbb from chromium (#28165)
* chore: cherry-pick 6e8856624cbb from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2021-03-15 11:52:18 -04:00
trop[bot]
43b9988c57 chore: cherry-pick 1fe571a from node (#28108)
* chore: cherry-pick 1fe571a from node

Backports https://github.com/nodejs/node/pull/37000

* Fix merge error

* update patches

Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-03-15 04:39:08 -07:00
trop[bot]
b740cd2202 fix: handle a nil backgroundColor in win.getBackgroundColor() (#28186)
* fix: handle a nil backgroundColor in win.getBackgroundColor()

* spec: add crash case

* fix: update to fix native_views transparent color

* chore: fix lint

Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-03-15 11:08:12 +09:00
trop[bot]
592430f918 fix: convert system colors to device color space in systemPreferences (#28171)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-03-13 05:01:23 -08:00
Pedro Pontes
3445fbf7dc chore: cherry-pick 18d3f86206e8 from chromium (#28097)
* chore: cherry-pick 18d3f86206e8 from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2021-03-13 10:44:25 +09:00
Pedro Pontes
df5ff97144 cherry-pick 157601b9b9 from pdfium (#28101) 2021-03-12 09:24:23 -08:00
Pedro Pontes
3bb800ce04 chore: cherry-pick eb0c0353bf24 from chromium (#28093)
* chore: cherry-pick eb0c0353bf24 from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-03-12 19:44:21 +09:00
trop[bot]
413fbcfa18 fix: change #if defined(OS_MACOSX) to #if defined(OS_MAC) (#28151)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-03-12 16:43:24 +09:00
Pedro Pontes
8877087e51 chore: cherry-pick 38781b86f0 from chromium (#28050) 2021-03-12 16:37:40 +09:00
trop[bot]
275eecdfcb docs: fix cookies event documentation for type generation (#28138)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-03-11 16:22:53 -08:00
Pedro Pontes
6ecf43c8c4 chore: cherry-pick aeb6bc551b60 from chromium (#28089)
* chore: cherry-pick aeb6bc551b60 from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-03-10 13:43:25 -05:00
Pedro Pontes
aec62a9874 chore: cherry-pick 6ed1c0c425e0 from chromium (#28091)
* chore: cherry-pick 6ed1c0c425e0 from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2021-03-10 11:26:03 -05:00
trop[bot]
291b4f9980 fix: capturePage not resolving with hidden windows (#28074)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-09 13:42:49 -08:00
trop[bot]
a841bd195c build: call goma_ctl.py ensure_start directly (#28058)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-03-09 16:05:36 +09:00
Pedro Pontes
4a5a18f003 chore: cherry-pick 7e0e52df283c from chromium (#28046)
* chore: cherry-pick 7e0e52df283c from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2021-03-08 16:58:37 -05:00
trop[bot]
5c29d3b533 chore: Add a condition to crashReporter deprecate log (#28012)
* Add a condition to crashReporter deprecate log

When developer set  submitURL to '' crash reports will be saved  at `...\AppData\Roaming\...\Crashpad\reports`, will not be uploaded to the server.
So  at this time `deprecate.log('Sending uncompressed crash reports....')`  is  unnecessary.

* Update lib/browser/api/crash-reporter.ts

change to check uploadToServer

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

Co-authored-by: liulun <xland@live.cn>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-03-07 16:31:27 +09:00
trop[bot]
e0172c45f0 fix: warning when worldSafeExecuteJavaScript is disabled (#27968)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-03-05 10:14:47 +09:00
trop[bot]
3fa9826b8b feat: expose des-ede3 cipher (#27993)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-03-04 15:38:42 -05:00
trop[bot]
e262b5040a fix: ensure owner window valid (#27948)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-04 16:39:08 +09:00
trop[bot]
e5eafc8ee9 fix: check web_contents() for destroyed WebContents (#27965)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-03-04 16:33:37 +09:00
trop[bot]
2bcf583bcf fix: offset browserview drag regions on macOS (#27987)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-03-04 16:32:45 +09:00
Shelley Vohr
c50d0e49c1 fix: set WebContents background color ubiquitously (#27944)
Move it from LoadURL to RenderViewCreated which is present
in all window creation cases and is called early enough to be
relevant from user prespective and after RenderWidgetHostView
is already present.

Co-authored-by: marekharanczyk <48673767+marekharanczyk@users.noreply.github.com>
2021-03-01 13:21:16 -08:00
John Kleinschmidt
26c5cc2801 fix: navigator.bluetooth.requestDevice crash (#27941)
* fix: navigator.bluetooth.requestDevice crash

* update bluetooth test to handle bluetooth permission denied

(cherry picked from commit 1c7ca277cc)
2021-03-01 12:39:54 -08:00
trop[bot]
fb5822af43 docs: fix header level of some events in app.md (#27886)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-02-24 20:36:19 +09:00
trop[bot]
97626aeac8 fix: isFullScreen typo (#27863)
* fix isFullScreen typo

* Update lib/browser/api/base-window.ts

Co-authored-by: John Kleinschmidt <jkleinsc@github.com>

Co-authored-by: Tony Wu <tonywoo@fb.com>
Co-authored-by: Tony <TonyWuu@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
2021-02-24 18:05:16 +09:00
Shelley Vohr
b8d136aeea fix: libuv hang when nodeIntegrationInSubframes enabled (#27880) 2021-02-24 17:58:56 +09:00
Erick Zhao
eed55d5923 docs: remove v5 and v6 modernization docs (#27857) 2021-02-22 12:21:16 -08:00
trop[bot]
ef4d98ac7f fix: cap sendInputEvent text length at n-1 (#27853)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-02-22 11:54:10 -08:00
Michaela Laurencin
8ae9c5c7cf fix: replace default frameName title with null check (#27813)
* fix: replace default frameName title with null check (#27521)

* refactor: replace default frameName title with null check

* add isNativeWindowOpen check in makeBrowserWindowOptions

* modify snapshot test files

* replace title with frame-name again for proxy - not native open

* modify proxy snapshot title key-value to come after height key-value

* add nativewindowopen check to null title

* fix lint and json formatting

* reformat test cases for this branch

the merged changes included some rearrangements to the json items that
do not apply to this branch, so the items were reordered according to
this branch's previous files.

* remove default frameName title for native open call and modify test txts
2021-02-22 11:07:18 -05:00
Electron Bot
1631fc9b0c Bump v11.3.0 2021-02-19 11:40:19 -08:00
trop[bot]
cc0848a86e revert: patch libuv to use posix_spawn on macOS (#27026) (#27809)
* Revert "perf: patch libuv to use posix_spawn on macOS (#27026)"

This reverts commit f69c11105f.

* Update .patches

Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: Robo <hop2deep@gmail.com>
2021-02-19 09:50:35 -08:00
trop[bot]
c7a2b32c5a docs: update menu item '&' escaping (#27817)
Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
2021-02-19 09:44:41 -08:00
trop[bot]
18cfdb1c82 fix: enableBlinkFeatures warning in webviews (#27789)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-02-19 15:46:47 +09:00
trop[bot]
1105931d0a fix: don't create last saved path if none exists (#27808)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-02-19 15:44:44 +09:00
Robo
234309497e chore: cherry-pick b712f9fd66 from chromium (#27781)
Backports https://chromium-review.googlesource.com/c/chromium/src/+/2690730
2021-02-18 17:23:41 -08:00
Calvin
6fa2ab2edd fix: restore window event redispatching on mac (#27787) 2021-02-18 16:19:13 -08:00
Robo
527c767107 chore: cherry-pick 202b40b9ae, 135a6e537f from chromium (#27780)
* chore: cherry-pick 202b40b9ae, 135a6e537f from chromium

Backports:
https://chromium-review.googlesource.com/c/chromium/src/+/2687828
https://chromium-review.googlesource.com/c/chromium/src/+/2688137

* update patches

* fix: compilation errors

Co-authored-by: Electron Bot <electron@github.com>
2021-02-18 15:34:00 -08:00
Robo
15468432c8 chore: cherry-pick 59f3ca2780 from chromium (#27778)
Backports https://chromium-review.googlesource.com/c/chromium/src/+/2679121
2021-02-18 14:11:11 -08:00
Robo
af34655cb7 chore: cherry-pick 3a6f6fbfd8 from chromium (#27776)
* chore: cherry-pick 3a6f6fbfd8 from chromium

Backports https://chromium-review.googlesource.com/c/chromium/src/+/2692927

* fix: compilation errors
2021-02-18 13:41:13 -08:00
Robo
111b737ae4 chore: cherry-pick 84853ff62a from v8 (#27777)
Backports https://chromium-review.googlesource.com/c/v8/v8/+/2689191
2021-02-18 13:21:49 -08:00
Robo
e33df2c7b6 chore: cherry-pick 62bda83979 from chromium (#27779)
Backports https://chromium-review.googlesource.com/c/chromium/src/+/2651183
2021-02-18 11:11:08 -08:00
Robo
f30018b4b0 fix: crash in crypto.createDiffieHellman (#27766) 2021-02-18 10:34:56 +09:00
Eryk Rakowski
795200a838 feat: add win.setTopBrowserView() so that BrowserViews can be raised (#27007) (#27712)
* feat: Raise a browser view via `BrowserWindow.setTopBrowserView()`.

This is similar to removing and re-adding a browser view, but avoids a visible flicker as the browser view is not removed from the window when using `setTopBrowserView`. Note: if the given browser view is not attached to the window, it will be added.

This commit contains the macOS implementation.

* feat: setTopBrowserView support for Windows and Linux

* docs: add info about setTopBrowserView

* docs: Clarify behavior when browserView is not yet attached.

* fix: throw en error when browserView is not attached to the window

* fix: build error

* fix: test

* fix: add test case

* fix: tests

* fix: reparenting

* fix: close second window in tests

Co-authored-by: sentialx <sentialx@gmail.com>

Co-authored-by: Stewart Lord <stew@offbynone.com>
2021-02-18 10:20:55 +09:00
trop[bot]
64d4e5969f fix: check WebContents before emitting render-process-gone event (#27757)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-02-18 10:17:03 +09:00
trop[bot]
be670059a6 test: fix flaky did-change-theme-color test (#27767)
* test: move did-change-theme-color test to main

* test: enable did-change-theme-color test for WOA

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-02-18 10:15:15 +09:00
Jeremy Rose
5d64c42801 chore: cherry-pick 76cb1cc32baa from chromium (#27750)
* chore: cherry-pick 76cb1cc32baa from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2021-02-17 10:22:14 -08:00
Jeremy Rose
5b81463423 feat: implement allowFileAccess loadExtension option (#27703)
Co-authored-by: Сковорода Никита Андреевич <chalkerx@gmail.com>
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2021-02-16 15:32:37 -08:00
Erick Zhao
92df786066 PATCH (#27558) 2021-02-15 11:59:18 +09:00
trop[bot]
59aaa65381 ci: ignore errors deleting user app directories on WOA testing (#27728)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-02-15 11:49:23 +09:00
Raymond Zhao
715ffe4e51 fix: Replace ClearFilterData with InvalidateFilterData (#27699) 2021-02-15 09:54:48 +09:00
trop[bot]
51bb0ad36d docs: remove references to remote from docs (#27715)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-02-12 11:41:22 -06:00
Jeremy Rose
4636dfe68e chore: cherry-pick df438f22f7d2 from chromium (#27609) 2021-02-11 16:37:05 -08:00
Jeremy Rose
e3f6b2b082 chore: cherry-pick b0d3d3e85fa6 from skia (#27614)
* chore: cherry-pick b0d3d3e85fa6 from skia

* Update config.json

* resolve conflict
2021-02-11 15:58:51 -08:00
trop[bot]
968db9285f docs: update menu example to avoid remote (#27714)
* docs: update menu example to avoid remote

* Update menu.md

* lint

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-02-11 13:48:56 -08:00
trop[bot]
19f8ea37a5 perf: patch libuv to use posix_spawn on macOS (#27654)
* perf: patch libuv to use posix_spawn on macOS

patch libuv to fix a performance regression in macOS >= 11

Spawning child processes in an Electron application with a hardened
runtime has become slow in macOS Big Sur. This patch is a squashed
version of https://github.com/libuv/libuv/pull/3064

This patch should be removed when libuv PR 3064 is merged.

Fixes: https://github.com/libuv/libuv/issues/3050
Fixes: https://github.com/electron/electron/issues/26143
PR-URL: https://github.com/libuv/libuv/pull/3064

Authored-by: Juan Pablo Canepa <jpcanepa@gmail.com>
Co-authored-by: Marcello Bastéa-Forte <marcello@descript.com>
Electron patch prepared by: Pat DeSantis <pdesantis3@gmail.com>

* Remove trailing whitespaces from patch file

* update patches

* Update patch description

* Update .patches

Co-authored-by: Pat DeSantis <pdesantis3@gmail.com>
Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: Robo <hop2deep@gmail.com>
2021-02-10 16:53:51 -08:00
trop[bot]
99eb8ac059 chore: cherry-pick 0c8b6e41 from v8 (#27684)
* chore: cherry-pick 0c8b6e41 from v8

Backports https://chromium-review.googlesource.com/c/v8/v8/+/2679688

* update patches

* Update .patches

* update patches

Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-02-10 16:53:22 -08:00
Shelley Vohr
3bcdc276e1 fix: BrowserView rendering flicker (#27659) 2021-02-10 08:02:24 -08:00
trop[bot]
85dad8fb18 refactor: load preload script directly as a string (#27662)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-02-09 14:14:38 -08:00
trop[bot]
5f60640ddc perf: optimize data structures in context_bridge::ObjectCache (#27664)
* Use std::forward_list instead of base::LinkedList for better perf,
more consistent memory management.  Better than std::list because we
don't need the double-linked-list behavior of std::list
* Use std::unordered_map instead of std::map for the v8 hash table

Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-02-09 08:31:59 -08:00
trop[bot]
f9e6e6eff9 fix: do not run display check on "closed" windows in tray (#27669)
* fix: only run display check on restored wndow if minimized

* fix: don't run display check on hidden, non-minimized windows

Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2021-02-09 08:31:10 -08:00
Raymond Zhao
7695f3f1ee fix: Backport SVG filter invalidation fix from Chromium (#27635) 2021-02-08 10:15:12 -05:00
trop[bot]
3492077f33 fix: memory leak in BrowserWindow (#27640)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-02-08 17:36:00 +09:00
trop[bot]
0933c6796c fix: clean up base::LinkedList in context_bridge::ObjectCache (#27638)
base::LinkedList does not delete its members on destruction. We need to
manually ensure the linkedlist is empty when the ObjectCache is
destroyed.

Fixes #27039

Notes: Fixed memory leak when sending non-primitives over the context
bridge

Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-02-05 14:25:13 -08:00
Electron Bot
137f45750f Bump v11.2.3 2021-02-05 10:09:13 -08:00
Jeremy Rose
a0175137fb chore: cherry-pick 36abafa0a316 from v8 (#27624) 2021-02-05 09:43:20 -08:00
Erick Zhao
90eee5f909 fix: cherry-pick 5c7ad5393f74 from chromium (#27584)
* patch

* patch more

* patch more more
2021-02-03 20:47:35 -08:00
trop[bot]
a09dada8e4 fix: crash when loadExtension fails (#27588)
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-02-03 16:28:28 +09:00
Electron Bot
805e442ff8 Bump v11.2.2 2021-02-02 09:38:53 -08:00
trop[bot]
02a1b42db3 docs: update Xcode / macOS SDK version in build-instructions-macos.md (#27537)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-01-29 12:44:40 -08:00
trop[bot]
5c44dc2a0a docs: Update Readme, don't mention Electron < 2 (#27539)
* chore: Update Readme, don't mention Electron < 2

* chore: Add back versioning info

Co-authored-by: Felix Rieseberg <felix@felixrieseberg.com>
2021-01-29 12:44:15 -08:00
Erick Zhao
210c406ab1 docs: update verb tenses for structured clone notes (#27519) 2021-01-27 11:49:39 -08:00
trop[bot]
15a96413b6 docs: add missing contextBridge API to README (#27510)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-01-27 17:02:49 +09:00
Pedro Pontes
13e017c861 chore: cherry-pick 4af9de9806 and 115eccc0c6 from chromium. (#27494)
* chore: cherry-pick 4af9de9806 and 115eccc0c6 from chromium.

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2021-01-27 16:38:31 +09:00
Milan Burda
bb1299bbb5 build: fix build with enable_printing=false (#27456) (#27504) 2021-01-27 16:35:21 +09:00
Milan Burda
42d15f0536 fix: add eyedropper tool functionality to browser view (#27275) (#27509)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2021-01-27 16:34:26 +09:00
Pedro Pontes
70526f8070 chore: cherry-pick 2c26785, b03de8b and a3c3ef6 from usrsctp. (#27491)
* chore: cherry-pick 2c26785, b03de8b and a3c3ef6 from usrsctp.

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2021-01-26 09:25:57 -08:00
Charles Kerr
47640eaa9a fix: don't throw on bad icons in BrowserWindow constructor (#27441) (#27478) 2021-01-25 14:44:04 -06:00
Pedro Pontes
1f5a8b6894 chore: cherry-pick 3f7b67374a11 from chromium (#27406)
* chore: cherry-pick 3f7b67374a11 from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-01-25 11:29:44 -08:00
trop[bot]
b1f438245f fix: CSP with unsafe-eval detection with Trusted Types (#27469)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-01-25 10:25:29 -08:00
Pedro Pontes
a73d563390 chore: cherry-pick 44d052c and 0919d75 from v8. (#27415)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-01-25 08:43:33 -08:00
trop[bot]
6a1ef337a7 fix: <webview> not working with Trusted Types (#27464)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-01-25 08:26:16 -08:00
Pedro Pontes
63677086c2 chore: cherry-pick 06fe641d21bd from chromium (#27401)
* chore: cherry-pick 06fe641d21bd from chromium

* update patches

Co-authored-by: Electron Bot <electron@github.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-01-25 13:34:30 +09:00
Electron Bot
8805b996e0 Bump v11.2.1 2021-01-22 15:55:24 -08:00
Pedro Pontes
47adc0a2b7 chore: cherry-pick f9add3b8e5 from chromium. (#27443) 2021-01-22 12:13:16 -08:00
Pedro Pontes
1559dc74da chore: cherry-pick f62f983b56623f0e from sqlite. (#27424)
* chore: cherry-pick f62f983b56623f0e from sqlite.

* Fix missing comma

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-01-22 11:36:15 -08:00
trop[bot]
207dbb8d4e fix: actually clear pending requests in DevToolsAgentHost (#27439)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-01-21 14:00:17 -08:00
Pedro Pontes
3bda527e83 chore: cherry-pick 96db1e0, fd08636 and bc9cb11 from chromium. (#27437) 2021-01-21 12:55:49 -08:00
Pedro Pontes
e3b76f71de chore: cherry-pick ffd6ff5a61b9 from v8 (#27411)
* chore: cherry-pick ffd6ff5a61b9 from v8

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2021-01-21 15:56:27 +09:00
Milan Burda
6be5244111 fix: apply tzdata2020f to ICU (#27369)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2021-01-21 15:45:28 +09:00
Shelley Vohr
f398ba08a9 fix: incorrect case in content::PermissionType mapping (#27423) 2021-01-21 15:31:56 +09:00
trop[bot]
aa4f3550fd fix: Shutdown crash in DownloadItem callback (#27419)
The call stack for one of our top crashes looks like this:

```
node::Abort (node_errors.cc:241)
node::Assert (node_errors.cc:256)
node::MakeCallback (callback.cc:226)
gin_helper::internal::CallMethodWithArgs (event_emitter_caller.cc:23)
gin_helper::EmitEvent<T> (event_emitter_caller.h:51)
gin_helper::EventEmitterMixin<T>::Emit<T> (event_emitter_mixin.h:81)
electron::api::DownloadItem::OnDownloadUpdated (electron_api_download_item.cc:115)
download::DownloadItemImpl::UpdateObservers (download_item_impl.cc:482)
content::DownloadManagerImpl::Shutdown (download_manager_impl.cc:508)
content::BrowserContext::~BrowserContext (browser_context.cc:476)
```

Full stack here: https://sentry.io/share/issue/9b030a0601b547188181b543c16ecda2/

During browser shutdown, the `DownloadManager` was being cleaned up
*after* the Node environment had already been destroyed. This caused the
`DownloadItem::OnDownloadUpdated` callback to crash when trying to emit
the JS `done` event.

To prevent this, we now manually shut down the `DownloadManager`
earlier. This is also mentioned in the comment on
`DownloadManager::Shutdown`:

```
// Shutdown the download manager. Content calls this when BrowserContext is
// being destructed. If the embedder needs this to be called earlier, it can
// call it. In that case, the delegate's Shutdown() method will only be called
// once.
```

Co-authored-by: Biru Mohanathas <birunthan@mohanathas.com>
2021-01-21 15:30:29 +09:00
trop[bot]
095de8114e ci: fix broken homebrew cache (#27409)
Backport of #27224

Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-01-20 14:00:06 -08:00
trop[bot]
5737bac6f4 fix: increase stack size on windows (#27385)
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-01-20 11:50:49 -08:00
trop[bot]
c95eda8420 fix: prevent crash when keyboard event immediately precedes calling BrowserWindow.close() (#27357)
* fix: prevent crash when destroyed widget receives keyboard event

Activating a key to close a window will cause a silent crash. Handling the keyboard
event will lead to a nullptr dereferenced in Chromium code if the window widget has
already been destroyed.

* test: ensure BrowserWindow doesn't crash from keyboard events during close

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-01-19 15:50:21 +09:00
Shelley Vohr
7fb97f041b refactor: use platform-specific TaskRunner to print (#27326) 2021-01-19 11:34:00 +09:00
Erick Zhao
b4ea9e0fc8 docs: update devtools extension tutorial (#26326) (#27311)
* docs: update devtools extension tutorial

* Update docs/tutorial/devtools-extension.md

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

* update

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

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-01-14 14:54:45 +09:00
Charles Kerr
19b7336fc3 chore: fix patch whitespace warnings (#27314) 2021-01-13 13:50:15 -08:00
trop[bot]
f809e74905 build: fix installing of code-signing identity on macOS (#27292)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-01-13 13:45:55 -08:00
trop[bot]
f6eb88ac08 test: disable flaky reporting API test (#27271)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-01-12 10:17:33 +09:00
Electron Bot
56e926ce23 Bump v11.2.0 2021-01-11 14:54:54 -08:00
Shelley Vohr
5e0e91510a Revert "Bump v11.1.2"
This reverts commit 9bfd5d4a4b.
2021-01-11 14:27:05 -08:00
Electron Bot
9bfd5d4a4b Bump v11.1.2 2021-01-11 09:32:26 -08:00
trop[bot]
8afd7877f6 test: skip PictureInPicture video when media not supported (#27235)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-01-07 21:38:48 -08:00
trop[bot]
bf0b82dc8e test: skip media-started-playing media-paused events test when media not supported (#27237)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-01-07 21:38:05 -08:00
Shelley Vohr
122d8910d5 refactor: remove path from nativeImage converter (#27217) 2021-01-07 13:14:29 -08:00
trop[bot]
cb281b7954 test: skip protocol.registerSchemesAsPrivileged stream test when media not supported (#27229)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-01-07 13:04:24 -08:00
Electron Bot
91cfa96c80 chore: bump chromium in DEPS to 87.0.4280.141 (#27213) 2021-01-07 11:48:53 -08:00
trop[bot]
a21ed83751 feat: make win.setAspectRatio() work on Windows (#27203) 2021-01-07 11:46:04 -08:00
Shelley Vohr
c0b48658d8 fix: handle BrowserView reparenting (#27219) 2021-01-07 11:43:46 -08:00
trop[bot]
c68f0f04d0 docs: document frameId meaning (#27189)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-01-05 17:19:19 +09:00
Eryk Rakowski
a2b61f9b97 feat: add support for webContents option in BrowserView (#26802) (#27095)
* feat: add support for webContents option in BrowserView

* tests: add tests
2021-01-05 17:17:50 +09:00
trop[bot]
fc478f4e96 fix: default offset when no drag regions (#27183)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-01-05 12:13:54 +09:00
trop[bot]
b710412e7b fix: unclickable regions in some draggable BrowserViews (#27178)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-01-05 11:44:12 +09:00
Eryk Rakowski
9a7bda51a3 fix(extensions): implement missing web_request hooks (#22655) (#27096)
Co-authored-by: Jeremy Apthorp <nornagon@nornagon.net>
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>

Co-authored-by: Jeremy Apthorp <nornagon@nornagon.net>
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-01-05 11:27:48 +09:00
trop[bot]
615e467a15 fix: make webContents.id work even after destroy (#27069)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-01-05 11:13:21 +09:00
trop[bot]
f8a900fdde docs: update broken Chrome webview URL (#27180)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-01-04 14:05:26 -08:00
trop[bot]
c188ed065d fix: sync devtools frontend mime types with upstream (#27102)
* fix: sync devtools frontend mime types with upstream

* fix header

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2020-12-22 14:13:17 -08:00
Electron Bot
dcd216984f Bump v11.1.1 2020-12-21 09:33:17 -08:00
Shelley Vohr
e012f61aee refactor: remove last use of InternalCallbackScope (#27050)
* refactor: remove last use of InternalCallbackScope

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2020-12-17 13:06:33 -06:00
Erick Zhao
50e3a2ae20 docs: update OSR max FPS number (#26805) (#27059) 2020-12-17 20:30:31 +09:00
trop[bot]
b4413e9398 fix: memory leak in desktopCapturer.getSources (#27056)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2020-12-16 20:47:57 -08:00
trop[bot]
25df0f5d31 fix: throw when using globalShortcut before ready (#27021)
* fix: throw when using globalShortcut before ready

* fix

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2020-12-17 10:07:10 +09:00
trop[bot]
6b91371b6e fix: make protocol wrapper remote-friendly again (#27044)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-12-16 12:10:07 -08:00
trop[bot]
8e6d332e96 fix: crash on exit in Event destructor (#27035)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2020-12-16 17:29:57 +09:00
trop[bot]
eebd7cfa05 refactor: use public node::CallbackScope where possible (#27027)
* refactor: use public node::CallbackScope where possible

* Remove unused node_env() getter

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-12-16 08:39:49 +09:00
Shelley Vohr
a4d73be9c5 fix: stack traces in non-Node.js contexts (#26997)
* fix: stack traces in non-Node.js contexts

* update patches

Co-authored-by: Electron Bot <electron@github.com>
2020-12-16 08:38:39 +09:00
trop[bot]
0e9214a82b fix(asar): readdir(withFileTypes) fails on deep directory when using readdirSync on a deep directory within the archive, the code fails to get the stats of child paths. (#27010)
Co-authored-by: Avi Vahl <avi.vahl@wix.com>
2020-12-15 09:18:00 -08:00
trop[bot]
24c7365bef fix: add SafeForTerminationScopes for SIGINT interruptions (#26972)
* fix: add SafeForTerminationScopes for SIGINT interruptions

* update patches

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Electron Bot <electron@github.com>
2020-12-14 16:43:56 -08:00
trop[bot]
686aefb2cd ci: ignore failures on Ninja summary (#26996)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2020-12-14 13:44:49 -05:00
Shelley Vohr
0e0a1421fd fix: screen EventEmitter methods with remote (#26989) 2020-12-14 10:39:43 -08:00
trop[bot]
c4e8c0fd0e fix: properly emit after hooks after exception (#26991)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-12-14 10:24:25 -08:00
Electron Bot
101a2282ab Bump v11.1.0 2020-12-11 13:03:56 -08:00
Jeremy Rose
429400040e fix: restrict sendToFrame to same-process frames by default (#26875) (#26926) 2020-12-11 13:01:31 -08:00
trop[bot]
ca7528a2d0 fix: Upload all *.dll.pdb to symbol server (#26965)
Fixes #26961.

Notes: Add Electron DLLs like libGLESv2.dll to symbol server

Co-authored-by: Biru Mohanathas <birunthan@mohanathas.com>
2020-12-11 12:53:27 -08:00
trop[bot]
d58812b517 fix: Avoid crashing in NativeViewHost::SetParentAccessible on Windows 10 (#26951)
* fix: Avoid crashing in NativeViewHost::SetParentAccessible on Windows

This fixes #26905. The patch was obtained from @deepak1556, who in turn
got it from the Microsoft Teams folks.

I believe the crash started happening due to the changes in
5c6c8e994b%5E!/#F15

This affects Electron 9 and later.

Notes: Fix occasional crash on Windows

* update patches

Co-authored-by: Biru Mohanathas <birunthan@mohanathas.com>
Co-authored-by: Electron Bot <electron@github.com>
2020-12-11 12:51:23 -08:00
trop[bot]
5942c84288 docs: add missing deprecated systemPreferences APIs to breaking-changes (#26936)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-12-11 10:59:00 -08:00
trop[bot]
f920463b47 fix: message box missing an "OK" button in GTK (#26916)
Co-authored-by: Mimi <1119186082@qq.com>
2020-12-10 13:06:03 -08:00
Electron Bot
296cba563e Bump v11.0.5 2020-12-10 09:47:04 -08:00
trop[bot]
90a96c0b73 fix: systemPreferences.effectiveAppearance returning systemPreferences.getAppLevelAppearance() (#26878)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-12-09 14:58:44 +09:00
Milan Burda
2c325cd654 fix: send IPC_MESSAGES.RENDERER_RELEASE_CALLBACK as internal message (#26808) (#26836) 2020-12-08 13:29:50 +09:00
Electron Bot
c26b78bbc0 chore: bump chromium to 87.0.4280.88 (11-x-y) (#26817)
* chore: bump chromium in DEPS to 87.0.4280.88

* update patches

Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
2020-12-07 16:46:44 -08:00
Alexey Kuzmin
6951c09b61 fix: add a "set" trap to the "screen" module proxy (#26873) 2020-12-07 16:46:05 -08:00
trop[bot]
fe21892974 fix: handle security warnings promise when JS is disabled (#26870)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-12-07 13:03:40 -08:00
Electron Bot
0fd6a8ca83 Bump v11.0.4 2020-12-07 10:06:44 -08:00
Erick Zhao
de12232df5 docs: added fiddle support for code samples (#26766)
Co-authored-by: Antonio <bandantonio@users.noreply.github.com>
2020-12-03 15:54:49 +09:00
trop[bot]
d12674f9f1 docs: fix contentTracing code sample (#26777)
According to the API docs, the property is called included_categories, not include_categories.

Co-authored-by: Jim Fisher <jameshfisher@gmail.com>
2020-12-02 14:29:00 -05:00
Samuel Attard
75cdd02697 build: use all-for-one goma (#26699) (#26770)
* Revert "Revert "build: use one-for-all goma (#26679)" (#26689)"

This reverts commit 38ab829ea6.

* build: ensure file descriptor limit is higher on macOS
2020-12-02 11:18:56 -05:00
trop[bot]
08b7f5a569 fix: draggable views on BrowserViews on Windows (#26774) 2020-12-01 21:35:53 -08:00
trop[bot]
a5077e2586 docs: BrowserWindow extension APIs are deprecated in Electron 9 (#26782)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-12-01 21:31:57 -08:00
trop[bot]
4fa9122151 fix: add check in IsMaximized for non-WS_THICKFRAME windows (#26780)
Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
2020-12-01 21:30:59 -08:00
Vadim
56fa037a46 fix: internalModuleReadJSON for unpacked JSON (#26751) 2020-12-01 18:24:22 -06:00
trop[bot]
13a9e15a27 fix: Add default Bluetooth permission strings (#26768) 2020-12-01 15:02:25 -08:00
trop[bot]
badc01c2d8 fix: draggable regions calculation in BrowserWindow/BrowserView (#26754) 2020-12-01 11:29:55 -08:00
Electron Bot
b0862a6e63 Bump v11.0.3 2020-11-23 17:01:12 -08:00
trop[bot]
18cde2ef04 fix: make screen wrapper remote-friendly again (#26660)
This restores accessibility of screen methods via remote.screen.

Fixes #26610.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Co-authored-by: Anders Kaseorg <andersk@mit.edu>
2020-11-23 18:27:16 -05:00
Jeremy Rose
e6c94854a0 chore: cherry-pick 47e21abe349a from chromium (#26654)
* chore: cherry-pick 47e21abe349a from chromium

* resolve conflicts
2020-11-23 17:23:57 -05:00
trop[bot]
94d8b7d4c1 fix: reject contentTracing.stopRecording on failure (#26655)
* fix: reject contentTracing.stopRecording on failure

* hacks to account for std::moved promise

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2020-11-23 15:36:17 -05:00
John Kleinschmidt
c0769d77e5 build: remove no longer needed arm64 macos patches (#26650) 2020-11-23 12:13:25 -08:00
Jeremy Rose
2a6c3bb7d1 fix: segfault on webContents.fromId(xxx) (#26652) 2020-11-23 11:41:09 -08:00
Milan Burda
d892fde98b fix: <webview> render-process-gone event dispatch (#26578)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2020-11-19 10:29:58 -08:00
Electron Bot
edb6723157 Bump v11.0.2 2020-11-19 10:19:12 -08:00
Samuel Attard
9dda9a894a Revert "Bump v11.0.2"
This reverts commit 4dc98f1347.
2020-11-19 10:17:40 -08:00
Electron Bot
90ab868b50 chore: bump chromium to 87.0.4280.67 (11-x-y) (#26565)
* chore: bump chromium in DEPS to 87.0.4280.66

* chore: bump chromium in DEPS to 87.0.4280.67
2020-11-19 11:25:16 -05:00
Electron Bot
4dc98f1347 Bump v11.0.2 2020-11-18 13:06:12 -08:00
trop[bot]
2189ddb14e fix: LC_ALL env should not be changed (#26551)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-11-18 11:44:04 -08:00
trop[bot]
680569e404 test: support for adding extra module paths (#26543)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2020-11-18 11:43:53 -08:00
trop[bot]
e119699ae2 revert: disable rosetta as Electron does not run under rosetta
This reverts commit 4829b0f816.

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-11-18 11:18:49 -08:00
trop[bot]
63e6f08768 fix: use public APIs in place of private CTFontDescriptorIsSystemUIFont in ui/gfx (#26574)
* fix: use public APIs in place of private CTFontDescriptorIsSystemUIFont in ui/gfx

* Update .patches

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2020-11-18 11:18:05 -08:00
trop[bot]
b14c57e30c fix: getLoginItemSettings() on windows (#26538)
* find by exe, detect taskmgr enable/disable

* tests

* revert

* oops

Co-authored-by: Jan Hannemann <jan.hannemann@outlook.com>
2020-11-18 11:15:24 +09:00
Electron Bot
8a68a304e0 chore: bump chromium to 87.0.4280.63 (11-x-y) (#26534)
* chore: bump chromium in DEPS to 87.0.4280.63

* update patches
2020-11-17 14:29:42 -05:00
trop[bot]
60cef385d5 fix: webContents interaction with draggable browserviews (#26528)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-11-17 10:16:53 -05:00
Electron Bot
4f281e3d31 Bump v11.0.1 2020-11-17 02:20:52 -08:00
trop[bot]
eb2710e483 fix: Cannot read property 'setDockSide' of undefined (#26514)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-11-16 16:05:51 -05:00
trop[bot]
7a15dca09c fix: do not use crashpad APIs in the MAS build (#26513)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-11-16 11:39:56 -08:00
Electron Bot
387a15f582 Bump v11.0.0 2020-11-16 06:29:41 -08:00
Jeremy Rose
38fab63863 chore: cherry-pick 275865e8c237 from chromium (#26470)
* chore: cherry-pick 275865e8c237 from chromium

* resolve conflict

* update patches

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Electron Bot <electron@github.com>
2020-11-16 09:27:25 -05:00
Milan Burda
1b156c53fd fix: ensure that internal messages are sent from the main process (#26440) 2020-11-16 15:30:47 +09:00
Electron Bot
e4f3f9e1db chore: bump chromium to 87.0.4280.60 (11-x-y) (#26483) 2020-11-13 15:36:26 -08:00
Jeremy Rose
612acc04b0 fix: cherry-pick 8f5a08079948 from chromium (#26469) 2020-11-13 15:14:18 -08:00
Electron Bot
717271095e Bump v11.0.0-beta.23 2020-11-13 13:53:04 -08:00
trop[bot]
76e54ae0c8 feat: add app.runningUnderRosettaTranslation to detect running under rosetta (#26492)
* feat: add app.isRunningUnderRosettaTranslation to detect running under rosetta

* chore: fixup

* chore: make const

* chore: add missing import

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-11-13 13:51:05 -08:00
Electron Bot
0c21ce02c1 Bump v11.0.0-beta.22 2020-11-12 07:01:59 -08:00
trop[bot]
01fa45fc50 feat: add 'resized' event to BrowserWindow (#26454)
Also adds 'moved' event to BrowserWindow on Windows.

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2020-11-12 09:47:01 -05:00
trop[bot]
832ce14bda build: fix usage of octokit/rest and make uploading better (#26389)
* build: fix usage of octokit/rest and make uploading better

* Pull in change from #26414

* Update with changes from #26425

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2020-11-11 14:30:58 -05:00
trop[bot]
07318e5146 fix: renderer crash on setImmediate (#26424)
* fix: renderer crash on setImmediate

* spec: add a crash case

* fix: ensure env exists

* Update spec-main/fixtures/crash-cases/setimmediate-renderer-crash/index.js

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2020-11-11 10:23:30 -05:00
trop[bot]
79dff5f782 chore(extensions): remove old renderer code (#26441)
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2020-11-11 10:15:27 -05:00
Samuel Attard
9c9e40294e build: auto-push patch file changes (#26235) (#26431)
* build: auto-push patch file changes

* chore: change patch for testing purposes

* build: remove stray log

* build: push as electron bot

* build: suppress all output of the push-patch script

* chore: fix linting
2020-11-10 13:47:51 -08:00
trop[bot]
5b617a7f39 chore: synchronously destroy WebContents on event prevented (#26418)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2020-11-10 11:27:32 -05:00
trop[bot]
ff717d4a93 chore: cleanup inline HTML in docs (#26392)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2020-11-10 10:49:47 -05:00
trop[bot]
51bced4ee3 fix: make draggable regions work when devtools is opened on macOS (#26395)
* fix: make draggable region work when devtools is open

* fix: update draggable regions when resizing

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-11-10 10:46:40 -05:00
Shelley Vohr
b0fd7cf430 fix: honor pageRanges when printing (#25600)
* fix: honor pageRanges when printing

* Update docs/api/web-contents.md

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

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2020-11-10 10:06:57 -05:00
Electron Bot
a56c1d3f2f Bump v11.0.0-beta.21 2020-11-09 07:02:10 -08:00
John Kleinschmidt
98b6403e3b feat: correctly identify permissions when using setPermissionRequestHandler (#26172) (#26353)
(cherry picked from commit 7f9b21daa0)
2020-11-09 09:58:35 -05:00
trop[bot]
e9c12688e6 refactor: store <webview> attributes as typed Map (#26330)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-11-05 15:29:06 -05:00
Electron Bot
8d88d1e2ed chore: bump chromium to 87.0.4280.47 (11-x-y) (#26351)
* chore: bump chromium in DEPS to 87.0.4280.47

* update patches

* Make sure angle has full git info

Co-authored-by: Electron Bot <anonymous@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
2020-11-05 15:11:11 -05:00
Electron Bot
2e730fe48b Bump v11.0.0-beta.20 2020-11-05 07:01:36 -08:00
Electron Bot
88de23b241 chore: bump chromium to 87.0.4280.40 (11-x-y) (#26280)
* chore: bump chromium in DEPS to 87.0.4280.40

* update patches

Co-authored-by: Electron Bot <anonymous@electronjs.org>
2020-11-04 15:35:28 -05:00
trop[bot]
3faa2c2a46 fix: window.open not accepting size values with "px" at the end (#26334)
* fix: use parseInt to parse sizes

* fix: pass radix to parseInt

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>

Co-authored-by: Abhishek Shingane <abhisheks@iitbhilai.ac.in>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-11-04 10:59:49 -08:00
trop[bot]
cab14277b8 fix: draggable region edge calculation on resize (#26320)
* fix: draggable region edge calculation on resize

* Feedback from review

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-11-04 11:17:14 +09:00
Electron Bot
ce243f8172 Bump v11.0.0-beta.19 2020-11-02 07:01:23 -08:00
Shelley Vohr
da4790d944 build: only check patch diffs in testing builds (#26283)
* build: only check patch diffs in testing builds

* Fixup patch indices
2020-11-02 18:56:13 +09:00
Charles Kerr
4088566a4d fix: nativeTheme.themeSource = 'dark' on windows (#26238)
Manually backports #25373.
2020-11-02 16:20:57 +09:00
Shelley Vohr
ac425c0cf3 fix: draggable regions exclusively on BrowserViews (#26259) 2020-11-02 16:07:04 +09:00
trop[bot]
ccb471e5d5 chore: change some for loops to range-based (#26263)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2020-10-30 09:58:39 -07:00
Robo
f44880f065 fix: Initialize logging for crashpad (#26250)
* fix: Initialize logging for crashpad

* chore: update mini_chromium

* conditionally access CommandLine because crashpad doesn't initialize one.

https://chromium-review.googlesource.com/c/chromium/src/+/2490880
2020-10-29 16:23:51 -07:00
trop[bot]
7ec001486e fix: hover text only working when VO enabled (#26246)
* fix: hover text only working when VO enabled

* chore: simplify conditional

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-10-29 08:51:45 -07:00
David Sanders
dd3fbae447 chore: use auto to avoid repeating type (#26254) 2020-10-29 08:50:27 -07:00
Electron Bot
e9710f6a77 Bump v11.0.0-beta.18 2020-10-29 08:01:25 -07:00
trop[bot]
699a771288 fix: transparently package bundles as zip archives (#26217)
* refactor: move FileSelectHelper to own file

* fix: zip packages on macOS

* Thread safety, it's good actually

* misc cleanup

* Remove some unused includes

* Better ref management

* Use upstream file_select_helper_mac

* Small fixes

* Put back file_select_helper_mac

* observe RenderWidgetHost

* fix ref-counting and add some guards

* Address review

* Remove refcounting for FileSelectHelper

* Remove unnecessary GetWeakPtr

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2020-10-29 10:01:32 -04:00
trop[bot]
f679dd8ad7 fix: build with printing disabled (#26249)
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2020-10-29 02:18:26 -07:00
trop[bot]
9f1b913793 fix: set app locale after user's script is loaded (#26226)
* fix: set app locale after user's script is loaded

* fix: set LC_ALL env on Linux

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-10-28 15:20:10 -04:00
Charles Kerr
9328725e93 perf: improve heap snapshot performance (#26230)
Fixes #24509.

cherry-pick 2e2dc98 from v8
2020-10-28 12:07:48 -07:00
trop[bot]
cea757f59c fix: delay emitting powerMonitor events on windows (#26181)
* fix: delay emitting powerMonitor events

* Update electron_api_power_monitor_win.cc

* Update electron_api_power_monitor_win.cc

* syntax

* Update electron_api_power_monitor_win.cc

* Update electron_api_power_monitor_win.cc

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2020-10-28 12:39:49 -05:00
trop[bot]
d93cb942fc build: rename the v8 context snapshot on arm64 macOS builds (#26202)
* chore: rename the v8 context snapshot on arm64 macOS builds

* build: update zip manifests

* build: update to upstream patch

* chore: update patches

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-10-27 20:11:24 -04:00
trop[bot]
4d280ed483 docs: fix app 'ready' event arguments (#26174)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-10-26 20:38:42 -07:00
David Sanders
bb69770267 chore: bump @electron/docs-parser version (#26155) 2020-10-26 11:50:00 -07:00
David Sanders
d4112d38de chore: prefer empty() check for readability (#26157) 2020-10-26 11:48:12 -07:00
Electron Bot
b1eec448f0 Bump v11.0.0-beta.17 2020-10-26 08:01:55 -07:00
trop[bot]
becfe25528 fix: wasm code generation in the renderer (#25829)
* fix: wasm code generation in the renderer

* Fixup patches

* update patches

* update patches

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Electron Bot <anonymous@electronjs.org>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-10-26 18:19:09 +09:00
Shelley Vohr
a461001677 fix: crash in printing on Windows (#26062)
* fix: crash in printing on Windows

* update patches

Co-authored-by: Electron Bot <anonymous@electronjs.org>
2020-10-26 12:11:36 +09:00
Electron Bot
aa15eeed78 Bump v11.0.0-beta.16 2020-10-23 13:10:26 -07:00
Samuel Attard
6daac26f49 Revert "Bump v11.0.0-beta.16"
This reverts commit 2b1004919d.
2020-10-23 13:09:17 -07:00
trop[bot]
3551c81cc5 fix: setSimpleFullScreen shows traffic light in frameless window (#26127)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-10-23 11:06:24 -07:00
Electron Bot
2b1004919d Bump v11.0.0-beta.16 2020-10-23 10:20:48 -07:00
Samuel Attard
d200b9192a revert: "fix: reply notifs sometimes destroyed too early" (#25247) (#26131)
* Revert "fix: reply notifs sometimes destroyed too early (#25086)"

This reverts commit bea6c9e4e1.

* nothing
2020-10-23 10:18:42 -07:00
Samuel Attard
c2e8704683 fix: re-enable the spellchecker when new language list set (#26119) (#26129)
* fix: re-enable the spellchecker when new language list set

Chromium recently added prefs logic to disable the spellchecker if the list of languages is empty, but the logic to re-enable if the languages are provided again lives in another part of Chromium.  This change makes it so our API re-enables the spellchecker correctly when required.

* chore: fix lint
2020-10-23 10:18:30 -07:00
Electron Bot
0b2862b184 chore: bump chromium to 87.0.4280.27 (11-x-y) (#25993)
* chore: bump chromium in DEPS to 87.0.4280.20

* update patches

* test: disable flaky arm tests (#26046)

* tests: disable flaking test on all arm platforms

* tests: disable flaky did-change-theme-color tests on WOA

(cherry picked from commit 4ce7ca6cfb)

* 2478082: Make window cloaking and uncloaking trigger occlusion calculation

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

Fixes visibility issues.

* Revert "2478082: Make window cloaking and uncloaking trigger occlusion calculation"

This reverts commit 5ff8cc8c83.

* ci: disable CalculateNativeWinOcclusion for woa (#26001)

(cherry picked from commit 708cf44d19)

* Update appveyor.yml

disable CalculateNativeWinOcclusion due to visibility issues

* chore: bump chromium in DEPS to 87.0.4280.27

* update patches

Co-authored-by: Electron Bot <anonymous@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: Robo <hop2deep@gmail.com>
2020-10-22 17:01:59 -04:00
trop[bot]
d959222bb8 fix: return early on promise rejection (#26111)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2020-10-22 13:32:06 -07:00
Jeremy Rose
e5550e5bad chore: backport fix for ARIA TreeGrid rows not being announced by VoiceOver (#26036)
* chore: cherry-pick 2f5b8357dca2 from chromium

* update patches
2020-10-22 12:57:31 -07:00
trop[bot]
8546f98a87 fix: release NSAlert properly (#26099)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-10-22 08:09:21 -07:00
Electron Bot
7a6965087c Bump v11.0.0-beta.15 2020-10-22 08:02:26 -07:00
trop[bot]
2558455be4 fix: crash when printing (#26047)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-10-20 09:08:14 -07:00
trop[bot]
65fdfc1e16 perf: remove GC timer that fired once per minute. (#26051)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2020-10-20 14:35:51 +09:00
trop[bot]
139e20367f fix: update squirrel.mac to handle bug in Big Sur (#25906)
Fixes #25626

This is not the greatest workaround but at least it works.

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-10-20 10:50:22 +09:00
trop[bot]
e84aa04bb5 fix: Save As PDF from PDF Preview (#26012)
* fix: Save As PDF from PDF Preview

* Address review feedback

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-10-20 10:45:34 +09:00
David Sanders
7a06ae575e chore: bump @electron/docs-parser to get fix (#25974) 2020-10-20 10:34:33 +09:00
trop[bot]
460594480f build: fix invocation of cpplint on Windows (#26041)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2020-10-19 19:17:57 -05:00
trop[bot]
6e676c3695 chore: tweak branch detection in release notes. (#26037)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2020-10-19 15:36:12 -07:00
Michaela Laurencin
e6fa69bfd2 fix: correct null pointer checks in autoresizing browser views (#25956)
Co-authored-by: mlaurencin <mlaurencin@microsoft.com>
2020-10-19 09:26:13 -07:00
Electron Bot
df3fa7ddb7 Bump v11.0.0-beta.14 2020-10-19 08:01:43 -07:00
Robo
c090fbfd11 chore: fix visibility tests on windows (#25991)
* disable CalculateNativeWinOcclusion on win ci

* Update appveyor.yml

* disable CalculateNativeWinOcclusion for woa

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2020-10-16 11:13:31 -07:00
trop[bot]
6d99158379 fix: maximized frameless window bleeding to other monitors (#25978)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-10-15 20:05:03 -07:00
Electron Bot
bb11bdce36 Bump v11.0.0-beta.13 2020-10-15 08:02:38 -07:00
trop[bot]
ca163f9cf7 docs: move breaking-changes-ns.md contents to breaking-changes.md (#25947)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-10-15 10:51:21 +09:00
trop[bot]
5598025884 fix: pass module resolution paths to wrapped function (#25945)
Co-authored-by: Matt Kane <matt@gatsbyjs.com>
2020-10-15 10:49:07 +09:00
trop[bot]
df82bbab43 feat: add support for preventing the system context menu (#25835)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2020-10-14 18:37:41 -07:00
Michaela Laurencin
ed5fd9c910 fix: notifications successfully never timeout with included flag (#25902)
* Backport changes for notification timeout neber to version 11

* fix: notifications successfully never timeout with included flag

* Add back SetXmlAudioSilent

Co-authored-by: mlaurencin <mlaurencin@microsoft.com>
2020-10-13 18:22:33 -07:00
Shelley Vohr
0ac14ce30c fix: uv loop polling when render process reuse enabled (#25922) 2020-10-14 10:18:42 +09:00
trop[bot]
3793cfc0ff fix: NativeImage.getScaleFactors returns correct scales (#25903) 2020-10-13 15:24:11 -07:00
Electron Bot
1c8377967d Bump v11.0.0-beta.12 2020-10-13 13:39:53 -07:00
John Kleinschmidt
485612ae68 build: fix 11-x-y compiler errors (#25927)
* Add whole src\third_party\angle\.git directory

This directory is needed in order to properly generate gen/angle/angle_commit.h

* fix: correct calling convention for Windows on Arm

https://chromium-review.googlesource.com/c/v8/v8/+/2440717
(cherry picked from commit 0041f5aaa6)

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-10-13 16:37:27 -04:00
John Kleinschmidt
4016def2d0 Revert "Bump v11.0.0-beta.12"
This reverts commit 7a669cbbb0.
2020-10-13 16:36:33 -04:00
John Kleinschmidt
c35a67f31e Revert "Bump v11.0.0-beta.13"
This reverts commit fd5896919b.
2020-10-13 16:36:22 -04:00
Electron Bot
fd5896919b Bump v11.0.0-beta.13 2020-10-12 08:02:17 -07:00
Electron Bot
7a669cbbb0 Bump v11.0.0-beta.12 2020-10-09 14:21:33 -07:00
Electron Bot
8acf548c62 Revert "Bump v11.0.0-beta.12"
This reverts commit dc9282d6ff.
2020-10-09 14:15:32 -07:00
Electron Bot
dc9282d6ff Bump v11.0.0-beta.12 2020-10-09 12:12:22 -07:00
Electron Bot
a4cb3e2af9 chore: bump chromium to 87.0.4280.11 (11-x-y) (#25802)
* chore: bump chromium in DEPS to 87.0.4280.6

* chore: bump chromium in DEPS to 87.0.4280.11

* chore: update patches

* Add deprecated_default_sources_assignment_filter variable

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

* 2426564: Remove global sources assignment filter value

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

* Remove set_sources_filter import

* chore: fixup printing patch

* Add DragOperation and AllowedDragOperations Mojo types

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

* Add DragOperation and AllowedDragOperations Mojo types

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

* Remove several references to BrowserPlugin from content

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

* Remove SurfaceEmbeddingTime and LocalSurfaceIdAllocation

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

* Remove several references to BrowserPlugin from content

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

* Service Manager embedders switches have been removed or moved

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

* Remove SurfaceEmbeddingTime and LocalSurfaceIdAllocation

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

* [XProto] Remove usage of Xlib Visuals

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

* Implement tabs.removeCSS in electrons TabsExecuteScriptFunction

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

* Remove lossy ConvertSizeToPixel() methods

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

* Remove all keyboard related usage of Xlib

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

* fix: use parent namespace for zygote switches

* ConvertRectToPixel methods have been removed

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

* impl SortingLSH service

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

* chore: update patches

* chore: fix servicemanager removed namespace

* chore: revert removed methods

* chore: update patches

* ExtensionURLLoaderFactory is now owned by its receivers

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

* chore: fix linting

* Skip Angle manifest file

https://chromium-review.googlesource.com/c/angle/angle/+/2425197

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2020-10-09 12:06:07 -07:00
trop[bot]
1eea063c3a fix: suppress worldSafe warning emitted from security checks (#25828)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2020-10-08 20:12:33 -07:00
trop[bot]
583e2b76d9 ci: fixup doc only check on Windows (#25838)
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
2020-10-08 21:38:27 -04:00
trop[bot]
ca215070e9 test: improve app 'session-created' event spec (#25803)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-10-08 09:39:05 -07:00
trop[bot]
9852e1f190 fix: window.open doesn't work correctly in child window (#25816)
If speculative render view host is deleted during naviagation to
page we try to open with call to window.open window is destroyed
right after it is created. It may happen when naviagation triggers
redirect from http to https. To void that we should emit event
current-render-view-deleted only when render view host which was
destroyed is the current webcontent's rvh.

Co-authored-by: Cezary Kulakowski <cezary@openfin.co>
2020-10-08 09:38:42 -07:00
trop[bot]
9ce7d133d8 chore: use noop ShouldAbortOnUncaughtException cb (#25792)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-10-06 14:30:20 -07:00
Electron Bot
c157521bd0 chore: bump chromium to 87.0.4276.0 (11-x-y) (#25488)
* chore: bump chromium in DEPS to 87.0.4265.1

* chore: bump chromium in DEPS to 87.0.4266.2

* chore: bump chromium in DEPS to 87.0.4267.1

* update patches

* chore: bump chromium in DEPS to 87.0.4270.0

* Update patches

* Move content::WebPreferences struct to Blink

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

* viz: Rename RenderPass to CompositorRenderPass (and related types).

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

* 2320268: Migrate DragHostMsg_StartDragging to Mojo

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2320268
(cherry picked from commit 4e835d505d)

* Make FileURLLoaderFactory always owned by its |receivers_|.

https://chromium-review.googlesource.com/c/chromium/src/+/2337411
(cherry picked from commit 284abad17d)

* fix: add a patch to remove deprecated factory

(cherry picked from commit 98c9616829)
Co-Authored-By: Robo <hop2deep@gmail.com>

* fixup patch

(cherry picked from commit 98c9616829)
Co-Authored-By: Robo <hop2deep@gmail.com>

* Add MIME sniffer overloads that take base::StringPieces

https://chromium-review.googlesource.com/c/chromium/src/+/2382896
(cherry picked from commit 211fd4f8f0)

* chore: implement GetSurveyAPIKey

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2362182
(cherry picked from commit 6c539bc6fc)

* 2415752: Reland "Reland "OOR-CORS: Remove BlinkCORS supporting code outside Blink""

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

* Make FileURLLoaderFactory always owned by its |receivers_|.

https://chromium-review.googlesource.com/c/chromium/src/+/2337411
(cherry picked from commit 507eb0965f)

* fixup! Make FileURLLoaderFactory always owned by its |receivers_|.

(cherry picked from commit e19400b4e2)

* 2418471: PDF Viewer update: Add missing aria-labels to various buttons.

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

* chore: bump chromium in DEPS to 87.0.4271.0

* Refactor WebContentSettingsClient to dedupe AllowXYZ methods

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

* 2402123: Use end date when deleting http auth cache

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

* [printing] Move PrintHostMsg_PreviewIds to print.mojom

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

* update patches

* 2401303: Move content/browser/frame_host/* over to content/browser/renderer_host/

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

* Introduce NonNetworkURLLoaderFactoryBase class.

https://chromium-review.googlesource.com/c/chromium/src/+/2357559
(cherry picked from commit 33e2e12114)

* fix: add a patch to remove deprecated factory

(cherry picked from commit 98c9616829)

* chore: non_network_url_loader_factory_base was moved

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

* chore: replace CreateWebUIURLLoader with CreateWebUIURLLoaderFactory

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2358309
(cherry picked from commit 40bfaa5ea4)

* 2346803: Study whether blocking of requests via webRequest is fingerprintable

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

* lint cleanup

* chore: bump chromium in DEPS to 87.0.4272.0

* update patches

* 2387901: Accessing C++ enums in Java for WebBluetooth

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

* chore: bump chromium in DEPS to 87.0.4273.0

* Update patches

(cherry picked from commit b389d4adca71e268c390c41370e87033b69c649c)

* chore: bump chromium in DEPS to 87.0.4274.0

* chore: bump chromium in DEPS to 87.0.4275.0

* chore: bump chromium in DEPS to 87.0.4276.0

* update patches

* 2418443: Explicit use of deprecated global sources assignment filter

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

* fixup 2418443: Explicit use of deprecated global sources assignment filter

* Use 87.0.4274.2 for now

* 2401847: Cache Storage Permissions on ContentSettingsClientImpl

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

* 2418568: Remove ConvertPointToPixel() methods.

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

* 2419388: Rename Button methods to be suitable for builders and properties.

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

* [XProto] Remove usage of all Xlib headers

https: //chromium-review.googlesource.com/c/chromium/src/+/2392140
Co-Authored-By: Robo <hop2deep@gmail.com>

* service_manager::kCrashDumpSignal -> kCrashDumpSignal

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2417073
(cherry picked from commit 7d9d2a172f50e12830a2b8fbfbb2fe344756c377)

* gfx::ConvertPointToPixel -> gfx::ConvertPointToPixels

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

* Fixup [XProto] Remove usage of all Xlib headers

* Set appid on Pip windows.

https: //chromium-review.googlesource.com/c/chromium/src/+/2388274
Co-Authored-By: Robo <hop2deep@gmail.com>

* chore: update node patches for common.gypi

Co-Authored-By: Samuel Attard <MarshallOfSound@users.noreply.github.com>

* Try using lower number of processes for linux

* fixup call to diagnose_goma_log.py

* Use larger machines on linux to work around goma issue

* Don't fail on goma stats

* don't exit immediately

* turn off pipefail

* always return true

Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Andy Locascio <andy@slack-corp.com>
Co-authored-by: Samuel Attard <MarshallOfSound@users.noreply.github.com>
2020-10-06 15:43:56 -04:00
trop[bot]
309df5a99d fix: nativeImage.crop().toBitmap() returning garbage (#25774)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2020-10-06 09:40:56 +09:00
trop[bot]
f298d4d54f feat: add webContents.forcefullyCrashRenderer() to forcefully terminate a renderer process (#25756)
* feat: add webContents.crashProcess() to forcefully terminate a renderer process

* chore: fix up docs and tests

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-10-05 13:00:36 -07:00
Electron Bot
ca227ede76 Bump v11.0.0-beta.11 2020-10-05 08:01:36 -07:00
trop[bot]
7120698f1f docs: rename launch-failure -> launch-failed to match C++ code (#25730)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-10-02 13:58:27 -07:00
trop[bot]
5eb225b5ae fix: crash when application launched from UNUserNotificationCenter notification (#25738)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-10-02 13:58:01 -07:00
trop[bot]
71c26dab90 build: move to ACR for docker image storage (#25731)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-10-02 13:28:35 -07:00
Shelley Vohr
f8ee8b2ee2 chore: fix nmv for Electron v11 (#25748) 2020-10-02 12:50:33 -07:00
Robert Borg
639fb15dc4 fix: gdi printing in silent printing mode (#25744)
for windows print_text_with_gdi is set to the value of is_modifiable
but this code path is not taken for silent printing
2020-10-02 08:30:59 -07:00
Electron Bot
c6fa081558 Bump v11.0.0-beta.10 2020-10-01 08:01:18 -07:00
trop[bot]
dcbca5448a fix: ensure ready-to-show event is fired (#25672) 2020-09-29 16:46:11 -07:00
trop[bot]
0667110350 fix: submenu should be autoreleased (#25688)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-09-29 12:57:40 -07:00
trop[bot]
e089cab8cd docs: command line flags for GPU controls (#25686)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-09-29 13:52:09 -04:00
Electron Bot
634b76e5a2 Bump v11.0.0-beta.9 2020-09-28 08:01:11 -07:00
trop[bot]
11c20477e4 refactor: add a wrapper for wrangling uv handles. (#25661) 2020-09-27 19:12:17 -07:00
trop[bot]
fca920de40 chore: improve renderer crash logging (#25619)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-09-24 12:55:57 -07:00
Electron Bot
ce5660db36 Bump v11.0.0-beta.8 2020-09-24 08:32:12 -07:00
Shelley Vohr
f8bdaa04d8 Revert "Bump v11.0.0-beta.8"
This reverts commit 69ded48ce4.
2020-09-24 08:28:59 -07:00
Shelley Vohr
08ebf7c03b Revert "Bump v11.0.0-beta.9"
This reverts commit 8bdff7acbc.
2020-09-24 08:28:52 -07:00
Shelley Vohr
9f164607b7 Revert "Bump v11.0.0-beta.10"
This reverts commit d88ce0be9c.
2020-09-24 08:28:45 -07:00
Electron Bot
d88ce0be9c Bump v11.0.0-beta.10 2020-09-24 08:03:12 -07:00
trop[bot]
e17b770690 docs: pepper flash plugin info appears at chrome://version now (#25608)
`chrome://flash` doesn't seem to exist anymore, but similar information
appears at `chrome://version`.

Co-authored-by: Joe Duncko <JoeDuncko@users.noreply.github.com>
2020-09-23 13:51:18 -07:00
trop[bot]
ff97c5255b fix: decompress devtools discovery html (#25602)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2020-09-23 12:38:36 -07:00
trop[bot]
2ab7143b69 fix: update node certdata to NSS 3.56 (#25362)
* fix: update node certdata to NSS 3.56

* Update .patches

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2020-09-23 12:25:26 -07:00
Jeremy Rose
96f258b866 fix: check for destroyed webcontents in converter (#25598) 2020-09-23 12:23:37 -07:00
trop[bot]
e6d5fc23a7 docs: remove unused StreamProtocolResponse / StringProtocolResponse (#25583)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-09-23 12:18:01 -07:00
trop[bot]
fe1b40ce9e fix: order menu items before filtering excess separators (#25599)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-09-23 12:12:15 -07:00
trop[bot]
fb7f783ee1 fix: unsubscribe from observers when window is closing (#25585)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-09-23 10:00:22 -04:00
trop[bot]
9ff208f898 fix: NOTREACHED in content::ChildProcessHost::GetChildPath when enable_plugins=false (#25552)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-09-23 10:46:00 +09:00
trop[bot]
a8dc3ae5c2 fix: check printer list when no default printers (#25562)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-09-22 11:53:49 -07:00
trop[bot]
07ec50b547 build: use newer xCode image (#25571)
* build: use newer xCode image

* build: log changed file paths

Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-09-22 11:48:22 -05:00
Electron Bot
8bdff7acbc Bump v11.0.0-beta.9 2020-09-21 08:02:16 -07:00
trop[bot]
a66ba564fd test: retry the "v8 samples" test for a few times (#25514)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-09-21 09:36:18 +09:00
trop[bot]
0f4f5ac32c fix: prevent destroyed view references from causing crashes (#25509)
* fix: prevent destroyed view references from causing crashes

* Remove extraneous comments

* Relocate crash test to proper location

* Add WebContentsObserver

* Add nullptr check and inspectable observer

* Remote initial test file

* Add test cases to test file

* Rename and move testing file

* Fix linting errors

* Make functions exit early on check

* Fix setBackgroundColor function call in test file

* Fix styling of test file

* Fix mac name mismatch and make variable name more clear

Co-authored-by: Michaela Laurencin <mlaurencin@microsoft.com>
2020-09-21 09:33:39 +09:00
trop[bot]
4e080c4b15 fix: app.importCertificate crash on Linux (#25537)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-09-19 21:00:39 -06:00
trop[bot]
7e40dc2237 fix: close window when leave fs crash (#25524)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-09-19 15:23:49 -06:00
trop[bot]
e2b90ee28c build: fix build with enable_pdf_viewer=false (#25507)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-09-17 14:55:29 -06:00
Electron Bot
69ded48ce4 Bump v11.0.0-beta.8 2020-09-17 08:02:47 -07:00
trop[bot]
a22dfc813f fix: disable CORS when webSecurity is disabled (#25504)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-09-17 10:22:25 +09:00
trop[bot]
c1d04d8e49 chore: log hint on renderer crash (#25474)
* chore: log hint on renderer crash

* Address feedback from review

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-09-16 07:58:48 -06:00
trop[bot]
80efb6d9da fix: call node::Stop on exit (#25459)
* fix: call node::Stop on exit

* also call Stop in node_main

* oop, we were already calling set_can_call_into_js(false)??

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2020-09-16 09:25:51 +09:00
trop[bot]
51a35f8b4d fix: ensure ready-to-show event is fired (#25471)
* fix: ensure ready-to-show event is fired

* test: acutally draw something when capturePage

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-09-16 09:15:34 +09:00
John Kleinschmidt
b88396cf00 chore: bump chromium to 87.0.4251.1 (11-x-y) (#25259) 2020-09-15 09:52:14 -07:00
Jeremy Rose
35d2727de0 feat: remove getMediaSourceIdForWebContents() (#25414) (#25455)
This reverts commit 204f001c5d.
2020-09-14 13:44:54 -07:00
trop[bot]
23c32766e5 fix: Ensure electron delay loads the same modules as chromium (#25436)
* Ensure electron delay loads the appropriate modules as chromium on windows

This change adds the same module delay load list that chromium uses for electron.  Some modules were already getting delay loaded from other build files in chromium but not the main list via //build/config/win:delayloads.  We do not include the list of delay loads in delayloads_not_for_child_dll as those have issues being loaded in sandboxes processes.  This will reduce the overall reference set impact of the electron processes.

* fix: Ensure win modules are properly delayloaded

* chore: fix linting

Co-authored-by: Chris Davis <chrisdavis@outlook.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-09-14 10:20:31 -07:00
trop[bot]
db492c3178 fix: provide asynchronous cleanup hooks in n-api (#25281)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-09-14 10:24:40 -06:00
Electron Bot
86cc6a7b44 Bump v11.0.0-beta.7 2020-09-14 08:02:47 -07:00
trop[bot]
2ed7f0f4fc fix: crash on nativeImage on Windows on ARM (#25410)
* fix: nativeImage on WOA

* Remove old ldflag

* maybe this will work ¯\_(ツ)_/¯

Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
2020-09-14 10:25:11 +09:00
Electron Bot
9e9cc8f606 Bump v11.0.0-beta.6 2020-09-10 08:02:15 -07:00
trop[bot]
1e1d35fb87 fix(extensions): devtools now open for background pages (#25366)
refactor(extensions): remove unused InitWithBrowserContext method

fix(extensions): release background page WebContents to avoid crash

The background page WebContents instance is managed by the ExtensionHost.

fix(extensions): open background page devtools detached by default

test(extensions): add background page devtools test

chore: test fix for null web_contents()

fix: close background page devtools in test after opening

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2020-09-10 11:38:52 +09:00
trop[bot]
119cd24a7f fix: bind fake mojo service for badging (#25370)
* fix: bind fake mojo service for badging

* Add a test

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-09-10 09:14:53 +09:00
Eryk Rakowski
138fa6cdf3 feat(extensions): add support for some chrome.management APIs (#25098) (#25342)
* fix: initialize management policy

* fix(extensions): crash when using chrome.management

* test: add tests

* docs: add a note about chrome.management

* fix: lint errors

* fix: lint errors

* fix: remove favicon_service include

* fix: add missing management permission

* docs: more supported apis

* fix: extensions.md line endings
2020-09-08 20:11:50 +09:00
trop[bot]
7745e48498 chore: graceful handling of notes with sub-lists (#25312)
* chore: graceful handling of notes with sub-lists

Handle multine release notes that contain their own bullet points.

Also, if a release note begins with a bullet point, remove it because it
will confuse the markdown parser to have two bullet points.

* chore: make lint happy

* test: add tests for release note changes

* chore: only target current octokit

* chore: add commits to release-notes test cache

No behavior change; just includes files that ought to be cached to prevent
hitting octokit for them.

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2020-09-08 17:12:09 +09:00
trop[bot]
b62e00f0ae fix: handle electron script errors better (#25331)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-09-08 16:26:41 +09:00
Electron Bot
ad876ac1b1 Bump v11.0.0-beta.5 2020-09-07 08:01:02 -07:00
trop[bot]
c35ec6bc34 fix: only focus a webContents if the window was not initially hidden (#25323)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-09-04 14:47:08 -07:00
trop[bot]
a08b3682c3 fix: avoid creating client_id file for empty DIR_CRASH_DUMPS (#25310)
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2020-09-03 19:09:20 -07:00
trop[bot]
c3ad33c28b fix: multiple dock icons when calling dock.show/hide (#25300)
* fix: mulitple dock icons when calling dock.show/hide

* test: run dock.show tests after dock.hide tests

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-09-03 13:57:06 -07:00
Electron Bot
59f9e417d4 Bump v11.0.0-beta.4 2020-09-03 08:01:35 -07:00
trop[bot]
7931c8abfd ci: cleanup up test app directories (#25257)
* ci: cleanup up test app directories

* ci: use electron prefix for a testing apps so that the can be cleaned up

* Revert "ci: cleanup up test app directories"

This reverts commit a47daba812.

* fixup test due to app name change

Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
2020-09-02 10:05:09 +09:00
trop[bot]
622f5f84cf chore: wrap add/remove view in extra check (#25258)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-09-02 10:04:10 +09:00
trop[bot]
c8944df576 chore: force source code and markdown files to use LF line ending (#25176)
* chore: force source code and markdown files to use LF line ending

* chore: replace CRLF with LF

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-09-01 12:48:18 +09:00
Robo
3efbee2061 fix: client area inset calculation when maximized for framless windows (#25217)
* adopt per monitor scale factor

* fix: client area inset calculation when maximized

* address review feedback

* pass correct glass insets to GetDwmFrameInsetsInPixels

* remove unused code

* Windows 8 and 10 use the same DWM frame calculation

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-08-31 13:20:28 -07:00
trop[bot]
aafada554f docs: fix supported platforms of powerMonitor (#25211)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-08-31 10:16:26 -07:00
Electron Bot
56e81665fb Bump v11.0.0-beta.3 2020-08-31 08:01:05 -07:00
trop[bot]
e68f086d95 fix: do not reset process_id in URLLoaderFactoryParams (#25180)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2020-08-31 10:08:52 +09:00
trop[bot]
74edd99570 fix: save dialog extensions should be deterministic (#25193)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-08-28 11:38:07 -07:00
trop[bot]
63720fd603 fix: resolve RegisterSuspendResumeNotification dynamically (#25168)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2020-08-28 10:15:40 +09:00
Markus Olsson
d6bea2a681 fix: make shell.moveItemToTrash return false on Windows when move unsuccessful (#25171) 2020-08-27 17:43:52 -07:00
Electron Bot
5b53a08132 Bump v11.0.0-beta.2 2020-08-27 08:01:11 -07:00
Electron Bot
09e33b3420 Bump v11.0.0-beta.1 2020-08-26 10:51:08 -07:00
622 changed files with 33290 additions and 5426 deletions

View File

@@ -69,7 +69,7 @@ parameters:
# Build machines configs.
docker-image: &docker-image
docker:
- image: electronjs/build:d09fd95029bd8c1c73069888231b29688ef385ed
- image: electron.azurecr.io/build:4cec2c5ab66765caa724e37bae2bffb9b29722a5
machine-linux-medium: &machine-linux-medium
<<: *docker-image
@@ -85,17 +85,17 @@ machine-linux-2xlarge: &machine-linux-2xlarge
machine-mac: &machine-mac
macos:
xcode: "11.5.0"
xcode: "12.2.0"
machine-mac-large: &machine-mac-large
resource_class: large
macos:
xcode: "11.5.0"
xcode: "12.2.0"
machine-mac-large-arm: &machine-mac-large-arm
resource_class: large
macos:
xcode: "12.0.0-large"
xcode: "12.2.0"
# Build configurations options.
env-testing-build: &env-testing-build
@@ -107,6 +107,7 @@ env-release-build: &env-release-build
STRIP_BINARIES: true
GENERATE_SYMBOLS: true
CHECK_DIST_MANIFEST: '1'
IS_RELEASE: true
env-headless-testing: &env-headless-testing
DISPLAY: ':99.0'
@@ -256,23 +257,34 @@ step-gclient-sync: &step-gclient-sync
"$CIRCLE_REPOSITORY_URL"
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags
# Re-export all the patches to check if there were changes.
python src/electron/script/export_all_patches.py src/electron/patches/config.json
cd src/electron
git update-index --refresh || true
if ! git diff-index --quiet HEAD --; then
# There are changes to the patches. Make a git commit with the updated patches
git add patches
GIT_COMMITTER_NAME="Electron Bot" GIT_COMMITTER_EMAIL="anonymous@electronjs.org" git commit -m "update patches" --author="Electron Bot <anonymous@electronjs.org>"
# Export it
mkdir -p ../../patches
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
echo
echo "======================================================================"
echo "There were changes to the patches when applying."
echo "Check the CI artifacts for a patch you can apply to fix it."
echo "======================================================================"
exit 1
if [ "$IS_RELEASE" != "true" ]; then
# Re-export all the patches to check if there were changes.
python src/electron/script/export_all_patches.py src/electron/patches/config.json
cd src/electron
git update-index --refresh || true
if ! git diff-index --quiet HEAD --; then
# There are changes to the patches. Make a git commit with the updated patches
git add patches
GIT_COMMITTER_NAME="Electron Bot" GIT_COMMITTER_EMAIL="electron@github.com" git commit -m "update patches" --author="Electron Bot <electron@github.com>"
# Export it
mkdir -p ../../patches
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
if (node ./script/push-patch.js 2> /dev/null > /dev/null); then
echo
echo "======================================================================"
echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch"
echo "A new CI job will kick off shortly"
echo "======================================================================"
exit 1
else
echo
echo "======================================================================"
echo "There were changes to the patches when applying."
echo "Check the CI artifacts for a patch you can apply to fix it."
echo "======================================================================"
exit 1
fi
fi
fi
fi
@@ -299,10 +311,10 @@ step-setup-goma-for-build: &step-setup-goma-for-build
name: Setup Goma
command: |
echo 'export USE_GOMA=true' >> $BASH_ENV
if [ "`uname`" == "Linux" ]; then
echo 'export NUMBER_OF_NINJA_PROCESSES=300' >> $BASH_ENV
else
echo 'export NUMBER_OF_NINJA_PROCESSES=25' >> $BASH_ENV
echo 'export NUMBER_OF_NINJA_PROCESSES=300' >> $BASH_ENV
if [ "`uname`" == "Darwin" ]; then
echo 'ulimit -n 10000' >> $BASH_ENV
echo 'sudo launchctl limit maxfiles 65536 200000' >> $BASH_ENV
fi
if [ ! -z "$RAW_GOMA_AUTH" ]; then
echo $RAW_GOMA_AUTH > ~/.goma_oauth2_config
@@ -311,8 +323,8 @@ step-setup-goma-for-build: &step-setup-goma-for-build
cd build-tools
npm install
mkdir third_party
node -e "require('./src/utils/goma.js').downloadAndPrepare()"
node -e "require('./src/utils/goma.js').ensure()"
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
third_party/goma/goma_ctl.py ensure_start
echo 'export GN_GOMA_FILE='`node -e "console.log(require('./src/utils/goma.js').gnFilePath)"` >> $BASH_ENV
echo 'export LOCAL_GOMA_DIR='`node -e "console.log(require('./src/utils/goma.js').dir)"` >> $BASH_ENV
cd ..
@@ -320,15 +332,17 @@ step-setup-goma-for-build: &step-setup-goma-for-build
step-restore-brew-cache: &step-restore-brew-cache
restore_cache:
paths:
- /usr/local/Homebrew
- /usr/local/Cellar/gnu-tar
- /usr/local/bin/gtar
keys:
- v1-brew-cache-{{ arch }}
- v4-brew-cache-{{ arch }}
step-save-brew-cache: &step-save-brew-cache
save_cache:
paths:
- /usr/local/Homebrew
key: v1-brew-cache-{{ arch }}
- /usr/local/Cellar/gnu-tar
- /usr/local/bin/gtar
key: v4-brew-cache-{{ arch }}
name: Persisting brew cache
step-get-more-space-on-mac: &step-get-more-space-on-mac
@@ -468,8 +482,10 @@ step-install-gnutar-on-mac: &step-install-gnutar-on-mac
name: Install gnu-tar on macos
command: |
if [ "`uname`" == "Darwin" ]; then
brew update
brew install gnu-tar
if [ ! -d /usr/local/Cellar/gnu-tar/ ]; then
brew update
brew install gnu-tar
fi
ln -fs /usr/local/bin/gtar /usr/local/bin/tar
fi
@@ -572,6 +588,9 @@ step-electron-dist-build: &step-electron-dist-build
if [ x"$MAS_BUILD" == x"true" ]; then
target_os=mac_mas
fi
if [ "$TARGET_ARCH" == "arm64" ]; then
target_cpu=arm64
fi
elif [ "`uname`" == "Linux" ]; then
target_os=linux
if [ x"$TARGET_ARCH" == x ]; then
@@ -659,10 +678,10 @@ step-electron-publish: &step-electron-publish
cd src/electron
if [ "$UPLOAD_TO_S3" == "1" ]; then
echo 'Uploading Electron release distribution to S3'
script/release/uploaders/upload.py --upload_to_s3
script/release/uploaders/upload.py --verbose --upload_to_s3
else
echo 'Uploading Electron release distribution to Github releases'
script/release/uploaders/upload.py
script/release/uploaders/upload.py --verbose
fi
step-persist-data-for-tests: &step-persist-data-for-tests
@@ -764,14 +783,20 @@ step-setup-linux-for-headless-testing: &step-setup-linux-for-headless-testing
step-show-sccache-stats: &step-show-sccache-stats
run:
shell: /bin/bash
name: Check sccache/goma stats after build
command: |
if [ "$SCCACHE_PATH" != "" ]; then
$SCCACHE_PATH -s
fi
if [ "$USE_GOMA" == "true" ]; then
set +e
set +o pipefail
$LOCAL_GOMA_DIR/goma_ctl.py stat
$LOCAL_GOMA_DIR/diagnose_goma_log.py
true
fi
when: always
step-mksnapshot-build: &step-mksnapshot-build
run:
@@ -909,6 +934,8 @@ step-ninja-summary: &step-ninja-summary
run:
name: Print ninja summary
command: |
set +e
set +o pipefail
python depot_tools/post_build_ninja_summary.py -C src/out/Default
step-ninja-report: &step-ninja-report
@@ -1135,7 +1162,6 @@ steps-checkout-and-save-cache: &steps-checkout-and-save-cache
- *step-maybe-early-exit-doc-only-change
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-restore-brew-cache
- *step-get-more-space-on-mac
- *step-install-gnutar-on-mac
@@ -1799,7 +1825,7 @@ jobs:
# Layer 2: Builds.
linux-x64-testing:
<<: *machine-linux-xlarge
<<: *machine-linux-2xlarge
environment:
<<: *env-global
<<: *env-testing-build
@@ -1879,7 +1905,7 @@ jobs:
checkout: false
linux-ia32-testing:
<<: *machine-linux-xlarge
<<: *machine-linux-2xlarge
environment:
<<: *env-global
<<: *env-ia32
@@ -1945,7 +1971,7 @@ jobs:
checkout: false
linux-arm-testing:
<<: *machine-linux-xlarge
<<: *machine-linux-2xlarge
environment:
<<: *env-global
<<: *env-arm
@@ -2012,7 +2038,7 @@ jobs:
checkout: false
linux-arm64-testing:
<<: *machine-linux-xlarge
<<: *machine-linux-2xlarge
environment:
<<: *env-global
<<: *env-arm64

10
.gitattributes vendored
View File

@@ -2,3 +2,13 @@
# files to be checked out with LF endings even if core.autocrlf is true.
*.patch text eol=lf
patches/**/.patches merge=union
# Source code and markdown files should always use LF as line ending.
*.cc text eol=lf
*.mm text eol=lf
*.h text eol=lf
*.js text eol=lf
*.ts text eol=lf
*.py text eol=lf
*.ps1 text eol=lf
*.md text eol=lf

116
BUILD.gn
View File

@@ -325,7 +325,6 @@ source_set("electron_lib") {
"//base/allocator:buildflags",
"//chrome/app:command_ids",
"//chrome/app/resources:platform_locale_settings",
"//chrome/services/printing/public/mojom",
"//components/certificate_transparency",
"//components/language/core/browser",
"//components/net_log",
@@ -372,6 +371,7 @@ source_set("electron_lib") {
"//third_party/libyuv",
"//third_party/webrtc_overrides:webrtc_component",
"//third_party/widevine/cdm:headers",
"//third_party/zlib/google:zip",
"//ui/base/idle",
"//ui/events:dom_keycode_converter",
"//ui/gl",
@@ -405,44 +405,26 @@ source_set("electron_lib") {
defines += [ "GDK_DISABLE_DEPRECATION_WARNINGS" ]
}
extra_source_filters = []
if (!is_linux) {
extra_source_filters += [
"*\bx/*",
"*_x11.h",
"*_x11.cc",
"*_gtk.h",
"*_gtk.cc",
"*\blibrary_loaders/*",
]
}
if (!is_win) {
extra_source_filters += [
"*\bwin_*.h",
"*\bwin_*.cc",
]
}
if (!is_posix) {
extra_source_filters += [
"*_posix.cc",
"*_posix.h",
]
}
if (is_mac) {
extra_source_filters += [
"*_views.cc",
"*_views.h",
"*\bviews/*",
]
}
if (!is_mas_build) {
deps += [ "//components/crash/core/app" ]
}
set_sources_assignment_filter(
sources_assignment_filter + extra_source_filters)
sources = filenames.lib_sources
set_sources_assignment_filter(sources_assignment_filter)
if (is_win) {
sources += filenames.lib_sources_win
}
if (is_mac) {
sources += filenames.lib_sources_mac
}
if (is_posix) {
sources += filenames.lib_sources_posix
}
if (is_linux) {
sources += filenames.lib_sources_linux
}
if (!is_mac) {
sources += filenames.lib_sources_views
}
if (is_component_build) {
defines += [ "NODE_SHARED_MODE" ]
@@ -531,7 +513,9 @@ source_set("electron_lib") {
]
}
configs += [ ":gio_unix" ]
configs += [ "//build/config/linux:x11" ]
if (use_x11) {
deps += [ "//ui/gfx/x" ]
}
defines += [
# Disable warnings for g_settings_list_schemas.
"GLIB_DISABLE_DEPRECATION_WARNINGS",
@@ -587,7 +571,6 @@ source_set("electron_lib") {
sources += [
"shell/browser/osr/osr_host_display_client.cc",
"shell/browser/osr/osr_host_display_client.h",
"shell/browser/osr/osr_host_display_client_mac.mm",
"shell/browser/osr/osr_render_widget_host_view.cc",
"shell/browser/osr/osr_render_widget_host_view.h",
"shell/browser/osr/osr_video_consumer.cc",
@@ -596,8 +579,13 @@ source_set("electron_lib") {
"shell/browser/osr/osr_view_proxy.h",
"shell/browser/osr/osr_web_contents_view.cc",
"shell/browser/osr/osr_web_contents_view.h",
"shell/browser/osr/osr_web_contents_view_mac.mm",
]
if (is_mac) {
sources += [
"shell/browser/osr/osr_host_display_client_mac.mm",
"shell/browser/osr/osr_web_contents_view_mac.mm",
]
}
deps += [
"//components/viz/service",
"//services/viz/public/mojom",
@@ -632,7 +620,10 @@ source_set("electron_lib") {
"shell/renderer/printing/print_render_frame_helper_delegate.cc",
"shell/renderer/printing/print_render_frame_helper_delegate.h",
]
deps += [ "//components/printing/common:mojo_interfaces" ]
deps += [
"//chrome/services/printing/public/mojom",
"//components/printing/common:mojo_interfaces",
]
}
if (enable_electron_extensions) {
@@ -670,6 +661,14 @@ source_set("electron_lib") {
"shell/browser/electron_pdf_web_contents_helper_client.h",
]
}
if (is_win && enable_win_dark_mode_window_ui) {
sources += [
"shell/browser/win/dark_mode.cc",
"shell/browser/win/dark_mode.h",
]
libs += [ "uxtheme.lib" ]
}
}
electron_paks("packed_resources") {
@@ -695,10 +694,10 @@ if (is_mac) {
action("fake_v8_context_snapshot_generator") {
script = "build/fake_v8_context_snapshot_generator.py"
args = [
rebase_path("$root_out_dir/v8_context_snapshot.bin"),
rebase_path("$root_out_dir/fake/v8_context_snapshot.bin"),
rebase_path("$root_out_dir/$v8_context_snapshot_filename"),
rebase_path("$root_out_dir/fake/$v8_context_snapshot_filename"),
]
outputs = [ "$root_out_dir/fake/v8_context_snapshot.bin" ]
outputs = [ "$root_out_dir/fake/$v8_context_snapshot_filename" ]
}
bundle_data("electron_framework_resources") {
@@ -712,10 +711,10 @@ if (is_mac) {
public_deps += [ "//v8" ]
if (use_v8_context_snapshot) {
if (use_prebuilt_v8_context_snapshot) {
sources += [ "$root_out_dir/fake/v8_context_snapshot.bin" ]
sources += [ "$root_out_dir/fake/$v8_context_snapshot_filename" ]
public_deps += [ ":fake_v8_context_snapshot_generator" ]
} else {
sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
public_deps += [ "//tools/v8_context_snapshot" ]
}
} else {
@@ -1138,22 +1137,37 @@ if (is_mac) {
"//components/crash/core/app:run_as_crashpad_handler",
]
ldflags = []
libs = [
"comctl32.lib",
"uiautomationcore.lib",
"wtsapi32.lib",
]
configs += [ "//build/config/win:windowed" ]
ldflags = [
# Windows 7 doesn't have these DLLs.
# TODO: are there other DLLs we need to list here to be win7
# compatible?
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
configs += [
"//build/config/win:windowed",
"//build/config/win:delayloads",
]
if (target_cpu == "arm64") {
configs -= [ "//build/config/win:cfi_linker" ]
ldflags += [ "/guard:cf,nolongjmp" ]
}
if (current_cpu == "x86") {
# Set the initial stack size to 0.5MiB, instead of the 1.5MiB needed by
# Chrome's main thread. This saves significant memory on threads (like
# those in the Windows thread pool, and others) whose stack size we can
# only control through this setting. Because Chrome's main thread needs
# a minimum 1.5 MiB stack, the main thread (in 32-bit builds only) uses
# fibers to switch to a 1.5 MiB stack before running any other code.
ldflags += [ "/STACK:0x80000" ]
} else {
# Increase the initial stack size. The default is 1MB, this is 8MB.
ldflags += [ "/STACK:0x800000" ]
}
# This is to support renaming of electron.exe. node-gyp has hard-coded
# executable names which it will recognise as node. This module definition
# file claims that the electron executable is in fact named "node.exe",

4
DEPS
View File

@@ -14,13 +14,13 @@ gclient_gn_args = [
vars = {
'chromium_version':
'b04584161e07d4ac110045b7647fa8a81f5f0709',
'87.0.4280.141',
'node_version':
'v12.18.3',
'nan_version':
'2c4ee8a32a299eada3cd6e468bbd0a473bfea96d',
'squirrel.mac_version':
'44468f858ce0d25c27bd5e674abfa104e0119738',
'a3a5b3f03b824441c014893b18f99a103b2603e9',
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
'pyyaml_version': '3.12',

View File

@@ -1 +1 @@
11.0.0-nightly.20200826
11.4.1

View File

@@ -28,15 +28,12 @@ The preferred method is to install Electron as a development dependency in your
app:
```sh
npm install electron --save-dev [--save-exact]
npm install electron --save-dev
```
The `--save-exact` flag is recommended for Electron prior to version 2, as it does not follow semantic
versioning. As of version 2.0.0, Electron follows semver, so you don't need `--save-exact` flag. For info on how to manage Electron versions in your apps, see
[Electron versioning](docs/tutorial/electron-versioning.md).
For more installation options and troubleshooting tips, see
[installation](docs/tutorial/installation.md).
[installation](docs/tutorial/installation.md). For info on how to manage Electron versions in your apps, see
[Electron versioning](docs/tutorial/electron-versioning.md).
## Quick start & Electron Fiddle

View File

@@ -53,7 +53,9 @@ build_script:
} else {
node script/yarn.js install --frozen-lockfile
if ($(node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH;$LASTEXITCODE -eq 0)) {
$result = node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
Write-Output $result
if ($result.ExitCode -eq 0) {
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
}
}
@@ -99,6 +101,11 @@ build_script:
} else {
# update external binaries
python src/electron/script/update-external-binaries.py
# update angle
cd src\third_party\angle
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
git fetch
cd ..\..\..
}
} else {
# file does not exist, gclient sync, then zip
@@ -114,14 +121,16 @@ build_script:
if ($env:SAVE_GCLIENT_SRC -eq 'true') {
# archive current source for future use
# only run on x64/woa to avoid contention saving
if ($(7z a $zipfile src -xr!android_webview -xr!electron -xr'!*\.git' -xr!third_party\WebKit\LayoutTests! -xr!third_party\blink\web_tests -xr!third_party\blink\perf_tests -slp -t7z -mmt=30;$LASTEXITCODE -ne 0)) {
$(7z a $zipfile src -xr!android_webview -xr!electron -xr'!*\.git' -xr!third_party\WebKit\LayoutTests! -xr!third_party\blink\web_tests -xr!third_party\blink\perf_tests -slp -t7z -mmt=30)
if ($LASTEXITCODE -ne 0) {
Write-warning "Could not save source to shared drive; continuing anyway"
}
# build time generation of file gen/angle/commit.h depends on
# third_party/angle/.git/HEAD.
# build time generation of file gen/angle/angle_commit.h depends on
# third_party/angle/.git
# https://chromium-review.googlesource.com/c/angle/angle/+/2074924
if ($(7z a $zipfile src\third_party\angle\.git\HEAD;$LASTEXITCODE -ne 0)) {
Write-warning "Failed to add third_party\angle\.git\HEAD; continuing anyway"
$(7z a $zipfile src\third_party\angle\.git)
if ($LASTEXITCODE -ne 0) {
Write-warning "Failed to add third_party\angle\.git; continuing anyway"
}
}
- ps: >-
@@ -134,7 +143,7 @@ build_script:
cd build-tools
npm install
mkdir third_party
node -e "require('./src/utils/goma.js').downloadAndPrepare()"
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
$env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
$env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
cd ..
@@ -205,7 +214,8 @@ test_script:
echo "Skipping tests for $env:GN_CONFIG build"
}
- cd electron
- if "%RUN_TESTS%"=="true" ( echo Running test suite & node script/yarn test -- --trace-uncaught --enable-logging)
# CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022
- if "%RUN_TESTS%"=="true" ( echo Running test suite & node script/yarn test -- --trace-uncaught --enable-logging --disable-features=CalculateNativeWinOcclusion )
- cd ..
- if "%RUN_TESTS%"=="true" ( echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg )
- echo "About to verify mksnapshot"
@@ -219,10 +229,10 @@ deploy_script:
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_S3) {
Write-Output "Uploading Electron release distribution to s3"
& python script\release\uploaders\upload.py --upload_to_s3
& python script\release\uploaders\upload.py --verbose --upload_to_s3
} else {
Write-Output "Uploading Electron release distribution to github releases"
& python script\release\uploaders\upload.py
& python script\release\uploaders\upload.py --verbose
}
} elseif (Test-Path Env:\TEST_WOA) {
node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH

View File

@@ -63,7 +63,8 @@ steps:
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
set npm_config_arch=arm64
cd electron
node script/yarn test -- --enable-logging --verbose
# CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022
node script/yarn test -- --enable-logging --verbose --disable-features=CalculateNativeWinOcclusion
displayName: 'Run Electron tests'
env:
ELECTRON_OUT_DIR: Default
@@ -92,6 +93,6 @@ steps:
condition: always()
- powershell: |
Remove-Item -path $env:APPDATA/Electron* -Recurse
Remove-Item -path $env:APPDATA/Electron* -Recurse -Force -ErrorAction Ignore
displayName: 'Delete user app data directories'
condition: always()

View File

@@ -2,7 +2,7 @@ is_electron_build = true
root_extra_deps = [ "//electron" ]
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
node_module_version = 82
node_module_version = 85
v8_promise_internal_field_count = 1
v8_typed_array_max_size_in_heap = 0

View File

@@ -10,10 +10,9 @@ config.output = {
filename: path.basename(outPath)
};
const { wrapInitWithProfilingTimeout } = config;
delete config.wrapInitWithProfilingTimeout;
const { wrapInitWithProfilingTimeout, wrapInitWithTryCatch, ...webpackConfig } = config;
webpack(config, (err, stats) => {
webpack(webpackConfig, (err, stats) => {
if (err) {
console.error(err);
process.exit(1);
@@ -21,9 +20,17 @@ webpack(config, (err, stats) => {
console.error(stats.toString('normal'));
process.exit(1);
} else {
let contents = fs.readFileSync(outPath, 'utf8');
if (wrapInitWithTryCatch) {
contents = `try {
${contents}
} catch (err) {
console.error('Electron ${webpackConfig.output.filename} script failed to run');
console.error(err);
}`;
}
if (wrapInitWithProfilingTimeout) {
const contents = fs.readFileSync(outPath, 'utf8');
const newContents = `function ___electron_webpack_init__() {
contents = `function ___electron_webpack_init__() {
${contents}
};
if ((globalThis.process || binding.process).argv.includes("--profile-electron-init")) {
@@ -31,8 +38,8 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
} else {
___electron_webpack_init__();
}`;
fs.writeFileSync(outPath, newContents);
}
fs.writeFileSync(outPath, contents);
process.exit(0);
}
});

View File

@@ -69,7 +69,8 @@ module.exports = ({
loadElectronFromAlternateTarget,
targetDeletesNodeGlobals,
target,
wrapInitWithProfilingTimeout
wrapInitWithProfilingTimeout,
wrapInitWithTryCatch
}) => {
let entry = path.resolve(electronRoot, 'lib', target, 'init.ts');
if (!fs.existsSync(entry)) {
@@ -87,6 +88,7 @@ module.exports = ({
filename: `${target}.bundle.js`
},
wrapInitWithProfilingTimeout,
wrapInitWithTryCatch,
resolve: {
alias: {
'@electron/internal': path.resolve(electronRoot, 'lib'),

View File

@@ -1,4 +1,5 @@
module.exports = require('./webpack.config.base')({
target: 'isolated_renderer',
alwaysHasNode: false
alwaysHasNode: false,
wrapInitWithTryCatch: true
});

View File

@@ -2,5 +2,6 @@ module.exports = require('./webpack.config.base')({
target: 'renderer',
alwaysHasNode: true,
targetDeletesNodeGlobals: true,
wrapInitWithProfilingTimeout: true
wrapInitWithProfilingTimeout: true,
wrapInitWithTryCatch: true
});

View File

@@ -1,5 +1,6 @@
module.exports = require('./webpack.config.base')({
target: 'sandboxed_renderer',
alwaysHasNode: false,
wrapInitWithProfilingTimeout: true
wrapInitWithProfilingTimeout: true,
wrapInitWithTryCatch: true
});

View File

@@ -2,5 +2,6 @@ module.exports = require('./webpack.config.base')({
target: 'worker',
loadElectronFromAlternateTarget: 'renderer',
alwaysHasNode: true,
targetDeletesNodeGlobals: true
targetDeletesNodeGlobals: true,
wrapInitWithTryCatch: true
});

View File

@@ -13,27 +13,30 @@ EXTENSIONS_TO_SKIP = [
]
PATHS_TO_SKIP = [
'angledata', #Skipping because it is an output of //ui/gl that we don't need
'./libVkICD_mock_', #Skipping because these are outputs that we don't need
'./VkICD_mock_', #Skipping because these are outputs that we don't need
# Skipping because its an output of create_bundle from //build/config/mac/rules.gni
# Skip because it is an output of //ui/gl that we don't need.
'angledata',
# Skip because these are outputs that we don't need.
'./libVkICD_mock_',
# Skip because these are outputs that we don't need.
'./VkICD_mock_',
# Skip because its an output of create_bundle from //build/config/mac/rules.gni
# that we don't need
'Electron.dSYM',
# Refs https://chromium-review.googlesource.com/c/angle/angle/+/2425197.
# Remove this when Angle themselves remove the file: https://issuetracker.google.com/issues/168736059
'gen/angle/angle_commit.h',
# //chrome/browser:resources depends on this via
# //chrome/browser/resources/ssl/ssl_error_assistant, but we don't need to
# ship it.
'pyproto',
# On Windows, this binary doesn't exist (the crashpad handler is built-in).
# On MacOS, the binary is called 'chrome_crashpad_handler' and is inside the
# app bundle.
# On Linux, we don't use crashpad, but this binary is still built for some
# reason. Exclude it from the zip.
'./crashpad_handler',
'resources/inspector', #Skipping because these are outputs that we don't need
# Skip because these are outputs that we don't need.
'resources/inspector',
]
def skip_path(dep, dist_zip, target_cpu):

View File

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

View File

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

View File

@@ -26,18 +26,10 @@ static_library("chrome") {
"//chrome/browser/devtools/devtools_file_system_indexer.h",
"//chrome/browser/extensions/global_shortcut_listener.cc",
"//chrome/browser/extensions/global_shortcut_listener.h",
"//chrome/browser/extensions/global_shortcut_listener_mac.h",
"//chrome/browser/extensions/global_shortcut_listener_mac.mm",
"//chrome/browser/extensions/global_shortcut_listener_win.cc",
"//chrome/browser/extensions/global_shortcut_listener_win.h",
"//chrome/browser/icon_loader.cc",
"//chrome/browser/icon_loader.h",
"//chrome/browser/icon_loader_mac.mm",
"//chrome/browser/icon_loader_win.cc",
"//chrome/browser/icon_manager.cc",
"//chrome/browser/icon_manager.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
"//chrome/browser/net/chrome_mojo_proxy_resolver_factory.cc",
"//chrome/browser/net/chrome_mojo_proxy_resolver_factory.h",
"//chrome/browser/net/proxy_config_monitor.cc",
@@ -57,14 +49,32 @@ static_library("chrome") {
"//chrome/browser/ssl/tls_deprecation_config.cc",
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.cc",
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.h",
"//chrome/browser/win/chrome_process_finder.cc",
"//chrome/browser/win/chrome_process_finder.h",
"//chrome/child/v8_crashpad_support_win.cc",
"//chrome/child/v8_crashpad_support_win.h",
"//extensions/browser/app_window/size_constraints.cc",
"//extensions/browser/app_window/size_constraints.h",
]
if (is_mac) {
sources += [
"//chrome/browser/extensions/global_shortcut_listener_mac.h",
"//chrome/browser/extensions/global_shortcut_listener_mac.mm",
"//chrome/browser/icon_loader_mac.mm",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
]
}
if (is_win) {
sources += [
"//chrome/browser/extensions/global_shortcut_listener_win.cc",
"//chrome/browser/extensions/global_shortcut_listener_win.h",
"//chrome/browser/icon_loader_win.cc",
"//chrome/browser/win/chrome_process_finder.cc",
"//chrome/browser/win/chrome_process_finder.h",
"//chrome/child/v8_crashpad_support_win.cc",
"//chrome/child/v8_crashpad_support_win.h",
]
}
public_deps = [
"//chrome/common",
"//chrome/common:version_header",
@@ -124,10 +134,17 @@ static_library("chrome") {
"//chrome/browser/platform_util.h",
"//chrome/browser/ui/browser_dialogs.h",
"//chrome/browser/ui/color_chooser.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.cc",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.h",
]
if (use_aura) {
sources += [ "//chrome/browser/platform_util_aura.cc" ]
sources += [
"//chrome/browser/platform_util_aura.cc",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_aura.cc",
]
if (!is_win) {
sources += [
@@ -144,6 +161,8 @@ static_library("chrome") {
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
"//chrome/browser/ui/cocoa/color_chooser_mac.h",
"//chrome/browser/ui/cocoa/color_chooser_mac.mm",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
]
deps += [
"//components/remote_cocoa/app_shim",
@@ -266,6 +285,17 @@ static_library("chrome") {
]
}
}
if (!is_mas_build) {
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump.h" ]
if (is_mac) {
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump_mac.cc" ]
} else if (is_win) {
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump_win.cc" ]
} else {
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump.cc" ]
}
}
}
source_set("plugins") {

View File

@@ -36,6 +36,7 @@ net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext(
// Linux has only a single persistent slot compared to ChromeOS's separate
// public and private slot.
// Redirect any slot usage to this persistent slot on Linux.
crypto::EnsureNSSInit();
g_nss_cert_database = new net::NSSCertDatabase(
crypto::ScopedPK11Slot(PK11_GetInternalKeySlot()) /* public slot */,
crypto::ScopedPK11Slot(PK11_GetInternalKeySlot()) /* private slot */);

View File

@@ -826,10 +826,9 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
to_send.append(current_dir.value());
const std::vector<std::string>& argv = electron::ElectronCommandLine::argv();
for (std::vector<std::string>::const_iterator it = argv.begin();
it != argv.end(); ++it) {
for (const auto& arg : argv) {
to_send.push_back(kTokenDelimiter);
to_send.append(*it);
to_send.append(arg);
}
// Send the message

View File

@@ -122,8 +122,7 @@ void GlobalMenuBarRegistrarX11::OnNameOwnerChanged(GObject* /* ignored */,
GParamSpec* /* ignored */) {
// If the name owner changed, we need to reregister all the live x11::Window
// with the system.
for (std::set<x11::Window>::const_iterator it = live_windows_.begin();
it != live_windows_.end(); ++it) {
RegisterXWindow(*it);
for (const auto& window : live_windows_) {
RegisterXWindow(window);
}
}

View File

@@ -148,6 +148,7 @@ These individual tutorials expand on topics discussed in the guide above.
### Modules for the Renderer Process (Web Page):
* [contextBridge](api/context-bridge.md)
* [desktopCapturer](api/desktop-capturer.md)
* [ipcRenderer](api/ipc-renderer.md)
* [remote](api/remote.md)

View File

@@ -32,7 +32,8 @@ In most cases, you should do everything in the `ready` event handler.
Returns:
* `launchInfo` unknown _macOS_
* `event` Event
* `launchInfo` Record<string, any> _macOS_
Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
holds the `userInfo` of the `NSUserNotification` that was used to open the
@@ -389,7 +390,7 @@ which contains more information about why the render process disappeared. It
isn't always because it crashed. The `killed` boolean can be replaced by
checking `reason === 'killed'` when you switch to that event.
#### Event: 'render-process-gone'
### Event: 'render-process-gone'
Returns:
@@ -402,13 +403,13 @@ Returns:
* `killed` - Process was sent a SIGTERM or otherwise killed externally
* `crashed` - Process crashed
* `oom` - Process ran out of memory
* `launch-failure` - Process never successfully launched
* `launch-failed` - Process never successfully launched
* `integrity-failure` - Windows code integrity checks failed
Emitted when the renderer process unexpectedly disappears. This is normally
because it was crashed or killed.
#### Event: 'child-process-gone'
### Event: 'child-process-gone'
Returns:
@@ -428,7 +429,7 @@ Returns:
* `killed` - Process was sent a SIGTERM or otherwise killed externally
* `crashed` - Process crashed
* `oom` - Process ran out of memory
* `launch-failure` - Process never successfully launched
* `launch-failed` - Process never successfully launched
* `integrity-failure` - Windows code integrity checks failed
* `exitCode` Number - The exit code for the process
(e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).
@@ -501,7 +502,7 @@ Returns:
Emitted when `desktopCapturer.getSources()` is called in the renderer process of `webContents`.
Calling `event.preventDefault()` will make it return empty sources.
### Event: 'remote-require'
### Event: 'remote-require' _Deprecated_
Returns:
@@ -513,7 +514,7 @@ Emitted when `remote.require()` is called in the renderer process of `webContent
Calling `event.preventDefault()` will prevent the module from being returned.
Custom value can be returned by setting `event.returnValue`.
### Event: 'remote-get-global'
### Event: 'remote-get-global' _Deprecated_
Returns:
@@ -525,7 +526,7 @@ Emitted when `remote.getGlobal()` is called in the renderer process of `webConte
Calling `event.preventDefault()` will prevent the global from being returned.
Custom value can be returned by setting `event.returnValue`.
### Event: 'remote-get-builtin'
### Event: 'remote-get-builtin' _Deprecated_
Returns:
@@ -537,7 +538,7 @@ Emitted when `remote.getBuiltin()` is called in the renderer process of `webCont
Calling `event.preventDefault()` will prevent the module from being returned.
Custom value can be returned by setting `event.returnValue`.
### Event: 'remote-get-current-window'
### Event: 'remote-get-current-window' _Deprecated_
Returns:
@@ -548,7 +549,7 @@ Emitted when `remote.getCurrentWindow()` is called in the renderer process of `w
Calling `event.preventDefault()` will prevent the object from being returned.
Custom value can be returned by setting `event.returnValue`.
### Event: 'remote-get-current-web-contents'
### Event: 'remote-get-current-web-contents' _Deprecated_
Returns:
@@ -1340,7 +1341,7 @@ systems Application folder. Use in combination with `app.moveToApplicationsFolde
### `app.moveToApplicationsFolder([options])` _macOS_
* `options` Object (optional)
* `conflictHandler` Function<Boolean> (optional) - A handler for potential conflict in move failure.
* `conflictHandler` Function\<Boolean> (optional) - A handler for potential conflict in move failure.
* `conflictType` String - The type of move conflict encountered by the handler; can be `exists` or `existsAndRunning`, where `exists` means that an app of the same name is present in the Applications directory and `existsAndRunning` means both that it exists and that it's presently running.
Returns `Boolean` - Whether the move was successful. Please note that if
@@ -1484,3 +1485,12 @@ which native modules you can use in the renderer process. For more information
on the direction Electron is going with renderer process restarts and usage of
native modules in the renderer process please check out this
[Tracking Issue](https://github.com/electron/electron/issues/18397).
### `app.runningUnderRosettaTranslation` _macOS_ _Readonly_
A `Boolean` which when `true` indicates that the app is currently running
under the [Rosetta Translator Environment](https://en.wikipedia.org/wiki/Rosetta_(software)).
You can use this property to prompt users to download the arm64 version of
your application when they are running the x64 version under Rosetta
incorrectly.

View File

@@ -8,9 +8,6 @@ Process: [Main](../glossary.md#main-process)
// In the main process.
const { BrowserWindow } = require('electron')
// Or use `remote` from the renderer process.
// const { BrowserWindow } = require('electron').remote
const win = new BrowserWindow({ width: 800, height: 600 })
// Load a remote URL
@@ -541,6 +538,12 @@ Note that this is only emitted when the window is being resized manually. Resizi
Emitted after the window has been resized.
#### Event: 'resized' _macOS_ _Windows_
Emitted once when the window has finished being resized.
This is usually emitted when the window has been resized manually. On macOS, resizing the window with `setBounds`/`setSize` and setting the `animate` parameter to `true` will also emit this event once resizing has finished.
#### Event: 'will-move' _macOS_ _Windows_
Returns:
@@ -556,12 +559,12 @@ Note that this is only emitted when the window is being resized manually. Resizi
Emitted when the window is being moved to a new position.
__Note__: On macOS this event is an alias of `moved`.
#### Event: 'moved' _macOS_
#### Event: 'moved' _macOS_ _Windows_
Emitted once when the window is moved to a new position.
__Note__: On macOS this event is an alias of `move`.
#### Event: 'enter-full-screen'
Emitted when the window enters a full-screen state.
@@ -670,6 +673,20 @@ Emitted when the window has closed a sheet.
Emitted when the native new tab button is clicked.
#### Event: 'system-context-menu' _Windows_
Returns:
* `event` Event
* `point` [Point](structures/point.md) - The screen coordinates the context menu was triggered at
Emitted when the system context menu is triggered on the window, this is
normally only triggered when the user right clicks on the non-client area
of your window. This is the window titlebar or any area you have declared
as `-webkit-app-region: drag` in a frameless window.
Calling `event.preventDefault()` will prevent the menu from being displayed.
### Static Methods
The `BrowserWindow` class has the following static methods:
@@ -713,7 +730,7 @@ The method will also not return if the extension's manifest is missing or incomp
is emitted.
**Note:** This method is deprecated. Instead, use
[`ses.loadExtension(path)`](session.md#sesloadextensionpath).
[`ses.loadExtension(path)`](session.md#sesloadextensionpath-options).
#### `BrowserWindow.removeExtension(name)` _Deprecated_
@@ -755,7 +772,7 @@ The method will also not return if the extension's manifest is missing or incomp
is emitted.
**Note:** This method is deprecated. Instead, use
[`ses.loadExtension(path)`](session.md#sesloadextensionpath).
[`ses.loadExtension(path)`](session.md#sesloadextensionpath-options).
#### `BrowserWindow.removeDevToolsExtension(name)` _Deprecated_
@@ -1029,7 +1046,7 @@ Returns `Boolean` - Whether the window is in simple (pre-Lion) fullscreen mode.
Returns `Boolean` - Whether the window is in normal state (not maximized, not minimized, not in fullscreen mode).
#### `win.setAspectRatio(aspectRatio[, extraSize])` _macOS_ _Linux_
#### `win.setAspectRatio(aspectRatio[, extraSize])`
* `aspectRatio` Float - The aspect ratio to maintain for some portion of the
content view.
@@ -1050,6 +1067,9 @@ 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
APIs like `win.setSize`.
#### `win.setBackgroundColor(backgroundColor)`
* `backgroundColor` String - Window's background color as a hexadecimal value,
@@ -1369,6 +1389,8 @@ The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
* `message` Integer
* `callback` Function
* `wParam` any - The `wParam` provided to the WndProc
* `lParam` any - The `lParam` provided to the WndProc
Hooks a windows message. The `callback` is called when
the message is received in the WndProc.
@@ -1421,7 +1443,7 @@ Returns `Boolean` - Whether the window's document has been edited.
Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page.
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page. If the page is not visible, `rect` may be empty.
#### `win.loadURL(url[, options])`
@@ -1829,6 +1851,13 @@ Replacement API for setBrowserView supporting work with multi browser views.
* `browserView` [BrowserView](browser-view.md)
#### `win.setTopBrowserView(browserView)` _Experimental_
* `browserView` [BrowserView](browser-view.md)
Raises `browserView` above other `BrowserView`s attached to `win`.
Throws an error if `browserView` is not attached to `win`.
#### `win.getBrowserViews()` _Experimental_
Returns `BrowserView[]` - an array of all BrowserViews that have been attached

View File

@@ -198,6 +198,14 @@ logging level for all code in the source files under a `foo/bar` directory.
This switch only works when `--enable-logging` is also passed.
### --force_high_performance_gpu
Force using discrete GPU when there are multiple GPUs available.
### --force_low_power_gpu
Force using integrated GPU when there are multiple GPUs available.
## Node.js Flags
Electron supports some of the [CLI flags][node-cli] supported by Node.js.

View File

@@ -16,7 +16,7 @@ const { app, contentTracing } = require('electron')
app.whenReady().then(() => {
(async () => {
await contentTracing.startRecording({
include_categories: ['*']
included_categories: ['*']
})
console.log('Tracing started')
await new Promise(resolve => setTimeout(resolve, 5000))

View File

@@ -45,6 +45,8 @@ The following events are available on instances of `Cookies`:
#### Event: 'changed'
Returns:
* `event` Event
* `cookie` [Cookie](structures/cookie.md) - The cookie that was changed.
* `cause` String - The cause of the change with one of the following values:

View File

@@ -72,50 +72,6 @@ const constraints = {
}
```
This example shows how to capture a video from a [WebContents](web-contents.md)
```javascript
// In the renderer process.
const { desktopCapturer, remote } = require('electron')
desktopCapturer.getMediaSourceIdForWebContents(remote.getCurrentWebContents().id).then(async mediaSourceId => {
try {
const stream = await navigator.mediaDevices.getUserMedia({
audio: {
mandatory: {
chromeMediaSource: 'tab',
chromeMediaSourceId: mediaSourceId
}
},
video: {
mandatory: {
chromeMediaSource: 'tab',
chromeMediaSourceId: mediaSourceId,
minWidth: 1280,
maxWidth: 1280,
minHeight: 720,
maxHeight: 720
}
}
})
handleStream(stream)
} catch (e) {
handleError(e)
}
})
function handleStream (stream) {
const video = document.querySelector('video')
video.srcObject = stream
video.onloadedmetadata = (e) => video.play()
}
function handleError (e) {
console.log(e)
}
```
## Methods
The `desktopCapturer` module has the following methods:
@@ -138,15 +94,6 @@ Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`Desktop
**Note** Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
which can detected by [`systemPreferences.getMediaAccessStatus`].
### `desktopCapturer.getMediaSourceIdForWebContents(webContentsId)`
* `webContentsId` number - Id of the WebContents to get stream of
Returns `Promise<string>` - Resolves with the identifier of a WebContents stream, this identifier can be
used with [`navigator.mediaDevices.getUserMedia`].
The identifier is **only valid for 10 seconds**.
The identifier may be empty if not requested from a renderer process.
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
[`systemPreferences.getMediaAccessStatus`]: system-preferences.md#systempreferencesgetmediaaccessstatusmediatype-macos

View File

@@ -11,14 +11,6 @@ const { dialog } = require('electron')
console.log(dialog.showOpenDialog({ properties: ['openFile', 'multiSelections'] }))
```
The Dialog is opened from Electron's main thread. If you want to use the dialog
object from a renderer process, remember to access it using the remote:
```javascript
const { dialog } = require('electron').remote
console.log(dialog)
```
## Methods
The `dialog` module has the following methods:

View File

@@ -15,7 +15,7 @@ extension capabilities.
Electron only supports loading unpacked extensions (i.e., `.crx` files do not
work). Extensions are installed per-`session`. To load an extension, call
[`ses.loadExtension`](session.md#sesloadextensionpath):
[`ses.loadExtension`](session.md#sesloadextensionpath-options):
```js
const { session } = require('electron')
@@ -102,3 +102,21 @@ The following methods of `chrome.tabs` are supported:
> **Note:** In Chrome, passing `-1` as a tab ID signifies the "currently active
> tab". Since Electron has no such concept, passing `-1` as a tab ID is not
> supported and will raise an error.
### `chrome.management`
The following methods of `chrome.management` are supported:
- `chrome.management.getAll`
- `chrome.management.get`
- `chrome.management.getSelf`
- `chrome.management.getPermissionWarningsById`
- `chrome.management.getPermissionWarningsByManifest`
- `chrome.management.onEnabled`
- `chrome.management.onDisabled`
### `chrome.webRequest`
All features of this API are supported.
> **NOTE:** Electron's [`webRequest`](web-request.md) module takes precedence over `chrome.webRequest` if there are conflicting handlers.

View File

@@ -112,13 +112,19 @@ optional parameter can be used to forward mouse move messages to the web page,
allowing events such as `mouseleave` to be emitted:
```javascript
const win = require('electron').remote.getCurrentWindow()
const { ipcRenderer } = require('electron')
const el = document.getElementById('clickThroughElement')
el.addEventListener('mouseenter', () => {
win.setIgnoreMouseEvents(true, { forward: true })
ipcRenderer.send('set-ignore-mouse-events', true, { forward: true })
})
el.addEventListener('mouseleave', () => {
win.setIgnoreMouseEvents(false)
ipcRenderer.send('set-ignore-mouse-events', false)
})
// Main process
const { ipcMain } = require('electron')
ipcMain.on('set-ignore-mouse-events', (event, ...args) => {
BrowserWindow.fromWebContents(event.sender).setIgnoreMouseEvents(...args)
})
```

View File

@@ -9,7 +9,7 @@ with the operating system so that you can customize the operations for various
shortcuts.
**Note:** The shortcut is global; it will work even if the app does
not have the keyboard focus. You should not use this module until the `ready`
not have the keyboard focus. This module cannot be used before the `ready`
event of the app module is emitted.
```javascript

View File

@@ -91,7 +91,7 @@ Removes listeners of the specified `channel`.
### `ipcMain.handle(channel, listener)`
* `channel` String
* `listener` Function<Promise<void> | any>
* `listener` Function<Promise\<void> | any>
* `event` IpcMainInvokeEvent
* `...args` any[]
@@ -123,7 +123,7 @@ WebContents is the source of the invoke request.
### `ipcMain.handleOnce(channel, listener)`
* `channel` String
* `listener` Function<Promise<void> | any>
* `listener` Function<Promise\<void> | any>
* `event` IpcMainInvokeEvent
* `...args` any[]

View File

@@ -61,9 +61,13 @@ Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will no
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
throw an exception.
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
> special Electron objects is deprecated, and will begin throwing an exception
> starting with Electron 9.
> **NOTE:** Sending non-standard JavaScript types such as DOM objects or
> special Electron objects will throw an exception.
>
> Since the main process does not have support for DOM objects such as
> `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
> Electron's IPC to the main process, as the main process would have no way to decode
> them. Attempting to send such objects over IPC will result in an error.
The main process handles it by listening for `channel` with the
[`ipcMain`](ipc-main.md) module.
@@ -85,9 +89,13 @@ Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will no
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
throw an exception.
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
> special Electron objects is deprecated, and will begin throwing an exception
> starting with Electron 9.
> **NOTE:** Sending non-standard JavaScript types such as DOM objects or
> special Electron objects will throw an exception.
>
> Since the main process does not have support for DOM objects such as
> `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
> Electron's IPC to the main process, as the main process would have no way to decode
> them. Attempting to send such objects over IPC will result in an error.
The main process should listen for `channel` with
[`ipcMain.handle()`](ipc-main.md#ipcmainhandlechannel-listener).
@@ -123,9 +131,13 @@ Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will no
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
throw an exception.
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
> special Electron objects is deprecated, and will begin throwing an exception
> starting with Electron 9.
> **NOTE:** Sending non-standard JavaScript types such as DOM objects or
> special Electron objects will throw an exception.
>
> Since the main process does not have support for DOM objects such as
> `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
> Electron's IPC to the main process, as the main process would have no way to decode
> them. Attempting to send such objects over IPC will result in an error.
The main process handles it by listening for `channel` with [`ipcMain`](ipc-main.md) module,
and replies by setting `event.returnValue`.

View File

@@ -22,8 +22,10 @@ Sets `menu` as the application menu on macOS. On Windows and Linux, the
Also on Windows and Linux, you can use a `&` in the top-level item name to
indicate which letter should get a generated accelerator. For example, using
`&File` for the file menu would result in a generated `Alt-F` accelerator that
opens the associated menu. The indicated character in the button label gets an
underline. The `&` character is not displayed on the button label.
opens the associated menu. The indicated character in the button label then gets an
underline, and the `&` character is not displayed on the button label.
In order to escape the `&` character in an item name, add a proceeding `&`. For example, `&&File` would result in `&File` displayed on the button label.
Passing `null` will suppress the default menu. On Windows and Linux,
this has the additional effect of removing the menu bar from the window.
@@ -141,13 +143,7 @@ can have a submenu.
## Examples
The `Menu` class is only available in the main process, but you can also use it
in the render process via the [`remote`](remote.md) module.
### Main process
An example of creating the application menu in the main process with the
simple template API:
An example of creating the application menu with the simple template API:
```javascript
const { app, Menu } = require('electron')
@@ -257,26 +253,36 @@ Menu.setApplicationMenu(menu)
### Render process
Below is an example of creating a menu dynamically in a web page
(render process) by using the [`remote`](remote.md) module, and showing it when
the user right clicks the page:
To create menus initiated by the renderer process, send the required
information to the main process using IPC and have the main process display the
menu on behalf of the renderer.
```html
<!-- index.html -->
<script>
const { remote } = require('electron')
const { Menu, MenuItem } = remote
const menu = new Menu()
menu.append(new MenuItem({ label: 'MenuItem1', click() { console.log('item 1 clicked') } }))
menu.append(new MenuItem({ type: 'separator' }))
menu.append(new MenuItem({ label: 'MenuItem2', type: 'checkbox', checked: true }))
Below is an example of showing a menu when the user right clicks the page:
```js
// renderer
window.addEventListener('contextmenu', (e) => {
e.preventDefault()
menu.popup({ window: remote.getCurrentWindow() })
}, false)
</script>
ipcRenderer.send('show-context-menu')
})
ipcRenderer.on('context-menu-command', (e, command) => {
// ...
})
// main
ipcMain.on('show-context-menu', (event) => {
const template = [
{
label: 'Menu Item 1',
click: () => { event.sender.send('context-menu-command', 'menu-item-1') }
},
{ type: 'separator' },
{ label: 'Menu Item 2', type: 'checkbox', checked: true }
]
const menu = Menu.buildFromTemplate(template)
menu.popup(BrowserWindow.fromWebContents(event.sender))
})
```
## Notes on macOS Application Menu

View File

@@ -1,10 +0,0 @@
## Modernization
The Electron team is currently undergoing an initiative to modernize our API in a few concrete ways. These include: updating our modules to use idiomatic JS properties instead of separate `getPropertyX` and `setpropertyX`, converting callbacks to promises, and removing some other anti-patterns present in our APIs. The current status of the Promise initiative can be tracked in the [promisification](promisification.md) tracking file.
As we work to perform these updates, we seek to create the least disruptive amount of change at any given time, so as many changes as possible will be introduced in a backward compatible manner and deprecated after enough time has passed to give users a chance to upgrade their API calls.
This document and its child documents will be updated to reflect the latest status of our API changes.
* [Promisification](promisification.md)
* [Property Updates](property-updates.md)

View File

@@ -1,42 +0,0 @@
## Promisification
The Electron team recently underwent an initiative to convert callback-based APIs to Promise-based ones. See converted functions below:
- [app.getFileIcon(path[, options], callback)](https://github.com/electron/electron/blob/master/docs/api/app.md#getFileIcon)
- [contents.capturePage([rect, ]callback)](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#capturePage)
- [contents.executeJavaScript(code[, userGesture, callback])](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#executeJavaScript)
- [contents.printToPDF(options, callback)](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#printToPDF)
- [contents.savePage(fullPath, saveType, callback)](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#savePage)
- [contentTracing.getCategories(callback)](https://github.com/electron/electron/blob/master/docs/api/content-tracing.md#getCategories)
- [contentTracing.startRecording(options, callback)](https://github.com/electron/electron/blob/master/docs/api/content-tracing.md#startRecording)
- [contentTracing.stopRecording(resultFilePath, callback)](https://github.com/electron/electron/blob/master/docs/api/content-tracing.md#stopRecording)
- [contentTracing.getTraceBufferUsage(callback)](https://github.com/electron/electron/blob/master/docs/api/content-tracing.md#getTraceBufferUsage)
- [cookies.flushStore(callback)](https://github.com/electron/electron/blob/master/docs/api/cookies.md#flushStore)
- [cookies.get(filter, callback)](https://github.com/electron/electron/blob/master/docs/api/cookies.md#get)
- [cookies.remove(url, name, callback)](https://github.com/electron/electron/blob/master/docs/api/cookies.md#remove)
- [cookies.set(details, callback)](https://github.com/electron/electron/blob/master/docs/api/cookies.md#set)
- [debugger.sendCommand(method[, commandParams, callback])](https://github.com/electron/electron/blob/master/docs/api/debugger.md#sendCommand)
- [desktopCapturer.getSources(options, callback)](https://github.com/electron/electron/blob/master/docs/api/desktop-capturer.md#getSources)
- [dialog.showOpenDialog([browserWindow, ]options[, callback])](https://github.com/electron/electron/blob/master/docs/api/dialog.md#showOpenDialog)
- [dialog.showSaveDialog([browserWindow, ]options[, callback])](https://github.com/electron/electron/blob/master/docs/api/dialog.md#showSaveDialog)
- [inAppPurchase.purchaseProduct(productID, quantity, callback)](https://github.com/electron/electron/blob/master/docs/api/in-app-purchase.md#purchaseProduct)
- [inAppPurchase.getProducts(productIDs, callback)](https://github.com/electron/electron/blob/master/docs/api/in-app-purchase.md#getProducts)
- [dialog.showMessageBox([browserWindow, ]options[, callback])](https://github.com/electron/electron/blob/master/docs/api/dialog.md#showMessageBox)
- [dialog.showCertificateTrustDialog([browserWindow, ]options, callback)](https://github.com/electron/electron/blob/master/docs/api/dialog.md#showCertificateTrustDialog)
- [netLog.stopLogging([callback])](https://github.com/electron/electron/blob/master/docs/api/net-log.md#stopLogging)
- [protocol.isProtocolHandled(scheme, callback)](https://github.com/electron/electron/blob/master/docs/api/protocol.md#isProtocolHandled)
- [ses.clearHostResolverCache([callback])](https://github.com/electron/electron/blob/master/docs/api/session.md#clearHostResolverCache)
- [ses.clearStorageData([options, callback])](https://github.com/electron/electron/blob/master/docs/api/session.md#clearStorageData)
- [ses.setProxy(config, callback)](https://github.com/electron/electron/blob/master/docs/api/session.md#setProxy)
- [ses.resolveProxy(url, callback)](https://github.com/electron/electron/blob/master/docs/api/session.md#resolveProxy)
- [ses.getCacheSize(callback)](https://github.com/electron/electron/blob/master/docs/api/session.md#getCacheSize)
- [ses.clearAuthCache(options[, callback])](https://github.com/electron/electron/blob/master/docs/api/session.md#clearAuthCache)
- [ses.clearCache(callback)](https://github.com/electron/electron/blob/master/docs/api/session.md#clearCache)
- [ses.getBlobData(identifier, callback)](https://github.com/electron/electron/blob/master/docs/api/session.md#getBlobData)
- [shell.openExternal(url[, options, callback])](https://github.com/electron/electron/blob/master/docs/api/shell.md#openExternal)
- [webFrame.executeJavaScript(code[, userGesture, callback])](https://github.com/electron/electron/blob/master/docs/api/web-frame.md#executeJavaScript)
- [webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])](https://github.com/electron/electron/blob/master/docs/api/web-frame.md#executeJavaScriptInIsolatedWorld)
- [webviewTag.capturePage([rect, ]callback)](https://github.com/electron/electron/blob/master/docs/api/webview-tag.md#capturePage)
- [webviewTag.executeJavaScript(code[, userGesture, callback])](https://github.com/electron/electron/blob/master/docs/api/webview-tag.md#executeJavaScript)
- [webviewTag.printToPDF(options, callback)](https://github.com/electron/electron/blob/master/docs/api/webview-tag.md#printToPDF)
- [win.capturePage([rect, ]callback)](https://github.com/electron/electron/blob/master/docs/api/browser-window.md#capturePage)

View File

@@ -1,41 +0,0 @@
## Property Updates
The Electron team is currently undergoing an initiative to convert separate getter and setter functions in Electron to bespoke properties with `get` and `set` functionality. During this transition period, both the new properties and old getters and setters of these functions will work correctly and be documented.
## Candidates
* `BrowserWindow`
* `menubarVisible`
* `crashReporter` module
* `uploadToServer`
* `webFrame` modules
* `zoomFactor`
* `zoomLevel`
* `audioMuted`
* `<webview>`
* `zoomFactor`
* `zoomLevel`
* `audioMuted`
## Converted Properties
* `app` module
* `accessibilitySupport`
* `applicationMenu`
* `badgeCount`
* `name`
* `DownloadItem` class
* `savePath`
* `BrowserWindow` module
* `autohideMenuBar`
* `resizable`
* `maximizable`
* `minimizable`
* `fullscreenable`
* `movable`
* `closable`
* `backgroundThrottling`
* `NativeImage`
* `isMacTemplateImage`
* `SystemPreferences` module
* `appLevelAppearance`

View File

@@ -8,19 +8,19 @@ Process: [Main](../glossary.md#main-process)
The `powerMonitor` module emits the following events:
### Event: 'suspend'
### Event: 'suspend' _macOS_ _Windows_
Emitted when the system is suspending.
### Event: 'resume'
### Event: 'resume' _macOS_ _Windows_
Emitted when system is resuming.
### Event: 'on-ac' _Windows_
### Event: 'on-ac' _macOS_ _Windows_
Emitted when the system changes to AC power.
### Event: 'on-battery' _Windows_
### Event: 'on-battery' _macOS_ _Windows_
Emitted when system changes to battery power.

View File

@@ -88,26 +88,17 @@ and preload.js:
```js
// This file is loaded whenever a javascript context is created. It runs in a
// private scope that can access a subset of Electron renderer APIs. We must be
// careful to not leak any objects into the global scope!
const { ipcRenderer, remote } = require('electron')
const fs = remote.require('fs')
// read a configuration file using the `fs` module
const buf = fs.readFileSync('allowed-popup-urls.json')
const allowedUrls = JSON.parse(buf.toString('utf8'))
// private scope that can access a subset of Electron renderer APIs. Without
// contextIsolation enabled, it's possible to accidentally leak privileged
// globals like ipcRenderer to web content.
const { ipcRenderer } = require('electron')
const defaultWindowOpen = window.open
function customWindowOpen (url, ...args) {
if (allowedUrls.indexOf(url) === -1) {
ipcRenderer.sendSync('blocked-popup-notification', location.origin, url)
return null
}
return defaultWindowOpen(url, ...args)
window.open = function customWindowOpen (url, ...args) {
ipcRenderer.send('report-window-open', location.origin, url, args)
return defaultWindowOpen(url + '?from_electron=1', ...args)
}
window.open = customWindowOpen
```
Important things to notice in the preload script:
@@ -115,8 +106,6 @@ Important things to notice in the preload script:
- Even though the sandboxed renderer doesn't have Node.js running, it still has
access to a limited node-like environment: `Buffer`, `process`, `setImmediate`,
`clearImmediate` and `require` are available.
- The preload script can indirectly access all APIs from the main process through the
`remote` and `ipcRenderer` modules.
- The preload script must be contained in a single script, but it is possible to have
complex preload code composed with multiple modules by using a tool like
webpack or browserify. An example of using browserify is below.
@@ -144,15 +133,12 @@ following modules:
- `desktopCapturer`
- `ipcRenderer`
- `nativeImage`
- `remote`
- `webFrame`
- `events`
- `timers`
- `url`
More may be added as needed to expose more Electron APIs in the sandbox, but any
module in the main process can already be used through
`electron.remote.require`.
More may be added as needed to expose more Electron APIs in the sandbox.
## Rendering untrusted content

View File

@@ -349,6 +349,7 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
* `handler` Function | null
* `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.
* `media` - Request access to media devices such as camera, microphone and speakers.
* `mediaKeySystem` - Request access to DRM protected content.
* `geolocation` - Request access to user's current location.
@@ -384,7 +385,7 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
#### `ses.setPermissionCheckHandler(handler)`
* `handler` Function<Boolean> | null
* `handler` Function\<Boolean> | null
* `webContents` [WebContents](web-contents.md) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin.
* `permission` String - Enum of 'media'.
* `requestingOrigin` String - The origin URL of the permission check
@@ -567,9 +568,13 @@ will not work on non-persistent (in-memory) sessions.
**Note:** On macOS and Windows 10 this word will be removed from the OS custom dictionary as well
#### `ses.loadExtension(path)`
#### `ses.loadExtension(path[, options])`
* `path` String - Path to a directory containing an unpacked Chrome extension
* `options` Object (optional)
* `allowFileAccess` Boolean - Whether to allow the extension to read local files over `file://`
protocol and inject content scripts into `file://` pages. This is required e.g. for loading
devtools extensions on `file://` URLs. Defaults to false.
Returns `Promise<Extension>` - resolves when the extension is loaded.
@@ -592,7 +597,11 @@ const { app, session } = require('electron')
const path = require('path')
app.on('ready', async () => {
await session.defaultSession.loadExtension(path.join(__dirname, 'react-devtools'))
await session.defaultSession.loadExtension(
path.join(__dirname, 'react-devtools'),
// allowFileAccess is required to load the devtools extension on file:// URLs.
{ allowFileAccess: true }
)
// Note that in order to use the React DevTools extension, you'll need to
// download and unzip a copy of the extension.
})

View File

@@ -1,5 +1,6 @@
# IpcMainEvent Object extends `Event`
* `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

View File

@@ -1,4 +1,5 @@
# IpcMainInvokeEvent Object extends `Event`
* `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
* `sender` WebContents - Returns the `webContents` that sent the message

View File

@@ -1,5 +0,0 @@
# StreamProtocolResponse Object
* `statusCode` Number (optional) - The HTTP response code.
* `headers` Record<String, String | String[]> (optional) - An object containing the response headers.
* `data` ReadableStream | null - A Node.js readable stream representing the response body.

View File

@@ -1,5 +0,0 @@
# StringProtocolResponse Object
* `mimeType` String (optional) - MIME type of the response.
* `charset` String (optional) - Charset of the response.
* `data` String | null - A string representing the response body.

View File

@@ -9,7 +9,7 @@ the [native modules](../tutorial/using-native-node-modules.md)).
Electron also provides some extra built-in modules for developing native
desktop applications. Some modules are only available in the main process, some
are only available in the renderer process (web page), and some can be used in
both processes.
either process type.
The basic rule is: if a module is [GUI][gui] or low-level system related, then
it should be only available in the main process. You need to be familiar with
@@ -29,15 +29,15 @@ app.whenReady().then(() => {
```
The renderer process is no different than a normal web page, except for the
extra ability to use node modules:
extra ability to use node modules if `nodeIntegration` is enabled:
```html
<!DOCTYPE html>
<html>
<body>
<script>
const { app } = require('electron').remote
console.log(app.getVersion())
const fs = require('fs')
console.log(fs.readFileSync(__filename, 'utf8'))
</script>
</body>
</html>

View File

@@ -42,7 +42,8 @@ returns `null`.
* `id` Integer
Returns `WebContents` - A WebContents instance with the given ID.
Returns `WebContents` | undefined - A WebContents instance with the given ID, or
`undefined` if there is no WebContents associated with the given ID.
## Class: WebContents
@@ -364,7 +365,7 @@ Returns:
* `killed` - Process was sent a SIGTERM or otherwise killed externally
* `crashed` - Process crashed
* `oom` - Process ran out of memory
* `launch-failure` - Process never successfully launched
* `launch-failed` - Process never successfully launched
* `integrity-failure` - Windows code integrity checks failed
Emitted when the renderer process unexpectedly disappears. This is normally
@@ -784,7 +785,7 @@ Returns:
Emitted when `desktopCapturer.getSources()` is called in the renderer process.
Calling `event.preventDefault()` will make it return empty sources.
#### Event: 'remote-require'
#### Event: 'remote-require' _Deprecated_
Returns:
@@ -795,7 +796,7 @@ Emitted when `remote.require()` is called in the renderer process.
Calling `event.preventDefault()` will prevent the module from being returned.
Custom value can be returned by setting `event.returnValue`.
#### Event: 'remote-get-global'
#### Event: 'remote-get-global' _Deprecated_
Returns:
@@ -806,7 +807,7 @@ Emitted when `remote.getGlobal()` is called in the renderer process.
Calling `event.preventDefault()` will prevent the global from being returned.
Custom value can be returned by setting `event.returnValue`.
#### Event: 'remote-get-builtin'
#### Event: 'remote-get-builtin' _Deprecated_
Returns:
@@ -817,7 +818,7 @@ Emitted when `remote.getBuiltin()` is called in the renderer process.
Calling `event.preventDefault()` will prevent the module from being returned.
Custom value can be returned by setting `event.returnValue`.
#### Event: 'remote-get-current-window'
#### Event: 'remote-get-current-window' _Deprecated_
Returns:
@@ -827,7 +828,7 @@ Emitted when `remote.getCurrentWindow()` is called in the renderer process.
Calling `event.preventDefault()` will prevent the object from being returned.
Custom value can be returned by setting `event.returnValue`.
#### Event: 'remote-get-current-web-contents'
#### Event: 'remote-get-current-web-contents' _Deprecated_
Returns:
@@ -998,6 +999,34 @@ Navigates to the specified offset from the "current entry".
Returns `Boolean` - Whether the renderer process has crashed.
#### `contents.forcefullyCrashRenderer()`
Forcefully terminates the renderer process that is currently hosting this
`webContents`. This will cause the `render-process-gone` event to be emitted
with the `reason=killed || reason=crashed`. Please note that some webContents share renderer
processes and therefore calling this method may also crash the host process
for other webContents as well.
Calling `reload()` immediately after calling this
method will force the reload to occur in a new process. This should be used
when this process is unstable or unusable, for instance in order to recover
from the `unresponsive` event.
```js
contents.on('unresponsive', async () => {
const { response } = await dialog.showMessageBox({
message: 'App X has become unresponsive',
title: 'Do you want to try forcefully reloading the app?',
buttons: ['OK', 'Cancel'],
cancelId: 1
})
if (response === 0) {
contents.forcefullyCrashRenderer()
contents.reload()
}
})
```
#### `contents.setUserAgent(userAgent)`
* `userAgent` String
@@ -1296,9 +1325,9 @@ Returns [`PrinterInfo[]`](structures/printer-info.md)
* `pagesPerSheet` Number (optional) - The number of pages to print per page sheet.
* `collate` Boolean (optional) - Whether the web page should be collated.
* `copies` Number (optional) - The number of copies of the web page to print.
* `pageRanges` Record<string, number> (optional) - The page range to print.
* `from` Number - the start page.
* `to` Number - the end page.
* `pageRanges` Object[] (optional) - The page range to print. On macOS, only one range is honored.
* `from` Number - Index of the first page to print (0-based).
* `to` Number - Index of the last page to print (inclusive) (0-based).
* `duplexMode` String (optional) - Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or `longEdge`.
* `dpi` Record<string, number> (optional)
* `horizontal` Number (optional) - The horizontal dpi.
@@ -1324,10 +1353,10 @@ Example usage:
const options = {
silent: true,
deviceName: 'My-Printer',
pageRanges: {
pageRanges: [{
from: 0,
to: 1
}
}]
}
win.webContents.print(options, (success, errorType) => {
if (!success) console.log(errorType)
@@ -1345,8 +1374,8 @@ win.webContents.print(options, (success, errorType) => {
default margin, 1 for no margin, and 2 for minimum margin.
* `scaleFactor` Number (optional) - The scale factor of the web page. Can range from 0 to 100.
* `pageRanges` Record<string, number> (optional) - The page range to print.
* `from` Number - zero-based index of the first page to print.
* `to` Number - zero-based index of the last page to print (inclusive).
* `from` Number - Index of the first page to print (0-based).
* `to` Number - Index of the last page to print (inclusive) (0-based).
* `pageSize` String | Size (optional) - Specify page size of the generated PDF. Can be `A3`,
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and `width` in microns.
* `printBackground` Boolean (optional) - Whether to print CSS backgrounds.
@@ -1453,7 +1482,7 @@ An example of showing devtools in a `<webview>` tag:
<webview id="browser" src="https://github.com"></webview>
<webview id="devtools" src="about:blank"></webview>
<script>
const { webContents } = require('electron').remote
const { ipcRenderer } = require('electron')
const emittedOnce = (element, eventName) => new Promise(resolve => {
element.addEventListener(eventName, event => resolve(event), { once: true })
})
@@ -1462,16 +1491,26 @@ An example of showing devtools in a `<webview>` tag:
const browserReady = emittedOnce(browserView, 'dom-ready')
const devtoolsReady = emittedOnce(devtoolsView, 'dom-ready')
Promise.all([browserReady, devtoolsReady]).then(() => {
const browser = webContents.fromId(browserView.getWebContentsId())
const devtools = webContents.fromId(devtoolsView.getWebContentsId())
browser.setDevToolsWebContents(devtools)
browser.openDevTools()
const targetId = browserView.getWebContentsId()
const devtoolsId = devtoolsView.getWebContentsId()
ipcRenderer.send('open-devtools', targetId, devtoolsId)
})
</script>
</body>
</html>
```
```js
// Main process
const { ipcMain, webContents } = require('electron')
ipcMain.on('open-devtools', (event, targetContentsId, devtoolsContentsId) => {
const target = webContents.fromId(targetContentsId)
const devtools = webContents.fromId(devtoolsContentsId)
target.setDevToolsWebContents(devtools)
target.openDevTools()
})
```
An example of showing devtools in a `BrowserWindow`:
```js
@@ -1556,8 +1595,7 @@ included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
throw an exception.
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
> special Electron objects is deprecated, and will begin throwing an exception
> starting with Electron 9.
> special Electron objects will throw an exception.
The renderer process can handle the message by listening to `channel` with the
[`ipcRenderer`](ipc-renderer.md) module.
@@ -1593,7 +1631,9 @@ app.whenReady().then(() => {
#### `contents.sendToFrame(frameId, channel, ...args)`
* `frameId` Integer
* `frameId` Integer | [number, number] - the ID of the frame to send to, or a
pair of `[processId, frameId]` if the frame is in a different process to the
main frame.
* `channel` String
* `...args` any[]
@@ -1603,9 +1643,8 @@ Send an asynchronous message to a specific frame in a renderer process via
chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or
WeakSets will throw an exception.
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
> special Electron objects is deprecated, and will begin throwing an exception
> starting with Electron 9.
> **NOTE:** Sending non-standard JavaScript types such as DOM objects or
> special Electron objects will throw an exception.
The renderer process can handle the message by listening to `channel` with the
[`ipcRenderer`](ipc-renderer.md) module.
@@ -1767,7 +1806,7 @@ Returns `Boolean` - If *offscreen rendering* is enabled returns whether it is cu
* `fps` Integer
If *offscreen rendering* is enabled sets the frame rate to the specified number.
Only values between 1 and 60 are accepted.
Only values between 1 and 240 are accepted.
#### `contents.getFrameRate()`
@@ -1865,7 +1904,7 @@ The zoom factor is the zoom percent divided by 100, so 300% = 3.0.
#### `contents.frameRate`
An `Integer` property that sets the frame rate of the web contents to the specified number.
Only values between 1 and 60 are accepted.
Only values between 1 and 240 are accepted.
Only applicable if *offscreen rendering* is enabled.

View File

@@ -137,7 +137,7 @@ This option is disabled by default in the guest page.
```
A `Boolean`. When this attribute is `false` the guest page in `webview` will not have access
to the [`remote`](remote.md) module. The remote module is available by default.
to the [`remote`](remote.md) module. The remote module is unavailable by default.
### `plugins`
@@ -560,9 +560,9 @@ Stops any `findInPage` request for the `webview` with the provided `action`.
* `pagesPerSheet` Number (optional) - The number of pages to print per page sheet.
* `collate` Boolean (optional) - Whether the web page should be collated.
* `copies` Number (optional) - The number of copies of the web page to print.
* `pageRanges` Record<string, number> (optional) - The page range to print.
* `from` Number - zero-based index of the first page to print.
* `to` Number - zero-based index of the last page to print (inclusive).
* `pageRanges` Object[] (optional) - The page range to print.
* `from` Number - Index of the first page to print (0-based).
* `to` Number - Index of the last page to print (inclusive) (0-based).
* `duplexMode` String (optional) - Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or `longEdge`.
* `dpi` Record<string, number> (optional)
* `horizontal` Number (optional) - The horizontal dpi.
@@ -588,8 +588,8 @@ Prints `webview`'s web page. Same as `webContents.print([options])`.
and `width` in microns.
* `scaleFactor` Number (optional) - The scale factor of the web page. Can range from 0 to 100.
* `pageRanges` Record<string, number> (optional) - The page range to print.
* `from` Number - the first page to print.
* `to` Number - the last page to print (inclusive).
* `from` Number - Index of the first page to print (0-based).
* `to` Number - Index of the last page to print (inclusive) (0-based).
* `pageSize` String | Size (optional) - Specify page size of the generated PDF. Can be `A3`,
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`
* `printBackground` Boolean (optional) - Whether to print CSS backgrounds.
@@ -968,4 +968,4 @@ Emitted when DevTools is closed.
Emitted when DevTools is focused / opened.
[runtime-enabled-features]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70
[chrome-webview]: https://developer.chrome.com/apps/tags/webview
[chrome-webview]: https://developer.chrome.com/docs/extensions/reference/webviewTag/

View File

@@ -1,61 +0,0 @@
# Breaking changes (NetworkService) (Draft)
This document describes changes to Electron APIs after migrating network code
to NetworkService API.
We don't currently have an estimate of when we will enable `NetworkService` by
default in Electron, but as Chromium is already removing non-`NetworkService`
code, we might switch before Electron 10.
The content of this document should be moved to `breaking-changes.md` once we have
determined when to enable `NetworkService` in Electron.
## Planned Breaking API Changes
### `protocol.unregisterProtocol`
### `protocol.uninterceptProtocol`
The APIs are now synchronous and the optional callback is no longer needed.
```javascript
// Deprecated
protocol.unregisterProtocol(scheme, () => { /* ... */ })
// Replace with
protocol.unregisterProtocol(scheme)
```
### `protocol.registerFileProtocol`
### `protocol.registerBufferProtocol`
### `protocol.registerStringProtocol`
### `protocol.registerHttpProtocol`
### `protocol.registerStreamProtocol`
### `protocol.interceptFileProtocol`
### `protocol.interceptStringProtocol`
### `protocol.interceptBufferProtocol`
### `protocol.interceptHttpProtocol`
### `protocol.interceptStreamProtocol`
The APIs are now synchronous and the optional callback is no longer needed.
```javascript
// Deprecated
protocol.registerFileProtocol(scheme, handler, () => { /* ... */ })
// Replace with
protocol.registerFileProtocol(scheme, handler)
```
The registered or intercepted protocol does not have effect on current page
until navigation happens.
### `protocol.isProtocolHandled`
This API is deprecated and users should use `protocol.isProtocolRegistered`
and `protocol.isProtocolIntercepted` instead.
```javascript
// Deprecated
protocol.isProtocolHandled(scheme).then(() => { /* ... */ })
// Replace with
const isRegistered = protocol.isProtocolRegistered(scheme)
const isIntercepted = protocol.isProtocolIntercepted(scheme)
```

View File

@@ -133,6 +133,54 @@ const w = new BrowserWindow({
We [recommend moving away from the remote
module](https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31).
### `protocol.unregisterProtocol`
### `protocol.uninterceptProtocol`
The APIs are now synchronous and the optional callback is no longer needed.
```javascript
// Deprecated
protocol.unregisterProtocol(scheme, () => { /* ... */ })
// Replace with
protocol.unregisterProtocol(scheme)
```
### `protocol.registerFileProtocol`
### `protocol.registerBufferProtocol`
### `protocol.registerStringProtocol`
### `protocol.registerHttpProtocol`
### `protocol.registerStreamProtocol`
### `protocol.interceptFileProtocol`
### `protocol.interceptStringProtocol`
### `protocol.interceptBufferProtocol`
### `protocol.interceptHttpProtocol`
### `protocol.interceptStreamProtocol`
The APIs are now synchronous and the optional callback is no longer needed.
```javascript
// Deprecated
protocol.registerFileProtocol(scheme, handler, () => { /* ... */ })
// Replace with
protocol.registerFileProtocol(scheme, handler)
```
The registered or intercepted protocol does not have effect on current page
until navigation happens.
### `protocol.isProtocolHandled`
This API is deprecated and users should use `protocol.isProtocolRegistered`
and `protocol.isProtocolIntercepted` instead.
```javascript
// Deprecated
protocol.isProtocolHandled(scheme).then(() => { /* ... */ })
// Replace with
const isRegistered = protocol.isProtocolRegistered(scheme)
const isIntercepted = protocol.isProtocolIntercepted(scheme)
```
## Planned Breaking API Changes (9.0)
### Default Changed: Loading non-context-aware native modules in the renderer process is disabled by default
@@ -147,6 +195,45 @@ you should plan to update your native modules to be context aware.
For more detailed information see [#18397](https://github.com/electron/electron/issues/18397).
### Deprecated: `BrowserWindow` extension APIs
The following extension APIs have been deprecated:
* `BrowserWindow.addExtension(path)`
* `BrowserWindow.addDevToolsExtension(path)`
* `BrowserWindow.removeExtension(name)`
* `BrowserWindow.removeDevToolsExtension(name)`
* `BrowserWindow.getExtensions()`
* `BrowserWindow.getDevToolsExtensions()`
Use the session APIs instead:
* `ses.loadExtension(path)`
* `ses.removeExtension(extension_id)`
* `ses.getAllExtensions()`
```js
// Deprecated in Electron 9
BrowserWindow.addExtension(path)
BrowserWindow.addDevToolsExtension(path)
// Replace with
session.defaultSession.loadExtension(path)
```
```js
// Deprecated in Electron 9
BrowserWindow.removeExtension(name)
BrowserWindow.removeDevToolsExtension(name)
// Replace with
session.defaultSession.removeExtension(extension_id)
```
```js
// Deprecated in Electron 9
BrowserWindow.getExtensions()
BrowserWindow.getDevToolsExtensions()
// Replace with
session.defaultSession.getAllExtensions()
```
### Removed: `<webview>.getWebContents()`
This API, which was deprecated in Electron 8.0, is now removed.
@@ -290,6 +377,52 @@ in Electron 8.x, and cease to exist in Electron 9.x. The layout zoom level
limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined
[here](https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11).
### Deprecated events in `systemPreferences`
The following `systemPreferences` events have been deprecated:
* `inverted-color-scheme-changed`
* `high-contrast-color-scheme-changed`
Use the new `updated` event on the `nativeTheme` module instead.
```js
// Deprecated
systemPreferences.on('inverted-color-scheme-changed', () => { /* ... */ })
systemPreferences.on('high-contrast-color-scheme-changed', () => { /* ... */ })
// Replace with
nativeTheme.on('updated', () => { /* ... */ })
```
### Deprecated: methods in `systemPreferences`
The following `systemPreferences` methods have been deprecated:
* `systemPreferences.isDarkMode()`
* `systemPreferences.isInvertedColorScheme()`
* `systemPreferences.isHighContrastColorScheme()`
Use the following `nativeTheme` properties instead:
* `nativeTheme.shouldUseDarkColors`
* `nativeTheme.shouldUseInvertedColorScheme`
* `nativeTheme.shouldUseHighContrastColors`
```js
// Deprecated
systemPreferences.isDarkMode()
// Replace with
nativeTheme.shouldUseDarkColors
// Deprecated
systemPreferences.isInvertedColorScheme()
// Replace with
nativeTheme.shouldUseInvertedColorScheme
// Deprecated
systemPreferences.isHighContrastColorScheme()
// Replace with
nativeTheme.shouldUseHighContrastColors
```
## Planned Breaking API Changes (7.0)
### Deprecated: Atom.io Node Headers URL
@@ -386,6 +519,55 @@ Note that `webkitdirectory` no longer exposes the path to the selected folder.
If you require the path to the selected folder rather than the folder contents,
see the `dialog.showOpenDialog` API ([link](https://github.com/electron/electron/blob/master/docs/api/dialog.md#dialogshowopendialogbrowserwindow-options)).
### API Changed: Callback-based versions of promisified APIs
Electron 5 and Electron 6 introduced Promise-based versions of existing
asynchronous APIs and deprecated their older, callback-based counterparts.
In Electron 7, all deprecated callback-based APIs are now removed.
These functions now only return Promises:
* `app.getFileIcon()` [#15742](https://github.com/electron/electron/pull/15742)
* `app.dock.show()` [#16904](https://github.com/electron/electron/pull/16904)
* `contentTracing.getCategories()` [#16583](https://github.com/electron/electron/pull/16583)
* `contentTracing.getTraceBufferUsage()` [#16600](https://github.com/electron/electron/pull/16600)
* `contentTracing.startRecording()` [#16584](https://github.com/electron/electron/pull/16584)
* `contentTracing.stopRecording()` [#16584](https://github.com/electron/electron/pull/16584)
* `contents.executeJavaScript()` [#17312](https://github.com/electron/electron/pull/17312)
* `cookies.flushStore()` [#16464](https://github.com/electron/electron/pull/16464)
* `cookies.get()` [#16464](https://github.com/electron/electron/pull/16464)
* `cookies.remove()` [#16464](https://github.com/electron/electron/pull/16464)
* `cookies.set()` [#16464](https://github.com/electron/electron/pull/16464)
* `debugger.sendCommand()` [#16861](https://github.com/electron/electron/pull/16861)
* `dialog.showCertificateTrustDialog()` [#17181](https://github.com/electron/electron/pull/17181)
* `inAppPurchase.getProducts()` [#17355](https://github.com/electron/electron/pull/17355)
* `inAppPurchase.purchaseProduct()`[#17355](https://github.com/electron/electron/pull/17355)
* `netLog.stopLogging()` [#16862](https://github.com/electron/electron/pull/16862)
* `session.clearAuthCache()` [#17259](https://github.com/electron/electron/pull/17259)
* `session.clearCache()` [#17185](https://github.com/electron/electron/pull/17185)
* `session.clearHostResolverCache()` [#17229](https://github.com/electron/electron/pull/17229)
* `session.clearStorageData()` [#17249](https://github.com/electron/electron/pull/17249)
* `session.getBlobData()` [#17303](https://github.com/electron/electron/pull/17303)
* `session.getCacheSize()` [#17185](https://github.com/electron/electron/pull/17185)
* `session.resolveProxy()` [#17222](https://github.com/electron/electron/pull/17222)
* `session.setProxy()` [#17222](https://github.com/electron/electron/pull/17222)
* `shell.openExternal()` [#16176](https://github.com/electron/electron/pull/16176)
* `webContents.loadFile()` [#15855](https://github.com/electron/electron/pull/15855)
* `webContents.loadURL()` [#15855](https://github.com/electron/electron/pull/15855)
* `webContents.hasServiceWorker()` [#16535](https://github.com/electron/electron/pull/16535)
* `webContents.printToPDF()` [#16795](https://github.com/electron/electron/pull/16795)
* `webContents.savePage()` [#16742](https://github.com/electron/electron/pull/16742)
* `webFrame.executeJavaScript()` [#17312](https://github.com/electron/electron/pull/17312)
* `webFrame.executeJavaScriptInIsolatedWorld()` [#17312](https://github.com/electron/electron/pull/17312)
* `webviewTag.executeJavaScript()` [#17312](https://github.com/electron/electron/pull/17312)
* `win.capturePage()` [#15743](https://github.com/electron/electron/pull/15743)
These functions now have two forms, synchronous and Promise-based asynchronous:
* `dialog.showMessageBox()`/`dialog.showMessageBoxSync()` [#17298](https://github.com/electron/electron/pull/17298)
* `dialog.showOpenDialog()`/`dialog.showOpenDialogSync()` [#16973](https://github.com/electron/electron/pull/16973)
* `dialog.showSaveDialog()`/`dialog.showSaveDialogSync()` [#17054](https://github.com/electron/electron/pull/17054)
## Planned Breaking API Changes (6.0)
### API Changed: `win.setMenu(null)` is now `win.removeMenu()`
@@ -397,19 +579,6 @@ win.setMenu(null)
win.removeMenu()
```
### API Changed: `contentTracing.getTraceBufferUsage()` is now a promise
```js
// Deprecated
contentTracing.getTraceBufferUsage((percentage, value) => {
// do something
})
// Replace with
contentTracing.getTraceBufferUsage().then(infoObject => {
// infoObject has percentage and value fields
})
```
### API Changed: `electron.screen` in the renderer process should be accessed via `remote`
```js
@@ -546,6 +715,31 @@ webFrame.setSpellCheckProvider('en-US', {
})
```
### API Changed: `webContents.getZoomLevel` and `webContents.getZoomFactor` are now synchronous
`webContents.getZoomLevel` and `webContents.getZoomFactor` no longer take callback parameters,
instead directly returning their number values.
```js
// Deprecated
webContents.getZoomLevel((level) => {
console.log(level)
})
// Replace with
const level = webContents.getZoomLevel()
console.log(level)
```
```js
// Deprecated
webContents.getZoomFactor((factor) => {
console.log(factor)
})
// Replace with
const factor = webContents.getZoomFactor()
console.log(factor)
```
## Planned Breaking API Changes (4.0)
The following list includes the breaking API changes made in Electron 4.0.

View File

@@ -177,12 +177,12 @@ $ gn gen out/Testing-x86 --args='... target_cpu = "x86"'
Not all combinations of source and target CPU/OS are supported by Chromium.
<table>
<tr><th>Host</th><th>Target</th><th>Status</th></tr>
<tr><td>Windows x64</td><td>Windows arm64</td><td>Experimental</td>
<tr><td>Windows x64</td><td>Windows x86</td><td>Automatically tested</td></tr>
<tr><td>Linux x64</td><td>Linux x86</td><td>Automatically tested</td></tr>
</table>
| Host | Target | Status |
|-------------|---------------|----------------------|
| Windows x64 | Windows arm64 | Experimental |
| Windows x64 | Windows x86 | Automatically tested |
| Linux x64 | Linux x86 | Automatically tested |
If you test other combinations and find them to work, please update this document :)

View File

@@ -42,7 +42,7 @@ $ pip install pyobjc
If you're developing Electron and don't plan to redistribute your
custom Electron build, you may skip this section.
Official Electron builds are built with [Xcode 9.4.1](http://adcdownload.apple.com/Developer_Tools/Xcode_9.4.1/Xcode_9.4.1.xip), and the macOS 10.13 SDK. Building with a newer SDK works too, but the releases currently use the 10.13 SDK.
Official Electron builds are built with [Xcode 12.2](https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip), and the macOS 11.0 SDK. Building with a newer SDK works too, but the releases currently use the 11.0 SDK.
## Building Electron

View File

@@ -69,8 +69,7 @@ way of figuring out which is which.
### Which Process Should I Attach to?
Code executed within the main process (that is, code found in or eventually run
by your main JavaScript file) as well as code called using the remote
(`require('electron').remote`) will run inside the main process, while other
by your main JavaScript file) will run inside the main process, while other
code will execute inside its respective renderer process.
You can be attached to multiple programs when you are debugging, but only one

View File

@@ -43,8 +43,8 @@ SRV*c:\code\symbols\*https://msdl.microsoft.com/download/symbols;SRV*c:\code\sym
## Using the symbol server in Visual Studio
<img src='https://mdn.mozillademos.org/files/733/symbol-server-vc8express-menu.jpg'>
<img src='https://mdn.mozillademos.org/files/2497/2005_options.gif'>
![Tools -> Options](https://mdn.mozillademos.org/files/733/symbol-server-vc8express-menu.jpg)
![Symbols Settings](https://mdn.mozillademos.org/files/2497/2005_options.gif)
## Troubleshooting: Symbols will not load

View File

@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<a href="#" id="drag">Drag me</a>
<script src="renderer.js"></script>
</body>
</html>

View File

@@ -0,0 +1,41 @@
const { app, BrowserWindow, ipcMain, nativeImage, NativeImage } = require('electron')
const fs = require('fs');
const http = require('http');
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
}
const iconName = 'iconForDragAndDrop.png';
const icon = fs.createWriteStream(`${process.cwd()}/${iconName}`);
http.get('http://img.icons8.com/ios/452/drag-and-drop.png', (response) => {
response.pipe(icon);
});
app.whenReady().then(createWindow)
ipcMain.on('ondragstart', (event, filePath) => {
event.sender.startDrag({
file: filePath,
icon: `${process.cwd()}/${iconName}`
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,9 @@
const { ipcRenderer } = require('electron')
const fs = require('fs')
document.getElementById('drag').ondragstart = (event) => {
const fileName = 'drag-and-drop.md'
fs.writeFileSync(fileName, '# Test drag and drop');
event.preventDefault()
ipcRenderer.send('ondragstart', process.cwd() + `/${fileName}`)
}

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
</body>
</html>

View File

@@ -0,0 +1,31 @@
const { app, BrowserWindow, globalShortcut } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
}
app.whenReady().then(() => {
globalShortcut.register('Alt+CommandOrControl+I', () => {
console.log('Electron loves global shortcuts!')
})
}).then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</body>
</html>

View File

@@ -0,0 +1,13 @@
const { app, BrowserWindow } = require('electron')
app.whenReady().then(() => {
const win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true } })
win.loadFile('index.html')
win.webContents.on('before-input-event', (event, input) => {
if (input.control && input.key.toLowerCase() === 'i') {
console.log('Pressed Control+I')
event.preventDefault()
}
})
})

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
</body>
</html>

View File

@@ -0,0 +1,39 @@
const { app, BrowserWindow, Menu, MenuItem } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
}
const menu = new Menu()
menu.append(new MenuItem({
label: 'Electron',
submenu: [{
role: 'help',
accelerator: process.platform === 'darwin' ? 'Alt+Cmd+I' : 'Alt+Shift+I',
click: () => { console.log('Electron rocks!') }
}]
}))
Menu.setApplicationMenu(menu)
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<link rel="stylesheet" type="text/css" href="./styles.css">
</head>
<body>
<h1>Hello World!</h1>
<p>Current theme source: <strong id="theme-source">System</strong></p>
<button id="toggle-dark-mode">Toggle Dark Mode</button>
<button id="reset-to-system">Reset to System Theme</button>
<script src="renderer.js"></script>
</body>
</body>
</html>

View File

@@ -0,0 +1,40 @@
const { app, BrowserWindow, ipcMain, nativeTheme } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
ipcMain.handle('dark-mode:toggle', () => {
if (nativeTheme.shouldUseDarkColors) {
nativeTheme.themeSource = 'light'
} else {
nativeTheme.themeSource = 'dark'
}
return nativeTheme.shouldUseDarkColors
})
ipcMain.handle('dark-mode:system', () => {
nativeTheme.themeSouce = 'system'
})
}
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,11 @@
const { ipcRenderer } = require('electron')
document.getElementById('toggle-dark-mode').addEventListener('click', async () => {
const isDarkMode = await ipcRenderer.invoke('dark-mode:toggle')
document.getElementById('theme-source').innerHTML = isDarkMode ? 'Dark' : 'Light'
})
document.getElementById('reset-to-system').addEventListener('click', async () => {
await ipcRenderer.invoke('dark-mode:system')
document.getElementById('theme-source').innerHTML = 'System'
})

View File

@@ -0,0 +1,7 @@
@media (prefers-color-scheme: dark) {
body { background: #333; color: white; }
}
@media (prefers-color-scheme: light) {
body { background: #ddd; color: black; }
}

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
</body>
</html>

View File

@@ -0,0 +1,43 @@
const { app, BrowserWindow, Menu } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
}
const dockMenu = Menu.buildFromTemplate([
{
label: 'New Window',
click () { console.log('New Window') }
}, {
label: 'New Window with Settings',
submenu: [
{ label: 'Basic' },
{ label: 'Pro' }
]
},
{ label: 'New Command...' }
])
app.whenReady().then(() => {
app.dock.setMenu(dockMenu)
}).then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
</body>
</html>

View File

@@ -0,0 +1,35 @@
const { app, BrowserWindow, Notification } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
}
function showNotification () {
const notification = {
title: 'Basic Notification',
body: 'Notification from the Main process'
}
new Notification(notification).show()
}
app.whenReady().then(createWindow).then(showNotification)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<script src="renderer.js"></script>
</body>
</html>

View File

@@ -0,0 +1,27 @@
const { app, BrowserWindow } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
}
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,7 @@
const myNotification = new Notification('Title', {
body: 'Notification from the Renderer process'
})
myNotification.onclick = () => {
console.log('Notification clicked')
}

View File

@@ -0,0 +1,15 @@
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
</body>
</html>

View File

@@ -0,0 +1,28 @@
const { app, BrowserWindow } = require('electron')
const fs = require('fs')
app.disableHardwareAcceleration()
let win
app.whenReady().then(() => {
win = new BrowserWindow({ webPreferences: { offscreen: true } })
win.loadURL('https://github.com')
win.webContents.on('paint', (event, dirty, image) => {
fs.writeFileSync('ex.png', image.toPNG())
})
win.webContents.setFrameRate(60)
console.log(`The screenshot has been successfully saved to ${process.cwd()}/ex.png`)
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<script src="renderer.js"></script>
</body>
</html>

View File

@@ -0,0 +1,24 @@
const { app, BrowserWindow, ipcMain } = require('electron')
let onlineStatusWindow
app.whenReady().then(() => {
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false, webPreferences: { nodeIntegration: true } })
onlineStatusWindow.loadURL(`file://${__dirname}/index.html`)
})
ipcMain.on('online-status-changed', (event, status) => {
console.log(status)
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,7 @@
const { ipcRenderer } = require('electron')
const updateOnlineStatus = () => { ipcRenderer.send('online-status-changed', navigator.onLine ? 'online' : 'offline') }
window.addEventListener('online', updateOnlineStatus)
window.addEventListener('offline', updateOnlineStatus)
updateOnlineStatus()

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<script src="renderer.js"></script>
</body>
</html>

View File

@@ -0,0 +1,20 @@
const { app, BrowserWindow } = require('electron')
let onlineStatusWindow
app.whenReady().then(() => {
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false })
onlineStatusWindow.loadURL(`file://${__dirname}/index.html`)
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,6 @@
const alertOnlineStatus = () => { window.alert(navigator.onLine ? 'online' : 'offline') }
window.addEventListener('online', alertOnlineStatus)
window.addEventListener('offline', alertOnlineStatus)
alertOnlineStatus()

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
</body>
</html>

View File

@@ -0,0 +1,30 @@
const { app, BrowserWindow } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
win.setProgressBar(0.5)
}
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
</body>
</html>

View File

@@ -0,0 +1,34 @@
const { app, BrowserWindow } = require('electron')
const fs = require('fs')
const path = require('path')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
}
const fileName = 'recently-used.md'
fs.writeFile(fileName, 'Lorem Ipsum', () => {
app.addRecentDocument(path.join(process.cwd(), `${fileName}`))
})
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
app.clearRecentDocuments()
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
</body>
</html>

View File

@@ -0,0 +1,33 @@
const { app, BrowserWindow } = require('electron')
const os = require('os');
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
}
app.whenReady().then(() => {
const win = new BrowserWindow()
win.setRepresentedFilename(os.homedir())
win.setDocumentEdited(true)
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})

View File

@@ -1,7 +1,11 @@
const { BrowserWindow, app } = require('electron')
const { BrowserWindow, app, screen, ipcMain } = require('electron')
let mainWindow = null
ipcMain.handle('get-screen-size', () => {
return screen.getPrimaryDisplay().workAreaSize
})
function createWindow () {
const windowOptions = {
width: 600,

View File

@@ -1,5 +1,4 @@
const { desktopCapturer } = require('electron')
const { screen, shell } = require('electron').remote
const { desktopCapturer, shell, ipcRenderer } = require('electron')
const fs = require('fs')
const os = require('os')
@@ -8,9 +7,9 @@ const path = require('path')
const screenshot = document.getElementById('screen-shot')
const screenshotMsg = document.getElementById('screenshot-path')
screenshot.addEventListener('click', (event) => {
screenshot.addEventListener('click', async (event) => {
screenshotMsg.textContent = 'Gathering screens...'
const thumbSize = determineScreenShotSize()
const thumbSize = await determineScreenShotSize()
const options = { types: ['screen'], thumbnailSize: thumbSize }
desktopCapturer.getSources(options, (error, sources) => {
@@ -33,8 +32,8 @@ screenshot.addEventListener('click', (event) => {
})
})
function determineScreenShotSize () {
const screenSize = screen.getPrimaryDisplay().workAreaSize
async function determineScreenShotSize () {
const screenSize = await ipcRenderer.invoke('get-screen-size')
const maxDimension = Math.max(screenSize.width, screenSize.height)
return {
width: maxDimension * window.devicePixelRatio,

View File

@@ -1,95 +1,95 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow, ipcMain, dialog } = require('electron')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On macOS it is common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
ipcMain.on('open-error-dialog', event => {
dialog.showErrorBox('An Error Message', 'Demonstrating an error message.')
})
ipcMain.on('open-information-dialog', event => {
const options = {
type: 'info',
title: 'Information',
message: "This is an information dialog. Isn't it nice?",
buttons: ['Yes', 'No']
}
dialog.showMessageBox(options, index => {
event.sender.send('information-dialog-selection', index)
})
})
ipcMain.on('open-file-dialog', event => {
dialog.showOpenDialog(
{
properties: ['openFile', 'openDirectory']
},
files => {
if (files) {
event.sender.send('selected-directory', files)
}
}
)
})
ipcMain.on('save-dialog', event => {
const options = {
title: 'Save an Image',
filters: [{ name: 'Images', extensions: ['jpg', 'png', 'gif'] }]
}
dialog.showSaveDialog(options, filename => {
event.sender.send('saved-file', filename)
})
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
// Modules to control application life and create native browser window
const { app, BrowserWindow, ipcMain, dialog } = require('electron')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On macOS it is common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
ipcMain.on('open-error-dialog', event => {
dialog.showErrorBox('An Error Message', 'Demonstrating an error message.')
})
ipcMain.on('open-information-dialog', event => {
const options = {
type: 'info',
title: 'Information',
message: "This is an information dialog. Isn't it nice?",
buttons: ['Yes', 'No']
}
dialog.showMessageBox(options, index => {
event.sender.send('information-dialog-selection', index)
})
})
ipcMain.on('open-file-dialog', event => {
dialog.showOpenDialog(
{
properties: ['openFile', 'openDirectory']
},
files => {
if (files) {
event.sender.send('selected-directory', files)
}
}
)
})
ipcMain.on('save-dialog', event => {
const options = {
title: 'Save an Image',
filters: [{ name: 'Images', extensions: ['jpg', 'png', 'gif'] }]
}
dialog.showSaveDialog(options, filename => {
event.sender.send('saved-file', filename)
})
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

View File

@@ -1,18 +1,18 @@
const { ipcRenderer, shell } = require('electron')
const links = document.querySelectorAll('a[href]')
const errorBtn = document.getElementById('error-dialog')
errorBtn.addEventListener('click', event => {
ipcRenderer.send('open-error-dialog')
})
Array.prototype.forEach.call(links, (link) => {
const url = link.getAttribute('href')
if (url.indexOf('http') === 0) {
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal(url)
})
}
const { ipcRenderer, shell } = require('electron')
const links = document.querySelectorAll('a[href]')
const errorBtn = document.getElementById('error-dialog')
errorBtn.addEventListener('click', event => {
ipcRenderer.send('open-error-dialog')
})
Array.prototype.forEach.call(links, (link) => {
const url = link.getAttribute('href')
if (url.indexOf('http') === 0) {
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal(url)
})
}
})

View File

@@ -1,70 +1,70 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow, ipcMain, dialog } = require('electron')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On macOS it is common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
ipcMain.on('open-information-dialog', event => {
const options = {
type: 'info',
title: 'Information',
message: "This is an information dialog. Isn't it nice?",
buttons: ['Yes', 'No']
}
dialog.showMessageBox(options, index => {
event.sender.send('information-dialog-selection', index)
})
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
// Modules to control application life and create native browser window
const { app, BrowserWindow, ipcMain, dialog } = require('electron')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On macOS it is common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
ipcMain.on('open-information-dialog', event => {
const options = {
type: 'info',
title: 'Information',
message: "This is an information dialog. Isn't it nice?",
buttons: ['Yes', 'No']
}
dialog.showMessageBox(options, index => {
event.sender.send('information-dialog-selection', index)
})
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

View File

@@ -1,25 +1,25 @@
const { ipcRenderer, shell } = require('electron')
const informationBtn = document.getElementById('information-dialog')
const links = document.querySelectorAll('a[href]')
informationBtn.addEventListener('click', event => {
ipcRenderer.send('open-information-dialog')
})
ipcRenderer.on('information-dialog-selection', (event, index) => {
let message = 'You selected '
if (index === 0) message += 'yes.'
else message += 'no.'
document.getElementById('info-selection').innerHTML = message
})
Array.prototype.forEach.call(links, (link) => {
const url = link.getAttribute('href')
if (url.indexOf('http') === 0) {
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal(url)
})
}
const { ipcRenderer, shell } = require('electron')
const informationBtn = document.getElementById('information-dialog')
const links = document.querySelectorAll('a[href]')
informationBtn.addEventListener('click', event => {
ipcRenderer.send('open-information-dialog')
})
ipcRenderer.on('information-dialog-selection', (event, index) => {
let message = 'You selected '
if (index === 0) message += 'yes.'
else message += 'no.'
document.getElementById('info-selection').innerHTML = message
})
Array.prototype.forEach.call(links, (link) => {
const url = link.getAttribute('href')
if (url.indexOf('http') === 0) {
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal(url)
})
}
})

View File

@@ -1,70 +1,70 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow, ipcMain, dialog } = require('electron')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On macOS it is common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
ipcMain.on('open-file-dialog', event => {
dialog.showOpenDialog(
{
properties: ['openFile', 'openDirectory']
},
files => {
if (files) {
event.sender.send('selected-directory', files)
}
}
)
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
// Modules to control application life and create native browser window
const { app, BrowserWindow, ipcMain, dialog } = require('electron')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On macOS it is common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
ipcMain.on('open-file-dialog', event => {
dialog.showOpenDialog(
{
properties: ['openFile', 'openDirectory']
},
files => {
if (files) {
event.sender.send('selected-directory', files)
}
}
)
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

View File

@@ -1,22 +1,22 @@
const { ipcRenderer, shell } = require('electron')
const selectDirBtn = document.getElementById('select-directory')
const links = document.querySelectorAll('a[href]')
selectDirBtn.addEventListener('click', event => {
ipcRenderer.send('open-file-dialog')
})
ipcRenderer.on('selected-directory', (event, path) => {
document.getElementById('selected-file').innerHTML = `You selected: ${path}`
})
Array.prototype.forEach.call(links, (link) => {
const url = link.getAttribute('href')
if (url.indexOf('http') === 0) {
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal(url)
})
}
})
const { ipcRenderer, shell } = require('electron')
const selectDirBtn = document.getElementById('select-directory')
const links = document.querySelectorAll('a[href]')
selectDirBtn.addEventListener('click', event => {
ipcRenderer.send('open-file-dialog')
})
ipcRenderer.on('selected-directory', (event, path) => {
document.getElementById('selected-file').innerHTML = `You selected: ${path}`
})
Array.prototype.forEach.call(links, (link) => {
const url = link.getAttribute('href')
if (url.indexOf('http') === 0) {
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal(url)
})
}
})

View File

@@ -1,66 +1,66 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow, ipcMain, dialog } = require('electron')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On macOS it is common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
ipcMain.on('save-dialog', event => {
const options = {
title: 'Save an Image',
filters: [{ name: 'Images', extensions: ['jpg', 'png', 'gif'] }]
}
dialog.showSaveDialog(options, filename => {
event.sender.send('saved-file', filename)
})
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
// Modules to control application life and create native browser window
const { app, BrowserWindow, ipcMain, dialog } = require('electron')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On macOS it is common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
ipcMain.on('save-dialog', event => {
const options = {
title: 'Save an Image',
filters: [{ name: 'Images', extensions: ['jpg', 'png', 'gif'] }]
}
dialog.showSaveDialog(options, filename => {
event.sender.send('saved-file', filename)
})
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

View File

@@ -1,23 +1,23 @@
const { ipcRenderer, shell } = require('electron')
const saveBtn = document.getElementById('save-dialog')
const links = document.querySelectorAll('a[href]')
saveBtn.addEventListener('click', event => {
ipcRenderer.send('save-dialog')
})
ipcRenderer.on('saved-file', (event, path) => {
if (!path) path = 'No path'
document.getElementById('file-saved').innerHTML = `Path selected: ${path}`
})
Array.prototype.forEach.call(links, (link) => {
const url = link.getAttribute('href')
if (url.indexOf('http') === 0) {
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal(url)
})
}
const { ipcRenderer, shell } = require('electron')
const saveBtn = document.getElementById('save-dialog')
const links = document.querySelectorAll('a[href]')
saveBtn.addEventListener('click', event => {
ipcRenderer.send('save-dialog')
})
ipcRenderer.on('saved-file', (event, path) => {
if (!path) path = 'No path'
document.getElementById('file-saved').innerHTML = `Path selected: ${path}`
})
Array.prototype.forEach.call(links, (link) => {
const url = link.getAttribute('href')
if (url.indexOf('http') === 0) {
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal(url)
})
}
})

View File

@@ -1,56 +1,56 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow } = require('electron')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On macOS it is common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
// In this file you can include the rest of your app's specific main process
// Modules to control application life and create native browser window
const { app, BrowserWindow } = require('electron')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On macOS it is common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

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