mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
255 Commits
test-push-
...
pr/47870
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71526af2fb | ||
|
|
550e054168 | ||
|
|
b992ead837 | ||
|
|
11f76118db | ||
|
|
37c7487600 | ||
|
|
9e46efb8f7 | ||
|
|
9c38917a14 | ||
|
|
3a53c71324 | ||
|
|
0d478ec69c | ||
|
|
9143f7c6e2 | ||
|
|
df86312e2f | ||
|
|
ffbae02a95 | ||
|
|
a87ee21f5c | ||
|
|
ea8f43f9b9 | ||
|
|
e8e91c331a | ||
|
|
49c1139ab9 | ||
|
|
16bcd645b5 | ||
|
|
6756974828 | ||
|
|
d6dfd4ed7a | ||
|
|
a1ca9a8d55 | ||
|
|
38e491689a | ||
|
|
6e2be00f0f | ||
|
|
497b5a68a4 | ||
|
|
715808ecbe | ||
|
|
01cab978f7 | ||
|
|
7cb1552614 | ||
|
|
49c37b4daa | ||
|
|
37a115b8fd | ||
|
|
e7e29ea876 | ||
|
|
b40a4befd4 | ||
|
|
61a7303531 | ||
|
|
6f9cd718c4 | ||
|
|
a95180e080 | ||
|
|
d4a5fdc8fc | ||
|
|
3a7c6dd4a5 | ||
|
|
26e886c517 | ||
|
|
26a473db98 | ||
|
|
6661457cdf | ||
|
|
b51e82c5fb | ||
|
|
235fdc41f6 | ||
|
|
6bbbc1232e | ||
|
|
49335805d5 | ||
|
|
b27e721f69 | ||
|
|
1fda08b8c8 | ||
|
|
19256a07dd | ||
|
|
f62d7254c4 | ||
|
|
c7aa0b537d | ||
|
|
048d620701 | ||
|
|
15cdae1cf0 | ||
|
|
bac383c219 | ||
|
|
49eb165ef9 | ||
|
|
a468ed7f10 | ||
|
|
5444738721 | ||
|
|
a6959ca97b | ||
|
|
45353ae38c | ||
|
|
f702327dce | ||
|
|
fda3a3d493 | ||
|
|
dae5dad167 | ||
|
|
940ebb6c7a | ||
|
|
793565e4be | ||
|
|
1f322ebce3 | ||
|
|
f009e077f2 | ||
|
|
fed73040e2 | ||
|
|
828fd59a72 | ||
|
|
e892840975 | ||
|
|
7373173e44 | ||
|
|
5d5e672f17 | ||
|
|
e39943bf45 | ||
|
|
f331606e07 | ||
|
|
cca55117e4 | ||
|
|
bf29d2f0bd | ||
|
|
fea1a2a987 | ||
|
|
a51c56aca9 | ||
|
|
89f25e6af3 | ||
|
|
e0db4046b2 | ||
|
|
3b9130d815 | ||
|
|
52ed4646d9 | ||
|
|
68098c317f | ||
|
|
52e0307cc1 | ||
|
|
7fffe77909 | ||
|
|
3ccb1bc0a8 | ||
|
|
0917ed5f6f | ||
|
|
a67aad0f50 | ||
|
|
ceb6d28fd3 | ||
|
|
e12ab6708e | ||
|
|
6101025368 | ||
|
|
97b0280ad4 | ||
|
|
1044fe675d | ||
|
|
42af60cc7e | ||
|
|
cadba11088 | ||
|
|
8aeee3f714 | ||
|
|
dd54e84a58 | ||
|
|
d4b7d9e9cf | ||
|
|
83a5ba1e2c | ||
|
|
13d955a73e | ||
|
|
fdf29ce838 | ||
|
|
3770bb31a7 | ||
|
|
ed4a99ba5b | ||
|
|
0e6c26096f | ||
|
|
7792ed1efa | ||
|
|
c75c390ccf | ||
|
|
4c3c3049e1 | ||
|
|
68e7b38c05 | ||
|
|
a051c7c274 | ||
|
|
53003d7af9 | ||
|
|
63d7f609cd | ||
|
|
01291623af | ||
|
|
13ed526ca7 | ||
|
|
afb0ee418c | ||
|
|
55d8b71d72 | ||
|
|
b9ceaabb85 | ||
|
|
d6c0691a63 | ||
|
|
a201d6c541 | ||
|
|
51add3e847 | ||
|
|
9dcdec5015 | ||
|
|
095e622a6a | ||
|
|
a0d983e4b5 | ||
|
|
f49a645c06 | ||
|
|
8ab5ac9069 | ||
|
|
27a8cc531b | ||
|
|
26ffc8505c | ||
|
|
3b0f35a7e8 | ||
|
|
8769d5ba9e | ||
|
|
7f8b7c3873 | ||
|
|
8bf4260e3e | ||
|
|
7a13c6f175 | ||
|
|
678fb400fd | ||
|
|
8806499904 | ||
|
|
637a504e28 | ||
|
|
40cdfdb1d1 | ||
|
|
4ca10a1056 | ||
|
|
9d05454dc7 | ||
|
|
0e862bba61 | ||
|
|
4232ed2814 | ||
|
|
e7683bdd25 | ||
|
|
bdaf3b9a2b | ||
|
|
5c98e3609f | ||
|
|
2cfccac074 | ||
|
|
03aad28412 | ||
|
|
25e2459f31 | ||
|
|
18af498cf1 | ||
|
|
9f43503b3e | ||
|
|
ecb1eb0b5d | ||
|
|
2c916cfa33 | ||
|
|
4c9ab8765b | ||
|
|
051f78dd1d | ||
|
|
c796a74467 | ||
|
|
0d0cbaf7b4 | ||
|
|
63c452dcc7 | ||
|
|
f6407b4949 | ||
|
|
06d7a51a58 | ||
|
|
2255bb620a | ||
|
|
084c6ef549 | ||
|
|
01faaa30ea | ||
|
|
c569d5e4ba | ||
|
|
670da27305 | ||
|
|
5f901174c5 | ||
|
|
b39a1fb877 | ||
|
|
2156ccb577 | ||
|
|
9e2f7065a0 | ||
|
|
51bfe07da9 | ||
|
|
4699761649 | ||
|
|
26e1bda335 | ||
|
|
cf871bce4e | ||
|
|
39cca586f6 | ||
|
|
2f4a070c39 | ||
|
|
2b098408a8 | ||
|
|
fa844268ec | ||
|
|
a29a72c3ab | ||
|
|
4601aeccde | ||
|
|
31b18c9830 | ||
|
|
895bf9103e | ||
|
|
bf51d345c8 | ||
|
|
6eef170d9a | ||
|
|
31725b4a86 | ||
|
|
ec748eb915 | ||
|
|
5feb91e2f4 | ||
|
|
5128ebeddb | ||
|
|
389927dce8 | ||
|
|
67afc10b75 | ||
|
|
f570e6967f | ||
|
|
09ab71de43 | ||
|
|
21b325b034 | ||
|
|
cc9ca4bee2 | ||
|
|
17dba93587 | ||
|
|
603cafad7e | ||
|
|
09f269426e | ||
|
|
3bbb82b42b | ||
|
|
a9504abde9 | ||
|
|
9f3636ffe2 | ||
|
|
4a89068fb7 | ||
|
|
137d4ec329 | ||
|
|
624d085632 | ||
|
|
600b6b3315 | ||
|
|
9e67bd3508 | ||
|
|
909fd3d55a | ||
|
|
f2429c31c1 | ||
|
|
fbb83be785 | ||
|
|
1eab19fc7c | ||
|
|
02f2feabe6 | ||
|
|
712262597d | ||
|
|
31bc5ca903 | ||
|
|
03a02fc31e | ||
|
|
5ef6897bc7 | ||
|
|
bc585b6a3f | ||
|
|
4c460df0a4 | ||
|
|
cf193b279b | ||
|
|
655037fbdf | ||
|
|
07338bb1cf | ||
|
|
fb0b77b731 | ||
|
|
499e987c77 | ||
|
|
f7138344d8 | ||
|
|
b9248e6782 | ||
|
|
af39dcfb09 | ||
|
|
d347632046 | ||
|
|
4f69c5835e | ||
|
|
fa15332587 | ||
|
|
e299a1d098 | ||
|
|
c2302960a8 | ||
|
|
5e862f398e | ||
|
|
61c245761c | ||
|
|
7c55b24be2 | ||
|
|
4af248f2b6 | ||
|
|
69e9b653ba | ||
|
|
4dccccadbb | ||
|
|
79cd6a2614 | ||
|
|
2ba8fe9140 | ||
|
|
b21c4b0f88 | ||
|
|
f50ad3d022 | ||
|
|
7a274a711c | ||
|
|
bc499ffb8a | ||
|
|
0a74e91580 | ||
|
|
035879357e | ||
|
|
e4c37e4b38 | ||
|
|
828fc84e60 | ||
|
|
51fbc964a6 | ||
|
|
3e8e87d186 | ||
|
|
498f4bc98c | ||
|
|
a6ad5a6e60 | ||
|
|
93d5152a25 | ||
|
|
fb65124234 | ||
|
|
93f4b3cf9f | ||
|
|
bb22eaccec | ||
|
|
90a14299fd | ||
|
|
60924690d9 | ||
|
|
9b158238dc | ||
|
|
dac5e0cd1a | ||
|
|
626895848e | ||
|
|
3536d4976a | ||
|
|
2ad762e075 | ||
|
|
6779769d22 | ||
|
|
96fcc2f8c8 | ||
|
|
3c9b8475a2 | ||
|
|
6f915e85e2 | ||
|
|
0259abe920 |
@@ -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
|
||||
|
||||
@@ -58,13 +58,13 @@ if [ ! -f $buildtools/configs/evm.testing.json ]; then
|
||||
},
|
||||
\"\$schema\": \"file:///home/builduser/.electron_build_tools/evm-config.schema.json\",
|
||||
\"configValidationLevel\": \"strict\",
|
||||
\"reclient\": \"$1\",
|
||||
\"preserveXcode\": 5
|
||||
\"remoteBuild\": \"reclient\",
|
||||
\"preserveSDK\": 5
|
||||
}
|
||||
" >$buildtools/configs/evm.testing.json
|
||||
}
|
||||
|
||||
write_config remote_exec
|
||||
write_config
|
||||
|
||||
e use testing
|
||||
else
|
||||
|
||||
10
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
10
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -58,6 +58,16 @@ body:
|
||||
label: Last Known Working Electron version
|
||||
description: What is the last version of Electron this worked in, if applicable?
|
||||
placeholder: 16.0.0
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Does the issue also appear in Chromium / Google Chrome?
|
||||
description: If it does, please report the issue in the [Chromium issue tracker](https://issues.chromium.org/issues), not against Electron. Electron will inherit the fix once Chromium resolves the issue.
|
||||
options:
|
||||
- I don't know how to test
|
||||
- "Yes"
|
||||
- "No"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected Behavior
|
||||
|
||||
82
.github/actions/build-electron/action.yml
vendored
82
.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,12 @@ 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"
|
||||
@@ -57,22 +60,14 @@ runs:
|
||||
sudo launchctl limit maxfiles 65536 200000
|
||||
fi
|
||||
|
||||
NINJA_SUMMARIZE_BUILD=1 e build -j $NUMBER_OF_NINJA_PROCESSES
|
||||
NINJA_SUMMARIZE_BUILD=1 e build
|
||||
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 }}
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
e build --target electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES -d explain
|
||||
e build --target electron:electron_dist_zip
|
||||
if [ "${{ inputs.is-asan }}" != "true" ]; then
|
||||
target_os=${{ inputs.target-platform == 'macos' && 'mac' || inputs.target-platform }}
|
||||
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
|
||||
@@ -84,7 +79,7 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
e build --target electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:electron_mksnapshot_zip
|
||||
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"
|
||||
@@ -94,20 +89,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
|
||||
@@ -141,8 +122,15 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
e build --target electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:electron_chromedriver_zip
|
||||
|
||||
if [ "${{ inputs.is-asan }}" != "true" ]; then
|
||||
target_os=${{ inputs.target-platform == 'macos' && 'mac' || inputs.target-platform }}
|
||||
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
|
||||
target_os="${target_os}_mas"
|
||||
fi
|
||||
electron/script/zip_manifests/check-zip-manifest.py out/Default/chromedriver.zip electron/script/zip_manifests/chromedriver_zip.$target_os.${{ inputs.target-arch }}.manifest
|
||||
fi
|
||||
- name: Build Node.js headers ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -188,20 +176,20 @@ 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
|
||||
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: Generate Hunspell Dictionaries ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
|
||||
run: |
|
||||
e build --target electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:hunspell_dictionaries_zip
|
||||
- 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
|
||||
e build --target electron:libcxx_headers_zip
|
||||
e build --target electron:libcxxabi_headers_zip
|
||||
e build --target electron:libcxx_objects_zip
|
||||
- name: Remove Clang problem matcher
|
||||
shell: bash
|
||||
run: echo "::remove-matcher owner=clang::"
|
||||
@@ -224,7 +212,29 @@ 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
|
||||
cat siso_report.txt
|
||||
echo "SISO REPORT AT $SISO_REPORT_PATH"
|
||||
- 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"
|
||||
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
|
||||
@@ -236,9 +246,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 }}
|
||||
|
||||
17
.github/actions/checkout/action.yml
vendored
17
.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 }}
|
||||
@@ -117,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"
|
||||
@@ -130,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."
|
||||
@@ -172,7 +172,6 @@ runs:
|
||||
run: |
|
||||
rm -rf src/android_webview
|
||||
rm -rf src/ios/chrome
|
||||
rm -rf src/third_party/blink/web_tests
|
||||
rm -rf src/third_party/blink/perf_tests
|
||||
rm -rf src/chrome/test/data/xr/webvr_info
|
||||
rm -rf src/third_party/angle/third_party/VK-GL-CTS/src
|
||||
|
||||
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' }}
|
||||
|
||||
20
.github/actions/fix-sync/action.yml
vendored
20
.github/actions/fix-sync/action.yml
vendored
@@ -19,12 +19,16 @@ inputs:
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Fix clang
|
||||
- name: Fix llvm toolchain
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
shell: bash
|
||||
run : |
|
||||
rm -rf src/third_party/llvm-build
|
||||
python3 src/tools/clang/scripts/update.py
|
||||
# Refs https://chromium-review.googlesource.com/c/chromium/src/+/6667681
|
||||
python3 src/tools/clang/scripts/update.py --package objdump
|
||||
- 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 +38,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 +62,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 +71,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 +89,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 +98,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: build/siso/${platform}
|
||||
- name: Fixup angle git
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
shell: bash
|
||||
run : |
|
||||
cd src/third_party/angle
|
||||
|
||||
16
.github/actions/free-space-macos/action.yml
vendored
16
.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() {
|
||||
@@ -57,9 +59,21 @@ runs:
|
||||
sudo rm -rf $TMPDIR/del-target
|
||||
|
||||
sudo rm -rf /Applications/Safari.app
|
||||
sudo rm -rf /Applications/Xcode_16.1.app
|
||||
sudo rm -rf /Applications/Xcode_16.3.app
|
||||
sudo rm -rf /Applications/Xcode_16.2.app
|
||||
sudo rm -rf /Applications/Google Chrome.app
|
||||
sudo rm -rf /Applications/Xcode_16.4.app
|
||||
sudo rm -rf /Applications/Google Chrome for Testing.app
|
||||
sudo rm -rf /Applications/Firefox.app
|
||||
sudo rm -rf ~/project/src/third_party/catapult/tracing/test_data
|
||||
sudo rm -rf ~/project/src/third_party/angle/third_party/VK-GL-CTS
|
||||
sudo rm -rf /Users/runner/Library/Android
|
||||
sudo rm -rf $JAVA_HOME_11_arm64
|
||||
sudo rm -rf $JAVA_HOME_17_arm64
|
||||
sudo rm -rf $JAVA_HOME_21_arm64
|
||||
|
||||
# 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
|
||||
|
||||
@@ -11,9 +11,11 @@ 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
|
||||
|
||||
@@ -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
|
||||
2
.github/workflows/archaeologist-dig.yml
vendored
2
.github/workflows/archaeologist-dig.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Node.js/npm
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
|
||||
with:
|
||||
node-version: 20.19.x
|
||||
- name: Setting Up Dig Site
|
||||
|
||||
17
.github/workflows/audit-branch-ci.yml
vendored
17
.github/workflows/audit-branch-ci.yml
vendored
@@ -15,8 +15,12 @@ jobs:
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- run: npm install @actions/cache @electron/fiddle-core
|
||||
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
|
||||
with:
|
||||
node-version: 22.17.x
|
||||
- run: npm install @actions/cache@4.0.3 @electron/fiddle-core@2.0.1
|
||||
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
id: audit-errors
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -29,7 +33,7 @@ jobs:
|
||||
// Only want the most recent workflow run that wasn't skipped or cancelled
|
||||
const isValidWorkflowRun = (run) => !['skipped', 'cancelled'].includes(run.conclusion);
|
||||
|
||||
const versions = await ElectronVersions.create(undefined, { ignoreCache: true });
|
||||
const versions = await ElectronVersions.create({ ignoreCache: true });
|
||||
const branches = versions.supportedMajors.map((branch) => `${branch}-x-y`);
|
||||
|
||||
for (const branch of ["main", ...branches]) {
|
||||
@@ -69,6 +73,7 @@ jobs:
|
||||
annotation_level === "failure" &&
|
||||
!message.startsWith("Process completed with exit code") &&
|
||||
!message.startsWith("Response status code does not indicate success") &&
|
||||
!message.startsWith("The hosted runner lost communication with the server") &&
|
||||
!/Unable to make request/.test(message) &&
|
||||
!/The requested URL returned error/.test(message),
|
||||
)
|
||||
@@ -101,7 +106,6 @@ jobs:
|
||||
}
|
||||
|
||||
if (runsWithErrors.length > 0) {
|
||||
core.setOutput('errorsFound', true);
|
||||
core.summary.addHeading('⚠️ Runs with Errors');
|
||||
core.summary.addTable([
|
||||
[
|
||||
@@ -128,6 +132,7 @@ jobs:
|
||||
|
||||
// Set this as failed so it's easy to scan runs to find failures
|
||||
if (runsWithErrors.find((run) => !run.isStale)) {
|
||||
core.setOutput('errorsFound', true);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
} else {
|
||||
@@ -136,8 +141,8 @@ jobs:
|
||||
|
||||
await core.summary.write();
|
||||
- name: Send Slack message if errors
|
||||
if: ${{ steps.audit-errors.outputs.errorsFound && github.ref == 'refs/heads/main' }}
|
||||
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
|
||||
if: ${{ always() && steps.audit-errors.outputs.errorsFound && github.ref == 'refs/heads/main' }}
|
||||
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
|
||||
with:
|
||||
payload: |
|
||||
link: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
|
||||
2
.github/workflows/branch-created.yml
vendored
2
.github/workflows/branch-created.yml
vendored
@@ -75,7 +75,7 @@ jobs:
|
||||
org: electron
|
||||
- name: Generate Release Project Board Metadata
|
||||
if: ${{ steps.check-major-version.outputs.MAJOR }}
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
id: generate-project-metadata
|
||||
with:
|
||||
script: |
|
||||
|
||||
6
.github/workflows/build-git-cache.yml
vendored
6
.github/workflows/build-git-cache.yml
vendored
@@ -8,7 +8,7 @@ on:
|
||||
|
||||
jobs:
|
||||
build-git-cache-linux:
|
||||
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
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
target-platform: linux
|
||||
|
||||
build-git-cache-windows:
|
||||
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 --device /dev/fuse --cap-add SYS_ADMIN
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
target-platform: win
|
||||
|
||||
build-git-cache-macos:
|
||||
runs-on: electron-arc-linux-amd64-32core
|
||||
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:
|
||||
|
||||
60
.github/workflows/build.yml
vendored
60
.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
|
||||
@@ -149,7 +154,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
|
||||
@@ -191,10 +196,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
|
||||
@@ -205,7 +211,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
|
||||
@@ -220,13 +226,14 @@ jobs:
|
||||
needs: checkout-macos
|
||||
with:
|
||||
build-runs-on: macos-14-xlarge
|
||||
test-runs-on: macos-13
|
||||
test-runs-on: macos-15-large
|
||||
target-platform: macos
|
||||
target-arch: x64
|
||||
is-release: false
|
||||
gn-build-type: testing
|
||||
generate-symbols: false
|
||||
upload-to-storage: '0'
|
||||
enable-ssh: ${{ inputs.enable-ssh || false }}
|
||||
secrets: inherit
|
||||
|
||||
macos-arm64:
|
||||
@@ -238,13 +245,14 @@ jobs:
|
||||
needs: checkout-macos
|
||||
with:
|
||||
build-runs-on: macos-14-xlarge
|
||||
test-runs-on: macos-14
|
||||
test-runs-on: macos-15
|
||||
target-platform: macos
|
||||
target-arch: arm64
|
||||
is-release: false
|
||||
gn-build-type: testing
|
||||
generate-symbols: false
|
||||
upload-to-storage: '0'
|
||||
enable-ssh: ${{ inputs.enable-ssh || false }}
|
||||
secrets: inherit
|
||||
|
||||
linux-x64:
|
||||
@@ -254,9 +262,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
|
||||
@@ -274,9 +283,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
|
||||
@@ -295,9 +305,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
|
||||
@@ -315,9 +326,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
|
||||
@@ -337,7 +349,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
|
||||
@@ -356,7 +368,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
|
||||
@@ -375,8 +387,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
|
||||
|
||||
11
.github/workflows/issue-commented.yml
vendored
11
.github/workflows/issue-commented.yml
vendored
@@ -10,15 +10,24 @@ permissions: {}
|
||||
jobs:
|
||||
issue-commented:
|
||||
name: Remove blocked/{need-info,need-repro} on comment
|
||||
if: ${{ (contains(github.event.issue.labels.*.name, 'blocked/need-repro') || contains(github.event.issue.labels.*.name, 'blocked/need-info ❌')) && !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR"]'), github.event.comment.author_association) && github.event.comment.user.type != 'Bot' }}
|
||||
if: ${{ (contains(github.event.issue.labels.*.name, 'blocked/need-repro') || contains(github.event.issue.labels.*.name, 'blocked/need-info ❌')) && github.event.comment.user.type != 'Bot' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get author association
|
||||
id: get-author-association
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
AUTHOR_ASSOCIATION=$(gh api /repos/electron/electron/issues/comments/${{ github.event.comment.id }} --jq '.author_association')
|
||||
echo "author_association=$AUTHOR_ASSOCIATION" >> "$GITHUB_OUTPUT"
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
if: ${{ !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR"]'), steps.get-author-association.outputs.author_association) }}
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- name: Remove label
|
||||
if: ${{ !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR"]'), steps.get-author-association.outputs.author_association) }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
ISSUE_URL: ${{ github.event.issue.html_url }}
|
||||
|
||||
2
.github/workflows/issue-labeled.yml
vendored
2
.github/workflows/issue-labeled.yml
vendored
@@ -72,7 +72,7 @@ jobs:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- name: Create comment
|
||||
if: ${{ steps.check-for-comment.outputs.SHOULD_COMMENT }}
|
||||
uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3.6.0
|
||||
uses: actions-cool/issues-helper@50068f49b7b2b3857270ead65e2d02e4459b022c # v3.6.2
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
21
.github/workflows/issue-opened.yml
vendored
21
.github/workflows/issue-opened.yml
vendored
@@ -37,7 +37,7 @@ jobs:
|
||||
org: electron
|
||||
- run: npm install @electron/fiddle-core@1.3.3 mdast-util-from-markdown@2.0.0 unist-util-select@5.1.0 semver@7.6.0
|
||||
- name: Add labels
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
id: add-labels
|
||||
env:
|
||||
ISSUE_BODY: ${{ github.event.issue.body }}
|
||||
@@ -60,6 +60,8 @@ jobs:
|
||||
// It's possible for multiple versions to be listed -
|
||||
// for now check for comma or space separated version.
|
||||
const versions = electronVersion.split(/, | /);
|
||||
let hasSupportedVersion = false;
|
||||
|
||||
for (const version of versions) {
|
||||
const major = semver.coerce(version, { loose: true })?.major;
|
||||
if (major) {
|
||||
@@ -75,19 +77,20 @@ jobs:
|
||||
labelExists = true;
|
||||
} catch {}
|
||||
|
||||
if (labelExists) {
|
||||
// Check if it's an unsupported major
|
||||
const { ElectronVersions } = await import('${{ github.workspace }}/node_modules/@electron/fiddle-core/dist/index.js');
|
||||
const versions = await ElectronVersions.create(undefined, { ignoreCache: true });
|
||||
const { ElectronVersions } = await import('${{ github.workspace }}/node_modules/@electron/fiddle-core/dist/index.js');
|
||||
const electronVersions = await ElectronVersions.create(undefined, { ignoreCache: true });
|
||||
const validVersions = [...electronVersions.supportedMajors, ...electronVersions.prereleaseMajors];
|
||||
|
||||
const validVersions = [...versions.supportedMajors, ...versions.prereleaseMajors];
|
||||
if (validVersions.includes(major)) {
|
||||
if (validVersions.includes(major)) {
|
||||
hasSupportedVersion = true;
|
||||
if (labelExists) {
|
||||
labels.push(versionLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (labels.length === 0) {
|
||||
|
||||
if (!hasSupportedVersion) {
|
||||
core.setOutput('unsupportedMajor', true);
|
||||
labels.push('blocked/need-info ❌');
|
||||
}
|
||||
@@ -131,7 +134,7 @@ jobs:
|
||||
}
|
||||
- name: Create unsupported major comment
|
||||
if: ${{ steps.add-labels.outputs.unsupportedMajor }}
|
||||
uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3.6.0
|
||||
uses: actions-cool/issues-helper@50068f49b7b2b3857270ead65e2d02e4459b022c # v3.6.2
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
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
|
||||
|
||||
@@ -1,30 +1,40 @@
|
||||
name: Check for Non-Maintainer Dependency Change
|
||||
name: Check for Disallowed Non-Maintainer Change
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
paths:
|
||||
- 'yarn.lock'
|
||||
- 'spec/yarn.lock'
|
||||
- '.github/workflows/**'
|
||||
- '.github/actions/**'
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
check-for-non-maintainer-dependency-change:
|
||||
name: Check for non-maintainer dependency change
|
||||
if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.pull_request.author_association) && github.event.pull_request.user.type != 'Bot' && !github.event.pull_request.draft }}
|
||||
name: Check for disallowed non-maintainer change
|
||||
if: ${{ github.event.pull_request.user.type != 'Bot' && !github.event.pull_request.draft }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get author association
|
||||
id: get-author-association
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
AUTHOR_ASSOCIATION=$(gh api /repos/electron/electron/pulls/${{ github.event.pull_request.number }} --jq '.author_association')
|
||||
echo "author_association=$AUTHOR_ASSOCIATION" >> "$GITHUB_OUTPUT"
|
||||
- name: Check for existing review
|
||||
id: check-for-review
|
||||
if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), steps.get-author-association.outputs.author_association) }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||
run: |
|
||||
set -eo pipefail
|
||||
REVIEW_COUNT=$(gh pr view $PR_URL --json reviews | jq '[ .reviews[] | select(.author.login == "github-actions") | select(.body | startswith("<!-- no-dependency-change -->")) ] | length')
|
||||
REVIEW_COUNT=$(gh pr view $PR_URL --json reviews | jq '[ .reviews[] | select(.author.login == "github-actions") | select(.body | startswith("<!-- disallowed-non-maintainer-change -->")) ] | length')
|
||||
if [[ $REVIEW_COUNT -eq 0 ]]; then
|
||||
echo "SHOULD_REVIEW=1" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
@@ -34,4 +44,4 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||
run: |
|
||||
printf "<!-- no-dependency-change -->\n\nHello @${{ github.event.pull_request.user.login }}! It looks like this pull request touches one of our dependency files, and per [our contribution policy](https://github.com/electron/electron/blob/main/CONTRIBUTING.md#dependencies-upgrades-policy) we do not accept these types of changes in PRs." | gh pr review $PR_URL -r --body-file=-
|
||||
printf "<!-- disallowed-non-maintainer-change -->\n\nHello @${{ github.event.pull_request.user.login }}! It looks like this pull request touches one of our dependency or CI files, and per [our contribution policy](https://github.com/electron/electron/blob/main/CONTRIBUTING.md#dependencies-upgrades-policy) we do not accept these types of changes in PRs." | gh pr review $PR_URL -r --body-file=-
|
||||
|
||||
@@ -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:
|
||||
|
||||
2
.github/workflows/pipeline-electron-lint.yml
vendored
2
.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:
|
||||
|
||||
@@ -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 }}
|
||||
@@ -73,6 +72,7 @@ env:
|
||||
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:
|
||||
@@ -94,6 +94,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
|
||||
@@ -102,7 +113,7 @@ jobs:
|
||||
run: df -h
|
||||
- name: Setup Node.js/npm
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
|
||||
with:
|
||||
node-version: 20.19.x
|
||||
cache: yarn
|
||||
@@ -160,7 +171,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 +181,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 +193,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,29 +68,15 @@ 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
|
||||
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
|
||||
with:
|
||||
node-version: 20.19.x
|
||||
- name: Add TCC permissions on macOS
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: |
|
||||
epochdate=$(($(date +'%s * 1000 + %-N / 1000000')))
|
||||
configure_user_tccdb () {
|
||||
local values=$1
|
||||
local dbPath="$HOME/Library/Application Support/com.apple.TCC/TCC.db"
|
||||
@@ -100,14 +92,17 @@ 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"
|
||||
"'kTCCServiceScreenCapture','/bin/bash',1,2,3,1,NULL,NULL,NULL,'UNUSED',NULL,0,$epochdate"
|
||||
)
|
||||
for values in "${userValuesArray[@]}"; do
|
||||
# Sonoma and higher have a few extra values
|
||||
# Ref: https://github.com/actions/runner-images/blob/main/images/macos/scripts/build/configure-tccdb-macos.sh
|
||||
if [ "$OSTYPE" = "darwin23" ]; then
|
||||
if [ "$OSTYPE" = "darwin23" ] || [ "$OSTYPE" = "darwin24" ]; then
|
||||
configure_user_tccdb "$values,NULL,NULL,'UNUSED',${values##*,}"
|
||||
configure_sys_tccdb "$values,NULL,NULL,'UNUSED',${values##*,}"
|
||||
else
|
||||
@@ -118,12 +113,32 @@ jobs:
|
||||
- name: Turn off the unexpectedly quit dialog on macOS
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: defaults write com.apple.CrashReporter DialogType server
|
||||
- name: Set xcode to 16.4
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: sudo xcode-select --switch /Applications/Xcode_16.4.app
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Turn off screenshot nag on macOS
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: |
|
||||
defaults write ~/Library/Group\ Containers/group.com.apple.replayd/ScreenCaptureApprovals.plist "/bin/bash" -date "3024-09-23 12:00:00 +0000"
|
||||
src/electron/script/actions/screencapture-nag-remover.sh -a $(which bash)
|
||||
src/electron/script/actions/screencapture-nag-remover.sh -a /opt/hca/hosted-compute-agent
|
||||
- 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 +150,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
|
||||
@@ -149,39 +166,35 @@ jobs:
|
||||
echo "DISABLE_CRASH_REPORTER_TESTS=true" >> $GITHUB_ENV
|
||||
echo "IS_ASAN=true" >> $GITHUB_ENV
|
||||
- name: Download Generated Artifacts
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
||||
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
|
||||
with:
|
||||
name: generated_artifacts_${{ env.ARTIFACT_KEY }}
|
||||
path: ./generated_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
|
||||
- name: Download Src Artifacts
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
||||
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
|
||||
with:
|
||||
name: src_artifacts_${{ env.ARTIFACT_KEY }}
|
||||
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: |
|
||||
sudo security authorizationdb write com.apple.trust-settings.admin allow
|
||||
cd src/electron
|
||||
./script/codesign/generate-identity.sh
|
||||
#- name: Import & Trust Self-Signed Codesigning Cert on MacOS
|
||||
# if: ${{ inputs.target-platform == 'macos' && inputs.target-arch == 'x64' }}
|
||||
# run: |
|
||||
# sudo security authorizationdb write com.apple.trust-settings.admin allow
|
||||
# cd src/electron
|
||||
# ./script/codesign/generate-identity.sh
|
||||
- name: Install Datadog CLI
|
||||
run: |
|
||||
cd src/electron
|
||||
@@ -192,7 +205,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 +224,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 }}
|
||||
@@ -61,12 +61,12 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Download Generated Artifacts
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
||||
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
|
||||
with:
|
||||
name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
|
||||
path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
|
||||
- name: Download Src Artifacts
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
||||
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
|
||||
with:
|
||||
name: src_artifacts_linux_${{ env.TARGET_ARCH }}
|
||||
path: ./src_artifacts_linux_${{ env.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 }}
|
||||
@@ -115,12 +115,12 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Download Generated Artifacts
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
||||
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
|
||||
with:
|
||||
name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
|
||||
path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
|
||||
- name: Download Src Artifacts
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
||||
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
|
||||
with:
|
||||
name: src_artifacts_linux_${{ env.TARGET_ARCH }}
|
||||
path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
|
||||
|
||||
2
.github/workflows/pull-request-labeled.yml
vendored
2
.github/workflows/pull-request-labeled.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger Slack workflow
|
||||
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
|
||||
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
|
||||
with:
|
||||
webhook: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
|
||||
webhook-type: webhook-trigger
|
||||
|
||||
2
.github/workflows/scorecards.yml
vendored
2
.github/workflows/scorecards.yml
vendored
@@ -50,6 +50,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
|
||||
uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
2
.github/workflows/semantic.yml
vendored
2
.github/workflows/semantic.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: semantic-pull-request
|
||||
uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
|
||||
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
|
||||
6
.github/workflows/stale.yml
vendored
6
.github/workflows/stale.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # tag: v9.1.0
|
||||
- uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # tag: v10.1.0
|
||||
with:
|
||||
repo-token: ${{ steps.generate-token.outputs.token }}
|
||||
days-before-stale: 90
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
This issue has been automatically marked as stale. **If this issue is still affecting you, please leave any comment** (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the [latest version of Electron](https://www.electronjs.org/releases/stable) or in the [beta](https://www.electronjs.org/releases/beta)—please include it with your comment!
|
||||
close-issue-message: >
|
||||
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a [supported version of Electron](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline) please open a new issue and include instructions for reproducing the issue.
|
||||
exempt-issue-labels: "discussion,security \U0001F512,enhancement :sparkles:,status/confirmed,stale-exempt"
|
||||
exempt-issue-labels: "discussion,security \U0001F512,enhancement :sparkles:,status/confirmed,stale-exempt,upgrade-follow-up"
|
||||
only-pr-labels: not-a-real-label
|
||||
pending-repro:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # tag: v9.1.0
|
||||
- uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # tag: v10.1.0
|
||||
with:
|
||||
repo-token: ${{ steps.generate-token.outputs.token }}
|
||||
days-before-stale: -1
|
||||
|
||||
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
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
"ul",
|
||||
"unknown",
|
||||
"Tabs",
|
||||
"TabItem"
|
||||
"TabItem",
|
||||
"DocCardList",
|
||||
"kbd"
|
||||
]
|
||||
},
|
||||
"no-newline-in-links": true
|
||||
|
||||
133
BUILD.gn
133
BUILD.gn
@@ -4,9 +4,9 @@ import("//build/config/win/manifest.gni")
|
||||
import("//components/os_crypt/sync/features.gni")
|
||||
import("//components/spellcheck/spellcheck_build_features.gni")
|
||||
import("//content/public/app/mac_helpers.gni")
|
||||
import("//content/public/common/features.gni")
|
||||
import("//extensions/buildflags/buildflags.gni")
|
||||
import("//pdf/features.gni")
|
||||
import("//ppapi/buildflags/buildflags.gni")
|
||||
import("//printing/buildflags/buildflags.gni")
|
||||
import("//testing/test.gni")
|
||||
import("//third_party/electron_node/node.gni")
|
||||
@@ -38,12 +38,13 @@ if (is_mac) {
|
||||
import("build/rules.gni")
|
||||
|
||||
assert(
|
||||
mac_deployment_target == "11.0",
|
||||
"Chromium has updated the mac_deployment_target, please update this assert, update the supported versions documentation (docs/tutorial/support.md) and flag this as a breaking change")
|
||||
mac_deployment_target == "12.0",
|
||||
"Chromium has updated the mac_deployment_target, please update this assert and flag this as a breaking change (docs/breaking-changes.md)")
|
||||
}
|
||||
|
||||
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") {
|
||||
@@ -452,7 +453,7 @@ source_set("electron_lib") {
|
||||
"//components/certificate_transparency",
|
||||
"//components/compose:buildflags",
|
||||
"//components/embedder_support:user_agent",
|
||||
"//components/input:input",
|
||||
"//components/input",
|
||||
"//components/language/core/browser",
|
||||
"//components/net_log",
|
||||
"//components/network_hints/browser",
|
||||
@@ -485,7 +486,7 @@ source_set("electron_lib") {
|
||||
"//net:extras",
|
||||
"//net:net_resources",
|
||||
"//printing/buildflags",
|
||||
"//services/device/public/cpp/bluetooth:bluetooth",
|
||||
"//services/device/public/cpp/bluetooth",
|
||||
"//services/device/public/cpp/geolocation",
|
||||
"//services/device/public/cpp/hid",
|
||||
"//services/device/public/mojom",
|
||||
@@ -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",
|
||||
@@ -650,6 +655,7 @@ source_set("electron_lib") {
|
||||
"//ui/events/devices/x11",
|
||||
"//ui/events/platform/x11",
|
||||
"//ui/gtk:gtk_config",
|
||||
"//ui/linux:display_server_utils",
|
||||
"//ui/linux:linux_ui",
|
||||
"//ui/linux:linux_ui_factory",
|
||||
"//ui/wm",
|
||||
@@ -682,7 +688,7 @@ source_set("electron_lib") {
|
||||
deps += [
|
||||
"//components/app_launch_prefetch",
|
||||
"//components/crash/core/app:crash_export_thunks",
|
||||
"//ui/native_theme:native_theme_browser",
|
||||
"//third_party/libxml:xml_writer",
|
||||
"//ui/wm",
|
||||
"//ui/wm/public",
|
||||
]
|
||||
@@ -727,7 +733,7 @@ source_set("electron_lib") {
|
||||
"shell/common/extensions/api:extensions_features",
|
||||
"//chrome/browser/resources:component_extension_resources",
|
||||
"//components/guest_view/common:mojom",
|
||||
"//components/update_client:update_client",
|
||||
"//components/update_client",
|
||||
"//components/zoom",
|
||||
"//extensions/browser",
|
||||
"//extensions/browser/api:api_provider",
|
||||
@@ -772,6 +778,18 @@ 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)
|
||||
|
||||
args += rebase_path(outputs)
|
||||
|
||||
deps = [ "//tools/v8_context_snapshot" ]
|
||||
}
|
||||
|
||||
electron_paks("packed_resources") {
|
||||
if (is_mac) {
|
||||
output_dir = "$root_gen_dir/electron_repack"
|
||||
@@ -815,7 +833,7 @@ if (is_mac) {
|
||||
sources = []
|
||||
public_deps = []
|
||||
sources += [ "$root_out_dir/libffmpeg.dylib" ]
|
||||
public_deps += [ "//third_party/ffmpeg:ffmpeg" ]
|
||||
public_deps += [ "//third_party/ffmpeg" ]
|
||||
outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
|
||||
}
|
||||
} else {
|
||||
@@ -1230,7 +1248,7 @@ if (is_mac) {
|
||||
}
|
||||
|
||||
if (use_v8_context_snapshot) {
|
||||
public_deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
|
||||
public_deps = [ "//tools/v8_context_snapshot" ]
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
@@ -1409,6 +1427,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
|
||||
@@ -1454,6 +1484,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" ]
|
||||
}
|
||||
@@ -1578,3 +1618,78 @@ group("copy_node_headers") {
|
||||
group("node_headers") {
|
||||
public_deps = [ ":tar_node_headers" ]
|
||||
}
|
||||
|
||||
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':
|
||||
'138.0.7190.0',
|
||||
'142.0.7417.0',
|
||||
'node_version':
|
||||
'v22.16.0',
|
||||
'v22.20.0',
|
||||
'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,
|
||||
|
||||
@@ -8,6 +8,12 @@ The Electron team will send a response indicating the next steps in handling you
|
||||
|
||||
Report security bugs in third-party modules to the person or team maintaining the module. You can also report a vulnerability through the [npm contact form](https://www.npmjs.com/support) by selecting "I'm reporting a security vulnerability".
|
||||
|
||||
## Escalation
|
||||
|
||||
If you do not receive an acknowledgement of your report within 6 business days, or if you cannot find a private security contact for the project, you may escalate to the OpenJS Foundation CNA at `security@lists.openjsf.org`.
|
||||
|
||||
If the project acknowledges your report but does not provide any further response or engagement within 14 days, escalation is also appropriate.
|
||||
|
||||
## The Electron Security Notification Process
|
||||
|
||||
For context on Electron's security notification process, please see the [Notifications](https://github.com/electron/governance/blob/main/wg-security/membership-and-notifications.md#notifications) section of the Security WG's [Membership and Notifications](https://github.com/electron/governance/blob/main/wg-security/membership-and-notifications.md) Governance document.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"plugins": [
|
||||
"unicorn"
|
||||
"import"
|
||||
],
|
||||
"rules": {
|
||||
"unicorn/prefer-node-protocol": "error"
|
||||
"import/enforce-node-protocol-usage": ["error", "always"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ is_electron_build = true
|
||||
root_extra_deps = [ "//electron" ]
|
||||
|
||||
# Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json
|
||||
node_module_version = 136
|
||||
node_module_version = 140
|
||||
|
||||
v8_promise_internal_field_count = 1
|
||||
v8_embedder_string = "-electron.0"
|
||||
@@ -70,6 +70,8 @@ v8_expose_public_symbols = true
|
||||
# sensitive content by enterprise users.
|
||||
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
|
||||
|
||||
# Disable "Save to Drive" feature in PDF viewer
|
||||
enable_pdf_save_to_drive = 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 {
|
||||
|
||||
inline constexpr std::string_view 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())
|
||||
@@ -67,10 +67,6 @@ template("mac_xib_bundle_data") {
|
||||
ibtool_flags = [
|
||||
"--minimum-deployment-target",
|
||||
mac_deployment_target,
|
||||
|
||||
# TODO(rsesek): Enable this once all the bots are on Xcode 7+.
|
||||
# "--target-device",
|
||||
# "mac",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
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):
|
||||
|
||||
@@ -23,6 +23,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/browser_process.h",
|
||||
"//chrome/browser/devtools/devtools_contents_resizing_strategy.cc",
|
||||
"//chrome/browser/devtools/devtools_contents_resizing_strategy.h",
|
||||
"//chrome/browser/devtools/devtools_dispatch_http_request_params.cc",
|
||||
"//chrome/browser/devtools/devtools_dispatch_http_request_params.h",
|
||||
"//chrome/browser/devtools/devtools_embedder_message_dispatcher.cc",
|
||||
"//chrome/browser/devtools/devtools_embedder_message_dispatcher.h",
|
||||
"//chrome/browser/devtools/devtools_eye_dropper.cc",
|
||||
@@ -66,6 +68,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker.h",
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker_observer.cc",
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker_observer.h",
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_widget_fade_animator.cc",
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_widget_fade_animator.h",
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc",
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h",
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager_uma_helper.cc",
|
||||
@@ -74,14 +78,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.h",
|
||||
"//chrome/browser/platform_util.cc",
|
||||
"//chrome/browser/platform_util.h",
|
||||
"//chrome/browser/predictors/preconnect_manager.cc",
|
||||
"//chrome/browser/predictors/preconnect_manager.h",
|
||||
"//chrome/browser/predictors/predictors_features.cc",
|
||||
"//chrome/browser/predictors/predictors_features.h",
|
||||
"//chrome/browser/predictors/proxy_lookup_client_impl.cc",
|
||||
"//chrome/browser/predictors/proxy_lookup_client_impl.h",
|
||||
"//chrome/browser/predictors/resolve_host_client_impl.cc",
|
||||
"//chrome/browser/predictors/resolve_host_client_impl.h",
|
||||
"//chrome/browser/process_singleton.h",
|
||||
"//chrome/browser/process_singleton_internal.cc",
|
||||
"//chrome/browser/process_singleton_internal.h",
|
||||
@@ -128,8 +126,12 @@ static_library("chrome") {
|
||||
"//chrome/browser/ui/views/overlay/hang_up_button.h",
|
||||
"//chrome/browser/ui/views/overlay/minimize_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/minimize_button.h",
|
||||
"//chrome/browser/ui/views/overlay/overlay_controls_fade_animation.cc",
|
||||
"//chrome/browser/ui/views/overlay/overlay_controls_fade_animation.h",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_live_caption_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_live_caption_button.h",
|
||||
"//chrome/browser/ui/views/overlay/playback_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/playback_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/resize_handle_button.cc",
|
||||
@@ -144,6 +146,10 @@ static_library("chrome") {
|
||||
"//chrome/browser/ui/views/overlay/toggle_microphone_button.h",
|
||||
"//chrome/browser/ui/views/overlay/video_overlay_window_views.cc",
|
||||
"//chrome/browser/ui/views/overlay/video_overlay_window_views.h",
|
||||
"//chrome/browser/ui/views/picture_in_picture/picture_in_picture_bounds_change_animation.cc",
|
||||
"//chrome/browser/ui/views/picture_in_picture/picture_in_picture_bounds_change_animation.h",
|
||||
"//chrome/browser/ui/views/picture_in_picture/picture_in_picture_tucker.cc",
|
||||
"//chrome/browser/ui/views/picture_in_picture/picture_in_picture_tucker.h",
|
||||
"//chrome/browser/ui/webui/accessibility/accessibility_ui.cc",
|
||||
"//chrome/browser/ui/webui/accessibility/accessibility_ui.h",
|
||||
"//chrome/browser/usb/usb_blocklist.cc",
|
||||
@@ -207,7 +213,7 @@ static_library("chrome") {
|
||||
"//components/enterprise/common/proto:connectors_proto",
|
||||
"//components/enterprise/obfuscation/core:enterprise_obfuscation",
|
||||
"//components/safe_browsing/core/browser/db:safebrowsing_proto",
|
||||
"//components/vector_icons:vector_icons",
|
||||
"//components/vector_icons",
|
||||
"//ui/base/accelerators/global_accelerator_listener",
|
||||
"//ui/snapshot",
|
||||
"//ui/views/controls/webview",
|
||||
@@ -217,8 +223,8 @@ static_library("chrome") {
|
||||
sources += [
|
||||
"//chrome/browser/platform_util_aura.cc",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_aura.cc",
|
||||
"//ui/views/native_window_tracker_aura.cc",
|
||||
"//ui/views/native_window_tracker_aura.h",
|
||||
"//ui/native_window_tracker/native_window_tracker_aura.cc",
|
||||
"//ui/native_window_tracker/native_window_tracker_aura.h",
|
||||
]
|
||||
deps += [ "//components/eye_dropper" ]
|
||||
}
|
||||
@@ -274,6 +280,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/process_singleton_mac.mm",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
|
||||
"//chrome/browser/ui/views/overlay/video_overlay_window_native_widget_mac.h",
|
||||
"//chrome/browser/ui/views/overlay/video_overlay_window_native_widget_mac.mm",
|
||||
]
|
||||
deps += [ ":system_media_capture_permissions_mac_conflict" ]
|
||||
}
|
||||
@@ -496,15 +504,17 @@ source_set("chrome_spellchecker") {
|
||||
]
|
||||
}
|
||||
|
||||
# These sources create an object file conflict with one in |:chrome|, so they
|
||||
# must live in a separate target.
|
||||
# Conflicting sources:
|
||||
# //chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm
|
||||
# //chrome/browser/permissions/system/system_media_capture_permissions_mac.mm
|
||||
source_set("system_media_capture_permissions_mac_conflict") {
|
||||
sources = [
|
||||
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.h",
|
||||
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.mm",
|
||||
]
|
||||
deps = [ "//chrome/common" ]
|
||||
if (is_mac) {
|
||||
# These sources create an object file conflict with one in |:chrome|, so they
|
||||
# must live in a separate target.
|
||||
# Conflicting sources:
|
||||
# //chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm
|
||||
# //chrome/browser/permissions/system/system_media_capture_permissions_mac.mm
|
||||
source_set("system_media_capture_permissions_mac_conflict") {
|
||||
sources = [
|
||||
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.h",
|
||||
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.mm",
|
||||
]
|
||||
deps = [ "//chrome/common" ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"plugins": [
|
||||
"unicorn"
|
||||
"import"
|
||||
],
|
||||
"rules": {
|
||||
"unicorn/prefer-node-protocol": "error"
|
||||
"import/enforce-node-protocol-usage": ["error", "always"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"extends": "standard",
|
||||
"plugins": [
|
||||
"markdown",
|
||||
"unicorn"
|
||||
"import",
|
||||
"markdown"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
@@ -30,6 +30,6 @@
|
||||
"no-undef": "off",
|
||||
"no-unused-expressions": "off",
|
||||
"no-unused-vars": "off",
|
||||
"unicorn/prefer-node-protocol": "error"
|
||||
"import/enforce-node-protocol-usage": ["error", "always"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
# Accelerator
|
||||
|
||||
> Define keyboard shortcuts.
|
||||
|
||||
Accelerators are strings that can contain multiple modifiers and a single key code,
|
||||
combined by the `+` character, and are used to define keyboard shortcuts
|
||||
throughout your application. Accelerators are case insensitive.
|
||||
|
||||
Examples:
|
||||
|
||||
* `CommandOrControl+A`
|
||||
* `CommandOrControl+Shift+Z`
|
||||
|
||||
Shortcuts are registered with the [`globalShortcut`](global-shortcut.md) module
|
||||
using the [`register`](global-shortcut.md#globalshortcutregisteraccelerator-callback)
|
||||
method, i.e.
|
||||
|
||||
```js
|
||||
const { app, globalShortcut } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
// Register a 'CommandOrControl+Y' shortcut listener.
|
||||
globalShortcut.register('CommandOrControl+Y', () => {
|
||||
// Do stuff when Y and either Command/Control is pressed.
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
## Platform notice
|
||||
|
||||
On Linux and Windows, the `Command` key does not have any effect so
|
||||
use `CommandOrControl` which represents `Command` on macOS and `Control` on
|
||||
Linux and Windows to define some accelerators.
|
||||
|
||||
Use `Alt` instead of `Option`. The `Option` key only exists on macOS, whereas
|
||||
the `Alt` key is available on all platforms.
|
||||
|
||||
The `Super` (or `Meta`) key is mapped to the `Windows` key on Windows and Linux and
|
||||
`Cmd` on macOS.
|
||||
|
||||
## Available modifiers
|
||||
|
||||
* `Command` (or `Cmd` for short)
|
||||
* `Control` (or `Ctrl` for short)
|
||||
* `CommandOrControl` (or `CmdOrCtrl` for short)
|
||||
* `Alt`
|
||||
* `Option`
|
||||
* `AltGr`
|
||||
* `Shift`
|
||||
* `Super`
|
||||
* `Meta`
|
||||
|
||||
## Available key codes
|
||||
|
||||
* `0` to `9`
|
||||
* `A` to `Z`
|
||||
* `F1` to `F24`
|
||||
* Various Punctuation: `)`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, `*`, `(`, `:`, `;`, `:`, `+`, `=`, `<`, `,`, `_`, `-`, `>`, `.`, `?`, `/`, `~`, `` ` ``, `{`, `]`, `[`, `|`, `\`, `}`, `"`
|
||||
* `Plus`
|
||||
* `Space`
|
||||
* `Tab`
|
||||
* `Capslock`
|
||||
* `Numlock`
|
||||
* `Scrolllock`
|
||||
* `Backspace`
|
||||
* `Delete`
|
||||
* `Insert`
|
||||
* `Return` (or `Enter` as alias)
|
||||
* `Up`, `Down`, `Left` and `Right`
|
||||
* `Home` and `End`
|
||||
* `PageUp` and `PageDown`
|
||||
* `Escape` (or `Esc` for short)
|
||||
* `VolumeUp`, `VolumeDown` and `VolumeMute`
|
||||
* `MediaNextTrack`, `MediaPreviousTrack`, `MediaStop` and `MediaPlayPause`
|
||||
* `PrintScreen`
|
||||
* NumPad Keys
|
||||
* `num0` - `num9`
|
||||
* `numdec` - decimal key
|
||||
* `numadd` - numpad `+` key
|
||||
* `numsub` - numpad `-` key
|
||||
* `nummult` - numpad `*` key
|
||||
* `numdiv` - numpad `÷` key
|
||||
@@ -602,6 +602,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
|
||||
@@ -616,7 +617,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.
|
||||
@@ -776,6 +777,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,
|
||||
|
||||
@@ -1260,6 +1260,43 @@ Sets the properties for the window's taskbar button.
|
||||
> `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_
|
||||
|
||||
* `icon` [NativeImage](native-image.md) | string
|
||||
|
||||
@@ -1440,6 +1440,43 @@ Sets the properties for the window's taskbar button.
|
||||
> `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_
|
||||
|
||||
Same as `webContents.showDefinitionForSelection()`.
|
||||
@@ -1533,11 +1570,18 @@ 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 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.
|
||||
|
||||
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).
|
||||
Unfortunately, due to an intentional change in macOS, newer Mac applications that use
|
||||
`ScreenCaptureKit` will capture your window despite `win.setContentProtection(true)`.
|
||||
See [here](https://github.com/electron/electron/issues/48258#issuecomment-3269893618).
|
||||
|
||||
#### `win.isContentProtected()` _macOS_ _Windows_
|
||||
|
||||
Returns `boolean` - whether or not content protection is currently enabled.
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) (non-sandboxed only)
|
||||
|
||||
> [!IMPORTANT]
|
||||
> If you want to call this API from a renderer process with context isolation enabled,
|
||||
> place the API call in your preload script and
|
||||
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
|
||||
> [`contextBridge`](context-bridge.md) API.
|
||||
|
||||
On Linux, there is also a `selection` clipboard. To manipulate it
|
||||
you need to pass `selection` to each method:
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ Field trials to be forcefully enabled or disabled.
|
||||
|
||||
For example: `WebRTC-Audio-Red-For-Opus/Enabled/`
|
||||
|
||||
### --host-rules=`rules`
|
||||
### --host-rules=`rules` _Deprecated_
|
||||
|
||||
A comma-separated list of `rules` that control how hostnames are mapped.
|
||||
|
||||
@@ -104,9 +104,23 @@ These mappings apply to the endpoint host in a net request (the TCP connect
|
||||
and host resolver in a direct connection, and the `CONNECT` in an HTTP proxy
|
||||
connection, and the endpoint host in a `SOCKS` proxy connection).
|
||||
|
||||
**Deprecated:** Use the `--host-resolver-rules` switch instead.
|
||||
|
||||
### --host-resolver-rules=`rules`
|
||||
|
||||
Like `--host-rules` but these `rules` only apply to the host resolver.
|
||||
A comma-separated list of `rules` that control how hostnames are mapped.
|
||||
|
||||
For example:
|
||||
|
||||
* `MAP * 127.0.0.1` Forces all hostnames to be mapped to 127.0.0.1
|
||||
* `MAP *.google.com proxy` Forces all google.com subdomains to be resolved to
|
||||
"proxy".
|
||||
* `MAP test.com [::1]:77` Forces "test.com" to resolve to IPv6 loopback. Will
|
||||
also force the port of the resulting socket address to be 77.
|
||||
* `MAP * baz, EXCLUDE www.google.com` Remaps everything to "baz", except for
|
||||
"www.google.com".
|
||||
|
||||
These `rules` only apply to the host resolver.
|
||||
|
||||
### --ignore-certificate-errors
|
||||
|
||||
@@ -179,6 +193,11 @@ Disables the Chromium [sandbox](https://www.chromium.org/developers/design-docum
|
||||
Forces renderer process and Chromium helper processes to run un-sandboxed.
|
||||
Should only be used for testing.
|
||||
|
||||
### --no-stdio-init
|
||||
|
||||
Disable stdio initialization during node initialization.
|
||||
Used to avoid node initialization crash when the nul device is disabled on Windows platform.
|
||||
|
||||
### --proxy-bypass-list=`hosts`
|
||||
|
||||
Instructs Electron to bypass the proxy server for the given semi-colon-separated
|
||||
@@ -292,7 +311,7 @@ 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-inspector`
|
||||
### `--experimental-network-inspection`
|
||||
|
||||
Enable support for devtools network inspector events, for visibility into requests made by the nodejs `http` and `https` modules.
|
||||
|
||||
@@ -331,6 +350,22 @@ Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https:
|
||||
|
||||
Disable exposition of [Navigator API][] on the global scope from Node.js.
|
||||
|
||||
## Chromium Flags
|
||||
|
||||
There isn't a documented list of all Chromium switches, but there are a few ways to find them.
|
||||
|
||||
The easiest way is through Chromium's flags page, which you can access at `about://flags`. These flags don't directly match switch names, but they show up in the process's command-line arguments.
|
||||
|
||||
To see these arguments, enable a flag in `about://flags`, then go to `about://version` in Chromium. You'll find a list of command-line arguments, including `--flag-switches-begin --your --list --flag-switches-end`, which contains the list of your flag enabled switches.
|
||||
|
||||
Most flags are included as part of `--enable-features=`, but some are standalone switches, like `--enable-experimental-web-platform-features`.
|
||||
|
||||
A complete list of flags exists in [Chromium's flag metadata page](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/flag-metadata.json), but this list includes platform, environment and GPU specific, expired and potentially non-functional flags, so many of them might not always work in every situation.
|
||||
|
||||
Keep in mind that standalone switches can sometimes be split into individual features, so there's no fully complete list of switches.
|
||||
|
||||
Finally, you'll need to ensure that the version of Chromium in Electron matches the version of the browser you're using to cross-reference the switches.
|
||||
|
||||
[app]: app.md
|
||||
[append-switch]: command-line.md#commandlineappendswitchswitch-value
|
||||
[debugging-main-process]: ../tutorial/debugging-main-process.md
|
||||
|
||||
@@ -157,6 +157,7 @@ has been included below for completeness:
|
||||
| [Cloneable Types](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) | Simple | ✅ | ✅ | See the linked document on cloneable types |
|
||||
| `Element` | Complex | ✅ | ✅ | Prototype modifications are dropped. Sending custom elements will not work. |
|
||||
| `Blob` | Complex | ✅ | ✅ | N/A |
|
||||
| `VideoFrame` | Complex | ✅ | ✅ | N/A |
|
||||
| `Symbol` | N/A | ❌ | ❌ | Symbols cannot be copied across contexts so they are dropped |
|
||||
|
||||
If the type you care about is not in the above table, it is probably not supported.
|
||||
|
||||
@@ -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%`
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
|
||||
|
||||
> [!IMPORTANT]
|
||||
> If you want to call this API from a renderer process with context isolation enabled,
|
||||
> place the API call in your preload script and
|
||||
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
|
||||
> [`contextBridge`](context-bridge.md) API.
|
||||
|
||||
The following is an example of setting up Electron to automatically submit
|
||||
crash reports to a remote server:
|
||||
|
||||
@@ -63,7 +69,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.
|
||||
|
||||
@@ -5,13 +5,8 @@
|
||||
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._
|
||||
|
||||
The following example shows how to bounce your icon on the dock.
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
|
||||
app.dock?.bounce()
|
||||
```
|
||||
> [!TIP]
|
||||
> See also: [A detailed guide about how to implement Dock menus](../tutorial/macos-dock.md).
|
||||
|
||||
### Instance Methods
|
||||
|
||||
@@ -50,6 +45,9 @@ Bounces the Downloads stack if the filePath is inside the Downloads folder.
|
||||
|
||||
Sets the string to be displayed in the dock’s badging area.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> You need to ensure that your application has the permission to display notifications for this method to work.
|
||||
|
||||
#### `dock.getBadge()` _macOS_
|
||||
|
||||
Returns `string` - The badge string of the dock.
|
||||
|
||||
@@ -125,16 +125,6 @@ Options:
|
||||
* `kioclient5`
|
||||
* `kioclient`
|
||||
|
||||
### `ELECTRON_OZONE_PLATFORM_HINT` _Linux_
|
||||
|
||||
Selects the preferred platform backend used on Linux. The default one is `x11`. `auto` selects Wayland if possible, X11 otherwise.
|
||||
|
||||
Options:
|
||||
|
||||
* `auto`
|
||||
* `wayland`
|
||||
* `x11`
|
||||
|
||||
## Development Variables
|
||||
|
||||
The following environment variables are intended primarily for development and
|
||||
|
||||
@@ -46,13 +46,16 @@ app.on('will-quit', () => {
|
||||
})
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> See also: [A detailed guide on Keyboard Shortcuts](../tutorial/keyboard-shortcuts.md).
|
||||
|
||||
## Methods
|
||||
|
||||
The `globalShortcut` module has the following methods:
|
||||
|
||||
### `globalShortcut.register(accelerator, callback)`
|
||||
|
||||
* `accelerator` [Accelerator](accelerator.md)
|
||||
* `accelerator` string - An [accelerator](../tutorial/keyboard-shortcuts.md#accelerators) shortcut.
|
||||
* `callback` Function
|
||||
|
||||
Returns `boolean` - Whether or not the shortcut was registered successfully.
|
||||
@@ -74,7 +77,7 @@ the app has been authorized as a [trusted accessibility client](https://develope
|
||||
|
||||
### `globalShortcut.registerAll(accelerators, callback)`
|
||||
|
||||
* `accelerators` [Accelerator](accelerator.md)[] - an array of [Accelerator](accelerator.md)s.
|
||||
* `accelerators` string[] - An array of [accelerator](../tutorial/keyboard-shortcuts.md#accelerators) shortcuts.
|
||||
* `callback` Function
|
||||
|
||||
Registers a global shortcut of all `accelerator` items in `accelerators`. The `callback` is called when any of the registered shortcuts are pressed by the user.
|
||||
@@ -93,7 +96,7 @@ the app has been authorized as a [trusted accessibility client](https://develope
|
||||
|
||||
### `globalShortcut.isRegistered(accelerator)`
|
||||
|
||||
* `accelerator` [Accelerator](accelerator.md)
|
||||
* `accelerator` string - An [accelerator](../tutorial/keyboard-shortcuts.md#accelerators) shortcut.
|
||||
|
||||
Returns `boolean` - Whether this application has registered `accelerator`.
|
||||
|
||||
@@ -103,7 +106,7 @@ don't want applications to fight for global shortcuts.
|
||||
|
||||
### `globalShortcut.unregister(accelerator)`
|
||||
|
||||
* `accelerator` [Accelerator](accelerator.md)
|
||||
* `accelerator` string - An [accelerator](../tutorial/keyboard-shortcuts.md#accelerators) shortcut.
|
||||
|
||||
Unregisters the global shortcut of `accelerator`.
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ changes:
|
||||
|
||||
Process: [Renderer](../glossary.md#renderer-process)
|
||||
|
||||
> [!IMPORTANT]
|
||||
> If you want to call this API from a renderer process with context isolation enabled,
|
||||
> place the API call in your preload script and
|
||||
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
|
||||
> [`contextBridge`](context-bridge.md) API.
|
||||
|
||||
The `ipcRenderer` module is an [EventEmitter][event-emitter]. It provides a few
|
||||
methods so you can send synchronous and asynchronous messages from the render
|
||||
process (web page) to the main process. You can also receive replies from the
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# MenuItem
|
||||
|
||||
## Class: MenuItem
|
||||
|
||||
> Add items to native application menus and context menus.
|
||||
@@ -19,7 +21,7 @@ See [`Menu`](menu.md) for examples.
|
||||
* `window` [BaseWindow](base-window.md) | undefined - This will not be defined if no window is open.
|
||||
* `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).
|
||||
`click` property will be ignored. See [roles](../tutorial/menus.md#roles).
|
||||
* `type` string (optional)
|
||||
* `normal`
|
||||
* `separator`
|
||||
@@ -31,7 +33,7 @@ See [`Menu`](menu.md) for examples.
|
||||
* `label` 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)
|
||||
* `accelerator` string (optional) - An [Accelerator](../tutorial/keyboard-shortcuts.md#accelerators) string.
|
||||
* `icon` ([NativeImage](native-image.md) | string) (optional)
|
||||
* `enabled` boolean (optional) - If false, the menu item will be greyed out and
|
||||
unclickable.
|
||||
@@ -64,88 +66,13 @@ See [`Menu`](menu.md) for examples.
|
||||
> [!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
|
||||
|
||||
Roles allow menu items to have predefined behaviors.
|
||||
|
||||
It is best to specify `role` for any menu item that matches a standard role,
|
||||
rather than trying to manually implement the behavior in a `click` function.
|
||||
The built-in `role` behavior will give the best native experience.
|
||||
|
||||
The `label` and `accelerator` values are optional when using a `role` and will
|
||||
default to appropriate values for each platform.
|
||||
|
||||
Every menu item must have either a `role`, `label`, or in the case of a separator
|
||||
a `type`.
|
||||
|
||||
The `role` property can have following values:
|
||||
|
||||
* `undo`
|
||||
* `about` - Trigger a native about panel (custom message box on Window, which does not provide its own).
|
||||
* `redo`
|
||||
* `cut`
|
||||
* `copy`
|
||||
* `paste`
|
||||
* `pasteAndMatchStyle`
|
||||
* `selectAll`
|
||||
* `delete`
|
||||
* `minimize` - Minimize current window.
|
||||
* `close` - Close current window.
|
||||
* `quit` - Quit the application.
|
||||
* `reload` - Reload the current window.
|
||||
* `forceReload` - Reload the current window ignoring the cache.
|
||||
* `toggleDevTools` - Toggle developer tools in the current window.
|
||||
* `togglefullscreen` - Toggle full screen mode on the current window.
|
||||
* `resetZoom` - Reset the focused page's zoom level to the original size.
|
||||
* `zoomIn` - Zoom in the focused page by 10%.
|
||||
* `zoomOut` - Zoom out the focused page by 10%.
|
||||
* `toggleSpellChecker` - Enable/disable builtin spell checker.
|
||||
* `fileMenu` - Whole default "File" menu (Close / Quit)
|
||||
* `editMenu` - Whole default "Edit" menu (Undo, Copy, etc.).
|
||||
* `viewMenu` - Whole default "View" menu (Reload, Toggle Developer Tools, etc.)
|
||||
* `windowMenu` - Whole default "Window" menu (Minimize, Zoom, etc.).
|
||||
|
||||
The following additional roles are available on _macOS_:
|
||||
|
||||
* `appMenu` - Whole default "App" menu (About, Services, etc.)
|
||||
* `hide` - Map to the `hide` action.
|
||||
* `hideOthers` - Map to the `hideOtherApplications` action.
|
||||
* `unhide` - Map to the `unhideAllApplications` action.
|
||||
* `showSubstitutions` - Map to the `orderFrontSubstitutionsPanel` action.
|
||||
* `toggleSmartQuotes` - Map to the `toggleAutomaticQuoteSubstitution` action.
|
||||
* `toggleSmartDashes` - Map to the `toggleAutomaticDashSubstitution` action.
|
||||
* `toggleTextReplacement` - Map to the `toggleAutomaticTextReplacement` action.
|
||||
* `startSpeaking` - Map to the `startSpeaking` action.
|
||||
* `stopSpeaking` - Map to the `stopSpeaking` action.
|
||||
* `front` - Map to the `arrangeInFront` action.
|
||||
* `zoom` - Map to the `performZoom` action.
|
||||
* `toggleTabBar` - Map to the `toggleTabBar` action.
|
||||
* `selectNextTab` - Map to the `selectNextTab` action.
|
||||
* `selectPreviousTab` - Map to the `selectPreviousTab` action.
|
||||
* `showAllTabs` - Map to the `showAllTabs` action.
|
||||
* `mergeAllWindows` - Map to the `mergeAllWindows` action.
|
||||
* `moveTabToNewWindow` - Map to the `moveTabToNewWindow` action.
|
||||
* `window` - The submenu is a "Window" menu.
|
||||
* `help` - The submenu is a "Help" menu.
|
||||
* `services` - The submenu is a ["Services"](https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc) menu. This is only intended for use in the Application Menu and is _not_ the same as the "Services" submenu used in context menus in macOS apps, which is not implemented in Electron.
|
||||
* `recentDocuments` - The submenu is an "Open Recent" menu.
|
||||
* `clearRecentDocuments` - Map to the `clearRecentDocuments` action.
|
||||
* `shareMenu` - The submenu is [share menu][ShareMenu]. The `sharingItem` property must also be set to indicate the item to share.
|
||||
|
||||
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.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
The following properties are available on instances of `MenuItem`:
|
||||
|
||||
#### `menuItem.id`
|
||||
|
||||
A `string` indicating the item's unique id, this property can be
|
||||
A `string` indicating the item's unique id. This property can be
|
||||
dynamically changed.
|
||||
|
||||
#### `menuItem.label`
|
||||
@@ -203,17 +130,17 @@ A `string` indicating the item's hover text.
|
||||
|
||||
#### `menuItem.enabled`
|
||||
|
||||
A `boolean` indicating whether the item is enabled, this property can be
|
||||
A `boolean` indicating whether the item is enabled. This property can be
|
||||
dynamically changed.
|
||||
|
||||
#### `menuItem.visible`
|
||||
|
||||
A `boolean` indicating whether the item is visible, this property can be
|
||||
A `boolean` indicating whether the item is visible. This property can be
|
||||
dynamically changed.
|
||||
|
||||
#### `menuItem.checked`
|
||||
|
||||
A `boolean` indicating whether the item is checked, this property can be
|
||||
A `boolean` indicating whether the item is checked. This property can be
|
||||
dynamically changed.
|
||||
|
||||
A `checkbox` menu item will toggle the `checked` property on and off when
|
||||
@@ -244,5 +171,3 @@ A `number` indicating an item's sequential unique id.
|
||||
#### `menuItem.menu`
|
||||
|
||||
A `Menu` that the item is a part of.
|
||||
|
||||
[ShareMenu]: https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/
|
||||
|
||||
339
docs/api/menu.md
339
docs/api/menu.md
@@ -6,6 +6,9 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
> [!TIP]
|
||||
> See also: [A detailed guide about how to implement menus in your application](../tutorial/menus.md).
|
||||
|
||||
> [!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).
|
||||
@@ -20,7 +23,7 @@ The `Menu` class has the following static methods:
|
||||
|
||||
#### `Menu.setApplicationMenu(menu)`
|
||||
|
||||
* `menu` Menu | null
|
||||
- `menu` Menu | null
|
||||
|
||||
Sets `menu` as the application menu on macOS. On Windows and Linux, the
|
||||
`menu` will be set as each window's top menu.
|
||||
@@ -51,18 +54,18 @@ Returns `Menu | null` - The application menu, if set, or `null`, if not set.
|
||||
|
||||
#### `Menu.sendActionToFirstResponder(action)` _macOS_
|
||||
|
||||
* `action` string
|
||||
- `action` string
|
||||
|
||||
Sends the `action` to the first responder of application. This is used for
|
||||
emulating default macOS menu behaviors. Usually you would use the
|
||||
[`role`](menu-item.md#roles) property of a [`MenuItem`](menu-item.md).
|
||||
[`role`](../tutorial/menus.md#roles) property of a [`MenuItem`](menu-item.md).
|
||||
|
||||
See the [macOS Cocoa Event Handling Guide](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7)
|
||||
for more information on macOS' native actions.
|
||||
|
||||
#### `Menu.buildFromTemplate(template)`
|
||||
|
||||
* `template` (MenuItemConstructorOptions | MenuItem)[]
|
||||
- `template` (MenuItemConstructorOptions | MenuItem)[]
|
||||
|
||||
Returns `Menu`
|
||||
|
||||
@@ -77,47 +80,50 @@ The `menu` object has the following instance methods:
|
||||
|
||||
#### `menu.popup([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
|
||||
* `frame` [WebFrameMain](web-frame-main.md) (optional) - Provide the relevant frame
|
||||
- `options` Object (optional)
|
||||
- `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
|
||||
- `frame` [WebFrameMain](web-frame-main.md) (optional) - Provide the relevant frame
|
||||
if you want certain OS-level features such as Writing Tools on macOS to function correctly. Typically, this should be `params.frame` from the [`context-menu` event](web-contents.md#event-context-menu) on a WebContents, or the [`focusedFrame` property](web-contents.md#contentsfocusedframe-readonly) of a WebContents.
|
||||
* `x` number (optional) - Default is the current mouse cursor position.
|
||||
- `x` number (optional) - Default is the current mouse cursor position.
|
||||
Must be declared if `y` is declared.
|
||||
* `y` number (optional) - Default is the current mouse cursor position.
|
||||
- `y` number (optional) - Default is the current mouse cursor position.
|
||||
Must be declared if `x` is declared.
|
||||
* `positioningItem` number (optional) _macOS_ - The index of the menu item to
|
||||
- `positioningItem` number (optional) _macOS_ - The index of the menu item to
|
||||
be positioned under the mouse cursor at the specified coordinates. Default
|
||||
is -1.
|
||||
* `sourceType` string (optional) _Windows_ _Linux_ - This should map to the `menuSourceType`
|
||||
- `sourceType` string (optional) _Windows_ _Linux_ - This should map to the `menuSourceType`
|
||||
provided by the `context-menu` event. It is not recommended to set this value manually,
|
||||
only provide values you receive from other APIs or leave it `undefined`.
|
||||
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.
|
||||
* `callback` Function (optional) - Called when menu is closed.
|
||||
- `callback` Function (optional) - Called when menu is closed.
|
||||
|
||||
Pops up this menu as a context menu in the [`BaseWindow`](base-window.md).
|
||||
|
||||
> [!TIP]
|
||||
> For more details, see the [Context Menu](../tutorial/context-menu.md) guide.
|
||||
|
||||
#### `menu.closePopup([window])`
|
||||
|
||||
* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
|
||||
- `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
|
||||
|
||||
Closes the context menu in the `window`.
|
||||
|
||||
#### `menu.append(menuItem)`
|
||||
|
||||
* `menuItem` [MenuItem](menu-item.md)
|
||||
- `menuItem` [MenuItem](menu-item.md)
|
||||
|
||||
Appends the `menuItem` to the menu.
|
||||
|
||||
#### `menu.getMenuItemById(id)`
|
||||
|
||||
* `id` string
|
||||
- `id` string
|
||||
|
||||
Returns `MenuItem | null` the item with the specified `id`
|
||||
|
||||
#### `menu.insert(pos, menuItem)`
|
||||
|
||||
* `pos` Integer
|
||||
* `menuItem` [MenuItem](menu-item.md)
|
||||
- `pos` Integer
|
||||
- `menuItem` [MenuItem](menu-item.md)
|
||||
|
||||
Inserts the `menuItem` to the `pos` position of the menu.
|
||||
|
||||
@@ -133,7 +139,7 @@ Objects created with `new Menu` or returned by `Menu.buildFromTemplate` emit the
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
- `event` Event
|
||||
|
||||
Emitted when `menu.popup()` is called.
|
||||
|
||||
@@ -141,7 +147,7 @@ Emitted when `menu.popup()` is called.
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
- `event` Event
|
||||
|
||||
Emitted when a popup is closed either manually or with `menu.closePopup()`.
|
||||
|
||||
@@ -153,296 +159,5 @@ Emitted when a popup is closed either manually or with `menu.closePopup()`.
|
||||
|
||||
A `MenuItem[]` array containing the menu's items.
|
||||
|
||||
Each `Menu` consists of multiple [`MenuItem`](menu-item.md)s and each `MenuItem`
|
||||
can have a submenu.
|
||||
|
||||
## Examples
|
||||
|
||||
An example of creating the application menu with the simple template API:
|
||||
|
||||
```js @ts-expect-error=[107]
|
||||
const { app, Menu } = require('electron')
|
||||
|
||||
const isMac = process.platform === 'darwin'
|
||||
|
||||
const template = [
|
||||
// { role: 'appMenu' }
|
||||
...(isMac
|
||||
? [{
|
||||
label: app.name,
|
||||
submenu: [
|
||||
{ role: 'about' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'services' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'hide' },
|
||||
{ role: 'hideOthers' },
|
||||
{ role: 'unhide' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'quit' }
|
||||
]
|
||||
}]
|
||||
: []),
|
||||
// { role: 'fileMenu' }
|
||||
{
|
||||
label: 'File',
|
||||
submenu: [
|
||||
isMac ? { role: 'close' } : { role: 'quit' }
|
||||
]
|
||||
},
|
||||
// { role: 'editMenu' }
|
||||
{
|
||||
label: 'Edit',
|
||||
submenu: [
|
||||
{ role: 'undo' },
|
||||
{ role: 'redo' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'cut' },
|
||||
{ role: 'copy' },
|
||||
{ role: 'paste' },
|
||||
...(isMac
|
||||
? [
|
||||
{ role: 'pasteAndMatchStyle' },
|
||||
{ role: 'delete' },
|
||||
{ role: 'selectAll' },
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: 'Speech',
|
||||
submenu: [
|
||||
{ role: 'startSpeaking' },
|
||||
{ role: 'stopSpeaking' }
|
||||
]
|
||||
}
|
||||
]
|
||||
: [
|
||||
{ role: 'delete' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'selectAll' }
|
||||
])
|
||||
]
|
||||
},
|
||||
// { role: 'viewMenu' }
|
||||
{
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{ role: 'reload' },
|
||||
{ role: 'forceReload' },
|
||||
{ role: 'toggleDevTools' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'resetZoom' },
|
||||
{ role: 'zoomIn' },
|
||||
{ role: 'zoomOut' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'togglefullscreen' }
|
||||
]
|
||||
},
|
||||
// { role: 'windowMenu' }
|
||||
{
|
||||
label: 'Window',
|
||||
submenu: [
|
||||
{ role: 'minimize' },
|
||||
{ role: 'zoom' },
|
||||
...(isMac
|
||||
? [
|
||||
{ type: 'separator' },
|
||||
{ role: 'front' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'window' }
|
||||
]
|
||||
: [
|
||||
{ role: 'close' }
|
||||
])
|
||||
]
|
||||
},
|
||||
{
|
||||
role: 'help',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Learn More',
|
||||
click: async () => {
|
||||
const { shell } = require('electron')
|
||||
await shell.openExternal('https://electronjs.org')
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
const menu = Menu.buildFromTemplate(template)
|
||||
Menu.setApplicationMenu(menu)
|
||||
```
|
||||
|
||||
### Render process
|
||||
|
||||
To create menus initiated by the renderer process, send the required
|
||||
information to the main process using IPC and have the main process display the
|
||||
menu on behalf of the renderer.
|
||||
|
||||
Below is an example of showing a menu when the user right clicks the page:
|
||||
|
||||
```js @ts-expect-error=[21]
|
||||
// renderer
|
||||
window.addEventListener('contextmenu', (e) => {
|
||||
e.preventDefault()
|
||||
ipcRenderer.send('show-context-menu')
|
||||
})
|
||||
|
||||
ipcRenderer.on('context-menu-command', (e, command) => {
|
||||
// ...
|
||||
})
|
||||
|
||||
// main
|
||||
ipcMain.on('show-context-menu', (event) => {
|
||||
const template = [
|
||||
{
|
||||
label: 'Menu Item 1',
|
||||
click: () => { event.sender.send('context-menu-command', 'menu-item-1') }
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{ label: 'Menu Item 2', type: 'checkbox', checked: true }
|
||||
]
|
||||
const menu = Menu.buildFromTemplate(template)
|
||||
menu.popup({ window: BrowserWindow.fromWebContents(event.sender) })
|
||||
})
|
||||
```
|
||||
|
||||
## Notes on macOS Application Menu
|
||||
|
||||
macOS has a completely different style of application menu from Windows and
|
||||
Linux. Here are some notes on making your app's menu more native-like.
|
||||
|
||||
### Standard Menus
|
||||
|
||||
On macOS there are many system-defined standard menus, like the [`Services`](https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc) and
|
||||
`Windows` menus. To make your menu a standard menu, you should set your menu's
|
||||
`role` to one of the following and Electron will recognize them and make them
|
||||
become standard menus:
|
||||
|
||||
* `window`
|
||||
* `help`
|
||||
* `services`
|
||||
|
||||
### Standard Menu Item Actions
|
||||
|
||||
macOS has provided standard actions for some menu items, like `About xxx`,
|
||||
`Hide xxx`, and `Hide Others`. To set the action of a menu item to a standard
|
||||
action, you should set the `role` attribute of the menu item.
|
||||
|
||||
### Main Menu's Name
|
||||
|
||||
On macOS the label of the application menu's first item is always your app's
|
||||
name, no matter what label you set. To change it, modify your app bundle's
|
||||
`Info.plist` file. See
|
||||
[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
|
||||
browser windows.
|
||||
|
||||
## Menu Item Position
|
||||
|
||||
You can make use of `before`, `after`, `beforeGroupContaining`, `afterGroupContaining` and `id` to control how the item will be placed when building a menu with `Menu.buildFromTemplate`.
|
||||
|
||||
* `before` - Inserts this item before the item with the specified id. If the
|
||||
referenced item doesn't exist the item will be inserted at the end of
|
||||
the menu. Also implies that the menu item in question should be placed in the same “group” as the item.
|
||||
* `after` - Inserts this item after the item with the specified id. If the
|
||||
referenced item doesn't exist the item will be inserted at the end of
|
||||
the menu. Also implies that the menu item in question should be placed in the same “group” as the item.
|
||||
* `beforeGroupContaining` - Provides a means for a single context menu to declare
|
||||
the placement of their containing group before the containing group of the item with the specified id.
|
||||
* `afterGroupContaining` - Provides a means for a single context menu to declare
|
||||
the placement of their containing group after the containing group of the item with the specified id.
|
||||
|
||||
By default, items will be inserted in the order they exist in the template unless one of the specified positioning keywords is used.
|
||||
|
||||
### Examples
|
||||
|
||||
Template:
|
||||
|
||||
```js
|
||||
[
|
||||
{ id: '1', label: 'one' },
|
||||
{ id: '2', label: 'two' },
|
||||
{ id: '3', label: 'three' },
|
||||
{ id: '4', label: 'four' }
|
||||
]
|
||||
```
|
||||
|
||||
Menu:
|
||||
|
||||
```sh
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- 4
|
||||
```
|
||||
|
||||
Template:
|
||||
|
||||
```js
|
||||
[
|
||||
{ id: '1', label: 'one' },
|
||||
{ type: 'separator' },
|
||||
{ id: '3', label: 'three', beforeGroupContaining: ['1'] },
|
||||
{ id: '4', label: 'four', afterGroupContaining: ['2'] },
|
||||
{ type: 'separator' },
|
||||
{ id: '2', label: 'two' }
|
||||
]
|
||||
```
|
||||
|
||||
Menu:
|
||||
|
||||
```sh
|
||||
- 3
|
||||
- 4
|
||||
- ---
|
||||
- 1
|
||||
- ---
|
||||
- 2
|
||||
```
|
||||
|
||||
Template:
|
||||
|
||||
```js
|
||||
[
|
||||
{ id: '1', label: 'one', after: ['3'] },
|
||||
{ id: '2', label: 'two', before: ['1'] },
|
||||
{ id: '3', label: 'three' }
|
||||
]
|
||||
```
|
||||
|
||||
Menu:
|
||||
|
||||
```sh
|
||||
- ---
|
||||
- 3
|
||||
- 2
|
||||
- 1
|
||||
```
|
||||
|
||||
[AboutInformationPropertyListFiles]: https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html
|
||||
[setMenu]: browser-window.md#winsetmenumenu-linux-windows
|
||||
Each `Menu` consists of multiple [`MenuItem`](menu-item.md) instances and each `MenuItem`
|
||||
can nest a `Menu` into its `submenu` property.
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
|
||||
|
||||
> [!IMPORTANT]
|
||||
> If you want to call this API from a renderer process with context isolation enabled,
|
||||
> place the API call in your preload script and
|
||||
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
|
||||
> [`contextBridge`](context-bridge.md) API.
|
||||
|
||||
The `nativeImage` module provides a unified interface for manipulating
|
||||
system images. These can be handy if you want to provide multiple scaled
|
||||
versions of the same icon or take advantage of macOS [template images][template-image].
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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._
|
||||
|
||||
|
||||
@@ -939,14 +939,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
|
||||
@@ -968,6 +972,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
|
||||
|
||||
@@ -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
|
||||
|
||||
195
docs/api/structures/color-space.md
Normal file
195
docs/api/structures/color-space.md
Normal file
@@ -0,0 +1,195 @@
|
||||
# ColorSpace Object
|
||||
|
||||
* `primaries` string - The color primaries of the color space. Can be one of the following values:
|
||||
* `bt709` - BT709 primaries (also used for sRGB)
|
||||
* `bt470m` - BT470M primaries
|
||||
* `bt470bg` - BT470BG primaries
|
||||
* `smpte170m` - SMPTE170M primaries
|
||||
* `smpte240m` - SMPTE240M primaries
|
||||
* `film` - Film primaries
|
||||
* `bt2020` - BT2020 primaries
|
||||
* `smptest428-1` - SMPTEST428-1 primaries
|
||||
* `smptest431-2` - SMPTEST431-2 primaries
|
||||
* `p3` - P3 primaries
|
||||
* `xyz-d50` - XYZ D50 primaries
|
||||
* `adobe-rgb` - Adobe RGB primaries
|
||||
* `apple-generic-rgb` - Apple Generic RGB primaries
|
||||
* `wide-gamut-color-spin` - Wide Gamut Color Spin primaries
|
||||
* `ebu-3213-e` - EBU 3213-E primaries
|
||||
* `custom` - Custom primaries
|
||||
* `invalid` - Invalid primaries
|
||||
|
||||
* `transfer` string - The transfer function of the color space. Can be one of the following values:
|
||||
* `bt709` - BT709 transfer function
|
||||
* `bt709-apple` - BT709 Apple transfer function
|
||||
* `gamma18` - Gamma 1.8 transfer function
|
||||
* `gamma22` - Gamma 2.2 transfer function
|
||||
* `gamma24` - Gamma 2.4 transfer function
|
||||
* `gamma28` - Gamma 2.8 transfer function
|
||||
* `smpte170m` - SMPTE170M transfer function
|
||||
* `smpte240m` - SMPTE240M transfer function
|
||||
* `linear` - Linear transfer function
|
||||
* `log` - Log transfer function
|
||||
* `log-sqrt` - Log Square Root transfer function
|
||||
* `iec61966-2-4` - IEC61966-2-4 transfer function
|
||||
* `bt1361-ecg` - BT1361 ECG transfer function
|
||||
* `srgb` - sRGB transfer function
|
||||
* `bt2020-10` - BT2020-10 transfer function
|
||||
* `bt2020-12` - BT2020-12 transfer function
|
||||
* `pq` - PQ (Perceptual Quantizer) transfer function
|
||||
* `smptest428-1` - SMPTEST428-1 transfer function
|
||||
* `hlg` - HLG (Hybrid Log-Gamma) transfer function
|
||||
* `srgb-hdr` - sRGB HDR transfer function
|
||||
* `linear-hdr` - Linear HDR transfer function
|
||||
* `custom` - Custom transfer function
|
||||
* `custom-hdr` - Custom HDR transfer function
|
||||
* `scrgb-linear-80-nits` - scRGB Linear 80 nits transfer function
|
||||
* `invalid` - Invalid transfer function
|
||||
|
||||
* `matrix` string - The color matrix of the color space. Can be one of the following values:
|
||||
* `rgb` - RGB matrix
|
||||
* `bt709` - BT709 matrix
|
||||
* `fcc` - FCC matrix
|
||||
* `bt470bg` - BT470BG matrix
|
||||
* `smpte170m` - SMPTE170M matrix
|
||||
* `smpte240m` - SMPTE240M matrix
|
||||
* `ycocg` - YCoCg matrix
|
||||
* `bt2020-ncl` - BT2020 NCL matrix
|
||||
* `ydzdx` - YDzDx matrix
|
||||
* `gbr` - GBR matrix
|
||||
* `invalid` - Invalid matrix
|
||||
|
||||
* `range` string - The color range of the color space. Can be one of the following values:
|
||||
* `limited` - Limited color range (RGB values ranging from 16 to 235)
|
||||
* `full` - Full color range (RGB values from 0 to 255)
|
||||
* `derived` - Range defined by the transfer function and matrix
|
||||
* `invalid` - Invalid range
|
||||
|
||||
## Common `ColorSpace` definitions
|
||||
|
||||
### Standard Color Spaces
|
||||
|
||||
**sRGB**:
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt709',
|
||||
transfer: 'srgb',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
**Display P3**:
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'p3',
|
||||
transfer: 'srgb',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
**XYZ D50**:
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'xyz-d50',
|
||||
transfer: 'linear',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
### HDR Color Spaces
|
||||
|
||||
**Extended sRGB** (extends sRGB to all real values):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt709',
|
||||
transfer: 'srgb-hdr',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
**scRGB Linear** (linear transfer function for all real values):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt709',
|
||||
transfer: 'linear-hdr',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
**scRGB Linear 80 Nits** (with an SDR white level of 80 nits):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt709',
|
||||
transfer: 'scrgb-linear-80-nits',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
**HDR10** (BT.2020 primaries with PQ transfer function):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt2020',
|
||||
transfer: 'pq',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
**HLG** (BT.2020 primaries with HLG transfer function):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt2020',
|
||||
transfer: 'hlg',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
### Video Color Spaces
|
||||
|
||||
**Rec. 601** (SDTV):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'smpte170m',
|
||||
transfer: 'smpte170m',
|
||||
matrix: 'smpte170m',
|
||||
range: 'limited'
|
||||
}
|
||||
```
|
||||
|
||||
**Rec. 709** (HDTV):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt709',
|
||||
transfer: 'bt709',
|
||||
matrix: 'bt709',
|
||||
range: 'limited'
|
||||
}
|
||||
```
|
||||
|
||||
**JPEG** (typical color space for JPEG images):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt709',
|
||||
transfer: 'srgb',
|
||||
matrix: 'smpte170m',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
@@ -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.
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
* `type` string - The type of the event, can be `rawKeyDown`, `keyDown`, `keyUp` or `char`.
|
||||
* `keyCode` string - The character that will be sent
|
||||
as the keyboard event. Should only use the valid key codes in
|
||||
[Accelerator](../accelerator.md).
|
||||
as the keyboard event. Should only use valid [Accelerator](../../tutorial/keyboard-shortcuts.md#accelerators)
|
||||
key codes.
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
|
||||
* `textureInfo` Object - The shared texture info.
|
||||
* `widgetType` string - The widget type of the texture. Can be `popup` or `frame`.
|
||||
* `pixelFormat` string - The pixel format of the texture. Can be `rgba` or `bgra`.
|
||||
* `pixelFormat` string - The pixel format of the texture.
|
||||
* `rgba` - The texture format is 8-bit unorm RGBA.
|
||||
* `bgra` - The texture format is 8-bit unorm BGRA.
|
||||
* `rgbaf16` - The texture format is 16-bit float RGBA.
|
||||
* `codedSize` [Size](size.md) - The full dimensions of the video frame.
|
||||
* `visibleRect` [Rectangle](rectangle.md) - A subsection of [0, 0, codedSize.width(), codedSize.height()]. In OSR case, it is expected to have the full section area.
|
||||
* `colorSpace` [ColorSpace](color-space.md) - The color space of the video frame.
|
||||
* `visibleRect` [Rectangle](rectangle.md) - A subsection of [0, 0, codedSize.width, codedSize.height]. In OSR case, it is expected to have the full section area.
|
||||
* `contentRect` [Rectangle](rectangle.md) - The region of the video frame that capturer would like to populate. In OSR case, it is the same with `dirtyRect` that needs to be painted.
|
||||
* `timestamp` number - The time in microseconds since the capture start.
|
||||
* `metadata` Object - Extra metadata. See comments in src\media\base\video_frame_metadata.h for accurate details.
|
||||
@@ -12,13 +16,6 @@
|
||||
* `regionCaptureRect` [Rectangle](rectangle.md) (optional) - May reflect the frame's contents origin if region capture is used internally.
|
||||
* `sourceSize` [Rectangle](rectangle.md) (optional) - Full size of the source frame.
|
||||
* `frameCount` number (optional) - The increasing count of captured frame. May contain gaps if frames are dropped between two consecutively received frames.
|
||||
* `sharedTextureHandle` Buffer _Windows_ _macOS_ - The handle to the shared texture.
|
||||
* `planes` Object[] _Linux_ - Each plane's info of the shared texture.
|
||||
* `stride` number - The strides and offsets in bytes to be used when accessing the buffers via a memory mapping. One per plane per entry.
|
||||
* `offset` number - The strides and offsets in bytes to be used when accessing the buffers via a memory mapping. One per plane per entry.
|
||||
* `size` number - Size in bytes of the plane. This is necessary to map the buffers.
|
||||
* `fd` number - File descriptor for the underlying memory object (usually dmabuf).
|
||||
* `modifier` string _Linux_ - The modifier is retrieved from GBM library and passed to EGL driver.
|
||||
* `handle` [SharedTextureHandle](shared-texture-handle.md) - The shared texture handle data.
|
||||
* `release` Function - Release the resources. The `texture` cannot be directly passed to another process, users need to maintain texture lifecycles in
|
||||
main process, but it is safe to pass the `textureInfo` to another process. Only a limited number of textures can exist at the same time, so it's important
|
||||
that you call `texture.release()` as soon as you're done with the texture.
|
||||
main process, but it is safe to pass the `textureInfo` to another process. Only a limited number of textures can exist at the same time, so it's important that you call `texture.release()` as soon as you're done with the texture.
|
||||
|
||||
12
docs/api/structures/shared-texture-handle.md
Normal file
12
docs/api/structures/shared-texture-handle.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# SharedTextureHandle Object
|
||||
|
||||
* `ntHandle` Buffer (optional) _Windows_ - NT HANDLE holds the shared texture. Note that this NT HANDLE is local to current process.
|
||||
* `ioSurface` Buffer (optional) _macOS_ - IOSurfaceRef holds the shared texture. Note that this IOSurface is local to current process (not global).
|
||||
* `nativePixmap` Object (optional) _Linux_ - Structure contains planes of shared texture.
|
||||
* `planes` Object[] _Linux_ - Each plane's info of the shared texture.
|
||||
* `stride` number - The strides and offsets in bytes to be used when accessing the buffers via a memory mapping. One per plane per entry.
|
||||
* `offset` number - The strides and offsets in bytes to be used when accessing the buffers via a memory mapping. One per plane per entry.
|
||||
* `size` number - Size in bytes of the plane. This is necessary to map the buffers.
|
||||
* `fd` number - File descriptor for the underlying memory object (usually dmabuf).
|
||||
* `modifier` string _Linux_ - The modifier is retrieved from GBM library and passed to EGL driver.
|
||||
* `supportsZeroCopyWebGpuImport` boolean _Linux_ - Indicates whether supports zero copy import to WebGPU.
|
||||
@@ -1,17 +1,35 @@
|
||||
# USBDevice Object
|
||||
|
||||
* `configuration` Object (optional) - A [USBConfiguration](https://developer.mozilla.org/en-US/docs/Web/API/USBConfiguration) object containing information about the currently selected configuration of a USB device.
|
||||
* `configurationValue` Integer - the configuration value of this configuration.
|
||||
* `configurationName` string - the name provided by the device to describe this configuration.
|
||||
* `interfaces` Object[] - An array of [USBInterface](https://developer.mozilla.org/en-US/docs/Web/API/USBInterface) objects containing information about an interface provided by the USB device.
|
||||
* `interfaceNumber` Integer - the interface number of this interface.
|
||||
* `alternate` Object - the currently selected alternative configuration of this interface.
|
||||
* `alternateSetting` Integer - the alternate setting number of this interface.
|
||||
* `interfaceClass` Integer - the class of this interface. See [USB.org](https://www.usb.org/defined-class-codes) for class code descriptions.
|
||||
* `interfaceSubclass` Integer - the subclass of this interface.
|
||||
* `interfaceProtocol` Integer - the protocol supported by this interface.
|
||||
* `interfaceName` string (optional) - the name of the interface, if one is provided by the device.
|
||||
* `endpoints` Object[] - an array containing instances of the [USBEndpoint interface](https://developer.mozilla.org/en-US/docs/Web/API/USBEndpoint) describing each of the endpoints that are part of this interface.
|
||||
* `endpointNumber` Integer - this endpoint's "endpoint number" which is a value from 1 to 15.
|
||||
* `direction` string - the direction in which this endpoint transfers data - can be either 'in' or 'out'.
|
||||
* `type` string - the type of this endpoint - can be either 'bulk', 'interrupt', or 'isochronous'.
|
||||
* `packetSize` Integer - the size of the packets that data sent through this endpoint will be divided into.
|
||||
* `alternates` Object[] - an array containing instances of the [USBAlternateInterface](https://developer.mozilla.org/en-US/docs/Web/API/USBAlternateInterface) interface describing each of the alternative configurations possible for this interface.
|
||||
* `configurations` Object[] - An array of [USBConfiguration](https://developer.mozilla.org/en-US/docs/Web/API/USBConfiguration) interfaces for controlling a paired USB device.
|
||||
* `deviceClass` Integer - The device class for the communication interface supported by the device.
|
||||
* `deviceId` string - Unique identifier for the device.
|
||||
* `vendorId` Integer - The USB vendor ID.
|
||||
* `productId` Integer - The USB product ID.
|
||||
* `productName` string (optional) - Name of the device.
|
||||
* `serialNumber` string (optional) - The USB device serial number.
|
||||
* `manufacturerName` string (optional) - The manufacturer name of the device.
|
||||
* `usbVersionMajor` Integer - The USB protocol major version supported by the device
|
||||
* `usbVersionMinor` Integer - The USB protocol minor version supported by the device
|
||||
* `usbVersionSubminor` Integer - The USB protocol subminor version supported by the device
|
||||
* `deviceClass` Integer - The device class for the communication interface supported by the device
|
||||
* `deviceSubclass` Integer - The device subclass for the communication interface supported by the device
|
||||
* `deviceProtocol` Integer - The device protocol for the communication interface supported by the device
|
||||
* `deviceProtocol` Integer - The device protocol for the communication interface supported by the device.
|
||||
* `deviceSubclass` Integer - The device subclass for the communication interface supported by the device.
|
||||
* `deviceVersionMajor` Integer - The major version number of the device as defined by the device manufacturer.
|
||||
* `deviceVersionMinor` Integer - The minor version number of the device as defined by the device manufacturer.
|
||||
* `deviceVersionSubminor` Integer - The subminor version number of the device as defined by the device manufacturer.
|
||||
* `manufacturerName` string (optional) - The manufacturer name of the device.
|
||||
* `productId` Integer - The USB product ID.
|
||||
* `productName` string (optional) - Name of the device.
|
||||
* `serialNumber` string (optional) - The USB device serial number.
|
||||
* `usbVersionMajor` Integer - The USB protocol major version supported by the device.
|
||||
* `usbVersionMinor` Integer - The USB protocol minor version supported by the device.
|
||||
* `usbVersionSubminor` Integer - The USB protocol subminor version supported by the device.
|
||||
* `vendorId` Integer - The USB vendor ID.
|
||||
|
||||
@@ -87,6 +87,11 @@
|
||||
paint event. Defaults to `false`. See the
|
||||
[offscreen rendering tutorial](../../tutorial/offscreen-rendering.md) for
|
||||
more details.
|
||||
* `sharedTexturePixelFormat` string (optional) _Experimental_ - The requested output format of the shared texture. Defaults to `argb`.
|
||||
The name is originated from Chromium [`media::VideoPixelFormat`](https://source.chromium.org/chromium/chromium/src/+/main:media/base/video_types.h) enum suffix and only subset of them are supported.
|
||||
The actual output pixel format and color space of the texture should refer to [`OffscreenSharedTexture`](../structures/offscreen-shared-texture.md) object in the `paint` event.
|
||||
* `argb` - The requested output texture format is 8-bit unorm RGBA, with SRGB SDR color space.
|
||||
* `rgbaf16` - The requested output texture format is 16-bit float RGBA, with scRGB HDR color space.
|
||||
* `contextIsolation` boolean (optional) - Whether to run Electron APIs and
|
||||
the specified `preload` script in a separate JavaScript context. Defaults
|
||||
to `true`. The context that the `preload` script runs in will only have
|
||||
@@ -149,7 +154,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
|
||||
|
||||
@@ -8,7 +8,7 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
`Tray` is an [EventEmitter][event-emitter].
|
||||
|
||||
```js
|
||||
```js title='Creating a basic tray menu'
|
||||
const { app, Menu, Tray } = require('electron')
|
||||
|
||||
let tray = null
|
||||
@@ -25,6 +25,9 @@ app.whenReady().then(() => {
|
||||
})
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> See also: [A detailed guide about how to implement Tray menus](../tutorial/tray.md).
|
||||
|
||||
> [!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).
|
||||
@@ -76,7 +79,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`.
|
||||
|
||||
@@ -324,8 +335,56 @@ 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.
|
||||
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
|
||||
## Platform considerations
|
||||
|
||||
### Linux
|
||||
|
||||
* Tray icon uses [StatusNotifierItem](https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/)
|
||||
by default, when it is not available in user's desktop environment the
|
||||
`GtkStatusIcon` will be used instead.
|
||||
* The `click` event is emitted when the tray icon receives activation from
|
||||
user, however the StatusNotifierItem spec does not specify which action would
|
||||
cause an activation, for some environments it is left mouse click, but for
|
||||
some it might be double left mouse click.
|
||||
* In order for changes made to individual `MenuItem`s to take effect,
|
||||
you have to call `setContextMenu` again. For example:
|
||||
|
||||
```js
|
||||
const { app, Menu, Tray } = require('electron')
|
||||
|
||||
let appIcon = null
|
||||
app.whenReady().then(() => {
|
||||
appIcon = new Tray('/path/to/my/icon')
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
{ label: 'Item1', type: 'radio' },
|
||||
{ label: 'Item2', type: 'radio' }
|
||||
])
|
||||
|
||||
// Make a change to the context menu
|
||||
contextMenu.items[1].checked = false
|
||||
|
||||
// Call this again for Linux because we modified the context menu
|
||||
appIcon.setContextMenu(contextMenu)
|
||||
})
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
* Icons passed to the Tray constructor should be [Template Images](native-image.md#template-image-macos).
|
||||
* To make sure your icon isn't grainy on retina monitors, be sure your `@2x` image is 144dpi.
|
||||
* If you are bundling your application (e.g., with webpack for development), be sure that the file names are not being mangled or hashed. The filename needs to end in Template, and the `@2x` image needs to have the same filename as the standard image, or MacOS will not magically invert your image's colors or use the high density image.
|
||||
* 16x16 (72dpi) and 32x32@2x (144dpi) work well for most icons.
|
||||
|
||||
### Windows
|
||||
|
||||
* It is recommended to use `ICO` icons to get best visual effects.
|
||||
|
||||
@@ -486,16 +486,6 @@ Emitted when the web page becomes unresponsive.
|
||||
|
||||
Emitted when the unresponsive web page becomes responsive again.
|
||||
|
||||
#### Event: 'plugin-crashed'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `name` string
|
||||
* `version` string
|
||||
|
||||
Emitted when a plugin process has crashed.
|
||||
|
||||
#### Event: 'destroyed'
|
||||
|
||||
Emitted when `webContents` is destroyed.
|
||||
|
||||
@@ -66,6 +66,16 @@ These methods can be accessed from the `webFrameMain` module:
|
||||
Returns `WebFrameMain | undefined` - A frame with the given process and routing IDs,
|
||||
or `undefined` if there is no WebFrameMain associated with the given IDs.
|
||||
|
||||
### `webFrameMain.fromFrameToken(processId, frameToken)`
|
||||
|
||||
* `processId` Integer - An `Integer` representing the internal ID of the process which owns the frame.
|
||||
* `frameToken` string - A `string` token identifying the unique frame. Can also
|
||||
be retrieved in the renderer process via
|
||||
[`webFrame.frameToken`](web-frame.md#webframeframetoken-readonly).
|
||||
|
||||
Returns `WebFrameMain | null` - A frame with the given process and frame token,
|
||||
or `null` if there is no WebFrameMain associated with the given IDs.
|
||||
|
||||
## Class: WebFrameMain
|
||||
|
||||
Process: [Main](../glossary.md#main-process)<br />
|
||||
@@ -237,6 +247,11 @@ not used again.
|
||||
|
||||
A `string` representing the frame name.
|
||||
|
||||
#### `frame.frameToken` _Readonly_
|
||||
|
||||
A `string` which uniquely identifies the frame within its associated renderer
|
||||
process. This is equivalent to [`webFrame.frameToken`](web-frame.md#webframeframetoken-readonly).
|
||||
|
||||
#### `frame.osProcessId` _Readonly_
|
||||
|
||||
An `Integer` representing the operating system `pid` of the process which owns this frame.
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
|
||||
Process: [Renderer](../glossary.md#renderer-process)
|
||||
|
||||
> [!IMPORTANT]
|
||||
> If you want to call this API from a renderer process with context isolation enabled,
|
||||
> place the API call in your preload script and
|
||||
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
|
||||
> [`contextBridge`](context-bridge.md) API.
|
||||
|
||||
`webFrame` export of the Electron module is an instance of the `WebFrame`
|
||||
class representing the current frame. Sub-frames can be retrieved by
|
||||
certain properties and methods (e.g. `webFrame.firstChild`).
|
||||
@@ -67,7 +73,7 @@ Sets the maximum and minimum pinch-to-zoom level.
|
||||
> [!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
|
||||
> Menu. To disable shortcuts, manually [define the Menu](../tutorial/menus.md) and omit zoom roles
|
||||
> from the definition.
|
||||
|
||||
### `webFrame.setSpellCheckProvider(language, provider)`
|
||||
@@ -139,7 +145,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`.
|
||||
@@ -160,7 +166,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
|
||||
@@ -253,7 +259,7 @@ and intend to stay there).
|
||||
|
||||
* `selector` string - CSS selector for a frame element.
|
||||
|
||||
Returns `WebFrame` - The frame element in `webFrame's` document selected by
|
||||
Returns `WebFrame | null` - The frame element in `webFrame's` document selected by
|
||||
`selector`, `null` would be returned if `selector` does not select a frame or
|
||||
if the frame is not in the current renderer process.
|
||||
|
||||
@@ -261,18 +267,29 @@ if the frame is not in the current renderer process.
|
||||
|
||||
* `name` string
|
||||
|
||||
Returns `WebFrame` - A child of `webFrame` with the supplied `name`, `null`
|
||||
Returns `WebFrame | null` - A child of `webFrame` with the supplied `name`, `null`
|
||||
would be returned if there's no such frame or if the frame is not in the current
|
||||
renderer process.
|
||||
|
||||
### `webFrame.findFrameByRoutingId(routingId)`
|
||||
### `webFrame.findFrameByRoutingId(routingId)` _Deprecated_
|
||||
|
||||
* `routingId` Integer - An `Integer` representing the unique frame id in the
|
||||
current renderer process. Routing IDs can be retrieved from `WebFrame`
|
||||
instances (`webFrame.routingId`) and are also passed by frame
|
||||
specific `WebContents` navigation events (e.g. `did-frame-navigate`)
|
||||
|
||||
Returns `WebFrame` - that has the supplied `routingId`, `null` if not found.
|
||||
Returns `WebFrame | null` - that has the supplied `routingId`, `null` if not found.
|
||||
|
||||
**Deprecated:** Use the new `webFrame.findFrameByToken` API.
|
||||
|
||||
### `webFrame.findFrameByToken(frameToken)`
|
||||
|
||||
* `frameToken` string - A `string` representing the unique frame id in the
|
||||
current renderer process. Frame tokens can be retrieved from `WebFrame`
|
||||
instances (`webFrame.frameToken`) and can also be retrieved from
|
||||
`WebFrameMain` instances using `webFrameMain.frameToken`.
|
||||
|
||||
Returns `WebFrame | null` - that has the supplied `frameToken`, `null` if not found.
|
||||
|
||||
### `webFrame.isWordMisspelled(word)`
|
||||
|
||||
@@ -318,8 +335,16 @@ A `WebFrame | null` representing next sibling frame, the property would be `null
|
||||
`webFrame` is the last frame in its parent or if the next sibling is not in the
|
||||
current renderer process.
|
||||
|
||||
### `webFrame.routingId` _Readonly_
|
||||
### `webFrame.routingId` _Readonly_ _Deprecated_
|
||||
|
||||
An `Integer` representing the unique frame id in the current renderer process.
|
||||
Distinct WebFrame instances that refer to the same underlying frame will have
|
||||
the same `routingId`.
|
||||
|
||||
**Deprecated:** Use the new `webFrame.frameToken` API.
|
||||
|
||||
### `webFrame.frameToken` _Readonly_
|
||||
|
||||
A `string` representing the unique frame token in the current renderer process.
|
||||
Distinct WebFrame instances that refer to the same underlying frame will have
|
||||
the same `frameToken`.
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
|
||||
Process: [Renderer](../glossary.md#renderer-process)
|
||||
|
||||
> [!IMPORTANT]
|
||||
> If you want to call this API from a renderer process with context isolation enabled,
|
||||
> place the API call in your preload script and
|
||||
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
|
||||
> [`contextBridge`](context-bridge.md) API.
|
||||
|
||||
## Methods
|
||||
|
||||
The `webUtils` module has the following methods:
|
||||
@@ -17,11 +23,27 @@ Returns `string` - The file system path that this `File` object points to. In th
|
||||
This method superseded the previous augmentation to the `File` object with the `path` property. An example is included below.
|
||||
|
||||
```js @ts-nocheck
|
||||
// Before
|
||||
const oldPath = document.querySelector('input').files[0].path
|
||||
|
||||
// After
|
||||
const { webUtils } = require('electron')
|
||||
|
||||
const newPath = webUtils.getPathForFile(document.querySelector('input').files[0])
|
||||
// Before (renderer)
|
||||
const oldPath = document.querySelector('input[type=file]').files[0].path
|
||||
```
|
||||
|
||||
```js @ts-nocheck
|
||||
// After
|
||||
|
||||
// Renderer:
|
||||
|
||||
const file = document.querySelector('input[type=file]').files[0]
|
||||
electronApi.doSomethingWithFile(file)
|
||||
|
||||
// Preload script:
|
||||
|
||||
const { contextBridge, webUtils } = require('electron')
|
||||
|
||||
contextBridge.exposeInMainWorld('electronApi', {
|
||||
doSomethingWithFile (file) {
|
||||
const path = webUtils.getPathForFile(file)
|
||||
// Do something with the path, e.g., send it over IPC to the main process.
|
||||
// It's best not to expose the full file path to the web content if possible.
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
@@ -1002,15 +1002,6 @@ Returns:
|
||||
Fired when the renderer process unexpectedly disappears. This is normally
|
||||
because it was crashed or killed.
|
||||
|
||||
### Event: 'plugin-crashed'
|
||||
|
||||
Returns:
|
||||
|
||||
* `name` string
|
||||
* `version` string
|
||||
|
||||
Fired when a plugin process is crashed.
|
||||
|
||||
### Event: 'destroyed'
|
||||
|
||||
Fired when the WebContents is destroyed.
|
||||
|
||||
@@ -39,8 +39,8 @@ consider using `webContents.setWindowOpenHandler` to customize the
|
||||
BrowserWindow creation.
|
||||
|
||||
A subset of [`WebPreferences`](structures/web-preferences.md) can be set directly,
|
||||
unnested, from the features string: `zoomFactor`, `nodeIntegration`, `preload`,
|
||||
`javascript`, `contextIsolation`, and `webviewTag`.
|
||||
unnested, from the features string: `zoomFactor`, `nodeIntegration`, `javascript`,
|
||||
`contextIsolation`, and `webviewTag`.
|
||||
|
||||
For example:
|
||||
|
||||
|
||||
@@ -12,6 +12,68 @@ This document uses the following convention to categorize breaking changes:
|
||||
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
|
||||
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
|
||||
|
||||
## Planned Breaking API Changes (39.0)
|
||||
|
||||
### Deprecated: `--host-rules` command line switch
|
||||
|
||||
Chromium is deprecating the `--host-rules` switch.
|
||||
|
||||
You should use `--host-resolver-rules` instead.
|
||||
|
||||
### Behavior Changed: window.open popups are always resizable
|
||||
|
||||
Per current [WHATWG spec](https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-open-dev), the `window.open` API will now always create a resizable popup window.
|
||||
|
||||
To restore previous behavior:
|
||||
|
||||
```js
|
||||
webContents.setWindowOpenHandler((details) => {
|
||||
return {
|
||||
action: 'allow',
|
||||
overrideBrowserWindowOptions: {
|
||||
resizable: details.features.includes('resizable=yes')
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Behavior Changed: shared texture OSR `paint` event data structure
|
||||
|
||||
When using shared texture offscreen rendering feature, the `paint` event now emits a more structured object.
|
||||
It moves the `sharedTextureHandle`, `planes`, `modifier` into a unified `handle` property.
|
||||
See [here](https://www.electronjs.org/docs/latest/api/structures/offscreen-shared-texture) for more details.
|
||||
|
||||
## Planned Breaking API Changes (38.0)
|
||||
|
||||
### Removed: `ELECTRON_OZONE_PLATFORM_HINT` environment variable
|
||||
|
||||
The default value of the `--ozone-plaftform` flag [changed to `auto`](https://chromium-review.googlesource.com/c/chromium/src/+/6775426).
|
||||
|
||||
You should use the `XDG_SESSION_TYPE=wayland` environment variable instead to use Wayland.
|
||||
|
||||
### Removed: macOS 11 support
|
||||
|
||||
macOS 11 (Big Sur) is no longer supported by [Chromium](https://chromium-review.googlesource.com/c/chromium/src/+/6594615).
|
||||
|
||||
Older versions of Electron will continue to run on Big Sur, but macOS 12 (Monterey)
|
||||
or later will be required to run Electron v38.0.0 and higher.
|
||||
|
||||
### Removed: `plugin-crashed` event
|
||||
|
||||
The `plugin-crashed` event has been removed from `webContents`.
|
||||
|
||||
### Deprecated: `webFrame.routingId` property
|
||||
|
||||
The `routingId` property will be removed from `webFrame` objects.
|
||||
|
||||
You should use `webFrame.frameToken` instead.
|
||||
|
||||
### Deprecated: `webFrame.findFrameByRoutingId(routingId)`
|
||||
|
||||
The `webFrame.findFrameByRoutingId(routingId)` function will be removed.
|
||||
|
||||
You should use `webFrame.findFrameByToken(frameToken)` instead.
|
||||
|
||||
## Planned Breaking API Changes (37.0)
|
||||
|
||||
### Utility Process unhandled rejection behavior change
|
||||
@@ -27,6 +89,16 @@ process.on('unhandledRejection', () => {
|
||||
})
|
||||
```
|
||||
|
||||
### Behavior Changed: `process.exit()` kills utility process synchronously
|
||||
|
||||
Calling `process.exit()` in a utility process will now kill the utility process synchronously.
|
||||
This brings the behavior of `process.exit()` in line with Node.js behavior.
|
||||
|
||||
Please refer to the
|
||||
[Node.js docs](https://nodejs.org/docs/latest-v22.x/api/process.html#processexitcode) and
|
||||
[PR #45690](https://github.com/electron/electron/pull/45690) to understand the potential
|
||||
implications of that, e.g., when calling `console.log()` before `process.exit()`.
|
||||
|
||||
### Behavior Changed: WebUSB and WebSerial Blocklist Support
|
||||
|
||||
[WebUSB](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API) and [Web Serial](https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API) now support the [WebUSB Blocklist](https://wicg.github.io/webusb/#blocklist) and [Web Serial Blocklist](https://wicg.github.io/serial/#blocklist) used by Chromium and outlined in their respective specifications.
|
||||
|
||||
@@ -191,12 +191,6 @@ $ ./out/Testing/electron
|
||||
|
||||
### Packaging
|
||||
|
||||
On linux, first strip the debugging and symbol information:
|
||||
|
||||
```sh
|
||||
$ electron/script/strip-binaries.py -d out/Release
|
||||
```
|
||||
|
||||
To package the electron build as a distributable zip file:
|
||||
|
||||
```sh
|
||||
|
||||
@@ -7,11 +7,8 @@ Follow the guidelines below for building **Electron itself** on Linux, for the p
|
||||
## Prerequisites
|
||||
|
||||
* At least 25GB disk space and 8GB RAM.
|
||||
* Python >= 3.7.
|
||||
* Node.js. There are various ways to install Node. You can download
|
||||
source code from [nodejs.org](https://nodejs.org) and compile it.
|
||||
Doing so permits installing Node on your own home directory as a standard user.
|
||||
Or try repositories such as [NodeSource](https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories).
|
||||
* Python >= 3.9.
|
||||
* [Node.js](https://nodejs.org/download/) >= 22.12.0
|
||||
* [clang](https://clang.llvm.org/get_started.html) 3.4 or later.
|
||||
* Development headers of GTK 3 and libnotify.
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ Follow the guidelines below for building **Electron itself** on macOS, for the p
|
||||
* [Xcode](https://developer.apple.com/technologies/tools/). The exact version
|
||||
needed depends on what branch you are building, but the latest version of
|
||||
Xcode is generally a good bet for building `main`.
|
||||
* [node.js](https://nodejs.org) (external)
|
||||
* Python >= 3.7
|
||||
* Python >= 3.9
|
||||
* [Node.js](https://nodejs.org/download/) >= 22.12.0
|
||||
|
||||
### Arm64-specific prerequisites
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Follow the guidelines below for building **Electron itself** on Windows, for the
|
||||
set a few environment variables to point the toolchains to your installation path.
|
||||
* `vs2022_install = DRIVE:\path\to\Microsoft Visual Studio\2022\Community`, replacing `2022` and `Community` with your installed versions and replacing `DRIVE:` with the drive that Visual Studio is on. Often, this will be `C:`.
|
||||
* `WINDOWSSDKDIR = DRIVE:\path\to\Windows Kits\10`, replacing `DRIVE:` with the drive that Windows Kits is on. Often, this will be `C:`.
|
||||
* [Node.js](https://nodejs.org/download/)
|
||||
* [Node.js](https://nodejs.org/download/) >= 22.12.0
|
||||
* [Git](https://git-scm.com)
|
||||
* Debugging Tools for Windows of Windows SDK 10.0.15063.468 if you plan on
|
||||
creating a full distribution since `symstore.exe` is used for creating a symbol
|
||||
|
||||
@@ -60,12 +60,12 @@ namespace electron {
|
||||
|
||||
namespace api {
|
||||
|
||||
class ApiName : public gin::Wrappable<ApiName> {
|
||||
class ApiName : public gin::DeprecatedWrappable<ApiName> {
|
||||
public:
|
||||
static gin::Handle<ApiName> Create(v8::Isolate* isolate);
|
||||
|
||||
// gin::Wrappable
|
||||
static gin::WrapperInfo kWrapperInfo;
|
||||
static gin::DeprecatedWrapperInfo kWrapperInfo;
|
||||
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) override;
|
||||
const char* GetTypeName() override;
|
||||
@@ -90,7 +90,7 @@ namespace electron {
|
||||
|
||||
namespace api {
|
||||
|
||||
gin::WrapperInfo ApiName::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
gin::DeprecatedWrapperInfo ApiName::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
gin::ObjectTemplateBuilder ApiName::GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) {
|
||||
@@ -117,7 +117,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
||||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("apiName", electron::api::ApiName::Create(isolate));
|
||||
}
|
||||
|
||||
25
docs/faq.md
25
docs/faq.md
@@ -12,19 +12,28 @@ network problems. The best resolution is to try switching networks, or
|
||||
wait a bit and try installing again.
|
||||
|
||||
You can also attempt to download Electron directly from
|
||||
[electron/electron/releases](https://github.com/electron/electron/releases)
|
||||
[GitHub Releases](https://github.com/electron/electron/releases)
|
||||
if installing via `npm` is failing.
|
||||
|
||||
## When will Electron upgrade to latest Chrome?
|
||||
If you need to install Electron through a custom mirror or proxy, see
|
||||
the [Advanced Installation](./tutorial/installation.md) documentation for more details.
|
||||
|
||||
The Chrome version of Electron is usually bumped within one or two weeks after
|
||||
a new stable Chrome version gets released. This estimate is not guaranteed and
|
||||
depends on the amount of work involved with upgrading.
|
||||
## How are Electron binaries downloaded?
|
||||
|
||||
Only the stable channel of Chrome is used. If an important fix is in beta or dev
|
||||
channel, we will back-port it.
|
||||
When you run `npm install electron`, the Electron binary for the corresponding version is downloaded
|
||||
into your project's `node_modules` folder via npm's `postinstall` lifecycle script.
|
||||
|
||||
For more information, please see the [security introduction](tutorial/security.md).
|
||||
This logic is handled by the [`@electron/get`](https://github.com/electron/get) utility package
|
||||
under the hood.
|
||||
|
||||
## When will Electron upgrade to latest Chromium?
|
||||
|
||||
Every new major version of Electron releases with a Chromium major version upgrade. By releasing every
|
||||
8 weeks, Electron is able to pull in every other major Chromium release on the very same day that it
|
||||
releases upstream. Security fixes will be backported to stable release channels ahead of time.
|
||||
|
||||
See the [Electron Releases](./tutorial/electron-timelines.md) documentation for more details or
|
||||
[releases.electronjs.org](https://releases.electronjs.org) to see our Release Status dashboard.
|
||||
|
||||
## When will Electron upgrade to latest Node.js?
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>Hit Alt+Ctrl+I on Windows or Opt+Cmd+I on Mac to see a message printed to the console.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,28 +0,0 @@
|
||||
const { app, BrowserWindow, globalShortcut } = require('electron/main')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
globalShortcut.register('Alt+CommandOrControl+I', () => {
|
||||
console.log('Electron loves global shortcuts!')
|
||||
})
|
||||
}).then(createWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user