mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
351 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c42564337 | ||
|
|
479fc57cef | ||
|
|
b2fb14fd48 | ||
|
|
d8f90444aa | ||
|
|
045331666c | ||
|
|
0ac42125d2 | ||
|
|
ce04014739 | ||
|
|
19bd97d80c | ||
|
|
ea2e34c4c3 | ||
|
|
5f6498d13a | ||
|
|
e3c1292548 | ||
|
|
b3e53839a4 | ||
|
|
f3e9f10cad | ||
|
|
2c8927a9a2 | ||
|
|
c6786aed26 | ||
|
|
5b3b09fb7f | ||
|
|
9f5924c5ea | ||
|
|
25f5d764ac | ||
|
|
941c72fcfe | ||
|
|
663d389925 | ||
|
|
b8e3477092 | ||
|
|
035c784b6c | ||
|
|
8faf8a3535 | ||
|
|
331125d35a | ||
|
|
7316ebde79 | ||
|
|
c3340ad21c | ||
|
|
1e84816c96 | ||
|
|
58c6ea5de8 | ||
|
|
34be80602c | ||
|
|
ce40be475b | ||
|
|
5f7bd36119 | ||
|
|
0f19193afd | ||
|
|
06b3b0ea15 | ||
|
|
32f973b010 | ||
|
|
ad2c2a055b | ||
|
|
3069ef3827 | ||
|
|
d70b1c68fe | ||
|
|
3ba4a35c9c | ||
|
|
2c4c1a3dd9 | ||
|
|
a4d8974556 | ||
|
|
b7d4759c19 | ||
|
|
d6ecc65df3 | ||
|
|
98b67cdb69 | ||
|
|
eb37822e03 | ||
|
|
8751f485c5 | ||
|
|
bfef6a54f0 | ||
|
|
5fd403b571 | ||
|
|
abe8c7168a | ||
|
|
5c32d18248 | ||
|
|
c1da7b5238 | ||
|
|
5b75a4a4be | ||
|
|
57e36afc7e | ||
|
|
a4ea27de36 | ||
|
|
7ba879711a | ||
|
|
f057b0e494 | ||
|
|
fa01a20f9b | ||
|
|
579f7a1899 | ||
|
|
920a82a4de | ||
|
|
b501c40bd6 | ||
|
|
672aa1c67f | ||
|
|
b305784aa3 | ||
|
|
c4efeef92c | ||
|
|
96b41d0930 | ||
|
|
1f652f08f8 | ||
|
|
d12c157242 | ||
|
|
68873fbadb | ||
|
|
526d748b7e | ||
|
|
54109cb04d | ||
|
|
542f30b54b | ||
|
|
07ea340314 | ||
|
|
524d6a5d79 | ||
|
|
a0431e1265 | ||
|
|
647299fa9f | ||
|
|
ee5d52440b | ||
|
|
d4a79bc4c0 | ||
|
|
e37f69c467 | ||
|
|
df6faec72e | ||
|
|
691ddb3f67 | ||
|
|
b4e1b840cd | ||
|
|
6f12b67582 | ||
|
|
33f5fa3c56 | ||
|
|
6f88108132 | ||
|
|
05a7f5f492 | ||
|
|
b878a5ea4c | ||
|
|
8756ff0349 | ||
|
|
20c5a3b9e1 | ||
|
|
ddb62e8d7c | ||
|
|
077e35c576 | ||
|
|
eb63062889 | ||
|
|
cac6db76a0 | ||
|
|
9257c315ac | ||
|
|
031480c3db | ||
|
|
9f9d3e98bf | ||
|
|
ae639186e3 | ||
|
|
6e4690574d | ||
|
|
c83dc5be92 | ||
|
|
63cb360df0 | ||
|
|
b311235165 | ||
|
|
6cd2623a87 | ||
|
|
9aa81de83d | ||
|
|
0f246b6be7 | ||
|
|
5be76fd4ea | ||
|
|
a315283f88 | ||
|
|
b741cbf3d7 | ||
|
|
031c0d6951 | ||
|
|
3639a82915 | ||
|
|
7fe2cad354 | ||
|
|
de2e12343e | ||
|
|
69598ae5c6 | ||
|
|
0f0a7e6b1e | ||
|
|
a0dcb55d6c | ||
|
|
ee35482d97 | ||
|
|
8317553cd4 | ||
|
|
ebf98e8af4 | ||
|
|
cfe350a534 | ||
|
|
854dcb3247 | ||
|
|
882ce295ee | ||
|
|
1ac31e18b7 | ||
|
|
957717e483 | ||
|
|
d1ccfea882 | ||
|
|
232ca04edd | ||
|
|
2888e46b7a | ||
|
|
4464a04f35 | ||
|
|
37baff1e31 | ||
|
|
dde19b0583 | ||
|
|
e2b9cd7b7c | ||
|
|
ecd398f8bd | ||
|
|
21f544392b | ||
|
|
5c93682a89 | ||
|
|
1db64c9e51 | ||
|
|
3a747eddbb | ||
|
|
51504aee64 | ||
|
|
360e8a2eb8 | ||
|
|
4447a63f20 | ||
|
|
ceb3b0cf54 | ||
|
|
89607e647d | ||
|
|
c8e2a6261e | ||
|
|
e9814e016b | ||
|
|
dc9654c03c | ||
|
|
fce3426675 | ||
|
|
637cf8a02b | ||
|
|
daab432fb6 | ||
|
|
50dac1d908 | ||
|
|
d4f915e428 | ||
|
|
72bccd1305 | ||
|
|
9439388b7b | ||
|
|
b0fee4b067 | ||
|
|
7c33fc0c5c | ||
|
|
f263a3f755 | ||
|
|
1af3a71fdb | ||
|
|
9f2371fc4e | ||
|
|
f658c1aeb4 | ||
|
|
c196121467 | ||
|
|
133ac9a323 | ||
|
|
a326408bce | ||
|
|
2085111c43 | ||
|
|
7ae8d54265 | ||
|
|
c5574c8667 | ||
|
|
6cf8abc3b3 | ||
|
|
46a4864b08 | ||
|
|
7956b45323 | ||
|
|
63bcbd4ff5 | ||
|
|
3b5ca91a40 | ||
|
|
80282ba972 | ||
|
|
7ddb3dd184 | ||
|
|
0cee5cc1c1 | ||
|
|
048d770a0e | ||
|
|
b3fdb242f0 | ||
|
|
38d908ee6a | ||
|
|
416b850dd2 | ||
|
|
714e068cba | ||
|
|
0a0689587a | ||
|
|
83c4633b21 | ||
|
|
a33063c8a7 | ||
|
|
c478d45713 | ||
|
|
74686a9cb3 | ||
|
|
473a90f99f | ||
|
|
15e9f22fda | ||
|
|
ee44155f7a | ||
|
|
bf64b34475 | ||
|
|
26dbd2218e | ||
|
|
38e46abf0b | ||
|
|
67f7bf4a23 | ||
|
|
02f040c765 | ||
|
|
9b841e4594 | ||
|
|
a40957f2bc | ||
|
|
a6121f527c | ||
|
|
71a31d553f | ||
|
|
1a309fd55f | ||
|
|
73527e54c5 | ||
|
|
2ef0827767 | ||
|
|
76bcab07e6 | ||
|
|
5a5b6abd2c | ||
|
|
4ce5a48076 | ||
|
|
7b61e6044a | ||
|
|
048f06c7f5 | ||
|
|
06868c938f | ||
|
|
22e8fc6379 | ||
|
|
427c139eff | ||
|
|
6a881520ee | ||
|
|
5a2c451c0b | ||
|
|
f47fbccf1a | ||
|
|
eb419946ad | ||
|
|
1b204a4369 | ||
|
|
ee2de310f5 | ||
|
|
e81aa83a14 | ||
|
|
96cae44f32 | ||
|
|
757e7a91a9 | ||
|
|
6faef05095 | ||
|
|
ee65a190fa | ||
|
|
da45f0341a | ||
|
|
c6517c0b7f | ||
|
|
2c92573978 | ||
|
|
fa7326af64 | ||
|
|
aca96553fc | ||
|
|
37592cdaee | ||
|
|
64e48ad0e6 | ||
|
|
68566583f0 | ||
|
|
6a56aa2240 | ||
|
|
7e8c1108e0 | ||
|
|
f5ce5f8218 | ||
|
|
28e44b31ca | ||
|
|
606ca98df0 | ||
|
|
acd2eabdfd | ||
|
|
07972c2892 | ||
|
|
70079d1c8a | ||
|
|
4def69876f | ||
|
|
61a2c7bd16 | ||
|
|
f53262d58f | ||
|
|
8c15619905 | ||
|
|
4a66bed930 | ||
|
|
8dabb3fe33 | ||
|
|
3f88934025 | ||
|
|
296dcc3405 | ||
|
|
5f6de7053a | ||
|
|
6c1eb46f68 | ||
|
|
05cde0d945 | ||
|
|
696c94c08a | ||
|
|
4284691cb3 | ||
|
|
2ab56802cb | ||
|
|
353d12b231 | ||
|
|
cbd734faf9 | ||
|
|
cf282c177f | ||
|
|
e8c8afb1b4 | ||
|
|
dd0d06448c | ||
|
|
3527fdc291 | ||
|
|
a6b9d68897 | ||
|
|
e1e7ec737f | ||
|
|
4fd03f59f4 | ||
|
|
e64e0f00ca | ||
|
|
1bfead2f6b | ||
|
|
c79f1ee720 | ||
|
|
e18c369e4a | ||
|
|
1953ab3bf2 | ||
|
|
d998bf9fed | ||
|
|
40eff3a778 | ||
|
|
9dd089fc56 | ||
|
|
5e2bd0e55f | ||
|
|
95b8be4cc4 | ||
|
|
d48f99fd6e | ||
|
|
3a9b934cc5 | ||
|
|
768f372675 | ||
|
|
9e3f0d5190 | ||
|
|
5a297f409f | ||
|
|
57335cea69 | ||
|
|
3331f51571 | ||
|
|
f122268ca8 | ||
|
|
bfc817fd28 | ||
|
|
2bd83d0e89 | ||
|
|
f29f3418ed | ||
|
|
c87a0077dd | ||
|
|
23c1dcea46 | ||
|
|
41e64d2469 | ||
|
|
5fdc24d3bf | ||
|
|
64dc86c8c2 | ||
|
|
9d1ec6b0eb | ||
|
|
8919480ebc | ||
|
|
bb9e68beee | ||
|
|
88c1f2caf7 | ||
|
|
88375be2b2 | ||
|
|
2aa69505f9 | ||
|
|
e78fe7c8da | ||
|
|
7a7b944c74 | ||
|
|
09f5a2b741 | ||
|
|
cbf50eabd9 | ||
|
|
90a74139c1 | ||
|
|
3a6cc1b786 | ||
|
|
f5fde13b14 | ||
|
|
c6d429d533 | ||
|
|
73df925241 | ||
|
|
269f4ba2bb | ||
|
|
9b304beb54 | ||
|
|
5ffad09e91 | ||
|
|
b694315cd3 | ||
|
|
8566315902 | ||
|
|
cd94ab9de3 | ||
|
|
09ebadaf5b | ||
|
|
990189ab35 | ||
|
|
049e536c5f | ||
|
|
7fe2f25341 | ||
|
|
c79809ddb9 | ||
|
|
b3edf86914 | ||
|
|
7044122f5d | ||
|
|
b7bcce9576 | ||
|
|
2560776888 | ||
|
|
d5d5fef931 | ||
|
|
6b158872fc | ||
|
|
a4ef2d4356 | ||
|
|
14cc902ad8 | ||
|
|
a62a367b9f | ||
|
|
8d67f16512 | ||
|
|
59cb78e9aa | ||
|
|
032552df57 | ||
|
|
1913926ebc | ||
|
|
dc979388ba | ||
|
|
bcabc25b93 | ||
|
|
ab6d22c958 | ||
|
|
806925ee79 | ||
|
|
a46b50fc7b | ||
|
|
517a5915d7 | ||
|
|
1de38af8cc | ||
|
|
66a95db3df | ||
|
|
7b779c6e6a | ||
|
|
429dfd7054 | ||
|
|
03f7a85cfb | ||
|
|
2d2a753dd9 | ||
|
|
028e3889f0 | ||
|
|
47eb123649 | ||
|
|
45ab098079 | ||
|
|
6cfc05ded2 | ||
|
|
40e0e8e499 | ||
|
|
beff8b8b51 | ||
|
|
311723396a | ||
|
|
d39d75321a | ||
|
|
55201d7db6 | ||
|
|
ac46d5b16e | ||
|
|
a1fb069624 | ||
|
|
3aa33dd220 | ||
|
|
9b74d0d54a | ||
|
|
018fc2ca46 | ||
|
|
e286b78df7 | ||
|
|
f77bd19a70 | ||
|
|
cff63d32a0 | ||
|
|
a8e7696674 | ||
|
|
5fc689dc4e | ||
|
|
895bdc0ee0 | ||
|
|
c99f1d317e | ||
|
|
315e3e325d | ||
|
|
8acce4279b | ||
|
|
c8943cdc3c | ||
|
|
f74f009648 |
@@ -41,14 +41,6 @@ parameters:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
run-linux-publish:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
run-macos-publish:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
# The config expects the following environment variables to be set:
|
||||
# - "SLACK_WEBHOOK" Slack hook URL to send notifications.
|
||||
#
|
||||
@@ -61,7 +53,7 @@ parameters:
|
||||
# Build machines configs.
|
||||
docker-image: &docker-image
|
||||
docker:
|
||||
- image: electron.azurecr.io/build:4cec2c5ab66765caa724e37bae2bffb9b29722a5
|
||||
- image: electronjs/build:d09fd95029bd8c1c73069888231b29688ef385ed
|
||||
|
||||
machine-linux-medium: &machine-linux-medium
|
||||
<<: *docker-image
|
||||
@@ -135,7 +127,7 @@ env-enable-sccache: &env-enable-sccache
|
||||
|
||||
env-send-slack-notifications: &env-send-slack-notifications
|
||||
NOTIFY_SLACK: true
|
||||
|
||||
|
||||
env-global: &env-global
|
||||
ELECTRON_OUT_DIR: Default
|
||||
|
||||
@@ -173,10 +165,6 @@ env-32bit-release: &env-32bit-release
|
||||
# Set symbol level to 1 for 32 bit releases because of https://crbug.com/648948
|
||||
GN_BUILDFLAG_ARGS: 'symbol_level = 1'
|
||||
|
||||
env-macos-build: &env-macos-build
|
||||
# Disable pre-compiled headers to reduce out size, only useful for rebuilds
|
||||
GN_BUILDFLAG_ARGS: 'enable_precompiled_headers = false'
|
||||
|
||||
# Individual (shared) steps.
|
||||
step-maybe-notify-slack-failure: &step-maybe-notify-slack-failure
|
||||
run:
|
||||
@@ -401,15 +389,8 @@ step-electron-build: &step-electron-build
|
||||
name: Electron build
|
||||
no_output_timeout: 30m
|
||||
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
|
||||
ninja -C out/Default electron -j $NUMBER_OF_NINJA_PROCESSES
|
||||
node electron/script/check-symlinks.js
|
||||
|
||||
step-native-unittests-build: &step-native-unittests-build
|
||||
run:
|
||||
@@ -473,37 +454,16 @@ step-electron-dist-store: &step-electron-dist-store
|
||||
path: src/out/Default/dist.zip
|
||||
destination: dist.zip
|
||||
|
||||
step-electron-maybe-chromedriver-gn-gen: &step-electron-maybe-chromedriver-gn-gen
|
||||
run:
|
||||
name: chromedriver GN gen
|
||||
command: |
|
||||
cd src
|
||||
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
|
||||
if [ "$USE_GOMA" == "true" ]; then
|
||||
gn gen out/chromedriver --args="import(\"$GN_CONFIG\") import(\"//electron/build/args/goma.gn\") is_component_ffmpeg=false proprietary_codecs=false $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
else
|
||||
gn gen out/chromedriver --args="import(\"$GN_CONFIG\") cc_wrapper=\"$SCCACHE_PATH\" is_component_ffmpeg=false proprietary_codecs=false $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
fi
|
||||
fi
|
||||
|
||||
step-electron-chromedriver-build: &step-electron-chromedriver-build
|
||||
run:
|
||||
name: Build chromedriver.zip
|
||||
command: |
|
||||
cd src
|
||||
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
|
||||
export CHROMEDRIVER_DIR="out/chromedriver"
|
||||
else
|
||||
export CHROMEDRIVER_DIR="out/Default"
|
||||
fi
|
||||
ninja -C $CHROMEDRIVER_DIR electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
||||
ninja -C out/Default chrome/test/chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
||||
if [ "`uname`" == "Linux" ]; then
|
||||
electron/script/strip-binaries.py --target-cpu="$TARGET_ARCH" --file $PWD/$CHROMEDRIVER_DIR/chromedriver
|
||||
fi
|
||||
ninja -C $CHROMEDRIVER_DIR electron:electron_chromedriver_zip
|
||||
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
|
||||
cp out/chromedriver/chromedriver.zip out/Default
|
||||
electron/script/strip-binaries.py --target-cpu="$TARGET_ARCH" --file $PWD/out/Default/chromedriver
|
||||
fi
|
||||
ninja -C out/Default electron:electron_chromedriver_zip
|
||||
|
||||
step-electron-chromedriver-store: &step-electron-chromedriver-store
|
||||
store_artifacts:
|
||||
@@ -534,7 +494,6 @@ step-electron-publish: &step-electron-publish
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
rm -rf src/out/Default/obj
|
||||
fi
|
||||
|
||||
cd src/electron
|
||||
if [ "$UPLOAD_TO_S3" == "1" ]; then
|
||||
echo 'Uploading Electron release distribution to S3'
|
||||
@@ -551,7 +510,6 @@ step-persist-data-for-tests: &step-persist-data-for-tests
|
||||
# Build artifacts
|
||||
- src/out/Default/dist.zip
|
||||
- src/out/Default/mksnapshot.zip
|
||||
- src/out/Default/chromedriver.zip
|
||||
- src/out/Default/shell_browser_ui_unittests
|
||||
- src/out/Default/gen/node_headers
|
||||
- src/out/ffmpeg/ffmpeg.zip
|
||||
@@ -582,20 +540,13 @@ step-mksnapshot-unzip: &step-mksnapshot-unzip
|
||||
cd src/out/Default
|
||||
unzip -o mksnapshot.zip
|
||||
|
||||
step-chromedriver-unzip: &step-chromedriver-unzip
|
||||
run:
|
||||
name: Unzip chromedriver.zip
|
||||
command: |
|
||||
cd src/out/Default
|
||||
unzip -o chromedriver.zip
|
||||
|
||||
step-ffmpeg-gn-gen: &step-ffmpeg-gn-gen
|
||||
run:
|
||||
name: ffmpeg GN gen
|
||||
command: |
|
||||
cd src
|
||||
if [ "$USE_GOMA" == "true" ]; then
|
||||
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") import(\"//electron/build/args/goma.gn\") $GN_EXTRA_ARGS"
|
||||
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS"
|
||||
else
|
||||
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") cc_wrapper=\"$SCCACHE_PATH\" $GN_EXTRA_ARGS"
|
||||
fi
|
||||
@@ -626,13 +577,6 @@ step-verify-mksnapshot: &step-verify-mksnapshot
|
||||
cd src
|
||||
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default
|
||||
|
||||
step-verify-chromedriver: &step-verify-chromedriver
|
||||
run:
|
||||
name: Verify ChromeDriver
|
||||
command: |
|
||||
cd src
|
||||
python electron/script/verify-chromedriver.py --source-root "$PWD" --build-dir out/Default
|
||||
|
||||
step-setup-linux-for-headless-testing: &step-setup-linux-for-headless-testing
|
||||
run:
|
||||
name: Setup for headless testing
|
||||
@@ -658,14 +602,11 @@ step-mksnapshot-build: &step-mksnapshot-build
|
||||
command: |
|
||||
cd src
|
||||
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
|
||||
if [ "`uname`" != "Darwin" ]; then
|
||||
if [ "$TARGET_ARCH" == "arm" ]; then
|
||||
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/mksnapshot
|
||||
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/v8_context_snapshot_generator
|
||||
elif [ "$TARGET_ARCH" == "arm64" ]; then
|
||||
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x64_v8_arm64/mksnapshot
|
||||
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x64_v8_arm64/v8_context_snapshot_generator
|
||||
else
|
||||
electron/script/strip-binaries.py --file $PWD/out/Default/mksnapshot
|
||||
electron/script/strip-binaries.py --file $PWD/out/Default/v8_context_snapshot_generator
|
||||
@@ -673,7 +614,6 @@ step-mksnapshot-build: &step-mksnapshot-build
|
||||
fi
|
||||
if [ "$SKIP_DIST_ZIP" != "1" ]; then
|
||||
ninja -C out/Default electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
|
||||
fi
|
||||
|
||||
step-mksnapshot-store: &step-mksnapshot-store
|
||||
@@ -702,6 +642,8 @@ step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols
|
||||
if [ "$GENERATE_SYMBOLS" == "true" ]; then
|
||||
cd src
|
||||
ninja -C out/Default electron:electron_symbols
|
||||
cd out/Default/breakpad_symbols
|
||||
find . -name \*.sym -print0 | xargs -0 npx @sentry/cli@1.51.1 difutil bundle-sources
|
||||
fi
|
||||
|
||||
step-maybe-zip-symbols: &step-maybe-zip-symbols
|
||||
@@ -778,16 +720,11 @@ step-ninja-summary: &step-ninja-summary
|
||||
command: |
|
||||
python depot_tools/post_build_ninja_summary.py -C src/out/Default
|
||||
|
||||
step-ninja-report: &step-ninja-report
|
||||
store_artifacts:
|
||||
path: src/out/Default/.ninja_log
|
||||
destination: ninja_log
|
||||
|
||||
# Checkout Steps
|
||||
step-generate-deps-hash: &step-generate-deps-hash
|
||||
run:
|
||||
name: Generate DEPS Hash
|
||||
command: node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
|
||||
command: node src/electron/script/generate-deps-hash.js
|
||||
|
||||
step-touch-sync-done: &step-touch-sync-done
|
||||
run:
|
||||
@@ -815,14 +752,6 @@ step-maybe-restore-git-cache: &step-maybe-restore-git-cache
|
||||
- v2-gclient-cache-{{ checksum "src/electron/.circle-sync-done" }}
|
||||
name: Conditionally restoring git cache
|
||||
|
||||
step-restore-out-cache: &step-restore-out-cache
|
||||
restore_cache:
|
||||
paths:
|
||||
- ./src/out/Default
|
||||
keys:
|
||||
- v8-out-cache-{{ checksum "src/electron/.depshash" }}-{{ checksum "src/electron/.depshash-target" }}
|
||||
name: Restoring out cache
|
||||
|
||||
step-set-git-cache-path: &step-set-git-cache-path
|
||||
run:
|
||||
name: Set GIT_CACHE_PATH to make gclient to use the cache
|
||||
@@ -840,13 +769,6 @@ step-save-git-cache: &step-save-git-cache
|
||||
key: v2-gclient-cache-{{ checksum "src/electron/.circle-sync-done" }}-{{ checksum "src/electron/DEPS" }}
|
||||
name: Persisting git cache
|
||||
|
||||
step-save-out-cache: &step-save-out-cache
|
||||
save_cache:
|
||||
paths:
|
||||
- ./src/out/Default
|
||||
key: v8-out-cache-{{ checksum "src/electron/.depshash" }}-{{ checksum "src/electron/.depshash-target" }}
|
||||
name: Persisting out cache
|
||||
|
||||
step-run-electron-only-hooks: &step-run-electron-only-hooks
|
||||
run:
|
||||
name: Run Electron Only Hooks
|
||||
@@ -855,7 +777,7 @@ step-run-electron-only-hooks: &step-run-electron-only-hooks
|
||||
step-generate-deps-hash-cleanly: &step-generate-deps-hash-cleanly
|
||||
run:
|
||||
name: Generate DEPS Hash
|
||||
command: (cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
|
||||
command: (cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js
|
||||
|
||||
# Mark the sync as done for future cache saving
|
||||
step-mark-sync-done: &step-mark-sync-done
|
||||
@@ -1062,6 +984,55 @@ 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-electron-build-for-publish: &steps-electron-build-for-publish
|
||||
steps:
|
||||
- *step-checkout-electron
|
||||
- *step-depot-tools-get
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-restore-brew-cache
|
||||
- *step-get-more-space-on-mac
|
||||
- *step-gclient-sync
|
||||
- *step-setup-env-for-build
|
||||
- *step-delete-git-directories
|
||||
- *step-minimize-workspace-size-from-checkout
|
||||
- *step-gn-gen-default
|
||||
|
||||
# Electron app
|
||||
- *step-electron-build
|
||||
- *step-maybe-generate-breakpad-symbols
|
||||
- *step-maybe-electron-dist-strip
|
||||
- *step-electron-dist-build
|
||||
- *step-electron-dist-store
|
||||
- *step-maybe-zip-symbols
|
||||
- *step-symbols-store
|
||||
|
||||
# mksnapshot
|
||||
- *step-mksnapshot-build
|
||||
- *step-mksnapshot-store
|
||||
|
||||
# chromedriver
|
||||
- *step-electron-chromedriver-build
|
||||
- *step-electron-chromedriver-store
|
||||
|
||||
# Node.js headers
|
||||
- *step-nodejs-headers-build
|
||||
- *step-nodejs-headers-store
|
||||
|
||||
# ffmpeg
|
||||
- *step-ffmpeg-gn-gen
|
||||
- *step-ffmpeg-build
|
||||
- *step-ffmpeg-store
|
||||
|
||||
# hunspell
|
||||
- *step-hunspell-build
|
||||
- *step-hunspell-store
|
||||
|
||||
# typescript defs
|
||||
- *step-maybe-generate-typescript-defs
|
||||
|
||||
# Publish
|
||||
- *step-electron-publish
|
||||
|
||||
steps-chromedriver-build: &steps-chromedriver-build
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@@ -1069,8 +1040,8 @@ steps-chromedriver-build: &steps-chromedriver-build
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-setup-env-for-build
|
||||
- *step-fix-sync-on-mac
|
||||
- *step-gn-gen-default
|
||||
|
||||
- *step-electron-maybe-chromedriver-gn-gen
|
||||
- *step-electron-chromedriver-build
|
||||
- *step-electron-chromedriver-store
|
||||
|
||||
@@ -1132,18 +1103,6 @@ steps-verify-mksnapshot: &steps-verify-mksnapshot
|
||||
- *step-verify-mksnapshot
|
||||
- *step-maybe-notify-slack-failure
|
||||
|
||||
steps-verify-chromedriver: &steps-verify-chromedriver
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-electron-dist-unzip
|
||||
- *step-chromedriver-unzip
|
||||
- *step-setup-linux-for-headless-testing
|
||||
|
||||
- *step-verify-chromedriver
|
||||
- *step-maybe-notify-slack-failure
|
||||
|
||||
steps-tests: &steps-tests
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@@ -1152,7 +1111,6 @@ steps-tests: &steps-tests
|
||||
- *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
|
||||
@@ -1167,8 +1125,7 @@ steps-tests: &steps-tests
|
||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
||||
command: |
|
||||
cd src
|
||||
(cd electron && node script/yarn test --runners=main --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split))
|
||||
(cd electron && node script/yarn test --runners=remote --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split))
|
||||
(cd electron && node script/yarn test -- --ci --enable-logging)
|
||||
- run:
|
||||
name: Check test results existence
|
||||
command: |
|
||||
@@ -1185,7 +1142,6 @@ steps-tests: &steps-tests
|
||||
path: src/junit
|
||||
|
||||
- *step-verify-mksnapshot
|
||||
- *step-verify-chromedriver
|
||||
|
||||
- *step-maybe-notify-slack-failure
|
||||
|
||||
@@ -1283,9 +1239,6 @@ commands:
|
||||
build:
|
||||
type: boolean
|
||||
default: true
|
||||
use-out-cache:
|
||||
type: boolean
|
||||
default: true
|
||||
restore-src-cache:
|
||||
type: boolean
|
||||
default: true
|
||||
@@ -1375,13 +1328,9 @@ commands:
|
||||
|
||||
# Electron app
|
||||
- when:
|
||||
condition: << parameters.use-out-cache >>
|
||||
steps:
|
||||
- *step-restore-out-cache
|
||||
- *step-gn-gen-default
|
||||
- *step-electron-build
|
||||
- *step-ninja-summary
|
||||
- *step-ninja-report
|
||||
- *step-maybe-electron-dist-strip
|
||||
- *step-electron-dist-build
|
||||
- *step-electron-dist-store
|
||||
@@ -1402,11 +1351,6 @@ commands:
|
||||
- *step-maybe-cross-arch-snapshot
|
||||
- *step-maybe-cross-arch-snapshot-store
|
||||
|
||||
# chromedriver
|
||||
- *step-electron-maybe-chromedriver-gn-gen
|
||||
- *step-electron-chromedriver-build
|
||||
- *step-electron-chromedriver-store
|
||||
|
||||
# ffmpeg
|
||||
- *step-ffmpeg-gn-gen
|
||||
- *step-ffmpeg-build
|
||||
@@ -1444,10 +1388,6 @@ commands:
|
||||
# These files do not seem to like being in a cache, let us remove them
|
||||
find . -type f -name '*_pkg_info' -delete
|
||||
fi
|
||||
- when:
|
||||
condition: << parameters.use-out-cache >>
|
||||
steps:
|
||||
- *step-save-out-cache
|
||||
|
||||
# Trigger tests on arm hardware if needed
|
||||
- *step-maybe-trigger-arm-test
|
||||
@@ -1501,7 +1441,6 @@ commands:
|
||||
- *step-mksnapshot-store
|
||||
|
||||
# chromedriver
|
||||
- *step-electron-maybe-chromedriver-gn-gen
|
||||
- *step-electron-chromedriver-build
|
||||
- *step-electron-chromedriver-store
|
||||
|
||||
@@ -1603,7 +1542,6 @@ jobs:
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
<<: *env-testing-build
|
||||
<<: *env-macos-build
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac --custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
steps:
|
||||
- electron-build:
|
||||
@@ -1619,7 +1557,6 @@ jobs:
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
<<: *env-testing-build
|
||||
<<: *env-macos-build
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
steps:
|
||||
- electron-build:
|
||||
@@ -1633,7 +1570,6 @@ jobs:
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
<<: *env-testing-build
|
||||
<<: *env-macos-build
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
<<: *steps-checkout-and-save-cache
|
||||
|
||||
@@ -1649,7 +1585,6 @@ jobs:
|
||||
- electron-build:
|
||||
persist: true
|
||||
checkout: true
|
||||
use-out-cache: false
|
||||
|
||||
linux-x64-testing-no-run-as-node:
|
||||
<<: *machine-linux-2xlarge
|
||||
@@ -1663,7 +1598,6 @@ jobs:
|
||||
- electron-build:
|
||||
persist: false
|
||||
checkout: true
|
||||
use-out-cache: false
|
||||
|
||||
linux-x64-testing-gn-check:
|
||||
<<: *machine-linux-medium
|
||||
@@ -1694,18 +1628,6 @@ jobs:
|
||||
checkout: true
|
||||
|
||||
linux-x64-publish:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
checkout: true
|
||||
|
||||
linux-x64-publish-skip-checkout:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
@@ -1713,10 +1635,7 @@ jobs:
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
checkout: false
|
||||
<<: *steps-electron-build-for-publish
|
||||
|
||||
linux-ia32-testing:
|
||||
<<: *machine-linux-2xlarge
|
||||
@@ -1730,7 +1649,6 @@ jobs:
|
||||
- electron-build:
|
||||
persist: true
|
||||
checkout: true
|
||||
use-out-cache: false
|
||||
|
||||
linux-ia32-chromedriver:
|
||||
<<: *machine-linux-medium
|
||||
@@ -1756,20 +1674,6 @@ jobs:
|
||||
checkout: true
|
||||
|
||||
linux-ia32-publish:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-ia32
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
<<: *env-32bit-release
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
checkout: true
|
||||
|
||||
linux-ia32-publish-skip-checkout:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
@@ -1779,10 +1683,7 @@ jobs:
|
||||
<<: *env-enable-sccache
|
||||
<<: *env-32bit-release
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
checkout: false
|
||||
<<: *steps-electron-build-for-publish
|
||||
|
||||
linux-arm-testing:
|
||||
<<: *machine-linux-2xlarge
|
||||
@@ -1797,7 +1698,6 @@ jobs:
|
||||
- electron-build:
|
||||
persist: false
|
||||
checkout: true
|
||||
use-out-cache: false
|
||||
|
||||
linux-arm-chromedriver:
|
||||
<<: *machine-linux-medium
|
||||
@@ -1823,20 +1723,6 @@ jobs:
|
||||
checkout: true
|
||||
|
||||
linux-arm-publish:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-arm
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
<<: *env-32bit-release
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
checkout: true
|
||||
|
||||
linux-arm-publish-skip-checkout:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
@@ -1846,10 +1732,7 @@ jobs:
|
||||
<<: *env-32bit-release
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
checkout: false
|
||||
<<: *steps-electron-build-for-publish
|
||||
|
||||
linux-arm64-testing:
|
||||
<<: *machine-linux-2xlarge
|
||||
@@ -1864,7 +1747,6 @@ jobs:
|
||||
- electron-build:
|
||||
persist: false
|
||||
checkout: true
|
||||
use-out-cache: false
|
||||
|
||||
linux-arm64-testing-gn-check:
|
||||
<<: *machine-linux-medium
|
||||
@@ -1898,19 +1780,6 @@ jobs:
|
||||
checkout: true
|
||||
|
||||
linux-arm64-publish:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-arm64
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
checkout: true
|
||||
|
||||
linux-arm64-publish-skip-checkout:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
@@ -1919,10 +1788,7 @@ jobs:
|
||||
<<: *env-enable-sccache
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm64=True --custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
checkout: false
|
||||
<<: *steps-electron-build-for-publish
|
||||
|
||||
osx-testing:
|
||||
<<: *machine-mac-large
|
||||
@@ -1930,7 +1796,6 @@ jobs:
|
||||
<<: *env-mac-large
|
||||
<<: *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:
|
||||
@@ -1969,18 +1834,6 @@ jobs:
|
||||
attach: false
|
||||
|
||||
osx-publish:
|
||||
<<: *machine-mac-large
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
checkout: true
|
||||
|
||||
osx-publish-skip-checkout:
|
||||
<<: *machine-mac-large
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
@@ -1988,10 +1841,7 @@ jobs:
|
||||
<<: *env-enable-sccache
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
checkout: false
|
||||
<<: *steps-electron-build-for-publish
|
||||
|
||||
mas-testing:
|
||||
<<: *machine-mac-large
|
||||
@@ -2000,7 +1850,6 @@ jobs:
|
||||
<<: *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:
|
||||
@@ -2041,19 +1890,6 @@ jobs:
|
||||
attach: false
|
||||
|
||||
mas-publish:
|
||||
<<: *machine-mac-large
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-mas
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
checkout: true
|
||||
|
||||
mas-publish-skip-checkout:
|
||||
<<: *machine-mac-large
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
@@ -2062,10 +1898,7 @@ jobs:
|
||||
<<: *env-enable-sccache
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
checkout: false
|
||||
<<: *steps-electron-build-for-publish
|
||||
|
||||
# Layer 3: Tests.
|
||||
linux-x64-unittests:
|
||||
@@ -2109,7 +1942,6 @@ jobs:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-headless-testing
|
||||
<<: *env-stack-dumping
|
||||
parallelism: 3
|
||||
<<: *steps-tests
|
||||
|
||||
linux-x64-testing-nan:
|
||||
@@ -2152,14 +1984,6 @@ jobs:
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-verify-mksnapshot
|
||||
|
||||
linux-x64-verify-chromedriver:
|
||||
<<: *machine-linux-medium
|
||||
environment:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-headless-testing
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-verify-chromedriver
|
||||
|
||||
linux-ia32-testing-tests:
|
||||
<<: *machine-linux-medium
|
||||
environment:
|
||||
@@ -2167,7 +1991,6 @@ jobs:
|
||||
<<: *env-ia32
|
||||
<<: *env-headless-testing
|
||||
<<: *env-stack-dumping
|
||||
parallelism: 3
|
||||
<<: *steps-tests
|
||||
|
||||
linux-ia32-testing-nan:
|
||||
@@ -2215,20 +2038,11 @@ jobs:
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-verify-mksnapshot
|
||||
|
||||
linux-ia32-verify-chromedriver:
|
||||
<<: *machine-linux-medium
|
||||
environment:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-headless-testing
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-verify-chromedriver
|
||||
|
||||
osx-testing-tests:
|
||||
<<: *machine-mac-large
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
<<: *env-stack-dumping
|
||||
parallelism: 2
|
||||
<<: *steps-tests
|
||||
|
||||
osx-release-tests:
|
||||
@@ -2253,19 +2067,11 @@ jobs:
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-verify-mksnapshot
|
||||
|
||||
osx-verify-chromedriver:
|
||||
<<: *machine-mac
|
||||
environment:
|
||||
<<: *env-machine-mac
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-verify-chromedriver
|
||||
|
||||
mas-testing-tests:
|
||||
<<: *machine-mac-large
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
<<: *env-stack-dumping
|
||||
parallelism: 2
|
||||
<<: *steps-tests
|
||||
|
||||
mas-release-tests:
|
||||
@@ -2290,13 +2096,6 @@ jobs:
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-verify-mksnapshot
|
||||
|
||||
mas-verify-chromedriver:
|
||||
<<: *machine-mac
|
||||
environment:
|
||||
<<: *env-machine-mac
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-verify-chromedriver
|
||||
|
||||
# Layer 4: Summary.
|
||||
linux-x64-release-summary:
|
||||
<<: *machine-linux-medium
|
||||
@@ -2355,27 +2154,6 @@ workflows:
|
||||
# will need to be updated and there will most likely need to be changes to
|
||||
# sudowoodo
|
||||
|
||||
publish-linux:
|
||||
when: << pipeline.parameters.run-linux-publish >>
|
||||
jobs:
|
||||
- linux-checkout
|
||||
- linux-x64-publish-skip-checkout:
|
||||
requires:
|
||||
- linux-checkout
|
||||
context: release-env
|
||||
- linux-ia32-publish-skip-checkout:
|
||||
requires:
|
||||
- linux-checkout
|
||||
context: release-env
|
||||
- linux-arm-publish-skip-checkout:
|
||||
requires:
|
||||
- linux-checkout
|
||||
context: release-env
|
||||
- linux-arm64-publish-skip-checkout:
|
||||
requires:
|
||||
- linux-checkout
|
||||
context: release-env
|
||||
|
||||
publish-x64-linux:
|
||||
when: << pipeline.parameters.run-linux-x64-publish >>
|
||||
jobs:
|
||||
@@ -2412,17 +2190,6 @@ workflows:
|
||||
- mas-publish:
|
||||
context: release-env
|
||||
|
||||
publish-macos:
|
||||
when: << pipeline.parameters.run-macos-publish >>
|
||||
jobs:
|
||||
- mac-checkout
|
||||
- osx-publish-skip-checkout:
|
||||
requires:
|
||||
- mac-checkout
|
||||
- mas-publish-skip-checkout:
|
||||
requires:
|
||||
- mac-checkout
|
||||
|
||||
lint:
|
||||
when: << pipeline.parameters.run-lint >>
|
||||
jobs:
|
||||
@@ -2433,7 +2200,6 @@ workflows:
|
||||
jobs:
|
||||
- linux-checkout-fast
|
||||
- linux-checkout-and-save-cache
|
||||
|
||||
- linux-x64-testing
|
||||
- linux-x64-testing-no-run-as-node
|
||||
- linux-x64-testing-gn-check:
|
||||
@@ -2515,19 +2281,15 @@ workflows:
|
||||
- linux-x64-release-tests:
|
||||
requires:
|
||||
- linux-x64-release
|
||||
- linux-x64-chromedriver:
|
||||
requires:
|
||||
- linux-checkout-fast
|
||||
- linux-x64-verify-ffmpeg:
|
||||
requires:
|
||||
- linux-x64-release
|
||||
- linux-x64-verify-mksnapshot:
|
||||
requires:
|
||||
- linux-x64-release
|
||||
- linux-x64-verify-chromedriver:
|
||||
- linux-x64-chromedriver:
|
||||
requires:
|
||||
- linux-x64-release
|
||||
- linux-x64-chromedriver
|
||||
- linux-checkout-fast
|
||||
- linux-x64-release-summary:
|
||||
requires:
|
||||
- linux-x64-release
|
||||
@@ -2539,19 +2301,15 @@ workflows:
|
||||
- linux-ia32-release-tests:
|
||||
requires:
|
||||
- linux-ia32-release
|
||||
- linux-ia32-chromedriver:
|
||||
requires:
|
||||
- linux-checkout-fast
|
||||
- linux-ia32-verify-ffmpeg:
|
||||
requires:
|
||||
- linux-ia32-release
|
||||
- linux-ia32-verify-mksnapshot:
|
||||
requires:
|
||||
- linux-ia32-release
|
||||
- linux-x64-verify-chromedriver:
|
||||
- linux-ia32-chromedriver:
|
||||
requires:
|
||||
- linux-ia32-release
|
||||
- linux-ia32-chromedriver
|
||||
- linux-checkout-fast
|
||||
- linux-ia32-release-summary:
|
||||
requires:
|
||||
- linux-ia32-release
|
||||
@@ -2596,19 +2354,15 @@ workflows:
|
||||
- osx-release-tests:
|
||||
requires:
|
||||
- osx-release
|
||||
- osx-chromedriver:
|
||||
requires:
|
||||
- mac-checkout-fast
|
||||
- osx-verify-ffmpeg:
|
||||
requires:
|
||||
- osx-release
|
||||
- osx-verify-mksnapshot:
|
||||
requires:
|
||||
- osx-release
|
||||
- osx-verify-chromedriver:
|
||||
- osx-chromedriver:
|
||||
requires:
|
||||
- osx-release
|
||||
- osx-chromedriver
|
||||
- mac-checkout-fast
|
||||
- osx-release-summary:
|
||||
requires:
|
||||
- osx-release
|
||||
@@ -2622,19 +2376,15 @@ workflows:
|
||||
- mas-release-tests:
|
||||
requires:
|
||||
- mas-release
|
||||
- mas-chromedriver:
|
||||
requires:
|
||||
- mac-checkout-fast
|
||||
- mas-verify-ffmpeg:
|
||||
requires:
|
||||
- mas-release
|
||||
- mas-verify-mksnapshot:
|
||||
requires:
|
||||
- mas-release
|
||||
- mas-verify-chromedriver:
|
||||
- mas-chromedriver:
|
||||
requires:
|
||||
- mas-release
|
||||
- mas-chromedriver
|
||||
- mac-checkout-fast
|
||||
- mas-release-summary:
|
||||
requires:
|
||||
- mas-release
|
||||
|
||||
@@ -19,35 +19,18 @@
|
||||
"prefer-const": ["error", {
|
||||
"destructuring": "all"
|
||||
}],
|
||||
"standard/no-callback-literal": "off",
|
||||
"node/no-deprecated-api": 0
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"globals": {
|
||||
"standardScheme": "readonly",
|
||||
"BUILDFLAG": "readonly",
|
||||
"ENABLE_DESKTOP_CAPTURER": "readonly",
|
||||
"ENABLE_ELECTRON_EXTENSIONS": "readonly",
|
||||
"ENABLE_REMOTE_MODULE": "readonly",
|
||||
"ENABLE_VIEW_API": "readonly",
|
||||
"BigInt": "readonly"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.js",
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unused-vars": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": "*.d.ts",
|
||||
"rules": {
|
||||
"no-useless-constructor": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
10
.gitattributes
vendored
10
.gitattributes
vendored
@@ -2,13 +2,3 @@
|
||||
# files to be checked out with LF endings even if core.autocrlf is true.
|
||||
*.patch text eol=lf
|
||||
patches/**/.patches merge=union
|
||||
|
||||
# Source code and markdown files should always use LF as line ending.
|
||||
*.cc text eol=lf
|
||||
*.mm text eol=lf
|
||||
*.h text eol=lf
|
||||
*.js text eol=lf
|
||||
*.ts text eol=lf
|
||||
*.py text eol=lf
|
||||
*.ps1 text eol=lf
|
||||
*.md text eol=lf
|
||||
|
||||
10
.github/ISSUE_TEMPLATE/security_report.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/security_report.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: Security report
|
||||
about: Do not create an issue for security reports, send an email to security@electronjs.org
|
||||
|
||||
---
|
||||
|
||||
### Notice
|
||||
|
||||
**DO NOT** create an issue for security reports.
|
||||
Send an email to: **security@electronjs.org**.
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -65,4 +65,3 @@ ts-gen
|
||||
|
||||
# Used to accelerate CI builds
|
||||
.depshash
|
||||
.depshash-target
|
||||
464
BUILD.gn
464
BUILD.gn
@@ -3,9 +3,7 @@ import("//build/config/ui.gni")
|
||||
import("//build/config/win/manifest.gni")
|
||||
import("//components/spellcheck/spellcheck_build_features.gni")
|
||||
import("//content/public/app/mac_helpers.gni")
|
||||
import("//extensions/buildflags/buildflags.gni")
|
||||
import("//pdf/features.gni")
|
||||
import("//ppapi/buildflags/buildflags.gni")
|
||||
import("//printing/buildflags/buildflags.gni")
|
||||
import("//testing/test.gni")
|
||||
import("//third_party/ffmpeg/ffmpeg_options.gni")
|
||||
@@ -59,17 +57,6 @@ if (is_mas_build) {
|
||||
"It doesn't make sense to build a MAS build on a non-mac platform")
|
||||
}
|
||||
|
||||
if (enable_pdf_viewer) {
|
||||
assert(enable_pdf, "PDF viewer support requires enable_pdf=true")
|
||||
assert(enable_electron_extensions,
|
||||
"PDF viewer support requires enable_electron_extensions=true")
|
||||
}
|
||||
|
||||
if (enable_electron_extensions) {
|
||||
assert(enable_extensions,
|
||||
"Chrome extension support requires enable_extensions=true")
|
||||
}
|
||||
|
||||
config("branding") {
|
||||
defines = [
|
||||
"ELECTRON_PRODUCT_NAME=\"$electron_product_name\"",
|
||||
@@ -91,11 +78,15 @@ npm_action("build_electron_definitions") {
|
||||
args = [ rebase_path("$target_gen_dir/tsc/typings/electron.d.ts") ]
|
||||
inputs = auto_filenames.api_docs + [ "yarn.lock" ]
|
||||
|
||||
outputs = [ "$target_gen_dir/tsc/typings/electron.d.ts" ]
|
||||
outputs = [
|
||||
"$target_gen_dir/tsc/typings/electron.d.ts",
|
||||
]
|
||||
}
|
||||
|
||||
webpack_build("electron_browser_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
deps = [
|
||||
":build_electron_definitions",
|
||||
]
|
||||
|
||||
inputs = auto_filenames.browser_bundle_deps
|
||||
|
||||
@@ -104,7 +95,9 @@ webpack_build("electron_browser_bundle") {
|
||||
}
|
||||
|
||||
webpack_build("electron_renderer_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
deps = [
|
||||
":build_electron_definitions",
|
||||
]
|
||||
|
||||
inputs = auto_filenames.renderer_bundle_deps
|
||||
|
||||
@@ -113,7 +106,9 @@ webpack_build("electron_renderer_bundle") {
|
||||
}
|
||||
|
||||
webpack_build("electron_worker_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
deps = [
|
||||
":build_electron_definitions",
|
||||
]
|
||||
|
||||
inputs = auto_filenames.worker_bundle_deps
|
||||
|
||||
@@ -122,7 +117,9 @@ webpack_build("electron_worker_bundle") {
|
||||
}
|
||||
|
||||
webpack_build("electron_sandboxed_renderer_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
deps = [
|
||||
":build_electron_definitions",
|
||||
]
|
||||
|
||||
inputs = auto_filenames.sandbox_bundle_deps
|
||||
|
||||
@@ -131,7 +128,9 @@ webpack_build("electron_sandboxed_renderer_bundle") {
|
||||
}
|
||||
|
||||
webpack_build("electron_isolated_renderer_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
deps = [
|
||||
":build_electron_definitions",
|
||||
]
|
||||
|
||||
inputs = auto_filenames.isolated_bundle_deps
|
||||
|
||||
@@ -140,7 +139,9 @@ webpack_build("electron_isolated_renderer_bundle") {
|
||||
}
|
||||
|
||||
webpack_build("electron_content_script_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
deps = [
|
||||
":build_electron_definitions",
|
||||
]
|
||||
|
||||
inputs = auto_filenames.content_script_bundle_deps
|
||||
|
||||
@@ -153,7 +154,9 @@ copy("electron_js2c_copy") {
|
||||
"lib/common/asar.js",
|
||||
"lib/common/asar_init.js",
|
||||
]
|
||||
outputs = [ "$target_gen_dir/js2c/{{source_file_part}}" ]
|
||||
outputs = [
|
||||
"$target_gen_dir/js2c/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
|
||||
action("electron_js2c") {
|
||||
@@ -169,11 +172,11 @@ action("electron_js2c") {
|
||||
|
||||
webpack_sources = [
|
||||
"$target_gen_dir/js2c/browser_init.js",
|
||||
"$target_gen_dir/js2c/renderer_init.js",
|
||||
"$target_gen_dir/js2c/worker_init.js",
|
||||
"$target_gen_dir/js2c/content_script_bundle.js",
|
||||
"$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/worker_init.js",
|
||||
]
|
||||
|
||||
sources = webpack_sources + [
|
||||
@@ -182,7 +185,9 @@ action("electron_js2c") {
|
||||
]
|
||||
|
||||
inputs = sources + [ "//third_party/electron_node/tools/js2c.py" ]
|
||||
outputs = [ "$root_gen_dir/electron_natives.cc" ]
|
||||
outputs = [
|
||||
"$root_gen_dir/electron_natives.cc",
|
||||
]
|
||||
|
||||
script = "tools/js2c.py"
|
||||
args = [ rebase_path("//third_party/electron_node") ] +
|
||||
@@ -193,7 +198,9 @@ action("electron_js2c") {
|
||||
target_gen_default_app_js = "$target_gen_dir/js/default_app"
|
||||
|
||||
typescript_build("default_app_js") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
deps = [
|
||||
":build_electron_definitions",
|
||||
]
|
||||
type_root = rebase_path("$target_gen_dir/tsc/electron/typings")
|
||||
|
||||
sources = filenames.default_app_ts_sources
|
||||
@@ -205,12 +212,16 @@ typescript_build("default_app_js") {
|
||||
|
||||
copy("default_app_static") {
|
||||
sources = filenames.default_app_static_sources
|
||||
outputs = [ "$target_gen_default_app_js/{{source}}" ]
|
||||
outputs = [
|
||||
"$target_gen_default_app_js/{{source}}",
|
||||
]
|
||||
}
|
||||
|
||||
copy("default_app_octicon_deps") {
|
||||
sources = filenames.default_app_octicon_sources
|
||||
outputs = [ "$target_gen_default_app_js/electron/default_app/octicon/{{source_file_part}}" ]
|
||||
outputs = [
|
||||
"$target_gen_default_app_js/electron/default_app/octicon/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
|
||||
asar("default_app_asar") {
|
||||
@@ -224,7 +235,9 @@ asar("default_app_asar") {
|
||||
sources = get_target_outputs(":default_app_js") +
|
||||
get_target_outputs(":default_app_static") +
|
||||
get_target_outputs(":default_app_octicon_deps")
|
||||
outputs = [ "$root_out_dir/resources/default_app.asar" ]
|
||||
outputs = [
|
||||
"$root_out_dir/resources/default_app.asar",
|
||||
]
|
||||
}
|
||||
|
||||
grit("resources") {
|
||||
@@ -236,19 +249,26 @@ grit("resources") {
|
||||
]
|
||||
|
||||
# Mojo manifest overlays are generated.
|
||||
source_is_generated = true
|
||||
grit_flags = [
|
||||
"-E",
|
||||
"target_gen_dir=" + rebase_path(target_gen_dir, root_build_dir),
|
||||
]
|
||||
|
||||
deps = [ ":copy_shell_devtools_discovery_page" ]
|
||||
deps = [
|
||||
":copy_shell_devtools_discovery_page",
|
||||
]
|
||||
|
||||
output_dir = "$target_gen_dir"
|
||||
}
|
||||
|
||||
copy("copy_shell_devtools_discovery_page") {
|
||||
sources = [ "//content/shell/resources/shell_devtools_discovery_page.html" ]
|
||||
outputs = [ "$target_gen_dir/shell_devtools_discovery_page.html" ]
|
||||
sources = [
|
||||
"//content/shell/resources/shell_devtools_discovery_page.html",
|
||||
]
|
||||
outputs = [
|
||||
"$target_gen_dir/shell_devtools_discovery_page.html",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
@@ -294,7 +314,9 @@ source_set("manifests") {
|
||||
npm_action("electron_version_args") {
|
||||
script = "generate-version-json"
|
||||
|
||||
outputs = [ "$target_gen_dir/electron_version.args" ]
|
||||
outputs = [
|
||||
"$target_gen_dir/electron_version.args",
|
||||
]
|
||||
|
||||
args = rebase_path(outputs)
|
||||
|
||||
@@ -305,7 +327,9 @@ npm_action("electron_version_args") {
|
||||
}
|
||||
|
||||
templated_file("electron_version_header") {
|
||||
deps = [ ":electron_version_args" ]
|
||||
deps = [
|
||||
":electron_version_args",
|
||||
]
|
||||
|
||||
template = "build/templates/electron_version.tmpl"
|
||||
output = "$target_gen_dir/electron_version.h"
|
||||
@@ -330,10 +354,10 @@ source_set("electron_lib") {
|
||||
"buildflags",
|
||||
"chromium_src:chrome",
|
||||
"chromium_src:chrome_spellchecker",
|
||||
"native_mate",
|
||||
"shell/common/api:mojo",
|
||||
"//base:base_static",
|
||||
"//base/allocator:buildflags",
|
||||
"//chrome/app:command_ids",
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//chrome/services/printing/public/mojom",
|
||||
"//components/certificate_transparency",
|
||||
@@ -343,10 +367,7 @@ source_set("electron_lib") {
|
||||
"//components/network_hints/common:mojo_bindings",
|
||||
"//components/network_hints/renderer",
|
||||
"//components/network_session_configurator/common",
|
||||
"//components/pref_registry",
|
||||
"//components/prefs",
|
||||
"//components/upload_list",
|
||||
"//components/user_prefs",
|
||||
"//components/viz/host",
|
||||
"//components/viz/service",
|
||||
"//content/public/browser",
|
||||
@@ -442,9 +463,6 @@ source_set("electron_lib") {
|
||||
"*\bviews/*",
|
||||
]
|
||||
}
|
||||
if (!is_mas_build) {
|
||||
deps += [ "//components/crash/core/app" ]
|
||||
}
|
||||
|
||||
set_sources_assignment_filter(
|
||||
sources_assignment_filter + extra_source_filters)
|
||||
@@ -462,10 +480,6 @@ source_set("electron_lib") {
|
||||
]
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
deps += [ "//components/crash/content/browser" ]
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
deps += [
|
||||
"//components/remote_cocoa/app_shim",
|
||||
@@ -473,10 +487,6 @@ source_set("electron_lib") {
|
||||
"//ui/accelerated_widget_mac",
|
||||
]
|
||||
|
||||
if (!is_mas_build) {
|
||||
deps += [ "//third_party/crashpad/crashpad/client" ]
|
||||
}
|
||||
|
||||
libs = [
|
||||
"AVFoundation.framework",
|
||||
"Carbon.framework",
|
||||
@@ -495,14 +505,12 @@ 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",
|
||||
"shell/common/crash_keys.cc",
|
||||
"shell/common/crash_keys.h",
|
||||
"shell/browser/auto_updater_mac.mm",
|
||||
"shell/common/crash_reporter/crash_reporter_mac.h",
|
||||
"shell/common/crash_reporter/crash_reporter_mac.mm",
|
||||
]
|
||||
defines += [ "MAS_BUILD" ]
|
||||
} else {
|
||||
libs += [
|
||||
"Squirrel.framework",
|
||||
@@ -522,21 +530,17 @@ source_set("electron_lib") {
|
||||
deps += [
|
||||
":libnotify_loader",
|
||||
"//build/config/linux/gtk",
|
||||
"//chrome/browser/ui/libgtkui",
|
||||
"//dbus",
|
||||
"//device/bluetooth",
|
||||
"//third_party/breakpad:client",
|
||||
"//ui/events/devices/x11",
|
||||
"//ui/events/platform/x11",
|
||||
"//ui/gtk",
|
||||
"//ui/views/controls/webview",
|
||||
"//ui/wm",
|
||||
]
|
||||
if (use_x11) {
|
||||
deps += [
|
||||
"//ui/gfx/x",
|
||||
"//ui/gtk:x",
|
||||
]
|
||||
}
|
||||
configs += [ ":gio_unix" ]
|
||||
include_dirs += [ "//third_party/breakpad" ]
|
||||
configs += [ "//build/config/linux:x11" ]
|
||||
defines += [
|
||||
# Disable warnings for g_settings_list_schemas.
|
||||
@@ -545,16 +549,6 @@ source_set("electron_lib") {
|
||||
|
||||
sources += filenames.lib_sources_nss
|
||||
sources += [
|
||||
"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",
|
||||
]
|
||||
@@ -562,7 +556,6 @@ source_set("electron_lib") {
|
||||
if (is_win) {
|
||||
libs += [ "dwmapi.lib" ]
|
||||
deps += [
|
||||
"//components/crash/core/app:crash_export_thunks",
|
||||
"//ui/native_theme:native_theme_browser",
|
||||
"//ui/views/controls/webview",
|
||||
"//ui/wm",
|
||||
@@ -574,12 +567,16 @@ source_set("electron_lib") {
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_plugins) {
|
||||
deps += [ "chromium_src:plugins" ]
|
||||
if ((is_mac && !is_mas_build) || is_win) {
|
||||
sources += [
|
||||
"shell/renderer/pepper_helper.cc",
|
||||
"shell/renderer/pepper_helper.h",
|
||||
"shell/common/crash_reporter/crash_reporter_crashpad.cc",
|
||||
"shell/common/crash_reporter/crash_reporter_crashpad.h",
|
||||
]
|
||||
deps += [ "//third_party/crashpad/crashpad/client" ]
|
||||
}
|
||||
|
||||
if (enable_pdf) {
|
||||
deps += [ "//pdf" ]
|
||||
}
|
||||
|
||||
if (enable_run_as_node) {
|
||||
@@ -613,6 +610,8 @@ source_set("electron_lib") {
|
||||
|
||||
if (enable_remote_module) {
|
||||
sources += [
|
||||
"shell/common/api/remote/object_life_monitor.cc",
|
||||
"shell/common/api/remote/object_life_monitor.h",
|
||||
"shell/common/api/remote/remote_callback_freer.cc",
|
||||
"shell/common/api/remote/remote_callback_freer.h",
|
||||
"shell/common/api/remote/remote_object_freer.cc",
|
||||
@@ -659,42 +658,24 @@ source_set("electron_lib") {
|
||||
"shell/renderer/printing/print_render_frame_helper_delegate.cc",
|
||||
"shell/renderer/printing/print_render_frame_helper_delegate.h",
|
||||
]
|
||||
deps += [ "//components/printing/common:mojo_interfaces" ]
|
||||
}
|
||||
|
||||
if (enable_pepper_flash) {
|
||||
deps += [ "components/pepper_flash" ]
|
||||
}
|
||||
|
||||
public_deps += [ "shell/common/extensions/api:extensions_features" ]
|
||||
deps += [
|
||||
"//components/pref_registry",
|
||||
"//components/user_prefs",
|
||||
"//extensions/browser",
|
||||
"//extensions/browser:core_api_provider",
|
||||
"//extensions/common",
|
||||
"//extensions/common:core_api_provider",
|
||||
"//extensions/renderer",
|
||||
]
|
||||
if (enable_electron_extensions) {
|
||||
sources += filenames.lib_sources_extensions
|
||||
deps += [
|
||||
"shell/browser/extensions/api:api_registration",
|
||||
"shell/common/extensions/api",
|
||||
"shell/common/extensions/api:extensions_features",
|
||||
"//chrome/browser/resources:component_extension_resources",
|
||||
"//components/zoom",
|
||||
"//extensions/browser",
|
||||
"//extensions/browser:core_api_provider",
|
||||
"//extensions/common",
|
||||
"//extensions/common:core_api_provider",
|
||||
"//extensions/renderer",
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_pdf) {
|
||||
# Printing depends on some //pdf code, so it needs to be built even if the
|
||||
# pdf viewer isn't enabled.
|
||||
deps += [
|
||||
"//pdf",
|
||||
"//pdf:features",
|
||||
]
|
||||
}
|
||||
if (enable_pdf_viewer) {
|
||||
deps += [
|
||||
"//components/pdf/browser",
|
||||
"//components/pdf/renderer",
|
||||
]
|
||||
sources += [
|
||||
"shell/browser/electron_pdf_web_contents_helper_client.cc",
|
||||
"shell/browser/electron_pdf_web_contents_helper_client.h",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,11 +696,15 @@ if (is_mac) {
|
||||
electron_version = read_file("ELECTRON_VERSION", "trim string")
|
||||
|
||||
mac_xib_bundle_data("electron_xibs") {
|
||||
sources = [ "shell/common/resources/mac/MainMenu.xib" ]
|
||||
sources = [
|
||||
"shell/common/resources/mac/MainMenu.xib",
|
||||
]
|
||||
}
|
||||
|
||||
bundle_data("electron_framework_resources") {
|
||||
public_deps = [ ":packed_resources" ]
|
||||
public_deps = [
|
||||
":packed_resources",
|
||||
]
|
||||
sources = []
|
||||
if (icu_use_data_file) {
|
||||
sources += [ "$root_out_dir/icudtl.dat" ]
|
||||
@@ -734,16 +719,22 @@ if (is_mac) {
|
||||
sources += [ "$root_out_dir/snapshot_blob.bin" ]
|
||||
}
|
||||
}
|
||||
outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
|
||||
outputs = [
|
||||
"{{bundle_resources_dir}}/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
|
||||
if (!is_component_build && is_component_ffmpeg) {
|
||||
if (!is_component_build) {
|
||||
bundle_data("electron_framework_libraries") {
|
||||
sources = []
|
||||
public_deps = []
|
||||
sources += [ "$root_out_dir/libffmpeg.dylib" ]
|
||||
public_deps += [ "//third_party/ffmpeg:ffmpeg" ]
|
||||
outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
|
||||
if (is_component_ffmpeg) {
|
||||
sources += [ "$root_out_dir/libffmpeg.dylib" ]
|
||||
public_deps += [ "//third_party/ffmpeg:ffmpeg" ]
|
||||
}
|
||||
outputs = [
|
||||
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
group("electron_framework_libraries") {
|
||||
@@ -756,8 +747,12 @@ if (is_mac) {
|
||||
"$root_out_dir/egl_intermediates/libEGL.dylib",
|
||||
"$root_out_dir/egl_intermediates/libGLESv2.dylib",
|
||||
]
|
||||
outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
|
||||
public_deps = [ "//ui/gl:angle_library_copy" ]
|
||||
outputs = [
|
||||
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
|
||||
]
|
||||
public_deps = [
|
||||
"//ui/gl:angle_library_copy",
|
||||
]
|
||||
}
|
||||
|
||||
# Add the SwiftShader .dylibs in the Libraries directory of the Framework.
|
||||
@@ -765,40 +760,43 @@ if (is_mac) {
|
||||
sources = [
|
||||
"$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
|
||||
"$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
|
||||
"$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
|
||||
"$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
|
||||
]
|
||||
outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
|
||||
outputs = [
|
||||
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
|
||||
]
|
||||
public_deps = [
|
||||
"//ui/gl:swiftshader_egl_library_copy",
|
||||
"//ui/gl:swiftshader_vk_library_copy",
|
||||
"//ui/gl:swiftshader_library_copy",
|
||||
]
|
||||
}
|
||||
}
|
||||
group("electron_angle_library") {
|
||||
if (use_egl) {
|
||||
deps = [ ":electron_angle_binaries" ]
|
||||
deps = [
|
||||
":electron_angle_binaries",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
group("electron_swiftshader_library") {
|
||||
if (use_egl) {
|
||||
deps = [ ":electron_swiftshader_binaries" ]
|
||||
deps = [
|
||||
":electron_swiftshader_binaries",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
bundle_data("electron_crashpad_helper") {
|
||||
sources = [ "$root_out_dir/chrome_crashpad_handler" ]
|
||||
sources = [
|
||||
"$root_out_dir/crashpad_handler",
|
||||
]
|
||||
|
||||
outputs = [ "{{bundle_contents_dir}}/Helpers/{{source_file_part}}" ]
|
||||
outputs = [
|
||||
"{{bundle_resources_dir}}/{{source_file_part}}",
|
||||
]
|
||||
|
||||
public_deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
|
||||
|
||||
if (is_asan) {
|
||||
# crashpad_handler requires the ASan runtime at its @executable_path.
|
||||
sources += [ "$root_out_dir/libclang_rt.asan_osx_dynamic.dylib" ]
|
||||
public_deps += [ "//build/config/sanitizers:copy_asan_runtime" ]
|
||||
}
|
||||
public_deps = [
|
||||
"//third_party/crashpad/crashpad/handler:crashpad_handler",
|
||||
]
|
||||
}
|
||||
|
||||
mac_framework_bundle("electron_framework") {
|
||||
@@ -808,9 +806,6 @@ if (is_mac) {
|
||||
"Resources",
|
||||
"Libraries",
|
||||
]
|
||||
if (!is_mas_build) {
|
||||
framework_contents += [ "Helpers" ]
|
||||
}
|
||||
public_deps = [
|
||||
":electron_framework_libraries",
|
||||
":electron_lib",
|
||||
@@ -860,7 +855,9 @@ if (is_mac) {
|
||||
assert(defined(invoker.helper_name_suffix))
|
||||
|
||||
output_name = electron_helper_name + invoker.helper_name_suffix
|
||||
deps = [ ":electron_framework+link" ]
|
||||
deps = [
|
||||
":electron_framework+link",
|
||||
]
|
||||
if (!is_mas_build) {
|
||||
deps += [ "//sandbox/mac:seatbelt" ]
|
||||
}
|
||||
@@ -894,7 +891,9 @@ if (is_mac) {
|
||||
}
|
||||
|
||||
bundle_data("electron_app_framework_bundle_data") {
|
||||
sources = [ "$root_out_dir/$electron_framework_name.framework" ]
|
||||
sources = [
|
||||
"$root_out_dir/$electron_framework_name.framework",
|
||||
]
|
||||
if (!is_mas_build) {
|
||||
sources += [
|
||||
"external_binaries/Mantle.framework",
|
||||
@@ -902,8 +901,12 @@ if (is_mac) {
|
||||
"external_binaries/Squirrel.framework",
|
||||
]
|
||||
}
|
||||
outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
|
||||
public_deps = [ ":electron_framework+link" ]
|
||||
outputs = [
|
||||
"{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
|
||||
]
|
||||
public_deps = [
|
||||
":electron_framework+link",
|
||||
]
|
||||
|
||||
foreach(helper_params, content_mac_helpers) {
|
||||
sources +=
|
||||
@@ -923,10 +926,15 @@ if (is_mac) {
|
||||
}
|
||||
|
||||
bundle_data("electron_login_helper_app") {
|
||||
public_deps = [ ":electron_login_helper" ]
|
||||
sources = [ "$root_out_dir/$electron_login_helper_name.app" ]
|
||||
outputs =
|
||||
[ "{{bundle_contents_dir}}/Library/LoginItems/{{source_file_part}}" ]
|
||||
public_deps = [
|
||||
":electron_login_helper",
|
||||
]
|
||||
sources = [
|
||||
"$root_out_dir/$electron_login_helper_name.app",
|
||||
]
|
||||
outputs = [
|
||||
"{{bundle_contents_dir}}/Library/LoginItems/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
|
||||
action("electron_app_lproj_dirs") {
|
||||
@@ -941,9 +949,15 @@ if (is_mac) {
|
||||
|
||||
foreach(locale, locales_as_mac_outputs) {
|
||||
bundle_data("electron_app_strings_${locale}_bundle_data") {
|
||||
sources = [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
|
||||
outputs = [ "{{bundle_resources_dir}}/$locale.lproj" ]
|
||||
public_deps = [ ":electron_app_lproj_dirs" ]
|
||||
sources = [
|
||||
"$target_gen_dir/app_infoplist_strings/$locale.lproj",
|
||||
]
|
||||
outputs = [
|
||||
"{{bundle_resources_dir}}/$locale.lproj",
|
||||
]
|
||||
public_deps = [
|
||||
":electron_app_lproj_dirs",
|
||||
]
|
||||
}
|
||||
}
|
||||
group("electron_app_strings_bundle_data") {
|
||||
@@ -962,7 +976,9 @@ if (is_mac) {
|
||||
"$root_out_dir/resources/default_app.asar",
|
||||
"shell/browser/resources/mac/electron.icns",
|
||||
]
|
||||
outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
|
||||
outputs = [
|
||||
"{{bundle_resources_dir}}/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
|
||||
mac_app_bundle("electron_app") {
|
||||
@@ -993,7 +1009,9 @@ if (is_mac) {
|
||||
binary = "$root_out_dir/$electron_framework_name.framework/Versions/$electron_framework_version/$electron_framework_name"
|
||||
symbol_dir = "$root_out_dir/breakpad_symbols"
|
||||
dsym_file = "$root_out_dir/$electron_framework_name.dSYM/Contents/Resources/DWARF/$electron_framework_name"
|
||||
deps = [ ":electron_framework" ]
|
||||
deps = [
|
||||
":electron_framework",
|
||||
]
|
||||
}
|
||||
|
||||
foreach(helper_params, content_mac_helpers) {
|
||||
@@ -1004,7 +1022,9 @@ if (is_mac) {
|
||||
binary = "$root_out_dir/$electron_helper_name${_helper_suffix}.app/Contents/MacOS/$electron_helper_name${_helper_suffix}"
|
||||
symbol_dir = "$root_out_dir/breakpad_symbols"
|
||||
dsym_file = "$root_out_dir/$electron_helper_name${_helper_suffix}.dSYM/Contents/Resources/DWARF/$electron_helper_name${_helper_suffix}"
|
||||
deps = [ ":electron_helper_app_${_helper_target}" ]
|
||||
deps = [
|
||||
":electron_helper_app_${_helper_target}",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1012,15 +1032,18 @@ if (is_mac) {
|
||||
binary = "$root_out_dir/$electron_product_name.app/Contents/MacOS/$electron_product_name"
|
||||
symbol_dir = "$root_out_dir/breakpad_symbols"
|
||||
dsym_file = "$root_out_dir/$electron_product_name.dSYM/Contents/Resources/DWARF/$electron_product_name"
|
||||
deps = [ ":electron_app" ]
|
||||
deps = [
|
||||
":electron_app",
|
||||
]
|
||||
}
|
||||
|
||||
extract_symbols("swiftshader_egl_syms") {
|
||||
binary = "$root_out_dir/libswiftshader_libEGL.dylib"
|
||||
symbol_dir = "$root_out_dir/breakpad_symbols"
|
||||
dsym_file = "$root_out_dir/libswiftshader_libEGL.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libEGL.dylib"
|
||||
deps =
|
||||
[ "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL" ]
|
||||
deps = [
|
||||
"//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL",
|
||||
]
|
||||
}
|
||||
|
||||
extract_symbols("swiftshader_gles_syms") {
|
||||
@@ -1033,24 +1056,23 @@ if (is_mac) {
|
||||
}
|
||||
|
||||
extract_symbols("crashpad_handler_syms") {
|
||||
binary = "$root_out_dir/chrome_crashpad_handler"
|
||||
binary = "$root_out_dir/crashpad_handler"
|
||||
symbol_dir = "$root_out_dir/breakpad_symbols"
|
||||
dsym_file = "$root_out_dir/chrome_crashpad_handler.dSYM/Contents/Resources/DWARF/chrome_crashpad_handler"
|
||||
deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
|
||||
dsym_file = "$root_out_dir/crashpad_handler.dSYM/Contents/Resources/DWARF/crashpad_handler"
|
||||
deps = [
|
||||
"//third_party/crashpad/crashpad/handler:crashpad_handler",
|
||||
]
|
||||
}
|
||||
|
||||
group("electron_symbols") {
|
||||
deps = [
|
||||
":crashpad_handler_syms",
|
||||
":electron_app_syms",
|
||||
":electron_framework_syms",
|
||||
":swiftshader_egl_syms",
|
||||
":swiftshader_gles_syms",
|
||||
]
|
||||
|
||||
if (!is_mas_build) {
|
||||
deps += [ ":crashpad_handler_syms" ]
|
||||
}
|
||||
|
||||
foreach(helper_params, content_mac_helpers) {
|
||||
_helper_target = helper_params[0]
|
||||
deps += [ ":electron_helper_syms_${_helper_target}" ]
|
||||
@@ -1080,7 +1102,6 @@ if (is_mac) {
|
||||
":electron_app_manifest",
|
||||
":electron_lib",
|
||||
":packed_resources",
|
||||
"//components/crash/core/app",
|
||||
"//content:sandbox_helper_win",
|
||||
"//electron/buildflags",
|
||||
"//ui/strings",
|
||||
@@ -1101,7 +1122,9 @@ if (is_mac) {
|
||||
data += [ "$root_out_dir/resources/default_app.asar" ]
|
||||
}
|
||||
|
||||
public_deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
|
||||
public_deps = [
|
||||
"//tools/v8_context_snapshot:v8_context_snapshot",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
sources += [
|
||||
@@ -1110,22 +1133,20 @@ if (is_mac) {
|
||||
"shell/browser/resources/win/resource.h",
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//components/browser_watcher:browser_watcher_client",
|
||||
"//components/crash/core/app:run_as_crashpad_handler",
|
||||
]
|
||||
|
||||
ldflags = []
|
||||
|
||||
libs = [
|
||||
"comctl32.lib",
|
||||
"uiautomationcore.lib",
|
||||
"wtsapi32.lib",
|
||||
]
|
||||
|
||||
configs += [
|
||||
"//build/config/win:windowed",
|
||||
"//build/config/win:delayloads",
|
||||
configs += [ "//build/config/win:windowed" ]
|
||||
|
||||
ldflags = [
|
||||
# Windows 7 doesn't have these DLLs.
|
||||
# TODO: are there other DLLs we need to list here to be win7
|
||||
# compatible?
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
|
||||
]
|
||||
|
||||
# This is to support renaming of electron.exe. node-gyp has hard-coded
|
||||
@@ -1160,14 +1181,17 @@ if (is_mac) {
|
||||
extract_symbols("electron_app_symbols") {
|
||||
binary = "$root_out_dir/$electron_project_name$_target_executable_suffix"
|
||||
symbol_dir = "$root_out_dir/breakpad_symbols"
|
||||
deps = [ ":electron_app" ]
|
||||
deps = [
|
||||
":electron_app",
|
||||
]
|
||||
}
|
||||
|
||||
extract_symbols("swiftshader_egl_symbols") {
|
||||
binary = "$root_out_dir/swiftshader/libEGL$_target_shared_library_suffix"
|
||||
symbol_dir = "$root_out_dir/breakpad_symbols"
|
||||
deps =
|
||||
[ "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL" ]
|
||||
deps = [
|
||||
"//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL",
|
||||
]
|
||||
}
|
||||
|
||||
extract_symbols("swiftshader_gles_symbols") {
|
||||
@@ -1239,7 +1263,9 @@ template("dist_zip") {
|
||||
|
||||
action(target_name) {
|
||||
script = "//electron/build/zip.py"
|
||||
deps = [ ":$_runtime_deps_target" ]
|
||||
deps = [
|
||||
":$_runtime_deps_target",
|
||||
]
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"outputs",
|
||||
@@ -1258,64 +1284,78 @@ template("dist_zip") {
|
||||
}
|
||||
|
||||
copy("electron_license") {
|
||||
sources = [ "LICENSE" ]
|
||||
outputs = [ "$root_build_dir/{{source_file_part}}" ]
|
||||
sources = [
|
||||
"LICENSE",
|
||||
]
|
||||
outputs = [
|
||||
"$root_build_dir/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
copy("chromium_licenses") {
|
||||
deps = [ "//components/resources:about_credits" ]
|
||||
sources = [ "$root_gen_dir/components/resources/about_credits.html" ]
|
||||
outputs = [ "$root_build_dir/LICENSES.chromium.html" ]
|
||||
deps = [
|
||||
"//components/resources:about_credits",
|
||||
]
|
||||
sources = [
|
||||
"$root_gen_dir/components/resources/about_credits.html",
|
||||
]
|
||||
outputs = [
|
||||
"$root_build_dir/LICENSES.chromium.html",
|
||||
]
|
||||
}
|
||||
|
||||
group("licenses") {
|
||||
data_deps = [
|
||||
":chromium_licenses",
|
||||
":electron_license",
|
||||
":chromium_licenses",
|
||||
]
|
||||
}
|
||||
|
||||
copy("electron_version") {
|
||||
sources = [ "ELECTRON_VERSION" ]
|
||||
outputs = [ "$root_build_dir/version" ]
|
||||
sources = [
|
||||
"ELECTRON_VERSION",
|
||||
]
|
||||
outputs = [
|
||||
"$root_build_dir/version",
|
||||
]
|
||||
}
|
||||
|
||||
dist_zip("electron_dist_zip") {
|
||||
data_deps = [
|
||||
":electron_app",
|
||||
":electron_version",
|
||||
":licenses",
|
||||
":electron_version",
|
||||
]
|
||||
if (is_linux) {
|
||||
data_deps += [ "//sandbox/linux:chrome_sandbox" ]
|
||||
}
|
||||
outputs = [ "$root_build_dir/dist.zip" ]
|
||||
outputs = [
|
||||
"$root_build_dir/dist.zip",
|
||||
]
|
||||
}
|
||||
|
||||
dist_zip("electron_ffmpeg_zip") {
|
||||
data_deps = [ "//third_party/ffmpeg" ]
|
||||
outputs = [ "$root_build_dir/ffmpeg.zip" ]
|
||||
}
|
||||
|
||||
electron_chromedriver_deps = [
|
||||
":licenses",
|
||||
"//chrome/test/chromedriver",
|
||||
"//electron/buildflags",
|
||||
]
|
||||
|
||||
group("electron_chromedriver") {
|
||||
testonly = true
|
||||
public_deps = electron_chromedriver_deps
|
||||
data_deps = [
|
||||
"//third_party/ffmpeg",
|
||||
]
|
||||
outputs = [
|
||||
"$root_build_dir/ffmpeg.zip",
|
||||
]
|
||||
}
|
||||
|
||||
dist_zip("electron_chromedriver_zip") {
|
||||
testonly = true
|
||||
data_deps = electron_chromedriver_deps
|
||||
outputs = [ "$root_build_dir/chromedriver.zip" ]
|
||||
data_deps = [
|
||||
"//chrome/test/chromedriver",
|
||||
":licenses",
|
||||
]
|
||||
outputs = [
|
||||
"$root_build_dir/chromedriver.zip",
|
||||
]
|
||||
}
|
||||
|
||||
mksnapshot_deps = [
|
||||
":licenses",
|
||||
"//tools/v8_context_snapshot:v8_context_snapshot_generator($v8_snapshot_toolchain)",
|
||||
"//tools/v8_context_snapshot:v8_context_snapshot_generator",
|
||||
"//v8:mksnapshot($v8_snapshot_toolchain)",
|
||||
]
|
||||
|
||||
@@ -1325,21 +1365,31 @@ group("electron_mksnapshot") {
|
||||
|
||||
dist_zip("electron_mksnapshot_zip") {
|
||||
data_deps = mksnapshot_deps
|
||||
outputs = [ "$root_build_dir/mksnapshot.zip" ]
|
||||
outputs = [
|
||||
"$root_build_dir/mksnapshot.zip",
|
||||
]
|
||||
}
|
||||
|
||||
copy("hunspell_dictionaries") {
|
||||
sources = hunspell_dictionaries + hunspell_licenses
|
||||
outputs = [ "$target_gen_dir/electron_hunspell/{{source_file_part}}" ]
|
||||
outputs = [
|
||||
"$target_gen_dir/electron_hunspell/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
|
||||
dist_zip("hunspell_dictionaries_zip") {
|
||||
data_deps = [ ":hunspell_dictionaries" ]
|
||||
data_deps = [
|
||||
":hunspell_dictionaries",
|
||||
]
|
||||
flatten = true
|
||||
|
||||
outputs = [ "$root_build_dir/hunspell_dictionaries.zip" ]
|
||||
outputs = [
|
||||
"$root_build_dir/hunspell_dictionaries.zip",
|
||||
]
|
||||
}
|
||||
|
||||
group("electron") {
|
||||
public_deps = [ ":electron_app" ]
|
||||
public_deps = [
|
||||
":electron_app",
|
||||
]
|
||||
}
|
||||
|
||||
11
DEPS
11
DEPS
@@ -6,15 +6,14 @@ gclient_gn_args = [
|
||||
'checkout_libaom',
|
||||
'checkout_nacl',
|
||||
'checkout_oculus_sdk',
|
||||
'checkout_openxr',
|
||||
'checkout_google_benchmark'
|
||||
'checkout_openxr'
|
||||
]
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'83.0.4103.122',
|
||||
'80.0.3987.165',
|
||||
'node_version':
|
||||
'v12.14.1',
|
||||
'v12.13.0',
|
||||
'nan_version':
|
||||
'2ee313aaca52e2b478965ac50eb5082520380d1b',
|
||||
|
||||
@@ -70,8 +69,6 @@ vars = {
|
||||
False,
|
||||
'checkout_android_native_support':
|
||||
False,
|
||||
'checkout_google_benchmark':
|
||||
False,
|
||||
}
|
||||
|
||||
deps = {
|
||||
@@ -156,4 +153,4 @@ recursedeps = [
|
||||
'src',
|
||||
]
|
||||
|
||||
# Touch DEPS again to bust cache
|
||||
# Touch DEPS to bust cache
|
||||
|
||||
50
Dockerfile
Normal file
50
Dockerfile
Normal file
@@ -0,0 +1,50 @@
|
||||
FROM ubuntu:18.04
|
||||
|
||||
RUN groupadd --gid 1000 builduser \
|
||||
&& useradd --uid 1000 --gid builduser --shell /bin/bash --create-home builduser
|
||||
|
||||
# Set up TEMP directory
|
||||
ENV TEMP=/tmp
|
||||
RUN chmod a+rwx /tmp
|
||||
|
||||
# Install Linux packages
|
||||
ADD build/install-build-deps.sh /setup/install-build-deps.sh
|
||||
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
|
||||
RUN dpkg --add-architecture i386
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
curl \
|
||||
libnotify-bin \
|
||||
locales \
|
||||
lsb-release \
|
||||
nano \
|
||||
python-dbus \
|
||||
python-pip \
|
||||
python-setuptools \
|
||||
sudo \
|
||||
vim-nox \
|
||||
wget \
|
||||
g++-multilib \
|
||||
libgl1:i386 \
|
||||
&& /setup/install-build-deps.sh --syms --no-prompt --no-chromeos-fonts --lib32 --arm \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Node.js
|
||||
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# crcmod is required by gsutil, which is used for filling the gclient git cache
|
||||
RUN pip install -U crcmod
|
||||
|
||||
# dbusmock is needed for Electron tests
|
||||
RUN pip install python-dbusmock
|
||||
|
||||
RUN mkdir /tmp/workspace
|
||||
RUN chown builduser:builduser /tmp/workspace
|
||||
|
||||
# Add xvfb init script
|
||||
ADD tools/xvfb-init.sh /etc/init.d/xvfb
|
||||
RUN chmod a+x /etc/init.d/xvfb
|
||||
|
||||
USER builduser
|
||||
WORKDIR /home/builduser
|
||||
59
Dockerfile.arm32v7
Normal file
59
Dockerfile.arm32v7
Normal file
@@ -0,0 +1,59 @@
|
||||
FROM arm32v7/ubuntu:18.04
|
||||
|
||||
RUN groupadd --gid 1000 builduser \
|
||||
&& useradd --uid 1000 --gid builduser --shell /bin/bash --create-home builduser
|
||||
|
||||
# Set up TEMP directory
|
||||
ENV TEMP=/tmp
|
||||
RUN chmod a+rwx /tmp
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
bison \
|
||||
build-essential \
|
||||
clang \
|
||||
curl \
|
||||
gperf \
|
||||
git \
|
||||
libasound2 \
|
||||
libasound2-dev \
|
||||
libcap-dev \
|
||||
libcups2-dev \
|
||||
libdbus-1-dev \
|
||||
libgnome-keyring-dev \
|
||||
libgtk2.0-0 \
|
||||
libgtk2.0-dev \
|
||||
libgtk-3-0 \
|
||||
libgtk-3-dev \
|
||||
libnotify-bin \
|
||||
libnss3 \
|
||||
libnss3-dev \
|
||||
libxss1 \
|
||||
libxtst-dev \
|
||||
libxtst6 \
|
||||
lsb-release \
|
||||
locales \
|
||||
nano \
|
||||
python-setuptools \
|
||||
python-pip \
|
||||
python-dbusmock \
|
||||
sudo \
|
||||
unzip \
|
||||
wget \
|
||||
xvfb \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Node.js
|
||||
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# crcmod is required by gsutil, which is used for filling the gclient git cache
|
||||
RUN pip install -U crcmod
|
||||
|
||||
ADD tools/xvfb-init.sh /etc/init.d/xvfb
|
||||
RUN chmod a+x /etc/init.d/xvfb
|
||||
|
||||
RUN usermod -aG sudo builduser
|
||||
RUN echo 'builduser ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||
|
||||
WORKDIR /home/builduser
|
||||
65
Dockerfile.arm64v8
Normal file
65
Dockerfile.arm64v8
Normal file
@@ -0,0 +1,65 @@
|
||||
FROM arm64v8/ubuntu:18.04
|
||||
|
||||
RUN groupadd --gid 1000 builduser \
|
||||
&& useradd --uid 1000 --gid builduser --shell /bin/bash --create-home builduser
|
||||
|
||||
# Set up TEMP directory
|
||||
ENV TEMP=/tmp
|
||||
RUN chmod a+rwx /tmp
|
||||
|
||||
RUN dpkg --add-architecture armhf
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
bison \
|
||||
build-essential \
|
||||
clang \
|
||||
curl \
|
||||
gperf \
|
||||
git \
|
||||
libasound2 \
|
||||
libasound2-dev \
|
||||
libc6:armhf \
|
||||
libcap-dev \
|
||||
libcups2-dev \
|
||||
libdbus-1-dev \
|
||||
libgnome-keyring-dev \
|
||||
libgtk2.0-0 \
|
||||
libgtk2.0-dev \
|
||||
libgtk-3-0 \
|
||||
libgtk-3-dev \
|
||||
libnotify-bin \
|
||||
libnss3 \
|
||||
libnss3-dev \
|
||||
libstdc++6:armhf \
|
||||
libxss1 \
|
||||
libxtst-dev \
|
||||
libxtst6 \
|
||||
lsb-release \
|
||||
locales \
|
||||
nano \
|
||||
python-setuptools \
|
||||
python-pip \
|
||||
sudo \
|
||||
unzip \
|
||||
wget \
|
||||
xvfb \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Node.js
|
||||
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# crcmod is required by gsutil, which is used for filling the gclient git cache
|
||||
RUN pip install -U crcmod
|
||||
|
||||
# dbusmock is needed for Electron tests
|
||||
RUN pip install python-dbusmock
|
||||
|
||||
ADD tools/xvfb-init.sh /etc/init.d/xvfb
|
||||
RUN chmod a+x /etc/init.d/xvfb
|
||||
|
||||
RUN usermod -aG sudo builduser
|
||||
RUN echo 'builduser ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||
|
||||
WORKDIR /home/builduser
|
||||
@@ -1 +1 @@
|
||||
9.3.3
|
||||
8.2.5
|
||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2013-2020 GitHub Inc.
|
||||
Copyright (c) 2013-2019 GitHub Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
58
appveyor.yml
58
appveyor.yml
@@ -1,5 +1,5 @@
|
||||
# The config expects the following environment variables to be set:
|
||||
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
|
||||
# - "GN_CONFIG" Build type. One of {'debug', 'testing', 'release'}.
|
||||
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
|
||||
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
|
||||
# https://gn.googlesource.com/gn/+/master/docs/reference.md#target_cpu
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: libcc-20
|
||||
image: vs2019bt-16.4.0
|
||||
image: vs2019-16.3-10.0.18362
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
@@ -53,9 +53,7 @@ build_script:
|
||||
} else {
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
|
||||
$result = node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
|
||||
Write-Output $result
|
||||
if ($result.ExitCode -eq 0) {
|
||||
if ($(node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH;$LASTEXITCODE -eq 0)) {
|
||||
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
|
||||
}
|
||||
}
|
||||
@@ -78,39 +76,7 @@ build_script:
|
||||
--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=30 -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"
|
||||
}
|
||||
} else {
|
||||
# update external binaries
|
||||
python src/electron/script/update-external-binaries.py
|
||||
}
|
||||
} else {
|
||||
# file does not exist, gclient sync, then zip
|
||||
$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 --with_branch_heads --with_tags --ignore_locks)
|
||||
- gclient sync --with_branch_heads --with_tags --ignore_locks --break_repo_locks
|
||||
- ps: >-
|
||||
if ($env:SAVE_GCLIENT_SRC -eq 'true') {
|
||||
# archive current source for future use
|
||||
@@ -143,22 +109,16 @@ build_script:
|
||||
- gn check out/Default //electron:manifests
|
||||
- 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 )
|
||||
- if "%GN_CONFIG%"=="testing" ( python C:\Users\electron\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/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
|
||||
- if "%GN_CONFIG%"=="testing" ( python %LOCAL_GOMA_DIR%\goma_ctl.py stat )
|
||||
- python electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
||||
- appveyor PushArtifact out/Default/windows_toolchain_profile.json
|
||||
- appveyor PushArtifact out/Default/dist.zip
|
||||
- appveyor PushArtifact out/Default/shell_browser_ui_unittests.exe
|
||||
- appveyor PushArtifact out/Default/chromedriver.zip
|
||||
@@ -177,12 +137,12 @@ build_script:
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
python electron\script\zip-symbols.py
|
||||
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
|
||||
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
|
||||
appveyor-retry appveyor PushArtifact pdb.zip
|
||||
appveyor PushArtifact pdb.zip
|
||||
}
|
||||
- python electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
|
||||
test_script:
|
||||
@@ -200,14 +160,12 @@ test_script:
|
||||
echo "Skipping tests for $env:GN_CONFIG build"
|
||||
}
|
||||
- cd electron
|
||||
- if "%RUN_TESTS%"=="true" ( echo Running test suite & node script/yarn test -- --enable-logging)
|
||||
- if "%RUN_TESTS%"=="true" ( echo Running test suite & node script/yarn test -- --ci --enable-logging)
|
||||
- cd ..
|
||||
- if "%RUN_TESTS%"=="true" ( echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg )
|
||||
- echo "About to verify mksnapshot"
|
||||
- if "%RUN_TESTS%"=="true" ( echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd% )
|
||||
- echo "Done verifying mksnapshot"
|
||||
- if "%RUN_TESTS%"=="true" ( echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd% )
|
||||
- echo "Done verifying chromedriver"
|
||||
deploy_script:
|
||||
- cd electron
|
||||
- ps: >-
|
||||
|
||||
@@ -63,7 +63,7 @@ steps:
|
||||
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
|
||||
set npm_config_arch=arm64
|
||||
cd electron
|
||||
node script/yarn test -- --enable-logging --verbose
|
||||
node script/yarn test -- --ci --enable-logging --verbose
|
||||
displayName: 'Run Electron tests'
|
||||
env:
|
||||
ELECTRON_OUT_DIR: Default
|
||||
@@ -88,6 +88,5 @@ steps:
|
||||
- powershell: |
|
||||
Get-Process | Where Name –Like "electron*" | Stop-Process
|
||||
Get-Process | Where Name –Like "MicrosoftEdge*" | Stop-Process
|
||||
Get-Process | Where Name –Like "msedge*" | Stop-Process
|
||||
displayName: 'Kill processes left running from last test run'
|
||||
condition: always()
|
||||
condition: always()
|
||||
@@ -2,12 +2,18 @@ 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 = 80
|
||||
node_module_version = 76
|
||||
|
||||
v8_promise_internal_field_count = 1
|
||||
v8_typed_array_max_size_in_heap = 0
|
||||
v8_embedder_string = "-electron.0"
|
||||
|
||||
# TODO: this breaks native modules. See e.g. https://www.github.com/nodejs/node/pull/30463
|
||||
# We can probably enable this as long as we make sure node native modules
|
||||
# also build with the relevant #defines (V8_COMPRESS_POINTERS etc.)
|
||||
v8_enable_pointer_compression = false
|
||||
v8_enable_31bit_smis_on_64bit_arch = false
|
||||
|
||||
# TODO: this breaks mksnapshot
|
||||
v8_enable_snapshot_native_code_counters = false
|
||||
|
||||
@@ -20,3 +26,5 @@ angle_enable_vulkan_validation_layers = false
|
||||
dawn_enable_vulkan_validation_layers = false
|
||||
|
||||
is_cfi = false
|
||||
|
||||
enable_osr = true
|
||||
|
||||
10
build/args/debug.gn
Normal file
10
build/args/debug.gn
Normal file
@@ -0,0 +1,10 @@
|
||||
import("all.gn")
|
||||
is_debug = true
|
||||
is_component_build = true
|
||||
|
||||
# This may be guarded behind is_chrome_branded alongside
|
||||
# proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
|
||||
# explicitly override here to build OpenH264 encoder/FFmpeg decoder.
|
||||
# The initialization of the decoder depends on whether ffmpeg has
|
||||
# been built with H.264 support.
|
||||
rtc_use_h264 = proprietary_codecs
|
||||
@@ -1,2 +0,0 @@
|
||||
goma_dir = rebase_path("//electron/external_binaries/goma")
|
||||
use_goma = true
|
||||
@@ -34,7 +34,9 @@ template("extract_symbols") {
|
||||
dump_syms_binary,
|
||||
]
|
||||
stamp_file = "${target_gen_dir}/${target_name}.stamp"
|
||||
outputs = [ stamp_file ]
|
||||
outputs = [
|
||||
stamp_file,
|
||||
]
|
||||
args = [
|
||||
"./" + rebase_path(dump_syms_binary, root_build_dir),
|
||||
rebase_path(invoker.binary, root_build_dir),
|
||||
|
||||
@@ -10,7 +10,9 @@ template("npm_action") {
|
||||
]
|
||||
script = "//electron/build/npm-run.py"
|
||||
|
||||
outputs = [ "$target_gen_dir/npm_pre_stamps/" + target_name + ".stamp" ]
|
||||
outputs = [
|
||||
"$target_gen_dir/npm_pre_stamps/" + target_name + ".stamp",
|
||||
]
|
||||
|
||||
args = [
|
||||
"--silent",
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
from __future__ import with_statement
|
||||
import contextlib
|
||||
import sys
|
||||
import os
|
||||
import optparse
|
||||
import json
|
||||
|
||||
sys.path.append("%s/../../build" % os.path.dirname(os.path.realpath(__file__)))
|
||||
|
||||
import find_depot_tools
|
||||
from vs_toolchain import \
|
||||
SetEnvironmentAndGetRuntimeDllDirs, \
|
||||
SetEnvironmentAndGetSDKDir, \
|
||||
GetVisualStudioVersion, \
|
||||
NormalizePath
|
||||
|
||||
sys.path.append("%s/win_toolchain" % find_depot_tools.add_depot_tools_to_path())
|
||||
|
||||
from get_toolchain_if_necessary import CalculateHash
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def cwd(dir):
|
||||
curdir = os.getcwd()
|
||||
try:
|
||||
os.chdir(dir)
|
||||
yield
|
||||
finally:
|
||||
os.chdir(curdir)
|
||||
|
||||
|
||||
def calculate_hash(root):
|
||||
with cwd(root):
|
||||
return CalculateHash('.', None)
|
||||
|
||||
def windows_installed_software():
|
||||
import win32com.client
|
||||
strComputer = "."
|
||||
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
|
||||
objSWbemServices = objWMIService.ConnectServer(strComputer, "root\cimv2")
|
||||
colItems = objSWbemServices.ExecQuery("Select * from Win32_Product")
|
||||
items = []
|
||||
|
||||
for objItem in colItems:
|
||||
item = {}
|
||||
if objItem.Caption:
|
||||
item['caption'] = objItem.Caption
|
||||
if objItem.Caption:
|
||||
item['description'] = objItem.Description
|
||||
if objItem.InstallDate:
|
||||
item['install_date'] = objItem.InstallDate
|
||||
if objItem.InstallDate2:
|
||||
item['install_date_2'] = objItem.InstallDate2
|
||||
if objItem.InstallLocation:
|
||||
item['install_location'] = objItem.InstallLocation
|
||||
if objItem.Name:
|
||||
item['name'] = objItem.Name
|
||||
if objItem.SKUNumber:
|
||||
item['sku_number'] = objItem.SKUNumber
|
||||
if objItem.Vendor:
|
||||
item['vendor'] = objItem.Vendor
|
||||
if objItem.Version:
|
||||
item['version'] = objItem.Version
|
||||
items.append(item)
|
||||
|
||||
return items
|
||||
|
||||
|
||||
def windows_profile():
|
||||
runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs()
|
||||
win_sdk_dir = SetEnvironmentAndGetSDKDir()
|
||||
path = NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH'])
|
||||
|
||||
return {
|
||||
'pwd': os.getcwd(), # since current windows executable are symbols path dependant, profile the current directory too
|
||||
'installed_software': windows_installed_software(),
|
||||
'sdks': [
|
||||
{'name': 'vs', 'path': path, 'hash': calculate_hash(path)},
|
||||
{'name': 'wsdk', 'path': win_sdk_dir, 'hash': calculate_hash(win_sdk_dir)}
|
||||
],
|
||||
'runtime_lib_dirs': runtime_dll_dirs,
|
||||
}
|
||||
|
||||
|
||||
def main(options):
|
||||
if sys.platform == 'win32':
|
||||
with open(options.output_json, 'wb') as f:
|
||||
json.dump(windows_profile(), f)
|
||||
else:
|
||||
raise OSError("Unsupported OS")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option('--output-json', metavar='FILE', default='profile.json',
|
||||
help='write information about toolchain to FILE')
|
||||
options, args = parser.parse_args()
|
||||
sys.exit(main(options))
|
||||
@@ -81,7 +81,9 @@ template("mac_xib_bundle_data") {
|
||||
"visibility",
|
||||
])
|
||||
|
||||
public_deps = [ ":$_compile_target_name" ]
|
||||
public_deps = [
|
||||
":$_compile_target_name",
|
||||
]
|
||||
sources = get_target_outputs(":$_compile_target_name")
|
||||
|
||||
_output_path = "{{bundle_resources_dir}}"
|
||||
@@ -89,6 +91,8 @@ template("mac_xib_bundle_data") {
|
||||
_output_path = invoker.output_path
|
||||
}
|
||||
|
||||
outputs = [ "$_output_path/{{source_file_part}}" ]
|
||||
outputs = [
|
||||
"$_output_path/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,12 @@ template("templated_file") {
|
||||
"inputs",
|
||||
"outputs",
|
||||
])
|
||||
inputs = [ invoker.template ]
|
||||
outputs = [ invoker.output ]
|
||||
inputs = [
|
||||
invoker.template,
|
||||
]
|
||||
outputs = [
|
||||
invoker.output,
|
||||
]
|
||||
script = "//electron/build/generate-template.py"
|
||||
args = [
|
||||
rebase_path(invoker.template),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
|
||||
@@ -10,9 +9,7 @@ config.output = {
|
||||
filename: path.basename(outPath)
|
||||
}
|
||||
|
||||
const { wrapInitWithProfilingTimeout, wrapInitWithTryCatch, ...webpackConfig } = config;
|
||||
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
webpack(config, (err, stats) => {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
@@ -20,26 +17,6 @@ webpack(webpackConfig, (err, stats) => {
|
||||
console.error(stats.toString('normal'))
|
||||
process.exit(1)
|
||||
} else {
|
||||
let contents = fs.readFileSync(outPath, 'utf8');
|
||||
if (wrapInitWithTryCatch) {
|
||||
contents = `try {
|
||||
${contents}
|
||||
} catch (err) {
|
||||
console.error('Electron ${webpackConfig.output.filename} script failed to run');
|
||||
console.error(err);
|
||||
}`;
|
||||
}
|
||||
if (wrapInitWithProfilingTimeout) {
|
||||
contents = `function ___electron_webpack_init__() {
|
||||
${contents}
|
||||
};
|
||||
if ((globalThis.process || binding.process).argv.includes("--profile-electron-init")) {
|
||||
setTimeout(___electron_webpack_init__, 0);
|
||||
} else {
|
||||
___electron_webpack_init__();
|
||||
}`;
|
||||
}
|
||||
fs.writeFileSync(outPath, contents)
|
||||
process.exit(0)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
|
||||
const electronRoot = path.resolve(__dirname, '../..')
|
||||
|
||||
@@ -21,73 +20,11 @@ class AccessDependenciesPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
const defines = {
|
||||
BUILDFLAG: onlyPrintingGraph ? '(a => a)' : ''
|
||||
}
|
||||
|
||||
const buildFlagsPrefix = '--buildflags='
|
||||
const buildFlagArg = process.argv.find(arg => arg.startsWith(buildFlagsPrefix))
|
||||
|
||||
if (buildFlagArg) {
|
||||
const buildFlagPath = buildFlagArg.substr(buildFlagsPrefix.length)
|
||||
|
||||
const flagFile = fs.readFileSync(buildFlagPath, 'utf8')
|
||||
for (const line of flagFile.split(/(\r\n|\r|\n)/g)) {
|
||||
const flagMatch = line.match(/#define BUILDFLAG_INTERNAL_(.+?)\(\) \(([01])\)/)
|
||||
if (flagMatch) {
|
||||
const [, flagName, flagValue] = flagMatch;
|
||||
defines[flagName] = JSON.stringify(Boolean(parseInt(flagValue, 10)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const ignoredModules = []
|
||||
|
||||
if (defines['ENABLE_DESKTOP_CAPTURER'] === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/desktop-capturer',
|
||||
'@electron/internal/renderer/api/desktop-capturer'
|
||||
)
|
||||
}
|
||||
|
||||
if (defines['ENABLE_REMOTE_MODULE'] === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/remote/server',
|
||||
'@electron/internal/renderer/api/remote'
|
||||
)
|
||||
}
|
||||
|
||||
if (defines['ENABLE_VIEW_API'] === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/api/views/box-layout',
|
||||
'@electron/internal/browser/api/views/button',
|
||||
'@electron/internal/browser/api/views/label-button',
|
||||
'@electron/internal/browser/api/views/layout-manager',
|
||||
'@electron/internal/browser/api/views/md-text-button',
|
||||
'@electron/internal/browser/api/views/resize-area',
|
||||
'@electron/internal/browser/api/views/text-field'
|
||||
)
|
||||
}
|
||||
|
||||
if (defines['ENABLE_ELECTRON_EXTENSIONS'] === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/@browser/chrome-extension-shim'
|
||||
)
|
||||
} else {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/chrome-extension',
|
||||
'@electron/internal/renderer/chrome-api',
|
||||
'@electron/internal/renderer/content-scripts-injector'
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = ({
|
||||
alwaysHasNode,
|
||||
loadElectronFromAlternateTarget,
|
||||
targetDeletesNodeGlobals,
|
||||
target,
|
||||
wrapInitWithProfilingTimeout,
|
||||
wrapInitWithTryCatch
|
||||
target
|
||||
}) => {
|
||||
let entry = path.resolve(electronRoot, 'lib', target, 'init.ts')
|
||||
if (!fs.existsSync(entry)) {
|
||||
@@ -96,37 +33,29 @@ module.exports = ({
|
||||
|
||||
return ({
|
||||
mode: 'development',
|
||||
devtool: false,
|
||||
devtool: 'inline-source-map',
|
||||
entry,
|
||||
target: alwaysHasNode ? 'node' : 'web',
|
||||
output: {
|
||||
filename: `${target}.bundle.js`
|
||||
},
|
||||
wrapInitWithProfilingTimeout,
|
||||
wrapInitWithTryCatch,
|
||||
resolve: {
|
||||
alias: {
|
||||
'@electron/internal': path.resolve(electronRoot, 'lib'),
|
||||
'electron': path.resolve(electronRoot, 'lib', loadElectronFromAlternateTarget || target, 'api', 'exports', 'electron.ts'),
|
||||
// Force timers to resolve to our dependency that doesn't use window.postMessage
|
||||
// Force timers to resolve to our dependency that doens't use window.postMessage
|
||||
'timers': path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
||||
},
|
||||
extensions: ['.ts', '.js']
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: (moduleName) => !onlyPrintingGraph && ignoredModules.includes(moduleName),
|
||||
loader: 'null-loader',
|
||||
}, {
|
||||
test: /\.ts$/,
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
configFile: path.resolve(electronRoot, 'tsconfig.electron.json'),
|
||||
transpileOnly: onlyPrintingGraph,
|
||||
ignoreDiagnostics: [
|
||||
// File '{0}' is not under 'rootDir' '{1}'.
|
||||
6059,
|
||||
]
|
||||
ignoreDiagnostics: [6059]
|
||||
}
|
||||
}]
|
||||
},
|
||||
@@ -137,17 +66,6 @@ module.exports = ({
|
||||
// one of our renderer bundles should import it from the 'timers' package
|
||||
setImmediate: false,
|
||||
},
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
terserOptions: {
|
||||
keep_classnames: true,
|
||||
keep_fnames: true,
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new AccessDependenciesPlugin(),
|
||||
...(targetDeletesNodeGlobals ? [
|
||||
@@ -160,7 +78,6 @@ module.exports = ({
|
||||
new webpack.ProvidePlugin({
|
||||
Promise: ['@electron/internal/common/webpack-globals-provider', 'Promise'],
|
||||
}),
|
||||
new webpack.DefinePlugin(defines),
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'isolated_renderer',
|
||||
alwaysHasNode: false,
|
||||
wrapInitWithTryCatch: true
|
||||
alwaysHasNode: false
|
||||
})
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'renderer',
|
||||
alwaysHasNode: true,
|
||||
targetDeletesNodeGlobals: true,
|
||||
wrapInitWithProfilingTimeout: true,
|
||||
wrapInitWithTryCatch: true
|
||||
targetDeletesNodeGlobals: true
|
||||
})
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'sandboxed_renderer',
|
||||
alwaysHasNode: false,
|
||||
wrapInitWithProfilingTimeout: true,
|
||||
wrapInitWithTryCatch: true
|
||||
alwaysHasNode: false
|
||||
})
|
||||
|
||||
@@ -2,6 +2,5 @@ module.exports = require('./webpack.config.base')({
|
||||
target: 'worker',
|
||||
loadElectronFromAlternateTarget: 'renderer',
|
||||
alwaysHasNode: true,
|
||||
targetDeletesNodeGlobals: true,
|
||||
wrapInitWithTryCatch: true
|
||||
targetDeletesNodeGlobals: true
|
||||
})
|
||||
|
||||
@@ -16,7 +16,6 @@ template("webpack_build") {
|
||||
inputs = [
|
||||
invoker.config_file,
|
||||
"//electron/build/webpack/webpack.config.base.js",
|
||||
"//electron/build/webpack/run-compiler.js",
|
||||
"//electron/tsconfig.json",
|
||||
"//electron/yarn.lock",
|
||||
"//electron/typings/internal-ambient.d.ts",
|
||||
@@ -26,10 +25,10 @@ template("webpack_build") {
|
||||
args = [
|
||||
rebase_path(invoker.config_file),
|
||||
rebase_path(invoker.out_file),
|
||||
"--buildflags=" + rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||
]
|
||||
deps += [ "buildflags" ]
|
||||
|
||||
outputs = [ invoker.out_file ]
|
||||
outputs = [
|
||||
invoker.out_file,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ EXTENSIONS_TO_SKIP = [
|
||||
'.pdb',
|
||||
'.mojom.js',
|
||||
'.mojom-lite.js',
|
||||
'.info'
|
||||
]
|
||||
|
||||
PATHS_TO_SKIP = [
|
||||
@@ -25,13 +24,6 @@ PATHS_TO_SKIP = [
|
||||
# //chrome/browser/resources/ssl/ssl_error_assistant, but we don't need to
|
||||
# ship it.
|
||||
'pyproto',
|
||||
|
||||
# On Windows, this binary doesn't exist (the crashpad handler is built-in).
|
||||
# On MacOS, the binary is called 'chrome_crashpad_handler' and is inside the
|
||||
# app bundle.
|
||||
# On Linux, we don't use crashpad, but this binary is still built for some
|
||||
# reason. Exclude it from the zip.
|
||||
'./crashpad_handler',
|
||||
]
|
||||
|
||||
def skip_path(dep, dist_zip, target_cpu):
|
||||
|
||||
@@ -14,7 +14,7 @@ declare_args() {
|
||||
|
||||
enable_view_api = false
|
||||
|
||||
enable_pdf_viewer = true
|
||||
enable_pdf_viewer = false
|
||||
|
||||
enable_tts = true
|
||||
|
||||
@@ -32,7 +32,7 @@ declare_args() {
|
||||
enable_pepper_flash = true
|
||||
|
||||
# Enable Chrome extensions support.
|
||||
enable_electron_extensions = true
|
||||
enable_electron_extensions = false
|
||||
|
||||
# Enable Spellchecker support
|
||||
enable_builtin_spellchecker = true
|
||||
|
||||
@@ -14,8 +14,6 @@ static_library("chrome") {
|
||||
sources = [
|
||||
"//chrome/browser/browser_process.cc",
|
||||
"//chrome/browser/browser_process.h",
|
||||
"//chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc",
|
||||
"//chrome/browser/crash_upload_list/crash_upload_list_crashpad.h",
|
||||
"//chrome/browser/devtools/devtools_contents_resizing_strategy.cc",
|
||||
"//chrome/browser/devtools/devtools_contents_resizing_strategy.h",
|
||||
"//chrome/browser/devtools/devtools_embedder_message_dispatcher.cc",
|
||||
@@ -53,12 +51,10 @@ static_library("chrome") {
|
||||
"//chrome/browser/ssl/security_state_tab_helper.cc",
|
||||
"//chrome/browser/ssl/security_state_tab_helper.h",
|
||||
"//chrome/browser/ssl/tls_deprecation_config.cc",
|
||||
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.cc",
|
||||
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.h",
|
||||
"//chrome/browser/ui/autofill/popup_view_common.cc",
|
||||
"//chrome/browser/ui/autofill/popup_view_common.h",
|
||||
"//chrome/browser/win/chrome_process_finder.cc",
|
||||
"//chrome/browser/win/chrome_process_finder.h",
|
||||
"//chrome/child/v8_crashpad_support_win.cc",
|
||||
"//chrome/child/v8_crashpad_support_win.h",
|
||||
"//extensions/browser/app_window/size_constraints.cc",
|
||||
"//extensions/browser/app_window/size_constraints.h",
|
||||
]
|
||||
@@ -73,7 +69,6 @@ static_library("chrome") {
|
||||
deps = [
|
||||
"//chrome/browser:resource_prefetch_predictor_proto",
|
||||
"//components/feature_engagement:buildflags",
|
||||
"//components/optimization_guide/proto:optimization_guide_proto",
|
||||
]
|
||||
|
||||
if (is_linux) {
|
||||
@@ -114,15 +109,11 @@ static_library("chrome") {
|
||||
]
|
||||
|
||||
if (use_aura) {
|
||||
sources += [ "//chrome/browser/platform_util_aura.cc" ]
|
||||
|
||||
if (!is_win) {
|
||||
sources += [
|
||||
"//chrome/browser/ui/views/color_chooser_aura.cc",
|
||||
"//chrome/browser/ui/views/color_chooser_aura.h",
|
||||
]
|
||||
}
|
||||
|
||||
sources += [
|
||||
"//chrome/browser/platform_util_aura.cc",
|
||||
"//chrome/browser/ui/views/color_chooser_aura.cc",
|
||||
"//chrome/browser/ui/views/color_chooser_aura.h",
|
||||
]
|
||||
deps += [ "//components/feature_engagement" ]
|
||||
}
|
||||
|
||||
@@ -193,9 +184,9 @@ static_library("chrome") {
|
||||
"//chrome/services/printing:lib",
|
||||
"//components/printing/browser",
|
||||
"//components/printing/renderer",
|
||||
"//components/services/print_compositor",
|
||||
"//components/services/print_compositor/public/cpp",
|
||||
"//components/services/print_compositor/public/mojom",
|
||||
"//components/services/pdf_compositor",
|
||||
"//components/services/pdf_compositor/public/cpp",
|
||||
"//components/services/pdf_compositor/public/mojom",
|
||||
]
|
||||
|
||||
deps += [
|
||||
@@ -238,111 +229,6 @@ static_library("chrome") {
|
||||
"//components/vector_icons:vector_icons",
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_electron_extensions) {
|
||||
sources += [
|
||||
"//chrome/browser/extensions/chrome_url_request_util.cc",
|
||||
"//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",
|
||||
]
|
||||
|
||||
if (enable_pdf_viewer) {
|
||||
sources += [
|
||||
"//chrome/browser/pdf/pdf_extension_util.cc",
|
||||
"//chrome/browser/pdf/pdf_extension_util.h",
|
||||
"//chrome/renderer/pepper/chrome_pdf_print_client.cc",
|
||||
"//chrome/renderer/pepper/chrome_pdf_print_client.h",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
source_set("plugins") {
|
||||
sources = []
|
||||
deps = []
|
||||
libs = []
|
||||
|
||||
# browser side
|
||||
sources += [
|
||||
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc",
|
||||
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
|
||||
]
|
||||
deps += [
|
||||
"//media:media_buildflags",
|
||||
"//ppapi/buildflags",
|
||||
"//ppapi/proxy:ipc",
|
||||
"//services/device/public/mojom",
|
||||
]
|
||||
if (enable_pdf_viewer) {
|
||||
deps += [ "//components/pdf/browser" ]
|
||||
}
|
||||
if (enable_pepper_flash) {
|
||||
sources += [
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h",
|
||||
]
|
||||
if (is_mac) {
|
||||
sources += [
|
||||
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.h",
|
||||
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.mm",
|
||||
]
|
||||
libs += [ "CoreGraphics.framework" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
deps += [ "//components/services/font/public/cpp" ]
|
||||
}
|
||||
}
|
||||
|
||||
# renderer side
|
||||
sources += [
|
||||
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc",
|
||||
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
|
||||
]
|
||||
if (enable_pepper_flash) {
|
||||
sources += [
|
||||
"//chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_drm_renderer_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_fullscreen_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_fullscreen_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_menu_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_menu_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_renderer_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_renderer_host.h",
|
||||
]
|
||||
}
|
||||
if (enable_pepper_flash || enable_pdf_viewer) {
|
||||
sources += [
|
||||
"//chrome/renderer/pepper/pepper_flash_font_file_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_font_file_host.h",
|
||||
]
|
||||
if (enable_pdf_viewer) {
|
||||
deps += [ "//components/pdf/renderer" ]
|
||||
}
|
||||
}
|
||||
deps += [
|
||||
"//components/strings",
|
||||
"//media:media_buildflags",
|
||||
"//ppapi/host",
|
||||
"//ppapi/proxy",
|
||||
"//ppapi/proxy:ipc",
|
||||
"//ppapi/shared_impl",
|
||||
"//skia",
|
||||
]
|
||||
}
|
||||
|
||||
# This source set is just so we don't have to depend on all of //chrome/browser
|
||||
@@ -369,7 +255,6 @@ source_set("chrome_spellchecker") {
|
||||
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_service.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_service.h",
|
||||
"//chrome/common/pref_names.h",
|
||||
]
|
||||
|
||||
if (has_spellcheck_panel) {
|
||||
|
||||
@@ -36,7 +36,6 @@ net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext(
|
||||
// Linux has only a single persistent slot compared to ChromeOS's separate
|
||||
// public and private slot.
|
||||
// Redirect any slot usage to this persistent slot on Linux.
|
||||
crypto::EnsureNSSInit();
|
||||
g_nss_cert_database = new net::NSSCertDatabase(
|
||||
crypto::ScopedPK11Slot(PK11_GetInternalKeySlot()) /* public slot */,
|
||||
crypto::ScopedPK11Slot(PK11_GetInternalKeySlot()) /* private slot */);
|
||||
|
||||
@@ -197,7 +197,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
|
||||
return PROCESS_NONE;
|
||||
}
|
||||
|
||||
switch (chrome::AttemptToNotifyRunningChrome(remote_window_)) {
|
||||
switch (chrome::AttemptToNotifyRunningChrome(remote_window_, false)) {
|
||||
case chrome::NOTIFY_SUCCESS:
|
||||
return PROCESS_NOTIFIED;
|
||||
case chrome::NOTIFY_FAILED:
|
||||
|
||||
62
components/pepper_flash/BUILD.gn
Normal file
62
components/pepper_flash/BUILD.gn
Normal file
@@ -0,0 +1,62 @@
|
||||
# Copyright (c) 2018 GitHub, Inc.
|
||||
# Use of this source code is governed by the MIT license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
component("pepper_flash") {
|
||||
visibility = [ "//electron:electron_lib" ]
|
||||
defines = [ "IS_PEPPER_FLASH_IMPL" ]
|
||||
sources = [
|
||||
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc",
|
||||
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
|
||||
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc",
|
||||
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_drm_renderer_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_font_file_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_font_file_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_fullscreen_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_fullscreen_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_menu_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_menu_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_renderer_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_renderer_host.h",
|
||||
"//chrome/renderer/pepper/pepper_helper.cc",
|
||||
"//chrome/renderer/pepper/pepper_helper.h",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
|
||||
]
|
||||
deps = [
|
||||
"//content/public/browser",
|
||||
"//content/public/renderer",
|
||||
"//media:media_buildflags",
|
||||
"//ppapi/host",
|
||||
"//ppapi/proxy",
|
||||
"//ppapi/proxy:ipc",
|
||||
"//ppapi/shared_impl",
|
||||
"//services/device/public/mojom",
|
||||
"//skia",
|
||||
"//third_party/adobe/flash:flapper_version_h",
|
||||
"//ui/base",
|
||||
"//ui/base/clipboard",
|
||||
]
|
||||
if (is_mac) {
|
||||
sources += [
|
||||
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.h",
|
||||
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.mm",
|
||||
]
|
||||
libs = [ "CoreGraphics.framework" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
deps += [ "//components/services/font/public/cpp" ]
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
import { app, dialog, BrowserWindow, shell, ipcMain } from 'electron';
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
|
||||
let mainWindow: BrowserWindow | null = null;
|
||||
|
||||
app.allowRendererProcessReuse = true;
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', () => {
|
||||
app.quit();
|
||||
@@ -30,11 +31,12 @@ function isTrustedSender (webContents: Electron.WebContents) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return url.fileURLToPath(webContents.getURL()) === indexPath;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const parsedUrl = new URL(webContents.getURL());
|
||||
const urlPath = process.platform === 'win32'
|
||||
// Strip the prefixed "/" that occurs on windows
|
||||
? path.resolve(parsedUrl.pathname.substr(1))
|
||||
: parsedUrl.pathname;
|
||||
return parsedUrl.protocol === 'file:' && urlPath === indexPath;
|
||||
}
|
||||
|
||||
ipcMain.handle('bootstrap', (event) => {
|
||||
|
||||
33
docs-translations/README.md
Normal file
33
docs-translations/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
## Docs Translations
|
||||
|
||||
This directory once contained unstructured translations of Electron's
|
||||
documentation, but has been deprecated in favor of a new translation process
|
||||
using [Crowdin], a GitHub-friendly platform for collaborative translation.
|
||||
|
||||
For more details, visit the [electron/i18n] repo.
|
||||
|
||||
## Contributing
|
||||
|
||||
If you're interested in helping translate Electron's docs, visit
|
||||
[Crowdin] and log in with your GitHub account. And thanks!
|
||||
|
||||
## Offline Docs
|
||||
|
||||
If you miss having access to Electron's raw markdown files in your preferred
|
||||
language, don't fret! You can still get raw docs, they're just in a
|
||||
different place now. See [electron/i18n/tree/master/content]
|
||||
|
||||
To more easily view and browse offline docs in your language, clone the repo and use [vmd],
|
||||
an Electron-based GitHub-styled markdown viewer:
|
||||
|
||||
```sh
|
||||
npm i -g vmd
|
||||
git clone https://github.com/electron/i18n
|
||||
vmd electron-i18n/content/zh-CN
|
||||
```
|
||||
|
||||
[crowdin.com/project/electron]: https://crowdin.com/project/electron
|
||||
[Crowdin]: https://crowdin.com/project/electron
|
||||
[electron/i18n]: https://github.com/electron/i18n#readme
|
||||
[electron/i18n/tree/master/content]: https://github.com/electron/i18n/tree/master/content
|
||||
[vmd]: http://ghub.io/vmd
|
||||
@@ -39,7 +39,6 @@ an issue:
|
||||
* [Using Electron's APIs](tutorial/application-architecture.md#using-electron-apis)
|
||||
* [Using Node.js APIs](tutorial/application-architecture.md#using-nodejs-apis)
|
||||
* [Using Native Node.js Modules](tutorial/using-native-node-modules.md)
|
||||
* [Performance Strategies](tutorial/performance.md)
|
||||
* Adding Features to Your App
|
||||
* [Notifications](tutorial/notifications.md)
|
||||
* [Recent Documents](tutorial/recent-documents.md)
|
||||
@@ -53,7 +52,6 @@ an issue:
|
||||
* [Native File Drag & Drop](tutorial/native-file-drag-drop.md)
|
||||
* [Offscreen Rendering](tutorial/offscreen-rendering.md)
|
||||
* [Supporting macOS Dark Mode](tutorial/mojave-dark-mode-guide.md)
|
||||
* [Web embeds in Electron](tutorial/web-embeds.md)
|
||||
* [Accessibility](tutorial/accessibility.md)
|
||||
* [Spectron](tutorial/accessibility.md#spectron)
|
||||
* [Devtron](tutorial/accessibility.md#devtron)
|
||||
@@ -112,8 +110,7 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
* [Process Object](api/process.md)
|
||||
* [Supported Command Line Switches](api/command-line-switches.md)
|
||||
* [Environment Variables](api/environment-variables.md)
|
||||
* [Chrome Extensions Support](api/extensions.md)
|
||||
* [Breaking API Changes](breaking-changes.md)
|
||||
* [Breaking API Changes](api/breaking-changes.md)
|
||||
|
||||
### Custom DOM Elements:
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ method, i.e.
|
||||
```javascript
|
||||
const { app, globalShortcut } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
// Register a 'CommandOrControl+Y' shortcut listener.
|
||||
globalShortcut.register('CommandOrControl+Y', () => {
|
||||
// Do stuff when Y and either Command/Control is pressed.
|
||||
@@ -54,7 +54,7 @@ The `Super` key is mapped to the `Windows` key on Windows and Linux and
|
||||
* `0` to `9`
|
||||
* `A` to `Z`
|
||||
* `F1` to `F24`
|
||||
* Punctuation like `~`, `!`, `@`, `#`, `$`, etc.
|
||||
* Punctuations like `~`, `!`, `@`, `#`, `$`, etc.
|
||||
* `Plus`
|
||||
* `Space`
|
||||
* `Tab`
|
||||
|
||||
@@ -34,11 +34,10 @@ Returns:
|
||||
|
||||
* `launchInfo` unknown _macOS_
|
||||
|
||||
Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
|
||||
holds the `userInfo` of the `NSUserNotification` that was used to open the
|
||||
application, if it was launched from Notification Center. You can also call
|
||||
`app.isReady()` to check if this event has already fired and `app.whenReady()`
|
||||
to get a Promise that is fulfilled when Electron is initialized.
|
||||
Emitted when Electron has finished initializing. On macOS, `launchInfo` holds
|
||||
the `userInfo` of the `NSUserNotification` that was used to open the application,
|
||||
if it was launched from Notification Center. You can call `app.isReady()` to
|
||||
check if this event has already fired.
|
||||
|
||||
### Event: 'window-all-closed'
|
||||
|
||||
@@ -75,7 +74,7 @@ Returns:
|
||||
* `event` Event
|
||||
|
||||
Emitted when all windows have been closed and the application will quit.
|
||||
Calling `event.preventDefault()` will prevent the default behavior, which is
|
||||
Calling `event.preventDefault()` will prevent the default behaviour, which is
|
||||
terminating the application.
|
||||
|
||||
See the description of the `window-all-closed` event for the differences between
|
||||
@@ -204,7 +203,7 @@ Returns:
|
||||
[`NSUserActivity.activityType`][activity-type].
|
||||
* `userInfo` unknown - Contains app-specific state stored by the activity.
|
||||
|
||||
Emitted when [Handoff][handoff] is about to be resumed on another device. If you need to update the state to be transferred, you should call `event.preventDefault()` immediately, construct a new `userInfo` dictionary and call `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will fail and `continue-activity-error` will be called.
|
||||
Emitted when [Handoff][handoff] is about to be resumed on another device. If you need to update the state to be transferred, you should call `event.preventDefault()` immediately, construct a new `userInfo` dictionary and call `app.updateCurrentActiviy()` in a timely manner. Otherwise, the operation will fail and `continue-activity-error` will be called.
|
||||
|
||||
### Event: 'new-window-for-tab' _macOS_
|
||||
|
||||
@@ -369,25 +368,6 @@ Returns:
|
||||
|
||||
Emitted when the renderer process of `webContents` crashes or is killed.
|
||||
|
||||
#### Event: 'render-process-gone'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
* `details` Object
|
||||
* `reason` String - The reason the render process is gone. Possible values:
|
||||
* `clean-exit` - Process exited with an exit code of zero
|
||||
* `abnormal-exit` - Process exited with a non-zero exit code
|
||||
* `killed` - Process was sent a SIGTERM or otherwise killed externally
|
||||
* `crashed` - Process crashed
|
||||
* `oom` - Process ran out of memory
|
||||
* `launch-failed` - Process never successfully launched
|
||||
* `integrity-failure` - Windows code integrity checks failed
|
||||
|
||||
Emitted when the renderer process unexpectedly dissapears. This is normally
|
||||
because it was crashed or killed.
|
||||
|
||||
### Event: 'accessibility-support-changed' _macOS_ _Windows_
|
||||
|
||||
Returns:
|
||||
@@ -507,6 +487,18 @@ Emitted when `remote.getCurrentWebContents()` is called in the renderer process
|
||||
Calling `event.preventDefault()` will prevent the object from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
### Event: 'remote-get-guest-web-contents'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
* `guestWebContents` [WebContents](web-contents.md)
|
||||
|
||||
Emitted when `<webview>.getWebContents()` is called in the renderer process of `webContents`.
|
||||
Calling `event.preventDefault()` will prevent the object from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
## Methods
|
||||
|
||||
The `app` object has the following methods:
|
||||
@@ -565,7 +557,6 @@ app.exit(0)
|
||||
### `app.isReady()`
|
||||
|
||||
Returns `Boolean` - `true` if Electron has finished initializing, `false` otherwise.
|
||||
See also `app.whenReady()`.
|
||||
|
||||
### `app.whenReady()`
|
||||
|
||||
@@ -573,17 +564,11 @@ Returns `Promise<void>` - fulfilled when Electron is initialized.
|
||||
May be used as a convenient alternative to checking `app.isReady()`
|
||||
and subscribing to the `ready` event if the app is not ready yet.
|
||||
|
||||
### `app.focus([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
* `steal` Boolean _macOS_ - Make the receiver the active app even if another app is
|
||||
currently active.
|
||||
### `app.focus()`
|
||||
|
||||
On Linux, focuses on the first visible window. On macOS, makes the application
|
||||
the active app. On Windows, focuses on the application's first window.
|
||||
|
||||
You should seek to use the `steal` option as sparingly as possible.
|
||||
|
||||
### `app.hide()` _macOS_
|
||||
|
||||
Hides all application windows without minimizing them.
|
||||
@@ -627,7 +612,6 @@ Returns `String` - The current application directory.
|
||||
* `videos` Directory for a user's videos.
|
||||
* `logs` Directory for your app's log folder.
|
||||
* `pepperFlashSystemPlugin` Full path to the system version of the Pepper Flash plugin.
|
||||
* `crashDumps` Directory where crash dumps are stored.
|
||||
|
||||
Returns `String` - A path to a special directory or file associated with `name`. On
|
||||
failure, an `Error` is thrown.
|
||||
@@ -685,6 +669,8 @@ to the npm modules spec. You should usually also specify a `productName`
|
||||
field, which is your application's full capitalized name, and which will be
|
||||
preferred over `name` by Electron.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.setName(name)`
|
||||
|
||||
* `name` String
|
||||
@@ -693,6 +679,8 @@ Overrides the current application's name.
|
||||
|
||||
**Note:** This function overrides the name used internally by Electron; it does not affect the name that the OS uses.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.getLocale()`
|
||||
|
||||
Returns `String` - The current application locale. Possible return values are documented [here](locales.md).
|
||||
@@ -957,7 +945,7 @@ if (!gotTheLock) {
|
||||
})
|
||||
|
||||
// Create myWindow, load the rest of the app, etc...
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
})
|
||||
}
|
||||
```
|
||||
@@ -1014,17 +1002,6 @@ Updates the current activity if its type matches `type`, merging the entries fro
|
||||
|
||||
Changes the [Application User Model ID][app-user-model-id] to `id`.
|
||||
|
||||
### `app.setActivationPolicy(policy)` _macOS_
|
||||
|
||||
* `policy` String - Can be 'regular', 'accessory', or 'prohibited'.
|
||||
|
||||
Sets the activation policy for a given app.
|
||||
|
||||
Activation policy types:
|
||||
* 'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.
|
||||
* 'accessory' - The application doesn’t appear in the Dock and doesn’t have a menu bar, but it may be activated programmatically or by clicking on one of its windows.
|
||||
* 'prohibited' - The application doesn’t appear in the Dock and may not create windows or be activated.
|
||||
|
||||
### `app.importCertificate(options, callback)` _Linux_
|
||||
|
||||
* `options` Object
|
||||
@@ -1047,7 +1024,7 @@ This method can only be called before app is ready.
|
||||
|
||||
By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per
|
||||
domain basis if the GPU processes crashes too frequently. This function
|
||||
disables that behavior.
|
||||
disables that behaviour.
|
||||
|
||||
This method can only be called before app is ready.
|
||||
|
||||
@@ -1111,10 +1088,14 @@ On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
|
||||
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
|
||||
for more information please read [Desktop Environment Integration][unity-requirement].
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.getBadgeCount()` _Linux_ _macOS_
|
||||
|
||||
Returns `Integer` - The current value displayed in the counter badge.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.isUnityRunning()` _Linux_
|
||||
|
||||
Returns `Boolean` - Whether the current desktop environment is Unity launcher.
|
||||
@@ -1189,6 +1170,8 @@ technologies, such as screen readers, has been detected. See
|
||||
https://www.chromium.org/developers/design-documents/accessibility for more
|
||||
details.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.setAccessibilitySupportEnabled(enabled)` _macOS_ _Windows_
|
||||
|
||||
* `enabled` Boolean - Enable or disable [accessibility tree](https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree) rendering
|
||||
@@ -1200,6 +1183,8 @@ This API must be called after the `ready` event is emitted.
|
||||
|
||||
**Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.showAboutPanel()`
|
||||
|
||||
Show the app's about panel options. These options can be overridden with `app.setAboutPanelOptions(options)`.
|
||||
@@ -1216,7 +1201,7 @@ Show the app's about panel options. These options can be overridden with `app.se
|
||||
* `website` String (optional) _Linux_ - The app's website.
|
||||
* `iconPath` String (optional) _Linux_ _Windows_ - Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
|
||||
|
||||
Set the about panel options. This will override the values defined in the app's `.plist` file on macOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.
|
||||
Set the about panel options. This will override the values defined in the app's `.plist` file on MacOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.
|
||||
|
||||
If you do not set `credits` but still wish to surface them in your app, AppKit will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in that order, in the bundle returned by the NSBundle class method main. The first file found is used, and if none is found, the info area is left blank. See Apple [documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc) for more information.
|
||||
|
||||
@@ -1329,7 +1314,7 @@ command line arguments that Chromium uses.
|
||||
|
||||
### `app.dock` _macOS_ _Readonly_
|
||||
|
||||
A [`Dock`](./dock.md) `| undefined` object that allows you to perform actions on your app icon in the user's
|
||||
A [`Dock`](./dock.md) object that allows you to perform actions on your app icon in the user's
|
||||
dock on macOS.
|
||||
|
||||
### `app.isPackaged` _Readonly_
|
||||
@@ -1373,7 +1358,7 @@ in your app's initialization to ensure that your overridden value is used.
|
||||
|
||||
A `Boolean` which when `true` disables the overrides that Electron has in place
|
||||
to ensure renderer processes are restarted on every navigation. The current
|
||||
default value for this property is `true`.
|
||||
default value for this property is `false`.
|
||||
|
||||
The intention is for these overrides to become disabled by default and then at
|
||||
some point in the future this property will be removed. This property impacts
|
||||
|
||||
61
docs/api/breaking-changes-ns.md
Normal file
61
docs/api/breaking-changes-ns.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Breaking changes (NetworkService) (Draft)
|
||||
|
||||
This document describes changes to Electron APIs after migrating network code
|
||||
to NetworkService API.
|
||||
|
||||
We don't currently have an estimate of when we will enable `NetworkService` by
|
||||
default in Electron, but as Chromium is already removing non-`NetworkService`
|
||||
code, we might switch before Electron 10.
|
||||
|
||||
The content of this document should be moved to `breaking-changes.md` once we have
|
||||
determined when to enable `NetworkService` in Electron.
|
||||
|
||||
## Planned Breaking API Changes
|
||||
|
||||
### `protocol.unregisterProtocol`
|
||||
### `protocol.uninterceptProtocol`
|
||||
|
||||
The APIs are now synchronous and the optional callback is no longer needed.
|
||||
|
||||
```javascript
|
||||
// Deprecated
|
||||
protocol.unregisterProtocol(scheme, () => { /* ... */ })
|
||||
// Replace with
|
||||
protocol.unregisterProtocol(scheme)
|
||||
```
|
||||
|
||||
### `protocol.registerFileProtocol`
|
||||
### `protocol.registerBufferProtocol`
|
||||
### `protocol.registerStringProtocol`
|
||||
### `protocol.registerHttpProtocol`
|
||||
### `protocol.registerStreamProtocol`
|
||||
### `protocol.interceptFileProtocol`
|
||||
### `protocol.interceptStringProtocol`
|
||||
### `protocol.interceptBufferProtocol`
|
||||
### `protocol.interceptHttpProtocol`
|
||||
### `protocol.interceptStreamProtocol`
|
||||
|
||||
The APIs are now synchronous and the optional callback is no longer needed.
|
||||
|
||||
```javascript
|
||||
// Deprecated
|
||||
protocol.registerFileProtocol(scheme, handler, () => { /* ... */ })
|
||||
// Replace with
|
||||
protocol.registerFileProtocol(scheme, handler)
|
||||
```
|
||||
|
||||
The registered or intercepted protocol does not have effect on current page
|
||||
until navigation happens.
|
||||
|
||||
### `protocol.isProtocolHandled`
|
||||
|
||||
This API is deprecated and users should use `protocol.isProtocolRegistered`
|
||||
and `protocol.isProtocolIntercepted` instead.
|
||||
|
||||
```javascript
|
||||
// Deprecated
|
||||
protocol.isProtocolHandled(scheme).then(() => { /* ... */ })
|
||||
// Replace with
|
||||
const isRegistered = protocol.isProtocolRegistered(scheme)
|
||||
const isIntercepted = protocol.isProtocolIntercepted(scheme)
|
||||
```
|
||||
@@ -1,216 +1,14 @@
|
||||
# Breaking Changes
|
||||
|
||||
Breaking changes will be documented here, and deprecation warnings added to JS code where possible, at least [one major version](tutorial/electron-versioning.md#semver) before the change is made.
|
||||
Breaking changes will be documented here, and deprecation warnings added to JS code where possible, at least [one major version](../tutorial/electron-versioning.md#semver) before the change is made.
|
||||
|
||||
### Types of Breaking Changes
|
||||
## `FIXME` comments
|
||||
|
||||
This document uses the following convention to categorize breaking changes:
|
||||
|
||||
- **API Changed:** An API was changed in such a way that code that has not been updated is guaranteed to throw an exception.
|
||||
- **Behavior Changed:** The behavior of Electron has changed, but not in such a way that an exception will necessarily be thrown.
|
||||
- **Default Changed:** Code depending on the old default may break, not necessarily throwing an exception. The old behavior can be restored by explicitly specifying the value.
|
||||
- **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 (12.0)
|
||||
|
||||
### Removed: `crashReporter` methods in the renderer process
|
||||
|
||||
The following `crashReporter` methods are no longer available in the renderer
|
||||
process:
|
||||
|
||||
- `crashReporter.start`
|
||||
- `crashReporter.getLastCrashReport`
|
||||
- `crashReporter.getUploadedReports`
|
||||
- `crashReporter.getUploadToServer`
|
||||
- `crashReporter.setUploadToServer`
|
||||
- `crashReporter.getCrashesDirectory`
|
||||
|
||||
They should be called only from the main process.
|
||||
|
||||
See [#23265](https://github.com/electron/electron/pull/23265) for more details.
|
||||
|
||||
## Planned Breaking API Changes (11.0)
|
||||
|
||||
## Planned Breaking API Changes (10.0)
|
||||
|
||||
### Deprecated: `companyName` argument to `crashReporter.start()`
|
||||
|
||||
The `companyName` argument to `crashReporter.start()`, which was previously
|
||||
required, is now optional, and further, is deprecated. To get the same
|
||||
behavior in a non-deprecated way, you can pass a `companyName` value in
|
||||
`globalExtra`.
|
||||
|
||||
```js
|
||||
// Deprecated in Electron 10
|
||||
crashReporter.start({ companyName: 'Umbrella Corporation' })
|
||||
// Replace with
|
||||
crashReporter.start({ globalExtra: { _companyName: 'Umbrella Corporation' } })
|
||||
```
|
||||
|
||||
### Deprecated: `crashReporter.getCrashesDirectory()`
|
||||
|
||||
The `crashReporter.getCrashesDirectory` method has been deprecated. Usage
|
||||
should be replaced by `app.getPath('crashDumps')`.
|
||||
|
||||
```js
|
||||
// Deprecated in Electron 10
|
||||
crashReporter.getCrashesDirectory()
|
||||
// Replace with
|
||||
app.getPath('crashDumps')
|
||||
```
|
||||
|
||||
### Deprecated: `crashReporter` methods in the renderer process
|
||||
|
||||
Calling the following `crashReporter` methods from the renderer process is
|
||||
deprecated:
|
||||
|
||||
- `crashReporter.start`
|
||||
- `crashReporter.getLastCrashReport`
|
||||
- `crashReporter.getUploadedReports`
|
||||
- `crashReporter.getUploadToServer`
|
||||
- `crashReporter.setUploadToServer`
|
||||
- `crashReporter.getCrashesDirectory`
|
||||
|
||||
The only non-deprecated methods remaining in the `crashReporter` module in the
|
||||
renderer are `addExtraParameter`, `removeExtraParameter` and `getParameters`.
|
||||
|
||||
All above methods remain non-deprecated when called from the main process.
|
||||
|
||||
See [#23265](https://github.com/electron/electron/pull/23265) for more details.
|
||||
|
||||
### Removed: Browser Window Affinity
|
||||
|
||||
The `affinity` option when constructing a new `BrowserWindow` will be removed
|
||||
as part of our plan to more closely align with Chromium's process model for security,
|
||||
performance and maintainability.
|
||||
|
||||
For more detailed information see [#18397](https://github.com/electron/electron/issues/18397).
|
||||
|
||||
### Default Changed: `enableRemoteModule` defaults to `false`
|
||||
|
||||
In Electron 9, using the remote module without explicitly enabling it via the
|
||||
`enableRemoteModule` WebPreferences option began emitting a warning. In
|
||||
Electron 10, the remote module is now disabled by default. To use the remote
|
||||
module, `enableRemoteModule: true` must be specified in WebPreferences:
|
||||
|
||||
```js
|
||||
const w = new BrowserWindow({
|
||||
webPreferences: {
|
||||
enableRemoteModule: true
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
We [recommend moving away from the remote
|
||||
module](https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31).
|
||||
|
||||
### `protocol.unregisterProtocol`
|
||||
### `protocol.uninterceptProtocol`
|
||||
|
||||
The APIs are now synchronous and the optional callback is no longer needed.
|
||||
|
||||
```javascript
|
||||
// Deprecated
|
||||
protocol.unregisterProtocol(scheme, () => { /* ... */ })
|
||||
// Replace with
|
||||
protocol.unregisterProtocol(scheme)
|
||||
```
|
||||
|
||||
### `protocol.registerFileProtocol`
|
||||
### `protocol.registerBufferProtocol`
|
||||
### `protocol.registerStringProtocol`
|
||||
### `protocol.registerHttpProtocol`
|
||||
### `protocol.registerStreamProtocol`
|
||||
### `protocol.interceptFileProtocol`
|
||||
### `protocol.interceptStringProtocol`
|
||||
### `protocol.interceptBufferProtocol`
|
||||
### `protocol.interceptHttpProtocol`
|
||||
### `protocol.interceptStreamProtocol`
|
||||
|
||||
The APIs are now synchronous and the optional callback is no longer needed.
|
||||
|
||||
```javascript
|
||||
// Deprecated
|
||||
protocol.registerFileProtocol(scheme, handler, () => { /* ... */ })
|
||||
// Replace with
|
||||
protocol.registerFileProtocol(scheme, handler)
|
||||
```
|
||||
|
||||
The registered or intercepted protocol does not have effect on current page
|
||||
until navigation happens.
|
||||
|
||||
### `protocol.isProtocolHandled`
|
||||
|
||||
This API is deprecated and users should use `protocol.isProtocolRegistered`
|
||||
and `protocol.isProtocolIntercepted` instead.
|
||||
|
||||
```javascript
|
||||
// Deprecated
|
||||
protocol.isProtocolHandled(scheme).then(() => { /* ... */ })
|
||||
// Replace with
|
||||
const isRegistered = protocol.isProtocolRegistered(scheme)
|
||||
const isIntercepted = protocol.isProtocolIntercepted(scheme)
|
||||
```
|
||||
|
||||
## Planned Breaking API Changes (9.0)
|
||||
|
||||
### Default Changed: Loading non-context-aware native modules in the renderer process is disabled by default
|
||||
|
||||
As of Electron 9 we do not allow loading of non-context-aware native modules in
|
||||
the renderer process. This is to improve security, performance and maintainability
|
||||
of Electron as a project.
|
||||
|
||||
If this impacts you, you can temporarily set `app.allowRendererProcessReuse` to `false`
|
||||
to revert to the old behavior. This flag will only be an option until Electron 11 so
|
||||
you should plan to update your native modules to be context aware.
|
||||
|
||||
For more detailed information see [#18397](https://github.com/electron/electron/issues/18397).
|
||||
|
||||
### Removed: `<webview>.getWebContents()`
|
||||
|
||||
This API, which was deprecated in Electron 8.0, is now removed.
|
||||
|
||||
```js
|
||||
// Removed in Electron 9.0
|
||||
webview.getWebContents()
|
||||
// Replace with
|
||||
const { remote } = require('electron')
|
||||
remote.webContents.fromId(webview.getWebContentsId())
|
||||
```
|
||||
|
||||
### Removed: `webFrame.setLayoutZoomLevelLimits()`
|
||||
|
||||
Chromium has removed support for changing the layout zoom level limits, and it
|
||||
is beyond Electron's capacity to maintain it. The function was deprecated in
|
||||
Electron 8.x, and has been removed in Electron 9.x. The layout zoom level limits
|
||||
are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined
|
||||
[here](https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11).
|
||||
|
||||
### Behavior Changed: Sending non-JS objects over IPC now throws an exception
|
||||
|
||||
In Electron 8.0, IPC was changed to use the Structured Clone Algorithm,
|
||||
bringing significant performance improvements. To help ease the transition, the
|
||||
old IPC serialization algorithm was kept and used for some objects that aren't
|
||||
serializable with Structured Clone. In particular, DOM objects (e.g. `Element`,
|
||||
`Location` and `DOMMatrix`), Node.js objects backed by C++ classes (e.g.
|
||||
`process.env`, some members of `Stream`), and Electron objects backed by C++
|
||||
classes (e.g. `WebContents`, `BrowserWindow` and `WebFrame`) are not
|
||||
serializable with Structured Clone. Whenever the old algorithm was invoked, a
|
||||
deprecation warning was printed.
|
||||
|
||||
In Electron 9.0, the old serialization algorithm has been removed, and sending
|
||||
such non-serializable objects will now throw an "object could not be cloned"
|
||||
error.
|
||||
|
||||
### API Changed: `shell.openItem` is now `shell.openPath`
|
||||
|
||||
The `shell.openItem` API has been replaced with an asynchronous `shell.openPath` API.
|
||||
You can see the original API proposal and reasoning [here](https://github.com/electron/governance/blob/master/wg-api/spec-documents/shell-openitem.md).
|
||||
The `FIXME` string is used in code comments to denote things that should be fixed for future releases. See https://github.com/electron/electron/search?q=fixme
|
||||
|
||||
## Planned Breaking API Changes (8.0)
|
||||
|
||||
### Behavior Changed: Values sent over IPC are now serialized with Structured Clone Algorithm
|
||||
### Values sent over IPC are now serialized with Structured Clone Algorithm
|
||||
|
||||
The algorithm used to serialize objects sent over IPC (through
|
||||
`ipcRenderer.send`, `ipcRenderer.sendSync`, `WebContents.send` and related
|
||||
@@ -261,7 +59,7 @@ these kinds of objects will throw a 'could not be cloned' error.
|
||||
|
||||
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||
|
||||
### Deprecated: `<webview>.getWebContents()`
|
||||
### `<webview>.getWebContents()`
|
||||
|
||||
This API is implemented using the `remote` module, which has both performance
|
||||
and security implications. Therefore its usage should be explicit.
|
||||
@@ -280,7 +78,7 @@ However, it is recommended to avoid using the `remote` module altogether.
|
||||
// main
|
||||
const { ipcMain, webContents } = require('electron')
|
||||
|
||||
const getGuestForWebContents = (webContentsId, contents) => {
|
||||
const getGuestForWebContents = function (webContentsId, contents) {
|
||||
const guest = webContents.fromId(webContentsId)
|
||||
if (!guest) {
|
||||
throw new Error(`Invalid webContentsId: ${webContentsId}`)
|
||||
@@ -302,7 +100,7 @@ const { ipcRenderer } = require('electron')
|
||||
ipcRenderer.invoke('openDevTools', webview.getWebContentsId())
|
||||
```
|
||||
|
||||
### Deprecated: `webFrame.setLayoutZoomLevelLimits()`
|
||||
### `webFrame.setLayoutZoomLevelLimits()`
|
||||
|
||||
Chromium has removed support for changing the layout zoom level limits, and it
|
||||
is beyond Electron's capacity to maintain it. The function will emit a warning
|
||||
@@ -312,7 +110,7 @@ limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined
|
||||
|
||||
## Planned Breaking API Changes (7.0)
|
||||
|
||||
### Deprecated: Atom.io Node Headers URL
|
||||
### Node Headers URL
|
||||
|
||||
This is the URL specified as `disturl` in a `.npmrc` file or as the `--dist-url`
|
||||
command line flag when building native Node modules. Both will be supported for
|
||||
@@ -322,7 +120,7 @@ Deprecated: https://atom.io/download/electron
|
||||
|
||||
Replace with: https://electronjs.org/headers
|
||||
|
||||
### API Changed: `session.clearAuthCache()` no longer accepts options
|
||||
### `session.clearAuthCache(options)`
|
||||
|
||||
The `session.clearAuthCache` API no longer accepts options for what to clear, and instead unconditionally clears the whole cache.
|
||||
|
||||
@@ -333,25 +131,25 @@ session.clearAuthCache({ type: 'password' })
|
||||
session.clearAuthCache()
|
||||
```
|
||||
|
||||
### API Changed: `powerMonitor.querySystemIdleState` is now `powerMonitor.getSystemIdleState`
|
||||
### `powerMonitor.querySystemIdleState`
|
||||
|
||||
```js
|
||||
// Removed in Electron 7.0
|
||||
powerMonitor.querySystemIdleState(threshold, callback)
|
||||
// Replace with synchronous API
|
||||
const idleState = powerMonitor.getSystemIdleState(threshold)
|
||||
const idleState = getSystemIdleState(threshold)
|
||||
```
|
||||
|
||||
### API Changed: `powerMonitor.querySystemIdleTime` is now `powerMonitor.getSystemIdleState`
|
||||
### `powerMonitor.querySystemIdleTime`
|
||||
|
||||
```js
|
||||
// Removed in Electron 7.0
|
||||
powerMonitor.querySystemIdleTime(callback)
|
||||
// Replace with synchronous API
|
||||
const idleTime = powerMonitor.getSystemIdleTime()
|
||||
const idleTime = getSystemIdleTime()
|
||||
```
|
||||
|
||||
### API Changed: `webFrame.setIsolatedWorldInfo` replaces separate methods
|
||||
### webFrame Isolated World APIs
|
||||
|
||||
```js
|
||||
// Removed in Electron 7.0
|
||||
@@ -368,20 +166,20 @@ webFrame.setIsolatedWorldInfo(
|
||||
})
|
||||
```
|
||||
|
||||
### Removed: `marked` property on `getBlinkMemoryInfo`
|
||||
### Removal of deprecated `marked` property on getBlinkMemoryInfo
|
||||
|
||||
This property was removed in Chromium 77, and as such is no longer available.
|
||||
|
||||
### Behavior Changed: `webkitdirectory` attribute for `<input type="file"/>` now lists directory contents
|
||||
|
||||
### `webkitdirectory` attribute for `<input type="file"/>`
|
||||

|
||||
The `webkitdirectory` property on HTML file inputs allows them to select folders.
|
||||
Previous versions of Electron had an incorrect implementation where the `event.target.files`
|
||||
of the input returned a `FileList` that returned one `File` corresponding to the selected folder.
|
||||
|
||||

|
||||
As of Electron 7, that `FileList` is now list of all files contained within
|
||||
the folder, similarly to Chrome, Firefox, and Edge
|
||||
([link to MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory)).
|
||||
|
||||

|
||||
As an illustration, take a folder with this structure:
|
||||
```console
|
||||
folder
|
||||
@@ -389,26 +187,26 @@ folder
|
||||
├── file2
|
||||
└── file3
|
||||
```
|
||||
|
||||

|
||||
In Electron <=6, this would return a `FileList` with a `File` object for:
|
||||
```console
|
||||
path/to/folder
|
||||
```
|
||||
|
||||

|
||||
In Electron 7, this now returns a `FileList` with a `File` object for:
|
||||
```console
|
||||
/path/to/folder/file3
|
||||
/path/to/folder/file2
|
||||
/path/to/folder/file1
|
||||
```
|
||||
|
||||

|
||||
Note that `webkitdirectory` no longer exposes the path to the selected folder.
|
||||
If you require the path to the selected folder rather than the folder contents,
|
||||
see the `dialog.showOpenDialog` API ([link](https://github.com/electron/electron/blob/master/docs/api/dialog.md#dialogshowopendialogbrowserwindow-options)).
|
||||
|
||||
## Planned Breaking API Changes (6.0)
|
||||
|
||||
### API Changed: `win.setMenu(null)` is now `win.removeMenu()`
|
||||
### `win.setMenu(null)`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
@@ -417,7 +215,7 @@ win.setMenu(null)
|
||||
win.removeMenu()
|
||||
```
|
||||
|
||||
### API Changed: `contentTracing.getTraceBufferUsage()` is now a promise
|
||||
### `contentTracing.getTraceBufferUsage()`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
@@ -430,7 +228,7 @@ contentTracing.getTraceBufferUsage().then(infoObject => {
|
||||
})
|
||||
```
|
||||
|
||||
### API Changed: `electron.screen` in the renderer process should be accessed via `remote`
|
||||
### `electron.screen` in renderer process
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
@@ -439,7 +237,7 @@ require('electron').screen
|
||||
require('electron').remote.screen
|
||||
```
|
||||
|
||||
### API Changed: `require()`ing node builtins in sandboxed renderers no longer implicitly loads the `remote` version
|
||||
### `require` in sandboxed renderers
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
@@ -463,25 +261,25 @@ require('path')
|
||||
require('electron').remote.require('path')
|
||||
```
|
||||
|
||||
### Deprecated: `powerMonitor.querySystemIdleState` replaced with `powerMonitor.getSystemIdleState`
|
||||
### `powerMonitor.querySystemIdleState`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
powerMonitor.querySystemIdleState(threshold, callback)
|
||||
// Replace with synchronous API
|
||||
const idleState = powerMonitor.getSystemIdleState(threshold)
|
||||
const idleState = getSystemIdleState(threshold)
|
||||
```
|
||||
|
||||
### Deprecated: `powerMonitor.querySystemIdleTime` replaced with `powerMonitor.getSystemIdleTime`
|
||||
### `powerMonitor.querySystemIdleTime`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
powerMonitor.querySystemIdleTime(callback)
|
||||
// Replace with synchronous API
|
||||
const idleTime = powerMonitor.getSystemIdleTime()
|
||||
const idleTime = getSystemIdleTime()
|
||||
```
|
||||
|
||||
### Deprecated: `app.enableMixedSandbox()` is no longer needed
|
||||
### `app.enableMixedSandbox`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
@@ -490,7 +288,7 @@ app.enableMixedSandbox()
|
||||
|
||||
Mixed-sandbox mode is now enabled by default.
|
||||
|
||||
### Deprecated: `Tray.setHighlightMode`
|
||||
### `Tray`
|
||||
|
||||
Under macOS Catalina our former Tray implementation breaks.
|
||||
Apple's native substitute doesn't support changing the highlighting behavior.
|
||||
@@ -503,7 +301,7 @@ tray.setHighlightMode(mode)
|
||||
|
||||
## Planned Breaking API Changes (5.0)
|
||||
|
||||
### Default Changed: `nodeIntegration` and `webviewTag` default to false, `contextIsolation` defaults to true
|
||||
### `new BrowserWindow({ webPreferences })`
|
||||
|
||||
The following `webPreferences` option default values are deprecated in favor of the new defaults listed below.
|
||||
|
||||
@@ -523,16 +321,16 @@ const w = new BrowserWindow({
|
||||
})
|
||||
```
|
||||
|
||||
### Behavior Changed: `nodeIntegration` in child windows opened via `nativeWindowOpen`
|
||||
### `nativeWindowOpen`
|
||||
|
||||
Child windows opened with the `nativeWindowOpen` option will always have Node.js integration disabled, unless `nodeIntegrationInSubFrames` is `true`.
|
||||
Child windows opened with the `nativeWindowOpen` option will always have Node.js integration disabled, unless `nodeIntegrationInSubFrames` is `true.
|
||||
|
||||
### API Changed: Registering privileged schemes must now be done before app ready
|
||||
### Privileged Schemes Registration
|
||||
|
||||
Renderer process APIs `webFrame.registerURLSchemeAsPrivileged` and `webFrame.registerURLSchemeAsBypassingCSP` as well as browser process API `protocol.registerStandardSchemes` have been removed.
|
||||
Renderer process APIs `webFrame.setRegisterURLSchemeAsPrivileged` and `webFrame.registerURLSchemeAsBypassingCSP` as well as browser process API `protocol.registerStandardSchemes` have been removed.
|
||||
A new API, `protocol.registerSchemesAsPrivileged` has been added and should be used for registering custom schemes with the required privileges. Custom schemes are required to be registered before app ready.
|
||||
|
||||
### Deprecated: `webFrame.setIsolatedWorld*` replaced with `webFrame.setIsolatedWorldInfo`
|
||||
### webFrame Isolated World APIs
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
@@ -549,7 +347,7 @@ webFrame.setIsolatedWorldInfo(
|
||||
})
|
||||
```
|
||||
|
||||
### API Changed: `webFrame.setSpellCheckProvider` now takes an asynchronous callback
|
||||
## `webFrame.setSpellCheckProvider`
|
||||
The `spellCheck` callback is now asynchronous, and `autoCorrectWord` parameter has been removed.
|
||||
```js
|
||||
// Deprecated
|
||||
@@ -15,9 +15,12 @@ relative to its owning window. It is meant to be an alternative to the
|
||||
// In the main process.
|
||||
const { BrowserView, BrowserWindow } = require('electron')
|
||||
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
let win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.on('closed', () => {
|
||||
win = null
|
||||
})
|
||||
|
||||
const view = new BrowserView()
|
||||
let view = new BrowserView()
|
||||
win.setBrowserView(view)
|
||||
view.setBounds({ x: 0, y: 0, width: 300, height: 300 })
|
||||
view.webContents.loadURL('https://electronjs.org')
|
||||
|
||||
@@ -11,7 +11,10 @@ const { BrowserWindow } = require('electron')
|
||||
// Or use `remote` from the renderer process.
|
||||
// const { BrowserWindow } = require('electron').remote
|
||||
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
let win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.on('closed', () => {
|
||||
win = null
|
||||
})
|
||||
|
||||
// Load a remote URL
|
||||
win.loadURL('https://github.com')
|
||||
@@ -177,7 +180,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
* `simpleFullscreen` Boolean (optional) - Use pre-Lion fullscreen on macOS. Default is `false`.
|
||||
* `skipTaskbar` Boolean (optional) - Whether to show the window in taskbar. Default is
|
||||
`false`.
|
||||
* `kiosk` Boolean (optional) - Whether the window is in kiosk mode. Default is `false`.
|
||||
* `kiosk` Boolean (optional) - The 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
|
||||
recommended to use `ICO` icons to get best visual effects, you can also
|
||||
@@ -207,7 +210,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
* `opacity` Number (optional) - Set the initial opacity of the window, between 0.0 (fully
|
||||
transparent) and 1.0 (fully opaque). This is only implemented on Windows and macOS.
|
||||
* `darkTheme` Boolean (optional) - Forces using dark theme for the window, only works on
|
||||
some GTK desktop environments. Default is `false`.
|
||||
some GTK+3 desktop environments. Default is `false`.
|
||||
* `transparent` Boolean (optional) - Makes the window [transparent](frameless-window.md#transparent-window).
|
||||
Default is `false`. On Windows, does not work unless the window is frameless.
|
||||
* `type` String (optional) - The type of window, default is normal window. See more about
|
||||
@@ -289,7 +292,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
between the web pages even when you specified different values for them,
|
||||
including but not limited to `preload`, `sandbox` and `nodeIntegration`.
|
||||
So it is suggested to use exact same `webPreferences` for web pages with
|
||||
the same `affinity`. _Deprecated_
|
||||
the same `affinity`. _This property is experimental_
|
||||
* `zoomFactor` Number (optional) - The default zoom factor of the page, `3.0` represents
|
||||
`300%`. Default is `1.0`.
|
||||
* `javascript` Boolean (optional) - Enables JavaScript support. Default is `true`.
|
||||
@@ -348,9 +351,6 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
You can access this context in the dev tools by selecting the
|
||||
'Electron Isolated Context' entry in the combo box at the top of the
|
||||
Console tab.
|
||||
* `worldSafeExecuteJavaScript` Boolean (optional) - If true, values returned from `webFrame.executeJavaScript` will be sanitized to ensure JS values
|
||||
can't unsafely cross between worlds when using `contextIsolation`. The default
|
||||
is `false`. In Electron 12, the default will be changed to `true`. _Deprecated_
|
||||
* `nativeWindowOpen` Boolean (optional) - Whether to use native
|
||||
`window.open()`. Defaults to `false`. Child windows will always have node
|
||||
integration disabled unless `nodeIntegrationInSubFrames` is true. **Note:** This option is currently
|
||||
@@ -387,16 +387,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
to accessibility tools such as screen readers. This string is not directly
|
||||
visible to users.
|
||||
* `spellcheck` Boolean (optional) - Whether to enable the builtin spellchecker.
|
||||
Default is `true`.
|
||||
* `enableWebSQL` Boolean (optional) - Whether to enable the [WebSQL api](https://www.w3.org/TR/webdatabase/).
|
||||
Default is `true`.
|
||||
* `v8CacheOptions` String (optional) - Enforces the v8 code caching policy
|
||||
used by blink. Accepted values are
|
||||
* `none` - Disables code caching
|
||||
* `code` - Heuristic based code caching
|
||||
* `bypassHeatCheck` - Bypass code caching heuristics but with lazy compilation
|
||||
* `bypassHeatCheckAndEagerCompile` - Same as above except compilation is eager.
|
||||
Default policy is `code`.
|
||||
Default is `false`.
|
||||
|
||||
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
|
||||
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
|
||||
@@ -697,7 +688,7 @@ Returns `BrowserWindow | null` - The window that owns the given `browserView`. I
|
||||
|
||||
Returns `BrowserWindow` - The window with the given `id`.
|
||||
|
||||
#### `BrowserWindow.addExtension(path)` _Deprecated_
|
||||
#### `BrowserWindow.addExtension(path)`
|
||||
|
||||
* `path` String
|
||||
|
||||
@@ -708,10 +699,7 @@ The method will also not return if the extension's manifest is missing or incomp
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.loadExtension(path)`](session.md#sesloadextensionpath).
|
||||
|
||||
#### `BrowserWindow.removeExtension(name)` _Deprecated_
|
||||
#### `BrowserWindow.removeExtension(name)`
|
||||
|
||||
* `name` String
|
||||
|
||||
@@ -720,10 +708,7 @@ Remove a Chrome extension by name.
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.removeExtension(extension_id)`](session.md#sesremoveextensionextensionid).
|
||||
|
||||
#### `BrowserWindow.getExtensions()` _Deprecated_
|
||||
#### `BrowserWindow.getExtensions()`
|
||||
|
||||
Returns `Record<String, ExtensionInfo>` - The keys are the extension names and each value is
|
||||
an Object containing `name` and `version` properties.
|
||||
@@ -731,10 +716,7 @@ an Object containing `name` and `version` properties.
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.getAllExtensions()`](session.md#sesgetallextensions).
|
||||
|
||||
#### `BrowserWindow.addDevToolsExtension(path)` _Deprecated_
|
||||
#### `BrowserWindow.addDevToolsExtension(path)`
|
||||
|
||||
* `path` String
|
||||
|
||||
@@ -750,10 +732,7 @@ The method will also not return if the extension's manifest is missing or incomp
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.loadExtension(path)`](session.md#sesloadextensionpath).
|
||||
|
||||
#### `BrowserWindow.removeDevToolsExtension(name)` _Deprecated_
|
||||
#### `BrowserWindow.removeDevToolsExtension(name)`
|
||||
|
||||
* `name` String
|
||||
|
||||
@@ -762,10 +741,7 @@ Remove a DevTools extension by name.
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.removeExtension(extension_id)`](session.md#sesremoveextensionextensionid).
|
||||
|
||||
#### `BrowserWindow.getDevToolsExtensions()` _Deprecated_
|
||||
#### `BrowserWindow.getDevToolsExtensions()`
|
||||
|
||||
Returns `Record<string, ExtensionInfo>` - The keys are the extension names and each value is
|
||||
an Object containing `name` and `version` properties.
|
||||
@@ -782,9 +758,6 @@ console.log(installed)
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.getAllExtensions()`](session.md#sesgetallextensions).
|
||||
|
||||
### Instance Properties
|
||||
|
||||
Objects created with `new BrowserWindow` have the following properties:
|
||||
@@ -806,7 +779,7 @@ events.
|
||||
|
||||
#### `win.id` _Readonly_
|
||||
|
||||
A `Integer` property representing the unique ID of the window. Each ID is unique among all `BrowserWindow` instances of the entire Electron application.
|
||||
A `Integer` property representing the unique ID of the window.
|
||||
|
||||
#### `win.autoHideMenuBar`
|
||||
|
||||
@@ -815,51 +788,6 @@ A `Boolean` property that determines whether the window menu bar should hide its
|
||||
If the menu bar is already visible, setting this property to `true` won't
|
||||
hide it immediately.
|
||||
|
||||
#### `win.simpleFullScreen`
|
||||
|
||||
A `Boolean` property that determines whether the window is in simple (pre-Lion) fullscreen mode.
|
||||
|
||||
#### `win.fullScreen`
|
||||
|
||||
A `Boolean` property that determines whether the window is in fullscreen mode.
|
||||
|
||||
#### `win.visibleOnAllWorkspaces`
|
||||
|
||||
A `Boolean` property that determines whether the window is visible on all workspaces.
|
||||
|
||||
**Note:** Always returns false on Windows.
|
||||
|
||||
#### `win.shadow`
|
||||
|
||||
A `Boolean` property that determines whether the window has a shadow.
|
||||
|
||||
#### `win.menuBarVisible` _Windows_ _Linux_
|
||||
|
||||
A `Boolean` property that determines whether the menu bar should be visible.
|
||||
|
||||
**Note:** If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||
|
||||
#### `win.kiosk`
|
||||
|
||||
A `Boolean` property that determines whether the window is in kiosk mode.
|
||||
|
||||
#### `win.documentEdited` _macOS_
|
||||
|
||||
A `Boolean` property that specifies whether the window’s document has been edited.
|
||||
|
||||
The icon in title bar will become gray when set to `true`.
|
||||
|
||||
#### `win.representedFilename` _macOS_
|
||||
|
||||
A `String` property that determines the pathname of the file the window represents,
|
||||
and the icon of the file will show in window's title bar.
|
||||
|
||||
#### `win.title`
|
||||
|
||||
A `String` property that determines the title of the native window.
|
||||
|
||||
**Note:** The title of the web page can be different from the title of the native window.
|
||||
|
||||
#### `win.minimizable`
|
||||
|
||||
A `Boolean` property that determines whether the window can be manually minimized by user.
|
||||
@@ -1015,7 +943,7 @@ Returns `Boolean` - Whether the window is in fullscreen mode.
|
||||
|
||||
Enters or leaves simple fullscreen mode.
|
||||
|
||||
Simple fullscreen mode emulates the native fullscreen behavior found in versions of macOS prior to Lion (10.7).
|
||||
Simple fullscreen mode emulates the native fullscreen behavior found in versions of Mac OS X prior to Lion (10.7).
|
||||
|
||||
#### `win.isSimpleFullScreen()` _macOS_
|
||||
|
||||
@@ -1025,11 +953,11 @@ Returns `Boolean` - Whether the window is in simple (pre-Lion) fullscreen mode.
|
||||
|
||||
Returns `Boolean` - Whether the window is in normal state (not maximized, not minimized, not in fullscreen mode).
|
||||
|
||||
#### `win.setAspectRatio(aspectRatio[, extraSize])` _macOS_ _Linux_
|
||||
#### `win.setAspectRatio(aspectRatio[, extraSize])` _macOS_
|
||||
|
||||
* `aspectRatio` Float - The aspect ratio to maintain for some portion of the
|
||||
content view.
|
||||
* `extraSize` [Size](structures/size.md) (optional) _macOS_ - The extra size not to be included while
|
||||
* `extraSize` [Size](structures/size.md) (optional) - The extra size not to be included while
|
||||
maintaining the aspect ratio.
|
||||
|
||||
This will make a window maintain an aspect ratio. The extra size allows a
|
||||
@@ -1042,10 +970,13 @@ Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
|
||||
on the right edge and 50 pixels of controls below the player. In order to
|
||||
maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
|
||||
the player itself we would call this function with arguments of 16/9 and
|
||||
{ width: 40, height: 50 }. The second argument doesn't care where the extra width and height
|
||||
[ 40, 50 ]. The second argument doesn't care where the extra width and height
|
||||
are within the content view--only that they exist. Sum any extra width and
|
||||
height areas you have within the overall content view.
|
||||
|
||||
Calling this function with a value of `0` will remove any previously set aspect
|
||||
ratios.
|
||||
|
||||
#### `win.setBackgroundColor(backgroundColor)`
|
||||
|
||||
* `backgroundColor` String - Window's background color as a hexadecimal value,
|
||||
@@ -1095,11 +1026,6 @@ console.log(win.getBounds())
|
||||
|
||||
Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `Object`.
|
||||
|
||||
#### `win.getBackgroundColor()`
|
||||
|
||||
Returns `String` - Gets the background color of the window. See [Setting
|
||||
`backgroundColor`](#setting-backgroundcolor).
|
||||
|
||||
#### `win.setContentBounds(bounds[, animate])`
|
||||
|
||||
* `bounds` [Rectangle](structures/rectangle.md)
|
||||
@@ -1126,7 +1052,7 @@ Disable or enable the window.
|
||||
|
||||
#### `win.isEnabled()`
|
||||
|
||||
Returns `Boolean` - whether the window is enabled.
|
||||
Returns Boolean - whether the window is enabled.
|
||||
|
||||
#### `win.setSize(width, height[, animate])`
|
||||
|
||||
@@ -1178,11 +1104,15 @@ Returns `Integer[]` - Contains the window's maximum width and height.
|
||||
|
||||
* `resizable` Boolean
|
||||
|
||||
Sets whether the window can be manually resized by the user.
|
||||
Sets whether the window can be manually resized by user.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isResizable()`
|
||||
|
||||
Returns `Boolean` - Whether the window can be manually resized by the user.
|
||||
Returns `Boolean` - Whether the window can be manually resized by user.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setMovable(movable)` _macOS_ _Windows_
|
||||
|
||||
@@ -1190,29 +1120,41 @@ Returns `Boolean` - Whether the window can be manually resized by the user.
|
||||
|
||||
Sets whether the window can be moved by user. On Linux does nothing.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isMovable()` _macOS_ _Windows_
|
||||
|
||||
Returns `Boolean` - Whether the window can be moved by user.
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setMinimizable(minimizable)` _macOS_ _Windows_
|
||||
|
||||
* `minimizable` Boolean
|
||||
|
||||
Sets whether the window can be manually minimized by user. On Linux does nothing.
|
||||
Sets whether the window can be manually minimized by user. On Linux does
|
||||
nothing.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isMinimizable()` _macOS_ _Windows_
|
||||
|
||||
Returns `Boolean` - Whether the window can be manually minimized by the user.
|
||||
Returns `Boolean` - Whether the window can be manually minimized by user
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setMaximizable(maximizable)` _macOS_ _Windows_
|
||||
|
||||
* `maximizable` Boolean
|
||||
|
||||
Sets whether the window can be manually maximized by user. On Linux does nothing.
|
||||
Sets whether the window can be manually maximized by user. On Linux does
|
||||
nothing.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isMaximizable()` _macOS_ _Windows_
|
||||
|
||||
@@ -1220,15 +1162,23 @@ Returns `Boolean` - Whether the window can be manually maximized by user.
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setFullScreenable(fullscreenable)`
|
||||
|
||||
* `fullscreenable` Boolean
|
||||
|
||||
Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
|
||||
Sets whether the maximize/zoom window button toggles fullscreen mode or
|
||||
maximizes the window.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isFullScreenable()`
|
||||
|
||||
Returns `Boolean` - Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
|
||||
Returns `Boolean` - Whether the maximize/zoom window button toggles fullscreen mode or
|
||||
maximizes the window.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setClosable(closable)` _macOS_ _Windows_
|
||||
|
||||
@@ -1236,12 +1186,16 @@ Returns `Boolean` - Whether the maximize/zoom window button toggles fullscreen m
|
||||
|
||||
Sets whether the window can be manually closed by user. On Linux does nothing.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isClosable()` _macOS_ _Windows_
|
||||
|
||||
Returns `Boolean` - Whether the window can be manually closed by user.
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setAlwaysOnTop(flag[, level][, relativeLevel])`
|
||||
|
||||
* `flag` Boolean
|
||||
@@ -1339,7 +1293,7 @@ Makes the window not show in the taskbar.
|
||||
|
||||
* `flag` Boolean
|
||||
|
||||
Enters or leaves kiosk mode.
|
||||
Enters or leaves the kiosk mode.
|
||||
|
||||
#### `win.isKiosk()`
|
||||
|
||||
@@ -1653,17 +1607,23 @@ This cannot be called when `titleBarStyle` is set to `customButtonsOnHover`.
|
||||
Sets whether the window menu bar should hide itself automatically. Once set the
|
||||
menu bar will only show when users press the single `Alt` key.
|
||||
|
||||
If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't hide it immediately.
|
||||
If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
|
||||
hide it immediately.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isMenuBarAutoHide()`
|
||||
|
||||
Returns `Boolean` - Whether menu bar automatically hides itself.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setMenuBarVisibility(visible)` _Windows_ _Linux_
|
||||
|
||||
* `visible` Boolean
|
||||
|
||||
Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||
Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
|
||||
can still bring up the menu bar by pressing the single `Alt` key.
|
||||
|
||||
#### `win.isMenuBarVisible()`
|
||||
|
||||
@@ -1674,7 +1634,7 @@ Returns `Boolean` - Whether the menu bar is visible.
|
||||
* `visible` Boolean
|
||||
* `options` Object (optional)
|
||||
* `visibleOnFullScreen` Boolean (optional) _macOS_ - Sets whether
|
||||
the window should be visible above fullscreen windows
|
||||
the window should be visible above fullscreen windows _deprecated_
|
||||
|
||||
Sets whether the window should be visible on all workspaces.
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ const { app } = require('electron')
|
||||
app.commandLine.appendSwitch('remote-debugging-port', '8315')
|
||||
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
// Your code here
|
||||
})
|
||||
```
|
||||
@@ -28,10 +28,6 @@ Disables the disk cache for HTTP requests.
|
||||
|
||||
Disable HTTP/2 and SPDY/3.1 protocols.
|
||||
|
||||
### --disable-ntlm-v2
|
||||
|
||||
Disables NTLM v2 for posix platforms, no effect elsewhere.
|
||||
|
||||
## --lang
|
||||
|
||||
Set a custom locale.
|
||||
@@ -194,6 +190,7 @@ Enables caller stack logging for the following APIs (filtering events):
|
||||
- `remote.getBuiltin()` / `remote-get-global`
|
||||
- `remote.getCurrentWindow()` / `remote-get-current-window`
|
||||
- `remote.getCurrentWebContents()` / `remote-get-current-web-contents`
|
||||
- `remote.getGuestWebContents()` / `remote-get-guest-web-contents`
|
||||
|
||||
## --no-sandbox
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ module is emitted.
|
||||
```javascript
|
||||
const { app, contentTracing } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
(async () => {
|
||||
await contentTracing.startRecording({
|
||||
include_categories: ['*']
|
||||
@@ -38,9 +38,6 @@ Get a set of category groups. The category groups can change as new code paths
|
||||
are reached. See also the [list of built-in tracing
|
||||
categories](https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h).
|
||||
|
||||
> **NOTE:** Electron adds a non-default tracing category called `"electron"`.
|
||||
> This category can be used to capture Electron-specific tracing events.
|
||||
|
||||
### `contentTracing.startRecording(options)`
|
||||
|
||||
* `options` ([TraceConfig](structures/trace-config.md) | [TraceCategoriesAndOptions](structures/trace-categories-and-options.md))
|
||||
|
||||
@@ -4,13 +4,18 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
|
||||
|
||||
The following is an example of setting up Electron to automatically submit
|
||||
crash reports to a remote server:
|
||||
The following is an example of automatically submitting a crash report to a
|
||||
remote server:
|
||||
|
||||
```javascript
|
||||
const { crashReporter } = require('electron')
|
||||
|
||||
crashReporter.start({ submitURL: 'https://your-domain.com/url-to-submit' })
|
||||
crashReporter.start({
|
||||
productName: 'YourName',
|
||||
companyName: 'YourCompany',
|
||||
submitURL: 'https://your-domain.com/url-to-submit',
|
||||
uploadToServer: true
|
||||
})
|
||||
```
|
||||
|
||||
For setting up a server to accept and process crash reports, you can use
|
||||
@@ -25,19 +30,11 @@ Or use a 3rd party hosted solution:
|
||||
* [Sentry](https://docs.sentry.io/clients/electron)
|
||||
* [BugSplat](https://www.bugsplat.com/docs/platforms/electron)
|
||||
|
||||
Crash reports are stored temporarily before being uploaded in a directory
|
||||
underneath the app's user data directory (called 'Crashpad' on Windows and Mac,
|
||||
or 'Crash Reports' on Linux). You can override this directory by calling
|
||||
`app.setPath('crashDumps', '/path/to/crashes')` before starting the crash
|
||||
reporter.
|
||||
|
||||
On Windows and macOS, Electron uses
|
||||
[crashpad](https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md)
|
||||
to monitor and report crashes. On Linux, Electron uses
|
||||
[breakpad](https://chromium.googlesource.com/breakpad/breakpad/+/master/). This
|
||||
is an implementation detail driven by Chromium, and it may change in future. In
|
||||
particular, crashpad is newer and will likely eventually replace breakpad on
|
||||
all platforms.
|
||||
Crash reports are saved locally in an application-specific temp directory folder.
|
||||
For a `productName` of `YourName`, crash reports will be stored in a folder
|
||||
named `YourName Crashes` inside the temp directory. You can customize this temp
|
||||
directory location for your app by calling the `app.setPath('temp', '/my/custom/temp')`
|
||||
API before starting the crash reporter.
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -46,68 +43,40 @@ The `crashReporter` module has the following methods:
|
||||
### `crashReporter.start(options)`
|
||||
|
||||
* `options` Object
|
||||
* `companyName` String
|
||||
* `submitURL` String - URL that crash reports will be sent to as POST.
|
||||
* `productName` String (optional) - Defaults to `app.name`.
|
||||
* `companyName` String (optional) _Deprecated_ - Deprecated alias for
|
||||
`{ globalExtra: { _companyName: ... } }`.
|
||||
* `uploadToServer` Boolean (optional) - Whether crash reports should be sent
|
||||
to the server. If false, crash reports will be collected and stored in the
|
||||
crashes directory, but not uploaded. Default is `true`.
|
||||
* `ignoreSystemCrashHandler` Boolean (optional) - If true, crashes generated
|
||||
in the main process will not be forwarded to the system crash handler.
|
||||
Default is `false`.
|
||||
* `rateLimit` Boolean (optional) _macOS_ _Windows_ - If true, limit the
|
||||
number of crashes uploaded to 1/hour. Default is `false`.
|
||||
* `compress` Boolean (optional) _macOS_ _Windows_ - If true, crash reports
|
||||
will be compressed and uploaded with `Content-Encoding: gzip`. Not all
|
||||
collection servers support compressed payloads. Default is `false`.
|
||||
* `extra` Record<String, String> (optional) - Extra string key/value
|
||||
annotations that will be sent along with crash reports that are generated
|
||||
in the main process. Only string values are supported. Crashes generated in
|
||||
child processes will not contain these extra
|
||||
parameters to crash reports generated from child processes, call
|
||||
[`addExtraParameter`](#crashreporteraddextraparameterkey-value) from the
|
||||
child process.
|
||||
* `globalExtra` Record<String, String> (optional) - Extra string key/value
|
||||
annotations that will be sent along with any crash reports generated in any
|
||||
process. These annotations cannot be changed once the crash reporter has
|
||||
been started. If a key is present in both the global extra parameters and
|
||||
the process-specific extra parameters, then the global one will take
|
||||
precedence. By default, `productName` and the app version are included, as
|
||||
well as the Electron version.
|
||||
* `uploadToServer` Boolean (optional) - Whether crash reports should be sent to the server. Default is `true`.
|
||||
* `ignoreSystemCrashHandler` Boolean (optional) - Default is `false`.
|
||||
* `extra` Record<String, String> (optional) - An object you can define that will be sent along with the
|
||||
report. Only string properties are sent correctly. Nested objects are not
|
||||
supported. When using Windows, the property names and values must be fewer than 64 characters.
|
||||
* `crashesDirectory` String (optional) - Directory to store the crash reports temporarily (only used when the crash reporter is started via `process.crashReporter.start`).
|
||||
|
||||
This method must be called before using any other `crashReporter` APIs. Once
|
||||
initialized this way, the crashpad handler collects crashes from all
|
||||
subsequently created processes. The crash reporter cannot be disabled once
|
||||
started.
|
||||
You are required to call this method before using any other `crashReporter` APIs
|
||||
and in each process (main/renderer) from which you want to collect crash reports.
|
||||
You can pass different options to `crashReporter.start` when calling from different processes.
|
||||
|
||||
This method should be called as early as possible in app startup, preferably
|
||||
before `app.on('ready')`. If the crash reporter is not initialized at the time
|
||||
a renderer process is created, then that renderer process will not be monitored
|
||||
by the crash reporter.
|
||||
**Note** Child processes created via the `child_process` module will not have access to the Electron modules.
|
||||
Therefore, to collect crash reports from them, use `process.crashReporter.start` instead. Pass the same options as above
|
||||
along with an additional one called `crashesDirectory` that should point to a directory to store the crash
|
||||
reports temporarily. You can test this out by calling `process.crash()` to crash the child process.
|
||||
|
||||
**Note:** You can test out the crash reporter by generating a crash using
|
||||
`process.crash()`.
|
||||
**Note:** If you need send additional/updated `extra` parameters after your
|
||||
first call `start` you can call `addExtraParameter` on macOS or call `start`
|
||||
again with the new/updated `extra` parameters on Linux and Windows.
|
||||
|
||||
**Note:** If you need to send additional/updated `extra` parameters after your
|
||||
first call `start` you can call `addExtraParameter`.
|
||||
|
||||
**Note:** Parameters passed in `extra`, `globalExtra` or set with
|
||||
`addExtraParameter` have limits on the length of the keys and values. Key names
|
||||
must be at most 39 bytes long, and values must be no longer than 127 bytes.
|
||||
Keys with names longer than the maximum will be silently ignored. Key values
|
||||
longer than the maximum length will be truncated.
|
||||
|
||||
**Note:** Calling this method from the renderer process is deprecated.
|
||||
**Note:** On macOS and windows, Electron uses a new `crashpad` client for crash collection and reporting.
|
||||
If you want to enable crash reporting, initializing `crashpad` from the main process using `crashReporter.start` is required
|
||||
regardless of which process you want to collect crashes from. Once initialized this way, the crashpad handler collects
|
||||
crashes from all processes. You still have to call `crashReporter.start` from the renderer or child process, otherwise crashes from
|
||||
them will get reported without `companyName`, `productName` or any of the `extra` information.
|
||||
|
||||
### `crashReporter.getLastCrashReport()`
|
||||
|
||||
Returns [`CrashReport`](structures/crash-report.md) - The date and ID of the
|
||||
last crash report. Only crash reports that have been uploaded will be returned;
|
||||
even if a crash report is present on disk it will not be returned until it is
|
||||
uploaded. In the case that there are no uploaded reports, `null` is returned.
|
||||
Returns [`CrashReport`](structures/crash-report.md):
|
||||
|
||||
**Note:** Calling this method from the renderer process is deprecated.
|
||||
Returns the date and ID of the last crash report. Only crash reports that have been uploaded will be returned; even if a crash report is present on disk it will not be returned until it is uploaded. In the case that there are no uploaded reports, `null` is returned.
|
||||
|
||||
### `crashReporter.getUploadedReports()`
|
||||
|
||||
@@ -116,67 +85,43 @@ Returns [`CrashReport[]`](structures/crash-report.md):
|
||||
Returns all uploaded crash reports. Each report contains the date and uploaded
|
||||
ID.
|
||||
|
||||
**Note:** Calling this method from the renderer process is deprecated.
|
||||
|
||||
### `crashReporter.getUploadToServer()`
|
||||
|
||||
Returns `Boolean` - Whether reports should be submitted to the server. Set through
|
||||
the `start` method or `setUploadToServer`.
|
||||
|
||||
**Note:** Calling this method from the renderer process is deprecated.
|
||||
**Note:** This API can only be called from the main process.
|
||||
|
||||
### `crashReporter.setUploadToServer(uploadToServer)`
|
||||
|
||||
* `uploadToServer` Boolean - Whether reports should be submitted to the server.
|
||||
* `uploadToServer` Boolean _macOS_ - Whether reports should be submitted to the server.
|
||||
|
||||
This would normally be controlled by user preferences. This has no effect if
|
||||
called before `start` is called.
|
||||
|
||||
**Note:** Calling this method from the renderer process is deprecated.
|
||||
**Note:** This API can only be called from the main process.
|
||||
|
||||
### `crashReporter.getCrashesDirectory()` _Deprecated_
|
||||
### `crashReporter.addExtraParameter(key, value)` _macOS_ _Windows_
|
||||
|
||||
Returns `String` - The directory where crashes are temporarily stored before being uploaded.
|
||||
* `key` String - Parameter key, must be less than 64 characters long.
|
||||
* `value` String - Parameter value, must be less than 64 characters long.
|
||||
|
||||
**Note:** This method is deprecated, use `app.getPath('crashDumps')` instead.
|
||||
Set an extra parameter to be sent with the crash report. The values
|
||||
specified here will be sent in addition to any values set via the `extra` option when `start` was called. This API is only available on macOS and windows, if you need to add/update extra parameters on Linux after your first call to `start` you can call `start` again with the updated `extra` options.
|
||||
|
||||
### `crashReporter.addExtraParameter(key, value)`
|
||||
### `crashReporter.removeExtraParameter(key)` _macOS_ _Windows_
|
||||
|
||||
* `key` String - Parameter key, must be no longer than 39 bytes.
|
||||
* `value` String - Parameter value, must be no longer than 127 bytes.
|
||||
* `key` String - Parameter key, must be less than 64 characters long.
|
||||
|
||||
Set an extra parameter to be sent with the crash report. The values specified
|
||||
here will be sent in addition to any values set via the `extra` option when
|
||||
`start` was called.
|
||||
|
||||
Parameters added in this fashion (or via the `extra` parameter to
|
||||
`crashReporter.start`) are specific to the calling process. Adding extra
|
||||
parameters in the main process will not cause those parameters to be sent along
|
||||
with crashes from renderer or other child processes. Similarly, adding extra
|
||||
parameters in a renderer process will not result in those parameters being sent
|
||||
with crashes that occur in other renderer processes or in the main process.
|
||||
|
||||
**Note:** Parameters have limits on the length of the keys and values. Key
|
||||
names must be no longer than 39 bytes, and values must be no longer than 20320
|
||||
bytes. Keys with names longer than the maximum will be silently ignored. Key
|
||||
values longer than the maximum length will be truncated.
|
||||
|
||||
**Note:** On linux values that are longer than 127 bytes will be chunked into
|
||||
multiple keys, each 127 bytes in length. E.g. `addExtraParameter('foo', 'a'.repeat(130))`
|
||||
will result in two chunked keys `foo__1` and `foo__2`, the first will contain
|
||||
the first 127 bytes and the second will contain the remaining 3 bytes. On
|
||||
your crash reporting backend you should stitch together keys in this format.
|
||||
|
||||
### `crashReporter.removeExtraParameter(key)`
|
||||
|
||||
* `key` String - Parameter key, must be no longer than 39 bytes.
|
||||
|
||||
Remove a extra parameter from the current set of parameters. Future crashes
|
||||
will not include this parameter.
|
||||
Remove a extra parameter from the current set of parameters so that it will not be sent with the crash report.
|
||||
|
||||
### `crashReporter.getParameters()`
|
||||
|
||||
Returns `Record<String, String>` - The current 'extra' parameters of the crash reporter.
|
||||
See all of the current parameters being passed to the crash reporter.
|
||||
|
||||
### `crashReporter.getCrashesDirectory()`
|
||||
|
||||
Returns `String` - The directory where crashes are temporarily stored before being uploaded.
|
||||
|
||||
## Crash Report Payload
|
||||
|
||||
|
||||
@@ -52,8 +52,6 @@ Returns:
|
||||
* `method` String - Method name.
|
||||
* `params` any - Event parameters defined by the 'parameters'
|
||||
attribute in the remote debugging protocol.
|
||||
* `sessionId` String - Unique identifier of attached debugging session,
|
||||
will match the value sent from `debugger.sendCommand`.
|
||||
|
||||
Emitted whenever the debugging target issues an instrumentation event.
|
||||
|
||||
@@ -76,16 +74,11 @@ Returns `Boolean` - Whether a debugger is attached to the `webContents`.
|
||||
|
||||
Detaches the debugger from the `webContents`.
|
||||
|
||||
#### `debugger.sendCommand(method[, commandParams, sessionId])`
|
||||
#### `debugger.sendCommand(method[, commandParams])`
|
||||
|
||||
* `method` String - Method name, should be one of the methods defined by the
|
||||
[remote debugging protocol][rdp].
|
||||
* `commandParams` any (optional) - JSON object with request parameters.
|
||||
* `sessionId` String (optional) - send command to the target with associated
|
||||
debugging session id. The initial value can be obtained by sending
|
||||
[Target.attachToTarget][attachToTarget] message.
|
||||
|
||||
[attachToTarget]: https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget
|
||||
|
||||
Returns `Promise<any>` - A promise that resolves with the response defined by
|
||||
the 'returns' attribute of the command description in the remote debugging protocol
|
||||
|
||||
@@ -82,12 +82,16 @@ The API is only available in session's `will-download` callback function.
|
||||
If user doesn't set the save path via the API, Electron will use the original
|
||||
routine to determine the save path; this usually prompts a save dialog.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md): use the `savePath` property instead.**
|
||||
|
||||
#### `downloadItem.getSavePath()`
|
||||
|
||||
Returns `String` - The save path of the download item. This will be either the path
|
||||
set via `downloadItem.setSavePath(path)` or the path selected from the shown
|
||||
save dialog.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md): use the `savePath` property instead.**
|
||||
|
||||
#### `downloadItem.setSaveDialogOptions(options)`
|
||||
|
||||
* `options` SaveDialogOptions - Set the save file dialog options. This object has the same
|
||||
|
||||
@@ -53,23 +53,16 @@ Unsupported options are:
|
||||
|
||||
### `GOOGLE_API_KEY`
|
||||
|
||||
Geolocation support in Electron requires the use of Google Cloud Platform's
|
||||
geolocation webservice. To enable this feature, acquire a
|
||||
[Google API key](https://developers.google.com/maps/documentation/geolocation/get-api-key)
|
||||
and place the following code in your main process file, before opening any
|
||||
browser windows that will make geolocation requests:
|
||||
You can provide an API key for making requests to Google's geocoding webservice. To do this, place the following code in your main process
|
||||
file, before opening any browser windows that will make geocoding requests:
|
||||
|
||||
```javascript
|
||||
process.env.GOOGLE_API_KEY = 'YOUR_KEY_HERE'
|
||||
```
|
||||
|
||||
By default, a newly generated Google API key may not be allowed to make geolocation requests.
|
||||
To enable the geolocation webservice for your project, enable it through the
|
||||
[API library](https://console.cloud.google.com/apis/library).
|
||||
|
||||
N.B. You will need to add a
|
||||
[Billing Account](https://cloud.google.com/billing/docs/how-to/payment-methods#add_a_payment_method)
|
||||
to the project associated to the API key for the geolocation webservice to work.
|
||||
For instructions on how to acquire a Google API key, visit [this page](https://developers.google.com/maps/documentation/javascript/get-api-key).
|
||||
By default, a newly generated Google API key may not be allowed to make
|
||||
geocoding requests. To enable geocoding requests, visit [this page](https://developers.google.com/maps/documentation/geocoding/get-api-key).
|
||||
|
||||
### `ELECTRON_NO_ASAR`
|
||||
|
||||
@@ -133,16 +126,5 @@ the `electron` command to use the specified build of Electron instead of
|
||||
the one downloaded by `npm install`. Usage:
|
||||
|
||||
```sh
|
||||
export ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing
|
||||
export ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Debug
|
||||
```
|
||||
|
||||
## Set By Electron
|
||||
|
||||
Electron sets some variables in your environment at runtime.
|
||||
|
||||
### `ORIGINAL_XDG_CURRENT_DESKTOP`
|
||||
|
||||
This variable is set to the value of `XDG_CURRENT_DESKTOP` that your application
|
||||
originally launched with. Electron sometimes modifies the value of `XDG_CURRENT_DESKTOP`
|
||||
to affect other logic within Chromium so if you want access to the _original_ value
|
||||
you should look up this environment variable instead.
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
# Chrome Extension Support
|
||||
|
||||
Electron supports a subset of the [Chrome Extensions
|
||||
API][chrome-extensions-api-index], primarily to support DevTools extensions and
|
||||
Chromium-internal extensions, but it also happens to support some other
|
||||
extension capabilities.
|
||||
|
||||
[chrome-extensions-api-index]: https://developer.chrome.com/extensions/api_index
|
||||
|
||||
> **Note:** Electron does not support arbitrary Chrome extensions from the
|
||||
> store, and it is a **non-goal** of the Electron project to be perfectly
|
||||
> compatible with Chrome's implementation of Extensions.
|
||||
|
||||
## Loading extensions
|
||||
|
||||
Electron only supports loading unpacked extensions (i.e., `.crx` files do not
|
||||
work). Extensions are installed per-`session`. To load an extension, call
|
||||
[`ses.loadExtension`](session.md#sesloadextensionpath):
|
||||
|
||||
```js
|
||||
const { session } = require('electron')
|
||||
|
||||
session.loadExtension('path/to/unpacked/extension').then(({ id }) => {
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
Loaded extensions will not be automatically remembered across exits; if you do
|
||||
not call `loadExtension` when the app runs, the extension will not be loaded.
|
||||
|
||||
Note that loading extensions is only supported in persistent sessions.
|
||||
Attempting to load an extension into an in-memory session will throw an error.
|
||||
|
||||
See the [`session`](session.md) documentation for more information about
|
||||
loading, unloading, and querying active extensions.
|
||||
|
||||
## Supported Extensions APIs
|
||||
|
||||
We support the following extensions APIs, with some caveats. Other APIs may
|
||||
additionally be supported, but support for any APIs not listed here is
|
||||
provisional and may be removed.
|
||||
|
||||
### `chrome.devtools.inspectedWindow`
|
||||
|
||||
All features of this API are supported.
|
||||
|
||||
### `chrome.devtools.network`
|
||||
|
||||
All features of this API are supported.
|
||||
|
||||
### `chrome.devtools.panels`
|
||||
|
||||
All features of this API are supported.
|
||||
|
||||
### `chrome.extension`
|
||||
|
||||
The following properties of `chrome.extension` are supported:
|
||||
|
||||
- `chrome.extension.lastError`
|
||||
|
||||
The following methods of `chrome.extension` are supported:
|
||||
|
||||
- `chrome.extension.getURL`
|
||||
- `chrome.extension.getBackgroundPage`
|
||||
|
||||
### `chrome.runtime`
|
||||
|
||||
The following properties of `chrome.runtime` are supported:
|
||||
|
||||
- `chrome.runtime.lastError`
|
||||
- `chrome.runtime.id`
|
||||
|
||||
The following methods of `chrome.runtime` are supported:
|
||||
|
||||
- `chrome.runtime.getBackgroundPage`
|
||||
- `chrome.runtime.getManifest`
|
||||
- `chrome.runtime.getURL`
|
||||
- `chrome.runtime.connect`
|
||||
- `chrome.runtime.sendMessage`
|
||||
|
||||
The following events of `chrome.runtime` are supported:
|
||||
|
||||
- `chrome.runtime.onStartup`
|
||||
- `chrome.runtime.onInstalled`
|
||||
- `chrome.runtime.onSuspend`
|
||||
- `chrome.runtime.onSuspendCanceled`
|
||||
- `chrome.runtime.onConnect`
|
||||
- `chrome.runtime.onMessage`
|
||||
|
||||
### `chrome.storage`
|
||||
|
||||
Only `chrome.storage.local` is supported; `chrome.storage.sync` and
|
||||
`chrome.storage.managed` are not.
|
||||
|
||||
### `chrome.tabs`
|
||||
|
||||
The following methods of `chrome.tabs` are supported:
|
||||
|
||||
- `chrome.tabs.sendMessage`
|
||||
- `chrome.tabs.executeScript`
|
||||
|
||||
> **Note:** In Chrome, passing `-1` as a tab ID signifies the "currently active
|
||||
> tab". Since Electron has no such concept, passing `-1` as a tab ID is not
|
||||
> supported and will raise an error.
|
||||
|
||||
### `chrome.management`
|
||||
|
||||
The following methods of `chrome.management` are supported:
|
||||
|
||||
- `chrome.management.getAll`
|
||||
- `chrome.management.get`
|
||||
- `chrome.management.getSelf`
|
||||
- `chrome.management.getPermissionWarningsById`
|
||||
- `chrome.management.getPermissionWarningsByManifest`
|
||||
- `chrome.management.onEnabled`
|
||||
- `chrome.management.onDisabled`
|
||||
@@ -52,7 +52,7 @@ win.show()
|
||||
Uses custom drawn close, and miniaturize buttons that display
|
||||
when hovering in the top left of the window. The fullscreen button
|
||||
is not available due to restrictions of frameless windows as they
|
||||
interface with Apple's macOS window masks. These custom buttons prevent
|
||||
interface with Apple's MacOS window masks. These custom buttons prevent
|
||||
issues with mouse events that occur with the standard window toolbar buttons.
|
||||
This option is only applicable for frameless windows.
|
||||
|
||||
@@ -158,7 +158,7 @@ buttons in titlebar non-draggable.
|
||||
|
||||
## Text selection
|
||||
|
||||
In a frameless window the dragging behavior may conflict with selecting text.
|
||||
In a frameless window the dragging behaviour may conflict with selecting text.
|
||||
For example, when you drag the titlebar you may accidentally select the text on
|
||||
the titlebar. To prevent this, you need to disable text selection within a
|
||||
draggable area like this:
|
||||
|
||||
@@ -15,7 +15,7 @@ event of the app module is emitted.
|
||||
```javascript
|
||||
const { app, globalShortcut } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
// Register a 'CommandOrControl+X' shortcut listener.
|
||||
const ret = globalShortcut.register('CommandOrControl+X', () => {
|
||||
console.log('CommandOrControl+X is pressed')
|
||||
|
||||
@@ -40,17 +40,11 @@ Retrieves the product descriptions.
|
||||
|
||||
### `inAppPurchase.canMakePayments()`
|
||||
|
||||
Returns `Boolean` - whether a user can make a payment.
|
||||
|
||||
### `inAppPurchase.restoreCompletedTransactions()`
|
||||
|
||||
Restores finished transactions. This method can be called either to install purchases on additional devices, or to restore purchases for an application that the user deleted and reinstalled.
|
||||
|
||||
[The payment queue](https://developer.apple.com/documentation/storekit/skpaymentqueue?language=objc) delivers a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.
|
||||
Returns `Boolean`, whether a user can make a payment.
|
||||
|
||||
### `inAppPurchase.getReceiptURL()`
|
||||
|
||||
Returns `String` - the path to the receipt.
|
||||
Returns `String`, the path to the receipt.
|
||||
|
||||
### `inAppPurchase.finishAllTransactions()`
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ Removes all listeners, or those of the specified `channel`.
|
||||
|
||||
Send an asynchronous message to the main process via `channel`, along with
|
||||
arguments. Arguments will be serialized with the [Structured Clone
|
||||
Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will not be
|
||||
Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
|
||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||
throw an exception.
|
||||
|
||||
@@ -68,10 +68,6 @@ throw an exception.
|
||||
The main process handles it by listening for `channel` with the
|
||||
[`ipcMain`](ipc-main.md) module.
|
||||
|
||||
If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRenderer.postMessage`](#ipcrendererpostmessagechannel-message-transfer).
|
||||
|
||||
If you want to receive a single response from the main process, like the result of a method call, consider using [`ipcRenderer.invoke`](#ipcrendererinvokechannel-args).
|
||||
|
||||
### `ipcRenderer.invoke(channel, ...args)`
|
||||
|
||||
* `channel` String
|
||||
@@ -81,7 +77,7 @@ Returns `Promise<any>` - Resolves with the response from the main process.
|
||||
|
||||
Send a message to the main process via `channel` and expect a result
|
||||
asynchronously. Arguments will be serialized with the [Structured Clone
|
||||
Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will not be
|
||||
Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
|
||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||
throw an exception.
|
||||
|
||||
@@ -106,10 +102,6 @@ ipcMain.handle('some-name', async (event, someArgument) => {
|
||||
})
|
||||
```
|
||||
|
||||
If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRenderer.postMessage`](#ipcrendererpostmessagechannel-message-transfer).
|
||||
|
||||
If you do not need a respons to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
|
||||
|
||||
### `ipcRenderer.sendSync(channel, ...args)`
|
||||
|
||||
* `channel` String
|
||||
@@ -119,7 +111,7 @@ Returns `any` - The value sent back by the [`ipcMain`](ipc-main.md) handler.
|
||||
|
||||
Send a message to the main process via `channel` and expect a result
|
||||
synchronously. Arguments will be serialized with the [Structured Clone
|
||||
Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will not be
|
||||
Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
|
||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||
throw an exception.
|
||||
|
||||
@@ -135,35 +127,6 @@ and replies by setting `event.returnValue`.
|
||||
> last resort. It's much better to use the asynchronous version,
|
||||
> [`invoke()`](ipc-renderer.md#ipcrendererinvokechannel-args).
|
||||
|
||||
### `ipcRenderer.postMessage(channel, message, [transfer])`
|
||||
|
||||
* `channel` String
|
||||
* `message` any
|
||||
* `transfer` MessagePort[] (optional)
|
||||
|
||||
Send a message to the main process, optionally transferring ownership of zero
|
||||
or more [`MessagePort`][] objects.
|
||||
|
||||
The transferred `MessagePort` objects will be available in the main process as
|
||||
[`MessagePortMain`](message-port-main.md) objects by accessing the `ports`
|
||||
property of the emitted event.
|
||||
|
||||
For example:
|
||||
```js
|
||||
// Renderer process
|
||||
const { port1, port2 } = new MessageChannel()
|
||||
ipcRenderer.postMessage('port', { message: 'hello' }, [port1])
|
||||
|
||||
// Main process
|
||||
ipcMain.on('port', (e, msg) => {
|
||||
const [port] = e.ports
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
For more information on using `MessagePort` and `MessageChannel`, see the [MDN
|
||||
documentation](https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel).
|
||||
|
||||
### `ipcRenderer.sendTo(webContentsId, channel, ...args)`
|
||||
|
||||
* `webContentsId` Number
|
||||
@@ -187,5 +150,4 @@ in the [`ipc-renderer-event`](structures/ipc-renderer-event.md) structure docs.
|
||||
|
||||
[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
|
||||
[`window.postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
||||
[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort
|
||||
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
||||
|
||||
@@ -12,9 +12,9 @@ See [`Menu`](menu.md) for examples.
|
||||
* `click` Function (optional) - Will be called with
|
||||
`click(menuItem, browserWindow, event)` when the menu item is clicked.
|
||||
* `menuItem` MenuItem
|
||||
* `browserWindow` [BrowserWindow](browser-window.md) | undefined - This will not be defined if no window is open.
|
||||
* `browserWindow` [BrowserWindow](browser-window.md)
|
||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||
* `role` String (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
||||
* `role` String (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
||||
`click` property will be ignored. See [roles](#roles).
|
||||
* `type` String (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
|
||||
`radio`.
|
||||
@@ -69,7 +69,6 @@ a `type`.
|
||||
The `role` property can have following values:
|
||||
|
||||
* `undo`
|
||||
* `about` - Trigger a native about panel (custom message box on Window, which does not provide its own).
|
||||
* `redo`
|
||||
* `cut`
|
||||
* `copy`
|
||||
@@ -95,6 +94,7 @@ The `role` property can have following values:
|
||||
The following additional roles are available on _macOS_:
|
||||
|
||||
* `appMenu` - Whole default "App" menu (About, Services, etc.)
|
||||
* `about` - Map to the `orderFrontStandardAboutPanel` action.
|
||||
* `hide` - Map to the `hide` action.
|
||||
* `hideOthers` - Map to the `hideOtherApplications` action.
|
||||
* `unhide` - Map to the `unhideAllApplications` action.
|
||||
@@ -117,7 +117,7 @@ When specifying a `role` on macOS, `label` and `accelerator` are the only
|
||||
options that will affect the menu item. All other options will be ignored.
|
||||
Lowercase `role`, e.g. `toggledevtools`, is still supported.
|
||||
|
||||
**Nota Bene:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
|
||||
**Nota Bene:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on MacOS.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
@@ -130,7 +130,8 @@ dynamically changed.
|
||||
|
||||
#### `menuItem.label`
|
||||
|
||||
A `String` indicating the item's visible label.
|
||||
A `String` indicating the item's visible label, this property can be
|
||||
dynamically changed.
|
||||
|
||||
#### `menuItem.click`
|
||||
|
||||
@@ -151,7 +152,7 @@ A `String` indicating the type of the item. Can be `normal`, `separator`, `subme
|
||||
|
||||
#### `menuItem.role`
|
||||
|
||||
A `String` (optional) indicating the item's role, if set. Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
|
||||
A `String` (optional) indicating the item's role, if set. Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
|
||||
|
||||
#### `menuItem.accelerator`
|
||||
|
||||
@@ -164,7 +165,7 @@ item's icon, if set.
|
||||
|
||||
#### `menuItem.sublabel`
|
||||
|
||||
A `String` indicating the item's sublabel.
|
||||
A `String` indicating the item's sublabel, this property can be dynamically changed.
|
||||
|
||||
#### `menuItem.toolTip` _macOS_
|
||||
|
||||
@@ -196,9 +197,7 @@ You can add a `click` function for additional behavior.
|
||||
#### `menuItem.registerAccelerator`
|
||||
|
||||
A `Boolean` indicating if the accelerator should be registered with the
|
||||
system or just displayed.
|
||||
|
||||
This property can be dynamically changed.
|
||||
system or just displayed, this property can be dynamically changed.
|
||||
|
||||
#### `menuItem.commandId`
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
# MessageChannelMain
|
||||
|
||||
`MessageChannelMain` is the main-process-side equivalent of the DOM
|
||||
[`MessageChannel`][] object. Its singular function is to create a pair of
|
||||
connected [`MessagePortMain`](message-port-main.md) objects.
|
||||
|
||||
See the [Channel Messaging API][] documentation for more information on using
|
||||
channel messaging.
|
||||
|
||||
## Class: MessageChannelMain
|
||||
|
||||
Example:
|
||||
```js
|
||||
const { port1, port2 } = new MessageChannelMain()
|
||||
w.webContents.postMessage('port', null, [port2])
|
||||
port1.postMessage({ some: 'message' })
|
||||
```
|
||||
|
||||
### Instance Properties
|
||||
|
||||
#### `channel.port1`
|
||||
|
||||
A [`MessagePortMain`](message-port-main.md) property.
|
||||
|
||||
#### `channel.port2`
|
||||
|
||||
A [`MessagePortMain`](message-port-main.md) property.
|
||||
|
||||
[`MessageChannel`]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel
|
||||
[Channel Messaging API]: https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API
|
||||
@@ -1,49 +0,0 @@
|
||||
# MessagePortMain
|
||||
|
||||
`MessagePortMain` is the main-process-side equivalent of the DOM
|
||||
[`MessagePort`][] object. It behaves similarly to the DOM version, with the
|
||||
exception that it uses the Node.js `EventEmitter` event system, instead of the
|
||||
DOM `EventTarget` system. This means you should use `port.on('message', ...)`
|
||||
to listen for events, instead of `port.onmessage = ...` or
|
||||
`port.addEventListener('message', ...)`
|
||||
|
||||
See the [Channel Messaging API][] documentation for more information on using
|
||||
channel messaging.
|
||||
|
||||
`MessagePortMain` is an [EventEmitter][event-emitter].
|
||||
|
||||
## Class: MessagePortMain
|
||||
|
||||
### Instance Methods
|
||||
|
||||
#### `port.postMessage(message, [transfer])`
|
||||
|
||||
* `message` any
|
||||
* `transfer` MessagePortMain[] (optional)
|
||||
|
||||
Sends a message from the port, and optionally, transfers ownership of objects
|
||||
to other browsing contexts.
|
||||
|
||||
#### `port.start()`
|
||||
|
||||
Starts the sending of messages queued on the port. Messages will be queued
|
||||
until this method is called.
|
||||
|
||||
#### `port.close()`
|
||||
|
||||
Disconnects the port, so it is no longer active.
|
||||
|
||||
### Instance Events
|
||||
|
||||
#### Event: 'message'
|
||||
|
||||
Returns:
|
||||
|
||||
* `messageEvent` Object
|
||||
* `data` any
|
||||
* `ports` MessagePortMain[]
|
||||
|
||||
Emitted when a MessagePortMain object receives a message.
|
||||
|
||||
[`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
|
||||
@@ -1,6 +1,17 @@
|
||||
## Promisification
|
||||
|
||||
The Electron team recently underwent an initiative to convert callback-based APIs to Promise-based ones. See converted functions below:
|
||||
The Electron team is currently undergoing an initiative to convert callback-based functions in Electron to return Promises. During this transition period, both the callback and Promise-based versions of these functions will work correctly, and will both be documented.
|
||||
|
||||
To enable deprecation warnings for these updated functions, use the [`process.enablePromiseAPIs` runtime flag](../process.md#processenablepromiseapis).
|
||||
|
||||
When a majority of affected functions are migrated, this flag will be enabled by default and all developers will be able to see these deprecation warnings. At that time, the callback-based versions will also be removed from documentation. This document will be continuously updated as more functions are converted.
|
||||
|
||||
### Candidate Functions
|
||||
|
||||
- [app.importCertificate(options, callback)](https://github.com/electron/electron/blob/master/docs/api/app.md#importCertificate)
|
||||
- [contents.print([options], [callback])](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#print)
|
||||
|
||||
### Converted Functions
|
||||
|
||||
- [app.getFileIcon(path[, options], callback)](https://github.com/electron/electron/blob/master/docs/api/app.md#getFileIcon)
|
||||
- [contents.capturePage([rect, ]callback)](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#capturePage)
|
||||
|
||||
@@ -5,7 +5,14 @@ The Electron team is currently undergoing an initiative to convert separate gett
|
||||
## Candidates
|
||||
|
||||
* `BrowserWindow`
|
||||
* `fullscreen`
|
||||
* `simpleFullscreen`
|
||||
* `alwaysOnTop`
|
||||
* `title`
|
||||
* `documentEdited`
|
||||
* `hasShadow`
|
||||
* `menubarVisible`
|
||||
* `visibleOnAllWorkspaces`
|
||||
* `crashReporter` module
|
||||
* `uploadToServer`
|
||||
* `webFrame` modules
|
||||
@@ -38,3 +45,9 @@ The Electron team is currently undergoing an initiative to convert separate gett
|
||||
* `isMacTemplateImage`
|
||||
* `SystemPreferences` module
|
||||
* `appLevelAppearance`
|
||||
* `webContents` module
|
||||
* `audioMuted`
|
||||
* `frameRate`
|
||||
* `userAgent`
|
||||
* `zoomFactor`
|
||||
* `zoomLevel`
|
||||
|
||||
@@ -276,10 +276,14 @@ Returns [`Size`](structures/size.md)
|
||||
|
||||
Marks the image as a template image.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `image.isTemplateImage()`
|
||||
|
||||
Returns `Boolean` - Whether the image is a template image.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `image.crop(rect)`
|
||||
|
||||
* `rect` [Rectangle](structures/rectangle.md) - The area of the image to crop.
|
||||
|
||||
@@ -27,7 +27,7 @@ should use `themeSource` below.
|
||||
|
||||
### `nativeTheme.themeSource`
|
||||
|
||||
A `String` property that can be `system`, `light` or `dark`. It is used to override and supersede
|
||||
A `String` property that can be `system`, `light` or `dark`. It is used to override and supercede
|
||||
the value that Chromium has chosen to use internally.
|
||||
|
||||
Setting this property to `system` will remove the override and
|
||||
|
||||
@@ -7,7 +7,7 @@ Process: [Main](../glossary.md#main-process)
|
||||
```javascript
|
||||
const { netLog } = require('electron')
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
app.on('ready', async () => {
|
||||
await netLog.startLogging('/path/to/net-log')
|
||||
// After some network events
|
||||
const path = await netLog.stopLogging()
|
||||
|
||||
@@ -28,7 +28,7 @@ Example usage:
|
||||
|
||||
```javascript
|
||||
const { app } = require('electron')
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
const { net } = require('electron')
|
||||
const request = net.request('https://github.com')
|
||||
request.on('response', (response) => {
|
||||
|
||||
@@ -13,7 +13,7 @@ For example:
|
||||
```javascript
|
||||
const { app, powerMonitor } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
powerMonitor.on('suspend', () => {
|
||||
console.log('The system is going to sleep')
|
||||
})
|
||||
@@ -24,19 +24,19 @@ app.whenReady().then(() => {
|
||||
|
||||
The `powerMonitor` module emits the following events:
|
||||
|
||||
### Event: 'suspend' _macOS_ _Windows_
|
||||
### Event: 'suspend'
|
||||
|
||||
Emitted when the system is suspending.
|
||||
|
||||
### Event: 'resume' _macOS_ _Windows_
|
||||
### Event: 'resume'
|
||||
|
||||
Emitted when system is resuming.
|
||||
|
||||
### Event: 'on-ac' _macOS_ _Windows_
|
||||
### Event: 'on-ac' _Windows_
|
||||
|
||||
Emitted when the system changes to AC power.
|
||||
|
||||
### Event: 'on-battery' _macOS_ _Windows_
|
||||
### Event: 'on-battery' _Windows_
|
||||
|
||||
Emitted when system changes to battery power.
|
||||
|
||||
|
||||
@@ -82,6 +82,12 @@ A `Boolean` that controls whether or not deprecation warnings are printed to `st
|
||||
Setting this to `true` will silence deprecation warnings. This property is used
|
||||
instead of the `--no-deprecation` command line flag.
|
||||
|
||||
### `process.enablePromiseAPIs`
|
||||
|
||||
A `Boolean` that controls whether or not deprecation warnings are printed to `stderr` when
|
||||
formerly callback-based APIs converted to Promises are invoked using callbacks. Setting this to `true`
|
||||
will enable deprecation warnings.
|
||||
|
||||
### `process.resourcesPath` _Readonly_
|
||||
|
||||
A `String` representing the path to the resources directory.
|
||||
|
||||
@@ -20,7 +20,7 @@ An example of implementing a protocol that has the same effect as the
|
||||
const { app, protocol } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
protocol.registerFileProtocol('atom', (request, callback) => {
|
||||
const url = request.url.substr(7)
|
||||
callback({ path: path.normalize(`${__dirname}/${url}`) })
|
||||
@@ -47,7 +47,7 @@ to register it to that session explicitly.
|
||||
const { session, app, protocol } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
const partition = 'persist:example'
|
||||
const ses = session.fromPartition(partition)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ An example of implementing a protocol that has the same effect as the
|
||||
const { app, protocol } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
protocol.registerFileProtocol('atom', (request, callback) => {
|
||||
const url = request.url.substr(7)
|
||||
callback({ path: path.normalize(`${__dirname}/${url}`) })
|
||||
@@ -34,7 +34,7 @@ To have your custom protocol work in combination with a custom session, you need
|
||||
const { session, app, protocol } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
const partition = 'persist:example'
|
||||
const ses = session.fromPartition(partition)
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ project/
|
||||
```js
|
||||
// main process: main/index.js
|
||||
const { app } = require('electron')
|
||||
app.whenReady().then(() => { /* ... */ })
|
||||
app.on('ready', () => { /* ... */ })
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
@@ -39,7 +39,7 @@ To create a sandboxed window, pass `sandbox: true` to `webPreferences`:
|
||||
|
||||
```js
|
||||
let win
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow({
|
||||
webPreferences: {
|
||||
sandbox: true
|
||||
@@ -51,7 +51,7 @@ app.whenReady().then(() => {
|
||||
|
||||
In the above code the [`BrowserWindow`](browser-window.md) that was created has Node.js disabled and can communicate
|
||||
only via IPC. The use of this option stops Electron from creating a Node.js runtime in the renderer. Also,
|
||||
within this new window `window.open` follows the native behavior (by default Electron creates a [`BrowserWindow`](browser-window.md)
|
||||
within this new window `window.open` follows the native behaviour (by default Electron creates a [`BrowserWindow`](browser-window.md)
|
||||
and returns a proxy to this via `window.open`).
|
||||
|
||||
[`app.enableSandbox`](app.md#appenablesandbox-experimental) can be used to force `sandbox: true` for all `BrowserWindow` instances.
|
||||
@@ -59,7 +59,7 @@ and returns a proxy to this via `window.open`).
|
||||
```js
|
||||
let win
|
||||
app.enableSandbox()
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
// no need to pass `sandbox: true` since `app.enableSandbox()` was called.
|
||||
win = new BrowserWindow()
|
||||
win.loadURL('http://google.com')
|
||||
@@ -73,7 +73,7 @@ Here's an example:
|
||||
|
||||
```js
|
||||
let win
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow({
|
||||
webPreferences: {
|
||||
sandbox: true,
|
||||
|
||||
@@ -18,7 +18,7 @@ An example of creating a window that fills the whole screen:
|
||||
const { app, BrowserWindow, screen } = require('electron')
|
||||
|
||||
let win
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
const { width, height } = screen.getPrimaryDisplay().workAreaSize
|
||||
win = new BrowserWindow({ width, height })
|
||||
win.loadURL('https://github.com')
|
||||
@@ -32,7 +32,7 @@ const { app, BrowserWindow, screen } = require('electron')
|
||||
|
||||
let win
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
let displays = screen.getAllDisplays()
|
||||
let externalDisplay = displays.find((display) => {
|
||||
return display.bounds.x !== 0 || display.bounds.y !== 0
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
## Class: ServiceWorkers
|
||||
|
||||
> Query and receive events from a sessions active service workers.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
Instances of the `ServiceWorkers` class are accessed by using `serviceWorkers` property of
|
||||
a `Session`.
|
||||
|
||||
For example:
|
||||
|
||||
```javascript
|
||||
const { session } = require('electron')
|
||||
|
||||
// Get all service workers.
|
||||
console.log(session.defaultSession.serviceWorkers.getAllRunning())
|
||||
|
||||
// Handle logs and get service worker info
|
||||
session.defaultSession.serviceWorkers.on('console-message', (event, messageDetails) => {
|
||||
console.log(
|
||||
'Got service worker message',
|
||||
messageDetails,
|
||||
'from',
|
||||
session.defaultSession.serviceWorkers.getFromVersionID(messageDetails.versionId)
|
||||
)
|
||||
})
|
||||
```
|
||||
|
||||
### Instance Events
|
||||
|
||||
The following events are available on instances of `ServiceWorkers`:
|
||||
|
||||
#### Event: 'console-message'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `messageDetails` Object - Information about the console message
|
||||
* `message` String - The actual console message
|
||||
* `versionId` Number - The version ID of the service worker that sent the log message
|
||||
* `source` String - The type of source for this message. Can be `javascript`, `xml`, `network`, `console-api`, `storage`, `app-cache`, `rendering`, `security`, `deprecation`, `worker`, `violation`, `intervention`, `recommendation` or `other`.
|
||||
* `level` Number - The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and `error`.
|
||||
* `sourceUrl` String - The URL the message came from
|
||||
* `lineNumber` Number - The line number of the source that triggered this console message
|
||||
|
||||
Emitted when a service worker logs something to the console.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
The following methods are available on instances of `ServiceWorkers`:
|
||||
|
||||
#### `serviceWorkers.getAllRunning()`
|
||||
|
||||
Returns `Record<Number, ServiceWorkerInfo>` - A [ServiceWorkerInfo](structures/service-worker-info.md) object where the keys are the service worker version ID and the values are the information about that service worker.
|
||||
|
||||
#### `serviceWorkers.getFromVersionID(versionId)`
|
||||
|
||||
* `versionId` Number
|
||||
|
||||
Returns [`ServiceWorkerInfo`](structures/service-worker-info.md) - Information about this service worker
|
||||
|
||||
If the service worker does not exist or is not running this method will throw an exception.
|
||||
@@ -165,10 +165,9 @@ Clears the session’s HTTP cache.
|
||||
`scheme://host:port`.
|
||||
* `storages` String[] (optional) - The types of storages to clear, can contain:
|
||||
`appcache`, `cookies`, `filesystem`, `indexdb`, `localstorage`,
|
||||
`shadercache`, `websql`, `serviceworkers`, `cachestorage`. If not
|
||||
specified, clear all storage types.
|
||||
`shadercache`, `websql`, `serviceworkers`, `cachestorage`.
|
||||
* `quotas` String[] (optional) - The types of quotas to clear, can contain:
|
||||
`temporary`, `persistent`, `syncable`. If not specified, clear all quotas.
|
||||
`temporary`, `persistent`, `syncable`.
|
||||
|
||||
Returns `Promise<void>` - resolves when the storage data has been cleared.
|
||||
|
||||
@@ -311,7 +310,6 @@ the original network configuration.
|
||||
* `request` Object
|
||||
* `hostname` String
|
||||
* `certificate` [Certificate](structures/certificate.md)
|
||||
* `validatedCertificate` [Certificate](structures/certificate.md)
|
||||
* `verificationResult` String - Verification result from chromium.
|
||||
* `errorCode` Integer - Error code.
|
||||
* `callback` Function
|
||||
@@ -531,88 +529,14 @@ note the trailing slash. The URL to the dictionaries is formed as `${url}${file
|
||||
|
||||
**Note:** On macOS the OS spellchecker is used and therefore we do not download any dictionary files. This API is a no-op on macOS.
|
||||
|
||||
#### `ses.listWordsInSpellCheckerDictionary()`
|
||||
|
||||
Returns `Promise<String[]>` - An array of all words in app's custom dictionary.
|
||||
Resolves when the full dictionary is loaded from disk.
|
||||
|
||||
#### `ses.addWordToSpellCheckerDictionary(word)`
|
||||
|
||||
* `word` String - The word you want to add to the dictionary
|
||||
|
||||
Returns `Boolean` - Whether the word was successfully written to the custom dictionary. This API
|
||||
will not work on non-persistent (in-memory) sessions.
|
||||
Returns `Boolean` - Whether the word was successfully written to the custom dictionary.
|
||||
|
||||
**Note:** On macOS and Windows 10 this word will be written to the OS custom dictionary as well
|
||||
|
||||
#### `ses.removeWordFromSpellCheckerDictionary(word)`
|
||||
|
||||
* `word` String - The word you want to remove from the dictionary
|
||||
|
||||
Returns `Boolean` - Whether the word was successfully removed from the custom dictionary. This API
|
||||
will not work on non-persistent (in-memory) sessions.
|
||||
|
||||
**Note:** On macOS and Windows 10 this word will be removed from the OS custom dictionary as well
|
||||
|
||||
#### `ses.loadExtension(path)`
|
||||
|
||||
* `path` String - Path to a directory containing an unpacked Chrome extension
|
||||
|
||||
Returns `Promise<Extension>` - resolves when the extension is loaded.
|
||||
|
||||
This method will raise an exception if the extension could not be loaded. If
|
||||
there are warnings when installing the extension (e.g. if the extension
|
||||
requests an API that Electron does not support) then they will be logged to the
|
||||
console.
|
||||
|
||||
Note that Electron does not support the full range of Chrome extensions APIs.
|
||||
|
||||
Note that in previous versions of Electron, extensions that were loaded would
|
||||
be remembered for future runs of the application. This is no longer the case:
|
||||
`loadExtension` must be called on every boot of your app if you want the
|
||||
extension to be loaded.
|
||||
|
||||
```js
|
||||
const { app, session } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.on('ready', async () => {
|
||||
await session.defaultSession.loadExtension(path.join(__dirname, 'react-devtools'))
|
||||
// Note that in order to use the React DevTools extension, you'll need to
|
||||
// download and unzip a copy of the extension.
|
||||
})
|
||||
```
|
||||
|
||||
This API does not support loading packed (.crx) extensions.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
#### `ses.removeExtension(extensionId)`
|
||||
|
||||
* `extensionId` String - ID of extension to remove
|
||||
|
||||
Unloads an extension.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
#### `ses.getExtension(extensionId)`
|
||||
|
||||
* `extensionId` String - ID of extension to query
|
||||
|
||||
Returns `Extension` | `null` - The loaded extension with the given ID.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
#### `ses.getAllExtensions()`
|
||||
|
||||
Returns `Extension[]` - A list of all loaded extensions.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
The following properties are available on instances of `Session`:
|
||||
@@ -626,10 +550,6 @@ code to the `setSpellCheckerLanaguages` API that isn't in this array will result
|
||||
|
||||
A [`Cookies`](cookies.md) object for this session.
|
||||
|
||||
#### `ses.serviceWorkers` _Readonly_
|
||||
|
||||
A [`ServiceWorkers`](service-workers.md) object for this session.
|
||||
|
||||
#### `ses.webRequest` _Readonly_
|
||||
|
||||
A [`WebRequest`](web-request.md) object for this session.
|
||||
@@ -642,12 +562,12 @@ A [`Protocol`](protocol.md) object for this session.
|
||||
const { app, session } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', function () {
|
||||
const protocol = session.fromPartition('some-partition').protocol
|
||||
protocol.registerFileProtocol('atom', (request, callback) => {
|
||||
let url = request.url.substr(7)
|
||||
protocol.registerFileProtocol('atom', function (request, callback) {
|
||||
var url = request.url.substr(7)
|
||||
callback({ path: path.normalize(`${__dirname}/${url}`) })
|
||||
}, (error) => {
|
||||
}, function (error) {
|
||||
if (error) console.error('Failed to register protocol')
|
||||
})
|
||||
})
|
||||
@@ -660,7 +580,7 @@ A [`NetLog`](net-log.md) object for this session.
|
||||
```javascript
|
||||
const { app, session } = require('electron')
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
app.on('ready', async function () {
|
||||
const netLog = session.fromPartition('some-partition').netLog
|
||||
netLog.startLogging('/path/to/net-log')
|
||||
// After some network events
|
||||
|
||||
@@ -24,11 +24,11 @@ The `shell` module has the following methods:
|
||||
|
||||
Show the given file in a file manager. If possible, select the file.
|
||||
|
||||
### `shell.openPath(path)`
|
||||
### `shell.openItem(fullPath)`
|
||||
|
||||
* `path` String
|
||||
* `fullPath` String
|
||||
|
||||
Returns `Promise<String>` - Resolves with an string containing the error message corresponding to the failure if a failure occurred, otherwise "".
|
||||
Returns `Boolean` - Whether the item was successfully opened.
|
||||
|
||||
Open the given file in the desktop's default manner.
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# Extension Object
|
||||
|
||||
* `id` String
|
||||
* `manifest` any - Copy of the [extension's manifest data](https://developer.chrome.com/extensions/manifest).
|
||||
* `name` String
|
||||
* `path` String - The extension's file path.
|
||||
* `version` String
|
||||
* `url` String - The extension's `chrome-extension://` URL.
|
||||
@@ -3,7 +3,5 @@
|
||||
* `frameId` Integer - The ID of the renderer frame that sent this message
|
||||
* `returnValue` any - Set this to the value to be returned in a synchronous message
|
||||
* `sender` WebContents - Returns the `webContents` that sent the message
|
||||
* `ports` MessagePortMain[] - A list of MessagePorts that were transferred with this message
|
||||
* `reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame.
|
||||
* `channel` String
|
||||
* `...args` any[]
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
|
||||
* `sender` IpcRenderer - The `IpcRenderer` instance that emitted the event originally
|
||||
* `senderId` Integer - The `webContents.id` that sent the message, you can call `event.sender.sendTo(event.senderId, ...)` to reply to the message, see [ipcRenderer.sendTo][ipc-renderer-sendto] for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set `event.senderId` to `0`.
|
||||
* `ports` MessagePort[] - A list of MessagePorts that were transferred with this message
|
||||
|
||||
[ipc-renderer-sendto]: #ipcrenderersendtowindowid-channel--arg1-arg2-
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# NewWindowEvent Object extends `Event`
|
||||
|
||||
* `newGuest` BrowserWindow (optional)
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
# PrinterInfo Object
|
||||
|
||||
* `name` String - the name of the printer as understood by the OS.
|
||||
* `displayName` String - the name of the printer as shown in Print Preview.
|
||||
* `description` String - a longer description of the printer's type.
|
||||
* `status` Number - the current status of the printer.
|
||||
* `isDefault` Boolean - whether or not a given printer is set as the default printer on the OS.
|
||||
* `options` Object - an object containing a variable number of platform-specific printer information.
|
||||
|
||||
The number represented by `status` means different things on different platforms: on Windows it's potential values can be found [here](https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2), and on Linux and macOS they can be found [here](https://www.cups.org/doc/cupspm.html).
|
||||
* `name` String
|
||||
* `description` String
|
||||
* `status` Number
|
||||
* `isDefault` Boolean
|
||||
|
||||
## Example
|
||||
|
||||
@@ -16,14 +12,13 @@ may be different on each platform.
|
||||
|
||||
```javascript
|
||||
{
|
||||
name: 'Austin_4th_Floor_Printer___C02XK13BJHD4',
|
||||
displayName: 'Austin 4th Floor Printer @ C02XK13BJHD4',
|
||||
description: 'TOSHIBA ColorMFP',
|
||||
name: 'Zebra_LP2844',
|
||||
description: 'Zebra LP2844',
|
||||
status: 3,
|
||||
isDefault: false,
|
||||
options: {
|
||||
copies: '1',
|
||||
'device-uri': 'dnssd://Austin%204th%20Floor%20Printer%20%40%20C02XK13BJHD4._ipps._tcp.local./?uuid=71687f1e-1147-3274-6674-22de61b110bd',
|
||||
'device-uri': 'usb://Zebra/LP2844?location=14200000',
|
||||
finishings: '3',
|
||||
'job-cancel-after': '10800',
|
||||
'job-hold-until': 'no-hold',
|
||||
@@ -31,19 +26,18 @@ may be different on each platform.
|
||||
'job-sheets': 'none,none',
|
||||
'marker-change-time': '0',
|
||||
'number-up': '1',
|
||||
'printer-commands': 'ReportLevels,PrintSelfTestPage,com.toshiba.ColourProfiles.update,com.toshiba.EFiling.update,com.toshiba.EFiling.checkPassword',
|
||||
'printer-info': 'Austin 4th Floor Printer @ C02XK13BJHD4',
|
||||
'printer-commands': 'none',
|
||||
'printer-info': 'Zebra LP2844',
|
||||
'printer-is-accepting-jobs': 'true',
|
||||
'printer-is-shared': 'false',
|
||||
'printer-is-temporary': 'false',
|
||||
'printer-is-shared': 'true',
|
||||
'printer-location': '',
|
||||
'printer-make-and-model': 'TOSHIBA ColorMFP',
|
||||
'printer-make-and-model': 'Zebra EPL2 Label Printer',
|
||||
'printer-state': '3',
|
||||
'printer-state-change-time': '1573472937',
|
||||
'printer-state-reasons': 'offline-report,com.toshiba.snmp.failed',
|
||||
'printer-type': '10531038',
|
||||
'printer-uri-supported': 'ipp://localhost/printers/Austin_4th_Floor_Printer___C02XK13BJHD4',
|
||||
system_driverinfo: 'T'
|
||||
'printer-state-change-time': '1484872644',
|
||||
'printer-state-reasons': 'offline-report',
|
||||
'printer-type': '36932',
|
||||
'printer-uri-supported': 'ipp://localhost/printers/Zebra_LP2844',
|
||||
system_driverinfo: 'Z'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -7,5 +7,4 @@
|
||||
* `contentLengths` Number[] - The total size of the content, in bytes.
|
||||
* `price` Number - The cost of the product in the local currency.
|
||||
* `formattedPrice` String - The locale formatted price of the product.
|
||||
* `currencyCode` String - 3 character code presenting a product's currency based on the ISO 4217 standard.
|
||||
* `isDownloadable` Boolean - A Boolean value that indicates whether the App Store has downloadable content for this product. `true` if at least one file has been associated with the product.
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# ServiceWorkerInfo Object
|
||||
|
||||
* `scriptUrl` String - The full URL to the script that this service worker runs
|
||||
* `scope` String - The base URL that this service worker is active for.
|
||||
* `renderProcessId` Number - The virtual ID of the process that this service worker is running in. This is not an OS level PID. This aligns with the ID set used for `webContents.getProcessId()`.
|
||||
@@ -22,7 +22,7 @@ The main process script is like a normal Node.js script:
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
let win = null
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.loadURL('https://github.com')
|
||||
})
|
||||
@@ -56,7 +56,7 @@ const { app, BrowserWindow } = require('electron')
|
||||
|
||||
let win
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow()
|
||||
win.loadURL('https://github.com')
|
||||
})
|
||||
@@ -71,7 +71,7 @@ const { app, BrowserWindow } = electron
|
||||
|
||||
let win
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow()
|
||||
win.loadURL('https://github.com')
|
||||
})
|
||||
@@ -85,7 +85,7 @@ const app = electron.app
|
||||
const BrowserWindow = electron.BrowserWindow
|
||||
let win
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow()
|
||||
win.loadURL('https://github.com')
|
||||
})
|
||||
|
||||
@@ -326,7 +326,7 @@ This API is only available on macOS 10.14 Mojave or newer.
|
||||
* `window-frame-text` - The text in the window's titlebar area.
|
||||
|
||||
Returns `String` - The system color setting in RGB hexadecimal form (`#ABCDEF`).
|
||||
See the [Windows docs][windows-colors] and the [macOS docs][macos-colors] for more details.
|
||||
See the [Windows docs][windows-colors] and the [MacOS docs][macos-colors] for more details.
|
||||
|
||||
The following colors are only available on macOS 10.14: `find-highlight`, `selected-content-background`, `separator`, `unemphasized-selected-content-background`, `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
|
||||
|
||||
@@ -360,7 +360,7 @@ Returns `Boolean` - `true` if an inverted color scheme (a high contrast color sc
|
||||
|
||||
Returns `Boolean` - `true` if a high contrast theme is active, `false` otherwise.
|
||||
|
||||
**Deprecated:** Should use the new [`nativeTheme.shouldUseHighContrastColors`](native-theme.md#nativethemeshouldusehighcontrastcolors-macos-windows-readonly) API.
|
||||
**Depreacted:** Should use the new [`nativeTheme.shouldUseHighContrastColors`](native-theme.md#nativethemeshouldusehighcontrastcolors-macos-windows-readonly) API.
|
||||
|
||||
### `systemPreferences.getEffectiveAppearance()` _macOS_
|
||||
|
||||
@@ -369,6 +369,8 @@ Returns `String` - Can be `dark`, `light` or `unknown`.
|
||||
Gets the macOS appearance setting that is currently applied to your application,
|
||||
maps to [NSApplication.effectiveAppearance](https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc)
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `systemPreferences.getAppLevelAppearance()` _macOS_ _Deprecated_
|
||||
|
||||
Returns `String` | `null` - Can be `dark`, `light` or `unknown`.
|
||||
@@ -377,6 +379,8 @@ Gets the macOS appearance setting that you have declared you want for
|
||||
your application, maps to [NSApplication.appearance](https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc).
|
||||
You can use the `setAppLevelAppearance` API to set this value.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `systemPreferences.setAppLevelAppearance(appearance)` _macOS_ _Deprecated_
|
||||
|
||||
* `appearance` String | null - Can be `dark` or `light`
|
||||
@@ -384,6 +388,8 @@ You can use the `setAppLevelAppearance` API to set this value.
|
||||
Sets the appearance setting for your application, this should override the
|
||||
system default and override the value of `getEffectiveAppearance`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `systemPreferences.canPromptTouchID()` _macOS_
|
||||
|
||||
Returns `Boolean` - whether or not this device has the ability to use Touch ID.
|
||||
@@ -416,7 +422,7 @@ This API itself will not protect your user data; rather, it is a mechanism to al
|
||||
|
||||
Returns `Boolean` - `true` if the current process is a trusted accessibility client and `false` if it is not.
|
||||
|
||||
### `systemPreferences.getMediaAccessStatus(mediaType)` _Windows_ _macOS_
|
||||
### `systemPreferences.getMediaAccessStatus(mediaType)` _macOS_
|
||||
|
||||
* `mediaType` String - Can be `microphone`, `camera` or `screen`.
|
||||
|
||||
@@ -426,9 +432,6 @@ This user consent was not required on macOS 10.13 High Sierra or lower so this m
|
||||
macOS 10.14 Mojave or higher requires consent for `microphone` and `camera` access.
|
||||
macOS 10.15 Catalina or higher requires consent for `screen` access.
|
||||
|
||||
Windows 10 has a global setting controlling `microphone` and `camera` access for all win32 applications.
|
||||
It will always return `granted` for `screen` and for all media types on older versions of Windows.
|
||||
|
||||
### `systemPreferences.askForMediaAccess(mediaType)` _macOS_
|
||||
|
||||
* `mediaType` String - the type of media being requested; can be `microphone`, `camera`.
|
||||
|
||||
@@ -14,7 +14,6 @@ Process: [Main](../tutorial/application-architecture.md#main-and-renderer-proces
|
||||
* `icon` [NativeImage](native-image.md) | String (optional) - Button icon.
|
||||
* `iconPosition` String (optional) - Can be `left`, `right` or `overlay`. Defaults to `overlay`.
|
||||
* `click` Function (optional) - Function to call when the button is clicked.
|
||||
* `enabled` Boolean (optional) - Whether the button is in an enabled state. Default is `true`.
|
||||
|
||||
When defining `accessibilityLabel`, ensure you have considered macOS [best practices](https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc).
|
||||
|
||||
@@ -40,7 +39,3 @@ the button in the touch bar.
|
||||
|
||||
A `NativeImage` representing the button's current icon. Changing this value immediately updates the button
|
||||
in the touch bar.
|
||||
|
||||
#### `touchBarButton.enabled`
|
||||
|
||||
A `Boolean` representing whether the button is in an enabled state.
|
||||
|
||||
@@ -166,7 +166,7 @@ const touchBar = new TouchBar({
|
||||
|
||||
let window
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.once('ready', () => {
|
||||
window = new BrowserWindow({
|
||||
frame: false,
|
||||
titleBarStyle: 'hiddenInset',
|
||||
|
||||
@@ -10,7 +10,7 @@ Process: [Main](../glossary.md#main-process)
|
||||
const { app, Menu, Tray } = require('electron')
|
||||
|
||||
let tray = null
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
tray = new Tray('/path/to/my/icon')
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
{ label: 'Item1', type: 'radio' },
|
||||
@@ -38,7 +38,7 @@ __Platform limitations:__
|
||||
const { app, Menu, Tray } = require('electron')
|
||||
|
||||
let appIcon = null
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
appIcon = new Tray('/path/to/my/icon')
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
{ label: 'Item1', type: 'radio' },
|
||||
@@ -58,10 +58,9 @@ If you want to keep exact same behaviors on all platforms, you should not
|
||||
rely on the `click` event and always attach a context menu to the tray icon.
|
||||
|
||||
|
||||
### `new Tray(image, [guid])`
|
||||
### `new Tray(image)`
|
||||
|
||||
* `image` ([NativeImage](native-image.md) | String)
|
||||
* `guid` String (optional) _Windows_ - Assigns a GUID to the tray icon. If the executable is signed and the signature contains an organization in the subject line then the GUID is permanently associated with that signature. OS level settings like the position of the tray icon in the system tray will persist even if the path to the executable changes. If the executable is not code-signed then the GUID is permanently associated with the path to the executable. Changing the path to the executable will break the creation of the tray icon and a new GUID must be used. However, it is highly recommended to use the GUID parameter only in conjunction with code-signed executable. If an App defines multiple tray icons then each icon must use a separate GUID.
|
||||
|
||||
Creates a new tray icon associated with the `image`.
|
||||
|
||||
@@ -144,26 +143,6 @@ Emitted when a drag operation exits the tray icon.
|
||||
|
||||
Emitted when a drag operation ends on the tray or ends at another location.
|
||||
|
||||
#### Event: 'mouse-up' _macOS_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||
* `position` [Point](structures/point.md) - The position of the event.
|
||||
|
||||
Emitted when the mouse is released from clicking the tray icon.
|
||||
|
||||
Note: This will not be emitted if you have set a context menu for your Tray using `tray.setContextMenu`, as a result of macOS-level constraints.
|
||||
|
||||
#### Event: 'mouse-down' _macOS_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||
* `position` [Point](structures/point.md) - The position of the event.
|
||||
|
||||
Emitted when the mouse clicks the tray icon.
|
||||
|
||||
#### Event: 'mouse-enter' _macOS_
|
||||
|
||||
Returns:
|
||||
@@ -278,10 +257,6 @@ be shown instead of the tray icon's context menu.
|
||||
|
||||
The `position` is only available on Windows, and it is (0, 0) by default.
|
||||
|
||||
#### `tray.closeContextMenu()` _macOS_ _Windows_
|
||||
|
||||
Closes an open context menu, as set by `tray.setContextMenu()`.
|
||||
|
||||
#### `tray.setContextMenu(menu)`
|
||||
|
||||
* `menu` Menu | null
|
||||
|
||||
@@ -138,7 +138,7 @@ Emitted when page receives favicon urls.
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` NewWindowEvent
|
||||
* `event` Event
|
||||
* `url` String
|
||||
* `frameName` String
|
||||
* `disposition` String - Can be `default`, `foreground-tab`, `background-tab`,
|
||||
@@ -325,7 +325,7 @@ win.webContents.on('will-prevent-unload', (event) => {
|
||||
})
|
||||
```
|
||||
|
||||
#### Event: 'crashed' _Deprecated_
|
||||
#### Event: 'crashed'
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -334,29 +334,6 @@ Returns:
|
||||
|
||||
Emitted when the renderer process crashes or is killed.
|
||||
|
||||
**Deprecated:** This event is superceded by the `render-process-gone` event
|
||||
which contains more information about why the render process dissapeared. It
|
||||
isn't always because it crashed. The `killed` boolean can be replaced by
|
||||
checking `reason === 'killed'` when you switch to that event.
|
||||
|
||||
#### Event: 'render-process-gone'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `reason` String - The reason the render process is gone. Possible values:
|
||||
* `clean-exit` - Process exited with an exit code of zero
|
||||
* `abnormal-exit` - Process exited with a non-zero exit code
|
||||
* `killed` - Process was sent a SIGTERM or otherwise killed externally
|
||||
* `crashed` - Process crashed
|
||||
* `oom` - Process ran out of memory
|
||||
* `launch-failed` - Process never successfully launched
|
||||
* `integrity-failure` - Windows code integrity checks failed
|
||||
|
||||
Emitted when the renderer process unexpectedly dissapears. This is normally
|
||||
because it was crashed or killed.
|
||||
|
||||
#### Event: 'unresponsive'
|
||||
|
||||
Emitted when the web page becomes unresponsive.
|
||||
@@ -389,7 +366,6 @@ Returns:
|
||||
* `key` String - Equivalent to [KeyboardEvent.key][keyboardevent].
|
||||
* `code` String - Equivalent to [KeyboardEvent.code][keyboardevent].
|
||||
* `isAutoRepeat` Boolean - Equivalent to [KeyboardEvent.repeat][keyboardevent].
|
||||
* `isComposing` Boolean - Equivalent to [KeyboardEvent.isComposing][keyboardevent].
|
||||
* `shift` Boolean - Equivalent to [KeyboardEvent.shiftKey][keyboardevent].
|
||||
* `control` Boolean - Equivalent to [KeyboardEvent.controlKey][keyboardevent].
|
||||
* `alt` Boolean - Equivalent to [KeyboardEvent.altKey][keyboardevent].
|
||||
@@ -648,7 +624,7 @@ const { app, BrowserWindow } = require('electron')
|
||||
let win = null
|
||||
app.commandLine.appendSwitch('enable-experimental-web-platform-features')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.webContents.on('select-bluetooth-device', (event, deviceList, callback) => {
|
||||
event.preventDefault()
|
||||
@@ -824,6 +800,17 @@ Emitted when `remote.getCurrentWebContents()` is called in the renderer process.
|
||||
Calling `event.preventDefault()` will prevent the object from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
#### Event: 'remote-get-guest-web-contents'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` IpcMainEvent
|
||||
* `guestWebContents` [WebContents](web-contents.md)
|
||||
|
||||
Emitted when `<webview>.getWebContents()` is called in the renderer process.
|
||||
Calling `event.preventDefault()` will prevent the object from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
#### `contents.loadURL(url[, options])`
|
||||
@@ -895,10 +882,10 @@ Returns `String` - The URL of the current web page.
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
let win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.loadURL('http://github.com').then(() => {
|
||||
const currentURL = win.webContents.getURL()
|
||||
console.log(currentURL)
|
||||
})
|
||||
win.loadURL('http://github.com')
|
||||
|
||||
let currentURL = win.webContents.getURL()
|
||||
console.log(currentURL)
|
||||
```
|
||||
|
||||
#### `contents.getTitle()`
|
||||
@@ -991,10 +978,14 @@ Returns `Boolean` - Whether the renderer process has crashed.
|
||||
|
||||
Overrides the user agent for this web page.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.getUserAgent()`
|
||||
|
||||
Returns `String` - The user agent for this web page.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.insertCSS(css[, options])`
|
||||
|
||||
* `css` String
|
||||
@@ -1007,7 +998,7 @@ Injects CSS into the current web page and returns a unique key for the inserted
|
||||
stylesheet.
|
||||
|
||||
```js
|
||||
contents.on('did-finish-load', () => {
|
||||
contents.on('did-finish-load', function () {
|
||||
contents.insertCSS('html, body { background-color: #f00; }')
|
||||
})
|
||||
```
|
||||
@@ -1022,7 +1013,7 @@ Removes the inserted CSS from the current web page. The stylesheet is identified
|
||||
by its key, which is returned from `contents.insertCSS(css)`.
|
||||
|
||||
```js
|
||||
contents.on('did-finish-load', async () => {
|
||||
contents.on('did-finish-load', async function () {
|
||||
const key = await contents.insertCSS('html, body { background-color: #f00; }')
|
||||
contents.removeInsertedCSS(key)
|
||||
})
|
||||
@@ -1074,10 +1065,14 @@ Ignore application menu shortcuts while this web contents is focused.
|
||||
|
||||
Mute the audio on the current web page.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.isAudioMuted()`
|
||||
|
||||
Returns `Boolean` - Whether this page has been muted.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.isCurrentlyAudible()`
|
||||
|
||||
Returns `Boolean` - Whether audio is currently playing.
|
||||
@@ -1091,10 +1086,14 @@ zoom percent divided by 100, so 300% = 3.0.
|
||||
|
||||
The factor must be greater than 0.0.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.getZoomFactor()`
|
||||
|
||||
Returns `Number` - the current zoom factor.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.setZoomLevel(level)`
|
||||
|
||||
* `level` Number - Zoom level.
|
||||
@@ -1104,10 +1103,14 @@ increment above or below represents zooming 20% larger or smaller to default
|
||||
limits of 300% and 50% of original size, respectively. The formula for this is
|
||||
`scale := 1.2 ^ level`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.getZoomLevel()`
|
||||
|
||||
Returns `Number` - the current zoom level.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.setVisualZoomLevelLimits(minimumLevel, maximumLevel)`
|
||||
|
||||
* `minimumLevel` Number
|
||||
@@ -1123,6 +1126,17 @@ Sets the maximum and minimum pinch-to-zoom level.
|
||||
> contents.setVisualZoomLevelLimits(1, 3)
|
||||
> ```
|
||||
|
||||
#### `contents.setLayoutZoomLevelLimits(minimumLevel, maximumLevel)` _Deprecated_
|
||||
|
||||
* `minimumLevel` Number
|
||||
* `maximumLevel` Number
|
||||
|
||||
Returns `Promise<void>`
|
||||
|
||||
Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
|
||||
|
||||
**Deprecated:** This API is no longer supported by Chromium.
|
||||
|
||||
#### `contents.undo()`
|
||||
|
||||
Executes the editing command `undo` in web page.
|
||||
@@ -1283,23 +1297,17 @@ Returns [`PrinterInfo[]`](structures/printer-info.md)
|
||||
* `pagesPerSheet` Number (optional) - The number of pages to print per page sheet.
|
||||
* `collate` Boolean (optional) - Whether the web page should be collated.
|
||||
* `copies` Number (optional) - The number of copies of the web page to print.
|
||||
* `pageRanges` Record<string, number> (optional) - The page range to print.
|
||||
* `from` Number - the start page.
|
||||
* `to` Number - the end page.
|
||||
* `pageRanges` Record<string, number> (optional) - The page range to print. Should have two keys: `from` and `to`.
|
||||
* `duplexMode` String (optional) - Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or `longEdge`.
|
||||
* `dpi` Record<string, number> (optional)
|
||||
* `dpi` Object (optional)
|
||||
* `horizontal` Number (optional) - The horizontal dpi.
|
||||
* `vertical` Number (optional) - The vertical dpi.
|
||||
* `header` String (optional) - String to be printed as page header.
|
||||
* `footer` String (optional) - String to be printed as page footer.
|
||||
* `pageSize` String | Size (optional) - Specify page size of the printed document. Can be `A3`,
|
||||
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`.
|
||||
* `callback` Function (optional)
|
||||
* `success` Boolean - Indicates success of the print call.
|
||||
* `failureReason` String - Error description called back if the print fails.
|
||||
|
||||
When a custom `pageSize` is passed, Chromium attempts to validate platform specific minumum values for `width_microns` and `height_microns`. Width and height must both be minimum 353 microns but may be higher on some operating systems.
|
||||
|
||||
Prints window's web page. When `silent` is set to `true`, Electron will pick
|
||||
the system's default printer if `deviceName` is empty and the default settings for printing.
|
||||
|
||||
@@ -1317,20 +1325,14 @@ win.webContents.print(options, (success, errorType) => {
|
||||
#### `contents.printToPDF(options)`
|
||||
|
||||
* `options` Object
|
||||
* `headerFooter` Record<string, string> (optional) - the header and footer for the PDF.
|
||||
* `title` String - The title for the PDF header.
|
||||
* `url` String - the url for the PDF footer.
|
||||
* `landscape` Boolean (optional) - `true` for landscape, `false` for portrait.
|
||||
* `marginsType` Integer (optional) - Specifies the type of margins to use. Uses 0 for
|
||||
default margin, 1 for no margin, and 2 for minimum margin.
|
||||
* `scaleFactor` Number (optional) - The scale factor of the web page. Can range from 0 to 100.
|
||||
* `pageRanges` Record<string, number> (optional) - The page range to print.
|
||||
* `from` Number - the first page to print.
|
||||
* `to` Number - the last page to print (inclusive).
|
||||
* `pageSize` String | Size (optional) - Specify page size of the generated PDF. Can be `A3`,
|
||||
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and `width` in microns.
|
||||
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`
|
||||
and `width` in microns.
|
||||
* `printBackground` Boolean (optional) - Whether to print CSS backgrounds.
|
||||
* `printSelectionOnly` Boolean (optional) - Whether to print selection only.
|
||||
* `landscape` Boolean (optional) - `true` for landscape, `false` for portrait.
|
||||
|
||||
Returns `Promise<Buffer>` - Resolves with the generated PDF data.
|
||||
|
||||
@@ -1346,9 +1348,7 @@ By default, an empty `options` will be regarded as:
|
||||
marginsType: 0,
|
||||
printBackground: false,
|
||||
printSelectionOnly: false,
|
||||
landscape: false,
|
||||
pageSize: 'A4',
|
||||
scaleFactor: 100
|
||||
landscape: false
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1428,20 +1428,13 @@ An example of showing devtools in a `<webview>` tag:
|
||||
</head>
|
||||
<body>
|
||||
<webview id="browser" src="https://github.com"></webview>
|
||||
<webview id="devtools" src="about:blank"></webview>
|
||||
<webview id="devtools"></webview>
|
||||
<script>
|
||||
const { webContents } = require('electron').remote
|
||||
const emittedOnce = (element, eventName) => new Promise(resolve => {
|
||||
element.addEventListener(eventName, event => resolve(event), { once: true })
|
||||
})
|
||||
const browserView = document.getElementById('browser')
|
||||
const devtoolsView = document.getElementById('devtools')
|
||||
const browserReady = emittedOnce(browserView, 'dom-ready')
|
||||
const devtoolsReady = emittedOnce(devtoolsView, 'dom-ready')
|
||||
Promise.all([browserReady, devtoolsReady]).then(() => {
|
||||
const browser = webContents.fromId(browserView.getWebContentsId())
|
||||
const devtools = webContents.fromId(devtoolsView.getWebContentsId())
|
||||
browser.setDevToolsWebContents(devtools)
|
||||
browserView.addEventListener('dom-ready', () => {
|
||||
const browser = browserView.getWebContents()
|
||||
browser.setDevToolsWebContents(devtoolsView.getWebContents())
|
||||
browser.openDevTools()
|
||||
})
|
||||
</script>
|
||||
@@ -1457,7 +1450,7 @@ const { app, BrowserWindow } = require('electron')
|
||||
let win = null
|
||||
let devtools = null
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.once('ready', () => {
|
||||
win = new BrowserWindow()
|
||||
devtools = new BrowserWindow()
|
||||
win.loadURL('https://github.com')
|
||||
@@ -1546,7 +1539,7 @@ An example of sending messages from the main process to the renderer process:
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
let win = null
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.loadURL(`file://${__dirname}/index.html`)
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
@@ -1604,32 +1597,6 @@ ipcMain.on('ping', (event) => {
|
||||
})
|
||||
```
|
||||
|
||||
#### `contents.postMessage(channel, message, [transfer])`
|
||||
|
||||
* `channel` String
|
||||
* `message` any
|
||||
* `transfer` MessagePortMain[] (optional)
|
||||
|
||||
Send a message to the renderer process, optionally transferring ownership of
|
||||
zero or more [`MessagePortMain`][] objects.
|
||||
|
||||
The transferred `MessagePortMain` objects will be available in the renderer
|
||||
process by accessing the `ports` property of the emitted event. When they
|
||||
arrive in the renderer, they will be native DOM `MessagePort` objects.
|
||||
|
||||
For example:
|
||||
```js
|
||||
// Main process
|
||||
const { port1, port2 } = new MessageChannelMain()
|
||||
webContents.postMessage('port', { message: 'hello' }, [port1])
|
||||
|
||||
// Renderer process
|
||||
ipcRenderer.on('port', (e, msg) => {
|
||||
const [port] = e.ports
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
#### `contents.enableDeviceEmulation(parameters)`
|
||||
|
||||
* `parameters` Object
|
||||
@@ -1746,10 +1713,14 @@ Returns `Boolean` - If *offscreen rendering* is enabled returns whether it is cu
|
||||
If *offscreen rendering* is enabled sets the frame rate to the specified number.
|
||||
Only values between 1 and 60 are accepted.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.getFrameRate()`
|
||||
|
||||
Returns `Integer` - If *offscreen rendering* is enabled returns the current frame rate.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.invalidate()`
|
||||
|
||||
Schedules a full repaint of the window this web contents is in.
|
||||
@@ -1843,7 +1814,7 @@ Only applicable if *offscreen rendering* is enabled.
|
||||
|
||||
#### `contents.id` _Readonly_
|
||||
|
||||
A `Integer` representing the unique ID of this WebContents. Each ID is unique among all `WebContents` instances of the entire Electron application.
|
||||
A `Integer` representing the unique ID of this WebContents.
|
||||
|
||||
#### `contents.session` _Readonly_
|
||||
|
||||
|
||||
@@ -58,6 +58,15 @@ Sets the maximum and minimum pinch-to-zoom level.
|
||||
> webFrame.setVisualZoomLevelLimits(1, 3)
|
||||
> ```
|
||||
|
||||
### `webFrame.setLayoutZoomLevelLimits(minimumLevel, maximumLevel)` _Deprecated_
|
||||
|
||||
* `minimumLevel` Number
|
||||
* `maximumLevel` Number
|
||||
|
||||
Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
|
||||
|
||||
**Deprecated:** This API is no longer supported by Chromium.
|
||||
|
||||
### `webFrame.setSpellCheckProvider(language, provider)`
|
||||
|
||||
* `language` String
|
||||
@@ -124,20 +133,13 @@ by its key, which is returned from `webFrame.insertCSS(css)`.
|
||||
|
||||
Inserts `text` to the focused element.
|
||||
|
||||
### `webFrame.executeJavaScript(code[, userGesture, callback])`
|
||||
### `webFrame.executeJavaScript(code[, userGesture])`
|
||||
|
||||
* `code` String
|
||||
* `userGesture` Boolean (optional) - Default is `false`.
|
||||
* `callback` Function (optional) - Called after script has been executed. Unless
|
||||
the frame is suspended (e.g. showing a modal alert), execution will be
|
||||
synchronous and the callback will be invoked before the method returns. For
|
||||
compatibility with an older version of this method, the error parameter is
|
||||
second.
|
||||
* `result` Any
|
||||
* `error` Error
|
||||
|
||||
Returns `Promise<any>` - A promise that resolves with the result of the executed
|
||||
code or is rejected if execution throws or results in a rejected promise.
|
||||
Returns `Promise<any>` - A promise that resolves with the result of the executed code
|
||||
or is rejected if the result of the code is a rejected promise.
|
||||
|
||||
Evaluates `code` in page.
|
||||
|
||||
@@ -145,31 +147,17 @@ In the browser window some HTML APIs like `requestFullScreen` can only be
|
||||
invoked by a gesture from the user. Setting `userGesture` to `true` will remove
|
||||
this limitation.
|
||||
|
||||
### `webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])`
|
||||
### `webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture])`
|
||||
|
||||
* `worldId` Integer - The ID of the world to run the javascript
|
||||
in, `0` is the default main world (where content runs), `999` is the
|
||||
world used by Electron's `contextIsolation` feature. Accepts values
|
||||
in the range 1..536870911.
|
||||
* `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electrons `contextIsolation` feature. You can provide any integer here.
|
||||
* `scripts` [WebSource[]](structures/web-source.md)
|
||||
* `userGesture` Boolean (optional) - Default is `false`.
|
||||
* `callback` Function (optional) - Called after script has been executed. Unless
|
||||
the frame is suspended (e.g. showing a modal alert), execution will be
|
||||
synchronous and the callback will be invoked before the method returns. For
|
||||
compatibility with an older version of this method, the error parameter is
|
||||
second.
|
||||
* `result` Any
|
||||
* `error` Error
|
||||
|
||||
Returns `Promise<any>` - A promise that resolves with the result of the executed
|
||||
code or is rejected if execution could not start.
|
||||
Returns `Promise<any>` - A promise that resolves with the result of the executed code
|
||||
or is rejected if the result of the code is a rejected promise.
|
||||
|
||||
Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
|
||||
|
||||
Note that when the execution of script fails, the returned promise will not
|
||||
reject and the `result` would be `undefined`. This is because Chromium does not
|
||||
dispatch errors of isolated worlds to foreign worlds.
|
||||
|
||||
### `webFrame.setIsolatedWorldInfo(worldId, info)`
|
||||
* `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electrons `contextIsolation` feature. Chrome extensions reserve the range of IDs in `[1 << 20, 1 << 29)`. You can provide any integer here.
|
||||
* `info` Object
|
||||
|
||||
@@ -545,32 +545,9 @@ Stops any `findInPage` request for the `webview` with the provided `action`.
|
||||
|
||||
* `options` Object (optional)
|
||||
* `silent` Boolean (optional) - Don't ask user for print settings. Default is `false`.
|
||||
* `printBackground` Boolean (optional) - Prints the background color and image of
|
||||
* `printBackground` Boolean (optional) - Also prints the background color and image of
|
||||
the web page. Default is `false`.
|
||||
* `deviceName` String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
|
||||
* `color` Boolean (optional) - Set whether the printed web page will be in color or grayscale. Default is `true`.
|
||||
* `margins` Object (optional)
|
||||
* `marginType` String (optional) - Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen, you will also need to specify `top`, `bottom`, `left`, and `right`.
|
||||
* `top` Number (optional) - The top margin of the printed web page, in pixels.
|
||||
* `bottom` Number (optional) - The bottom margin of the printed web page, in pixels.
|
||||
* `left` Number (optional) - The left margin of the printed web page, in pixels.
|
||||
* `right` Number (optional) - The right margin of the printed web page, in pixels.
|
||||
* `landscape` Boolean (optional) - Whether the web page should be printed in landscape mode. Default is `false`.
|
||||
* `scaleFactor` Number (optional) - The scale factor of the web page.
|
||||
* `pagesPerSheet` Number (optional) - The number of pages to print per page sheet.
|
||||
* `collate` Boolean (optional) - Whether the web page should be collated.
|
||||
* `copies` Number (optional) - The number of copies of the web page to print.
|
||||
* `pageRanges` Record<string, number> (optional) - The page range to print.
|
||||
* `from` Number - the start page.
|
||||
* `to` Number - the end page.
|
||||
* `duplexMode` String (optional) - Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or `longEdge`.
|
||||
* `dpi` Record<string, number> (optional)
|
||||
* `horizontal` Number (optional) - The horizontal dpi.
|
||||
* `vertical` Number (optional) - The vertical dpi.
|
||||
* `header` String (optional) - String to be printed as page header.
|
||||
* `footer` String (optional) - String to be printed as page footer.
|
||||
* `pageSize` String | Size (optional) - Specify page size of the printed document. Can be `A3`,
|
||||
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`.
|
||||
* `deviceName` String (optional) - Set the printer device name to use. Default is `''`.
|
||||
|
||||
Returns `Promise<void>`
|
||||
|
||||
@@ -579,21 +556,14 @@ Prints `webview`'s web page. Same as `webContents.print([options])`.
|
||||
### `<webview>.printToPDF(options)`
|
||||
|
||||
* `options` Object
|
||||
* `headerFooter` Record<string, string> (optional) - the header and footer for the PDF.
|
||||
* `title` String - The title for the PDF header.
|
||||
* `url` String - the url for the PDF footer.
|
||||
* `landscape` Boolean (optional) - `true` for landscape, `false` for portrait.
|
||||
* `marginsType` Integer (optional) - Specifies the type of margins to use. Uses 0 for
|
||||
default margin, 1 for no margin, and 2 for minimum margin.
|
||||
and `width` in microns.
|
||||
* `scaleFactor` Number (optional) - The scale factor of the web page. Can range from 0 to 100.
|
||||
* `pageRanges` Record<string, number> (optional) - The page range to print.
|
||||
* `from` Number - the first page to print.
|
||||
* `to` Number - the last page to print (inclusive).
|
||||
* `pageSize` String | Size (optional) - Specify page size of the generated PDF. Can be `A3`,
|
||||
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`
|
||||
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`
|
||||
and `width` in microns.
|
||||
* `printBackground` Boolean (optional) - Whether to print CSS backgrounds.
|
||||
* `printSelectionOnly` Boolean (optional) - Whether to print selection only.
|
||||
* `landscape` Boolean (optional) - `true` for landscape, `false` for portrait.
|
||||
|
||||
Returns `Promise<Uint8Array>` - Resolves with the generated PDF data.
|
||||
|
||||
@@ -665,10 +635,29 @@ Returns `Promise<void>`
|
||||
|
||||
Sets the maximum and minimum pinch-to-zoom level.
|
||||
|
||||
### `<webview>.setLayoutZoomLevelLimits(minimumLevel, maximumLevel)` _Deprecated_
|
||||
|
||||
* `minimumLevel` Number
|
||||
* `maximumLevel` Number
|
||||
|
||||
Returns `Promise<void>`
|
||||
|
||||
Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
|
||||
|
||||
**Deprecated:** This API is no longer supported by Chromium.
|
||||
|
||||
### `<webview>.showDefinitionForSelection()` _macOS_
|
||||
|
||||
Shows pop-up dictionary that searches the selected word on the page.
|
||||
|
||||
### `<webview>.getWebContents()` _Deprecated_
|
||||
|
||||
Returns [`WebContents`](web-contents.md) - The web contents associated with
|
||||
this `webview`.
|
||||
|
||||
It depends on the [`remote`](remote.md) module,
|
||||
it is therefore not available when this module is disabled.
|
||||
|
||||
### `<webview>.getWebContentsId()`
|
||||
|
||||
Returns `Number` - The WebContents ID of this `webview`.
|
||||
|
||||
@@ -96,30 +96,30 @@ $ cd src
|
||||
$ export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools
|
||||
# this next line is needed only if building with sccache
|
||||
$ export GN_EXTRA_ARGS="${GN_EXTRA_ARGS} cc_wrapper=\"${PWD}/electron/external_binaries/sccache\""
|
||||
$ gn gen out/Testing --args="import(\"//electron/build/args/testing.gn\") $GN_EXTRA_ARGS"
|
||||
$ gn gen out/Debug --args="import(\"//electron/build/args/debug.gn\") $GN_EXTRA_ARGS"
|
||||
```
|
||||
|
||||
Or on Windows (without the optional argument):
|
||||
```sh
|
||||
$ cd src
|
||||
$ set CHROMIUM_BUILDTOOLS_PATH=%cd%\buildtools
|
||||
$ gn gen out/Testing --args="import(\"//electron/build/args/testing.gn\")"
|
||||
$ gn gen out/Debug --args="import(\"//electron/build/args/debug.gn\")"
|
||||
```
|
||||
|
||||
This will generate a build directory `out/Testing` under `src/` with
|
||||
the testing build configuration. You can replace `Testing` with another name,
|
||||
This will generate a build directory `out/Debug` under `src/` with
|
||||
debug build configuration. You can replace `Debug` with another name,
|
||||
but it should be a subdirectory of `out`.
|
||||
Also you shouldn't have to run `gn gen` again—if you want to change the
|
||||
build arguments, you can run `gn args out/Testing` to bring up an editor.
|
||||
build arguments, you can run `gn args out/Debug` to bring up an editor.
|
||||
|
||||
To see the list of available build configuration options, run `gn args
|
||||
out/Testing --list`.
|
||||
out/Debug --list`.
|
||||
|
||||
**For generating Testing build config of
|
||||
**For generating Debug (aka "component" or "shared") build config of
|
||||
Electron:**
|
||||
|
||||
```sh
|
||||
$ gn gen out/Testing --args="import(\"//electron/build/args/testing.gn\") $GN_EXTRA_ARGS"
|
||||
$ gn gen out/Debug --args="import(\"//electron/build/args/debug.gn\") $GN_EXTRA_ARGS"
|
||||
```
|
||||
|
||||
**For generating Release (aka "non-component" or "static") build config of
|
||||
@@ -132,9 +132,9 @@ $ gn gen out/Release --args="import(\"//electron/build/args/release.gn\") $GN_EX
|
||||
**To build, run `ninja` with the `electron` target:**
|
||||
Nota Bene: This will also take a while and probably heat up your lap.
|
||||
|
||||
For the testing configuration:
|
||||
For the debug configuration:
|
||||
```sh
|
||||
$ ninja -C out/Testing electron
|
||||
$ ninja -C out/Debug electron
|
||||
```
|
||||
|
||||
For the release configuration:
|
||||
@@ -147,19 +147,19 @@ This will build all of what was previously 'libchromiumcontent' (i.e. the
|
||||
so it will take a while.
|
||||
|
||||
To speed up subsequent builds, you can use [sccache][sccache]. Add the GN arg
|
||||
`cc_wrapper = "sccache"` by running `gn args out/Testing` to bring up an
|
||||
`cc_wrapper = "sccache"` by running `gn args out/Debug` to bring up an
|
||||
editor and adding a line to the end of the file.
|
||||
|
||||
[sccache]: https://github.com/mozilla/sccache
|
||||
|
||||
The built executable will be under `./out/Testing`:
|
||||
The built executable will be under `./out/Debug`:
|
||||
|
||||
```sh
|
||||
$ ./out/Testing/Electron.app/Contents/MacOS/Electron
|
||||
$ ./out/Debug/Electron.app/Contents/MacOS/Electron
|
||||
# or, on Windows
|
||||
$ ./out/Testing/electron.exe
|
||||
$ ./out/Debug/electron.exe
|
||||
# or, on Linux
|
||||
$ ./out/Testing/electron
|
||||
$ ./out/Debug/electron
|
||||
```
|
||||
|
||||
### Packaging
|
||||
@@ -181,7 +181,7 @@ set the `target_cpu` and `target_os` GN arguments. For example, to compile an
|
||||
x86 target from an x64 host, specify `target_cpu = "x86"` in `gn args`.
|
||||
|
||||
```sh
|
||||
$ gn gen out/Testing-x86 --args='... target_cpu = "x86"'
|
||||
$ gn gen out/Debug-x86 --args='... target_cpu = "x86"'
|
||||
```
|
||||
|
||||
Not all combinations of source and target CPU/OS are supported by Chromium.
|
||||
@@ -226,7 +226,7 @@ generate build headers for the modules to compile against, run the following
|
||||
under `src/` directory.
|
||||
|
||||
```sh
|
||||
$ ninja -C out/Testing third_party/electron_node:headers
|
||||
$ ninja -C out/Debug third_party/electron_node:headers
|
||||
```
|
||||
|
||||
You can now [run the tests](testing.md#unit-tests).
|
||||
@@ -235,8 +235,8 @@ If you're debugging something, it can be helpful to pass some extra flags to
|
||||
the Electron binary:
|
||||
|
||||
```sh
|
||||
$ npm run test -- \
|
||||
--enable-logging -g 'BrowserWindow module'
|
||||
$ ./out/Debug/Electron.app/Contents/MacOS/Electron electron/spec \
|
||||
--ci --enable-logging -g 'BrowserWindow module'
|
||||
```
|
||||
|
||||
## Sharing the git cache between multiple machines
|
||||
@@ -265,7 +265,8 @@ New-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\Lanmanworkstatio
|
||||
|
||||
### Stale locks in the git cache
|
||||
If `gclient sync` is interrupted while using the git cache, it will leave
|
||||
the cache locked. To remove the lock, pass the `--ignore_locks` argument to `gclient sync`.
|
||||
the cache locked. To remove the lock, pass the `--break_repo_locks` argument to
|
||||
`gclient sync`.
|
||||
|
||||
### 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
|
||||
|
||||
@@ -25,7 +25,7 @@ Follow the guidelines below for building Electron on Linux.
|
||||
Doing so permits installing Node on your own home directory as a standard user.
|
||||
Or try repositories such as [NodeSource](https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories).
|
||||
* [clang](https://clang.llvm.org/get_started.html) 3.4 or later.
|
||||
* Development headers of GTK 3 and libnotify.
|
||||
* Development headers of GTK+ and libnotify.
|
||||
|
||||
On Ubuntu, install the following libraries:
|
||||
|
||||
@@ -79,7 +79,7 @@ And to cross-compile for `arm` or `ia32` targets, you should pass the
|
||||
`target_cpu` parameter to `gn gen`:
|
||||
|
||||
```sh
|
||||
$ gn gen out/Testing --args='import(...) target_cpu="arm"'
|
||||
$ gn gen out/Debug --args='import(...) target_cpu="arm"'
|
||||
```
|
||||
|
||||
## Building
|
||||
@@ -114,7 +114,7 @@ GN args.
|
||||
For example if you installed `clang` under `/usr/local/bin/clang`:
|
||||
|
||||
```sh
|
||||
$ gn gen out/Testing --args='import("//electron/build/args/testing.gn") clang_base_path = "/usr/local/bin"'
|
||||
$ gn gen out/Debug --args='import("//electron/build/args/debug.gn") clang_base_path = "/usr/local/bin"'
|
||||
```
|
||||
|
||||
### Using compilers other than `clang`
|
||||
|
||||
@@ -42,7 +42,7 @@ $ pip install pyobjc
|
||||
If you're developing Electron and don't plan to redistribute your
|
||||
custom Electron build, you may skip this section.
|
||||
|
||||
Official Electron builds are built with [Xcode 9.4.1](http://adcdownload.apple.com/Developer_Tools/Xcode_9.4.1/Xcode_9.4.1.xip), and the macOS 10.13 SDK. Building with a newer SDK works too, but the releases currently use the 10.13 SDK.
|
||||
Official Electron builds are built with [Xcode 9.4.1](http://adcdownload.apple.com/Developer_Tools/Xcode_9.4.1/Xcode_9.4.1.xip), and the MacOS 10.13 SDK. Building with a newer SDK works too, but the releases currently use the 10.13 SDK.
|
||||
|
||||
## Building Electron
|
||||
|
||||
|
||||
@@ -11,8 +11,9 @@ Follow the guidelines below for building Electron on Windows.
|
||||
components are required.
|
||||
* If your Visual Studio is installed in a directory other than the default, you'll need to
|
||||
set a few environment variables to point the toolchains to your installation path.
|
||||
* `vs2019_install = DRIVE:\path\to\Microsoft Visual Studio\2019\Community`, replacing `2019` and `Community` with your installed versions and replacing `DRIVE:` with the drive that Visual Studio is on. Often, this will be `C:`.
|
||||
* `WINDOWSSDKDIR = DRIVE:\path\to\Windows Kits\10`, replacing `DRIVE:` with the drive that Windows Kits is on. Often, this will be `C:`.
|
||||
* `vs2019_install = DRIVE:\path\to\Microsoft Visual Studio\2019\Community`
|
||||
(replace `2019` and `Community` with your installed versions)
|
||||
* `WINDOWSSDKDIR = DRIVE:\path\to\Windows Kits\10`
|
||||
* [Python 2.7.10 or higher](http://www.python.org/download/releases/2.7/)
|
||||
* Contrary to the `depot_tools` setup instructions linked below, you will need
|
||||
to use your locally installed Python with at least version 2.7.10 (with
|
||||
@@ -73,7 +74,7 @@ To generate a Visual Studio project, you can pass the `--ide=vs2017` parameter
|
||||
to `gn gen`:
|
||||
|
||||
```powershell
|
||||
$ gn gen out/Testing --ide=vs2017
|
||||
$ gn gen out/Debug --ide=vs2017
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@@ -57,7 +57,7 @@ you're currently working on using Mocha's
|
||||
`.only` to any `describe` or `it` function call:
|
||||
|
||||
```js
|
||||
describe.only('some feature', () => {
|
||||
describe.only('some feature', function () {
|
||||
// ... only tests in this block will be run
|
||||
})
|
||||
```
|
||||
|
||||
@@ -54,7 +54,7 @@ formatted correctly.
|
||||
the `module-name` form. This rule only applies to `.js` files.
|
||||
* Use newer ES6/ES2015 syntax where appropriate
|
||||
* [`const`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const)
|
||||
for requires and other constants. If the value is a primitive, use uppercase naming (eg `const NUMBER_OF_RETRIES = 5`).
|
||||
for requires and other constants
|
||||
* [`let`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let)
|
||||
for defining variables
|
||||
* [Arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)
|
||||
|
||||
@@ -36,7 +36,7 @@ To start a debugging session, open up PowerShell/CMD and execute your debug
|
||||
build of Electron, using the application to open as a parameter.
|
||||
|
||||
```powershell
|
||||
$ ./out/Testing/electron.exe ~/my-electron-app/
|
||||
$ ./out/Debug/electron.exe ~/my-electron-app/
|
||||
```
|
||||
|
||||
### Setting Breakpoints
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
### Generate xcode project for debugging sources (cannot build code from xcode)
|
||||
Run `gn gen` with the --ide=xcode argument.
|
||||
```sh
|
||||
$ gn gen out/Testing --ide=xcode
|
||||
$ gn gen out/Debug --ide=xcode
|
||||
```
|
||||
This will generate the electron.ninja.xcworkspace. You will have to open this workspace
|
||||
to set breakpoints and inspect.
|
||||
|
||||
@@ -20,23 +20,18 @@ you prefer a graphical interface.
|
||||
tail calls, and other compiler optimizations.
|
||||
|
||||
* **Xcode**: In addition to Xcode, also install the Xcode command line tools.
|
||||
They include LLDB, the default debugger in Xcode on macOS. It supports
|
||||
They include LLDB, the default debugger in Xcode on Mac OS X. It supports
|
||||
debugging C, Objective-C and C++ on the desktop and iOS devices and simulator.
|
||||
|
||||
* **.lldbinit**: Create or edit `~/.lldbinit` to allow Chromium code to be properly source-mapped.
|
||||
```text
|
||||
command script import ~/electron/src/tools/lldb/lldbinit.py
|
||||
```
|
||||
|
||||
## Attaching to and Debugging Electron
|
||||
|
||||
To start a debugging session, open up Terminal and start `lldb`, passing a non-release
|
||||
To start a debugging session, open up Terminal and start `lldb`, passing a debug
|
||||
build of Electron as a parameter.
|
||||
|
||||
```sh
|
||||
$ lldb ./out/Testing/Electron.app
|
||||
(lldb) target create "./out/Testing/Electron.app"
|
||||
Current executable set to './out/Testing/Electron.app' (x86_64).
|
||||
$ lldb ./out/Debug/Electron.app
|
||||
(lldb) target create "./out/Debug/Electron.app"
|
||||
Current executable set to './out/Debug/Electron.app' (x86_64).
|
||||
```
|
||||
|
||||
### Setting Breakpoints
|
||||
@@ -67,7 +62,7 @@ The app will immediately be paused, since Electron sets the app's name on launch
|
||||
|
||||
```sh
|
||||
(lldb) run
|
||||
Process 25244 launched: '/Users/fr/Code/electron/out/Testing/Electron.app/Contents/MacOS/Electron' (x86_64)
|
||||
Process 25244 launched: '/Users/fr/Code/electron/out/Debug/Electron.app/Contents/MacOS/Electron' (x86_64)
|
||||
Process 25244 stopped
|
||||
* thread #1: tid = 0x839a4c, 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name="Electron") + 20 at browser.cc:118, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
|
||||
frame #0: 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name="Electron") + 20 at browser.cc:118
|
||||
@@ -110,8 +105,6 @@ Process 25244 stopped
|
||||
122 return badge_count_;
|
||||
```
|
||||
|
||||
**NOTE:** If you don't see source code when you think you should, you may not have added the `~/.lldbinit` file above.
|
||||
|
||||
To finish debugging at this point, run `process continue`. You can also continue until a certain
|
||||
line is hit in this thread (`thread until 100`). This command will run the thread in the current
|
||||
frame till it reaches line 100 in this frame or stops if it leaves the current frame.
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
# Goma
|
||||
|
||||
> Goma is a distributed compiler service for open-source projects such as
|
||||
> Chromium and Android.
|
||||
|
||||
Electron has a deployment of a custom Goma Backend that we make available to
|
||||
all Electron Maintainers. See the [Access](#access) section below for details
|
||||
on authentication.
|
||||
|
||||
## Enabling Goma
|
||||
|
||||
Currently Electron Goma supports Windows, Linux, and macOS. If you are
|
||||
on a supported platform you can enable goma by importing the `goma.gn` config
|
||||
file when using `gn`.
|
||||
|
||||
```bash
|
||||
gn gen out/Testing --args="import(\"//electron/build/args/testing.gn\") import(\"//electron/build/args/goma.gn\")"
|
||||
```
|
||||
|
||||
You must ensure that you do not have `cc_wrapper` configured, this means you
|
||||
can't use `sccache` or similar technology.
|
||||
|
||||
Before you can use goma to build Electron you need to authenticate against
|
||||
the Goma service. You only need to do this once per-machine.
|
||||
|
||||
```bash
|
||||
cd electron/external_binaries/goma
|
||||
./goma_auth.py login
|
||||
```
|
||||
|
||||
Once authenticated you need to make sure the goma daemon is running on your
|
||||
machine.
|
||||
|
||||
```bash
|
||||
cd electron/external_binaries/goma
|
||||
./goma_ctl.py ensure_start
|
||||
```
|
||||
|
||||
## Building with Goma
|
||||
|
||||
When you are using Goma you can run `ninja` with a substantially higher `j`
|
||||
value than would normally be supported by your machine.
|
||||
|
||||
Please do not set a value higher than **300** on Windows or Linux and
|
||||
**80** on macOS, we monitor the goma system and users found to be abusing
|
||||
it with unreasonable concurrency will be de-activated.
|
||||
|
||||
```bash
|
||||
ninja -C out/Testing electron -j 200
|
||||
```
|
||||
|
||||
## Monitoring Goma
|
||||
|
||||
If you access [http://localhost:8088](http://localhost:8088) on your local
|
||||
machine you can monitor compile jobs as they flow through the goma system.
|
||||
|
||||
## Access
|
||||
|
||||
For security and cost reasons access to Electron Goma is currently restricted
|
||||
to Electron Maintainers. If you want access please head to `#access-requests` in
|
||||
Slack and ping `@goma-squad` to ask for access. Please be aware that being a
|
||||
maintainer does not *automatically* grant access and access is determined on a
|
||||
case by case basis.
|
||||
@@ -13,7 +13,7 @@ contribute:
|
||||
|
||||
1. By opening the issue for discussion: If you believe that you have found
|
||||
a new bug in Electron, you should report it by creating a new issue in
|
||||
the [`electron/electron` issue tracker](https://github.com/electron/electron/issues).
|
||||
the `electron/electron` issue tracker.
|
||||
2. By helping to triage the issue: You can do this either by providing
|
||||
assistive details (a reproducible test case that demonstrates a bug) or by
|
||||
providing suggestions to address the issue.
|
||||
@@ -30,9 +30,7 @@ contributing, and more. Please use the issue tracker for bugs only!
|
||||
|
||||
## Submitting a Bug Report
|
||||
|
||||
To submit a bug report:
|
||||
|
||||
When opening a new issue in the [`electron/electron` issue tracker](https://github.com/electron/electron/issues/new/choose), users
|
||||
When opening a new issue in the `electron/electron` issue tracker, users
|
||||
will be presented with a template that should be filled in.
|
||||
|
||||
```markdown
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user