mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
259 Commits
v40.0.0-al
...
v37.10.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e994a48c7a | ||
|
|
35ed9f6c6a | ||
|
|
dc5681ed79 | ||
|
|
6a03d14055 | ||
|
|
3ecddde010 | ||
|
|
6a303cb19f | ||
|
|
a8dceb5d2e | ||
|
|
e93f04b23e | ||
|
|
d8c222d607 | ||
|
|
8647ef3870 | ||
|
|
800bfde80f | ||
|
|
ade3ae7cb7 | ||
|
|
92cbc042e8 | ||
|
|
c5894fb455 | ||
|
|
60a8cde048 | ||
|
|
441e317400 | ||
|
|
45aa5396a9 | ||
|
|
a8372e0e70 | ||
|
|
93396bdea3 | ||
|
|
b0dea2f1c1 | ||
|
|
b56d95d214 | ||
|
|
80b1defd81 | ||
|
|
55f8924821 | ||
|
|
5a1d521a1d | ||
|
|
dfc60f0f42 | ||
|
|
8265537daf | ||
|
|
24602a7b2a | ||
|
|
fbbcb0dfd4 | ||
|
|
7449f3f376 | ||
|
|
f3f25fd020 | ||
|
|
14ce66e4ea | ||
|
|
05f8cd8b15 | ||
|
|
f58a7be1a5 | ||
|
|
d3d2877b65 | ||
|
|
7059e38293 | ||
|
|
3a9ca3234e | ||
|
|
04c8bde38e | ||
|
|
9a2b4f84be | ||
|
|
09fa5977f4 | ||
|
|
2867f505b7 | ||
|
|
f93375d130 | ||
|
|
b5c8dc159f | ||
|
|
432be6c971 | ||
|
|
aa82113161 | ||
|
|
fa1505cca9 | ||
|
|
31485996d1 | ||
|
|
e7ff3d4254 | ||
|
|
fa8f3384a9 | ||
|
|
d4ac255c5a | ||
|
|
9c186be17f | ||
|
|
3bacb67783 | ||
|
|
55ba373480 | ||
|
|
f58d12bbfa | ||
|
|
f46b84efa6 | ||
|
|
cfdd0a3640 | ||
|
|
68e5a3199b | ||
|
|
024d339efa | ||
|
|
ce91f050d4 | ||
|
|
2a10eb762d | ||
|
|
5b33120edc | ||
|
|
81ed404ea6 | ||
|
|
efb54324a4 | ||
|
|
23a0293451 | ||
|
|
beee3737a9 | ||
|
|
a11d4eb03c | ||
|
|
edbe9cbbda | ||
|
|
1d6508bc70 | ||
|
|
78614c6bdb | ||
|
|
dbd11d7806 | ||
|
|
d053f2e4f9 | ||
|
|
4694925015 | ||
|
|
4b46b6e2f2 | ||
|
|
a84d77143f | ||
|
|
020e07cc73 | ||
|
|
a0a315aa7a | ||
|
|
23266d5496 | ||
|
|
a954f9f245 | ||
|
|
f409eb0d7a | ||
|
|
922f707ef5 | ||
|
|
4f426daeca | ||
|
|
e83b0f6c23 | ||
|
|
3474f897f2 | ||
|
|
1919b18b72 | ||
|
|
3a493bc01b | ||
|
|
e0628b9de1 | ||
|
|
c7ae20c4f2 | ||
|
|
6c8dbe4594 | ||
|
|
99b9516a68 | ||
|
|
ee8290e707 | ||
|
|
46dec46a82 | ||
|
|
e17cbc96e2 | ||
|
|
45899d1cd7 | ||
|
|
6cc713f058 | ||
|
|
2d855cd680 | ||
|
|
1bf39c1341 | ||
|
|
2359cfefbd | ||
|
|
cb11c333fa | ||
|
|
d49515db3e | ||
|
|
2e460c0ffb | ||
|
|
36aba22fee | ||
|
|
7f00dc74db | ||
|
|
6c9bbdf72a | ||
|
|
9e3b0366e5 | ||
|
|
d5c68c2f6d | ||
|
|
fe378a43cd | ||
|
|
87682eff7f | ||
|
|
87cdc1e994 | ||
|
|
f4ae0dc342 | ||
|
|
5ba1597340 | ||
|
|
e845d20789 | ||
|
|
4c3f14e436 | ||
|
|
e6f2de587f | ||
|
|
52bba3fb5f | ||
|
|
591b1e77ad | ||
|
|
dac83d743b | ||
|
|
102f740ec2 | ||
|
|
ca563d5464 | ||
|
|
cbec5f7a5a | ||
|
|
8164a0b1f9 | ||
|
|
6e1650af12 | ||
|
|
e93c4a3419 | ||
|
|
93d70103aa | ||
|
|
6e9a46042d | ||
|
|
f4e709c47e | ||
|
|
549c73a8b4 | ||
|
|
90a0f81302 | ||
|
|
841a770c6c | ||
|
|
cc05e5f40e | ||
|
|
65c062d3f9 | ||
|
|
fc55862138 | ||
|
|
2856008e52 | ||
|
|
abba008673 | ||
|
|
bbf8003f0f | ||
|
|
9aedb9c1f4 | ||
|
|
47e927ac2b | ||
|
|
e73d57cc08 | ||
|
|
99a224e45b | ||
|
|
1754c55c05 | ||
|
|
1eb8f7e705 | ||
|
|
e45eab5b35 | ||
|
|
75cda9e16b | ||
|
|
be53277b54 | ||
|
|
253d49b24f | ||
|
|
42325294ab | ||
|
|
285bbc560b | ||
|
|
713030b21a | ||
|
|
9e453030ae | ||
|
|
d4e22c97b2 | ||
|
|
6ce5f88940 | ||
|
|
cfa2efe0c2 | ||
|
|
221f5ee3d6 | ||
|
|
2f1dfc73ac | ||
|
|
3ea4c6c3e7 | ||
|
|
5bd18aac95 | ||
|
|
03c32ba3be | ||
|
|
bef6e11b9d | ||
|
|
f72ec2c45a | ||
|
|
ba6f0358b0 | ||
|
|
2f4472f058 | ||
|
|
32599dda44 | ||
|
|
d2c95a28bb | ||
|
|
e90404be7d | ||
|
|
b494ae62ba | ||
|
|
5953dca8be | ||
|
|
9f4b16fa81 | ||
|
|
a6569b116e | ||
|
|
dd0fb7d24d | ||
|
|
d657036a1b | ||
|
|
b875976f04 | ||
|
|
f1f7bd631f | ||
|
|
08e27c02ea | ||
|
|
8275e86f0a | ||
|
|
3fdb77abf1 | ||
|
|
2e2d1f1612 | ||
|
|
c68389ad98 | ||
|
|
380351c01b | ||
|
|
c382d4c875 | ||
|
|
2fb2cc030d | ||
|
|
1d8e9e1d52 | ||
|
|
bdcf09861e | ||
|
|
cd1afd6d9a | ||
|
|
ca22facaaf | ||
|
|
95212a539b | ||
|
|
91c153ed0b | ||
|
|
ab78c8a295 | ||
|
|
c2e8d71683 | ||
|
|
47e0baf21d | ||
|
|
f9b86609a9 | ||
|
|
7dd024a9dc | ||
|
|
65b9accc80 | ||
|
|
584fa31adc | ||
|
|
c0149676fb | ||
|
|
b39305af61 | ||
|
|
6e7271ff7e | ||
|
|
3e07a0e9a3 | ||
|
|
6a16fc3144 | ||
|
|
e53a7c7c00 | ||
|
|
63052c45a1 | ||
|
|
28c5f7026f | ||
|
|
c78be76176 | ||
|
|
73dd132202 | ||
|
|
f6e7cdb8b6 | ||
|
|
54f2c93fec | ||
|
|
ecc00f149f | ||
|
|
791235b15b | ||
|
|
692d648edb | ||
|
|
bbb6aabe41 | ||
|
|
cc302c2f07 | ||
|
|
b6779056f2 | ||
|
|
d7990ca180 | ||
|
|
7cb5a46b66 | ||
|
|
917e95433a | ||
|
|
7db9671420 | ||
|
|
a3d19d7a99 | ||
|
|
f1562543a3 | ||
|
|
bf54b8d709 | ||
|
|
ec83c1303c | ||
|
|
ec1b0f4923 | ||
|
|
be5b02386d | ||
|
|
df8ed0acc3 | ||
|
|
8de0bb5bc3 | ||
|
|
25c7f0017a | ||
|
|
546d9f4ba6 | ||
|
|
434f77e6c1 | ||
|
|
ace7ef4316 | ||
|
|
0e9c0d8c04 | ||
|
|
8f37d42241 | ||
|
|
3d836267ed | ||
|
|
440cdec061 | ||
|
|
4eea6e4974 | ||
|
|
2c6f713d72 | ||
|
|
057437f739 | ||
|
|
b59a7ef2c3 | ||
|
|
069c9a9e1f | ||
|
|
5602efb2b6 | ||
|
|
839590eb90 | ||
|
|
c9d1615b19 | ||
|
|
4597f4ba9e | ||
|
|
2cf774b2b8 | ||
|
|
3029cdb4dd | ||
|
|
6bd6180703 | ||
|
|
cd023b54f5 | ||
|
|
7dfa2b92fb | ||
|
|
8189b01987 | ||
|
|
0c683552ec | ||
|
|
018e2f6a31 | ||
|
|
3c8d971c53 | ||
|
|
258762929f | ||
|
|
01994637e8 | ||
|
|
0810fe54d4 | ||
|
|
d783f134d9 | ||
|
|
bf94f88569 | ||
|
|
47e25dfd57 | ||
|
|
03d83c293f | ||
|
|
46e3ab6353 | ||
|
|
620f3a57dd | ||
|
|
534ad05cf2 | ||
|
|
7c77018b19 | ||
|
|
6696b98ecc |
@@ -2,7 +2,7 @@ version: '3'
|
||||
|
||||
services:
|
||||
buildtools:
|
||||
image: ghcr.io/electron/devcontainer:424eedbf277ad9749ffa9219068aa72ed4a5e373
|
||||
image: ghcr.io/electron/devcontainer:933c7d6ff6802706875270bec2e3c891cf8add3f
|
||||
|
||||
volumes:
|
||||
- ..:/workspaces/gclient/src/electron:cached
|
||||
|
||||
107
.github/actions/build-electron/action.yml
vendored
107
.github/actions/build-electron/action.yml
vendored
@@ -17,9 +17,6 @@ inputs:
|
||||
is-release:
|
||||
description: 'Is release build'
|
||||
required: true
|
||||
strip-binaries:
|
||||
description: 'Strip binaries (Linux only)'
|
||||
required: false
|
||||
generate-symbols:
|
||||
description: 'Generate symbols'
|
||||
required: true
|
||||
@@ -38,6 +35,15 @@ runs:
|
||||
run: |
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"x64\" v8_snapshot_toolchain=\"//build/toolchain/mac:clang_x64\""
|
||||
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
- name: Set GN_EXTRA_ARGS for Windows
|
||||
shell: bash
|
||||
if: ${{inputs.target-arch != 'x64' && inputs.target-platform == 'win' }}
|
||||
run: |
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"${{ inputs.target-arch }}\""
|
||||
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
- name: Add Clang problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json"
|
||||
- name: Build Electron ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -54,22 +60,24 @@ runs:
|
||||
sudo launchctl limit maxfiles 65536 200000
|
||||
fi
|
||||
|
||||
NINJA_SUMMARIZE_BUILD=1 e build -j $NUMBER_OF_NINJA_PROCESSES
|
||||
if [ "${{ inputs.is-release }}" = "true" ]; then
|
||||
NINJA_SUMMARIZE_BUILD=1 e build --target electron:release_build
|
||||
else
|
||||
NINJA_SUMMARIZE_BUILD=1 e build --target electron:testing_build
|
||||
fi
|
||||
cp out/Default/.ninja_log out/electron_ninja_log
|
||||
node electron/script/check-symlinks.js
|
||||
- name: Strip Electron Binaries ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
if: ${{ inputs.strip-binaries == 'true' }}
|
||||
run: |
|
||||
cd src
|
||||
electron/script/copy-debug-symbols.py --target-cpu="${{ inputs.target-arch }}" --out-dir=out/Default/debug --compress
|
||||
electron/script/strip-binaries.py --target-cpu="${{ inputs.target-arch }}" --verbose
|
||||
electron/script/add-debug-link.py --target-cpu="${{ inputs.target-arch }}" --debug-dir=out/Default/debug
|
||||
- name: Build Electron dist.zip ${{ inputs.step-suffix }}
|
||||
|
||||
# Upload build stats to Datadog
|
||||
if ! [ -z $DD_API_KEY ]; then
|
||||
npx node electron/script/build-stats.mjs out/Default/siso.INFO --upload-stats || true
|
||||
else
|
||||
echo "Skipping build-stats.mjs upload because DD_API_KEY is not set"
|
||||
fi
|
||||
- name: Verify dist.zip ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
e build --target electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES -d explain
|
||||
cd src
|
||||
if [ "${{ inputs.is-asan }}" != "true" ]; then
|
||||
target_os=${{ inputs.target-platform == 'macos' && 'mac' || inputs.target-platform }}
|
||||
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
|
||||
@@ -77,11 +85,10 @@ runs:
|
||||
fi
|
||||
electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.${{ inputs.target-arch }}.manifest
|
||||
fi
|
||||
- name: Build Mksnapshot ${{ inputs.step-suffix }}
|
||||
- name: Fixup Mksnapshot ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
e build --target electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
|
||||
ELECTRON_DEPOT_TOOLS_DISABLE_LOG=1 e d gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
||||
# Remove unused args from mksnapshot_args
|
||||
SEDOPTION="-i"
|
||||
@@ -91,20 +98,6 @@ runs:
|
||||
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
|
||||
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
|
||||
|
||||
if [ "${{ inputs.target-platform }}" = "linux" ]; then
|
||||
if [ "${{ inputs.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 [ "${{ inputs.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
|
||||
fi
|
||||
fi
|
||||
|
||||
e build --target electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
cd out/Default
|
||||
powershell Compress-Archive -update mksnapshot_args mksnapshot.zip
|
||||
@@ -138,13 +131,7 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
e build --target electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:electron_chromedriver_zip
|
||||
- name: Build Node.js headers ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
e build --target electron:node_headers
|
||||
- name: Create installed_software.json ${{ inputs.step-suffix }}
|
||||
shell: powershell
|
||||
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
|
||||
@@ -164,17 +151,11 @@ runs:
|
||||
# Needed for msdia140.dll on 64-bit windows
|
||||
cd src
|
||||
export PATH="$PATH:$(pwd)/third_party/llvm-build/Release+Asserts/bin"
|
||||
- name: Generate & Zip Symbols ${{ inputs.step-suffix }}
|
||||
- name: Zip Symbols ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
# Generate breakpad symbols on release builds
|
||||
if [ "${{ inputs.generate-symbols }}" = "true" ]; then
|
||||
e build --target electron:electron_symbols
|
||||
fi
|
||||
cd src
|
||||
export BUILD_PATH="$(pwd)/out/Default"
|
||||
e build --target electron:licenses
|
||||
e build --target electron:electron_version_file
|
||||
if [ "${{ inputs.is-release }}" = "true" ]; then
|
||||
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
|
||||
else
|
||||
@@ -185,20 +166,11 @@ runs:
|
||||
if: ${{ inputs.is-release == 'true' }}
|
||||
run: |
|
||||
cd src
|
||||
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS"
|
||||
e build --target electron:electron_ffmpeg_zip -C ../../out/ffmpeg -j $NUMBER_OF_NINJA_PROCESSES
|
||||
- name: Generate Hunspell Dictionaries ${{ inputs.step-suffix }}
|
||||
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true use_siso=true $GN_EXTRA_ARGS"
|
||||
e build --target electron:electron_ffmpeg_zip -C ../../out/ffmpeg
|
||||
- name: Remove Clang problem matcher
|
||||
shell: bash
|
||||
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
|
||||
run: |
|
||||
e build --target electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
- name: Generate Libcxx ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
|
||||
run: |
|
||||
e build --target electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
run: echo "::remove-matcher owner=clang::"
|
||||
- name: Generate TypeScript Definitions ${{ inputs.step-suffix }}
|
||||
if: ${{ inputs.is-release == 'true' }}
|
||||
shell: bash
|
||||
@@ -218,7 +190,26 @@ runs:
|
||||
echo 'Uploading Electron release distribution to GitHub releases'
|
||||
script/release/uploaders/upload.py --verbose
|
||||
fi
|
||||
- name: Generate siso report
|
||||
if: ${{ inputs.target-platform != 'win' && !cancelled() }}
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
e d siso report -C out/Default > siso_report.txt
|
||||
SISO_REPORT_PATH=$(grep -o '/.*siso-report-[^ ]*' siso_report.txt)
|
||||
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH" >> $GITHUB_ENV
|
||||
- name: Generate siso report (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' && !cancelled() }}
|
||||
shell: powershell
|
||||
run: |
|
||||
cd src
|
||||
e d siso report -C out\Default > siso_report.txt
|
||||
$SISO_REPORT_PATH = Get-Content "siso_report.txt" | Select-String "report file:\s*(.+)" | ForEach-Object {
|
||||
$_.Matches.Groups[1].Value.Trim()
|
||||
}
|
||||
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH" >> $env:GITHUB_ENV
|
||||
- name: Generate Artifact Key
|
||||
if: always() && !cancelled()
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ inputs.is-asan }}" = "true" ]; then
|
||||
@@ -230,9 +221,11 @@ runs:
|
||||
# The current generated_artifacts_<< artifact.key >> name was taken from CircleCI
|
||||
# to ensure we don't break anything, but we may be able to improve that.
|
||||
- name: Move all Generated Artifacts to Upload Folder ${{ inputs.step-suffix }}
|
||||
if: always() && !cancelled()
|
||||
shell: bash
|
||||
run: ./src/electron/script/actions/move-artifacts.sh
|
||||
- name: Upload Generated Artifacts ${{ inputs.step-suffix }}
|
||||
if: always() && !cancelled()
|
||||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
|
||||
with:
|
||||
name: generated_artifacts_${{ env.ARTIFACT_KEY }}
|
||||
|
||||
83
.github/actions/build-git-cache/action.yml
vendored
Normal file
83
.github/actions/build-git-cache/action.yml
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
name: 'Build Git Cache'
|
||||
description: 'Runs a gclient sync to build the git cache for Electron'
|
||||
inputs:
|
||||
target-platform:
|
||||
description: 'Target platform, should be linux, win, macos'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set GIT_CACHE_PATH to make gclient to use the cache
|
||||
shell: bash
|
||||
run: |
|
||||
echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
|
||||
- name: Set Chromium Git Cookie
|
||||
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||
- name: Install Build Tools
|
||||
uses: ./src/electron/.github/actions/install-build-tools
|
||||
- name: Set up cache drive
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
echo "CACHE_DRIVE=/mnt/win-cache" >> $GITHUB_ENV
|
||||
else
|
||||
echo "CACHE_DRIVE=/mnt/cross-instance-cache" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Check cross instance cache disk space
|
||||
shell: bash
|
||||
run: |
|
||||
# if there is less than 35 GB free space then creating the cache might fail so exit early
|
||||
freespace=`df -m $CACHE_DRIVE | grep -w $CACHE_DRIVE | awk '{print $4}'`
|
||||
freespace_human=`df -h $CACHE_DRIVE | grep -w $CACHE_DRIVE | awk '{print $4}'`
|
||||
if [ $freespace -le 35000 ]; then
|
||||
echo "The cross mount cache has $freespace_human free space which is not enough - exiting"
|
||||
exit 1
|
||||
else
|
||||
echo "The cross mount cache has $freespace_human free space - continuing"
|
||||
fi
|
||||
- name: Restore gitcache
|
||||
shell: bash
|
||||
run: |
|
||||
GIT_CACHE_TAR="$CACHE_DRIVE/gitcache.tar"
|
||||
if [ ! -f "$GIT_CACHE_TAR" ]; then
|
||||
echo "Git cache tar file does not exist, skipping restore"
|
||||
exit 0
|
||||
fi
|
||||
echo "Restoring git cache from $GIT_CACHE_TAR to $GIT_CACHE_PATH"
|
||||
mkdir -p $GIT_CACHE_PATH
|
||||
tar -xf $GIT_CACHE_TAR -C $GIT_CACHE_PATH
|
||||
- name: Gclient Sync
|
||||
shell: bash
|
||||
run: |
|
||||
e d gclient config \
|
||||
--name "src/electron" \
|
||||
--unmanaged \
|
||||
${GCLIENT_EXTRA_ARGS} \
|
||||
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
|
||||
|
||||
if [ "$TARGET_OS" != "" ]; then
|
||||
echo "target_os=['$TARGET_OS']" >> ./.gclient
|
||||
fi
|
||||
|
||||
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 e d gclient sync --with_branch_heads --with_tags --nohooks -vv
|
||||
- name: Compress Git Cache Directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Uncompressed gitcache size: $(du -sh $GIT_CACHE_PATH | cut -f1 -d' ')"
|
||||
cd $GIT_CACHE_PATH
|
||||
tar -cf ../gitcache.tar .
|
||||
cd ..
|
||||
echo "Compressed gitcache to $(du -sh gitcache.tar | cut -f1 -d' ')"
|
||||
# remove the old cache file if it exists
|
||||
if [ -f $CACHE_DRIVE/gitcache.tar ]; then
|
||||
echo "Removing old gitcache.tar from $CACHE_DRIVE"
|
||||
rm $CACHE_DRIVE/gitcache.tar
|
||||
fi
|
||||
cp ./gitcache.tar $CACHE_DRIVE/
|
||||
- name: Wait for active SSH sessions
|
||||
shell: bash
|
||||
if: always() && !cancelled()
|
||||
run: |
|
||||
while [ -f /var/.ssh-lock ]
|
||||
do
|
||||
sleep 60
|
||||
done
|
||||
37
.github/actions/checkout/action.yml
vendored
37
.github/actions/checkout/action.yml
vendored
@@ -40,10 +40,10 @@ runs:
|
||||
if: ${{ inputs.generate-sas-token == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$CACHE_FILE?platform=${{ inputs.target-platform }}" > sas-token
|
||||
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$CACHE_FILE?platform=${{ inputs.target-platform }}&getAccountName=true" > sas-token
|
||||
- name: Save SAS Key
|
||||
if: ${{ inputs.generate-sas-token == 'true' }}
|
||||
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf
|
||||
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
with:
|
||||
path: sas-token
|
||||
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
|
||||
@@ -80,6 +80,21 @@ runs:
|
||||
else
|
||||
echo "The cross mount cache has $freespace_human free space - continuing"
|
||||
fi
|
||||
- name: Add patch conflict problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/patch-conflict.json"
|
||||
- name: Restore gitcache
|
||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
||||
shell: bash
|
||||
run: |
|
||||
GIT_CACHE_TAR="$CACHE_DRIVE/gitcache.tar"
|
||||
if [ ! -f "$GIT_CACHE_TAR" ]; then
|
||||
echo "Git cache tar file does not exist, skipping restore"
|
||||
exit 0
|
||||
fi
|
||||
echo "Restoring git cache from $GIT_CACHE_TAR to $GIT_CACHE_PATH"
|
||||
mkdir -p $GIT_CACHE_PATH
|
||||
tar -xf $GIT_CACHE_TAR -C $GIT_CACHE_PATH
|
||||
- name: Gclient Sync
|
||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
||||
shell: bash
|
||||
@@ -102,12 +117,7 @@ runs:
|
||||
git update-index --refresh || true
|
||||
if ! git diff-index --quiet HEAD --; then
|
||||
# There are changes to the patches. Make a git commit with the updated patches
|
||||
git add patches
|
||||
GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
|
||||
# Export it
|
||||
mkdir -p ../../patches
|
||||
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
|
||||
if node ./script/push-patch.js; then
|
||||
if node ./script/patch-up.js; then
|
||||
echo
|
||||
echo "======================================================================"
|
||||
echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch"
|
||||
@@ -115,6 +125,11 @@ runs:
|
||||
echo "======================================================================"
|
||||
exit 1
|
||||
else
|
||||
git add patches
|
||||
GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
|
||||
# Export it
|
||||
mkdir -p ../../patches
|
||||
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
|
||||
echo
|
||||
echo "======================================================================"
|
||||
echo "There were changes to the patches when applying."
|
||||
@@ -128,7 +143,11 @@ runs:
|
||||
echo "No changes to patches detected"
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Remove patch conflict problem matcher
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::remove-matcher owner=merge-conflict::"
|
||||
echo "::remove-matcher owner=patch-conflict::"
|
||||
# delete all .git directories under src/ except for
|
||||
# third_party/angle/ and third_party/dawn/ because of build time generation of files
|
||||
# gen/angle/commit.h depends on third_party/angle/.git/HEAD
|
||||
|
||||
17
.github/actions/cipd-install/action.yml
vendored
17
.github/actions/cipd-install/action.yml
vendored
@@ -14,6 +14,9 @@ inputs:
|
||||
description: 'Target platform, should be linux, win, macos'
|
||||
package:
|
||||
description: 'Package to install'
|
||||
dependency-version:
|
||||
description: 'Version of the dependency to install'
|
||||
default: ''
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
@@ -22,15 +25,23 @@ runs:
|
||||
run : |
|
||||
rm -rf ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }}
|
||||
- name: Create ensure file for ${{ inputs.dependency }}
|
||||
if: ${{ inputs.dependency-version == '' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo '${{ inputs.package }}' `e d gclient getdep --deps-file=${{ inputs.deps-file }} -r '${{ inputs.installation-dir }}:${{ inputs.package }}'` > ${{ inputs.dependency }}_ensure_file
|
||||
cat ${{ inputs.dependency }}_ensure_file
|
||||
- name: CIPD installation of ${{ inputs.dependency }} (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
|
||||
- name: Create ensure file for ${{ inputs.dependency }} from dependency-version
|
||||
if: ${{ inputs.dependency-version != '' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "ensuring ${{ inputs.dependency }} on macOS"
|
||||
echo '${{ inputs.package }} ${{ inputs.dependency-version }}' > ${{ inputs.dependency }}_ensure_file
|
||||
cat ${{ inputs.dependency }}_ensure_file
|
||||
- name: CIPD installation of ${{ inputs.dependency }} (macOS)
|
||||
if: ${{ inputs.target-platform != 'win' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "ensuring ${{ inputs.dependency }}"
|
||||
e d cipd ensure --root ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }} -ensure-file ${{ inputs.dependency }}_ensure_file
|
||||
- name: CIPD installation of ${{ inputs.dependency }} (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
|
||||
16
.github/actions/fix-sync/action.yml
vendored
16
.github/actions/fix-sync/action.yml
vendored
@@ -20,11 +20,13 @@ runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Fix clang
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
shell: bash
|
||||
run : |
|
||||
rm -rf src/third_party/llvm-build
|
||||
python3 src/tools/clang/scripts/update.py
|
||||
- name: Fix esbuild
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
uses: ./src/electron/.github/actions/cipd-install
|
||||
with:
|
||||
cipd-root-prefix-path: src/third_party/devtools-frontend/src/
|
||||
@@ -34,6 +36,7 @@ runs:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
package: infra/3pp/tools/esbuild/${platform}
|
||||
- name: Fix rustc
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
shell: bash
|
||||
run : |
|
||||
rm -rf src/third_party/rust-toolchain
|
||||
@@ -57,6 +60,7 @@ runs:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
package: gn/gn/windows-amd64
|
||||
- name: Fix reclient
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
uses: ./src/electron/.github/actions/cipd-install
|
||||
with:
|
||||
dependency: reclient
|
||||
@@ -65,6 +69,7 @@ runs:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
package: infra/rbe/client/${platform}
|
||||
- name: Configure reclient configs
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
shell: bash
|
||||
run : |
|
||||
python3 src/buildtools/reclient_cfgs/configure_reclient_cfgs.py --rbe_instance "projects/rbe-chrome-untrusted/instances/default_instance" --reproxy_cfg_template reproxy.cfg.template --rewrapper_cfg_project "" --skip_remoteexec_cfg_fetch
|
||||
@@ -82,6 +87,7 @@ runs:
|
||||
python3 src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang -s $DSYM_SHA_FILE -o src/tools/clang/dsymutil/bin/dsymutil
|
||||
fi
|
||||
- name: Fix ninja
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
uses: ./src/electron/.github/actions/cipd-install
|
||||
with:
|
||||
dependency: ninja
|
||||
@@ -90,10 +96,20 @@ runs:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
package: infra/3pp/tools/ninja/${platform}
|
||||
- name: Set ninja in path
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
shell: bash
|
||||
run : |
|
||||
echo "$(pwd)/src/third_party/ninja" >> $GITHUB_PATH
|
||||
- name: Fix siso
|
||||
uses: ./src/electron/.github/actions/cipd-install
|
||||
with:
|
||||
dependency: siso
|
||||
deps-file: src/DEPS
|
||||
installation-dir: src/third_party/siso/cipd
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
package: infra/build/siso/${platform}
|
||||
- name: Fixup angle git
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
shell: bash
|
||||
run : |
|
||||
cd src/third_party/angle
|
||||
|
||||
5
.github/actions/free-space-macos/action.yml
vendored
5
.github/actions/free-space-macos/action.yml
vendored
@@ -6,6 +6,8 @@ runs:
|
||||
- name: Free Space on MacOS
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Disk usage before cleanup:"
|
||||
df -h
|
||||
sudo mkdir -p $TMPDIR/del-target
|
||||
|
||||
tmpify() {
|
||||
@@ -62,4 +64,5 @@ runs:
|
||||
|
||||
# lipo off some huge binaries arm64 versions to save space
|
||||
strip_universal_deep $(xcode-select -p)/../SharedFrameworks
|
||||
# strip_arm_deep /System/Volumes/Data/Library/Developer/CommandLineTools/usr
|
||||
# strip_arm_deep /System/Volumes/Data/Library/Developer/CommandLineTools/usr
|
||||
sudo mdutil -a -i off
|
||||
|
||||
15
.github/actions/install-build-tools/action.yml
vendored
15
.github/actions/install-build-tools/action.yml
vendored
@@ -11,15 +11,22 @@ runs:
|
||||
git config --global core.autocrlf false
|
||||
git config --global branch.autosetuprebase always
|
||||
git config --global core.fscache true
|
||||
git config --global core.longpaths true
|
||||
git config --global core.preloadindex true
|
||||
git config --global core.longpaths true
|
||||
fi
|
||||
export BUILD_TOOLS_SHA=6e8526315ea3b4828882497e532b8340e64e053c
|
||||
export BUILD_TOOLS_SHA=706147b2376f55078f718576b28129a0457f1795
|
||||
npm i -g @electron/build-tools
|
||||
# Update depot_tools to ensure python
|
||||
e d update_depot_tools
|
||||
e auto-update disable
|
||||
# Disable further updates of depot_tools
|
||||
e d auto-update disable
|
||||
if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then
|
||||
e d cipd.bat --version
|
||||
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
|
||||
fi
|
||||
echo "$HOME/.electron_build_tools/third_party/depot_tools" >> $GITHUB_PATH
|
||||
echo "$HOME/.electron_build_tools/third_party/depot_tools/python-bin" >> $GITHUB_PATH
|
||||
echo "C:\Users\ContainerAdministrator\.electron_build_tools\third_party\depot_tools" >> $GITHUB_PATH
|
||||
else
|
||||
echo "$HOME/.electron_build_tools/third_party/depot_tools" >> $GITHUB_PATH
|
||||
echo "$HOME/.electron_build_tools/third_party/depot_tools/python-bin" >> $GITHUB_PATH
|
||||
fi
|
||||
@@ -7,7 +7,7 @@ runs:
|
||||
shell: bash
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(node src/electron/script/yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
|
||||
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
19
.github/actions/restore-cache-azcopy/action.yml
vendored
19
.github/actions/restore-cache-azcopy/action.yml
vendored
@@ -8,14 +8,14 @@ runs:
|
||||
steps:
|
||||
- name: Obtain SAS Key
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
|
||||
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
with:
|
||||
path: sas-token
|
||||
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-1
|
||||
enableCrossOsArchive: true
|
||||
- name: Obtain SAS Key
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
|
||||
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
with:
|
||||
path: sas-token
|
||||
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
|
||||
@@ -32,22 +32,23 @@ runs:
|
||||
shell: bash
|
||||
command: |
|
||||
sas_token=$(cat sas-token)
|
||||
if [ -z $sas-token ]; then
|
||||
if [ -z "$sas_token" ]; then
|
||||
echo "SAS Token not found; exiting src cache download early..."
|
||||
exit 1
|
||||
else
|
||||
sas_token=$(jq -r '.sasToken' sas-token)
|
||||
account_name=$(jq -r '.accountName' sas-token)
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
azcopy copy --log-level=ERROR \
|
||||
"https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_WIN_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
|
||||
"https://$account_name.file.core.windows.net/${{ env.AZURE_AKS_WIN_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
|
||||
else
|
||||
azcopy copy --log-level=ERROR \
|
||||
"https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
|
||||
"https://$account_name.file.core.windows.net/${{ env.AZURE_AKS_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
|
||||
fi
|
||||
fi
|
||||
env:
|
||||
AZURE_AKS_CACHE_STORAGE_ACCOUNT: f723719aa87a34622b5f7f3
|
||||
AZURE_AKS_CACHE_SHARE_NAME: pvc-f6a4089f-b082-4bee-a3f9-c3e1c0c02d8f
|
||||
AZURE_AKS_WIN_CACHE_SHARE_NAME: pvc-71dec4f2-0d44-4fd1-a2c3-add049d70bdf
|
||||
AZURE_AKS_CACHE_SHARE_NAME: linux-cache
|
||||
AZURE_AKS_WIN_CACHE_SHARE_NAME: windows-cache
|
||||
- name: Clean SAS Key
|
||||
shell: bash
|
||||
run: rm -f sas-token
|
||||
@@ -96,7 +97,7 @@ runs:
|
||||
|
||||
$TEMP_DIR=New-Item -ItemType Directory -Path temp-cache
|
||||
$TEMP_DIR_PATH = $TEMP_DIR.FullName
|
||||
C:\ProgramData\Chocolatey\bin\7z.exe -y x $src_cache -o"$TEMP_DIR_PATH"
|
||||
C:\ProgramData\Chocolatey\bin\7z.exe -y -snld20 x $src_cache -o"$TEMP_DIR_PATH"
|
||||
|
||||
- name: Move Src Cache (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
|
||||
20
.github/actions/ssh-debug/action.yml
vendored
Normal file
20
.github/actions/ssh-debug/action.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: Debug via SSH
|
||||
description: Setup a SSH server with a tunnel to access it to debug via SSH.
|
||||
inputs:
|
||||
tunnel:
|
||||
description: 'Enable SSH tunneling via cloudflared'
|
||||
required: true
|
||||
default: 'false'
|
||||
timeout:
|
||||
description: 'SSH session timeout in seconds'
|
||||
required: false
|
||||
type: number
|
||||
default: 3600
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- run: $GITHUB_ACTION_PATH/setup-ssh.sh
|
||||
shell: bash
|
||||
env:
|
||||
TUNNEL: ${{ inputs.tunnel }}
|
||||
TIMEOUT: ${{ inputs.timeout }}
|
||||
4
.github/actions/ssh-debug/bashrc
vendored
Normal file
4
.github/actions/ssh-debug/bashrc
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# If we're in an interactive SSH session and we're not already in tmux and there's no explicit SSH command, auto attach tmux
|
||||
if [ -n "$SSH_TTY" ] && [ -z "$TMUX" ] && [ -z "$SSH_ORIGINAL_COMMAND" ]; then
|
||||
exec tmux attach || exec tmux
|
||||
fi
|
||||
146
.github/actions/ssh-debug/setup-ssh.sh
vendored
Executable file
146
.github/actions/ssh-debug/setup-ssh.sh
vendored
Executable file
@@ -0,0 +1,146 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if [ "${TUNNEL}" != "true" ]; then
|
||||
echo "SSH tunneling is disabled. Set enable-tunnel: true to enable remote access."
|
||||
echo "Local SSH server would be available on localhost:2222 if this were a local environment."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo ::group::Configuring Tunnel
|
||||
|
||||
echo "SSH tunneling enabled. Setting up remote access..."
|
||||
|
||||
EXTERNAL_DEPS="curl jq ssh-keygen"
|
||||
|
||||
for dep in $EXTERNAL_DEPS; do
|
||||
if ! command -v "${dep}" > /dev/null 2>&1; then
|
||||
echo "Command ${dep} not installed on the system!" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
cd "$GITHUB_ACTION_PATH"
|
||||
|
||||
bashrc_path=$(pwd)/bashrc
|
||||
|
||||
# Source `bashrc` to auto start tmux on SSH login.
|
||||
if ! grep -q "${bashrc_path}" ~/.bash_profile; then
|
||||
echo >> ~/.bash_profile # On macOS runner there's no newline at the end of the file
|
||||
echo "source \"${bashrc_path}\"" >> ~/.bash_profile
|
||||
fi
|
||||
|
||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
ARCH=$(uname -m)
|
||||
|
||||
if [ "${ARCH}" = "x86_64" ]; then
|
||||
ARCH="amd64"
|
||||
elif [ "${ARCH}" = "aarch64" ]; then
|
||||
ARCH="arm64"
|
||||
fi
|
||||
|
||||
if [ "${OS}" = "darwin" ] && ! command -v tmux > /dev/null 2>&1; then
|
||||
echo "Installing tmux..."
|
||||
brew install tmux
|
||||
fi
|
||||
|
||||
if [ "$OS" = "darwin" ]; then
|
||||
cloudflared_url="https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-${OS}-${ARCH}.tgz"
|
||||
echo "Downloading \`cloudflared\` from <$cloudflared_url>..."
|
||||
curl --location --silent --output cloudflared.tgz "${cloudflared_url}"
|
||||
tar xf cloudflared.tgz
|
||||
rm cloudflared.tgz
|
||||
fi
|
||||
|
||||
chmod +x cloudflared
|
||||
|
||||
echo 'Creating SSH server key...'
|
||||
ssh-keygen -q -f ssh_host_rsa_key -N ''
|
||||
|
||||
echo 'Creating SSH server config...'
|
||||
sed "s,\$PWD,${PWD},;s,\$USER,${USER}," sshd_config.template > sshd_config
|
||||
|
||||
echo 'Starting SSH server...'
|
||||
sudo /usr/sbin/sshd -f sshd_config -D &
|
||||
sshd_pid=$!
|
||||
|
||||
echo "SSH server started successfully (PID: ${sshd_pid})"
|
||||
|
||||
echo 'Starting tmux session...'
|
||||
(cd "${GITHUB_WORKSPACE}" && tmux new-session -d -s debug)
|
||||
|
||||
mkdir ~/.cloudflared
|
||||
CLEAN_TUNNEL_CERT=$(printf '%s\n' "${CLOUDFLARE_TUNNEL_CERT}" | tr -d '\r' | sed '/^[[:space:]]*$/d')
|
||||
|
||||
echo "${CLEAN_TUNNEL_CERT}" > ~/.cloudflared/cert.pem
|
||||
|
||||
CLEAN_USER_CA_CERT=$(printf '%s\n' "${CLOUDFLARE_USER_CA_CERT}" | tr -d '\r' | sed '/^[[:space:]]*$/d')
|
||||
|
||||
echo "${CLEAN_USER_CA_CERT}" | sudo tee /etc/ssh/ca.pub > /dev/null
|
||||
sudo chmod 644 /etc/ssh/ca.pub
|
||||
|
||||
random_suffix=$(openssl rand -hex 5 | cut -c1-10)
|
||||
tunnel_name="${GITHUB_SHA}-${GITHUB_RUN_ID}-${random_suffix}"
|
||||
tunnel_url="${tunnel_name}.${CLOUDFLARE_TUNNEL_HOSTNAME}"
|
||||
|
||||
if ./cloudflared tunnel list | grep -q "${tunnel_name}"; then
|
||||
echo "Deleting existing tunnel: ${tunnel_name}"
|
||||
./cloudflared tunnel delete ${tunnel_name}
|
||||
fi
|
||||
|
||||
echo "Creating new cloudflare tunnel: ${tunnel_name}"
|
||||
./cloudflared tunnel create ${tunnel_name}
|
||||
|
||||
credentials_file=$(find ~/.cloudflared -name "*.json" | head -n 1)
|
||||
if [ -z "${credentials_file}" ]; then
|
||||
echo "Error: Could not find tunnel credentials file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Found credentials file: ${credentials_file}"
|
||||
|
||||
echo 'Creating tunnel configuration...'
|
||||
cat > tunnel_config.yml << EOF
|
||||
tunnel: ${tunnel_name}
|
||||
credentials-file: ${credentials_file}
|
||||
|
||||
ingress:
|
||||
- hostname: ${tunnel_url}
|
||||
service: ssh://localhost:2222
|
||||
- service: http_status:404
|
||||
EOF
|
||||
|
||||
echo 'Setting up DNS routing for tunnel...'
|
||||
./cloudflared tunnel route dns ${tunnel_name} ${tunnel_url}
|
||||
|
||||
echo 'Running cloudflare tunnel...'
|
||||
./cloudflared tunnel --no-autoupdate --config tunnel_config.yml run 2>&1 | tee cloudflared.log | sed -u 's/^/cloudflared: /' &
|
||||
cloudflared_pid=$!
|
||||
|
||||
echo ::endgroup::
|
||||
|
||||
echo ::notice title=SSH Debug Session Ready::ssh ${tunnel_url}
|
||||
|
||||
|
||||
(
|
||||
echo ' '
|
||||
echo ' '
|
||||
echo '🔗 SSH Debug Session Ready!'
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo ' '
|
||||
echo '📋 Infra WG can copy and run this command to connect:'
|
||||
echo ' '
|
||||
echo "ssh ${tunnel_url}"
|
||||
echo ' '
|
||||
echo "⏰ Session expires automatically in ${TIMEOUT} seconds"
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo ' '
|
||||
echo ' '
|
||||
) | cat
|
||||
|
||||
echo ::group::Starting Background Session
|
||||
echo 'Starting SSH session in background...'
|
||||
./ssh-session.sh "${sshd_pid}" "${cloudflared_pid}" "${TIMEOUT}" "${tunnel_name}" &
|
||||
|
||||
echo 'SSH session is running in background. GitHub Action will continue.'
|
||||
echo 'Session will auto-cleanup after timeout or when processes end.'
|
||||
echo ::endgroup::
|
||||
52
.github/actions/ssh-debug/ssh-session.sh
vendored
Executable file
52
.github/actions/ssh-debug/ssh-session.sh
vendored
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
SSHD_PID=$1
|
||||
CLOUDFLARED_PID=$2
|
||||
SESSION_TIMEOUT=${3:-10000}
|
||||
TUNNEL_NAME=$4
|
||||
|
||||
cleanup() {
|
||||
# Kill processes.
|
||||
for pid in "$SLEEP_PID" "$SSHD_PID" "$CLOUDFLARED_PID"; do
|
||||
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
|
||||
kill "$pid" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
|
||||
# Clean up tunnel.
|
||||
if [ -n "$TUNNEL_NAME" ]; then
|
||||
cd "$GITHUB_ACTION_PATH"
|
||||
./cloudflared tunnel delete "$TUNNEL_NAME" 2>/dev/null || {
|
||||
echo "Failed to delete tunnel"
|
||||
}
|
||||
fi
|
||||
|
||||
echo "Session ended at $(date)"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Trap signals to ensure cleanup.
|
||||
trap cleanup SIGTERM SIGINT SIGQUIT SIGHUP EXIT
|
||||
|
||||
# Wait for timeout or until processes die.
|
||||
sleep "$SESSION_TIMEOUT" &
|
||||
SLEEP_PID=$!
|
||||
|
||||
# Monitor processes
|
||||
while kill -0 "$SLEEP_PID" 2>/dev/null; do
|
||||
# Check SSH daemon.
|
||||
if ! kill -0 "$SSHD_PID" 2>/dev/null; then
|
||||
echo "SSH daemon died at $(date)"
|
||||
break
|
||||
fi
|
||||
|
||||
# Check cloudflared,
|
||||
if ! kill -0 "$CLOUDFLARED_PID" 2>/dev/null; then
|
||||
echo "Cloudflared died at $(date)"
|
||||
break
|
||||
fi
|
||||
|
||||
sleep 10
|
||||
done
|
||||
|
||||
cleanup
|
||||
25
.github/actions/ssh-debug/sshd_config.template
vendored
Normal file
25
.github/actions/ssh-debug/sshd_config.template
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
Port 2222
|
||||
HostKey $PWD/ssh_host_rsa_key
|
||||
PidFile $PWD/sshd.pid
|
||||
|
||||
# Connection settings
|
||||
ClientAliveInterval 30
|
||||
ClientAliveCountMax 10
|
||||
MaxStartups 10
|
||||
LoginGraceTime 120
|
||||
|
||||
# Allow TCP forwarding for tunneling
|
||||
AllowTcpForwarding yes
|
||||
|
||||
# Try to prevent timeouts
|
||||
TCPKeepAlive yes
|
||||
|
||||
# Security
|
||||
TrustedUserCAKeys /etc/ssh/ca.pub
|
||||
PubkeyAuthentication yes
|
||||
PasswordAuthentication no
|
||||
|
||||
AuthorizedPrincipalsCommand /bin/bash -c "echo '%t %k' | ssh-keygen -L -f - | grep -A1 Principals"
|
||||
AuthorizedPrincipalsCommandUser nobody
|
||||
|
||||
PubkeyAcceptedKeyTypes ssh-rsa,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com
|
||||
18
.github/problem-matchers/clang.json
vendored
Normal file
18
.github/problem-matchers/clang.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "clang",
|
||||
"fromPath": "src/out/Default/args.gn",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(.+)[(:](\\d+)[:,](\\d+)\\)?:\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
22
.github/problem-matchers/eslint-stylish.json
vendored
Normal file
22
.github/problem-matchers/eslint-stylish.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "eslint-stylish",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^\\s*([^\\s].*)$",
|
||||
"file": 1
|
||||
},
|
||||
{
|
||||
"regexp": "^\\s+(\\d+):(\\d+)\\s+(error|warning|info)\\s+(.*)\\s\\s+(.*)$",
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"severity": 3,
|
||||
"message": 4,
|
||||
"code": 5,
|
||||
"loop": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
24
.github/problem-matchers/patch-conflict.json
vendored
Normal file
24
.github/problem-matchers/patch-conflict.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "merge-conflict",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^CONFLICT\\s\\(\\S+\\): (Merge conflict in \\S+)$",
|
||||
"message": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "patch-conflict",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^error: (patch failed: (\\S+):(\\d+))$",
|
||||
"message": 1,
|
||||
"file": 2,
|
||||
"line": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
2
.github/workflows/archaeologist-dig.yml
vendored
2
.github/workflows/archaeologist-dig.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
- name: Setup Node.js/npm
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: 20.11.x
|
||||
node-version: 20.19.x
|
||||
- name: Setting Up Dig Site
|
||||
run: |
|
||||
echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}"
|
||||
|
||||
74
.github/workflows/build-git-cache.yml
vendored
Normal file
74
.github/workflows/build-git-cache.yml
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
name: Build Git Cache
|
||||
# This workflow updates git cache on the cross-instance cache volumes
|
||||
# It runs daily at midnight.
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
jobs:
|
||||
build-git-cache-linux:
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
container:
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
- name: Build Git Cache
|
||||
uses: ./src/electron/.github/actions/build-git-cache
|
||||
with:
|
||||
target-platform: linux
|
||||
|
||||
build-git-cache-windows:
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
container:
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||
volumes:
|
||||
- /mnt/win-cache:/mnt/win-cache
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
|
||||
TARGET_OS: 'win'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
- name: Build Git Cache
|
||||
uses: ./src/electron/.github/actions/build-git-cache
|
||||
with:
|
||||
target-platform: win
|
||||
|
||||
build-git-cache-macos:
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
# This job updates the same git cache as linux, so it needs to run after the linux one.
|
||||
needs: build-git-cache-linux
|
||||
container:
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
- name: Build Git Cache
|
||||
uses: ./src/electron/.github/actions/build-git-cache
|
||||
with:
|
||||
target-platform: macos
|
||||
58
.github/workflows/build.yml
vendored
58
.github/workflows/build.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
|
||||
default: '933c7d6ff6802706875270bec2e3c891cf8add3f'
|
||||
required: true
|
||||
skip-macos:
|
||||
type: boolean
|
||||
@@ -28,6 +28,11 @@ on:
|
||||
description: 'Skip lint check'
|
||||
default: false
|
||||
required: false
|
||||
enable-ssh:
|
||||
description: 'Enable SSH debugging'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
@@ -64,7 +69,7 @@ jobs:
|
||||
id: set-output
|
||||
run: |
|
||||
if [ -z "${{ inputs.build-image-sha }}" ]; then
|
||||
echo "build-image-sha=424eedbf277ad9749ffa9219068aa72ed4a5e373" >> "$GITHUB_OUTPUT"
|
||||
echo "build-image-sha=933c7d6ff6802706875270bec2e3c891cf8add3f" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
@@ -81,18 +86,18 @@ jobs:
|
||||
|
||||
# Docs Only Jobs
|
||||
docs-only:
|
||||
needs: setup
|
||||
needs: [setup, checkout-linux]
|
||||
if: ${{ needs.setup.outputs.docs-only == 'true' }}
|
||||
uses: ./.github/workflows/pipeline-electron-docs-only.yml
|
||||
with:
|
||||
container: '{"image":"ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}","options":"--user root"}'
|
||||
container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
secrets: inherit
|
||||
|
||||
# Checkout Jobs
|
||||
checkout-macos:
|
||||
needs: setup
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-macos}}
|
||||
runs-on: electron-arc-linux-amd64-32core
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
options: --user root
|
||||
@@ -119,8 +124,8 @@ jobs:
|
||||
|
||||
checkout-linux:
|
||||
needs: setup
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-linux}}
|
||||
runs-on: electron-arc-linux-amd64-32core
|
||||
if: ${{ !inputs.skip-linux}}
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
options: --user root
|
||||
@@ -128,7 +133,7 @@ jobs:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
- /var/run/sas:/var/run/sas
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
PATCH_UP_APP_CREDS: ${{ secrets.PATCH_UP_APP_CREDS }}
|
||||
outputs:
|
||||
@@ -146,7 +151,7 @@ jobs:
|
||||
checkout-windows:
|
||||
needs: setup
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
runs-on: electron-arc-linux-amd64-32core
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||
@@ -188,10 +193,11 @@ jobs:
|
||||
linux-gn-check:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
|
||||
needs: checkout-linux
|
||||
if: ${{ needs.setup.outputs.src == 'true' }}
|
||||
with:
|
||||
target-platform: linux
|
||||
target-archs: x64 arm arm64
|
||||
check-runs-on: electron-arc-linux-amd64-8core
|
||||
check-runs-on: electron-arc-centralus-linux-amd64-8core
|
||||
check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
gn-build-type: testing
|
||||
secrets: inherit
|
||||
@@ -202,7 +208,7 @@ jobs:
|
||||
with:
|
||||
target-platform: win
|
||||
target-archs: x64 x86 arm64
|
||||
check-runs-on: electron-arc-linux-amd64-8core
|
||||
check-runs-on: electron-arc-centralus-linux-amd64-8core
|
||||
check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
|
||||
gn-build-type: testing
|
||||
secrets: inherit
|
||||
@@ -224,6 +230,7 @@ jobs:
|
||||
gn-build-type: testing
|
||||
generate-symbols: false
|
||||
upload-to-storage: '0'
|
||||
enable-ssh: ${{ inputs.enable-ssh || false }}
|
||||
secrets: inherit
|
||||
|
||||
macos-arm64:
|
||||
@@ -242,6 +249,7 @@ jobs:
|
||||
gn-build-type: testing
|
||||
generate-symbols: false
|
||||
upload-to-storage: '0'
|
||||
enable-ssh: ${{ inputs.enable-ssh || false }}
|
||||
secrets: inherit
|
||||
|
||||
linux-x64:
|
||||
@@ -251,9 +259,10 @@ jobs:
|
||||
pull-requests: read
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-test-and-nan.yml
|
||||
needs: checkout-linux
|
||||
if: ${{ needs.setup.outputs.src == 'true' }}
|
||||
with:
|
||||
build-runs-on: electron-arc-linux-amd64-32core
|
||||
test-runs-on: electron-arc-linux-amd64-4core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
test-runs-on: electron-arc-centralus-linux-amd64-4core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
|
||||
target-platform: linux
|
||||
@@ -271,9 +280,10 @@ jobs:
|
||||
pull-requests: read
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||
needs: checkout-linux
|
||||
if: ${{ needs.setup.outputs.src == 'true' }}
|
||||
with:
|
||||
build-runs-on: electron-arc-linux-amd64-32core
|
||||
test-runs-on: electron-arc-linux-amd64-4core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
test-runs-on: electron-arc-centralus-linux-amd64-4core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
|
||||
target-platform: linux
|
||||
@@ -292,9 +302,10 @@ jobs:
|
||||
pull-requests: read
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||
needs: checkout-linux
|
||||
if: ${{ needs.setup.outputs.src == 'true' }}
|
||||
with:
|
||||
build-runs-on: electron-arc-linux-amd64-32core
|
||||
test-runs-on: electron-arc-linux-arm64-4core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
test-runs-on: electron-arc-centralus-linux-arm64-4core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
test-container: '{"image":"ghcr.io/electron/test:arm32v7-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init","volumes":["/home/runner/externals:/mnt/runner-externals"]}'
|
||||
target-platform: linux
|
||||
@@ -312,9 +323,10 @@ jobs:
|
||||
pull-requests: read
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||
needs: checkout-linux
|
||||
if: ${{ needs.setup.outputs.src == 'true' }}
|
||||
with:
|
||||
build-runs-on: electron-arc-linux-amd64-32core
|
||||
test-runs-on: electron-arc-linux-arm64-4core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
test-runs-on: ubuntu-22.04-arm
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
test-container: '{"image":"ghcr.io/electron/test:arm64v8-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
|
||||
target-platform: linux
|
||||
@@ -334,7 +346,7 @@ jobs:
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-windows-amd64-16core
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
test-runs-on: windows-latest
|
||||
target-platform: win
|
||||
target-arch: x64
|
||||
@@ -353,7 +365,7 @@ jobs:
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-windows-amd64-16core
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
test-runs-on: windows-latest
|
||||
target-platform: win
|
||||
target-arch: x86
|
||||
@@ -372,8 +384,8 @@ jobs:
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-windows-amd64-16core
|
||||
test-runs-on: electron-hosted-windows-arm64-4core
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
test-runs-on: windows-11-arm
|
||||
target-platform: win
|
||||
target-arch: arm64
|
||||
is-release: false
|
||||
|
||||
2
.github/workflows/clean-src-cache.yml
vendored
2
.github/workflows/clean-src-cache.yml
vendored
@@ -10,7 +10,7 @@ on:
|
||||
|
||||
jobs:
|
||||
clean-src-cache:
|
||||
runs-on: electron-arc-linux-amd64-32core
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
container:
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
options: --user root
|
||||
|
||||
13
.github/workflows/linux-publish.yml
vendored
13
.github/workflows/linux-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
|
||||
default: '933c7d6ff6802706875270bec2e3c891cf8add3f'
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
required: false
|
||||
@@ -19,7 +19,7 @@ on:
|
||||
|
||||
jobs:
|
||||
checkout-linux:
|
||||
runs-on: electron-arc-linux-amd64-32core
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
|
||||
options: --user root
|
||||
@@ -43,14 +43,13 @@ jobs:
|
||||
needs: checkout-linux
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: electron-arc-linux-amd64-32core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
target-platform: linux
|
||||
target-arch: x64
|
||||
is-release: true
|
||||
gn-build-type: release
|
||||
generate-symbols: true
|
||||
strip-binaries: true
|
||||
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||
secrets: inherit
|
||||
|
||||
@@ -59,14 +58,13 @@ jobs:
|
||||
needs: checkout-linux
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: electron-arc-linux-amd64-32core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
target-platform: linux
|
||||
target-arch: arm
|
||||
is-release: true
|
||||
gn-build-type: release
|
||||
generate-symbols: true
|
||||
strip-binaries: true
|
||||
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||
secrets: inherit
|
||||
|
||||
@@ -75,13 +73,12 @@ jobs:
|
||||
needs: checkout-linux
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: electron-arc-linux-amd64-32core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
target-platform: linux
|
||||
target-arch: arm64
|
||||
is-release: true
|
||||
gn-build-type: release
|
||||
generate-symbols: true
|
||||
strip-binaries: true
|
||||
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||
secrets: inherit
|
||||
|
||||
4
.github/workflows/macos-publish.yml
vendored
4
.github/workflows/macos-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
|
||||
default: '933c7d6ff6802706875270bec2e3c891cf8add3f'
|
||||
required: true
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
@@ -20,7 +20,7 @@ on:
|
||||
|
||||
jobs:
|
||||
checkout-macos:
|
||||
runs-on: electron-arc-linux-amd64-32core
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
|
||||
options: --user root
|
||||
|
||||
@@ -54,6 +54,11 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
enable-ssh:
|
||||
description: 'Enable SSH debugging'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
concurrency:
|
||||
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||
@@ -76,7 +81,8 @@ jobs:
|
||||
gn-build-type: ${{ inputs.gn-build-type }}
|
||||
generate-symbols: ${{ inputs.generate-symbols }}
|
||||
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||
is-asan: ${{ inputs.is-asan}}
|
||||
is-asan: ${{ inputs.is-asan }}
|
||||
enable-ssh: ${{ inputs.enable-ssh }}
|
||||
secrets: inherit
|
||||
test:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-test.yml
|
||||
@@ -86,5 +92,6 @@ jobs:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
test-runs-on: ${{ inputs.test-runs-on }}
|
||||
test-container: ${{ inputs.test-container }}
|
||||
is-asan: ${{ inputs.is-asan}}
|
||||
is-asan: ${{ inputs.is-asan }}
|
||||
enable-ssh: ${{ inputs.enable-ssh }}
|
||||
secrets: inherit
|
||||
|
||||
@@ -12,13 +12,32 @@ concurrency:
|
||||
group: electron-docs-only-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
GCLIENT_EXTRA_ARGS: --custom-var=checkout_arm=True --custom-var=checkout_arm64=True
|
||||
|
||||
jobs:
|
||||
docs-only:
|
||||
name: Docs Only Compile
|
||||
runs-on: electron-arc-linux-amd64-4core
|
||||
runs-on: electron-arc-centralus-linux-amd64-4core
|
||||
timeout-minutes: 20
|
||||
container: ${{ fromJSON(inputs.container) }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Generate DEPS Hash
|
||||
run: |
|
||||
node src/electron/script/generate-deps-hash.js
|
||||
DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)
|
||||
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
|
||||
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
|
||||
- name: Restore src cache via AKS
|
||||
uses: ./src/electron/.github/actions/restore-cache-aks
|
||||
with:
|
||||
target-platform: linux
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
|
||||
5
.github/workflows/pipeline-electron-lint.yml
vendored
5
.github/workflows/pipeline-electron-lint.yml
vendored
@@ -18,7 +18,7 @@ env:
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: electron-arc-linux-amd64-4core
|
||||
runs-on: electron-arc-centralus-linux-amd64-4core
|
||||
timeout-minutes: 20
|
||||
container: ${{ fromJSON(inputs.container) }}
|
||||
steps:
|
||||
@@ -61,6 +61,9 @@ jobs:
|
||||
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
|
||||
|
||||
gclient sync --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]"
|
||||
- name: Add ESLint problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/eslint-stylish.json"
|
||||
- name: Run Lint
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -48,17 +48,16 @@ on:
|
||||
required: true
|
||||
type: string
|
||||
default: '0'
|
||||
strip-binaries:
|
||||
description: 'Strip the binaries before release (Linux only)'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
is-asan:
|
||||
description: 'Building the Address Sanitizer (ASan) Linux build'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
enable-ssh:
|
||||
description: 'Enable SSH debugging'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
concurrency:
|
||||
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||
@@ -67,12 +66,14 @@ concurrency:
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
|
||||
DD_API_KEY: ${{ secrets.DD_API_KEY }}
|
||||
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }}
|
||||
SUDOWOODO_EXCHANGE_TOKEN: ${{ secrets.SUDOWOODO_EXCHANGE_TOKEN }}
|
||||
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || inputs.target-platform == 'win' && '--custom-var=checkout_win=True' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -84,6 +85,7 @@ jobs:
|
||||
environment: ${{ inputs.environment }}
|
||||
env:
|
||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||
TARGET_PLATFORM: ${{ inputs.target-platform }}
|
||||
steps:
|
||||
- name: Create src dir
|
||||
run: |
|
||||
@@ -94,6 +96,17 @@ jobs:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Setup SSH Debugging
|
||||
if: ${{ inputs.target-platform == 'macos' && (inputs.enable-ssh || env.ACTIONS_STEP_DEBUG == 'true') }}
|
||||
uses: ./src/electron/.github/actions/ssh-debug
|
||||
with:
|
||||
tunnel: 'true'
|
||||
env:
|
||||
CLOUDFLARE_TUNNEL_CERT: ${{ secrets.CLOUDFLARE_TUNNEL_CERT }}
|
||||
CLOUDFLARE_TUNNEL_HOSTNAME: ${{ vars.CLOUDFLARE_TUNNEL_HOSTNAME }}
|
||||
CLOUDFLARE_USER_CA_CERT: ${{ secrets.CLOUDFLARE_USER_CA_CERT }}
|
||||
AUTHORIZED_USERS: ${{ secrets.SSH_DEBUG_AUTHORIZED_USERS }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Free up space (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/free-space-macos
|
||||
@@ -104,7 +117,7 @@ jobs:
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: 20.11.x
|
||||
node-version: 20.19.x
|
||||
cache: yarn
|
||||
cache-dependency-path: src/electron/yarn.lock
|
||||
- name: Install Dependencies
|
||||
@@ -160,7 +173,7 @@ jobs:
|
||||
ELECTRON_DEPOT_TOOLS_DISABLE_LOG: true
|
||||
- name: Init Build Tools
|
||||
run: |
|
||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
|
||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --remote-build siso
|
||||
- name: Run Electron Only Hooks
|
||||
run: |
|
||||
e d gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
|
||||
@@ -170,9 +183,6 @@ jobs:
|
||||
echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV
|
||||
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
|
||||
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
|
||||
- name: Setup Number of Ninja Processes
|
||||
run: |
|
||||
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform != 'macos' && '300' || '200' }}" >> $GITHUB_ENV
|
||||
- name: Free up space (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/free-space-macos
|
||||
@@ -185,7 +195,6 @@ jobs:
|
||||
artifact-platform: ${{ inputs.target-platform == 'macos' && 'darwin' || inputs.target-platform }}
|
||||
is-release: '${{ inputs.is-release }}'
|
||||
generate-symbols: '${{ inputs.generate-symbols }}'
|
||||
strip-binaries: '${{ inputs.strip-binaries }}'
|
||||
upload-to-storage: '${{ inputs.upload-to-storage }}'
|
||||
is-asan: '${{ inputs.is-asan }}'
|
||||
- name: Set GN_EXTRA_ARGS for MAS Build
|
||||
|
||||
@@ -25,6 +25,11 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
enable-ssh:
|
||||
description: 'Enable SSH debugging'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
concurrency:
|
||||
group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||
@@ -40,6 +45,7 @@ env:
|
||||
CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@@ -62,26 +68,11 @@ jobs:
|
||||
if: ${{ inputs.target-arch == 'arm' && inputs.target-platform == 'linux' }}
|
||||
run: |
|
||||
cp $(which node) /mnt/runner-externals/node20/bin/
|
||||
- name: Install Git on Windows arm64 runners
|
||||
if: ${{ inputs.target-arch == 'arm64' && inputs.target-platform == 'win' }}
|
||||
shell: powershell
|
||||
run: |
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||
choco install -y --no-progress git.install --params "'/GitAndUnixToolsOnPath'"
|
||||
choco install -y --no-progress git
|
||||
choco install -y --no-progress python --version 3.11.9
|
||||
choco install -y --no-progress visualstudio2022-workload-vctools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.ARM64"
|
||||
echo "C:\Program Files\Git\cmd" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||
echo "C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||
echo "C:\Python311" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
|
||||
- name: Setup Node.js/npm
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: 20.11.x
|
||||
node-version: 20.19.x
|
||||
- name: Add TCC permissions on macOS
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: |
|
||||
@@ -100,9 +91,11 @@ jobs:
|
||||
}
|
||||
|
||||
userValuesArray=(
|
||||
"'kTCCServiceMicrophone','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
|
||||
"'kTCCServiceCamera','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
|
||||
"'kTCCServiceBluetoothAlways','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
|
||||
"'kTCCServiceAppleEvents','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
|
||||
"'kTCCServiceCamera','/opt/hca/hosted-compute-agent',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
|
||||
"'kTCCServiceBluetoothAlways','/opt/hca/hosted-compute-agent',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
|
||||
)
|
||||
for values in "${userValuesArray[@]}"; do
|
||||
# Sonoma and higher have a few extra values
|
||||
@@ -124,6 +117,17 @@ jobs:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Setup SSH Debugging
|
||||
if: ${{ inputs.target-platform == 'macos' && (inputs.enable-ssh || env.ACTIONS_STEP_DEBUG == 'true') }}
|
||||
uses: ./src/electron/.github/actions/ssh-debug
|
||||
with:
|
||||
tunnel: 'true'
|
||||
env:
|
||||
CLOUDFLARE_TUNNEL_CERT: ${{ secrets.CLOUDFLARE_TUNNEL_CERT }}
|
||||
CLOUDFLARE_TUNNEL_HOSTNAME: ${{ vars.CLOUDFLARE_TUNNEL_HOSTNAME }}
|
||||
CLOUDFLARE_USER_CA_CERT: ${{ secrets.CLOUDFLARE_USER_CA_CERT }}
|
||||
AUTHORIZED_USERS: ${{ secrets.SSH_DEBUG_AUTHORIZED_USERS }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Set Chromium Git Cookie
|
||||
@@ -135,7 +139,9 @@ jobs:
|
||||
git config --global core.autocrlf false
|
||||
git config --global branch.autosetuprebase always
|
||||
git config --global core.fscache true
|
||||
git config --global core.longpaths true
|
||||
git config --global core.preloadindex true
|
||||
git config --global core.longpaths true
|
||||
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
# Ensure depot_tools does not update.
|
||||
test -d depot_tools && cd depot_tools
|
||||
@@ -160,22 +166,18 @@ jobs:
|
||||
path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
|
||||
- name: Restore Generated Artifacts
|
||||
run: ./src/electron/script/actions/restore-artifacts.sh
|
||||
- name: Unzip Dist, Mksnapshot & Chromedriver (win)
|
||||
- name: Unzip Dist (win)
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
shell: powershell
|
||||
run: |
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||
cd src/out/Default
|
||||
Expand-Archive -Force dist.zip -DestinationPath ./
|
||||
Expand-Archive -Force chromedriver.zip -DestinationPath ./
|
||||
Expand-Archive -Force mksnapshot.zip -DestinationPath ./
|
||||
- name: Unzip Dist, Mksnapshot & Chromedriver (unix)
|
||||
- name: Unzip Dist (unix)
|
||||
if: ${{ inputs.target-platform != 'win' }}
|
||||
run: |
|
||||
cd src/out/Default
|
||||
unzip -:o dist.zip
|
||||
unzip -:o chromedriver.zip
|
||||
unzip -:o mksnapshot.zip
|
||||
- name: Import & Trust Self-Signed Codesigning Cert on MacOS
|
||||
if: ${{ inputs.target-platform == 'macos' && inputs.target-arch == 'x64' }}
|
||||
run: |
|
||||
@@ -192,7 +194,6 @@ jobs:
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
||||
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
||||
DISPLAY: ':99.0'
|
||||
NPM_CONFIG_MSVS_VERSION: '2022'
|
||||
run: |
|
||||
@@ -212,7 +213,7 @@ jobs:
|
||||
export ELECTRON_FORCE_TEST_SUITE_EXIT="true"
|
||||
fi
|
||||
fi
|
||||
node script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
|
||||
node script/yarn test --runners=main --enableRerun=3 --trace-uncaught --enable-logging --files $tests_files
|
||||
else
|
||||
chown :builduser .. && chmod g+w ..
|
||||
chown -R :builduser . && chmod -R g+w .
|
||||
|
||||
@@ -38,7 +38,7 @@ env:
|
||||
jobs:
|
||||
node-tests:
|
||||
name: Run Node.js Tests
|
||||
runs-on: electron-arc-linux-amd64-8core
|
||||
runs-on: electron-arc-centralus-linux-amd64-8core
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||
@@ -92,7 +92,7 @@ jobs:
|
||||
done
|
||||
nan-tests:
|
||||
name: Run Nan Tests
|
||||
runs-on: electron-arc-linux-amd64-4core
|
||||
runs-on: electron-arc-centralus-linux-amd64-4core
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||
|
||||
5
.github/workflows/pull-request-labeled.yml
vendored
5
.github/workflows/pull-request-labeled.yml
vendored
@@ -19,7 +19,10 @@ jobs:
|
||||
webhook-type: webhook-trigger
|
||||
payload: |
|
||||
{
|
||||
"url": "${{ github.event.pull_request.html_url }}"
|
||||
"base_ref": ${{ toJSON(github.event.pull_request.base.ref) }},
|
||||
"title": ${{ toJSON(github.event.pull_request.title) }},
|
||||
"url": ${{ toJSON(github.event.pull_request.html_url) }},
|
||||
"user": ${{ toJSON(github.event.pull_request.user.login) }}
|
||||
}
|
||||
pull-request-labeled-deprecation-review-complete:
|
||||
name: deprecation-review/complete label added
|
||||
|
||||
10
.github/workflows/windows-publish.yml
vendored
10
.github/workflows/windows-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
|
||||
default: '933c7d6ff6802706875270bec2e3c891cf8add3f'
|
||||
required: true
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
@@ -20,7 +20,7 @@ on:
|
||||
|
||||
jobs:
|
||||
checkout-windows:
|
||||
runs-on: electron-arc-linux-amd64-32core
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
|
||||
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
needs: checkout-windows
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: electron-arc-windows-amd64-16core
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
target-platform: win
|
||||
target-arch: x64
|
||||
is-release: true
|
||||
@@ -65,7 +65,7 @@ jobs:
|
||||
needs: checkout-windows
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: electron-arc-windows-amd64-16core
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
target-platform: win
|
||||
target-arch: arm64
|
||||
is-release: true
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
needs: checkout-windows
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: electron-arc-windows-amd64-16core
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
target-platform: win
|
||||
target-arch: x86
|
||||
is-release: true
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"config": {
|
||||
"extends": "@electron/lint-roller/configs/markdownlint.json",
|
||||
"descriptive-link-text": false,
|
||||
"link-image-style": {
|
||||
"autolink": false,
|
||||
"shortcut": false
|
||||
@@ -26,6 +27,6 @@
|
||||
"no-newline-in-links": true
|
||||
},
|
||||
"customRules": [
|
||||
"@electron/lint-roller/markdownlint-rules/"
|
||||
"./node_modules/@electron/lint-roller/markdownlint-rules/index.mjs"
|
||||
]
|
||||
}
|
||||
|
||||
135
BUILD.gn
135
BUILD.gn
@@ -44,6 +44,7 @@ if (is_mac) {
|
||||
|
||||
if (is_linux) {
|
||||
import("//build/config/linux/pkg_config.gni")
|
||||
import("//electron/build/linux/strip_binary.gni")
|
||||
import("//tools/generate_stubs/rules.gni")
|
||||
|
||||
pkg_config("gio_unix") {
|
||||
@@ -518,6 +519,10 @@ source_set("electron_lib") {
|
||||
"//v8:v8_libplatform",
|
||||
]
|
||||
|
||||
if (v8_use_external_startup_data && use_v8_context_snapshot) {
|
||||
deps += [ ":mksnapshot_checksum_gen" ]
|
||||
}
|
||||
|
||||
public_deps = [
|
||||
"//base",
|
||||
"//base:i18n",
|
||||
@@ -670,6 +675,8 @@ source_set("electron_lib") {
|
||||
sources += [
|
||||
"shell/browser/certificate_manager_model.cc",
|
||||
"shell/browser/certificate_manager_model.h",
|
||||
"shell/browser/linux/x11_util.cc",
|
||||
"shell/browser/linux/x11_util.h",
|
||||
"shell/browser/ui/gtk_util.cc",
|
||||
"shell/browser/ui/gtk_util.h",
|
||||
]
|
||||
@@ -770,6 +777,14 @@ source_set("electron_lib") {
|
||||
}
|
||||
}
|
||||
|
||||
action("mksnapshot_checksum_gen") {
|
||||
script = "build/checksum_header.py"
|
||||
outputs = [ "$target_gen_dir/snapshot_checksum.h" ]
|
||||
inputs = [ "$root_out_dir/$v8_context_snapshot_filename" ]
|
||||
args = rebase_path(inputs) + rebase_path(outputs)
|
||||
deps = [ "//tools/v8_context_snapshot" ]
|
||||
}
|
||||
|
||||
electron_paks("packed_resources") {
|
||||
if (is_mac) {
|
||||
output_dir = "$root_gen_dir/electron_repack"
|
||||
@@ -1407,6 +1422,18 @@ dist_zip("electron_dist_zip") {
|
||||
":licenses",
|
||||
]
|
||||
if (is_linux) {
|
||||
if (is_official_build) {
|
||||
data_deps += [
|
||||
":strip_chrome_crashpad_handler",
|
||||
":strip_chrome_sandbox",
|
||||
":strip_electron_binary",
|
||||
":strip_libEGL_shlib",
|
||||
":strip_libGLESv2_shlib",
|
||||
":strip_libffmpeg_shlib",
|
||||
":strip_libvk_swiftshader_shlib",
|
||||
]
|
||||
}
|
||||
|
||||
data_deps += [ "//sandbox/linux:chrome_sandbox" ]
|
||||
}
|
||||
deps = data_deps
|
||||
@@ -1452,6 +1479,16 @@ group("electron_mksnapshot") {
|
||||
|
||||
dist_zip("electron_mksnapshot_zip") {
|
||||
data_deps = mksnapshot_deps
|
||||
if (is_linux && is_official_build) {
|
||||
data_deps += [
|
||||
":strip_libEGL_shlib",
|
||||
":strip_libGLESv2_shlib",
|
||||
":strip_libffmpeg_shlib",
|
||||
":strip_libvk_swiftshader_shlib",
|
||||
":strip_mksnapshot_binary",
|
||||
":strip_v8_context_snapshot_generator_binary",
|
||||
]
|
||||
}
|
||||
deps = data_deps
|
||||
outputs = [ "$root_build_dir/mksnapshot.zip" ]
|
||||
}
|
||||
@@ -1576,3 +1613,101 @@ group("copy_node_headers") {
|
||||
group("node_headers") {
|
||||
public_deps = [ ":tar_node_headers" ]
|
||||
}
|
||||
|
||||
group("testing_build") {
|
||||
public_deps = [
|
||||
":electron_dist_zip",
|
||||
":electron_mksnapshot_zip",
|
||||
":node_headers",
|
||||
]
|
||||
}
|
||||
|
||||
group("release_build") {
|
||||
public_deps = [ ":testing_build" ]
|
||||
if (is_official_build) {
|
||||
public_deps += [ ":electron_symbols" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
public_deps += [
|
||||
":hunspell_dictionaries_zip",
|
||||
":libcxx_headers_zip",
|
||||
":libcxx_objects_zip",
|
||||
":libcxxabi_headers_zip",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_linux && is_official_build) {
|
||||
strip_binary("strip_electron_binary") {
|
||||
binary_input = "$root_out_dir/$electron_project_name"
|
||||
symbol_output = "$root_out_dir/debug/$electron_project_name.debug"
|
||||
compress_debug_sections = true
|
||||
deps = [ ":electron_app" ]
|
||||
}
|
||||
|
||||
strip_binary("strip_chrome_crashpad_handler") {
|
||||
binary_input = "$root_out_dir/chrome_crashpad_handler"
|
||||
symbol_output = "$root_out_dir/debug/chrome_crashpad_handler.debug"
|
||||
compress_debug_sections = true
|
||||
deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
|
||||
}
|
||||
|
||||
strip_binary("strip_chrome_sandbox") {
|
||||
binary_input = "$root_out_dir/chrome_sandbox"
|
||||
symbol_output = "$root_out_dir/debug/chrome-sandbox.debug"
|
||||
compress_debug_sections = true
|
||||
deps = [ "//sandbox/linux:chrome_sandbox" ]
|
||||
}
|
||||
|
||||
strip_binary("strip_libEGL_shlib") {
|
||||
binary_input = "$root_out_dir/libEGL.so"
|
||||
symbol_output = "$root_out_dir/debug/libEGL.so.debug"
|
||||
compress_debug_sections = true
|
||||
deps = [ "//third_party/angle:libEGL" ]
|
||||
}
|
||||
|
||||
strip_binary("strip_libGLESv2_shlib") {
|
||||
binary_input = "$root_out_dir/libGLESv2.so"
|
||||
symbol_output = "$root_out_dir/debug/libGLESv2.so.debug"
|
||||
compress_debug_sections = true
|
||||
deps = [ "//third_party/angle:libGLESv2" ]
|
||||
}
|
||||
|
||||
strip_binary("strip_libffmpeg_shlib") {
|
||||
binary_input = "$root_out_dir/libffmpeg.so"
|
||||
symbol_output = "$root_out_dir/debug/libffmpeg.so.debug"
|
||||
compress_debug_sections = true
|
||||
deps = [ "//third_party/ffmpeg" ]
|
||||
}
|
||||
|
||||
strip_binary("strip_libvk_swiftshader_shlib") {
|
||||
binary_input = "$root_out_dir/libvk_swiftshader.so"
|
||||
symbol_output = "$root_out_dir/debug/libvk_swiftshader.so.debug"
|
||||
compress_debug_sections = true
|
||||
deps = [ "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan" ]
|
||||
}
|
||||
|
||||
strip_binary("strip_mksnapshot_binary") {
|
||||
_binary_path = rebase_path(
|
||||
get_label_info(
|
||||
":v8_context_snapshot_generator($v8_snapshot_toolchain)",
|
||||
"root_out_dir") + "/mksnapshot",
|
||||
root_build_dir)
|
||||
binary_input = "$root_out_dir/$_binary_path"
|
||||
symbol_output = "$root_out_dir/debug/${_binary_path}.debug"
|
||||
compress_debug_sections = true
|
||||
deps = mksnapshot_deps
|
||||
}
|
||||
|
||||
strip_binary("strip_v8_context_snapshot_generator_binary") {
|
||||
_binary_path = rebase_path(
|
||||
get_label_info(
|
||||
":v8_context_snapshot_generator($v8_snapshot_toolchain)",
|
||||
"root_out_dir") + "/v8_context_snapshot_generator",
|
||||
root_build_dir)
|
||||
binary_input = "$root_out_dir/$_binary_path"
|
||||
symbol_output = "$root_out_dir/debug/${_binary_path}.debug"
|
||||
compress_debug_sections = true
|
||||
deps = mksnapshot_deps
|
||||
}
|
||||
}
|
||||
|
||||
6
DEPS
6
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'137.0.7151.0',
|
||||
'138.0.7204.251',
|
||||
'node_version':
|
||||
'v22.14.0',
|
||||
'v22.21.1',
|
||||
'nan_version':
|
||||
'e14bdcd1f72d62bca1d541b66da43130384ec213',
|
||||
'squirrel.mac_version':
|
||||
@@ -31,7 +31,7 @@ vars = {
|
||||
'sysroots_json_path': 'electron/script/sysroots.json',
|
||||
|
||||
# KEEP IN SYNC WITH utils.js FILE
|
||||
'yarn_version': '1.15.2',
|
||||
'yarn_version': '1.22.22',
|
||||
|
||||
# To be able to build clean Chromium from sources.
|
||||
'apply_patches': True,
|
||||
|
||||
14
README.md
14
README.md
@@ -44,29 +44,17 @@ Each Electron release provides binaries for macOS, Windows, and Linux.
|
||||
* Fedora 32 and newer
|
||||
* Debian 10 and newer
|
||||
|
||||
## Quick start & Electron Fiddle
|
||||
## Electron Fiddle
|
||||
|
||||
Use [`Electron Fiddle`](https://github.com/electron/fiddle)
|
||||
to build, run, and package small Electron experiments, to see code examples for all of Electron's APIs, and
|
||||
to try out different versions of Electron. It's designed to make the start of your journey with
|
||||
Electron easier.
|
||||
|
||||
Alternatively, clone and run the
|
||||
[electron/electron-quick-start](https://github.com/electron/electron-quick-start)
|
||||
repository to see a minimal Electron app in action:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/electron/electron-quick-start
|
||||
cd electron-quick-start
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
## Resources for learning Electron
|
||||
|
||||
* [electronjs.org/docs](https://electronjs.org/docs) - All of Electron's documentation
|
||||
* [electron/fiddle](https://github.com/electron/fiddle) - A tool to build, run, and package small Electron experiments
|
||||
* [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - A very basic starter Electron app
|
||||
* [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - Sample starter apps created by the community
|
||||
|
||||
## Programmatic usage
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"plugins": [
|
||||
"unicorn"
|
||||
"import"
|
||||
],
|
||||
"rules": {
|
||||
"unicorn/prefer-node-protocol": "error"
|
||||
"import/enforce-node-protocol-usage": ["error", "always"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,6 @@ enable_printing = true
|
||||
angle_enable_vulkan_validation_layers = false
|
||||
dawn_enable_vulkan_validation_layers = false
|
||||
|
||||
# Removes dxc dll's that are only used experimentally.
|
||||
# See https://bugs.chromium.org/p/chromium/issues/detail?id=1474897
|
||||
dawn_use_built_dxc = false
|
||||
|
||||
# These are disabled because they cause the zip manifest to differ between
|
||||
# testing and release builds.
|
||||
# See https://chromium-review.googlesource.com/c/chromium/src/+/2774898.
|
||||
@@ -73,3 +69,6 @@ enterprise_cloud_content_analysis = false
|
||||
# TODO: remove dependency on legacy ipc
|
||||
# https://issues.chromium.org/issues/40943039
|
||||
content_enable_legacy_ipc = true
|
||||
|
||||
# We don't use anything from here, and it causes target collisions
|
||||
enable_linux_installer = false
|
||||
|
||||
37
build/checksum_header.py
Normal file
37
build/checksum_header.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import hashlib
|
||||
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
TEMPLATE_H = """
|
||||
#ifndef ELECTRON_SNAPSHOT_CHECKSUM_H_
|
||||
#define ELECTRON_SNAPSHOT_CHECKSUM_H_
|
||||
|
||||
namespace electron::snapshot_checksum {
|
||||
|
||||
const std::string kChecksum = "{checksum}";
|
||||
|
||||
} // namespace electron::snapshot_checksum
|
||||
|
||||
#endif // ELECTRON_SNAPSHOT_CHECKSUM_H_
|
||||
"""
|
||||
|
||||
def calculate_sha256(filepath):
|
||||
sha256_hash = hashlib.sha256()
|
||||
with open(filepath, "rb") as f:
|
||||
for byte_block in iter(lambda: f.read(4096), b""):
|
||||
sha256_hash.update(byte_block)
|
||||
return sha256_hash.hexdigest()
|
||||
|
||||
input_file = sys.argv[1]
|
||||
output_file = sys.argv[2]
|
||||
|
||||
checksum = calculate_sha256(input_file)
|
||||
|
||||
checksum_h = TEMPLATE_H.replace("{checksum}", checksum)
|
||||
|
||||
with open(output_file, 'w') as f:
|
||||
f.write(checksum_h)
|
||||
70
build/linux/strip_binary.gni
Normal file
70
build/linux/strip_binary.gni
Normal file
@@ -0,0 +1,70 @@
|
||||
# Copyright 2021 The Chromium Authors
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This has been adapted from https://source.chromium.org/chromium/chromium/src/+/main:build/linux/strip_binary.gni;drc=c220a41e0422d45f1657c28146d32e99cc53640b
|
||||
# The notable difference is it has an option to compress the debug sections
|
||||
|
||||
import("//build/config/clang/clang.gni")
|
||||
import("//build/toolchain/toolchain.gni")
|
||||
|
||||
# Extracts symbols from a binary into a symbol file.
|
||||
#
|
||||
# Args:
|
||||
# binary_input: Path to the binary containing symbols to extract, e.g.:
|
||||
# "$root_out_dir/chrome"
|
||||
# symbol_output: Desired output file for symbols, e.g.:
|
||||
# "$root_out_dir/chrome.debug"
|
||||
# stripped_binary_output: Desired output file for stripped file, e.g.:
|
||||
# "$root_out_dir/chrome.stripped"
|
||||
# compress_debug_sections: If true, compress the extracted debug sections
|
||||
template("strip_binary") {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"deps",
|
||||
"testonly",
|
||||
])
|
||||
action("${target_name}") {
|
||||
llvm_strip_binary = "${clang_base_path}/bin/llvm-strip"
|
||||
llvm_objcopy_binary = "${clang_base_path}/bin/llvm-objcopy"
|
||||
script = "//electron/build/linux/strip_binary.py"
|
||||
|
||||
if (defined(invoker.stripped_binary_output)) {
|
||||
stripped_binary_output = invoker.stripped_binary_output
|
||||
} else {
|
||||
stripped_binary_output = invoker.binary_input + ".stripped"
|
||||
}
|
||||
if (defined(invoker.symbol_output)) {
|
||||
symbol_output = invoker.symbol_output
|
||||
} else {
|
||||
symbol_output = invoker.binary_input + ".debug"
|
||||
}
|
||||
|
||||
inputs = [
|
||||
invoker.binary_input,
|
||||
llvm_strip_binary,
|
||||
llvm_objcopy_binary,
|
||||
]
|
||||
outputs = [
|
||||
symbol_output,
|
||||
stripped_binary_output,
|
||||
]
|
||||
args = [
|
||||
"--llvm-strip-binary-path",
|
||||
rebase_path(llvm_strip_binary, root_build_dir),
|
||||
"--llvm-objcopy-binary-path",
|
||||
rebase_path(llvm_objcopy_binary, root_build_dir),
|
||||
"--symbol-output",
|
||||
rebase_path(symbol_output, root_build_dir),
|
||||
"--stripped-binary-output",
|
||||
rebase_path(stripped_binary_output, root_build_dir),
|
||||
"--binary-input",
|
||||
rebase_path(invoker.binary_input, root_build_dir),
|
||||
]
|
||||
|
||||
if (defined(invoker.compress_debug_sections) &&
|
||||
invoker.compress_debug_sections) {
|
||||
args += [ "--compress-debug-sections" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
63
build/linux/strip_binary.py
Normal file
63
build/linux/strip_binary.py
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright 2021 The Chromium Authors
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This has been adapted from https://source.chromium.org/chromium/chromium/src/+/main:build/linux/strip_binary.py;drc=c220a41e0422d45f1657c28146d32e99cc53640b
|
||||
# The notable difference is it has an option to compress the debug sections
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description="Strip binary using LLVM tools.")
|
||||
parser.add_argument("--llvm-strip-binary-path",
|
||||
help="Path to llvm-strip executable.")
|
||||
parser.add_argument("--llvm-objcopy-binary-path",
|
||||
required=True,
|
||||
help="Path to llvm-objcopy executable.")
|
||||
parser.add_argument("--binary-input", help="Input ELF binary.")
|
||||
parser.add_argument("--symbol-output",
|
||||
help="File to write extracted debug info (.debug).")
|
||||
parser.add_argument("--compress-debug-sections",
|
||||
action="store_true",
|
||||
help="Compress extracted debug info.")
|
||||
parser.add_argument("--stripped-binary-output",
|
||||
help="File to write stripped binary.")
|
||||
args = parser.parse_args()
|
||||
|
||||
# Replicate the behavior of:
|
||||
# eu-strip <binary_input> -o <stripped_binary_output> -f <symbol_output>
|
||||
|
||||
objcopy_args = [
|
||||
"--only-keep-debug",
|
||||
args.binary_input,
|
||||
args.symbol_output,
|
||||
]
|
||||
|
||||
if args.compress_debug_sections:
|
||||
objcopy_args.insert(0, "--compress-debug-sections")
|
||||
|
||||
subprocess.check_output([args.llvm_objcopy_binary_path] + objcopy_args)
|
||||
subprocess.check_output([
|
||||
args.llvm_strip_binary_path,
|
||||
"--strip-debug",
|
||||
"--strip-unneeded",
|
||||
"-o",
|
||||
args.stripped_binary_output,
|
||||
args.binary_input,
|
||||
])
|
||||
subprocess.check_output([
|
||||
args.llvm_objcopy_binary_path,
|
||||
f"--add-gnu-debuglink={args.symbol_output}",
|
||||
args.stripped_binary_output,
|
||||
])
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
21
build/siso/backend.star
Normal file
21
build/siso/backend.star
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- bazel-starlark -*-
|
||||
|
||||
load("@builtin//struct.star", "module")
|
||||
|
||||
def __platform_properties(ctx):
|
||||
container_image = "docker://gcr.io/chops-public-images-prod/rbe/siso-chromium/linux@sha256:d7cb1ab14a0f20aa669c23f22c15a9dead761dcac19f43985bf9dd5f41fbef3a"
|
||||
return {
|
||||
"default": {
|
||||
"OSFamily": "Linux",
|
||||
"container-image": container_image,
|
||||
},
|
||||
"large": {
|
||||
"OSFamily": "Linux",
|
||||
"container-image": container_image,
|
||||
},
|
||||
}
|
||||
|
||||
backend = module(
|
||||
"backend",
|
||||
platform_properties = __platform_properties,
|
||||
)
|
||||
66
build/siso/main.star
Normal file
66
build/siso/main.star
Normal file
@@ -0,0 +1,66 @@
|
||||
load("@builtin//encoding.star", "json")
|
||||
load("@builtin//path.star", "path")
|
||||
load("@builtin//runtime.star", "runtime")
|
||||
load("@builtin//struct.star", "module")
|
||||
load("@config//main.star", upstream_init = "init")
|
||||
load("@config//win_sdk.star", "win_sdk")
|
||||
load("@config//gn_logs.star", "gn_logs")
|
||||
|
||||
def init(ctx):
|
||||
mod = upstream_init(ctx)
|
||||
step_config = json.decode(mod.step_config)
|
||||
|
||||
# Buildbarn doesn't support input_root_absolute_path so disable that
|
||||
for rule in step_config["rules"]:
|
||||
input_root_absolute_path = rule.get("input_root_absolute_path", False)
|
||||
if input_root_absolute_path:
|
||||
rule.pop("input_root_absolute_path", None)
|
||||
|
||||
# Only wrap clang rules with a remote wrapper if not on Linux. These are currently only
|
||||
# needed for X-Compile builds, which run on Windows and Mac.
|
||||
if runtime.os != "linux":
|
||||
for rule in step_config["rules"]:
|
||||
if rule["name"].startswith("clang/") or rule["name"].startswith("clang-cl/"):
|
||||
rule["remote_wrapper"] = "../../buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper"
|
||||
if "inputs" not in rule:
|
||||
rule["inputs"] = []
|
||||
rule["inputs"].append("buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper")
|
||||
rule["inputs"].append("third_party/llvm-build/Release+Asserts_linux/bin/clang")
|
||||
|
||||
if "executables" not in step_config:
|
||||
step_config["executables"] = []
|
||||
step_config["executables"].append("buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper")
|
||||
step_config["executables"].append("third_party/llvm-build/Release+Asserts_linux/bin/clang")
|
||||
|
||||
if runtime.os == "darwin":
|
||||
# Update platforms to match our default siso config instead of reclient configs.
|
||||
step_config["platforms"].update({
|
||||
"clang": step_config["platforms"]["default"],
|
||||
"clang_large": step_config["platforms"]["default"],
|
||||
})
|
||||
|
||||
if runtime.os == "windows":
|
||||
# Add additional Windows SDK headers needed by Electron
|
||||
win_toolchain_dir = win_sdk.toolchain_dir(ctx)
|
||||
if win_toolchain_dir:
|
||||
sdk_version = gn_logs.read(ctx).get("windows_sdk_version")
|
||||
step_config["input_deps"][win_toolchain_dir + ":headers"].extend([
|
||||
# third_party/electron_node/deps/uv/include/uv/win.h includes mswsock.h
|
||||
path.join(win_toolchain_dir, "Windows Kits/10/Include", sdk_version, "um/mswsock.h"),
|
||||
# third_party/electron_node/src/debug_utils.cc includes lm.h
|
||||
path.join(win_toolchain_dir, "Windows Kits/10/Include", sdk_version, "um/Lm.h"),
|
||||
])
|
||||
|
||||
# Update platforms to match our default siso config instead of reclient configs.
|
||||
step_config["platforms"].update({
|
||||
"clang-cl": step_config["platforms"]["default"],
|
||||
"clang-cl_large": step_config["platforms"]["default"],
|
||||
"lld-link": step_config["platforms"]["default"],
|
||||
})
|
||||
|
||||
return module(
|
||||
"config",
|
||||
step_config = json.encode(step_config),
|
||||
filegroups = mod.filegroups,
|
||||
handlers = mod.handlers,
|
||||
)
|
||||
@@ -121,6 +121,7 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
|
||||
'electron/main$': electronAPIFile,
|
||||
'electron/renderer$': electronAPIFile,
|
||||
'electron/common$': electronAPIFile,
|
||||
'electron/utility$': electronAPIFile,
|
||||
// Force timers to resolve to our dependency that doesn't use window.postMessage
|
||||
timers: path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
||||
},
|
||||
@@ -143,7 +144,9 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
|
||||
transpileOnly: onlyPrintingGraph,
|
||||
ignoreDiagnostics: [
|
||||
// File '{0}' is not under 'rootDir' '{1}'.
|
||||
6059
|
||||
6059,
|
||||
// Private field '{0}' must be declared in an enclosing class.
|
||||
1111
|
||||
]
|
||||
}
|
||||
}]
|
||||
|
||||
12
build/zip.py
12
build/zip.py
@@ -41,6 +41,8 @@ PATHS_TO_SKIP = [
|
||||
'resources/inspector',
|
||||
'gen/third_party/devtools-frontend/src',
|
||||
'gen/ui/webui',
|
||||
# Skip because these get zipped separately in script/zip-symbols.py
|
||||
'debug',
|
||||
]
|
||||
|
||||
def skip_path(dep, dist_zip, target_cpu):
|
||||
@@ -80,6 +82,11 @@ def main(argv):
|
||||
dep = dep.strip()
|
||||
if not skip_path(dep, dist_zip, target_cpu):
|
||||
dist_files.add(dep)
|
||||
# On Linux, filter out any files which have a .stripped companion
|
||||
if sys.platform == 'linux':
|
||||
dist_files = {
|
||||
dep for dep in dist_files if f"{dep.removeprefix('./')}.stripped" not in dist_files
|
||||
}
|
||||
if sys.platform == 'darwin' and not should_flatten:
|
||||
execute(['zip', '-r', '-y', dist_zip] + list(dist_files))
|
||||
else:
|
||||
@@ -96,10 +103,13 @@ def main(argv):
|
||||
dirname = os.path.dirname(dep)
|
||||
arcname = (
|
||||
os.path.join(dirname, 'chrome-sandbox')
|
||||
if basename == 'chrome_sandbox'
|
||||
if basename.removesuffix('.stripped') == 'chrome_sandbox'
|
||||
else dep
|
||||
)
|
||||
name_to_write = arcname
|
||||
# On Linux, strip the .stripped suffix from the name before zipping
|
||||
if sys.platform == 'linux':
|
||||
name_to_write = name_to_write.removesuffix('.stripped')
|
||||
if should_flatten:
|
||||
if flatten_relative_to:
|
||||
if name_to_write.startswith(flatten_relative_to):
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"plugins": [
|
||||
"unicorn"
|
||||
"import"
|
||||
],
|
||||
"rules": {
|
||||
"unicorn/prefer-node-protocol": "error"
|
||||
"import/enforce-node-protocol-usage": ["error", "always"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
* [dialog](api/dialog.md)
|
||||
* [globalShortcut](api/global-shortcut.md)
|
||||
* [inAppPurchase](api/in-app-purchase.md)
|
||||
* [ImageView](api/image-view.md)
|
||||
* [ipcMain](api/ipc-main.md)
|
||||
* [Menu](api/menu.md)
|
||||
* [MenuItem](api/menu-item.md)
|
||||
|
||||
261
docs/api/app.md
261
docs/api/app.md
@@ -41,9 +41,10 @@ that was used to open the application, if it was launched from Notification Cent
|
||||
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.
|
||||
|
||||
**Note**: The `ready` event is only fired after the main process has finished running the first
|
||||
tick of the event loop. If an Electron API needs to be called before the `ready` event, ensure
|
||||
that it is called synchronously in the top-level context of the main process.
|
||||
> [!NOTE]
|
||||
> The `ready` event is only fired after the main process has finished running the first
|
||||
> tick of the event loop. If an Electron API needs to be called before the `ready` event, ensure
|
||||
> that it is called synchronously in the top-level context of the main process.
|
||||
|
||||
### Event: 'window-all-closed'
|
||||
|
||||
@@ -66,12 +67,14 @@ Emitted before the application starts closing its windows.
|
||||
Calling `event.preventDefault()` will prevent the default behavior, which is
|
||||
terminating the application.
|
||||
|
||||
**Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
|
||||
then `before-quit` is emitted _after_ emitting `close` event on all windows and
|
||||
closing them.
|
||||
> [!NOTE]
|
||||
> If application quit was initiated by `autoUpdater.quitAndInstall()`,
|
||||
> then `before-quit` is emitted _after_ emitting `close` event on all windows and
|
||||
> closing them.
|
||||
|
||||
**Note:** On Windows, this event will not be emitted if the app is closed due
|
||||
to a shutdown/restart of the system or a user logout.
|
||||
> [!NOTE]
|
||||
> On Windows, this event will not be emitted if the app is closed due
|
||||
> to a shutdown/restart of the system or a user logout.
|
||||
|
||||
### Event: 'will-quit'
|
||||
|
||||
@@ -86,8 +89,9 @@ terminating the application.
|
||||
See the description of the `window-all-closed` event for the differences between
|
||||
the `will-quit` and `window-all-closed` events.
|
||||
|
||||
**Note:** On Windows, this event will not be emitted if the app is closed due
|
||||
to a shutdown/restart of the system or a user logout.
|
||||
> [!NOTE]
|
||||
> On Windows, this event will not be emitted if the app is closed due
|
||||
> to a shutdown/restart of the system or a user logout.
|
||||
|
||||
### Event: 'quit'
|
||||
|
||||
@@ -98,8 +102,9 @@ Returns:
|
||||
|
||||
Emitted when the application is quitting.
|
||||
|
||||
**Note:** On Windows, this event will not be emitted if the app is closed due
|
||||
to a shutdown/restart of the system or a user logout.
|
||||
> [!NOTE]
|
||||
> On Windows, this event will not be emitted if the app is closed due
|
||||
> to a shutdown/restart of the system or a user logout.
|
||||
|
||||
### Event: 'open-file' _macOS_
|
||||
|
||||
@@ -470,24 +475,28 @@ and `workingDirectory` is its current working directory. Usually
|
||||
applications respond to this by making their primary window focused and
|
||||
non-minimized.
|
||||
|
||||
**Note:** `argv` will not be exactly the same list of arguments as those passed
|
||||
to the second instance. The order might change and additional arguments might be appended.
|
||||
If you need to maintain the exact same arguments, it's advised to use `additionalData` instead.
|
||||
> [!NOTE]
|
||||
> `argv` will not be exactly the same list of arguments as those passed
|
||||
> to the second instance. The order might change and additional arguments might be appended.
|
||||
> If you need to maintain the exact same arguments, it's advised to use `additionalData` instead.
|
||||
|
||||
**Note:** If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
|
||||
> [!NOTE]
|
||||
> If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
|
||||
|
||||
This event is guaranteed to be emitted after the `ready` event of `app`
|
||||
gets emitted.
|
||||
|
||||
**Note:** Extra command line arguments might be added by Chromium,
|
||||
such as `--original-process-start-time`.
|
||||
> [!NOTE]
|
||||
> Extra command line arguments might be added by Chromium,
|
||||
> such as `--original-process-start-time`.
|
||||
|
||||
## Methods
|
||||
|
||||
The `app` object has the following methods:
|
||||
|
||||
**Note:** Some methods are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
> [!NOTE]
|
||||
> Some methods are only available on specific operating systems and are
|
||||
> labeled as such.
|
||||
|
||||
### `app.quit()`
|
||||
|
||||
@@ -592,6 +601,7 @@ Returns `string` - The current application directory.
|
||||
* `%APPDATA%` on Windows
|
||||
* `$XDG_CONFIG_HOME` or `~/.config` on Linux
|
||||
* `~/Library/Application Support` on macOS
|
||||
* `assets` The directory where app assets such as `resources.pak` are stored. By default this is the same as the folder containing the `exe` path. Available on Windows and Linux only.
|
||||
* `userData` The directory for storing your app's configuration files, which
|
||||
by default is the `appData` directory appended with your app's name. By
|
||||
convention files storing user data should be written to this directory, and
|
||||
@@ -606,7 +616,7 @@ Returns `string` - The current application directory.
|
||||
directory.
|
||||
* `temp` Temporary directory.
|
||||
* `exe` The current executable file.
|
||||
* `module` The `libchromiumcontent` library.
|
||||
* `module` The location of the Chromium module. By default this is synonymous with `exe`.
|
||||
* `desktop` The current user's Desktop directory.
|
||||
* `documents` Directory for a user's "My Documents".
|
||||
* `downloads` Directory for a user's downloads.
|
||||
@@ -679,7 +689,8 @@ preferred over `name` by Electron.
|
||||
|
||||
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.
|
||||
> [!NOTE]
|
||||
> This function overrides the name used internally by Electron; it does not affect the name that the OS uses.
|
||||
|
||||
### `app.getLocale()`
|
||||
|
||||
@@ -688,18 +699,22 @@ Possible return values are documented [here](https://source.chromium.org/chromiu
|
||||
|
||||
To set the locale, you'll want to use a command line switch at app startup, which may be found [here](command-line-switches.md).
|
||||
|
||||
**Note:** When distributing your packaged app, you have to also ship the
|
||||
`locales` folder.
|
||||
> [!NOTE]
|
||||
> When distributing your packaged app, you have to also ship the
|
||||
> `locales` folder.
|
||||
|
||||
**Note:** This API must be called after the `ready` event is emitted.
|
||||
> [!NOTE]
|
||||
> This API must be called after the `ready` event is emitted.
|
||||
|
||||
**Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
|
||||
> [!NOTE]
|
||||
> To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
|
||||
|
||||
### `app.getLocaleCountryCode()`
|
||||
|
||||
Returns `string` - User operating system's locale two-letter [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) country code. The value is taken from native OS APIs.
|
||||
|
||||
**Note:** When unable to detect locale country code, it returns empty string.
|
||||
> [!NOTE]
|
||||
> When unable to detect locale country code, it returns empty string.
|
||||
|
||||
### `app.getSystemLocale()`
|
||||
|
||||
@@ -712,9 +727,11 @@ Different operating systems also use the regional data differently:
|
||||
|
||||
Therefore, this API can be used for purposes such as choosing a format for rendering dates and times in a calendar app, especially when the developer wants the format to be consistent with the OS.
|
||||
|
||||
**Note:** This API must be called after the `ready` event is emitted.
|
||||
> [!NOTE]
|
||||
> This API must be called after the `ready` event is emitted.
|
||||
|
||||
**Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
|
||||
> [!NOTE]
|
||||
> To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
|
||||
|
||||
### `app.getPreferredSystemLanguages()`
|
||||
|
||||
@@ -759,6 +776,22 @@ bar, and on macOS, you can visit it from dock menu.
|
||||
|
||||
Clears the recent documents list.
|
||||
|
||||
### `app.getRecentDocuments()` _macOS_ _Windows_
|
||||
|
||||
Returns `string[]` - An array containing documents in the most recent documents list.
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
|
||||
const path = require('node:path')
|
||||
|
||||
const file = path.join(app.getPath('desktop'), 'foo.txt')
|
||||
app.addRecentDocument(file)
|
||||
|
||||
const recents = app.getRecentDocuments()
|
||||
console.log(recents) // ['/path/to/desktop/foo.txt'}
|
||||
```
|
||||
|
||||
### `app.setAsDefaultProtocolClient(protocol[, path, args])`
|
||||
|
||||
* `protocol` string - The name of your protocol, without `://`. For example,
|
||||
@@ -777,16 +810,18 @@ Once registered, all links with `your-protocol://` will be opened with the
|
||||
current executable. The whole link, including protocol, will be passed to your
|
||||
application as a parameter.
|
||||
|
||||
**Note:** On macOS, you can only register protocols that have been added to
|
||||
your app's `info.plist`, which cannot be modified at runtime. However, you can
|
||||
change the file during build time via [Electron Forge][electron-forge],
|
||||
[Electron Packager][electron-packager], or by editing `info.plist` with a text
|
||||
editor. Please refer to [Apple's documentation][CFBundleURLTypes] for details.
|
||||
> [!NOTE]
|
||||
> On macOS, you can only register protocols that have been added to
|
||||
> your app's `info.plist`, which cannot be modified at runtime. However, you can
|
||||
> change the file during build time via [Electron Forge][electron-forge],
|
||||
> [Electron Packager][electron-packager], or by editing `info.plist` with a text
|
||||
> editor. Please refer to [Apple's documentation][CFBundleURLTypes] for details.
|
||||
|
||||
**Note:** In a Windows Store environment (when packaged as an `appx`) this API
|
||||
will return `true` for all calls but the registry key it sets won't be accessible
|
||||
by other applications. In order to register your Windows Store application
|
||||
as a default protocol handler you must [declare the protocol in your manifest](https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
|
||||
> [!NOTE]
|
||||
> In a Windows Store environment (when packaged as an `appx`) this API
|
||||
> will return `true` for all calls but the registry key it sets won't be accessible
|
||||
> by other applications. In order to register your Windows Store application
|
||||
> as a default protocol handler you must [declare the protocol in your manifest](https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
|
||||
|
||||
The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme` internally.
|
||||
|
||||
@@ -810,11 +845,12 @@ protocol (aka URI scheme). If so, it will remove the app as the default handler.
|
||||
Returns `boolean` - Whether the current executable is the default handler for a
|
||||
protocol (aka URI scheme).
|
||||
|
||||
**Note:** On macOS, you can use this method to check if the app has been
|
||||
registered as the default protocol handler for a protocol. You can also verify
|
||||
this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
|
||||
macOS machine. Please refer to
|
||||
[Apple's documentation][LSCopyDefaultHandlerForURLScheme] for details.
|
||||
> [!NOTE]
|
||||
> On macOS, you can use this method to check if the app has been
|
||||
> registered as the default protocol handler for a protocol. You can also verify
|
||||
> this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
|
||||
> macOS machine. Please refer to
|
||||
> [Apple's documentation][LSCopyDefaultHandlerForURLScheme] for details.
|
||||
|
||||
The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme` internally.
|
||||
|
||||
@@ -858,8 +894,9 @@ Adds `tasks` to the [Tasks][tasks] category of the Jump List on Windows.
|
||||
|
||||
Returns `boolean` - Whether the call succeeded.
|
||||
|
||||
**Note:** If you'd like to customize the Jump List even more use
|
||||
`app.setJumpList(categories)` instead.
|
||||
> [!NOTE]
|
||||
> If you'd like to customize the Jump List even more use
|
||||
> `app.setJumpList(categories)` instead.
|
||||
|
||||
### `app.getJumpListSettings()` _Windows_
|
||||
|
||||
@@ -897,21 +934,24 @@ following strings:
|
||||
If `categories` is `null` the previously set custom Jump List (if any) will be
|
||||
replaced by the standard Jump List for the app (managed by Windows).
|
||||
|
||||
**Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
|
||||
property set then its `type` is assumed to be `tasks`. If the `name` property
|
||||
> [!NOTE]
|
||||
> If a `JumpListCategory` object has neither the `type` nor the `name`
|
||||
> property set then its `type` is assumed to be `tasks`. If the `name` property
|
||||
is set but the `type` property is omitted then the `type` is assumed to be
|
||||
`custom`.
|
||||
|
||||
**Note:** Users can remove items from custom categories, and Windows will not
|
||||
allow a removed item to be added back into a custom category until **after**
|
||||
the next successful call to `app.setJumpList(categories)`. Any attempt to
|
||||
re-add a removed item to a custom category earlier than that will result in the
|
||||
entire custom category being omitted from the Jump List. The list of removed
|
||||
items can be obtained using `app.getJumpListSettings()`.
|
||||
> [!NOTE]
|
||||
> Users can remove items from custom categories, and Windows will not
|
||||
> allow a removed item to be added back into a custom category until **after**
|
||||
> the next successful call to `app.setJumpList(categories)`. Any attempt to
|
||||
> re-add a removed item to a custom category earlier than that will result in the
|
||||
> entire custom category being omitted from the Jump List. The list of removed
|
||||
> items can be obtained using `app.getJumpListSettings()`.
|
||||
|
||||
**Note:** The maximum length of a Jump List item's `description` property is
|
||||
260 characters. Beyond this limit, the item will not be added to the Jump
|
||||
List, nor will it be displayed.
|
||||
> [!NOTE]
|
||||
> The maximum length of a Jump List item's `description` property is
|
||||
> 260 characters. Beyond this limit, the item will not be added to the Jump
|
||||
> List, nor will it be displayed.
|
||||
|
||||
Here's a very simple example of creating a custom Jump List:
|
||||
|
||||
@@ -1172,6 +1212,13 @@ Disables hardware acceleration for current app.
|
||||
|
||||
This method can only be called before app is ready.
|
||||
|
||||
### `app.isHardwareAccelerationEnabled()`
|
||||
|
||||
Returns `boolean` - whether hardware acceleration is currently disabled.
|
||||
|
||||
> [!NOTE]
|
||||
> This information is only usable after the `gpu-info-update` event is emitted.
|
||||
|
||||
### `app.disableDomainBlockingFor3DAPIs()`
|
||||
|
||||
By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per
|
||||
@@ -1188,7 +1235,8 @@ Returns [`ProcessMetric[]`](structures/process-metric.md): Array of `ProcessMetr
|
||||
|
||||
Returns [`GPUFeatureStatus`](structures/gpu-feature-status.md) - The Graphics Feature Status from `chrome://gpu/`.
|
||||
|
||||
**Note:** This information is only usable after the `gpu-info-update` event is emitted.
|
||||
> [!NOTE]
|
||||
> This information is only usable after the `gpu-info-update` event is emitted.
|
||||
|
||||
### `app.getGPUInfo(infoType)`
|
||||
|
||||
@@ -1242,11 +1290,13 @@ badge.
|
||||
|
||||
On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
|
||||
|
||||
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
|
||||
please read the [Unity integration documentation][unity-requirement].
|
||||
> [!NOTE]
|
||||
> Unity launcher requires a `.desktop` file to work. For more information,
|
||||
> please read the [Unity integration documentation][unity-requirement].
|
||||
|
||||
**Note:** On macOS, you need to ensure that your application has the permission
|
||||
to display notifications for this method to work.
|
||||
> [!NOTE]
|
||||
> On macOS, you need to ensure that your application has the permission
|
||||
> to display notifications for this method to work.
|
||||
|
||||
### `app.getBadgeCount()` _Linux_ _macOS_
|
||||
|
||||
@@ -1348,7 +1398,76 @@ details. Disabled by default.
|
||||
|
||||
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.
|
||||
> [!NOTE]
|
||||
> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default. Calling this method will enable the following accessibility support features: `nativeAPIs`, `webContents`, `inlineTextBoxes`, and `extendedProperties`.
|
||||
|
||||
### `app.getAccessibilitySupportFeatures()` _macOS_ _Windows_
|
||||
|
||||
Returns `string[]` - Array of strings naming currently enabled accessibility support components. Possible values:
|
||||
|
||||
* `nativeAPIs` - Native OS accessibility APIs integration enabled.
|
||||
* `webContents` - Web contents accessibility tree exposure enabled.
|
||||
* `inlineTextBoxes` - Inline text boxes (character bounding boxes) enabled.
|
||||
* `extendedProperties` - Extended accessibility properties enabled.
|
||||
* `screenReader` - Screen reader specific mode enabled.
|
||||
* `html` - HTML accessibility tree construction enabled.
|
||||
* `labelImages` - Accessibility support for automatic image annotations.
|
||||
* `pdfPrinting` - Accessibility support for PDF printing enabled.
|
||||
|
||||
Notes:
|
||||
|
||||
* The array may be empty if no accessibility modes are active.
|
||||
* Use `app.isAccessibilitySupportEnabled()` for the legacy boolean check;
|
||||
prefer this method for granular diagnostics or telemetry.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
if (app.getAccessibilitySupportFeatures().includes('screenReader')) {
|
||||
// Change some app UI to better work with Screen Readers.
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### `app.setAccessibilitySupportFeatures(features)` _macOS_ _Windows_
|
||||
|
||||
* `features` string[] - An array of the accessibility features to enable.
|
||||
|
||||
Possible values are:
|
||||
|
||||
* `nativeAPIs` - Native OS accessibility APIs integration enabled.
|
||||
* `webContents` - Web contents accessibility tree exposure enabled.
|
||||
* `inlineTextBoxes` - Inline text boxes (character bounding boxes) enabled.
|
||||
* `extendedProperties` - Extended accessibility properties enabled.
|
||||
* `screenReader` - Screen reader specific mode enabled.
|
||||
* `html` - HTML accessibility tree construction enabled.
|
||||
* `labelImages` - Accessibility support for automatic image annotations.
|
||||
* `pdfPrinting` - Accessibility support for PDF printing enabled.
|
||||
|
||||
To disable all supported features, pass an empty array `[]`.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
// Enable a subset of features:
|
||||
app.setAccessibilitySupportFeatures([
|
||||
'screenReader',
|
||||
'pdfPrinting',
|
||||
'webContents'
|
||||
])
|
||||
|
||||
// Other logic
|
||||
|
||||
// Some time later, disable all features:
|
||||
app.setAccessibilitySupportFeatures([])
|
||||
})
|
||||
```
|
||||
|
||||
### `app.showAboutPanel()`
|
||||
|
||||
@@ -1476,7 +1595,8 @@ By using this API, important information such as password and other sensitive in
|
||||
See [Apple's documentation](https://developer.apple.com/library/archive/technotes/tn2150/_index.html) for more
|
||||
details.
|
||||
|
||||
**Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it when it is no longer needed.
|
||||
> [!NOTE]
|
||||
> Enable `Secure Keyboard Entry` only when it is needed and disable it when it is no longer needed.
|
||||
|
||||
### `app.setProxy(config)`
|
||||
|
||||
@@ -1490,7 +1610,7 @@ and internal requests made by the runtime (ex: geolocation queries).
|
||||
|
||||
This method can only be called after app is ready.
|
||||
|
||||
#### `app.resolveProxy(url)`
|
||||
### `app.resolveProxy(url)`
|
||||
|
||||
* `url` URL
|
||||
|
||||
@@ -1538,7 +1658,8 @@ See [Chromium's accessibility docs](https://www.chromium.org/developers/design-d
|
||||
|
||||
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.
|
||||
> [!NOTE]
|
||||
> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
|
||||
|
||||
### `app.applicationMenu`
|
||||
|
||||
@@ -1551,11 +1672,13 @@ An `Integer` property that returns the badge count for current app. Setting the
|
||||
|
||||
On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.
|
||||
|
||||
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
|
||||
please read the [Unity integration documentation][unity-requirement].
|
||||
> [!NOTE]
|
||||
> Unity launcher requires a `.desktop` file to work. For more information,
|
||||
> please read the [Unity integration documentation][unity-requirement].
|
||||
|
||||
**Note:** On macOS, you need to ensure that your application has the permission
|
||||
to display notifications for this property to take effect.
|
||||
> [!NOTE]
|
||||
> On macOS, you need to ensure that your application has the permission
|
||||
> to display notifications for this property to take effect.
|
||||
|
||||
### `app.commandLine` _Readonly_
|
||||
|
||||
|
||||
@@ -26,8 +26,9 @@ requirements, you can read [Server Support][server-support]. Note that
|
||||
update process. Apps that need to disable ATS can add the
|
||||
`NSAllowsArbitraryLoads` key to their app's plist.
|
||||
|
||||
**Note:** Your application must be signed for automatic updates on macOS.
|
||||
This is a requirement of `Squirrel.Mac`.
|
||||
> [!IMPORTANT]
|
||||
> Your application must be signed for automatic updates on macOS.
|
||||
> This is a requirement of `Squirrel.Mac`.
|
||||
|
||||
### Windows
|
||||
|
||||
@@ -93,8 +94,9 @@ Emitted when an update has been downloaded.
|
||||
|
||||
On Windows only `releaseName` is available.
|
||||
|
||||
**Note:** It is not strictly necessary to handle this event. A successfully
|
||||
downloaded update will still be applied the next time the application starts.
|
||||
> [!NOTE]
|
||||
> It is not strictly necessary to handle this event. A successfully
|
||||
> downloaded update will still be applied the next time the application starts.
|
||||
|
||||
### Event: 'before-quit-for-update'
|
||||
|
||||
@@ -125,8 +127,9 @@ Returns `string` - The current update feed URL.
|
||||
Asks the server whether there is an update. You must call `setFeedURL` before
|
||||
using this API.
|
||||
|
||||
**Note:** If an update is available it will be downloaded automatically.
|
||||
Calling `autoUpdater.checkForUpdates()` twice will download the update two times.
|
||||
> [!NOTE]
|
||||
> If an update is available it will be downloaded automatically.
|
||||
> Calling `autoUpdater.checkForUpdates()` twice will download the update two times.
|
||||
|
||||
### `autoUpdater.quitAndInstall()`
|
||||
|
||||
@@ -137,9 +140,10 @@ Under the hood calling `autoUpdater.quitAndInstall()` will close all application
|
||||
windows first, and automatically call `app.quit()` after all windows have been
|
||||
closed.
|
||||
|
||||
**Note:** It is not strictly necessary to call this function to apply an update,
|
||||
as a successfully downloaded update will always be applied the next time the
|
||||
application starts.
|
||||
> [!NOTE]
|
||||
> It is not strictly necessary to call this function to apply an update,
|
||||
> as a successfully downloaded update will always be applied the next time the
|
||||
> application starts.
|
||||
|
||||
[squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac
|
||||
[server-support]: https://github.com/Squirrel/Squirrel.Mac#server-support
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
> **Note**
|
||||
> [!NOTE]
|
||||
> `BaseWindow` provides a flexible way to compose multiple web views in a
|
||||
> single window. For windows with only a single, full-size web view, the
|
||||
> [`BrowserWindow`](browser-window.md) class may be a simpler option.
|
||||
@@ -99,6 +99,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
It creates a new `BaseWindow` with native properties as set by the `options`.
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new BaseWindow([options])`
|
||||
|
||||
* `options` [BaseWindowConstructorOptions](structures/base-window-options.md?inline) (optional)
|
||||
@@ -107,8 +111,9 @@ It creates a new `BaseWindow` with native properties as set by the `options`.
|
||||
|
||||
Objects created with `new BaseWindow` emit the following events:
|
||||
|
||||
**Note:** Some events are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
> [!NOTE]
|
||||
> Some events are only available on specific operating systems and are
|
||||
> labeled as such.
|
||||
|
||||
#### Event: 'close'
|
||||
|
||||
@@ -137,7 +142,11 @@ window.onbeforeunload = (e) => {
|
||||
}
|
||||
```
|
||||
|
||||
_**Note**: There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and `window.addEventListener('beforeunload', handler)`. It is recommended to always set the `event.returnValue` explicitly, instead of only returning a value, as the former works more consistently within Electron._
|
||||
> [!NOTE]
|
||||
> There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and
|
||||
> `window.addEventListener('beforeunload', handler)`. It is recommended to always set the
|
||||
> `event.returnValue` explicitly, instead of only returning a value, as the former works more
|
||||
> consistently within Electron.
|
||||
|
||||
#### Event: 'closed'
|
||||
|
||||
@@ -252,7 +261,8 @@ Emitted when the window is being moved to a new position.
|
||||
|
||||
Emitted once when the window is moved to a new position.
|
||||
|
||||
**Note**: On macOS this event is an alias of `move`.
|
||||
> [!NOTE]
|
||||
> On macOS, this event is an alias of `move`.
|
||||
|
||||
#### Event: 'enter-full-screen'
|
||||
|
||||
@@ -356,7 +366,7 @@ as `-webkit-app-region: drag` in a frameless window.
|
||||
|
||||
Calling `event.preventDefault()` will prevent the menu from being displayed.
|
||||
|
||||
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows).
|
||||
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows-linux).
|
||||
|
||||
### Static Methods
|
||||
|
||||
@@ -421,7 +431,8 @@ A `boolean` property that determines whether the window is focusable.
|
||||
|
||||
A `boolean` property that determines whether the window is visible on all workspaces.
|
||||
|
||||
**Note:** Always returns false on Windows.
|
||||
> [!NOTE]
|
||||
> Always returns false on Windows.
|
||||
|
||||
#### `win.shadow`
|
||||
|
||||
@@ -431,7 +442,8 @@ A `boolean` property that determines whether the window has a shadow.
|
||||
|
||||
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.
|
||||
> [!NOTE]
|
||||
> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||
|
||||
#### `win.kiosk`
|
||||
|
||||
@@ -452,7 +464,8 @@ and the icon of the file will show in window's title bar.
|
||||
|
||||
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.
|
||||
> [!NOTE]
|
||||
> The title of the web page can be different from the title of the native window.
|
||||
|
||||
#### `win.minimizable` _macOS_ _Windows_
|
||||
|
||||
@@ -521,8 +534,9 @@ A `boolean` property that indicates whether the window is arranged via [Snap.](h
|
||||
|
||||
Objects created with `new BaseWindow` have the following instance methods:
|
||||
|
||||
**Note:** Some methods are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
> [!NOTE]
|
||||
> Some methods are only available on specific operating systems and are
|
||||
> labeled as such.
|
||||
|
||||
#### `win.setContentView(view)`
|
||||
|
||||
@@ -614,7 +628,8 @@ Returns `boolean` - Whether the window is minimized.
|
||||
|
||||
Sets whether the window should be in fullscreen mode.
|
||||
|
||||
**Note:** On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](base-window.md#event-enter-full-screen) or ['leave-full-screen'](base-window.md#event-leave-full-screen) events.
|
||||
> [!NOTE]
|
||||
> On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](base-window.md#event-enter-full-screen) or > ['leave-full-screen'](base-window.md#event-leave-full-screen) events.
|
||||
|
||||
#### `win.isFullScreen()`
|
||||
|
||||
@@ -728,13 +743,15 @@ win.setBounds({ width: 100 })
|
||||
console.log(win.getBounds())
|
||||
```
|
||||
|
||||
**Note:** On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
|
||||
> [!NOTE]
|
||||
> On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
|
||||
|
||||
#### `win.getBounds()`
|
||||
|
||||
Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `Object`.
|
||||
|
||||
**Note:** On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
|
||||
> [!NOTE]
|
||||
> On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
|
||||
|
||||
#### `win.getBackgroundColor()`
|
||||
|
||||
@@ -742,7 +759,8 @@ Returns `string` - Gets the background color of the window in Hex (`#RRGGBB`) fo
|
||||
|
||||
See [Setting `backgroundColor`](browser-window.md#setting-the-backgroundcolor-property).
|
||||
|
||||
**Note:** The alpha value is _not_ returned alongside the red, green, and blue values.
|
||||
> [!NOTE]
|
||||
> The alpha value is _not_ returned alongside the red, green, and blue values.
|
||||
|
||||
#### `win.setContentBounds(bounds[, animate])`
|
||||
|
||||
@@ -760,7 +778,8 @@ Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window's cl
|
||||
|
||||
Returns [`Rectangle`](structures/rectangle.md) - Contains the window bounds of the normal state
|
||||
|
||||
**Note:** whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same [`Rectangle`](structures/rectangle.md).
|
||||
> [!NOTE]
|
||||
> Whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same [`Rectangle`](structures/rectangle.md).
|
||||
|
||||
#### `win.setEnabled(enable)`
|
||||
|
||||
@@ -957,8 +976,9 @@ Changes the title of native window to `title`.
|
||||
|
||||
Returns `string` - The title of the native window.
|
||||
|
||||
**Note:** The title of the web page can be different from the title of the native
|
||||
window.
|
||||
> [!NOTE]
|
||||
> The title of the web page can be different from the title of the native
|
||||
> window.
|
||||
|
||||
#### `win.setSheetOffset(offsetY[, offsetX])` _macOS_
|
||||
|
||||
@@ -1232,8 +1252,46 @@ in the taskbar.
|
||||
|
||||
Sets the properties for the window's taskbar button.
|
||||
|
||||
**Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
|
||||
together. If one of those properties is not set, then neither will be used.
|
||||
> [!NOTE]
|
||||
> `relaunchCommand` and `relaunchDisplayName` must always be set
|
||||
> together. If one of those properties is not set, then neither will be used.
|
||||
|
||||
#### `win.setAccentColor(accentColor)` _Windows_
|
||||
|
||||
* `accentColor` boolean | string - The accent color for the window. By default, follows user preference in System Settings.
|
||||
|
||||
Sets the system accent color and highlighting of active window border.
|
||||
|
||||
The `accentColor` parameter accepts the following values:
|
||||
|
||||
* **Color string** - Sets a custom accent color using standard CSS color formats (Hex, RGB, RGBA, HSL, HSLA, or named colors). Alpha values in RGBA/HSLA formats are ignored and the color is treated as fully opaque.
|
||||
* **`true`** - Uses the system's default accent color from user preferences in System Settings.
|
||||
* **`false`** - Explicitly disables accent color highlighting for the window.
|
||||
|
||||
Examples:
|
||||
|
||||
```js
|
||||
const win = new BrowserWindow({ frame: false })
|
||||
|
||||
// Set red accent color.
|
||||
win.setAccentColor('#ff0000')
|
||||
|
||||
// RGB format (alpha ignored if present).
|
||||
win.setAccentColor('rgba(255,0,0,0.5)')
|
||||
|
||||
// Use system accent color.
|
||||
win.setAccentColor(true)
|
||||
|
||||
// Disable accent color.
|
||||
win.setAccentColor(false)
|
||||
```
|
||||
|
||||
#### `win.getAccentColor()` _Windows_
|
||||
|
||||
Returns `string | boolean` - the system accent color and highlighting of active window border in Hex RGB format.
|
||||
|
||||
If a color has been set for the window that differs from the system accent color, the window accent color will
|
||||
be returned. Otherwise, a boolean will be returned, with `true` indicating that the window uses the global system accent color, and `false` indicating that accent color highlighting is disabled for this window.
|
||||
|
||||
#### `win.setIcon(icon)` _Windows_ _Linux_
|
||||
|
||||
@@ -1293,13 +1351,15 @@ maximize button, or by dragging it to the edges of the screen.
|
||||
|
||||
Sets whether the window should be visible on all workspaces.
|
||||
|
||||
**Note:** This API does nothing on Windows.
|
||||
> [!NOTE]
|
||||
> This API does nothing on Windows.
|
||||
|
||||
#### `win.isVisibleOnAllWorkspaces()` _macOS_ _Linux_
|
||||
|
||||
Returns `boolean` - Whether the window is visible on all workspaces.
|
||||
|
||||
**Note:** This API always returns false on Windows.
|
||||
> [!NOTE]
|
||||
> This API always returns false on Windows.
|
||||
|
||||
#### `win.setIgnoreMouseEvents(ignore[, options])`
|
||||
|
||||
@@ -1327,6 +1387,10 @@ On Windows it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`.
|
||||
For Windows 10 version 2004 and up the window will be removed from capture entirely,
|
||||
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
|
||||
|
||||
#### `win.isContentProtected()` _macOS_ _Windows_
|
||||
|
||||
Returns `boolean` - whether or not content protection is currently enabled.
|
||||
|
||||
#### `win.setFocusable(focusable)` _macOS_ _Windows_
|
||||
|
||||
* `focusable` boolean
|
||||
@@ -1416,7 +1480,8 @@ This method sets the browser window's system-drawn background material, includin
|
||||
|
||||
See the [Windows documentation](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type) for more details.
|
||||
|
||||
**Note:** This method is only supported on Windows 11 22H2 and up.
|
||||
> [!NOTE]
|
||||
> This method is only supported on Windows 11 22H2 and up.
|
||||
|
||||
#### `win.setWindowButtonPosition(position)` _macOS_
|
||||
|
||||
@@ -1438,8 +1503,9 @@ Sets the touchBar layout for the current window. Specifying `null` or
|
||||
`undefined` clears the touch bar. This method only has an effect if the
|
||||
machine has a touch bar.
|
||||
|
||||
**Note:** The TouchBar API is currently experimental and may change or be
|
||||
removed in future Electron releases.
|
||||
> [!NOTE]
|
||||
> The TouchBar API is currently experimental and may change or be
|
||||
> removed in future Electron releases.
|
||||
|
||||
#### `win.setTitleBarOverlay(options)` _Windows_ _Linux_
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ deprecated:
|
||||
```
|
||||
-->
|
||||
|
||||
> **Note**
|
||||
> [!NOTE]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -29,7 +29,7 @@ deprecated:
|
||||
|
||||
> Create and control views.
|
||||
|
||||
> **Note**
|
||||
> [!NOTE]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -38,6 +38,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
This module cannot be used until the `ready` event of the `app`
|
||||
module is emitted.
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### Example
|
||||
|
||||
```js
|
||||
@@ -176,4 +180,5 @@ Examples of valid `color` values:
|
||||
* Similar to CSS Color Module Level 3 keywords, but case-sensitive.
|
||||
* e.g. `blueviolet` or `red`
|
||||
|
||||
**Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`.
|
||||
> [!NOTE]
|
||||
> Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`.
|
||||
|
||||
@@ -150,6 +150,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new BrowserWindow([options])`
|
||||
|
||||
* `options` [BrowserWindowConstructorOptions](structures/browser-window-options.md?inline) (optional)
|
||||
@@ -158,7 +162,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
|
||||
Objects created with `new BrowserWindow` emit the following events:
|
||||
|
||||
**Note:** Some events are only available on specific operating systems and are
|
||||
> [!NOTE]
|
||||
> Some events are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
|
||||
#### Event: 'page-title-updated'
|
||||
@@ -200,7 +205,11 @@ window.onbeforeunload = (e) => {
|
||||
}
|
||||
```
|
||||
|
||||
_**Note**: There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and `window.addEventListener('beforeunload', handler)`. It is recommended to always set the `event.returnValue` explicitly, instead of only returning a value, as the former works more consistently within Electron._
|
||||
> [!NOTE]
|
||||
> There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and
|
||||
> `window.addEventListener('beforeunload', handler)`. It is recommended to always set the
|
||||
> `event.returnValue` explicitly, instead of only returning a value, as the former works more
|
||||
> consistently within Electron.
|
||||
|
||||
#### Event: 'closed'
|
||||
|
||||
@@ -323,7 +332,8 @@ Emitted when the window is being moved to a new position.
|
||||
|
||||
Emitted once when the window is moved to a new position.
|
||||
|
||||
**Note**: On macOS this event is an alias of `move`.
|
||||
> [!NOTE]
|
||||
> On macOS, this event is an alias of `move`.
|
||||
|
||||
#### Event: 'enter-full-screen'
|
||||
|
||||
@@ -435,7 +445,7 @@ as `-webkit-app-region: drag` in a frameless window.
|
||||
|
||||
Calling `event.preventDefault()` will prevent the menu from being displayed.
|
||||
|
||||
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows).
|
||||
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows-linux).
|
||||
|
||||
### Static Methods
|
||||
|
||||
@@ -460,7 +470,7 @@ or `null` if the contents are not owned by a window.
|
||||
|
||||
* `browserView` [BrowserView](browser-view.md)
|
||||
|
||||
> **Note**
|
||||
> [!NOTE]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -522,7 +532,8 @@ A `boolean` property that determines whether the window is focusable.
|
||||
|
||||
A `boolean` property that determines whether the window is visible on all workspaces.
|
||||
|
||||
**Note:** Always returns false on Windows.
|
||||
> [!NOTE]
|
||||
> Always returns false on Windows.
|
||||
|
||||
#### `win.shadow`
|
||||
|
||||
@@ -532,7 +543,8 @@ A `boolean` property that determines whether the window has a shadow.
|
||||
|
||||
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.
|
||||
> [!NOTE]
|
||||
> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||
|
||||
#### `win.kiosk`
|
||||
|
||||
@@ -553,7 +565,8 @@ and the icon of the file will show in window's title bar.
|
||||
|
||||
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.
|
||||
> [!NOTE]
|
||||
> The title of the web page can be different from the title of the native window.
|
||||
|
||||
#### `win.minimizable` _macOS_ _Windows_
|
||||
|
||||
@@ -621,8 +634,9 @@ A `boolean` property that indicates whether the window is arranged via [Snap.](h
|
||||
|
||||
Objects created with `new BrowserWindow` have the following instance methods:
|
||||
|
||||
**Note:** Some methods are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
> [!NOTE]
|
||||
> Some methods are only available on specific operating systems and are
|
||||
> labeled as such.
|
||||
|
||||
#### `win.destroy()`
|
||||
|
||||
@@ -704,13 +718,15 @@ Returns `boolean` - Whether the window is minimized.
|
||||
|
||||
Sets whether the window should be in fullscreen mode.
|
||||
|
||||
**Note:** On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events.
|
||||
> [!NOTE]
|
||||
> On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events.
|
||||
|
||||
#### `win.isFullScreen()`
|
||||
|
||||
Returns `boolean` - Whether the window is in fullscreen mode.
|
||||
|
||||
**Note:** On macOS, fullscreen transitions take place asynchronously. When querying for a BrowserWindow's fullscreen status, you should ensure that either the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events have been emitted.
|
||||
> [!NOTE]
|
||||
> On macOS, fullscreen transitions take place asynchronously. When querying for a BrowserWindow's fullscreen status, you should ensure that either the ['enter-full-screen'](browser-window.md#event-enter-full-screen) or ['leave-full-screen'](browser-window.md#event-leave-full-screen) events have been emitted.
|
||||
|
||||
#### `win.setSimpleFullScreen(flag)` _macOS_
|
||||
|
||||
@@ -820,13 +836,15 @@ win.setBounds({ width: 100 })
|
||||
console.log(win.getBounds())
|
||||
```
|
||||
|
||||
**Note:** On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
|
||||
> [!NOTE]
|
||||
> On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
|
||||
|
||||
#### `win.getBounds()`
|
||||
|
||||
Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `Object`.
|
||||
|
||||
**Note:** On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
|
||||
> [!NOTE]
|
||||
> On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
|
||||
|
||||
#### `win.getBackgroundColor()`
|
||||
|
||||
@@ -834,7 +852,8 @@ Returns `string` - Gets the background color of the window in Hex (`#RRGGBB`) fo
|
||||
|
||||
See [Setting `backgroundColor`](#setting-the-backgroundcolor-property).
|
||||
|
||||
**Note:** The alpha value is _not_ returned alongside the red, green, and blue values.
|
||||
> [!NOTE]
|
||||
> The alpha value is _not_ returned alongside the red, green, and blue values.
|
||||
|
||||
#### `win.setContentBounds(bounds[, animate])`
|
||||
|
||||
@@ -852,7 +871,8 @@ Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window's cl
|
||||
|
||||
Returns [`Rectangle`](structures/rectangle.md) - Contains the window bounds of the normal state
|
||||
|
||||
**Note:** whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same [`Rectangle`](structures/rectangle.md).
|
||||
> [!NOTE]
|
||||
> Whatever the current state of the window (maximized, minimized or in fullscreen), this function always returns the position and size of the window in normal state. In normal state, `getBounds` and `getNormalBounds` return the same [`Rectangle`](structures/rectangle.md).
|
||||
|
||||
#### `win.setEnabled(enable)`
|
||||
|
||||
@@ -1049,8 +1069,9 @@ Changes the title of native window to `title`.
|
||||
|
||||
Returns `string` - The title of the native window.
|
||||
|
||||
**Note:** The title of the web page can be different from the title of the native
|
||||
window.
|
||||
> [!NOTE]
|
||||
> The title of the web page can be different from the title of the native
|
||||
> window.
|
||||
|
||||
#### `win.setSheetOffset(offsetY[, offsetX])` _macOS_
|
||||
|
||||
@@ -1409,8 +1430,46 @@ in the taskbar.
|
||||
|
||||
Sets the properties for the window's taskbar button.
|
||||
|
||||
**Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
|
||||
together. If one of those properties is not set, then neither will be used.
|
||||
> [!NOTE]
|
||||
> `relaunchCommand` and `relaunchDisplayName` must always be set
|
||||
> together. If one of those properties is not set, then neither will be used.
|
||||
|
||||
#### `win.setAccentColor(accentColor)` _Windows_
|
||||
|
||||
* `accentColor` boolean | string - The accent color for the window. By default, follows user preference in System Settings.
|
||||
|
||||
Sets the system accent color and highlighting of active window border.
|
||||
|
||||
The `accentColor` parameter accepts the following values:
|
||||
|
||||
* **Color string** - Sets a custom accent color using standard CSS color formats (Hex, RGB, RGBA, HSL, HSLA, or named colors). Alpha values in RGBA/HSLA formats are ignored and the color is treated as fully opaque.
|
||||
* **`true`** - Uses the system's default accent color from user preferences in System Settings.
|
||||
* **`false`** - Explicitly disables accent color highlighting for the window.
|
||||
|
||||
Examples:
|
||||
|
||||
```js
|
||||
const win = new BrowserWindow({ frame: false })
|
||||
|
||||
// Set red accent color.
|
||||
win.setAccentColor('#ff0000')
|
||||
|
||||
// RGB format (alpha ignored if present).
|
||||
win.setAccentColor('rgba(255,0,0,0.5)')
|
||||
|
||||
// Use system accent color.
|
||||
win.setAccentColor(true)
|
||||
|
||||
// Disable accent color.
|
||||
win.setAccentColor(false)
|
||||
```
|
||||
|
||||
#### `win.getAccentColor()` _Windows_
|
||||
|
||||
Returns `string | boolean` - the system accent color and highlighting of active window border in Hex RGB format.
|
||||
|
||||
If a color has been set for the window that differs from the system accent color, the window accent color will
|
||||
be returned. Otherwise, a boolean will be returned, with `true` indicating that the window uses the global system accent color, and `false` indicating that accent color highlighting is disabled for this window.
|
||||
|
||||
#### `win.showDefinitionForSelection()` _macOS_
|
||||
|
||||
@@ -1474,13 +1533,15 @@ maximize button, or by dragging it to the edges of the screen.
|
||||
|
||||
Sets whether the window should be visible on all workspaces.
|
||||
|
||||
**Note:** This API does nothing on Windows.
|
||||
> [!NOTE]
|
||||
> This API does nothing on Windows.
|
||||
|
||||
#### `win.isVisibleOnAllWorkspaces()` _macOS_ _Linux_
|
||||
|
||||
Returns `boolean` - Whether the window is visible on all workspaces.
|
||||
|
||||
**Note:** This API always returns false on Windows.
|
||||
> [!NOTE]
|
||||
> This API always returns false on Windows.
|
||||
|
||||
#### `win.setIgnoreMouseEvents(ignore[, options])`
|
||||
|
||||
@@ -1503,11 +1564,15 @@ events.
|
||||
|
||||
Prevents the window contents from being captured by other apps.
|
||||
|
||||
On macOS it sets the NSWindow's sharingType to NSWindowSharingNone.
|
||||
On Windows it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`.
|
||||
On macOS it sets the NSWindow's [`sharingType`](https://developer.apple.com/documentation/appkit/nswindow/sharingtype-swift.property?language=objc) to [`NSWindowSharingNone`](https://developer.apple.com/documentation/appkit/nswindow/sharingtype-swift.enum/none?language=objc).
|
||||
On Windows it calls [`SetWindowDisplayAffinity`](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowdisplayaffinity) with `WDA_EXCLUDEFROMCAPTURE`.
|
||||
For Windows 10 version 2004 and up the window will be removed from capture entirely,
|
||||
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
|
||||
|
||||
#### `win.isContentProtected()` _macOS_ _Windows_
|
||||
|
||||
Returns `boolean` - whether or not content protection is currently enabled.
|
||||
|
||||
#### `win.setFocusable(focusable)` _macOS_ _Windows_
|
||||
|
||||
* `focusable` boolean
|
||||
@@ -1601,7 +1666,8 @@ This method sets the browser window's system-drawn background material, includin
|
||||
|
||||
See the [Windows documentation](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type) for more details.
|
||||
|
||||
**Note:** This method is only supported on Windows 11 22H2 and up.
|
||||
> [!NOTE]
|
||||
> This method is only supported on Windows 11 22H2 and up.
|
||||
|
||||
#### `win.setWindowButtonPosition(position)` _macOS_
|
||||
|
||||
@@ -1623,8 +1689,9 @@ Sets the touchBar layout for the current window. Specifying `null` or
|
||||
`undefined` clears the touch bar. This method only has an effect if the
|
||||
machine has a touch bar.
|
||||
|
||||
**Note:** The TouchBar API is currently experimental and may change or be
|
||||
removed in future Electron releases.
|
||||
> [!NOTE]
|
||||
> The TouchBar API is currently experimental and may change or be
|
||||
> removed in future Electron releases.
|
||||
|
||||
#### `win.setBrowserView(browserView)` _Experimental_ _Deprecated_
|
||||
|
||||
@@ -1632,7 +1699,7 @@ removed in future Electron releases.
|
||||
If there are other `BrowserView`s attached, they will be removed from
|
||||
this window.
|
||||
|
||||
> **Note**
|
||||
> [!WARNING]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -1641,7 +1708,7 @@ this window.
|
||||
Returns `BrowserView | null` - The `BrowserView` attached to `win`. Returns `null`
|
||||
if one is not attached. Throws an error if multiple `BrowserView`s are attached.
|
||||
|
||||
> **Note**
|
||||
> [!WARNING]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -1651,7 +1718,7 @@ if one is not attached. Throws an error if multiple `BrowserView`s are attached.
|
||||
|
||||
Replacement API for setBrowserView supporting work with multi browser views.
|
||||
|
||||
> **Note**
|
||||
> [!WARNING]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -1659,7 +1726,7 @@ Replacement API for setBrowserView supporting work with multi browser views.
|
||||
|
||||
* `browserView` [BrowserView](browser-view.md)
|
||||
|
||||
> **Note**
|
||||
> [!WARNING]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -1670,7 +1737,7 @@ Replacement API for setBrowserView supporting work with multi browser views.
|
||||
Raises `browserView` above other `BrowserView`s attached to `win`.
|
||||
Throws an error if `browserView` is not attached to `win`.
|
||||
|
||||
> **Note**
|
||||
> [!WARNING]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
@@ -1679,7 +1746,7 @@ Throws an error if `browserView` is not attached to `win`.
|
||||
Returns `BrowserView[]` - a sorted by z-index array of all BrowserViews that have been attached
|
||||
with `addBrowserView` or `setBrowserView`. The top-most BrowserView is the last element of the array.
|
||||
|
||||
> **Note**
|
||||
> [!WARNING]
|
||||
> The `BrowserView` class is deprecated, and replaced by the new
|
||||
> [`WebContentsView`](web-contents-view.md) class.
|
||||
|
||||
|
||||
@@ -60,6 +60,10 @@ following properties:
|
||||
`strict-origin-when-cross-origin`.
|
||||
* `cache` string (optional) - can be `default`, `no-store`, `reload`,
|
||||
`no-cache`, `force-cache` or `only-if-cached`.
|
||||
* `priority` string (optional) - can be `throttled`, `idle`, `lowest`,
|
||||
`low`, `medium`, or `highest`. Defaults to `idle`.
|
||||
* `priorityIncremental` boolean (optional) - the incremental loading flag as part
|
||||
of HTTP extensible priorities (RFC 9218). Default is `true`.
|
||||
|
||||
`options` properties such as `protocol`, `host`, `hostname`, `port` and `path`
|
||||
strictly follow the Node.js model as described in the
|
||||
|
||||
@@ -18,7 +18,8 @@ console.log(clipboard.readText('selection'))
|
||||
|
||||
The `clipboard` module has the following methods:
|
||||
|
||||
**Note:** Experimental APIs are marked as such and could be removed in future.
|
||||
> [!NOTE]
|
||||
> Experimental APIs are marked as such and could be removed in future.
|
||||
|
||||
### `clipboard.readText([type])`
|
||||
|
||||
@@ -141,9 +142,10 @@ bookmark is unavailable. The `title` value will always be empty on Windows.
|
||||
|
||||
Writes the `title` (macOS only) and `url` into the clipboard as a bookmark.
|
||||
|
||||
**Note:** Most apps on Windows don't support pasting bookmarks into them so
|
||||
you can use `clipboard.write` to write both a bookmark and fallback text to the
|
||||
clipboard.
|
||||
> [!NOTE]
|
||||
> Most apps on Windows don't support pasting bookmarks into them so
|
||||
> you can use `clipboard.write` to write both a bookmark and fallback text to the
|
||||
> clipboard.
|
||||
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
@@ -73,7 +73,8 @@ Passing `--enable-logging=file` will result in logs being saved to the file
|
||||
specified by `--log-file=...`, or to `electron_debug.log` in the user-data
|
||||
directory if `--log-file` is not specified.
|
||||
|
||||
> **Note:** On Windows, logs from child processes cannot be sent to stderr.
|
||||
> [!NOTE]
|
||||
> On Windows, logs from child processes cannot be sent to stderr.
|
||||
> Logging to a file is the most reliable way to collect logs on Windows.
|
||||
|
||||
See also `--log-file`, `--log-level`, `--v`, and `--vmodule`.
|
||||
@@ -252,9 +253,10 @@ the required version is unavailable. Current default is set to `3`.
|
||||
|
||||
Electron supports some of the [CLI flags][node-cli] supported by Node.js.
|
||||
|
||||
**Note:** Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
|
||||
> [!NOTE]
|
||||
> Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
|
||||
|
||||
### `--inspect-brk\[=\[host:]port]`
|
||||
### `--inspect-brk[=[host:]port]`
|
||||
|
||||
Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.
|
||||
|
||||
@@ -266,13 +268,13 @@ Activate inspector on `host:port` and break at start of the first internal
|
||||
JavaScript script executed when the inspector is available.
|
||||
Default `host:port` is `127.0.0.1:9229`.
|
||||
|
||||
### `--inspect-port=\[host:]port`
|
||||
### `--inspect-port=[host:]port`
|
||||
|
||||
Set the `host:port` to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is `127.0.0.1`.
|
||||
|
||||
Aliased to `--debug-port=[host:]port`.
|
||||
|
||||
### `--inspect\[=\[host:]port]`
|
||||
### `--inspect[=[host:]port]`
|
||||
|
||||
Activate inspector on `host:port`. Default is `127.0.0.1:9229`.
|
||||
|
||||
@@ -288,6 +290,10 @@ Specify ways of the inspector web socket url exposure.
|
||||
|
||||
By default inspector websocket url is available in stderr and under /json/list endpoint on `http://host:port/json/list`.
|
||||
|
||||
### `--experimental-network-inspection`
|
||||
|
||||
Enable support for devtools network inspector events, for visibility into requests made by the nodejs `http` and `https` modules.
|
||||
|
||||
### `--no-deprecation`
|
||||
|
||||
Silence deprecation warnings.
|
||||
@@ -319,6 +325,10 @@ Set the directory to which all Node.js diagnostic output files are written. Defa
|
||||
|
||||
Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https://nodejs.org/docs/latest/api/v8.html#v8setheapsnapshotnearheaplimitlimit).
|
||||
|
||||
### `--no-experimental-global-navigator`
|
||||
|
||||
Disable exposition of [Navigator API][] on the global scope from Node.js.
|
||||
|
||||
[app]: app.md
|
||||
[append-switch]: command-line.md#commandlineappendswitchswitch-value
|
||||
[debugging-main-process]: ../tutorial/debugging-main-process.md
|
||||
@@ -327,3 +337,4 @@ Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https:
|
||||
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
|
||||
[ready]: app.md#event-ready
|
||||
[severities]: https://source.chromium.org/chromium/chromium/src/+/main:base/logging.h?q=logging::LogSeverity&ss=chromium
|
||||
[Navigator API]: https://github.com/nodejs/node/blob/main/doc/api/globals.md#navigator
|
||||
|
||||
@@ -25,8 +25,9 @@ document.
|
||||
|
||||
Append a switch (with optional `value`) to Chromium's command line.
|
||||
|
||||
**Note:** This will not affect `process.argv`. The intended usage of this function is to
|
||||
control Chromium's behavior.
|
||||
> [!NOTE]
|
||||
> This will not affect `process.argv`. The intended usage of this function is to
|
||||
> control Chromium's behavior.
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
@@ -49,8 +50,9 @@ const { app } = require('electron')
|
||||
app.commandLine.appendArgument('--enable-experimental-web-platform-features')
|
||||
```
|
||||
|
||||
**Note:** This will not affect `process.argv`. The intended usage of this function is to
|
||||
control Chromium's behavior.
|
||||
> [!NOTE]
|
||||
> This will not affect `process.argv`. The intended usage of this function is to
|
||||
> control Chromium's behavior.
|
||||
|
||||
#### `commandLine.hasSwitch(switch)`
|
||||
|
||||
@@ -84,7 +86,8 @@ const portValue = app.commandLine.getSwitchValue('remote-debugging-port')
|
||||
console.log(portValue) // '8315'
|
||||
```
|
||||
|
||||
**Note:** When the switch is not present or has no value, it returns empty string.
|
||||
> [!NOTE]
|
||||
> When the switch is not present or has no value, it returns empty string.
|
||||
|
||||
#### `commandLine.removeSwitch(switch)`
|
||||
|
||||
@@ -102,5 +105,6 @@ app.commandLine.removeSwitch('remote-debugging-port')
|
||||
console.log(app.commandLine.hasSwitch('remote-debugging-port')) // false
|
||||
```
|
||||
|
||||
**Note:** This will not affect `process.argv`. The intended usage of this function is to
|
||||
control Chromium's behavior.
|
||||
> [!NOTE]
|
||||
> This will not affect `process.argv`. The intended usage of this function is to
|
||||
> control Chromium's behavior.
|
||||
|
||||
@@ -7,8 +7,9 @@ Process: [Main](../glossary.md#main-process)
|
||||
This module does not include a web interface. To view recorded traces, use
|
||||
[trace viewer][], available at `chrome://tracing` in Chrome.
|
||||
|
||||
**Note:** You should not use this module until the `ready` event of the app
|
||||
module is emitted.
|
||||
> [!NOTE]
|
||||
> You should not use this module until the `ready` event of the app
|
||||
> module is emitted.
|
||||
|
||||
```js
|
||||
const { app, contentTracing } = require('electron')
|
||||
|
||||
@@ -51,19 +51,17 @@ Use the `system-ui` keyword to match the smoothness to the OS design language.
|
||||
|
||||
### Controlling availibility
|
||||
|
||||
This CSS rule can be disabled by setting [the `cornerSmoothingCSS` web preference](./structures/web-preferences.md) to `false`.
|
||||
This CSS rule can be disabled using the Blink feature flag `ElectronCSSCornerSmoothing`.
|
||||
|
||||
```js
|
||||
const myWindow = new BrowserWindow({
|
||||
// [...]
|
||||
webPreferences: {
|
||||
enableCornerSmoothingCSS: false // Disables the `-electron-corner-smoothing` CSS rule
|
||||
disableBlinkFeatures: 'ElectronCSSCornerSmoothing' // Disables the `-electron-corner-smoothing` CSS rule
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
The CSS rule will still parse, but will have no visual effect.
|
||||
|
||||
### Formal reference
|
||||
|
||||
* **Initial value**: `0%`
|
||||
|
||||
@@ -19,7 +19,8 @@ following projects:
|
||||
* [socorro](https://github.com/mozilla-services/socorro)
|
||||
* [mini-breakpad-server](https://github.com/electron/mini-breakpad-server)
|
||||
|
||||
> **Note:** Electron uses Crashpad, not Breakpad, to collect and upload
|
||||
> [!NOTE]
|
||||
> Electron uses Crashpad, not Breakpad, to collect and upload
|
||||
> crashes, but for the time being, the [upload protocol is the same](https://chromium.googlesource.com/crashpad/crashpad/+/HEAD/doc/overview_design.md#Upload-to-collection-server).
|
||||
|
||||
Or use a 3rd party hosted solution:
|
||||
@@ -62,7 +63,7 @@ The `crashReporter` module has the following methods:
|
||||
* `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
|
||||
child processes will not include these extra parameters. To add extra
|
||||
parameters to crash reports generated from child processes, call
|
||||
[`addExtraParameter`](#crashreporteraddextraparameterkey-value) from the
|
||||
child process.
|
||||
@@ -84,19 +85,23 @@ 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:** You can test out the crash reporter by generating a crash using
|
||||
`process.crash()`.
|
||||
> [!NOTE]
|
||||
> You can test out the crash reporter by generating a crash using
|
||||
> `process.crash()`.
|
||||
|
||||
**Note:** If you need to send additional/updated `extra` parameters after your
|
||||
first call `start` you can call `addExtraParameter`.
|
||||
> [!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]
|
||||
> 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:** This method is only available in the main process.
|
||||
> [!NOTE]
|
||||
> This method is only available in the main process.
|
||||
|
||||
### `crashReporter.getLastCrashReport()`
|
||||
|
||||
@@ -105,7 +110,8 @@ 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.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
> [!NOTE]
|
||||
> This method is only available in the main process.
|
||||
|
||||
### `crashReporter.getUploadedReports()`
|
||||
|
||||
@@ -114,14 +120,16 @@ Returns [`CrashReport[]`](structures/crash-report.md):
|
||||
Returns all uploaded crash reports. Each report contains the date and uploaded
|
||||
ID.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
> [!NOTE]
|
||||
> This method is only available in the main process.
|
||||
|
||||
### `crashReporter.getUploadToServer()`
|
||||
|
||||
Returns `boolean` - Whether reports should be submitted to the server. Set through
|
||||
the `start` method or `setUploadToServer`.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
> [!NOTE]
|
||||
> This method is only available in the main process.
|
||||
|
||||
### `crashReporter.setUploadToServer(uploadToServer)`
|
||||
|
||||
@@ -130,7 +138,8 @@ the `start` method or `setUploadToServer`.
|
||||
This would normally be controlled by user preferences. This has no effect if
|
||||
called before `start` is called.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
> [!NOTE]
|
||||
> This method is only available in the main process.
|
||||
|
||||
### `crashReporter.addExtraParameter(key, value)`
|
||||
|
||||
@@ -148,10 +157,11 @@ 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]
|
||||
> 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.
|
||||
|
||||
### `crashReporter.removeExtraParameter(key)`
|
||||
|
||||
|
||||
@@ -70,8 +70,9 @@ stopButton.addEventListener('click', () => {
|
||||
|
||||
See [`navigator.mediaDevices.getDisplayMedia`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia) for more information.
|
||||
|
||||
**Note:** `navigator.mediaDevices.getDisplayMedia` does not permit the use of `deviceId` for
|
||||
selection of a source - see [specification](https://w3c.github.io/mediacapture-screen-share/#constraints).
|
||||
> [!NOTE]
|
||||
> `navigator.mediaDevices.getDisplayMedia` does not permit the use of `deviceId` for
|
||||
> selection of a source - see [specification](https://w3c.github.io/mediacapture-screen-share/#constraints).
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -92,8 +93,9 @@ The `desktopCapturer` module has the following methods:
|
||||
|
||||
Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`DesktopCapturerSource`](structures/desktop-capturer-source.md) objects, each `DesktopCapturerSource` represents a screen or an individual window that can be captured.
|
||||
|
||||
**Note** Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
|
||||
which can detected by [`systemPreferences.getMediaAccessStatus`][].
|
||||
> [!NOTE]
|
||||
> Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
|
||||
> which can detected by [`systemPreferences.getMediaAccessStatus`][].
|
||||
|
||||
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
|
||||
[`systemPreferences.getMediaAccessStatus`]: system-preferences.md#systempreferencesgetmediaaccessstatusmediatype-windows-macos
|
||||
|
||||
@@ -67,10 +67,11 @@ The `extensions` array should contain extensions without wildcards or dots (e.g.
|
||||
`'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
|
||||
`'*'` wildcard (no other wildcard is supported).
|
||||
|
||||
**Note:** On Windows and Linux an open dialog can not be both a file selector
|
||||
and a directory selector, so if you set `properties` to
|
||||
`['openFile', 'openDirectory']` on these platforms, a directory selector will be
|
||||
shown.
|
||||
> [!NOTE]
|
||||
> On Windows and Linux an open dialog can not be both a file selector
|
||||
> and a directory selector, so if you set `properties` to
|
||||
> `['openFile', 'openDirectory']` on these platforms, a directory selector will be
|
||||
> shown.
|
||||
|
||||
```js @ts-type={mainWindow:Electron.BaseWindow}
|
||||
dialog.showOpenDialogSync(mainWindow, {
|
||||
@@ -78,10 +79,11 @@ dialog.showOpenDialogSync(mainWindow, {
|
||||
})
|
||||
```
|
||||
|
||||
**Note:** On Linux `defaultPath` is not supported when using portal file chooser
|
||||
dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
|
||||
[command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
|
||||
to force gtk or kde dialogs.
|
||||
> [!NOTE]
|
||||
> On Linux `defaultPath` is not supported when using portal file chooser
|
||||
> dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
|
||||
> [command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
|
||||
> to force gtk or kde dialogs.
|
||||
|
||||
### `dialog.showOpenDialog([window, ]options)`
|
||||
|
||||
@@ -139,10 +141,11 @@ The `extensions` array should contain extensions without wildcards or dots (e.g.
|
||||
`'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
|
||||
`'*'` wildcard (no other wildcard is supported).
|
||||
|
||||
**Note:** On Windows and Linux an open dialog can not be both a file selector
|
||||
and a directory selector, so if you set `properties` to
|
||||
`['openFile', 'openDirectory']` on these platforms, a directory selector will be
|
||||
shown.
|
||||
> [!NOTE]
|
||||
> On Windows and Linux an open dialog can not be both a file selector
|
||||
> and a directory selector, so if you set `properties` to
|
||||
> `['openFile', 'openDirectory']` on these platforms, a directory selector will be
|
||||
> shown.
|
||||
|
||||
```js @ts-type={mainWindow:Electron.BaseWindow}
|
||||
dialog.showOpenDialog(mainWindow, {
|
||||
@@ -155,10 +158,11 @@ dialog.showOpenDialog(mainWindow, {
|
||||
})
|
||||
```
|
||||
|
||||
**Note:** On Linux `defaultPath` is not supported when using portal file chooser
|
||||
dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
|
||||
[command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
|
||||
to force gtk or kde dialogs.
|
||||
> [!NOTE]
|
||||
> On Linux `defaultPath` is not supported when using portal file chooser
|
||||
> dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
|
||||
> [command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
|
||||
> to force gtk or kde dialogs.
|
||||
|
||||
### `dialog.showSaveDialogSync([window, ]options)`
|
||||
|
||||
@@ -225,8 +229,9 @@ The `window` argument allows the dialog to attach itself to a parent window, mak
|
||||
The `filters` specifies an array of file types that can be displayed, see
|
||||
`dialog.showOpenDialog` for an example.
|
||||
|
||||
**Note:** On macOS, using the asynchronous version is recommended to avoid issues when
|
||||
expanding and collapsing the dialog.
|
||||
> [!NOTE]
|
||||
> On macOS, using the asynchronous version is recommended to avoid issues when
|
||||
> expanding and collapsing the dialog.
|
||||
|
||||
### `dialog.showMessageBoxSync([window, ]options)`
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ When `informational` is passed, the dock icon will bounce for one second.
|
||||
However, the request remains active until either the application becomes active
|
||||
or the request is canceled.
|
||||
|
||||
**Note:** This method can only be used while the app is not focused; when the app is focused it will return -1.
|
||||
> [!NOTE]
|
||||
> This method can only be used while the app is not focused; when the app is focused it will return -1.
|
||||
|
||||
#### `dock.cancelBounce(id)` _macOS_
|
||||
|
||||
|
||||
@@ -115,7 +115,8 @@ Returns `boolean` - Whether the download is paused.
|
||||
|
||||
Resumes the download that has been paused.
|
||||
|
||||
**Note:** To enable resumable downloads the server you are downloading from must support range requests and provide both `Last-Modified` and `ETag` header values. Otherwise `resume()` will dismiss previously received bytes and restart the download from the beginning.
|
||||
> [!NOTE]
|
||||
> To enable resumable downloads the server you are downloading from must support range requests and provide both `Last-Modified` and `ETag` header values. Otherwise `resume()` will dismiss previously received bytes and restart the download from the beginning.
|
||||
|
||||
#### `downloadItem.canResume()`
|
||||
|
||||
@@ -141,9 +142,10 @@ Returns `boolean` - Whether the download has user gesture.
|
||||
|
||||
Returns `string` - The file name of the download item.
|
||||
|
||||
**Note:** The file name is not always the same as the actual one saved in local
|
||||
disk. If user changes the file name in a prompted download saving dialog, the
|
||||
actual name of saved file will be different.
|
||||
> [!NOTE]
|
||||
> The file name is not always the same as the actual one saved in local
|
||||
> disk. If user changes the file name in a prompted download saving dialog, the
|
||||
> actual name of saved file will be different.
|
||||
|
||||
#### `downloadItem.getCurrentBytesPerSecond()`
|
||||
|
||||
@@ -172,8 +174,9 @@ header.
|
||||
|
||||
Returns `string` - The current state. Can be `progressing`, `completed`, `cancelled` or `interrupted`.
|
||||
|
||||
**Note:** The following methods are useful specifically to resume a
|
||||
`cancelled` item when session is restarted.
|
||||
> [!NOTE]
|
||||
> The following methods are useful specifically to resume a
|
||||
> `cancelled` item when session is restarted.
|
||||
|
||||
#### `downloadItem.getURLChain()`
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ you would when running the normal Node.js executable, with the exception of the
|
||||
These flags are disabled owing to the fact that Electron uses BoringSSL instead of OpenSSL when building Node.js'
|
||||
`crypto` module, and so will not work as designed.
|
||||
|
||||
If the [`runAsNode` fuse](../tutorial/fuses.md#L13) is disabled, `ELECTRON_RUN_AS_NODE` will be ignored.
|
||||
If the [`runAsNode` fuse](../tutorial/fuses.md#runasnode) is disabled, `ELECTRON_RUN_AS_NODE` will be ignored.
|
||||
|
||||
### `ELECTRON_NO_ATTACH_CONSOLE` _Windows_
|
||||
|
||||
|
||||
@@ -92,11 +92,13 @@ app.whenReady().then(async () => {
|
||||
|
||||
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.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
**Note:** Loading extensions into in-memory (non-persistent) sessions is not
|
||||
supported and will throw an error.
|
||||
> [!NOTE]
|
||||
> Loading extensions into in-memory (non-persistent) sessions is not
|
||||
> supported and will throw an error.
|
||||
|
||||
#### `extensions.removeExtension(extensionId)`
|
||||
|
||||
@@ -104,8 +106,9 @@ supported and will throw an error.
|
||||
|
||||
Unloads an extension.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
#### `extensions.getExtension(extensionId)`
|
||||
|
||||
@@ -113,12 +116,14 @@ is emitted.
|
||||
|
||||
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.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
#### `extensions.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.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
@@ -6,7 +6,8 @@ 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
|
||||
> [!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.
|
||||
|
||||
@@ -160,7 +161,8 @@ The following methods of `chrome.tabs` are supported:
|
||||
- `chrome.tabs.update` (partial support)
|
||||
- supported properties: `url`, `muted`.
|
||||
|
||||
> **Note:** In Chrome, passing `-1` as a tab ID signifies the "currently active
|
||||
> [!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.
|
||||
|
||||
@@ -170,6 +172,7 @@ See [official documentation](https://developer.chrome.com/docs/extensions/refere
|
||||
|
||||
All features of this API are supported.
|
||||
|
||||
> **NOTE:** Electron's [`webRequest`](web-request.md) module takes precedence over `chrome.webRequest` if there are conflicting handlers.
|
||||
> [!NOTE]
|
||||
> Electron's [`webRequest`](web-request.md) module takes precedence over `chrome.webRequest` if there are conflicting handlers.
|
||||
|
||||
See [official documentation](https://developer.chrome.com/docs/extensions/reference/webRequest) for more information.
|
||||
|
||||
@@ -8,13 +8,13 @@ The `globalShortcut` module can register/unregister a global keyboard shortcut
|
||||
with the operating system so that you can customize the operations for various
|
||||
shortcuts.
|
||||
|
||||
**Note:** The shortcut is global; it will work even if the app does
|
||||
not have the keyboard focus. This module cannot be used before the `ready`
|
||||
event of the app module is emitted.
|
||||
|
||||
Please also note that it is also possible to use Chromium's
|
||||
`GlobalShortcutsPortal` implementation, which allows apps to bind global
|
||||
shortcuts when running within a Wayland session.
|
||||
> [!NOTE]
|
||||
> The shortcut is global; it will work even if the app does
|
||||
> not have the keyboard focus. This module cannot be used before the `ready`
|
||||
> event of the app module is emitted.
|
||||
> Please also note that it is also possible to use Chromium's
|
||||
> `GlobalShortcutsPortal` implementation, which allows apps to bind global
|
||||
> shortcuts when running within a Wayland session.
|
||||
|
||||
```js
|
||||
const { app, globalShortcut } = require('electron')
|
||||
|
||||
65
docs/api/image-view.md
Normal file
65
docs/api/image-view.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# ImageView
|
||||
|
||||
> A View that displays an image.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
This module cannot be used until the `ready` event of the `app`
|
||||
module is emitted.
|
||||
|
||||
Useful for showing splash screens that will be swapped for `WebContentsView`s
|
||||
when the content finishes loading.
|
||||
|
||||
Note that `ImageView` is experimental and may be changed or removed in the future.
|
||||
|
||||
```js
|
||||
const { BaseWindow, ImageView, nativeImage, WebContentsView } = require('electron')
|
||||
const path = require('node:path')
|
||||
|
||||
const win = new BaseWindow({ width: 800, height: 600 })
|
||||
|
||||
// Create a "splash screen" image to display while the WebContentsView loads
|
||||
const splashView = new ImageView()
|
||||
const splashImage = nativeImage.createFromPath(path.join(__dirname, 'loading.png'))
|
||||
splashView.setImage(splashImage)
|
||||
win.setContentView(splashView)
|
||||
|
||||
const webContentsView = new WebContentsView()
|
||||
webContentsView.webContents.once('did-finish-load', () => {
|
||||
// Now that the WebContentsView has loaded, swap out the "splash screen" ImageView
|
||||
win.setContentView(webContentsView)
|
||||
})
|
||||
webContentsView.webContents.loadURL('https://electronjs.org')
|
||||
```
|
||||
|
||||
## Class: ImageView extends `View`
|
||||
|
||||
> A View that displays an image.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
`ImageView` inherits from [`View`](view.md).
|
||||
|
||||
`ImageView` is an [EventEmitter][event-emitter].
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new ImageView()` _Experimental_
|
||||
|
||||
Creates an ImageView.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
The following methods are available on instances of the `ImageView` class, in
|
||||
addition to those inherited from [View](view.md):
|
||||
|
||||
#### `image.setImage(image)` _Experimental_
|
||||
|
||||
* `image` NativeImage
|
||||
|
||||
Sets the image for this `ImageView`. Note that only image formats supported by
|
||||
`NativeImage` can be used with an `ImageView`.
|
||||
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
@@ -11,6 +11,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
<!-- TODO(samuelmaddock): refactor doc gen to allow generics to reduce duplication -->
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### Instance Methods
|
||||
|
||||
#### `ipcMainServiceWorker.on(channel, listener)`
|
||||
|
||||
@@ -156,7 +156,7 @@ If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRender
|
||||
|
||||
If you do not need a response to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
|
||||
|
||||
> **Note**
|
||||
> [!NOTE]
|
||||
> Sending non-standard JavaScript types such as DOM objects or
|
||||
> special Electron objects will throw an exception.
|
||||
>
|
||||
@@ -165,7 +165,7 @@ If you do not need a response to the message, consider using [`ipcRenderer.send`
|
||||
> Electron's IPC to the main process, as the main process would have no way to decode
|
||||
> them. Attempting to send such objects over IPC will result in an error.
|
||||
|
||||
> **Note**
|
||||
> [!NOTE]
|
||||
> If the handler in the main process throws an error,
|
||||
> the promise returned by `invoke` will reject.
|
||||
> However, the `Error` object in the renderer process
|
||||
@@ -195,7 +195,8 @@ throw an exception.
|
||||
The main process handles it by listening for `channel` with [`ipcMain`](./ipc-main.md) module,
|
||||
and replies by setting `event.returnValue`.
|
||||
|
||||
> :warning: **WARNING**: Sending a synchronous message will block the whole
|
||||
> [!WARNING]
|
||||
> Sending a synchronous message will block the whole
|
||||
> renderer process until the reply is received, so use this method only as a
|
||||
> last resort. It's much better to use the asynchronous version,
|
||||
> [`invoke()`](./ipc-renderer.md#ipcrendererinvokechannel-args).
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# MenuItem
|
||||
|
||||
## Class: MenuItem
|
||||
|
||||
> Add items to native application menus and context menus.
|
||||
@@ -6,6 +8,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
See [`Menu`](menu.md) for examples.
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new MenuItem(options)`
|
||||
|
||||
* `options` Object
|
||||
@@ -16,10 +22,16 @@ See [`Menu`](menu.md) for examples.
|
||||
* `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`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`, `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `showAllTabs`, `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`.
|
||||
* `type` string (optional)
|
||||
* `normal`
|
||||
* `separator`
|
||||
* `submenu`
|
||||
* `checkbox`
|
||||
* `radio`
|
||||
* `header` - Only available on macOS 14 and up.
|
||||
* `palette` - Only available on macOS 14 and up.
|
||||
* `label` string (optional)
|
||||
* `sublabel` string (optional)
|
||||
* `sublabel` string (optional) _macOS_ - Available in macOS >= 14.4
|
||||
* `toolTip` string (optional) _macOS_ - Hover text for this menu item.
|
||||
* `accelerator` [Accelerator](accelerator.md) (optional)
|
||||
* `icon` ([NativeImage](native-image.md) | string) (optional)
|
||||
@@ -51,7 +63,8 @@ See [`Menu`](menu.md) for examples.
|
||||
the placement of their containing group after the containing group of the item
|
||||
with the specified id.
|
||||
|
||||
**Note:** `acceleratorWorksWhenHidden` is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development.
|
||||
> [!NOTE]
|
||||
> `acceleratorWorksWhenHidden` is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development.
|
||||
|
||||
### Roles
|
||||
|
||||
@@ -125,7 +138,8 @@ 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.
|
||||
|
||||
**Note:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
|
||||
> [!NOTE]
|
||||
> The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
@@ -156,7 +170,10 @@ item's submenu, if present.
|
||||
|
||||
#### `menuItem.type`
|
||||
|
||||
A `string` indicating the type of the item. Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
|
||||
A `string` indicating the type of the item. Can be `normal`, `separator`, `submenu`, `checkbox`, `radio`, `header` or `palette`.
|
||||
|
||||
> [!NOTE]
|
||||
> `header` and `palette` are only available on macOS 14 and up.
|
||||
|
||||
#### `menuItem.role`
|
||||
|
||||
@@ -170,7 +187,8 @@ An `Accelerator` (optional) indicating the item's accelerator, if set.
|
||||
|
||||
An `Accelerator | null` indicating the item's [user-assigned accelerator](https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc) for the menu item.
|
||||
|
||||
**Note:** This property is only initialized after the `MenuItem` has been added to a `Menu`. Either via `Menu.buildFromTemplate` or via `Menu.append()/insert()`. Accessing before initialization will just return `null`.
|
||||
> [!NOTE]
|
||||
> This property is only initialized after the `MenuItem` has been added to a `Menu`. Either via `Menu.buildFromTemplate` or via `Menu.append()/insert()`. Accessing before initialization will just return `null`.
|
||||
|
||||
#### `menuItem.icon`
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new Menu()`
|
||||
|
||||
Creates a new menu.
|
||||
@@ -32,16 +36,18 @@ In order to escape the `&` character in an item name, add a proceeding `&`. For
|
||||
Passing `null` will suppress the default menu. On Windows and Linux,
|
||||
this has the additional effect of removing the menu bar from the window.
|
||||
|
||||
**Note:** The default menu will be created automatically if the app does not set one.
|
||||
It contains standard items such as `File`, `Edit`, `View`, `Window` and `Help`.
|
||||
> [!NOTE]
|
||||
> The default menu will be created automatically if the app does not set one.
|
||||
> It contains standard items such as `File`, `Edit`, `View`, `Window` and `Help`.
|
||||
|
||||
#### `Menu.getApplicationMenu()`
|
||||
|
||||
Returns `Menu | null` - The application menu, if set, or `null`, if not set.
|
||||
|
||||
**Note:** The returned `Menu` instance doesn't support dynamic addition or
|
||||
removal of menu items. [Instance properties](#instance-properties) can still
|
||||
be dynamically modified.
|
||||
> [!NOTE]
|
||||
> The returned `Menu` instance doesn't support dynamic addition or
|
||||
> removal of menu items. [Instance properties](#instance-properties) can still
|
||||
> be dynamically modified.
|
||||
|
||||
#### `Menu.sendActionToFirstResponder(action)` _macOS_
|
||||
|
||||
@@ -119,8 +125,9 @@ Inserts the `menuItem` to the `pos` position of the menu.
|
||||
|
||||
Objects created with `new Menu` or returned by `Menu.buildFromTemplate` emit the following events:
|
||||
|
||||
**Note:** Some events are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
> [!NOTE]
|
||||
> Some events are only available on specific operating systems and are
|
||||
> labeled as such.
|
||||
|
||||
#### Event: 'menu-will-show'
|
||||
|
||||
@@ -329,6 +336,27 @@ name, no matter what label you set. To change it, modify your app bundle's
|
||||
[About Information Property List Files][AboutInformationPropertyListFiles]
|
||||
for more information.
|
||||
|
||||
### Menu Sublabels
|
||||
|
||||
Menu sublabels, or [subtitles](https://developer.apple.com/documentation/appkit/nsmenuitem/subtitle?language=objc), can be added to menu items using the `sublabel` option. Below is an example based on the renderer example above:
|
||||
|
||||
```js @ts-expect-error=[12]
|
||||
// main
|
||||
ipcMain.on('show-context-menu', (event) => {
|
||||
const template = [
|
||||
{
|
||||
label: 'Menu Item 1',
|
||||
sublabel: 'Subtitle 1',
|
||||
click: () => { event.sender.send('context-menu-command', 'menu-item-1') }
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{ label: 'Menu Item 2', sublabel: 'Subtitle 2', type: 'checkbox', checked: true }
|
||||
]
|
||||
const menu = Menu.buildFromTemplate(template)
|
||||
menu.popup({ window: BrowserWindow.fromWebContents(event.sender) })
|
||||
})
|
||||
```
|
||||
|
||||
## Setting Menu for Specific Browser Window (_Linux_ _Windows_)
|
||||
|
||||
The [`setMenu` method][setMenu] of browser windows can set the menu of certain
|
||||
|
||||
@@ -33,6 +33,10 @@ ipcRenderer.on('port', (e) => {
|
||||
})
|
||||
```
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### Instance Properties
|
||||
|
||||
#### `channel.port1`
|
||||
|
||||
@@ -134,7 +134,8 @@ Creates an empty `NativeImage` instance.
|
||||
|
||||
Returns `Promise<NativeImage>` - fulfilled with the file's thumbnail preview image, which is a [NativeImage](native-image.md).
|
||||
|
||||
Note: The Windows implementation will ignore `size.height` and scale the height according to `size.width`.
|
||||
> [!NOTE]
|
||||
> Windows implementation will ignore `size.height` and scale the height according to `size.width`.
|
||||
|
||||
### `nativeImage.createFromPath(path)`
|
||||
|
||||
@@ -142,8 +143,8 @@ Note: The Windows implementation will ignore `size.height` and scale the height
|
||||
|
||||
Returns `NativeImage`
|
||||
|
||||
Creates a new `NativeImage` instance from a file located at `path`. This method
|
||||
returns an empty image if the `path` does not exist, cannot be read, or is not
|
||||
Creates a new `NativeImage` instance from an image file (e.g., PNG or JPEG) located at `path`.
|
||||
This method returns an empty image if the `path` does not exist, cannot be read, or is not
|
||||
a valid image.
|
||||
|
||||
```js
|
||||
|
||||
@@ -17,8 +17,9 @@ app.whenReady().then(async () => {
|
||||
|
||||
See [`--log-net-log`](command-line-switches.md#--log-net-logpath) to log network events throughout the app's lifecycle.
|
||||
|
||||
**Note:** All methods unless specified can only be used after the `ready` event
|
||||
of the `app` module gets emitted.
|
||||
> [!NOTE]
|
||||
> All methods unless specified can only be used after the `ready` event
|
||||
> of the `app` module gets emitted.
|
||||
|
||||
## Methods
|
||||
|
||||
|
||||
@@ -117,8 +117,9 @@ protocol.handle('https', (req) => {
|
||||
})
|
||||
```
|
||||
|
||||
Note: in the [utility process](../glossary.md#utility-process) custom protocols
|
||||
are not supported.
|
||||
> [!NOTE]
|
||||
> In the [utility process](../glossary.md#utility-process), custom protocols
|
||||
> are not supported.
|
||||
|
||||
### `net.isOnline()`
|
||||
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
:::info Renderer process notifications
|
||||
|
||||
If you want to show notifications from a renderer process you should use the
|
||||
[web Notifications API](../tutorial/notifications.md)
|
||||
|
||||
:::
|
||||
> [!NOTE]
|
||||
> If you want to show notifications from a renderer process you should use the
|
||||
> [web Notifications API](../tutorial/notifications.md)
|
||||
|
||||
## Class: Notification
|
||||
|
||||
@@ -21,6 +18,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
It creates a new `Notification` with native properties as set by the `options`.
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### Static Methods
|
||||
|
||||
The `Notification` class has the following static methods:
|
||||
|
||||
@@ -33,10 +33,11 @@ Returns `Integer` - The blocker ID that is assigned to this power blocker.
|
||||
Starts preventing the system from entering lower-power mode. Returns an integer
|
||||
identifying the power save blocker.
|
||||
|
||||
**Note:** `prevent-display-sleep` has higher precedence over
|
||||
`prevent-app-suspension`. Only the highest precedence type takes effect. In
|
||||
other words, `prevent-display-sleep` always takes precedence over
|
||||
`prevent-app-suspension`.
|
||||
> [!NOTE]
|
||||
> `prevent-display-sleep` has higher precedence over
|
||||
> `prevent-app-suspension`. Only the highest precedence type takes effect. In
|
||||
> other words, `prevent-display-sleep` always takes precedence over
|
||||
> `prevent-app-suspension`.
|
||||
|
||||
For example, an API calling A requests for `prevent-app-suspension`, and
|
||||
another calling B requests for `prevent-display-sleep`. `prevent-display-sleep`
|
||||
|
||||
@@ -211,6 +211,10 @@ Returns `Object`:
|
||||
system.
|
||||
* `free` Integer - The total amount of memory not being used by applications or disk
|
||||
cache.
|
||||
* `fileBacked` Integer _macOS_ - The amount of memory that currently has been paged out to storage.
|
||||
Includes memory for file caches, network buffers, and other system services.
|
||||
* `purgeable` Integer _macOS_ - The amount of memory that is marked as "purgeable". The system can reclaim it
|
||||
if memory pressure increases.
|
||||
* `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in Kilobytes available to the
|
||||
system.
|
||||
* `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in Kilobytes available to the
|
||||
@@ -233,7 +237,8 @@ console.log(version)
|
||||
// On Linux -> '4.15.0-45-generic'
|
||||
```
|
||||
|
||||
**Note:** It returns the actual operating system version instead of kernel version on macOS unlike `os.release()`.
|
||||
> [!NOTE]
|
||||
> It returns the actual operating system version instead of kernel version on macOS unlike `os.release()`.
|
||||
|
||||
### `process.takeHeapSnapshot(filePath)`
|
||||
|
||||
|
||||
@@ -20,8 +20,9 @@ app.whenReady().then(() => {
|
||||
})
|
||||
```
|
||||
|
||||
**Note:** All methods unless specified can only be used after the `ready` event
|
||||
of the `app` module gets emitted.
|
||||
> [!NOTE]
|
||||
> All methods unless specified can only be used after the `ready` event
|
||||
> of the `app` module gets emitted.
|
||||
|
||||
## Using `protocol` with a custom `partition` or `session`
|
||||
|
||||
@@ -61,8 +62,9 @@ The `protocol` module has the following methods:
|
||||
|
||||
* `customSchemes` [CustomScheme[]](structures/custom-scheme.md)
|
||||
|
||||
**Note:** This method can only be used before the `ready` event of the `app`
|
||||
module gets emitted and can be called only once.
|
||||
> [!NOTE]
|
||||
> This method can only be used before the `ready` event of the `app`
|
||||
> module gets emitted and can be called only once.
|
||||
|
||||
Registers the `scheme` as standard, secure, bypasses content security policy for
|
||||
resources, allows registering ServiceWorker, supports fetch API, streaming
|
||||
|
||||
@@ -73,5 +73,6 @@ command line flag is provided `--password-store="basic"`.
|
||||
is provided `--password-store="kwallet"`.
|
||||
* `kwallet5` - When the desktop session is `kde5` or if the following command line flag
|
||||
is provided `--password-store="kwallet5"`.
|
||||
* `kwallet6` - When the desktop session is `kde6`.
|
||||
* `kwallet6` - When the desktop session is `kde6` or if the following command line flag
|
||||
is provided `--password-store="kwallet6"`.
|
||||
* `unknown` - When the function is called before app has emitted the `ready` event.
|
||||
|
||||
@@ -9,8 +9,9 @@ module is emitted.
|
||||
|
||||
`screen` is an [EventEmitter][event-emitter].
|
||||
|
||||
**Note:** In the renderer / DevTools, `window.screen` is a reserved DOM
|
||||
property, so writing `let { screen } = require('electron')` will not work.
|
||||
> [!NOTE]
|
||||
> In the renderer / DevTools, `window.screen` is a reserved DOM
|
||||
> property, so writing `let { screen } = require('electron')` will not work.
|
||||
|
||||
An example of creating a window that fills the whole screen:
|
||||
|
||||
@@ -57,6 +58,14 @@ app.whenReady().then(() => {
|
||||
})
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Screen coordinates used by this module are [`Point`](structures/point.md) structures.
|
||||
> There are two kinds of coordinates available to the process:
|
||||
>
|
||||
> * **Physical screen points** are raw hardware pixels on a display.
|
||||
> * **Device-independent pixel (DIP) points** are virtualized screen points scaled based on the DPI
|
||||
> (dots per inch) of the display.
|
||||
|
||||
## Events
|
||||
|
||||
The `screen` module emits the following events:
|
||||
@@ -101,7 +110,8 @@ Returns [`Point`](structures/point.md)
|
||||
|
||||
The current absolute position of the mouse pointer.
|
||||
|
||||
**Note:** The return value is a DIP point, not a screen physical point.
|
||||
> [!NOTE]
|
||||
> The return value is a DIP point, not a screen physical point.
|
||||
|
||||
### `screen.getPrimaryDisplay()`
|
||||
|
||||
@@ -124,7 +134,7 @@ Returns [`Display`](structures/display.md) - The display nearest the specified p
|
||||
Returns [`Display`](structures/display.md) - The display that most closely
|
||||
intersects the provided bounds.
|
||||
|
||||
### `screen.screenToDipPoint(point)` _Windows_
|
||||
### `screen.screenToDipPoint(point)` _Windows_ _Linux_
|
||||
|
||||
* `point` [Point](structures/point.md)
|
||||
|
||||
@@ -133,7 +143,10 @@ Returns [`Point`](structures/point.md)
|
||||
Converts a screen physical point to a screen DIP point.
|
||||
The DPI scale is performed relative to the display containing the physical point.
|
||||
|
||||
### `screen.dipToScreenPoint(point)` _Windows_
|
||||
Not currently supported on Wayland - if used there it will return the point passed
|
||||
in with no changes.
|
||||
|
||||
### `screen.dipToScreenPoint(point)` _Windows_ _Linux_
|
||||
|
||||
* `point` [Point](structures/point.md)
|
||||
|
||||
@@ -142,6 +155,8 @@ Returns [`Point`](structures/point.md)
|
||||
Converts a screen DIP point to a screen physical point.
|
||||
The DPI scale is performed relative to the display containing the DIP point.
|
||||
|
||||
Not currently supported on Wayland.
|
||||
|
||||
### `screen.screenToDipRect(window, rect)` _Windows_
|
||||
|
||||
* `window` [BrowserWindow](browser-window.md) | null
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
# ServiceWorkerMain
|
||||
## Class: ServiceWorkerMain
|
||||
|
||||
> An instance of a Service Worker representing a version of a script for a given scope.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
## Class: ServiceWorkerMain
|
||||
|
||||
Process: [Main](../glossary.md#main-process)<br />
|
||||
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
|
||||
|
||||
|
||||
@@ -762,7 +762,8 @@ Preconnects the given number of sockets to an origin.
|
||||
|
||||
Returns `Promise<void>` - Resolves when all connections are closed.
|
||||
|
||||
**Note:** It will terminate / fail all requests currently in flight.
|
||||
> [!NOTE]
|
||||
> It will terminate / fail all requests currently in flight.
|
||||
|
||||
#### `ses.fetch(input[, init])`
|
||||
|
||||
@@ -934,14 +935,18 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
|
||||
* `top-level-storage-access` - Allow top-level sites to request third-party cookie access on behalf of embedded content originating from another site in the same related website set using the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API).
|
||||
* `usb` - Expose non-standard Universal Serial Bus (USB) compatible devices services to the web with the [WebUSB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API).
|
||||
* `deprecated-sync-clipboard-read` _Deprecated_ - Request access to run `document.execCommand("paste")`
|
||||
* `fileSystem` - Access to read, write, and file management capabilities using the [File System API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API).
|
||||
* `requestingOrigin` string - The origin URL of the permission check
|
||||
* `details` Object - Some properties are only available on certain permission types.
|
||||
* `embeddingOrigin` string (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
|
||||
* `securityOrigin` string (optional) - The security origin of the `media` check.
|
||||
* `mediaType` string (optional) - The type of media access being requested, can be `video`,
|
||||
`audio` or `unknown`
|
||||
`audio` or `unknown`.
|
||||
* `requestingUrl` string (optional) - The last URL the requesting frame loaded. This is not provided for cross-origin sub frames making permission checks.
|
||||
* `isMainFrame` boolean - Whether the frame making the request is the main frame
|
||||
* `isMainFrame` boolean - Whether the frame making the request is the main frame.
|
||||
* `filePath` string (optional) - The path of a `fileSystem` request.
|
||||
* `isDirectory` boolean (optional) - Whether a `fileSystem` request is a directory.
|
||||
* `fileAccessType` string (optional) - The access type of a `fileSystem` request. Can be `writable` or `readable`.
|
||||
|
||||
Sets the handler which can be used to respond to permission checks for the `session`.
|
||||
Returning `true` will allow the permission and `false` will reject it. Please note that
|
||||
@@ -961,6 +966,9 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
|
||||
})
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> `isMainFrame` will always be `false` for a `fileSystem` request as a result of Chromium limitations.
|
||||
|
||||
#### `ses.setDisplayMediaRequestHandler(handler[, opts])`
|
||||
|
||||
* `handler` Function | null
|
||||
@@ -1305,8 +1313,9 @@ Initiates a download of the resource at `url`.
|
||||
The API will generate a [DownloadItem](download-item.md) that can be accessed
|
||||
with the [will-download](#event-will-download) event.
|
||||
|
||||
**Note:** This does not perform any security checks that relate to a page's origin,
|
||||
unlike [`webContents.downloadURL`](web-contents.md#contentsdownloadurlurl-options).
|
||||
> [!NOTE]
|
||||
> This does not perform any security checks that relate to a page's origin,
|
||||
> unlike [`webContents.downloadURL`](web-contents.md#contentsdownloadurlurl-options).
|
||||
|
||||
#### `ses.createInterruptedDownload(options)`
|
||||
|
||||
@@ -1434,7 +1443,8 @@ The built in spellchecker does not automatically detect what language a user is
|
||||
spell checker to correctly check their words you must call this API with an array of language codes. You can
|
||||
get the list of supported language codes with the `ses.availableSpellCheckerLanguages` property.
|
||||
|
||||
**Note:** On macOS the OS spellchecker is used and will detect your language automatically. This API is a no-op on macOS.
|
||||
> [!NOTE]
|
||||
> On macOS, the OS spellchecker is used and will detect your language automatically. This API is a no-op on macOS.
|
||||
|
||||
#### `ses.getSpellCheckerLanguages()`
|
||||
|
||||
@@ -1442,7 +1452,8 @@ Returns `string[]` - An array of language codes the spellchecker is enabled for.
|
||||
will fallback to using `en-US`. By default on launch if this setting is an empty list Electron will try to populate this
|
||||
setting with the current OS locale. This setting is persisted across restarts.
|
||||
|
||||
**Note:** On macOS the OS spellchecker is used and has its own list of languages. On macOS, this API will return whichever languages have been configured by the OS.
|
||||
> [!NOTE]
|
||||
> On macOS, the OS spellchecker is used and has its own list of languages. On macOS, this API will return whichever languages have been configured by the OS.
|
||||
|
||||
#### `ses.setSpellCheckerDictionaryDownloadURL(url)`
|
||||
|
||||
@@ -1460,7 +1471,8 @@ If the files present in `hunspell_dictionaries.zip` are available at `https://ex
|
||||
then you should call this api with `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`. Please
|
||||
note the trailing slash. The URL to the dictionaries is formed as `${url}${filename}`.
|
||||
|
||||
**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.
|
||||
> [!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()`
|
||||
|
||||
@@ -1474,7 +1486,8 @@ Resolves when the full dictionary is loaded from disk.
|
||||
Returns `boolean` - Whether the word was successfully written to the custom dictionary. This API
|
||||
will not work on non-persistent (in-memory) sessions.
|
||||
|
||||
**Note:** On macOS and Windows 10 this word will be written to the OS custom dictionary as well
|
||||
> [!NOTE]
|
||||
> On macOS and Windows, this word will be written to the OS custom dictionary as well.
|
||||
|
||||
#### `ses.removeWordFromSpellCheckerDictionary(word)`
|
||||
|
||||
@@ -1483,7 +1496,8 @@ will not work on non-persistent (in-memory) sessions.
|
||||
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
|
||||
> [!NOTE]
|
||||
> On macOS and Windows, this word will be removed from the OS custom dictionary as well.
|
||||
|
||||
#### `ses.loadExtension(path[, options])` _Deprecated_
|
||||
|
||||
@@ -1526,11 +1540,13 @@ app.whenReady().then(async () => {
|
||||
|
||||
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.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
**Note:** Loading extensions into in-memory (non-persistent) sessions is not
|
||||
supported and will throw an error.
|
||||
> [!NOTE]
|
||||
> Loading extensions into in-memory (non-persistent) sessions is not
|
||||
> supported and will throw an error.
|
||||
|
||||
**Deprecated:** Use the new `ses.extensions.loadExtension` API.
|
||||
|
||||
@@ -1540,8 +1556,9 @@ supported and will throw an error.
|
||||
|
||||
Unloads an extension.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
**Deprecated:** Use the new `ses.extensions.removeExtension` API.
|
||||
|
||||
@@ -1551,8 +1568,9 @@ is emitted.
|
||||
|
||||
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.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
**Deprecated:** Use the new `ses.extensions.getExtension` API.
|
||||
|
||||
@@ -1560,8 +1578,9 @@ is emitted.
|
||||
|
||||
Returns `Extension[]` - A list of all loaded extensions.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
> [!NOTE]
|
||||
> This API cannot be called before the `ready` event of the `app` module
|
||||
> is emitted.
|
||||
|
||||
**Deprecated:** Use the new `ses.extensions.getAllExtensions` API.
|
||||
|
||||
@@ -1599,9 +1618,11 @@ Clears various different types of data.
|
||||
This method clears more types of data and is more thorough than the
|
||||
`clearStorageData` method.
|
||||
|
||||
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
|
||||
> [!NOTE]
|
||||
> Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
|
||||
|
||||
**Note:** Clearing cache data will also clear the shared dictionary cache. This means that any dictionaries used for compression may be reloaded after clearing the cache. If you wish to clear the shared dictionary cache but leave other cached data intact, you may want to use the `clearSharedDictionaryCache` method.
|
||||
> [!NOTE]
|
||||
> Clearing cache data will also clear the shared dictionary cache. This means that any dictionaries used for compression may be reloaded after clearing the cache. If you wish to clear the shared dictionary cache but leave other cached data intact, you may want to use the `clearSharedDictionaryCache` method.
|
||||
|
||||
For more information, refer to Chromium's [`BrowsingDataRemover` interface][browsing-data-remover].
|
||||
|
||||
|
||||
@@ -13,6 +13,10 @@ For including the share menu as a submenu of other menus, please use the
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new ShareMenu(sharingItem)`
|
||||
|
||||
* `sharingItem` SharingItem - The item to share.
|
||||
|
||||
@@ -14,7 +14,8 @@ const { shell } = require('electron')
|
||||
shell.openExternal('https://github.com')
|
||||
```
|
||||
|
||||
**Note:** While the `shell` module can be used in the renderer process, it will not function in a sandboxed renderer.
|
||||
> [!WARNING]
|
||||
> While the `shell` module can be used in the renderer process, it will not function in a sandboxed renderer.
|
||||
|
||||
## Methods
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
* `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `symbolColor` String (optional) _Windows_ _Linux_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
|
||||
* `accentColor` boolean | string (optional) _Windows_ - The accent color for the window. By default, follows user preference in System Settings. Set to `false` to explicitly disable, or set the color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha values will be ignored.
|
||||
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
|
||||
Set a custom position for the traffic light buttons in frameless windows.
|
||||
* `roundedCorners` boolean (optional) _macOS_ _Windows_ - Whether frameless window
|
||||
|
||||
@@ -6,3 +6,11 @@
|
||||
* `productId` Integer - The USB product ID.
|
||||
* `serialNumber` string (optional) - The USB device serial number.
|
||||
* `guid` string (optional) - Unique identifier for the HID interface. A device may have multiple HID interfaces.
|
||||
* `collections` Object[] - an array of report formats. See [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/collections) for more.
|
||||
* `usage` Integer - An integer representing the usage ID component of the HID usage associated with this collection.
|
||||
* `usagePage` Integer - An integer representing the usage page component of the HID usage associated with this collection.
|
||||
* `type` Integer - An 8-bit value representing the collection type, which describes a different relationship between the grouped items.
|
||||
* `children` Object[] - An array of sub-collections which takes the same format as a top-level collection.
|
||||
* `inputReports` Object[] - An array of inputReport items which represent individual input reports described in this collection.
|
||||
* `outputReports` Object[] - An array of outputReport items which represent individual output reports described in this collection.
|
||||
* `featureReports` Object[] - An array of featureReport items which represent individual feature reports described in this collection.
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
* `items` JumpListItem[] (optional) - Array of [`JumpListItem`](jump-list-item.md) objects if `type` is `tasks` or
|
||||
`custom`, otherwise it should be omitted.
|
||||
|
||||
**Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
|
||||
property set then its `type` is assumed to be `tasks`. If the `name` property
|
||||
is set but the `type` property is omitted then the `type` is assumed to be
|
||||
`custom`.
|
||||
> [!NOTE]
|
||||
> If a `JumpListCategory` object has neither the `type` nor the `name`
|
||||
> property set then its `type` is assumed to be `tasks`. If the `name` property
|
||||
> is set but the `type` property is omitted then the `type` is assumed to be
|
||||
> `custom`.
|
||||
|
||||
**Note:** The maximum length of a Jump List item's `description` property is
|
||||
260 characters. Beyond this limit, the item will not be added to the Jump
|
||||
List, nor will it be displayed.
|
||||
> [!NOTE]
|
||||
> The maximum length of a Jump List item's `description` property is
|
||||
> 260 characters. Beyond this limit, the item will not be added to the Jump
|
||||
> List, nor will it be displayed.
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* `x` number
|
||||
* `y` number
|
||||
|
||||
**Note:** Both `x` and `y` must be whole integers, when providing a point object
|
||||
as input to an Electron API we will automatically round your `x` and `y` values
|
||||
to the nearest whole integer.
|
||||
> [!NOTE]
|
||||
> Both `x` and `y` must be whole integers, when providing a point object
|
||||
> as input to an Electron API we will automatically round your `x` and `y` values
|
||||
> to the nearest whole integer.
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
associated with the window, making it compatible with the Chromium
|
||||
OS-level sandbox and disabling the Node.js engine. This is not the same as
|
||||
the `nodeIntegration` option and the APIs available to the preload script
|
||||
are more limited. Read more about the option [here](../../tutorial/sandbox.md).
|
||||
are more limited. Default is `true` since Electron 20. The sandbox will
|
||||
automatically be disabled when `nodeIntegration` is set to `true`.
|
||||
Read more about the option [here](../../tutorial/sandbox.md).
|
||||
* `session` [Session](../session.md#class-session) (optional) - Sets the session used by the
|
||||
page. Instead of passing the Session object directly, you can also choose to
|
||||
use the `partition` option instead, which accepts a partition string. When
|
||||
@@ -149,7 +151,6 @@
|
||||
`WebContents` when the preferred size changes. Default is `false`.
|
||||
* `transparent` boolean (optional) - Whether to enable background transparency for the guest page. Default is `true`. **Note:** The guest page's text and background colors are derived from the [color scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme) of its root element. When transparency is enabled, the text color will still change accordingly but the background will remain transparent.
|
||||
* `enableDeprecatedPaste` boolean (optional) _Deprecated_ - Whether to enable the `paste` [execCommand](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand). Default is `false`.
|
||||
* `enableCornerSmoothingCSS` boolean (optional) _Experimental_ - Whether the [`-electron-corner-smoothing` CSS rule](../corner-smoothing-css.md) is enabled. Default is `true`.
|
||||
|
||||
[chrome-content-scripts]: https://developer.chrome.com/extensions/content_scripts#execution-environment
|
||||
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
> from Chromium at the space indicated by the proxy. By default, this proxy is added
|
||||
> to each TouchBar at the end of the input. For more information, see the AppKit docs on
|
||||
> [NSTouchBarItemIdentifierOtherItemsProxy](https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy)
|
||||
>
|
||||
> Note: Only one instance of this class can be added per TouchBar.
|
||||
|
||||
> [!NOTE]
|
||||
> Only one instance of this class can be added per TouchBar.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)<br />
|
||||
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# TouchBar
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
## Class: TouchBar
|
||||
|
||||
> Create TouchBar layouts for native macOS applications
|
||||
@@ -15,12 +19,14 @@ Process: [Main](../glossary.md#main-process)
|
||||
Creates a new touch bar with the specified items. Use
|
||||
`BrowserWindow.setTouchBar` to add the `TouchBar` to a window.
|
||||
|
||||
**Note:** The TouchBar API is currently experimental and may change or be
|
||||
removed in future Electron releases.
|
||||
> [!NOTE]
|
||||
> The TouchBar API is currently experimental and may change or be
|
||||
> removed in future Electron releases.
|
||||
|
||||
**Tip:** If you don't have a MacBook with Touch Bar, you can use
|
||||
[Touch Bar Simulator](https://github.com/sindresorhus/touch-bar-simulator)
|
||||
to test Touch Bar usage in your app.
|
||||
> [!TIP]
|
||||
> If you don't have a MacBook with Touch Bar, you can use
|
||||
> [Touch Bar Simulator](https://github.com/sindresorhus/touch-bar-simulator)
|
||||
> to test Touch Bar usage in your app.
|
||||
|
||||
### Static Properties
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ app.whenReady().then(() => {
|
||||
})
|
||||
```
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
**Platform Considerations**
|
||||
|
||||
**Linux**
|
||||
@@ -72,7 +76,15 @@ app.whenReady().then(() => {
|
||||
### `new Tray(image, [guid])`
|
||||
|
||||
* `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.
|
||||
* `guid` string (optional) _Windows_ _macOS_ - A unique string used to identify the tray icon. Must adhere to [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
|
||||
|
||||
**Windows**
|
||||
|
||||
On Windows, 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.
|
||||
|
||||
**MacOS**
|
||||
|
||||
On macOS, the `guid` is a string used to uniquely identify the tray icon and allow it to retain its position between relaunches. Using the same string for a new tray item will create it in the same position as the previous tray item to use the string.
|
||||
|
||||
Creates a new tray icon associated with the `image`.
|
||||
|
||||
@@ -176,7 +188,8 @@ Returns:
|
||||
|
||||
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.
|
||||
> [!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_
|
||||
|
||||
@@ -319,6 +332,10 @@ Returns [`Rectangle`](structures/rectangle.md)
|
||||
|
||||
The `bounds` of this tray icon as `Object`.
|
||||
|
||||
#### `tray.getGUID()` _macOS_ _Windows_
|
||||
|
||||
Returns `string | null` - The GUID used to uniquely identify the tray icon and allow it to retain its position between relaunches, or null if none is set.
|
||||
|
||||
#### `tray.isDestroyed()`
|
||||
|
||||
Returns `boolean` - Whether the tray icon is destroyed.
|
||||
|
||||
@@ -44,7 +44,8 @@ Process: [Main](../glossary.md#main-process)<br />
|
||||
|
||||
Returns [`UtilityProcess`](utility-process.md#class-utilityprocess)
|
||||
|
||||
**Note:** `utilityProcess.fork` can only be called after the `ready` event has been emitted on `App`.
|
||||
> [!NOTE]
|
||||
> `utilityProcess.fork` can only be called after the `ready` event has been emitted on `App`.
|
||||
|
||||
## Class: UtilityProcess
|
||||
|
||||
@@ -108,7 +109,8 @@ child.on('exit', () => {
|
||||
})
|
||||
```
|
||||
|
||||
**Note:** You can use the `pid` to determine if the process is currently running.
|
||||
> [!NOTE]
|
||||
> You can use the `pid` to determine if the process is currently running.
|
||||
|
||||
#### `child.stdout`
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
`View` is an [EventEmitter][event-emitter].
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new View()`
|
||||
|
||||
Creates a new `View`.
|
||||
@@ -94,13 +98,15 @@ Examples of valid `color` values:
|
||||
* Similar to CSS Color Module Level 3 keywords, but case-sensitive.
|
||||
* e.g. `blueviolet` or `red`
|
||||
|
||||
**Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`.
|
||||
> [!NOTE]
|
||||
> Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`.
|
||||
|
||||
#### `view.setBorderRadius(radius)`
|
||||
|
||||
* `radius` Integer - Border radius size in pixels.
|
||||
|
||||
**Note:** The area cutout of the view's border still captures clicks.
|
||||
> [!NOTE]
|
||||
> The area cutout of the view's border still captures clicks.
|
||||
|
||||
#### `view.setVisible(visible)`
|
||||
|
||||
|
||||
@@ -32,6 +32,10 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
`WebContentsView` is an [EventEmitter][event-emitter].
|
||||
|
||||
> [!WARNING]
|
||||
> Electron's built-in classes cannot be subclassed in user code.
|
||||
> For more information, see [the FAQ](../faq.md#class-inheritance-does-not-work-with-electron-built-in-modules).
|
||||
|
||||
### `new WebContentsView([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
|
||||
@@ -463,7 +463,8 @@ win.webContents.on('will-prevent-unload', (event) => {
|
||||
})
|
||||
```
|
||||
|
||||
**Note:** This will be emitted for `BrowserViews` but will _not_ be respected - this is because we have chosen not to tie the `BrowserView` lifecycle to its owning BrowserWindow should one exist per the [specification](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event).
|
||||
> [!NOTE]
|
||||
> This will be emitted for `BrowserViews` but will _not_ be respected - this is because we have chosen not to tie the `BrowserView` lifecycle to its owning BrowserWindow should one exist per the [specification](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event).
|
||||
|
||||
#### Event: 'render-process-gone'
|
||||
|
||||
@@ -533,14 +534,55 @@ To only prevent the menu shortcuts, use
|
||||
[`setIgnoreMenuShortcuts`](#contentssetignoremenushortcutsignore):
|
||||
|
||||
```js
|
||||
const { BrowserWindow } = require('electron')
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
app.whenReady().then(() => {
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
|
||||
win.webContents.on('before-input-event', (event, input) => {
|
||||
// For example, only enable application menu keyboard shortcuts when
|
||||
// Ctrl/Cmd are down.
|
||||
win.webContents.setIgnoreMenuShortcuts(!input.control && !input.meta)
|
||||
win.webContents.on('before-input-event', (event, input) => {
|
||||
// Enable application menu keyboard shortcuts when Ctrl/Cmd are down.
|
||||
win.webContents.setIgnoreMenuShortcuts(!input.control && !input.meta)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
#### Event: 'before-mouse-event'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `mouse` [MouseInputEvent](structures/mouse-input-event.md)
|
||||
|
||||
Emitted before dispatching mouse events in the page.
|
||||
|
||||
Calling `event.preventDefault` will prevent the page mouse events.
|
||||
|
||||
```js
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
|
||||
win.webContents.on('before-mouse-event', (event, mouse) => {
|
||||
// Prevent mouseDown events.
|
||||
if (mouse.type === 'mouseDown') {
|
||||
console.log(mouse)
|
||||
/*
|
||||
{
|
||||
type: 'mouseDown',
|
||||
clickCount: 1,
|
||||
movementX: 0,
|
||||
movementY: 0,
|
||||
button: 'left',
|
||||
x: 632.359375,
|
||||
y: 480.6875,
|
||||
globalX: 168.359375,
|
||||
globalY: 193.6875
|
||||
}
|
||||
*/
|
||||
event.preventDefault()
|
||||
}
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
@@ -838,9 +880,10 @@ Emitted when a bluetooth device needs to be selected when a call to
|
||||
the `deviceId` of the device to be selected. Passing an empty string to
|
||||
`callback` will cancel the request.
|
||||
|
||||
If an event listener is not added for this event, or if `event.preventDefault`
|
||||
is not called when handling this event, the first available device will be
|
||||
automatically selected.
|
||||
If no event listener is added for this event, all bluetooth requests will be cancelled.
|
||||
|
||||
If `event.preventDefault` is not called when handling this event, the first available
|
||||
device will be automatically selected.
|
||||
|
||||
Due to the nature of bluetooth, scanning for devices when
|
||||
`navigator.bluetooth.requestDevice` is called may take time and will cause
|
||||
@@ -1491,7 +1534,8 @@ 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`.
|
||||
|
||||
> **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> [!NOTE]
|
||||
> The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> zoom level for a specific domain propagates across all instances of windows with
|
||||
> the same domain. Differentiating the window URLs will make zoom work per-window.
|
||||
|
||||
@@ -1508,7 +1552,8 @@ Returns `Promise<void>`
|
||||
|
||||
Sets the maximum and minimum pinch-to-zoom level.
|
||||
|
||||
> **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it, call:
|
||||
> [!NOTE]
|
||||
> Visual zoom is disabled by default in Electron. To re-enable it, call:
|
||||
>
|
||||
> ```js
|
||||
> const win = new BrowserWindow()
|
||||
@@ -2076,7 +2121,9 @@ Disable device emulation enabled by `webContents.enableDeviceEmulation`.
|
||||
* `inputEvent` [MouseInputEvent](structures/mouse-input-event.md) | [MouseWheelInputEvent](structures/mouse-wheel-input-event.md) | [KeyboardInputEvent](structures/keyboard-input-event.md)
|
||||
|
||||
Sends an input `event` to the page.
|
||||
**Note:** The [`BrowserWindow`](browser-window.md) containing the contents needs to be focused for
|
||||
|
||||
> [!NOTE]
|
||||
> The [`BrowserWindow`](browser-window.md) containing the contents needs to be focused for
|
||||
`sendInputEvent()` to work.
|
||||
|
||||
#### `contents.beginFrameSubscription([onlyDirty ,]callback)`
|
||||
@@ -2218,7 +2265,9 @@ By default this value is `{ min: 0, max: 0 }` , which would apply no restriction
|
||||
* `max` Integer - The maximum UDP port number that WebRTC should use.
|
||||
|
||||
Setting the WebRTC UDP Port Range allows you to restrict the udp port range used by WebRTC. By default the port range is unrestricted.
|
||||
**Note:** To reset to an unrestricted port range this value should be set to `{ min: 0, max: 0 }`.
|
||||
|
||||
> [!NOTE]
|
||||
> To reset to an unrestricted port range this value should be set to `{ min: 0, max: 0 }`.
|
||||
|
||||
#### `contents.getMediaSourceId(requestWebContents)`
|
||||
|
||||
@@ -2364,8 +2413,9 @@ A [`WebContents`](web-contents.md) instance that might own this `WebContents`.
|
||||
|
||||
A `WebContents | null` property that represents the of DevTools `WebContents` associated with a given `WebContents`.
|
||||
|
||||
**Note:** Users should never store this object because it may become `null`
|
||||
when the DevTools has been closed.
|
||||
> [!NOTE]
|
||||
> Users should never store this object because it may become `null`
|
||||
> when the DevTools has been closed.
|
||||
|
||||
#### `contents.debugger` _Readonly_
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ Changes the zoom level to the specified level. The original size is 0 and each
|
||||
increment above or below represents zooming 20% larger or smaller to default
|
||||
limits of 300% and 50% of original size, respectively.
|
||||
|
||||
> **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> [!NOTE]
|
||||
> The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> zoom level for a specific domain propagates across all instances of windows with
|
||||
> the same domain. Differentiating the window URLs will make zoom work per-window.
|
||||
|
||||
@@ -56,13 +57,15 @@ Returns `number` - The current zoom level.
|
||||
|
||||
Sets the maximum and minimum pinch-to-zoom level.
|
||||
|
||||
> **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it, call:
|
||||
> [!NOTE]
|
||||
> Visual zoom is disabled by default in Electron. To re-enable it, call:
|
||||
>
|
||||
> ```js
|
||||
> webFrame.setVisualZoomLevelLimits(1, 3)
|
||||
> ```
|
||||
|
||||
> **NOTE**: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are
|
||||
> [!NOTE]
|
||||
> Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are
|
||||
> controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem roles in the application
|
||||
> Menu. To disable shortcuts, manually [define the Menu](./menu.md#examples) and omit zoom roles
|
||||
> from the definition.
|
||||
@@ -134,7 +137,7 @@ 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][, callback])`
|
||||
|
||||
* `code` string
|
||||
* `userGesture` boolean (optional) - Default is `false`.
|
||||
@@ -155,7 +158,7 @@ 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][, callback])`
|
||||
|
||||
* `worldId` Integer - The ID of the world to run the javascript
|
||||
in, `0` is the default main world (where content runs), `999` is the
|
||||
@@ -189,7 +192,9 @@ dispatch errors of isolated worlds to foreign worlds.
|
||||
* `name` string (optional) - Name for isolated world. Useful in devtools.
|
||||
|
||||
Set the security origin, content security policy and name of the isolated world.
|
||||
Note: If the `csp` is specified, then the `securityOrigin` also has to be specified.
|
||||
|
||||
> [!NOTE]
|
||||
> If the `csp` is specified, then the `securityOrigin` also has to be specified.
|
||||
|
||||
### `webFrame.getResourceUsage()`
|
||||
|
||||
|
||||
@@ -30,8 +30,10 @@ rendered.
|
||||
Unlike an `iframe`, the `webview` runs in a separate process than your
|
||||
app. It doesn't have the same permissions as your web page and all interactions
|
||||
between your app and embedded content will be asynchronous. This keeps your app
|
||||
safe from the embedded content. **Note:** Most methods called on the
|
||||
webview from the host page require a synchronous call to the main process.
|
||||
safe from the embedded content.
|
||||
|
||||
> [!NOTE]
|
||||
> Most methods called on the webview from the host page require a synchronous call to the main process.
|
||||
|
||||
## Example
|
||||
|
||||
@@ -252,7 +254,8 @@ The full list of supported feature strings can be found in the
|
||||
|
||||
The `webview` tag has the following methods:
|
||||
|
||||
**Note:** The webview element must be loaded before using the methods.
|
||||
> [!NOTE]
|
||||
> The webview element must be loaded before using the methods.
|
||||
|
||||
**Example**
|
||||
|
||||
@@ -679,7 +682,8 @@ 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`.
|
||||
|
||||
> **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> [!NOTE]
|
||||
> The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> zoom level for a specific domain propagates across all instances of windows with
|
||||
> the same domain. Differentiating the window URLs will make zoom work per-window.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user