Compare commits

..

318 Commits

Author SHA1 Message Date
Sudowoodo Release Bot
58e9dedd76 Bump v15.3.7 2022-02-14 11:23:11 -08:00
Cheng Zhao
51a673e7e0 chore: cherry-pick fix for 1283375 from chromium (#32777)
Co-authored-by: Electron Bot <electron@github.com>
2022-02-14 20:04:39 +09:00
Milan Burda
fed01fb57d fix: will-attach-webview handler modifying params.instanceId does not break <webview> (#32386) (#32855) 2022-02-13 22:33:31 -08:00
Micha Hanselmann
65c9f47e15 chore: cherry-pick c1700c5 from v8 (#32770)
* chore: cherry-pick c1700c5 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-02-10 11:27:01 -05:00
Cheng Zhao
1b54c4bc44 chore: cherry-pick fix for 1283371 from chromium (#32779)
Co-authored-by: Electron Bot <electron@github.com>
2022-02-10 10:03:37 -06:00
Robo
f903141394 chore: cherry-pick 06504ff3b1 from chromium (#32793)
* chore: cherry-pick 06504ff3b1 from chromium

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

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-02-10 22:16:55 +09:00
Robo
6c1f9f8270 chore: cherry-pick 5c41beab6 from chromium (#32798)
* chore: cherry-pick 5c41beab6 from chromium

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

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-02-10 19:36:18 +09:00
Robo
7432ea43b7 chore: cherry-pick 91fbf1798 and cff03c22c5 from chromium (#32792)
Backports
https://chromium-review.googlesource.com/c/chromium/src/+/3347570
https://chromium-review.googlesource.com/c/chromium/src/+/3348406

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-02-10 17:22:19 +09:00
Robo
0d1b7be451 chore: cherry-pick efdfe711dc5 from chromium (#32791)
Backports
https://chromium-review.googlesource.com/c/chromium/src/+/3242785
https://chromium-review.googlesource.com/c/angle/angle/+/3242963

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-02-10 15:13:26 +09:00
Robo
e0a7f869de chore: cherry-pick 349a35b19 from chromium (#32790)
Backports https://chromium-review.googlesource.com/c/chromium/src/+/3226142

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-02-10 09:37:43 +09:00
Jeremy Rose
d9dd6138e2 chore: cherry-pick 9db9911e1242 from chromium (#32741)
* chore: cherry-pick 9db9911e1242 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2022-02-09 16:49:44 -05:00
trop[bot]
c1651e333b test: disable the test that makes spec runner hang on exit (#32836)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-02-09 12:11:16 -05:00
trop[bot]
c0ea40e71d build: rebuild the dist_zips when the deps get modified (#32819)
* build: rebuild the dist_zips when the deps get modified

The dist.zip generated by the electron_dist_zip action was not getting
updated when changes were being made to the dependencies, like the
source files. It turns out, we were using data_deps for the dependencies
instead of deps. Here is the difference:

data_deps: things needed to ultimately run the thing built by a target
deps: things needed to build the target

So the difference in treatment of both sets of dependencies is actually
intentional.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

* fixup! build: rebuild the dist_zips when the deps get modified

Signed-off-by: Darshan Sen <raisinten@gmail.com>

Co-authored-by: Darshan Sen <raisinten@gmail.com>
2022-02-09 11:13:28 -05:00
Robo
501bb98a10 chore: cherry-pick 5f8ddef5a6 from chromium (#32789)
Backports https://chromium-review.googlesource.com/c/chromium/src/+/3193885

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-02-09 13:04:10 +09:00
Robo
9fe9a0ccc1 chore: cherry-pick ce8b70863 from angle (#32795)
Backports https://chromium-review.googlesource.com/c/angle/angle/+/3335173
2022-02-09 09:41:57 +09:00
Robo
f6d2b9dc63 chore: cherry-pick 55f6cb37 from chromium (#32794)
* chore: cherry-pick 55f6cb37 from chromium

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

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-02-09 09:41:24 +09:00
Jeremy Rose
b04be1dff6 chore: cherry-pick 27bc67f761e6 from v8 (#32739)
* chore: cherry-pick 27bc67f761e6 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-02-09 09:40:26 +09:00
Cheng Zhao
656463c2f4 chore: cherry-pick fix for 1284367 from chromium (#32775) 2022-02-08 11:32:00 -05:00
trop[bot]
a0e9cc6c02 fix: WCO window hover on window controls on Windows (#32717) 2022-02-03 10:06:48 +01:00
trop[bot]
27e2c79dd0 docs: fix missing tag end in clipboard example (#32693)
Co-authored-by: Paul Hollinsky <paulhollinsky@gmail.com>
2022-02-02 10:13:58 -05:00
trop[bot]
d74441f00e docs: fix typo in BrowserWindow description (#32697)
Co-authored-by: Tobias Nießen <tniessen@tnie.de>
2022-02-02 10:09:58 -05:00
trop[bot]
97e52764a8 fix: some frameless windows showing a frame on Windows (#32708)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-02-02 15:38:37 +01:00
trop[bot]
112392c414 fix: expose all serial devices to setDevicePermissionHandler (#32686)
* fix: expose all serial devices to setDevicePermissionHandler

* Trigger Build

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-02-01 19:28:20 -05:00
trop[bot]
42c2eecdef fix: transparent window max/unmax event firing (#32688)
* fix: transparent window max/unmax event firing

* chore: fixup tests

* Update spec-main/api-browser-window-spec.ts

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2022-02-01 20:21:42 +09:00
trop[bot]
98603c645e fix: missing comma in config.py (#32676)
* Fix missing comma

Co-authored-by: Marek Šuppa <mrshu@users.noreply.github.com>
2022-02-01 17:52:59 +09:00
trop[bot]
11391e7351 docs: update context bridge docs about Promises and Errors (#32533) (#32646)
* Update context bridge docs about Promises

From my testing it doesn't remove Promises in nested objects,
also according to the test suite it does not:
80577a4f08/spec-main/api-context-bridge-spec.ts (L693)

* docs: Update docs for errors too

Co-authored-by: Mikael Finstad <finstaden@gmail.com>
2022-01-28 19:59:28 +09:00
Sudowoodo Release Bot
a636ab7c61 Bump v15.3.6 2022-01-27 09:46:32 -08:00
trop[bot]
53e39eb9c0 ci: update ts-compile-doc-change to properly use src cache (#32625)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-01-26 10:30:22 -05:00
trop[bot]
cccd74e6a6 fix: webContents.setZoomFactor crash (#32619)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-01-26 20:05:49 +09:00
trop[bot]
1efa631b56 fix: crash when saving edited PDF files (#32537)
* fix: crash when saving edited PDF files

* chore: update patches after backport

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-01-26 20:03:37 +09:00
trop[bot]
221d2220e1 fix: make window without rounded corners closable (#32610)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2022-01-26 20:03:12 +09:00
trop[bot]
ae3ee8ad00 test: disable flaky test on WOA (#32562)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-01-25 13:31:02 -05:00
Jeremy Rose
b39a34650f chore: cherry-pick c5571653d932 from chromium (#32353)
* chore: cherry-pick c5571653d932 from chromium

* fix patch

* Update cherry-pick-c5571653d932.patch

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-01-24 13:16:38 -05:00
trop[bot]
8292b3dc0c fix: strip crashpad_handler binary (#32548)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2022-01-24 20:06:55 +09:00
David Sanders
8653dfc8b3 docs: fix anchors for broken relative links (#32568) 2022-01-24 19:59:27 +09:00
trop[bot]
1ef9a756e5 ci: call autoninja without ninjalog_uploader_wrapper.py (#32573)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-01-24 19:55:03 +09:00
Pedro Pontes
fdfa5d41d4 chore: cherry-pick cc44ae61f37b from angle (#32546)
* chore: cherry-pick cc44ae61f37b from angle

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-01-20 11:08:23 -08:00
trop[bot]
86e10b06dd fix: check for maximized window before unmaximizings (#32494)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2022-01-19 10:39:04 -05:00
Shelley Vohr
d2497a14e0 fix: maximize/unmaximize firing on linux (#32498) 2022-01-19 10:30:47 -05:00
trop[bot]
5963024ac7 docs: fix broken images for symbol server setup (#32524)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2022-01-18 15:24:12 -05:00
trop[bot]
26690b12f2 fix: Corrupted title of alert dialog (#32468)
Co-authored-by: Takao Baba <babatakao@gmail.com>
2022-01-17 16:34:26 +09:00
trop[bot]
1a148a8232 fix: optional postMessage transfer arg (#32458)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-01-14 09:42:37 +09:00
Pedro Pontes
cff70f15aa chore: cherry-pick f0a63e1f361f from chromium (#32012)
* chore: cherry-pick f0a63e1f361f from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2022-01-13 18:39:01 +09:00
trop[bot]
a6f094c983 fix: use setAspectRatio for frameless window on mac (#32445)
* fix(window): setAspectRatio for frameless windows

* dummy

* undo dummy

Co-authored-by: Gellert Hegyi <gellert.hegyi@around.co>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2022-01-13 17:19:12 +09:00
Pedro Pontes
04dcbe4c74 chore: cherry-pick 27eb11a28555 from chromium (#32015)
* chore: cherry-pick 27eb11a28555 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2022-01-13 09:36:39 +09:00
Pedro Pontes
28def9ed7d chore: cherry-pick 855df1837e from chromium (#32032)
Co-authored-by: Electron Bot <electron@github.com>
2022-01-12 16:45:06 +09:00
trop[bot]
2089370bbb build: pin colors to v1.4.0 in package.json (#32424)
* pin colors to v1.4.0 in packae.json

Fixes #32416

* fixup! pin colors to v1.4.0 in packae.json

update yarn.lock too

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-01-12 16:44:27 +09:00
Pedro Pontes
837dc05204 chore: cherry-pick bdffa0ea5148 from angle (#32184)
* chore: cherry-pick bdffa0ea5148 from angle

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Electron Bot <electron@github.com>
2022-01-12 16:42:40 +09:00
Sudowoodo Release Bot
9f08e46018 Bump v15.3.5 2022-01-11 11:18:16 -08:00
trop[bot]
6a70d8a6ca fix: incorrect skipTransformProcessType option parsing in win.setVisibleOnAllWorkspaces() (#32396)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2022-01-11 14:45:25 +09:00
Pedro Pontes
aab276c532 chore: cherry-pick da11d71a0227 from chromium (#32181)
* chore: cherry-pick da11d71a0227 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2022-01-11 14:43:57 +09:00
Pedro Pontes
053fea1b44 chore: cherry-pick 05e69c75905f from angle (#32190)
* chore: cherry-pick 05e69c75905f from angle

* chore: update patches

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Electron Bot <electron@github.com>
2022-01-11 14:42:40 +09:00
Pedro Pontes
0b0e991a54 chore: cherry-pick 809830f1b3 from webrtc (#32226)
* chore: cherry-pick 809830f1b3 from webrtc

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-01-11 14:40:54 +09:00
Pedro Pontes
ec7408a2d4 chore: cherry-pick 891020ed64d4 from angle (#32223)
* chore: cherry-pick 891020ed64d4 from angle

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-01-10 17:01:35 -05:00
Milan Burda
250b7ed3db docs: left is a valid mode in contents.openDevTools() options (#32372) (#32404) 2022-01-10 16:54:07 -05:00
Pedro Pontes
d136430b35 chore: cherry-pick dbde8795233a from chromium (#32210)
* chore: cherry-pick dbde8795233a from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2022-01-10 11:10:32 +01:00
Pedro Pontes
79abfe7ac8 chore: cherry-pick 05ccacee14 from v8. (#32216)
Co-authored-by: Electron Bot <electron@github.com>
2022-01-10 11:07:14 +01:00
trop[bot]
a18a4609ad fix: Allow npm_config_arch override on mac (#32380)
If the npm_config_arch environment variable is set on Mac, then use the
specified architecture rather than overriding it to x64.

Co-authored-by: Tommy MacWilliam <tommy@serenade.ai>
2022-01-10 10:49:30 +01:00
Pedro Pontes
cdf661939d chore: cherry-pick 6bb320d134b1 from chromium (#32009)
* chore: cherry-pick 6bb320d134b1 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2022-01-06 09:47:14 -05:00
Pedro Pontes
98cf0e5dff chore: cherry-pick 2b98abd8cb6c from angle (#32187)
* chore: cherry-pick 2b98abd8cb6c from angle

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-01-06 13:34:35 +01:00
trop[bot]
be9dccfcc6 fix: rename patch file to .patch to conform to naming standard which utilizes .gitattributes settings (#32346)
* Rename patch file to .patch to conform to naming standard which utilizes .gitattributes settings

* chore: remove backported patches

* chore: rename patch (don't re-add)

Co-authored-by: stsean <stsean@justin.tv>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2022-01-06 09:19:17 +09:00
Pedro Pontes
e4bb98195f chore: cherry-pick 109fde1088be from chromium (#32011)
* chore: cherry-pick 109fde1088be from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2022-01-05 13:50:59 -05:00
trop[bot]
099560c59c fix: crash caused by app.getLocaleCountryCode() (#32332)
CFLocaleGetValue() returned null and crashed the process when
app.getLocaleCountryCode() was run on a CircleCI metal resource class
macOS instance with Xcode 12.5.1. This change fixes that logic and adds
further checks to make the code future-proof.

Here too people are complaining that the returned country code migth be
null: https://stackoverflow.com/questions/15202454/nslocalecountrycode-returns-nil

Signed-off-by: Darshan Sen <darshan.sen@postman.com>

Co-authored-by: Darshan Sen <darshan.sen@postman.com>
2022-01-05 18:35:00 +09:00
trop[bot]
efd276d31f fix: #32141 register wrong command for setAsDefaultProtocolClient for windows (#32330)
Co-authored-by: Shubham-Kumar-2000 <shukhu10@gmail.com>
2022-01-04 16:09:13 +09:00
Pedro Pontes
e2cb43768d chore: cherry-pick 2b978fb482 from chromium (#32232)
Co-authored-by: Electron Bot <electron@github.com>
2022-01-04 10:09:05 +09:00
Cheng Zhao
e654f5ecb3 fix: window.open not overriding parent's webPreferences (#32109) 2022-01-04 09:18:38 +09:00
Pedro Pontes
f74940b536 chore: cherry-pick f781748dcb3c from chromium (#32257)
* chore: cherry-pick f781748dcb3c from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-01-03 12:01:51 -05:00
Pedro Pontes
fe8508a287 chore: cherry-pick 04a58fedd5 from v8 (#32235) 2022-01-03 09:43:48 -05:00
trop[bot]
d5dd50f87e fix: check for single bluetooth listener (#32245)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2022-01-03 10:29:19 +01:00
trop[bot]
952994c591 fix: older systems crash when playing media files (#32213)
* fix: win7 crash when playing media

* reset

* chore: update patches

Co-authored-by: Micha Hanselmann <micha.hanselmann@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-12-17 13:30:03 -08:00
Sudowoodo Release Bot
536b5c4e3b Bump v15.3.4 2021-12-16 09:06:05 -08:00
trop[bot]
210bae878f fix: ensure bluetooth devices are not returned by default (#32197)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-12-15 19:51:28 -08:00
trop[bot]
9b78227260 docs: Fix environment variable name (#32161)
The names of environment variables are case-sensitive on Linux and Mac.

Co-authored-by: stephen9357 <stephen9357@gmail.com>
2021-12-14 19:42:16 +09:00
Keeley Hammond
0a50571460 build: add CI path-filtering for docs-only changes (#32056)
* build: add CI path-filtering for docs-only changes (#31741)

build: (wip) initial dynamic config research

* build: (wip) test path filtering option

* build: (wip) remove doc-only script, use path filtering to check changes

* build: (wip) add docker image with Electron dependencies

* build: (wip) clean up config

* build (wip): readd parameters, executors and env*s

* build: re-add steps and commands

* build: change doc-only to ts-compile-doc-only

* build: re-add workflows and jobs

* build: split configs to setup & build

* build: move lint to "always run" config

* build: clean up, remove old reference config

* build: bump to path-filtering 0.1.0

* build: remove ts-compile step from build-linux

* build: remove nightly-linux-release-test, linux-checks-nightly

* build: don't run build on publish

* build: set base-revision to main (runs branch vs commit)

* build: update config from chromium roll

* build: don't use python3 on sync-step

reverts ea6087e343. This commit was added in
the Nov. 23, 2021 Chromium roll in main, and doesn't apply to 15-x-y

* build: account for path-filtering workflow in release-build script (#32063)

* build: account for path-filtering workflow in release-build script

* build: update syntax for workflow id

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

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

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-12-06 11:36:18 +09:00
trop[bot]
248a6012d5 fix: gtk_native_dialog_run() calls show() internally (#32081)
In the synchronous code path, gtk_native_dialog_run() will call
gtk_native_dialog_show(). Previously this was causing an assertion to be
hit at run time.

Co-authored-by: Tristan Partin <tristan@partin.io>
2021-12-06 11:29:54 +09:00
Sudowoodo Release Bot
ed52801e09 Bump v15.3.3 2021-11-30 12:57:10 -08:00
trop[bot]
6226507536 fix: aspect ratio when max width/height is set (#31956)
* fix: fix aspect ratio when max width/height is set

Add the native frame border size to the minimum and maximum size if
the view reports its size as the client size. It allows to enlarge
window to proper values when aspect ratio and max width/height are
set. It also fixes DCHECK which was triggered when user tried to
enlarge window above dimensions set during creation of the
BrowserWindow.

* chore: update patches

Co-authored-by: Cezary Kulakowski <cezary@openfin.co>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-24 15:42:20 -05:00
Pedro Pontes
098a118dce chore: cherry-pick 56de3b2004, bbca3704f9 and f2b0985ac3 from chromium (#31919)
Co-authored-by: Electron Bot <electron@github.com>
2021-11-24 10:49:13 -05:00
Pedro Pontes
56e08fe5f1 chore: cherry-pick 1fcfb942bd from chromium (#31927) 2021-11-22 16:22:03 -05:00
trop[bot]
8dba1cf5fa fix: ninja build failed on some system (#31942)
Co-authored-by: Black-Hole1 <158blackhole@gmail.com>
2021-11-22 16:16:21 -05:00
Pedro Pontes
1fc7634f69 chore: cherry-pick 1a8af2da50e4 from chromium (#31902)
* chore: cherry-pick 1a8af2da50e4 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-11-22 08:29:39 -08:00
Pedro Pontes
52e443ec52 chore: cherry-pick 5d2b5e7c006c from v8 (#31910)
* chore: cherry-pick 5d2b5e7c006c from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-22 01:44:38 -08:00
Pedro Pontes
16be926e0a chore: cherry-pick a5f54612590d from chromium (#31899) 2021-11-22 01:36:15 -08:00
trop[bot]
5c2d65c749 fix: BrowserView setBackgroundColor needs two calls (#31946)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-22 16:41:33 +09:00
trop[bot]
7bf1d3c110 fix: lint Objective-C header files (#31938)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-11-22 16:35:19 +09:00
trop[bot]
92969d6032 docs: fix typo in distribution docs (#31879)
Co-authored-by: Sergey Zolotarev <sryze@protonmail.com>
2021-11-18 20:32:17 +09:00
trop[bot]
b48d0f2cbe fix: setContentProtection affects BrowserWindow frame (#31830)
Co-authored-by: Micha Hanselmann <micha.hanselmann@gmail.com>
2021-11-17 19:36:25 +09:00
Shelley Vohr
ff8594b11b chore: fix malformed mojom::CreateNewWindowParams patch (#31843)
* chore: fix malformed mojom::CreateNewWindowParams patch

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-16 20:39:31 +01:00
trop[bot]
a41f04028e chore: use std::forward() in ConvertToV8() (#31856)
The variable `input` is accepted by a universal reference, so it doesn't
make sense to cast a potential lvalue reference into an rvalue
reference. In case `input` is an lvalue reference, we should rather
forward the value as is to `ToV8()`.

Signed-off-by: Darshan Sen <darshan.sen@postman.com>

Co-authored-by: Darshan Sen <darshan.sen@postman.com>
2021-11-16 10:03:36 -05:00
Sudowoodo Release Bot
1f320e0688 Bump v15.3.2 2021-11-15 15:45:07 -08:00
Shelley Vohr
1f23e83ef9 fix: BrowserView setBackgroundColor() (#31844) 2021-11-15 10:32:56 -08:00
trop[bot]
11ea44925b fix: make BrowserView aware of owning window (#31841)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-15 10:32:30 -08:00
trop[bot]
21a6c6dc76 fix: in GTK open dialog, do not preview huge files (#31820)
* fix: in GTK open dialog, do not preview huge files

Previewing images whose files are larger than a GB can crash Electron.

* refactor: tweak CanPreview()

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-15 10:48:27 -06:00
trop[bot]
057c24feec fix: media shouldn't open permissions dialog (#31836)
* fix: media shouldn't open permissions dialog

Playing media shouldn't open Accessibility permissions dialog on macOS.
However, we still need to watch for media events, just not globally and
`media_keys_listener_` is an API over global capture of the media keys.

The fix is to let chromium call `UpdateWhichKeysAreListenedFor` which
will call `UpdateSystemMediaControlsEnabledControls` and watch for
events on `system_media_controls_` without triggering permissions popup.

* chore: update patches

* chore: update patches

Co-authored-by: Fedor Indutny <fedor@indutny.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-15 08:20:38 -08:00
trop[bot]
69014e7aad fix: correct default text for button labels in gtk dialogs (#31823) 2021-11-15 16:19:21 +01:00
trop[bot]
ec293f4de0 fix: crash on browserView.webContents.destroy() (#31826)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-15 16:18:54 +01:00
trop[bot]
15038974ad chore: cleanup obsolete lib/common/remote/ipc-messages.ts (#31766)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-11-09 11:37:06 -05:00
trop[bot]
d2287a1935 test: fix crash in electron::NativeWindowMac::Close() (#31760)
* test: fix crash in electron::NativeWindowMac::Close()

* remove extra close

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-09 11:25:15 -05:00
Sudowoodo Release Bot
e298bf46e4 Bump v15.3.1 2021-11-08 09:26:37 -08:00
trop[bot]
5426d2c920 fix: clipboard.writeBuffer raw format access (#31720)
* fix: clipboard.writeBuffer raw format access (#31116)

* fix: clipboard.writeBuffer raw format access

* test: clipboard.writeBuffer raw format access

* test: clipboard win32 test skip

* fixup spec

* cleanup patch

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

* fixup .patches file

Co-authored-by: henrit <henrit@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-08 11:36:14 -05:00
Milan Burda
3e0a2edec4 fix: <webview> background transparency (#31701)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2021-11-05 14:43:08 -07:00
trop[bot]
f74d89ba80 fix: crash dump location on Linux (#31712)
* fix: crash dump location on Linux

* fix: ignore client_id for Zygote process

* chore: update comment

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-11-04 17:18:50 -04:00
trop[bot]
4e14dca687 test: deflake <webview> tag loads devtools extensions on WOA (#31716)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-04 16:36:11 -04:00
Pedro Pontes
1aaf1e7241 chore: cherry-pick 91dd4f79ab5b from chromium (#31680)
* chore: cherry-pick 91dd4f79ab5b from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-04 14:28:26 -04:00
Keeley Hammond
1e7c8a3c63 docs: update test automation doc (#31506) (#31699)
* Update WebdriverIO documentation

* Update docs/tutorial/using-selenium-and-webdriver.md

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

* Update docs/tutorial/using-selenium-and-webdriver.md

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

* docs: update automated testing docs

* lint

* update

* Update docs/tutorial/automated-testing.md

Co-authored-by: Christian Bromann <github@christian-bromann.com>

* fixes

Co-authored-by: Christian Bromann <github@christian-bromann.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>

Co-authored-by: Christian Bromann <github@christian-bromann.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-11-04 09:52:23 -07:00
trop[bot]
8496a12321 fix: incorrect Content-Disposition serialization (#31693)
* fix: incorrect Content-Disposition serialization

* test: fixup test

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-04 10:00:12 +09:00
trop[bot]
98bab0ca28 fix: do not run dialog callback inside transaction commit (#31658)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-11-02 13:22:23 +01:00
trop[bot]
a630db8c86 test: fix test-datetime-change-notify after daylight change (#31655)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-01 20:57:41 -04:00
trop[bot]
7e19dbad6f fix: use disable-hid-blocklist to allow FIDO devices (#31649)
* fix: use disable-hid-blocklist to allow FIDO

* Trigger Build

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-01 17:09:53 -04:00
Milan Burda
2b8fc8a139 chore: update chore_add_context_to_context_aware_module_prevention.patch (#31579) (#31628)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2021-11-01 15:39:42 -04:00
trop[bot]
30b9d15af0 fix: crash on close window when webContents destroyed (#31644)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-11-01 15:30:46 -04:00
trop[bot]
bcf04f5878 fix: clipboard.read() to recognize custom types (#31651)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-11-01 13:45:48 -04:00
Shelley Vohr
9fba8b35cb fix: silent print settings (#31616) 2021-11-01 10:03:27 -04:00
trop[bot]
ad3563687f docs: link to Apple developer docs for app.ready event (#31599)
Changes some links around. There was no link for `NSUserNotification`, and
`UNNotificationResponse` incorrectly linked to our own `NotificationResponse`
API structure doc.

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-10-28 11:17:10 +09:00
trop[bot]
4e2c19944f fix: clipboard.read() crash (#31591)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-10-26 11:29:58 -04:00
trop[bot]
95814288cf build: retry hasher function if it fails first time (#31582)
* build: retry hasher function if it fails first time

* Update script/release/get-url-hash.js

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

Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-10-26 17:40:41 +09:00
trop[bot]
b711b8f98d docs: win.getParentWindow() returns BrowserWindow | null (#31576)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-26 17:38:12 +09:00
Pedro Pontes
a1744e5de0 chore: cherry-pick 36028012d897 from chromium (#31539)
Co-authored-by: Electron Bot <electron@github.com>
2021-10-25 13:27:14 -04:00
trop[bot]
e9446f0dc4 fix: MediaMetadata not working properly (#31534)
* fix: MediaMetadata not working properly

* chore: update patches

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-25 16:55:16 +02:00
Pedro Pontes
1cda1d0e86 chore: cherry-pick 0894af410c4e from chromium (#31543)
* chore: cherry-pick 0894af410c4e from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-25 13:03:10 +02:00
Pedro Pontes
c2023dd9f5 chore: cherry-pick 8af66de55aad from chromium (#31523)
* chore: cherry-pick 8af66de55aad from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-10-25 09:47:11 +09:00
Pedro Pontes
c98059abd9 chore: cherry-pick c69dddfe1cde from chromium (#31519)
* chore: cherry-pick c69dddfe1cde from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-10-22 21:19:03 +09:00
Pedro Pontes
df726b619d chore: cherry-pick 6de4e210688e from v8 (#31501)
* chore: cherry-pick 6de4e210688e from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Electron Bot <electron@github.com>
2021-10-22 21:14:15 +09:00
trop[bot]
c2b1db192d fix: event with invalid timestamp in trace log (#31422)
* fix: event with invalid timestamp in trace log

When node is started within Electron's environment it doesn't
initialize v8 and time of v8's start is never set. As a result
we log v8's start time as 0 and it breaks timestamps in the
trace log. With this change we log v8's start time only when
it was initialized by node.

* fixup patches for 15-x-y

Co-authored-by: Cezary Kulakowski <cezary@openfin.co>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-10-22 21:13:02 +09:00
Pedro Pontes
235c32ee55 chore: cherry-pick 29be6884cb8a from v8 (#31516) 2021-10-21 16:08:48 -04:00
Pedro Pontes
7e66d6a952 chore: cherry-pick 2e7c9b33453b from chromium (#31497)
* chore: cherry-pick 2e7c9b33453b from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-21 15:15:43 -04:00
Erick Zhao
0db4d5add5 docs: add window customization guide (#31054) (#31507)
* docs: add window customization guide

* fixes

* Update docs/api/browser-window.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/api/browser-window.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/fiddles/windows/manage-windows/frameless-window/index.html

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/window-customization.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/window-customization.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/window-customization.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/window-customization.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/window-customization.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/window-customization.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/window-customization.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/window-customization.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/window-customization.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/window-customization.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/tutorial/window-customization.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* fix code fence

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2021-10-21 14:07:57 -04:00
trop[bot]
9380803004 feat: warn when ipcRenderer.sendSync() called with no listeners for channel (#31434)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-21 09:09:01 +09:00
trop[bot]
2a12d5fa7f fix: ensure TracingAgent in place for SWs (#31476)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-10-21 09:07:41 +09:00
trop[bot]
93e8de87a5 fix: remove 'NOTREACHED()' from 'GetWindowResizeEdge' (#31480)
Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
2021-10-21 09:05:45 +09:00
Sudowoodo Release Bot
b6c9110923 Bump v15.3.0 2021-10-20 07:51:47 -07:00
Keeley Hammond
5e815df20f fix: don't use private enterprise APIs in MAS build (#31483) 2021-10-19 23:14:22 -07:00
trop[bot]
e676b3862c fix: link to image windows progress bar image was linked with square brackets [] insted of parenthesis () and to github asset storage instead of local image directory. (#31472)
Co-authored-by: Daniel Ramp <12480131+DanielRamp@users.noreply.github.com>
2021-10-19 20:40:12 +09:00
trop[bot]
cd8f678a8d Avoid Undefined Variable In printToPdf Example (#31465)
Co-authored-by: universalstrapping <90921972+universalstrapping@users.noreply.github.com>
2021-10-19 17:41:24 +09:00
trop[bot]
79554ba989 fix: add isDestroyed check (#31468)
* Added isDestroyed check

fix: https://github.com/electron/electron/issues/31196

* fix: unregister frame name

Unregister the frame name so that we do not accidentally unregister the wrong window later on in case there is a timing issue with the events

* fix; check if webContents is destroyed

* fix: check if window/webContents is destroyed

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

Co-authored-by: t57ser <seve@live.at>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2021-10-19 17:39:49 +09:00
Cheng Zhao
ad67a27dcf fix: generate valid config.gypi (#31442) 2021-10-19 09:39:47 +09:00
trop[bot]
c9476eb821 fix: also pass securityOrigin to media permissions request handler (#31417)
Co-authored-by: Maxime Serrano <mserrano@alumni.cmu.edu>
2021-10-15 13:31:48 +09:00
John Kleinschmidt
2c6321c9af chore: refactor persisting permission granted to serial ports (#31418)
(cherry picked from commit 515785aabe)
2021-10-15 09:07:24 +09:00
trop[bot]
715de396d4 fix: mac window crash native theme update (#31429)
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2021-10-15 09:06:05 +09:00
Sudowoodo Release Bot
98d6b9bf15 Bump v15.2.0 2021-10-14 12:54:57 -07:00
trop[bot]
a05ed73f43 fix: reset render_frame_disposed_ after render frame host change (#31426)
* fix: reset render_frame_disposed_ after hang

* fix: handle exception in webContents.send

Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-10-14 12:52:46 -07:00
trop[bot]
f7fdd34c45 docs: update Versioning doc (#31388)
* fix information

* move historical section to bottom

* Update docs/tutorial/electron-versioning.md

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: fix small typo

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2021-10-13 11:24:56 +09:00
trop[bot]
55e6ce81e0 fix: black window on screen capture when content protection is enabled (#31385)
Co-authored-by: Micha Hanselmann <mhanselmann@microsoft.com>
2021-10-12 09:09:10 +09:00
trop[bot]
b5c81db591 feat: add commandLine.removeSwitch (#31326)
* feat: add commandLine.removeSwitch

In some cases apps may want to remove Chromium command line switches to avoid certain Chromium behaviors being used, E.g. remote-debugging-port or gpu-launcher

* fix: add missing removeSwitch to app.ts

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-12 09:05:52 +09:00
electron-roller[bot]
cffbeeaefa chore: bump chromium to 94.0.4606.81 (15-x-y) (#31351) 2021-10-11 13:28:17 +02:00
trop[bot]
c81380848f fix: correctly notify WebViewGuestDelegate when webview is detached (#31376)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-10-11 14:35:33 +09:00
Milan Burda
45a1d81315 docs: nativeWindowOpen default was changed in Electron 15 (#31345) (#31367)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2021-10-10 15:50:48 -07:00
Sudowoodo Release Bot
ded013e4a7 Bump v15.1.2 2021-10-08 09:10:28 -07:00
Samuel Attard
2cabee9128 chore: cherry-pick 39090918efac from chromium (#31297)
* chore: cherry-pick 39090918efac from chromium

* chore: cherry-pick ec42dfd3545f from chromium

* chore: reconcile FPS patch differences

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2021-10-08 09:07:58 -07:00
trop[bot]
0c9571c89f docs: add missing 'context-menu' event to webview-tag.md (#31309)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-08 08:57:45 -07:00
electron-roller[bot]
c93204ec0d chore: bump chromium to 94.0.4606.71 (15-x-y) (#31234)
* chore: bump chromium in DEPS to 94.0.4606.71

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-10-07 22:02:54 -04:00
trop[bot]
3c47d9e0d7 fix: crash on missing render frame (#31334)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-10-07 20:15:48 +02:00
Robo
9c54bf7973 refactor: only access memory coordinator interface from browser process (#31295) (#31303)
Refs https://chromium-review.googlesource.com/c/chromium/src/+/3174305
2021-10-06 15:44:14 -07:00
trop[bot]
d6f44a75d2 test: add missing context-menu event spec for <webview> (#31306)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-06 15:16:28 -05:00
trop[bot]
259f27070c chore: add logging for print_backend failures (#31286)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-10-06 16:55:17 +02:00
trop[bot]
6d1fa337c2 fix: return HTNOWHERE in resize hit test to allow draggable regions to kick in when required (#31299)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-10-06 09:22:21 +09:00
Sudowoodo Release Bot
b51f82c73f Bump v15.1.1 2021-10-04 12:42:12 -07:00
trop[bot]
e19f7fbaf7 fix: "Failed to serialize arguments" when emitting 'context-menu' for webview (#31259) (#31279)
* fix: sanitize params for 'context-menu' event sent over IPC for webview

* Revert "fix: sanitize params for 'context-menu' event sent over IPC for webview"

This reverts commit 7fee455138.

* fix: make frame property non-enumerable in params for 'context-menu' event

Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-04 15:40:46 -04:00
trop[bot]
955d6c82ff fix: dialog is not defined (#31272)
Corrects the following error in Electron Fiddle:

```
Uncaught Exception:
ReferenceError: dialog is not defined
...
```

Co-authored-by: Ryan Johnson <CITguy@users.noreply.github.com>
2021-10-04 12:14:59 +09:00
trop[bot]
5fbb4fd8c9 fix: fix typo in description of secureDnsMode (#31267)
Co-authored-by: Tobias Nießen <tniessen@users.noreply.github.com>
2021-10-04 12:13:57 +09:00
Robo
9407a3ee09 fix: remove expired DST Root CA X3 (#31219)
* Revert "fix: Enable X509_V_FLAG_TRUSTED_FIRST flag in BoringSSL (#31218)"

This reverts commit d788d817ee.

* fix: remove expired DST Root CA X3
2021-10-01 07:56:31 -07:00
Sudowoodo Release Bot
86bb866ffb Bump v15.1.0 2021-10-01 07:32:00 -07:00
Keeley Hammond
2b22f02354 Revert "Bump v15.1.0" (#31238)
This reverts commit c3ee7b4bd1.
2021-10-01 10:29:43 -04:00
Sudowoodo Release Bot
c3ee7b4bd1 Bump v15.1.0 2021-09-30 14:38:16 -07:00
trop[bot]
d788d817ee fix: Enable X509_V_FLAG_TRUSTED_FIRST flag in BoringSSL (#31218)
* fix: Enable X509_V_FLAG_TRUSTED_FIRST flag in BoringSSL

Fixes: https://github.com/electron/electron/issues/31212
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>

* Update .patches

Co-authored-by: Juan Cruz Viotti <jv@jviotti.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-09-30 17:00:29 -04:00
trop[bot]
6fbd50ab37 fix: draggable regions in BrowserViews are independent (#31198)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-30 12:04:29 -04:00
trop[bot]
097fd4c206 fix: first mouse not dragging BrowserView (#31100)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-30 11:06:04 -04:00
Alexey Kuzmin
844d104d06 chore: fix pylint (#31207)
* chore: fix pylint

* chore: fix linter errors
2021-09-30 09:48:59 -04:00
trop[bot]
b62cef5a01 fix: running tests with release build (#31140)
* fix: running tests with release build

* Update electron_api_v8_util.cc

Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-09-29 17:18:06 -04:00
Keeley Hammond
4cdb2c4bd4 chore: remove gin::Wrappable crash keys (#31075) (#31189) 2021-09-29 17:06:46 -04:00
Darshan Sen
bc655b8eaf refactor: make InitWithWebContents and InspectableWebContents take a unique_ptr (#30920) (#31124)
* refactor: make InitWithWebContents take a unique_ptr

Signed-off-by: Darshan Sen <darshan.sen@postman.com>

* refactor: make InspectableWebContents take a unique_ptr

Signed-off-by: Darshan Sen <darshan.sen@postman.com>
2021-09-29 17:05:53 -04:00
trop[bot]
4891e92f32 feat: add width option to dialog.showMessageBox() (#31088)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-09-29 14:28:16 -04:00
John Kleinschmidt
62b88b2a0b feat: add support for WebHID (#30213) (#31095)
* feat: add support for WebHID

* Apply suggestions from code review

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

* Address review feedback

* Address review feedback

* chore: clear granted_devices on navigation

Also added test to verify devices get cleared

* fixup testing for device clear

* make sure navigator.hid.getDevices is run on correct frame

* clear granted devices on RenderFrameHost deletion/change

* manage device permissions per RenderFrameHost

This change makes sure we don't clear device permission prematurely due to child frame navigation

* Update shell/browser/api/electron_api_web_contents.cc

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

* apply review feedback from @zcbenz

* Match upstream ObjectMap

This change matches what ObjectPermissionContextBase uses to cache object permissions: https://source.chromium.org/chromium/chromium/src/+/main:components/permissions/object_permission_context_base.h;l=52;drc=8f95b5eab2797a3e26bba299f3b0df85bfc98bf5;bpv=1;bpt=0

The main reason for this was to resolve this crash on Win x64:
ok 2 WebContentsView doesn't crash when GCed during allocation
Received fatal exception EXCEPTION_ACCESS_VIOLATION
Backtrace:
        gin::WrappableBase::SecondWeakCallback [0x00007FF6F2AFA005+133] (o:\gin\wrappable.cc:53)
        v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacks [0x00007FF6F028F9AB+171] (o:\v8\src\handles\global-handles.cc:1400)
        v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacksFromTask [0x00007FF6F028F867+391] (o:\v8\src\handles\global-handles.cc:1387)
        node::PerIsolatePlatformData::RunForegroundTask [0x00007FF6F3B4D065+317] (o:\third_party\electron_node\src\node_platform.cc:415)
        node::PerIsolatePlatformData::FlushForegroundTasksInternal [0x00007FF6F3B4C424+776] (o:\third_party\electron_node\src\node_platform.cc:479)
        uv_run [0x00007FF6F2DDD07C+492] (o:\third_party\electron_node\deps\uv\src\win\core.c:609)
        electron::NodeBindings::UvRunOnce [0x00007FF6EEE1E036+294] (o:\electron\shell\common\node_bindings.cc:631)
        base::TaskAnnotator::RunTask [0x00007FF6F2318A19+457] (o:\base\task\common\task_annotator.cc:178)
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl [0x00007FF6F2E6F553+963] (o:\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:361)
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork [0x00007FF6F2E6EC69+137] (o:\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:266)
        base::MessagePumpForUI::DoRunLoop [0x00007FF6F235AA58+216] (o:\base\message_loop\message_pump_win.cc:221)
        base::MessagePumpWin::Run [0x00007FF6F235A01A+106] (o:\base\message_loop\message_pump_win.cc:79)
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run [0x00007FF6F2E702DA+682] (o:\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:470)
        base::RunLoop::Run [0x00007FF6F22F95BA+842] (o:\base\run_loop.cc:136)
        content::BrowserMainLoop::RunMainMessageLoop [0x00007FF6F14423CC+208] (o:\content\browser\browser_main_loop.cc:990)
        content::BrowserMainRunnerImpl::Run [0x00007FF6F144402F+143] (o:\content\browser\browser_main_runner_impl.cc:153)
        content::BrowserMain [0x00007FF6F143F911+257] (o:\content\browser\browser_main.cc:49)
        content::RunBrowserProcessMain [0x00007FF6EFFA7D18+112] (o:\content\app\content_main_runner_impl.cc:608)
        content::ContentMainRunnerImpl::RunBrowser [0x00007FF6EFFA8CF4+1220] (o:\content\app\content_main_runner_impl.cc:1104)
        content::ContentMainRunnerImpl::Run [0x00007FF6EFFA87C9+393] (o:\content\app\content_main_runner_impl.cc:971)
        content::RunContentProcess [0x00007FF6EFFA73BD+733] (o:\content\app\content_main.cc:394)
        content::ContentMain [0x00007FF6EFFA79E1+54] (o:\content\app\content_main.cc:422)
        wWinMain [0x00007FF6EECA1535+889] (o:\electron\shell\app\electron_main.cc:291)
        __scrt_common_main_seh [0x00007FF6F6F88482+262] (d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
        BaseThreadInitThunk [0x00007FFEC0087034+20]
        RtlUserThreadStart [0x00007FFEC1F02651+33]
✗ Electron tests failed with code 0xc0000005.

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
(cherry picked from commit 6aece4a83d)
2021-09-29 13:05:26 -04:00
trop[bot]
2cbfd19d94 fix: crash creating private key with unsupported algorithm (#31137)
* fix: crash creating private key with unsupported algorithm

* test: add regression test

* chore: update patches

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-29 11:56:45 -04:00
trop[bot]
da132e0289 fix: .lldbinit config stale (unavailable) (#31158)
Co-authored-by: Black-Hole1 <158blackhole@gmail.com>
2021-09-29 12:33:07 +02:00
trop[bot]
622b79cd9d fix: BrowserView drag now delegates to the OS when possible (#31177)
Co-authored-by: @anulman <@anulman>
2021-09-29 12:28:38 +02:00
trop[bot]
2e91d6e10c docs: update branch name (#31149) 2021-09-28 09:51:57 +02:00
trop[bot]
4a495542cb refactor: use native WeakRef instead of v8util.weaklyTrackValue() (#31165)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-09-28 09:44:31 +02:00
trop[bot]
45813a0342 fix: crash in v8 due to regexp reentrancy (#31144)
* fix: crash in v8 due to regexp reentrancy

Check failed: !regexp_stack_->is_in_use()

Refs https://bugs.chromium.org/p/chromium/issues/detail?id=1250646
Refs https://bugs.chromium.org/p/v8/issues/detail?id=11382

* chore: update patches

* chore: update patches

Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-27 16:54:46 -07:00
trop[bot]
b55362b588 fix: avoid double free when destroying WebContents (#31133)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-09-27 22:00:44 +02:00
electron-roller[bot]
b39b6cde8c chore: bump chromium to 94.0.4606.61 (15-x-y) (#31112)
* chore: bump chromium in DEPS to 94.0.4606.61

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-27 12:38:07 -04:00
trop[bot]
6919520c88 fix: startDrag params type incorrect (#31083)
Co-authored-by: Black-Hole1 <158blackhole@gmail.com>
2021-09-23 19:50:10 +09:00
trop[bot]
71fcb8d8f8 fix: update Windows' cache after changing window's style (#31081)
To enable/disable window resizing we set/unset WS_THICKFRAME style
flag on the window. Window's frame styles are cached so we need to
call SetWindowPos with the SWP_FRAMECHANGED flag set to update
cache properly.

Co-authored-by: Cezary Kulakowski <cezary@openfin.co>
2021-09-23 19:48:12 +09:00
trop[bot]
ee23788acf fix: proper localization when using GtkFileChooserNative (#31066)
* fix: proper localization when using GtkFileChooserNative

* fix: iwyu

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-23 16:35:46 +09:00
trop[bot]
52196791b9 feat: add isMainFrame argument to 'certificate-error' event (#31038)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-09-23 16:32:56 +09:00
trop[bot]
6dbf0c52ec docs: update glossary (#31056)
* docs: update glossary

* remove nsis entry

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-09-23 16:30:13 +09:00
trop[bot]
5d95688753 chore: clarify new-window fix comment (#31073)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-09-22 17:26:41 -07:00
electron-roller[bot]
6e60fa6d59 chore: bump chromium to 94.0.4606.54 (15-x-y) (#31046)
* chore: bump chromium in DEPS to 94.0.4606.54

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-22 14:12:04 -04:00
trop[bot]
d072d408c0 feat: add frame to context-menu event params (#31057)
* feat: add frame to context-menu event params

* doc: rephrase frame description

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-09-22 14:11:48 -04:00
trop[bot]
cde7f04409 fix: prevent navigator.fonts.query() from crashing (#30985) 2021-09-22 08:25:18 +02:00
trop[bot]
e143f654ca fix: maximized state calculation for non-resizable windows (#31041)
* fix: maximized state calculation for non-resizable windows

* refactor: clean up NSRect comparison

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-22 09:28:44 +09:00
trop[bot]
cc62c4a33a docs: update public timeline for E16 (#31051)
Co-authored-by: Sofia Nguy <sofianguy@gmail.com>
2021-09-21 14:37:02 -07:00
Sudowoodo Release Bot
c3e6746fa9 Bump v15.0.0 2021-09-21 11:50:28 -07:00
Samuel Attard
436c3ba644 Revert "Bump v15.0.0"
This reverts commit dc6f951f43.
2021-09-21 11:48:38 -07:00
Samuel Attard
599babae00 Revert "Bump v15.0.1"
This reverts commit 5f7da14447.
2021-09-21 11:48:31 -07:00
Sudowoodo Release Bot
5f7da14447 Bump v15.0.1 2021-09-21 11:43:53 -07:00
Sudowoodo Release Bot
dc6f951f43 Bump v15.0.0 2021-09-21 11:40:26 -07:00
trop[bot]
f4fa6c0cf4 fix: propagate window.open settings to child window (#31049)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-09-21 10:34:32 -07:00
trop[bot]
98de50451a fix: suppress insecure resource warning for more local hostnames (#31036) 2021-09-21 10:48:26 +02:00
Sudowoodo Release Bot
c78ab7a1f2 Revert "Bump v15.0.0"
This reverts commit 0928f322fa.
2021-09-20 17:16:32 -07:00
Sudowoodo Release Bot
0928f322fa Bump v15.0.0 2021-09-20 11:31:33 -07:00
trop[bot]
c6c59bf0b3 build: fix release CI jobs start script (#31026)
* build: fix release CI jobs start script

This broke in #30492, we weren't handled 20X status codes and weren't authing to appveyor correctly.

* build: do not pass undefined to Auth header in CI scripts

(cherry picked from commit a48968c1ce)

* build: use basic auth to trigger CI if either a username OR password is provided

(cherry picked from commit d1bd9afbbf)

* build: manually pull 64bit dugite for 32bit tests (#30531)

(cherry picked from commit 8b9d0092cb)

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-09-20 11:02:51 -07:00
Keeley Hammond
9d3bcfc559 fix: ensure web_contents() is alive before grabbing view (#31027) 2021-09-20 10:14:12 -07:00
Sudowoodo Release Bot
fb2473bb5e Revert "Bump v15.0.0-beta.8"
This reverts commit 18c5401d08.
2021-09-20 07:43:58 -07:00
electron-roller[bot]
4664b5da57 chore: bump chromium to 94.0.4606.51 (15-x-y) (#30895)
* chore: bump chromium in DEPS to 94.0.4606.41

* chore: bump chromium in DEPS to 94.0.4606.50

* chore: bump chromium in DEPS to 94.0.4606.51

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2021-09-20 10:42:16 -04:00
Sudowoodo Release Bot
18c5401d08 Bump v15.0.0-beta.8 2021-09-20 06:31:53 -07:00
trop[bot]
3f81697e48 fix: disabling and enabling resizability on macOS (#31014)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-20 09:34:55 +09:00
trop[bot]
a00a43ba25 chore: update links of documentation of chromes (#31008)
chrome now use developer.chrome.com/docs/extensions/* instead of developer.chrome.com/extensions/*

Co-authored-by: 祈緒ちゃん - Kiochan <sunxingchen@live.com>
2021-09-17 22:10:48 +09:00
trop[bot]
ce1435be30 fix: links to images (#31005)
Images that used the inline link format do not show up on Docusaurus or
the old website infrastructure. There are only 2 guides using it so it
is faster to change the format rather than figuring out why the parsin
logic does not work.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Ref: https://github.com/electron/electronjs.org-new/issues/84

Co-authored-by: Antón Molleda <amolleda@gmail.com>
2021-09-17 16:49:03 +09:00
trop[bot]
c625b77bde fix: add casing for WCO edge (#30995)
Co-authored-by: mlaurencin <mlaurencin@electronjs.org>
2021-09-16 18:49:03 -04:00
Samuel Attard
4969c4ab19 build: ensure we await correctly in npm publish script 2021-09-16 13:48:53 -07:00
Sudowoodo Release Bot
9e1736f5bc Bump v15.0.0-beta.7 2021-09-16 07:36:07 -07:00
Sudowoodo Release Bot
200e26c602 Revert "Bump v15.0.0-beta.7"
This reverts commit bbc4545742.
2021-09-16 07:32:57 -07:00
Sudowoodo Release Bot
bbc4545742 Bump v15.0.0-beta.7 2021-09-16 06:33:26 -07:00
trop[bot]
9874e940ab build: embed binary checksums in the npm package (#30647)
* build: embed binary checksums in the npm package

* Update docs/tutorial/installation.md

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

* refactor: replace reduce with loop

* refactor: remove all usages of the legacy request module (#30492)

* Replaces request with got
* Replaces nugget with got streams
* Replaces request in docs with got
* Upgrades dugite to drop requests dependency

* build: do not excessively log response bodies

* build: fix publish-to-npm script post requests migration

* chore: revert accidental package bumps

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-09-16 09:36:54 +09:00
trop[bot]
304453fa5c fix: always include pepper flash font file (#30970)
Co-authored-by: Micha Hanselmann <micha.hanselmann@gmail.com>
2021-09-16 09:29:34 +09:00
Keeley Hammond
16a32a30d9 chore: update E15 node module version (#30773)
Ref: https://github.com/nodejs/node/pull/39950/files
2021-09-15 16:33:08 -07:00
trop[bot]
a227474809 chore: correct hierarchy of BrowserWindow headings (#30974)
* chore: correct hierarchy of BrowserWindow headings

* Update docs/api/browser-window.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/api/browser-window.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/api/browser-window.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2021-09-15 15:41:29 +09:00
trop[bot]
3a2055ebba docs: update context isolation doc (#30977)
* docs: update context isolation doc

* Apply suggestions from code review

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2021-09-15 15:40:35 +09:00
Sudowoodo Release Bot
87042e1493 Bump v15.0.0-beta.6 2021-09-14 06:03:11 -07:00
Sudowoodo Release Bot
86f3aa0376 Revert "Bump v15.0.0-beta.6"
This reverts commit 33eb6263c0.
2021-09-13 20:35:36 -07:00
Sudowoodo Release Bot
33eb6263c0 Bump v15.0.0-beta.6 2021-09-13 15:31:50 -07:00
trop[bot]
05d5ee4486 fix: remove conflicting RunFileChooserEnd for Mac (#30936)
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2021-09-13 15:26:00 -07:00
trop[bot]
98845392d8 feat: add support for validating asar archives on macOS (#30900)
* feat: add support for validating asar archives on macOS

* chore: fix lint

* chore: update as per feedback

* feat: switch implementation to asar integrity hash checks

* feat: make ranged requests work with the asar file validator DataSourceFilter

* chore: fix lint

* chore: fix missing log include on non-darwin

* fix: do not pull block size out of missing optional

* fix: match ValidateOrDie symbol on non-darwin

* chore: fix up asar specs by repacking archives

* fix: maintain integrity chain, do not load file integrity if header integrity was not loaded

* debug test

* Update node-spec.ts

* fix: initialize header_validated_

* chore: update PR per feedback

* chore: update per feedback

* build: use final asar module

* Update fuses.json5

* chore: fix compile errors

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-09-13 09:58:59 -07:00
Sudowoodo Release Bot
946baab086 Bump v15.0.0-beta.5 2021-09-13 08:46:53 -07:00
trop[bot]
e3aeba3581 fix: delete rfh after open/save dialog done (#30927)
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2021-09-13 08:37:33 -07:00
Sudowoodo Release Bot
e03c11598e Bump v15.0.0-beta.4 2021-09-09 06:32:23 -07:00
trop[bot]
3b1c9dfc54 refactor: remove dead code in NeedsCompleteGpuInfoCollection (#30877)
Refs https://chromium-review.googlesource.com/c/chromium/src/+/1208362

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-08 15:19:25 +09:00
Mark Lee
2724456dc7 docs(protocols): simplify packaging section & cleanup (#30881)
Backport of #30194
Backport of #30566
Backport of #30832
2021-09-08 15:18:33 +09:00
trop[bot]
9333b091f5 docs: Update windows info for auto-updater (#30871)
Squirrel.Mac can be served from a static host as well.

Co-authored-by: Finn Behrens <me@kloenk.dev>
2021-09-08 08:43:50 +09:00
trop[bot]
cb12c4e392 refactor: use getter for frame in webrequest details (#30861)
Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-09-08 08:42:18 +09:00
trop[bot]
1d38e14e92 fix: show maximized frameless window (#30865)
* fix: show maximized frameless window

* test: show maximized transparent window

* fix: test using wrong bounds

BrowserWindow will be sized to the workArea when the Windows taskbar is
visible.

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-09-07 17:02:14 +02:00
Robo
9f39865999 chore: enable v8 oilpan (#30853)
* chore: enable v8 oilpan

* chore: update patches
2021-09-07 09:41:50 +02:00
Sudowoodo Release Bot
2d5b45659a Bump v15.0.0-beta.3 2021-09-06 19:03:15 -07:00
Sudowoodo Release Bot
dab8ec7711 Revert "Bump v15.0.0-beta.3"
This reverts commit 8f81c73908.
2021-09-06 18:47:42 -07:00
Sudowoodo Release Bot
8f81c73908 Bump v15.0.0-beta.3 2021-09-06 18:11:46 -07:00
Sudowoodo Release Bot
79580b1809 Revert "Bump v15.0.0-beta.3"
This reverts commit 835c4a1bb4.
2021-09-06 18:10:45 -07:00
Sudowoodo Release Bot
835c4a1bb4 Bump v15.0.0-beta.3 2021-09-06 06:32:28 -07:00
trop[bot]
81f773eb6f docs: updated webview tag documentation to accurately reflect preload behavior with asar archives (#30851)
Co-authored-by: ike <isaactaylor124@gmail.com>
2021-09-06 19:17:42 +09:00
trop[bot]
2708f66627 fix: devtools not resizable on Windows (#30848)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-06 19:16:57 +09:00
trop[bot]
190085141c feat: add webContents.fromDevToolsTargetId() (#30733)
* feat: add webContents.fromDevToolsTargetId()

* refactor: avoid using FromOrCreate

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
2021-09-03 10:24:32 +02:00
electron-roller[bot]
4111f2b3a7 chore: bump chromium to 94.0.4606.31 (15-x-y) (#30813)
* chore: bump chromium in DEPS to 94.0.4606.31

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-09-02 14:19:04 -04:00
trop[bot]
f894f8a92d feat: add <webview> 'did-redirect-navigation' event (#30664)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-09-02 13:25:40 -04:00
Samuel Maddock
439a295776 fix: BrowserWindow backgroundColor (#30777) 2021-09-02 10:53:11 -04:00
Sudowoodo Release Bot
99868688f1 Bump v15.0.0-beta.2 2021-09-02 06:33:03 -07:00
Milan Burda
3dc92be74c feat: add <webview>.sendToFrame() / frameId to 'ipc-message' event (#30451) (#30704) 2021-09-02 11:13:06 +02:00
trop[bot]
a9e141305b feat: add 'dom-ready' event to WebFrameMain (#30801) 2021-09-02 10:13:13 +02:00
trop[bot]
4fb3b585f9 feat: add app.configureHostResolver (#30775)
* feat: add app.configureHostResolver (#30576)

* fix tests

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-09-01 20:22:53 -04:00
Erick Zhao
ceb65338a5 docs: fix code example in process-model.md (#30690) (#30802)
* Update process-model.md

the demo have two error:
- at macos, close all window, the app will not quite, unless press cmd + q
- attach preload.js, use preload prop that is member of `webPreferences` property of `BrowserWindow` controller argument

* Update docs/tutorial/process-model.md

Co-authored-by: Erick Zhao <erick@hotmail.ca>

Co-authored-by: Cheng Zhao <github@zcbenz.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>

Co-authored-by: Cheng Zhao <github@zcbenz.com>
2021-09-01 16:52:57 -07:00
trop[bot]
30a2a0bf8d repl: fix crash when SharedArrayBuffer disabled (#30483)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-01 14:23:40 -04:00
trop[bot]
1401789817 ci: ignore pdb download failure (#30796)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-09-01 13:24:30 -04:00
trop[bot]
a20f19bc8f fix(linux): OpenURI portal support for shell.showItemInFolder() (#30784)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-01 20:48:13 +09:00
trop[bot]
87f07534b1 docs: improve documentation about macOS entitlement usage security (#30781)
Co-authored-by: ComplexSpaces <complexspacescode@gmail.com>
2021-09-01 20:47:45 +09:00
Sudowoodo Release Bot
326de41302 Bump v15.0.0-beta.1 2021-08-31 13:02:28 -07:00
trop[bot]
53fee846d4 docs: add remote removal to E14 breaking changes (#30770)
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2021-08-31 11:51:29 -07:00
trop[bot]
2c406ff566 fix: remove ipc wrapper for nativeImage.createThumbnailFromPath (#30734)
* fix: remove ipc wrapper for nativeImage.createThumbnailFromPath

* ScopedCOMInitializer

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-08-30 19:31:40 +09:00
electron-roller[bot]
a2ae0e16b5 chore: bump chromium to 94.0.4606.20 (15-x-y) (#30715)
* chore: bump chromium in DEPS to 94.0.4606.20

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-26 12:16:54 -04:00
Sudowoodo Release Bot
b69d7af656 Bump v15.0.0-alpha.10 2021-08-26 09:03:25 -07:00
trop[bot]
4b4bd037e1 docs: explain the null webContents case in permission checks (#30688)
* docs: explain the null webContents case in permission checks

* Update docs/api/session.md

Co-authored-by: Erick Zhao <erick@hotmail.ca>

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-26 15:48:18 +09:00
trop[bot]
ebc21d751a fix: titlebar and buttons state under simple fullscreen (#30708)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-08-26 15:46:34 +09:00
trop[bot]
ea17543800 fix: crash when using TouchBarScrubber arrow button (#30681)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-25 10:06:41 +09:00
electron-roller[bot]
2bc618e7ac chore: bump chromium to 94.0.4606.12 (15-x-y) (#30370)
* chore: bump chromium in DEPS to 94.0.4595.0

* chore: bump chromium in DEPS to 94.0.4596.0

* chore: bump chromium in DEPS to 94.0.4597.0

* chore: bump chromium in DEPS to 94.0.4598.2

* chore: bump chromium in DEPS to 94.0.4599.2

* chore: bump chromium in DEPS to 94.0.4600.0

* chore: bump chromium in DEPS to 94.0.4601.0

* chore: bump chromium in DEPS to 94.0.4602.0

* chore: bump chromium in DEPS to 94.0.4603.0

* chore: bump chromium in DEPS to 94.0.4604.0

* chore: bump chromium in DEPS to 94.0.4603.0

* chore: bump chromium in DEPS to 94.0.4605.0

* chore: bump chromium in DEPS to 94.0.4606.0

* chore: bump chromium in DEPS to 94.0.4606.3

* chore: bump chromium in DEPS to 94.0.4606.5

* build: 3-way merge of chromium patches

(cherry picked from commit d77d456a369c07dbc06e4c2eade23e4029a4c169)

* build: 3-way merge of chromium patches

(cherry picked from commit e495584d5c8a36a469946ada24fa75b30776e1b9)

* 3076040: Reland Remove delete_children RemoveAllChildViews arg

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3076040
(cherry picked from commit 22e131c7b5e146ac57b813a6906d87f98a51c3c3)

* 3069287: Remove the remaining uses and delete the deprecated API

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3069287
(cherry picked from commit a6c546107298ab197893e1bdef906b15bb4f1c70)

* 2297212: Replace RemoveWithoutPathExpansion(.*, nullptr) with Value::RemoveKey()

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

Also: https://chromium-review.googlesource.com/c/chromium/src/+/3060296
(cherry picked from commit 10854b7cb26b1cd259b067e3f5aa2b266bf8eb9a)

* 3082756: Change transport_security_persister_path param to be a path to a file.

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

> this CL intentionally changes the name of the parameter
> in the network context parameters and the order of the constructor
> parameters to ensure all callers update their code to pass a full
> file path rather than a path to a directory.

The 'path' in this diff is already an absolute path, coming from
`CHECK(base::PathService::Get(chrome::DIR_USER_DATA, &path_));` at
08ff1c2cbf/shell/browser/electron_browser_context.cc (L126)

(cherry picked from commit 3e310964ffc592b0a0af4eeededeab3cadbec5a5)

* iwyu: network::mojom::HttpRawHeaderPair

(cherry picked from commit 51c73ea7fd65711eaf26f545b39b8e4a52435182)

* fixup! 3076040: Reland Remove delete_children RemoveAllChildViews arg

Missed one.

(cherry picked from commit f6f9de30780e6b1c677dc55f081af34e4f44fd9c)

* 2999884: CodeHealth: Remove DictionaryValue::GetStringWithoutPathExpansion

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2999884
(example of replacing GetStringWithoutPathExpansion() w/FindStringKey())

Also: https://chromium-review.googlesource.com/c/chromium/src/+/3060296
(removal of DictionaryValue::GetStringWithoutPathExpansion)

(cherry picked from commit 5f7fd94d71480e05ad8badf4be1cfc5d2bd685ce)

* 3059260: Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure

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

We had both of these in a 'disable_features' list. Since these feature have
been removed upstream, remove them from our disable list, too.

IMPORTANT: this commit should not be backported to older branches that
still have these features, because doing so would un-disable them.

(cherry picked from commit a09154d0b20af4680d7c7be6cafd40f84408df2e)

* 2920890: Load reroute_info from download in-progress and history db back into DownloadItem.

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2920890
(cherry picked from commit 66a3797a3f798a368c7630d6c6a1ebc3d8606880)

* 3039323: [Clipboard API] Clipboard Custom Formats implementation Part 5.

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3039323
(cherry picked from commit 136b2ed9aa601bd59b3416d11c1109d249850faa)

* 3084502: Add a new PrintRasterizePdfDpi policy.

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

* chore: update patches

(cherry picked from commit 4b03542e425f73ef7742ee272f30feac350d9bd0)

* chore: update patches

* Disable kDesktopCaptureMacV2

https://chromium-review.googlesource.com/c/chromium/src/+/3069272
(cherry picked from commit 4b308cb8c37b8d84bce8f037d11c242ce9d45845)

* [DevTools] Remove report_raw_headers from network::ResourceRequest (Attempt #2)

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

* Add a new PrintRasterizePdfDpi policy.

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

* chore: update patches

* chore: fix lint

(cherry picked from commit ed0d9adef6b9c5fb8c2b4bcf6783a3bd58605d51)

* Linux: use chrome_crashpad_handler instead of crashpad_handler

https://chromium-review.googlesource.com/c/chromium/src/+/3054290
(cherry picked from commit 0c63c9c1312422180c85bedac5ba8cfb6418649f)

* DCHECK that predictor always has a non-empty NetworkIsolationKey.

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

* fixup! Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure

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

* chore: bump chromium in DEPS to 94.0.4606.12

* chore: update patches

* Disable kDesktopCaptureMacV2

https://chromium-review.googlesource.com/c/chromium/src/+/3069272
(cherry picked from commit 205e477037)

* Convert PrintManager to RenderFrameHostReceiverSet.

https://chromium-review.googlesource.com/c/chromium/src/+/3072019
(cherry picked from commit 6bf73bce81)

* [Clipboard API] Clipboard Custom Formats implementation Part 5.

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

* Convert ExtensionFrameHost to RenderFrameHostReceiverSet.

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

* cleanup after merge

* chore: fix lint

(cherry picked from commit b4ea757281)

* chore: disable v8 oilpan

(cherry picked from commit 19a5afd264)

* fixup! Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure

(cherry picked from commit d0a1a8b51a)

* fixup! Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure

(cherry picked from commit c49b5a9277)

* fixup! Disable kDesktopCaptureMacV2

(cherry picked from commit bc6b974647)

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-24 17:07:19 -04:00
trop[bot]
ba8f4660fd feat: enable windows control overlay on Windows (#29600) (#30497)
* rebase "feat: enable windows control overlay on Windows"

* correct compilation error

* fix linting errors

* modify includes and build file

* change `hidden` option to `overlay`

* add patch to fix visual layout

* add button background color parameter

* add button text color parameter

* modify `overlay` in docs and modify button hover/press transition color

* change `text` to `symbol`

* remove todo and fix `text` replacement

* add new titleBarOverlay property and remove titleBarStyle `overlay`

* update browser and frameless window docs

* remove chromium patches

* chore: update patches

* change button hover color, update trailing `_`, update test file

* add dchecks, update title bar drawing checks, update test file

* modify for mac and linux builds

* update docs with overlayColor and overlaySymbolColor

* add corner and side hit test info

* modify docs and copyright info

* modify `titlebar_overlay_` as boolean or object

* move `title_bar_style_ to `NativeWindow`

* update docs with boolean and object titlebar_overlay_

* add `IsEmpty` checks

* move get options for boolean and object checks

* fix linting error

* disable `use_lld` for macos

* Update docs/api/frameless-window.md

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

* Update docs/api/frameless-window.md

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

* Update docs/api/frameless-window.md

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

* Apply docs suggestions from code review

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

* modify `true` option description `titleBarOverlay`

* ci: cleanup keychain after tests on arm64 mac (#30472)

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-08-23 20:52:45 -04:00
trop[bot]
b19ccb708e fix: change gin::Wrappable crash key type to ScopedCrashKey (#30610)
* fix: change gin_wrappable to scoped crash key

* fix: build dependency

Dependency was missed in cbeae20438

Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2021-08-23 17:19:28 -07:00
trop[bot]
24b3ee8444 feat: add electron.safeStorage encryption API (#30020) (#30430)
* feat: add SafeStorage api; first commit

* chore: rename files to fit semantically

* chore: add linkedBindings

* chore: fix function signatures

* chore: refactor eisCookieEncryptionEnabled() fuse

* chore: create test file

* chore: add tests and documentation

* chore: add copyright and lint

* chore: add additional tests

* chore: fix constructor

* chore: commit for pair programming

* wip: commit for keeley pairing

* chore: docs change and code cleanup

* chore: add linux import

* chore: add description to documentation

* chore: fixing tests

* chore: modify behaviour to not allow unencrypted strings as decyption input

* fix add patch for enabling default v11 encryption on Linux

* chore: remove file after each test

* chore: fix patch

* chore: remove chromium patch

* chore: add linux specific tests

* chore: fix path

* chore: add checker for linuux file deletion

* chore: add dcheck back

* chore: remove reference to headless mode

* chore: remove tests for linux

* chore: edit commit message

* chore: refactor safeStorage to not be a class

* chore: remove static variable from header

* chore:  spec file remove settimeout

Co-authored-by: VerteDinde <keeleymhammond@gmail.com>

Co-authored-by: George Xu <33054982+georgexu99@users.noreply.github.com>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-23 15:21:40 -07:00
Sudowoodo Release Bot
941ab704e1 Bump v15.0.0-alpha.9 2021-08-23 08:08:12 -07:00
trop[bot]
9d9c7a2f70 fix: media key globalShortcuts on macOS (#30570)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-19 19:54:59 -04:00
Sudowoodo Release Bot
e406ebd472 Bump v15.0.0-alpha.8 2021-08-19 09:11:24 -07:00
trop[bot]
e44b02b9ad fix: WebFrameMain mojo pipe not reset (#30632)
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
2021-08-19 16:55:21 +09:00
trop[bot]
b26760bed5 docs: typo in launch-app-from-url-in-another-app.md (#30628)
* Typo in launch-app-from-url-in-another-app.md

Code snippet for the info.plist example had html formatting. Removed.

* Fix paddings

Co-authored-by: Larry Kluger <larry.kluger@docusign.com>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2021-08-19 15:11:22 +09:00
trop[bot]
33fd679843 fix: cross-origin navigation disposing WebFrameMain instances (#30600)
* refactor: call methods directly from electron:WebContents

Writing static method boilerplate isn't fun

* fix: cross-origin navigation disposing WebFrameMain instances

* fix: move call to WFM::Connect

* refactor: use base::NoDestructor<T>

* Update shell/browser/api/electron_api_web_frame_main.cc

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

Co-authored-by: samuelmaddock <samuel.maddock@gmail.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-08-19 15:08:08 +09:00
trop[bot]
87399cc4f4 fix: handle nullish WebContentsView in UpdateDraggableRegions (#30558)
* fix: handle nullish WebContentsView in UpdateDraggableRegions

* build: nogncheck on webcontentsimpl include

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-08-19 10:38:51 +09:00
trop[bot]
33631b44f8 docs: remove unused Desktop Environment Integration doc (#30619)
* docs: remove unused Desktop Environment Integration doc

* Update docs/api/app.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

* Update docs/api/app.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2021-08-19 09:54:07 +09:00
trop[bot]
10a8752e70 docs: update Hazel information (#30623)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-19 09:53:35 +09:00
trop[bot]
12c54ab670 fix: persist BrowserView background color when bounds offscreen (#30542)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-19 08:39:53 +09:00
trop[bot]
1ca52e9b93 fix: {exit|enter}-html-fullscreen emitted after esc in webview (#30562)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-19 08:38:34 +09:00
trop[bot]
b444944a6d fix: documentEdited with non-default titlebarStyle (#30604)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-18 14:13:41 -07:00
trop[bot]
766a58e465 fix: disable kWindowCaptureMacV2 for desktopCapturer (#30525)
Co-authored-by: VerteDinde <khammond@slack-corp.com>
2021-08-16 11:17:59 -07:00
trop[bot]
8130613364 docs: uniformize tutorial titles (#30547)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-16 14:07:59 -04:00
trop[bot]
e1859a3657 docs: clarify usage of option (#30550)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-08-16 14:04:43 -04:00
Sudowoodo Release Bot
daf533dabb Bump v15.0.0-alpha.7 2021-08-16 08:37:31 -07:00
John Kleinschmidt
6cf9e12dd4 chore: bump chromium to 94.0.4590.2 (15-x-y) (#30512)
* chore: bump chromium to 94.0.4590.2 (main) (#30274)

* chore: bump chromium in DEPS to 94.0.4587.0

* chore: update patches

* 2823155: fix GPU video decoding capabilities enumeration

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

* 3041383: Reduce includes in url_request_mojom_traits.h

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

* chore: bump chromium in DEPS to 94.0.4588.0

* chore: update patches

* chore: bump chromium in DEPS to 94.0.4589.0

* chore: update patches

* 3050633: Rename ScaleFactor to ResourceScaleFactor

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

* 3048296: Create new mojo target to prevent traits header spreading

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

* 3046186: Rename base::ClampToRange

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

* chore: update picture-in-picture patch

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

* chore: bump chromium in DEPS to 94.0.4590.0

* chore: update patches

* 3057495: Fix base::NoDestructor usage in Mac KeychainPassword

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

* 3056134: Remove NetworkIsolationKey unused methods

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

* 3035091: [rab/gsab] Fix gsab maxByteLength after transferring to worker

Adds a patch to v8 to disable a DCHECK that is also firing on node streams
in child processes.

Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3035091

* chore: bump chromium in DEPS to 94.0.4590.2

* chore: fix mas_no_private_api.patch

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

* 3049555: [views] Add CHECK to prevent fallthrough to global NativeTheme

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

* chore: empty commit

* chore: fix whitespace for lint

* chore: cherry-pick chromium woa fix

* Revert "chore: cherry-pick chromium woa fix"

This reverts commit 64f3082e2d.

* chore: fix the build on Windows on ARM

* chore: remove commented code in printing.patch

* fixup! chore: remove commented code in printing.patch

do not remove the new weak_ptr check

* build: sync disable_use_lld_for_macos.patch

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
(cherry picked from commit 81c143318b)

* test fix for (unrelated) bug showing up on linux-asan

(cherry picked from commit a65d2dacd3)

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-08-16 10:12:39 -04:00
trop[bot]
0b5c95abdf ci: update git on CI machines (#30532)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-16 10:48:26 +02:00
Sudowoodo Release Bot
84df964d2f Bump v15.0.0-alpha.6 2021-08-12 08:18:31 -07:00
trop[bot]
6781a2c6e0 ci: make arm64 macos test cleanup more resilient (#30502)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-11 17:46:48 -04:00
Keeley Hammond
5dce02a3bb fix: explicitly define REFGUID from ::GUID&, not base::GUID (#30442) (#30498)
* fix: explicitly define REFGUID from ::GUID&

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

* fix: duplicate GUID_NULL symbol, add comment
2021-08-11 14:13:01 -07:00
trop[bot]
9aafee9cf0 docs: add missing <webview> event documentation (#30467)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-08-11 09:43:50 +09:00
trop[bot]
5df3e7e8fb ci: cleanup keychain after tests on arm64 mac (#30477)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-11 09:43:22 +09:00
trop[bot]
889be2327f docs: fix camelcase in menu example (#30463)
* docs: fix camelcase in menu example and add hint to deal with TS error

hideothers -> hideOthers (the TS compiler caught this)
The TypeScript compiler also did not like the pattern used to
switch between platforms for submenus was loosing the type information
of the literal constants and generalized them as strings which
conflicts with the type definition of MenuItemConstructorOptions.

* docs: Fix spelling, added hint to TypeScript

Without explicitly stating the type for the const template TypeScript does not create a
with the correct shape due to generalization to strings.

* remove ts hints

Co-authored-by: a@b <a@b>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2021-08-11 09:38:39 +09:00
trop[bot]
68e87ea4f5 fix: mouse doesn't work on frameless browserwindows (#30460)
Fixes #30402. This bug is from the "CanResize has been de-virtualized"
refactor in https://github.com/electron/electron/pull/29256

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-08-11 09:38:06 +09:00
trop[bot]
d3462596fa feat: add fuses for NODE_OPTIONS and --inspect (#30420)
* feat: add fuses for NODE_OPTIONS and --inspect

* chore: add node patch to ensure NODE_OPTIONS are never parsed when fuse is disabledd

* chore: fix lint

* chore: flip boolean logic

* chore: update patches

* chore: add trailing _ to static member

* Update add_should_read_node_options_from_env_option_to_disable_node_options.patch

* chore: update patches

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-08-09 22:07:18 -04:00
trop[bot]
f3fd8492cf chore: more crash-keys for gin::Wrappable debugging (#30423)
* chore: more crash-keys for gin::Wrappable debugging

* fix namespace for Event

* Update crash_keys.cc

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-08-10 09:50:10 +09:00
trop[bot]
a3ca79f883 build: rebase release branch before reverting bump (#30419)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-08-09 17:17:33 -04:00
trop[bot]
e2aaf5d18a build: set the export goma auth fallback flag for the control process (#30315)
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-08-09 11:54:09 -04:00
Electron Bot
e49b33cad8 Bump v15.0.0-alpha.5 2021-08-09 08:25:06 -07:00
trop[bot]
5ac3192dd0 fix: move window buttons in-place on macOS (#30392)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-08-09 16:00:29 +09:00
Electron Bot
ea63f2ea98 Bump v15.0.0-alpha.4 2021-08-05 08:41:46 -07:00
trop[bot]
73b280d6b4 fix: console window popping up when --enable-logging passed on windows (#30386)
* fix: console window popping up when --enable-logging passed on windows

* chore: update patches

* clang format

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-08-05 08:58:14 +09:00
trop[bot]
2de6939db0 build: fix building with enable_desktop_capturer = false (#30389)
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-08-04 09:56:10 +09:00
Electron Bot
022620f4cd Bump v15.0.0-alpha.3 2021-08-02 08:16:27 -07:00
trop[bot]
d1894977de build: update build images to update npm and node (#30364)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-08-02 13:00:45 +09:00
trop[bot]
6765eec7a9 fix: respect LogJsConsoleMessages feature in InspectableWebContents::DidAddMessageToConsole (#30356)
* fix: respect LogJsConsoleMessages feature in InspectableWebContents::DidAddMessageToConsole

* just delete the method

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-08-02 10:00:30 +09:00
trop[bot]
d462204dce fix: guard against missing native view (#30328)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-08-02 09:57:58 +09:00
trop[bot]
52d9bf41e6 chore: update deps (#30346)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-07-30 14:56:10 -07:00
trop[bot]
0cd714a3bb fix: use contentAspectRatio not aspectRatio (#30332)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-30 02:24:30 -07:00
trop[bot]
1228c69e1d fix: BrowserViews not painting their WebContents (#30336)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-30 02:23:08 -07:00
trop[bot]
c09b22bf85 chore: remove experimental from navigator.serial implementation (#30334)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-07-29 21:55:48 -04:00
trop[bot]
65d83f2054 chore: update publish to npm to use GitHub token (#30292)
ensures that we don't get hit with a rate limit while trying to publish a release.

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-07-28 12:24:29 -07:00
trop[bot]
6fa95afd71 test: deflake crashReporter.getLastCrashReport test (#30309)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-07-28 12:21:04 -07:00
trop[bot]
d58211304b fix: update traffic lights position for macOS 11 (#30270)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-07-28 12:02:09 +02:00
trop[bot]
760cb4ab50 fix: Add missing items to menuItem.role documentation (#30302) 2021-07-28 11:54:41 +02:00
trop[bot]
4acdb97543 chore: bump chromium to 94.0.4584.0 (main) (#30030) (#30268)
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-07-26 16:11:58 -07:00
Electron Bot
011a874021 Bump v15.0.0-alpha.2 2021-07-26 10:07:59 -07:00
trop[bot]
bac728a134 fix: process.exit crash in nativeWindowOpen (#30238)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-07-26 18:28:37 +02:00
trop[bot]
9d6c37ac88 docs: update title of guide (#30260)
Co-authored-by: Antón Molleda <amolleda@gmail.com>
2021-07-26 20:18:20 +09:00
trop[bot]
25fc9acec6 fix: increase stack size on windows x86 (#30243)
* fix: increace main thread stack size on windows x86

* chore: improve quit-on-crashed-event spec

* chore: add debug logs

* Revert "chore: add debug logs"

This reverts commit 0be81ae07c.

* chore: use a reliable crash endpoint

Co-authored-by: Stephen Wang <wangwenqiang.wwq@bytedance.com>
Co-authored-by: Deepak Mohan <hop2deep@gmail.com>
2021-07-26 17:45:36 +09:00
Electron Bot
edb65a07f1 Bump v15.0.0-alpha.1 2021-07-21 15:05:18 -07:00
Samuel Attard
82b5fbc396 build: handle alpha tag existing before beta line has finished 2021-07-21 14:50:06 -07:00
529 changed files with 17820 additions and 17885 deletions

View File

@@ -322,10 +322,6 @@ step-setup-goma-for-build: &step-setup-goma-for-build
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
export GOMA_FALLBACK_ON_AUTH_FAILURE=true
third_party/goma/goma_ctl.py ensure_start
if [ ! -z "$RAW_GOMA_AUTH" ] && [ "`third_party/goma/goma_auth.py info`" != "Login as Fermi Planck" ]; then
echo "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token."
exit 1
fi
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
echo 'export GOMA_FALLBACK_ON_AUTH_FAILURE=true' >> $BASH_ENV

View File

@@ -1,59 +0,0 @@
# Electron Dev on Codespaces
Welcome to the Codespaces Electron Developer Environment.
## Quick Start
Upon creation of your codespace you should have [build tools](https://github.com/electron/build-tools) installed and an initialized gclient checkout of Electron. In order to build electron you'll need to run the following commands.
```bash
e sync -vv
e build
```
The initial sync will take approximately ~30 minutes and the build will take ~8 minutes. Incremental syncs and incremental builds are substantially quicker.
## Directory Structure
Codespaces doesn't lean very well into gclient based checkouts, the directory structure is slightly strange. There are two locations for the `electron` checkout that both map to the same files under the hood.
```graphql
# Primary gclient checkout container
/workspaces/gclient/*
src/* - # Chromium checkout
electron - # Electron checkout
# Symlinked Electron checkout (identical to the above)
/workspaces/electron
```
## Goma
If you are a maintainer [with Goma access](../docs/development/goma.md) it should be automatically configured and authenticated when you spin up a new codespaces instance. You can validate this by checking `e d goma_auth info` or by checking that your build-tools configuration has a goma mode of `cluster`.
## Running Electron
You can run Electron in a few ways. If you just want to see if it launches:
```bash
# Enter an interactive JS prompt headlessly
xvfb-run e start -i
```
But if you want to actually see Electron you will need to use the built-in VNC capability. If you click "Ports" in codespaces and then open the `VNC web client` forwarded port you should see a web based VNC portal in your browser. When you are asked for a password use `builduser`.
Once in the VNC UI you can open `Applications -> System -> XTerm` which will open a VNC based terminal app and then you can run `e start` like normal and Electron will open in your VNC session.
## Running Tests
You run tests via build-tools and `xvfb`.
```bash
# Run all tests
xvfb-run e test
# Run the main process tests
xvfb-run e test --runners=main
# Run the old remote tests
xvfb-run e test --runners=remote
```

View File

@@ -1,43 +0,0 @@
{
"dockerComposeFile": "docker-compose.yml",
"service": "buildtools",
"onCreateCommand": ".devcontainer/on-create-command.sh",
"workspaceFolder": "/workspaces/gclient/src/electron",
"extensions": [
"joeleinbinder.mojom-language",
"rafaelmaiolla.diff",
"surajbarkale.ninja",
"ms-vscode.cpptools",
"mutantdino.resourcemonitor",
"dbaeumer.vscode-eslint",
"shakram02.bash-beautify",
"marshallofsound.gnls-electron"
],
"settings": {
"[gn]": {
"editor.formatOnSave": true
},
"editor.tabSize": 2,
"bashBeautify.tabSize": 2
},
"forwardPorts": [8088, 6080, 5901],
"portsAttributes": {
"8088": {
"label": "Goma Control Panel",
"onAutoForward": "silent"
},
"6080": {
"label": "VNC web client (noVNC)",
"onAutoForward": "silent"
},
"5901": {
"label": "VNC TCP port",
"onAutoForward": "silent"
}
},
"hostRequirements": {
"storage": "32gb",
"cpus": 8
},
"remoteUser": "builduser"
}

View File

@@ -1,19 +0,0 @@
version: '3'
services:
buildtools:
image: ghcr.io/electron/devcontainer:27db4a3e3512bfd2e47f58cea69922da0835f1d9
volumes:
- ..:/workspaces/gclient/src/electron:cached
- /var/run/docker.sock:/var/run/docker.sock
command: /bin/sh -c "while sleep 1000; do :; done"
user: builduser
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined

View File

@@ -1,74 +0,0 @@
#!/bin/bash
set -eo pipefail
buildtools=$HOME/.electron_build_tools
gclient_root=/workspaces/gclient
buildtools_configs=/workspaces/buildtools-configs
export PATH="$PATH:$buildtools/src"
# Create the persisted buildtools config folder
mkdir -p $buildtools_configs
rm -f $buildtools/configs
ln -s $buildtools_configs $buildtools/configs
# Write the gclient config if it does not already exist
if [ ! -f $gclient_root/.gclient ]; then
echo "solutions = [
{ \"name\" : \"src/electron\",
\"url\" : \"https://github.com/electron/electron\",
\"deps_file\" : \"DEPS\",
\"managed\" : False,
\"custom_deps\" : {
},
\"custom_vars\": {},
},
]
" >$gclient_root/.gclient
fi
# Write the default buildtools config file if it does
# not already exist
if [ ! -f $buildtools/configs/evm.testing.json ]; then
write_config() {
echo "
{
\"root\": \"/workspaces/gclient\",
\"goma\": \"$1\",
\"gen\": {
\"args\": [
\"import(\\\"//electron/build/args/testing.gn\\\")\",
\"import(\\\"/home/builduser/.electron_build_tools/third_party/goma.gn\\\")\"
],
\"out\": \"Testing\"
},
\"env\": {
\"CHROMIUM_BUILDTOOLS_PATH\": \"/workspaces/gclient/src/buildtools\",
\"GIT_CACHE_PATH\": \"/workspaces/gclient/.git-cache\"
},
\"remotes\": {
\"electron\": {
\"origin\": \"https://github.com/electron/electron.git\"
}
}
}
" >$buildtools/configs/evm.testing.json
}
# Start out as cache only
write_config cache-only
e use testing
# Attempt to auth to the goma service via codespaces tokens
# if it works we can use the goma cluster
export NOTGOMA_CODESPACES_TOKEN=$GITHUB_TOKEN
if e d goma_auth login; then
write_config cluster
fi
else
# Even if the config file existed we still need to re-auth with the goma
# cluster
NOTGOMA_CODESPACES_TOKEN=$GITHUB_TOKEN e d goma_auth login || true
fi

3
.github/CODEOWNERS vendored
View File

@@ -4,7 +4,7 @@
# https://git-scm.com/docs/gitignore
# Upgrades WG
/patches/ @electron/wg-upgrades @electron/wg-security
/patches/ @electron/wg-upgrades
DEPS @electron/wg-upgrades
# Releases WG
@@ -16,4 +16,3 @@ DEPS @electron/wg-upgrades
/lib/browser/guest-view-manager.ts @electron/wg-security
/lib/browser/guest-window-proxy.ts @electron/wg-security
/lib/browser/rpc-server.ts @electron/wg-security
/lib/renderer/security-warnings.ts @electron/wg-security

View File

@@ -37,4 +37,4 @@ body:
label: Additional Information
description: Add any other context about the problem here.
validations:
required: false
required: true

1
.nvmrc
View File

@@ -1 +0,0 @@
14

View File

@@ -313,23 +313,6 @@ action("electron_fuses") {
args = rebase_path(outputs)
}
action("electron_generate_node_defines") {
script = "build/generate_node_defines.py"
inputs = [
"//third_party/electron_node/src/tracing/trace_event_common.h",
"//third_party/electron_node/src/tracing/trace_event.h",
"//third_party/electron_node/src/util.h",
]
outputs = [
"$target_gen_dir/push_and_undef_node_defines.h",
"$target_gen_dir/pop_node_defines.h",
]
args = [ rebase_path(target_gen_dir) ] + rebase_path(inputs)
}
source_set("electron_lib") {
configs += [ "//v8:external_startup_data" ]
configs += [ "//third_party/electron_node:node_internals" ]
@@ -341,7 +324,6 @@ source_set("electron_lib") {
deps = [
":electron_fuses",
":electron_generate_node_defines",
":electron_js2c",
":electron_version_header",
":resources",
@@ -353,7 +335,6 @@ source_set("electron_lib") {
"//base/allocator:buildflags",
"//chrome/app:command_ids",
"//chrome/app/resources:platform_locale_settings",
"//components/autofill/core/common:features",
"//components/certificate_transparency",
"//components/language/core/browser",
"//components/net_log",
@@ -420,6 +401,7 @@ source_set("electron_lib") {
]
include_dirs = [
"chromium_src",
".",
"$target_gen_dir",
@@ -553,9 +535,8 @@ source_set("electron_lib") {
"GLIB_DISABLE_DEPRECATION_WARNINGS",
]
sources += filenames.lib_sources_nss
sources += [
"shell/browser/certificate_manager_model.cc",
"shell/browser/certificate_manager_model.h",
"shell/browser/ui/gtk/app_indicator_icon.cc",
"shell/browser/ui/gtk/app_indicator_icon.h",
"shell/browser/ui/gtk/app_indicator_icon_menu.cc",

4
DEPS
View File

@@ -15,9 +15,9 @@ gclient_gn_args = [
vars = {
'chromium_version':
'96.0.4664.174',
'94.0.4606.81',
'node_version':
'v16.9.1',
'v16.5.0',
'nan_version':
# The following commit hash of NAN is v2.14.2 with *only* changes to the
# test suite. This should be updated to a specific tag when one becomes

View File

@@ -1 +1 @@
16.2.2
15.3.7

View File

@@ -60,6 +60,7 @@ npm start
- [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - Sample starter apps created by the community
- [electron/simple-samples](https://github.com/electron/simple-samples) - Small applications with ideas for taking them further
- [electron/electron-api-demos](https://github.com/electron/electron-api-demos) - An Electron app that teaches you how to use Electron
- [hokein/electron-sample-apps](https://github.com/hokein/electron-sample-apps) - Small demo apps for the various Electron APIs
## Programmatic usage

View File

@@ -66,31 +66,6 @@ build_script:
- mkdir src
- update_depot_tools.bat
- ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npm install
- mkdir third_party
- ps: >-
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
- ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
- ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
- cd ..
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$goma_login = python $env:LOCAL_GOMA_DIR\goma_auth.py info
if ($goma_login -eq 'Login as Fermi Planck') {
Write-warning "Goma authentication is correct";
} else {
Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
$host.SetShouldExit(1)
}
}
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
@@ -137,7 +112,7 @@ build_script:
}
}
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync )
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags --ignore_locks)
- ps: >-
if ($env:SAVE_GCLIENT_SRC -eq 'true') {
# archive current source for future use
@@ -154,6 +129,21 @@ build_script:
Write-warning "Failed to add third_party\angle\.git; continuing anyway"
}
}
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npm install
- mkdir third_party
- ps: >-
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
- ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
- ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
- cd ..
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
- cd src
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "

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 = 99
node_module_version = 98
v8_promise_internal_field_count = 1
v8_typed_array_max_size_in_heap = 0

View File

@@ -1,34 +0,0 @@
import os
import re
import sys
DEFINE_EXTRACT_REGEX = re.compile('^ *# *define (\w*)', re.MULTILINE)
def main(outDir, headers):
defines = []
for filename in headers:
with open(filename, 'r') as f:
content = f.read()
defines += read_defines(content)
push_and_undef = ''
for define in defines:
push_and_undef += '#pragma push_macro("%s")\n' % define
push_and_undef += '#undef %s\n' % define
with open(os.path.join(outDir, 'push_and_undef_node_defines.h'), 'w') as o:
o.write(push_and_undef)
pop = ''
for define in defines:
pop += '#pragma pop_macro("%s")\n' % define
with open(os.path.join(outDir, 'pop_node_defines.h'), 'w') as o:
o.write(pop)
def read_defines(content):
defines = []
for match in DEFINE_EXTRACT_REGEX.finditer(content):
defines.append(match.group(1))
return defines
if __name__ == '__main__':
main(sys.argv[1], sys.argv[2:])

View File

@@ -5,8 +5,8 @@ template("npm_action") {
action("npm_pre_flight_" + target_name) {
inputs = [
"//electron/package.json",
"//electron/yarn.lock",
"package.json",
"yarn.lock",
]
script = "//electron/build/npm-run.py"

View File

@@ -1,12 +1,9 @@
from __future__ import unicode_literals
from __future__ import with_statement
import contextlib
import sys
import os
import optparse
import json
import re
import subprocess
sys.path.append("%s/../../build" % os.path.dirname(os.path.realpath(__file__)))
@@ -36,56 +33,36 @@ def calculate_hash(root):
return CalculateHash('.', None)
def windows_installed_software():
powershell_command = [
"Get-CimInstance",
"-Namespace",
"root\cimv2",
"-Class",
"Win32_product",
"|",
"Select",
"vendor,",
"description,",
"@{l='install_location';e='InstallLocation'},",
"@{l='install_date';e='InstallDate'},",
"@{l='install_date_2';e='InstallDate2'},",
"caption,",
"version,",
"name,",
"@{l='sku_number';e='SKUNumber'}",
"|",
"ConvertTo-Json",
]
import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer, "root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_Product")
items = []
proc = subprocess.Popen(
["powershell.exe", "-Command", "-"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
)
for objItem in colItems:
item = {}
if objItem.Caption:
item['caption'] = objItem.Caption
if objItem.Caption:
item['description'] = objItem.Description
if objItem.InstallDate:
item['install_date'] = objItem.InstallDate
if objItem.InstallDate2:
item['install_date_2'] = objItem.InstallDate2
if objItem.InstallLocation:
item['install_location'] = objItem.InstallLocation
if objItem.Name:
item['name'] = objItem.Name
if objItem.SKUNumber:
item['sku_number'] = objItem.SKUNumber
if objItem.Vendor:
item['vendor'] = objItem.Vendor
if objItem.Version:
item['version'] = objItem.Version
items.append(item)
stdout, _ = proc.communicate(" ".join(powershell_command).encode("utf-8"))
if proc.returncode != 0:
raise RuntimeError("Failed to get list of installed software")
# On AppVeyor there's other output related to PSReadline,
# so grab only the JSON output and ignore everything else
json_match = re.match(
r".*(\[.*{.*}.*\]).*", stdout.decode("utf-8"), re.DOTALL
)
if not json_match:
raise RuntimeError(
"Couldn't find JSON output for list of installed software"
)
# Filter out missing keys
return list(
map(
lambda info: {k: info[k] for k in info if info[k]},
json.loads(json_match.group(1)),
)
)
return items
def windows_profile():
@@ -112,7 +89,7 @@ def windows_profile():
def main(options):
if sys.platform == 'win32':
with open(options.output_json, 'w') as f:
with open(options.output_json, 'wb') as f:
json.dump(windows_profile(), f)
else:
raise OSError("Unsupported OS")

View File

@@ -36,7 +36,7 @@ template("webpack_build") {
rebase_path("$target_gen_dir/buildflags/buildflags.h"),
"--env.mode=" + mode,
]
deps += [ "//electron/buildflags" ]
deps += [ "buildflags" ]
outputs = [ invoker.out_file ]
}

View File

@@ -15,10 +15,6 @@ static_library("chrome") {
sources = [
"//chrome/browser/accessibility/accessibility_ui.cc",
"//chrome/browser/accessibility/accessibility_ui.h",
"//chrome/browser/app_mode/app_mode_utils.cc",
"//chrome/browser/app_mode/app_mode_utils.h",
"//chrome/browser/browser_features.cc",
"//chrome/browser/browser_features.h",
"//chrome/browser/browser_process.cc",
"//chrome/browser/browser_process.h",
"//chrome/browser/devtools/devtools_contents_resizing_strategy.cc",
@@ -29,7 +25,6 @@ static_library("chrome") {
"//chrome/browser/devtools/devtools_eye_dropper.h",
"//chrome/browser/devtools/devtools_file_system_indexer.cc",
"//chrome/browser/devtools/devtools_file_system_indexer.h",
"//chrome/browser/devtools/devtools_settings.h",
"//chrome/browser/extensions/global_shortcut_listener.cc",
"//chrome/browser/extensions/global_shortcut_listener.h",
"//chrome/browser/icon_loader.cc",
@@ -52,23 +47,6 @@ static_library("chrome") {
"//chrome/browser/predictors/proxy_lookup_client_impl.h",
"//chrome/browser/predictors/resolve_host_client_impl.cc",
"//chrome/browser/predictors/resolve_host_client_impl.h",
"//chrome/browser/process_singleton.h",
"//chrome/browser/ui/browser_dialogs.cc",
"//chrome/browser/ui/browser_dialogs.h",
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.cc",
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h",
"//chrome/browser/ui/exclusive_access/exclusive_access_controller_base.cc",
"//chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h",
"//chrome/browser/ui/exclusive_access/exclusive_access_manager.cc",
"//chrome/browser/ui/exclusive_access/exclusive_access_manager.h",
"//chrome/browser/ui/exclusive_access/fullscreen_controller.cc",
"//chrome/browser/ui/exclusive_access/fullscreen_controller.h",
"//chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.cc",
"//chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.h",
"//chrome/browser/ui/exclusive_access/keyboard_lock_controller.cc",
"//chrome/browser/ui/exclusive_access/keyboard_lock_controller.h",
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.cc",
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.h",
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.cc",
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
@@ -79,10 +57,6 @@ static_library("chrome") {
"//extensions/browser/app_window/size_constraints.h",
]
if (is_posix) {
sources += [ "//chrome/browser/process_singleton_posix.cc" ]
}
if (is_mac) {
sources += [
"//chrome/browser/extensions/global_shortcut_listener_mac.h",
@@ -91,7 +65,6 @@ static_library("chrome") {
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
"//chrome/browser/process_singleton_mac.mm",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
]
@@ -103,7 +76,6 @@ static_library("chrome") {
"//chrome/browser/extensions/global_shortcut_listener_win.h",
"//chrome/browser/icon_loader_win.cc",
"//chrome/browser/media/webrtc/window_icon_util_win.cc",
"//chrome/browser/process_singleton_win.cc",
"//chrome/browser/ui/frame/window_frame_util.h",
"//chrome/browser/ui/view_ids.h",
"//chrome/browser/win/chrome_process_finder.cc",
@@ -115,7 +87,7 @@ static_library("chrome") {
}
if (is_linux) {
sources += [ "//chrome/browser/media/webrtc/window_icon_util_ozone.cc" ]
sources += [ "//chrome/browser/media/webrtc/window_icon_util_linux.cc" ]
}
if (use_aura) {
@@ -132,13 +104,13 @@ static_library("chrome") {
"//components/keyed_service/content",
"//components/paint_preview/buildflags",
"//components/proxy_config",
"//components/services/language_detection/public/mojom",
"//content/public/browser",
"//services/strings",
]
deps = [
"//chrome/browser:resource_prefetch_predictor_proto",
"//chrome/services/speech:buildflags",
"//components/optimization_guide/proto:optimization_guide_proto",
]
@@ -148,6 +120,16 @@ static_library("chrome") {
if (is_linux) {
sources += [ "//chrome/browser/icon_loader_auralinux.cc" ]
if (use_x11 || use_ozone) {
sources +=
[ "//chrome/browser/extensions/global_shortcut_listener_linux.cc" ]
}
if (use_x11) {
sources += [
"//chrome/browser/extensions/global_shortcut_listener_x11.cc",
"//chrome/browser/extensions/global_shortcut_listener_x11.h",
]
}
if (use_ozone) {
deps += [ "//ui/ozone" ]
sources += [
@@ -177,7 +159,6 @@ static_library("chrome") {
if (enable_desktop_capturer) {
sources += [
"//chrome/browser/media/webrtc/desktop_media_list.cc",
"//chrome/browser/media/webrtc/desktop_media_list.h",
"//chrome/browser/media/webrtc/desktop_media_list_base.cc",
"//chrome/browser/media/webrtc/desktop_media_list_base.h",
@@ -215,13 +196,6 @@ static_library("chrome") {
"//chrome/browser/printing/printing_service.h",
]
if (enable_oop_printing) {
sources += [
"//chrome/browser/printing/print_backend_service_manager.cc",
"//chrome/browser/printing/print_backend_service_manager.h",
]
}
public_deps += [
"//chrome/services/printing:lib",
"//components/printing/browser",
@@ -229,7 +203,6 @@ static_library("chrome") {
"//components/services/print_compositor",
"//components/services/print_compositor/public/cpp",
"//components/services/print_compositor/public/mojom",
"//printing/backend",
]
deps += [

View File

@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "shell/browser/certificate_manager_model.h"
#include "chrome/browser/certificate_manager_model.h"
#include <utility>

View File

@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_CERTIFICATE_MANAGER_MODEL_H_
#define SHELL_BROWSER_CERTIFICATE_MANAGER_MODEL_H_
#ifndef CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_
#define CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_
#include <memory>
#include <string>
@@ -112,4 +112,4 @@ class CertificateManagerModel {
DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel);
};
#endif // SHELL_BROWSER_CERTIFICATE_MANAGER_MODEL_H_
#endif // CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_

View File

@@ -0,0 +1,185 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_PROCESS_SINGLETON_H_
#define CHROME_BROWSER_PROCESS_SINGLETON_H_
#if defined(OS_WIN)
#include <windows.h>
#endif // defined(OS_WIN)
#include "base/callback.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/process/process.h"
#include "base/sequence_checker.h"
#include "ui/gfx/native_widget_types.h"
#if defined(OS_POSIX) && !defined(OS_ANDROID)
#include "base/files/scoped_temp_dir.h"
#endif
#if defined(OS_WIN)
#include "base/win/message_window.h"
#endif // defined(OS_WIN)
namespace base {
class CommandLine;
}
// ProcessSingleton ----------------------------------------------------------
//
// This class allows different browser processes to communicate with
// each other. It is named according to the user data directory, so
// we can be sure that no more than one copy of the application can be
// running at once with a given data directory.
//
// Implementation notes:
// - the Windows implementation uses an invisible global message window;
// - the Linux implementation uses a Unix domain socket in the user data dir.
class ProcessSingleton {
public:
enum NotifyResult {
PROCESS_NONE,
PROCESS_NOTIFIED,
PROFILE_IN_USE,
LOCK_ERROR,
};
// Implement this callback to handle notifications from other processes. The
// callback will receive the command line and directory with which the other
// Chrome process was launched. Return true if the command line will be
// handled within the current browser instance or false if the remote process
// should handle it (i.e., because the current process is shutting down).
using NotificationCallback = base::RepeatingCallback<bool(
const base::CommandLine::StringVector& command_line,
const base::FilePath& current_directory)>;
ProcessSingleton(const base::FilePath& user_data_dir,
const NotificationCallback& notification_callback);
~ProcessSingleton();
// Notify another process, if available. Otherwise sets ourselves as the
// singleton instance. Returns PROCESS_NONE if we became the singleton
// instance. Callers are guaranteed to either have notified an existing
// process or have grabbed the singleton (unless the profile is locked by an
// unreachable process).
// TODO(brettw): Make the implementation of this method non-platform-specific
// by making Linux re-use the Windows implementation.
NotifyResult NotifyOtherProcessOrCreate();
void StartListeningOnSocket();
void OnBrowserReady();
// Sets ourself up as the singleton instance. Returns true on success. If
// false is returned, we are not the singleton instance and the caller must
// exit.
// NOTE: Most callers should generally prefer NotifyOtherProcessOrCreate() to
// this method, only callers for whom failure is preferred to notifying
// another process should call this directly.
bool Create();
// Clear any lock state during shutdown.
void Cleanup();
#if defined(OS_POSIX) && !defined(OS_ANDROID)
static void DisablePromptForTesting();
#endif
#if defined(OS_WIN)
// Called to query whether to kill a hung browser process that has visible
// windows. Return true to allow killing the hung process.
using ShouldKillRemoteProcessCallback = base::RepeatingCallback<bool()>;
void OverrideShouldKillRemoteProcessCallbackForTesting(
const ShouldKillRemoteProcessCallback& display_dialog_callback);
#endif
protected:
// Notify another process, if available.
// Returns true if another process was found and notified, false if we should
// continue with the current process.
// On Windows, Create() has to be called before this.
NotifyResult NotifyOtherProcess();
#if defined(OS_POSIX) && !defined(OS_ANDROID)
// Exposed for testing. We use a timeout on Linux, and in tests we want
// this timeout to be short.
NotifyResult NotifyOtherProcessWithTimeout(
const base::CommandLine& command_line,
int retry_attempts,
const base::TimeDelta& timeout,
bool kill_unresponsive);
NotifyResult NotifyOtherProcessWithTimeoutOrCreate(
const base::CommandLine& command_line,
int retry_attempts,
const base::TimeDelta& timeout);
void OverrideCurrentPidForTesting(base::ProcessId pid);
void OverrideKillCallbackForTesting(
const base::RepeatingCallback<void(int)>& callback);
#endif
private:
NotificationCallback notification_callback_; // Handler for notifications.
#if defined(OS_WIN)
HWND remote_window_ = nullptr; // The HWND_MESSAGE of another browser.
base::win::MessageWindow window_; // The message-only window.
bool is_virtualized_ =
false; // Stuck inside Microsoft Softricity VM environment.
HANDLE lock_file_ = INVALID_HANDLE_VALUE;
base::FilePath user_data_dir_;
ShouldKillRemoteProcessCallback should_kill_remote_process_callback_;
#elif defined(OS_POSIX) && !defined(OS_ANDROID)
// Start listening to the socket.
void StartListening(int sock);
// Return true if the given pid is one of our child processes.
// Assumes that the current pid is the root of all pids of the current
// instance.
bool IsSameChromeInstance(pid_t pid);
// Extract the process's pid from a symbol link path and if it is on
// the same host, kill the process, unlink the lock file and return true.
// If the process is part of the same chrome instance, unlink the lock file
// and return true without killing it.
// If the process is on a different host, return false.
bool KillProcessByLockPath();
// Default function to kill a process, overridable by tests.
void KillProcess(int pid);
// Allow overriding for tests.
base::ProcessId current_pid_;
// Function to call when the other process is hung and needs to be killed.
// Allows overriding for tests.
base::RepeatingCallback<void(int)> kill_callback_;
// Path in file system to the socket.
base::FilePath socket_path_;
// Path in file system to the lock.
base::FilePath lock_path_;
// Path in file system to the cookie file.
base::FilePath cookie_path_;
// Temporary directory to hold the socket.
base::ScopedTempDir socket_dir_;
// Helper class for linux specific messages. LinuxWatcher is ref counted
// because it posts messages between threads.
class LinuxWatcher;
scoped_refptr<LinuxWatcher> watcher_;
int sock_ = -1;
bool listen_on_ready_ = false;
#endif
SEQUENCE_CHECKER(sequence_checker_);
DISALLOW_COPY_AND_ASSIGN(ProcessSingleton);
};
#endif // CHROME_BROWSER_PROCESS_SINGLETON_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,315 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/process_singleton.h"
#include <windows.h>
#include <shellapi.h>
#include "base/base_paths.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/process/process.h"
#include "base/process/process_info.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "chrome/browser/win/chrome_process_finder.h"
#include "content/public/common/result_codes.h"
#include "net/base/escape.h"
#include "ui/gfx/win/hwnd_util.h"
namespace {
const char kLockfile[] = "lockfile";
// A helper class that acquires the given |mutex| while the AutoLockMutex is in
// scope.
class AutoLockMutex {
public:
explicit AutoLockMutex(HANDLE mutex) : mutex_(mutex) {
DWORD result = ::WaitForSingleObject(mutex_, INFINITE);
DPCHECK(result == WAIT_OBJECT_0) << "Result = " << result;
}
~AutoLockMutex() {
BOOL released = ::ReleaseMutex(mutex_);
DPCHECK(released);
}
private:
HANDLE mutex_;
DISALLOW_COPY_AND_ASSIGN(AutoLockMutex);
};
// A helper class that releases the given |mutex| while the AutoUnlockMutex is
// in scope and immediately re-acquires it when going out of scope.
class AutoUnlockMutex {
public:
explicit AutoUnlockMutex(HANDLE mutex) : mutex_(mutex) {
BOOL released = ::ReleaseMutex(mutex_);
DPCHECK(released);
}
~AutoUnlockMutex() {
DWORD result = ::WaitForSingleObject(mutex_, INFINITE);
DPCHECK(result == WAIT_OBJECT_0) << "Result = " << result;
}
private:
HANDLE mutex_;
DISALLOW_COPY_AND_ASSIGN(AutoUnlockMutex);
};
// Checks the visibility of the enumerated window and signals once a visible
// window has been found.
BOOL CALLBACK BrowserWindowEnumeration(HWND window, LPARAM param) {
bool* result = reinterpret_cast<bool*>(param);
*result = ::IsWindowVisible(window) != 0;
// Stops enumeration if a visible window has been found.
return !*result;
}
bool ParseCommandLine(const COPYDATASTRUCT* cds,
base::CommandLine::StringVector* parsed_command_line,
base::FilePath* current_directory) {
// We should have enough room for the shortest command (min_message_size)
// and also be a multiple of wchar_t bytes. The shortest command
// possible is L"START\0\0" (empty current directory and command line).
static const int min_message_size = 7;
if (cds->cbData < min_message_size * sizeof(wchar_t) ||
cds->cbData % sizeof(wchar_t) != 0) {
LOG(WARNING) << "Invalid WM_COPYDATA, length = " << cds->cbData;
return false;
}
// We split the string into 4 parts on NULLs.
DCHECK(cds->lpData);
const std::wstring msg(static_cast<wchar_t*>(cds->lpData),
cds->cbData / sizeof(wchar_t));
const std::wstring::size_type first_null = msg.find_first_of(L'\0');
if (first_null == 0 || first_null == std::wstring::npos) {
// no NULL byte, don't know what to do
LOG(WARNING) << "Invalid WM_COPYDATA, length = " << msg.length()
<< ", first null = " << first_null;
return false;
}
// Decode the command, which is everything until the first NULL.
if (msg.substr(0, first_null) == L"START") {
// Another instance is starting parse the command line & do what it would
// have done.
VLOG(1) << "Handling STARTUP request from another process";
const std::wstring::size_type second_null =
msg.find_first_of(L'\0', first_null + 1);
if (second_null == std::wstring::npos || first_null == msg.length() - 1 ||
second_null == msg.length()) {
LOG(WARNING) << "Invalid format for start command, we need a string in 4 "
"parts separated by NULLs";
return false;
}
// Get current directory.
*current_directory =
base::FilePath(msg.substr(first_null + 1, second_null - first_null));
const std::wstring::size_type third_null =
msg.find_first_of(L'\0', second_null + 1);
if (third_null == std::wstring::npos || third_null == msg.length()) {
LOG(WARNING) << "Invalid format for start command, we need a string in 4 "
"parts separated by NULLs";
}
// Get command line.
const std::wstring cmd_line =
msg.substr(second_null + 1, third_null - second_null);
*parsed_command_line = base::CommandLine::FromString(cmd_line).argv();
return true;
}
return false;
}
bool ProcessLaunchNotification(
const ProcessSingleton::NotificationCallback& notification_callback,
UINT message,
WPARAM wparam,
LPARAM lparam,
LRESULT* result) {
if (message != WM_COPYDATA)
return false;
// Handle the WM_COPYDATA message from another process.
const COPYDATASTRUCT* cds = reinterpret_cast<COPYDATASTRUCT*>(lparam);
base::CommandLine::StringVector parsed_command_line;
base::FilePath current_directory;
if (!ParseCommandLine(cds, &parsed_command_line, &current_directory)) {
*result = TRUE;
return true;
}
*result = notification_callback.Run(parsed_command_line, current_directory)
? TRUE
: FALSE;
return true;
}
bool TerminateAppWithError() {
// TODO: This is called when the secondary process can't ping the primary
// process. Need to find out what to do here.
return false;
}
} // namespace
ProcessSingleton::ProcessSingleton(
const base::FilePath& user_data_dir,
const NotificationCallback& notification_callback)
: notification_callback_(notification_callback),
user_data_dir_(user_data_dir),
should_kill_remote_process_callback_(
base::BindRepeating(&TerminateAppWithError)) {
// The user_data_dir may have not been created yet.
base::CreateDirectoryAndGetError(user_data_dir, nullptr);
}
ProcessSingleton::~ProcessSingleton() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (lock_file_ != INVALID_HANDLE_VALUE)
::CloseHandle(lock_file_);
}
// Code roughly based on Mozilla.
ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
if (is_virtualized_)
return PROCESS_NOTIFIED; // We already spawned the process in this case.
if (lock_file_ == INVALID_HANDLE_VALUE && !remote_window_) {
return LOCK_ERROR;
} else if (!remote_window_) {
return PROCESS_NONE;
}
switch (chrome::AttemptToNotifyRunningChrome(remote_window_)) {
case chrome::NOTIFY_SUCCESS:
return PROCESS_NOTIFIED;
case chrome::NOTIFY_FAILED:
remote_window_ = NULL;
return PROCESS_NONE;
case chrome::NOTIFY_WINDOW_HUNG:
// Fall through and potentially terminate the hung browser.
break;
}
DWORD process_id = 0;
DWORD thread_id = ::GetWindowThreadProcessId(remote_window_, &process_id);
if (!thread_id || !process_id) {
remote_window_ = NULL;
return PROCESS_NONE;
}
base::Process process = base::Process::Open(process_id);
// The window is hung. Scan for every window to find a visible one.
bool visible_window = false;
::EnumThreadWindows(thread_id, &BrowserWindowEnumeration,
reinterpret_cast<LPARAM>(&visible_window));
// If there is a visible browser window, ask the user before killing it.
if (visible_window && !should_kill_remote_process_callback_.Run()) {
// The user denied. Quit silently.
return PROCESS_NOTIFIED;
}
// Time to take action. Kill the browser process.
process.Terminate(content::RESULT_CODE_HUNG, true);
remote_window_ = NULL;
return PROCESS_NONE;
}
ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessOrCreate() {
ProcessSingleton::NotifyResult result = PROCESS_NONE;
if (!Create()) {
result = NotifyOtherProcess();
if (result == PROCESS_NONE)
result = PROFILE_IN_USE;
}
return result;
}
void ProcessSingleton::StartListeningOnSocket() {}
void ProcessSingleton::OnBrowserReady() {}
// Look for a Chrome instance that uses the same profile directory. If there
// isn't one, create a message window with its title set to the profile
// directory path.
bool ProcessSingleton::Create() {
static const wchar_t kMutexName[] = L"Local\\AtomProcessSingletonStartup!";
remote_window_ = chrome::FindRunningChromeWindow(user_data_dir_);
if (!remote_window_) {
// Make sure we will be the one and only process creating the window.
// We use a named Mutex since we are protecting against multi-process
// access. As documented, it's clearer to NOT request ownership on creation
// since it isn't guaranteed we will get it. It is better to create it
// without ownership and explicitly get the ownership afterward.
base::win::ScopedHandle only_me(::CreateMutex(NULL, FALSE, kMutexName));
if (!only_me.IsValid()) {
DPLOG(FATAL) << "CreateMutex failed";
return false;
}
AutoLockMutex auto_lock_only_me(only_me.Get());
// We now own the mutex so we are the only process that can create the
// window at this time, but we must still check if someone created it
// between the time where we looked for it above and the time the mutex
// was given to us.
remote_window_ = chrome::FindRunningChromeWindow(user_data_dir_);
if (!remote_window_) {
// We have to make sure there is no Chrome instance running on another
// machine that uses the same profile.
base::FilePath lock_file_path = user_data_dir_.AppendASCII(kLockfile);
lock_file_ =
::CreateFile(lock_file_path.value().c_str(), GENERIC_WRITE,
FILE_SHARE_READ, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL);
DWORD error = ::GetLastError();
LOG_IF(WARNING, lock_file_ != INVALID_HANDLE_VALUE &&
error == ERROR_ALREADY_EXISTS)
<< "Lock file exists but is writable.";
LOG_IF(ERROR, lock_file_ == INVALID_HANDLE_VALUE)
<< "Lock file can not be created! Error code: " << error;
if (lock_file_ != INVALID_HANDLE_VALUE) {
// Set the window's title to the path of our user data directory so
// other Chrome instances can decide if they should forward to us.
bool result =
window_.CreateNamed(base::BindRepeating(&ProcessLaunchNotification,
notification_callback_),
user_data_dir_.value());
// NB: Ensure that if the primary app gets started as elevated
// admin inadvertently, secondary windows running not as elevated
// will still be able to send messages
::ChangeWindowMessageFilterEx(window_.hwnd(), WM_COPYDATA, MSGFLT_ALLOW,
NULL);
CHECK(result && window_.hwnd());
}
}
}
return window_.hwnd() != NULL;
}
void ProcessSingleton::Cleanup() {}
void ProcessSingleton::OverrideShouldKillRemoteProcessCallbackForTesting(
const ShouldKillRemoteProcessCallback& display_dialog_callback) {
should_kill_remote_process_callback_ = display_dialog_callback;
}

View File

@@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "shell/browser/ui/views/global_menu_bar_registrar_x11.h"
#include <string>
#include "chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h"
#include "base/bind.h"
#include "base/debug/leak_annotations.h"
@@ -51,7 +49,7 @@ GlobalMenuBarRegistrarX11::GlobalMenuBarRegistrarX11() {
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START),
nullptr, kAppMenuRegistrarName, kAppMenuRegistrarPath,
kAppMenuRegistrarName,
nullptr, // Probably want a real cancelable.
nullptr, // TODO: Probalby want a real cancelable.
static_cast<GAsyncReadyCallback>(OnProxyCreatedThunk), this);
}

View File

@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_VIEWS_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
#define SHELL_BROWSER_UI_VIEWS_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
#define CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
#include <gio/gio.h>
@@ -57,4 +57,4 @@ class GlobalMenuBarRegistrarX11 {
DISALLOW_COPY_AND_ASSIGN(GlobalMenuBarRegistrarX11);
};
#endif // SHELL_BROWSER_UI_VIEWS_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_REGISTRAR_X11_H_

View File

@@ -483,7 +483,6 @@ Returns:
* `event` Event
* `argv` String[] - An array of the second instance's command line arguments
* `workingDirectory` String - The second instance's working directory
* `additionalData` unknown - A JSON object of additional data passed from the second instance
This event will be emitted inside the primary instance of your application
when a second instance has been executed and calls `app.requestSingleInstanceLock()`.
@@ -940,9 +939,7 @@ app.setJumpList([
])
```
### `app.requestSingleInstanceLock([additionalData])`
* `additionalData` Record<any, any> (optional) - A JSON object containing additional data to send to the first instance.
### `app.requestSingleInstanceLock()`
Returns `Boolean`
@@ -969,16 +966,12 @@ starts:
const { app } = require('electron')
let myWindow = null
const additionalData = { myKey: 'myValue' }
const gotTheLock = app.requestSingleInstanceLock(additionalData)
const gotTheLock = app.requestSingleInstanceLock()
if (!gotTheLock) {
app.quit()
} else {
app.on('second-instance', (event, commandLine, workingDirectory, additionalData) => {
// Print out data received from the second instance.
console.log(additionalData)
app.on('second-instance', (event, commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (myWindow) {
if (myWindow.isMinimized()) myWindow.restore()

View File

@@ -15,16 +15,14 @@ Process: [Main](../glossary.md#main-process)
```javascript
// In the main process.
const { app, BrowserView, BrowserWindow } = require('electron')
const { BrowserView, BrowserWindow } = require('electron')
app.whenReady().then(() => {
const win = new BrowserWindow({ width: 800, height: 600 })
const win = new BrowserWindow({ width: 800, height: 600 })
const view = new BrowserView()
win.setBrowserView(view)
view.setBounds({ x: 0, y: 0, width: 300, height: 300 })
view.webContents.loadURL('https://electronjs.org')
})
const view = new BrowserView()
win.setBrowserView(view)
view.setBounds({ x: 0, y: 0, width: 300, height: 300 })
view.webContents.loadURL('https://electronjs.org')
```
### `new BrowserView([options])` _Experimental_

View File

@@ -391,10 +391,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
contain the layout of the document—without requiring scrolling. Enabling
this will cause the `preferred-size-changed` event to be emitted on the
`WebContents` when the preferred size changes. Default is `false`.
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjuction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
* `color` String (optional) _Windows_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
* `height` Integer (optional) _macOS_ _Windows_ - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
@@ -560,7 +559,7 @@ Returns:
Emitted before the window is moved. On Windows, calling `event.preventDefault()` will prevent the window from being moved.
Note that this is only emitted when the window is being moved manually. Moving the window with `setPosition`/`setBounds`/`center` will not emit this event.
Note that this is only emitted when the window is being resized manually. Resizing the window with `setBounds`/`setSize` will not emit this event.
#### Event: 'move'

View File

@@ -131,15 +131,15 @@ Returns `Object`:
Returns an Object containing `title` and `url` keys representing the bookmark in
the clipboard. The `title` and `url` values will be empty strings when the
bookmark is unavailable. The `title` value will always be empty on Windows.
bookmark is unavailable.
### `clipboard.writeBookmark(title, url[, type])` _macOS_ _Windows_
* `title` String - Unused on Windows
* `title` String
* `url` String
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
Writes the `title` (macOS only) and `url` into the clipboard as a bookmark.
Writes the `title` and `url` into the clipboard as a bookmark.
**Note:** Most apps on Windows don't support pasting bookmarks into them so
you can use `clipboard.write` to write both a bookmark and fallback text to the

View File

@@ -99,7 +99,7 @@ the response.
* `expirationDate` Double (optional) - The expiration date of the cookie as the number of
seconds since the UNIX epoch. If omitted then the cookie becomes a session
cookie and will not be retained between sessions.
* `sameSite` String (optional) - The [Same Site](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies) policy to apply to this cookie. Can be `unspecified`, `no_restriction`, `lax` or `strict`. Default is `lax`.
* `sameSite` String (optional) - The [Same Site](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies) policy to apply to this cookie. Can be `unspecified`, `no_restriction`, `lax` or `strict`. Default is `no_restriction`.
Returns `Promise<void>` - A promise which resolves when the cookie has been set

View File

@@ -19,9 +19,6 @@ following projects:
* [socorro](https://github.com/mozilla/socorro)
* [mini-breakpad-server](https://github.com/electron/mini-breakpad-server)
> **Note:** Electron uses Crashpad, not Breakpad, to collect and upload
> crashes, but for the time being, the [upload protocol is the same](https://chromium.googlesource.com/crashpad/crashpad/+/HEAD/doc/overview_design.md#Upload-to-collection-server).
Or use a 3rd party hosted solution:
* [Backtrace](https://backtrace.io/electron/)
@@ -29,12 +26,49 @@ Or use a 3rd party hosted solution:
* [BugSplat](https://www.bugsplat.com/docs/platforms/electron)
Crash reports are stored temporarily before being uploaded in a directory
underneath the app's user data directory, called 'Crashpad'. You can override
this directory by calling `app.setPath('crashDumps', '/path/to/crashes')`
before starting the crash reporter.
underneath the app's user data directory (called 'Crashpad' on Windows and Mac,
or 'Crash Reports' on Linux). You can override this directory by calling
`app.setPath('crashDumps', '/path/to/crashes')` before starting the crash
reporter.
Electron uses [crashpad](https://chromium.googlesource.com/crashpad/crashpad/+/refs/heads/main/README.md)
to monitor and report crashes.
On Windows and macOS, Electron uses
[crashpad](https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md)
to monitor and report crashes. On Linux, Electron uses
[breakpad](https://chromium.googlesource.com/breakpad/breakpad/+/master/). This
is an implementation detail driven by Chromium, and it may change in future. In
particular, crashpad is newer and will likely eventually replace breakpad on
all platforms.
### Note about Node child processes on Linux
If you are using the Node.js `child_process` module and want to report crashes
from those processes on Linux, there is an extra step you will need to take to
properly initialize the crash reporter in the child process. This is not
necessary on Mac or Windows, as those platforms use Crashpad, which
automatically monitors child processes.
Since `require('electron')` is not available in Node child processes, the
following APIs are available on the `process` object in Node child processes.
Note that, on Linux, each Node child process has its own separate instance of
the breakpad crash reporter. This is dissimilar to renderer child processes,
which have a "stub" breakpad reporter which returns information to the main
process for reporting.
#### `process.crashReporter.start(options)`
See [`crashReporter.start()`](#crashreporterstartoptions).
#### `process.crashReporter.getParameters()`
See [`crashReporter.getParameters()`](#crashreportergetparameters).
#### `process.crashReporter.addExtraParameter(key, value)`
See [`crashReporter.addExtraParameter(key, value)`](#crashreporteraddextraparameterkey-value).
#### `process.crashReporter.removeExtraParameter(key)`
See [`crashReporter.removeExtraParameter(key)`](#crashreporterremoveextraparameterkey).
## Methods
@@ -152,6 +186,12 @@ names must be no longer than 39 bytes, and values must be no longer than 20320
bytes. Keys with names longer than the maximum will be silently ignored. Key
values longer than the maximum length will be truncated.
**Note:** On linux values that are longer than 127 bytes will be chunked into
multiple keys, each 127 bytes in length. E.g. `addExtraParameter('foo', 'a'.repeat(130))`
will result in two chunked keys `foo__1` and `foo__2`, the first will contain
the first 127 bytes and the second will contain the remaining 3 bytes. On
your crash reporting backend you should stitch together keys in this format.
### `crashReporter.removeExtraParameter(key)`
* `key` String - Parameter key, must be no longer than 39 bytes.
@@ -163,32 +203,6 @@ will not include this parameter.
Returns `Record<String, String>` - The current 'extra' parameters of the crash reporter.
## In Node child processes
Since `require('electron')` is not available in Node child processes, the
following APIs are available on the `process` object in Node child processes.
#### `process.crashReporter.start(options)`
See [`crashReporter.start()`](#crashreporterstartoptions).
Note that if the crash reporter is started in the main process, it will
automatically monitor child processes, so it should not be started in the child
process. Only use this method if the main process does not initialize the crash
reporter.
#### `process.crashReporter.getParameters()`
See [`crashReporter.getParameters()`](#crashreportergetparameters).
#### `process.crashReporter.addExtraParameter(key, value)`
See [`crashReporter.addExtraParameter(key, value)`](#crashreporteraddextraparameterkey-value).
#### `process.crashReporter.removeExtraParameter(key)`
See [`crashReporter.removeExtraParameter(key)`](#crashreporterremoveextraparameterkey).
## Crash Report Payload
The crash reporter will send the following data to the `submitURL` as

View File

@@ -100,8 +100,6 @@ The following methods of `chrome.tabs` are supported:
- `chrome.tabs.sendMessage`
- `chrome.tabs.executeScript`
- `chrome.tabs.update` (partial support)
- supported properties: `url`, `muted`.
> **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

View File

@@ -67,8 +67,3 @@ or is being instructed to show a high-contrast UI.
A `Boolean` for if the OS / Chromium currently has an inverted color scheme
or is being instructed to use an inverted color scheme.
### `nativeTheme.inForcedColorsMode` _Windows_ _Readonly_
A `boolean` indicating whether Chromium is in forced colors mode, controlled by system accessibility settings.
Currently, Windows high contrast is the only system setting that triggers forced colors mode.

View File

@@ -178,6 +178,7 @@ Returns an object with V8 heap statistics. Note that all statistics are reported
Returns `Object`:
* `allocated` Integer - Size of all allocated objects in Kilobytes.
* `marked` Integer - Size of all marked objects in Kilobytes.
* `total` Integer - Total allocated space in Kilobytes.
Returns an object with Blink memory information.

View File

@@ -562,8 +562,7 @@ the original network configuration.
* `hostname` String
* `certificate` [Certificate](structures/certificate.md)
* `validatedCertificate` [Certificate](structures/certificate.md)
* `isIssuedByKnownRoot` Boolean - `true` if Chromium recognises the root CA as a standard root. If it isn't then it's probably the case that this certificate was generated by a MITM proxy whose root has been installed locally (for example, by a corporate proxy). This should not be trusted if the `verificationResult` is not `OK`.
* `verificationResult` String - `OK` if the certificate is trusted, otherwise an error like `CERT_REVOKED`.
* `verificationResult` String - Verification result from chromium.
* `errorCode` Integer - Error code.
* `callback` Function
* `verificationResult` Integer - Value can be one of certificate error codes
@@ -903,10 +902,8 @@ setting with the current OS locale. This setting is persisted across restarts.
By default Electron will download hunspell dictionaries from the Chromium CDN. If you want to override this
behavior you can use this API to point the dictionary downloader at your own hosted version of the hunspell
dictionaries. We publish a `hunspell_dictionaries.zip` file with each release which contains the files you need
to host here.
The file server must be **case insensitive**. If you cannot do this, you must upload each file twice: once with
the case it has in the ZIP file and once with the filename as all lowercase.
to host here, the file server must be **case insensitive** you must upload each file twice, once with the case it
has in the ZIP file and once with the filename as all lower case.
If the files present in `hunspell_dictionaries.zip` are available at `https://example.com/dictionaries/language-code.bdic`
then you should call this api with `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`. Please

View File

@@ -1840,7 +1840,7 @@ the cursor when dragging.
#### `contents.savePage(fullPath, saveType)`
* `fullPath` String - The absolute file path.
* `fullPath` String - The full file path.
* `saveType` String - Specify the save type.
* `HTMLOnly` - Save only the HTML of the page.
* `HTMLComplete` - Save complete-html page.

View File

@@ -5,8 +5,8 @@
Process: [Renderer](../glossary.md#renderer-process)
`webFrame` export of the Electron module is an instance of the `WebFrame`
class representing the current frame. Sub-frames can be retrieved by
certain properties and methods (e.g. `webFrame.firstChild`).
class representing the top frame of the current `BrowserWindow`. Sub-frames can
be retrieved by certain properties and methods (e.g. `webFrame.firstChild`).
An example of zooming current page to 200%.

View File

@@ -12,63 +12,6 @@ This document uses the following convention to categorize breaking changes:
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
## Planned Breaking API Changes (17.0)
### Removed: `desktopCapturer.getSources` in the renderer
The `desktopCapturer.getSources` API is now only available in the main process.
This has been changed in order to improve the default security of Electron
apps.
If you need this functionality, it can be replaced as follows:
```js
// Main process
const { ipcMain, desktopCapturer } = require('electron')
ipcMain.handle(
'DESKTOP_CAPTURER_GET_SOURCES',
(event, opts) => desktopCapturer.getSources(opts)
)
```
```js
// Renderer process
const { ipcRenderer } = require('electron')
const desktopCapturer = {
getSources: (opts) => ipcRenderer.invoke('DESKTOP_CAPTURER_GET_SOURCES', opts)
}
```
However, you should consider further restricting the information returned to
the renderer; for instance, displaying a source selector to the user and only
returning the selected source.
## Planned Breaking API Changes (16.0)
### Behavior Changed: `crashReporter` implementation switched to Crashpad on Linux
The underlying implementation of the `crashReporter` API on Linux has changed
from Breakpad to Crashpad, bringing it in line with Windows and Mac. As a
result of this, child processes are now automatically monitored, and calling
`process.crashReporter.start` in Node child processes is no longer needed (and
is not advisable, as it will start a second instance of the Crashpad reporter).
There are also some subtle changes to how annotations will be reported on
Linux, including that long values will no longer be split between annotations
appended with `__1`, `__2` and so on, and instead will be truncated at the
(new, longer) annotation value limit.
### Deprecated: `desktopCapturer.getSources` in the renderer
Usage of the `desktopCapturer.getSources` API in the renderer has been
deprecated and will be removed. This change improves the default security of
Electron apps.
See [here](#removed-desktopcapturergetsources-in-the-renderer) for details on
how to replace this API in your app.
## Planned Breaking API Changes (15.0)
### Default Changed: `nativeWindowOpen` defaults to `true`

View File

@@ -85,37 +85,42 @@ $ gclient sync -f
## Building
**Set the environment variable for chromium build tools**
On Linux & MacOS
```sh
$ cd src
$ export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools
$ gn gen out/Testing --args="import(\"//electron/build/args/testing.gn\") $GN_EXTRA_ARGS"
```
On Windows:
Or on Windows (without the optional argument):
```sh
$ cd src
$ set CHROMIUM_BUILDTOOLS_PATH=%cd%\buildtools
```
**To generate Testing build config of Electron:**
```sh
$ gn gen out/Testing --args="import(\"//electron/build/args/testing.gn\")"
```
**To generate Release build config of Electron:**
This will generate a build directory `out/Testing` under `src/` with
the testing build configuration. You can replace `Testing` with another name,
but it should be a subdirectory of `out`.
Also you shouldn't have to run `gn gen` again—if you want to change the
build arguments, you can run `gn args out/Testing` to bring up an editor.
To see the list of available build configuration options, run `gn args
out/Testing --list`.
**For generating Testing build config of
Electron:**
```sh
$ gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"
$ gn gen out/Testing --args="import(\"//electron/build/args/testing.gn\") $GN_EXTRA_ARGS"
```
**Note:** This will generate a `out/Testing` or `out/Release` build directory under `src/` with the testing or release build depending upon the configuration passed above. You can replace `Testing|Release` with another names, but it should be a subdirectory of `out`.
**For generating Release (aka "non-component" or "static") build config of
Electron:**
Also you shouldn't have to run `gn gen` again—if you want to change the build arguments, you can run `gn args out/Testing` to bring up an editor. To see the list of available build configuration options, run `gn args out/Testing --list`.
```sh
$ gn gen out/Release --args="import(\"//electron/build/args/release.gn\") $GN_EXTRA_ARGS"
```
**To build, run `ninja` with the `electron` target:**
Nota Bene: This will also take a while and probably heat up your lap.
@@ -151,13 +156,13 @@ $ ./out/Testing/electron
On linux, first strip the debugging and symbol information:
```sh
$ electron/script/strip-binaries.py -d out/Release
electron/script/strip-binaries.py -d out/Release
```
To package the electron build as a distributable zip file:
```sh
$ ninja -C out/Release electron:electron_dist_zip
ninja -C out/Release electron:electron_dist_zip
```
### Cross-compiling

View File

@@ -1,171 +0,0 @@
# Creating a New Electron Browser Module
Welcome to the Electron API guide! If you are unfamiliar with creating a new Electron API module within the [`browser`](https://github.com/electron/electron/tree/main/shell/browser) directory, this guide serves as a checklist for some of the necessary steps that you will need to implement.
This is not a comprehensive end-all guide to creating an Electron Browser API, rather an outline documenting some of the more unintuitive steps.
## Add your files to Electron's project configuration
Electron uses [GN](https://gn.googlesource.com/gn) as a meta build system to generate files for its compiler, [Ninja](https://ninja-build.org/). This means that in order to tell Electron to compile your code, we have to add your API's code and header file names into [`filenames.gni`](https://github.com/electron/electron/blob/main/filenames.gni).
You will need to append your API file names alphabetically into the appropriate files like so:
```cpp title='filenames.gni'
lib_sources = [
"path/to/api/api_name.cc",
"path/to/api/api_name.h",
]
lib_sources_mac = [
"path/to/api/api_name_mac.h",
"path/to/api/api_name_mac.mm",
]
lib_sources_win = [
"path/to/api/api_name_win.cc",
"path/to/api/api_name_win.h",
]
lib_sources_linux = [
"path/to/api/api_name_linux.cc",
"path/to/api/api_name_linux.h",
]
```
Note that the Windows, macOS and Linux array additions are optional and should only be added if your API has specific platform implementations.
## Create API documentation
Type definitions are generated by Electron using [`@electron/docs-parser`](https://github.com/electron/docs-parser) and [`@electron/typescript-definitions`](https://github.com/electron/typescript-definitions). This step is necessary to ensure consistency across Electron's API documentation. This means that for your API type definition to appear in the `electron.d.ts` file, we must create a `.md` file. Examples can be found in [this folder](https://github.com/electron/electron/tree/main/docs/api).
## Set up `ObjectTemplateBuilder` and `Wrappable`
Electron constructs its modules using [`object_template_builder`](https://www.electronjs.org/blog/from-native-to-js#mateobjecttemplatebuilder).
[`wrappable`](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/gin/wrappable.h) is a base class for C++ objects that have corresponding v8 wrapper objects.
Here is a basic example of code that you may need to add, in order to incorporate `object_template_builder` and `wrappable` into your API. For further reference, you can find more implementations [here](https://github.com/electron/electron/tree/main/shell/browser/api).
In your `api_name.h` file:
```cpp title='api_name.h'
#ifndef SHELL_BROWSER_API_ELECTRON_API_{API_NAME}_H_
#define SHELL_BROWSER_API_ELECTRON_API_{API_NAME}_H_
#include "gin/handle.h"
#include "gin/wrappable.h"
namespace electron {
namespace api {
class ApiName : public gin::Wrappable<ApiName> {
public:
static gin::Handle<ApiName> Create(v8::Isolate* isolate);
// gin::Wrappable
static gin::WrapperInfo kWrapperInfo;
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
const char* GetTypeName() override;
} // namespace api
} // namespace electron
```
In your `api_name.cc` file:
```cpp title='api_name.cc'
#include "shell/browser/api/electron_api_safe_storage.h"
#include "shell/browser/browser.h"
#include "shell/common/gin_converters/base_converter.h"
#include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h"
#include "shell/common/platform_util.h"
namespace electron {
namespace api {
gin::WrapperInfo ApiName::kWrapperInfo = {gin::kEmbedderNativeGin};
gin::ObjectTemplateBuilder ApiName::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return gin::ObjectTemplateBuilder(isolate)
.SetMethod("methodName", &ApiName::methodName);
}
const char* ApiName::GetTypeName() {
return "ApiName";
}
// static
gin::Handle<ApiName> ApiName::Create(v8::Isolate* isolate) {
return gin::CreateHandle(isolate, new ApiName());
}
} // namespace api
} // namespace electron
namespace {
void Initialize(v8::Local<v8::Object> exports,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context,
void* priv) {
v8::Isolate* isolate = context->GetIsolate();
gin_helper::Dictionary dict(isolate, exports);
dict.Set("apiName", electron::api::ApiName::Create(isolate));
}
} // namespace
```
## Link your Electron API with Node
In the [`typings/internal-ambient.d.ts`](https://github.com/electron/electron/blob/main/typings/internal-ambient.d.ts) file, we need to append a new property onto the `Process` interface like so:
```ts title='typings/internal-ambient.d.ts'
interface Process {
_linkedBinding(name: 'electron_browser_{api_name}', Electron.ApiName);
}
```
At the very bottom of your `api_name.cc` file:
```cpp title='api_name.cc'
NODE_LINKED_MODULE_CONTEXT_AWARE(electron_browser_{api_name},Initialize)
```
In your [`shell/common/node_bindings.cc`](https://github.com/electron/electron/blob/main/shell/common/node_bindings.cc) file, add your node binding name to Electron's built-in modules.
```cpp title='shell/common/node_bindings.cc'
#define ELECTRON_BUILTIN_MODULES(V) \
V(electron_browser_{api_name})
```
> Note: More technical details on how Node links with Electron can be found on [our blog](https://www.electronjs.org/blog/electron-internals-using-node-as-a-library#link-node-with-electron).
## Expose your API to TypeScript
### Export your API as a module
We will need to create a new TypeScript file in the path that follows:
`"lib/browser/api/{electron_browser_{api_name}}.ts"`
An example of the contents of this file can be found [here](https://github.com/electron/electron/blob/main/lib/browser/api/native-image.ts).
### Expose your module to TypeScript
Add your module to the module list found at `"lib/browser/api/module-list.ts"` like so:
```typescript title='lib/browser/api/module-list.ts'
export const browserModuleList: ElectronInternal.ModuleEntry[] = [
{ name: 'apiName', loader: () => require('./api-name') },
];
```

View File

@@ -58,6 +58,8 @@ To run your tests:
$ npx wdio run wdio.conf.js
```
[chrome-driver]: https://sites.google.com/chromium.org/driver/
### With Selenium
[Selenium](https://www.selenium.dev/) is a web automation framework that
@@ -114,142 +116,6 @@ driver.wait(() => {
driver.quit()
```
## Using Playwright
[Microsoft Playwright](https://playwright.dev) is an end-to-end testing framework built
using browser-specific remote debugging protocols, similar to the [Puppeteer] headless
Node.js API but geared towards end-to-end testing. Playwright has experimental Electron
support via Electron's support for the [Chrome DevTools Protocol] (CDP).
### Install dependencies
You can install Playwright through your preferred Node.js package manager. The Playwright team
recommends using the `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` environment variable to avoid
unnecessary browser downloads when testing an Electron app.
```sh npm2yarn
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install --save-dev playwright
```
Playwright also comes with its own test runner, Playwright Test, which is built for end-to-end
testing. You can also install it as a dev dependency in your project:
```sh npm2yarn
npm install --save-dev @playwright/test
```
:::caution Dependencies
This tutorial was written `playwright@1.16.3` and `@playwright/test@1.16.3`. Check out
[Playwright's releases][playwright-releases] page to learn about
changes that might affect the code below.
:::
:::info Using third-party test runners
If you're interested in using an alternative test runner (e.g. Jest or Mocha), check out
Playwright's [Third-Party Test Runner][playwright-test-runners] guide.
:::
### Write your tests
Playwright launches your app in development mode through the `_electron.launch` API.
To point this API to your Electron app, you can pass the path to your main process
entry point (here, it is `main.js`).
```js {5}
const { _electron: electron } = require('playwright')
const { test } = require('@playwright/test')
test('launch app', async () => {
const electronApp = await electron.launch({ args: ['main.js'] })
// close app
await electronApp.close()
})
```
After that, you will access to an instance of Playwright's `ElectronApp` class. This
is a powerful class that has access to main process modules for example:
```js {6-11}
const { _electron: electron } = require('playwright')
const { test } = require('@playwright/test')
test('get isPackaged', async () => {
const electronApp = await electron.launch({ args: ['main.js'] })
const isPackaged = await electronApp.evaluate(async ({ app }) => {
// This runs in Electron's main process, parameter here is always
// the result of the require('electron') in the main app script.
return app.isPackaged
})
console.log(isPackaged) // false (because we're in development mode)
// close app
await electronApp.close()
})
```
It can also create individual [Page][playwright-page] objects from Electron BrowserWindow instances.
For example, to grab the first BrowserWindow and save a screenshot:
```js {6-7}
const { _electron: electron } = require('playwright')
const { test } = require('@playwright/test')
test('save screenshot', async () => {
const electronApp = await electron.launch({ args: ['main.js'] })
const window = await electronApp.firstWindow()
await window.screenshot({ path: 'intro.png' })
// close app
await electronApp.close()
})
```
Putting all this together using the PlayWright Test runner, let's create a `example.spec.js`
test file with a single test and assertion:
```js title='example.spec.js'
const { _electron: electron } = require('playwright')
const { test, expect } = require('@playwright/test')
test('example test', async () => {
const electronApp = await electron.launch({ args: ['.'] })
const isPackaged = await electronApp.evaluate(async ({ app }) => {
// This runs in Electron's main process, parameter here is always
// the result of the require('electron') in the main app script.
return app.isPackaged;
});
expect(isPackaged).toBe(false);
// Wait for the first BrowserWindow to open
// and return its Page object
const window = await electronApp.firstWindow()
await window.screenshot({ path: 'intro.png' })
// close app
await electronApp.close()
});
```
Then, run Playwright Test using `npx playwright test`. You should see the test pass in your
console, and have an `intro.png` screenshot on your filesystem.
```console
☁ $ npx playwright test
Running 1 test using 1 worker
✓ example.spec.js:4:1 example test (1s)
```
:::info
Playwright Test will automatically run any files matching the `.*(test|spec)\.(js|ts|mjs)` regex.
You can customize this match in the [Playwright Test configuration options][playwright-test-config].
:::
:::tip Further reading
Check out Playwright's documentation for the full [Electron][playwright-electron]
and [ElectronApplication][playwright-electronapplication] class APIs.
:::
## Using a custom test driver
It's also possible to write your own custom driver using Node.js' built-in IPC-over-STDIO.
@@ -397,13 +263,3 @@ test.after.always('cleanup', async t => {
await app.stop()
})
```
[chrome-driver]: https://sites.google.com/chromium.org/driver/
[Puppeteer]: https://github.com/puppeteer/puppeteer
[playwright-electron]: https://playwright.dev/docs/api/class-electron/
[playwright-electronapplication]: https://playwright.dev/docs/api/class-electronapplication
[playwright-page]: https://playwright.dev/docs/api/class-page
[playwright-releases]: https://github.com/microsoft/playwright/releases
[playwright-test-config]: https://playwright.dev/docs/api/class-testconfig#test-config-test-match
[playwright-test-runners]: https://playwright.dev/docs/test-runners/
[Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/

View File

@@ -138,7 +138,7 @@ Finally, the `main.js` file represents the main process and contains the actual
const { app, BrowserWindow, ipcMain, nativeTheme } = require('electron')
const path = require('path')
const createWindow = () => {
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,

View File

@@ -7,7 +7,7 @@ Special notes:
* All dates are our goals but there may be reasons for adjusting the stable deadline, such as security bugs.
* Take a look at the [5.0.0 Timeline blog post](https://electronjs.org/blog/electron-5-0-timeline) for info about publicizing our release dates.
* Since Electron 6.0, we've been targeting every other Chromium version and releasing our stable on the same day as Chrome stable. You can reference Chromium's release schedule [here](https://chromiumdash.appspot.com/schedule). See [Electron's new release cadence blog post](https://www.electronjs.org/blog/12-week-cadence) for more details on our release schedule.
* Starting in Electron 16.0, we will release on an 8-week cadence. See [Electron's new 8-week cadence blog post](https://www.electronjs.org/blog/8-week-cadence) for more details.
* Electron 15.0 only will include a special Alpha release. Starting in Electron 16.0, we will release on an 8-week cadence. See [Electron's new 8-week cadence blog post](https://www.electronjs.org/blog/8-week-cadence) for more details.
| Electron | Alpha | Beta | Stable | Chrome | Node |
| ------- | ----- | ------- | ------ | ------ | ---- |
@@ -25,5 +25,4 @@ Special notes:
| 13.0.0 | -- | 2021-Mar-04 | 2021-May-25 | M91 | v14.16 |
| 14.0.0 | -- | 2021-May-27 | 2021-Aug-31 | M93 | v14.17 |
| 15.0.0 | 2021-Jul-20 | 2021-Sep-01 | 2021-Sep-21 | M94 | v16.5 |
| 16.0.0 | 2021-Sep-23 | 2021-Oct-20 | 2021-Nov-16 | M96 | v16.9 |
| 17.0.0 | 2021-Nov-18 | 2022-Jan-06 | 2022-Feb-01 | M98 | TBD |
| 16.0.0 | -- | 2021-Sep-23 | 2021-Nov-16 | M96 | TBD |

View File

@@ -18,7 +18,7 @@ npm install --save-dev electron@latest
There are several major changes from our 1.x strategy outlined below. Each change is intended to satisfy the needs and priorities of developers/maintainers and app developers.
1. Strict use of the the [SemVer](#semver) spec
1. Strict use of the [SemVer](#semver) spec
2. Introduction of semver-compliant `-beta` tags
3. Introduction of [conventional commit messages](https://conventionalcommits.org/)
4. Well-defined stabilization branches

View File

@@ -12,7 +12,7 @@ Fuses are the solution to this problem, at a high level they are "magic bits" in
### The easy way
We've made a handy module, [`@electron/fuses`](https://npmjs.com/package/@electron/fuses), to make flipping these fuses easy. Check out the README of that module for more details on usage and potential error cases.
We've made a handy module `@electron/fuses` to make flipping these fuses easy. Check out the README of that module for more details on usage and potential error cases.
```js
require('@electron/fuses').flipFuses(

View File

@@ -39,7 +39,7 @@ inAppPurchase.on('transactions-updated', (event, transactions) => {
}
// Check each transaction.
transactions.forEach((transaction) => {
transactions.forEach(function (transaction) {
const payment = transaction.payment
switch (transaction.transactionState) {

View File

@@ -56,4 +56,4 @@ problem. If not, feel free to fill out our bug report template and submit a new
[comic]: https://www.google.com/googlebooks/chrome/
[fiddle]: https://electronjs.org/fiddle
[issue-tracker]: https://github.com/electron/electron/issues
[discord]: https://discord.gg/electronjs
[discord]: https://discord.gg/electron

View File

@@ -82,7 +82,7 @@ listen for the `keyup` and `keydown` [DOM events][dom-events] inside the
renderer process using the [addEventListener() API][addEventListener-api].
```javascript fiddle='docs/fiddles/features/keyboard-shortcuts/web-apis|focus=renderer.js'
const handleKeyPress = (event) => {
function handleKeyPress(event) {
// You can put code here to handle the keypress.
document.getElementById("last-keypress").innerText = event.key;
console.log(`You pressed ${event.key}`);

View File

@@ -25,7 +25,7 @@ Starting with a working application from the
```javascript fiddle='docs/fiddles/features/macos-dock-menu'
const { app, BrowserWindow, Menu } = require('electron')
const createWindow = () => {
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,

View File

@@ -134,7 +134,7 @@ app.whenReady().then(async () => {
<script>
const { ipcRenderer } = require('electron')
const doWork = (input) => {
function doWork(input) {
// Something cpu-intensive.
return input * 2
}
@@ -185,7 +185,7 @@ stream of data.
```js
// renderer.js ///////////////////////////////////////////////////////////////
const makeStreamingRequest = (element, callback) => {
function makeStreamingRequest (element, callback) {
// MessageChannels are lightweight--it's cheap to create a new one for each
// request.
const { port1, port2 } = new MessageChannel()

View File

@@ -54,7 +54,7 @@ const { Notification } = require('electron')
const NOTIFICATION_TITLE = 'Basic Notification'
const NOTIFICATION_BODY = 'Notification from the Main process'
const showNotification = () => {
function showNotification () {
new Notification({ title: NOTIFICATION_TITLE, body: NOTIFICATION_BODY }).show()
}
@@ -146,7 +146,7 @@ desktop environment that follows [Desktop Notifications
Specification][notification-spec], including Cinnamon, Enlightenment, Unity,
GNOME, KDE.
[notification-spec]: https://developer-old.gnome.org/notification-spec/
[notification-spec]: https://developer.gnome.org/notification-spec/
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
[set-app-user-model-id]: ../api/app.md#appsetappusermodelidid-windows
[squirrel-events]: https://github.com/electron/windows-installer/blob/master/README.md#handling-squirrel-events

View File

@@ -41,7 +41,7 @@ Starting with an HTML file `index.html`, this example will demonstrate how the `
In order to mutate the DOM, create a `renderer.js` file that adds event listeners to the `'online'` and `'offline'` `window` events. The event handler sets the content of the `<strong id='status'>` element depending on the result of `navigator.onLine`.
```js title='renderer.js'
const updateOnlineStatus = () => {
function updateOnlineStatus () {
document.getElementById('status').innerHTML = navigator.onLine ? 'online' : 'offline'
}
@@ -56,7 +56,7 @@ Finally, create a `main.js` file for main process that creates the window.
```js title='main.js'
const { app, BrowserWindow } = require('electron')
const createWindow = () => {
function createWindow () {
const onlineStatusWindow = new BrowserWindow({
width: 400,
height: 100

View File

@@ -84,7 +84,7 @@ uses `app` APIs to create a more native application window experience.
```js title='main.js'
// quitting the app when no windows are open on non-macOS platforms
app.on('window-all-closed', () => {
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})
```

View File

@@ -48,7 +48,7 @@ const { app, BrowserWindow } = require('electron')
let progressInterval
const createWindow = () => {
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600

View File

@@ -119,7 +119,7 @@ of your project.
Before we can create a window for our application, we need to create the content that
will be loaded into it. In Electron, each window displays web contents that can be loaded
from either a local HTML file or a remote URL.
from either from a local HTML file or a remote URL.
For this tutorial, you will be doing the former. Create an `index.html` file in the root
folder of your project:
@@ -166,7 +166,7 @@ Then, add a `createWindow()` function that loads `index.html` into a new `Browse
instance.
```js
const createWindow = () => {
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600
@@ -216,7 +216,7 @@ To implement this, listen for the `app` module's [`'window-all-closed'`][window-
event, and call [`app.quit()`][app-quit] if the user is not on macOS (`darwin`).
```js
app.on('window-all-closed', () => {
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})
```
@@ -244,7 +244,7 @@ from within your existing `whenReady()` callback.
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
@@ -295,7 +295,7 @@ to the `webPreferences.preload` option in your existing `BrowserWindow` construc
const path = require('path')
// modify your existing createWindow() function
const createWindow = () => {
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
@@ -360,7 +360,7 @@ The full code is available below:
const { app, BrowserWindow } = require('electron')
const path = require('path')
const createWindow = () => {
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
@@ -383,7 +383,7 @@ const createWindow = () => {
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
@@ -393,7 +393,7 @@ app.whenReady().then(() => {
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})

View File

@@ -22,7 +22,7 @@ const { app, BrowserWindow } = require('electron')
const fs = require('fs')
const path = require('path')
const createWindow = () => {
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600

View File

@@ -24,7 +24,7 @@ To set the represented file of window, you can use the
const { app, BrowserWindow } = require('electron')
const os = require('os');
const createWindow = () => {
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600

View File

@@ -216,7 +216,7 @@ access to a `window.readConfig()` method, but no Node.js features.
```js
const { readFileSync } = require('fs')
window.readConfig = () => {
window.readConfig = function () {
const data = readFileSync('./config.json')
return data
}

View File

@@ -70,10 +70,10 @@ until the maintainers feel the maintenance burden is too high to continue doing
### Currently supported versions
* 16.x.y
* 15.x.y
* 14.x.y
* 13.x.y
* 12
### End-of-life

View File

@@ -19,7 +19,6 @@
<includes>
<include name="IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE" file="${target_gen_dir}/shell_devtools_discovery_page.html" use_base_dir="false" type="BINDATA" />
<include name="IDR_PDF_MANIFEST" file="../chrome/browser/resources/pdf/manifest.json" type="BINDATA" />
<include name="IDR_CRYPTOTOKEN_MANIFEST" file="../chrome/browser/resources/cryptotoken/manifest.json" type="BINDATA" />
</includes>
</release>
</grit>

View File

@@ -33,23 +33,6 @@
{SCREEN_INDEX, plural, =1{Screen #} other{Screen #}}
</message>
<!-- File Select Helper-->
<message name="IDS_IMAGE_FILES" desc="The description of the image file extensions in the select file dialog.">
Image Files
</message>
<message name="IDS_AUDIO_FILES" desc="The description of the audio file extensions in the select file dialog.">
Audio Files
</message>
<message name="IDS_VIDEO_FILES" desc="The description of the video file extensions in the select file dialog.">
Video Files
</message>
<message name="IDS_CUSTOM_FILES" desc="The description of the custom file extensions in the select file dialog.">
Custom Files
</message>
<message name="IDS_DEFAULT_DOWNLOAD_FILENAME" desc="Default name for downloaded files when we have no idea what they could be.">
download
</message>
<!-- Picture-in-Picture -->
<if expr="is_macosx">
<message name="IDS_PICTURE_IN_PICTURE_TITLE_TEXT" desc="Title of the Picture-in-Picture window. This appears in the system tray and window header.">

View File

@@ -135,14 +135,16 @@ auto_filenames = {
sandbox_bundle_deps = [
"lib/common/api/deprecate.ts",
"lib/common/api/native-image.ts",
"lib/common/define-properties.ts",
"lib/common/ipc-messages.ts",
"lib/common/type-utils.ts",
"lib/common/web-view-events.ts",
"lib/common/web-view-methods.ts",
"lib/renderer/api/context-bridge.ts",
"lib/renderer/api/crash-reporter.ts",
"lib/renderer/api/desktop-capturer.ts",
"lib/renderer/api/ipc-renderer.ts",
"lib/renderer/api/native-image.ts",
"lib/renderer/api/web-frame.ts",
"lib/renderer/inspector.ts",
"lib/renderer/ipc-renderer-internal-utils.ts",
@@ -167,6 +169,7 @@ auto_filenames = {
]
isolated_bundle_deps = [
"lib/common/type-utils.ts",
"lib/common/web-view-methods.ts",
"lib/isolated_renderer/init.ts",
"lib/renderer/web-view/web-view-attributes.ts",
@@ -203,6 +206,7 @@ auto_filenames = {
"lib/browser/api/menu.ts",
"lib/browser/api/message-channel.ts",
"lib/browser/api/module-list.ts",
"lib/browser/api/native-image.ts",
"lib/browser/api/native-theme.ts",
"lib/browser/api/net-log.ts",
"lib/browser/api/net.ts",
@@ -237,13 +241,13 @@ auto_filenames = {
"lib/common/api/clipboard.ts",
"lib/common/api/deprecate.ts",
"lib/common/api/module-list.ts",
"lib/common/api/native-image.ts",
"lib/common/api/shell.ts",
"lib/common/define-properties.ts",
"lib/common/init.ts",
"lib/common/ipc-messages.ts",
"lib/common/parse-features-string.ts",
"lib/common/reset-search-paths.ts",
"lib/common/type-utils.ts",
"lib/common/web-view-events.ts",
"lib/common/web-view-methods.ts",
"lib/common/webpack-globals-provider.ts",
@@ -260,12 +264,13 @@ auto_filenames = {
"lib/common/api/clipboard.ts",
"lib/common/api/deprecate.ts",
"lib/common/api/module-list.ts",
"lib/common/api/native-image.ts",
"lib/common/api/shell.ts",
"lib/common/define-properties.ts",
"lib/common/init.ts",
"lib/common/ipc-messages.ts",
"lib/common/reset-search-paths.ts",
"lib/common/type-utils.ts",
"lib/common/web-view-events.ts",
"lib/common/web-view-methods.ts",
"lib/common/webpack-provider.ts",
"lib/renderer/api/context-bridge.ts",
@@ -274,6 +279,7 @@ auto_filenames = {
"lib/renderer/api/exports/electron.ts",
"lib/renderer/api/ipc-renderer.ts",
"lib/renderer/api/module-list.ts",
"lib/renderer/api/native-image.ts",
"lib/renderer/api/web-frame.ts",
"lib/renderer/init.ts",
"lib/renderer/inspector.ts",
@@ -299,12 +305,12 @@ auto_filenames = {
"lib/common/api/clipboard.ts",
"lib/common/api/deprecate.ts",
"lib/common/api/module-list.ts",
"lib/common/api/native-image.ts",
"lib/common/api/shell.ts",
"lib/common/define-properties.ts",
"lib/common/init.ts",
"lib/common/ipc-messages.ts",
"lib/common/reset-search-paths.ts",
"lib/common/type-utils.ts",
"lib/common/webpack-provider.ts",
"lib/renderer/api/context-bridge.ts",
"lib/renderer/api/crash-reporter.ts",
@@ -312,6 +318,7 @@ auto_filenames = {
"lib/renderer/api/exports/electron.ts",
"lib/renderer/api/ipc-renderer.ts",
"lib/renderer/api/module-list.ts",
"lib/renderer/api/native-image.ts",
"lib/renderer/api/web-frame.ts",
"lib/renderer/ipc-renderer-internal-utils.ts",
"lib/renderer/ipc-renderer-internal.ts",

View File

@@ -44,8 +44,8 @@ filenames = {
]
lib_sources_linux_x11 = [
"shell/browser/ui/views/global_menu_bar_registrar_x11.cc",
"shell/browser/ui/views/global_menu_bar_registrar_x11.h",
"chromium_src/chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.cc",
"chromium_src/chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h",
"shell/browser/ui/views/global_menu_bar_x11.cc",
"shell/browser/ui/views/global_menu_bar_x11.h",
"shell/browser/ui/x/event_disabler.cc",
@@ -56,9 +56,13 @@ filenames = {
"shell/browser/ui/x/x_window_utils.h",
]
lib_sources_posix = [ "shell/browser/electron_browser_main_parts_posix.cc" ]
lib_sources_posix = [
"chromium_src/chrome/browser/process_singleton_posix.cc",
"shell/browser/electron_browser_main_parts_posix.cc",
]
lib_sources_win = [
"chromium_src/chrome/browser/process_singleton_win.cc",
"shell/browser/api/electron_api_power_monitor_win.cc",
"shell/browser/api/electron_api_system_preferences_win.cc",
"shell/browser/browser_win.cc",
@@ -233,6 +237,7 @@ filenames = {
]
lib_sources = [
"chromium_src/chrome/browser/process_singleton.h",
"shell/app/command_line_args.cc",
"shell/app/command_line_args.h",
"shell/app/electron_content_client.cc",
@@ -504,6 +509,8 @@ filenames = {
"shell/browser/web_contents_preferences.h",
"shell/browser/web_contents_zoom_controller.cc",
"shell/browser/web_contents_zoom_controller.h",
"shell/browser/web_dialog_helper.cc",
"shell/browser/web_dialog_helper.h",
"shell/browser/web_view_guest_delegate.cc",
"shell/browser/web_view_guest_delegate.h",
"shell/browser/web_view_manager.cc",
@@ -675,11 +682,14 @@ filenames = {
"shell/utility/electron_content_utility_client.h",
]
lib_sources_nss = [
"chromium_src/chrome/browser/certificate_manager_model.cc",
"chromium_src/chrome/browser/certificate_manager_model.h",
]
lib_sources_extensions = [
"shell/browser/extensions/api/i18n/i18n_api.cc",
"shell/browser/extensions/api/i18n/i18n_api.h",
"shell/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc",
"shell/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.h",
"shell/browser/extensions/api/management/electron_management_api_delegate.cc",
"shell/browser/extensions/api/management/electron_management_api_delegate.h",
"shell/browser/extensions/api/resources_private/resources_private_api.cc",

View File

@@ -143,10 +143,7 @@ export const roleList: Record<RoleId, Role> = {
label: 'Toggle Developer Tools',
accelerator: isMac ? 'Alt+Command+I' : 'Ctrl+Shift+I',
nonNativeMacOSRole: true,
webContentsMethod: wc => {
const bw = wc.getOwnerBrowserWindow();
if (bw) bw.webContents.toggleDevTools();
}
windowMethod: w => w.webContents.toggleDevTools()
},
togglefullscreen: {
label: 'Toggle Full Screen',

View File

@@ -16,6 +16,7 @@ export const browserModuleList: ElectronInternal.ModuleEntry[] = [
{ name: 'Menu', loader: () => require('./menu') },
{ name: 'MenuItem', loader: () => require('./menu-item') },
{ name: 'MessageChannelMain', loader: () => require('./message-channel') },
{ name: 'nativeImage', loader: () => require('./native-image') },
{ name: 'nativeTheme', loader: () => require('./native-theme') },
{ name: 'net', loader: () => require('./net') },
{ name: 'netLog', loader: () => require('./net-log') },

View File

@@ -67,7 +67,7 @@ ipcMainInternal.handle(IPC_MESSAGES.INSPECTOR_CONTEXT_MENU, function (event, ite
const template = isEditMenu ? getEditMenuItems() : convertToMenuTemplate(items, resolve);
const menu = Menu.buildFromTemplate(template);
const window = event.sender.getOwnerBrowserWindow()!;
const window = event.sender.getOwnerBrowserWindow();
menu.popup({ window, callback: () => resolve() });
});
@@ -94,7 +94,7 @@ ipcMainUtils.handleSync(IPC_MESSAGES.INSPECTOR_CONFIRM, async function (event, m
buttons: ['OK', 'Cancel'],
cancelId: 1
};
const window = event.sender.getOwnerBrowserWindow()!;
const window = event.sender.getOwnerBrowserWindow();
const { response } = await dialog.showMessageBox(window, options);
return response === 0;
});

View File

@@ -4,6 +4,7 @@ import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-util
import { parseWebViewWebPreferences } from '@electron/internal/common/parse-features-string';
import { syncMethods, asyncMethods, properties } from '@electron/internal/common/web-view-methods';
import { webViewEvents } from '@electron/internal/common/web-view-events';
import { serialize } from '@electron/internal/common/type-utils';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
interface GuestInstance {
@@ -14,7 +15,6 @@ interface GuestInstance {
}
const webViewManager = process._linkedBinding('electron_browser_web_view_manager');
const eventBinding = process._linkedBinding('electron_browser_event');
const supportedWebViewEvents = Object.keys(webViewEvents);
@@ -28,52 +28,6 @@ function sanitizeOptionsForGuest (options: Record<string, any>) {
return ret;
}
function makeWebPreferences (embedder: Electron.WebContents, params: Record<string, any>) {
// parse the 'webpreferences' attribute string, if set
// this uses the same parsing rules as window.open uses for its features
const parsedWebPreferences =
typeof params.webpreferences === 'string'
? parseWebViewWebPreferences(params.webpreferences)
: null;
const webPreferences: Electron.WebPreferences = {
nodeIntegration: params.nodeintegration != null ? params.nodeintegration : false,
nodeIntegrationInSubFrames: params.nodeintegrationinsubframes != null ? params.nodeintegrationinsubframes : false,
plugins: params.plugins,
zoomFactor: embedder.zoomFactor,
disablePopups: !params.allowpopups,
webSecurity: !params.disablewebsecurity,
enableBlinkFeatures: params.blinkfeatures,
disableBlinkFeatures: params.disableblinkfeatures,
...parsedWebPreferences
};
if (params.preload) {
webPreferences.preloadURL = params.preload;
}
// Security options that guest will always inherit from embedder
const inheritedWebPreferences = new Map([
['contextIsolation', true],
['javascript', false],
['nativeWindowOpen', true],
['nodeIntegration', false],
['sandbox', true],
['nodeIntegrationInSubFrames', false],
['enableWebSQL', false]
]);
// Inherit certain option values from embedder
const lastWebPreferences = embedder.getLastWebPreferences()!;
for (const [name, value] of inheritedWebPreferences) {
if (lastWebPreferences[name as keyof Electron.WebPreferences] === value) {
(webPreferences as any)[name] = value;
}
}
return webPreferences;
}
function makeLoadURLOptions (params: Record<string, any>) {
const opts: Electron.LoadURLOptions = {};
if (params.httpreferrer) {
@@ -86,7 +40,7 @@ function makeLoadURLOptions (params: Record<string, any>) {
}
// Create a new guest instance.
const createGuest = function (embedder: Electron.WebContents, embedderFrameId: number, elementInstanceId: number, params: Record<string, any>) {
const createGuest = function (embedder: Electron.WebContents, params: Record<string, any>) {
// eslint-disable-next-line no-undef
const guest = (webContents as typeof ElectronInternal.WebContents).create({
type: 'webview',
@@ -131,33 +85,27 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
}
};
const makeProps = (eventKey: string, args: any[]) => {
const props: Record<string, any> = {};
webViewEvents[eventKey].forEach((prop, index) => {
props[prop] = args[index];
});
return props;
};
// Dispatch events to embedder.
for (const event of supportedWebViewEvents) {
const fn = function (event: string) {
guest.on(event as any, function (_, ...args: any[]) {
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, event, makeProps(event, args));
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, event, ...args);
});
};
for (const event of supportedWebViewEvents) {
if (event !== 'new-window') {
fn(event);
}
}
guest.on('new-window', function (event, url, frameName, disposition, options) {
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, 'new-window', {
url,
frameName,
disposition,
options: sanitizeOptionsForGuest(options)
});
guest.on('new-window', function (event, url, frameName, disposition, options, additionalFeatures, referrer) {
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, 'new-window', url,
frameName, disposition, sanitizeOptionsForGuest(options),
additionalFeatures, referrer);
});
// Dispatch guest's IPC messages to embedder.
guest.on('ipc-message-host' as any, function (event: Electron.IpcMainEvent, channel: string, args: any[]) {
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, 'ipc-message', {
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_IPC_MESSAGE, {
frameId: [event.processId, event.frameId],
channel,
args
@@ -173,22 +121,20 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
}
});
if (attachGuest(embedder, embedderFrameId, elementInstanceId, guestInstanceId, params)) {
return guestInstanceId;
}
return -1;
return guestInstanceId;
};
// Attach the guest to an element of embedder.
const attachGuest = function (embedder: Electron.WebContents, embedderFrameId: number, elementInstanceId: number, guestInstanceId: number, params: Record<string, any>) {
const attachGuest = function (event: Electron.IpcMainInvokeEvent,
embedderFrameId: number, elementInstanceId: number, guestInstanceId: number, params: Record<string, any>) {
const embedder = event.sender;
// Destroy the old guest when attaching.
const key = `${embedder.id}-${elementInstanceId}`;
const oldGuestInstanceId = embedderElementsMap.get(key);
if (oldGuestInstanceId != null) {
// Reattachment to the same guest is just a no-op.
if (oldGuestInstanceId === guestInstanceId) {
return false;
return;
}
const oldGuestInstance = guestInstances.get(oldGuestInstanceId);
@@ -200,13 +146,11 @@ const attachGuest = function (embedder: Electron.WebContents, embedderFrameId: n
const guestInstance = guestInstances.get(guestInstanceId);
// If this isn't a valid guest instance then do nothing.
if (!guestInstance) {
console.error(new Error(`Guest attach failed: Invalid guestInstanceId ${guestInstanceId}`));
return false;
throw new Error(`Invalid guestInstanceId: ${guestInstanceId}`);
}
const { guest } = guestInstance;
if (guest.hostWebContents !== embedder) {
console.error(new Error(`Guest attach failed: Access denied to guestInstanceId ${guestInstanceId}`));
return false;
throw new Error(`Access denied to guestInstanceId: ${guestInstanceId}`);
}
const { instanceId } = params;
@@ -223,14 +167,54 @@ const attachGuest = function (embedder: Electron.WebContents, embedderFrameId: n
}
}
const webPreferences = makeWebPreferences(embedder, params);
// parse the 'webpreferences' attribute string, if set
// this uses the same parsing rules as window.open uses for its features
const parsedWebPreferences =
typeof params.webpreferences === 'string'
? parseWebViewWebPreferences(params.webpreferences)
: null;
const webPreferences: Electron.WebPreferences = {
guestInstanceId,
nodeIntegration: params.nodeintegration != null ? params.nodeintegration : false,
nodeIntegrationInSubFrames: params.nodeintegrationinsubframes != null ? params.nodeintegrationinsubframes : false,
plugins: params.plugins,
zoomFactor: embedder.zoomFactor,
disablePopups: !params.allowpopups,
webSecurity: !params.disablewebsecurity,
enableBlinkFeatures: params.blinkfeatures,
disableBlinkFeatures: params.disableblinkfeatures,
...parsedWebPreferences
};
if (params.preload) {
webPreferences.preloadURL = params.preload;
}
// Security options that guest will always inherit from embedder
const inheritedWebPreferences = new Map([
['contextIsolation', true],
['javascript', false],
['nativeWindowOpen', true],
['nodeIntegration', false],
['sandbox', true],
['nodeIntegrationInSubFrames', false],
['enableWebSQL', false]
]);
// Inherit certain option values from embedder
const lastWebPreferences = embedder.getLastWebPreferences();
for (const [name, value] of inheritedWebPreferences) {
if (lastWebPreferences[name as keyof Electron.WebPreferences] === value) {
(webPreferences as any)[name] = value;
}
}
const event = eventBinding.createWithSender(embedder);
embedder.emit('will-attach-webview', event, webPreferences, params);
if (event.defaultPrevented) {
if (guest.viewInstanceId == null) guest.viewInstanceId = instanceId;
guest.destroy();
return false;
return;
}
guest.attachParams = { instanceId, src: params.src, opts: makeLoadURLOptions(params) };
@@ -244,7 +228,6 @@ const attachGuest = function (embedder: Electron.WebContents, embedderFrameId: n
webViewManager.addGuest(guestInstanceId, embedder, guest, webPreferences);
guest.attachToIframe(embedder, embedderFrameId);
return true;
};
// Remove an guest-embedder relationship.
@@ -329,8 +312,16 @@ const handleMessageSync = function (channel: string, handler: (event: ElectronIn
ipcMainUtils.handleSync(channel, makeSafeHandler(channel, handler));
};
handleMessage(IPC_MESSAGES.GUEST_VIEW_MANAGER_CREATE_AND_ATTACH_GUEST, function (event, embedderFrameId: number, elementInstanceId: number, params) {
return createGuest(event.sender, embedderFrameId, elementInstanceId, params);
handleMessage(IPC_MESSAGES.GUEST_VIEW_MANAGER_CREATE_GUEST, function (event, params) {
return createGuest(event.sender, params);
});
handleMessage(IPC_MESSAGES.GUEST_VIEW_MANAGER_ATTACH_GUEST, function (event, embedderFrameId: number, elementInstanceId: number, guestInstanceId: number, params) {
try {
attachGuest(event, embedderFrameId, elementInstanceId, guestInstanceId, params);
} catch (error) {
console.error(`Guest attach failed: ${error}`);
}
});
handleMessageSync(IPC_MESSAGES.GUEST_VIEW_MANAGER_DETACH_GUEST, function (event, guestInstanceId: number) {
@@ -378,6 +369,12 @@ handleMessageSync(IPC_MESSAGES.GUEST_VIEW_MANAGER_PROPERTY_SET, function (event,
(guest as any)[property] = val;
});
handleMessage(IPC_MESSAGES.GUEST_VIEW_MANAGER_CAPTURE_PAGE, async function (event, guestInstanceId: number, args: any[]) {
const guest = getGuestForWebContents(guestInstanceId, event.sender);
return serialize(await guest.capturePage(...args));
});
// Returns WebContents from its guest id hosted in given webContents.
const getGuestForWebContents = function (guestInstanceId: number, contents: Electron.WebContents) {
const guestInstance = guestInstances.get(guestInstanceId);

View File

@@ -149,7 +149,7 @@ function emitDeprecatedNewWindowEvent ({ event, embedder, guest, windowOpenArgs,
postData?: PostData,
}): boolean {
const { url, frameName } = windowOpenArgs;
const isWebViewWithPopupsDisabled = embedder.getType() === 'webview' && embedder.getLastWebPreferences()!.disablePopups;
const isWebViewWithPopupsDisabled = embedder.getType() === 'webview' && embedder.getLastWebPreferences().disablePopups;
const postBody = postData ? {
data: postData,
...parseContentTypeFormat(postData)
@@ -238,7 +238,7 @@ export function makeWebPreferences ({ embedder, secureOverrideWebPreferences = {
// have unvetted prefs, use parsedWebPreferences.
secureOverrideWebPreferences?: BrowserWindowConstructorOptions['webPreferences'],
}) {
const parentWebPreferences = embedder.getLastWebPreferences()!;
const parentWebPreferences = embedder.getLastWebPreferences();
const securityWebPreferencesFromParent = (Object.keys(securityWebPreferences).reduce((map, key) => {
if (securityWebPreferences[key] === parentWebPreferences[key as keyof Electron.WebPreferences]) {
(map as any)[key] = parentWebPreferences[key as keyof Electron.WebPreferences];

View File

@@ -28,7 +28,7 @@ const getGuestWindow = function (guestContents: WebContents) {
};
const isChildWindow = function (sender: WebContents, target: WebContents) {
return target.getLastWebPreferences()!.openerId === sender.id;
return target.getLastWebPreferences().openerId === sender.id;
};
const isRelatedWindow = function (sender: WebContents, target: WebContents) {
@@ -43,7 +43,7 @@ const isScriptableWindow = function (sender: WebContents, target: WebContents) {
};
const isNodeIntegrationEnabled = function (sender: WebContents) {
return sender.getLastWebPreferences()!.nodeIntegration === true;
return sender.getLastWebPreferences().nodeIntegration === true;
};
// Checks whether |sender| can access the |target|:
@@ -65,7 +65,7 @@ ipcMainInternal.on(
features: string
) => {
// This should only be allowed for senders that have nativeWindowOpen: false
const lastWebPreferences = event.sender.getLastWebPreferences()!;
const lastWebPreferences = event.sender.getLastWebPreferences();
if (lastWebPreferences.nativeWindowOpen || lastWebPreferences.sandbox) {
event.returnValue = null;
throw new Error(

View File

@@ -4,6 +4,7 @@ import { clipboard } from 'electron/common';
import * as fs from 'fs';
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
import * as typeUtils from '@electron/internal/common/type-utils';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import type * as desktopCapturerModule from '@electron/internal/browser/desktop-capturer';
@@ -59,7 +60,7 @@ ipcMainUtils.handleSync(IPC_MESSAGES.BROWSER_CLIPBOARD_SYNC, function (event, me
throw new Error(`Invalid method: ${method}`);
}
return (clipboard as any)[method](...args);
return typeUtils.serialize((clipboard as any)[method](...typeUtils.deserialize(args)));
});
if (BUILDFLAG(ENABLE_DESKTOP_CAPTURER)) {
@@ -74,7 +75,7 @@ if (BUILDFLAG(ENABLE_DESKTOP_CAPTURER)) {
return [];
}
return await desktopCapturer.getSourcesImpl(event.sender, options);
return typeUtils.serialize(await desktopCapturer.getSourcesImpl(event.sender, options));
});
}

View File

@@ -1,14 +1,20 @@
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import type * as ipcRendererUtilsModule from '@electron/internal/renderer/ipc-renderer-internal-utils';
import type * as typeUtilsModule from '@electron/internal/common/type-utils';
const clipboard = process._linkedBinding('electron_common_clipboard');
if (process.type === 'renderer') {
const ipcRendererUtils = require('@electron/internal/renderer/ipc-renderer-internal-utils') as typeof ipcRendererUtilsModule;
const typeUtils = require('@electron/internal/common/type-utils') as typeof typeUtilsModule;
const makeRemoteMethod = function (method: keyof Electron.Clipboard): any {
return (...args: any[]) => ipcRendererUtils.invokeSync(IPC_MESSAGES.BROWSER_CLIPBOARD_SYNC, method, ...args);
const makeRemoteMethod = function (method: keyof Electron.Clipboard) {
return (...args: any[]) => {
args = typeUtils.serialize(args);
const result = ipcRendererUtils.invokeSync(IPC_MESSAGES.BROWSER_CLIPBOARD_SYNC, method, ...args);
return typeUtils.deserialize(result);
};
};
if (process.platform === 'linux') {

View File

@@ -1,7 +1,6 @@
// Common modules, please sort alphabetically
export const commonModuleList: ElectronInternal.ModuleEntry[] = [
{ name: 'clipboard', loader: () => require('./clipboard') },
{ name: 'nativeImage', loader: () => require('./native-image') },
{ name: 'shell', loader: () => require('./shell') },
// The internal modules, invisible unless you know their names.
{ name: 'deprecate', loader: () => require('./deprecate'), private: true }

View File

@@ -10,11 +10,14 @@ export const enum IPC_MESSAGES {
GUEST_VIEW_INTERNAL_DESTROY_GUEST = 'GUEST_VIEW_INTERNAL_DESTROY_GUEST',
GUEST_VIEW_INTERNAL_DISPATCH_EVENT = 'GUEST_VIEW_INTERNAL_DISPATCH_EVENT',
GUEST_VIEW_INTERNAL_IPC_MESSAGE = 'GUEST_VIEW_INTERNAL_IPC_MESSAGE',
GUEST_VIEW_MANAGER_CREATE_AND_ATTACH_GUEST = 'GUEST_VIEW_MANAGER_CREATE_AND_ATTACH_GUEST',
GUEST_VIEW_MANAGER_CREATE_GUEST = 'GUEST_VIEW_MANAGER_CREATE_GUEST',
GUEST_VIEW_MANAGER_ATTACH_GUEST = 'GUEST_VIEW_MANAGER_ATTACH_GUEST',
GUEST_VIEW_MANAGER_DETACH_GUEST = 'GUEST_VIEW_MANAGER_DETACH_GUEST',
GUEST_VIEW_MANAGER_FOCUS_CHANGE = 'GUEST_VIEW_MANAGER_FOCUS_CHANGE',
GUEST_VIEW_MANAGER_CALL = 'GUEST_VIEW_MANAGER_CALL',
GUEST_VIEW_MANAGER_CAPTURE_PAGE = 'GUEST_VIEW_MANAGER_CAPTURE_PAGE',
GUEST_VIEW_MANAGER_PROPERTY_GET = 'GUEST_VIEW_MANAGER_PROPERTY_GET',
GUEST_VIEW_MANAGER_PROPERTY_SET = 'GUEST_VIEW_MANAGER_PROPERTY_SET',

110
lib/common/type-utils.ts Normal file
View File

@@ -0,0 +1,110 @@
function getCreateNativeImage () {
return process._linkedBinding('electron_common_native_image').nativeImage.createEmpty;
}
export function isPromise (val: any) {
return (
val &&
val.then &&
val.then instanceof Function &&
val.constructor &&
val.constructor.reject &&
val.constructor.reject instanceof Function &&
val.constructor.resolve &&
val.constructor.resolve instanceof Function
);
}
const serializableTypes = [
Boolean,
Number,
String,
Date,
Error,
RegExp,
ArrayBuffer
];
// https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#Supported_types
export function isSerializableObject (value: any) {
return value === null || ArrayBuffer.isView(value) || serializableTypes.some(type => value instanceof type);
}
const objectMap = function (source: Object, mapper: (value: any) => any) {
const sourceEntries = Object.entries(source);
const targetEntries = sourceEntries.map(([key, val]) => [key, mapper(val)]);
return Object.fromEntries(targetEntries);
};
function serializeNativeImage (image: Electron.NativeImage) {
const representations = [];
const scaleFactors = image.getScaleFactors();
// Use Buffer when there's only one representation for better perf.
// This avoids compressing to/from PNG where it's not necessary to
// ensure uniqueness of dataURLs (since there's only one).
if (scaleFactors.length === 1) {
const scaleFactor = scaleFactors[0];
const size = image.getSize(scaleFactor);
const buffer = image.toBitmap({ scaleFactor });
representations.push({ scaleFactor, size, buffer });
} else {
// Construct from dataURLs to ensure that they are not lost in creation.
for (const scaleFactor of scaleFactors) {
const size = image.getSize(scaleFactor);
const dataURL = image.toDataURL({ scaleFactor });
representations.push({ scaleFactor, size, dataURL });
}
}
return { __ELECTRON_SERIALIZED_NativeImage__: true, representations };
}
function deserializeNativeImage (value: any, createNativeImage: typeof Electron.nativeImage['createEmpty']) {
const image = createNativeImage();
// Use Buffer when there's only one representation for better perf.
// This avoids compressing to/from PNG where it's not necessary to
// ensure uniqueness of dataURLs (since there's only one).
if (value.representations.length === 1) {
const { buffer, size, scaleFactor } = value.representations[0];
const { width, height } = size;
image.addRepresentation({ buffer, scaleFactor, width, height });
} else {
// Construct from dataURLs to ensure that they are not lost in creation.
for (const rep of value.representations) {
const { dataURL, size, scaleFactor } = rep;
const { width, height } = size;
image.addRepresentation({ dataURL, scaleFactor, width, height });
}
}
return image;
}
export function serialize (value: any): any {
if (value && value.constructor && value.constructor.name === 'NativeImage') {
return serializeNativeImage(value);
} if (Array.isArray(value)) {
return value.map(serialize);
} else if (isSerializableObject(value)) {
return value;
} else if (value instanceof Object) {
return objectMap(value, serialize);
} else {
return value;
}
}
export function deserialize (value: any, createNativeImage: typeof Electron.nativeImage['createEmpty'] = getCreateNativeImage()): any {
if (value && value.__ELECTRON_SERIALIZED_NativeImage__) {
return deserializeNativeImage(value, createNativeImage);
} else if (Array.isArray(value)) {
return value.map(value => deserialize(value, createNativeImage));
} else if (isSerializableObject(value)) {
return value;
} else if (value instanceof Object) {
return objectMap(value, value => deserialize(value, createNativeImage));
} else {
return value;
}
}

View File

@@ -12,6 +12,7 @@ export const webViewEvents: Record<string, readonly string[]> = {
'devtools-opened': [],
'devtools-closed': [],
'devtools-focused': [],
'new-window': ['url', 'frameName', 'disposition', 'options'],
'will-navigate': ['url'],
'did-start-navigation': ['url', 'isInPlace', 'isMainFrame', 'frameProcessId', 'frameRoutingId'],
'did-redirect-navigation': ['url', 'isInPlace', 'isMainFrame', 'frameProcessId', 'frameRoutingId'],

View File

@@ -59,7 +59,6 @@ export const properties = new Set([
]);
export const asyncMethods = new Set([
'capturePage',
'loadURL',
'executeJavaScript',
'insertCSS',

View File

@@ -1,5 +1,5 @@
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import deprecate from '@electron/internal/common/api/deprecate';
import { deserialize } from '@electron/internal/common/type-utils';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
const { hasSwitch } = process._linkedBinding('electron_common_command_line');
@@ -14,11 +14,6 @@ function getCurrentStack () {
return (target as any).stack;
}
let warned = process.noDeprecation;
export async function getSources (options: Electron.SourcesOptions) {
if (!warned) {
deprecate.log('The use of \'desktopCapturer.getSources\' in the renderer process is deprecated and will be removed. See https://www.electronjs.org/docs/breaking-changes#removed-desktopcapturergetsources-in-the-renderer for more details.');
warned = true;
}
return await ipcRendererInternal.invoke(IPC_MESSAGES.DESKTOP_CAPTURER_GET_SOURCES, options, getCurrentStack());
return deserialize(await ipcRendererInternal.invoke(IPC_MESSAGES.DESKTOP_CAPTURER_GET_SOURCES, options, getCurrentStack()));
}

View File

@@ -3,6 +3,7 @@ export const rendererModuleList: ElectronInternal.ModuleEntry[] = [
{ name: 'contextBridge', loader: () => require('./context-bridge') },
{ name: 'crashReporter', loader: () => require('./crash-reporter') },
{ name: 'ipcRenderer', loader: () => require('./ipc-renderer') },
{ name: 'nativeImage', loader: () => require('./native-image') },
{ name: 'webFrame', loader: () => require('./web-frame') }
];

View File

@@ -0,0 +1,3 @@
const { nativeImage } = process._linkedBinding('electron_common_native_image');
export default nativeImage;

View File

@@ -78,7 +78,7 @@ const isHiddenPage = mainFrame.getWebPreference('hiddenPage');
const usesNativeWindowOpen = mainFrame.getWebPreference('nativeWindowOpen');
const preloadScript = mainFrame.getWebPreference('preload');
const preloadScripts = mainFrame.getWebPreference('preloadScripts');
const isWebView = mainFrame.getWebPreference('isWebView');
const guestInstanceId = mainFrame.getWebPreference('guestInstanceId');
const openerId = mainFrame.getWebPreference('openerId');
const appPath = hasSwitch('app-path') ? getSwitchValue('app-path') : null;
@@ -102,14 +102,14 @@ switch (window.location.protocol) {
default: {
// Override default web functions.
const { windowSetup } = require('@electron/internal/renderer/window-setup') as typeof windowSetupModule;
windowSetup(isWebView, openerId, isHiddenPage, usesNativeWindowOpen);
windowSetup(guestInstanceId, openerId, isHiddenPage, usesNativeWindowOpen);
}
}
// Load webview tag implementation.
if (process.isMainFrame) {
const { webViewInit } = require('@electron/internal/renderer/web-view/web-view-init') as typeof webViewInitModule;
webViewInit(contextIsolation, webviewTag, isWebView);
webViewInit(contextIsolation, webviewTag, guestInstanceId);
}
if (nodeIntegration) {

View File

@@ -77,8 +77,15 @@ const isLocalhost = function () {
*
* @returns {boolean} Is a CSP with `unsafe-eval` set?
*/
const isUnsafeEvalEnabled = () => {
return webFrame._isEvalAllowed();
const isUnsafeEvalEnabled: () => Promise<boolean> = function () {
return webFrame.executeJavaScript(`(${(() => {
try {
eval(window.trustedTypes.emptyScript); // eslint-disable-line no-eval
} catch {
return false;
}
return true;
}).toString()})()`, false);
};
const moreInformation = `\nFor more information and help, consult
@@ -167,14 +174,16 @@ const warnAboutDisabledWebSecurity = function (webPreferences?: Electron.WebPref
* Logs a warning message about unset or insecure CSP
*/
const warnAboutInsecureCSP = function () {
if (!isUnsafeEvalEnabled()) return;
isUnsafeEvalEnabled().then((enabled) => {
if (!enabled) return;
const warning = `This renderer process has either no Content Security
Policy set or a policy with "unsafe-eval" enabled. This exposes users of
this app to unnecessary security risks.\n${moreInformation}`;
const warning = `This renderer process has either no Content Security
Policy set or a policy with "unsafe-eval" enabled. This exposes users of
this app to unnecessary security risks.\n${moreInformation}`;
console.warn('%cElectron Security Warning (Insecure Content-Security-Policy)',
'font-weight: bold;', warning);
console.warn('%cElectron Security Warning (Insecure Content-Security-Policy)',
'font-weight: bold;', warning);
}).catch(() => {});
};
/**

View File

@@ -1,5 +1,6 @@
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
import { webViewEvents } from '@electron/internal/common/web-view-events';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame');
@@ -13,27 +14,45 @@ const DEPRECATED_EVENTS: Record<string, string> = {
'page-title-updated': 'page-title-set'
} as const;
const dispatchEvent = function (delegate: GuestViewDelegate, eventName: string, eventKey: string, ...args: Array<any>) {
if (DEPRECATED_EVENTS[eventName] != null) {
dispatchEvent(delegate, DEPRECATED_EVENTS[eventName], eventKey, ...args);
}
const props: Record<string, any> = {};
webViewEvents[eventKey].forEach((prop, index) => {
props[prop] = args[index];
});
delegate.dispatchEvent(eventName, props);
};
export function registerEvents (viewInstanceId: number, delegate: GuestViewDelegate) {
ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DESTROY_GUEST}-${viewInstanceId}`, function () {
delegate.reset();
delegate.dispatchEvent('destroyed', {});
});
ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT}-${viewInstanceId}`, function (event, eventName, props) {
if (DEPRECATED_EVENTS[eventName] != null) {
delegate.dispatchEvent(DEPRECATED_EVENTS[eventName], props);
}
ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT}-${viewInstanceId}`, function (event, eventName, ...args) {
dispatchEvent(delegate, eventName, eventName, ...args);
});
delegate.dispatchEvent(eventName, props);
ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_IPC_MESSAGE}-${viewInstanceId}`, function (event, data) {
delegate.dispatchEvent('ipc-message', data);
});
}
export function deregisterEvents (viewInstanceId: number) {
ipcRendererInternal.removeAllListeners(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DESTROY_GUEST}-${viewInstanceId}`);
ipcRendererInternal.removeAllListeners(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT}-${viewInstanceId}`);
ipcRendererInternal.removeAllListeners(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_IPC_MESSAGE}-${viewInstanceId}`);
}
export function createGuest (iframe: HTMLIFrameElement, elementInstanceId: number, params: Record<string, any>): Promise<number> {
export function createGuest (params: Record<string, any>): Promise<number> {
return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_CREATE_GUEST, params);
}
export function attachGuest (iframe: HTMLIFrameElement, elementInstanceId: number, guestInstanceId: number, params: Record<string, any>) {
if (!(iframe instanceof HTMLIFrameElement)) {
throw new Error('Invalid embedder frame');
}
@@ -43,13 +62,17 @@ export function createGuest (iframe: HTMLIFrameElement, elementInstanceId: numbe
throw new Error('Invalid embedder frame');
}
return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_CREATE_AND_ATTACH_GUEST, embedderFrameId, elementInstanceId, params);
return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_ATTACH_GUEST, embedderFrameId, elementInstanceId, guestInstanceId, params);
}
export function detachGuest (guestInstanceId: number) {
return ipcRendererUtils.invokeSync(IPC_MESSAGES.GUEST_VIEW_MANAGER_DETACH_GUEST, guestInstanceId);
}
export function capturePage (guestInstanceId: number, args: any[]) {
return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_CAPTURE_PAGE, guestInstanceId, args);
}
export function invoke (guestInstanceId: number, method: string, args: any[]) {
return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_CALL, guestInstanceId, method, args);
}

View File

@@ -3,6 +3,7 @@ import { WEB_VIEW_CONSTANTS } from '@electron/internal/renderer/web-view/web-vie
import { syncMethods, asyncMethods, properties } from '@electron/internal/common/web-view-methods';
import type { WebViewAttribute, PartitionAttribute } from '@electron/internal/renderer/web-view/web-view-attributes';
import { setupWebViewAttributes } from '@electron/internal/renderer/web-view/web-view-attributes';
import { deserialize } from '@electron/internal/common/type-utils';
// ID generator.
let nextId = 0;
@@ -15,6 +16,7 @@ export interface WebViewImplHooks {
readonly guestViewInternal: typeof guestViewInternalModule;
readonly allowGuestViewElementDefinition: NodeJS.InternalWebFrame['allowGuestViewElementDefinition'];
readonly setIsWebView: (iframe: HTMLIFrameElement) => void;
readonly createNativeImage?: typeof Electron.nativeImage['createEmpty'];
}
// Represents the internal state of the WebView node.
@@ -112,11 +114,9 @@ export class WebViewImpl {
}
createGuest () {
this.internalInstanceId = getNextId();
this.hooks.guestViewInternal.createGuest(this.internalElement, this.internalInstanceId, this.buildParams())
.then(guestInstanceId => {
this.attachGuestInstance(guestInstanceId);
});
this.hooks.guestViewInternal.createGuest(this.buildParams()).then(guestInstanceId => {
this.attachGuestInstance(guestInstanceId);
});
}
dispatchEvent (eventName: string, props: Record<string, any> = {}) {
@@ -190,19 +190,20 @@ export class WebViewImpl {
}
attachGuestInstance (guestInstanceId: number) {
if (guestInstanceId === -1) {
// Do nothing
return;
}
if (!this.elementAttached) {
// The element could be detached before we got response from browser.
// Destroy the backing webContents to avoid any zombie nodes in the frame tree.
this.hooks.guestViewInternal.detachGuest(guestInstanceId);
return;
}
this.internalInstanceId = getNextId();
this.guestInstanceId = guestInstanceId;
this.hooks.guestViewInternal.attachGuest(
this.internalElement,
this.internalInstanceId,
this.guestInstanceId,
this.buildParams()
);
// TODO(zcbenz): Should we deprecate the "resize" event? Wait, it is not
// even documented.
this.resizeObserver = new ResizeObserver(this.onElementResize.bind(this));
@@ -231,6 +232,10 @@ export const setupMethods = (WebViewElement: typeof ElectronInternal.WebViewElem
};
}
WebViewElement.prototype.capturePage = async function (...args) {
return deserialize(await hooks.guestViewInternal.capturePage(this.getWebContentsId(), args), hooks.createNativeImage);
};
const createPropertyGetter = function (property: string) {
return function (this: ElectronInternal.WebViewElement) {
return hooks.guestViewInternal.propertyGet(this.getWebContentsId(), property);

View File

@@ -20,9 +20,9 @@ function handleFocusBlur () {
});
}
export function webViewInit (contextIsolation: boolean, webviewTag: boolean, isWebView: boolean) {
export function webViewInit (contextIsolation: boolean, webviewTag: boolean, guestInstanceId: number) {
// Don't allow recursive `<webview>`.
if (webviewTag && !isWebView) {
if (webviewTag && !guestInstanceId) {
const guestViewInternal = require('@electron/internal/renderer/web-view/guest-view-internal') as typeof guestViewInternalModule;
if (contextIsolation) {
v8Util.setHiddenValue(window, 'guestViewInternal', guestViewInternal);
@@ -36,7 +36,7 @@ export function webViewInit (contextIsolation: boolean, webviewTag: boolean, isW
}
}
if (isWebView) {
if (guestInstanceId) {
// Report focus/blur events of webview to browser.
handleFocusBlur();
}

View File

@@ -243,8 +243,8 @@ class BrowserWindowProxy {
}
export const windowSetup = (
isWebView: boolean, openerId: number, isHiddenPage: boolean, usesNativeWindowOpen: boolean) => {
if (!process.sandboxed && !isWebView) {
guestInstanceId: number, openerId: number, isHiddenPage: boolean, usesNativeWindowOpen: boolean) => {
if (!process.sandboxed && !guestInstanceId) {
// Override default window.close.
window.close = function () {
ipcRendererInternal.send(IPC_MESSAGES.BROWSER_WINDOW_CLOSE);
@@ -318,7 +318,7 @@ export const windowSetup = (
});
}
if (isWebView) {
if (guestInstanceId) {
// Webview `document.visibilityState` tracks window visibility (and ignores
// the actual <webview> element visibility) for backwards compatibility.
// See discussion in #9178.

View File

@@ -13,7 +13,7 @@ export const moduleList: ElectronInternal.ModuleEntry[] = [
},
{
name: 'nativeImage',
loader: () => require('@electron/internal/common/api/native-image')
loader: () => require('@electron/internal/renderer/api/native-image')
},
{
name: 'webFrame',

View File

@@ -131,7 +131,7 @@ const contextIsolation = mainFrame.getWebPreference('contextIsolation');
const webviewTag = mainFrame.getWebPreference('webviewTag');
const isHiddenPage = mainFrame.getWebPreference('hiddenPage');
const usesNativeWindowOpen = true;
const isWebView = mainFrame.getWebPreference('isWebView');
const guestInstanceId = mainFrame.getWebPreference('guestInstanceId');
const openerId = mainFrame.getWebPreference('openerId');
switch (window.location.protocol) {
@@ -149,14 +149,14 @@ switch (window.location.protocol) {
default: {
// Override default web functions.
const { windowSetup } = require('@electron/internal/renderer/window-setup') as typeof windowSetupModule;
windowSetup(isWebView, openerId, isHiddenPage, usesNativeWindowOpen);
windowSetup(guestInstanceId, openerId, isHiddenPage, usesNativeWindowOpen);
}
}
// Load webview tag implementation.
if (process.isMainFrame) {
const { webViewInit } = require('@electron/internal/renderer/web-view/web-view-init') as typeof webViewInitModule;
webViewInit(contextIsolation, webviewTag, isWebView);
webViewInit(contextIsolation, webviewTag, guestInstanceId);
}
// Wrap the script into a function executed in global scope. It won't have

View File

@@ -1,6 +1,6 @@
{
"name": "electron",
"version": "16.2.2",
"version": "15.3.7",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {
@@ -56,8 +56,8 @@
"minimist": "^1.2.5",
"null-loader": "^4.0.0",
"pre-flight": "^1.1.0",
"remark-cli": "^10.0.0",
"remark-preset-lint-markdown-style-guide": "^4.0.0",
"remark-cli": "^4.0.0",
"remark-preset-lint-markdown-style-guide": "^2.1.1",
"semver": "^5.6.0",
"shx": "^0.3.2",
"standard-markdown": "^6.0.0",
@@ -78,7 +78,7 @@
"generate-version-json": "node script/generate-version-json.js",
"lint": "node ./script/lint.js && npm run lint:clang-format && npm run lint:docs",
"lint:js": "node ./script/lint.js --js",
"lint:clang-format": "python script/run-clang-format.py -r -c shell/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
"lint:clang-format": "python script/run-clang-format.py -r -c chromium_src/ shell/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
"lint:clang-tidy": "ts-node ./script/run-clang-tidy.ts",
"lint:cpp": "node ./script/lint.js --cc",
"lint:objc": "node ./script/lint.js --objc",

View File

@@ -1,9 +1,7 @@
cherry-pick-bdffa0ea5148.patch
cherry-pick-05e69c75905f.patch
cherry-pick-891020ed64d4.patch
cherry-pick-2b98abd8cb6c.patch
cherry-pick-cc44ae61f37b.patch
vangle_change_the_default_vulkan_device_choose_logic.patch
m98_vulkan_fix_vkcmdresolveimage_extents.patch
m98_vulkan_fix_vkcmdresolveimage_offsets.patch
cherry-pick-49e8ff16f1fe.patch
m98_protect_against_deleting_a_current_xfb_buffer.patch
m99_vulkan_prevent_out_of_bounds_read_in_divisor_emulation_path.patch
m99_vulkan_streamvertexdatawithdivisor_write_beyond_buffer_boundary.patch
cherry-pick-2b75a29bf241.patch
m96-lts_fix_base_level_changes_not_updating_fbo_completeness_check.patch
m96_validate_samplerformat.patch

View File

@@ -0,0 +1,118 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lingfeng Yang <lfy@google.com>
Date: Wed, 1 Dec 2021 18:16:14 -0800
Subject: M96: Vulkan: remove staged updates on storage set
Previously we would allow staged updates to bigger versions of a texture
to go through even if the texture was redefined via glTexStorage*.
Bug: chromium:1262080
Change-Id: I9d861fed68d4a1fdcd0777b97caf729cc74c595e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3312718
Reviewed-by: Charlie Lao <cclao@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Lingfeng Yang <lfy@google.com>
(cherry picked from commit 929c8ed4e8c3912cf027d843e7a2af47b21e5612)
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3328001
diff --git a/src/libANGLE/renderer/vulkan/TextureVk.cpp b/src/libANGLE/renderer/vulkan/TextureVk.cpp
index e0be9676912e49d70473ffdcd4d7b1549210be25..b43f41dbae29356f1ffe4f961ed83e0f0e9cdcd2 100644
--- a/src/libANGLE/renderer/vulkan/TextureVk.cpp
+++ b/src/libANGLE/renderer/vulkan/TextureVk.cpp
@@ -1236,6 +1236,10 @@ angle::Result TextureVk::setStorageMultisample(const gl::Context *context,
{
releaseAndDeleteImageAndViews(contextVk);
}
+ else if (mImage)
+ {
+ mImage->releaseStagingBuffer(contextVk->getRenderer());
+ }
const vk::Format &format = renderer->getFormat(internalformat);
ANGLE_TRY(ensureImageAllocated(contextVk, format));
diff --git a/src/tests/gl_tests/TextureTest.cpp b/src/tests/gl_tests/TextureTest.cpp
index e79bc700d4991752289ff3d7c76f2ccbb3ba932a..a3dec629c9ea96b276ff8bf344d4a4628ff20b3b 100644
--- a/src/tests/gl_tests/TextureTest.cpp
+++ b/src/tests/gl_tests/TextureTest.cpp
@@ -9703,6 +9703,73 @@ void main()
glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
}
+class TextureChangeStorageUploadTest : public ANGLETest
+{
+ protected:
+ TextureChangeStorageUploadTest()
+ {
+ setWindowWidth(256);
+ setWindowHeight(256);
+ setConfigRedBits(8);
+ setConfigGreenBits(8);
+ setConfigBlueBits(8);
+ setConfigAlphaBits(8);
+ }
+
+ void testSetUp() override
+ {
+ mProgram = CompileProgram(essl1_shaders::vs::Simple(), essl1_shaders::fs::UniformColor());
+ if (mProgram == 0)
+ {
+ FAIL() << "shader compilation failed.";
+ }
+
+ mColorLocation = glGetUniformLocation(mProgram, essl1_shaders::ColorUniform());
+
+ glUseProgram(mProgram);
+
+ glClearColor(0, 0, 0, 0);
+ glClearDepthf(0.0);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glEnable(GL_BLEND);
+ glDisable(GL_DEPTH_TEST);
+
+ glGenTextures(1, &mTexture);
+ ASSERT_GL_NO_ERROR();
+ }
+
+ void testTearDown() override
+ {
+ glDeleteTextures(1, &mTexture);
+ glDeleteProgram(mProgram);
+ }
+
+ GLuint mProgram;
+ GLint mColorLocation;
+ GLuint mTexture;
+};
+
+// Verify that respecifying storage and re-uploading doesn't crash.
+TEST_P(TextureChangeStorageUploadTest, Basic)
+{
+ constexpr int kImageSize = 8; // 4 doesn't trip ASAN
+ constexpr int kSmallerImageSize = kImageSize / 2;
+ EXPECT_GT(kImageSize, kSmallerImageSize);
+ EXPECT_GT(kSmallerImageSize / 2, 0);
+
+ std::array<GLColor, kImageSize * kImageSize> kColor;
+
+ glBindTexture(GL_TEXTURE_2D, mTexture);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, kImageSize, kImageSize, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ kColor.data());
+ glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, kSmallerImageSize, kSmallerImageSize);
+ // need partial update to sidestep optimizations that remove the full upload
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, kSmallerImageSize / 2, kSmallerImageSize / 2, GL_RGBA,
+ GL_UNSIGNED_BYTE, kColor.data());
+ EXPECT_GL_NO_ERROR();
+}
+
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
#define ES2_EMULATE_COPY_TEX_IMAGE() \
@@ -9816,4 +9883,6 @@ ANGLE_INSTANTIATE_TEST_ES31_AND(TextureBufferTestES31, WithDirectSPIRVGeneration
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CopyImageTestES31);
ANGLE_INSTANTIATE_TEST_ES31_AND(CopyImageTestES31, WithDirectSPIRVGeneration(ES31_VULKAN()));
+ANGLE_INSTANTIATE_TEST_ES3(TextureChangeStorageUploadTest);
+
} // anonymous namespace

View File

@@ -1,94 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jamie Madill <jmadill@chromium.org>
Date: Tue, 1 Mar 2022 15:40:38 -0500
Subject: Vulkan: Fix issue with redefining a layered attachment.
The fix ensures we complete level redefinition before we get the
layer render target in TextureVk::getAttachmentRenderTarget.
Bug: chromium:1296866
Change-Id: Id7fa8e9fed5e766c30580b09336713c675c4e4f0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3498283
Commit-Queue: Jamie Madill <jmadill@chromium.org>
(cherry picked from commit 348ece42552a99cff88f79c80652b9dd3155ab22)
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3513754
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/TextureVk.cpp b/src/libANGLE/renderer/vulkan/TextureVk.cpp
index 75cd69adc7839fc05650fc7cc30680ca92102a7f..27902ccdec3c1674110f03df41006558b211576c 100644
--- a/src/libANGLE/renderer/vulkan/TextureVk.cpp
+++ b/src/libANGLE/renderer/vulkan/TextureVk.cpp
@@ -2325,6 +2325,15 @@ angle::Result TextureVk::getAttachmentRenderTarget(const gl::Context *context,
ASSERT(mState.hasBeenBoundAsAttachment());
ANGLE_TRY(ensureRenderable(contextVk));
+ if (mRedefinedLevels.any())
+ {
+ // If we have redefined levels, we must flush those out to fix the render targets.
+ ANGLE_TRY(respecifyImageStorage(contextVk));
+ }
+
+ // Otherwise, don't flush staged updates here. We'll handle that in FramebufferVk so we can
+ // defer clears.
+
if (!mImage->valid())
{
// Immutable texture must already have a valid image
@@ -2364,8 +2373,6 @@ angle::Result TextureVk::getAttachmentRenderTarget(const gl::Context *context,
mState.getType(), samples, *mImage, useRobustInit));
}
- // Don't flush staged updates here. We'll handle that in FramebufferVk so it can defer clears.
-
GLuint layerIndex = 0, layerCount = 0, imageLayerCount = 0;
GetRenderTargetLayerCountAndIndex(mImage, imageIndex, &layerIndex, &layerCount,
&imageLayerCount);
@@ -2376,10 +2383,14 @@ angle::Result TextureVk::getAttachmentRenderTarget(const gl::Context *context,
gl::LevelIndex(imageIndex.getLevelIndex()),
renderToTextureIndex);
- ASSERT(imageIndex.getLevelIndex() <
- static_cast<int32_t>(mSingleLayerRenderTargets[renderToTextureIndex].size()));
- *rtOut = &mSingleLayerRenderTargets[renderToTextureIndex][imageIndex.getLevelIndex()]
- [layerIndex];
+ std::vector<RenderTargetVector> &levelRenderTargets =
+ mSingleLayerRenderTargets[renderToTextureIndex];
+ ASSERT(imageIndex.getLevelIndex() < static_cast<int32_t>(levelRenderTargets.size()));
+
+ RenderTargetVector &layerRenderTargets = levelRenderTargets[imageIndex.getLevelIndex()];
+ ASSERT(imageIndex.getLayerIndex() < static_cast<int32_t>(layerRenderTargets.size()));
+
+ *rtOut = &layerRenderTargets[layerIndex];
}
else
{
diff --git a/src/tests/gl_tests/FramebufferTest.cpp b/src/tests/gl_tests/FramebufferTest.cpp
index d95f7b585f23af246cc65b1d68a1524c62f4024e..46740cae77df7b6e9509093c02b79a332b4f106d 100644
--- a/src/tests/gl_tests/FramebufferTest.cpp
+++ b/src/tests/gl_tests/FramebufferTest.cpp
@@ -4000,6 +4000,25 @@ TEST_P(FramebufferTest_ES3, BindRenderbufferThenModifySize)
ASSERT_GL_NO_ERROR();
}
+// Tests redefining a layered framebuffer attachment.
+TEST_P(FramebufferTest_ES3, RedefineLayerAttachment)
+{
+ GLTexture texture;
+ glBindTexture(GL_TEXTURE_3D, texture);
+ std::vector<uint8_t> imgData(20480, 0);
+ glTexImage3D(GL_TEXTURE_3D, 0, GL_R8, 8, 8, 8, 0, GL_RED, GL_UNSIGNED_BYTE, imgData.data());
+
+ GLFramebuffer fbo;
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+ glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, 0, 8);
+ glGenerateMipmap(GL_TEXTURE_3D);
+
+ glTexImage3D(GL_TEXTURE_3D, 0, GL_R8UI, 16, 16, 16, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE,
+ imgData.data());
+ glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 2, 2, 15, 16, 16);
+ ASSERT_GL_NO_ERROR();
+}
+
ANGLE_INSTANTIATE_TEST_ES2(AddMockTextureNoRenderTargetTest);
ANGLE_INSTANTIATE_TEST_ES2(FramebufferTest);
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(FramebufferFormatsTest);

View File

@@ -0,0 +1,96 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shahbaz Youssefi <syoussefi@chromium.org>
Date: Tue, 30 Nov 2021 23:48:30 -0500
Subject: M96: Vulkan: Fix image respecify's usage tracking
When respecifying an image due to mip level count changes, the previous
image is staged as an update to the new image. The resource usage info
was not being transferred to the image being staged as an update,
causing it to be prematurely deleted.
Test based on one authored by sugoi@google.com.
Bug: chromium:1270658
Bug: angleproject:4835
Change-Id: I9810f8940e0107bc8a04fa3fb9c26a045c0d689c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3318257
Reviewed-by: Lingfeng Yang <lfy@google.com>
diff --git a/src/libANGLE/renderer/vulkan/ResourceVk.cpp b/src/libANGLE/renderer/vulkan/ResourceVk.cpp
index efb04acf0fe5dc7c2d860ac8cc33dbe30691c4a3..e2cd1e3a96b1fa4e034efe6ed78ea1a787af6af6 100644
--- a/src/libANGLE/renderer/vulkan/ResourceVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ResourceVk.cpp
@@ -26,6 +26,12 @@ Resource::Resource(Resource &&other) : Resource()
mUse = std::move(other.mUse);
}
+Resource &Resource::operator=(Resource &&rhs)
+{
+ std::swap(mUse, rhs.mUse);
+ return *this;
+}
+
Resource::~Resource()
{
mUse.release();
diff --git a/src/libANGLE/renderer/vulkan/ResourceVk.h b/src/libANGLE/renderer/vulkan/ResourceVk.h
index 67440122bf7fa0f72b5412816853b2eddd770fd4..abab9900b7361c8564cb1ad30e0841eaf873ee2e 100644
--- a/src/libANGLE/renderer/vulkan/ResourceVk.h
+++ b/src/libANGLE/renderer/vulkan/ResourceVk.h
@@ -192,6 +192,7 @@ class Resource : angle::NonCopyable
protected:
Resource();
Resource(Resource &&other);
+ Resource &operator=(Resource &&rhs);
// Current resource lifetime.
SharedResourceUse mUse;
diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.cpp b/src/libANGLE/renderer/vulkan/vk_helpers.cpp
index a06b60d9c2c91280b925b12825e104bdbb757c05..893144ff07760dc1608a4b2d3af565e23ef27ba4 100644
--- a/src/libANGLE/renderer/vulkan/vk_helpers.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_helpers.cpp
@@ -6140,6 +6140,9 @@ void ImageHelper::stageSelfAsSubresourceUpdates(ContextVk *contextVk,
// Move the necessary information for staged update to work, and keep the rest as part of this
// object.
+ // Usage info
+ prevImage->get().Resource::operator=(std::move(*this));
+
// Vulkan objects
prevImage->get().mImage = std::move(mImage);
prevImage->get().mDeviceMemory = std::move(mDeviceMemory);
diff --git a/src/tests/gl_tests/MipmapTest.cpp b/src/tests/gl_tests/MipmapTest.cpp
index 4db00e78a7d2f7375fdcb9228fbdc83395973125..8a6d01ca36a84a9e294de3f6f0114ee7a54e1d9a 100644
--- a/src/tests/gl_tests/MipmapTest.cpp
+++ b/src/tests/gl_tests/MipmapTest.cpp
@@ -2106,6 +2106,30 @@ TEST_P(MipmapTestES3, GenerateMipmapZeroSize)
glGenerateMipmap(GL_TEXTURE_3D);
}
+// Test that reducing the size of the mipchain by resizing the base image then deleting it doesn't
+// cause a crash. Issue found by fuzzer.
+TEST_P(MipmapTestES3, ResizeBaseMipTo1x1ThenDelete)
+{
+ GLTexture tex;
+ glBindTexture(GL_TEXTURE_2D, tex);
+
+ std::vector<GLColor> data(2, GLColor::blue);
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, data.data());
+ glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, data.data());
+
+ clearAndDrawQuad(m2DProgram, getWindowWidth(), getWindowHeight());
+ EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::blue);
+
+ data[0] = GLColor::green;
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, data.data());
+
+ clearAndDrawQuad(m2DProgram, getWindowWidth(), getWindowHeight());
+
+ tex.reset();
+ EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
+}
+
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(MipmapTest);

View File

@@ -1,381 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shahbaz Youssefi <syoussefi@chromium.org>
Date: Tue, 25 Jan 2022 12:15:16 -0500
Subject: M99: Vulkan: Fix texture array level redefinition
When a level of a texture is redefined, all staged updates to that level
should be removed, not the ones specific to the new layers. The bug
fixed was that if the texture was redefined to have its number of layers
changed, the staged higher-layer-count update to the image was not
removed.
Bug: chromium:1289383
Change-Id: Iab79c38d846d1abbdd92e11b1b60a3adf0fbde4c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3441309
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/TextureVk.cpp b/src/libANGLE/renderer/vulkan/TextureVk.cpp
index 4c28358fad590350577177d9997f7731c3ea398f..75cd69adc7839fc05650fc7cc30680ca92102a7f 100644
--- a/src/libANGLE/renderer/vulkan/TextureVk.cpp
+++ b/src/libANGLE/renderer/vulkan/TextureVk.cpp
@@ -1602,12 +1602,25 @@ angle::Result TextureVk::redefineLevel(const gl::Context *context,
if (mImage != nullptr)
{
- // If there is any staged changes for this index, we can remove them since we're going to
+ // If there are any staged changes for this index, we can remove them since we're going to
// override them with this call.
gl::LevelIndex levelIndexGL(index.getLevelIndex());
uint32_t layerIndex = index.hasLayer() ? index.getLayerIndex() : 0;
- mImage->removeSingleSubresourceStagedUpdates(contextVk, levelIndexGL, layerIndex,
- index.getLayerCount());
+ if (gl::IsArrayTextureType(index.getType()))
+ {
+ // A multi-layer texture is being redefined, remove all updates to this level; the
+ // number of layers may have changed.
+ mImage->removeStagedUpdates(contextVk, levelIndexGL, levelIndexGL);
+ }
+ else
+ {
+ // Otherwise remove only updates to this layer. For example, cube map updates can be
+ // done through glTexImage2D, one per cube face (i.e. layer) and so should not remove
+ // updates to the other layers.
+ ASSERT(index.getLayerCount() == 1);
+ mImage->removeSingleSubresourceStagedUpdates(contextVk, levelIndexGL, layerIndex,
+ index.getLayerCount());
+ }
if (mImage->valid())
{
diff --git a/src/tests/gl_tests/MipmapTest.cpp b/src/tests/gl_tests/MipmapTest.cpp
index 8a6d01ca36a84a9e294de3f6f0114ee7a54e1d9a..957a52304edc9aa245f9f21e5557cc105cbad789 100644
--- a/src/tests/gl_tests/MipmapTest.cpp
+++ b/src/tests/gl_tests/MipmapTest.cpp
@@ -1686,6 +1686,106 @@ TEST_P(MipmapTestES3, MipmapsForTexture3D)
EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::red);
}
+// Create a 2D array, then immediately redefine it to have fewer layers. Regression test for a bug
+// in the Vulkan backend where the old higher-layer-count data upload was not removed.
+TEST_P(MipmapTestES3, TextureArrayRedefineThenGenerateMipmap)
+{
+ int px = getWindowWidth() / 2;
+ int py = getWindowHeight() / 2;
+
+ glBindTexture(GL_TEXTURE_2D_ARRAY, mTexture);
+
+ // Fill the whole texture with red, then redefine it and fill with green
+ std::vector<GLColor> pixelsRed(2 * 2 * 4, GLColor::red);
+ std::vector<GLColor> pixelsGreen(2 * 2 * 2, GLColor::green);
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 2, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ pixelsRed.data());
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 2, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ pixelsGreen.data());
+
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ EXPECT_GL_NO_ERROR();
+
+ // Generate mipmaps
+ glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
+ EXPECT_GL_NO_ERROR();
+
+ glUseProgram(mArrayProgram);
+ EXPECT_GL_NO_ERROR();
+
+ // Draw the first slice
+ glUniform1i(mTextureArraySliceUniformLocation, 0);
+ drawQuad(mArrayProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::green);
+
+ // Draw the second slice
+ glUniform1i(mTextureArraySliceUniformLocation, 1);
+ drawQuad(mArrayProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::green);
+}
+
+// Create a 2D array, use it, then redefine it to have fewer layers. Regression test for a bug in
+// the Vulkan backend where the old higher-layer-count data upload was not removed.
+TEST_P(MipmapTestES3, TextureArrayUseThenRedefineThenGenerateMipmap)
+{
+ int px = getWindowWidth() / 2;
+ int py = getWindowHeight() / 2;
+
+ glBindTexture(GL_TEXTURE_2D_ARRAY, mTexture);
+
+ // Fill the whole texture with red.
+ std::vector<GLColor> pixelsRed(2 * 2 * 4, GLColor::red);
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 2, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ pixelsRed.data());
+
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ EXPECT_GL_NO_ERROR();
+
+ // Generate mipmap
+ glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
+ EXPECT_GL_NO_ERROR();
+
+ glUseProgram(mArrayProgram);
+ EXPECT_GL_NO_ERROR();
+
+ // Draw the first slice
+ glUniform1i(mTextureArraySliceUniformLocation, 0);
+ drawQuad(mArrayProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::red);
+
+ // Draw the fourth slice
+ glUniform1i(mTextureArraySliceUniformLocation, 3);
+ drawQuad(mArrayProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::red);
+
+ // Redefine the image and fill with green
+ std::vector<GLColor> pixelsGreen(2 * 2 * 2, GLColor::green);
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 2, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ pixelsGreen.data());
+
+ // Generate mipmap
+ glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
+ EXPECT_GL_NO_ERROR();
+
+ // Draw the first slice
+ glUniform1i(mTextureArraySliceUniformLocation, 0);
+ drawQuad(mArrayProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::green);
+
+ // Draw the second slice
+ glUniform1i(mTextureArraySliceUniformLocation, 1);
+ drawQuad(mArrayProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::green);
+}
+
// Create a 2D texture with levels 0-2, call GenerateMipmap with base level 1 so that level 0 stays
// the same, and then sample levels 0 and 2.
// GLES 3.0.4 section 3.8.10:
diff --git a/src/tests/gl_tests/TextureTest.cpp b/src/tests/gl_tests/TextureTest.cpp
index 9ee0203153304080608a597ddbf1513d3a95616c..a46429331b3b272a89bdb8b31f7be75a4a82360c 100644
--- a/src/tests/gl_tests/TextureTest.cpp
+++ b/src/tests/gl_tests/TextureTest.cpp
@@ -1030,31 +1030,37 @@ class SamplerArrayAsFunctionParameterTest : public SamplerArrayTest
class Texture2DArrayTestES3 : public TexCoordDrawTest
{
protected:
- Texture2DArrayTestES3() : TexCoordDrawTest(), m2DArrayTexture(0), mTextureArrayLocation(-1) {}
+ Texture2DArrayTestES3()
+ : TexCoordDrawTest(),
+ m2DArrayTexture(0),
+ mTextureArrayLocation(-1),
+ mTextureArraySliceUniformLocation(-1)
+ {}
const char *getVertexShaderSource() override
{
- return "#version 300 es\n"
- "out vec2 texcoord;\n"
- "in vec4 position;\n"
- "void main()\n"
- "{\n"
- " gl_Position = vec4(position.xy, 0.0, 1.0);\n"
- " texcoord = (position.xy * 0.5) + 0.5;\n"
- "}\n";
+ return R"(#version 300 es
+out vec2 texcoord;
+in vec4 position;
+void main()
+{
+ gl_Position = vec4(position.xy, 0.0, 1.0);
+ texcoord = (position.xy * 0.5) + 0.5;
+})";
}
const char *getFragmentShaderSource() override
{
- return "#version 300 es\n"
- "precision highp float;\n"
- "uniform highp sampler2DArray tex2DArray;\n"
- "in vec2 texcoord;\n"
- "out vec4 fragColor;\n"
- "void main()\n"
- "{\n"
- " fragColor = texture(tex2DArray, vec3(texcoord.x, texcoord.y, 0.0));\n"
- "}\n";
+ return R"(#version 300 es
+precision highp float;
+uniform highp sampler2DArray tex2DArray;
+uniform int slice;
+in vec2 texcoord;
+out vec4 fragColor;
+void main()
+{
+ fragColor = texture(tex2DArray, vec3(texcoord, float(slice)));
+})";
}
void testSetUp() override
@@ -1066,6 +1072,9 @@ class Texture2DArrayTestES3 : public TexCoordDrawTest
mTextureArrayLocation = glGetUniformLocation(mProgram, "tex2DArray");
ASSERT_NE(-1, mTextureArrayLocation);
+ mTextureArraySliceUniformLocation = glGetUniformLocation(mProgram, "slice");
+ ASSERT_NE(-1, mTextureArraySliceUniformLocation);
+
glGenTextures(1, &m2DArrayTexture);
ASSERT_GL_NO_ERROR();
}
@@ -1078,6 +1087,7 @@ class Texture2DArrayTestES3 : public TexCoordDrawTest
GLuint m2DArrayTexture;
GLint mTextureArrayLocation;
+ GLint mTextureArraySliceUniformLocation;
};
class TextureSizeTextureArrayTest : public TexCoordDrawTest
@@ -1720,28 +1730,28 @@ class Texture2DArrayIntegerTestES3 : public Texture2DArrayTestES3
const char *getVertexShaderSource() override
{
- return "#version 300 es\n"
- "out vec2 texcoord;\n"
- "in vec4 position;\n"
- "void main()\n"
- "{\n"
- " gl_Position = vec4(position.xy, 0.0, 1.0);\n"
- " texcoord = (position.xy * 0.5) + 0.5;\n"
- "}\n";
+ return R"(#version 300 es
+out vec2 texcoord;
+in vec4 position;
+void main()
+{
+ gl_Position = vec4(position.xy, 0.0, 1.0);
+ texcoord = (position.xy * 0.5) + 0.5;
+})";
}
const char *getFragmentShaderSource() override
{
- return "#version 300 es\n"
- "precision highp float;\n"
- "uniform highp usampler2DArray tex2DArray;\n"
- "in vec2 texcoord;\n"
- "out vec4 fragColor;\n"
- "void main()\n"
- "{\n"
- " fragColor = vec4(texture(tex2DArray, vec3(texcoord.x, texcoord.y, "
- "0.0)))/255.0;\n"
- "}\n";
+ return R"(#version 300 es
+precision highp float;
+uniform highp usampler2DArray tex2DArray;
+uniform int slice;
+in vec2 texcoord;
+out vec4 fragColor;
+void main()
+{
+ fragColor = vec4(texture(tex2DArray, vec3(texcoord, slice)))/255.0;
+})";
}
};
@@ -5162,6 +5172,94 @@ TEST_P(Texture2DArrayTestES3, DrawWithLevelsOutsideRangeWithInconsistentDimensio
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::cyan);
}
+// Create a 2D array, then immediately redefine it to have fewer layers. Regression test for a bug
+// in the Vulkan backend where the old higher-layer-count data upload was not removed.
+TEST_P(Texture2DArrayTestES3, TextureArrayRedefineThenUse)
+{
+ int px = getWindowWidth() / 2;
+ int py = getWindowHeight() / 2;
+
+ glBindTexture(GL_TEXTURE_2D_ARRAY, m2DArrayTexture);
+
+ // Fill the whole texture with red, then redefine it and fill with green
+ std::vector<GLColor> pixelsRed(2 * 2 * 4, GLColor::red);
+ std::vector<GLColor> pixelsGreen(2 * 2 * 2, GLColor::green);
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 2, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ pixelsRed.data());
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 2, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ pixelsGreen.data());
+
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ EXPECT_GL_NO_ERROR();
+
+ glUseProgram(mProgram);
+ EXPECT_GL_NO_ERROR();
+
+ // Draw the first slice
+ glUniform1i(mTextureArraySliceUniformLocation, 0);
+ drawQuad(mProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::green);
+
+ // Draw the second slice
+ glUniform1i(mTextureArraySliceUniformLocation, 1);
+ drawQuad(mProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::green);
+}
+
+// Create a 2D array, use it, then redefine it to have fewer layers. Regression test for a bug in
+// the Vulkan backend where the old higher-layer-count data upload was not removed.
+TEST_P(Texture2DArrayTestES3, TextureArrayUseThenRedefineThenUse)
+{
+ int px = getWindowWidth() / 2;
+ int py = getWindowHeight() / 2;
+
+ glBindTexture(GL_TEXTURE_2D_ARRAY, m2DArrayTexture);
+
+ // Fill the whole texture with red.
+ std::vector<GLColor> pixelsRed(2 * 2 * 4, GLColor::red);
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 2, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ pixelsRed.data());
+
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ EXPECT_GL_NO_ERROR();
+
+ glUseProgram(mProgram);
+ EXPECT_GL_NO_ERROR();
+
+ // Draw the first slice
+ glUniform1i(mTextureArraySliceUniformLocation, 0);
+ drawQuad(mProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::red);
+
+ // Draw the fourth slice
+ glUniform1i(mTextureArraySliceUniformLocation, 3);
+ drawQuad(mProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::red);
+
+ // Redefine the image and fill with green
+ std::vector<GLColor> pixelsGreen(2 * 2 * 2, GLColor::green);
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 2, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ pixelsGreen.data());
+
+ // Draw the first slice
+ glUniform1i(mTextureArraySliceUniformLocation, 0);
+ drawQuad(mProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::green);
+
+ // Draw the second slice
+ glUniform1i(mTextureArraySliceUniformLocation, 1);
+ drawQuad(mProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+ EXPECT_PIXEL_COLOR_EQ(px, py, GLColor::green);
+}
+
// Test that texture completeness is updated if texture max level changes.
// GLES 3.0.4 section 3.8.13 Texture completeness
TEST_P(Texture2DTestES3, TextureCompletenessChangesWithMaxLevel)

View File

@@ -0,0 +1,163 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jonah Ryan-Davis <jonahr@google.com>
Date: Mon, 22 Nov 2021 14:30:52 -0500
Subject: Ignore the pixel unpack state for compressed textures.
From OpenGL ES 3 spec: All pixel storage modes are ignored when decoding
a compressed texture image
This was causing a bad access when calling compressedTexImage3D
with GL_UNPACK_IMAGE_HEIGHT greater than the image height.
Bug: chromium:1267496
Change-Id: I9b1f4c645548af64f2695fd23262225a1ad07cd7
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3296622
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
(cherry picked from commit 870f458f507ff7ba0f67b28a30a27955ce79dd3e)
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3309097
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index c4ce77d612d88a898f8a8164466d25b210e2144b..eb60719ac38543b608c122daebd71b1084ac35f2 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -4961,7 +4961,9 @@ void Context::compressedTexImage2D(TextureTarget target,
Extents size(width, height, 1);
Texture *texture = getTextureByTarget(target);
- ANGLE_CONTEXT_TRY(texture->setCompressedImage(this, mState.getUnpackState(), target, level,
+ // From OpenGL ES 3 spec: All pixel storage modes are ignored when decoding a compressed texture
+ // image. So we use an empty PixelUnpackState.
+ ANGLE_CONTEXT_TRY(texture->setCompressedImage(this, PixelUnpackState(), target, level,
internalformat, size, imageSize,
static_cast<const uint8_t *>(data)));
}
@@ -4993,7 +4995,9 @@ void Context::compressedTexImage3D(TextureTarget target,
Extents size(width, height, depth);
Texture *texture = getTextureByTarget(target);
- ANGLE_CONTEXT_TRY(texture->setCompressedImage(this, mState.getUnpackState(), target, level,
+ // From OpenGL ES 3 spec: All pixel storage modes are ignored when decoding a compressed texture
+ // image. So we use an empty PixelUnpackState.
+ ANGLE_CONTEXT_TRY(texture->setCompressedImage(this, PixelUnpackState(), target, level,
internalformat, size, imageSize,
static_cast<const uint8_t *>(data)));
}
@@ -5027,8 +5031,10 @@ void Context::compressedTexSubImage2D(TextureTarget target,
Box area(xoffset, yoffset, 0, width, height, 1);
Texture *texture = getTextureByTarget(target);
- ANGLE_CONTEXT_TRY(texture->setCompressedSubImage(this, mState.getUnpackState(), target, level,
- area, format, imageSize,
+ // From OpenGL ES 3 spec: All pixel storage modes are ignored when decoding a compressed texture
+ // image. So we use an empty PixelUnpackState.
+ ANGLE_CONTEXT_TRY(texture->setCompressedSubImage(this, PixelUnpackState(), target, level, area,
+ format, imageSize,
static_cast<const uint8_t *>(data)));
}
@@ -5069,8 +5075,10 @@ void Context::compressedTexSubImage3D(TextureTarget target,
Box area(xoffset, yoffset, zoffset, width, height, depth);
Texture *texture = getTextureByTarget(target);
- ANGLE_CONTEXT_TRY(texture->setCompressedSubImage(this, mState.getUnpackState(), target, level,
- area, format, imageSize,
+ // From OpenGL ES 3 spec: All pixel storage modes are ignored when decoding a compressed texture
+ // image. So we use an empty PixelUnpackState.
+ ANGLE_CONTEXT_TRY(texture->setCompressedSubImage(this, PixelUnpackState(), target, level, area,
+ format, imageSize,
static_cast<const uint8_t *>(data)));
}
diff --git a/src/tests/gl_tests/TextureTest.cpp b/src/tests/gl_tests/TextureTest.cpp
index a3dec629c9ea96b276ff8bf344d4a4628ff20b3b..ba512a11cb023d9caae666ab2634d1e66057d12c 100644
--- a/src/tests/gl_tests/TextureTest.cpp
+++ b/src/tests/gl_tests/TextureTest.cpp
@@ -5151,6 +5151,43 @@ TEST_P(Texture2DTestES3, TextureCompletenessChangesWithMaxLevel)
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::black);
}
+// Test that compressed textures ignore the pixel unpack state.
+// (https://crbug.org/1267496)
+TEST_P(Texture3DTestES3, PixelUnpackStateTexImage)
+{
+ ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_texture_compression_s3tc") &&
+ !IsGLExtensionEnabled("GL_ANGLE_texture_compression_dxt3"));
+
+ glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 5);
+ glBindTexture(GL_TEXTURE_2D_ARRAY, mTexture3D);
+
+ uint8_t data[64] = {0};
+ glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 4, 4, 4, 0, 64,
+ data);
+ EXPECT_GL_NO_ERROR();
+}
+
+// Test that compressed textures ignore the pixel unpack state.
+// (https://crbug.org/1267496)
+TEST_P(Texture3DTestES3, PixelUnpackStateTexSubImage)
+{
+ ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_texture_compression_s3tc") &&
+ !IsGLExtensionEnabled("GL_ANGLE_texture_compression_dxt3"));
+
+ glBindTexture(GL_TEXTURE_2D_ARRAY, mTexture3D);
+
+ uint8_t data[64] = {0};
+ glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 4, 4, 4, 0, 64,
+ data);
+ EXPECT_GL_NO_ERROR();
+
+ glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 5);
+
+ glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 4, 4, 4,
+ GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 64, data);
+ EXPECT_GL_NO_ERROR();
+}
+
// Test that 3D texture completeness is updated if texture max level changes.
// GLES 3.0.4 section 3.8.13 Texture completeness
TEST_P(Texture3DTestES3, Texture3DCompletenessChangesWithMaxLevel)
@@ -5830,6 +5867,41 @@ TEST_P(Texture2DTestES3, TextureCOMPRESSEDSRGB8ETC2ImplicitAlpha1)
EXPECT_PIXEL_ALPHA_EQ(0, 0, 255);
}
+// Test that compressed textures ignore the pixel unpack state.
+// (https://crbug.org/1267496)
+TEST_P(Texture2DTestES3, PixelUnpackStateTexImage)
+{
+ ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_texture_compression_s3tc") &&
+ !IsGLExtensionEnabled("GL_ANGLE_texture_compression_dxt3"));
+
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 5);
+ glBindTexture(GL_TEXTURE_2D, mTexture2D);
+
+ uint8_t data[16] = {0};
+ glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 4, 4, 0, 16, data);
+ EXPECT_GL_NO_ERROR();
+}
+
+// Test that compressed textures ignore the pixel unpack state.
+// (https://crbug.org/1267496)
+TEST_P(Texture2DTestES3, PixelUnpackStateTexSubImage)
+{
+ ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_texture_compression_s3tc") &&
+ !IsGLExtensionEnabled("GL_ANGLE_texture_compression_dxt3"));
+
+ glBindTexture(GL_TEXTURE_2D, mTexture2D);
+
+ uint8_t data[16] = {0};
+ glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 4, 4, 0, 16, data);
+ EXPECT_GL_NO_ERROR();
+
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 5);
+
+ glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 16,
+ data);
+ EXPECT_GL_NO_ERROR();
+}
+
// Copied from Texture2DTest::TexStorage
// Test that glTexSubImage2D works properly when glTexStorage2DEXT has initialized the image with a
// default color.

View File

@@ -0,0 +1,169 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shahbaz Youssefi <syoussefi@chromium.org>
Date: Thu, 2 Dec 2021 14:30:42 -0500
Subject: M96: Fix changing attached renderbuffer from MSRTT to non-MSRTT
FramebufferAttachment::mRenderToTextureSamples was never updated if the
renderbuffer storage was changed after attaching to framebuffer.
Bug: chromium:1272068
Change-Id: Icddbb5650354ea16d06c49532d6a8d0ae962ab5f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3320923
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/FramebufferAttachment.cpp b/src/libANGLE/FramebufferAttachment.cpp
index 00714d0a0303050893abcd9564e760b22d9b2de5..720d3000d42e6c8c23214e66eee4aa6982216a60 100644
--- a/src/libANGLE/FramebufferAttachment.cpp
+++ b/src/libANGLE/FramebufferAttachment.cpp
@@ -129,7 +129,7 @@ void FramebufferAttachment::attach(const Context *context,
mNumViews = numViews;
mBaseViewIndex = baseViewIndex;
mIsMultiview = isMultiview;
- mRenderToTextureSamples = samples;
+ mRenderToTextureSamples = type == GL_RENDERBUFFER ? kDefaultRenderToTextureSamples : samples;
resource->onAttach(context, framebufferSerial);
if (mResource != nullptr)
@@ -222,6 +222,29 @@ GLint FramebufferAttachment::getBaseViewIndex() const
return mBaseViewIndex;
}
+bool FramebufferAttachment::isRenderToTexture() const
+{
+ ASSERT(mRenderToTextureSamples == kDefaultRenderToTextureSamples || mType == GL_TEXTURE);
+
+ if (mType == GL_RENDERBUFFER)
+ {
+ return getRenderbuffer()->getMultisamplingMode() ==
+ MultisamplingMode::MultisampledRenderToTexture;
+ }
+ return mRenderToTextureSamples != kDefaultRenderToTextureSamples;
+}
+
+GLsizei FramebufferAttachment::getRenderToTextureSamples() const
+{
+ ASSERT(mRenderToTextureSamples == kDefaultRenderToTextureSamples || mType == GL_TEXTURE);
+
+ if (mType == GL_RENDERBUFFER)
+ {
+ return getRenderbuffer()->getState().getSamples();
+ }
+ return mRenderToTextureSamples;
+}
+
Texture *FramebufferAttachment::getTexture() const
{
return rx::GetAs<Texture>(mResource);
diff --git a/src/libANGLE/FramebufferAttachment.h b/src/libANGLE/FramebufferAttachment.h
index 7ebf5f5e620cfac47be176fa0bc668353e923104..a5d5bf0eb0c50e37656b241d105be3f35a657585 100644
--- a/src/libANGLE/FramebufferAttachment.h
+++ b/src/libANGLE/FramebufferAttachment.h
@@ -117,11 +117,8 @@ class FramebufferAttachment final
bool isMultiview() const;
GLint getBaseViewIndex() const;
- bool isRenderToTexture() const
- {
- return mRenderToTextureSamples != kDefaultRenderToTextureSamples;
- }
- GLsizei getRenderToTextureSamples() const { return mRenderToTextureSamples; }
+ bool isRenderToTexture() const;
+ GLsizei getRenderToTextureSamples() const;
// The size of the underlying resource the attachment points to. The 'depth' value will
// correspond to a 3D texture depth or the layer count of a 2D array texture. For Surfaces and
@@ -195,6 +192,14 @@ class FramebufferAttachment final
GLsizei mNumViews;
bool mIsMultiview;
GLint mBaseViewIndex;
+ // A single-sampled texture can be attached to a framebuffer either as single-sampled or as
+ // multisampled-render-to-texture. In the latter case, |mRenderToTextureSamples| will contain
+ // the number of samples. For renderbuffers, the number of samples is inherited from the
+ // renderbuffer itself.
+ //
+ // Note that textures cannot change storage between single and multisample once attached to a
+ // framebuffer. Renderbuffers instead can, and caching the number of renderbuffer samples here
+ // can lead to stale data.
GLsizei mRenderToTextureSamples;
};
@@ -254,8 +259,7 @@ inline Format FramebufferAttachment::getFormat() const
inline GLsizei FramebufferAttachment::getSamples() const
{
- return (mRenderToTextureSamples != kDefaultRenderToTextureSamples) ? getRenderToTextureSamples()
- : getResourceSamples();
+ return isRenderToTexture() ? getRenderToTextureSamples() : getResourceSamples();
}
inline GLsizei FramebufferAttachment::getResourceSamples() const
diff --git a/src/tests/gl_tests/FramebufferTest.cpp b/src/tests/gl_tests/FramebufferTest.cpp
index ff01848daff091d92e4fdce08bc6842a3bdd3ee9..cd733be3ae5c179860d882e305ec84d093a283ed 100644
--- a/src/tests/gl_tests/FramebufferTest.cpp
+++ b/src/tests/gl_tests/FramebufferTest.cpp
@@ -3366,6 +3366,65 @@ void main() {
// This shouldn't crash.
glDrawArrays(GL_POINTS, 0, 1);
+ ASSERT_GL_NO_ERROR();
+}
+
+// Modify renderbuffer attachment samples after bind
+TEST_P(FramebufferTest_ES3, BindRenderbufferThenModifySamples)
+{
+ ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), essl1_shaders::fs::UniformColor());
+ glUseProgram(program);
+ GLint colorUniformLocation =
+ glGetUniformLocation(program, angle::essl1_shaders::ColorUniform());
+ ASSERT_NE(colorUniformLocation, -1);
+
+ GLFramebuffer fbo;
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+ GLsizei size = 16;
+ glViewport(0, 0, size, size);
+
+ GLRenderbuffer color;
+ glBindRenderbuffer(GL_RENDERBUFFER, color);
+
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, size, size);
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, color);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, size, size);
+
+ glUniform4f(colorUniformLocation, 1, 0, 0, 1);
+ drawQuad(program, essl1_shaders::PositionAttrib(), 0.5f);
+
+ EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
+ ASSERT_GL_NO_ERROR();
+}
+
+// Modify renderbuffer attachment size after bind
+TEST_P(FramebufferTest_ES3, BindRenderbufferThenModifySize)
+{
+ ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), essl1_shaders::fs::UniformColor());
+ glUseProgram(program);
+ GLint colorUniformLocation =
+ glGetUniformLocation(program, angle::essl1_shaders::ColorUniform());
+ ASSERT_NE(colorUniformLocation, -1);
+
+ GLFramebuffer fbo;
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+ GLsizei size = 16;
+ glViewport(0, 0, size, size);
+
+ GLRenderbuffer color;
+ glBindRenderbuffer(GL_RENDERBUFFER, color);
+
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, size, size);
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, color);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, size / 2, size * 2);
+
+ glUniform4f(colorUniformLocation, 1, 0, 0, 1);
+ drawQuad(program, essl1_shaders::PositionAttrib(), 0.5f);
+
+ EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
+ ASSERT_GL_NO_ERROR();
}
ANGLE_INSTANTIATE_TEST_ES2(AddMockTextureNoRenderTargetTest);

View File

@@ -0,0 +1,43 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jamie Madill <jmadill@chromium.org>
Date: Tue, 4 Jan 2022 12:28:55 -0500
Subject: M96: D3D11: Fix OOB access in vertex conversion code.
This could happen when using certain combinations of stride and
offset. Fix the issue by using checked math.
Bug: chromium:1274499
Change-Id: I3e286a30fe128ab4684ee5e172dc9e3345e3b2f4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3365657
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
index 43fcdc8de5a0d15aacf4b06e0e32df008d78f886..031a12e2b8b0e0dee91087c02cbd2f8b17435a2b 100644
--- a/src/libANGLE/renderer/d3d/VertexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
@@ -58,17 +58,15 @@ int ElementsInBuffer(const gl::VertexAttribute &attrib,
const gl::VertexBinding &binding,
unsigned int size)
{
- // Size cannot be larger than a GLsizei
- if (size > static_cast<unsigned int>(std::numeric_limits<int>::max()))
- {
- size = static_cast<unsigned int>(std::numeric_limits<int>::max());
- }
+ angle::CheckedNumeric<size_t> bufferSize(size);
+ angle::CheckedNumeric<size_t> stride = ComputeVertexAttributeStride(attrib, binding);
+ angle::CheckedNumeric<size_t> offset = ComputeVertexAttributeOffset(attrib, binding);
+ angle::CheckedNumeric<size_t> elementSize = ComputeVertexAttributeTypeSize(attrib);
+
+ auto elementsInBuffer = (bufferSize - (offset % stride) + (stride - elementSize)) / stride;
+ auto elementsInBufferInt = angle::CheckedNumeric<int>::cast(elementsInBuffer);
- GLsizei stride = static_cast<GLsizei>(ComputeVertexAttributeStride(attrib, binding));
- GLsizei offset = static_cast<GLsizei>(ComputeVertexAttributeOffset(attrib, binding));
- return (size - offset % stride +
- (stride - static_cast<GLsizei>(ComputeVertexAttributeTypeSize(attrib)))) /
- stride;
+ return elementsInBufferInt.ValueOrDefault(0);
}
// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.

View File

@@ -1,119 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jamie Madill <jmadill@chromium.org>
Date: Tue, 1 Mar 2022 14:55:00 -0500
Subject: Fix base level changes not updating FBO completeness check.
M96 merge issues:
- RendererVk.cpp:
conflicting kSkippedSyncvalMessages entries
- vk_helpers.cpp
getRenderPassWriteCommandCount() not present in M96
- capture_replay_expectations.txt:
conflicting skipped test entries
- src/tests/gl_tests/FramebufferTest.cpp
RedefineLayerAttachment not present in M96
Bug: chromium:1299264
Change-Id: I0881a4916c3eeb9ee023d28d207795899417d530
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3498282
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Auto-Submit: Jamie Madill <jmadill@chromium.org>
(cherry picked from commit ea70300ba04404ba0c1cacf2173a0a1e3b443adf)
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3516115
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Texture.cpp b/src/libANGLE/Texture.cpp
index 0c15d244343b70e418bf0927cf942f6ade46b272..58512ff3da88a8289cf715c34e485d6f428f4d23 100644
--- a/src/libANGLE/Texture.cpp
+++ b/src/libANGLE/Texture.cpp
@@ -1188,7 +1188,15 @@ void Texture::signalDirtyState(size_t dirtyBit)
mDirtyBits.set(dirtyBit);
invalidateCompletenessCache();
mState.mCachedSamplerFormatValid = false;
- onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+
+ if (dirtyBit == DIRTY_BIT_BASE_LEVEL || dirtyBit == DIRTY_BIT_MAX_LEVEL)
+ {
+ onStateChange(angle::SubjectMessage::SubjectChanged);
+ }
+ else
+ {
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+ }
}
angle::Result Texture::setImage(Context *context,
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index d18fe88018cbca5fafbf19321340bb85e8e7ec9b..f513631f7b2170e72be17db93dc1437e681dbea9 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -351,6 +351,13 @@ constexpr SkippedSyncvalMessage kSkippedSyncvalMessages[] = {
"prior_usage: SYNC_COLOR_ATTACHMENT_OUTPUT_COLOR_ATTACHMENT_WRITE, write_barriers: 0, "
"command: vkCmdBeginRenderPass, seq_no: 11",
"", false},
+ // http://anglebug.com/7070
+ {"SYNC-HAZARD-READ_AFTER_WRITE",
+ "type: VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, imageLayout: VK_IMAGE_LAYOUT_GENERAL, "
+ "binding #0, index 0. Access info (usage: SYNC_FRAGMENT_SHADER_SHADER_STORAGE_READ, "
+ "prior_usage: SYNC_COLOR_ATTACHMENT_OUTPUT_COLOR_ATTACHMENT_WRITE, write_barriers: 0, "
+ "command: vkCmdBeginRenderPass",
+ "", false},
};
enum class DebugMessageReport
diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.cpp b/src/libANGLE/renderer/vulkan/vk_helpers.cpp
index fd3dd35fbe78fa59b3d4537d0cdcb981ebc36f09..1838b18f48de7a7a2fca0ae9c4d7ad4367647756 100644
--- a/src/libANGLE/renderer/vulkan/vk_helpers.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_helpers.cpp
@@ -1721,7 +1721,7 @@ void CommandBufferHelper::invalidateRenderPassDepthAttachment(const gl::DepthSte
{
ASSERT(mIsRenderPassCommandBuffer);
// Keep track of the size of commands in the command buffer. If the size grows in the
- // future, that implies that drawing occured since invalidated.
+ // future, that implies that drawing occurred since invalidated.
mDepthCmdSizeInvalidated = mCommandBuffer.getCommandSize();
// Also track the size if the attachment is currently disabled.
diff --git a/src/tests/gl_tests/FramebufferTest.cpp b/src/tests/gl_tests/FramebufferTest.cpp
index 46740cae77df7b6e9509093c02b79a332b4f106d..bb0d5db59f1126587c25f786e4f39461e34e4155 100644
--- a/src/tests/gl_tests/FramebufferTest.cpp
+++ b/src/tests/gl_tests/FramebufferTest.cpp
@@ -4019,6 +4019,38 @@ TEST_P(FramebufferTest_ES3, RedefineLayerAttachment)
ASSERT_GL_NO_ERROR();
}
+// Covers a bug when changing a base level of a texture bound to a FBO.
+TEST_P(FramebufferTest_ES3, ReattachToInvalidBaseLevel)
+{
+ ANGLE_GL_PROGRAM(testProgram, essl1_shaders::vs::Texture2D(), essl1_shaders::fs::Texture2D());
+ glUseProgram(testProgram);
+
+ GLTexture tex;
+ glBindTexture(GL_TEXTURE_2D, tex);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+
+ for (int mip = 0; mip <= 2; ++mip)
+ {
+ int size = 10 >> mip;
+ glTexImage2D(GL_TEXTURE_2D, mip, GL_RGBA8, size, size, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ nullptr);
+ }
+
+ GLFramebuffer fb;
+ glBindFramebuffer(GL_FRAMEBUFFER, fb);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 1);
+ EXPECT_GL_NO_ERROR();
+
+ // Set base level 1 and draw.
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 1);
+ glDrawArrays(GL_POINTS, 0, 1);
+ EXPECT_GL_NO_ERROR();
+ // Set base level 0. The FBO is incomplete because the FBO attachment binds to level 1.
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+ glDrawArrays(GL_POINTS, 0, 1);
+ EXPECT_GL_ERROR(GL_INVALID_FRAMEBUFFER_OPERATION);
+}
+
ANGLE_INSTANTIATE_TEST_ES2(AddMockTextureNoRenderTargetTest);
ANGLE_INSTANTIATE_TEST_ES2(FramebufferTest);
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(FramebufferFormatsTest);

View File

@@ -0,0 +1,115 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lingfeng Yang <lfy@google.com>
Date: Wed, 1 Dec 2021 17:08:01 -0800
Subject: M96: Validate SamplerFormat
We weren't validating sampler formats in ProgramExecutable validation.
Bug: chromium:1273661
Change-Id: Ida0c67c0c7169ea3f47ceb2d433bee17012a7e5e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3312717
Reviewed-by: Charlie Lao <cclao@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Lingfeng Yang <lfy@google.com>
(cherry picked from commit 6d3435fddd7abd67699c3f020d6b4fa21445d9b3)
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3335173
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/src/libANGLE/ProgramExecutable.cpp b/src/libANGLE/ProgramExecutable.cpp
index baf63ecec6f82fda9dd79a1c398b8e95ec70e321..14e5abdfab36a95f39839fc171e6e0bc3a5dc6e9 100644
--- a/src/libANGLE/ProgramExecutable.cpp
+++ b/src/libANGLE/ProgramExecutable.cpp
@@ -1132,6 +1132,19 @@ bool ProgramExecutable::validateSamplersImpl(InfoLog *infoLog, const Caps &caps)
mCachedValidateSamplersResult = false;
return false;
}
+
+ if (mActiveSamplerFormats[textureUnit] == SamplerFormat::InvalidEnum)
+ {
+ if (infoLog)
+ {
+ (*infoLog) << "Samplers of conflicting formats refer to the same texture "
+ "image unit ("
+ << textureUnit << ").";
+ }
+
+ mCachedValidateSamplersResult = false;
+ return false;
+ }
}
mCachedValidateSamplersResult = true;
diff --git a/src/tests/gl_tests/TextureTest.cpp b/src/tests/gl_tests/TextureTest.cpp
index ba512a11cb023d9caae666ab2634d1e66057d12c..56bef0186234f59d370669c21f588ea9c5c356fc 100644
--- a/src/tests/gl_tests/TextureTest.cpp
+++ b/src/tests/gl_tests/TextureTest.cpp
@@ -9796,8 +9796,6 @@ class TextureChangeStorageUploadTest : public ANGLETest
FAIL() << "shader compilation failed.";
}
- mColorLocation = glGetUniformLocation(mProgram, essl1_shaders::ColorUniform());
-
glUseProgram(mProgram);
glClearColor(0, 0, 0, 0);
@@ -9842,6 +9840,53 @@ TEST_P(TextureChangeStorageUploadTest, Basic)
EXPECT_GL_NO_ERROR();
}
+class ExtraSamplerCubeShadowUseTest : public ANGLETest
+{
+ protected:
+ ExtraSamplerCubeShadowUseTest() : ANGLETest() {}
+
+ const char *getVertexShaderSource() { return "#version 300 es\nvoid main() {}"; }
+
+ const char *getFragmentShaderSource()
+ {
+ return R"(#version 300 es
+precision mediump float;
+
+uniform mediump samplerCube var_0002; // this has to be there
+uniform highp samplerCubeShadow var_0004; // this has to be a cube shadow sampler
+out vec4 color;
+void main() {
+
+ vec4 var_0031 = texture(var_0002, vec3(1,1,1));
+ ivec2 size = textureSize(var_0004, 0) ;
+ var_0031.x += float(size.y);
+
+ color = var_0031;
+})";
+ }
+
+ void testSetUp() override
+ {
+ mProgram = CompileProgram(getVertexShaderSource(), getFragmentShaderSource());
+ if (mProgram == 0)
+ {
+ FAIL() << "shader compilation failed.";
+ }
+ glUseProgram(mProgram);
+ ASSERT_GL_NO_ERROR();
+ }
+
+ void testTearDown() override { glDeleteProgram(mProgram); }
+
+ GLuint mProgram;
+};
+
+TEST_P(ExtraSamplerCubeShadowUseTest, Basic)
+{
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 3);
+ EXPECT_GL_ERROR(GL_INVALID_OPERATION);
+}
+
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
#define ES2_EMULATE_COPY_TEX_IMAGE() \
@@ -9957,4 +10002,6 @@ ANGLE_INSTANTIATE_TEST_ES31_AND(CopyImageTestES31, WithDirectSPIRVGeneration(ES3
ANGLE_INSTANTIATE_TEST_ES3(TextureChangeStorageUploadTest);
+ANGLE_INSTANTIATE_TEST_ES3(ExtraSamplerCubeShadowUseTest);
+
} // anonymous namespace

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