Compare commits

..

49 Commits

Author SHA1 Message Date
Samuel Attard
100cf61dc8 fix some spec runner stuff 2024-10-04 00:17:57 -07:00
Samuel Attard
044780480b correct windows sharding 2024-10-03 22:24:21 -07:00
Samuel Attard
26f5df4754 build: set up nodejs 2024-10-03 22:22:54 -07:00
Samuel Attard
1262b2a126 maybe bash 2024-10-03 19:17:38 -07:00
Samuel Attard
55c150c39b 32 bit on 32 bit 2024-10-03 16:20:33 -07:00
Samuel Attard
e082304e3c build: windows tar is ass 2024-10-03 14:53:11 -07:00
Samuel Attard
349d25b04d build: get arm64 windows closer to working 2024-10-03 10:30:48 -07:00
Samuel Attard
dc1dc699de build: no patch depot_tools for tests 2024-10-03 10:24:54 -07:00
Samuel Attard
9d4e5ee4e7 build: ia32 zip manifest 2024-10-03 10:04:43 -07:00
Samuel Attard
a843c9f951 build: configure git global on win 2024-10-03 01:51:29 -07:00
Samuel Attard
c37acb7562 build: keep action around for post step 2024-10-03 01:50:44 -07:00
Samuel Attard
5e43a7e53a Merge remote-tracking branch 'origin/main' into windows-runner 2024-10-03 01:21:26 -07:00
Samuel Attard
fcb6dc81d8 maybe not needed 2024-10-03 00:46:13 -07:00
Samuel Attard
a5ee213d8e clean up 2024-10-03 00:45:43 -07:00
Samuel Attard
29d1dadf8e build: enable x86 and arm64 windows builds too 2024-10-03 00:43:21 -07:00
Samuel Attard
7ab4a36ccb build: use powershell to add mksnapshot_args 2024-10-02 23:36:34 -07:00
Samuel Attard
2a7e9b45a6 fix toolchain on windows cross check 2024-10-02 22:40:37 -07:00
Samuel Attard
a7103a4042 no log 2024-10-02 22:37:13 -07:00
Samuel Attard
c415741405 e d 2024-10-02 22:36:19 -07:00
Samuel Attard
cda341b080 build: e d 2024-10-02 21:35:27 -07:00
Samuel Attard
da411de1c8 cry ? 2024-10-02 21:26:02 -07:00
Samuel Attard
38bdb32040 use container... 2024-10-02 21:20:01 -07:00
Samuel Attard
f40456a426 build: run gn-check for windows on linux hosts for speed 2024-10-02 21:09:10 -07:00
Samuel Attard
868b800fe9 build: yolo some stuff 2024-10-02 20:26:56 -07:00
Samuel Attard
247182e952 no double checkout 2024-10-02 19:09:48 -07:00
Samuel Attard
2e090ceb6a ... 2024-10-02 18:08:11 -07:00
Samuel Attard
a42d0a6fb2 sigh 2024-10-02 08:25:59 -07:00
Samuel Attard
2abbc4b28c idk 2024-10-02 00:00:30 -07:00
Samuel Attard
9075e2b20d no check 2024-10-01 21:34:17 -07:00
Samuel Attard
d2fca2bbf7 sup 2024-10-01 21:33:36 -07:00
Samuel Attard
960541743b build: checkout on windows host 2024-10-01 20:19:56 -07:00
Samuel Attard
ca071c17e6 build: platform strings are hard 2024-09-27 16:16:54 -07:00
Samuel Attard
3c85204883 build: force lf endings for lock and DEPS 2024-09-27 09:41:01 -07:00
Samuel Attard
6db7a0f0af build: depshash logging 2024-09-27 09:25:44 -07:00
Samuel Attard
f7ac1bf039 build: past sam was a silly goose 2024-09-27 09:14:37 -07:00
Samuel Attard
51497a9452 build: output depshash for debugging 2024-09-27 09:11:26 -07:00
Samuel Attard
e5b62f4c97 build: sync gclient vars to build windows job 2024-09-27 09:04:21 -07:00
Samuel Attard
395526f45a build: use build-tools gclient 2024-09-27 08:43:13 -07:00
Samuel Attard
872d80cfc2 build: restore cache on windows 2024-09-27 08:42:24 -07:00
Samuel Attard
6859b2d5ea just pain 2024-09-27 08:35:07 -07:00
Samuel Attard
288441ec9e build: force windows cipd init and python3 existence 2024-09-27 08:23:25 -07:00
Samuel Attard
3addfb1943 build: use sha1sum 2024-09-27 07:52:58 -07:00
Samuel Attard
5c40f3595f build: configure windows correctly 2024-09-27 07:30:04 -07:00
Samuel Attard
cd5eb75260 build: bash as default 2024-09-27 07:21:32 -07:00
Samuel Attard
a1799f33cb build: configure git for windows build tools 2024-09-27 07:11:37 -07:00
Samuel Attard
ed0cc27f81 build: use bash as default shell always 2024-09-27 01:10:07 -07:00
Samuel Attard
96c7e69c73 build: take win/cross changes 2024-09-26 14:23:52 -07:00
Samuel Attard
5f0b657f86 build: try build windows on windows? 2024-09-26 14:04:02 -07:00
Samuel Attard
f86111130b build: test windows runner 2024-09-26 13:37:13 -07:00
807 changed files with 15976 additions and 19575 deletions

View File

@@ -2,7 +2,7 @@ version: '3'
services: services:
buildtools: buildtools:
image: ghcr.io/electron/devcontainer:77262e58c37631ab082482f42c33cdf68c6c394b image: ghcr.io/electron/devcontainer:9a43c14f5c19be0359843299f79e736521373adc
volumes: volumes:
- ..:/workspaces/gclient/src/electron:cached - ..:/workspaces/gclient/src/electron:cached

View File

@@ -1,4 +1,5 @@
# These env vars are only necessary for creating Electron releases. # These env vars are only necessary for creating Electron releases.
# See docs/development/releasing.md # See docs/development/releasing.md
APPVEYOR_CLOUD_TOKEN=
ELECTRON_GITHUB_TOKEN= ELECTRON_GITHUB_TOKEN=

1
.gitattributes vendored
View File

@@ -3,7 +3,6 @@
*.patch text eol=lf *.patch text eol=lf
DEPS text eol=lf DEPS text eol=lf
yarn.lock text eol=lf yarn.lock text eol=lf
script/zip_manifests/*.manifest text eol=lf
patches/**/.patches merge=union patches/**/.patches merge=union
# Source code and markdown files should always use LF as line ending. # Source code and markdown files should always use LF as line ending.

3
.github/CODEOWNERS vendored
View File

@@ -11,6 +11,9 @@ DEPS @electron/wg-upgrades
/docs/breaking-changes.md @electron/wg-releases /docs/breaking-changes.md @electron/wg-releases
/npm/ @electron/wg-releases /npm/ @electron/wg-releases
/script/release @electron/wg-releases /script/release @electron/wg-releases
appveyor.yml @electron/wg-releases
appveyor-bake.yml @electron/wg-releases
appveyor-woa.yml @electron/wg-releases
# Security WG # Security WG
/lib/browser/devtools.ts @electron/wg-security /lib/browser/devtools.ts @electron/wg-security

View File

@@ -1,6 +1,6 @@
name: Bug Report name: Bug Report
description: Report a bug in Electron description: Report an Electron bug
type: 'bug' title: "[Bug]: "
labels: "bug :beetle:" labels: "bug :beetle:"
body: body:
- type: checkboxes - type: checkboxes

View File

@@ -1,4 +1,3 @@
blank_issues_enabled: false
contact_links: contact_links:
- name: Discord Chat - name: Discord Chat
url: https://discord.gg/APGC3k5yaH url: https://discord.gg/APGC3k5yaH

View File

@@ -1,6 +1,6 @@
name: Feature Request name: Feature Request
description: Suggest an idea for Electron description: Suggest an idea for Electron
type: 'enhancement' title: "[Feature Request]: "
labels: "enhancement :sparkles:" labels: "enhancement :sparkles:"
body: body:
- type: checkboxes - type: checkboxes

View File

@@ -1,14 +0,0 @@
name: Maintainer Issue (not for public use)
description: Only to be created by Electron maintainers
body:
- type: checkboxes
attributes:
label: Confirmation
options:
- label: I am a [maintainer](https://github.com/orgs/electron/people) of the Electron project. (If not, please create a [different issue type](https://github.com/electron/electron/issues/new/).)
required: true
- type: textarea
attributes:
label: Description
validations:
required: true

View File

@@ -5,10 +5,10 @@ inputs:
description: 'Target arch' description: 'Target arch'
required: true required: true
target-platform: target-platform:
description: 'Target platform, should be linux, win, macos' description: 'Target platform'
required: true required: true
artifact-platform: artifact-platform:
description: 'Artifact platform, should be linux, win, darwin or mas' description: 'Artifact platform, should be linux, windows, darwin or mas'
required: true required: true
step-suffix: step-suffix:
description: 'Suffix for build steps' description: 'Suffix for build steps'
@@ -63,26 +63,30 @@ runs:
run: | run: |
cd src cd src
electron/script/copy-debug-symbols.py --target-cpu="${{ inputs.target-arch }}" --out-dir=out/Default/debug --compress 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/strip-binaries.py --target-cpu="${{ inputs.target-arch }}"
electron/script/add-debug-link.py --target-cpu="${{ inputs.target-arch }}" --debug-dir=out/Default/debug electron/script/add-debug-link.py --target-cpu="${{ inputs.target-arch }}" --debug-dir=out/Default/debug
- name: Build Electron dist.zip ${{ inputs.step-suffix }} - name: Build Electron dist.zip ${{ inputs.step-suffix }}
shell: bash shell: bash
run: | run: |
cd src cd src
e build --target electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES -d explain e build --target electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES
if [ "${{ inputs.is-asan }}" != "true" ]; then if [ "${{ inputs.is-asan }}" != "true" ]; then
target_os=${{ inputs.target-platform == 'macos' && 'mac' || inputs.target-platform }} target_os=${{ inputs.target-platform == 'linux' && 'linux' || (inputs.target-platform == 'windows' && 'win' || 'mac') }}
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
target_os="${target_os}_mas" target_os="${target_os}_mas"
fi fi
electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.${{ inputs.target-arch }}.manifest target_arch=${{ inputs.target-arch }}
if [ "${{ inputs.target-arch }}" = "x86" ]; then
target_arch="ia32"
fi
electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.$target_arch.manifest
fi fi
- name: Build Mksnapshot ${{ inputs.step-suffix }} - name: Build Mksnapshot ${{ inputs.step-suffix }}
shell: bash shell: bash
run: | run: |
cd src cd src
e build --target electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES e build --target electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
ELECTRON_DEPOT_TOOLS_DISABLE_LOG=1 e d gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args e d gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
# Remove unused args from mksnapshot_args # Remove unused args from mksnapshot_args
SEDOPTION="-i" SEDOPTION="-i"
if [ "`uname`" = "Darwin" ]; then if [ "`uname`" = "Darwin" ]; then
@@ -105,12 +109,10 @@ runs:
fi fi
e build --target electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES e build --target electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
if [ "${{ inputs.target-platform }}" = "win" ]; then if [ "${{ inputs.target-platform }}" = "windows" ]; then
cd out/Default cd out/Default
powershell Compress-Archive -update mksnapshot_args mksnapshot.zip powershell Compress-Archive -update mksnapshot_args mksnapshot.zip
powershell mkdir mktmp\\gen\\v8 powershell Compress-Archive -update gen/v8/embedded.S mksnapshot.zip
powershell Copy-Item gen\\v8\\embedded.S mktmp\\gen\\v8
powershell Compress-Archive -update -Path mktmp\\gen mksnapshot.zip
else else
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S) (cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
fi fi
@@ -145,25 +147,6 @@ runs:
run: | run: |
cd src cd src
e build --target electron:node_headers e build --target electron:node_headers
- name: Create installed_software.json ${{ inputs.step-suffix }}
shell: powershell
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
cd src
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- name: Profile Windows Toolchain ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
cd src
python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- name: Add msdia140.dll to Path ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
# Needed for msdia140.dll on 64-bit windows
cd src
export PATH="$PATH:$(pwd)/third_party/llvm-build/Release+Asserts/bin"
- name: Generate & Zip Symbols ${{ inputs.step-suffix }} - name: Generate & Zip Symbols ${{ inputs.step-suffix }}
shell: bash shell: bash
run: | run: |
@@ -186,19 +169,21 @@ runs:
run: | run: |
cd src cd src
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS" 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 autoninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES
- name: Generate Hunspell Dictionaries ${{ inputs.step-suffix }} - name: Generate Hunspell Dictionaries ${{ inputs.step-suffix }}
shell: bash shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }} if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
run: | run: |
e build --target electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES cd src
autoninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
- name: Generate Libcxx ${{ inputs.step-suffix }} - name: Generate Libcxx ${{ inputs.step-suffix }}
shell: bash shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }} if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
run: | run: |
e build --target electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES cd src
e build --target electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES autoninja -C out/Default electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES autoninja -C out/Default electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
autoninja -C out/Default electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
- name: Generate TypeScript Definitions ${{ inputs.step-suffix }} - name: Generate TypeScript Definitions ${{ inputs.step-suffix }}
if: ${{ inputs.is-release == 'true' }} if: ${{ inputs.is-release == 'true' }}
shell: bash shell: bash

View File

@@ -17,7 +17,10 @@ runs:
run: | run: |
echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies shell: bash
run: |
cd src/electron
node script/yarn install --frozen-lockfile
- name: Install Build Tools - name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools uses: ./src/electron/.github/actions/install-build-tools
- name: Get Depot Tools - name: Get Depot Tools
@@ -26,6 +29,11 @@ runs:
if [[ ! -d depot_tools ]]; then if [[ ! -d depot_tools ]]; then
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
# Remove swift-format dep from cipd on macOS until we send a patch upstream.
cd depot_tools
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
# Ensure depot_tools does not update. # Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools test -d depot_tools && cd depot_tools
touch .disable_auto_update touch .disable_auto_update
@@ -36,8 +44,8 @@ runs:
- name: Generate DEPS Hash - name: Generate DEPS Hash
shell: bash shell: bash
run: | run: |
node src/electron/script/generate-deps-hash.js node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash && cat src/electron/.depshash-target
echo "DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)" >> $GITHUB_ENV echo "DEPSHASH=v1-src-cache-$(sha1sum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
- name: Generate SAS Key - name: Generate SAS Key
if: ${{ inputs.generate-sas-token == 'true' }} if: ${{ inputs.generate-sas-token == 'true' }}
shell: bash shell: bash
@@ -45,7 +53,7 @@ runs:
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$DEPSHASH.tar" > sas-token curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$DEPSHASH.tar" > sas-token
- name: Save SAS Key - name: Save SAS Key
if: ${{ inputs.generate-sas-token == 'true' }} if: ${{ inputs.generate-sas-token == 'true' }}
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 uses: actions/cache/save@v4
with: with:
path: | path: |
sas-token sas-token
@@ -61,7 +69,7 @@ runs:
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
echo "Using cache key: $DEPSHASH" echo "Using cache key: $DEPSHASH"
echo "Checking for cache in: $cache_path" echo "Checking for cache in: $cache_path"
if [ ! -f "$cache_path" ] || [ `du $cache_path | cut -f1` = "0" ]; then if [ ! -f "$cache_path" ]; then
echo "cache_exists=false" >> $GITHUB_OUTPUT echo "cache_exists=false" >> $GITHUB_OUTPUT
echo "Cache Does Not Exist for $DEPSHASH" echo "Cache Does Not Exist for $DEPSHASH"
else else
@@ -69,19 +77,6 @@ runs:
echo "Cache Already Exists for $DEPSHASH, Skipping.." echo "Cache Already Exists for $DEPSHASH, Skipping.."
fi fi
fi fi
- name: Check cross instance cache disk space
if: steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true'
shell: bash
run: |
# if there is less than 35 GB free space then creating the cache might fail so exit early
freespace=`df -m /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
freespace_human=`df -h /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
if [ $freespace -le 35000 ]; then
echo "The cross mount cache has $freespace_human free space which is not enough - exiting"
exit 1
else
echo "The cross mount cache has $freespace_human free space - continuing"
fi
- name: Gclient Sync - name: Gclient Sync
if: steps.check-cache.outputs.cache_exists == 'false' if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash shell: bash

View File

@@ -11,10 +11,10 @@ runs:
git config --global core.autocrlf false git config --global core.autocrlf false
git config --global branch.autosetuprebase always git config --global branch.autosetuprebase always
fi fi
export BUILD_TOOLS_SHA=8246e57791b0af4ae5975eb96f09855f9269b1cd export BUILD_TOOLS_SHA=33dc5186556bfbf7b0121a00cdd89ed3802e47da
npm i -g @electron/build-tools npm i -g @electron/build-tools
e auto-update disable e auto-update disable
if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then
e d cipd.bat --version e d cipd.bat --version
cp "C:\Python311\python.exe" "C:\Python311\python3.exe" cp "C:\Python37\python.exe" "C:\Python37\python3.exe"
fi fi

View File

@@ -1,21 +0,0 @@
name: 'Install Dependencies'
description: 'Installs yarn depdencies using cache when available'
runs:
using: "composite"
steps:
- name: Get yarn cache directory path
shell: bash
id: yarn-cache-dir-path
run: echo "dir=$(node src/electron/script/yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('src/electron/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
shell: bash
run: |
cd src/electron
node script/yarn install --frozen-lockfile --prefer-offline

View File

@@ -17,11 +17,6 @@ runs:
fi fi
echo "Persisted cache is $(du -sh $cache_path | cut -f1)" echo "Persisted cache is $(du -sh $cache_path | cut -f1)"
if [ `du $cache_path | cut -f1` = "0" ]; then
echo "Cache is empty - exiting"
exit 1
fi
mkdir temp-cache mkdir temp-cache
tar -xf $cache_path -C temp-cache tar -xf $cache_path -C temp-cache
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)" echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"

View File

@@ -5,14 +5,14 @@ runs:
steps: steps:
- name: Obtain SAS Key - name: Obtain SAS Key
continue-on-error: true continue-on-error: true
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with: with:
path: | path: |
sas-token sas-token
key: sas-key-${{ github.run_number }}-1 key: sas-key-${{ github.run_number }}-1
- name: Obtain SAS Key - name: Obtain SAS Key
continue-on-error: true continue-on-error: true
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with: with:
path: | path: |
sas-token sas-token
@@ -44,11 +44,6 @@ runs:
shell: bash shell: bash
run: | run: |
echo "Downloaded cache is $(du -sh $DEPSHASH.tar | cut -f1)" echo "Downloaded cache is $(du -sh $DEPSHASH.tar | cut -f1)"
if [ `du $DEPSHASH.tar | cut -f1` = "0" ]; then
echo "Cache is empty - exiting"
exit 1
fi
mkdir temp-cache mkdir temp-cache
tar -xf $DEPSHASH.tar -C temp-cache tar -xf $DEPSHASH.tar -C temp-cache
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)" echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"

View File

@@ -9,13 +9,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.0.2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup Node.js/npm
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
with:
node-version: 20.11.x
- name: Setting Up Dig Site - name: Setting Up Dig Site
run: | run: |
echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}" echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}"
@@ -41,7 +37,7 @@ jobs:
sha-file: .dig-old sha-file: .dig-old
filename: electron.old.d.ts filename: electron.old.d.ts
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0 uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4.4.0
with: with:
name: artifacts name: artifacts
path: electron/artifacts path: electron/artifacts

View File

@@ -23,13 +23,11 @@ jobs:
steps: steps:
- name: Determine Major Version - name: Determine Major Version
id: check-major-version id: check-major-version
env:
BRANCH_NAME: ${{ github.event.inputs.branch-name || github.event.ref }}
run: | run: |
if [[ "$BRANCH_NAME" =~ ^([0-9]+)-x-y$ ]]; then if [[ ${{ github.event.inputs.branch-name || github.event.ref }} =~ ^([0-9]+)-x-y$ ]]; then
echo "MAJOR=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT" echo "MAJOR=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
else else
echo "Not a release branch: $BRANCH_NAME" echo "Not a release branch: ${{ github.event.inputs.branch-name || github.event.ref }}"
fi fi
- name: New Release Branch Tasks - name: New Release Branch Tasks
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.check-major-version.outputs.MAJOR }}
@@ -94,7 +92,7 @@ jobs:
})) }))
- name: Create Release Project Board - name: Create Release Project Board
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.check-major-version.outputs.MAJOR }}
uses: dsanders11/project-actions/copy-project@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/copy-project@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
id: create-release-board id: create-release-board
with: with:
drafts: true drafts: true
@@ -114,14 +112,14 @@ jobs:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
- name: Find Previous Release Project Board - name: Find Previous Release Project Board
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.check-major-version.outputs.MAJOR }}
uses: dsanders11/project-actions/find-project@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/find-project@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
id: find-prev-release-board id: find-prev-release-board
with: with:
title: ${{ steps.generate-project-metadata.outputs.prev-prev-major }}-x-y title: ${{ steps.generate-project-metadata.outputs.prev-prev-major }}-x-y
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
- name: Close Previous Release Project Board - name: Close Previous Release Project Board
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.check-major-version.outputs.MAJOR }}
uses: dsanders11/project-actions/close-project@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/close-project@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
project-number: ${{ steps.find-prev-release-board.outputs.number }} project-number: ${{ steps.find-prev-release-board.outputs.number }}
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}

View File

