mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
330 Commits
v21.3.3
...
timeout-ne
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43a80c49bf | ||
|
|
6a798b1c58 | ||
|
|
4e66184287 | ||
|
|
99b0d63c84 | ||
|
|
e1e66fc8ac | ||
|
|
8acf6039e7 | ||
|
|
2a26cef577 | ||
|
|
993d0337a7 | ||
|
|
b90a5baa6d | ||
|
|
909ee0ed6b | ||
|
|
79d2fc9c23 | ||
|
|
d092e6bda4 | ||
|
|
35a7c07306 | ||
|
|
eb291485bb | ||
|
|
4ff0642af7 | ||
|
|
835e248dff | ||
|
|
665cf03f74 | ||
|
|
f527b8aa2a | ||
|
|
e3b7c3024f | ||
|
|
9f007b9afb | ||
|
|
d5ce1387ce | ||
|
|
42ca25c338 | ||
|
|
2c723d7e84 | ||
|
|
16a7bd7102 | ||
|
|
bbb590b777 | ||
|
|
32583ac756 | ||
|
|
679ce632a9 | ||
|
|
629c54ba36 | ||
|
|
2751c2b07f | ||
|
|
c6d6af2551 | ||
|
|
b71cccb0d6 | ||
|
|
3a94634ae5 | ||
|
|
9c48992e21 | ||
|
|
7529ebfe0e | ||
|
|
4f1f263a9a | ||
|
|
87c183df6a | ||
|
|
517225b99e | ||
|
|
bd345358f6 | ||
|
|
9616dfb1f6 | ||
|
|
41d393c076 | ||
|
|
2cc24542f5 | ||
|
|
d57d9f71df | ||
|
|
f8aee0fbe7 | ||
|
|
f9d1b9aded | ||
|
|
9618a7227e | ||
|
|
9f8308907b | ||
|
|
05577d0903 | ||
|
|
a9ef68f126 | ||
|
|
d8bb172318 | ||
|
|
654e571512 | ||
|
|
46a74d1086 | ||
|
|
75d2caf451 | ||
|
|
1b1609aa0f | ||
|
|
5fc3ed936e | ||
|
|
8f5959aad2 | ||
|
|
31a0bb7de2 | ||
|
|
5c1186f624 | ||
|
|
184ac2b382 | ||
|
|
2008c9a5d0 | ||
|
|
0ba0df4523 | ||
|
|
71b8804fd0 | ||
|
|
15540975ff | ||
|
|
8b430c9d26 | ||
|
|
2f2c43e5e5 | ||
|
|
169cf531ba | ||
|
|
b9464d89b8 | ||
|
|
67a0c702fa | ||
|
|
ea6f873f97 | ||
|
|
07530f8e37 | ||
|
|
260678bd0c | ||
|
|
02ad8fcd5f | ||
|
|
ff4816367e | ||
|
|
ff3289d260 | ||
|
|
99a34d5209 | ||
|
|
625b4619d6 | ||
|
|
a75e8e051e | ||
|
|
09302a2fc6 | ||
|
|
b13f776d1b | ||
|
|
7ca2bb5f9c | ||
|
|
8553cfee35 | ||
|
|
ad289d120f | ||
|
|
85b193178f | ||
|
|
3aed596fba | ||
|
|
3e730ab016 | ||
|
|
0158077bec | ||
|
|
522f595740 | ||
|
|
7921fec761 | ||
|
|
289bdbe4bc | ||
|
|
da0fd286b4 | ||
|
|
4d2720a9a3 | ||
|
|
44c40efecf | ||
|
|
8bd66026a8 | ||
|
|
dde513b0d3 | ||
|
|
a8d89b3d52 | ||
|
|
b13606e55d | ||
|
|
4310468513 | ||
|
|
23d4a252c6 | ||
|
|
f2c341b655 | ||
|
|
bcafe8f654 | ||
|
|
d8d5d4a4a1 | ||
|
|
295c5331ee | ||
|
|
76880be6d2 | ||
|
|
e660fdf776 | ||
|
|
dd757f4e22 | ||
|
|
dc5d27a73b | ||
|
|
ce138fe969 | ||
|
|
79454dc50d | ||
|
|
8f09d6b47e | ||
|
|
b307314401 | ||
|
|
294f27900c | ||
|
|
8a926ffde4 | ||
|
|
7ce94eb0b4 | ||
|
|
1328d8d670 | ||
|
|
76afd8c028 | ||
|
|
eb97ce1931 | ||
|
|
b6eadf2414 | ||
|
|
8212616c76 | ||
|
|
ee7cf5a6d4 | ||
|
|
0759f3320e | ||
|
|
c2cb97ea29 | ||
|
|
e8ae0571b8 | ||
|
|
b3fd5eb258 | ||
|
|
9006f0e0c5 | ||
|
|
7493062555 | ||
|
|
e02de74ff2 | ||
|
|
ebb866e63d | ||
|
|
ef00a2a1da | ||
|
|
6072c4c71b | ||
|
|
1fe21ff712 | ||
|
|
a072f06168 | ||
|
|
8bfbb251cc | ||
|
|
3f4c4a4470 | ||
|
|
5c784c2b1b | ||
|
|
e1494ddc47 | ||
|
|
e31c96a564 | ||
|
|
faafcc7f87 | ||
|
|
a6b6816bec | ||
|
|
f916ce2c49 | ||
|
|
6196393c94 | ||
|
|
ff0517be3e | ||
|
|
d8e037e426 | ||
|
|
3bd85c8dc2 | ||
|
|
e63d4a6321 | ||
|
|
256d4678bb | ||
|
|
2cda1443fc | ||
|
|
12eade752d | ||
|
|
c76a931e20 | ||
|
|
16f459228b | ||
|
|
94955a7999 | ||
|
|
29ca3d1467 | ||
|
|
3f598ef1ed | ||
|
|
6a68afdb8a | ||
|
|
fea844c3da | ||
|
|
f82a863f65 | ||
|
|
dfb8a2d804 | ||
|
|
998a0820d9 | ||
|
|
621baa7bb7 | ||
|
|
74d59af3c5 | ||
|
|
c09c94fc98 | ||
|
|
697a219bcb | ||
|
|
f8077cc004 | ||
|
|
e0b4c485fe | ||
|
|
a2ae308448 | ||
|
|
7d96321786 | ||
|
|
39d79c5c28 | ||
|
|
f62aab76b3 | ||
|
|
324db14969 | ||
|
|
8a0b4fa338 | ||
|
|
626e248dea | ||
|
|
22d6102702 | ||
|
|
ad33a5f364 | ||
|
|
d357218654 | ||
|
|
c69754b8e6 | ||
|
|
0df8878da4 | ||
|
|
4438731124 | ||
|
|
eb3262cd87 | ||
|
|
4ffdd284c3 | ||
|
|
9719cea250 | ||
|
|
dfc134de42 | ||
|
|
8c3c0f0b50 | ||
|
|
0783692809 | ||
|
|
4935fd2422 | ||
|
|
99f4a42d41 | ||
|
|
b1d7b30ca3 | ||
|
|
d71b5e53fd | ||
|
|
6cc69122ce | ||
|
|
76ce6d5fb4 | ||
|
|
01cf5c5f99 | ||
|
|
80bcea7e55 | ||
|
|
9aed5bcac5 | ||
|
|
eebf34cc6c | ||
|
|
994834d25a | ||
|
|
7d3f22dd32 | ||
|
|
fa3cd17475 | ||
|
|
ee8a27492f | ||
|
|
bd6612273b | ||
|
|
f25c87dc70 | ||
|
|
5cf15cdab7 | ||
|
|
532162d2b5 | ||
|
|
30bdede09f | ||
|
|
38a7da692a | ||
|
|
bf20aabb9e | ||
|
|
3a3be23f0e | ||
|
|
748c6af61e | ||
|
|
f244e75927 | ||
|
|
c847229a7e | ||
|
|
62502b8937 | ||
|
|
12a7d7eea5 | ||
|
|
9f97c3e50a | ||
|
|
200153da8e | ||
|
|
71ba841f0a | ||
|
|
ef463b39be | ||
|
|
6ec4c7e563 | ||
|
|
b3a744db8a | ||
|
|
c14f52aeb7 | ||
|
|
88dac9afc5 | ||
|
|
730d9181b3 | ||
|
|
b0036ea43a | ||
|
|
a0dbae72c8 | ||
|
|
a0c20fef96 | ||
|
|
34cb360730 | ||
|
|
4fb4167b8b | ||
|
|
17d5016163 | ||
|
|
e3efa16415 | ||
|
|
3a6d6ff008 | ||
|
|
ebd1c8358b | ||
|
|
84c94c3ebb | ||
|
|
142eb89d5e | ||
|
|
c16baa063a | ||
|
|
87145c393c | ||
|
|
7d89cb1bd4 | ||
|
|
08ccc81574 | ||
|
|
f53ca20d41 | ||
|
|
e09a4a31ca | ||
|
|
bda094674f | ||
|
|
de206987fe | ||
|
|
2db0f7f8d4 | ||
|
|
98c0fa1c8b | ||
|
|
bfbe73396b | ||
|
|
6ad679f540 | ||
|
|
a7248af79e | ||
|
|
f99122abfc | ||
|
|
9cdc8bf6ca | ||
|
|
b7c5b48c38 | ||
|
|
5fe1ac5c3d | ||
|
|
1830c0f6c3 | ||
|
|
e0fb5cbe1f | ||
|
|
bfced8cbfe | ||
|
|
75f9573e53 | ||
|
|
d0e220cbce | ||
|
|
1847581848 | ||
|
|
2f23bdb19e | ||
|
|
4744674e93 | ||
|
|
f6bbad287a | ||
|
|
23264488c5 | ||
|
|
d829fb7ef2 | ||
|
|
f65b05b8cc | ||
|
|
8128fa6d85 | ||
|
|
3eb593dfde | ||
|
|
3de7844212 | ||
|
|
a3a9463024 | ||
|
|
70d6cbfb44 | ||
|
|
22ff2b6b93 | ||
|
|
7e8607fd7a | ||
|
|
6f77e63804 | ||
|
|
07c3e62d68 | ||
|
|
e1459f4d50 | ||
|
|
900ffede41 | ||
|
|
3ce35f224e | ||
|
|
0ff6508f5b | ||
|
|
33325e3608 | ||
|
|
221bb51326 | ||
|
|
0c04be502c | ||
|
|
d6d86f8b16 | ||
|
|
eca6029c0a | ||
|
|
9b2b1998b8 | ||
|
|
fc2e6bd0ed | ||
|
|
19baea4bc2 | ||
|
|
9b787d30f4 | ||
|
|
748a739291 | ||
|
|
b9bffb19ca | ||
|
|
82f146e223 | ||
|
|
402553aeeb | ||
|
|
1d6885c781 | ||
|
|
97b353a30a | ||
|
|
e15e66f229 | ||
|
|
532025c207 | ||
|
|
43182bf030 | ||
|
|
8e4a168a13 | ||
|
|
947f1b0abf | ||
|
|
db7c92fd57 | ||
|
|
e87c4015fe | ||
|
|
e85450b21a | ||
|
|
672539187c | ||
|
|
cbc1ee5775 | ||
|
|
9c2d89476c | ||
|
|
8424779906 | ||
|
|
81766707fc | ||
|
|
4cb57ad1a0 | ||
|
|
a8934d2302 | ||
|
|
f1216ca593 | ||
|
|
ceabca850c | ||
|
|
81d95b53b3 | ||
|
|
4d54cadb28 | ||
|
|
eab7ab2c47 | ||
|
|
882cdb1f7a | ||
|
|
1d95b98cc8 | ||
|
|
8646bf8d30 | ||
|
|
32fefb1f50 | ||
|
|
6548808054 | ||
|
|
faa2f7afa3 | ||
|
|
f3dbdaaf33 | ||
|
|
0400eb2e60 | ||
|
|
91f9436ad8 | ||
|
|
34b985c556 | ||
|
|
76431ac1fa | ||
|
|
a11cc3274f | ||
|
|
a719568ac1 | ||
|
|
fbcd8f8a6e | ||
|
|
aaa60dc0bc | ||
|
|
4cfdef0ffd | ||
|
|
b9fea0d2d2 | ||
|
|
1b2e5b4106 | ||
|
|
47a08f9570 | ||
|
|
21117ea5b2 | ||
|
|
6d859dcd7f | ||
|
|
bba22ae720 | ||
|
|
d15348ecc2 | ||
|
|
3baf713648 | ||
|
|
2b96d06960 |
@@ -137,6 +137,7 @@ env-mas-apple-silicon: &env-mas-apple-silicon
|
||||
MAS_BUILD: 'true'
|
||||
TARGET_ARCH: arm64
|
||||
USE_PREBUILT_V8_CONTEXT_SNAPSHOT: 1
|
||||
npm_config_arch: arm64
|
||||
|
||||
env-send-slack-notifications: &env-send-slack-notifications
|
||||
NOTIFY_SLACK: true
|
||||
@@ -216,6 +217,7 @@ step-maybe-cleanup-arm64-mac: &step-maybe-cleanup-arm64-mac
|
||||
rm -rf ~/Library/Application\ Support/electron*
|
||||
security delete-generic-password -l "Chromium Safe Storage" || echo "✓ Keychain does not contain password from tests"
|
||||
security delete-generic-password -l "Electron Test Main Safe Storage" || echo "✓ Keychain does not contain password from tests"
|
||||
security delete-generic-password -a "electron-test-safe-storage" || echo "✓ Keychain does not contain password from tests"
|
||||
elif [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
|
||||
XVFB=/usr/bin/Xvfb
|
||||
/sbin/start-stop-daemon --stop --exec $XVFB || echo "Xvfb not running"
|
||||
@@ -493,6 +495,11 @@ step-fix-sync: &step-fix-sync
|
||||
# Remove extra output from calling gclient getdep which always calls update_depot_tools
|
||||
sed -i '' "s/Updating depot_tools... //g" esbuild_ensure_file
|
||||
cipd ensure --root src/third_party/devtools-frontend/src/third_party/esbuild -ensure-file esbuild_ensure_file
|
||||
|
||||
# Fix ninja (wrong binary)
|
||||
echo 'infra/3pp/tools/ninja/${platform}' `gclient getdep --deps-file=src/DEPS -r 'src/third_party/ninja:infra/3pp/tools/ninja/${platform}'` > ninja_ensure_file
|
||||
sed -i '' "s/Updating depot_tools... //g" ninja_ensure_file
|
||||
cipd ensure --root src/third_party/ninja -ensure-file ninja_ensure_file
|
||||
fi
|
||||
|
||||
cd src/third_party/angle
|
||||
@@ -544,50 +551,6 @@ step-gn-check: &step-gn-check
|
||||
node electron/script/gen-hunspell-filenames.js --check
|
||||
node electron/script/gen-libc++-filenames.js --check
|
||||
|
||||
step-electron-build: &step-electron-build
|
||||
run:
|
||||
name: Electron build
|
||||
no_output_timeout: 60m
|
||||
command: |
|
||||
# On arm platforms we generate a cross-arch ffmpeg that ninja does not seem
|
||||
# to realize is not correct / should be rebuilt. We delete it here so it is
|
||||
# rebuilt
|
||||
if [ "$TRIGGER_ARM_TEST" == "true" ]; then
|
||||
rm -f src/out/Default/libffmpeg.so
|
||||
fi
|
||||
cd src
|
||||
# Enable if things get really bad
|
||||
# if [ "$TARGET_ARCH" == "arm64" ] &&[ "`uname`" == "Darwin" ]; then
|
||||
# diskutil erasevolume HFS+ "xcode_disk" `hdiutil attach -nomount ram://12582912`
|
||||
# mv /Applications/Xcode-12.beta.5.app /Volumes/xcode_disk/
|
||||
# ln -s /Volumes/xcode_disk/Xcode-12.beta.5.app /Applications/Xcode-12.beta.5.app
|
||||
# fi
|
||||
|
||||
# Lets generate a snapshot and mksnapshot and then delete all the x-compiled generated files to save space
|
||||
if [ "$USE_PREBUILT_V8_CONTEXT_SNAPSHOT" == "1" ]; then
|
||||
ninja -C out/Default electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
ninja -C out/Default tools/v8_context_snapshot -j $NUMBER_OF_NINJA_PROCESSES
|
||||
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
||||
# Remove unused args from mksnapshot_args
|
||||
SEDOPTION=
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
SEDOPTION="-i ''"
|
||||
fi
|
||||
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
|
||||
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
|
||||
(cd out/Default; zip mksnapshot.zip mksnapshot_args clang_x64_v8_arm64/gen/v8/embedded.S)
|
||||
rm -rf out/Default/clang_x64_v8_arm64/gen
|
||||
rm -rf out/Default/clang_x64_v8_arm64/obj
|
||||
rm -rf out/Default/clang_x64_v8_arm64/thinlto-cache
|
||||
rm -rf out/Default/clang_x64/obj
|
||||
|
||||
# Regenerate because we just deleted some ninja files
|
||||
gn gen out/Default --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
fi
|
||||
NINJA_SUMMARIZE_BUILD=1 autoninja -C out/Default electron -j $NUMBER_OF_NINJA_PROCESSES
|
||||
cp out/Default/.ninja_log out/electron_ninja_log
|
||||
node electron/script/check-symlinks.js
|
||||
|
||||
step-maybe-electron-dist-strip: &step-maybe-electron-dist-strip
|
||||
run:
|
||||
name: Strip electron binaries
|
||||
@@ -648,28 +611,6 @@ step-electron-publish: &step-electron-publish
|
||||
script/release/uploaders/upload.py --verbose
|
||||
fi
|
||||
|
||||
step-persist-data-for-tests: &step-persist-data-for-tests
|
||||
persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
# Build artifacts
|
||||
- src/out/Default/dist.zip
|
||||
- src/out/Default/mksnapshot.zip
|
||||
- src/out/Default/chromedriver.zip
|
||||
- src/out/Default/gen/node_headers
|
||||
- src/out/Default/overlapped-checker
|
||||
- src/out/ffmpeg/ffmpeg.zip
|
||||
- src/electron
|
||||
- src/third_party/electron_node
|
||||
- src/third_party/nan
|
||||
- src/cross-arch-snapshots
|
||||
- src/third_party/llvm-build
|
||||
- src/build/linux
|
||||
- src/buildtools/third_party/libc++
|
||||
- src/buildtools/third_party/libc++abi
|
||||
- src/out/Default/obj/buildtools/third_party
|
||||
- src/v8/tools/builtins-pgo
|
||||
|
||||
step-electron-dist-unzip: &step-electron-dist-unzip
|
||||
run:
|
||||
name: Unzip dist.zip
|
||||
@@ -766,7 +707,7 @@ step-mksnapshot-build: &step-mksnapshot-build
|
||||
ninja -C out/Default electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
|
||||
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
||||
# Remove unused args from mksnapshot_args
|
||||
SEDOPTION=
|
||||
SEDOPTION="-i"
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
SEDOPTION="-i ''"
|
||||
fi
|
||||
@@ -821,6 +762,16 @@ step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols
|
||||
fi
|
||||
|
||||
step-maybe-zip-symbols: &step-maybe-zip-symbols
|
||||
run:
|
||||
name: Zip symbols
|
||||
command: |
|
||||
cd src
|
||||
export BUILD_PATH="$PWD/out/Default"
|
||||
ninja -C out/Default electron:licenses
|
||||
ninja -C out/Default electron:electron_version_file
|
||||
electron/script/zip-symbols.py -b $BUILD_PATH
|
||||
|
||||
step-maybe-zip-symbols-and-clean: &step-maybe-zip-symbols-and-clean
|
||||
run:
|
||||
name: Zip symbols
|
||||
command: |
|
||||
@@ -851,6 +802,12 @@ step-maybe-cross-arch-snapshot: &step-maybe-cross-arch-snapshot
|
||||
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --create-snapshot-only
|
||||
mkdir cross-arch-snapshots
|
||||
cp out/Default-mksnapshot-test/*.bin cross-arch-snapshots
|
||||
# Clean up so that ninja does not get confused
|
||||
if [ "`uname`" == "Linux" ]; then
|
||||
rm -f out/Default/libffmpeg.so
|
||||
elif [ "`uname`" == "Darwin" ]; then
|
||||
rm -f out/Default/libffmpeg.dylib
|
||||
fi
|
||||
fi
|
||||
|
||||
step-maybe-generate-typescript-defs: &step-maybe-generate-typescript-defs
|
||||
@@ -949,7 +906,6 @@ step-minimize-workspace-size-from-checkout: &step-minimize-workspace-size-from-c
|
||||
rm -rf src/ios/chrome
|
||||
rm -rf src/third_party/blink/web_tests
|
||||
rm -rf src/third_party/blink/perf_tests
|
||||
rm -rf src/third_party/WebKit/LayoutTests
|
||||
rm -rf third_party/electron_node/deps/openssl
|
||||
rm -rf third_party/electron_node/deps/v8
|
||||
rm -rf chrome/test/data/xr/webvr_info
|
||||
@@ -993,7 +949,7 @@ step-ts-compile: &step-ts-compile
|
||||
do
|
||||
out="${f:29}"
|
||||
if [ "$out" != "base.js" ]; then
|
||||
node script/yarn webpack --config $f --output-filename=$out --output-path=./.tmp --env.mode=development
|
||||
node script/yarn webpack --config $f --output-filename=$out --output-path=./.tmp --env mode=development
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -1030,105 +986,6 @@ steps-electron-ts-compile-for-doc-change: &steps-electron-ts-compile-for-doc-cha
|
||||
#Compile ts/js to verify doc change didn't break anything
|
||||
- *step-ts-compile
|
||||
|
||||
steps-tests: &steps-tests
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-electron-dist-unzip
|
||||
- *step-mksnapshot-unzip
|
||||
- *step-chromedriver-unzip
|
||||
- *step-setup-linux-for-headless-testing
|
||||
- *step-restore-brew-cache
|
||||
- *step-fix-known-hosts-linux
|
||||
- install-python2-mac
|
||||
- *step-install-signing-cert-on-mac
|
||||
|
||||
- run:
|
||||
name: Run Electron tests
|
||||
environment:
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
ELECTRON_TEST_RESULTS_DIR: junit
|
||||
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
||||
command: |
|
||||
cd src
|
||||
if [ "$IS_ASAN" == "1" ]; then
|
||||
ASAN_SYMBOLIZE="$PWD/tools/valgrind/asan/asan_symbolize.py --executable-path=$PWD/out/Default/electron"
|
||||
export ASAN_OPTIONS="symbolize=0 handle_abort=1"
|
||||
export G_SLICE=always-malloc
|
||||
export NSS_DISABLE_ARENA_FREE_LIST=1
|
||||
export NSS_DISABLE_UNLOAD=1
|
||||
export LLVM_SYMBOLIZER_PATH=$PWD/third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer
|
||||
export MOCHA_TIMEOUT=180000
|
||||
echo "Piping output to ASAN_SYMBOLIZE ($ASAN_SYMBOLIZE)"
|
||||
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split --split-by=timings)) 2>&1 | $ASAN_SYMBOLIZE
|
||||
(cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split --split-by=timings)) 2>&1 | $ASAN_SYMBOLIZE
|
||||
else
|
||||
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
|
||||
export ELECTRON_SKIP_NATIVE_MODULE_TESTS=true
|
||||
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging)
|
||||
(cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging)
|
||||
else
|
||||
if [ "$TARGET_ARCH" == "ia32" ]; then
|
||||
npm_config_arch=x64 node electron/node_modules/dugite/script/download-git.js
|
||||
fi
|
||||
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split --split-by=timings))
|
||||
(cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split --split-by=timings))
|
||||
fi
|
||||
fi
|
||||
- run:
|
||||
name: Check test results existence
|
||||
command: |
|
||||
cd src
|
||||
|
||||
# Check if test results exist and are not empty.
|
||||
if [ ! -s "junit/test-results-remote.xml" ]; then
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -s "junit/test-results-main.xml" ]; then
|
||||
exit 1
|
||||
fi
|
||||
- store_test_results:
|
||||
path: src/junit
|
||||
|
||||
- *step-verify-mksnapshot
|
||||
- *step-verify-chromedriver
|
||||
|
||||
- *step-maybe-notify-slack-failure
|
||||
|
||||
- *step-maybe-cleanup-arm64-mac
|
||||
|
||||
steps-test-nan: &steps-test-nan
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-electron-dist-unzip
|
||||
- *step-setup-linux-for-headless-testing
|
||||
- *step-fix-known-hosts-linux
|
||||
- run:
|
||||
name: Run Nan Tests
|
||||
command: |
|
||||
cd src
|
||||
node electron/script/nan-spec-runner.js
|
||||
|
||||
steps-test-node: &steps-test-node
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-electron-dist-unzip
|
||||
- *step-setup-linux-for-headless-testing
|
||||
- *step-fix-known-hosts-linux
|
||||
- run:
|
||||
name: Run Node Tests
|
||||
command: |
|
||||
cd src
|
||||
node electron/script/node-spec-runner.js --default --jUnitDir=junit
|
||||
- store_test_results:
|
||||
path: src/junit
|
||||
|
||||
# Command Aliases
|
||||
commands:
|
||||
install-python2-mac:
|
||||
@@ -1187,17 +1044,65 @@ commands:
|
||||
mv /var/portal/src ./
|
||||
fi
|
||||
|
||||
build_and_save_artifacts:
|
||||
parameters:
|
||||
artifact-key:
|
||||
type: string
|
||||
build-nonproprietary-ffmpeg:
|
||||
type: boolean
|
||||
default: true
|
||||
steps:
|
||||
- *step-gn-gen-default
|
||||
- ninja_build_electron:
|
||||
clean-prebuilt-snapshot: false
|
||||
- *step-maybe-electron-dist-strip
|
||||
- step-electron-dist-build:
|
||||
additional-targets: shell_browser_ui_unittests third_party/electron_node:headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip
|
||||
|
||||
- *step-show-goma-stats
|
||||
|
||||
# mksnapshot
|
||||
- *step-mksnapshot-build
|
||||
- *step-maybe-cross-arch-snapshot
|
||||
|
||||
# chromedriver
|
||||
- *step-electron-chromedriver-build
|
||||
|
||||
- when:
|
||||
condition: << parameters.build-nonproprietary-ffmpeg >>
|
||||
steps:
|
||||
# ffmpeg
|
||||
- *step-ffmpeg-gn-gen
|
||||
- *step-ffmpeg-build
|
||||
|
||||
- *step-maybe-generate-breakpad-symbols
|
||||
- *step-maybe-zip-symbols
|
||||
|
||||
- move_and_store_all_artifacts:
|
||||
artifact-key: << parameters.artifact-key >>
|
||||
|
||||
move_and_store_all_artifacts:
|
||||
parameters:
|
||||
artifact-key:
|
||||
type: string
|
||||
steps:
|
||||
- run:
|
||||
name: Move all generated artifacts to upload folder
|
||||
command: |
|
||||
rm -rf generated_artifacts
|
||||
mkdir generated_artifacts
|
||||
rm -rf generated_artifacts_<< parameters.artifact-key >>
|
||||
mkdir generated_artifacts_<< parameters.artifact-key >>
|
||||
mv_if_exist() {
|
||||
if [ -f "$1" ] || [ -d "$1" ]; then
|
||||
echo Storing $1
|
||||
mv $1 generated_artifacts
|
||||
mv $1 generated_artifacts_<< parameters.artifact-key >>
|
||||
else
|
||||
echo Skipping $1 - It is not present on disk
|
||||
fi
|
||||
}
|
||||
cp_if_exist() {
|
||||
if [ -f "$1" ] || [ -d "$1" ]; then
|
||||
echo Storing $1
|
||||
cp $1 generated_artifacts_<< parameters.artifact-key >>
|
||||
else
|
||||
echo Skipping $1 - It is not present on disk
|
||||
fi
|
||||
@@ -1210,15 +1115,43 @@ commands:
|
||||
mv_if_exist src/out/ffmpeg/ffmpeg.zip
|
||||
mv_if_exist src/out/Default/hunspell_dictionaries.zip
|
||||
mv_if_exist src/cross-arch-snapshots
|
||||
mv_if_exist src/out/electron_ninja_log
|
||||
mv_if_exist src/out/Default/.ninja_log
|
||||
cp_if_exist src/out/electron_ninja_log
|
||||
cp_if_exist src/out/Default/.ninja_log
|
||||
when: always
|
||||
- store_artifacts:
|
||||
path: generated_artifacts
|
||||
destination: ./
|
||||
path: generated_artifacts_<< parameters.artifact-key >>
|
||||
destination: ./<< parameters.artifact-key >>
|
||||
- store_artifacts:
|
||||
path: generated_artifacts/cross-arch-snapshots
|
||||
destination: cross-arch-snapshots
|
||||
path: generated_artifacts_<< parameters.artifact-key >>/cross-arch-snapshots
|
||||
destination: << parameters.artifact-key >>/cross-arch-snapshots
|
||||
|
||||
restore_build_artifacts:
|
||||
parameters:
|
||||
artifact-key:
|
||||
type: string
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
name: Restore key specific artifacts
|
||||
command: |
|
||||
mv_if_exist() {
|
||||
if [ -f "generated_artifacts_<< parameters.artifact-key >>/$1" ] || [ -d "generated_artifacts_<< parameters.artifact-key >>/$1" ]; then
|
||||
echo Restoring $1 to $2
|
||||
mkdir -p $2
|
||||
mv generated_artifacts_<< parameters.artifact-key >>/$1 $2
|
||||
else
|
||||
echo Skipping $1 - It is not present on disk
|
||||
fi
|
||||
}
|
||||
mv_if_exist dist.zip src/out/Default
|
||||
mv_if_exist node_headers.tar.gz src/out/Default/gen
|
||||
mv_if_exist symbols.zip src/out/Default
|
||||
mv_if_exist mksnapshot.zip src/out/Default
|
||||
mv_if_exist chromedriver.zip src/out/Default
|
||||
mv_if_exist ffmpeg.zip src/out/ffmpeg
|
||||
mv_if_exist hunspell_dictionaries.zip src/out/Default
|
||||
mv_if_exist cross-arch-snapshots src
|
||||
|
||||
checkout-from-cache:
|
||||
steps:
|
||||
@@ -1252,7 +1185,7 @@ commands:
|
||||
command: |
|
||||
cd src
|
||||
if [ "$SKIP_DIST_ZIP" != "1" ]; then
|
||||
ninja -C out/Default electron:electron_dist_zip << parameters.additional-targets >>
|
||||
ninja -C out/Default electron:electron_dist_zip << parameters.additional-targets >> -j $NUMBER_OF_NINJA_PROCESSES
|
||||
if [ "$CHECK_DIST_MANIFEST" == "1" ]; then
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
target_os=mac
|
||||
@@ -1278,6 +1211,47 @@ commands:
|
||||
fi
|
||||
fi
|
||||
|
||||
ninja_build_electron:
|
||||
parameters:
|
||||
clean-prebuilt-snapshot:
|
||||
type: boolean
|
||||
default: true
|
||||
steps:
|
||||
- run:
|
||||
name: Electron build
|
||||
no_output_timeout: 60m
|
||||
command: |
|
||||
cd src
|
||||
|
||||
# Lets generate a snapshot and mksnapshot and then delete all the x-compiled generated files to save space
|
||||
if [ "$USE_PREBUILT_V8_CONTEXT_SNAPSHOT" == "1" ]; then
|
||||
ninja -C out/Default electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
ninja -C out/Default tools/v8_context_snapshot -j $NUMBER_OF_NINJA_PROCESSES
|
||||
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
||||
# Remove unused args from mksnapshot_args
|
||||
SEDOPTION="-i"
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
SEDOPTION="-i ''"
|
||||
fi
|
||||
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
|
||||
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
|
||||
(cd out/Default; zip mksnapshot.zip mksnapshot_args clang_x64_v8_arm64/gen/v8/embedded.S)
|
||||
if [ "<< parameters.clean-prebuilt-snapshot >>" == "true" ]; then
|
||||
rm -rf out/Default/clang_x64_v8_arm64/gen
|
||||
rm -rf out/Default/clang_x64_v8_arm64/obj
|
||||
rm -rf out/Default/clang_x64_v8_arm64/thinlto-cache
|
||||
rm -rf out/Default/clang_x64/obj
|
||||
# Regenerate because we just deleted some ninja files
|
||||
gn gen out/Default --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
fi
|
||||
# For x-compiles this will be built to the wrong arch after the context snapshot build
|
||||
# so we wipe it before re-linking it below
|
||||
rm -rf out/Default/libffmpeg.dylib
|
||||
fi
|
||||
NINJA_SUMMARIZE_BUILD=1 autoninja -C out/Default electron -j $NUMBER_OF_NINJA_PROCESSES
|
||||
cp out/Default/.ninja_log out/electron_ninja_log
|
||||
node electron/script/check-symlinks.js
|
||||
|
||||
electron-build:
|
||||
parameters:
|
||||
attach:
|
||||
@@ -1310,6 +1284,14 @@ commands:
|
||||
build-nonproprietary-ffmpeg:
|
||||
type: boolean
|
||||
default: true
|
||||
artifact-key:
|
||||
type: string
|
||||
after-build-and-save:
|
||||
type: steps
|
||||
default: []
|
||||
after-persist:
|
||||
type: steps
|
||||
default: []
|
||||
steps:
|
||||
- when:
|
||||
condition: << parameters.attach >>
|
||||
@@ -1425,52 +1407,148 @@ commands:
|
||||
- *step-fix-sync
|
||||
- *step-delete-git-directories
|
||||
|
||||
# Electron app
|
||||
- *step-gn-gen-default
|
||||
- *step-electron-build
|
||||
- *step-maybe-electron-dist-strip
|
||||
- step-electron-dist-build:
|
||||
additional-targets: shell_browser_ui_unittests third_party/electron_node:headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip
|
||||
|
||||
- *step-show-goma-stats
|
||||
|
||||
# mksnapshot
|
||||
- *step-mksnapshot-build
|
||||
- *step-maybe-cross-arch-snapshot
|
||||
|
||||
# chromedriver
|
||||
- *step-electron-chromedriver-build
|
||||
|
||||
- when:
|
||||
condition: << parameters.build >>
|
||||
steps:
|
||||
- build_and_save_artifacts:
|
||||
artifact-key: << parameters.artifact-key >>
|
||||
build-nonproprietary-ffmpeg: << parameters.build-nonproprietary-ffmpeg >>
|
||||
- steps: << parameters.after-build-and-save >>
|
||||
|
||||
# Save all data needed for a further tests run.
|
||||
- when:
|
||||
condition: << parameters.build-nonproprietary-ffmpeg >>
|
||||
condition: << parameters.persist >>
|
||||
steps:
|
||||
# ffmpeg
|
||||
- *step-ffmpeg-gn-gen
|
||||
- *step-ffmpeg-build
|
||||
|
||||
# Save all data needed for a further tests run.
|
||||
- when:
|
||||
condition: << parameters.persist >>
|
||||
steps:
|
||||
- *step-minimize-workspace-size-from-checkout
|
||||
- run: |
|
||||
rm -rf src/third_party/electron_node/deps/openssl
|
||||
rm -rf src/third_party/electron_node/deps/v8
|
||||
- *step-persist-data-for-tests
|
||||
- *step-minimize-workspace-size-from-checkout
|
||||
- run: |
|
||||
rm -rf src/third_party/electron_node/deps/openssl
|
||||
rm -rf src/third_party/electron_node/deps/v8
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
# Build artifacts
|
||||
- generated_artifacts_<< parameters.artifact-key >>
|
||||
- src/out/Default/gen/node_headers
|
||||
- src/out/Default/overlapped-checker
|
||||
- src/electron
|
||||
- src/third_party/electron_node
|
||||
- src/third_party/nan
|
||||
- src/cross-arch-snapshots
|
||||
- src/third_party/llvm-build
|
||||
- src/build/linux
|
||||
- src/buildtools/third_party/libc++
|
||||
- src/buildtools/third_party/libc++abi
|
||||
- src/out/Default/obj/buildtools/third_party
|
||||
- src/v8/tools/builtins-pgo
|
||||
- steps: << parameters.after-persist >>
|
||||
|
||||
- when:
|
||||
condition: << parameters.build >>
|
||||
steps:
|
||||
- *step-maybe-generate-breakpad-symbols
|
||||
- *step-maybe-zip-symbols
|
||||
|
||||
- when:
|
||||
condition: << parameters.build >>
|
||||
steps:
|
||||
- move_and_store_all_artifacts
|
||||
|
||||
- *step-maybe-notify-slack-failure
|
||||
|
||||
electron-tests:
|
||||
parameters:
|
||||
artifact-key:
|
||||
type: string
|
||||
steps:
|
||||
- restore_build_artifacts:
|
||||
artifact-key: << parameters.artifact-key >>
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-electron-dist-unzip
|
||||
- *step-mksnapshot-unzip
|
||||
- *step-chromedriver-unzip
|
||||
- *step-setup-linux-for-headless-testing
|
||||
- *step-restore-brew-cache
|
||||
- *step-fix-known-hosts-linux
|
||||
- install-python2-mac
|
||||
- *step-install-signing-cert-on-mac
|
||||
|
||||
- run:
|
||||
name: Run Electron tests
|
||||
environment:
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
ELECTRON_TEST_RESULTS_DIR: junit
|
||||
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
||||
command: |
|
||||
cd src
|
||||
if [ "$IS_ASAN" == "1" ]; then
|
||||
ASAN_SYMBOLIZE="$PWD/tools/valgrind/asan/asan_symbolize.py --executable-path=$PWD/out/Default/electron"
|
||||
export ASAN_OPTIONS="symbolize=0 handle_abort=1"
|
||||
export G_SLICE=always-malloc
|
||||
export NSS_DISABLE_ARENA_FREE_LIST=1
|
||||
export NSS_DISABLE_UNLOAD=1
|
||||
export LLVM_SYMBOLIZER_PATH=$PWD/third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer
|
||||
export MOCHA_TIMEOUT=180000
|
||||
echo "Piping output to ASAN_SYMBOLIZE ($ASAN_SYMBOLIZE)"
|
||||
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.ts | circleci tests split --split-by=timings)) 2>&1 | $ASAN_SYMBOLIZE
|
||||
else
|
||||
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
|
||||
export ELECTRON_SKIP_NATIVE_MODULE_TESTS=true
|
||||
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging)
|
||||
else
|
||||
if [ "$TARGET_ARCH" == "ia32" ]; then
|
||||
npm_config_arch=x64 node electron/node_modules/dugite/script/download-git.js
|
||||
fi
|
||||
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.ts | circleci tests split --split-by=timings))
|
||||
fi
|
||||
fi
|
||||
- run:
|
||||
name: Check test results existence
|
||||
command: |
|
||||
cd src
|
||||
|
||||
# Check if test results exist and are not empty.
|
||||
if [ ! -s "junit/test-results-main.xml" ]; then
|
||||
exit 1
|
||||
fi
|
||||
- store_test_results:
|
||||
path: src/junit
|
||||
|
||||
- *step-verify-mksnapshot
|
||||
- *step-verify-chromedriver
|
||||
|
||||
- *step-maybe-notify-slack-failure
|
||||
|
||||
- *step-maybe-cleanup-arm64-mac
|
||||
|
||||
nan-tests:
|
||||
parameters:
|
||||
artifact-key:
|
||||
type: string
|
||||
steps:
|
||||
- restore_build_artifacts:
|
||||
artifact-key: << parameters.artifact-key >>
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-electron-dist-unzip
|
||||
- *step-setup-linux-for-headless-testing
|
||||
- *step-fix-known-hosts-linux
|
||||
- run:
|
||||
name: Run Nan Tests
|
||||
command: |
|
||||
cd src
|
||||
node electron/script/nan-spec-runner.js
|
||||
|
||||
node-tests:
|
||||
parameters:
|
||||
artifact-key:
|
||||
type: string
|
||||
steps:
|
||||
- restore_build_artifacts:
|
||||
artifact-key: << parameters.artifact-key >>
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-electron-dist-unzip
|
||||
- *step-setup-linux-for-headless-testing
|
||||
- *step-fix-known-hosts-linux
|
||||
- run:
|
||||
name: Run Node Tests
|
||||
command: |
|
||||
cd src
|
||||
node electron/script/node-spec-runner.js --default --jUnitDir=junit
|
||||
- store_test_results:
|
||||
path: src/junit
|
||||
|
||||
electron-publish:
|
||||
parameters:
|
||||
attach:
|
||||
@@ -1510,12 +1588,12 @@ commands:
|
||||
- *step-gn-gen-default
|
||||
|
||||
# Electron app
|
||||
- *step-electron-build
|
||||
- ninja_build_electron
|
||||
- *step-show-goma-stats
|
||||
- *step-maybe-generate-breakpad-symbols
|
||||
- *step-maybe-electron-dist-strip
|
||||
- step-electron-dist-build
|
||||
- *step-maybe-zip-symbols
|
||||
- *step-maybe-zip-symbols-and-clean
|
||||
|
||||
# mksnapshot
|
||||
- *step-mksnapshot-build
|
||||
@@ -1541,7 +1619,8 @@ commands:
|
||||
|
||||
# Publish
|
||||
- *step-electron-publish
|
||||
- move_and_store_all_artifacts
|
||||
- move_and_store_all_artifacts:
|
||||
artifact-key: 'publish'
|
||||
|
||||
# List of all jobs.
|
||||
jobs:
|
||||
@@ -1571,6 +1650,7 @@ jobs:
|
||||
checkout: true
|
||||
save-git-cache: true
|
||||
checkout-to-create-src-cache: true
|
||||
artifact-key: 'nil'
|
||||
|
||||
mac-checkout:
|
||||
executor:
|
||||
@@ -1588,6 +1668,7 @@ jobs:
|
||||
checkout: true
|
||||
persist-checkout: true
|
||||
restore-src-cache: false
|
||||
artifact-key: 'nil'
|
||||
|
||||
mac-make-src-cache:
|
||||
executor:
|
||||
@@ -1605,6 +1686,7 @@ jobs:
|
||||
checkout: true
|
||||
save-git-cache: true
|
||||
checkout-to-create-src-cache: true
|
||||
artifact-key: 'nil'
|
||||
|
||||
# Layer 2: Builds.
|
||||
linux-x64-testing:
|
||||
@@ -1621,6 +1703,7 @@ jobs:
|
||||
persist: true
|
||||
checkout: false
|
||||
checkout-and-assume-cache: true
|
||||
artifact-key: 'linux-x64'
|
||||
|
||||
linux-x64-testing-asan:
|
||||
executor:
|
||||
@@ -1638,6 +1721,7 @@ jobs:
|
||||
persist: true
|
||||
checkout: true
|
||||
build-nonproprietary-ffmpeg: false
|
||||
artifact-key: 'linux-x64-asan'
|
||||
|
||||
linux-x64-testing-no-run-as-node:
|
||||
executor:
|
||||
@@ -1653,6 +1737,7 @@ jobs:
|
||||
- electron-build:
|
||||
persist: false
|
||||
checkout: true
|
||||
artifact-key: 'linux-x64-no-run-as-node'
|
||||
|
||||
linux-x64-testing-gn-check:
|
||||
executor:
|
||||
@@ -1703,6 +1788,7 @@ jobs:
|
||||
persist: true
|
||||
checkout: false
|
||||
checkout-and-assume-cache: true
|
||||
artifact-key: 'linux-arm'
|
||||
|
||||
linux-arm-publish:
|
||||
executor:
|
||||
@@ -1745,6 +1831,7 @@ jobs:
|
||||
persist: true
|
||||
checkout: false
|
||||
checkout-and-assume-cache: true
|
||||
artifact-key: 'linux-arm64'
|
||||
|
||||
linux-arm64-testing-gn-check:
|
||||
executor:
|
||||
@@ -1796,6 +1883,22 @@ jobs:
|
||||
checkout: false
|
||||
checkout-and-assume-cache: true
|
||||
attach: true
|
||||
artifact-key: 'darwin-x64'
|
||||
after-build-and-save:
|
||||
- run:
|
||||
name: Configuring MAS build
|
||||
command: |
|
||||
echo 'export GN_EXTRA_ARGS="is_mas_build = true $GN_EXTRA_ARGS"' >> $BASH_ENV
|
||||
echo 'export MAS_BUILD="true"' >> $BASH_ENV
|
||||
rm -rf "src/out/Default/Electron Framework.framework"
|
||||
rm -rf src/out/Default/Electron*.app
|
||||
- build_and_save_artifacts:
|
||||
artifact-key: 'mas-x64'
|
||||
after-persist:
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- generated_artifacts_mas-x64
|
||||
|
||||
osx-testing-x64-gn-check:
|
||||
executor:
|
||||
@@ -1868,35 +1971,22 @@ jobs:
|
||||
checkout: false
|
||||
checkout-and-assume-cache: true
|
||||
attach: true
|
||||
|
||||
mas-testing-x64:
|
||||
executor:
|
||||
name: macos
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
<<: *env-mas
|
||||
<<: *env-testing-build
|
||||
<<: *env-ninja-status
|
||||
<<: *env-macos-build
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
steps:
|
||||
- electron-build:
|
||||
persist: true
|
||||
checkout: false
|
||||
checkout-and-assume-cache: true
|
||||
attach: true
|
||||
|
||||
mas-testing-x64-gn-check:
|
||||
executor:
|
||||
name: macos
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-machine-mac
|
||||
<<: *env-mas
|
||||
<<: *env-testing-build
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
<<: *steps-electron-gn-check
|
||||
artifact-key: 'darwin-arm64'
|
||||
after-build-and-save:
|
||||
- run:
|
||||
name: Configuring MAS build
|
||||
command: |
|
||||
echo 'export GN_EXTRA_ARGS="is_mas_build = true $GN_EXTRA_ARGS"' >> $BASH_ENV
|
||||
echo 'export MAS_BUILD="true"' >> $BASH_ENV
|
||||
rm -rf "src/out/Default/Electron Framework.framework"
|
||||
rm -rf src/out/Default/Electron*.app
|
||||
- build_and_save_artifacts:
|
||||
artifact-key: 'mas-arm64'
|
||||
after-persist:
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- generated_artifacts_mas-arm64
|
||||
|
||||
mas-publish-x64:
|
||||
executor:
|
||||
@@ -1941,25 +2031,6 @@ jobs:
|
||||
attach: true
|
||||
checkout: false
|
||||
|
||||
mas-testing-arm64:
|
||||
executor:
|
||||
name: macos
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
<<: *env-testing-build
|
||||
<<: *env-ninja-status
|
||||
<<: *env-macos-build
|
||||
<<: *env-mas-apple-silicon
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
GENERATE_CROSS_ARCH_SNAPSHOT: true
|
||||
steps:
|
||||
- electron-build:
|
||||
persist: true
|
||||
checkout: false
|
||||
checkout-and-assume-cache: true
|
||||
attach: true
|
||||
|
||||
# Layer 3: Tests.
|
||||
linux-x64-testing-tests:
|
||||
executor:
|
||||
@@ -1970,7 +2041,9 @@ jobs:
|
||||
<<: *env-headless-testing
|
||||
<<: *env-stack-dumping
|
||||
parallelism: 3
|
||||
<<: *steps-tests
|
||||
steps:
|
||||
- electron-tests:
|
||||
artifact-key: linux-x64
|
||||
|
||||
linux-x64-testing-asan-tests:
|
||||
executor:
|
||||
@@ -1983,7 +2056,9 @@ jobs:
|
||||
IS_ASAN: '1'
|
||||
DISABLE_CRASH_REPORTER_TESTS: '1'
|
||||
parallelism: 3
|
||||
<<: *steps-tests
|
||||
steps:
|
||||
- electron-tests:
|
||||
artifact-key: linux-x64-asan
|
||||
|
||||
linux-x64-testing-nan:
|
||||
executor:
|
||||
@@ -1993,7 +2068,9 @@ jobs:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-headless-testing
|
||||
<<: *env-stack-dumping
|
||||
<<: *steps-test-nan
|
||||
steps:
|
||||
- nan-tests:
|
||||
artifact-key: linux-x64
|
||||
|
||||
linux-x64-testing-node:
|
||||
executor:
|
||||
@@ -2003,7 +2080,9 @@ jobs:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-headless-testing
|
||||
<<: *env-stack-dumping
|
||||
<<: *steps-test-node
|
||||
steps:
|
||||
- node-tests:
|
||||
artifact-key: linux-x64
|
||||
|
||||
linux-arm-testing-tests:
|
||||
executor: linux-arm
|
||||
@@ -2012,7 +2091,9 @@ jobs:
|
||||
<<: *env-global
|
||||
<<: *env-headless-testing
|
||||
<<: *env-stack-dumping
|
||||
<<: *steps-tests
|
||||
steps:
|
||||
- electron-tests:
|
||||
artifact-key: linux-arm
|
||||
|
||||
linux-arm64-testing-tests:
|
||||
executor: linux-arm64
|
||||
@@ -2021,9 +2102,11 @@ jobs:
|
||||
<<: *env-global
|
||||
<<: *env-headless-testing
|
||||
<<: *env-stack-dumping
|
||||
<<: *steps-tests
|
||||
steps:
|
||||
- electron-tests:
|
||||
artifact-key: linux-arm64
|
||||
|
||||
osx-testing-x64-tests:
|
||||
darwin-testing-x64-tests:
|
||||
executor:
|
||||
name: macos
|
||||
size: macos.x86.medium.gen2
|
||||
@@ -2031,16 +2114,20 @@ jobs:
|
||||
<<: *env-mac-large
|
||||
<<: *env-stack-dumping
|
||||
parallelism: 2
|
||||
<<: *steps-tests
|
||||
steps:
|
||||
- electron-tests:
|
||||
artifact-key: darwin-x64
|
||||
|
||||
osx-testing-arm64-tests:
|
||||
darwin-testing-arm64-tests:
|
||||
executor: apple-silicon
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
<<: *env-stack-dumping
|
||||
<<: *env-apple-silicon
|
||||
<<: *env-runner
|
||||
<<: *steps-tests
|
||||
steps:
|
||||
- electron-tests:
|
||||
artifact-key: darwin-arm64
|
||||
|
||||
mas-testing-x64-tests:
|
||||
executor:
|
||||
@@ -2050,7 +2137,9 @@ jobs:
|
||||
<<: *env-mac-large
|
||||
<<: *env-stack-dumping
|
||||
parallelism: 2
|
||||
<<: *steps-tests
|
||||
steps:
|
||||
- electron-tests:
|
||||
artifact-key: mas-x64
|
||||
|
||||
mas-testing-arm64-tests:
|
||||
executor: apple-silicon
|
||||
@@ -2059,7 +2148,9 @@ jobs:
|
||||
<<: *env-stack-dumping
|
||||
<<: *env-apple-silicon
|
||||
<<: *env-runner
|
||||
<<: *steps-tests
|
||||
steps:
|
||||
- electron-tests:
|
||||
artifact-key: mas-arm64
|
||||
|
||||
# List all workflows
|
||||
workflows:
|
||||
@@ -2173,40 +2264,29 @@ workflows:
|
||||
- osx-testing-x64-gn-check:
|
||||
requires:
|
||||
- mac-make-src-cache
|
||||
- osx-testing-x64-tests:
|
||||
- darwin-testing-x64-tests:
|
||||
requires:
|
||||
- osx-testing-x64
|
||||
- osx-testing-arm64:
|
||||
requires:
|
||||
- mac-make-src-cache
|
||||
- osx-testing-arm64-tests:
|
||||
- darwin-testing-arm64-tests:
|
||||
filters:
|
||||
branches:
|
||||
# Do not run this on forked pull requests
|
||||
ignore: /pull\/[0-9]+/
|
||||
requires:
|
||||
- osx-testing-arm64
|
||||
- mas-testing-x64:
|
||||
requires:
|
||||
- mac-make-src-cache
|
||||
- mas-testing-x64-gn-check:
|
||||
requires:
|
||||
- mac-make-src-cache
|
||||
- mas-testing-x64-tests:
|
||||
requires:
|
||||
- mas-testing-x64
|
||||
- mas-testing-arm64:
|
||||
requires:
|
||||
- mac-make-src-cache
|
||||
- osx-testing-x64
|
||||
- mas-testing-arm64-tests:
|
||||
filters:
|
||||
branches:
|
||||
# Do not run this on forked pull requests
|
||||
ignore: /pull\/[0-9]+/
|
||||
requires:
|
||||
- mas-testing-arm64
|
||||
- osx-testing-arm64
|
||||
lint:
|
||||
jobs:
|
||||
- lint
|
||||
|
||||
# VS Code Extension Version: 1.1.1
|
||||
@@ -4,14 +4,13 @@ Welcome to the Codespaces Electron Developer Environment.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Upon creation of your codespace you should have [build tools](https://github.com/electron/build-tools) installed and an initialized gclient checkout of Electron. In order to build electron you'll need to run the following commands.
|
||||
Upon creation of your codespace you should have [build tools](https://github.com/electron/build-tools) installed and an initialized gclient checkout of Electron. In order to build electron you'll need to run the following command.
|
||||
|
||||
```bash
|
||||
e sync -vv
|
||||
e build
|
||||
```
|
||||
|
||||
The initial sync will take approximately ~30 minutes and the build will take ~8 minutes. Incremental syncs and incremental builds are substantially quicker.
|
||||
The initial build will take ~8 minutes. Incremental builds are substantially quicker. If you pull changes from upstream that touch either the `patches` folder or the `DEPS` folder you will have to run `e sync` in order to keep your checkout up to date.
|
||||
|
||||
## Directory Structure
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "buildtools",
|
||||
"onCreateCommand": ".devcontainer/on-create-command.sh",
|
||||
"updateContentCommand": ".devcontainer/update-content-command.sh",
|
||||
"workspaceFolder": "/workspaces/gclient/src/electron",
|
||||
"extensions": [
|
||||
"joeleinbinder.mojom-language",
|
||||
@@ -11,14 +12,28 @@
|
||||
"mutantdino.resourcemonitor",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"shakram02.bash-beautify",
|
||||
"marshallofsound.gnls-electron"
|
||||
"marshallofsound.gnls-electron",
|
||||
"CircleCI.circleci"
|
||||
],
|
||||
"settings": {
|
||||
"editor.tabSize": 2,
|
||||
"bashBeautify.tabSize": 2,
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"[gn]": {
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"editor.tabSize": 2,
|
||||
"bashBeautify.tabSize": 2
|
||||
"[javascript]": {
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true
|
||||
}
|
||||
},
|
||||
"[typescript]": {
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true
|
||||
}
|
||||
},
|
||||
"javascript.preferences.quoteStyle": "single",
|
||||
"typescript.preferences.quoteStyle": "single"
|
||||
},
|
||||
"forwardPorts": [8088, 6080, 5901],
|
||||
"portsAttributes": {
|
||||
@@ -36,8 +51,15 @@
|
||||
}
|
||||
},
|
||||
"hostRequirements": {
|
||||
"storage": "32gb",
|
||||
"cpus": 8
|
||||
"storage": "128gb",
|
||||
"cpus": 16
|
||||
},
|
||||
"remoteUser": "builduser"
|
||||
"remoteUser": "builduser",
|
||||
"customizations": {
|
||||
"codespaces": {
|
||||
"openFiles": [
|
||||
".devcontainer/README.md"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ version: '3'
|
||||
|
||||
services:
|
||||
buildtools:
|
||||
image: ghcr.io/electron/devcontainer:27db4a3e3512bfd2e47f58cea69922da0835f1d9
|
||||
image: ghcr.io/electron/devcontainer:3d8d44d0f15b05bef6149e448f9cc522111847e9
|
||||
|
||||
volumes:
|
||||
- ..:/workspaces/gclient/src/electron:cached
|
||||
|
||||
@@ -10,6 +10,7 @@ export PATH="$PATH:$buildtools/src"
|
||||
|
||||
# Create the persisted buildtools config folder
|
||||
mkdir -p $buildtools_configs
|
||||
mkdir -p $gclient_root/.git-cache
|
||||
rm -f $buildtools/configs
|
||||
ln -s $buildtools_configs $buildtools/configs
|
||||
|
||||
|
||||
10
.devcontainer/update-content-command.sh
Executable file
10
.devcontainer/update-content-command.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
buildtools=$HOME/.electron_build_tools
|
||||
|
||||
export PATH="$PATH:$buildtools/src"
|
||||
|
||||
# Sync latest
|
||||
e d gclient sync --with_branch_heads --with_tags
|
||||
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -4,7 +4,7 @@
|
||||
# https://git-scm.com/docs/gitignore
|
||||
|
||||
# Upgrades WG
|
||||
/patches/ @electron/wg-upgrades @electron/wg-security
|
||||
/patches/ @electron/patch-owners
|
||||
DEPS @electron/wg-upgrades
|
||||
|
||||
# Releases WG
|
||||
|
||||
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,4 +1,5 @@
|
||||
#### Description of Change
|
||||
|
||||
<!--
|
||||
Thank you for your Pull Request. Please provide a description above and review
|
||||
the requirements below.
|
||||
@@ -12,7 +13,7 @@ Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.
|
||||
- [ ] PR description included and stakeholders cc'd
|
||||
- [ ] `npm test` passes
|
||||
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
|
||||
- [ ] relevant documentation is changed or added
|
||||
- [ ] relevant documentation, tutorials, templates and examples are changed or added
|
||||
- [ ] [PR release notes](https://github.com/electron/clerk/blob/master/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/master/README.md#examples).
|
||||
|
||||
#### Release Notes
|
||||
|
||||
30
.github/workflows/electron_woa_testing.yml
vendored
30
.github/workflows/electron_woa_testing.yml
vendored
@@ -10,6 +10,9 @@ on:
|
||||
type: text
|
||||
required: true
|
||||
|
||||
permissions: # added using https://github.com/step-security/secure-workflows
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
electron-woa-init:
|
||||
if: ${{ github.event_name == 'push' && github.repository == 'electron/electron' }}
|
||||
@@ -26,7 +29,7 @@ jobs:
|
||||
checks: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: LouisBrunner/checks-action@v1.1.1
|
||||
- uses: LouisBrunner/checks-action@442ad2296fb110373e3fe01c2a3717b546583631 # tag: v1.1.1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: electron-woa-testing
|
||||
@@ -39,7 +42,7 @@ jobs:
|
||||
Remove-Item * -Recurse -Force
|
||||
shell: powershell
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag: v3
|
||||
with:
|
||||
path: src\electron
|
||||
fetch-depth: 0
|
||||
@@ -117,21 +120,6 @@ jobs:
|
||||
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
||||
- name: Run Electron Remote based tests
|
||||
if: ${{ success() || failure() }}
|
||||
run: |
|
||||
cd src
|
||||
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
|
||||
set npm_config_arch=arm64
|
||||
cd electron
|
||||
node script/yarn test --runners=remote --enable-logging --disable-features=CalculateNativeWinOcclusion
|
||||
env:
|
||||
ELECTRON_OUT_DIR: Default
|
||||
IGNORE_YARN_INSTALL_ERROR: 1
|
||||
ELECTRON_TEST_RESULTS_DIR: junit
|
||||
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
||||
- name: Verify ffmpeg
|
||||
run: |
|
||||
cd src
|
||||
@@ -149,7 +137,7 @@ jobs:
|
||||
run: |
|
||||
Remove-Item -path $env:APPDATA/Electron* -Recurse -Force -ErrorAction Ignore
|
||||
shell: powershell
|
||||
- uses: LouisBrunner/checks-action@v1.1.1
|
||||
- uses: LouisBrunner/checks-action@442ad2296fb110373e3fe01c2a3717b546583631 # tag: v1.1.1
|
||||
if: ${{ success() }}
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -158,7 +146,7 @@ jobs:
|
||||
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
output: |
|
||||
{"summary":"${{ job.status }}","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
|
||||
- uses: LouisBrunner/checks-action@v1.1.1
|
||||
- uses: LouisBrunner/checks-action@442ad2296fb110373e3fe01c2a3717b546583631 # tag: v1.1.1
|
||||
if: ${{ success() }}
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -167,7 +155,7 @@ jobs:
|
||||
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
output: |
|
||||
{"summary":"Job Succeeded","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
|
||||
- uses: LouisBrunner/checks-action@v1.1.1
|
||||
- uses: LouisBrunner/checks-action@442ad2296fb110373e3fe01c2a3717b546583631 # tag: v1.1.1
|
||||
if: ${{ ! success() }}
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -175,4 +163,4 @@ jobs:
|
||||
conclusion: "${{ job.status }}"
|
||||
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
output: |
|
||||
{"summary":"Job Failed","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
|
||||
{"summary":"Job Failed","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
|
||||
|
||||
28
.github/workflows/issue-labeled.yml
vendored
Normal file
28
.github/workflows/issue-labeled.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Issue Labeled
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [labeled]
|
||||
|
||||
permissions: # added using https://github.com/step-security/secure-workflows
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
issue-labeled:
|
||||
permissions:
|
||||
issues: write # for actions-cool/issues-helper to update issues
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: blocked/need-repro label added
|
||||
if: github.event.label.name == 'blocked/need-repro'
|
||||
uses: actions-cool/issues-helper@dad28fdb88da5f082c04659b7373d85790f9b135 # v3.3.0
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
body: |
|
||||
Hello @${{ github.event.issue.user.login }}. Thanks for reporting this and helping to make Electron better!
|
||||
|
||||
Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, [Electron Fiddle](https://www.electronjs.org/fiddle) is a great tool for making small test cases and makes it easy to publish your test case to a [gist](https://gist.github.com) that Electron maintainers can use.
|
||||
|
||||
Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.
|
||||
|
||||
Now adding the `blocked/need-repro` label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.
|
||||
7
.github/workflows/release_dependency_versions.yml
vendored
Executable file → Normal file
7
.github/workflows/release_dependency_versions.yml
vendored
Executable file → Normal file
@@ -7,11 +7,14 @@ on:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
permissions: # added using https://github.com/step-security/secure-workflows
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check_tag:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag: v3
|
||||
- name: Check Tag
|
||||
run: |
|
||||
if [[ ${{ github.event.release.tag_name }} =~ ^v[0-9]+\.0\.0$ ]]; then
|
||||
@@ -22,7 +25,7 @@ jobs:
|
||||
needs: check_tag
|
||||
if: needs.check_tag.outputs.should_release == 'true'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag: v3
|
||||
- name: Trigger New chromedriver Release
|
||||
run: |
|
||||
gh api /repos/:owner/chromedriver/actions/workflows/release.yml/dispatches --input - <<< '{"ref":"main","inputs":{"version":"${{ github.event.release.tag_name }}"}}'
|
||||
|
||||
54
.github/workflows/scorecards.yml
vendored
Normal file
54
.github/workflows/scorecards.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
name: Scorecards supply-chain security
|
||||
on:
|
||||
# Only the default branch is supported.
|
||||
branch_protection_rule:
|
||||
schedule:
|
||||
- cron: '44 17 * * 0'
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
|
||||
# Declare default permissions as read only.
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
analysis:
|
||||
name: Scorecards analysis
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
# Needed to upload the results to code-scanning dashboard.
|
||||
security-events: write
|
||||
# Used to receive a badge.
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # tag=v2.0.6
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
|
||||
# Publish the results for public repositories to enable scorecard badges. For more details, see
|
||||
# https://github.com/ossf/scorecard-action#publishing-results.
|
||||
# For private repositories, `publish_results` will automatically be set to `false`, regardless
|
||||
# of the value entered here.
|
||||
publish_results: true
|
||||
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # tag=v3.0.0
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # tag=v1.0.26
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
2
.github/workflows/semantic.yml
vendored
2
.github/workflows/semantic.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: semantic-pull-request
|
||||
uses: amannn/action-semantic-pull-request@v4
|
||||
uses: amannn/action-semantic-pull-request@505e44b4f33b4c801f063838b3f053990ee46ea7 # tag: v4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
|
||||
36
.github/workflows/stale.yml
vendored
Normal file
36
.github/workflows/stale.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: 'Close stale issues'
|
||||
on:
|
||||
schedule:
|
||||
# 1:30am every day
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@3de2653986ebd134983c79fe2be5d45cc3d9f4e1
|
||||
with:
|
||||
days-before-stale: 90
|
||||
days-before-close: 30
|
||||
stale-issue-label: stale
|
||||
operations-per-run: 1750
|
||||
stale-issue-message: >
|
||||
This issue has been automatically marked as stale. **If this issue is still affecting you, please leave any comment** (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the [latest version of Electron](https://www.electronjs.org/releases/stable) or in the [beta](https://www.electronjs.org/releases/beta)—please include it with your comment!
|
||||
close-issue-message: >
|
||||
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a [supported version of Electron](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline) please open a new issue and include instructions for reproducing the issue.
|
||||
exempt-issue-labels: "discussion,security \U0001F512,enhancement :sparkles:"
|
||||
only-pr-labels: not-a-real-label
|
||||
pending-repro:
|
||||
steps:
|
||||
- uses: actions/stale@3de2653986ebd134983c79fe2be5d45cc3d9f4e1
|
||||
with:
|
||||
days-before-stale: -1
|
||||
days-before-close: 10
|
||||
stale-issue-label: blocked/need-repro
|
||||
stale-pr-label: not-a-real-label
|
||||
operations-per-run: 1750
|
||||
close-issue-message: >
|
||||
Unfortunately, without a way to reproduce this issue, we're unable to continue investigation. This issue has been closed and will not be monitored further. If you're able to provide a minimal test case that reproduces this issue on a [supported version of Electron](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline) please open a new issue and include instructions for reproducing the issue.
|
||||
62
.github/workflows/update_appveyor_image.yml
vendored
Normal file
62
.github/workflows/update_appveyor_image.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: Update AppVeyor Image
|
||||
|
||||
# Run chron daily Mon-Fri
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 8 * * 1-5' # runs 8:00 every business day (see https://crontab.guru)
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
bake-appveyor-image:
|
||||
name: Bake AppVeyor Image
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write # to create a new PR with updated Appveyor images
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Yarn install
|
||||
run: |
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
- name: Set Repo for Commit
|
||||
run: git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||
- name: Check AppVeyor Image
|
||||
env:
|
||||
APPVEYOR_TOKEN: ${{ secrets.APPVEYOR_TOKEN }}
|
||||
run: |
|
||||
node ./script/prepare-appveyor
|
||||
if [ -f ./image_version.txt ]; then
|
||||
echo "APPVEYOR_IMAGE_VERSION="$(cat image_version.txt)"" >> $GITHUB_ENV
|
||||
rm image_version.txt
|
||||
fi
|
||||
- name: (Optionally) Update Appveyor Image
|
||||
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
||||
uses: mikefarah/yq@1c7dc0e88aad311c89889bc5ce5d8f96931a1bd0 # v4.27.2
|
||||
with:
|
||||
cmd: yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor.yml" > "appveyor2.yml"
|
||||
- name: (Optionally) Generate Commit Diff
|
||||
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
||||
run: |
|
||||
diff -w -B appveyor.yml appveyor2.yml > appveyor.diff || true
|
||||
patch -f appveyor.yml < appveyor.diff
|
||||
rm appveyor2.yml appveyor.diff
|
||||
- name: (Optionally) Commit and Pull Request
|
||||
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
||||
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.3
|
||||
with:
|
||||
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
|
||||
commit-message: 'build: update appveyor image to latest version'
|
||||
committer: GitHub <noreply@github.com>
|
||||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||
signoff: false
|
||||
branch: bump-appveyor-image
|
||||
delete-branch: true
|
||||
title: 'build: update appveyor image to latest version'
|
||||
body: |
|
||||
This PR updates appveyor.yml to the latest baked image, ${{ env.APPVEYOR_IMAGE_VERSION }}.
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -41,7 +41,7 @@ spec/.hash
|
||||
.eslintcache*
|
||||
|
||||
# Generated native addon files
|
||||
/spec-main/fixtures/native-addon/echo/build/
|
||||
/spec/fixtures/native-addon/echo/build/
|
||||
|
||||
# If someone runs tsc this is where stuff will end up
|
||||
ts-gen
|
||||
@@ -53,4 +53,4 @@ ts-gen
|
||||
# Used to accelerate builds after sync
|
||||
patches/mtime-cache.json
|
||||
|
||||
spec/fixtures/logo.png
|
||||
spec/fixtures/logo.png
|
||||
|
||||
43
BUILD.gn
43
BUILD.gn
@@ -210,6 +210,15 @@ webpack_build("electron_isolated_renderer_bundle") {
|
||||
out_file = "$target_gen_dir/js2c/isolated_bundle.js"
|
||||
}
|
||||
|
||||
webpack_build("electron_utility_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
|
||||
inputs = auto_filenames.utility_bundle_deps
|
||||
|
||||
config_file = "//electron/build/webpack/webpack.config.utility.js"
|
||||
out_file = "$target_gen_dir/js2c/utility_init.js"
|
||||
}
|
||||
|
||||
action("electron_js2c") {
|
||||
deps = [
|
||||
":electron_asar_bundle",
|
||||
@@ -217,6 +226,7 @@ action("electron_js2c") {
|
||||
":electron_isolated_renderer_bundle",
|
||||
":electron_renderer_bundle",
|
||||
":electron_sandboxed_renderer_bundle",
|
||||
":electron_utility_bundle",
|
||||
":electron_worker_bundle",
|
||||
]
|
||||
|
||||
@@ -226,6 +236,7 @@ action("electron_js2c") {
|
||||
"$target_gen_dir/js2c/isolated_bundle.js",
|
||||
"$target_gen_dir/js2c/renderer_init.js",
|
||||
"$target_gen_dir/js2c/sandbox_bundle.js",
|
||||
"$target_gen_dir/js2c/utility_init.js",
|
||||
"$target_gen_dir/js2c/worker_init.js",
|
||||
]
|
||||
|
||||
@@ -406,6 +417,7 @@ source_set("electron_lib") {
|
||||
"chromium_src:chrome",
|
||||
"chromium_src:chrome_spellchecker",
|
||||
"shell/common/api:mojo",
|
||||
"shell/services/node/public/mojom",
|
||||
"//base:base_static",
|
||||
"//base/allocator:buildflags",
|
||||
"//chrome:strings",
|
||||
@@ -500,6 +512,8 @@ source_set("electron_lib") {
|
||||
]
|
||||
}
|
||||
|
||||
configs += [ "//electron/build/config:mas_build" ]
|
||||
|
||||
sources = filenames.lib_sources
|
||||
if (is_win) {
|
||||
sources += filenames.lib_sources_win
|
||||
@@ -528,13 +542,6 @@ source_set("electron_lib") {
|
||||
]
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
deps += [
|
||||
"//components/crash/content/browser",
|
||||
"//ui/gtk:gtk_config",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
deps += [
|
||||
"//components/remote_cocoa/app_shim",
|
||||
@@ -568,7 +575,6 @@ source_set("electron_lib") {
|
||||
if (is_mas_build) {
|
||||
sources += [ "shell/browser/api/electron_api_app_mas.mm" ]
|
||||
sources -= [ "shell/browser/auto_updater_mac.mm" ]
|
||||
defines += [ "MAS_BUILD" ]
|
||||
sources -= [
|
||||
"shell/app/electron_crash_reporter_client.cc",
|
||||
"shell/app/electron_crash_reporter_client.h",
|
||||
@@ -597,11 +603,14 @@ source_set("electron_lib") {
|
||||
":electron_gtk_stubs",
|
||||
":libnotify_loader",
|
||||
"//build/config/linux/gtk",
|
||||
"//components/crash/content/browser",
|
||||
"//dbus",
|
||||
"//device/bluetooth",
|
||||
"//third_party/crashpad/crashpad/client",
|
||||
"//ui/base/ime/linux",
|
||||
"//ui/events/devices/x11",
|
||||
"//ui/events/platform/x11",
|
||||
"//ui/gtk:gtk_config",
|
||||
"//ui/linux:linux_ui",
|
||||
"//ui/linux:linux_ui_factory",
|
||||
"//ui/views/controls/webview",
|
||||
@@ -623,16 +632,8 @@ source_set("electron_lib") {
|
||||
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",
|
||||
"shell/browser/ui/gtk/app_indicator_icon_menu.h",
|
||||
"shell/browser/ui/gtk/gtk_status_icon.cc",
|
||||
"shell/browser/ui/gtk/gtk_status_icon.h",
|
||||
"shell/browser/ui/gtk/menu_util.cc",
|
||||
"shell/browser/ui/gtk/menu_util.h",
|
||||
"shell/browser/ui/gtk/status_icon.cc",
|
||||
"shell/browser/ui/gtk/status_icon.h",
|
||||
"shell/browser/ui/gtk_util.cc",
|
||||
"shell/browser/ui/gtk_util.h",
|
||||
]
|
||||
@@ -655,6 +656,8 @@ source_set("electron_lib") {
|
||||
if (enable_plugins) {
|
||||
deps += [ "chromium_src:plugins" ]
|
||||
sources += [
|
||||
"shell/common/plugin_info.cc",
|
||||
"shell/common/plugin_info.h",
|
||||
"shell/renderer/electron_renderer_pepper_host_factory.cc",
|
||||
"shell/renderer/electron_renderer_pepper_host_factory.h",
|
||||
"shell/renderer/pepper_helper.cc",
|
||||
@@ -717,7 +720,7 @@ source_set("electron_lib") {
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_basic_printing) {
|
||||
if (enable_printing) {
|
||||
sources += [
|
||||
"shell/browser/printing/print_view_manager_electron.cc",
|
||||
"shell/browser/printing/print_view_manager_electron.h",
|
||||
@@ -743,7 +746,7 @@ source_set("electron_lib") {
|
||||
"//components/update_client:update_client",
|
||||
"//components/zoom",
|
||||
"//extensions/browser",
|
||||
"//extensions/browser:core_api_provider",
|
||||
"//extensions/browser/api:api_provider",
|
||||
"//extensions/browser/updater",
|
||||
"//extensions/common",
|
||||
"//extensions/common:core_api_provider",
|
||||
@@ -967,6 +970,7 @@ if (is_mac) {
|
||||
deps += [ "//sandbox/mac:seatbelt" ]
|
||||
}
|
||||
defines = [ "HELPER_EXECUTABLE" ]
|
||||
extra_configs = [ "//electron/build/config:mas_build" ]
|
||||
sources = [
|
||||
"shell/app/electron_main_mac.cc",
|
||||
"shell/app/uv_stdio_fix.cc",
|
||||
@@ -1137,6 +1141,7 @@ if (is_mac) {
|
||||
"-rpath",
|
||||
"@executable_path/../Frameworks",
|
||||
]
|
||||
extra_configs = [ "//electron/build/config:mas_build" ]
|
||||
}
|
||||
|
||||
if (enable_dsyms) {
|
||||
@@ -1472,7 +1477,7 @@ dist_zip("electron_ffmpeg_zip") {
|
||||
|
||||
electron_chromedriver_deps = [
|
||||
":licenses",
|
||||
"//chrome/test/chromedriver",
|
||||
"//chrome/test/chromedriver:chromedriver_server",
|
||||
"//electron/buildflags",
|
||||
]
|
||||
|
||||
|
||||
4
DEPS
4
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'106.0.5249.199',
|
||||
'110.0.5451.0',
|
||||
'node_version':
|
||||
'v16.16.0',
|
||||
'v18.12.1',
|
||||
'nan_version':
|
||||
'16fa32231e2ccd89d2804b3f765319128b20c4ac',
|
||||
'squirrel.mac_version':
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
[](https://discord.gg/electronjs)
|
||||
|
||||
:memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪.
|
||||
View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/).
|
||||
View these docs in other languages on our [Crowdin](https://crowdin.com/project/electron) project.
|
||||
|
||||
The Electron framework lets you write cross-platform desktop applications
|
||||
using JavaScript, HTML and CSS. It is based on [Node.js](https://nodejs.org/) and
|
||||
@@ -39,7 +39,7 @@ For more installation options and troubleshooting tips, see
|
||||
Each Electron release provides binaries for macOS, Windows, and Linux.
|
||||
|
||||
* macOS (High Sierra and up): Electron provides 64-bit Intel and ARM binaries for macOS. Apple Silicon support was added in Electron 11.
|
||||
* Windows (Windows 7 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8.
|
||||
* Windows (Windows 10 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8. Support for Windows 7 and 8 was [removed in Electron 23, in line with Chromium's Windows deprecation policy](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice).
|
||||
* Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on:
|
||||
* Ubuntu 14.04 and newer
|
||||
* Fedora 24 and newer
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
The Electron team and community take security bugs in Electron seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
|
||||
|
||||
To report a security issue, email [security@electronjs.org](mailto:security@electronjs.org) and include the word "SECURITY" in the subject line.
|
||||
To report a security issue, please use the GitHub Security Advisory ["Report a Vulnerability"](https://github.com/electron/electron/security/advisories/new) tab.
|
||||
|
||||
The Electron team will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
|
||||
|
||||
|
||||
52
appveyor-bake.yml
Normal file
52
appveyor-bake.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
# The config is used to bake appveyor images, not for running CI jobs.
|
||||
# The config expects the following environment variables to be set:
|
||||
# - "APPVEYOR_BAKE_IMAGE" e.g. 'electron-99.0.4767.0'. Name of the image to be baked.
|
||||
# Typically named after the Chromium version on which the image is built.
|
||||
# This can be set dynamically in the prepare-appveyor script.
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: electronhq-16-core
|
||||
image: Windows_Default_Appveyor
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ELECTRON_ENABLE_STACK_DUMPING: 1
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
|
||||
GOMA_FALLBACK_ON_AUTH_FAILURE: true
|
||||
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
|
||||
PYTHONIOENCODING: UTF-8
|
||||
build_script:
|
||||
- ps: Resize-Partition -DriveLetter C -Size (256GB) # ensure initial partition size
|
||||
- ps: Get-Partition -DriveLetter C
|
||||
- git config --global core.longpaths true
|
||||
- cd ..
|
||||
- mkdir src
|
||||
- ps: git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
|
||||
- update_depot_tools.bat
|
||||
- ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
|
||||
- src\electron\script\setup-win-for-dev.bat
|
||||
- >-
|
||||
gclient config
|
||||
--name "src\electron"
|
||||
--unmanaged
|
||||
%GCLIENT_EXTRA_ARGS%
|
||||
"https://github.com/electron/electron"
|
||||
- ps: cd src\electron
|
||||
- ps: node script\generate-deps-hash.js
|
||||
- ps: $depshash = Get-Content .\.depshash -Raw
|
||||
- ps: Copy-Item -path .\.depshash -destination ..\.depshash
|
||||
- ps: cd ..\..
|
||||
- gclient sync --with_branch_heads --with_tags --nohooks
|
||||
- ps: regsvr32 /s "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\DIA SDK\bin\amd64\msdia140.dll"
|
||||
on_image_bake:
|
||||
- ps: >-
|
||||
echo "Baking image: $env:APPVEYOR_BAKE_IMAGE at dir $PWD"
|
||||
- ps: Remove-Item -Recurse -Force $pwd\depot_tools
|
||||
- ps: Remove-Item -Recurse -Force $pwd\src\electron
|
||||
# Uncomment these lines to enable RDP
|
||||
#on_finish:
|
||||
# - ps: >-
|
||||
# $env:APPVEYOR_RDP_PASSWORD = "electron"
|
||||
# $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
374
appveyor.yml
374
appveyor.yml
@@ -24,23 +24,24 @@
|
||||
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: electron-16-core
|
||||
image: vs2019bt-16.16.11
|
||||
build_cloud: electronhq-16-core
|
||||
image: e-110.0.5415.0-fix
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
|
||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ELECTRON_ENABLE_STACK_DUMPING: 1
|
||||
ELECTRON_ALSO_LOG_TO_STDERR: 1
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
|
||||
GOMA_FALLBACK_ON_AUTH_FAILURE: true
|
||||
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
|
||||
PYTHONIOENCODING: UTF-8
|
||||
|
||||
matrix:
|
||||
|
||||
- job_name: Build
|
||||
|
||||
- job_name: Test
|
||||
job_depends_on: Build
|
||||
- job_name: Build
|
||||
- job_name: Test
|
||||
job_depends_on: Build
|
||||
|
||||
clone_folder: C:\projects\src\electron
|
||||
|
||||
@@ -50,167 +51,129 @@ matrix:
|
||||
|
||||
for:
|
||||
|
||||
-
|
||||
matrix:
|
||||
- matrix:
|
||||
only:
|
||||
- job_name: Build
|
||||
|
||||
init:
|
||||
- ps: >-
|
||||
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
|
||||
Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
|
||||
}
|
||||
- ps: >-
|
||||
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
|
||||
Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
|
||||
}
|
||||
|
||||
build_script:
|
||||
- ps: |
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-warning "Skipping tests for doc only change"; Exit-AppveyorBuild
|
||||
}
|
||||
$global:LASTEXITCODE = 0
|
||||
- cd ..
|
||||
- ps: Write-Host "Building $env:GN_CONFIG build"
|
||||
- git config --global core.longpaths true
|
||||
- update_depot_tools.bat
|
||||
- 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: |
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
|
||||
}
|
||||
}
|
||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -ne 'release') {
|
||||
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
|
||||
}
|
||||
- >-
|
||||
gclient config
|
||||
--name "src\electron"
|
||||
--unmanaged
|
||||
%GCLIENT_EXTRA_ARGS%
|
||||
"https://github.com/electron/electron"
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
$env:RUN_GCLIENT_SYNC="true"
|
||||
} else {
|
||||
cd src\electron
|
||||
node script\generate-deps-hash.js
|
||||
$depshash = Get-Content .\.depshash -Raw
|
||||
$zipfile = "Z:\$depshash.7z"
|
||||
cd ..\..
|
||||
if (Test-Path -Path $zipfile) {
|
||||
# file exists, unzip and then gclient sync
|
||||
7z x -y $zipfile -mmt=14 -aoa
|
||||
if (-not (Test-Path -Path "src\buildtools")) {
|
||||
# the zip file must be corrupt - resync
|
||||
$env:RUN_GCLIENT_SYNC="true"
|
||||
if ($env:TARGET_ARCH -ne 'ia32') {
|
||||
# only save on x64/woa to avoid contention saving
|
||||
$env:SAVE_GCLIENT_SRC="true"
|
||||
}
|
||||
$global:LASTEXITCODE = 0
|
||||
- cd ..
|
||||
- ps: Write-Host "Building $env:GN_CONFIG build"
|
||||
- git config --global core.longpaths true
|
||||
- ps: >-
|
||||
if (Test-Path -Path "$pwd\depot_tools") {
|
||||
Remove-Item -Recurse -Force $pwd\depot_tools
|
||||
}
|
||||
- ps: >-
|
||||
if (Test-Path -Path "$pwd\build-tools") {
|
||||
Remove-Item -Recurse -Force $pwd\build-tools
|
||||
}
|
||||
- ps: git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
|
||||
- ps: >-
|
||||
if (Test-Path -Path "$pwd\src\electron") {
|
||||
Remove-Item -Recurse -Force $pwd\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 {
|
||||
# update angle
|
||||
cd src\third_party\angle
|
||||
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
|
||||
git fetch
|
||||
cd ..\..\..
|
||||
Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
|
||||
$host.SetShouldExit(1)
|
||||
}
|
||||
} else {
|
||||
# file does not exist, gclient sync, then zip
|
||||
}
|
||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -ne 'release') {
|
||||
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
|
||||
}
|
||||
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
|
||||
# Patches are applied in the image bake. Check depshash to see if patches have changed.
|
||||
- ps: $env:RUN_GCLIENT_SYNC="false"
|
||||
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
|
||||
- ps: cd src\electron
|
||||
- ps: node script\generate-deps-hash.js
|
||||
- ps: $depshash = Get-Content .\.depshash -Raw
|
||||
- ps: cd ..\..
|
||||
- ps: >-
|
||||
if ($depshash_baked -ne $depshash) {
|
||||
$env:RUN_GCLIENT_SYNC="true"
|
||||
if ($env:TARGET_ARCH -ne 'ia32') {
|
||||
# only save on x64/woa to avoid contention saving
|
||||
$env:SAVE_GCLIENT_SRC="true"
|
||||
}
|
||||
}
|
||||
}
|
||||
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync )
|
||||
- ps: >-
|
||||
if ($env:SAVE_GCLIENT_SRC -eq 'true') {
|
||||
# archive current source for future use
|
||||
# only run on x64/woa to avoid contention saving
|
||||
$(7z a $zipfile src -xr!android_webview -xr!electron -xr'!*\.git' -xr!third_party\blink\web_tests -xr!third_party\blink\perf_tests -slp -t7z -mmt=30)
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-warning "Could not save source to shared drive; continuing anyway"
|
||||
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
|
||||
- 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% "
|
||||
- gn check out/Default //electron:electron_lib
|
||||
- gn check out/Default //electron:electron_app
|
||||
- gn check out/Default //electron/shell/common/api:mojo
|
||||
- if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
|
||||
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
|
||||
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
|
||||
- ninja -C out/ffmpeg electron:electron_ffmpeg_zip
|
||||
- ninja -C out/Default electron:electron_dist_zip
|
||||
- ninja -C out/Default shell_browser_ui_unittests
|
||||
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
|
||||
# Remove unused args from mksnapshot_args
|
||||
- ps: >-
|
||||
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
|
||||
- ninja -C out/Default electron:electron_mksnapshot_zip
|
||||
- cd out\Default
|
||||
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
|
||||
- cd ..\..
|
||||
- ninja -C out/Default electron:hunspell_dictionaries_zip
|
||||
- ninja -C out/Default electron:electron_chromedriver_zip
|
||||
- ninja -C out/Default third_party/electron_node:headers
|
||||
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
|
||||
- ps: >-
|
||||
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 | Out-File -Encoding utf8 -FilePath .\installed_software.json
|
||||
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
||||
- 7z a node_headers.zip out\Default\gen\node_headers
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
# Needed for msdia140.dll on 64-bit windows
|
||||
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
||||
ninja -C out/Default electron:electron_symbols
|
||||
}
|
||||
# build time generation of file gen/angle/angle_commit.h depends on
|
||||
# third_party/angle/.git
|
||||
# https://chromium-review.googlesource.com/c/angle/angle/+/2074924
|
||||
$(7z a $zipfile src\third_party\angle\.git)
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-warning "Failed to add third_party\angle\.git; continuing anyway"
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
python3 electron\script\zip-symbols.py
|
||||
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
|
||||
} else {
|
||||
# It's useful to have pdb files when debugging testing builds that are
|
||||
# built on CI.
|
||||
7z a pdb.zip out\Default\*.pdb
|
||||
}
|
||||
# build time generation of file dawn/common/Version_autogen.h depends on third_party/dawn/.git/HEAD
|
||||
# https://dawn-review.googlesource.com/c/dawn/+/83901
|
||||
$(7z a $zipfile src\third_party\dawn\.git)
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-warning "Failed to add third_party\dawn\.git; continuing anyway"
|
||||
}
|
||||
}
|
||||
- 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% "
|
||||
- gn check out/Default //electron:electron_lib
|
||||
- gn check out/Default //electron:electron_app
|
||||
- gn check out/Default //electron/shell/common/api:mojo
|
||||
- if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
|
||||
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
|
||||
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
|
||||
- ninja -C out/ffmpeg electron:electron_ffmpeg_zip
|
||||
- ninja -C out/Default electron:electron_dist_zip
|
||||
- ninja -C out/Default shell_browser_ui_unittests
|
||||
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
|
||||
- ps: >-
|
||||
# Remove unused args from mksnapshot_args
|
||||
- python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
|
||||
|
||||
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
|
||||
- ninja -C out/Default electron:electron_mksnapshot_zip
|
||||
- cd out\Default
|
||||
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
|
||||
- cd ..\..
|
||||
- ninja -C out/Default electron:hunspell_dictionaries_zip
|
||||
- ninja -C out/Default electron:electron_chromedriver_zip
|
||||
- ninja -C out/Default third_party/electron_node:headers
|
||||
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
|
||||
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
||||
- 7z a node_headers.zip out\Default\gen\node_headers
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
# Needed for msdia140.dll on 64-bit windows
|
||||
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
||||
ninja -C out/Default electron:electron_symbols
|
||||
}
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
python3 electron\script\zip-symbols.py
|
||||
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
|
||||
} else {
|
||||
# It's useful to have pdb files when debugging testing builds that are
|
||||
# built on CI.
|
||||
7z a pdb.zip out\Default\*.pdb
|
||||
}
|
||||
- python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
|
||||
|
||||
deploy_script:
|
||||
- cd electron
|
||||
- ps: >-
|
||||
@@ -227,7 +190,7 @@ for:
|
||||
}
|
||||
on_finish:
|
||||
# Uncomment this lines to enable RDP
|
||||
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
- cd C:\projects\src
|
||||
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
|
||||
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
|
||||
@@ -241,57 +204,55 @@ for:
|
||||
- ps: >-
|
||||
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
|
||||
appveyor-retry appveyor PushArtifact pdb.zip
|
||||
}
|
||||
|
||||
-
|
||||
matrix:
|
||||
}
|
||||
- matrix:
|
||||
only:
|
||||
- job_name: Test
|
||||
|
||||
init:
|
||||
- ps: |
|
||||
if ($env:RUN_TESTS -ne 'true') {
|
||||
Write-warning "Skipping tests for $env:APPVEYOR_PROJECT_NAME"; Exit-AppveyorBuild
|
||||
}
|
||||
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
|
||||
Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
|
||||
}
|
||||
- ps: |
|
||||
if ($env:RUN_TESTS -ne 'true') {
|
||||
Write-warning "Skipping tests for $env:APPVEYOR_PROJECT_NAME"; Exit-AppveyorBuild
|
||||
}
|
||||
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
|
||||
Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
|
||||
}
|
||||
build_script:
|
||||
- ps: |
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-warning "Skipping tests for doc only change"; Exit-AppveyorBuild
|
||||
}
|
||||
$global:LASTEXITCODE = 0
|
||||
- ps: |
|
||||
cd ..
|
||||
mkdir out\Default
|
||||
cd ..
|
||||
# Download build artifacts
|
||||
$apiUrl = 'https://ci.appveyor.com/api'
|
||||
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
|
||||
$artifacts_to_download = @('dist.zip','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
|
||||
foreach ($job in $build_info.build.jobs) {
|
||||
if ($job.name -eq "Build") {
|
||||
$jobId = $job.jobId
|
||||
foreach($artifact_name in $artifacts_to_download) {
|
||||
if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
|
||||
$outfile = "src\out\Default\$artifact_name"
|
||||
} else {
|
||||
$outfile = $artifact_name
|
||||
- ps: |
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
|
||||
}
|
||||
$global:LASTEXITCODE = 0
|
||||
- cd ..
|
||||
- mkdir out\Default
|
||||
- cd ..
|
||||
- ps: |
|
||||
# Download build artifacts
|
||||
$apiUrl = 'https://ci.appveyor.com/api'
|
||||
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
|
||||
$artifacts_to_download = @('dist.zip','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
|
||||
foreach ($job in $build_info.build.jobs) {
|
||||
if ($job.name -eq "Build") {
|
||||
$jobId = $job.jobId
|
||||
foreach($artifact_name in $artifacts_to_download) {
|
||||
if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
|
||||
$outfile = "src\out\Default\$artifact_name"
|
||||
} else {
|
||||
$outfile = $artifact_name
|
||||
}
|
||||
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
|
||||
}
|
||||
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
|
||||
}
|
||||
}
|
||||
}
|
||||
- ps: |
|
||||
$out_default_zips = @('dist.zip','chromedriver.zip','mksnapshot.zip')
|
||||
foreach($zip_name in $out_default_zips) {
|
||||
7z x -y -osrc\out\Default $zip_name
|
||||
}
|
||||
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
|
||||
- ps: 7z x -y -osrc node_headers.zip
|
||||
- ps: |
|
||||
$out_default_zips = @('dist.zip','chromedriver.zip','mksnapshot.zip')
|
||||
foreach($zip_name in $out_default_zips) {
|
||||
7z x -y -osrc\out\Default $zip_name
|
||||
}
|
||||
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
|
||||
- ps: 7z x -y -osrc node_headers.zip
|
||||
|
||||
test_script:
|
||||
# Workaround for https://github.com/appveyor/ci/issues/2420
|
||||
@@ -301,15 +262,22 @@ for:
|
||||
New-Item .\out\Default\gen\node_headers\Release -Type directory
|
||||
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
|
||||
- cd electron
|
||||
# Explicitly set npm_config_arch because the .env doesn't persist
|
||||
- ps: >-
|
||||
if ($env:TARGET_ARCH -eq 'ia32') {
|
||||
$env:npm_config_arch = "ia32"
|
||||
}
|
||||
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log
|
||||
- echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log
|
||||
- cd ..
|
||||
- echo Verifying non proprietary ffmpeg & python3 electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
||||
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
||||
- echo "About to verify mksnapshot"
|
||||
- echo Verifying mksnapshot & python3 electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd%
|
||||
- echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd%
|
||||
- echo "Done verifying mksnapshot"
|
||||
- echo Verifying chromedriver & python3 electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd%
|
||||
- echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd%
|
||||
- echo "Done verifying chromedriver"
|
||||
|
||||
on_finish:
|
||||
|
||||
# Uncomment these lines to enable RDP
|
||||
# on_finish:
|
||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )
|
||||
@@ -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 = 109
|
||||
node_module_version = 114
|
||||
|
||||
v8_promise_internal_field_count = 1
|
||||
v8_embedder_string = "-electron.0"
|
||||
@@ -20,7 +20,7 @@ enable_cdm_host_verification = false
|
||||
proprietary_codecs = true
|
||||
ffmpeg_branding = "Chrome"
|
||||
|
||||
enable_basic_printing = true
|
||||
enable_printing = true
|
||||
|
||||
# Removes DLLs from the build, which are only meant to be used for Chromium development.
|
||||
# See https://github.com/electron/electron/pull/17985
|
||||
@@ -45,3 +45,6 @@ enable_cet_shadow_stack = false
|
||||
# V8 in the browser process.
|
||||
# Ref: https://source.chromium.org/chromium/chromium/src/+/45fba672185aae233e75d6ddc81ea1e0b30db050:v8/BUILD.gn;l=281
|
||||
is_cfi = false
|
||||
|
||||
# TODO: fix this once sysroots have been updated.
|
||||
use_qt = false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
root_extra_deps = [ "//electron/spec" ]
|
||||
root_extra_deps = [ "//electron/spec-chromium:spec" ]
|
||||
|
||||
dcheck_always_on = true
|
||||
is_debug = false
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# For MAS build, we force defining "MAS_BUILD".
|
||||
config("mas_build") {
|
||||
if (is_mas_build) {
|
||||
defines = [ "MAS_BUILD" ]
|
||||
defines = [ "IS_MAS_BUILD()=1" ]
|
||||
} else {
|
||||
defines = [ "IS_MAS_BUILD()=0" ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ 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 +34,10 @@ 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",
|
||||
]
|
||||
|
||||
proc = subprocess.Popen(
|
||||
["powershell.exe", "-Command", "-"],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
|
||||
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)),
|
||||
)
|
||||
)
|
||||
# file_path = os.path.join(os.getcwd(), 'installed_software.json')
|
||||
# return json.loads(open('installed_software.json').read().decode('utf-8'))
|
||||
f = open('installed_software.json', encoding='utf-8-sig')
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def windows_profile():
|
||||
|
||||
@@ -75,9 +75,17 @@ module.exports = ({
|
||||
|
||||
if (targetDeletesNodeGlobals) {
|
||||
plugins.push(new webpack.ProvidePlugin({
|
||||
process: ['@electron/internal/common/webpack-provider', 'process'],
|
||||
Buffer: ['@electron/internal/common/webpack-provider', 'Buffer'],
|
||||
global: ['@electron/internal/common/webpack-provider', '_global'],
|
||||
Buffer: ['@electron/internal/common/webpack-provider', 'Buffer']
|
||||
process: ['@electron/internal/common/webpack-provider', 'process']
|
||||
}));
|
||||
}
|
||||
|
||||
// Webpack 5 no longer polyfills process or Buffer.
|
||||
if (!alwaysHasNode) {
|
||||
plugins.push(new webpack.ProvidePlugin({
|
||||
Buffer: ['buffer', 'Buffer'],
|
||||
process: 'process/browser'
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -129,7 +137,12 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
|
||||
// Force timers to resolve to our dependency that doesn't use window.postMessage
|
||||
timers: path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
||||
},
|
||||
extensions: ['.ts', '.js']
|
||||
extensions: ['.ts', '.js'],
|
||||
fallback: {
|
||||
// We provide our own "timers" import above, any usage of setImmediate inside
|
||||
// one of our renderer bundles should import it from the 'timers' package
|
||||
setImmediate: false
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
@@ -150,10 +163,7 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
|
||||
},
|
||||
node: {
|
||||
__dirname: false,
|
||||
__filename: false,
|
||||
// We provide our own "timers" import above, any usage of setImmediate inside
|
||||
// one of our renderer bundles should import it from the 'timers' package
|
||||
setImmediate: false
|
||||
__filename: false
|
||||
},
|
||||
optimization: {
|
||||
minimize: env.mode === 'production',
|
||||
|
||||
4
build/webpack/webpack.config.utility.js
Normal file
4
build/webpack/webpack.config.utility.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'utility',
|
||||
alwaysHasNode: true
|
||||
});
|
||||
@@ -30,11 +30,14 @@ template("webpack_build") {
|
||||
args = [
|
||||
"--config",
|
||||
rebase_path(invoker.config_file),
|
||||
"--output-filename=" + get_path_info(invoker.out_file, "file"),
|
||||
"--output-path=" + rebase_path(get_path_info(invoker.out_file, "dir")),
|
||||
"--env.buildflags=" +
|
||||
rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||
"--env.mode=" + mode,
|
||||
"--output-filename",
|
||||
get_path_info(invoker.out_file, "file"),
|
||||
"--output-path",
|
||||
rebase_path(get_path_info(invoker.out_file, "dir")),
|
||||
"--env",
|
||||
"buildflags=" + rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||
"--env",
|
||||
"mode=" + mode,
|
||||
]
|
||||
deps += [ "//electron/buildflags" ]
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ static_library("chrome") {
|
||||
deps += [ "//components/cdm/renderer" ]
|
||||
}
|
||||
|
||||
if (enable_basic_printing) {
|
||||
if (enable_printing) {
|
||||
sources += [
|
||||
"//chrome/browser/bad_message.cc",
|
||||
"//chrome/browser/bad_message.h",
|
||||
@@ -232,6 +232,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/printing/printing_service.h",
|
||||
"//components/printing/browser/print_to_pdf/pdf_print_job.cc",
|
||||
"//components/printing/browser/print_to_pdf/pdf_print_job.h",
|
||||
"//components/printing/browser/print_to_pdf/pdf_print_result.cc",
|
||||
"//components/printing/browser/print_to_pdf/pdf_print_result.h",
|
||||
"//components/printing/browser/print_to_pdf/pdf_print_utils.cc",
|
||||
"//components/printing/browser/print_to_pdf/pdf_print_utils.h",
|
||||
]
|
||||
@@ -262,7 +264,10 @@ static_library("chrome") {
|
||||
sources += [
|
||||
"//chrome/browser/printing/pdf_to_emf_converter.cc",
|
||||
"//chrome/browser/printing/pdf_to_emf_converter.h",
|
||||
"//chrome/browser/printing/printer_xml_parser_impl.cc",
|
||||
"//chrome/browser/printing/printer_xml_parser_impl.h",
|
||||
]
|
||||
deps += [ "//printing:printing_base" ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,20 +275,14 @@ static_library("chrome") {
|
||||
sources += [
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc",
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h",
|
||||
"//chrome/browser/ui/views/overlay/back_to_tab_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/back_to_tab_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/close_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/close_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/constants.h",
|
||||
"//chrome/browser/ui/views/overlay/document_overlay_window_views.cc",
|
||||
"//chrome/browser/ui/views/overlay/document_overlay_window_views.h",
|
||||
"//chrome/browser/ui/views/overlay/hang_up_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/hang_up_button.h",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_views.cc",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_views.h",
|
||||
"//chrome/browser/ui/views/overlay/playback_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/playback_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/resize_handle_button.cc",
|
||||
@@ -313,10 +312,10 @@ static_library("chrome") {
|
||||
"//chrome/browser/extensions/chrome_url_request_util.h",
|
||||
"//chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc",
|
||||
"//chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.h",
|
||||
"//chrome/renderer/extensions/extension_hooks_delegate.cc",
|
||||
"//chrome/renderer/extensions/extension_hooks_delegate.h",
|
||||
"//chrome/renderer/extensions/tabs_hooks_delegate.cc",
|
||||
"//chrome/renderer/extensions/tabs_hooks_delegate.h",
|
||||
"//chrome/renderer/extensions/api/extension_hooks_delegate.cc",
|
||||
"//chrome/renderer/extensions/api/extension_hooks_delegate.h",
|
||||
"//chrome/renderer/extensions/api/tabs_hooks_delegate.cc",
|
||||
"//chrome/renderer/extensions/api/tabs_hooks_delegate.h",
|
||||
]
|
||||
|
||||
if (enable_pdf_viewer) {
|
||||
@@ -400,6 +399,10 @@ source_set("chrome_spellchecker") {
|
||||
|
||||
if (enable_builtin_spellchecker) {
|
||||
sources += [
|
||||
"//chrome/browser/profiles/profile_keyed_service_factory.cc",
|
||||
"//chrome/browser/profiles/profile_keyed_service_factory.h",
|
||||
"//chrome/browser/profiles/profile_selections.cc",
|
||||
"//chrome/browser/profiles/profile_selections.h",
|
||||
"//chrome/browser/spellchecker/spell_check_host_chrome_impl.cc",
|
||||
"//chrome/browser/spellchecker/spell_check_host_chrome_impl.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_custom_dictionary.cc",
|
||||
|
||||
@@ -1509,7 +1509,6 @@ dock on macOS.
|
||||
|
||||
A `boolean` property that returns `true` if the app is packaged, `false` otherwise. For many apps, this property can be used to distinguish development and production environments.
|
||||
|
||||
[dock-menu]:https://developer.apple.com/macos/human-interface-guidelines/menus/dock-menus/
|
||||
[tasks]:https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
|
||||
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
|
||||
[electron-forge]: https://www.electronforge.io/
|
||||
|
||||
@@ -192,6 +192,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
macOS. Default is `false`.
|
||||
* `skipTaskbar` boolean (optional) _macOS_ _Windows_ - Whether to show the window in taskbar.
|
||||
Default is `false`.
|
||||
* `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control.
|
||||
* `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`.
|
||||
* `title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored.
|
||||
* `icon` ([NativeImage](native-image.md) | string) (optional) - The window icon. On Windows it is
|
||||
@@ -652,18 +653,36 @@ The following app commands are explicitly supported on Linux:
|
||||
* `browser-backward`
|
||||
* `browser-forward`
|
||||
|
||||
#### Event: 'scroll-touch-begin' _macOS_
|
||||
#### Event: 'scroll-touch-begin' _macOS_ _Deprecated_
|
||||
|
||||
Emitted when scroll wheel event phase has begun.
|
||||
|
||||
#### Event: 'scroll-touch-end' _macOS_
|
||||
> **Note**
|
||||
> This event is deprecated beginning in Electron 22.0.0. See [Breaking
|
||||
> Changes](breaking-changes.md#deprecated-browserwindow-scroll-touch--events)
|
||||
> for details of how to migrate to using the [WebContents
|
||||
> `input-event`](api/web-contents.md#event-input-event) event.
|
||||
|
||||
#### Event: 'scroll-touch-end' _macOS_ _Deprecated_
|
||||
|
||||
Emitted when scroll wheel event phase has ended.
|
||||
|
||||
#### Event: 'scroll-touch-edge' _macOS_
|
||||
> **Note**
|
||||
> This event is deprecated beginning in Electron 22.0.0. See [Breaking
|
||||
> Changes](breaking-changes.md#deprecated-browserwindow-scroll-touch--events)
|
||||
> for details of how to migrate to using the [WebContents
|
||||
> `input-event`](api/web-contents.md#event-input-event) event.
|
||||
|
||||
#### Event: 'scroll-touch-edge' _macOS_ _Deprecated_
|
||||
|
||||
Emitted when scroll wheel event phase filed upon reaching the edge of element.
|
||||
|
||||
> **Note**
|
||||
> This event is deprecated beginning in Electron 22.0.0. See [Breaking
|
||||
> Changes](breaking-changes.md#deprecated-browserwindow-scroll-touch--events)
|
||||
> for details of how to migrate to using the [WebContents
|
||||
> `input-event`](api/web-contents.md#event-input-event) event.
|
||||
|
||||
#### Event: 'swipe' _macOS_
|
||||
|
||||
Returns:
|
||||
@@ -1237,6 +1256,16 @@ Returns `boolean` - Whether the window can be manually closed by user.
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
#### `win.setHiddenInMissionControl(hidden)` _macOS_
|
||||
|
||||
* `hidden` boolean
|
||||
|
||||
Sets whether the window will be hidden when the user toggles into mission control.
|
||||
|
||||
#### `win.isHiddenInMissionControl()` _macOS_
|
||||
|
||||
Returns `boolean` - Whether the window will be hidden when the user toggles into mission control.
|
||||
|
||||
#### `win.setAlwaysOnTop(flag[, level][, relativeLevel])`
|
||||
|
||||
* `flag` boolean
|
||||
@@ -1419,13 +1448,16 @@ Returns `boolean` - Whether the window's document has been edited.
|
||||
|
||||
#### `win.blurWebView()`
|
||||
|
||||
#### `win.capturePage([rect])`
|
||||
#### `win.capturePage([rect, opts])`
|
||||
|
||||
* `rect` [Rectangle](structures/rectangle.md) (optional) - The bounds to capture
|
||||
* `opts` Object (optional)
|
||||
* `stayHidden` boolean (optional) - Keep the page hidden instead of visible. Default is `false`.
|
||||
* `stayAwake` boolean (optional) - Keep the system awake instead of allowing it to sleep. Default is `false`.
|
||||
|
||||
Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)
|
||||
|
||||
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page. If the page is not visible, `rect` may be empty.
|
||||
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page. If the page is not visible, `rect` may be empty. The page is considered visible when its browser window is hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that `stayHidden` is set to true.
|
||||
|
||||
#### `win.loadURL(url[, options])`
|
||||
|
||||
@@ -1533,6 +1565,13 @@ screen readers
|
||||
Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
|
||||
convey some sort of application status or to passively notify the user.
|
||||
|
||||
#### `win.invalidateShadow()` _macOS_
|
||||
|
||||
Invalidates the window shadow so that it is recomputed based on the current window shape.
|
||||
|
||||
`BrowserWindows` that are transparent can sometimes leave behind visual artifacts on macOS.
|
||||
This method can be used to clear these artifacts when, for example, performing an animation.
|
||||
|
||||
#### `win.setHasShadow(hasShadow)`
|
||||
|
||||
* `hasShadow` boolean
|
||||
|
||||
@@ -46,6 +46,12 @@ The `contextBridge` module has the following methods:
|
||||
* `apiKey` string - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`.
|
||||
* `api` any - Your API, more information on what this API can be and how it works is available below.
|
||||
|
||||
### `contextBridge.exposeInIsolatedWorld(worldId, apiKey, api)`
|
||||
|
||||
* `worldId` Integer - The ID of the world to inject the API into. `0` is the default world, `999` is the world used by Electron's `contextIsolation` feature. Using 999 would expose the object for preload context. We recommend using 1000+ while creating isolated world.
|
||||
* `apiKey` string - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`.
|
||||
* `api` any - Your API, more information on what this API can be and how it works is available below.
|
||||
|
||||
## Usage
|
||||
|
||||
### API
|
||||
@@ -84,6 +90,26 @@ contextBridge.exposeInMainWorld(
|
||||
)
|
||||
```
|
||||
|
||||
An example of `exposeInIsolatedWorld` is shown below:
|
||||
|
||||
```javascript
|
||||
const { contextBridge, ipcRenderer } = require('electron')
|
||||
|
||||
contextBridge.exposeInIsolatedWorld(
|
||||
1004,
|
||||
'electron',
|
||||
{
|
||||
doThing: () => ipcRenderer.send('do-a-thing')
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
```javascript
|
||||
// Renderer (In isolated world id1004)
|
||||
|
||||
window.electron.doThing()
|
||||
```
|
||||
|
||||
### API Functions
|
||||
|
||||
`Function` values that you bind through the `contextBridge` are proxied through Electron to ensure that contexts remain isolated. This
|
||||
|
||||
@@ -79,3 +79,5 @@ Returns `Menu | null` - The application's [dock menu][dock-menu].
|
||||
* `image` ([NativeImage](native-image.md) | string)
|
||||
|
||||
Sets the `image` associated with this dock icon.
|
||||
|
||||
[dock-menu]: https://developer.apple.com/macos/human-interface-guidelines/menus/dock-menus/
|
||||
|
||||
@@ -20,7 +20,7 @@ work). Extensions are installed per-`session`. To load an extension, call
|
||||
```js
|
||||
const { session } = require('electron')
|
||||
|
||||
session.loadExtension('path/to/unpacked/extension').then(({ id }) => {
|
||||
session.defaultSession.loadExtension('path/to/unpacked/extension').then(({ id }) => {
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
@@ -21,10 +21,12 @@ Returns:
|
||||
|
||||
The `inAppPurchase` module has the following methods:
|
||||
|
||||
### `inAppPurchase.purchaseProduct(productID[, quantity])`
|
||||
### `inAppPurchase.purchaseProduct(productID[, opts])`
|
||||
|
||||
* `productID` string - The identifiers of the product to purchase. (The identifier of `com.example.app.product1` is `product1`).
|
||||
* `quantity` Integer (optional) - The number of items the user wants to purchase.
|
||||
* `productID` string
|
||||
* `opts` Integer | Object (optional) - If specified as an integer, defines the quantity.
|
||||
* `quantity` Integer (optional) - The number of items the user wants to purchase.
|
||||
* `username` string (optional) - The string that associates the transaction with a user account on your service (applicationUsername).
|
||||
|
||||
Returns `Promise<boolean>` - Returns `true` if the product is valid and added to the payment queue.
|
||||
|
||||
|
||||
@@ -56,3 +56,4 @@ Emitted when the remote end of a MessagePortMain object becomes disconnected.
|
||||
|
||||
[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort
|
||||
[Channel Messaging API]: https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
|
||||
@@ -54,7 +54,7 @@ The `net` module has the following methods:
|
||||
|
||||
### `net.request(options)`
|
||||
|
||||
* `options` (ClientRequestConstructorOptions | string) - The `ClientRequest` constructor options.
|
||||
* `options` ([ClientRequestConstructorOptions](client-request.md#new-clientrequestoptions) | string) - The `ClientRequest` constructor options.
|
||||
|
||||
Returns [`ClientRequest`](./client-request.md)
|
||||
|
||||
|
||||
48
docs/api/parent-port.md
Normal file
48
docs/api/parent-port.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# parentPort
|
||||
|
||||
> Interface for communication with parent process.
|
||||
|
||||
Process: [Utility](../glossary.md#utility-process)
|
||||
|
||||
`parentPort` is an [EventEmitter][event-emitter].
|
||||
_This object is not exported from the `'electron'` module. It is only available as a property of the process object in the Electron API._
|
||||
|
||||
```js
|
||||
// Main process
|
||||
const child = utilityProcess.fork(path.join(__dirname, 'test.js'))
|
||||
child.postMessage({ message: 'hello' })
|
||||
child.on('message', (data) => {
|
||||
console.log(data) // hello world!
|
||||
})
|
||||
|
||||
// Child process
|
||||
process.parentPort.on('message', (e) => {
|
||||
process.parentPort.postMessage(`${e.data} world!`)
|
||||
})
|
||||
```
|
||||
|
||||
## Events
|
||||
|
||||
The `parentPort` object emits the following events:
|
||||
|
||||
### Event: 'message'
|
||||
|
||||
Returns:
|
||||
|
||||
* `messageEvent` Object
|
||||
* `data` any
|
||||
* `ports` MessagePortMain[]
|
||||
|
||||
Emitted when the process receives a message. Messages received on
|
||||
this port will be queued up until a handler is registered for this
|
||||
event.
|
||||
|
||||
## Methods
|
||||
|
||||
### `parentPort.postMessage(message)`
|
||||
|
||||
* `message` any
|
||||
|
||||
Sends a message from the process to its parent.
|
||||
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
@@ -113,6 +113,7 @@ A `string` representing the current process's type, can be:
|
||||
* `browser` - The main process
|
||||
* `renderer` - A renderer process
|
||||
* `worker` - In a web worker
|
||||
* `utility` - In a node process launched as a service
|
||||
|
||||
### `process.versions.chrome` _Readonly_
|
||||
|
||||
@@ -134,6 +135,11 @@ Each frame has its own JavaScript context. When contextIsolation is enabled, the
|
||||
world also has a separate JavaScript context.
|
||||
This property is only available in the renderer process.
|
||||
|
||||
### `process.parentPort`
|
||||
|
||||
A [`Electron.ParentPort`](parent-port.md) property if this is a [`UtilityProcess`](utility-process.md)
|
||||
(or `null` otherwise) allowing communication with the parent process.
|
||||
|
||||
## Methods
|
||||
|
||||
The `process` object has the following methods:
|
||||
|
||||
@@ -239,7 +239,7 @@ app.whenReady().then(() => {
|
||||
const selectedDevice = details.deviceList.find((device) => {
|
||||
return device.vendorId === '9025' && device.productId === '67'
|
||||
})
|
||||
callback(selectedPort?.deviceId)
|
||||
callback(selectedDevice?.deviceId)
|
||||
})
|
||||
})
|
||||
```
|
||||
@@ -385,6 +385,162 @@ callback from `select-serial-port` is called. This event is intended for use
|
||||
when using a UI to ask users to pick a port so that the UI can be updated
|
||||
to remove the specified port.
|
||||
|
||||
#### Event: 'serial-port-revoked'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `port` [SerialPort](structures/serial-port.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md)
|
||||
* `origin` string - The origin that the device has been revoked from.
|
||||
|
||||
Emitted after `SerialPort.forget()` has been called. This event can be used
|
||||
to help maintain persistent storage of permissions when `setDevicePermissionHandler` is used.
|
||||
|
||||
```js
|
||||
// Browser Process
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600
|
||||
})
|
||||
|
||||
win.webContents.session.on('serial-port-revoked', (event, details) => {
|
||||
console.log(`Access revoked for serial device from origin ${details.origin}`)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
```js
|
||||
// Renderer Process
|
||||
|
||||
const portConnect = async () => {
|
||||
// Request a port.
|
||||
const port = await navigator.serial.requestPort()
|
||||
|
||||
// Wait for the serial port to open.
|
||||
await port.open({ baudRate: 9600 })
|
||||
|
||||
// ...later, revoke access to the serial port.
|
||||
await port.forget()
|
||||
}
|
||||
```
|
||||
|
||||
#### Event: 'select-usb-device'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `deviceList` [USBDevice[]](structures/usb-device.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md)
|
||||
* `callback` Function
|
||||
* `deviceId` string (optional)
|
||||
|
||||
Emitted when a USB device needs to be selected when a call to
|
||||
`navigator.usb.requestDevice` is made. `callback` should be called with
|
||||
`deviceId` to be selected; passing no arguments to `callback` will
|
||||
cancel the request. Additionally, permissioning on `navigator.usb` can
|
||||
be further managed by using [ses.setPermissionCheckHandler(handler)](#sessetpermissioncheckhandlerhandler)
|
||||
and [ses.setDevicePermissionHandler(handler)`](#sessetdevicepermissionhandlerhandler).
|
||||
|
||||
```javascript
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
let win = null
|
||||
|
||||
app.whenReady().then(() => {
|
||||
win = new BrowserWindow()
|
||||
|
||||
win.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin, details) => {
|
||||
if (permission === 'usb') {
|
||||
// Add logic here to determine if permission should be given to allow USB selection
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
// Optionally, retrieve previously persisted devices from a persistent store (fetchGrantedDevices needs to be implemented by developer to fetch persisted permissions)
|
||||
const grantedDevices = fetchGrantedDevices()
|
||||
|
||||
win.webContents.session.setDevicePermissionHandler((details) => {
|
||||
if (new URL(details.origin).hostname === 'some-host' && details.deviceType === 'usb') {
|
||||
if (details.device.vendorId === 123 && details.device.productId === 345) {
|
||||
// Always allow this type of device (this allows skipping the call to `navigator.usb.requestDevice` first)
|
||||
return true
|
||||
}
|
||||
|
||||
// Search through the list of devices that have previously been granted permission
|
||||
return grantedDevices.some((grantedDevice) => {
|
||||
return grantedDevice.vendorId === details.device.vendorId &&
|
||||
grantedDevice.productId === details.device.productId &&
|
||||
grantedDevice.serialNumber && grantedDevice.serialNumber === details.device.serialNumber
|
||||
})
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
win.webContents.session.on('select-usb-device', (event, details, callback) => {
|
||||
event.preventDefault()
|
||||
const selectedDevice = details.deviceList.find((device) => {
|
||||
return device.vendorId === '9025' && device.productId === '67'
|
||||
})
|
||||
if (selectedDevice) {
|
||||
// Optionally, add this to the persisted devices (updateGrantedDevices needs to be implemented by developer to persist permissions)
|
||||
grantedDevices.push(selectedDevice)
|
||||
updateGrantedDevices(grantedDevices)
|
||||
}
|
||||
callback(selectedDevice?.deviceId)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
#### Event: 'usb-device-added'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `device` [USBDevice](structures/usb-device.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md)
|
||||
|
||||
Emitted after `navigator.usb.requestDevice` has been called and
|
||||
`select-usb-device` has fired if a new device becomes available before
|
||||
the callback from `select-usb-device` is called. This event is intended for
|
||||
use when using a UI to ask users to pick a device so that the UI can be updated
|
||||
with the newly added device.
|
||||
|
||||
#### Event: 'usb-device-removed'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `device` [USBDevice](structures/usb-device.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md)
|
||||
|
||||
Emitted after `navigator.usb.requestDevice` has been called and
|
||||
`select-usb-device` has fired if a device has been removed before the callback
|
||||
from `select-usb-device` is called. This event is intended for use when using
|
||||
a UI to ask users to pick a device so that the UI can be updated to remove the
|
||||
specified device.
|
||||
|
||||
#### Event: 'usb-device-revoked'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `device` [USBDevice[]](structures/usb-device.md)
|
||||
* `origin` string (optional) - The origin that the device has been revoked from.
|
||||
|
||||
Emitted after `USBDevice.forget()` has been called. This event can be used
|
||||
to help maintain persistent storage of permissions when
|
||||
`setDevicePermissionHandler` is used.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
The following methods are available on instances of `Session`:
|
||||
@@ -409,7 +565,7 @@ Clears the session’s HTTP cache.
|
||||
`shadercache`, `websql`, `serviceworkers`, `cachestorage`. If not
|
||||
specified, clear all storage types.
|
||||
* `quotas` string[] (optional) - The types of quotas to clear, can contain:
|
||||
`temporary`, `persistent`, `syncable`. If not specified, clear all quotas.
|
||||
`temporary`, `syncable`. If not specified, clear all quotas.
|
||||
|
||||
Returns `Promise<void>` - resolves when the storage data has been cleared.
|
||||
|
||||
@@ -670,7 +826,7 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
|
||||
|
||||
* `handler` Function\<boolean> | null
|
||||
* `webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. All cross origin sub frames making permission checks will pass a `null` webContents to this handler, while certain other permission checks such as `notifications` checks will always pass `null`. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
|
||||
* `permission` string - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, `hid`, or `serial`.
|
||||
* `permission` string - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, `hid`, `serial`, or `usb`.
|
||||
* `requestingOrigin` string - The origin URL of the permission check
|
||||
* `details` Object - Some properties are only available on certain permission types.
|
||||
* `embeddingOrigin` string (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
|
||||
@@ -698,11 +854,65 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
|
||||
})
|
||||
```
|
||||
|
||||
#### `ses.setDisplayMediaRequestHandler(handler)`
|
||||
|
||||
* `handler` Function | null
|
||||
* `request` Object
|
||||
* `frame` [WebFrameMain](web-frame-main.md) - Frame that is requesting access to media.
|
||||
* `securityOrigin` String - Origin of the page making the request.
|
||||
* `videoRequested` Boolean - true if the web content requested a video stream.
|
||||
* `audioRequested` Boolean - true if the web content requested an audio stream.
|
||||
* `userGesture` Boolean - Whether a user gesture was active when this request was triggered.
|
||||
* `callback` Function
|
||||
* `streams` Object
|
||||
* `video` Object | [WebFrameMain](web-frame-main.md) (optional)
|
||||
* `id` String - The id of the stream being granted. This will usually
|
||||
come from a [DesktopCapturerSource](structures/desktop-capturer-source.md)
|
||||
object.
|
||||
* `name` String - The name of the stream being granted. This will
|
||||
usually come from a [DesktopCapturerSource](structures/desktop-capturer-source.md)
|
||||
object.
|
||||
* `audio` String | [WebFrameMain](web-frame-main.md) (optional) - If
|
||||
a string is specified, can be `loopback` or `loopbackWithMute`.
|
||||
Specifying a loopback device will capture system audio, and is
|
||||
currently only supported on Windows. If a WebFrameMain is specified,
|
||||
will capture audio from that frame.
|
||||
|
||||
This handler will be called when web content requests access to display media
|
||||
via the `navigator.mediaDevices.getDisplayMedia` API. Use the
|
||||
[desktopCapturer](desktop-capturer.md) API to choose which stream(s) to grant
|
||||
access to.
|
||||
|
||||
```javascript
|
||||
const { session, desktopCapturer } = require('electron')
|
||||
|
||||
session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
|
||||
desktopCapturer.getSources({ types: ['screen'] }).then((sources) => {
|
||||
// Grant access to the first screen found.
|
||||
callback({ video: sources[0] })
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
Passing a [WebFrameMain](web-frame-main.md) object as a video or audio stream
|
||||
will capture the video or audio stream from that frame.
|
||||
|
||||
```javascript
|
||||
const { session } = require('electron')
|
||||
|
||||
session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
|
||||
// Allow the tab to capture itself.
|
||||
callback({ video: request.frame })
|
||||
})
|
||||
```
|
||||
|
||||
Passing `null` instead of a function resets the handler to its default state.
|
||||
|
||||
#### `ses.setDevicePermissionHandler(handler)`
|
||||
|
||||
* `handler` Function\<boolean> | null
|
||||
* `details` Object
|
||||
* `deviceType` string - The type of device that permission is being requested on, can be `hid` or `serial`.
|
||||
* `deviceType` string - The type of device that permission is being requested on, can be `hid`, `serial`, or `usb`.
|
||||
* `origin` string - The origin URL of the device permission check.
|
||||
* `device` [HIDDevice](structures/hid-device.md) | [SerialPort](structures/serial-port.md)- the device that permission is being requested for.
|
||||
|
||||
@@ -730,6 +940,8 @@ app.whenReady().then(() => {
|
||||
return true
|
||||
} else if (permission === 'serial') {
|
||||
// Add logic here to determine if permission should be given to allow serial port selection
|
||||
} else if (permission === 'usb') {
|
||||
// Add logic here to determine if permission should be given to allow USB device selection
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
* `id` string - The identifier of a window or screen that can be used as a
|
||||
`chromeMediaSourceId` constraint when calling
|
||||
[`navigator.webkitGetUserMedia`]. The format of the identifier will be
|
||||
[`navigator.getUserMedia`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getUserMedia). The format of the identifier will be
|
||||
`window:XX:YY` or `screen:ZZ:0`. XX is the windowID/handle. YY is 1 for
|
||||
the current process, and 0 for all others. ZZ is a sequential number
|
||||
that represents the screen, and it does not equal to the index in the
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# InputEvent Object
|
||||
|
||||
* `type` string - Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`,
|
||||
`mouseEnter`, `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`,
|
||||
`keyDown`, `keyUp`, `char`, `gestureScrollBegin`, `gestureScrollEnd`,
|
||||
`gestureScrollUpdate`, `gestureFlingStart`, `gestureFlingCancel`,
|
||||
`gesturePinchBegin`, `gesturePinchEnd`, `gesturePinchUpdate`,
|
||||
`gestureTapDown`, `gestureShowPress`, `gestureTap`, `gestureTapCancel`,
|
||||
`gestureShortPress`, `gestureLongPress`, `gestureLongTap`,
|
||||
`gestureTwoFingerTap`, `gestureTapUnconfirmed`, `gestureDoubleTap`,
|
||||
`touchStart`, `touchMove`, `touchEnd`, `touchCancel`, `touchScrollStarted`,
|
||||
`pointerDown`, `pointerUp`, `pointerMove`, `pointerRawUpdate`,
|
||||
`pointerCancel` or `pointerCausedUaAction`.
|
||||
* `modifiers` string[] (optional) - An array of modifiers of the event, can
|
||||
be `shift`, `control`, `ctrl`, `alt`, `meta`, `command`, `cmd`, `isKeypad`,
|
||||
`isAutoRepeat`, `leftButtonDown`, `middleButtonDown`, `rightButtonDown`,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# KeyboardInputEvent Object extends `InputEvent`
|
||||
|
||||
* `type` string - The type of the event, can be `keyDown`, `keyUp` or `char`.
|
||||
* `type` string - The type of the event, can be `rawKeyDown`, `keyDown`, `keyUp` or `char`.
|
||||
* `keyCode` string - The character that will be sent
|
||||
as the keyboard event. Should only use the valid key codes in
|
||||
[Accelerator](../accelerator.md).
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# NewWindowWebContentsEvent Object extends `Event`
|
||||
|
||||
* `newGuest` BrowserWindow (optional)
|
||||
17
docs/api/structures/usb-device.md
Normal file
17
docs/api/structures/usb-device.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# USBDevice Object
|
||||
|
||||
* `deviceId` string - Unique identifier for the device.
|
||||
* `vendorId` Integer - The USB vendor ID.
|
||||
* `productId` Integer - The USB product ID.
|
||||
* `productName` string (optional) - Name of the device.
|
||||
* `serialNumber` string (optional) - The USB device serial number.
|
||||
* `manufacturerName` string (optional) - The manufacturer name of the device.
|
||||
* `usbVersionMajor` Integer - The USB protocol major version supported by the device
|
||||
* `usbVersionMinor` Integer - The USB protocol minor version supported by the device
|
||||
* `usbVersionSubminor` Integer - The USB protocol subminor version supported by the device
|
||||
* `deviceClass` Integer - The device class for the communication interface supported by the device
|
||||
* `deviceSubclass` Integer - The device subclass for the communication interface supported by the device
|
||||
* `deviceProtocol` Integer - The device protocol for the communication interface supported by the device
|
||||
* `deviceVersionMajor` Integer - The major version number of the device as defined by the device manufacturer.
|
||||
* `deviceVersionMinor` Integer - The minor version number of the device as defined by the device manufacturer.
|
||||
* `deviceVersionSubminor` Integer - The subminor version number of the device as defined by the device manufacturer.
|
||||
@@ -1,3 +1,3 @@
|
||||
# WebRequestFilter Object
|
||||
|
||||
* `urls` string[] - Array of URL patterns that will be used to filter out the requests that do not match the URL patterns.
|
||||
* `urls` string[] - Array of [URL patterns](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns) that will be used to filter out the requests that do not match the URL patterns.
|
||||
|
||||
@@ -441,7 +441,7 @@ It will always return `granted` for `screen` and for all media types on older ve
|
||||
|
||||
Returns `Promise<boolean>` - A promise that resolves with `true` if consent was granted and `false` if it was denied. If an invalid `mediaType` is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. If access has already been requested and denied, it _must_ be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.
|
||||
|
||||
**Important:** In order to properly leverage this API, you [must set](https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc) the `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your app's `Info.plist` file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See [Electron Application Distribution](../tutorial/application-distribution.md#macos) for more information about how to set these in the context of Electron.
|
||||
**Important:** In order to properly leverage this API, you [must set](https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc) the `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your app's `Info.plist` file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See [Electron Application Distribution](../tutorial/application-distribution.md#rebranding-with-downloaded-binaries) for more information about how to set these in the context of Electron.
|
||||
|
||||
This user consent was not required until macOS 10.14 Mojave, so this method will always return `true` if your system is running 10.13 High Sierra or lower.
|
||||
|
||||
|
||||
@@ -27,17 +27,14 @@ app.whenReady().then(() => {
|
||||
|
||||
__Platform Considerations__
|
||||
|
||||
If you want to keep exact same behaviors on all platforms, you should not
|
||||
rely on the `click` event; instead, always attach a context menu to the tray icon.
|
||||
|
||||
__Linux__
|
||||
|
||||
* On Linux distributions that only have app indicator support, you have to
|
||||
install `libappindicator1` to make the tray icon work.
|
||||
* The app indicator will be used if it is supported, otherwise
|
||||
`GtkStatusIcon` will be used instead.
|
||||
* App indicator will only be shown when it has a context menu.
|
||||
* The `click` event is ignored when using the app indicator.
|
||||
* Tray icon requires support of [StatusNotifierItem](https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/)
|
||||
in user's desktop environment.
|
||||
* The `click` event is emitted when the tray icon receives activation from
|
||||
user, however the StatusNotifierItem spec does not specify which action would
|
||||
cause an activation, for some environments it is left mouse click, but for
|
||||
some it might be double left mouse click.
|
||||
* In order for changes made to individual `MenuItem`s to take effect,
|
||||
you have to call `setContextMenu` again. For example:
|
||||
|
||||
@@ -92,6 +89,9 @@ Returns:
|
||||
|
||||
Emitted when the tray icon is clicked.
|
||||
|
||||
Note that on Linux this event is emitted when the tray icon receives an
|
||||
activation, which might not necessarily be left mouse click.
|
||||
|
||||
#### Event: 'right-click' _macOS_ _Windows_
|
||||
|
||||
Returns:
|
||||
|
||||
138
docs/api/utility-process.md
Normal file
138
docs/api/utility-process.md
Normal file
@@ -0,0 +1,138 @@
|
||||
# utilityProcess
|
||||
|
||||
`utilityProcess` creates a child process with
|
||||
Node.js and Message ports enabled. It provides the equivalent of [`child_process.fork`][] API from Node.js
|
||||
but instead uses [Services API][] from Chromium to launch the child process.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)<br />
|
||||
|
||||
## Methods
|
||||
|
||||
### `utilityProcess.fork(modulePath[, args][, options])`
|
||||
|
||||
* `modulePath` string - Path to the script that should run as entrypoint in the child process.
|
||||
* `args` string[] (optional) - List of string arguments that will be available as `process.argv`
|
||||
in the child process.
|
||||
* `options` Object (optional)
|
||||
* `env` Object (optional) - Environment key-value pairs. Default is `process.env`.
|
||||
* `execArgv` string[] (optional) - List of string arguments passed to the executable.
|
||||
* `cwd` string (optional) - Current working directory of the child process.
|
||||
* `stdio` (string[] | string) (optional) - Allows configuring the mode for `stdout` and `stderr`
|
||||
of the child process. Default is `inherit`.
|
||||
String value can be one of `pipe`, `ignore`, `inherit`, for more details on these values you can refer to
|
||||
[stdio][] documentation from Node.js. Currently this option only supports configuring `stdout` and
|
||||
`stderr` to either `pipe`, `inherit` or `ignore`. Configuring `stdin` is not supported; `stdin` will
|
||||
always be ignored.
|
||||
For example, the supported values will be processed as following:
|
||||
* `pipe`: equivalent to ['ignore', 'pipe', 'pipe'] (the default)
|
||||
* `ignore`: equivalent to 'ignore', 'ignore', 'ignore']
|
||||
* `inherit`: equivalent to ['ignore', 'inherit', 'inherit']
|
||||
* `serviceName` string (optional) - Name of the process that will appear in `name` property of
|
||||
[`child-process-gone` event of `app`](app.md#event-child-process-gone).
|
||||
Default is `node.mojom.NodeService`.
|
||||
* `allowLoadingUnsignedLibraries` boolean (optional) _macOS_ - With this flag, the utility process will be
|
||||
launched via the `Electron Helper (Plugin).app` helper executable on macOS, which can be
|
||||
codesigned with `com.apple.security.cs.disable-library-validation` and
|
||||
`com.apple.security.cs.allow-unsigned-executable-memory` entitlements. This will allow the utility process
|
||||
to load unsigned libraries. Unless you specifically need this capability, it is best to leave this disabled.
|
||||
Default is `false`.
|
||||
|
||||
Returns [`UtilityProcess`](utility-process.md#class-utilityprocess)
|
||||
|
||||
## Class: UtilityProcess
|
||||
|
||||
> Instances of the `UtilityProcess` represent the Chromium spawned child process
|
||||
> with Node.js integration.
|
||||
|
||||
`UtilityProcess` is an [EventEmitter][event-emitter].
|
||||
|
||||
### Instance Methods
|
||||
|
||||
#### `child.postMessage(message, [transfer])`
|
||||
|
||||
* `message` any
|
||||
* `transfer` MessagePortMain[] (optional)
|
||||
|
||||
Send a message to the child process, optionally transferring ownership of
|
||||
zero or more [`MessagePortMain`][] objects.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
// Main process
|
||||
const { port1, port2 } = new MessageChannelMain()
|
||||
const child = utilityProcess.fork(path.join(__dirname, 'test.js'))
|
||||
child.postMessage({ message: 'hello' }, [port1])
|
||||
|
||||
// Child process
|
||||
process.parentPort.once('message', (e) => {
|
||||
const [port] = e.ports
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
#### `child.kill()`
|
||||
|
||||
Returns `boolean`
|
||||
|
||||
Terminates the process gracefully. On POSIX, it uses SIGTERM
|
||||
but will ensure the process is reaped on exit. This function returns
|
||||
true if the kill is successful, and false otherwise.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
#### `child.pid`
|
||||
|
||||
A `Integer | undefined` representing the process identifier (PID) of the child process.
|
||||
If the child process fails to spawn due to errors, then the value is `undefined`. When
|
||||
the child process exits, then the value is `undefined` after the `exit` event is emitted.
|
||||
|
||||
#### `child.stdout`
|
||||
|
||||
A `NodeJS.ReadableStream | null` that represents the child process's stdout.
|
||||
If the child was spawned with options.stdio[1] set to anything other than 'pipe', then this will be `null`.
|
||||
When the child process exits, then the value is `null` after the `exit` event is emitted.
|
||||
|
||||
```js
|
||||
// Main process
|
||||
const { port1, port2 } = new MessageChannelMain()
|
||||
const child = utilityProcess.fork(path.join(__dirname, 'test.js'))
|
||||
child.stdout.on('data', (data) => {
|
||||
console.log(`Received chunk ${data}`)
|
||||
})
|
||||
```
|
||||
|
||||
#### `child.stderr`
|
||||
|
||||
A `NodeJS.ReadableStream | null` that represents the child process's stderr.
|
||||
If the child was spawned with options.stdio[2] set to anything other than 'pipe', then this will be `null`.
|
||||
When the child process exits, then the value is `null` after the `exit` event is emitted.
|
||||
|
||||
### Instance Events
|
||||
|
||||
#### Event: 'spawn'
|
||||
|
||||
Emitted once the child process has spawned successfully.
|
||||
|
||||
#### Event: 'exit'
|
||||
|
||||
Returns:
|
||||
|
||||
* `code` number - Contains the exit code for
|
||||
the process obtained from waitpid on posix, or GetExitCodeProcess on windows.
|
||||
|
||||
Emitted after the child process ends.
|
||||
|
||||
#### Event: 'message'
|
||||
|
||||
Returns:
|
||||
|
||||
* `message` any
|
||||
|
||||
Emitted when the child process sends a message using [`process.parentPort.postMessage()`](process.md#processparentport).
|
||||
|
||||
[`child_process.fork`]: https://nodejs.org/dist/latest-v16.x/docs/api/child_process.html#child_processforkmodulepath-args-options
|
||||
[Services API]: https://chromium.googlesource.com/chromium/src/+/master/docs/mojo_and_services.md
|
||||
[stdio]: https://nodejs.org/dist/latest/docs/api/child_process.html#optionsstdio
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[`MessagePortMain`]: message-port-main.md
|
||||
@@ -137,10 +137,6 @@ Corresponds to the points in time when the spinner of the tab stopped spinning.
|
||||
|
||||
#### Event: 'dom-ready'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
|
||||
Emitted when the document in the top-level frame is loaded.
|
||||
|
||||
#### Event: 'page-title-updated'
|
||||
@@ -163,63 +159,17 @@ Returns:
|
||||
|
||||
Emitted when page receives favicon urls.
|
||||
|
||||
#### Event: 'new-window' _Deprecated_
|
||||
#### Event: 'content-bounds-updated'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` NewWindowWebContentsEvent
|
||||
* `url` string
|
||||
* `frameName` string
|
||||
* `disposition` string - Can be `default`, `foreground-tab`, `background-tab`,
|
||||
`new-window`, `save-to-disk` and `other`.
|
||||
* `options` BrowserWindowConstructorOptions - The options which will be used for creating the new
|
||||
[`BrowserWindow`](browser-window.md).
|
||||
* `additionalFeatures` string[] - The non-standard features (features not handled
|
||||
by Chromium or Electron) given to `window.open()`. Deprecated, and will now
|
||||
always be the empty array `[]`.
|
||||
* `referrer` [Referrer](structures/referrer.md) - The referrer that will be
|
||||
passed to the new window. May or may not result in the `Referer` header being
|
||||
sent, depending on the referrer policy.
|
||||
* `postBody` [PostBody](structures/post-body.md) (optional) - The post data that
|
||||
will be sent to the new window, along with the appropriate headers that will
|
||||
be set. If no post data is to be sent, the value will be `null`. Only defined
|
||||
when the window is being created by a form that set `target=_blank`.
|
||||
* `event` Event
|
||||
* `bounds` [Rectangle](structures/rectangle.md) - requested new content bounds
|
||||
|
||||
Deprecated in favor of [`webContents.setWindowOpenHandler`](web-contents.md#contentssetwindowopenhandlerhandler).
|
||||
Emitted when the page calls `window.moveTo`, `window.resizeTo` or related APIs.
|
||||
|
||||
Emitted when the page requests to open a new window for a `url`. It could be
|
||||
requested by `window.open` or an external link like `<a target='_blank'>`.
|
||||
|
||||
By default a new `BrowserWindow` will be created for the `url`.
|
||||
|
||||
Calling `event.preventDefault()` will prevent Electron from automatically creating a
|
||||
new [`BrowserWindow`](browser-window.md). If you call `event.preventDefault()` and manually create a new
|
||||
[`BrowserWindow`](browser-window.md) then you must set `event.newGuest` to reference the new [`BrowserWindow`](browser-window.md)
|
||||
instance, failing to do so may result in unexpected behavior. For example:
|
||||
|
||||
```javascript
|
||||
myBrowserWindow.webContents.on('new-window', (event, url, frameName, disposition, options, additionalFeatures, referrer, postBody) => {
|
||||
event.preventDefault()
|
||||
const win = new BrowserWindow({
|
||||
webContents: options.webContents, // use existing webContents if provided
|
||||
show: false
|
||||
})
|
||||
win.once('ready-to-show', () => win.show())
|
||||
if (!options.webContents) {
|
||||
const loadOptions = {
|
||||
httpReferrer: referrer
|
||||
}
|
||||
if (postBody != null) {
|
||||
const { data, contentType, boundary } = postBody
|
||||
loadOptions.postData = postBody.data
|
||||
loadOptions.extraHeaders = `content-type: ${contentType}; boundary=${boundary}`
|
||||
}
|
||||
|
||||
win.loadURL(url, loadOptions) // existing webContents will be navigated automatically
|
||||
}
|
||||
event.newGuest = win
|
||||
})
|
||||
```
|
||||
By default, this will move the window. To prevent that behavior, call
|
||||
`event.preventDefault()`.
|
||||
|
||||
#### Event: 'did-create-window'
|
||||
|
||||
@@ -461,6 +411,16 @@ Emitted when a plugin process has crashed.
|
||||
|
||||
Emitted when `webContents` is destroyed.
|
||||
|
||||
#### Event: 'input-event'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `inputEvent` [InputEvent](structures/input-event.md)
|
||||
|
||||
Emitted when an input event is sent to the WebContents. See
|
||||
[InputEvent](structures/input-event.md) for details.
|
||||
|
||||
#### Event: 'before-input-event'
|
||||
|
||||
Returns:
|
||||
@@ -991,6 +951,21 @@ Returns `string` - The title of the current web page.
|
||||
|
||||
Returns `boolean` - Whether the web page is destroyed.
|
||||
|
||||
#### `contents.close([opts])`
|
||||
|
||||
* `opts` Object (optional)
|
||||
* `waitForBeforeUnload` boolean - if true, fire the `beforeunload` event
|
||||
before closing the page. If the page prevents the unload, the WebContents
|
||||
will not be closed. The [`will-prevent-unload`](#event-will-prevent-unload)
|
||||
will be fired if the page requests prevention of unload.
|
||||
|
||||
Closes the page, as if the web content had called `window.close()`.
|
||||
|
||||
If the page is successfully closed (i.e. the unload is not prevented by the
|
||||
page, or `waitForBeforeUnload` is false or unspecified), the WebContents will
|
||||
be destroyed and no longer usable. The [`destroyed`](#event-destroyed) event
|
||||
will be emitted.
|
||||
|
||||
#### `contents.focus()`
|
||||
|
||||
Focuses the web page.
|
||||
@@ -1180,7 +1155,7 @@ Ignore application menu shortcuts while this web contents is focused.
|
||||
|
||||
#### `contents.setWindowOpenHandler(handler)`
|
||||
|
||||
* `handler` Function<{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}>
|
||||
* `handler` Function<{action: 'deny'} | {action: 'allow', outlivesOpener?: boolean, overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}>
|
||||
* `details` Object
|
||||
* `url` string - The _resolved_ version of the URL passed to `window.open()`. e.g. opening a window with `window.open('foo')` will yield something like `https://the-origin/the/current/path/foo`.
|
||||
* `frameName` string - Name of the window provided in `window.open()`
|
||||
@@ -1195,8 +1170,11 @@ Ignore application menu shortcuts while this web contents is focused.
|
||||
be set. If no post data is to be sent, the value will be `null`. Only defined
|
||||
when the window is being created by a form that set `target=_blank`.
|
||||
|
||||
Returns `{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}` - `deny` cancels the creation of the new
|
||||
Returns `{action: 'deny'} | {action: 'allow', outlivesOpener?: boolean, overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}` - `deny` cancels the creation of the new
|
||||
window. `allow` will allow the new window to be created. Specifying `overrideBrowserWindowOptions` allows customization of the created window.
|
||||
By default, child windows are closed when their opener is closed. This can be
|
||||
changed by specifying `outlivesOpener: true`, in which case the opened window
|
||||
will not be closed when its opener is closed.
|
||||
Returning an unrecognized value such as a null, undefined, or an object
|
||||
without a recognized 'action' value will result in a console error and have
|
||||
the same effect as returning `{action: 'deny'}`.
|
||||
@@ -1363,20 +1341,25 @@ const requestId = webContents.findInPage('api')
|
||||
console.log(requestId)
|
||||
```
|
||||
|
||||
#### `contents.capturePage([rect])`
|
||||
#### `contents.capturePage([rect, opts])`
|
||||
|
||||
* `rect` [Rectangle](structures/rectangle.md) (optional) - The area of the page to be captured.
|
||||
* `opts` Object (optional)
|
||||
* `stayHidden` boolean (optional) - Keep the page hidden instead of visible. Default is `false`.
|
||||
* `stayAwake` boolean (optional) - Keep the system awake instead of allowing it to sleep. Default is `false`.
|
||||
|
||||
Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)
|
||||
|
||||
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page.
|
||||
The page is considered visible when its browser window is hidden and the capturer count is non-zero.
|
||||
If you would like the page to stay hidden, you should ensure that `stayHidden` is set to true.
|
||||
|
||||
#### `contents.isBeingCaptured()`
|
||||
|
||||
Returns `boolean` - Whether this page is being captured. It returns true when the capturer count
|
||||
is large then 0.
|
||||
|
||||
#### `contents.incrementCapturerCount([size, stayHidden, stayAwake])`
|
||||
#### `contents.incrementCapturerCount([size, stayHidden, stayAwake])` _Deprecated_
|
||||
|
||||
* `size` [Size](structures/size.md) (optional) - The preferred size for the capturer.
|
||||
* `stayHidden` boolean (optional) - Keep the page hidden instead of visible.
|
||||
@@ -1387,7 +1370,9 @@ hidden and the capturer count is non-zero. If you would like the page to stay hi
|
||||
|
||||
This also affects the Page Visibility API.
|
||||
|
||||
#### `contents.decrementCapturerCount([stayHidden, stayAwake])`
|
||||
**Deprecated:** This API's functionality is now handled automatically within `contents.capturePage()`. See [breaking changes](../breaking-changes.md).
|
||||
|
||||
#### `contents.decrementCapturerCount([stayHidden, stayAwake])` _Deprecated_
|
||||
|
||||
* `stayHidden` boolean (optional) - Keep the page in hidden state instead of visible.
|
||||
* `stayAwake` boolean (optional) - Keep the system awake instead of allowing it to sleep.
|
||||
@@ -1396,6 +1381,9 @@ Decrease the capturer count by one. The page will be set to hidden or occluded s
|
||||
browser window is hidden or occluded and the capturer count reaches zero. If you want to
|
||||
decrease the hidden capturer count instead you should set `stayHidden` to true.
|
||||
|
||||
**Deprecated:** This API's functionality is now handled automatically within `contents.capturePage()`.
|
||||
See [breaking changes](../breaking-changes.md).
|
||||
|
||||
#### `contents.getPrinters()` _Deprecated_
|
||||
|
||||
Get the system printer list.
|
||||
@@ -2095,3 +2083,4 @@ with open(), or by navigating a link with a target attribute.
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
||||
[`MessagePortMain`]: message-port-main.md
|
||||
|
||||
@@ -233,3 +233,4 @@ See also how the [Page Visibility API](browser-window.md#page-visibility) is aff
|
||||
|
||||
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
||||
[`MessagePortMain`]: message-port-main.md
|
||||
|
||||
@@ -805,33 +805,6 @@ const requestId = webview.findInPage('test')
|
||||
console.log(requestId)
|
||||
```
|
||||
|
||||
### Event: 'new-window'
|
||||
|
||||
Returns:
|
||||
|
||||
* `url` string
|
||||
* `frameName` string
|
||||
* `disposition` string - Can be `default`, `foreground-tab`, `background-tab`,
|
||||
`new-window`, `save-to-disk` and `other`.
|
||||
* `options` BrowserWindowConstructorOptions - The options which should be used for creating the new
|
||||
[`BrowserWindow`](browser-window.md).
|
||||
|
||||
Fired when the guest page attempts to open a new browser window.
|
||||
|
||||
The following example code opens the new url in system's default browser.
|
||||
|
||||
```javascript
|
||||
const { shell } = require('electron')
|
||||
const webview = document.querySelector('webview')
|
||||
|
||||
webview.addEventListener('new-window', async (e) => {
|
||||
const protocol = (new URL(e.url)).protocol
|
||||
if (protocol === 'http:' || protocol === 'https:') {
|
||||
await shell.openExternal(e.url)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Event: 'will-navigate'
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -12,7 +12,165 @@ 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 (20.0)
|
||||
## Planned Breaking API Changes (23.0)
|
||||
|
||||
### Removed: Windows 7 / 8 / 8.1 support
|
||||
|
||||
[Windows 7, Windows 8, and Windows 8.1 are no longer supported](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice). Electron follows the planned Chromium deprecation policy, which will [deprecate Windows 7 support beginning in Chromium 109](https://support.google.com/chrome/thread/185534985/sunsetting-support-for-windows-7-8-8-1-in-early-2023?hl=en).
|
||||
|
||||
Older versions of Electron will continue to run on these operating systems, but Windows 10 or later will be required to run Electron v23.0.0 and higher.
|
||||
|
||||
### Removed: BrowserWindow `scroll-touch-*` events
|
||||
|
||||
The deprecated `scroll-touch-begin`, `scroll-touch-end` and `scroll-touch-edge`
|
||||
events on BrowserWindow have been removed. Instead, use the newly available
|
||||
[`input-event` event](api/web-contents.md#event-input-event) on WebContents.
|
||||
|
||||
```js
|
||||
// Removed in Electron 23.0
|
||||
win.on('scroll-touch-begin', scrollTouchBegin)
|
||||
win.on('scroll-touch-edge', scrollTouchEdge)
|
||||
win.on('scroll-touch-end', scrollTouchEnd)
|
||||
|
||||
// Replace with
|
||||
win.webContents.on('input-event', (_, event) => {
|
||||
if (event.type === 'gestureScrollBegin') {
|
||||
scrollTouchBegin()
|
||||
} else if (event.type === 'gestureScrollUpdate') {
|
||||
scrollTouchEdge()
|
||||
} else if (event.type === 'gestureScrollEnd') {
|
||||
scrollTouchEnd()
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Removed: `webContents.incrementCapturerCount(stayHidden, stayAwake)`
|
||||
|
||||
The `webContents.incrementCapturerCount(stayHidden, stayAwake)` function has been removed.
|
||||
It is now automatically handled by `webContents.capturePage` when a page capture completes.
|
||||
|
||||
```js
|
||||
const w = new BrowserWindow({ show: false })
|
||||
|
||||
// Removed in Electron 23
|
||||
w.webContents.incrementCapturerCount()
|
||||
w.capturePage().then(image => {
|
||||
console.log(image.toDataURL())
|
||||
w.webContents.decrementCapturerCount()
|
||||
})
|
||||
|
||||
// Replace with
|
||||
w.capturePage().then(image => {
|
||||
console.log(image.toDataURL())
|
||||
})
|
||||
```
|
||||
|
||||
### Removed: `webContents.decrementCapturerCount(stayHidden, stayAwake)`
|
||||
|
||||
The `webContents.decrementCapturerCount(stayHidden, stayAwake)` function has been removed.
|
||||
It is now automatically handled by `webContents.capturePage` when a page capture completes.
|
||||
|
||||
```js
|
||||
const w = new BrowserWindow({ show: false })
|
||||
|
||||
// Removed in Electron 23
|
||||
w.webContents.incrementCapturerCount()
|
||||
w.capturePage().then(image => {
|
||||
console.log(image.toDataURL())
|
||||
w.webContents.decrementCapturerCount()
|
||||
})
|
||||
|
||||
// Replace with
|
||||
w.capturePage().then(image => {
|
||||
console.log(image.toDataURL())
|
||||
})
|
||||
```
|
||||
|
||||
## Planned Breaking API Changes (22.0)
|
||||
|
||||
### Deprecated: `webContents.incrementCapturerCount(stayHidden, stayAwake)`
|
||||
|
||||
`webContents.incrementCapturerCount(stayHidden, stayAwake)` has been deprecated.
|
||||
It is now automatically handled by `webContents.capturePage` when a page capture completes.
|
||||
|
||||
```js
|
||||
const w = new BrowserWindow({ show: false })
|
||||
|
||||
// Removed in Electron 23
|
||||
w.webContents.incrementCapturerCount()
|
||||
w.capturePage().then(image => {
|
||||
console.log(image.toDataURL())
|
||||
w.webContents.decrementCapturerCount()
|
||||
})
|
||||
|
||||
// Replace with
|
||||
w.capturePage().then(image => {
|
||||
console.log(image.toDataURL())
|
||||
})
|
||||
```
|
||||
|
||||
### Deprecated: `webContents.decrementCapturerCount(stayHidden, stayAwake)`
|
||||
|
||||
`webContents.decrementCapturerCount(stayHidden, stayAwake)` has been deprecated.
|
||||
It is now automatically handled by `webContents.capturePage` when a page capture completes.
|
||||
|
||||
```js
|
||||
const w = new BrowserWindow({ show: false })
|
||||
|
||||
// Removed in Electron 23
|
||||
w.webContents.incrementCapturerCount()
|
||||
w.capturePage().then(image => {
|
||||
console.log(image.toDataURL())
|
||||
w.webContents.decrementCapturerCount()
|
||||
})
|
||||
|
||||
// Replace with
|
||||
w.capturePage().then(image => {
|
||||
console.log(image.toDataURL())
|
||||
})
|
||||
```
|
||||
|
||||
### Removed: WebContents `new-window` event
|
||||
|
||||
The `new-window` event of WebContents has been removed. It is replaced by [`webContents.setWindowOpenHandler()`](api/web-contents.md#contentssetwindowopenhandlerhandler).
|
||||
|
||||
```js
|
||||
// Removed in Electron 22
|
||||
webContents.on('new-window', (event) => {
|
||||
event.preventDefault()
|
||||
})
|
||||
|
||||
// Replace with
|
||||
webContents.setWindowOpenHandler((details) => {
|
||||
return { action: 'deny' }
|
||||
})
|
||||
```
|
||||
|
||||
### Deprecated: BrowserWindow `scroll-touch-*` events
|
||||
|
||||
The `scroll-touch-begin`, `scroll-touch-end` and `scroll-touch-edge` events on
|
||||
BrowserWindow are deprecated. Instead, use the newly available [`input-event`
|
||||
event](api/web-contents.md#event-input-event) on WebContents.
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
win.on('scroll-touch-begin', scrollTouchBegin)
|
||||
win.on('scroll-touch-edge', scrollTouchEdge)
|
||||
win.on('scroll-touch-end', scrollTouchEnd)
|
||||
|
||||
// Replace with
|
||||
win.webContents.on('input-event', (_, event) => {
|
||||
if (event.type === 'gestureScrollBegin') {
|
||||
scrollTouchBegin()
|
||||
} else if (event.type === 'gestureScrollUpdate') {
|
||||
scrollTouchEdge()
|
||||
} else if (event.type === 'gestureScrollEnd') {
|
||||
scrollTouchEnd()
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Planned Breaking API Changes (21.0)
|
||||
|
||||
### Behavior Changed: V8 Memory Cage enabled
|
||||
|
||||
@@ -76,6 +234,8 @@ webContents.printToPDF({
|
||||
})
|
||||
```
|
||||
|
||||
## Planned Breaking API Changes (20.0)
|
||||
|
||||
### Default Changed: renderers without `nodeIntegration: true` are sandboxed by default
|
||||
|
||||
Previously, renderers that specified a preload script defaulted to being
|
||||
|
||||
@@ -54,7 +54,7 @@ See [issues](issues.md) for more information.
|
||||
Most pull requests opened against the `electron/electron` repository include
|
||||
changes to either the C/C++ code in the `shell/` folder,
|
||||
the TypeScript code in the `lib/` folder, the documentation in `docs/`,
|
||||
or tests in the `spec/` and `spec-main/` folders.
|
||||
or tests in the `spec/` folder.
|
||||
|
||||
See [pull requests](pull-requests.md) for more information.
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ $ ninja -C out/Release electron
|
||||
```
|
||||
|
||||
This will build all of what was previously 'libchromiumcontent' (i.e. the
|
||||
`content/` directory of `chromium` and its dependencies, incl. WebKit and V8),
|
||||
`content/` directory of `chromium` and its dependencies, incl. Blink and V8),
|
||||
so it will take a while.
|
||||
|
||||
The built executable will be under `./out/Testing`:
|
||||
@@ -281,9 +281,22 @@ $ cd electron
|
||||
$ gclient sync -f
|
||||
```
|
||||
|
||||
This may also happen if you have checked out a branch (as opposed to having a detached head) in `electron/src/`
|
||||
or some other dependency’s repository. If that is the case, a `git checkout --detach HEAD` in the appropriate repository should do the trick.
|
||||
|
||||
### I'm being asked for a username/password for chromium-internal.googlesource.com
|
||||
|
||||
If you see a prompt for `Username for 'https://chrome-internal.googlesource.com':` when running `gclient sync` on Windows, it's probably because the `DEPOT_TOOLS_WIN_TOOLCHAIN` environment variable is not set to 0. Open `Control Panel` → `System and Security` → `System` → `Advanced system settings` and add a system variable
|
||||
`DEPOT_TOOLS_WIN_TOOLCHAIN` with value `0`. This tells `depot_tools` to use
|
||||
your locally installed version of Visual Studio (by default, `depot_tools` will
|
||||
try to download a Google-internal version that only Googlers have access to).
|
||||
|
||||
### `e` Module not found
|
||||
|
||||
If `e` is not recognized despite running `npm i -g @electron/build-tools`, ie:
|
||||
|
||||
```sh
|
||||
Error: Cannot find module '/Users/<user>/.electron_build_tools/src/e'
|
||||
```
|
||||
|
||||
We recommend installing Node through [nvm](https://github.com/nvm-sh/nvm). This allows for easier Node version management, and is often a fix for missing `e` modules.
|
||||
|
||||
@@ -13,6 +13,46 @@ Follow the guidelines below for building **Electron itself** on macOS, for the p
|
||||
* [node.js](https://nodejs.org) (external)
|
||||
* Python >= 3.7
|
||||
|
||||
### Arm64-specific prerequisites
|
||||
|
||||
* Rosetta 2
|
||||
* We recommend installing Rosetta if using dependencies that need to cross-compile on x64 and arm64 machines. Rosetta can be installed by using the softwareupdate command line tool.
|
||||
* `$ softwareupdate --install-rosetta`
|
||||
|
||||
## Building Electron
|
||||
|
||||
See [Build Instructions: GN](build-instructions-gn.md).
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Xcode "incompatible architecture" errors (MacOS arm64-specific)
|
||||
|
||||
If both Xcode and Xcode command line tools are installed (`$ xcode -select --install`, or directly download the correct version [here](https://developer.apple.com/download/all/?q=command%20line%20tools)), but the stack trace says otherwise like so:
|
||||
|
||||
```sh
|
||||
xcrun: error: unable to load libxcrun
|
||||
(dlopen(/Users/<user>/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/usr/lib/libxcrun.dylib (http://xcode.app/Contents/Developer/usr/lib/libxcrun.dylib), 0x0005):
|
||||
tried: '/Users/<user>/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/usr/lib/libxcrun.dylib (http://xcode.app/Contents/Developer/usr/lib/libxcrun.dylib)'
|
||||
(mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))), '/Users/<user>/.electron_build_tools/third_party/Xcode/Xcode-11.1.0.app/Contents/Developer/usr/lib/libxcrun.dylib (http://xcode-11.1.0.app/Contents/Developer/usr/lib/libxcrun.dylib)' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))).`
|
||||
```
|
||||
|
||||
If you are on arm64 architecture, the build script may be pointing to the wrong Xcode version (11.x.y doesn't support arm64). Navigate to `/Users/<user>/.electron_build_tools/third_party/Xcode/` and rename `Xcode-13.3.0.app` to `Xcode.app` to ensure the right Xcode version is used.
|
||||
|
||||
### Certificates fail to verify
|
||||
|
||||
installing [`certifi`](https://pypi.org/project/certifi/) will fix the following error:
|
||||
|
||||
```sh
|
||||
________ running 'python3 src/tools/clang/scripts/update.py' in '/Users/<user>/electron'
|
||||
Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Mac_arm64/clang-llvmorg-15-init-15652-g89a99ec9-1.tgz
|
||||
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>
|
||||
Retrying in 5 s ...
|
||||
Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Mac_arm64/clang-llvmorg-15-init-15652-g89a99ec9-1.tgz
|
||||
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>
|
||||
Retrying in 10 s ...
|
||||
Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Mac_arm64/clang-llvmorg-15-init-15652-g89a99ec9-1.tgz
|
||||
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>
|
||||
Retrying in 20 s ...
|
||||
```
|
||||
|
||||
This issue has to do with Python 3.6 using its [own](https://github.com/python/cpython/blob/560ea272b01acaa6c531cc7d94331b2ef0854be6/Mac/BuildScript/resources/ReadMe.rtf#L35) copy of OpenSSL in lieu of the deprecated Apple-supplied OpenSSL libraries. `certifi` adds a curated bundle of default root certificates. This issue is documented in the Electron repo [here](https://github.com/electron/build-tools/issues/55). Further information about this issue can be found [here](https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error) and [here](https://stackoverflow.com/questions/40684543/how-to-make-python-use-ca-certificates-from-mac-os-truststore).
|
||||
|
||||
@@ -116,10 +116,6 @@ $ git config --system core.longpaths true
|
||||
|
||||
This can happen during build, when Debugging Tools for Windows has been installed with Windows Driver Kit. Uninstall Windows Driver Kit and install Debugging Tools with steps described above.
|
||||
|
||||
### ImportError: No module named win32file
|
||||
|
||||
Make sure you have installed `pywin32` with `pip install pywin32`.
|
||||
|
||||
### Build Scripts Hang Until Keypress
|
||||
|
||||
This bug is a "feature" of Windows' command prompt. It happens when clicking inside the prompt window with
|
||||
|
||||
@@ -72,8 +72,7 @@ Electron
|
||||
| | message loop into Chromium's message loop.
|
||||
| └── api/ - The implementation of common APIs, and foundations of
|
||||
| Electron's built-in modules.
|
||||
├── spec/ - Components of Electron's test suite run in the renderer process.
|
||||
├── spec-main/ - Components of Electron's test suite run in the main process.
|
||||
├── spec/ - Components of Electron's test suite run in the main process.
|
||||
└── BUILD.gn - Building rules of Electron.
|
||||
```
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ app (surprise!) that can be found in the `spec` folder. Note that it has
|
||||
its own `package.json` and that its dependencies are therefore not defined
|
||||
in the top-level `package.json`.
|
||||
|
||||
To run only tests in a specific process, run `npm run test --runners=PROCESS`
|
||||
where `PROCESS` is one of `main` or `remote`.
|
||||
|
||||
To run only specific tests matching a pattern, run `npm run test --
|
||||
-g=PATTERN`, replacing the `PATTERN` with a regex that matches the tests
|
||||
you would like to run. As an example: If you want to run only IPC tests, you
|
||||
|
||||
@@ -20,4 +20,4 @@ happen at an API WG meeting. Things to consider when discussing / nominating:
|
||||
* During that time no major bugs / issues should have been caused by the adoption of this feature
|
||||
* The API is stable enough and hasn't been heavily impacted by Chromium upgrades
|
||||
* Is anyone using the API?
|
||||
* Is the API fulfilling the original proposed usecases, does it have any gaps?
|
||||
* Is the API fulfilling the original proposed use cases, does it have any gaps?
|
||||
|
||||
21
docs/fiddles/features/web-usb/index.html
Normal file
21
docs/fiddles/features/web-usb/index.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
|
||||
<title>WebUSB API</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>WebUSB API</h1>
|
||||
|
||||
<button id="clickme">Test WebUSB</button>
|
||||
|
||||
<h3>USB devices automatically granted access via <i>setDevicePermissionHandler</i></h3>
|
||||
<div id="granted-devices"></div>
|
||||
|
||||
<h3>USB devices automatically granted access via <i>select-usb-device</i></h3>
|
||||
<div id="granted-devices2"></div>
|
||||
|
||||
<script src="./renderer.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
72
docs/fiddles/features/web-usb/main.js
Normal file
72
docs/fiddles/features/web-usb/main.js
Normal file
@@ -0,0 +1,72 @@
|
||||
const {app, BrowserWindow} = require('electron')
|
||||
const e = require('express')
|
||||
const path = require('path')
|
||||
|
||||
function createWindow () {
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600
|
||||
})
|
||||
|
||||
let grantedDeviceThroughPermHandler
|
||||
|
||||
mainWindow.webContents.session.on('select-usb-device', (event, details, callback) => {
|
||||
//Add events to handle devices being added or removed before the callback on
|
||||
//`select-usb-device` is called.
|
||||
mainWindow.webContents.session.on('usb-device-added', (event, device) => {
|
||||
console.log('usb-device-added FIRED WITH', device)
|
||||
//Optionally update details.deviceList
|
||||
})
|
||||
|
||||
mainWindow.webContents.session.on('usb-device-removed', (event, device) => {
|
||||
console.log('usb-device-removed FIRED WITH', device)
|
||||
//Optionally update details.deviceList
|
||||
})
|
||||
|
||||
event.preventDefault()
|
||||
if (details.deviceList && details.deviceList.length > 0) {
|
||||
const deviceToReturn = details.deviceList.find((device) => {
|
||||
if (!grantedDeviceThroughPermHandler || (device.deviceId != grantedDeviceThroughPermHandler.deviceId)) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
if (deviceToReturn) {
|
||||
callback(deviceToReturn.deviceId)
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
mainWindow.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin, details) => {
|
||||
if (permission === 'usb' && details.securityOrigin === 'file:///') {
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
mainWindow.webContents.session.setDevicePermissionHandler((details) => {
|
||||
if (details.deviceType === 'usb' && details.origin === 'file://') {
|
||||
if (!grantedDeviceThroughPermHandler) {
|
||||
grantedDeviceThroughPermHandler = details.device
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
mainWindow.loadFile('index.html')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
})
|
||||
|
||||
app.on('window-all-closed', function () {
|
||||
if (process.platform !== 'darwin') app.quit()
|
||||
})
|
||||
33
docs/fiddles/features/web-usb/renderer.js
Normal file
33
docs/fiddles/features/web-usb/renderer.js
Normal file
@@ -0,0 +1,33 @@
|
||||
function getDeviceDetails(device) {
|
||||
return grantedDevice.productName || `Unknown device ${grantedDevice.deviceId}`
|
||||
}
|
||||
|
||||
async function testIt() {
|
||||
const noDevicesFoundMsg = 'No devices found'
|
||||
const grantedDevices = await navigator.usb.getDevices()
|
||||
let grantedDeviceList = ''
|
||||
if (grantedDevices.length > 0) {
|
||||
grantedDevices.forEach(device => {
|
||||
grantedDeviceList += `<hr>${getDeviceDetails(device)}</hr>`
|
||||
})
|
||||
} else {
|
||||
grantedDeviceList = noDevicesFoundMsg
|
||||
}
|
||||
document.getElementById('granted-devices').innerHTML = grantedDeviceList
|
||||
|
||||
grantedDeviceList = ''
|
||||
try {
|
||||
const grantedDevice = await navigator.usb.requestDevice({
|
||||
filters: []
|
||||
})
|
||||
grantedDeviceList += `<hr>${getDeviceDetails(device)}</hr>`
|
||||
|
||||
} catch (ex) {
|
||||
if (ex.name === 'NotFoundError') {
|
||||
grantedDeviceList = noDevicesFoundMsg
|
||||
}
|
||||
}
|
||||
document.getElementById('granted-devices2').innerHTML = grantedDeviceList
|
||||
}
|
||||
|
||||
document.getElementById('clickme').addEventListener('click',testIt)
|
||||
@@ -132,7 +132,7 @@ OSR (offscreen rendering) can be used for loading heavy page in
|
||||
background and then displaying it after (it will be much faster).
|
||||
It allows you to render page without showing it on screen.
|
||||
|
||||
For more information, read the [Offscreen Rendering][osr] tutorial.
|
||||
For more information, read the [Offscreen Rendering] tutorial.
|
||||
|
||||
### preload script
|
||||
|
||||
@@ -194,6 +194,15 @@ overly prescriptive about how it should be used. Userland enables users to
|
||||
create and share tools that provide additional functionality on top of what is
|
||||
available in "core".
|
||||
|
||||
### utility process
|
||||
|
||||
The utility process is a child of the main process that allows running any
|
||||
untrusted services that cannot be run in the main process. Chromium uses this
|
||||
process to perform network I/O, audio/video processing, device inputs etc.
|
||||
In Electron, you can create this process using [UtilityProcess][] API.
|
||||
|
||||
See also: [process](#process), [main process](#main-process)
|
||||
|
||||
### V8
|
||||
|
||||
V8 is Google's open source JavaScript engine. It is written in C++ and is
|
||||
@@ -226,9 +235,10 @@ embedded content.
|
||||
[mac app store submission guide]: tutorial/mac-app-store-submission-guide.md
|
||||
[main]: #main-process
|
||||
[msi]: https://docs.microsoft.com/en-us/windows/win32/msi/windows-installer-portal
|
||||
[Native Node Modules]: tutorial/using-native-node-modules.md
|
||||
[offscreen rendering]: tutorial/offscreen-rendering.md
|
||||
[process sandboxing]: tutorial/sandbox.md
|
||||
[renderer]: #renderer-process
|
||||
[userland]: #userland
|
||||
[using native node modules]: tutorial/using-native-node-modules.md
|
||||
[UtilityProcess]: api/utility-process.md
|
||||
[v8]: #v8
|
||||
|
||||
@@ -44,6 +44,4 @@ CFStringRef kAXManualAccessibility = CFSTR("AXManualAccessibility");
|
||||
```
|
||||
|
||||
[a11y-docs]: https://www.chromium.org/developers/design-documents/accessibility#TOC-How-Chrome-detects-the-presence-of-Assistive-Technology
|
||||
[a11y-devtools]: https://github.com/GoogleChrome/accessibility-developer-tools
|
||||
[a11y-devtools-wiki]: https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules
|
||||
[setAccessibilitySupportEnabled]: ../api/app.md#appsetaccessibilitysupportenabledenabled-macos-windows
|
||||
|
||||
@@ -22,7 +22,7 @@ There are a few ways that you can set up testing using WebDriver.
|
||||
Node.js package for testing with WebDriver. Its ecosystem also includes various plugins
|
||||
(e.g. reporter and services) that can help you put together your test setup.
|
||||
|
||||
#### Install the testrunner
|
||||
#### Install the test runner
|
||||
|
||||
First you need to run the WebdriverIO starter toolkit in your project root directory:
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from the OS.
|
||||
|
||||
If your app has its own dark mode, you should toggle it on and off in sync with
|
||||
the system's dark mode setting. You can do this by using the
|
||||
[prefer-color-scheme] CSS media query.
|
||||
[prefers-color-scheme] CSS media query.
|
||||
|
||||
### Manually update your own interfaces
|
||||
|
||||
|
||||
@@ -115,3 +115,41 @@ when the `Test Web Serial` button is clicked.
|
||||
```javascript fiddle='docs/fiddles/features/web-serial'
|
||||
|
||||
```
|
||||
|
||||
## WebUSB API
|
||||
|
||||
The [WebUSB API](https://web.dev/usb/) can be used to access USB devices.
|
||||
Electron provides several APIs for working with the WebUSB API:
|
||||
|
||||
* The [`select-usb-device` event on the Session](../api/session.md#event-select-usb-device)
|
||||
can be used to select a USB device when a call to
|
||||
`navigator.usb.requestDevice` is made. Additionally the [`usb-device-added`](../api/session.md#event-usb-device-added)
|
||||
and [`usb-device-removed`](../api/session.md#event-usb-device-removed) events
|
||||
on the Session can be used to handle devices being plugged in or unplugged
|
||||
when handling the `select-usb-device` event.
|
||||
**Note:** These two events only fire until the callback from `select-usb-device`
|
||||
is called. They are not intended to be used as a generic usb device listener.
|
||||
* The [`usb-device-revoked' event on the Session](../api/session.md#event-usb-device-revoked) can
|
||||
be used to respond when [device.forget()](https://developer.chrome.com/articles/usb/#revoke-access)
|
||||
is called on a USB device.
|
||||
* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler)
|
||||
can be used to provide default permissioning to devices without first calling
|
||||
for permission to devices via `navigator.usb.requestDevice`. Additionally,
|
||||
the default behavior of Electron is to store granted device permission through
|
||||
the lifetime of the corresponding WebContents. If longer term storage is
|
||||
needed, a developer can store granted device permissions (eg when handling
|
||||
the `select-usb-device` event) and then read from that storage with
|
||||
`setDevicePermissionHandler`.
|
||||
* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler)
|
||||
can be used to disable USB access for specific origins.
|
||||
|
||||
### Example
|
||||
|
||||
This example demonstrates an Electron application that automatically selects
|
||||
USB devices (if they are attached) through [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler)
|
||||
and through [`select-usb-device` event on the Session](../api/session.md#event-select-usb-device)
|
||||
when the `Test WebUSB` button is clicked.
|
||||
|
||||
```javascript fiddle='docs/fiddles/features/web-usb'
|
||||
|
||||
```
|
||||
|
||||
@@ -15,7 +15,7 @@ NPM package that does just that.
|
||||
If you don't want to use the tooling approach, you can also do all of the necessary
|
||||
operations by hand. To load an extension in Electron, you need to download it via Chrome,
|
||||
locate its filesystem path, and then load it into your [Session][session] by calling the
|
||||
[`ses.loadExtension`] API.
|
||||
[`ses.loadExtension`][load-extension] API.
|
||||
|
||||
Using the [React Developer Tools][react-devtools] as an example:
|
||||
|
||||
|
||||
@@ -9,10 +9,11 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
|
||||
|
||||
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
|
||||
| ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- |
|
||||
| 22.0.0 | 2022-Sep-29 | 2022-Oct-25 | 2022-Nov-29 | TBD | M108 | TBD | ✅ |
|
||||
| 21.0.0 | 2022-Aug-04 | 2022-Aug-30 | 2022-Sep-27 | TBD | M106 | v16.17 | ✅ |
|
||||
| 23.0.0 | 2022-Dec-01 | 2023-Jan-10 | 2023-Feb-07 | TBD | M110 | TBD | ✅ |
|
||||
| 22.0.0 | 2022-Sep-29 | 2022-Oct-25 | 2022-Nov-29 | TBD | M108 | v16.17 | ✅ |
|
||||
| 21.0.0 | 2022-Aug-04 | 2022-Aug-30 | 2022-Sep-27 | TBD | M106 | v16.16 | ✅ |
|
||||
| 20.0.0 | 2022-May-26 | 2022-Jun-21 | 2022-Aug-02 | TBD | M104 | v16.15 | ✅ |
|
||||
| 19.0.0 | 2022-Mar-31 | 2022-Apr-26 | 2022-May-24 | TBD | M102 | v16.14 | ✅ |
|
||||
| 19.0.0 | 2022-Mar-31 | 2022-Apr-26 | 2022-May-24 | 2022-Nov-29 | M102 | v16.14 | 🚫 |
|
||||
| 18.0.0 | 2022-Feb-03 | 2022-Mar-03 | 2022-Mar-29 | 2022-Sep-27 | M100 | v16.13 | 🚫 |
|
||||
| 17.0.0 | 2021-Nov-18 | 2022-Jan-06 | 2022-Feb-01 | 2022-Aug-02 | M98 | v16.13 | 🚫 |
|
||||
| 16.0.0 | 2021-Sep-23 | 2021-Oct-20 | 2021-Nov-16 | 2022-May-24 | M96 | v16.9 | 🚫 |
|
||||
|
||||
@@ -52,5 +52,6 @@ You can find the full list of "How to?" in the sidebar. If there is
|
||||
something that you would like to do that is not documented, please join
|
||||
our [Discord server][discord] and let us know!
|
||||
|
||||
[app]: ../api/app.md
|
||||
[discord]: https://discord.gg/electronjs
|
||||
[fiddle]: https://www.electronjs.org/fiddle
|
||||
|
||||
@@ -180,19 +180,16 @@ app.whenReady().then(async () => {
|
||||
|
||||
// We can't use ipcMain.handle() here, because the reply needs to transfer a
|
||||
// MessagePort.
|
||||
ipcMain.on('request-worker-channel', (event) => {
|
||||
// For security reasons, let's make sure only the frames we expect can
|
||||
// access the worker.
|
||||
if (event.senderFrame === mainWindow.webContents.mainFrame) {
|
||||
// Create a new channel ...
|
||||
const { port1, port2 } = new MessageChannelMain()
|
||||
// ... send one end to the worker ...
|
||||
worker.webContents.postMessage('new-client', null, [port1])
|
||||
// ... and the other end to the main window.
|
||||
event.senderFrame.postMessage('provide-worker-channel', null, [port2])
|
||||
// Now the main window and the worker can communicate with each other
|
||||
// without going through the main process!
|
||||
}
|
||||
// Listen for message sent from the top-level frame
|
||||
mainWindow.webContents.mainFrame.on('request-worker-channel', (event) => {
|
||||
// Create a new channel ...
|
||||
const { port1, port2 } = new MessageChannelMain()
|
||||
// ... send one end to the worker ...
|
||||
worker.webContents.postMessage('new-client', null, [port1])
|
||||
// ... and the other end to the main window.
|
||||
event.senderFrame.postMessage('provide-worker-channel', null, [port2])
|
||||
// Now the main window and the worker can communicate with each other
|
||||
// without going through the main process!
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
@@ -79,11 +79,6 @@ Start Menu. This can be overkill during development, so adding
|
||||
trick. Navigate to the file in Explorer, right-click and 'Pin to Start Menu'.
|
||||
You will then need to add the line `app.setAppUserModelId(process.execPath)` to
|
||||
your main process to see notifications.
|
||||
* On Windows 8.1 and Windows 8, a shortcut to your app with an [Application User
|
||||
Model ID][app-user-model-id] must be installed to the Start screen. Note,
|
||||
however, that it does not need to be pinned to the Start screen.
|
||||
* On Windows 7, notifications work via a custom implementation which visually
|
||||
resembles the native one on newer systems.
|
||||
|
||||
Electron attempts to automate the work around the Application User Model ID. When
|
||||
Electron is used together with the installation and update framework Squirrel,
|
||||
@@ -92,12 +87,6 @@ Electron will detect that Squirrel was used and will automatically call
|
||||
`app.setAppUserModelId()` with the correct value. During development, you may have
|
||||
to call [`app.setAppUserModelId()`][set-app-user-model-id] yourself.
|
||||
|
||||
Furthermore, in Windows 8, the maximum length for the notification body is 250
|
||||
characters, with the Windows team recommending that notifications should be kept
|
||||
to 200 characters. That said, that limitation has been removed in Windows 10, with
|
||||
the Windows team asking developers to be reasonable. Attempting to send gigantic
|
||||
amounts of text to the API (thousands of characters) might result in instability.
|
||||
|
||||
#### Advanced Notifications
|
||||
|
||||
Later versions of Windows allow for advanced notifications, with custom templates,
|
||||
|
||||
@@ -419,6 +419,18 @@ environment that needs to handle both Node.js and browser environments.
|
||||
As of writing this article, the popular choices include [Webpack][webpack],
|
||||
[Parcel][parcel], and [rollup.js][rollup].
|
||||
|
||||
### 8. Call `Menu.setApplicationMenu(null)` when you do not need a default menu
|
||||
|
||||
Electron will set a default menu on startup with some standard entries. But there are reasons your application might want to change that and it will benefit startup performance.
|
||||
|
||||
#### Why?
|
||||
|
||||
If you build your own menu or use a frameless window without native menu, you should tell Electron early enough to not setup the default menu.
|
||||
|
||||
#### How?
|
||||
|
||||
Call `Menu.setApplicationMenu(null)` before `app.on("ready")`. This will prevent Electron from setting a default menu. See also https://github.com/electron/electron/issues/35512 for a related discussion.
|
||||
|
||||
[security]: ./security.md
|
||||
[chrome-devtools-tutorial]: https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/
|
||||
[worker-threads]: https://nodejs.org/api/worker_threads.html
|
||||
|
||||
@@ -214,8 +214,25 @@ This feature is incredibly useful for two main purposes:
|
||||
URL, you can add custom properties onto the renderer's `window` global that can
|
||||
be used for desktop-only logic on the web client's side.
|
||||
|
||||
## The utility process
|
||||
|
||||
Each Electron app can spawn multiple child processes from the main process using
|
||||
the [UtilityProcess][] API. The utility process runs in a Node.js environment,
|
||||
meaning it has the ability to `require` modules and use all of Node.js APIs.
|
||||
The utility process can be used to host for example: untrusted services,
|
||||
CPU intensive tasks or crash prone components which would have previously
|
||||
been hosted in the main process or process spawned with Node.js [`child_process.fork`][] API.
|
||||
The primary difference between the utility process and process spawned by Node.js
|
||||
child_process module is that the utility process can establish a communication
|
||||
channel with a renderer process using [`MessagePort`][]s. An Electron app can
|
||||
always prefer the [UtilityProcess][] API over Node.js [`child_process.fork`][] API when
|
||||
there is need to fork a child process from the main process.
|
||||
|
||||
[window-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/Window
|
||||
[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort
|
||||
[`child_process.fork`]: https://nodejs.org/dist/latest-v16.x/docs/api/child_process.html#child_processforkmodulepath-args-options
|
||||
[context-isolation]: ./context-isolation.md
|
||||
[context-bridge]: ../api/context-bridge.md
|
||||
[ipcrenderer]: ../api/ipc-renderer.md
|
||||
[UtilityProcess]: ../api/utility-process.md
|
||||
[tutorial]: ./tutorial-1-prerequisites.md
|
||||
|
||||
@@ -113,6 +113,7 @@ You should at least follow these steps to improve the security of your applicati
|
||||
14. [Disable or limit creation of new windows](#14-disable-or-limit-creation-of-new-windows)
|
||||
15. [Do not use `shell.openExternal` with untrusted content](#15-do-not-use-shellopenexternal-with-untrusted-content)
|
||||
16. [Use a current version of Electron](#16-use-a-current-version-of-electron)
|
||||
17. [Validate the `sender` of all IPC messages](#17-validate-the-sender-of-all-ipc-messages)
|
||||
|
||||
To automate the detection of misconfigurations and insecure patterns, it is
|
||||
possible to use
|
||||
@@ -130,10 +131,8 @@ like `HTTP`. Similarly, we recommend the use of `WSS` over `WS`, `FTPS` over
|
||||
|
||||
#### Why?
|
||||
|
||||
`HTTPS` has three main benefits:
|
||||
`HTTPS` has two main benefits:
|
||||
|
||||
1. It authenticates the remote server, ensuring your app connects to the correct
|
||||
host instead of an impersonator.
|
||||
1. It ensures data integrity, asserting that the data was not modified while in
|
||||
transit between your application and the host.
|
||||
1. It encrypts the traffic between your user and the destination host, making it
|
||||
|
||||
@@ -237,8 +237,6 @@ apps:
|
||||
desktop: usr/share/applications/desktop.desktop
|
||||
```
|
||||
|
||||
[snapcraft.io]: https://snapcraft.io/
|
||||
[snapcraft-store]: https://snapcraft.io/store/
|
||||
[snapcraft-syntax]: https://docs.snapcraft.io/build-snaps/syntax
|
||||
[electron-packager]: https://github.com/electron/electron-packager
|
||||
[electron-forge]: https://github.com/electron-userland/electron-forge
|
||||
|
||||
@@ -186,7 +186,7 @@ by creating a barebones web page in an `index.html` file in the root folder of y
|
||||
```
|
||||
|
||||
Now that you have a web page, you can load it into an Electron [BrowserWindow][browser-window].
|
||||
Replace the contents your `main.js` file with the following code. We will explain each
|
||||
Replace the contents of your `main.js` file with the following code. We will explain each
|
||||
highlighted block separately.
|
||||
|
||||
```js {1,3-10,12-14} title='main.js' showLineNumbers
|
||||
@@ -435,7 +435,7 @@ This file controls Electron's **main process**, which runs an instance of Node.j
|
||||
responsible for your app's lifecycle, displaying native interfaces, performing privileged operations,
|
||||
and managing renderer processes.
|
||||
|
||||
**Renderer processes** (or renderers for short) are responsible for display graphical content. You can
|
||||
**Renderer processes** (or renderers for short) are responsible for displaying graphical content. You can
|
||||
load a web page into a renderer by pointing it to either a web address or a local HTML file.
|
||||
Renderers behave very similarly to regular web pages and have access to the same web APIs.
|
||||
|
||||
|
||||
@@ -203,7 +203,8 @@ loading the HTML file so that the handler is guaranteed to be ready before
|
||||
you send out the `invoke` call from the renderer.
|
||||
|
||||
```js {1,11} title="main.js"
|
||||
const { ipcMain } = require('electron')
|
||||
const { app, BrowserWindow, ipcMain } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
const createWindow = () => {
|
||||
const win = new BrowserWindow({
|
||||
@@ -216,6 +217,7 @@ const createWindow = () => {
|
||||
ipcMain.handle('ping', () => 'pong')
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
app.whenReady().then(createWindow)
|
||||
```
|
||||
|
||||
Once you have the sender and receiver set up, you can now send messages from the renderer
|
||||
|
||||
@@ -227,7 +227,7 @@ rest of our docs and happy developing! If you have questions, please stop by our
|
||||
[github actions]: https://github.com/features/actions
|
||||
[github publisher]: https://www.electronforge.io/config/publishers/github
|
||||
[github releases]: https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
|
||||
[git tag]: https://git-scm.com/book/en/v2/Git-Basics-Tagging
|
||||
[git-tag]: https://git-scm.com/book/en/v2/Git-Basics-Tagging
|
||||
[new-pat]: https://github.com/settings/tokens/new
|
||||
[publish command]: https://www.electronforge.io/cli#publish
|
||||
[publisher]: https://www.electronforge.io/config/publishers
|
||||
|
||||
@@ -67,7 +67,7 @@ Depending on your needs, you can choose from one of these:
|
||||
to minify server cost.
|
||||
|
||||
Once you've deployed your update server, you can instrument your app code to receive and
|
||||
apply the updates with Electron's [autoUpdater] module.
|
||||
apply the updates with Electron's [autoUpdater](../api/auto-updater.md) module.
|
||||
|
||||
### Step 2: Receiving updates in your app
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ auto_filenames = {
|
||||
"docs/api/net-log.md",
|
||||
"docs/api/net.md",
|
||||
"docs/api/notification.md",
|
||||
"docs/api/parent-port.md",
|
||||
"docs/api/power-monitor.md",
|
||||
"docs/api/power-save-blocker.md",
|
||||
"docs/api/process.md",
|
||||
@@ -62,6 +63,7 @@ auto_filenames = {
|
||||
"docs/api/touch-bar-spacer.md",
|
||||
"docs/api/touch-bar.md",
|
||||
"docs/api/tray.md",
|
||||
"docs/api/utility-process.md",
|
||||
"docs/api/web-contents.md",
|
||||
"docs/api/web-frame-main.md",
|
||||
"docs/api/web-frame.md",
|
||||
@@ -98,7 +100,6 @@ auto_filenames = {
|
||||
"docs/api/structures/mime-typed-buffer.md",
|
||||
"docs/api/structures/mouse-input-event.md",
|
||||
"docs/api/structures/mouse-wheel-input-event.md",
|
||||
"docs/api/structures/new-window-web-contents-event.md",
|
||||
"docs/api/structures/notification-action.md",
|
||||
"docs/api/structures/notification-response.md",
|
||||
"docs/api/structures/payment-discount.md",
|
||||
@@ -131,17 +132,18 @@ auto_filenames = {
|
||||
"docs/api/structures/upload-data.md",
|
||||
"docs/api/structures/upload-file.md",
|
||||
"docs/api/structures/upload-raw-data.md",
|
||||
"docs/api/structures/usb-device.md",
|
||||
"docs/api/structures/user-default-types.md",
|
||||
"docs/api/structures/web-request-filter.md",
|
||||
"docs/api/structures/web-source.md",
|
||||
]
|
||||
|
||||
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/web-view-methods.ts",
|
||||
"lib/common/webpack-globals-provider.ts",
|
||||
"lib/renderer/api/context-bridge.ts",
|
||||
"lib/renderer/api/crash-reporter.ts",
|
||||
"lib/renderer/api/ipc-renderer.ts",
|
||||
@@ -221,6 +223,7 @@ auto_filenames = {
|
||||
"lib/browser/api/system-preferences.ts",
|
||||
"lib/browser/api/touch-bar.ts",
|
||||
"lib/browser/api/tray.ts",
|
||||
"lib/browser/api/utility-process.ts",
|
||||
"lib/browser/api/view.ts",
|
||||
"lib/browser/api/views/image-view.ts",
|
||||
"lib/browser/api/web-contents-view.ts",
|
||||
@@ -239,11 +242,11 @@ auto_filenames = {
|
||||
"lib/browser/rpc-server.ts",
|
||||
"lib/browser/web-view-events.ts",
|
||||
"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/deprecate.ts",
|
||||
"lib/common/init.ts",
|
||||
"lib/common/ipc-messages.ts",
|
||||
"lib/common/reset-search-paths.ts",
|
||||
@@ -260,7 +263,6 @@ auto_filenames = {
|
||||
|
||||
renderer_bundle_deps = [
|
||||
"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",
|
||||
@@ -299,7 +301,6 @@ auto_filenames = {
|
||||
|
||||
worker_bundle_deps = [
|
||||
"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",
|
||||
@@ -334,4 +335,20 @@ auto_filenames = {
|
||||
"typings/internal-ambient.d.ts",
|
||||
"typings/internal-electron.d.ts",
|
||||
]
|
||||
|
||||
utility_bundle_deps = [
|
||||
"lib/browser/message-port-main.ts",
|
||||
"lib/common/define-properties.ts",
|
||||
"lib/common/init.ts",
|
||||
"lib/common/reset-search-paths.ts",
|
||||
"lib/utility/api/exports/electron.ts",
|
||||
"lib/utility/api/module-list.ts",
|
||||
"lib/utility/init.ts",
|
||||
"lib/utility/parent-port.ts",
|
||||
"package.json",
|
||||
"tsconfig.electron.json",
|
||||
"tsconfig.json",
|
||||
"typings/internal-ambient.d.ts",
|
||||
"typings/internal-electron.d.ts",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -67,17 +67,6 @@ filenames = {
|
||||
"shell/browser/native_window_views_win.cc",
|
||||
"shell/browser/notifications/win/notification_presenter_win.cc",
|
||||
"shell/browser/notifications/win/notification_presenter_win.h",
|
||||
"shell/browser/notifications/win/notification_presenter_win7.cc",
|
||||
"shell/browser/notifications/win/notification_presenter_win7.h",
|
||||
"shell/browser/notifications/win/win32_desktop_notifications/common.h",
|
||||
"shell/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.cc",
|
||||
"shell/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.h",
|
||||
"shell/browser/notifications/win/win32_desktop_notifications/toast_uia.cc",
|
||||
"shell/browser/notifications/win/win32_desktop_notifications/toast_uia.h",
|
||||
"shell/browser/notifications/win/win32_desktop_notifications/toast.cc",
|
||||
"shell/browser/notifications/win/win32_desktop_notifications/toast.h",
|
||||
"shell/browser/notifications/win/win32_notification.cc",
|
||||
"shell/browser/notifications/win/win32_notification.h",
|
||||
"shell/browser/notifications/win/windows_toast_notification.cc",
|
||||
"shell/browser/notifications/win/windows_toast_notification.h",
|
||||
"shell/browser/relauncher_win.cc",
|
||||
@@ -124,7 +113,6 @@ filenames = {
|
||||
"shell/app/electron_main_delegate_mac.h",
|
||||
"shell/app/electron_main_delegate_mac.mm",
|
||||
"shell/browser/api/electron_api_app_mac.mm",
|
||||
"shell/browser/api/electron_api_browser_window_mac.mm",
|
||||
"shell/browser/api/electron_api_menu_mac.h",
|
||||
"shell/browser/api/electron_api_menu_mac.mm",
|
||||
"shell/browser/api/electron_api_native_theme_mac.mm",
|
||||
@@ -211,7 +199,6 @@ filenames = {
|
||||
]
|
||||
|
||||
lib_sources_views = [
|
||||
"shell/browser/api/electron_api_browser_window_views.cc",
|
||||
"shell/browser/api/electron_api_menu_views.cc",
|
||||
"shell/browser/api/electron_api_menu_views.h",
|
||||
"shell/browser/native_browser_view_views.cc",
|
||||
@@ -313,6 +300,8 @@ filenames = {
|
||||
"shell/browser/api/electron_api_tray.h",
|
||||
"shell/browser/api/electron_api_url_loader.cc",
|
||||
"shell/browser/api/electron_api_url_loader.h",
|
||||
"shell/browser/api/electron_api_utility_process.cc",
|
||||
"shell/browser/api/electron_api_utility_process.h",
|
||||
"shell/browser/api/electron_api_view.cc",
|
||||
"shell/browser/api/electron_api_view.h",
|
||||
"shell/browser/api/electron_api_web_contents.cc",
|
||||
@@ -358,6 +347,7 @@ filenames = {
|
||||
"shell/browser/child_web_contents_tracker.h",
|
||||
"shell/browser/cookie_change_notifier.cc",
|
||||
"shell/browser/cookie_change_notifier.h",
|
||||
"shell/browser/draggable_region_provider.h",
|
||||
"shell/browser/electron_api_ipc_handler_impl.cc",
|
||||
"shell/browser/electron_api_ipc_handler_impl.h",
|
||||
"shell/browser/electron_autofill_driver.cc",
|
||||
@@ -380,8 +370,6 @@ filenames = {
|
||||
"shell/browser/electron_navigation_throttle.h",
|
||||
"shell/browser/electron_permission_manager.cc",
|
||||
"shell/browser/electron_permission_manager.h",
|
||||
"shell/browser/electron_quota_permission_context.cc",
|
||||
"shell/browser/electron_quota_permission_context.h",
|
||||
"shell/browser/electron_speech_recognition_manager_delegate.cc",
|
||||
"shell/browser/electron_speech_recognition_manager_delegate.h",
|
||||
"shell/browser/electron_web_contents_utility_handler_impl.cc",
|
||||
@@ -463,8 +451,6 @@ filenames = {
|
||||
"shell/browser/notifications/platform_notification_service.h",
|
||||
"shell/browser/plugins/plugin_utils.cc",
|
||||
"shell/browser/plugins/plugin_utils.h",
|
||||
"shell/browser/pref_store_delegate.cc",
|
||||
"shell/browser/pref_store_delegate.h",
|
||||
"shell/browser/protocol_registry.cc",
|
||||
"shell/browser/protocol_registry.h",
|
||||
"shell/browser/relauncher.cc",
|
||||
@@ -498,6 +484,7 @@ filenames = {
|
||||
"shell/browser/ui/inspectable_web_contents.cc",
|
||||
"shell/browser/ui/inspectable_web_contents.h",
|
||||
"shell/browser/ui/inspectable_web_contents_delegate.h",
|
||||
"shell/browser/ui/inspectable_web_contents_view.cc",
|
||||
"shell/browser/ui/inspectable_web_contents_view.h",
|
||||
"shell/browser/ui/inspectable_web_contents_view_delegate.cc",
|
||||
"shell/browser/ui/inspectable_web_contents_view_delegate.h",
|
||||
@@ -507,8 +494,14 @@ filenames = {
|
||||
"shell/browser/ui/tray_icon_observer.h",
|
||||
"shell/browser/ui/webui/accessibility_ui.cc",
|
||||
"shell/browser/ui/webui/accessibility_ui.h",
|
||||
"shell/browser/unresponsive_suppressor.cc",
|
||||
"shell/browser/unresponsive_suppressor.h",
|
||||
"shell/browser/usb/electron_usb_delegate.cc",
|
||||
"shell/browser/usb/electron_usb_delegate.h",
|
||||
"shell/browser/usb/usb_chooser_context.cc",
|
||||
"shell/browser/usb/usb_chooser_context.h",
|
||||
"shell/browser/usb/usb_chooser_context_factory.cc",
|
||||
"shell/browser/usb/usb_chooser_context_factory.h",
|
||||
"shell/browser/usb/usb_chooser_controller.cc",
|
||||
"shell/browser/usb/usb_chooser_controller.h",
|
||||
"shell/browser/web_contents_permission_helper.cc",
|
||||
"shell/browser/web_contents_permission_helper.h",
|
||||
"shell/browser/web_contents_preferences.cc",
|
||||
@@ -519,11 +512,14 @@ filenames = {
|
||||
"shell/browser/web_view_guest_delegate.h",
|
||||
"shell/browser/web_view_manager.cc",
|
||||
"shell/browser/web_view_manager.h",
|
||||
"shell/browser/webauthn/electron_authenticator_request_delegate.cc",
|
||||
"shell/browser/webauthn/electron_authenticator_request_delegate.h",
|
||||
"shell/browser/window_list.cc",
|
||||
"shell/browser/window_list.h",
|
||||
"shell/browser/window_list_observer.h",
|
||||
"shell/browser/zoom_level_delegate.cc",
|
||||
"shell/browser/zoom_level_delegate.h",
|
||||
"shell/common/api/crashpad_support.cc",
|
||||
"shell/common/api/electron_api_asar.cc",
|
||||
"shell/common/api/electron_api_clipboard.cc",
|
||||
"shell/common/api/electron_api_clipboard.h",
|
||||
@@ -577,14 +573,18 @@ filenames = {
|
||||
"shell/common/gin_converters/hid_device_info_converter.h",
|
||||
"shell/common/gin_converters/image_converter.cc",
|
||||
"shell/common/gin_converters/image_converter.h",
|
||||
"shell/common/gin_converters/media_converter.cc",
|
||||
"shell/common/gin_converters/media_converter.h",
|
||||
"shell/common/gin_converters/message_box_converter.cc",
|
||||
"shell/common/gin_converters/message_box_converter.h",
|
||||
"shell/common/gin_converters/native_window_converter.h",
|
||||
"shell/common/gin_converters/net_converter.cc",
|
||||
"shell/common/gin_converters/net_converter.h",
|
||||
"shell/common/gin_converters/serial_port_info_converter.h",
|
||||
"shell/common/gin_converters/std_converter.h",
|
||||
"shell/common/gin_converters/time_converter.cc",
|
||||
"shell/common/gin_converters/time_converter.h",
|
||||
"shell/common/gin_converters/usb_device_info_converter.h",
|
||||
"shell/common/gin_converters/value_converter.cc",
|
||||
"shell/common/gin_converters/value_converter.h",
|
||||
"shell/common/gin_helper/arguments.cc",
|
||||
@@ -647,6 +647,7 @@ filenames = {
|
||||
"shell/common/process_util.h",
|
||||
"shell/common/skia_util.cc",
|
||||
"shell/common/skia_util.h",
|
||||
"shell/common/thread_restrictions.h",
|
||||
"shell/common/v8_value_serializer.cc",
|
||||
"shell/common/v8_value_serializer.h",
|
||||
"shell/common/world_ids.h",
|
||||
@@ -673,19 +674,19 @@ filenames = {
|
||||
"shell/renderer/electron_renderer_client.h",
|
||||
"shell/renderer/electron_sandboxed_renderer_client.cc",
|
||||
"shell/renderer/electron_sandboxed_renderer_client.h",
|
||||
"shell/renderer/guest_view_container.cc",
|
||||
"shell/renderer/guest_view_container.h",
|
||||
"shell/renderer/renderer_client_base.cc",
|
||||
"shell/renderer/renderer_client_base.h",
|
||||
"shell/renderer/web_worker_observer.cc",
|
||||
"shell/renderer/web_worker_observer.h",
|
||||
"shell/services/node/node_service.cc",
|
||||
"shell/services/node/node_service.h",
|
||||
"shell/services/node/parent_port.cc",
|
||||
"shell/services/node/parent_port.h",
|
||||
"shell/utility/electron_content_utility_client.cc",
|
||||
"shell/utility/electron_content_utility_client.h",
|
||||
]
|
||||
|
||||
lib_sources_extensions = [
|
||||
"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",
|
||||
|
||||
@@ -205,15 +205,20 @@ libcxx_headers = [
|
||||
"//buildtools/third_party/libc++/trunk/include/__charconv/to_chars_result.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/calendar.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/convert_to_timespec.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/convert_to_tm.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/day.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/duration.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/file_clock.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/formatter.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/hh_mm_ss.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/high_resolution_clock.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/literals.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/month.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/month_weekday.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/monthday.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/ostream.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/parser_std_format_spec.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/statically_widen.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/steady_clock.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/system_clock.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__chrono/time_point.h",
|
||||
@@ -291,6 +296,7 @@ libcxx_headers = [
|
||||
"//buildtools/third_party/libc++/trunk/include/__format/format_args.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__format/format_context.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__format/format_error.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__format/format_functions.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__format/format_fwd.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__format/format_parse_context.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__format/format_string.h",
|
||||
@@ -334,10 +340,13 @@ libcxx_headers = [
|
||||
"//buildtools/third_party/libc++/trunk/include/__functional/unary_negate.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__functional/unwrap_ref.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__functional/weak_result_type.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__fwd/array.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__fwd/get.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__fwd/hash.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__fwd/pair.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__fwd/span.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__fwd/string_view.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__fwd/tuple.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__hash_table",
|
||||
"//buildtools/third_party/libc++/trunk/include/__ios/fpos.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__iterator/access.h",
|
||||
@@ -381,6 +390,7 @@ libcxx_headers = [
|
||||
"//buildtools/third_party/libc++/trunk/include/__locale",
|
||||
"//buildtools/third_party/libc++/trunk/include/__mbstate_t.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/addressof.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/align.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/allocate_at_least.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/allocation_guard.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/allocator.h",
|
||||
@@ -388,15 +398,18 @@ libcxx_headers = [
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/allocator_traits.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/assume_aligned.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/auto_ptr.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/builtin_new_allocator.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/compressed_pair.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/concepts.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/construct_at.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/destruct_n.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/pointer_traits.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/ranges_construct_at.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/ranges_uninitialized_algorithms.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/raw_storage_iterator.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/shared_ptr.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/swap_allocator.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/temp_value.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/temporary_buffer.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/uninitialized_algorithms.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__memory/unique_ptr.h",
|
||||
@@ -502,7 +515,6 @@ libcxx_headers = [
|
||||
"//buildtools/third_party/libc++/trunk/include/__support/solaris/floatingpoint.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__support/solaris/wchar.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__support/solaris/xlocale.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__support/win32/limits_msvc_win32.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__support/win32/locale_win32.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__support/xlocale/__nop_locale_mgmt.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__support/xlocale/__posix_l_fallback.h",
|
||||
@@ -511,7 +523,14 @@ libcxx_headers = [
|
||||
"//buildtools/third_party/libc++/trunk/include/__thread/timed_backoff_policy.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__threading_support",
|
||||
"//buildtools/third_party/libc++/trunk/include/__tree",
|
||||
"//buildtools/third_party/libc++/trunk/include/__tuple",
|
||||
"//buildtools/third_party/libc++/trunk/include/__tuple/apply_cv.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__tuple/make_tuple_types.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__tuple/sfinae_helpers.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__tuple/tuple_element.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__tuple/tuple_indices.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__tuple/tuple_like.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__tuple/tuple_size.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__tuple/tuple_types.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/add_const.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/add_cv.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/add_lvalue_reference.h",
|
||||
@@ -539,6 +558,7 @@ libcxx_headers = [
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/integral_constant.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/is_abstract.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/is_aggregate.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/is_allocator.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/is_arithmetic.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/is_array.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/is_assignable.h",
|
||||
@@ -621,6 +641,7 @@ libcxx_headers = [
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/maybe_const.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/nat.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/negation.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/noexcept_move_assign_container.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/promote.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/rank.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__type_traits/remove_all_extents.h",
|
||||
@@ -645,6 +666,7 @@ libcxx_headers = [
|
||||
"//buildtools/third_party/libc++/trunk/include/__utility/declval.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__utility/exchange.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__utility/forward.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__utility/forward_like.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__utility/in_place.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__utility/integer_sequence.h",
|
||||
"//buildtools/third_party/libc++/trunk/include/__utility/move.h",
|
||||
|
||||
@@ -60,8 +60,8 @@ const splitPath = (archivePathOrBuffer: string | Buffer) => {
|
||||
// Convert asar archive's Stats object to fs's Stats object.
|
||||
let nextInode = 0;
|
||||
|
||||
const uid = process.getuid != null ? process.getuid() : 0;
|
||||
const gid = process.getgid != null ? process.getgid() : 0;
|
||||
const uid = process.getuid?.() ?? 0;
|
||||
const gid = process.getgid?.() ?? 0;
|
||||
|
||||
const fakeTime = new Date();
|
||||
|
||||
@@ -263,7 +263,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
};
|
||||
|
||||
const { lstat } = fs;
|
||||
fs.lstat = function (pathArgument: string, options: any, callback: any) {
|
||||
fs.lstat = (pathArgument: string, options: any, callback: any) => {
|
||||
const pathInfo = splitPath(pathArgument);
|
||||
if (typeof options === 'function') {
|
||||
callback = options;
|
||||
@@ -382,10 +382,10 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
|
||||
fs.promises.realpath = util.promisify(fs.realpath.native);
|
||||
|
||||
const { exists } = fs;
|
||||
fs.exists = (pathArgument: string, callback: any) => {
|
||||
const { exists: nativeExists } = fs;
|
||||
fs.exists = function exists (pathArgument: string, callback: any) {
|
||||
const pathInfo = splitPath(pathArgument);
|
||||
if (!pathInfo.isAsar) return exists(pathArgument, callback);
|
||||
if (!pathInfo.isAsar) return nativeExists(pathArgument, callback);
|
||||
const { asarPath, filePath } = pathInfo;
|
||||
|
||||
const archive = getOrCreateArchive(asarPath);
|
||||
@@ -399,9 +399,9 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
nextTick(callback, [pathExists]);
|
||||
};
|
||||
|
||||
fs.exists[util.promisify.custom] = (pathArgument: string) => {
|
||||
fs.exists[util.promisify.custom] = function exists (pathArgument: string) {
|
||||
const pathInfo = splitPath(pathArgument);
|
||||
if (!pathInfo.isAsar) return exists[util.promisify.custom](pathArgument);
|
||||
if (!pathInfo.isAsar) return nativeExists[util.promisify.custom](pathArgument);
|
||||
const { asarPath, filePath } = pathInfo;
|
||||
|
||||
const archive = getOrCreateArchive(asarPath);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as fs from 'fs';
|
||||
|
||||
import { Menu, deprecate } from 'electron/main';
|
||||
import { Menu } from 'electron/main';
|
||||
import * as deprecate from '@electron/internal/common/deprecate';
|
||||
|
||||
const bindings = process._linkedBinding('electron_browser_app');
|
||||
const commandLine = process._linkedBinding('electron_common_command_line');
|
||||
|
||||
@@ -68,7 +68,7 @@ const spawnUpdate = function (args: string[], detached: boolean, callback: Funct
|
||||
if (code !== 0) {
|
||||
// Disabled for backwards compatibility:
|
||||
// eslint-disable-next-line standard/no-callback-literal
|
||||
return callback(`Command failed: ${signal != null ? signal : code}\n${stderr}`);
|
||||
return callback(`Command failed: ${signal ?? code}\n${stderr}`);
|
||||
}
|
||||
|
||||
// Success.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { BaseWindow, WebContents, Event, BrowserView, TouchBar } from 'electron/main';
|
||||
import type { BrowserWindow as BWT } from 'electron/main';
|
||||
import * as deprecate from '@electron/internal/common/deprecate';
|
||||
const { BrowserWindow } = process._linkedBinding('electron_browser_window') as { BrowserWindow: typeof BWT };
|
||||
|
||||
Object.setPrototypeOf(BrowserWindow.prototype, BaseWindow.prototype);
|
||||
@@ -44,6 +45,28 @@ BrowserWindow.prototype._init = function (this: BWT) {
|
||||
this.on(event as any, visibilityChanged);
|
||||
}
|
||||
|
||||
const warn = deprecate.warnOnceMessage('\'scroll-touch-{begin,end,edge}\' are deprecated and will be removed. Please use the WebContents \'input-event\' event instead.');
|
||||
this.webContents.on('input-event', (_, e) => {
|
||||
if (e.type === 'gestureScrollBegin') {
|
||||
if (this.listenerCount('scroll-touch-begin') !== 0) {
|
||||
warn();
|
||||
this.emit('scroll-touch-edge');
|
||||
this.emit('scroll-touch-begin');
|
||||
}
|
||||
} else if (e.type === 'gestureScrollUpdate') {
|
||||
if (this.listenerCount('scroll-touch-edge') !== 0) {
|
||||
warn();
|
||||
this.emit('scroll-touch-edge');
|
||||
}
|
||||
} else if (e.type === 'gestureScrollEnd') {
|
||||
if (this.listenerCount('scroll-touch-end') !== 0) {
|
||||
warn();
|
||||
this.emit('scroll-touch-edge');
|
||||
this.emit('scroll-touch-end');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Notify the creation of the window.
|
||||
const event = process._linkedBinding('electron_browser_event').createEmpty();
|
||||
app.emit('browser-window-created', event, this);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { app, deprecate } from 'electron/main';
|
||||
import { app } from 'electron/main';
|
||||
import * as deprecate from '@electron/internal/common/deprecate';
|
||||
|
||||
const binding = process._linkedBinding('electron_browser_crash_reporter');
|
||||
|
||||
|
||||
@@ -9,8 +9,7 @@ let currentlyRunning: {
|
||||
|
||||
// |options.types| can't be empty and must be an array
|
||||
function isValid (options: Electron.SourcesOptions) {
|
||||
const types = options ? options.types : undefined;
|
||||
return Array.isArray(types);
|
||||
return Array.isArray(options?.types);
|
||||
}
|
||||
|
||||
export async function getSources (args: Electron.SourcesOptions) {
|
||||
|
||||
@@ -4,7 +4,12 @@ let _inAppPurchase;
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
const { inAppPurchase } = process._linkedBinding('electron_browser_in_app_purchase');
|
||||
|
||||
const _purchase = inAppPurchase.purchaseProduct as (productID: string, quantity?: number, username?: string) => Promise<boolean>;
|
||||
inAppPurchase.purchaseProduct = (productID: string, opts?: number | { quantity?: number, username?: string }) => {
|
||||
const quantity = typeof opts === 'object' ? opts.quantity : opts;
|
||||
const username = typeof opts === 'object' ? opts.username : undefined;
|
||||
return _purchase.apply(inAppPurchase, [productID, quantity, username]);
|
||||
};
|
||||
_inAppPurchase = inAppPurchase;
|
||||
} else {
|
||||
_inAppPurchase = new EventEmitter();
|
||||
|
||||
@@ -31,6 +31,7 @@ export const browserModuleList: ElectronInternal.ModuleEntry[] = [
|
||||
{ name: 'systemPreferences', loader: () => require('./system-preferences') },
|
||||
{ name: 'TouchBar', loader: () => require('./touch-bar') },
|
||||
{ name: 'Tray', loader: () => require('./tray') },
|
||||
{ name: 'utilityProcess', loader: () => require('./utility-process') },
|
||||
{ name: 'View', loader: () => require('./view') },
|
||||
{ name: 'webContents', loader: () => require('./web-contents') },
|
||||
{ name: 'WebContentsView', loader: () => require('./web-contents-view') },
|
||||
|
||||
@@ -395,7 +395,7 @@ class TouchBar extends EventEmitter implements Electron.TouchBar {
|
||||
this.on('change', changeListener);
|
||||
|
||||
const escapeItemListener = (item: Electron.TouchBarItemType | null) => {
|
||||
window._setEscapeTouchBarItem(item != null ? item : {});
|
||||
window._setEscapeTouchBarItem(item ?? {});
|
||||
};
|
||||
this.on('escape-item-change', escapeItemListener);
|
||||
|
||||
|
||||
150
lib/browser/api/utility-process.ts
Normal file
150
lib/browser/api/utility-process.ts
Normal file
@@ -0,0 +1,150 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import { Duplex, PassThrough } from 'stream';
|
||||
import { Socket } from 'net';
|
||||
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
||||
const { _fork } = process._linkedBinding('electron_browser_utility_process');
|
||||
|
||||
class ForkUtilityProcess extends EventEmitter {
|
||||
#handle: ElectronInternal.UtilityProcessWrapper | null;
|
||||
#stdout: Duplex | null = null;
|
||||
#stderr: Duplex | null = null;
|
||||
constructor (modulePath: string, args?: string[], options?: Electron.ForkOptions) {
|
||||
super();
|
||||
|
||||
if (!modulePath) {
|
||||
throw new Error('Missing UtilityProcess entry script.');
|
||||
}
|
||||
|
||||
if (args == null) {
|
||||
args = [];
|
||||
} else if (typeof args === 'object' && !Array.isArray(args)) {
|
||||
options = args;
|
||||
args = [];
|
||||
}
|
||||
|
||||
if (options == null) {
|
||||
options = {};
|
||||
} else {
|
||||
options = { ...options };
|
||||
}
|
||||
|
||||
if (!options) {
|
||||
throw new Error('Options cannot be undefined.');
|
||||
}
|
||||
|
||||
if (options.execArgv != null) {
|
||||
if (!Array.isArray(options.execArgv)) {
|
||||
throw new Error('execArgv must be an array of strings.');
|
||||
}
|
||||
}
|
||||
|
||||
if (options.serviceName != null) {
|
||||
if (typeof options.serviceName !== 'string') {
|
||||
throw new Error('serviceName must be a string.');
|
||||
}
|
||||
}
|
||||
|
||||
if (options.cwd != null) {
|
||||
if (typeof options.cwd !== 'string') {
|
||||
throw new Error('cwd path must be a string.');
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof options.stdio === 'string') {
|
||||
const stdio : Array<'pipe' | 'ignore' | 'inherit'> = [];
|
||||
switch (options.stdio) {
|
||||
case 'inherit':
|
||||
case 'ignore':
|
||||
stdio.push('ignore', options.stdio, options.stdio);
|
||||
break;
|
||||
case 'pipe':
|
||||
this.#stderr = new PassThrough();
|
||||
this.#stdout = new PassThrough();
|
||||
stdio.push('ignore', options.stdio, options.stdio);
|
||||
break;
|
||||
default:
|
||||
throw new Error('stdio must be of the following values: inherit, pipe, ignore');
|
||||
}
|
||||
options.stdio = stdio;
|
||||
} else if (Array.isArray(options.stdio)) {
|
||||
if (options.stdio.length >= 3) {
|
||||
if (options.stdio[0] !== 'ignore') {
|
||||
throw new Error('stdin value other than ignore is not supported.');
|
||||
}
|
||||
|
||||
if (options.stdio[1] === 'pipe') {
|
||||
this.#stdout = new PassThrough();
|
||||
} else if (options.stdio[1] !== 'ignore' && options.stdio[1] !== 'inherit') {
|
||||
throw new Error('stdout configuration must be of the following values: inherit, pipe, ignore');
|
||||
}
|
||||
|
||||
if (options.stdio[2] === 'pipe') {
|
||||
this.#stderr = new PassThrough();
|
||||
} else if (options.stdio[2] !== 'ignore' && options.stdio[2] !== 'inherit') {
|
||||
throw new Error('stderr configuration must be of the following values: inherit, pipe, ignore');
|
||||
}
|
||||
} else {
|
||||
throw new Error('configuration missing for stdin, stdout or stderr.');
|
||||
}
|
||||
}
|
||||
|
||||
this.#handle = _fork({ options, modulePath, args });
|
||||
this.#handle!.emit = (channel: string | symbol, ...args: any[]) => {
|
||||
if (channel === 'exit') {
|
||||
try {
|
||||
this.emit('exit', ...args);
|
||||
} finally {
|
||||
this.#handle = null;
|
||||
if (this.#stdout) {
|
||||
this.#stdout.removeAllListeners();
|
||||
this.#stdout = null;
|
||||
}
|
||||
if (this.#stderr) {
|
||||
this.#stderr.removeAllListeners();
|
||||
this.#stderr = null;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else if (channel === 'stdout' && this.#stdout) {
|
||||
new Socket({ fd: args[0], readable: true }).pipe(this.#stdout);
|
||||
return true;
|
||||
} else if (channel === 'stderr' && this.#stderr) {
|
||||
new Socket({ fd: args[0], readable: true }).pipe(this.#stderr);
|
||||
return true;
|
||||
} else {
|
||||
return this.emit(channel, ...args);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
get pid () {
|
||||
return this.#handle?.pid;
|
||||
}
|
||||
|
||||
get stdout () {
|
||||
return this.#stdout;
|
||||
}
|
||||
|
||||
get stderr () {
|
||||
return this.#stderr;
|
||||
}
|
||||
|
||||
postMessage (message: any, transfer?: MessagePortMain[]) {
|
||||
if (Array.isArray(transfer)) {
|
||||
transfer = transfer.map((o: any) => o instanceof MessagePortMain ? o._internalPort : o);
|
||||
return this.#handle?.postMessage(message, transfer);
|
||||
}
|
||||
return this.#handle?.postMessage(message);
|
||||
}
|
||||
|
||||
kill () : boolean {
|
||||
if (this.#handle === null) {
|
||||
return false;
|
||||
}
|
||||
return this.#handle.kill();
|
||||
}
|
||||
}
|
||||
|
||||
export function fork (modulePath: string, args?: string[], options?: Electron.ForkOptions) {
|
||||
return new ForkUtilityProcess(modulePath, args, options);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { app, ipcMain, session, webFrameMain, deprecate } from 'electron/main';
|
||||
import { app, ipcMain, session, webFrameMain } from 'electron/main';
|
||||
import type { BrowserWindowConstructorOptions, LoadURLOptions } from 'electron/main';
|
||||
|
||||
import * as url from 'url';
|
||||
@@ -10,6 +10,7 @@ import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-util
|
||||
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||
import { IpcMainImpl } from '@electron/internal/browser/ipc-main-impl';
|
||||
import * as deprecate from '@electron/internal/common/deprecate';
|
||||
|
||||
// session is not used here, the purpose is to make sure session is initialized
|
||||
// before the webContents module.
|
||||
@@ -595,7 +596,7 @@ WebContents.prototype._init = function () {
|
||||
event.sendReply({ error: error.toString() });
|
||||
};
|
||||
const maybeWebFrame = getWebFrameForEvent(event);
|
||||
const targets: (ElectronInternal.IpcMainInternal| null)[] = internal ? [ipcMainInternal] : [maybeWebFrame && maybeWebFrame.ipc, ipc, ipcMain];
|
||||
const targets: (ElectronInternal.IpcMainInternal| undefined)[] = internal ? [ipcMainInternal] : [maybeWebFrame?.ipc, ipc, ipcMain];
|
||||
const target = targets.find(target => target && (target as any)._invokeHandlers.has(channel));
|
||||
if (target) {
|
||||
(target as any)._invokeHandlers.get(channel)(event, ...args);
|
||||
@@ -677,7 +678,6 @@ WebContents.prototype._init = function () {
|
||||
const options = result.browserWindowConstructorOptions;
|
||||
if (!event.defaultPrevented) {
|
||||
openGuestWindow({
|
||||
event,
|
||||
embedder: event.sender,
|
||||
disposition,
|
||||
referrer,
|
||||
@@ -724,18 +724,16 @@ WebContents.prototype._init = function () {
|
||||
transparent: windowOpenOverriddenOptions.transparent,
|
||||
...windowOpenOverriddenOptions.webPreferences
|
||||
} : undefined;
|
||||
// TODO(zcbenz): The features string is parsed twice: here where it is
|
||||
// passed to C++, and in |makeBrowserWindowOptions| later where it is
|
||||
// not actually used since the WebContents is created here.
|
||||
// We should be able to remove the latter once the |new-window| event
|
||||
// is removed.
|
||||
const { webPreferences: parsedWebPreferences } = parseFeatures(rawFeatures);
|
||||
// Parameters should keep same with |makeBrowserWindowOptions|.
|
||||
const webPreferences = makeWebPreferences({
|
||||
embedder: event.sender,
|
||||
insecureParsedWebPreferences: parsedWebPreferences,
|
||||
secureOverrideWebPreferences
|
||||
});
|
||||
windowOpenOverriddenOptions = {
|
||||
...windowOpenOverriddenOptions,
|
||||
webPreferences
|
||||
};
|
||||
this._setNextChildWebPreferences(webPreferences);
|
||||
}
|
||||
});
|
||||
@@ -757,7 +755,6 @@ WebContents.prototype._init = function () {
|
||||
}
|
||||
|
||||
openGuestWindow({
|
||||
event,
|
||||
embedder: event.sender,
|
||||
guest: webContents,
|
||||
overrideBrowserWindowOptions: overriddenOptions,
|
||||
|
||||
@@ -22,13 +22,6 @@ const supportedWebViewEvents = Object.keys(webViewEvents);
|
||||
const guestInstances = new Map<number, GuestInstance>();
|
||||
const embedderElementsMap = new Map<string, number>();
|
||||
|
||||
function sanitizeOptionsForGuest (options: Record<string, any>) {
|
||||
const ret = { ...options };
|
||||
// WebContents values can't be sent over IPC.
|
||||
delete ret.webContents;
|
||||
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
|
||||
@@ -38,8 +31,8 @@ function makeWebPreferences (embedder: Electron.WebContents, params: Record<stri
|
||||
: null;
|
||||
|
||||
const webPreferences: Electron.WebPreferences = {
|
||||
nodeIntegration: params.nodeintegration != null ? params.nodeintegration : false,
|
||||
nodeIntegrationInSubFrames: params.nodeintegrationinsubframes != null ? params.nodeintegrationinsubframes : false,
|
||||
nodeIntegration: params.nodeintegration ?? false,
|
||||
nodeIntegrationInSubFrames: params.nodeintegrationinsubframes ?? false,
|
||||
plugins: params.plugins,
|
||||
zoomFactor: embedder.zoomFactor,
|
||||
disablePopups: !params.allowpopups,
|
||||
@@ -156,15 +149,6 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
|
||||
});
|
||||
}
|
||||
|
||||
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)
|
||||
});
|
||||
});
|
||||
|
||||
// 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', {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* out-of-process (cross-origin) are created here. "Embedder" roughly means
|
||||
* "parent."
|
||||
*/
|
||||
import { BrowserWindow, deprecate } from 'electron/main';
|
||||
import { BrowserWindow } from 'electron/main';
|
||||
import type { BrowserWindowConstructorOptions, Referrer, WebContents, LoadURLOptions } from 'electron/main';
|
||||
import { parseFeatures } from '@electron/internal/browser/parse-features-string';
|
||||
|
||||
@@ -24,13 +24,8 @@ const getGuestWindowByFrameName = (name: string) => frameNamesToWindow.get(name)
|
||||
/**
|
||||
* `openGuestWindow` is called to create and setup event handling for the new
|
||||
* window.
|
||||
*
|
||||
* Until its removal in 12.0.0, the `new-window` event is fired, allowing the
|
||||
* user to preventDefault() on the passed event (which ends up calling
|
||||
* DestroyWebContents).
|
||||
*/
|
||||
export function openGuestWindow ({ event, embedder, guest, referrer, disposition, postData, overrideBrowserWindowOptions, windowOpenArgs, outlivesOpener }: {
|
||||
event: { sender: WebContents, defaultPrevented: boolean },
|
||||
export function openGuestWindow ({ embedder, guest, referrer, disposition, postData, overrideBrowserWindowOptions, windowOpenArgs, outlivesOpener }: {
|
||||
embedder: WebContents,
|
||||
guest?: WebContents,
|
||||
referrer: Referrer,
|
||||
@@ -41,23 +36,14 @@ export function openGuestWindow ({ event, embedder, guest, referrer, disposition
|
||||
outlivesOpener: boolean,
|
||||
}): BrowserWindow | undefined {
|
||||
const { url, frameName, features } = windowOpenArgs;
|
||||
const browserWindowOptions = makeBrowserWindowOptions({
|
||||
embedder,
|
||||
features,
|
||||
overrideOptions: overrideBrowserWindowOptions
|
||||
});
|
||||
|
||||
const didCancelEvent = emitDeprecatedNewWindowEvent({
|
||||
event,
|
||||
embedder,
|
||||
guest,
|
||||
browserWindowOptions,
|
||||
windowOpenArgs,
|
||||
disposition,
|
||||
postData,
|
||||
referrer
|
||||
});
|
||||
if (didCancelEvent) return;
|
||||
const { options: parsedOptions } = parseFeatures(features);
|
||||
const browserWindowOptions = {
|
||||
show: true,
|
||||
width: 800,
|
||||
height: 600,
|
||||
...parsedOptions,
|
||||
...overrideBrowserWindowOptions
|
||||
};
|
||||
|
||||
// To spec, subsequent window.open calls with the same frame name (`target` in
|
||||
// spec parlance) will reuse the previous window.
|
||||
@@ -134,68 +120,6 @@ const handleWindowLifecycleEvents = function ({ embedder, guest, frameName, outl
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Deprecated in favor of `webContents.setWindowOpenHandler` and
|
||||
* `did-create-window` in 11.0.0. Will be removed in 12.0.0.
|
||||
*/
|
||||
function emitDeprecatedNewWindowEvent ({ event, embedder, guest, windowOpenArgs, browserWindowOptions, disposition, referrer, postData }: {
|
||||
event: { sender: WebContents, defaultPrevented: boolean, newGuest?: BrowserWindow },
|
||||
embedder: WebContents,
|
||||
guest?: WebContents,
|
||||
windowOpenArgs: WindowOpenArgs,
|
||||
browserWindowOptions: BrowserWindowConstructorOptions,
|
||||
disposition: string,
|
||||
referrer: Referrer,
|
||||
postData?: PostData,
|
||||
}): boolean {
|
||||
const { url, frameName } = windowOpenArgs;
|
||||
const isWebViewWithPopupsDisabled = embedder.getType() === 'webview' && embedder.getLastWebPreferences()!.disablePopups;
|
||||
const postBody = postData ? {
|
||||
data: postData,
|
||||
...parseContentTypeFormat(postData)
|
||||
} : null;
|
||||
|
||||
if (embedder.listenerCount('new-window') > 0) {
|
||||
deprecate.log('The new-window event is deprecated and will be removed. Please use contents.setWindowOpenHandler() instead.');
|
||||
}
|
||||
|
||||
embedder.emit(
|
||||
'new-window',
|
||||
event,
|
||||
url,
|
||||
frameName,
|
||||
disposition,
|
||||
{
|
||||
...browserWindowOptions,
|
||||
webContents: guest
|
||||
},
|
||||
[], // additionalFeatures
|
||||
referrer,
|
||||
postBody
|
||||
);
|
||||
|
||||
const { newGuest } = event;
|
||||
if (isWebViewWithPopupsDisabled) return true;
|
||||
if (event.defaultPrevented) {
|
||||
if (newGuest) {
|
||||
if (guest === newGuest.webContents) {
|
||||
// The webContents is not changed, so set defaultPrevented to false to
|
||||
// stop the callers of this event from destroying the webContents.
|
||||
event.defaultPrevented = false;
|
||||
}
|
||||
|
||||
handleWindowLifecycleEvents({
|
||||
embedder: event.sender,
|
||||
guest: newGuest,
|
||||
frameName,
|
||||
outlivesOpener: false
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Security options that child windows will always inherit from parent windows
|
||||
const securityWebPreferences: { [key: string]: boolean } = {
|
||||
contextIsolation: true,
|
||||
@@ -207,31 +131,6 @@ const securityWebPreferences: { [key: string]: boolean } = {
|
||||
enableWebSQL: false
|
||||
};
|
||||
|
||||
function makeBrowserWindowOptions ({ embedder, features, overrideOptions }: {
|
||||
embedder: WebContents,
|
||||
features: string,
|
||||
overrideOptions?: BrowserWindowConstructorOptions,
|
||||
}) {
|
||||
const { options: parsedOptions, webPreferences: parsedWebPreferences } = parseFeatures(features);
|
||||
|
||||
return {
|
||||
show: true,
|
||||
width: 800,
|
||||
height: 600,
|
||||
...parsedOptions,
|
||||
...overrideOptions,
|
||||
// Note that for normal code path an existing WebContents created by
|
||||
// Chromium will be used, with web preferences parsed in the
|
||||
// |-will-add-new-contents| event.
|
||||
// The |webPreferences| here is only used by the |new-window| event.
|
||||
webPreferences: makeWebPreferences({
|
||||
embedder,
|
||||
insecureParsedWebPreferences: parsedWebPreferences,
|
||||
secureOverrideWebPreferences: overrideOptions && overrideOptions.webPreferences
|
||||
})
|
||||
} as Electron.BrowserViewConstructorOptions;
|
||||
}
|
||||
|
||||
export function makeWebPreferences ({ embedder, secureOverrideWebPreferences = {}, insecureParsedWebPreferences: parsedWebPreferences = {} }: {
|
||||
embedder: WebContents,
|
||||
insecureParsedWebPreferences?: ReturnType<typeof parseFeatures>['webPreferences'],
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
let deprecationHandler: ElectronInternal.DeprecationHandler | null = null;
|
||||
|
||||
function warnOnce (oldName: string, newName?: string) {
|
||||
let warned = false;
|
||||
const msg = newName
|
||||
? `'${oldName}' is deprecated and will be removed. Please use '${newName}' instead.`
|
||||
: `'${oldName}' is deprecated and will be removed.`;
|
||||
return () => {
|
||||
if (!warned && !process.noDeprecation) {
|
||||
warned = true;
|
||||
deprecate.log(msg);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const deprecate: ElectronInternal.DeprecationUtil = {
|
||||
warnOnce,
|
||||
setHandler: (handler) => { deprecationHandler = handler; },
|
||||
getHandler: () => deprecationHandler,
|
||||
warn: (oldName, newName) => {
|
||||
if (!process.noDeprecation) {
|
||||
deprecate.log(`'${oldName}' is deprecated. Use '${newName}' instead.`);
|
||||
}
|
||||
},
|
||||
log: (message) => {
|
||||
if (typeof deprecationHandler === 'function') {
|
||||
deprecationHandler(message);
|
||||
} else if (process.throwDeprecation) {
|
||||
throw new Error(message);
|
||||
} else if (process.traceDeprecation) {
|
||||
return console.trace(message);
|
||||
} else {
|
||||
return console.warn(`(electron) ${message}`);
|
||||
}
|
||||
},
|
||||
|
||||
// remove a function with no replacement
|
||||
removeFunction: (fn, removedName) => {
|
||||
if (!fn) { throw Error(`'${removedName} function' is invalid or does not exist.`); }
|
||||
|
||||
// wrap the deprecated function to warn user
|
||||
const warn = warnOnce(`${fn.name} function`);
|
||||
return function (this: any) {
|
||||
warn();
|
||||
fn.apply(this, arguments);
|
||||
} as unknown as typeof fn;
|
||||
},
|
||||
|
||||
// change the name of a function
|
||||
renameFunction: (fn, newName) => {
|
||||
const warn = warnOnce(`${fn.name} function`, `${newName} function`);
|
||||
return function (this: any) {
|
||||
warn();
|
||||
return fn.apply(this, arguments);
|
||||
} as unknown as typeof fn;
|
||||
},
|
||||
|
||||
moveAPI<T extends Function> (fn: T, oldUsage: string, newUsage: string): T {
|
||||
const warn = warnOnce(oldUsage, newUsage);
|
||||
return function (this: any) {
|
||||
warn();
|
||||
return fn.apply(this, arguments);
|
||||
} as unknown as typeof fn;
|
||||
},
|
||||
|
||||
// change the name of an event
|
||||
event: (emitter, oldName, newName) => {
|
||||
const warn = newName.startsWith('-') /* internal event */
|
||||
? warnOnce(`${oldName} event`)
|
||||
: warnOnce(`${oldName} event`, `${newName} event`);
|
||||
return emitter.on(newName, function (this: NodeJS.EventEmitter, ...args) {
|
||||
if (this.listenerCount(oldName) !== 0) {
|
||||
warn();
|
||||
this.emit(oldName, ...args);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// remove a property with no replacement
|
||||
removeProperty: (o, removedName, onlyForValues) => {
|
||||
// if the property's already been removed, warn about it
|
||||
const info = Object.getOwnPropertyDescriptor((o as any).__proto__, removedName) // eslint-disable-line
|
||||
if (!info) {
|
||||
deprecate.log(`Unable to remove property '${removedName}' from an object that lacks it.`);
|
||||
return o;
|
||||
}
|
||||
if (!info.get || !info.set) {
|
||||
deprecate.log(`Unable to remove property '${removedName}' from an object does not have a getter / setter`);
|
||||
return o;
|
||||
}
|
||||
|
||||
// wrap the deprecated property in an accessor to warn
|
||||
const warn = warnOnce(removedName);
|
||||
return Object.defineProperty(o, removedName, {
|
||||
configurable: true,
|
||||
get: () => {
|
||||
warn();
|
||||
return info.get!.call(o);
|
||||
},
|
||||
set: newVal => {
|
||||
if (!onlyForValues || onlyForValues.includes(newVal)) {
|
||||
warn();
|
||||
}
|
||||
return info.set!.call(o, newVal);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// change the name of a property
|
||||
renameProperty: (o, oldName, newName) => {
|
||||
const warn = warnOnce(oldName, newName);
|
||||
|
||||
// if the new property isn't there yet,
|
||||
// inject it and warn about it
|
||||
if ((oldName in o) && !(newName in o)) {
|
||||
warn();
|
||||
o[newName] = (o as any)[oldName];
|
||||
}
|
||||
|
||||
// wrap the deprecated property in an accessor to warn
|
||||
// and redirect to the new property
|
||||
return Object.defineProperty(o, oldName, {
|
||||
get: () => {
|
||||
warn();
|
||||
return o[newName];
|
||||
},
|
||||
set: value => {
|
||||
warn();
|
||||
o[newName] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default deprecate;
|
||||
@@ -2,7 +2,5 @@
|
||||
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 }
|
||||
{ name: 'shell', loader: () => require('./shell') }
|
||||
];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user