@@ -6,17 +6,17 @@ on:
build-image-sha: build-image-sha:
type: string type: string
description: 'SHA for electron/build image' description: 'SHA for electron/build image'
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1' default: 'cf814a4d2501e8e843caea071a6b70a48e78b855'
required: true required: true
skip-macos: skip-macos:
type: boolean type: boolean
description: 'Skip macOS builds' description: 'Skip macOS builds'
default: false default: true
required: false required: false
skip-linux: skip-linux:
type: boolean type: boolean
description: 'Skip Linux builds' description: 'Skip Linux builds'
default: false default: true
required: false required: false
skip-windows: skip-windows:
type: boolean type: boolean
@@ -26,7 +26,7 @@ on:
skip-lint: skip-lint:
type: boolean type: boolean
description: 'Skip lint check' description: 'Skip lint check'
default: false default: true
required: false required: false
push: push:
branches: branches:
@@ -49,9 +49,7 @@ jobs:
build-image-sha: ${{ steps.set-output.outputs.build-image-sha }} build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
docs-only: ${{ steps.set-output.outputs.docs-only }} docs-only: ${{ steps.set-output.outputs.docs-only }}
steps: steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter id: filter
with: with:
@@ -64,7 +62,7 @@ jobs:
id: set-output id: set-output
run: | run: |
if [ -z "${{ inputs.build-image-sha }}" ]; then if [ -z "${{ inputs.build-image-sha }}" ]; then
echo "build-image-sha=bc2f48b2415a670de18d13605b1cf0eb5fdbaae1" >> "$GITHUB_OUTPUT" echo "build-image-sha=77262e58c37631ab082482f42c33cdf68c6c394b" >> "$GITHUB_OUTPUT"
else else
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT" echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
fi fi
@@ -105,11 +103,10 @@ jobs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha }} build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout & Sync & Save - name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout uses: ./src/electron/.github/actions/checkout
with: with:
@@ -132,11 +129,10 @@ jobs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha}} build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout & Sync & Save - name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout uses: ./src/electron/.github/actions/checkout
@@ -153,169 +149,15 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True' GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
TARGET_OS: 'win' TARGET_OS: 'win'
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1' ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
outputs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout & Sync & Save - name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout uses: ./src/electron/.github/actions/checkout
# GN Check Jobs
macos-gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
needs: checkout-macos
with:
target-platform: macos
target-archs: x64 arm64
check-runs-on: macos-14
gn-build-type: testing
secrets: inherit
linux-gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
needs: checkout-linux
with:
target-platform: linux
target-archs: x64 arm arm64
check-runs-on: electron-arc-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
windows-gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
needs: checkout-windows
with:
target-platform: win
target-archs: x64 x86 arm64
check-runs-on: electron-arc-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/cross-instance-cache:/mnt/cross-instance-cache"]}'
gn-build-type: testing
secrets: inherit
# Build Jobs - These cascade into testing jobs
macos-x64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-macos
with:
build-runs-on: macos-14-xlarge
test-runs-on: macos-13
target-platform: macos
target-arch: x64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
macos-arm64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-macos
with:
build-runs-on: macos-14-xlarge
test-runs-on: macos-14
target-platform: macos
target-arch: arm64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
linux-x64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test-and-nan.yml
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
test-runs-on: electron-arc-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
target-arch: x64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
linux-x64-asan:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
test-runs-on: electron-arc-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
target-arch: x64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
is-asan: true
secrets: inherit
linux-arm:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
test-runs-on: electron-arc-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
target-arch: arm
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
linux-arm64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
test-runs-on: electron-arc-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:arm64v8-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
target-platform: linux
target-arch: arm64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
windows-x64: windows-x64:
permissions: permissions:
contents: read contents: read
@@ -327,7 +169,7 @@ jobs:
with: with:
build-runs-on: electron-arc-windows-amd64-16core build-runs-on: electron-arc-windows-amd64-16core
test-runs-on: windows-latest test-runs-on: windows-latest
target-platform: win target-platform: windows
target-arch: x64 target-arch: x64
is-release: false is-release: false
gn-build-type: testing gn-build-type: testing
@@ -346,7 +188,7 @@ jobs:
with: with:
build-runs-on: electron-arc-windows-amd64-16core build-runs-on: electron-arc-windows-amd64-16core
test-runs-on: windows-latest test-runs-on: windows-latest
target-platform: win target-platform: windows
target-arch: x86 target-arch: x86
is-release: false is-release: false
gn-build-type: testing gn-build-type: testing
@@ -365,7 +207,7 @@ jobs:
with: with:
build-runs-on: electron-arc-windows-amd64-16core build-runs-on: electron-arc-windows-amd64-16core
test-runs-on: electron-hosted-windows-arm64-4core test-runs-on: electron-hosted-windows-arm64-4core
target-platform: win target-platform: windows
target-arch: arm64 target-arch: arm64
is-release: false is-release: false
gn-build-type: testing gn-build-type: testing
@@ -373,12 +215,140 @@ jobs:
upload-to-storage: '0' upload-to-storage: '0'
secrets: inherit secrets: inherit
gha-done: windows-gn-check:
name: GitHub Actions Completed strategy:
runs-on: ubuntu-latest matrix:
needs: [docs-only, macos-x64, macos-arm64, linux-x64, linux-x64-asan, linux-arm, linux-arm64, windows-x64, windows-x86, windows-arm64] arch: [x64, x86, arm64]
if: always() && !contains(needs.*.result, 'failure') uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
steps: needs: checkout-windows
- name: GitHub Actions Jobs Done with:
run: | target-platform: windows
echo "All GitHub Actions Jobs are done" target-arch: ${{ matrix.arch }}
check-runs-on: electron-arc-linux-amd64-8core
check-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
gn-build-type: testing
secrets: inherit
# Build Jobs - These cascade into testing jobs
macos-x64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test-and-check.yml
needs: checkout-macos
with:
build-runs-on: macos-14-xlarge
check-runs-on: macos-14
test-runs-on: macos-13
target-platform: macos
target-arch: x64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
macos-arm64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test-and-check.yml
needs: checkout-macos
with:
build-runs-on: macos-14-xlarge
check-runs-on: macos-14
test-runs-on: macos-14
target-platform: macos
target-arch: arm64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
linux-x64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test-and-check-and-nan.yml
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
check-runs-on: electron-arc-linux-amd64-8core
test-runs-on: electron-arc-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
target-arch: x64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
linux-x64-asan:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test-and-check.yml
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
check-runs-on: electron-arc-linux-amd64-8core
test-runs-on: electron-arc-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
target-arch: x64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
is-asan: true
secrets: inherit
linux-arm:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test-and-check.yml
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
check-runs-on: electron-arc-linux-amd64-8core
test-runs-on: electron-arc-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
target-arch: arm
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
linux-arm64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test-and-check.yml
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
check-runs-on: electron-arc-linux-amd64-8core
test-runs-on: electron-arc-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:arm64v8-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
target-platform: linux
target-arch: arm64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit

View File

@@ -1,21 +0,0 @@
name: Clean Source Cache
on:
schedule:
- cron: "0 0 * * SUN" # Run at midnight every Sunday
jobs:
clean-src-cache:
runs-on: electron-arc-linux-amd64-32core
container:
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
options: --user root
volumes:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
steps:
- name: Cleanup Source Cache
shell: bash
run: |
df -h /mnt/cross-instance-cache
find /mnt/cross-instance-cache -type f -mtime +30 -delete
df -h /mnt/cross-instance-cache

14
.github/workflows/config/gclient.diff vendored Normal file
View File

@@ -0,0 +1,14 @@
diff --git a/gclient.py b/gclient.py
index 59e2b4c5197928bdba1ef69bdbe637d7dfe471c1..b4bae5e48c83c84bd867187afaf40eed16e69851 100755
--- a/gclient.py
+++ b/gclient.py
@@ -783,7 +783,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
not condition or "non_git_source" not in condition):
continue
cipd_root = self.GetCipdRoot()
- for package in dep_value.get('packages', []):
+ packages = dep_value.get('packages', [])
+ for package in (x for x in packages if "infra/3pp/tools/swift-format" not in x.get('package')):
deps_to_add.append(
CipdDependency(parent=self,
name=name,

View File

@@ -20,13 +20,12 @@ jobs:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron org: electron
- name: Set status - name: Set status
uses: dsanders11/project-actions/edit-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/edit-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 90 project-number: 90
field: Status field: Status
field-value: ✅ Triaged field-value: ✅ Triaged
fail-if-item-not-found: false
issue-labeled-blocked: issue-labeled-blocked:
name: blocked/* label added name: blocked/* label added
if: startsWith(github.event.label.name, 'blocked/') if: startsWith(github.event.label.name, 'blocked/')
@@ -39,13 +38,12 @@ jobs:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron org: electron
- name: Set status - name: Set status
uses: dsanders11/project-actions/edit-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/edit-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 90 project-number: 90
field: Status field: Status
field-value: 🛑 Blocked field-value: 🛑 Blocked
fail-if-item-not-found: false
issue-labeled-blocked-need-repro: issue-labeled-blocked-need-repro:
name: blocked/need-repro label added name: blocked/need-repro label added
if: github.event.label.name == 'blocked/need-repro' if: github.event.label.name == 'blocked/need-repro'

View File

@@ -19,7 +19,7 @@ jobs:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron org: electron
- name: Add to Issue Triage - name: Add to Issue Triage
uses: dsanders11/project-actions/add-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/add-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
field: Reporter field: Reporter
field-value: ${{ github.event.issue.user.login }} field-value: ${{ github.event.issue.user.login }}
@@ -57,40 +57,34 @@ jobs:
const electronVersion = select('heading:has(> text[value="Electron Version"]) + paragraph > text', tree)?.value.trim(); const electronVersion = select('heading:has(> text[value="Electron Version"]) + paragraph > text', tree)?.value.trim();
if (electronVersion !== undefined) { if (electronVersion !== undefined) {
// It's possible for multiple versions to be listed - const major = semver.parse(electronVersion)?.major;
// for now check for comma or space separated version. if (major) {
const versions = electronVersion.split(/, | /); const versionLabel = `${major}-x-y`;
for (const version of versions) { let labelExists = false;
const major = semver.coerce(version, { loose: true })?.major;
if (major) {
const versionLabel = `${major}-x-y`;
let labelExists = false;
try { try {
await github.rest.issues.getLabel({ await github.rest.issues.getLabel({
owner, owner,
repo, repo,
name: versionLabel, name: versionLabel,
}); });
labelExists = true; labelExists = true;
} catch {} } catch {}
if (labelExists) { if (labelExists) {
// Check if it's an unsupported major // Check if it's an unsupported major
const { ElectronVersions } = await import('${{ github.workspace }}/node_modules/@electron/fiddle-core/dist/index.js'); const { ElectronVersions } = await import('${{ github.workspace }}/node_modules/@electron/fiddle-core/dist/index.js');
const versions = await ElectronVersions.create(undefined, { ignoreCache: true }); const versions = await ElectronVersions.create(undefined, { ignoreCache: true });
const validVersions = [...versions.supportedMajors, ...versions.prereleaseMajors]; const validVersions = [...versions.supportedMajors, ...versions.prereleaseMajors];
if (validVersions.includes(major)) { if (!validVersions.includes(major)) {
labels.push(versionLabel); core.setOutput('unsupportedMajor', true);
} labels.push('blocked/need-info ❌');
} }
labels.push(versionLabel);
} }
} }
if (labels.length === 0) {
core.setOutput('unsupportedMajor', true);
labels.push('blocked/need-info ❌');
}
} }
const operatingSystems = select('heading:has(> text[value="What operating system(s) are you using?"]) + paragraph > text', tree)?.value.trim().split(', '); const operatingSystems = select('heading:has(> text[value="What operating system(s) are you using?"]) + paragraph > text', tree)?.value.trim().split(', ');

View File

@@ -1,27 +0,0 @@
name: Issue Transferred
on:
issues:
types: [transferred]
permissions: {}
jobs:
issue-transferred:
name: Issue Transferred
runs-on: ubuntu-latest
if: ${{ !github.event.changes.new_repository.private }}
steps:
- name: Generate GitHub App token
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token
with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron
- name: Remove from issue triage
uses: dsanders11/project-actions/delete-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1
with:
token: ${{ steps.generate-token.outputs.token }}
project-number: 90
item: ${{ github.event.changes.new_issue.html_url }}
fail-if-item-not-found: false

View File

@@ -30,10 +30,9 @@ jobs:
org: electron org: electron
- name: Set status - name: Set status
if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }} if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }}
uses: dsanders11/project-actions/edit-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/edit-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 90 project-number: 90
field: Status field: Status
field-value: 📥 Was Blocked field-value: 📥 Was Blocked
fail-if-item-not-found: false

View File

@@ -6,7 +6,7 @@ on:
build-image-sha: build-image-sha:
type: string type: string
description: 'SHA for electron/build image' description: 'SHA for electron/build image'
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1' default: 'cf814a4d2501e8e843caea071a6b70a48e78b855'
upload-to-storage: upload-to-storage:
description: 'Uploads to Azure storage' description: 'Uploads to Azure storage'
required: false required: false
@@ -30,7 +30,7 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0

View File

@@ -6,7 +6,7 @@ on:
build-image-sha: build-image-sha:
type: string type: string
description: 'SHA for electron/build image' description: 'SHA for electron/build image'
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1' default: 'cf814a4d2501e8e843caea071a6b70a48e78b855'
required: true required: true
upload-to-storage: upload-to-storage:
description: 'Uploads to Azure storage' description: 'Uploads to Azure storage'
@@ -31,7 +31,7 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac' GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0

View File

@@ -5,7 +5,7 @@ on:
inputs: inputs:
target-platform: target-platform:
type: string type: string
description: 'Platform to run on, can be macos, win or linux.' description: 'Platform to run on, can be macos, windows or linux.'
required: true required: true
target-arch: target-arch:
type: string type: string
@@ -15,6 +15,10 @@ on:
type: string type: string
description: 'What host to run the build' description: 'What host to run the build'
required: true required: true
check-runs-on:
type: string
description: 'What host to run the gn-check'
required: true
test-runs-on: test-runs-on:
type: string type: string
description: 'What host to run the tests on' description: 'What host to run the tests on'
@@ -56,8 +60,8 @@ on:
default: false default: false
concurrency: concurrency:
group: electron-build-and-test-and-nan-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }} group: electron-build-and-test-and-nan-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
jobs: jobs:
build: build:
@@ -72,6 +76,16 @@ jobs:
generate-symbols: ${{ inputs.generate-symbols }} generate-symbols: ${{ inputs.generate-symbols }}
upload-to-storage: ${{ inputs.upload-to-storage }} upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit secrets: inherit
gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
with:
target-platform: ${{ inputs.target-platform }}
target-arch: ${{ inputs.target-arch }}
check-runs-on: ${{ inputs.check-runs-on }}
check-container: ${{ inputs.build-container }}
gn-build-type: ${{ inputs.gn-build-type }}
is-asan: ${{ inputs.is-asan }}
secrets: inherit
test: test:
uses: ./.github/workflows/pipeline-segment-electron-test.yml uses: ./.github/workflows/pipeline-segment-electron-test.yml
needs: build needs: build

View File

@@ -0,0 +1,104 @@
name: Electron Build & Test Pipeline
on:
workflow_call:
inputs:
target-platform:
type: string
description: 'Platform to run on, can be macos, windows or linux'
required: true
target-arch:
type: string
description: 'Arch to build for, can be x64, arm64 or arm'
required: true
build-runs-on:
type: string
description: 'What host to run the build'
required: true
check-runs-on:
type: string
description: 'What host to run the gn-check'
required: true
test-runs-on:
type: string
description: 'What host to run the tests on'
required: true
build-container:
type: string
description: 'JSON container information for aks runs-on'
required: false
default: '{"image":null}'
test-container:
type: string
description: 'JSON container information for testing'
required: false
default: '{"image":null}'
is-release:
description: 'Whether this build job is a release job'
required: true
type: boolean
default: false
gn-build-type:
description: 'The gn build type - testing or release'
required: true
type: string
default: testing
generate-symbols:
description: 'Whether or not to generate symbols'
required: true
type: boolean
default: false
upload-to-storage:
description: 'Whether or not to upload build artifacts to external storage'
required: true
type: string
default: '0'
is-asan:
description: 'Building the Address Sanitizer (ASan) Linux build'
required: false
type: boolean
default: false
concurrency:
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
permissions:
contents: read
issues: read
pull-requests: read
jobs:
build:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
with:
build-runs-on: ${{ inputs.build-runs-on }}
build-container: ${{ inputs.build-container }}
target-platform: ${{ inputs.target-platform }}
target-arch: ${{ inputs.target-arch }}
is-release: ${{ inputs.is-release }}
gn-build-type: ${{ inputs.gn-build-type }}
generate-symbols: ${{ inputs.generate-symbols }}
upload-to-storage: ${{ inputs.upload-to-storage }}
is-asan: ${{ inputs.is-asan}}
secrets: inherit
gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
with:
target-platform: ${{ inputs.target-platform }}
target-arch: ${{ inputs.target-arch }}
check-runs-on: ${{ inputs.check-runs-on }}
check-container: ${{ inputs.build-container }}
gn-build-type: ${{ inputs.gn-build-type }}
is-asan: ${{ inputs.is-asan }}
secrets: inherit
test:
uses: ./.github/workflows/pipeline-segment-electron-test.yml
needs: build
with:
target-arch: ${{ inputs.target-arch }}
target-platform: ${{ inputs.target-platform }}
test-runs-on: ${{ inputs.test-runs-on }}
test-container: ${{ inputs.test-container }}
is-asan: ${{ inputs.is-asan}}
secrets: inherit

View File

@@ -5,7 +5,7 @@ on:
inputs: inputs:
target-platform: target-platform:
type: string type: string
description: 'Platform to run on, can be macos, win or linux' description: 'Platform to run on, can be macos, windows or linux'
required: true required: true
target-arch: target-arch:
type: string type: string
@@ -56,8 +56,8 @@ on:
default: false default: false
concurrency: concurrency:
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }} group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
permissions: permissions:
contents: read contents: read

View File

@@ -20,13 +20,14 @@ jobs:
container: ${{ fromJSON(inputs.container) }} container: ${{ fromJSON(inputs.container) }}
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies run: |
cd src/electron
node script/yarn install --frozen-lockfile
- name: Run TS/JS compile - name: Run TS/JS compile
shell: bash shell: bash
run: | run: |

View File

@@ -9,8 +9,8 @@ on:
type: string type: string
concurrency: concurrency:
group: electron-lint-${{ github.ref_protected == true && github.run_id || github.ref }} group: electron-lint-${{ github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
jobs: jobs:
lint: lint:
@@ -20,13 +20,14 @@ jobs:
container: ${{ fromJSON(inputs.container) }} container: ${{ fromJSON(inputs.container) }}
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies run: |
cd src/electron
node script/yarn install --frozen-lockfile
- name: Setup third_party Depot Tools - name: Setup third_party Depot Tools
shell: bash shell: bash
run: | run: |

View File

@@ -9,11 +9,11 @@ on:
type: string type: string
target-platform: target-platform:
type: string type: string
description: 'Platform to run on, can be macos, win or linux' description: 'Platform to run on, can be macos, windows or linux'
required: true required: true
target-arch: target-arch:
type: string type: string
description: 'Arch to build for, can be x64, arm64, ia32 or arm' description: 'Arch to build for, can be x64, arm64 or arm'
required: true required: true
target-variant: target-variant:
type: string type: string
@@ -61,15 +61,15 @@ on:
concurrency: 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 }} group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
env: env:
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }} ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }} ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }} SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }}
SUDOWOODO_EXCHANGE_TOKEN: ${{ secrets.SUDOWOODO_EXCHANGE_TOKEN }} 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' }} GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || inputs.target-platform == 'windows' && '--custom-var=checkout_win=True' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
ELECTRON_OUT_DIR: Default ELECTRON_OUT_DIR: Default
jobs: jobs:
@@ -87,11 +87,10 @@ jobs:
run: | run: |
mkdir src mkdir src
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Free up space (macOS) - name: Free up space (macOS)
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/free-space-macos uses: ./src/electron/.github/actions/free-space-macos
@@ -100,13 +99,15 @@ jobs:
run: df -h run: df -h
- name: Setup Node.js/npm - name: Setup Node.js/npm
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
with: with:
node-version: 20.11.x node-version: 20.11.x
cache: yarn cache: yarn
cache-dependency-path: src/electron/yarn.lock cache-dependency-path: src/electron/yarn.lock
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies run: |
cd src/electron
node script/yarn install --frozen-lockfile
- name: Install AZCopy - name: Install AZCopy
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
run: brew install azcopy run: brew install azcopy
@@ -140,13 +141,16 @@ jobs:
# Ensure depot_tools does not update. # Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools test -d depot_tools && cd depot_tools
if [ "`uname`" = "Linux" ]; then
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
fi
touch .disable_auto_update touch .disable_auto_update
- name: Add Depot Tools to PATH - name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- name: Generate DEPS Hash - name: Generate DEPS Hash
run: | run: |
node src/electron/script/generate-deps-hash.js node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash && cat src/electron/.depshash-target
DEPSHASH=v1-src-cache-$(cat src/electron/.depshash) DEPSHASH=v1-src-cache-$(sha1sum src/electron/.depshash | cut -f1 -d' ')
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
- name: Restore src cache via AZCopy - name: Restore src cache via AZCopy
@@ -155,37 +159,45 @@ jobs:
- name: Restore src cache via AKS - name: Restore src cache via AKS
if: ${{ inputs.target-platform == 'linux' }} if: ${{ inputs.target-platform == 'linux' }}
uses: ./src/electron/.github/actions/restore-cache-aks uses: ./src/electron/.github/actions/restore-cache-aks
- name: Checkout src via gclient sync - name: Checkout the whole damm thing
if: ${{ inputs.target-platform == 'win' }} if: ${{ inputs.target-platform == 'windows' }}
uses: ./src/electron/.github/actions/checkout uses: ./src/electron/.github/actions/checkout
with: with:
use-cache: 'false' use-cache: 'false'
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Build Tools - name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools - name: Init Build Tools
run: | 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 }} --only-sdk
- name: Run Electron Only Hooks - name: Run Electron Only Hooks
run: | run: |
e d gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" e d gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
- name: Regenerate DEPS Hash - name: Regenerate DEPS Hash
run: | run: |
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js (cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash && cat src/electron/.depshash-target
echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV echo "DEPSHASH=$(sha1sum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
- name: Add CHROMIUM_BUILDTOOLS_PATH to env - name: Add CHROMIUM_BUILDTOOLS_PATH to env
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
- name: Fix Sync (macOS) - name: Fix Sync (macOS)
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/fix-sync-macos uses: ./src/electron/.github/actions/fix-sync-macos
- name: Setup Number of Ninja Processes - name: Install build-tools & Setup RBE
run: | run: |
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform != 'macos' && '300' || '200' }}" >> $GITHUB_ENV echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform != 'macos' && '300' || '200' }}" >> $GITHUB_ENV
cd $(cygpath -u "$(e show depotdir)")/../..
npx yarn --ignore-engines
# Pull down credential helper and print status
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
HELPER=$(node -p "require('./src/utils/reclient.js').helperPath({})")
$HELPER login
echo 'RBE_service='`node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"` >> $GITHUB_ENV
echo 'RBE_experimental_credentials_helper='`node -e "console.log(require('./src/utils/reclient.js').helperPath({}))"` >> $GITHUB_ENV
echo 'RBE_experimental_credentials_helper_args=print' >> $GITHUB_ENV
- name: Free up space (macOS) - name: Free up space (macOS)
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/free-space-macos uses: ./src/electron/.github/actions/free-space-macos

View File

@@ -5,11 +5,11 @@ on:
inputs: inputs:
target-platform: target-platform:
type: string type: string
description: 'Platform to run on, can be macos, win or linux' description: 'Platform to run on, can be macos, windows or linux'
required: true required: true
target-archs: target-arch:
type: string type: string
description: 'Archs to check for, can be x64, x86, arm64 or arm space separated' description: 'Arch to build for, can be x64, arm64 or arm'
required: true required: true
check-runs-on: check-runs-on:
type: string type: string
@@ -25,30 +25,38 @@ on:
required: true required: true
type: string type: string
default: testing default: testing
is-asan:
description: 'Building the Address Sanitizer (ASan) Linux build'
required: false
type: boolean
default: false
concurrency: concurrency:
group: electron-gn-check-${{ inputs.target-platform }}-${{ github.ref }} group: electron-gn-check-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
env: env:
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }} ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || (inputs.target-platform == 'linux' && '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' || '--custom-var=checkout_win=True') }} GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || (inputs.target-platform == 'linux' && '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' || '--custom-var=checkout_win=True') }}
ELECTRON_OUT_DIR: Default ELECTRON_OUT_DIR: Default
TARGET_ARCH: ${{ inputs.target-arch }}
jobs: jobs:
gn-check: gn-check:
defaults: defaults:
run: run:
shell: bash shell: bash
# TODO(codebytere): Change this to medium VM
runs-on: ${{ inputs.check-runs-on }} runs-on: ${{ inputs.check-runs-on }}
container: ${{ fromJSON(inputs.check-container) }} container: ${{ fromJSON(inputs.check-container) }}
env:
TARGET_ARCH: ${{ inputs.target-arch }}
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Cleanup disk space on macOS - name: Cleanup disk space on macOS
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
shell: bash shell: bash
@@ -68,84 +76,103 @@ jobs:
run: df -h run: df -h
- name: Install Build Tools - name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools uses: ./src/electron/.github/actions/install-build-tools
- 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 }} --only-sdk
- name: Get Depot Tools
timeout-minutes: 5
run: |
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
SEDOPTION="-i"
if [ "`uname`" = "Darwin" ]; then
SEDOPTION="-i ''"
fi
# remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
sed $SEDOPTION '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
if [ "`uname`" = "Linux" ]; then
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
fi
touch .disable_auto_update
- name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- name: Set GN_EXTRA_ARGS for Linux
if: ${{ inputs.target-platform == 'linux' }}
run: |
if [ "${{ inputs.target-arch }}" = "arm" ]; then
GN_EXTRA_ARGS='build_tflite_with_xnnpack=false'
elif [ "${{ inputs.target-arch }}" = "arm64" ]; then
GN_EXTRA_ARGS='fatal_linker_warnings=false enable_linux_installer=false'
fi
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
- name: Set GN_EXTRA_ARGS for Win/cross
if: ${{ inputs.target-platform == 'windows' }}
run: |
GN_APPENDED_ARGS="$GN_EXTRA_ARGS use_v8_context_snapshot=true target_os=\"win\""
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
- name: Enable windows toolchain - name: Enable windows toolchain
if: ${{ inputs.target-platform == 'win' }} if: ${{ inputs.target-platform == 'windows' }}
run: | run: |
echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV
- name: Generate DEPS Hash - name: Generate DEPS Hash
run: | run: |
node src/electron/script/generate-deps-hash.js node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash && cat src/electron/.depshash-target
DEPSHASH=v1-src-cache-$(cat src/electron/.depshash) DEPSHASH=v1-src-cache-$(sha1sum src/electron/.depshash | cut -f1 -d' ')
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
- name: Restore src cache via AZCopy - name: Restore src cache via AZCopy
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/restore-cache-azcopy uses: ./src/electron/.github/actions/restore-cache-azcopy
- name: Restore src cache via AKS - name: Restore src cache via AKS
if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'win' }} if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'windows' }}
uses: ./src/electron/.github/actions/restore-cache-aks uses: ./src/electron/.github/actions/restore-cache-aks
- name: Run Electron Only Hooks - name: Run Electron Only Hooks
run: | run: |
echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient
if [ "${{ inputs.target-platform }}" = "win" ]; then if [ "${{ inputs.target-platform }}" = "windows" ]; then
echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False,'install_sysroot':False,'checkout_win':True},'managed':False}]" > tmpgclient echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False,'install_sysroot':False,'checkout_win':True},'managed':False}]" > tmpgclient
echo "target_os=['win']" >> tmpgclient echo "target_os=['win']" >> tmpgclient
fi fi
e d gclient runhooks --gclientfile=tmpgclient e d gclient runhooks --gclientfile=tmpgclient
# Fix VS Toolchain # Fix VS Toolchain
if [ "${{ inputs.target-platform }}" = "win" ]; then if [ "${{ inputs.target-platform }}" = "windows" ]; then
rm -rf src/third_party/depot_tools/win_toolchain/vs_files rm -rf src/third_party/depot_tools/win_toolchain/vs_files
e d python3 src/build/vs_toolchain.py update --force e d python3 src/build/vs_toolchain.py update --force
fi fi
- name: Regenerate DEPS Hash - name: Regenerate DEPS Hash
run: | run: |
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js (cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV echo "DEPSHASH=$(sha1sum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
- name: Add CHROMIUM_BUILDTOOLS_PATH to env - name: Add CHROMIUM_BUILDTOOLS_PATH to env
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies
- name: Default GN gen - name: Default GN gen
run: | run: |
cd src/electron cd src/electron
git pack-refs git pack-refs
- name: Run GN Check for ${{ inputs.target-archs }} cd ..
e build --only-gen
- name: Run GN Check
run: | run: |
for target_cpu in ${{ inputs.target-archs }} cd src
do e d gn check out/Default //electron:electron_lib
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu $target_cpu e d gn check out/Default //electron:electron_app
cd src e d gn check out/Default //electron/shell/common:mojo
export GN_EXTRA_ARGS="target_cpu=\"$target_cpu\"" e d gn check out/Default //electron/shell/common:plugin
if [ "${{ inputs.target-platform }}" = "linux" ]; then
if [ "$target_cpu" = "arm" ]; then
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS build_tflite_with_xnnpack=false"
elif [ "$target_cpu" = "arm64" ]; then
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS fatal_linker_warnings=false enable_linux_installer=false"
fi
fi
if [ "${{ inputs.target-platform }}" = "win" ]; then
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS use_v8_context_snapshot=true target_os=\"win\""
fi
e build --only-gen # Check the hunspell filenames
node electron/script/gen-hunspell-filenames.js --check
e d gn check out/Default //electron:electron_lib node electron/script/gen-libc++-filenames.js --check
e d gn check out/Default //electron:electron_app
e d gn check out/Default //electron/shell/common:mojo
e d gn check out/Default //electron/shell/common:plugin
# Check the hunspell filenames
node electron/script/gen-hunspell-filenames.js --check
node electron/script/gen-libc++-filenames.js --check
cd ..
done
- name: Wait for active SSH sessions - name: Wait for active SSH sessions
if: always() && !cancelled() if: always() && !cancelled()
shell: bash shell: bash

View File

@@ -5,7 +5,7 @@ on:
inputs: inputs:
target-platform: target-platform:
type: string type: string
description: 'Platform to run on, can be macos, win or linux' description: 'Platform to run on, can be macos, windows or linux'
required: true required: true
target-arch: target-arch:
type: string type: string
@@ -27,8 +27,8 @@ on:
default: false default: false
concurrency: concurrency:
group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }} group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
permissions: permissions:
contents: read contents: read
@@ -49,7 +49,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
build-type: ${{ inputs.target-platform == 'macos' && fromJSON('["darwin","mas"]') || (inputs.target-platform == 'win' && fromJSON('["win"]') || fromJSON('["linux"]')) }} build-type: ${{ inputs.target-platform == 'macos' && fromJSON('["darwin","mas"]') || (inputs.target-platform == 'windows' && fromJSON('["windows"]') || fromJSON('["linux"]')) }}
shard: ${{ inputs.target-platform == 'linux' && fromJSON('[1, 2, 3]') || fromJSON('[1, 2]') }} shard: ${{ inputs.target-platform == 'linux' && fromJSON('[1, 2, 3]') || fromJSON('[1, 2]') }}
env: env:
BUILD_TYPE: ${{ matrix.build-type }} BUILD_TYPE: ${{ matrix.build-type }}
@@ -61,23 +61,21 @@ jobs:
run: | run: |
cp $(which node) /mnt/runner-externals/node20/bin/ cp $(which node) /mnt/runner-externals/node20/bin/
- name: Install Git on Windows arm64 runners - name: Install Git on Windows arm64 runners
if: ${{ inputs.target-arch == 'arm64' && inputs.target-platform == 'win' }} if: ${{ inputs.target-arch == 'arm64' && inputs.target-platform == 'windows' }}
shell: powershell shell: powershell
run: | run: |
Set-ExecutionPolicy Bypass -Scope Process -Force Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install -y --no-progress git.install --params "'/GitAndUnixToolsOnPath'" choco install git.install --params "'/GitAndUnixToolsOnPath'" -y
choco install -y --no-progress git choco install -y --no-progress git
choco install -y --no-progress python --version 3.11.9 choco install python --version 3.7.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\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:\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 echo ""C:\Python37" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
- name: Setup Node.js/npm - name: Setup Node.js/npm
if: ${{ inputs.target-platform == 'win' }} if: ${{ inputs.target-platform == 'windows' }}
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
with: with:
node-version: 20.11.x node-version: 20.11.x
- name: Add TCC permissions on macOS - name: Add TCC permissions on macOS
@@ -114,13 +112,14 @@ jobs:
fi fi
done done
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies run: |
cd src/electron
node script/yarn install --frozen-lockfile
- name: Get Depot Tools - name: Get Depot Tools
timeout-minutes: 5 timeout-minutes: 5
run: | run: |
@@ -151,36 +150,29 @@ jobs:
path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }} path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
- name: Restore Generated Artifacts - name: Restore Generated Artifacts
run: ./src/electron/script/actions/restore-artifacts.sh run: ./src/electron/script/actions/restore-artifacts.sh
- name: Unzip Dist, Mksnapshot & Chromedriver (win) - name: Unzip Dist, Mksnapshot & Chromedriver
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)
if: ${{ inputs.target-platform != 'win' }}
run: | run: |
cd src/out/Default cd src/out/Default
unzip -:o dist.zip if [ "${{ inputs.target-platform }}" = "windows" ]; then
unzip -:o chromedriver.zip tar -xf dist.zip
unzip -:o mksnapshot.zip tar -xf chromedriver.zip
tar -xf mksnapshot.zip
else
unzip -:o dist.zip
unzip -:o chromedriver.zip
unzip -:o mksnapshot.zip
fi
- name: Import & Trust Self-Signed Codesigning Cert on MacOS - name: Import & Trust Self-Signed Codesigning Cert on MacOS
if: ${{ inputs.target-platform == 'macos' && inputs.target-arch == 'x64' }} if: ${{ inputs.target-platform == 'macos' && inputs.target-arch == 'x64' }}
run: | run: |
sudo security authorizationdb write com.apple.trust-settings.admin allow sudo security authorizationdb write com.apple.trust-settings.admin allow
cd src/electron cd src/electron
./script/codesign/generate-identity.sh ./script/codesign/generate-identity.sh
- name: Install Datadog CLI
run: |
cd src/electron
node script/yarn global add @datadog/datadog-ci
- name: Run Electron Tests - name: Run Electron Tests
shell: bash shell: bash
env: env:
MOCHA_REPORTER: mocha-multi-reporters MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
ELECTRON_DISABLE_SECURITY_WARNINGS: 1 ELECTRON_DISABLE_SECURITY_WARNINGS: 1
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
@@ -188,20 +180,14 @@ jobs:
NPM_CONFIG_MSVS_VERSION: '2022' NPM_CONFIG_MSVS_VERSION: '2022'
run: | run: |
cd src/electron cd src/electron
export ELECTRON_TEST_RESULTS_DIR=`pwd`/junit
# Get which tests are on this shard # Get which tests are on this shard
tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ inputs.target-platform == 'linux' && 3 || 2 }}) tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ inputs.target-platform == 'linux' && 3 || 2 }})
# Run tests # Run tests
if [ "${{ inputs.target-platform }}" != "linux" ]; then if [ "${{ inputs.target-platform }}" != "linux" ]; then
echo "About to start tests" echo "About to start tests"
if [ "${{ inputs.target-platform }}" = "win" ]; then if [ "${{ inputs.target-platform }}" = "windows" ] && [ "${{ inputs.target-arch }}" = "x86" ]; then
if [ "${{ inputs.target-arch }}" = "x86" ]; then export npm_config_arch="ia32"
export npm_config_arch="ia32"
fi
if [ "${{ inputs.target-arch }}" = "arm64" ]; then
export ELECTRON_FORCE_TEST_SUITE_EXIT="true"
fi
fi fi
node script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files node script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
else else
@@ -225,24 +211,11 @@ jobs:
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
fi fi
fi fi
- name: Upload Test results to Datadog
env:
DD_ENV: ci
DD_SERVICE: electron
DD_API_KEY: ${{ secrets.DD_API_KEY }}
DD_CIVISIBILITY_LOGS_ENABLED: true
DD_TAGS: "os.architecture:${{ inputs.target-arch }},os.family:${{ inputs.target-platform }},os.platform:${{ inputs.target-platform }},asan:${{ inputs.is-asan }}"
run: |
if ! [ -z $DD_API_KEY ] && [ -f src/electron/junit/test-results-main.xml ]; then
export DATADOG_PATH=`node src/electron/script/yarn global bin`
$DATADOG_PATH/datadog-ci junit upload src/electron/junit/test-results-main.xml
fi
if: always() && !cancelled()
- name: Upload Test Artifacts - name: Upload Test Artifacts
if: always() && !cancelled() if: always() && !cancelled()
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
with: with:
name: test_artifacts_${{ env.ARTIFACT_KEY }}_${{ matrix.shard }} name: test_artifacts_${{ env.ARTIFACT_KEY }}
path: src/electron/spec/artifacts path: src/electron/spec/artifacts
if-no-files-found: ignore if-no-files-found: ignore
- name: Wait for active SSH sessions - name: Wait for active SSH sessions

View File

@@ -5,7 +5,7 @@ on:
inputs: inputs:
target-platform: target-platform:
type: string type: string
description: 'Platform to run on, can be macos, win or linux' description: 'Platform to run on, can be macos, windows or linux'
required: true required: true
target-arch: target-arch:
type: string type: string
@@ -27,8 +27,8 @@ on:
default: testing default: testing
concurrency: concurrency:
group: electron-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }} group: electron-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
env: env:
ELECTRON_OUT_DIR: Default ELECTRON_OUT_DIR: Default
@@ -45,24 +45,27 @@ jobs:
container: ${{ fromJSON(inputs.test-container) }} container: ${{ fromJSON(inputs.test-container) }}
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Build Tools - name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools - name: Init Build Tools
run: | 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 }}
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies run: |
cd src/electron
node script/yarn install --frozen-lockfile
- name: Get Depot Tools - name: Get Depot Tools
timeout-minutes: 5 timeout-minutes: 5
run: | run: |
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
# Ensure depot_tools does not update. # Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools test -d depot_tools && cd depot_tools
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
touch .disable_auto_update touch .disable_auto_update
- name: Add Depot Tools to PATH - name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
@@ -106,24 +109,27 @@ jobs:
container: ${{ fromJSON(inputs.test-container) }} container: ${{ fromJSON(inputs.test-container) }}
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Build Tools - name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools - name: Init Build Tools
run: | run: |
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies run: |
cd src/electron
node script/yarn install --frozen-lockfile
- name: Get Depot Tools - name: Get Depot Tools
timeout-minutes: 5 timeout-minutes: 5
run: | run: |
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
# Ensure depot_tools does not update. # Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools test -d depot_tools && cd depot_tools
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
touch .disable_auto_update touch .disable_auto_update
- name: Add Depot Tools to PATH - name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH

View File

@@ -13,14 +13,14 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Trigger Slack workflow - name: Trigger Slack workflow
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0 uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
with: with:
webhook: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: | payload: |
{ {
"url": "${{ github.event.pull_request.html_url }}" "url": "${{ github.event.pull_request.html_url }}"
} }
env:
SLACK_WEBHOOK_URL: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
pull-request-labeled-deprecation-review-complete: pull-request-labeled-deprecation-review-complete:
name: deprecation-review/complete label added name: deprecation-review/complete label added
if: github.event.label.name == 'deprecation-review/complete ✅' if: github.event.label.name == 'deprecation-review/complete ✅'
@@ -33,7 +33,7 @@ jobs:
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }} creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
org: electron org: electron
- name: Set status - name: Set status
uses: dsanders11/project-actions/edit-item@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/edit-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 94 project-number: 94

View File

@@ -22,7 +22,7 @@ jobs:
steps: steps:
- name: "Checkout code" - name: "Checkout code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with: with:
persist-credentials: false persist-credentials: false
@@ -42,7 +42,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab. # format to the repository Actions tab.
- name: "Upload artifact" - name: "Upload artifact"
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with: with:
name: SARIF file name: SARIF file
path: results.sarif path: results.sarif
@@ -50,6 +50,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard. # Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8
with: with:
sarif_file: results.sarif sarif_file: results.sarif

View File

@@ -27,7 +27,7 @@ jobs:
PROJECT_NUMBER=$(gh project list --owner electron --format json | jq -r '.projects | map(select(.title | test("^[0-9]+-x-y$"))) | max_by(.number) | .number') PROJECT_NUMBER=$(gh project list --owner electron --format json | jq -r '.projects | map(select(.title | test("^[0-9]+-x-y$"))) | max_by(.number) | .number')
echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> "$GITHUB_OUTPUT" echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> "$GITHUB_OUTPUT"
- name: Update Completed Stable Prep Items - name: Update Completed Stable Prep Items
uses: dsanders11/project-actions/completed-by@9c80cd31f58599941c64f74636bea95ba5d46090 # v1.5.1 uses: dsanders11/project-actions/completed-by@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
field: Prep Status field: Prep Status
field-value: ✅ Complete field-value: ✅ Complete

View File

@@ -16,7 +16,7 @@ jobs:
id: generate-token id: generate-token
with: with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # tag: v9.1.0 - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # tag: v9.0.0
with: with:
repo-token: ${{ steps.generate-token.outputs.token }} repo-token: ${{ steps.generate-token.outputs.token }}
days-before-stale: 90 days-before-stale: 90
@@ -39,7 +39,7 @@ jobs:
id: generate-token id: generate-token
with: with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # tag: v9.1.0 - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # tag: v9.0.0
with: with:
repo-token: ${{ steps.generate-token.outputs.token }} repo-token: ${{ steps.generate-token.outputs.token }}
days-before-stale: -1 days-before-stale: -1

View File

@@ -0,0 +1,73 @@
name: Update AppVeyor Image
# Run chron daily Mon-Fri
on:
workflow_dispatch:
schedule:
- cron: '0 8 * * 1-5' # runs 8:00 every business day (see https://crontab.guru)
permissions: {}
jobs:
bake-appveyor-image:
name: Bake AppVeyor Image
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token
with:
creds: ${{ secrets.APPVEYOR_UPDATER_GH_APP_CREDS }}
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}
- name: Yarn install
run: |
node script/yarn.js install --frozen-lockfile
- name: Set Repo for Commit
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Check AppVeyor Image
env:
APPVEYOR_TOKEN: ${{ secrets.APPVEYOR_TOKEN }}
run: |
node ./script/prepare-appveyor
if [ -f ./image_version.txt ]; then
echo "APPVEYOR_IMAGE_VERSION="$(cat image_version.txt)"" >> $GITHUB_ENV
rm image_version.txt
fi
- name: (Optionally) Update Appveyor Image
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
uses: mikefarah/yq@bbdd97482f2d439126582a59689eb1c855944955 # v4.44.3
with:
cmd: |
yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor.yml" > "appveyor2.yml"
yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor-woa.yml" > "appveyor-woa2.yml"
- name: (Optionally) Generate Commit Diff
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
diff -w -B appveyor.yml appveyor2.yml > appveyor.diff || true
patch -f appveyor.yml < appveyor.diff
rm appveyor2.yml appveyor.diff
git add appveyor.yml
- name: (Optionally) Generate Commit Diff for WOA
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
diff -w -B appveyor-woa.yml appveyor-woa2.yml > appveyor-woa.diff || true
patch -f appveyor-woa.yml < appveyor-woa.diff
rm appveyor-woa2.yml appveyor-woa.diff
git add appveyor-woa.yml
- name: (Optionally) Commit to Branch
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
uses: dsanders11/github-app-commit-action@43de6da2f4d927e997c0784c7a0b61bd19ad6aac # v1.5.0
with:
message: 'build: update appveyor image to latest version'
ref: bump-appveyor-image
token: ${{ steps.generate-token.outputs.token }}
- name: (Optionally) Create Pull Request
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
printf "This PR updates appveyor.yml to the latest baked image, ${{ env.APPVEYOR_IMAGE_VERSION }}.\n\nNotes: none" | gh pr create --head bump-appveyor-image --label no-backport --label semver/none --title 'build: update appveyor image to latest version' --body-file=-
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}

View File

@@ -1,84 +0,0 @@
name: Publish Windows
on:
workflow_dispatch:
inputs:
build-image-sha:
type: string
description: 'SHA for electron/build image'
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
required: true
upload-to-storage:
description: 'Uploads to Azure storage'
required: false
default: '1'
type: string
run-windows-publish:
description: 'Run the publish jobs vs just the build jobs'
type: boolean
default: false
jobs:
checkout-windows:
runs-on: electron-arc-linux-amd64-32core
container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
volumes:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
env:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
TARGET_OS: 'win'
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
outputs:
build-image-sha: ${{ inputs.build-image-sha }}
steps:
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
- name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout
publish-x64-win:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-windows
with:
environment: production-release
build-runs-on: electron-arc-windows-amd64-16core
target-platform: win
target-arch: x64
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-arm64-win:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-windows
with:
environment: production-release
build-runs-on: electron-arc-windows-amd64-16core
target-platform: win
target-arch: arm64
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-x86-win:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-windows
with:
environment: production-release
build-runs-on: electron-arc-windows-amd64-16core
target-platform: win
target-arch: x86
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit

1
.gitignore vendored
View File

@@ -48,6 +48,7 @@ ts-gen
# Used to accelerate CI builds # Used to accelerate CI builds
.depshash .depshash
.depshash-target
# Used to accelerate builds after sync # Used to accelerate builds after sync
patches/mtime-cache.json patches/mtime-cache.json

View File

@@ -5,9 +5,6 @@
"autolink": false, "autolink": false,
"shortcut": false "shortcut": false
}, },
"MD049": {
"style": "underscore"
},
"no-angle-brackets": true, "no-angle-brackets": true,
"no-curly-braces": true, "no-curly-braces": true,
"no-inline-html": { "no-inline-html": {

View File

@@ -9,7 +9,7 @@ import("//pdf/features.gni")
import("//ppapi/buildflags/buildflags.gni") import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni") import("//printing/buildflags/buildflags.gni")
import("//testing/test.gni") import("//testing/test.gni")
import("//third_party/electron_node/node.gni") import("//third_party/electron_node/electron_node.gni")
import("//third_party/ffmpeg/ffmpeg_options.gni") import("//third_party/ffmpeg/ffmpeg_options.gni")
import("//tools/generate_library_loader/generate_library_loader.gni") import("//tools/generate_library_loader/generate_library_loader.gni")
import("//tools/grit/grit_rule.gni") import("//tools/grit/grit_rule.gni")
@@ -84,10 +84,7 @@ if (is_linux) {
# from the gtk library. Function signatures for which stubs are # from the gtk library. Function signatures for which stubs are
# required should be declared in the sig files. # required should be declared in the sig files.
generate_stubs("electron_gtk_stubs") { generate_stubs("electron_gtk_stubs") {
sigs = [ sigs = [ "shell/browser/ui/electron_gdk_pixbuf.sigs" ]
"shell/browser/ui/electron_gdk.sigs",
"shell/browser/ui/electron_gdk_pixbuf.sigs",
]
extra_header = "shell/browser/ui/electron_gtk.fragment" extra_header = "shell/browser/ui/electron_gtk.fragment"
output_name = "electron_gtk_stubs" output_name = "electron_gtk_stubs"
public_deps = [ "//ui/gtk:gtk_config" ] public_deps = [ "//ui/gtk:gtk_config" ]
@@ -224,21 +221,11 @@ webpack_build("electron_utility_bundle") {
out_file = "$target_gen_dir/js2c/utility_init.js" out_file = "$target_gen_dir/js2c/utility_init.js"
} }
webpack_build("electron_preload_realm_bundle") {
deps = [ ":build_electron_definitions" ]
inputs = auto_filenames.preload_realm_bundle_deps
config_file = "//electron/build/webpack/webpack.config.preload_realm.js"
out_file = "$target_gen_dir/js2c/preload_realm_bundle.js"
}
action("electron_js2c") { action("electron_js2c") {
deps = [ deps = [
":electron_browser_bundle", ":electron_browser_bundle",
":electron_isolated_renderer_bundle", ":electron_isolated_renderer_bundle",
":electron_node_bundle", ":electron_node_bundle",
":electron_preload_realm_bundle",
":electron_renderer_bundle", ":electron_renderer_bundle",
":electron_sandboxed_renderer_bundle", ":electron_sandboxed_renderer_bundle",
":electron_utility_bundle", ":electron_utility_bundle",
@@ -250,7 +237,6 @@ action("electron_js2c") {
"$target_gen_dir/js2c/browser_init.js", "$target_gen_dir/js2c/browser_init.js",
"$target_gen_dir/js2c/isolated_bundle.js", "$target_gen_dir/js2c/isolated_bundle.js",
"$target_gen_dir/js2c/node_init.js", "$target_gen_dir/js2c/node_init.js",
"$target_gen_dir/js2c/preload_realm_bundle.js",
"$target_gen_dir/js2c/renderer_init.js", "$target_gen_dir/js2c/renderer_init.js",
"$target_gen_dir/js2c/sandbox_bundle.js", "$target_gen_dir/js2c/sandbox_bundle.js",
"$target_gen_dir/js2c/utility_init.js", "$target_gen_dir/js2c/utility_init.js",
@@ -422,7 +408,7 @@ action("electron_generate_node_defines") {
source_set("electron_lib") { source_set("electron_lib") {
configs += [ configs += [
"//v8:external_startup_data", "//v8:external_startup_data",
"//third_party/electron_node:node_external_config", "//third_party/electron_node:node_internals",
] ]
public_configs = [ public_configs = [
@@ -441,7 +427,6 @@ source_set("electron_lib") {
"chromium_src:chrome_spellchecker", "chromium_src:chrome_spellchecker",
"shell/common:mojo", "shell/common:mojo",
"shell/common:plugin", "shell/common:plugin",
"shell/common:web_contents_utility",
"shell/services/node/public/mojom", "shell/services/node/public/mojom",
"//base:base_static", "//base:base_static",
"//base/allocator:buildflags", "//base/allocator:buildflags",
@@ -498,7 +483,7 @@ source_set("electron_lib") {
"//third_party/blink/public:blink_devtools_inspector_resources", "//third_party/blink/public:blink_devtools_inspector_resources",
"//third_party/blink/public/platform/media", "//third_party/blink/public/platform/media",
"//third_party/boringssl", "//third_party/boringssl",
"//third_party/electron_node:libnode", "//third_party/electron_node:node_lib",
"//third_party/inspector_protocol:crdtp", "//third_party/inspector_protocol:crdtp",
"//third_party/leveldatabase", "//third_party/leveldatabase",
"//third_party/libyuv", "//third_party/libyuv",
@@ -533,10 +518,7 @@ source_set("electron_lib") {
"//third_party/blink/renderer", "//third_party/blink/renderer",
] ]
defines = [ defines = [ "V8_DEPRECATION_WARNINGS" ]
"BLINK_MOJO_IMPL=1",
"V8_DEPRECATION_WARNINGS",
]
libs = [] libs = []
if (is_linux) { if (is_linux) {
@@ -883,7 +865,6 @@ if (is_mac) {
":electron_framework_resources", ":electron_framework_resources",
":electron_swiftshader_library", ":electron_swiftshader_library",
":electron_xibs", ":electron_xibs",
"//third_party/electron_node:libnode",
] ]
if (!is_mas_build) { if (!is_mas_build) {
deps += [ ":electron_crashpad_helper" ] deps += [ ":electron_crashpad_helper" ]
@@ -939,6 +920,7 @@ if (is_mac) {
"shell/app/electron_main_mac.cc", "shell/app/electron_main_mac.cc",
"shell/app/uv_stdio_fix.cc", "shell/app/uv_stdio_fix.cc",
"shell/app/uv_stdio_fix.h", "shell/app/uv_stdio_fix.h",
"shell/common/electron_constants.cc",
] ]
include_dirs = [ "." ] include_dirs = [ "." ]
info_plist = "shell/renderer/resources/mac/Info.plist" info_plist = "shell/renderer/resources/mac/Info.plist"
@@ -1207,7 +1189,6 @@ if (is_mac) {
"//components/crash/core/app", "//components/crash/core/app",
"//content:sandbox_helper_win", "//content:sandbox_helper_win",
"//electron/buildflags", "//electron/buildflags",
"//third_party/electron_node:libnode",
"//ui/strings", "//ui/strings",
] ]
@@ -1519,8 +1500,21 @@ group("electron") {
##### node_headers ##### node_headers
node_dir = "../third_party/electron_node" node_dir = "../third_party/electron_node"
node_files = read_file("$node_dir/filenames.json", "json")
node_headers_dir = "$root_gen_dir/node_headers" node_headers_dir = "$root_gen_dir/node_headers"
header_group_index = 0
header_groups = []
foreach(header_group, node_files.headers) {
copy("node_headers_${header_group_index}") {
sources = rebase_path(header_group.files, ".", node_dir)
outputs =
[ "$node_headers_dir/${header_group.dest_dir}/{{source_file_part}}" ]
}
header_groups += [ ":node_headers_${header_group_index}" ]
header_group_index += 1
}
copy("zlib_headers") { copy("zlib_headers") {
sources = [ sources = [
"$node_dir/deps/zlib/zconf.h", "$node_dir/deps/zlib/zconf.h",
@@ -1541,19 +1535,13 @@ copy("node_gypi_headers") {
action("node_version_header") { action("node_version_header") {
inputs = [ "$node_dir/src/node_version.h" ] inputs = [ "$node_dir/src/node_version.h" ]
outputs = [ "$node_headers_dir/include/node/node_version.h" ] outputs = [ "$node_headers_dir/include/node/node_version.h" ]
script = "script/node/generate_node_version_header.py" script = "script/generate_node_version_header.py"
args = rebase_path(inputs) + rebase_path(outputs) args = rebase_path(inputs) + rebase_path(outputs)
if (node_module_version != "") { if (node_module_version != "") {
args += [ "$node_module_version" ] args += [ "$node_module_version" ]
} }
} }
action("generate_node_headers") {
deps = [ ":generate_config_gypi" ]
script = "script/node/generate_node_headers.py"
outputs = [ "$root_gen_dir/node_headers.json" ]
}
action("tar_node_headers") { action("tar_node_headers") {
deps = [ ":copy_node_headers" ] deps = [ ":copy_node_headers" ]
outputs = [ "$root_gen_dir/node_headers.tar.gz" ] outputs = [ "$root_gen_dir/node_headers.tar.gz" ]
@@ -1565,12 +1553,11 @@ action("tar_node_headers") {
} }
group("copy_node_headers") { group("copy_node_headers") {
public_deps = [ public_deps = header_groups + [
":generate_node_headers", ":node_gypi_headers",
":node_gypi_headers", ":node_version_header",
":node_version_header", ":zlib_headers",
":zlib_headers", ]
]
} }
group("node_headers") { group("node_headers") {

View File

@@ -12,7 +12,7 @@ propose changes to this document in a pull request.
## [Issues](https://electronjs.org/docs/development/issues) ## [Issues](https://electronjs.org/docs/development/issues)
Issues are created [here](https://github.com/electron/electron/issues/new/choose). Issues are created [here](https://github.com/electron/electron/issues/new).
* [How to Contribute in Issues](https://electronjs.org/docs/development/issues#how-to-contribute-in-issues) * [How to Contribute in Issues](https://electronjs.org/docs/development/issues#how-to-contribute-in-issues)
* [Asking for General Help](https://electronjs.org/docs/development/issues#asking-for-general-help) * [Asking for General Help](https://electronjs.org/docs/development/issues#asking-for-general-help)

4
DEPS
View File

@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
vars = { vars = {
'chromium_version': 'chromium_version':
'134.0.6990.0', '131.0.6752.0',
'node_version': 'node_version':
'v22.13.1', 'v20.17.0',
'nan_version': 'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213', 'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version': 'squirrel.mac_version':

View File

@@ -1,6 +1,7 @@
[![Electron Logo](https://electronjs.org/images/electron-logo.svg)](https://electronjs.org) [![Electron Logo](https://electronjs.org/images/electron-logo.svg)](https://electronjs.org)
[![GitHub Actions Build Status](https://github.com/electron/electron/actions/workflows/build.yml/badge.svg)](https://github.com/electron/electron/actions/workflows/build.yml) [![GitHub Actions Build Status](https://github.com/electron/electron/actions/workflows/build.yml/badge.svg)](https://github.com/electron/electron/actions/workflows/build.yml)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/4lggi9dpjc1qob7k/branch/main?svg=true)](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/main)
[![Electron Discord Invite](https://img.shields.io/discord/745037351163527189?color=%237289DA&label=chat&logo=discord&logoColor=white)](https://discord.gg/electronjs) [![Electron Discord Invite](https://img.shields.io/discord/745037351163527189?color=%237289DA&label=chat&logo=discord&logoColor=white)](https://discord.gg/electronjs)
:memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪. :memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪.

107
appveyor-bake.yml Normal file
View File

@@ -0,0 +1,107 @@
# The config is used to bake appveyor images, not for running CI jobs.
# The config expects the following environment variables to be set:
# - "APPVEYOR_BAKE_IMAGE" e.g. 'electron-99.0.4767.0'. Name of the image to be baked.
# Typically named after the Chromium version on which the image is built.
# This can be set dynamically in the prepare-appveyor script.
version: 1.0.{build}
build_cloud: electronhq-16-core
image: base-bake-image
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
PYTHONIOENCODING: UTF-8
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# init:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - appveyor version
# - ps: $ErrorActionPreference = 'Stop'
# - ps: 'Write-Host "OS Build: $((Get-CimInstance Win32_OperatingSystem).BuildNumber)"'
# clone_folder: '%USERPROFILE%\image-bake-scripts'
# clone_script:
# - ps: Invoke-WebRequest "https://github.com/appveyor/build-images/archive/1f90d94e74c8243c909a09b994e527584dfcb838.zip" -OutFile "$env:temp\scripts.zip"
# - ps: Expand-Archive -Path "$env:temp\scripts.zip" -DestinationPath "$env:temp\scripts" -Force
# - ps: Copy-Item -Path "$env:temp\scripts\build-images-1f90d94e74c8243c909a09b994e527584dfcb838\scripts\Windows\*" -Destination $env:APPVEYOR_BUILD_FOLDER -Recurse
build_script:
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# - ps: .\init_server.ps1
# - ps: .\extend_system_volume.ps1
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# - appveyor version
# - ps: .\install_path_utils.ps1
# - ps: .\install_powershell_core.ps1
# - ps: .\install_powershell_get.ps1
# - ps: .\install_7zip.ps1
# - ps: .\install_chocolatey.ps1
# - ps: .\install_webpi.ps1
# - ps: .\install_nuget.ps1
# - ps: .\install_pstools.ps1
# - ps: .\install_git.ps1
# - ps: .\install_git_lfs.ps1
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# END LINES FOR COMPLETELY NEW IMAGE
- git config --global core.longpaths true
- ps: >-
if (-not (Test-Path -Path C:\projects\src)) {
New-Item -Path C:\projects\src -ItemType Directory
}
- cd C:\projects\
- git clone -q --branch=%APPVEYOR_REPO_BRANCH% https://github.com/electron/electron.git C:\projects\src\electron
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- update_depot_tools.bat
# Uncomment the following line if windows deps change
- src\electron\script\setup-win-for-dev.bat
- >-
gclient config
--name "src\electron"
--unmanaged
%GCLIENT_EXTRA_ARGS%
"https://github.com/electron/electron"
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: Copy-Item -path .\.depshash -destination ..\.depshash
- ps: cd ..\..
- gclient sync --with_branch_heads --with_tags --nohooks
- ps: regsvr32 /s "C:\Program Files\Microsoft Visual Studio\2022\Community\DIA SDK\bin\amd64\msdia140.dll"
- ps: set vs2022_install="C:\Program Files\Microsoft Visual Studio\2022\Community"
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# - cd %USERPROFILE%\image-bake-scripts
# - appveyor version
# - ps: .\optimize_dotnet_runtime.ps1
# - ps: .\disable_windows_background_services.ps1
# - ps: .\enforce_windows_firewall.ps1
# - ps: .\cleanup_windows.ps1
# END LINES FOR COMPLETELY NEW IMAGE
on_image_bake:
- ps: >-
echo "Baking image: $env:APPVEYOR_BAKE_IMAGE at dir $PWD"
- ps: Remove-Item -Recurse -Force C:\projects\depot_tools
- ps: Remove-Item -Recurse -Force C:\projects\src\electron
# Uncomment these lines and set APPVEYOR_RDP_PASSWORD in project settings to enable RDP after bake is done
# # on_finish:
# - ps: >-
# $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

330
appveyor-woa.yml Normal file
View File

@@ -0,0 +1,330 @@
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor.yml
# IF APPLICABLE!!!!
#
#
# The config expects the following environment variables to be set:
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
# https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
# if you pass a custom value for 'target_cpu'.
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64'}.
# Is used in some publishing scripts, but does NOT affect the Electron binary.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
# Otherwise the release will be uploaded to the GitHub Releases.
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
#
# The publishing scripts expect access tokens to be defined as env vars,
# but those are not covered here.
#
# AppVeyor docs on variables:
# https://www.appveyor.com/docs/environment-variables/
# https://www.appveyor.com/docs/build-configuration/#secure-variables
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-131.0.6734.0-node-20.17-0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_7393122652: 3ba76c5c20
PYTHONIOENCODING: UTF-8
matrix:
- job_name: Build Arm on X64 Windows
- job_name: Test On Windows On Arm Hardware
job_depends_on: Build Arm on X64 Windows
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
clone_script:
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
clone_folder: C:\projects\src\electron
skip_branch_with_pr: true
# the first failed job cancels other jobs and fails entire build
matrix:
fast_finish: true
for:
- matrix:
only:
- job_name: Build Arm on X64 Windows
build_script:
# TODO: Remove --ignore-engines once WOA image is up to node 20
- ps: |
node script/yarn.js install --frozen-lockfile --ignore-engines
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc-only change"
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- ps: >-
if (Test-Path -Path "$pwd\depot_tools") {
Remove-Item -Recurse -Force $pwd\depot_tools
}
- ps: >-
if (Test-Path -Path "$pwd\build-tools") {
Remove-Item -Recurse -Force $pwd\build-tools
}
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
- depot_tools\bootstrap\win_tools.bat
- ps: |
Set-Content -Path $pwd\depot_tools\build_telemetry.cfg -Value '{"user": "info@electronjs.org", "status": "opt-out", "countdown": 10, "version": 1}'
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npx yarn --ignore-engines
- mkdir third_party
- ps: >-
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
- ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})"
- ps: >-
& $env:RECLIENT_HELPER login
- ps: >-
$env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
- ps: >-
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
- ps: >-
$env:RBE_experimental_credentials_helper_args = "print"
- ps: >-
if ($env:ELECTRON_RBE_JWT -eq '') {
$env:RBE_fail_early_min_action_count = "0"
$env:RBE_fail_early_min_fallback_ratio = "0"
$env:RBE_exec_strategy = "local"
$env:RBE_remote_update_cache= "false"
}
- cd ..\..
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
# Patches are applied in the image bake. Check depshash to see if patches have changed.
- ps: $env:RUN_GCLIENT_SYNC="false"
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: cd ..\..
- ps: >-
if ($depshash_baked -ne $depshash) {
$env:RUN_GCLIENT_SYNC="true"
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
- cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common:mojo
- gn check out/Default //electron/shell/common:plugin
- if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
- autoninja -C out/Default electron:electron_dist_zip
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args
- ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
- autoninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- autoninja -C out/Default electron:hunspell_dictionaries_zip
- autoninja -C out/Default electron:electron_chromedriver_zip
- autoninja -C out/Default electron:node_headers
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
- 7z a nan.zip third_party\nan
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
}
- if "%GN_CONFIG%"=="release" ( autoninja -C out/Default electron:electron_symbols )
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
}
- ps: |
$manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:TARGET_ARCH.manifest"
python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
if ($LASTEXITCODE -ne 0) {
throw "Zip contains files not listed in the manifest $manifest_file"
}
- ps: |
cd C:\projects\src
$missing_artifacts = $false
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
} else {
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip','nan.zip'
foreach($artifact_name in $artifacts_to_validate) {
if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\ffmpeg\ffmpeg.zip"
} elseif (
$artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name
} elseif (
$artifact_name -eq 'nan.zip') {
$artifact_file = $artifact_name
} else {
$artifact_file = "out\Default\$artifact_name"
}
if (-not(Test-Path $artifact_file)) {
Write-warning "$artifact_name is missing and cannot be added to artifacts"
$missing_artifacts = $true
}
}
}
if ($missing_artifacts) {
throw "Build failed due to missing artifacts"
}
deploy_script:
- cd electron
- ps: >-
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
Write-Output "Uploading Electron release distribution to azure"
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
} else {
Write-Output "Uploading Electron release distribution to github releases"
& python3 script\release\uploaders\upload.py --verbose
}
}
on_finish:
# Uncomment this lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist nan.zip (appveyor-retry appveyor PushArtifact nan.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
}
- matrix:
only:
- job_name: Test On Windows On Arm Hardware
environment:
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile --ignore-engines
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- cd ..
- mkdir out\Default
- cd ..
- ps: |
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','electron.lib', 'nan.zip')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build Arm on X64 Windows") {
$jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name"
} else {
$outfile = $artifact_name
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
7z x -y -osrc pdb.zip
}
}
- ps: |
$out_default_zips = @('dist.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip
- ps: 7z x -y -osrc nan.zip
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
- ps: |
cd src
New-Item .\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
- set npm_config_nodedir=%cd%\out\Default\gen\node_headers
- set npm_config_arch=arm64
- cd electron
# Explicitly set npm_config_arch because the .env doesn't persist
- ps: >-
if ($env:TARGET_ARCH -eq 'ia32') {
$env:npm_config_arch = "ia32"
}
- echo Running main test suite & node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
- cd ..
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
on_finish:
# Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

322
appveyor.yml Normal file
View File

@@ -0,0 +1,322 @@
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor-woa.yml
# IF APPLICABLE!!!!
#
#
# The config expects the following environment variables to be set:
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
# https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
# if you pass a custom value for 'target_cpu'.
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64'}.
# Is used in some publishing scripts, but does NOT affect the Electron binary.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
# Otherwise the release will be uploaded to the GitHub Releases.
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
#
# The publishing scripts expect access tokens to be defined as env vars,
# but those are not covered here.
#
# AppVeyor docs on variables:
# https://www.appveyor.com/docs/environment-variables/
# https://www.appveyor.com/docs/build-configuration/#secure-variables
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-131.0.6734.0-node-20.17-0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_7393122652: 3ba76c5c20
PYTHONIOENCODING: UTF-8
matrix:
- job_name: Build
- job_name: Test
job_depends_on: Build
clone_script:
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
clone_folder: C:\projects\src\electron
skip_branch_with_pr: true
# the first failed job cancels other jobs and fails entire build
matrix:
fast_finish: true
for:
- matrix:
only:
- job_name: Build
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc-only change"
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- ps: >-
if (Test-Path -Path "$pwd\depot_tools") {
Remove-Item -Recurse -Force $pwd\depot_tools
}
- ps: >-
if (Test-Path -Path "$pwd\build-tools") {
Remove-Item -Recurse -Force $pwd\build-tools
}
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
- depot_tools\bootstrap\win_tools.bat
- ps: |
Set-Content -Path $pwd\depot_tools\build_telemetry.cfg -Value '{"user": "info@electronjs.org", "status": "opt-out", "countdown": 10, "version": 1}'
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npx yarn --ignore-engines
- mkdir third_party
- ps: >-
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
- ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})"
- ps: >-
& $env:RECLIENT_HELPER login
- ps: >-
$env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
- ps: >-
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
- ps: >-
$env:RBE_experimental_credentials_helper_args = "print"
- ps: >-
if ($env:ELECTRON_RBE_JWT -eq '') {
$env:RBE_fail_early_min_action_count = "0"
$env:RBE_fail_early_min_fallback_ratio = "0"
$env:RBE_exec_strategy = "local"
$env:RBE_remote_update_cache= "false"
}
- cd ..\..
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
# Patches are applied in the image bake. Check depshash to see if patches have changed.
- ps: $env:RUN_GCLIENT_SYNC="false"
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: cd ..\..
- ps: >-
if ($depshash_baked -ne $depshash) {
$env:RUN_GCLIENT_SYNC="true"
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
- cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common:mojo
- gn check out/Default //electron/shell/common:plugin
- if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
- autoninja -C out/Default electron:electron_dist_zip
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args
- ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
- autoninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- autoninja -C out/Default electron:hunspell_dictionaries_zip
- autoninja -C out/Default electron:electron_chromedriver_zip
- autoninja -C out/Default electron:node_headers
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
}
- if "%GN_CONFIG%"=="release" ( autoninja -C out/Default electron:electron_symbols )
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
}
- ps: |
$manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:TARGET_ARCH.manifest"
python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
if ($LASTEXITCODE -ne 0) {
throw "Zip contains files not listed in the manifest $manifest_file"
}
- ps: |
cd C:\projects\src
$missing_artifacts = $false
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
} else {
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip'
foreach($artifact_name in $artifacts_to_validate) {
if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\ffmpeg\ffmpeg.zip"
} elseif (
$artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name
} else {
$artifact_file = "out\Default\$artifact_name"
}
if (-not(Test-Path $artifact_file)) {
Write-warning "$artifact_name is missing and cannot be added to artifacts"
$missing_artifacts = $true
}
}
}
if ($missing_artifacts) {
throw "Build failed due to missing artifacts"
}
deploy_script:
- cd electron
- ps: >-
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
Write-Output "Uploading Electron release distribution to azure"
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
} else {
Write-Output "Uploading Electron release distribution to github releases"
& python3 script\release\uploaders\upload.py --verbose
}
}
on_finish:
# Uncomment this lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
}
- matrix:
only:
- job_name: Test
init:
- ps: |
if ($env:RUN_TESTS -ne 'true') {
Write-warning "Skipping tests for $env:APPVEYOR_PROJECT_NAME"; Exit-AppveyorBuild
}
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- cd ..
- mkdir out\Default
- cd ..
- ps: |
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build") {
$jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name"
} else {
$outfile = $artifact_name
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
7z x -y -osrc pdb.zip
}
}
- ps: |
$out_default_zips = @('dist.zip','chromedriver.zip','mksnapshot.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
- ps: |
cd src
New-Item .\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
- cd electron
# Explicitly set npm_config_arch because the .env doesn't persist
- ps: >-
if ($env:TARGET_ARCH -eq 'ia32') {
$env:npm_config_arch = "ia32"
}
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging
- cd ..
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
- echo "About to verify mksnapshot"
- echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd%
- echo "Done verifying mksnapshot"
- echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd%
- echo "Done verifying chromedriver"
on_finish:
# Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

View File

@@ -2,7 +2,7 @@ is_electron_build = true
root_extra_deps = [ "//electron" ] root_extra_deps = [ "//electron" ]
# Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json # Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json
node_module_version = 133 node_module_version = 130
v8_promise_internal_field_count = 1 v8_promise_internal_field_count = 1
v8_embedder_string = "-electron.0" v8_embedder_string = "-electron.0"
@@ -14,8 +14,8 @@ v8_enable_snapshot_native_code_counters = false
v8_enable_javascript_promise_hooks = true v8_enable_javascript_promise_hooks = true
enable_cdm_host_verification = false enable_cdm_host_verification = false
ffmpeg_branding = "Chrome"
proprietary_codecs = true proprietary_codecs = true
ffmpeg_branding = "Chrome"
enable_printing = true enable_printing = true
@@ -48,8 +48,7 @@ enable_cet_shadow_stack = false
is_cfi = false is_cfi = false
# TODO: fix this once sysroots have been updated. # TODO: fix this once sysroots have been updated.
use_qt5 = false use_qt = false
use_qt6 = false
# Disables the builtins PGO for V8 # Disables the builtins PGO for V8
v8_builtins_profiling_log_file = "" v8_builtins_profiling_log_file = ""
@@ -66,6 +65,11 @@ v8_enable_private_mapping_fork_optimization = true
# Expose public V8 symbols for native modules. # Expose public V8 symbols for native modules.
v8_expose_public_symbols = true v8_expose_public_symbols = true
# Disables unsafe-buffers-usage plugin due to incompatibilities with our reclient implementation
# Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5426599
# Ref: https://github.com/electron/electron/commit/8e20f16ea35eeaeb149ae63bad3703d782665f6a
clang_unsafe_buffers_paths = ""
# Disable snapshotting a page when printing for its content to be analyzed for # Disable snapshotting a page when printing for its content to be analyzed for
# sensitive content by enterprise users. # sensitive content by enterprise users.
enterprise_cloud_content_analysis = false enterprise_cloud_content_analysis = false
@@ -73,11 +77,3 @@ enterprise_cloud_content_analysis = false
# TODO: remove dependency on legacy ipc # TODO: remove dependency on legacy ipc
# https://issues.chromium.org/issues/40943039 # https://issues.chromium.org/issues/40943039
content_enable_legacy_ipc = true content_enable_legacy_ipc = true
# Electron has its own unsafe-buffers enforcement directories.
# TODO: clang_unsafe_buffers_paths = "//electron/electron_unsafe_buffers_paths.txt"
#
# Disables unsafe-buffers-usage plugin due to incompatibilities with our reclient implementation
# Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5426599
# Ref: https://github.com/electron/electron/commit/8e20f16ea35eeaeb149ae63bad3703d782665f6a
clang_unsafe_buffers_paths = ""

View File

@@ -1,7 +1,7 @@
import("//electron/build/args/all.gn") import("all.gn")
is_component_build = false is_component_build = false
is_component_ffmpeg = true is_component_ffmpeg = true
is_official_build = true is_official_build = true
proprietary_codecs = false
ffmpeg_branding = "Chromium" ffmpeg_branding = "Chromium"
enable_dsyms = false enable_dsyms = false
proprietary_codecs = false

View File

@@ -1,7 +1,14 @@
import("//electron/build/args/all.gn") import("all.gn")
is_component_build = false is_component_build = false
is_official_build = true is_official_build = true
# This may be guarded behind is_chrome_branded alongside
# proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
# explicitly override here to build OpenH264 encoder/FFmpeg decoder.
# The initialization of the decoder depends on whether ffmpeg has
# been built with H.264 support.
rtc_use_h264 = proprietary_codecs
# By default, Electron builds ffmpeg with proprietary codecs enabled. In order # By default, Electron builds ffmpeg with proprietary codecs enabled. In order
# to facilitate users who don't want to ship proprietary codecs in ffmpeg, or # to facilitate users who don't want to ship proprietary codecs in ffmpeg, or
# who have an LGPL requirement to ship ffmpeg as a dynamically linked library, # who have an LGPL requirement to ship ffmpeg as a dynamically linked library,

View File

@@ -1,7 +1,14 @@
import("//electron/build/args/all.gn") import("all.gn")
is_debug = false is_debug = false
is_component_build = false is_component_build = false
is_component_ffmpeg = true is_component_ffmpeg = true
is_official_build = false is_official_build = false
dcheck_always_on = true dcheck_always_on = true
symbol_level = 1 symbol_level = 1
# This may be guarded behind is_chrome_branded alongside
# proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
# explicitly override here to build OpenH264 encoder/FFmpeg decoder.
# The initialization of the decoder depends on whether ffmpeg has
# been built with H.264 support.
rtc_use_h264 = proprietary_codecs

View File

@@ -2,7 +2,7 @@ import os
import re import re
import sys import sys
DEFINE_EXTRACT_REGEX = re.compile(r'^ *# *define (\w*)', re.MULTILINE) DEFINE_EXTRACT_REGEX = re.compile('^ *# *define (\w*)', re.MULTILINE)
def main(out_dir, headers): def main(out_dir, headers):
defines = [] defines = []

View File

@@ -29,7 +29,7 @@ template("compile_ib_files") {
_output_extension = invoker.output_extension _output_extension = invoker.output_extension
script = "//build/config/apple/compile_ib_files.py" script = "//build/config/ios/compile_ib_files.py"
sources = invoker.sources sources = invoker.sources
outputs = [ outputs = [
"$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension", "$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",

View File

@@ -1,6 +0,0 @@
module.exports = require('./webpack.config.base')({
target: 'preload_realm',
alwaysHasNode: false,
wrapInitWithProfilingTimeout: true,
wrapInitWithTryCatch: true
});

View File

@@ -30,10 +30,10 @@ static_library("chrome") {
"//chrome/browser/devtools/devtools_file_system_indexer.cc", "//chrome/browser/devtools/devtools_file_system_indexer.cc",
"//chrome/browser/devtools/devtools_file_system_indexer.h", "//chrome/browser/devtools/devtools_file_system_indexer.h",
"//chrome/browser/devtools/devtools_settings.h", "//chrome/browser/devtools/devtools_settings.h",
"//chrome/browser/devtools/features.cc",
"//chrome/browser/devtools/features.h",
"//chrome/browser/devtools/visual_logging.cc", "//chrome/browser/devtools/visual_logging.cc",
"//chrome/browser/devtools/visual_logging.h", "//chrome/browser/devtools/visual_logging.h",
"//chrome/browser/extensions/global_shortcut_listener.cc",
"//chrome/browser/extensions/global_shortcut_listener.h",
"//chrome/browser/file_system_access/file_system_access_features.cc", "//chrome/browser/file_system_access/file_system_access_features.cc",
"//chrome/browser/file_system_access/file_system_access_features.h", "//chrome/browser/file_system_access/file_system_access_features.h",
"//chrome/browser/icon_loader.cc", "//chrome/browser/icon_loader.cc",
@@ -68,8 +68,6 @@ static_library("chrome") {
"//chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker_observer.h", "//chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker_observer.h",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc", "//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.h",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager_uma_helper.cc",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager_uma_helper.h",
"//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.cc", "//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.cc",
"//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.h", "//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.h",
"//chrome/browser/platform_util.cc", "//chrome/browser/platform_util.cc",
@@ -146,8 +144,6 @@ static_library("chrome") {
"//chrome/browser/ui/webui/accessibility/accessibility_ui.h", "//chrome/browser/ui/webui/accessibility/accessibility_ui.h",
"//extensions/browser/app_window/size_constraints.cc", "//extensions/browser/app_window/size_constraints.cc",
"//extensions/browser/app_window/size_constraints.h", "//extensions/browser/app_window/size_constraints.h",
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.cc",
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.h",
"//ui/views/native_window_tracker.h", "//ui/views/native_window_tracker.h",
] ]
@@ -157,15 +153,19 @@ static_library("chrome") {
if (is_win) { if (is_win) {
sources += [ sources += [
"//chrome/browser/extensions/global_shortcut_listener_win.cc",
"//chrome/browser/extensions/global_shortcut_listener_win.h",
"//chrome/browser/icon_loader_win.cc", "//chrome/browser/icon_loader_win.cc",
"//chrome/browser/media/webrtc/window_icon_util_win.cc", "//chrome/browser/media/webrtc/window_icon_util_win.cc",
"//chrome/browser/process_singleton_win.cc", "//chrome/browser/process_singleton_win.cc",
"//chrome/browser/ui/frame/window_frame_util.h",
"//chrome/browser/win/chrome_process_finder.cc", "//chrome/browser/win/chrome_process_finder.cc",
"//chrome/browser/win/chrome_process_finder.h", "//chrome/browser/win/chrome_process_finder.h",
"//chrome/browser/win/chrome_select_file_dialog_factory.cc", "//chrome/browser/win/chrome_select_file_dialog_factory.cc",
"//chrome/browser/win/chrome_select_file_dialog_factory.h", "//chrome/browser/win/chrome_select_file_dialog_factory.h",
"//chrome/browser/win/titlebar_config.cc", "//chrome/browser/win/titlebar_config.cc",
"//chrome/browser/win/titlebar_config.h", "//chrome/browser/win/titlebar_config.h",
"//chrome/browser/win/titlebar_config.h",
"//chrome/browser/win/util_win_service.cc", "//chrome/browser/win/util_win_service.cc",
"//chrome/browser/win/util_win_service.h", "//chrome/browser/win/util_win_service.h",
"//chrome/child/v8_crashpad_support_win.cc", "//chrome/child/v8_crashpad_support_win.cc",
@@ -178,15 +178,15 @@ static_library("chrome") {
} }
public_deps = [ public_deps = [
"//chrome/browser:dev_ui_browser_resources",
"//chrome/browser/resources/accessibility:resources", "//chrome/browser/resources/accessibility:resources",
"//chrome/browser/ui/color:color_headers",
"//chrome/browser/ui/color:mixers", "//chrome/browser/ui/color:mixers",
"//chrome/common", "//chrome/common",
"//chrome/common:version_header", "//chrome/common:version_header",
"//components/global_media_controls",
"//components/keyed_service/content", "//components/keyed_service/content",
"//components/paint_preview/buildflags", "//components/paint_preview/buildflags",
"//components/proxy_config", "//components/proxy_config",
"//components/services/language_detection/public/mojom",
"//content/public/browser", "//content/public/browser",
"//services/strings", "//services/strings",
] ]
@@ -195,16 +195,13 @@ static_library("chrome") {
"//chrome/app/vector_icons", "//chrome/app/vector_icons",
"//chrome/browser:resource_prefetch_predictor_proto", "//chrome/browser:resource_prefetch_predictor_proto",
"//chrome/browser/resource_coordinator:mojo_bindings", "//chrome/browser/resource_coordinator:mojo_bindings",
"//chrome/browser/task_manager/common:impl",
"//chrome/browser/ui/webui/tab_search:mojo_bindings", "//chrome/browser/ui/webui/tab_search:mojo_bindings",
"//chrome/browser/web_applications/mojom:mojom_web_apps_enum", "//chrome/browser/web_applications/mojom:mojom_web_apps_enum",
"//components/enterprise/buildflags", "//components/enterprise/buildflags",
"//components/enterprise/common/proto:browser_events_proto",
"//components/enterprise/common/proto:connectors_proto", "//components/enterprise/common/proto:connectors_proto",
"//components/enterprise/obfuscation/core:enterprise_obfuscation", "//components/enterprise/obfuscation/core:enterprise_obfuscation",
"//components/safe_browsing/core/browser/db:safebrowsing_proto", "//components/safe_browsing/core/browser/db:safebrowsing_proto",
"//components/vector_icons:vector_icons", "//components/vector_icons:vector_icons",
"//ui/base/accelerators/global_accelerator_listener",
"//ui/snapshot", "//ui/snapshot",
"//ui/views/controls/webview", "//ui/views/controls/webview",
] ]
@@ -220,11 +217,14 @@ static_library("chrome") {
} }
if (is_linux) { if (is_linux) {
sources += [ sources += [ "//chrome/browser/icon_loader_auralinux.cc" ]
"//chrome/browser/icon_loader_auralinux.cc", if (use_ozone) {
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.cc", deps += [ "//ui/ozone" ]
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.h", sources += [
] "//chrome/browser/extensions/global_shortcut_listener_ozone.cc",
"//chrome/browser/extensions/global_shortcut_listener_ozone.h",
]
}
sources += [ sources += [
"//chrome/browser/ui/views/status_icons/concat_menu_model.cc", "//chrome/browser/ui/views/status_icons/concat_menu_model.cc",
"//chrome/browser/ui/views/status_icons/concat_menu_model.h", "//chrome/browser/ui/views/status_icons/concat_menu_model.h",
@@ -235,7 +235,10 @@ static_library("chrome") {
"//chrome/browser/ui/views/dark_mode_manager_linux.cc", "//chrome/browser/ui/views/dark_mode_manager_linux.cc",
"//chrome/browser/ui/views/dark_mode_manager_linux.h", "//chrome/browser/ui/views/dark_mode_manager_linux.h",
] ]
public_deps += [ "//components/dbus" ] public_deps += [
"//components/dbus/menu",
"//components/dbus/thread_linux",
]
} }
if (is_win) { if (is_win) {
@@ -257,6 +260,8 @@ static_library("chrome") {
if (is_mac) { if (is_mac) {
sources += [ sources += [
"//chrome/browser/extensions/global_shortcut_listener_mac.h",
"//chrome/browser/extensions/global_shortcut_listener_mac.mm",
"//chrome/browser/icon_loader_mac.mm", "//chrome/browser/icon_loader_mac.mm",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h", "//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm", "//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",

View File

@@ -93,7 +93,9 @@ async function loadApplicationPackage (packagePath: string) {
try { try {
process.emitWarning = () => {}; process.emitWarning = () => {};
packageJson = (await import(url.pathToFileURL(packageJsonPath).toString(), { packageJson = (await import(url.pathToFileURL(packageJsonPath).toString(), {
with: { type: 'json' } assert: {
type: 'json'
}
})).default; })).default;
} catch (e) { } catch (e) {
showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${(e as Error).message}`); showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${(e as Error).message}`);

View File

@@ -21,6 +21,7 @@ an issue:
### Getting started ### Getting started
* [Introduction](tutorial/introduction.md) * [Introduction](tutorial/introduction.md)
* [Quick Start](tutorial/quick-start.md)
* [Process Model](tutorial/process-model.md) * [Process Model](tutorial/process-model.md)
### Learning the basics ### Learning the basics
@@ -127,7 +128,6 @@ These individual tutorials expand on topics discussed in the guide above.
* [pushNotifications](api/push-notifications.md) * [pushNotifications](api/push-notifications.md)
* [safeStorage](api/safe-storage.md) * [safeStorage](api/safe-storage.md)
* [screen](api/screen.md) * [screen](api/screen.md)
* [ServiceWorkerMain](api/service-worker-main.md)
* [session](api/session.md) * [session](api/session.md)
* [ShareMenu](api/share-menu.md) * [ShareMenu](api/share-menu.md)
* [systemPreferences](api/system-preferences.md) * [systemPreferences](api/system-preferences.md)

33
docs/api/app.md Normal file → Executable file
View File

@@ -416,7 +416,7 @@ Returns:
* `launch-failed` - Process never successfully launched * `launch-failed` - Process never successfully launched
* `integrity-failure` - Windows code integrity checks failed * `integrity-failure` - Windows code integrity checks failed
* `exitCode` number - The exit code for the process * `exitCode` number - The exit code for the process
(e.g. status from waitpid if on POSIX, from GetExitCodeProcess on Windows). (e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).
* `serviceName` string (optional) - The non-localized name of the process. * `serviceName` string (optional) - The non-localized name of the process.
* `name` string (optional) - The name of the process. * `name` string (optional) - The name of the process.
Examples for utility: `Audio Service`, `Content Decryption Module Service`, `Network Service`, `Video Capture`, etc. Examples for utility: `Audio Service`, `Content Decryption Module Service`, `Network Service`, `Video Capture`, etc.
@@ -514,20 +514,20 @@ and `will-quit` events will not be emitted.
* `args` string[] (optional) * `args` string[] (optional)
* `execPath` string (optional) * `execPath` string (optional)
Relaunches the app when the current instance exits. Relaunches the app when current instance exits.
By default, the new instance will use the same working directory and command line By default, the new instance will use the same working directory and command line
arguments as the current instance. When `args` is specified, the `args` will be arguments with current instance. When `args` is specified, the `args` will be
passed as the command line arguments instead. When `execPath` is specified, the passed as command line arguments instead. When `execPath` is specified, the
`execPath` will be executed for the relaunch instead of the current app. `execPath` will be executed for relaunch instead of current app.
Note that this method does not quit the app when executed. You have to call Note that this method does not quit the app when executed, you have to call
`app.quit` or `app.exit` after calling `app.relaunch` to make the app restart. `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
When `app.relaunch` is called multiple times, multiple instances will be When `app.relaunch` is called for multiple times, multiple instances will be
started after the current instance exits. started after current instance exited.
An example of restarting the current instance immediately and adding a new command An example of restarting current instance immediately and adding a new command
line argument to the new instance: line argument to the new instance:
```js ```js
@@ -1302,24 +1302,23 @@ Returns `Object`:
Set the app's login item settings. Set the app's login item settings.
To work with Electron's `autoUpdater` on Windows, which uses [Squirrel][Squirrel-Windows], To work with Electron's `autoUpdater` on Windows, which uses [Squirrel][Squirrel-Windows],
you'll want to set the launch path to your executable's name but a directory up, which is you'll want to set the launch path to Update.exe, and pass arguments that specify your
a stub application automatically generated by Squirrel which will automatically launch the application name. For example:
latest version.
``` js ``` js
const { app } = require('electron') const { app } = require('electron')
const path = require('node:path') const path = require('node:path')
const appFolder = path.dirname(process.execPath) const appFolder = path.dirname(process.execPath)
const ourExeName = path.basename(process.execPath) const updateExe = path.resolve(appFolder, '..', 'Update.exe')
const stubLauncher = path.resolve(appFolder, '..', ourExeName) const exeName = path.basename(process.execPath)
app.setLoginItemSettings({ app.setLoginItemSettings({
openAtLogin: true, openAtLogin: true,
path: stubLauncher, path: updateExe,
args: [ args: [
// You might want to pass a parameter here indicating that this '--processStart', `"${exeName}"`,
// app was launched via login, but you don't have to '--process-start-args', '"--hidden"'
] ]
}) })
``` ```

View File

@@ -68,7 +68,7 @@ Emitted when there is an error while updating.
### Event: 'checking-for-update' ### Event: 'checking-for-update'
Emitted when checking for an available update has started. Emitted when checking if an update has started.
### Event: 'update-available' ### Event: 'update-available'

View File

@@ -64,31 +64,6 @@ const child = new BaseWindow({ parent, modal: true })
* On Linux the type of modal windows will be changed to `dialog`. * On Linux the type of modal windows will be changed to `dialog`.
* On Linux many desktop environments do not support hiding a modal window. * On Linux many desktop environments do not support hiding a modal window.
## Resource management
When you add a [`WebContentsView`](web-contents-view.md) to a `BaseWindow` and the `BaseWindow`
is closed, the [`webContents`](web-contents.md) of the `WebContentsView` are not destroyed
automatically.
It is your responsibility to close the `webContents` when you no longer need them, e.g. when
the `BaseWindow` is closed:
```js
const { BaseWindow, WebContentsView } = require('electron')
const win = new BaseWindow({ width: 800, height: 600 })
const view = new WebContentsView()
win.contentView.addChildView(view)
win.on('closed', () => {
view.webContents.close()
})
```
Unlike with a [`BrowserWindow`](browser-window.md), if you don't explicitly close the
`webContents`, you'll encounter memory leaks.
## Class: BaseWindow ## Class: BaseWindow
> Create and control windows. > Create and control windows.
@@ -144,24 +119,10 @@ _**Note**: There is a subtle difference between the behaviors of `window.onbefor
Emitted when the window is closed. After you have received this event you should Emitted when the window is closed. After you have received this event you should
remove the reference to the window and avoid using it any more. remove the reference to the window and avoid using it any more.
#### Event: 'query-session-end' _Windows_
Returns:
* `event` [WindowSessionEndEvent][window-session-end-event]
Emitted when a session is about to end due to a shutdown, machine restart, or user log-off.
Calling `event.preventDefault()` can delay the system shutdown, though its generally best
to respect the users choice to end the session. However, you may choose to use it if
ending the session puts the user at risk of losing data.
#### Event: 'session-end' _Windows_ #### Event: 'session-end' _Windows_
Returns: Emitted when window session is going to end due to force shutdown or machine restart
or session log off.
* `event` [WindowSessionEndEvent][window-session-end-event]
Emitted when a session is about to end due to a shutdown, machine restart, or user log-off. Once this event fires, there is no way to prevent the session from ending.
#### Event: 'blur' #### Event: 'blur'
@@ -526,7 +487,7 @@ Sets the content view of the window.
#### `win.getContentView()` #### `win.getContentView()`
Returns [`View`](view.md) - The content view of the window. Returns [View](view.md) - The content view of the window.
#### `win.destroy()` #### `win.destroy()`
@@ -1443,4 +1404,3 @@ On Linux, the `symbolColor` is automatically calculated to have minimum accessib
[vibrancy-docs]: https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc [vibrancy-docs]: https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc
[window-levels]: https://developer.apple.com/documentation/appkit/nswindow/level [window-levels]: https://developer.apple.com/documentation/appkit/nswindow/level
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter [event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
[window-session-end-event]:../api/structures/window-session-end-event.md

View File

@@ -207,24 +207,10 @@ _**Note**: There is a subtle difference between the behaviors of `window.onbefor
Emitted when the window is closed. After you have received this event you should Emitted when the window is closed. After you have received this event you should
remove the reference to the window and avoid using it any more. remove the reference to the window and avoid using it any more.
#### Event: 'query-session-end' _Windows_
Returns:
* `event` [WindowSessionEndEvent][window-session-end-event]
Emitted when a session is about to end due to a shutdown, machine restart, or user log-off.
Calling `event.preventDefault()` can delay the system shutdown, though its generally best
to respect the users choice to end the session. However, you may choose to use it if
ending the session puts the user at risk of losing data.
#### Event: 'session-end' _Windows_ #### Event: 'session-end' _Windows_
Returns: Emitted when window session is going to end due to force shutdown or machine restart
or session log off.
* `event` [WindowSessionEndEvent][window-session-end-event]
Emitted when a session is about to end due to a shutdown, machine restart, or user log-off. Once this event fires, there is no way to prevent the session from ending.
#### Event: 'unresponsive' #### Event: 'unresponsive'
@@ -1563,17 +1549,13 @@ there is only one tab in the current window.
Adds a window as a tab on this window, after the tab for the window instance. Adds a window as a tab on this window, after the tab for the window instance.
#### `win.setVibrancy(type[, options])` _macOS_ #### `win.setVibrancy(type)` _macOS_
* `type` string | null - Can be `titlebar`, `selection`, `menu`, `popover`, `sidebar`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. See * `type` string | null - Can be `titlebar`, `selection`, `menu`, `popover`, `sidebar`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. See
the [macOS documentation][vibrancy-docs] for more details. the [macOS documentation][vibrancy-docs] for more details.
* `options` Object (optional)
* `animationDuration` number (optional) - if greater than zero, the change to vibrancy will be animated over the given duration (in milliseconds).
Adds a vibrancy effect to the browser window. Passing `null` or an empty string Adds a vibrancy effect to the browser window. Passing `null` or an empty string
will remove the vibrancy effect on the window. The `animationDuration` parameter only will remove the vibrancy effect on the window.
animates fading in or fading out the vibrancy effect. Animating between
different types of vibrancy is not supported.
#### `win.setBackgroundMaterial(material)` _Windows_ #### `win.setBackgroundMaterial(material)` _Windows_
@@ -1686,4 +1668,3 @@ On Linux, the `symbolColor` is automatically calculated to have minimum accessib
[vibrancy-docs]: https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc [vibrancy-docs]: https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc
[window-levels]: https://developer.apple.com/documentation/appkit/nswindow/level [window-levels]: https://developer.apple.com/documentation/appkit/nswindow/level
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter [event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
[window-session-end-event]:../api/structures/window-session-end-event.md

View File

@@ -38,7 +38,7 @@ Without `*` prefix the URL has to match exactly.
### --disable-ntlm-v2 ### --disable-ntlm-v2
Disables NTLM v2 for POSIX platforms, no effect elsewhere. Disables NTLM v2 for posix platforms, no effect elsewhere.
### --disable-http-cache ### --disable-http-cache
@@ -241,13 +241,6 @@ Force using discrete GPU when there are multiple GPUs available.
Force using integrated GPU when there are multiple GPUs available. Force using integrated GPU when there are multiple GPUs available.
### --xdg-portal-required-version=`version`
Sets the minimum required version of XDG portal implementation to `version`
in order to use the portal backend for file dialogs on linux. File dialogs
will fallback to using gtk or kde depending on the desktop environment when
the required version is unavailable. Current default is set to `3`.
## Node.js Flags ## Node.js Flags
Electron supports some of the [CLI flags][node-cli] supported by Node.js. Electron supports some of the [CLI flags][node-cli] supported by Node.js.

View File

@@ -61,20 +61,6 @@ The `contextBridge` module has the following methods:
* `apiKey` string - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`. * `apiKey` string - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`.
* `api` any - Your API, more information on what this API can be and how it works is available below. * `api` any - Your API, more information on what this API can be and how it works is available below.
### `contextBridge.executeInMainWorld(executionScript)` _Experimental_
<!-- TODO(samuelmaddock): add generics to map the `args` types to the `func` params -->
* `executionScript` Object
* `func` (...args: any[]) => any - A JavaScript function to execute. This function will be serialized which means
that any bound parameters and execution context will be lost.
* `args` any[] (optional) - An array of arguments to pass to the provided function. These
arguments will be copied between worlds in accordance with
[the table of supported types.](#parameter--error--return-type-support)
Returns `any` - A copy of the resulting value from executing the function in the main world.
[Refer to the table](#parameter--error--return-type-support) on how values are copied between worlds.
## Usage ## Usage
### API ### API

View File

@@ -74,7 +74,7 @@ The following methods are available on instances of `Cookies`:
`url`. Empty implies retrieving cookies of all URLs. `url`. Empty implies retrieving cookies of all URLs.
* `name` string (optional) - Filters cookies by name. * `name` string (optional) - Filters cookies by name.
* `domain` string (optional) - Retrieves cookies whose domains match or are * `domain` string (optional) - Retrieves cookies whose domains match or are
subdomains of `domains`. subdomains of `domain`.
* `path` string (optional) - Retrieves cookies whose path matches `path`. * `path` string (optional) - Retrieves cookies whose path matches `path`.
* `secure` boolean (optional) - Filters cookies by their Secure property. * `secure` boolean (optional) - Filters cookies by their Secure property.
* `session` boolean (optional) - Filters out session or persistent cookies. * `session` boolean (optional) - Filters out session or persistent cookies.

View File

@@ -78,11 +78,6 @@ dialog.showOpenDialogSync(mainWindow, {
}) })
``` ```
**Note:** On Linux `defaultPath` is not supported when using portal file chooser
dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
[command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
to force gtk or kde dialogs.
### `dialog.showOpenDialog([window, ]options)` ### `dialog.showOpenDialog([window, ]options)`
* `window` [BaseWindow](base-window.md) (optional) * `window` [BaseWindow](base-window.md) (optional)
@@ -155,11 +150,6 @@ dialog.showOpenDialog(mainWindow, {
}) })
``` ```
**Note:** On Linux `defaultPath` is not supported when using portal file chooser
dialogs unless the portal backend is version 4 or higher. You can use `--xdg-portal-required-version`
[command-line switch](./command-line-switches.md#--xdg-portal-required-versionversion)
to force gtk or kde dialogs.
### `dialog.showSaveDialogSync([window, ]options)` ### `dialog.showSaveDialogSync([window, ]options)`
* `window` [BaseWindow](base-window.md) (optional) * `window` [BaseWindow](base-window.md) (optional)
@@ -360,7 +350,7 @@ On Windows the options are more limited, due to the Win32 APIs used:
## Bookmarks array ## Bookmarks array
`showOpenDialog` and `showSaveDialog` resolve to an object with a `bookmarks` field. This field is an array of Base64 encoded strings that contain the [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) data for the saved file. The `securityScopedBookmarks` option must be enabled for this to be present. `showOpenDialog`, `showOpenDialogSync`, `showSaveDialog`, and `showSaveDialogSync` will return a `bookmarks` array.
| Build Type | securityScopedBookmarks boolean | Return Type | Return Value | | Build Type | securityScopedBookmarks boolean | Return Type | Return Value |
|------------|---------------------------------|:-----------:|--------------------------------| |------------|---------------------------------|:-----------:|--------------------------------|

View File

@@ -12,17 +12,9 @@ shortcuts.
not have the keyboard focus. This module cannot be used before the `ready` not have the keyboard focus. This module cannot be used before the `ready`
event of the app module is emitted. event of the app module is emitted.
Please also note that it is also possible to use Chromium's
`GlobalShortcutsPortal` implementation, which allows apps to bind global
shortcuts when running within a Wayland session.
```js ```js
const { app, globalShortcut } = require('electron') const { app, globalShortcut } = require('electron')
// Enable usage of Portal's globalShortcuts. This is essential for cases when
// the app runs in a Wayland session.
app.commandLine.appendSwitch('enable-features', 'GlobalShortcutsPortal')
app.whenReady().then(() => { app.whenReady().then(() => {
// Register a 'CommandOrControl+X' shortcut listener. // Register a 'CommandOrControl+X' shortcut listener.
const ret = globalShortcut.register('CommandOrControl+X', () => { const ret = globalShortcut.register('CommandOrControl+X', () => {

View File

@@ -10,13 +10,13 @@ The `inAppPurchase` module emits the following events:
### Event: 'transactions-updated' ### Event: 'transactions-updated'
Emitted when one or more transactions have been updated.
Returns: Returns:
* `event` Event * `event` Event
* `transactions` Transaction[] - Array of [`Transaction`](structures/transaction.md) objects. * `transactions` Transaction[] - Array of [`Transaction`](structures/transaction.md) objects.
Emitted when one or more transactions have been updated.
## Methods ## Methods
The `inAppPurchase` module has the following methods: The `inAppPurchase` module has the following methods:

View File

@@ -1,75 +0,0 @@
## Class: IpcMainServiceWorker
> Communicate asynchronously from the main process to service workers.
Process: [Main](../glossary.md#main-process)
> [!NOTE]
> This API is a subtle variation of [`IpcMain`](ipc-main.md)—targeted for
> communicating with service workers. For communicating with web frames,
> consult the `IpcMain` documentation.
<!-- TODO(samuelmaddock): refactor doc gen to allow generics to reduce duplication -->
### Instance Methods
#### `ipcMainServiceWorker.on(channel, listener)`
* `channel` string
* `listener` Function
* `event` [IpcMainServiceWorkerEvent][ipc-main-service-worker-event]
* `...args` any[]
Listens to `channel`, when a new message arrives `listener` would be called with
`listener(event, args...)`.
#### `ipcMainServiceWorker.once(channel, listener)`
* `channel` string
* `listener` Function
* `event` [IpcMainServiceWorkerEvent][ipc-main-service-worker-event]
* `...args` any[]
Adds a one time `listener` function for the event. This `listener` is invoked
only the next time a message is sent to `channel`, after which it is removed.
#### `ipcMainServiceWorker.removeListener(channel, listener)`
* `channel` string
* `listener` Function
* `...args` any[]
Removes the specified `listener` from the listener array for the specified
`channel`.
#### `ipcMainServiceWorker.removeAllListeners([channel])`
* `channel` string (optional)
Removes listeners of the specified `channel`.
#### `ipcMainServiceWorker.handle(channel, listener)`
* `channel` string
* `listener` Function\<Promise\<any\> | any\>
* `event` [IpcMainServiceWorkerInvokeEvent][ipc-main-service-worker-invoke-event]
* `...args` any[]
#### `ipcMainServiceWorker.handleOnce(channel, listener)`
* `channel` string
* `listener` Function\<Promise\<any\> | any\>
* `event` [IpcMainServiceWorkerInvokeEvent][ipc-main-service-worker-invoke-event]
* `...args` any[]
Handles a single `invoke`able IPC message, then removes the listener. See
`ipcMainServiceWorker.handle(channel, listener)`.
#### `ipcMainServiceWorker.removeHandler(channel)`
* `channel` string
Removes any handler for `channel`, if present.
[ipc-main-service-worker-event]:../api/structures/ipc-main-service-worker-event.md
[ipc-main-service-worker-invoke-event]:../api/structures/ipc-main-service-worker-invoke-event.md

View File

@@ -32,7 +32,7 @@ process, see [webContents.send][web-contents-send] for more information.
## Methods ## Methods
The `ipcMain` module has the following methods to listen for events: The `ipcMain` module has the following method to listen for events:
### `ipcMain.on(channel, listener)` ### `ipcMain.on(channel, listener)`
@@ -44,16 +44,6 @@ The `ipcMain` module has the following methods to listen for events:
Listens to `channel`, when a new message arrives `listener` would be called with Listens to `channel`, when a new message arrives `listener` would be called with
`listener(event, args...)`. `listener(event, args...)`.
### `ipcMain.off(channel, listener)`
* `channel` string
* `listener` Function
* `event` [IpcMainEvent][ipc-main-event]
* `...args` any[]
Removes the specified `listener` from the listener array for the specified
`channel`.
### `ipcMain.once(channel, listener)` ### `ipcMain.once(channel, listener)`
* `channel` string * `channel` string
@@ -64,28 +54,20 @@ Removes the specified `listener` from the listener array for the specified
Adds a one time `listener` function for the event. This `listener` is invoked Adds a one time `listener` function for the event. This `listener` is invoked
only the next time a message is sent to `channel`, after which it is removed. only the next time a message is sent to `channel`, after which it is removed.
### `ipcMain.addListener(channel, listener)`
* `channel` string
* `listener` Function
* `event` [IpcMainEvent][ipc-main-event]
* `...args` any[]
Alias for [`ipcMain.on`](#ipcmainonchannel-listener).
### `ipcMain.removeListener(channel, listener)` ### `ipcMain.removeListener(channel, listener)`
* `channel` string * `channel` string
* `listener` Function * `listener` Function
* `...args` any[] * `...args` any[]
Alias for [`ipcMain.off`](#ipcmainoffchannel-listener). Removes the specified `listener` from the listener array for the specified
`channel`.
### `ipcMain.removeAllListeners([channel])` ### `ipcMain.removeAllListeners([channel])`
* `channel` string (optional) * `channel` string (optional)
Removes all listeners from the specified `channel`. Removes all listeners from all channels if no channel is specified. Removes listeners of the specified `channel`.
### `ipcMain.handle(channel, listener)` ### `ipcMain.handle(channel, listener)`

View File

@@ -41,16 +41,6 @@ The `ipcRenderer` module has the following method to listen for events and send
Listens to `channel`, when a new message arrives `listener` would be called with Listens to `channel`, when a new message arrives `listener` would be called with
`listener(event, args...)`. `listener(event, args...)`.
:::warning
Do not expose the `event` argument to the renderer for security reasons! Wrap any
callback that you receive from the renderer in another function like this:
`ipcRenderer.on('my-channel', (event, ...args) => callback(...args))`.
Not wrapping the callback in such a function would expose dangerous Electron APIs
to the renderer process. See the
[security guide](../tutorial/security.md#20-do-not-expose-electron-apis-to-untrusted-web-content)
for more info.
:::
### `ipcRenderer.off(channel, listener)` ### `ipcRenderer.off(channel, listener)`
* `channel` string * `channel` string
@@ -58,8 +48,7 @@ for more info.
* `event` [IpcRendererEvent][ipc-renderer-event] * `event` [IpcRendererEvent][ipc-renderer-event]
* `...args` any[] * `...args` any[]
Removes the specified `listener` from the listener array for the specified Alias for [`ipcRenderer.removeListener`](#ipcrendererremovelistenerchannel-listener).
`channel`.
### `ipcRenderer.once(channel, listener)` ### `ipcRenderer.once(channel, listener)`
@@ -87,13 +76,14 @@ Alias for [`ipcRenderer.on`](#ipcrendereronchannel-listener).
* `event` [IpcRendererEvent][ipc-renderer-event] * `event` [IpcRendererEvent][ipc-renderer-event]
* `...args` any[] * `...args` any[]
Alias for [`ipcRenderer.off`](#ipcrendereroffchannel-listener). Removes the specified `listener` from the listener array for the specified
`channel`.
### `ipcRenderer.removeAllListeners([channel])` ### `ipcRenderer.removeAllListeners(channel)`
* `channel` string (optional) * `channel` string
Removes all listeners from the specified `channel`. Removes all listeners from all channels if no channel is specified. Removes all listeners, or those of the specified `channel`.
### `ipcRenderer.send(channel, ...args)` ### `ipcRenderer.send(channel, ...args)`

View File

@@ -72,7 +72,7 @@ The `menu` object has the following instance methods:
#### `menu.popup([options])` #### `menu.popup([options])`
* `options` Object (optional) * `options` Object (optional)
* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window. * `window` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
* `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. 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.
@@ -86,13 +86,13 @@ The `menu` object has the following instance methods:
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`. 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). Pops up this menu as a context menu in the [`BrowserWindow`](browser-window.md).
#### `menu.closePopup([window])` #### `menu.closePopup([browserWindow])`
* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window. * `browserWindow` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
Closes the context menu in the `window`. Closes the context menu in the `browserWindow`.
#### `menu.append(menuItem)` #### `menu.append(menuItem)`

View File

@@ -26,10 +26,7 @@ Emitted when system changes to battery power.
### Event: 'thermal-state-change' _macOS_ ### Event: 'thermal-state-change' _macOS_
Returns: * `state` string - The system's new thermal state. Can be `unknown`, `nominal`, `fair`, `serious`, `critical`.
* `details` Event\<\>
* `state` string - The system's new thermal state. Can be `unknown`, `nominal`, `fair`, `serious`, `critical`.
Emitted when the thermal state of the system changes. Notification of a change Emitted when the thermal state of the system changes. Notification of a change
in the thermal status of the system, such as entering a critical temperature in the thermal status of the system, such as entering a critical temperature
@@ -45,10 +42,7 @@ See https://developer.apple.com/library/archive/documentation/Performance/Concep
### Event: 'speed-limit-change' _macOS_ _Windows_ ### Event: 'speed-limit-change' _macOS_ _Windows_
Returns: * `limit` number - The operating system's advertised speed limit for CPUs, in percent.
* `details` Event\<\>
* `limit` number - The operating system's advertised speed limit for CPUs, in percent.
Notification of a change in the operating system's advertised speed limit for Notification of a change in the operating system's advertised speed limit for
CPUs, in percent. Values below 100 indicate that the system is impairing CPUs, in percent. Values below 100 indicate that the system is impairing

View File

@@ -114,7 +114,6 @@ A `string` representing the current process's type, can be:
* `browser` - The main process * `browser` - The main process
* `renderer` - A renderer process * `renderer` - A renderer process
* `service-worker` - In a service worker
* `worker` - In a web worker * `worker` - In a web worker
* `utility` - In a node process launched as a service * `utility` - In a node process launched as a service

View File

@@ -1,54 +0,0 @@
# 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._
### Instance Methods
#### `serviceWorker.isDestroyed()` _Experimental_
Returns `boolean` - Whether the service worker has been destroyed.
#### `serviceWorker.send(channel, ...args)` _Experimental_
- `channel` string
- `...args` any[]
Send an asynchronous message to the service worker process via `channel`, along with
arguments. Arguments will be serialized with the [Structured Clone Algorithm][SCA],
just like [`postMessage`][], so prototype chains will not be included.
Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
The service worker process can handle the message by listening to `channel` with the
[`ipcRenderer`](ipc-renderer.md) module.
#### `serviceWorker.startTask()` _Experimental_
Returns `Object`:
- `end` Function - Method to call when the task has ended. If never called, the service won't terminate while otherwise idle.
Initiate a task to keep the service worker alive until ended.
### Instance Properties
#### `serviceWorker.ipc` _Readonly_ _Experimental_
An [`IpcMainServiceWorker`](ipc-main-service-worker.md) instance scoped to the service worker.
#### `serviceWorker.scope` _Readonly_ _Experimental_
A `string` representing the scope URL of the service worker.
#### `serviceWorker.versionId` _Readonly_ _Experimental_
A `number` representing the ID of the specific version of the service worker script in its scope.
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

View File

@@ -56,17 +56,6 @@ Returns:
Emitted when a service worker has been registered. Can occur after a call to [`navigator.serviceWorker.register('/sw.js')`](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register) successfully resolves or when a Chrome extension is loaded. Emitted when a service worker has been registered. Can occur after a call to [`navigator.serviceWorker.register('/sw.js')`](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register) successfully resolves or when a Chrome extension is loaded.
#### Event: 'running-status-changed' _Experimental_
Returns:
* `details` Event\<\>
* `versionId` number - ID of the updated service worker version
* `runningStatus` string - Running status.
Possible values include `starting`, `running`, `stopping`, or `stopped`.
Emitted when a service worker's running status has changed.
### Instance Methods ### Instance Methods
The following methods are available on instances of `ServiceWorkers`: The following methods are available on instances of `ServiceWorkers`:
@@ -75,55 +64,10 @@ The following methods are available on instances of `ServiceWorkers`:
Returns `Record<number, ServiceWorkerInfo>` - A [ServiceWorkerInfo](structures/service-worker-info.md) object where the keys are the service worker version ID and the values are the information about that service worker. Returns `Record<number, ServiceWorkerInfo>` - A [ServiceWorkerInfo](structures/service-worker-info.md) object where the keys are the service worker version ID and the values are the information about that service worker.
#### `serviceWorkers.getInfoFromVersionID(versionId)` #### `serviceWorkers.getFromVersionID(versionId)`
* `versionId` number - ID of the service worker version * `versionId` number
Returns [`ServiceWorkerInfo`](structures/service-worker-info.md) - Information about this service worker Returns [`ServiceWorkerInfo`](structures/service-worker-info.md) - Information about this service worker
If the service worker does not exist or is not running this method will throw an exception. If the service worker does not exist or is not running this method will throw an exception.
#### `serviceWorkers.getFromVersionID(versionId)` _Deprecated_
* `versionId` number - ID of the service worker version
Returns [`ServiceWorkerInfo`](structures/service-worker-info.md) - Information about this service worker
If the service worker does not exist or is not running this method will throw an exception.
**Deprecated:** Use the new `serviceWorkers.getInfoFromVersionID` API.
#### `serviceWorkers.getWorkerFromVersionID(versionId)` _Experimental_
* `versionId` number - ID of the service worker version
Returns [`ServiceWorkerMain | undefined`](service-worker-main.md) - Instance of the service worker associated with the given version ID. If there's no associated version, or its running status has changed to 'stopped', this will return `undefined`.
#### `serviceWorkers.startWorkerForScope(scope)` _Experimental_
* `scope` string - The scope of the service worker to start.
Returns `Promise<ServiceWorkerMain>` - Resolves with the service worker when it's started.
Starts the service worker or does nothing if already running.
```js
const { app, session } = require('electron')
const { serviceWorkers } = session.defaultSession
// Collect service workers scopes
const workerScopes = Object.values(serviceWorkers.getAllRunning()).map((info) => info.scope)
app.on('browser-window-created', async (event, window) => {
for (const scope of workerScopes) {
try {
// Ensure worker is started
const serviceWorker = await serviceWorkers.startWorkerForScope(scope)
serviceWorker.send('window-created', { windowId: window.id })
} catch (error) {
console.error(`Failed to start service worker for ${scope}`)
console.error(error)
}
}
})
```

View File

@@ -27,8 +27,7 @@ The `session` module has the following methods:
* `partition` string * `partition` string
* `options` Object (optional) * `options` Object (optional)
* `cache` boolean - Whether to enable cache. Default is `true` unless the * `cache` boolean - Whether to enable cache.
[`--disable-http-cache` switch](command-line-switches.md#--disable-http-cache) is used.
Returns `Session` - A session instance from `partition` string. When there is an existing Returns `Session` - A session instance from `partition` string. When there is an existing
`Session` with the same `partition`, it will be returned; otherwise a new `Session` with the same `partition`, it will be returned; otherwise a new
@@ -47,8 +46,7 @@ of an existing `Session` object.
* `path` string * `path` string
* `options` Object (optional) * `options` Object (optional)
* `cache` boolean - Whether to enable cache. Default is `true` unless the * `cache` boolean - Whether to enable cache.
[`--disable-http-cache` switch](command-line-switches.md#--disable-http-cache) is used.
Returns `Session` - A session instance from the absolute path as specified by the `path` Returns `Session` - A session instance from the absolute path as specified by the `path`
string. When there is an existing `Session` with the same absolute path, it string. When there is an existing `Session` with the same absolute path, it
@@ -270,8 +268,7 @@ Returns:
* `event` Event * `event` Event
* `details` Object * `details` Object
* `deviceList` [HIDDevice[]](structures/hid-device.md) * `deviceList` [HIDDevice[]](structures/hid-device.md)
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event. * `frame` [WebFrameMain](web-frame-main.md)
May be `null` if accessed after the frame has either navigated or been destroyed.
* `callback` Function * `callback` Function
* `deviceId` string | null (optional) * `deviceId` string | null (optional)
@@ -335,8 +332,7 @@ Returns:
* `event` Event * `event` Event
* `details` Object * `details` Object
* `device` [HIDDevice](structures/hid-device.md) * `device` [HIDDevice](structures/hid-device.md)
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event. * `frame` [WebFrameMain](web-frame-main.md)
May be `null` if accessed after the frame has either navigated or been destroyed.
Emitted after `navigator.hid.requestDevice` has been called and Emitted after `navigator.hid.requestDevice` has been called and
`select-hid-device` has fired if a new device becomes available before `select-hid-device` has fired if a new device becomes available before
@@ -351,8 +347,7 @@ Returns:
* `event` Event * `event` Event
* `details` Object * `details` Object
* `device` [HIDDevice](structures/hid-device.md) * `device` [HIDDevice](structures/hid-device.md)
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event. * `frame` [WebFrameMain](web-frame-main.md)
May be `null` if accessed after the frame has either navigated or been destroyed.
Emitted after `navigator.hid.requestDevice` has been called and Emitted after `navigator.hid.requestDevice` has been called and
`select-hid-device` has fired if a device has been removed before the callback `select-hid-device` has fired if a device has been removed before the callback
@@ -478,8 +473,7 @@ Returns:
* `event` Event * `event` Event
* `details` Object * `details` Object
* `port` [SerialPort](structures/serial-port.md) * `port` [SerialPort](structures/serial-port.md)
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event. * `frame` [WebFrameMain](web-frame-main.md)
May be `null` if accessed after the frame has either navigated or been destroyed.
* `origin` string - The origin that the device has been revoked from. * `origin` string - The origin that the device has been revoked from.
Emitted after `SerialPort.forget()` has been called. This event can be used Emitted after `SerialPort.forget()` has been called. This event can be used
@@ -523,8 +517,7 @@ Returns:
* `event` Event * `event` Event
* `details` Object * `details` Object
* `deviceList` [USBDevice[]](structures/usb-device.md) * `deviceList` [USBDevice[]](structures/usb-device.md)
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event. * `frame` [WebFrameMain](web-frame-main.md)
May be `null` if accessed after the frame has either navigated or been destroyed.
* `callback` Function * `callback` Function
* `deviceId` string (optional) * `deviceId` string (optional)
@@ -933,7 +926,6 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
* `storage-access` - Allows content loaded in a third-party context to request access to third-party cookies using the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API). * `storage-access` - Allows content loaded in a third-party context to request access to third-party cookies using the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API).
* `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). * `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). * `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")`
* `requestingOrigin` string - The origin URL of the permission check * `requestingOrigin` string - The origin URL of the permission check
* `details` Object - Some properties are only available on certain permission types. * `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. * `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.
@@ -965,8 +957,7 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
* `handler` Function | null * `handler` Function | null
* `request` Object * `request` Object
* `frame` [WebFrameMain](web-frame-main.md) | null - Frame that is requesting access to media. * `frame` [WebFrameMain](web-frame-main.md) - Frame that is requesting access to media.
May be `null` if accessed after the frame has either navigated or been destroyed.
* `securityOrigin` String - Origin of the page making the request. * `securityOrigin` String - Origin of the page making the request.
* `videoRequested` Boolean - true if the web content requested a video stream. * `videoRequested` Boolean - true if the web content requested a video stream.
* `audioRequested` Boolean - true if the web content requested an audio stream. * `audioRequested` Boolean - true if the web content requested an audio stream.
@@ -1167,8 +1158,7 @@ app.whenReady().then(() => {
pin displayed on the device. pin displayed on the device.
* `providePin` * `providePin`
This prompt is requesting that a pin be provided for the device. This prompt is requesting that a pin be provided for the device.
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this handler. * `frame` [WebFrameMain](web-frame-main.md)
May be `null` if accessed after the frame has either navigated or been destroyed.
* `pin` string (optional) - The pin value to verify if `pairingKind` is `confirmPin`. * `pin` string (optional) - The pin value to verify if `pairingKind` is `confirmPin`.
* `callback` Function * `callback` Function
* `response` Object * `response` Object
@@ -1331,43 +1321,18 @@ the initial state will be `interrupted`. The download will start only when the
Returns `Promise<void>` - resolves when the sessions HTTP authentication cache has been cleared. Returns `Promise<void>` - resolves when the sessions HTTP authentication cache has been cleared.
#### `ses.setPreloads(preloads)` _Deprecated_ #### `ses.setPreloads(preloads)`
* `preloads` string[] - An array of absolute path to preload scripts * `preloads` string[] - An array of absolute path to preload scripts
Adds scripts that will be executed on ALL web contents that are associated with Adds scripts that will be executed on ALL web contents that are associated with
this session just before normal `preload` scripts run. this session just before normal `preload` scripts run.
**Deprecated:** Use the new `ses.registerPreloadScript` API. #### `ses.getPreloads()`
#### `ses.getPreloads()` _Deprecated_
Returns `string[]` an array of paths to preload scripts that have been Returns `string[]` an array of paths to preload scripts that have been
registered. registered.
**Deprecated:** Use the new `ses.getPreloadScripts` API. This will only return preload script paths
for `frame` context types.
#### `ses.registerPreloadScript(script)`
* `script` [PreloadScriptRegistration](structures/preload-script-registration.md) - Preload script
Registers preload script that will be executed in its associated context type in this session. For
`frame` contexts, this will run prior to any preload defined in the web preferences of a
WebContents.
Returns `string` - The ID of the registered preload script.
#### `ses.unregisterPreloadScript(id)`
* `id` string - Preload script ID
Unregisters script.
#### `ses.getPreloadScripts()`
Returns [`PreloadScript[]`](structures/preload-script.md): An array of paths to preload scripts that have been registered.
#### `ses.setCodeCachePath(path)` #### `ses.setCodeCachePath(path)`
* `path` String - Absolute path to store the v8 generated JS code cache from the renderer. * `path` String - Absolute path to store the v8 generated JS code cache from the renderer.
@@ -1386,36 +1351,6 @@ specified when registering the protocol.
Returns `Promise<void>` - resolves when the code cache clear operation is complete. Returns `Promise<void>` - resolves when the code cache clear operation is complete.
#### `ses.getSharedDictionaryUsageInfo()`
Returns `Promise<SharedDictionaryUsageInfo[]>` - an array of shared dictionary information entries in Chromium's networking service's storage.
Shared dictionaries are used to power advanced compression of data sent over the wire, specifically with Brotli and ZStandard. You don't need to call any of the shared dictionary APIs in Electron to make use of this advanced web feature, but if you do, they allow deeper control and inspection of the shared dictionaries used during decompression.
To get detailed information about a specific shared dictionary entry, call `getSharedDictionaryInfo(options)`.
#### `ses.getSharedDictionaryInfo(options)`
* `options` Object
* `frameOrigin` string - The origin of the frame where the request originates. Its specific to the individual frame making the request and is defined by its scheme, host, and port. In practice, will look like a URL.
* `topFrameSite` string - The site of the top-level browsing context (the main frame or tab that contains the request). Its less granular than `frameOrigin` and focuses on the broader "site" scope. In practice, will look like a URL.
Returns `Promise<SharedDictionaryInfo[]>` - an array of shared dictionary information entries in Chromium's networking service's storage.
To get information about all present shared dictionaries, call `getSharedDictionaryUsageInfo()`.
#### `ses.clearSharedDictionaryCache()`
Returns `Promise<void>` - resolves when the dictionary cache has been cleared, both in memory and on disk.
#### `ses.clearSharedDictionaryCacheForIsolationKey(options)`
* `options` Object
* `frameOrigin` string - The origin of the frame where the request originates. Its specific to the individual frame making the request and is defined by its scheme, host, and port. In practice, will look like a URL.
* `topFrameSite` string - The site of the top-level browsing context (the main frame or tab that contains the request). Its less granular than `frameOrigin` and focuses on the broader "site" scope. In practice, will look like a URL.
Returns `Promise<void>` - resolves when the dictionary cache has been cleared for the specified isolation key, both in memory and on disk.
#### `ses.setSpellCheckerEnabled(enable)` #### `ses.setSpellCheckerEnabled(enable)`
* `enable` boolean * `enable` boolean
@@ -1541,25 +1476,6 @@ Unloads an extension.
**Note:** This API cannot be called before the `ready` event of the `app` module **Note:** This API cannot be called before the `ready` event of the `app` module
is emitted. is emitted.
#### `ses.enableExtension(extensionId)`
* `extensionId` string - ID of extension to enable
Enables the extension and activates it for use by starting any background
workers. If the extension is disabled, marks it as enabled.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
#### `ses.disableExtension(extensionId)`
* `extensionId` string - ID of extension to disable
Disables the extension and deactives it.
**Note:** This API cannot be called before the `ready` event of the `app` module
is emitted.
#### `ses.getExtension(extensionId)` #### `ses.getExtension(extensionId)`
* `extensionId` string - ID of extension to query * `extensionId` string - ID of extension to query
@@ -1584,11 +1500,9 @@ session is persisted on disk. For in memory sessions this returns `null`.
#### `ses.clearData([options])` #### `ses.clearData([options])`
* `options` Object (optional) * `options` Object (optional)
* `dataTypes` String[] (optional) - The types of data to clear. By default, this will clear all types of data. This * `dataTypes` String[] (optional) - The types of data to clear. By default, this will clear all types of data.
can potentially include data types not explicitly listed here. (See Chromium's
[`BrowsingDataRemover`][browsing-data-remover] for the full list.)
* `backgroundFetch` - Background Fetch * `backgroundFetch` - Background Fetch
* `cache` - Cache (includes `cachestorage` and `shadercache`) * `cache` - Cache
* `cookies` - Cookies * `cookies` - Cookies
* `downloads` - Downloads * `downloads` - Downloads
* `fileSystems` - File Systems * `fileSystems` - File Systems
@@ -1612,9 +1526,7 @@ This method clears more types of data and is more thorough than the
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`. **Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
**Note:** Clearing cache data will also clear the shared dictionary cache. This means that any dictionaries used for compression may be reloaded after clearing the cache. If you wish to clear the shared dictionary cache but leave other cached data intact, you may want to use the `clearSharedDictionaryCache` method. For more information, refer to Chromium's [`BrowsingDataRemover` interface](https://source.chromium.org/chromium/chromium/src/+/main:content/public/browser/browsing_data_remover.h).
For more information, refer to Chromium's [`BrowsingDataRemover` interface][browsing-data-remover].
### Instance Properties ### Instance Properties
@@ -1680,5 +1592,3 @@ app.whenReady().then(async () => {
console.log('Net-logs written to', path) console.log('Net-logs written to', path)
}) })
``` ```
[browsing-data-remover]: https://source.chromium.org/chromium/chromium/src/+/main:content/public/browser/browsing_data_remover.h

View File

@@ -36,7 +36,7 @@ Open the given file in the desktop's default manner.
### `shell.openExternal(url[, options])` ### `shell.openExternal(url[, options])`
* `url` string - Max 2081 characters on Windows. * `url` string - Max 2081 characters on windows.
* `options` Object (optional) * `options` Object (optional)
* `activate` boolean (optional) _macOS_ - `true` to bring the opened application to the foreground. The default is `true`. * `activate` boolean (optional) _macOS_ - `true` to bring the opened application to the foreground. The default is `true`.
* `workingDirectory` string (optional) _Windows_ - The working directory. * `workingDirectory` string (optional) _Windows_ - The working directory.

View File

@@ -49,7 +49,7 @@
* `show` boolean (optional) - Whether window should be shown when created. Default is * `show` boolean (optional) - Whether window should be shown when created. Default is
`true`. `true`.
* `frame` boolean (optional) - Specify `false` to create a * `frame` boolean (optional) - Specify `false` to create a
[frameless window](../../tutorial/custom-window-styles.md#frameless-windows). Default is `true`. [frameless window](../../tutorial/window-customization.md#create-frameless-windows). Default is `true`.
* `parent` BaseWindow (optional) - Specify parent window. Default is `null`. * `parent` BaseWindow (optional) - Specify parent window. Default is `null`.
* `modal` boolean (optional) - Whether this is a modal window. This only works when the * `modal` boolean (optional) - Whether this is a modal window. This only works when the
window is a child window. Default is `false`. window is a child window. Default is `false`.
@@ -70,7 +70,7 @@
is only implemented on Windows and macOS. is only implemented on Windows and macOS.
* `darkTheme` boolean (optional) - Forces using dark theme for the window, only works on * `darkTheme` boolean (optional) - Forces using dark theme for the window, only works on
some GTK+3 desktop environments. Default is `false`. some GTK+3 desktop environments. Default is `false`.
* `transparent` boolean (optional) - Makes the window [transparent](../../tutorial/custom-window-styles.md#transparent-windows). * `transparent` boolean (optional) - Makes the window [transparent](../../tutorial/window-customization.md#create-transparent-windows).
Default is `false`. On Windows, does not work unless the window is frameless. Default is `false`. On Windows, does not work unless the window is frameless.
* `type` string (optional) - The type of window, default is normal window. See more about * `type` string (optional) - The type of window, default is normal window. See more about
this below. this below.
@@ -149,7 +149,7 @@ Possible values are:
focus, keyboard or mouse events, but you can use `globalShortcut` to receive focus, keyboard or mouse events, but you can use `globalShortcut` to receive
input sparingly. input sparingly.
* The `panel` type enables the window to float on top of full-screened apps * The `panel` type enables the window to float on top of full-screened apps
by adding the `NSWindowStyleMaskNonactivatingPanel` style mask, normally by adding the `NSWindowStyleMaskNonactivatingPanel` style mask,normally
reserved for NSPanel, at runtime. Also, the window will appear on all reserved for NSPanel, at runtime. Also, the window will appear on all
spaces (desktops). spaces (desktops).
* On Windows, possible type is `toolbar`. * On Windows, possible type is `toolbar`.

View File

@@ -5,7 +5,7 @@
* `colorDepth` number - The number of bits per pixel. * `colorDepth` number - The number of bits per pixel.
* `colorSpace` string - represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions. * `colorSpace` string - represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions.
* `depthPerComponent` number - The number of bits per color component. * `depthPerComponent` number - The number of bits per color component.
* `detected` boolean - `true` if the display is detected by the system. * `detected` boolean - `true`` if the display is detected by the system.
* `displayFrequency` number - The display refresh rate. * `displayFrequency` number - The display refresh rate.
* `id` number - Unique identifier associated with the display. A value of of -1 means the display is invalid or the correct `id` is not yet known, and a value of -10 means the display is a virtual display assigned to a unified desktop. * `id` number - Unique identifier associated with the display. A value of of -1 means the display is invalid or the correct `id` is not yet known, and a value of -10 means the display is a virtual display assigned to a unified desktop.
* `internal` boolean - `true` for an internal display and `false` for an external display. * `internal` boolean - `true` for an internal display and `false` for an external display.

View File

@@ -1,11 +1,10 @@
# IpcMainEvent Object extends `Event` # IpcMainEvent Object extends `Event`
* `type` String - Possible values include `frame`
* `processId` Integer - The internal ID of the renderer process that sent this message * `processId` Integer - The internal ID of the renderer process that sent this message
* `frameId` Integer - The ID of the renderer frame that sent this message * `frameId` Integer - The ID of the renderer frame that sent this message
* `returnValue` any - Set this to the value to be returned in a synchronous message * `returnValue` any - Set this to the value to be returned in a synchronous message
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message * `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
* `senderFrame` [WebFrameMain](../web-frame-main.md) | null _Readonly_ - The frame that sent this message. May be `null` if accessed after the frame has either navigated or been destroyed. * `senderFrame` [WebFrameMain](../web-frame-main.md) _Readonly_ - The frame that sent this message
* `ports` [MessagePortMain](../message-port-main.md)[] - A list of MessagePorts that were transferred with this message * `ports` [MessagePortMain](../message-port-main.md)[] - A list of MessagePorts that were transferred with this message
* `reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame. * `reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame.
* `channel` string * `channel` string

View File

@@ -1,7 +1,6 @@
# IpcMainInvokeEvent Object extends `Event` # IpcMainInvokeEvent Object extends `Event`
* `type` String - Possible values include `frame`
* `processId` Integer - The internal ID of the renderer process that sent this message * `processId` Integer - The internal ID of the renderer process that sent this message
* `frameId` Integer - The ID of the renderer frame that sent this message * `frameId` Integer - The ID of the renderer frame that sent this message
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message * `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
* `senderFrame` [WebFrameMain](../web-frame-main.md) | null _Readonly_ - The frame that sent this message. May be `null` if accessed after the frame has either navigated or been destroyed. * `senderFrame` [WebFrameMain](../web-frame-main.md) _Readonly_ - The frame that sent this message

View File

@@ -1,11 +0,0 @@
# IpcMainServiceWorkerEvent Object extends `Event`
* `type` String - Possible values include `service-worker`.
* `serviceWorker` [ServiceWorkerMain](../service-worker-main.md) _Readonly_ - The service worker that sent this message
* `versionId` Number - The service worker version ID.
* `session` Session - The [`Session`](../session.md) instance with which the event is associated.
* `returnValue` any - Set this to the value to be returned in a synchronous message
* `ports` [MessagePortMain](../message-port-main.md)[] - A list of MessagePorts that were transferred with this message
* `reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame.
* `channel` string
* `...args` any[]

View File

@@ -1,6 +0,0 @@
# IpcMainServiceWorkerInvokeEvent Object extends `Event`
* `type` String - Possible values include `service-worker`.
* `serviceWorker` [ServiceWorkerMain](../service-worker-main.md) _Readonly_ - The service worker that sent this message
* `versionId` Number - The service worker version ID.
* `session` Session - The [`Session`](../session.md) instance with which the event is associated.

View File

@@ -1,6 +0,0 @@
# PreloadScriptRegistration Object
* `type` string - Context type where the preload script will be executed.
Possible values include `frame` or `service-worker`.
* `id` string (optional) - Unique ID of preload script. Defaults to a random UUID.
* `filePath` string - Path of the script file. Must be an absolute path.

View File

@@ -1,6 +0,0 @@
# PreloadScript Object
* `type` string - Context type where the preload script will be executed.
Possible values include `frame` or `service-worker`.
* `id` string - Unique ID of preload script.
* `filePath` string - Path of the script file. Must be an absolute path.

View File

@@ -3,4 +3,3 @@
* `scriptUrl` string - The full URL to the script that this service worker runs * `scriptUrl` string - The full URL to the script that this service worker runs
* `scope` string - The base URL that this service worker is active for. * `scope` string - The base URL that this service worker is active for.
* `renderProcessId` number - The virtual ID of the process that this service worker is running in. This is not an OS level PID. This aligns with the ID set used for `webContents.getProcessId()`. * `renderProcessId` number - The virtual ID of the process that this service worker is running in. This is not an OS level PID. This aligns with the ID set used for `webContents.getProcessId()`.
* `versionId` number - ID of the service worker version

View File

@@ -1,12 +0,0 @@
# SharedDictionaryInfo Object
* `match` string - The matching path pattern for the dictionary which was declared in 'use-as-dictionary' response header's `match` option.
* `matchDestinations` string[] - An array of matching destinations for the dictionary which was declared in 'use-as-dictionary' response header's `match-dest` option.
* `id` string - The Id for the dictionary which was declared in 'use-as-dictionary' response header's `id` option.
* `dictionaryUrl` string - URL of the dictionary.
* `lastFetchTime` Date - The time of when the dictionary was received from the network layer.
* `responseTime` Date - The time of when the dictionary was received from the server. For cached responses, this time could be "far" in the past.
* `expirationDuration` number - The expiration time for the dictionary which was declared in 'use-as-dictionary' response header's `expires` option in seconds.
* `lastUsedTime` Date - The time when the dictionary was last used.
* `size` number - The amount of bytes stored for this shared dictionary information object in Chromium's internal storage (usually Sqlite).
* `hash` string - The sha256 hash of the dictionary binary.

View File

@@ -1,5 +0,0 @@
# SharedDictionaryUsageInfo Object
* `frameOrigin` string - The origin of the frame where the request originates. Its specific to the individual frame making the request and is defined by its scheme, host, and port. In practice, will look like a URL.
* `topFrameSite` string - The site of the top-level browsing context (the main frame or tab that contains the request). Its less granular than `frameOrigin` and focuses on the broader "site" scope. In practice, will look like a URL.
* `totalSizeBytes` number - The amount of bytes stored for this shared dictionary information object in Chromium's internal storage (usually Sqlite).

View File

@@ -148,7 +148,6 @@
this will cause the `preferred-size-changed` event to be emitted on the this will cause the `preferred-size-changed` event to be emitted on the
`WebContents` when the preferred size changes. Default is `false`. `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. * `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`.
[chrome-content-scripts]: https://developer.chrome.com/extensions/content_scripts#execution-environment [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 [runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5

View File

@@ -1,7 +0,0 @@
# WindowSessionEndEvent Object extends `Event`
* `reasons` string[] - List of reasons for shutdown. Can be 'shutdown', 'close-app', 'critical', or 'logoff'.
Unfortunately, Windows does not offer a way to differentiate between a shutdown and a reboot, meaning the 'shutdown'
reason is triggered in both scenarios. For more details on the `WM_ENDSESSION` message and its associated reasons,
refer to the [MSDN documentation](https://learn.microsoft.com/en-us/windows/win32/shutdown/wm-endsession).

View File

@@ -6,7 +6,7 @@ Process: [Main](../glossary.md#main-process), [Utility](../glossary.md#utility-p
```js ```js
const { systemPreferences } = require('electron') const { systemPreferences } = require('electron')
console.log(systemPreferences.getEffectiveAppearance()) console.log(systemPreferences.isAeroGlassEnabled())
``` ```
## Events ## Events
@@ -181,13 +181,35 @@ Some popular `key` and `type`s are:
Removes the `key` in `NSUserDefaults`. This can be used to restore the default Removes the `key` in `NSUserDefaults`. This can be used to restore the default
or global value of a `key` previously set with `setUserDefault`. or global value of a `key` previously set with `setUserDefault`.
### `systemPreferences.isAeroGlassEnabled()` _Windows_ _Deprecated_ ### `systemPreferences.isAeroGlassEnabled()` _Windows_
Returns `boolean` - `true` if [DWM composition][dwm-composition] (Aero Glass) is Returns `boolean` - `true` if [DWM composition][dwm-composition] (Aero Glass) is
enabled, and `false` otherwise. enabled, and `false` otherwise.
**Deprecated:** An example of using it to determine if you should create a transparent window or
This function has been always returning `true` since Electron 23, which only supports Windows 10+. not (transparent windows won't work correctly when DWM composition is disabled):
```js
const { BrowserWindow, systemPreferences } = require('electron')
const browserOptions = { width: 1000, height: 800 }
// Make the window transparent only if the platform supports it.
if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
browserOptions.transparent = true
browserOptions.frame = false
}
// Create the window.
const win = new BrowserWindow(browserOptions)
// Navigate.
if (browserOptions.transparent) {
win.loadFile('index.html')
} else {
// No transparency, so we load a fallback that uses basic styles.
win.loadFile('fallback.html')
}
```
[dwm-composition]: https://learn.microsoft.com/en-us/windows/win32/dwm/composition-ovw [dwm-composition]: https://learn.microsoft.com/en-us/windows/win32/dwm/composition-ovw

View File

@@ -37,10 +37,7 @@ Process: [Main](../glossary.md#main-process)<br />
to load unsigned libraries. Unless you specifically need this capability, it is best to leave this disabled. to load unsigned libraries. Unless you specifically need this capability, it is best to leave this disabled.
Default is `false`. Default is `false`.
* `respondToAuthRequestsFromMainProcess` boolean (optional) - With this flag, all HTTP 401 and 407 network * `respondToAuthRequestsFromMainProcess` boolean (optional) - With this flag, all HTTP 401 and 407 network
requests created via the [net module](net.md) will allow responding to them via the requests created via the [net module](net.md) will allow responding to them via the [`app#login`](app.md#event-login) event in the main process instead of the default [`login`](client-request.md#event-login) event on the [`ClientRequest`](client-request.md) object.
[`app#login`](app.md#event-login) event in the main process instead of the default
[`login`](client-request.md#event-login) event on the [`ClientRequest`](client-request.md) object. Default is
`false`.
Returns [`UtilityProcess`](utility-process.md#class-utilityprocess) Returns [`UtilityProcess`](utility-process.md#class-utilityprocess)
@@ -89,25 +86,9 @@ true if the kill is successful, and false otherwise.
#### `child.pid` #### `child.pid`
A `Integer | undefined` representing the process identifier (PID) of the child process. A `Integer | undefined` representing the process identifier (PID) of the child process.
Until the child process has spawned successfully, the value is `undefined`. When If the child process fails to spawn due to errors, then the value is `undefined`. When
the child process exits, then the value is `undefined` after the `exit` event is emitted. the child process exits, then the value is `undefined` after the `exit` event is emitted.
```js
const child = utilityProcess.fork(path.join(__dirname, 'test.js'))
console.log(child.pid) // undefined
child.on('spawn', () => {
console.log(child.pid) // Integer
})
child.on('exit', () => {
console.log(child.pid) // undefined
})
```
**Note:** You can use the `pid` to determine if the process is currently running.
#### `child.stdout` #### `child.stdout`
A `NodeJS.ReadableStream | null` that represents the child process's stdout. A `NodeJS.ReadableStream | null` that represents the child process's stdout.
@@ -146,15 +127,12 @@ Returns:
Emitted when the child process needs to terminate due to non continuable error from V8. Emitted when the child process needs to terminate due to non continuable error from V8.
No matter if you listen to the `error` event, the `exit` event will be emitted after the
child process terminates.
#### Event: 'exit' #### Event: 'exit'
Returns: Returns:
* `code` number - Contains the exit code for * `code` number - Contains the exit code for
the process obtained from waitpid on POSIX, or GetExitCodeProcess on Windows. the process obtained from waitpid on posix, or GetExitCodeProcess on windows.
Emitted after the child process ends. Emitted after the child process ends.

View File

@@ -106,12 +106,6 @@ Examples of valid `color` values:
* `visible` boolean - If false, the view will be hidden from display. * `visible` boolean - If false, the view will be hidden from display.
#### `view.getVisible()`
Returns `boolean` - Whether the view should be drawn. Note that this is
different from whether the view is visible on screen—it may still be obscured
or out of view.
### Instance Properties ### Instance Properties
Objects created with `new View` have the following properties: Objects created with `new View` have the following properties:

View File

@@ -242,9 +242,8 @@ Returns:
* `isSameDocument` boolean - This event does not fire for same document navigations using window.history api and reference fragment navigations. * `isSameDocument` boolean - This event does not fire for same document navigations using window.history api and reference fragment navigations.
This property is always set to `false` for this event. This property is always set to `false` for this event.
* `isMainFrame` boolean - True if the navigation is taking place in a main frame. * `isMainFrame` boolean - True if the navigation is taking place in a main frame.
* `frame` WebFrameMain | null - The frame to be navigated. * `frame` WebFrameMain - The frame to be navigated.
May be `null` if accessed after the frame has either navigated or been destroyed. * `initiator` WebFrameMain (optional) - The frame which initiated the
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
navigation, which can be a parent frame (e.g. via `window.open` with a navigation, which can be a parent frame (e.g. via `window.open` with a
frame's name), or null if the navigation was not initiated by a frame. This frame's name), or null if the navigation was not initiated by a frame. This
can also be null if the initiating frame was deleted before the event was can also be null if the initiating frame was deleted before the event was
@@ -276,9 +275,8 @@ Returns:
* `isSameDocument` boolean - This event does not fire for same document navigations using window.history api and reference fragment navigations. * `isSameDocument` boolean - This event does not fire for same document navigations using window.history api and reference fragment navigations.
This property is always set to `false` for this event. This property is always set to `false` for this event.
* `isMainFrame` boolean - True if the navigation is taking place in a main frame. * `isMainFrame` boolean - True if the navigation is taking place in a main frame.
* `frame` WebFrameMain | null - The frame to be navigated. * `frame` WebFrameMain - The frame to be navigated.
May be `null` if accessed after the frame has either navigated or been destroyed. * `initiator` WebFrameMain (optional) - The frame which initiated the
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
navigation, which can be a parent frame (e.g. via `window.open` with a navigation, which can be a parent frame (e.g. via `window.open` with a
frame's name), or null if the navigation was not initiated by a frame. This frame's name), or null if the navigation was not initiated by a frame. This
can also be null if the initiating frame was deleted before the event was can also be null if the initiating frame was deleted before the event was
@@ -308,9 +306,8 @@ Returns:
document. Examples of same document navigations are reference fragment document. Examples of same document navigations are reference fragment
navigations, pushState/replaceState, and same page history navigation. navigations, pushState/replaceState, and same page history navigation.
* `isMainFrame` boolean - True if the navigation is taking place in a main frame. * `isMainFrame` boolean - True if the navigation is taking place in a main frame.
* `frame` WebFrameMain | null - The frame to be navigated. * `frame` WebFrameMain - The frame to be navigated.
May be `null` if accessed after the frame has either navigated or been destroyed. * `initiator` WebFrameMain (optional) - The frame which initiated the
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
navigation, which can be a parent frame (e.g. via `window.open` with a navigation, which can be a parent frame (e.g. via `window.open` with a
frame's name), or null if the navigation was not initiated by a frame. This frame's name), or null if the navigation was not initiated by a frame. This
can also be null if the initiating frame was deleted before the event was can also be null if the initiating frame was deleted before the event was
@@ -333,9 +330,8 @@ Returns:
document. Examples of same document navigations are reference fragment document. Examples of same document navigations are reference fragment
navigations, pushState/replaceState, and same page history navigation. navigations, pushState/replaceState, and same page history navigation.
* `isMainFrame` boolean - True if the navigation is taking place in a main frame. * `isMainFrame` boolean - True if the navigation is taking place in a main frame.
* `frame` WebFrameMain | null - The frame to be navigated. * `frame` WebFrameMain - The frame to be navigated.
May be `null` if accessed after the frame has either navigated or been destroyed. * `initiator` WebFrameMain (optional) - The frame which initiated the
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
navigation, which can be a parent frame (e.g. via `window.open` with a navigation, which can be a parent frame (e.g. via `window.open` with a
frame's name), or null if the navigation was not initiated by a frame. This frame's name), or null if the navigation was not initiated by a frame. This
can also be null if the initiating frame was deleted before the event was can also be null if the initiating frame was deleted before the event was
@@ -365,9 +361,8 @@ Returns:
document. Examples of same document navigations are reference fragment document. Examples of same document navigations are reference fragment
navigations, pushState/replaceState, and same page history navigation. navigations, pushState/replaceState, and same page history navigation.
* `isMainFrame` boolean - True if the navigation is taking place in a main frame. * `isMainFrame` boolean - True if the navigation is taking place in a main frame.
* `frame` WebFrameMain | null - The frame to be navigated. * `frame` WebFrameMain - The frame to be navigated.
May be `null` if accessed after the frame has either navigated or been destroyed. * `initiator` WebFrameMain (optional) - The frame which initiated the
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
navigation, which can be a parent frame (e.g. via `window.open` with a navigation, which can be a parent frame (e.g. via `window.open` with a
frame's name), or null if the navigation was not initiated by a frame. This frame's name), or null if the navigation was not initiated by a frame. This
can also be null if the initiating frame was deleted before the event was can also be null if the initiating frame was deleted before the event was
@@ -748,8 +743,7 @@ Returns:
* `params` Object * `params` Object
* `x` Integer - x coordinate. * `x` Integer - x coordinate.
* `y` Integer - y coordinate. * `y` Integer - y coordinate.
* `frame` WebFrameMain | null - Frame from which the context menu was invoked. * `frame` WebFrameMain - Frame from which the context menu was invoked.
May be `null` if accessed after the frame has either navigated or been destroyed.
* `linkURL` string - URL of the link that encloses the node the context menu * `linkURL` string - URL of the link that encloses the node the context menu
was invoked on. was invoked on.
* `linkText` string - Text associated with the link. May be an empty * `linkText` string - Text associated with the link. May be an empty
@@ -955,17 +949,11 @@ Emitted when a `<webview>` has been attached to this web contents.
Returns: Returns:
* `details` Event\<\> * `event` Event
* `message` string - Message text * `level` Integer - The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and `error`.
* `level` string - Message severity * `message` string - The actual console message
Possible values include `info`, `warning`, `error`, and `debug`. * `line` Integer - The line number of the source that triggered this console message
* `lineNumber` Integer - Line number in the log source * `sourceId` string
* `sourceId` string - URL of the log source
* `frame` WebFrameMain - Frame that logged the message
* `level` Integer _Deprecated_ - The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and `error`.
* `message` string _Deprecated_ - The actual console message
* `line` Integer _Deprecated_ - The line number of the source that triggered this console message
* `sourceId` string _Deprecated_
Emitted when the associated window logs a console message. Emitted when the associated window logs a console message.
@@ -1022,8 +1010,7 @@ Returns:
* `event` Event * `event` Event
* `details` Object * `details` Object
* `frame` WebFrameMain | null - The created frame. * `frame` WebFrameMain
May be `null` if accessed after the frame has either navigated or been destroyed.
Emitted when the [mainFrame](web-contents.md#contentsmainframe-readonly), an `<iframe>`, or a nested `<iframe>` is loaded within the page. Emitted when the [mainFrame](web-contents.md#contentsmainframe-readonly), an `<iframe>`, or a nested `<iframe>` is loaded within the page.

View File

@@ -97,10 +97,6 @@ this limitation.
Returns `boolean` - Whether the reload was initiated successfully. Only results in `false` when the frame has no history. Returns `boolean` - Whether the reload was initiated successfully. Only results in `false` when the frame has no history.
#### `frame.isDestroyed()`
Returns `boolean` - Whether the frame is destroyed.
#### `frame.send(channel, ...args)` #### `frame.send(channel, ...args)`
* `channel` string * `channel` string
@@ -142,29 +138,6 @@ ipcRenderer.on('port', (e, msg) => {
}) })
``` ```
#### `frame.collectJavaScriptCallStack()` _Experimental_
Returns `Promise<string> | Promise<void>` - A promise that resolves with the currently running JavaScript call
stack. If no JavaScript runs in the frame, the promise will never resolve. In cases where the call stack is
otherwise unable to be collected, it will return `undefined`.
This can be useful to determine why the frame is unresponsive in cases where there's long-running JavaScript.
For more information, see the [proposed Crash Reporting API.](https://wicg.github.io/crash-reporting/)
```js
const { app } = require('electron')
app.commandLine.appendSwitch('enable-features', 'DocumentPolicyIncludeJSCallStacksInCrashReports')
app.on('web-contents-created', (_, webContents) => {
webContents.on('unresponsive', async () => {
// Interrupt execution and collect call stack from unresponsive renderer
const callStack = await webContents.mainFrame.collectJavaScriptCallStack()
console.log('Renderer unresponsive\n', callStack)
})
})
```
### Instance Properties ### Instance Properties
#### `frame.ipc` _Readonly_ #### `frame.ipc` _Readonly_
@@ -258,13 +231,6 @@ A `string` representing the [visibility state](https://developer.mozilla.org/en-
See also how the [Page Visibility API](browser-window.md#page-visibility) is affected by other Electron APIs. See also how the [Page Visibility API](browser-window.md#page-visibility) is affected by other Electron APIs.
#### `frame.detached` _Readonly_
A `Boolean` representing whether the frame is detached from the frame tree. If a frame is accessed
while the corresponding page is running any [unload][] listeners, it may become detached as the
newly navigated page replaced it in the frame tree.
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm [SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage [`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
[`MessagePortMain`]: message-port-main.md [`MessagePortMain`]: message-port-main.md
[unload]: https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event

View File

@@ -182,7 +182,7 @@ dispatch errors of isolated worlds to foreign worlds.
### `webFrame.setIsolatedWorldInfo(worldId, info)` ### `webFrame.setIsolatedWorldInfo(worldId, info)`
* `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electron's `contextIsolation` feature. Chrome extensions reserve the range of IDs in `[1 << 20, 1 << 29)`. You can provide any integer here. * `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electrons `contextIsolation` feature. Chrome extensions reserve the range of IDs in `[1 << 20, 1 << 29)`. You can provide any integer here.
* `info` Object * `info` Object
* `securityOrigin` string (optional) - Security origin for the isolated world. * `securityOrigin` string (optional) - Security origin for the isolated world.
* `csp` string (optional) - Content Security Policy for the isolated world. * `csp` string (optional) - Content Security Policy for the isolated world.

View File

@@ -51,8 +51,7 @@ The following methods are available on instances of `WebRequest`:
* `method` string * `method` string
* `webContentsId` Integer (optional) * `webContentsId` Integer (optional)
* `webContents` WebContents (optional) * `webContents` WebContents (optional)
* `frame` WebFrameMain | null (optional) - Requesting frame. * `frame` WebFrameMain (optional)
May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string * `referrer` string
* `timestamp` Double * `timestamp` Double
@@ -95,8 +94,7 @@ Some examples of valid `urls`:
* `method` string * `method` string
* `webContentsId` Integer (optional) * `webContentsId` Integer (optional)
* `webContents` WebContents (optional) * `webContents` WebContents (optional)
* `frame` WebFrameMain | null (optional) - Requesting frame. * `frame` WebFrameMain (optional)
May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string * `referrer` string
* `timestamp` Double * `timestamp` Double
@@ -124,8 +122,7 @@ The `callback` has to be called with a `response` object.
* `method` string * `method` string
* `webContentsId` Integer (optional) * `webContentsId` Integer (optional)
* `webContents` WebContents (optional) * `webContents` WebContents (optional)
* `frame` WebFrameMain | null (optional) - Requesting frame. * `frame` WebFrameMain (optional)
May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string * `referrer` string
* `timestamp` Double * `timestamp` Double
@@ -145,8 +142,7 @@ response are visible by the time this listener is fired.
* `method` string * `method` string
* `webContentsId` Integer (optional) * `webContentsId` Integer (optional)
* `webContents` WebContents (optional) * `webContents` WebContents (optional)
* `frame` WebFrameMain | null (optional) - Requesting frame. * `frame` WebFrameMain (optional)
May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string * `referrer` string
* `timestamp` Double * `timestamp` Double
@@ -177,8 +173,7 @@ The `callback` has to be called with a `response` object.
* `method` string * `method` string
* `webContentsId` Integer (optional) * `webContentsId` Integer (optional)
* `webContents` WebContents (optional) * `webContents` WebContents (optional)
* `frame` WebFrameMain | null (optional) - Requesting frame. * `frame` WebFrameMain (optional)
May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string * `referrer` string
* `timestamp` Double * `timestamp` Double
@@ -202,8 +197,7 @@ and response headers are available.
* `method` string * `method` string
* `webContentsId` Integer (optional) * `webContentsId` Integer (optional)
* `webContents` WebContents (optional) * `webContents` WebContents (optional)
* `frame` WebFrameMain | null (optional) - Requesting frame. * `frame` WebFrameMain (optional)
May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string * `referrer` string
* `timestamp` Double * `timestamp` Double
@@ -228,8 +222,7 @@ redirect is about to occur.
* `method` string * `method` string
* `webContentsId` Integer (optional) * `webContentsId` Integer (optional)
* `webContents` WebContents (optional) * `webContents` WebContents (optional)
* `frame` WebFrameMain | null (optional) - Requesting frame. * `frame` WebFrameMain (optional)
May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string * `referrer` string
* `timestamp` Double * `timestamp` Double
@@ -252,8 +245,7 @@ completed.
* `method` string * `method` string
* `webContentsId` Integer (optional) * `webContentsId` Integer (optional)
* `webContents` WebContents (optional) * `webContents` WebContents (optional)
* `frame` WebFrameMain | null (optional) - Requesting frame. * `frame` WebFrameMain (optional)
May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string * `referrer` string
* `timestamp` Double * `timestamp` Double

View File

@@ -12,111 +12,8 @@ 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. * **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. * **Removed:** An API or feature was removed, and is no longer supported by Electron.
## Planned Breaking API Changes (35.0)
### Deprecated: `getFromVersionID` on `session.serviceWorkers`
The `session.serviceWorkers.fromVersionID(versionId)` API has been deprecated
in favor of `session.serviceWorkers.getInfoFromVersionID(versionId)`. This was
changed to make it more clear which object is returned with the introduction
of the `session.serviceWorkers.getWorkerFromVersionID(versionId)` API.
```js
// Deprecated
session.serviceWorkers.fromVersionID(versionId)
// Replace with
session.serviceWorkers.getInfoFromVersionID(versionId)
```
### Deprecated: `setPreloads`, `getPreloads` on `Session`
`registerPreloadScript`, `unregisterPreloadScript`, and `getPreloadScripts` are introduced as a
replacement for the deprecated methods. These new APIs allow third-party libraries to register
preload scripts without replacing existing scripts. Also, the new `type` option allows for
additional preload targets beyond `frame`.
```js
// Deprecated
session.setPreloads([path.join(__dirname, 'preload.js')])
// Replace with:
session.registerPreloadScript({
type: 'frame',
id: 'app-preload',
filePath: path.join(__dirname, 'preload.js')
})
```
### Deprecated: `level`, `message`, `line`, and `sourceId` arguments in `console-message` event on `WebContents`
The `console-message` event on `WebContents` has been updated to provide details on the `Event`
argument.
```js
// Deprecated
webContents.on('console-message', (event, level, message, line, sourceId) => {})
// Replace with:
webContents.on('console-message', ({ level, message, lineNumber, sourceId, frame }) => {})
```
Additionally, `level` is now a string with possible values of `info`, `warning`, `error`, and `debug`.
### Deprecated: `systemPreferences.isAeroGlassEnabled()`
The `systemPreferences.isAeroGlassEnabled()` function has been deprecated without replacement.
It has been always returning `true` since Electron 23, which only supports Windows 10+, where DWM composition can no longer be disabled.
https://learn.microsoft.com/en-us/windows/win32/dwm/composition-ovw#disabling-dwm-composition-windows7-and-earlier
## Planned Breaking API Changes (34.0)
### Behavior Changed: menu bar will be hidden during fullscreen on Windows
This brings the behavior to parity with Linux. Prior behavior: Menu bar is still visible during fullscreen on Windows. New behavior: Menu bar is hidden during fullscreen on Windows.
**Correction**: This was previously listed as a breaking change in Electron 33, but was first released in Electron 34.
## Planned Breaking API Changes (33.0) ## Planned Breaking API Changes (33.0)
### Deprecated: `document.execCommand("paste")`
The synchronous clipboard read API [document.execCommand("paste")](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard) has been
deprecated in favor of [async clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API). This is to align with the browser defaults.
The `enableDeprecatedPaste` option on `WebPreferences` that triggers the permission
checks for this API and the associated permission type `deprecated-sync-clipboard-read`
are also deprecated.
### Behavior Changed: frame properties may retrieve detached WebFrameMain instances or none at all
APIs which provide access to a `WebFrameMain` instance may return an instance
with `frame.detached` set to `true`, or possibly return `null`.
When a frame performs a cross-origin navigation, it enters into a detached state
in which it's no longer attached to the page. In this state, it may be running
[unload](https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event)
handlers prior to being deleted. In the event of an IPC sent during this state,
`frame.detached` will be set to `true` with the frame being destroyed shortly
thereafter.
When receiving an event, it's important to access WebFrameMain properties
immediately upon being received. Otherwise, it's not guaranteed to point to the
same webpage as when received. To avoid misaligned expectations, Electron will
return `null` in the case of late access where the webpage has changed.
```js
ipcMain.on('unload-event', (event) => {
event.senderFrame // ✅ accessed immediately
})
ipcMain.on('unload-event', async (event) => {
await crossOriginNavigationPromise
event.senderFrame // ❌ returns `null` due to late access
})
```
### Behavior Changed: custom protocol URL handling on Windows ### Behavior Changed: custom protocol URL handling on Windows
Due to changes made in Chromium to support [Non-Special Scheme URLs](http://bit.ly/url-non-special), custom protocol URLs that use Windows file paths will no longer work correctly with the deprecated `protocol.registerFileProtocol` and the `baseURLForDataURL` property on `BrowserWindow.loadURL`, `WebContents.loadURL`, and `<webview>.loadURL`. `protocol.handle` will also not work with these types of URLs but this is not a change since it has always worked that way. Due to changes made in Chromium to support [Non-Special Scheme URLs](http://bit.ly/url-non-special), custom protocol URLs that use Windows file paths will no longer work correctly with the deprecated `protocol.registerFileProtocol` and the `baseURLForDataURL` property on `BrowserWindow.loadURL`, `WebContents.loadURL`, and `<webview>.loadURL`. `protocol.handle` will also not work with these types of URLs but this is not a change since it has always worked that way.
@@ -144,6 +41,10 @@ mainWindow.loadURL('data:text/html,<script src="loaded-from-dataurl.js"></script
mainWindow.loadURL('other://index.html') mainWindow.loadURL('other://index.html')
``` ```
### Behavior Changed: menu bar will be hidden during fullscreen on Windows
This brings the behavior to parity with Linux. Prior behavior: Menu bar is still visible during fullscreen on Windows. New behavior: Menu bar is hidden during fullscreen on Windows.
### Behavior Changed: `webContents` property on `login` on `app` ### Behavior Changed: `webContents` property on `login` on `app`
The `webContents` property in the `login` event from `app` will be `null` The `webContents` property in the `login` event from `app` will be `null`
@@ -161,16 +62,6 @@ macOS 10.15 (Catalina) is no longer supported by [Chromium](https://chromium-rev
Older versions of Electron will continue to run on Catalina, but macOS 11 (Big Sur) Older versions of Electron will continue to run on Catalina, but macOS 11 (Big Sur)
or later will be required to run Electron v33.0.0 and higher. or later will be required to run Electron v33.0.0 and higher.
### Behavior Changed: Native modules now require C++20
Due to changes made upstream, both
[V8](https://chromium-review.googlesource.com/c/v8/v8/+/5587859) and
[Node.js](https://github.com/nodejs/node/pull/45427) now require C++20 as a
minimum version. Developers using native node modules should build their
modules with `--std=c++20` rather than `--std=c++17`. Images using gcc9 or
lower may need to update to gcc10 in order to compile. See
[#43555](https://github.com/electron/electron/pull/43555) for more details.
### Deprecated: `systemPreferences.accessibilityDisplayShouldReduceTransparency` ### Deprecated: `systemPreferences.accessibilityDisplayShouldReduceTransparency`
The `systemPreferences.accessibilityDisplayShouldReduceTransparency` property is now deprecated in favor of the new `nativeTheme.prefersReducedTransparency`, which provides identical information and works cross-platform. The `systemPreferences.accessibilityDisplayShouldReduceTransparency` property is now deprecated in favor of the new `nativeTheme.prefersReducedTransparency`, which provides identical information and works cross-platform.
@@ -192,14 +83,14 @@ The nonstandard `path` property of the Web `File` object was added in an early v
```js ```js
// Before (renderer) // Before (renderer)
const file = document.querySelector('input[type=file]').files[0] const file = document.querySelector('input[type=file]')
alert(`Uploaded file path was: ${file.path}`) alert(`Uploaded file path was: ${file.path}`)
``` ```
```js ```js
// After (renderer) // After (renderer)
const file = document.querySelector('input[type=file]').files[0] const file = document.querySelector('input[type=file]')
electron.showFilePath(file) electron.showFilePath(file)
// (preload) // (preload)
@@ -242,14 +133,6 @@ win.webContents.navigationHistory.canGoToOffset()
win.webContents.navigationHistory.goToOffset(index) win.webContents.navigationHistory.goToOffset(index)
``` ```
### Behavior changed: Directory `databases` in `userData` will be deleted
If you have a directory called `databases` in the directory returned by
`app.getPath('userData')`, it will be deleted when Electron 32 is first run.
The `databases` directory was used by WebSQL, which was removed in Electron 31.
Chromium now performs a cleanup that deletes this directory. See
[issue #45396](https://github.com/electron/electron/issues/45396).
## Planned Breaking API Changes (31.0) ## Planned Breaking API Changes (31.0)
### Removed: `WebSQL` support ### Removed: `WebSQL` support

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