mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
183 Commits
fix-codesp
...
v33.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9d026e19b | ||
|
|
65cd09ffaf | ||
|
|
c8dc8717a4 | ||
|
|
6e44a274e9 | ||
|
|
743fe6f4b4 | ||
|
|
bd81baaf04 | ||
|
|
6e1d940ef3 | ||
|
|
be69311692 | ||
|
|
fcf0c115cb | ||
|
|
4fad573746 | ||
|
|
c600be6439 | ||
|
|
a7ab89ee9e | ||
|
|
7930412006 | ||
|
|
8b38c78e94 | ||
|
|
f3a2c1dee7 | ||
|
|
50eb34423f | ||
|
|
03acaade4e | ||
|
|
532e5cc1f6 | ||
|
|
ae9f2df082 | ||
|
|
4507774c51 | ||
|
|
4f13824bc9 | ||
|
|
b184a5668b | ||
|
|
828d29526a | ||
|
|
b0614f80d7 | ||
|
|
cab11e6de0 | ||
|
|
d435ff9128 | ||
|
|
a6b34dca26 | ||
|
|
ec070e57e0 | ||
|
|
359cfecce0 | ||
|
|
6b79679e5b | ||
|
|
964c1a1df8 | ||
|
|
3b3f72e974 | ||
|
|
64fd436375 | ||
|
|
34045394e0 | ||
|
|
777d447018 | ||
|
|
e0d14a6d89 | ||
|
|
739df86774 | ||
|
|
9a087b9c56 | ||
|
|
8b3f2c5d7c | ||
|
|
ad9bf6b041 | ||
|
|
32822cd747 | ||
|
|
e1419b2fdf | ||
|
|
11c2b61011 | ||
|
|
6b458c78b0 | ||
|
|
77324ff514 | ||
|
|
63d1d9cb65 | ||
|
|
dd5bce17cb | ||
|
|
258a4a76cf | ||
|
|
f269ca1d93 | ||
|
|
7887395e92 | ||
|
|
9011532b2e | ||
|
|
afce3ce7c7 | ||
|
|
eb90fb3b9e | ||
|
|
6964b79e68 | ||
|
|
5bb1bb9b7a | ||
|
|
78cb71f7b1 | ||
|
|
c9474ef5da | ||
|
|
5244fcecd3 | ||
|
|
af5901bc6a | ||
|
|
4e6e77d696 | ||
|
|
9469efb4c9 | ||
|
|
8cbe09d412 | ||
|
|
e9cb85bea6 | ||
|
|
479caedc8a | ||
|
|
86d86768b3 | ||
|
|
bd0277923f | ||
|
|
dd8c3b8dd9 | ||
|
|
6074f7ed31 | ||
|
|
7b14a305f8 | ||
|
|
0646cbfba6 | ||
|
|
8af5c6d130 | ||
|
|
ac10ddaa48 | ||
|
|
fc9cda72d2 | ||
|
|
52a8d133cd | ||
|
|
e019b37231 | ||
|
|
c8788f8217 | ||
|
|
4d16326b4d | ||
|
|
5836ea1a78 | ||
|
|
d8cd86c4fa | ||
|
|
a44059aa05 | ||
|
|
73c1413374 | ||
|
|
ce2163da2f | ||
|
|
481f9b25a7 | ||
|
|
9ca68e2b8c | ||
|
|
9ef7ec02e5 | ||
|
|
e32e85abb2 | ||
|
|
6973af4f7a | ||
|
|
625d950e32 | ||
|
|
d62097e067 | ||
|
|
ad8f2f8d5d | ||
|
|
53cc8aef9b | ||
|
|
0ffafbc295 | ||
|
|
134176a1d1 | ||
|
|
d2bd4cf91c | ||
|
|
1af736bc15 | ||
|
|
f609d77e29 | ||
|
|
ae6d5c4661 | ||
|
|
cdcfe49592 | ||
|
|
d35b848f95 | ||
|
|
ff65b58e2c | ||
|
|
dddcc09185 | ||
|
|
8fa00dbe1a | ||
|
|
eda8205424 | ||
|
|
c4921d2592 | ||
|
|
723015db29 | ||
|
|
7d108a163f | ||
|
|
7f473f2fba | ||
|
|
95caa1f0bd | ||
|
|
45a7a5d22c | ||
|
|
3232505c55 | ||
|
|
b896dbb103 | ||
|
|
3ee3844bdb | ||
|
|
78ede09ecd | ||
|
|
5c92ea76e9 | ||
|
|
68869c18cd | ||
|
|
d3cfe7aacb | ||
|
|
753cf3d409 | ||
|
|
3a4664f836 | ||
|
|
948a28fdb8 | ||
|
|
48d4adedaa | ||
|
|
a27df94f71 | ||
|
|
888928887c | ||
|
|
4ee00641eb | ||
|
|
12bb7093e2 | ||
|
|
6b4f269d22 | ||
|
|
d11c840cf0 | ||
|
|
18bd295873 | ||
|
|
748f293400 | ||
|
|
7a04a77ed0 | ||
|
|
810a6d6ef4 | ||
|
|
27aea84411 | ||
|
|
2aa2611f76 | ||
|
|
57aeb9dfc6 | ||
|
|
454218bd2b | ||
|
|
c56673f83d | ||
|
|
87fc32f0aa | ||
|
|
c7380437aa | ||
|
|
511dece7ff | ||
|
|
12ce546ded | ||
|
|
67da1f2f9f | ||
|
|
8d9ed52c72 | ||
|
|
8d76b8dba9 | ||
|
|
6f68a40430 | ||
|
|
cf8a97a924 | ||
|
|
37a7cb2c11 | ||
|
|
d92770a275 | ||
|
|
60264f30d8 | ||
|
|
b31a4dcdf3 | ||
|
|
1d3200d7da | ||
|
|
bf10a437bc | ||
|
|
60247e685d | ||
|
|
5d340577b6 | ||
|
|
40316df338 | ||
|
|
e92eb210bb | ||
|
|
f30c9120a1 | ||
|
|
986a621bfc | ||
|
|
6172e1d2b9 | ||
|
|
0ee624c308 | ||
|
|
d8e46cdd50 | ||
|
|
bcf948595d | ||
|
|
66fa1f4665 | ||
|
|
1fcd981e5e | ||
|
|
9a3618e912 | ||
|
|
d55e120038 | ||
|
|
26d6f62c01 | ||
|
|
d769f1ea71 | ||
|
|
f08c6f2e85 | ||
|
|
824b1aeb71 | ||
|
|
ddc19e3ea0 | ||
|
|
d9aa185ec5 | ||
|
|
3169351511 | ||
|
|
75ce3ac6a2 | ||
|
|
656a86169a | ||
|
|
e08be7d8ce | ||
|
|
150d332f10 | ||
|
|
85bac873e7 | ||
|
|
706d416284 | ||
|
|
0a1e906aa8 | ||
|
|
cd944384e2 | ||
|
|
dbd7840254 | ||
|
|
6263a39d9a | ||
|
|
5134328872 | ||
|
|
2d240453de |
@@ -2,7 +2,7 @@ version: '3'
|
||||
|
||||
services:
|
||||
buildtools:
|
||||
image: ghcr.io/electron/devcontainer:9a43c14f5c19be0359843299f79e736521373adc
|
||||
image: ghcr.io/electron/devcontainer:77262e58c37631ab082482f42c33cdf68c6c394b
|
||||
|
||||
volumes:
|
||||
- ..:/workspaces/gclient/src/electron:cached
|
||||
|
||||
@@ -19,7 +19,40 @@
|
||||
"prefer-const": ["error", {
|
||||
"destructuring": "all"
|
||||
}],
|
||||
"standard/no-callback-literal": "off"
|
||||
"n/no-callback-literal": "off",
|
||||
"import/newline-after-import": "error",
|
||||
"import/order": ["error", {
|
||||
"alphabetize": {
|
||||
"order": "asc"
|
||||
},
|
||||
"newlines-between": "always",
|
||||
"pathGroups": [
|
||||
{
|
||||
"pattern": "@electron/internal/**",
|
||||
"group": "external",
|
||||
"position": "before"
|
||||
},
|
||||
{
|
||||
"pattern": "@electron/**",
|
||||
"group": "external",
|
||||
"position": "before"
|
||||
},
|
||||
{
|
||||
"pattern": "{electron,electron/**}",
|
||||
"group": "external",
|
||||
"position": "before"
|
||||
}
|
||||
],
|
||||
"pathGroupsExcludedImportTypes": [],
|
||||
"distinctGroup": true,
|
||||
"groups": [
|
||||
"external",
|
||||
"builtin",
|
||||
["sibling", "parent"],
|
||||
"index",
|
||||
"type"
|
||||
]
|
||||
}]
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
|
||||
32
.github/actions/build-electron/action.yml
vendored
32
.github/actions/build-electron/action.yml
vendored
@@ -63,13 +63,13 @@ runs:
|
||||
run: |
|
||||
cd src
|
||||
electron/script/copy-debug-symbols.py --target-cpu="${{ inputs.target-arch }}" --out-dir=out/Default/debug --compress
|
||||
electron/script/strip-binaries.py --target-cpu="${{ inputs.target-arch }}"
|
||||
electron/script/strip-binaries.py --target-cpu="${{ inputs.target-arch }}" --verbose
|
||||
electron/script/add-debug-link.py --target-cpu="${{ inputs.target-arch }}" --debug-dir=out/Default/debug
|
||||
- name: Build Electron dist.zip ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
e build electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
if [ "${{ inputs.is-asan }}" != "true" ]; then
|
||||
target_os=${{ inputs.target-platform == 'linux' && 'linux' || 'mac'}}
|
||||
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
|
||||
@@ -81,7 +81,7 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
e build electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
|
||||
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
||||
# Remove unused args from mksnapshot_args
|
||||
SEDOPTION="-i"
|
||||
@@ -104,7 +104,7 @@ runs:
|
||||
fi
|
||||
fi
|
||||
|
||||
e build electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
|
||||
- name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
@@ -130,24 +130,24 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
e build electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build electron:electron_chromedriver_zip
|
||||
e build --target electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:electron_chromedriver_zip
|
||||
- name: Build Node.js headers ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
e build electron:node_headers
|
||||
e build --target electron:node_headers
|
||||
- name: Generate & Zip Symbols ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
# Generate breakpad symbols on release builds
|
||||
if [ "${{ inputs.generate-symbols }}" = "true" ]; then
|
||||
e build electron:electron_symbols
|
||||
e build --target electron:electron_symbols
|
||||
fi
|
||||
cd src
|
||||
export BUILD_PATH="$(pwd)/out/Default"
|
||||
e build electron:licenses
|
||||
e build electron:electron_version_file
|
||||
e build --target electron:licenses
|
||||
e build --target electron:electron_version_file
|
||||
if [ "${{ inputs.is-release }}" = "true" ]; then
|
||||
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
|
||||
else
|
||||
@@ -159,21 +159,19 @@ runs:
|
||||
run: |
|
||||
cd src
|
||||
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 -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:electron_ffmpeg_zip -C ../../out/ffmpeg -j $NUMBER_OF_NINJA_PROCESSES
|
||||
- name: Generate Hunspell Dictionaries ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
|
||||
run: |
|
||||
cd src
|
||||
autoninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
- name: Generate Libcxx ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
|
||||
run: |
|
||||
cd src
|
||||
autoninja -C out/Default electron:libcxx_headers_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
|
||||
e build --target electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
- name: Generate TypeScript Definitions ${{ inputs.step-suffix }}
|
||||
if: ${{ inputs.is-release == 'true' }}
|
||||
shell: bash
|
||||
|
||||
15
.github/actions/checkout/action.yml
vendored
15
.github/actions/checkout/action.yml
vendored
@@ -57,13 +57,26 @@ runs:
|
||||
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
|
||||
echo "Using cache key: $DEPSHASH"
|
||||
echo "Checking for cache in: $cache_path"
|
||||
if [ ! -f "$cache_path" ]; then
|
||||
if [ ! -f "$cache_path" ] || [ `du $cache_path | cut -f1` = "0" ]; then
|
||||
echo "cache_exists=false" >> $GITHUB_OUTPUT
|
||||
echo "Cache Does Not Exist for $DEPSHASH"
|
||||
else
|
||||
echo "cache_exists=true" >> $GITHUB_OUTPUT
|
||||
echo "Cache Already Exists for $DEPSHASH, Skipping.."
|
||||
fi
|
||||
- name: Check cross instance cache disk space
|
||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
||||
shell: bash
|
||||
run: |
|
||||
# if there is less than 20 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 20000 ]; 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
|
||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
||||
shell: bash
|
||||
|
||||
24
.github/actions/generate-types/action.yml
vendored
Normal file
24
.github/actions/generate-types/action.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: 'Generate Types for Archaeologist Dig'
|
||||
description: 'Generate Types for Archaeologist Dig'
|
||||
inputs:
|
||||
sha-file:
|
||||
description: 'File containing sha'
|
||||
required: true
|
||||
filename:
|
||||
description: 'Filename to write types to'
|
||||
required: true
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Generating Types for SHA in ${{ inputs.sha-file }}
|
||||
shell: bash
|
||||
run: |
|
||||
git checkout $(cat ${{ inputs.sha-file }})
|
||||
rm -rf node_modules
|
||||
yarn install --frozen-lockfile --ignore-scripts
|
||||
echo "#!/usr/bin/env node\nglobal.x=1" > node_modules/typescript/bin/tsc
|
||||
node node_modules/.bin/electron-docs-parser --dir=./ --outDir=./ --moduleVersion=0.0.0-development
|
||||
node node_modules/.bin/electron-typescript-definitions --api=electron-api.json --outDir=artifacts
|
||||
mv artifacts/electron.d.ts artifacts/${{ inputs.filename }}
|
||||
git checkout .
|
||||
working-directory: ./electron
|
||||
@@ -6,6 +6,6 @@ runs:
|
||||
- name: Install Build Tools
|
||||
shell: bash
|
||||
run: |
|
||||
export BUILD_TOOLS_SHA=d5b87591842be19058e8d75d2c5b7f1fabe9f450
|
||||
export BUILD_TOOLS_SHA=eeb1a11392e4cec08fd926c93b31ab556dc0c23b
|
||||
npm i -g @electron/build-tools
|
||||
e auto-update disable
|
||||
|
||||
5
.github/actions/restore-cache-aks/action.yml
vendored
5
.github/actions/restore-cache-aks/action.yml
vendored
@@ -17,6 +17,11 @@ runs:
|
||||
fi
|
||||
|
||||
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
|
||||
tar -xf $cache_path -C temp-cache
|
||||
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"
|
||||
|
||||
@@ -44,6 +44,11 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
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
|
||||
tar -xf $DEPSHASH.tar -C temp-cache
|
||||
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"
|
||||
|
||||
61
.github/workflows/archaeologist-dig.yml
vendored
Normal file
61
.github/workflows/archaeologist-dig.yml
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
name: Archaeologist
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
archaeologist-dig:
|
||||
name: Archaeologist Dig
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 #v4.0.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setting Up Dig Site
|
||||
run: |
|
||||
echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}"
|
||||
echo "sha ${{ github.event.pull_request.head.sha }}"
|
||||
echo "base ref ${{ github.event.pull_request.base.ref }}"
|
||||
git clone https://github.com/electron/electron.git electron
|
||||
cd electron
|
||||
mkdir -p artifacts
|
||||
git remote add fork ${{ github.event.pull_request.head.repo.clone_url }} && git fetch fork
|
||||
git checkout ${{ github.event.pull_request.head.sha }}
|
||||
git merge-base origin/${{ github.event.pull_request.base.ref }} HEAD > .dig-old
|
||||
echo ${{ github.event.pull_request.head.sha }} > .dig-new
|
||||
cp .dig-old artifacts
|
||||
|
||||
- name: Generating Types for SHA in .dig-new
|
||||
uses: ./.github/actions/generate-types
|
||||
with:
|
||||
sha-file: .dig-new
|
||||
filename: electron.new.d.ts
|
||||
- name: Generating Types for SHA in .dig-old
|
||||
uses: ./.github/actions/generate-types
|
||||
with:
|
||||
sha-file: .dig-old
|
||||
filename: electron.old.d.ts
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4.4.0
|
||||
with:
|
||||
name: artifacts
|
||||
path: electron/artifacts
|
||||
include-hidden-files: true
|
||||
- name: Set job output
|
||||
run: |
|
||||
git diff --no-index electron.old.d.ts electron.new.d.ts > patchfile || true
|
||||
if [ -s patchfile ]; then
|
||||
echo "Changes Detected"
|
||||
echo "## Changes Detected" > $GITHUB_STEP_SUMMARY
|
||||
echo "Looks like the \`electron.d.ts\` file changed." >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "\`\`\`\`\`\`diff" >> $GITHUB_STEP_SUMMARY
|
||||
cat patchfile >> $GITHUB_STEP_SUMMARY
|
||||
echo "\`\`\`\`\`\`" >> $GITHUB_STEP_SUMMARY
|
||||
else
|
||||
echo "No Changes Detected"
|
||||
echo "## No Changes" > $GITHUB_STEP_SUMMARY
|
||||
echo "We couldn't see any changes in the \`electron.d.ts\` artifact" >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
working-directory: ./electron/artifacts
|
||||
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: 'cf814a4d2501e8e843caea071a6b70a48e78b855'
|
||||
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
|
||||
required: true
|
||||
skip-macos:
|
||||
type: boolean
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
|
||||
docs-only: ${{ steps.set-output.outputs.docs-only }}
|
||||
steps:
|
||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.0.2
|
||||
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 #v4.0.2
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: filter
|
||||
with:
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
id: set-output
|
||||
run: |
|
||||
if [ -z "${{ inputs.build-image-sha }}" ]; then
|
||||
echo "build-image-sha=cf814a4d2501e8e843caea071a6b70a48e78b855" >> "$GITHUB_OUTPUT"
|
||||
echo "build-image-sha=bc2f48b2415a670de18d13605b1cf0eb5fdbaae1" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
@@ -94,7 +94,7 @@ jobs:
|
||||
build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -120,7 +120,7 @@ jobs:
|
||||
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -250,3 +250,13 @@ jobs:
|
||||
generate-symbols: false
|
||||
upload-to-storage: '0'
|
||||
secrets: inherit
|
||||
|
||||
gha-done:
|
||||
name: GitHub Actions Completed
|
||||
runs-on: ubuntu-latest
|
||||
needs: [docs-only, macos-x64, macos-arm64, linux-x64, linux-x64-asan, linux-arm, linux-arm64]
|
||||
if: always() && !contains(needs.*.result, 'failure')
|
||||
steps:
|
||||
- name: GitHub Actions Jobs Done
|
||||
run: |
|
||||
echo "All GitHub Actions Jobs are done"
|
||||
|
||||
21
.github/workflows/clean-src-cache.yml
vendored
Normal file
21
.github/workflows/clean-src-cache.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
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
|
||||
4
.github/workflows/linux-publish.yml
vendored
4
.github/workflows/linux-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: 'cf814a4d2501e8e843caea071a6b70a48e78b855'
|
||||
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
required: false
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
|
||||
40
.github/workflows/macos-publish.yml
vendored
40
.github/workflows/macos-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: 'cf814a4d2501e8e843caea071a6b70a48e78b855'
|
||||
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
|
||||
required: true
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
with:
|
||||
generate-sas-token: 'true'
|
||||
|
||||
publish-x64:
|
||||
publish-x64-darwin:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
needs: checkout-macos
|
||||
with:
|
||||
@@ -48,13 +48,29 @@ jobs:
|
||||
build-runs-on: macos-14-xlarge
|
||||
target-platform: macos
|
||||
target-arch: x64
|
||||
target-variant: darwin
|
||||
is-release: true
|
||||
gn-build-type: release
|
||||
generate-symbols: true
|
||||
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||
secrets: inherit
|
||||
|
||||
publish-arm64:
|
||||
publish-x64-mas:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
needs: checkout-macos
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: macos-14-xlarge
|
||||
target-platform: macos
|
||||
target-arch: x64
|
||||
target-variant: mas
|
||||
is-release: true
|
||||
gn-build-type: release
|
||||
generate-symbols: true
|
||||
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||
secrets: inherit
|
||||
|
||||
publish-arm64-darwin:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
needs: checkout-macos
|
||||
with:
|
||||
@@ -62,6 +78,22 @@ jobs:
|
||||
build-runs-on: macos-14-xlarge
|
||||
target-platform: macos
|
||||
target-arch: arm64
|
||||
target-variant: darwin
|
||||
is-release: true
|
||||
gn-build-type: release
|
||||
generate-symbols: true
|
||||
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||
secrets: inherit
|
||||
|
||||
publish-arm64-mas:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
needs: checkout-macos
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: macos-14-xlarge
|
||||
target-platform: macos
|
||||
target-arch: arm64
|
||||
target-variant: mas
|
||||
is-release: true
|
||||
gn-build-type: release
|
||||
generate-symbols: true
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
container: ${{ fromJSON(inputs.container) }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
|
||||
2
.github/workflows/pipeline-electron-lint.yml
vendored
2
.github/workflows/pipeline-electron-lint.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
container: ${{ fromJSON(inputs.container) }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -15,6 +15,10 @@ on:
|
||||
type: string
|
||||
description: 'Arch to build for, can be x64, arm64 or arm'
|
||||
required: true
|
||||
target-variant:
|
||||
type: string
|
||||
description: 'Variant to build for, no effect on non-macOS target platforms. Can be darwin, mas or all.'
|
||||
default: all
|
||||
build-runs-on:
|
||||
type: string
|
||||
description: 'What host to run the build'
|
||||
@@ -57,13 +61,14 @@ on:
|
||||
|
||||
|
||||
concurrency:
|
||||
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
|
||||
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
|
||||
|
||||
env:
|
||||
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
ELECTRON_GITHUB_TOKEN: ${{ secrets.ELECTRON_GITHUB_TOKEN }}
|
||||
SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }}
|
||||
SUDOWOODO_EXCHANGE_TOKEN: ${{ secrets.SUDOWOODO_EXCHANGE_TOKEN }}
|
||||
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
|
||||
ELECTRON_OUT_DIR: Default
|
||||
|
||||
@@ -78,13 +83,19 @@ jobs:
|
||||
- name: Create src dir
|
||||
run: mkdir src
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
- name: Free up space (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/free-space-macos
|
||||
- name: Check disk space after freeing up space
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: df -h
|
||||
- name: Setup Node.js/npm
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
|
||||
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
|
||||
with:
|
||||
node-version: 20.11.x
|
||||
cache: yarn
|
||||
@@ -145,7 +156,7 @@ jobs:
|
||||
if: ${{ inputs.target-platform == 'linux' }}
|
||||
uses: ./src/electron/.github/actions/restore-cache-aks
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -153,7 +164,7 @@ jobs:
|
||||
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
|
||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
|
||||
- name: Run Electron Only Hooks
|
||||
run: |
|
||||
gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
|
||||
@@ -166,22 +177,14 @@ jobs:
|
||||
- name: Fix Sync (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/fix-sync-macos
|
||||
- name: Install build-tools & Setup RBE
|
||||
- name: Setup Number of Ninja Processes
|
||||
run: |
|
||||
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform == 'linux' && '300' || '200' }}" >> $GITHUB_ENV
|
||||
cd ~/.electron_build_tools
|
||||
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)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/free-space-macos
|
||||
- name: Build Electron
|
||||
if: ${{ inputs.target-platform != 'macos' || (inputs.target-variant == 'all' || inputs.target-variant == 'darwin') }}
|
||||
uses: ./src/electron/.github/actions/build-electron
|
||||
with:
|
||||
target-arch: ${{ inputs.target-arch }}
|
||||
@@ -193,13 +196,13 @@ jobs:
|
||||
upload-to-storage: '${{ inputs.upload-to-storage }}'
|
||||
is-asan: '${{ inputs.is-asan }}'
|
||||
- name: Set GN_EXTRA_ARGS for MAS Build
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
if: ${{ inputs.target-platform == 'macos' && (inputs.target-variant == 'all' || inputs.target-variant == 'mas') }}
|
||||
run: |
|
||||
echo "MAS_BUILD=true" >> $GITHUB_ENV
|
||||
GN_EXTRA_ARGS='is_mas_build=true'
|
||||
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
|
||||
- name: Build Electron (MAS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
if: ${{ inputs.target-platform == 'macos' && (inputs.target-variant == 'all' || inputs.target-variant == 'mas') }}
|
||||
uses: ./src/electron/.github/actions/build-electron
|
||||
with:
|
||||
target-arch: ${{ inputs.target-arch }}
|
||||
|
||||
@@ -50,15 +50,32 @@ jobs:
|
||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
- name: Cleanup disk space on macOS
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
shell: bash
|
||||
run: |
|
||||
sudo mkdir -p $TMPDIR/del-target
|
||||
|
||||
tmpify() {
|
||||
if [ -d "$1" ]; then
|
||||
sudo mv "$1" $TMPDIR/del-target/$(echo $1|shasum -a 256|head -n1|cut -d " " -f1)
|
||||
fi
|
||||
}
|
||||
tmpify /Library/Developer/CoreSimulator
|
||||
tmpify ~/Library/Developer/CoreSimulator
|
||||
sudo rm -rf $TMPDIR/del-target
|
||||
- name: Check disk space after freeing up space
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: df -h
|
||||
- name: 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
|
||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
|
||||
- name: Get Depot Tools
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
@@ -111,10 +128,14 @@ jobs:
|
||||
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
|
||||
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
cd src/electron
|
||||
node script/yarn install --frozen-lockfile
|
||||
- name: Default GN gen
|
||||
run: |
|
||||
cd src/electron
|
||||
|
||||
@@ -38,7 +38,6 @@ permissions:
|
||||
env:
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
ELECTRON_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@@ -92,7 +91,7 @@ jobs:
|
||||
fi
|
||||
done
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -147,17 +146,21 @@ jobs:
|
||||
sudo security authorizationdb write com.apple.trust-settings.admin allow
|
||||
cd src/electron
|
||||
./script/codesign/generate-identity.sh
|
||||
- name: Install Datadog CLI
|
||||
run: |
|
||||
cd src/electron
|
||||
node script/yarn global add @datadog/datadog-ci
|
||||
- name: Run Electron Tests
|
||||
shell: bash
|
||||
env:
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
ELECTRON_TEST_RESULTS_DIR: junit
|
||||
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
||||
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
||||
DISPLAY: ':99.0'
|
||||
run: |
|
||||
cd src/electron
|
||||
export ELECTRON_TEST_RESULTS_DIR=`pwd`/junit
|
||||
# Get which tests are on this shard
|
||||
tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ inputs.target-platform == 'macos' && 2 || 3 }})
|
||||
|
||||
@@ -186,9 +189,21 @@ jobs:
|
||||
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
|
||||
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 ]; then
|
||||
datadog-ci junit upload src/electron/junit/test-results-main.xml
|
||||
fi
|
||||
if: always() && !cancelled()
|
||||
- name: Upload Test Artifacts
|
||||
if: always() && !cancelled()
|
||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
|
||||
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
|
||||
with:
|
||||
name: test_artifacts_${{ env.ARTIFACT_KEY }}
|
||||
path: src/electron/spec/artifacts
|
||||
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
container: ${{ fromJSON(inputs.test-container) }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -108,7 +108,7 @@ jobs:
|
||||
container: ${{ fromJSON(inputs.test-container) }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
|
||||
2
.github/workflows/pull-request-labeled.yml
vendored
2
.github/workflows/pull-request-labeled.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger Slack workflow
|
||||
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
|
||||
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
|
||||
with:
|
||||
payload: |
|
||||
{
|
||||
|
||||
6
.github/workflows/scorecards.yml
vendored
6
.github/workflows/scorecards.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
|
||||
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
@@ -50,6 +50,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3
|
||||
uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
2
.github/workflows/update_appveyor_image.yml
vendored
2
.github/workflows/update_appveyor_image.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
with:
|
||||
creds: ${{ secrets.APPVEYOR_UPDATER_GH_APP_CREDS }}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
"autolink": false,
|
||||
"shortcut": false
|
||||
},
|
||||
"MD049": {
|
||||
"style": "underscore"
|
||||
},
|
||||
"no-angle-brackets": true,
|
||||
"no-curly-braces": true,
|
||||
"no-inline-html": {
|
||||
|
||||
5
BUILD.gn
5
BUILD.gn
@@ -74,7 +74,7 @@ if (is_linux) {
|
||||
"notify_notification_set_image_from_pixbuf",
|
||||
"notify_notification_set_timeout",
|
||||
"notify_notification_set_urgency",
|
||||
"notify_notification_set_hint_string",
|
||||
"notify_notification_set_hint",
|
||||
"notify_notification_show",
|
||||
"notify_notification_close",
|
||||
]
|
||||
@@ -674,6 +674,8 @@ source_set("electron_lib") {
|
||||
|
||||
if (enable_plugins) {
|
||||
sources += [
|
||||
"shell/browser/electron_plugin_info_host_impl.cc",
|
||||
"shell/browser/electron_plugin_info_host_impl.h",
|
||||
"shell/common/plugin_info.cc",
|
||||
"shell/common/plugin_info.h",
|
||||
]
|
||||
@@ -733,6 +735,7 @@ source_set("electron_lib") {
|
||||
"//components/pdf/common:util",
|
||||
"//components/pdf/renderer",
|
||||
"//pdf",
|
||||
"//pdf:content_restriction",
|
||||
]
|
||||
sources += [
|
||||
"shell/browser/electron_pdf_document_helper_client.cc",
|
||||
|
||||
4
DEPS
4
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'129.0.6668.0',
|
||||
'130.0.6723.118',
|
||||
'node_version':
|
||||
'v20.16.0',
|
||||
'v20.18.0',
|
||||
'nan_version':
|
||||
'e14bdcd1f72d62bca1d541b66da43130384ec213',
|
||||
'squirrel.mac_version':
|
||||
|
||||
@@ -29,14 +29,14 @@
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: electronhq-16-core
|
||||
image: e-129.0.6656.0
|
||||
image: e-130.0.6695.0-node-20
|
||||
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"
|
||||
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-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
|
||||
@@ -45,10 +45,16 @@ environment:
|
||||
matrix:
|
||||
|
||||
- job_name: Build Arm on X64 Windows
|
||||
- job_name: Test On Windows On Arm Hardware
|
||||
- job_name: Test On Windows On Arm Hardware 1
|
||||
job_depends_on: Build Arm on X64 Windows
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
|
||||
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
|
||||
shard: 1
|
||||
- job_name: Test On Windows On Arm Hardware 2
|
||||
job_depends_on: Build Arm on X64 Windows
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
|
||||
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
|
||||
shard: 2
|
||||
|
||||
clone_script:
|
||||
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
|
||||
@@ -70,8 +76,9 @@ for:
|
||||
- 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
|
||||
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) {
|
||||
@@ -95,6 +102,8 @@ for:
|
||||
- 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") {
|
||||
@@ -115,6 +124,11 @@ for:
|
||||
$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"
|
||||
}
|
||||
- cd ..\..
|
||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||
- ps: >-
|
||||
@@ -142,7 +156,7 @@ for:
|
||||
- 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)
|
||||
- autoninja -j 300 -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
|
||||
@@ -167,8 +181,8 @@ for:
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
# Needed for msdia140.dll on 64-bit windows
|
||||
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
||||
autoninja -C out/Default electron:electron_symbols
|
||||
}
|
||||
- if "%GN_CONFIG%"=="release" ( autoninja -C out/Default electron:electron_symbols )
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
python3 electron\script\zip-symbols.py
|
||||
@@ -244,18 +258,23 @@ for:
|
||||
}
|
||||
- matrix:
|
||||
only:
|
||||
- job_name: Test On Windows On Arm Hardware
|
||||
- job_name: Test On Windows On Arm Hardware 1
|
||||
- job_name: Test On Windows On Arm Hardware 2
|
||||
|
||||
environment:
|
||||
IGNORE_YARN_INSTALL_ERROR: 1
|
||||
ELECTRON_TEST_RESULTS_DIR: junit
|
||||
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
|
||||
ELECTRON_TEST_RESULTS_DIR: C:\projects\src\electron\junit
|
||||
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-reporter, tap"
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
||||
DD_ENV: ci
|
||||
DD_SERVICE: electron
|
||||
DD_CIVISIBILITY_LOGS_ENABLED: true
|
||||
DD_GIT_REPOSITORY_URL: "https://github.com/electron/electron.git"
|
||||
|
||||
build_script:
|
||||
- ps: |
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
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"
|
||||
@@ -263,6 +282,7 @@ for:
|
||||
} else {
|
||||
$global:LASTEXITCODE = 0
|
||||
}
|
||||
- ps: Invoke-WebRequest -Uri "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_win-x64" -OutFile "C:\projects\src\electron\datadog-ci.exe"
|
||||
- cd ..
|
||||
- mkdir out\Default
|
||||
- cd ..
|
||||
@@ -311,11 +331,22 @@ for:
|
||||
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
|
||||
- ps: $env:tests_files=node script\split-tests $env:shard 2
|
||||
- echo "Running shard %shard% specs %tests_files%"
|
||||
- echo Running main test suite & node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion --files %tests_files%
|
||||
- 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'))
|
||||
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )
|
||||
- if exist electron\junit\test-results-main.xml ( appveyor-retry appveyor PushArtifact electron\junit\test-results-main.xml )
|
||||
- ps: |
|
||||
if ($env:DD_API_KEY) {
|
||||
$env:DD_GIT_COMMIT_SHA = $env:APPVEYOR_REPO_COMMIT
|
||||
$env:DD_GIT_BRANCH = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH
|
||||
$env:DD_TAGS = "os.architecture:$env:TARGET_ARCH,os.family:windows,os.platform:win32"
|
||||
if (Test-Path -Path "C:\projects\src\electron\junit\test-results-main.xml") {
|
||||
C:\projects\src\electron\datadog-ci.exe junit upload --verbose C:\projects\src\electron\junit\test-results-main.xml
|
||||
}
|
||||
}
|
||||
|
||||
47
appveyor.yml
47
appveyor.yml
@@ -29,14 +29,14 @@
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: electronhq-16-core
|
||||
image: e-129.0.6656.0
|
||||
image: e-130.0.6695.0-node-20
|
||||
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"
|
||||
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-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
|
||||
@@ -45,8 +45,12 @@ environment:
|
||||
matrix:
|
||||
|
||||
- job_name: Build
|
||||
- job_name: Test
|
||||
- job_name: Test 1
|
||||
job_depends_on: Build
|
||||
shard: 1
|
||||
- job_name: Test 2
|
||||
job_depends_on: Build
|
||||
shard: 2
|
||||
|
||||
clone_script:
|
||||
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
|
||||
@@ -93,6 +97,8 @@ for:
|
||||
- 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") {
|
||||
@@ -113,6 +119,11 @@ for:
|
||||
$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"
|
||||
}
|
||||
- cd ..\..
|
||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||
- ps: >-
|
||||
@@ -140,7 +151,7 @@ for:
|
||||
- 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)
|
||||
- autoninja -j 300 -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
|
||||
@@ -164,8 +175,8 @@ for:
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
# Needed for msdia140.dll on 64-bit windows
|
||||
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
||||
autoninja -C out/Default electron:electron_symbols
|
||||
}
|
||||
- if "%GN_CONFIG%"=="release" ( autoninja -C out/Default electron:electron_symbols )
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
python3 electron\script\zip-symbols.py
|
||||
@@ -237,7 +248,15 @@ for:
|
||||
}
|
||||
- matrix:
|
||||
only:
|
||||
- job_name: Test
|
||||
- job_name: Test 1
|
||||
- job_name: Test 2
|
||||
|
||||
environment:
|
||||
DD_ENV: ci
|
||||
DD_SERVICE: electron
|
||||
DD_CIVISIBILITY_LOGS_ENABLED: true
|
||||
DD_GIT_REPOSITORY_URL: "https://github.com/electron/electron.git"
|
||||
ELECTRON_TEST_RESULTS_DIR: C:\projects\src\electron\junit
|
||||
|
||||
init:
|
||||
- ps: |
|
||||
@@ -254,6 +273,7 @@ for:
|
||||
} else {
|
||||
$global:LASTEXITCODE = 0
|
||||
}
|
||||
- npm install -g @datadog/datadog-ci
|
||||
- cd ..
|
||||
- mkdir out\Default
|
||||
- cd ..
|
||||
@@ -299,7 +319,9 @@ for:
|
||||
if ($env:TARGET_ARCH -eq 'ia32') {
|
||||
$env:npm_config_arch = "ia32"
|
||||
}
|
||||
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log
|
||||
- ps: $env:tests_files=node script\split-tests $env:shard 2
|
||||
- echo "Running shard %shard% specs %tests_files%"
|
||||
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging --files %tests_files%
|
||||
- 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"
|
||||
@@ -311,4 +333,13 @@ for:
|
||||
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'))
|
||||
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )
|
||||
- if exist electron\junit\test-results-main.xml ( appveyor-retry appveyor PushArtifact electron\junit\test-results-main.xml )
|
||||
- ps: |
|
||||
if ($env:RUN_TESTS -eq 'true' -And $env:DD_API_KEY) {
|
||||
$env:DD_GIT_COMMIT_SHA = $env:APPVEYOR_REPO_COMMIT
|
||||
$env:DD_GIT_BRANCH = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH
|
||||
$env:DD_TAGS = "os.architecture:$env:TARGET_ARCH,os.family:windows,os.platform:win32"
|
||||
if (Test-Path -Path "C:\projects\src\electron\junit\test-results-main.xml") {
|
||||
C:\Users\appveyor\AppData\Roaming\npm\datadog-ci.ps1 junit upload --verbose C:\projects\src\electron\junit\test-results-main.xml
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const webpack = require('webpack');
|
||||
const WrapperPlugin = require('wrapper-webpack-plugin');
|
||||
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const webpack = require('webpack');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const WrapperPlugin = require('wrapper-webpack-plugin');
|
||||
|
||||
const electronRoot = path.resolve(__dirname, '../..');
|
||||
|
||||
|
||||
@@ -114,6 +114,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/ui/view_ids.h",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
|
||||
"//chrome/browser/ui/views/overlay/back_to_tab_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/back_to_tab_button.h",
|
||||
"//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/close_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/close_image_button.h",
|
||||
@@ -266,11 +268,13 @@ static_library("chrome") {
|
||||
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.h",
|
||||
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.mm",
|
||||
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
|
||||
"//chrome/browser/permissions/system/media_authorization_wrapper_mac.h",
|
||||
"//chrome/browser/platform_util_mac.mm",
|
||||
"//chrome/browser/process_singleton_mac.mm",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
|
||||
]
|
||||
deps += [ ":system_media_capture_permissions_mac_conflict" ]
|
||||
}
|
||||
|
||||
if (enable_widevine) {
|
||||
@@ -490,3 +494,16 @@ source_set("chrome_spellchecker") {
|
||||
"//components/spellcheck/renderer",
|
||||
]
|
||||
}
|
||||
|
||||
# These sources create an object file conflict with one in |:chrome|, so they
|
||||
# must live in a separate target.
|
||||
# Conflicting sources:
|
||||
# //chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm
|
||||
# //chrome/browser/permissions/system/system_media_capture_permissions_mac.mm
|
||||
source_set("system_media_capture_permissions_mac_conflict") {
|
||||
sources = [
|
||||
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.h",
|
||||
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.mm",
|
||||
]
|
||||
deps = [ "//chrome/common" ]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { shell } from 'electron/common';
|
||||
import { app, dialog, BrowserWindow, ipcMain } from 'electron/main';
|
||||
|
||||
import * as path from 'node:path';
|
||||
import * as url from 'node:url';
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import * as fs from 'node:fs';
|
||||
import { Module } from 'node:module';
|
||||
import * as path from 'node:path';
|
||||
import * as url from 'node:url';
|
||||
|
||||
const { app, dialog } = electron;
|
||||
|
||||
type DefaultAppOptions = {
|
||||
@@ -255,6 +256,7 @@ async function startRepl () {
|
||||
// start the default app.
|
||||
if (option.file && !option.webdriver) {
|
||||
const file = option.file;
|
||||
// eslint-disable-next-line n/no-deprecated-api
|
||||
const protocol = url.parse(file).protocol;
|
||||
const extension = path.extname(file);
|
||||
if (protocol === 'http:' || protocol === 'https:' || protocol === 'file:' || protocol === 'chrome:') {
|
||||
|
||||
@@ -37,6 +37,7 @@ an issue:
|
||||
* [Offline/Online Detection](tutorial/online-offline-events.md)
|
||||
* [Represented File for macOS BrowserWindows](tutorial/represented-file.md)
|
||||
* [Native File Drag & Drop](tutorial/native-file-drag-drop.md)
|
||||
* [Navigation History](tutorial/navigation-history.md)
|
||||
* [Offscreen Rendering](tutorial/offscreen-rendering.md)
|
||||
* [Dark Mode](tutorial/dark-mode.md)
|
||||
* [Web embeds in Electron](tutorial/web-embeds.md)
|
||||
|
||||
2
docs/api/app.md
Executable file → Normal file
2
docs/api/app.md
Executable file → Normal file
@@ -416,7 +416,7 @@ Returns:
|
||||
* `launch-failed` - Process never successfully launched
|
||||
* `integrity-failure` - Windows code integrity checks failed
|
||||
* `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.
|
||||
* `name` string (optional) - The name of the process.
|
||||
Examples for utility: `Audio Service`, `Content Decryption Module Service`, `Network Service`, `Video Capture`, etc.
|
||||
|
||||
@@ -32,22 +32,28 @@ This is a requirement of `Squirrel.Mac`.
|
||||
### Windows
|
||||
|
||||
On Windows, you have to install your app into a user's machine before you can
|
||||
use the `autoUpdater`, so it is recommended that you use the
|
||||
[electron-winstaller][installer-lib], [Electron Forge][electron-forge-lib] or the [grunt-electron-installer][installer] package to generate a Windows installer.
|
||||
use the `autoUpdater`, so it is recommended that you use
|
||||
[electron-winstaller][installer-lib] or [Electron Forge's Squirrel.Windows maker][electron-forge-lib] to generate a Windows installer.
|
||||
|
||||
When using [electron-winstaller][installer-lib] or [Electron Forge][electron-forge-lib] make sure you do not try to update your app [the first time it runs](https://github.com/electron/windows-installer#handling-squirrel-events) (Also see [this issue for more info](https://github.com/electron/electron/issues/7155)). It's also recommended to use [electron-squirrel-startup](https://github.com/mongodb-js/electron-squirrel-startup) to get desktop shortcuts for your app.
|
||||
Apps built with Squirrel.Windows will trigger [custom launch events](https://github.com/Squirrel/Squirrel.Windows/blob/51f5e2cb01add79280a53d51e8d0cfa20f8c9f9f/docs/using/custom-squirrel-events-non-cs.md#application-startup-commands)
|
||||
that must be handled by your Electron application to ensure proper setup and teardown.
|
||||
|
||||
The installer generated with Squirrel will create a shortcut icon with an
|
||||
Squirrel.Windows apps will launch with the `--squirrel-firstrun` argument immediately
|
||||
after installation. During this time, Squirrel.Windows will obtain a file lock on
|
||||
your app, and `autoUpdater` requests will fail until the lock is released. In practice,
|
||||
this means that you won't be able to check for updates on first launch for the first
|
||||
few seconds. You can work around this by not checking for updates when `process.argv`
|
||||
contains the `--squirrel-firstrun` flag or by setting a 10-second timeout on your
|
||||
update checks (see [electron/electron#7155](https://github.com/electron/electron/issues/7155)
|
||||
for more information).
|
||||
|
||||
The installer generated with Squirrel.Windows will create a shortcut icon with an
|
||||
[Application User Model ID][app-user-model-id] in the format of
|
||||
`com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE`, examples are
|
||||
`com.squirrel.slack.Slack` and `com.squirrel.code.Code`. You have to use the
|
||||
same ID for your app with `app.setAppUserModelId` API, otherwise Windows will
|
||||
not be able to pin your app properly in task bar.
|
||||
|
||||
Like Squirrel.Mac, Windows can host updates on S3 or any other static file host.
|
||||
You can read the documents of [Squirrel.Windows][squirrel-windows] to get more details
|
||||
about how Squirrel.Windows works.
|
||||
|
||||
## Events
|
||||
|
||||
The `autoUpdater` object emits the following events:
|
||||
@@ -137,9 +143,7 @@ application starts.
|
||||
|
||||
[squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac
|
||||
[server-support]: https://github.com/Squirrel/Squirrel.Mac#server-support
|
||||
[squirrel-windows]: https://github.com/Squirrel/Squirrel.Windows
|
||||
[installer]: https://github.com/electron-archive/grunt-electron-installer
|
||||
[installer-lib]: https://github.com/electron/windows-installer
|
||||
[electron-forge-lib]: https://github.com/electron/forge
|
||||
[electron-forge-lib]: https://www.electronforge.io/config/makers/squirrel.windows
|
||||
[app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
|
||||
@@ -126,10 +126,18 @@ or session log off.
|
||||
|
||||
#### Event: 'blur'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
|
||||
Emitted when the window loses focus.
|
||||
|
||||
#### Event: 'focus'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
|
||||
Emitted when the window gains focus.
|
||||
|
||||
#### Event: 'show'
|
||||
@@ -479,7 +487,7 @@ Sets the content view of the window.
|
||||
|
||||
#### `win.getContentView()`
|
||||
|
||||
Returns [View](view.md) - The content view of the window.
|
||||
Returns [`View`](view.md) - The content view of the window.
|
||||
|
||||
#### `win.destroy()`
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ following properties:
|
||||
[`request.followRedirect`](#requestfollowredirect) is invoked synchronously
|
||||
during the [`redirect`](#event-redirect) event. Defaults to `follow`.
|
||||
* `origin` string (optional) - The origin URL of the request.
|
||||
* `referrerPolicy` string (optional) - can be `""`, `no-referrer`,
|
||||
* `referrerPolicy` string (optional) - can be "", `no-referrer`,
|
||||
`no-referrer-when-downgrade`, `origin`, `origin-when-cross-origin`,
|
||||
`unsafe-url`, `same-origin`, `strict-origin`, or
|
||||
`strict-origin-when-cross-origin`. Defaults to
|
||||
|
||||
@@ -38,7 +38,7 @@ Without `*` prefix the URL has to match exactly.
|
||||
|
||||
### --disable-ntlm-v2
|
||||
|
||||
Disables NTLM v2 for posix platforms, no effect elsewhere.
|
||||
Disables NTLM v2 for POSIX platforms, no effect elsewhere.
|
||||
|
||||
### --disable-http-cache
|
||||
|
||||
|
||||
@@ -147,6 +147,25 @@ has been included below for completeness:
|
||||
|
||||
If the type you care about is not in the above table, it is probably not supported.
|
||||
|
||||
### Exposing ipcRenderer
|
||||
|
||||
Attempting to send the entire `ipcRenderer` module as an object over the `contextBridge` will result in
|
||||
an empty object on the receiving side of the bridge. Sending over `ipcRenderer` in full can let any
|
||||
code send any message, which is a security footgun. To interact through `ipcRenderer`, provide a safe wrapper
|
||||
like below:
|
||||
|
||||
```js
|
||||
// Preload (Isolated World)
|
||||
contextBridge.exposeInMainWorld('electron', {
|
||||
onMyEventName: (callback) => ipcRenderer.on('MyEventName', (e, ...args) => callback(args))
|
||||
})
|
||||
```
|
||||
|
||||
```js @ts-nocheck
|
||||
// Renderer (Main World)
|
||||
window.electron.onMyEventName(data => { /* ... */ })
|
||||
```
|
||||
|
||||
### Exposing Node Global Symbols
|
||||
|
||||
The `contextBridge` can be used by the preload script to give your renderer access to Node APIs.
|
||||
|
||||
@@ -74,7 +74,7 @@ The following methods are available on instances of `Cookies`:
|
||||
`url`. Empty implies retrieving cookies of all URLs.
|
||||
* `name` string (optional) - Filters cookies by name.
|
||||
* `domain` string (optional) - Retrieves cookies whose domains match or are
|
||||
subdomains of `domain`.
|
||||
subdomains of `domains`.
|
||||
* `path` string (optional) - Retrieves cookies whose path matches `path`.
|
||||
* `secure` boolean (optional) - Filters cookies by their Secure property.
|
||||
* `session` boolean (optional) - Filters out session or persistent cookies.
|
||||
|
||||
@@ -20,7 +20,11 @@ app.whenReady().then(() => {
|
||||
// Grant access to the first screen found.
|
||||
callback({ video: sources[0], audio: 'loopback' })
|
||||
})
|
||||
})
|
||||
// If true, use the system picker if available.
|
||||
// Note: this is currently experimental. If the system picker
|
||||
// is available, it will be used and the media request handler
|
||||
// will not be invoked.
|
||||
}, { useSystemPicker: true })
|
||||
|
||||
mainWindow.loadFile('index.html')
|
||||
})
|
||||
|
||||
@@ -31,7 +31,7 @@ Emitted when a request has been canceled during an ongoing HTTP transaction.
|
||||
|
||||
Returns:
|
||||
|
||||
`error` Error - Typically holds an error string identifying failure root cause.
|
||||
* `error` Error - Typically holds an error string identifying failure root cause.
|
||||
|
||||
Emitted when an error was encountered while streaming response data events. For
|
||||
instance, if the server closes the underlying while the response is still
|
||||
|
||||
@@ -10,9 +10,9 @@ See [`Menu`](menu.md) for examples.
|
||||
|
||||
* `options` Object
|
||||
* `click` Function (optional) - Will be called with
|
||||
`click(menuItem, browserWindow, event)` when the menu item is clicked.
|
||||
`click(menuItem, window, event)` when the menu item is clicked.
|
||||
* `menuItem` MenuItem
|
||||
* `browserWindow` [BrowserWindow](browser-window.md) | undefined - This will not be defined if no window is open.
|
||||
* `window` [BaseWindow](base-window.md) | undefined - This will not be defined if no window is open.
|
||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||
* `role` string (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`, `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `showAllTabs`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
||||
`click` property will be ignored. See [roles](#roles).
|
||||
@@ -146,7 +146,7 @@ A `Function` that is fired when the MenuItem receives a click event.
|
||||
It can be called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
|
||||
|
||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||
* `focusedWindow` [BrowserWindow](browser-window.md)
|
||||
* `focusedWindow` [BaseWindow](browser-window.md)
|
||||
* `focusedWebContents` [WebContents](web-contents.md)
|
||||
|
||||
#### `menuItem.submenu`
|
||||
|
||||
@@ -36,7 +36,7 @@ Returns `boolean` - Whether or not desktop notifications are supported on the cu
|
||||
* `subtitle` string (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
|
||||
* `body` string (optional) - The body text of the notification, which will be displayed below the title or subtitle.
|
||||
* `silent` boolean (optional) - Whether or not to suppress the OS notification noise when showing the notification.
|
||||
* `icon` (string | [NativeImage](native-image.md)) (optional) - An icon to use in the notification.
|
||||
* `icon` (string | [NativeImage](native-image.md)) (optional) - An icon to use in the notification. If a string is passed, it must be a valid path to a local icon file.
|
||||
* `hasReply` boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
|
||||
* `timeoutType` string (optional) _Linux_ _Windows_ - The timeout duration of the notification. Can be 'default' or 'never'.
|
||||
* `replyPlaceholder` string (optional) _macOS_ - The placeholder to write in the inline reply input field.
|
||||
|
||||
@@ -268,7 +268,8 @@ Returns:
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `deviceList` [HIDDevice[]](structures/hid-device.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
|
||||
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||
* `callback` Function
|
||||
* `deviceId` string | null (optional)
|
||||
|
||||
@@ -332,7 +333,8 @@ Returns:
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `device` [HIDDevice](structures/hid-device.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
|
||||
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||
|
||||
Emitted after `navigator.hid.requestDevice` has been called and
|
||||
`select-hid-device` has fired if a new device becomes available before
|
||||
@@ -347,7 +349,8 @@ Returns:
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `device` [HIDDevice](structures/hid-device.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
|
||||
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||
|
||||
Emitted after `navigator.hid.requestDevice` has been called and
|
||||
`select-hid-device` has fired if a device has been removed before the callback
|
||||
@@ -473,7 +476,8 @@ Returns:
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `port` [SerialPort](structures/serial-port.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
|
||||
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.
|
||||
|
||||
Emitted after `SerialPort.forget()` has been called. This event can be used
|
||||
@@ -495,7 +499,7 @@ app.whenReady().then(() => {
|
||||
})
|
||||
```
|
||||
|
||||
```js
|
||||
```js @ts-nocheck
|
||||
// Renderer Process
|
||||
|
||||
const portConnect = async () => {
|
||||
@@ -517,7 +521,8 @@ Returns:
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `deviceList` [USBDevice[]](structures/usb-device.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
|
||||
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||
* `callback` Function
|
||||
* `deviceId` string (optional)
|
||||
|
||||
@@ -953,11 +958,12 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
|
||||
})
|
||||
```
|
||||
|
||||
#### `ses.setDisplayMediaRequestHandler(handler)`
|
||||
#### `ses.setDisplayMediaRequestHandler(handler[, opts])`
|
||||
|
||||
* `handler` Function | null
|
||||
* `request` Object
|
||||
* `frame` [WebFrameMain](web-frame-main.md) - Frame that is requesting access to media.
|
||||
* `frame` [WebFrameMain](web-frame-main.md) | null - 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.
|
||||
* `videoRequested` Boolean - true if the web content requested a video stream.
|
||||
* `audioRequested` Boolean - true if the web content requested an audio stream.
|
||||
@@ -980,12 +986,18 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
|
||||
and this is set to `true`, then local playback of audio will not be muted (e.g. using `MediaRecorder`
|
||||
to record `WebFrameMain` with this flag set to `true` will allow audio to pass through to the speakers
|
||||
while recording). Default is `false`.
|
||||
* `opts` Object (optional) _macOS_ _Experimental_
|
||||
* `useSystemPicker` Boolean - true if the available native system picker should be used. Default is `false`. _macOS_ _Experimental_
|
||||
|
||||
This handler will be called when web content requests access to display media
|
||||
via the `navigator.mediaDevices.getDisplayMedia` API. Use the
|
||||
[desktopCapturer](desktop-capturer.md) API to choose which stream(s) to grant
|
||||
access to.
|
||||
|
||||
`useSystemPicker` allows an application to use the system picker instead of providing a specific video source from `getSources`.
|
||||
This option is experimental, and currently available for MacOS 15+ only. If the system picker is available and `useSystemPicker`
|
||||
is set to `true`, the handler will not be invoked.
|
||||
|
||||
```js
|
||||
const { session, desktopCapturer } = require('electron')
|
||||
|
||||
@@ -994,7 +1006,11 @@ session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
|
||||
// Grant access to the first screen found.
|
||||
callback({ video: sources[0] })
|
||||
})
|
||||
})
|
||||
// Use the system picker if available.
|
||||
// Note: this is currently experimental. If the system picker
|
||||
// is available, it will be used and the media request handler
|
||||
// will not be invoked.
|
||||
}, { useSystemPicker: true })
|
||||
```
|
||||
|
||||
Passing a [WebFrameMain](web-frame-main.md) object as a video or audio stream
|
||||
@@ -1148,7 +1164,8 @@ app.whenReady().then(() => {
|
||||
pin displayed on the device.
|
||||
* `providePin`
|
||||
This prompt is requesting that a pin be provided for the device.
|
||||
* `frame` [WebFrameMain](web-frame-main.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this handler.
|
||||
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`.
|
||||
* `callback` Function
|
||||
* `response` Object
|
||||
@@ -1511,7 +1528,7 @@ Returns `Promise<void>` - resolves when all data has been cleared.
|
||||
|
||||
Clears various different types of data.
|
||||
|
||||
This method clears more types of data and is more thourough than the
|
||||
This method clears more types of data and is more thorough than the
|
||||
`clearStorageData` method.
|
||||
|
||||
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
|
||||
|
||||
@@ -36,7 +36,7 @@ Open the given file in the desktop's default manner.
|
||||
|
||||
### `shell.openExternal(url[, options])`
|
||||
|
||||
* `url` string - Max 2081 characters on windows.
|
||||
* `url` string - Max 2081 characters on Windows.
|
||||
* `options` Object (optional)
|
||||
* `activate` boolean (optional) _macOS_ - `true` to bring the opened application to the foreground. The default is `true`.
|
||||
* `workingDirectory` string (optional) _Windows_ - The working directory.
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
* `show` boolean (optional) - Whether window should be shown when created. Default is
|
||||
`true`.
|
||||
* `frame` boolean (optional) - Specify `false` to create a
|
||||
[frameless window](../../tutorial/window-customization.md#create-frameless-windows). Default is `true`.
|
||||
[frameless window](../../tutorial/custom-window-styles.md#frameless-windows). Default is `true`.
|
||||
* `parent` BaseWindow (optional) - Specify parent window. Default is `null`.
|
||||
* `modal` boolean (optional) - Whether this is a modal window. This only works when the
|
||||
window is a child window. Default is `false`.
|
||||
@@ -70,7 +70,7 @@
|
||||
is only implemented on Windows and macOS.
|
||||
* `darkTheme` boolean (optional) - Forces using dark theme for the window, only works on
|
||||
some GTK+3 desktop environments. Default is `false`.
|
||||
* `transparent` boolean (optional) - Makes the window [transparent](../../tutorial/window-customization.md#create-transparent-windows).
|
||||
* `transparent` boolean (optional) - Makes the window [transparent](../../tutorial/custom-window-styles.md#transparent-windows).
|
||||
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
|
||||
this below.
|
||||
@@ -91,6 +91,10 @@
|
||||
title bar and a full size content window, the traffic light buttons will
|
||||
display when being hovered over in the top left of the window.
|
||||
**Note:** This option is currently experimental.
|
||||
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
|
||||
* `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
|
||||
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
|
||||
Set a custom position for the traffic light buttons in frameless windows.
|
||||
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
|
||||
@@ -149,3 +153,6 @@ Possible values are:
|
||||
reserved for NSPanel, at runtime. Also, the window will appear on all
|
||||
spaces (desktops).
|
||||
* On Windows, possible type is `toolbar`.
|
||||
|
||||
[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables
|
||||
[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis
|
||||
|
||||
@@ -2,10 +2,3 @@
|
||||
|
||||
* `webPreferences` [WebPreferences](web-preferences.md?inline) (optional) - Settings of web page's features.
|
||||
* `paintWhenInitiallyHidden` boolean (optional) - Whether the renderer should be active when `show` is `false` and it has just been created. In order for `document.visibilityState` to work correctly on first load with `show: false` you should set this to `false`. Setting this to `false` will cause the `ready-to-show` event to not fire. Default is `true`.
|
||||
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
|
||||
* `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
|
||||
|
||||
[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables
|
||||
[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* `frameId` Integer - The ID of the renderer frame that sent this message
|
||||
* `returnValue` any - Set this to the value to be returned in a synchronous message
|
||||
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
|
||||
* `senderFrame` [WebFrameMain](../web-frame-main.md) _Readonly_ - The frame that sent this 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.
|
||||
* `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
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
* `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
|
||||
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
|
||||
* `senderFrame` [WebFrameMain](../web-frame-main.md) _Readonly_ - The frame that sent this 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.
|
||||
|
||||
24
docs/api/structures/offscreen-shared-texture.md
Normal file
24
docs/api/structures/offscreen-shared-texture.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# OffscreenSharedTexture Object
|
||||
|
||||
* `textureInfo` Object - The shared texture info.
|
||||
* `widgetType` string - The widget type of the texture. Can be `popup` or `frame`.
|
||||
* `pixelFormat` string - The pixel format of the texture. Can be `rgba` or `bgra`.
|
||||
* `codedSize` [Size](size.md) - The full dimensions of the video frame.
|
||||
* `visibleRect` [Rectangle](rectangle.md) - A subsection of [0, 0, codedSize.width(), codedSize.height()]. In OSR case, it is expected to have the full section area.
|
||||
* `contentRect` [Rectangle](rectangle.md) - The region of the video frame that capturer would like to populate. In OSR case, it is the same with `dirtyRect` that needs to be painted.
|
||||
* `timestamp` number - The time in microseconds since the capture start.
|
||||
* `metadata` Object - Extra metadata. See comments in src\media\base\video_frame_metadata.h for accurate details.
|
||||
* `captureUpdateRect` [Rectangle](rectangle.md) (optional) - Updated area of frame, can be considered as the `dirty` area.
|
||||
* `regionCaptureRect` [Rectangle](rectangle.md) (optional) - May reflect the frame's contents origin if region capture is used internally.
|
||||
* `sourceSize` [Rectangle](rectangle.md) (optional) - Full size of the source frame.
|
||||
* `frameCount` number (optional) - The increasing count of captured frame. May contain gaps if frames are dropped between two consecutively received frames.
|
||||
* `sharedTextureHandle` Buffer _Windows_ _macOS_ - The handle to the shared texture.
|
||||
* `planes` Object[] _Linux_ - Each plane's info of the shared texture.
|
||||
* `stride` number - The strides and offsets in bytes to be used when accessing the buffers via a memory mapping. One per plane per entry.
|
||||
* `offset` number - The strides and offsets in bytes to be used when accessing the buffers via a memory mapping. One per plane per entry.
|
||||
* `size` number - Size in bytes of the plane. This is necessary to map the buffers.
|
||||
* `fd` number - File descriptor for the underlying memory object (usually dmabuf).
|
||||
* `modifier` string _Linux_ - The modifier is retrieved from GBM library and passed to EGL driver.
|
||||
* `release` Function - Release the resources. The `texture` cannot be directly passed to another process, users need to maintain texture lifecycles in
|
||||
main process, but it is safe to pass the `textureInfo` to another process. Only a limited number of textures can exist at the same time, so it's important
|
||||
that you call `texture.release()` as soon as you're done with the texture.
|
||||
@@ -79,10 +79,14 @@
|
||||
[browserWindow](../browser-window.md) has disabled `backgroundThrottling` then
|
||||
frames will be drawn and swapped for the whole window and other
|
||||
[webContents](../web-contents.md) displayed by it. Defaults to `true`.
|
||||
* `offscreen` boolean (optional) - Whether to enable offscreen rendering for the browser
|
||||
* `offscreen` Object | boolean (optional) - Whether to enable offscreen rendering for the browser
|
||||
window. Defaults to `false`. See the
|
||||
[offscreen rendering tutorial](../../tutorial/offscreen-rendering.md) for
|
||||
more details.
|
||||
* `useSharedTexture` boolean (optional) _Experimental_ - Whether to use GPU shared texture for accelerated
|
||||
paint event. Defaults to `false`. See the
|
||||
[offscreen rendering tutorial](../../tutorial/offscreen-rendering.md) for
|
||||
more details.
|
||||
* `contextIsolation` boolean (optional) - Whether to run Electron APIs and
|
||||
the specified `preload` script in a separate JavaScript context. Defaults
|
||||
to `true`. The context that the `preload` script runs in will only have
|
||||
|
||||
@@ -39,7 +39,7 @@ updates the control in the touch bar. Possible values:
|
||||
|
||||
#### `touchBarScrubber.overlayStyle`
|
||||
|
||||
A `string` representing the style that selected items in the scrubber should have. This style is overlayed on top
|
||||
A `string` representing the style that selected items in the scrubber should have. This style is overlaid on top
|
||||
of the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the
|
||||
touch bar. Possible values:
|
||||
|
||||
|
||||
@@ -86,9 +86,21 @@ true if the kill is successful, and false otherwise.
|
||||
#### `child.pid`
|
||||
|
||||
A `Integer | undefined` representing the process identifier (PID) of the child process.
|
||||
If the child process fails to spawn due to errors, then the value is `undefined`. When
|
||||
Until the child process has spawned successfully, the value is `undefined`. When
|
||||
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'))
|
||||
|
||||
child.on('spawn', () => {
|
||||
console.log(child.pid) // Integer
|
||||
})
|
||||
|
||||
child.on('exit', () => {
|
||||
console.log(child.pid) // undefined
|
||||
})
|
||||
```
|
||||
|
||||
#### `child.stdout`
|
||||
|
||||
A `NodeJS.ReadableStream | null` that represents the child process's stdout.
|
||||
@@ -116,12 +128,26 @@ When the child process exits, then the value is `null` after the `exit` event is
|
||||
|
||||
Emitted once the child process has spawned successfully.
|
||||
|
||||
#### Event: 'error' _Experimental_
|
||||
|
||||
Returns:
|
||||
|
||||
* `type` string - Type of error. One of the following values:
|
||||
* `FatalError`
|
||||
* `location` string - Source location from where the error originated.
|
||||
* `report` string - [`Node.js diagnostic report`][].
|
||||
|
||||
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'
|
||||
|
||||
Returns:
|
||||
|
||||
* `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.
|
||||
|
||||
@@ -138,3 +164,4 @@ Emitted when the child process sends a message using [`process.parentPort.postMe
|
||||
[stdio]: https://nodejs.org/dist/latest/docs/api/child_process.html#optionsstdio
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[`MessagePortMain`]: message-port-main.md
|
||||
[`Node.js diagnostic report`]: https://nodejs.org/docs/latest/api/report.html#diagnostic-report
|
||||
|
||||
@@ -55,6 +55,8 @@ it becomes the topmost view.
|
||||
|
||||
* `view` View - Child view to remove.
|
||||
|
||||
If the view passed as a parameter is not a child of this view, this method is a no-op.
|
||||
|
||||
#### `view.setBounds(bounds)`
|
||||
|
||||
* `bounds` [Rectangle](structures/rectangle.md) - New bounds of the View.
|
||||
|
||||
@@ -242,8 +242,9 @@ Returns:
|
||||
* `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.
|
||||
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
||||
* `frame` WebFrameMain - The frame to be navigated.
|
||||
* `initiator` WebFrameMain (optional) - The frame which initiated the
|
||||
* `frame` WebFrameMain | null - The frame to be navigated.
|
||||
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
|
||||
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
|
||||
can also be null if the initiating frame was deleted before the event was
|
||||
@@ -275,8 +276,9 @@ Returns:
|
||||
* `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.
|
||||
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
||||
* `frame` WebFrameMain - The frame to be navigated.
|
||||
* `initiator` WebFrameMain (optional) - The frame which initiated the
|
||||
* `frame` WebFrameMain | null - The frame to be navigated.
|
||||
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
|
||||
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
|
||||
can also be null if the initiating frame was deleted before the event was
|
||||
@@ -306,8 +308,9 @@ Returns:
|
||||
document. Examples of same document navigations are reference fragment
|
||||
navigations, pushState/replaceState, and same page history navigation.
|
||||
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
||||
* `frame` WebFrameMain - The frame to be navigated.
|
||||
* `initiator` WebFrameMain (optional) - The frame which initiated the
|
||||
* `frame` WebFrameMain | null - The frame to be navigated.
|
||||
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
|
||||
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
|
||||
can also be null if the initiating frame was deleted before the event was
|
||||
@@ -330,8 +333,9 @@ Returns:
|
||||
document. Examples of same document navigations are reference fragment
|
||||
navigations, pushState/replaceState, and same page history navigation.
|
||||
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
||||
* `frame` WebFrameMain - The frame to be navigated.
|
||||
* `initiator` WebFrameMain (optional) - The frame which initiated the
|
||||
* `frame` WebFrameMain | null - The frame to be navigated.
|
||||
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
|
||||
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
|
||||
can also be null if the initiating frame was deleted before the event was
|
||||
@@ -361,8 +365,9 @@ Returns:
|
||||
document. Examples of same document navigations are reference fragment
|
||||
navigations, pushState/replaceState, and same page history navigation.
|
||||
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
||||
* `frame` WebFrameMain - The frame to be navigated.
|
||||
* `initiator` WebFrameMain (optional) - The frame which initiated the
|
||||
* `frame` WebFrameMain | null - The frame to be navigated.
|
||||
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
|
||||
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
|
||||
can also be null if the initiating frame was deleted before the event was
|
||||
@@ -743,7 +748,8 @@ Returns:
|
||||
* `params` Object
|
||||
* `x` Integer - x coordinate.
|
||||
* `y` Integer - y coordinate.
|
||||
* `frame` WebFrameMain - Frame from which the context menu was invoked.
|
||||
* `frame` WebFrameMain | null - 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
|
||||
was invoked on.
|
||||
* `linkText` string - Text associated with the link. May be an empty
|
||||
@@ -869,12 +875,12 @@ app.whenReady().then(() => {
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `details` Event\<\>
|
||||
* `texture` [OffscreenSharedTexture](structures/offscreen-shared-texture.md) (optional) _Experimental_ - The GPU shared texture of the frame, when `webPreferences.offscreen.useSharedTexture` is `true`.
|
||||
* `dirtyRect` [Rectangle](structures/rectangle.md)
|
||||
* `image` [NativeImage](native-image.md) - The image data of the whole frame.
|
||||
|
||||
Emitted when a new frame is generated. Only the dirty area is passed in the
|
||||
buffer.
|
||||
Emitted when a new frame is generated. Only the dirty area is passed in the buffer.
|
||||
|
||||
```js
|
||||
const { BrowserWindow } = require('electron')
|
||||
@@ -886,6 +892,33 @@ win.webContents.on('paint', (event, dirty, image) => {
|
||||
win.loadURL('https://github.com')
|
||||
```
|
||||
|
||||
When using shared texture (set `webPreferences.offscreen.useSharedTexture` to `true`) feature, you can pass the texture handle to external rendering pipeline without the overhead of
|
||||
copying data between CPU and GPU memory, with Chromium's hardware acceleration support. This feature is helpful for high-performance rendering scenarios.
|
||||
|
||||
Only a limited number of textures can exist at the same time, so it's important that you call `texture.release()` as soon as you're done with the texture.
|
||||
By managing the texture lifecycle by yourself, you can safely pass the `texture.textureInfo` to other processes through IPC.
|
||||
|
||||
```js
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
const win = new BrowserWindow({ webPreferences: { offscreen: { useSharedTexture: true } } })
|
||||
win.webContents.on('paint', async (e, dirty, image) => {
|
||||
if (e.texture) {
|
||||
// By managing lifecycle yourself, you can handle the event in async handler or pass the `e.texture.textureInfo`
|
||||
// to other processes (not `e.texture`, the `e.texture.release` function is not passable through IPC).
|
||||
await new Promise(resolve => setTimeout(resolve, 50))
|
||||
|
||||
// You can send the native texture handle to native code for importing into your rendering pipeline.
|
||||
// For example: https://github.com/electron/electron/tree/main/spec/fixtures/native-addon/osr-gpu
|
||||
// importTextureHandle(dirty, e.texture.textureInfo)
|
||||
|
||||
// You must call `e.texture.release()` as soon as possible, before the underlying frame pool is drained.
|
||||
e.texture.release()
|
||||
}
|
||||
})
|
||||
win.loadURL('https://github.com')
|
||||
```
|
||||
|
||||
#### Event: 'devtools-reload-page'
|
||||
|
||||
Emitted when the devtools window instructs the webContents to reload
|
||||
@@ -983,7 +1016,8 @@ Returns:
|
||||
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `frame` WebFrameMain
|
||||
* `frame` WebFrameMain | null - The created frame.
|
||||
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.
|
||||
|
||||
|
||||
@@ -97,6 +97,10 @@ this limitation.
|
||||
|
||||
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)`
|
||||
|
||||
* `channel` string
|
||||
@@ -231,6 +235,13 @@ 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.
|
||||
|
||||
#### `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
|
||||
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
||||
[`MessagePortMain`]: message-port-main.md
|
||||
[unload]: https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event
|
||||
|
||||
@@ -182,7 +182,7 @@ dispatch errors of isolated worlds to foreign worlds.
|
||||
|
||||
### `webFrame.setIsolatedWorldInfo(worldId, info)`
|
||||
|
||||
* `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electrons `contextIsolation` feature. Chrome extensions reserve the range of IDs in `[1 << 20, 1 << 29)`. You can provide any integer here.
|
||||
* `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.
|
||||
* `info` Object
|
||||
* `securityOrigin` string (optional) - Security origin for the isolated world.
|
||||
* `csp` string (optional) - Content Security Policy for the isolated world.
|
||||
|
||||
@@ -51,7 +51,8 @@ The following methods are available on instances of `WebRequest`:
|
||||
* `method` string
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||
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`.
|
||||
* `referrer` string
|
||||
* `timestamp` Double
|
||||
@@ -94,7 +95,8 @@ Some examples of valid `urls`:
|
||||
* `method` string
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||
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`.
|
||||
* `referrer` string
|
||||
* `timestamp` Double
|
||||
@@ -122,7 +124,8 @@ The `callback` has to be called with a `response` object.
|
||||
* `method` string
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||
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`.
|
||||
* `referrer` string
|
||||
* `timestamp` Double
|
||||
@@ -142,7 +145,8 @@ response are visible by the time this listener is fired.
|
||||
* `method` string
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||
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`.
|
||||
* `referrer` string
|
||||
* `timestamp` Double
|
||||
@@ -173,7 +177,8 @@ The `callback` has to be called with a `response` object.
|
||||
* `method` string
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||
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`.
|
||||
* `referrer` string
|
||||
* `timestamp` Double
|
||||
@@ -197,7 +202,8 @@ and response headers are available.
|
||||
* `method` string
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||
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`.
|
||||
* `referrer` string
|
||||
* `timestamp` Double
|
||||
@@ -222,7 +228,8 @@ redirect is about to occur.
|
||||
* `method` string
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||
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`.
|
||||
* `referrer` string
|
||||
* `timestamp` Double
|
||||
@@ -245,7 +252,8 @@ completed.
|
||||
* `method` string
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||
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`.
|
||||
* `referrer` string
|
||||
* `timestamp` Double
|
||||
|
||||
@@ -14,7 +14,7 @@ The `webUtils` module has the following methods:
|
||||
|
||||
Returns `string` - The file system path that this `File` object points to. In the case where the object passed in is not a `File` object an exception is thrown. In the case where the File object passed in was constructed in JS and is not backed by a file on disk an empty string is returned.
|
||||
|
||||
This method superceded the previous augmentation to the `File` object with the `path` property. An example is included below.
|
||||
This method superseded the previous augmentation to the `File` object with the `path` property. An example is included below.
|
||||
|
||||
```js
|
||||
// Before
|
||||
|
||||
@@ -14,6 +14,61 @@ This document uses the following convention to categorize breaking changes:
|
||||
|
||||
## Planned Breaking API Changes (33.0)
|
||||
|
||||
### 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.
|
||||
|
||||
```ts
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
```js
|
||||
// No longer works
|
||||
protocol.registerFileProtocol('other', () => {
|
||||
callback({ filePath: '/path/to/my/file' })
|
||||
})
|
||||
|
||||
const mainWindow = new BrowserWindow()
|
||||
mainWindow.loadURL('data:text/html,<script src="loaded-from-dataurl.js"></script>', { baseURLForDataURL: 'other://C:\\myapp' })
|
||||
mainWindow.loadURL('other://C:\\myapp\\index.html')
|
||||
|
||||
// Replace with
|
||||
const path = require('node:path')
|
||||
const nodeUrl = require('node:url')
|
||||
protocol.handle(other, (req) => {
|
||||
const srcPath = 'C:\\myapp\\'
|
||||
const reqURL = new URL(req.url)
|
||||
return net.fetch(nodeUrl.pathToFileURL(path.join(srcPath, reqURL.pathname)).toString())
|
||||
})
|
||||
|
||||
mainWindow.loadURL('data:text/html,<script src="loaded-from-dataurl.js"></script>', { baseURLForDataURL: 'other://' })
|
||||
mainWindow.loadURL('other://index.html')
|
||||
```
|
||||
|
||||
### Behavior Changed: `webContents` property on `login` on `app`
|
||||
|
||||
The `webContents` property in the `login` event from `app` will be `null`
|
||||
|
||||
@@ -65,6 +65,8 @@ $ git rebase --autosquash -i [COMMIT_SHA]^
|
||||
$ ../electron/script/git-export-patches -o ../electron/patches/v8
|
||||
```
|
||||
|
||||
Note that the `^` symbol [can cause trouble on Windows](https://stackoverflow.com/questions/14203952/git-reset-asks-more/14204318#14204318). The workaround is to either quote it `"[COMMIT_SHA]^"` or avoid it `[COMMIT_SHA]~1`.
|
||||
|
||||
#### Removing a patch
|
||||
|
||||
```bash
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Experimental APIs
|
||||
|
||||
Some of Electrons APIs are tagged with `_Experimental_` in the documentation.
|
||||
Some of Electron's APIs are tagged with `_Experimental_` in the documentation.
|
||||
This tag indicates that the API may not be considered stable and the API may
|
||||
be removed or modified more frequently than other APIs with less warning.
|
||||
|
||||
|
||||
32
docs/fiddles/features/navigation-history/index.html
Normal file
32
docs/fiddles/features/navigation-history/index.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Enhanced Browser with Navigation History</title>
|
||||
<link href="styles.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="controls">
|
||||
<button id="backBtn" title="Go back">Back</button>
|
||||
<button id="forwardBtn" title="Go forward">Forward</button>
|
||||
<button id="backHistoryBtn" title="Show back history">Back History</button>
|
||||
<button id="forwardHistoryBtn" title="Show forward history">Forward History</button>
|
||||
<input id="urlInput" type="text" placeholder="Enter URL">
|
||||
<button id="goBtn" title="Navigate to URL">Go</button>
|
||||
</div>
|
||||
|
||||
<div id="historyPanel" class="history-panel"></div>
|
||||
|
||||
<div id="description">
|
||||
<h2>Navigation History Demo</h2>
|
||||
<p>This demo showcases Electron's NavigationHistory API functionality.</p>
|
||||
<p><strong>Back/Forward:</strong> Navigate through your browsing history.</p>
|
||||
<p><strong>Back History/Forward History:</strong> View and select from your browsing history.</p>
|
||||
<p><strong>URL Bar:</strong> Enter a URL and click 'Go' or press Enter to navigate.</p>
|
||||
</div>
|
||||
<script src="renderer.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
58
docs/fiddles/features/navigation-history/main.js
Normal file
58
docs/fiddles/features/navigation-history/main.js
Normal file
@@ -0,0 +1,58 @@
|
||||
const { app, BrowserWindow, BrowserView, ipcMain } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
function createWindow () {
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 1000,
|
||||
height: 800,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js'),
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true
|
||||
}
|
||||
})
|
||||
|
||||
mainWindow.loadFile('index.html')
|
||||
|
||||
const view = new BrowserView()
|
||||
mainWindow.setBrowserView(view)
|
||||
view.setBounds({ x: 0, y: 100, width: 1000, height: 800 })
|
||||
view.setAutoResize({ width: true, height: true })
|
||||
|
||||
const navigationHistory = view.webContents.navigationHistory
|
||||
ipcMain.handle('nav:back', () =>
|
||||
navigationHistory.goBack()
|
||||
)
|
||||
|
||||
ipcMain.handle('nav:forward', () => {
|
||||
navigationHistory.goForward()
|
||||
})
|
||||
|
||||
ipcMain.handle('nav:canGoBack', () => navigationHistory.canGoBack())
|
||||
ipcMain.handle('nav:canGoForward', () => navigationHistory.canGoForward())
|
||||
ipcMain.handle('nav:loadURL', (_, url) =>
|
||||
view.webContents.loadURL(url)
|
||||
)
|
||||
ipcMain.handle('nav:getCurrentURL', () => view.webContents.getURL())
|
||||
ipcMain.handle('nav:getHistory', () => {
|
||||
return navigationHistory.getAllEntries()
|
||||
})
|
||||
|
||||
view.webContents.on('did-navigate', () => {
|
||||
mainWindow.webContents.send('nav:updated')
|
||||
})
|
||||
|
||||
view.webContents.on('did-navigate-in-page', () => {
|
||||
mainWindow.webContents.send('nav:updated')
|
||||
})
|
||||
}
|
||||
|
||||
app.whenReady().then(createWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') app.quit()
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
12
docs/fiddles/features/navigation-history/preload.js
Normal file
12
docs/fiddles/features/navigation-history/preload.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const { contextBridge, ipcRenderer } = require('electron')
|
||||
|
||||
contextBridge.exposeInMainWorld('electronAPI', {
|
||||
goBack: () => ipcRenderer.invoke('nav:back'),
|
||||
goForward: () => ipcRenderer.invoke('nav:forward'),
|
||||
canGoBack: () => ipcRenderer.invoke('nav:canGoBack'),
|
||||
canGoForward: () => ipcRenderer.invoke('nav:canGoForward'),
|
||||
loadURL: (url) => ipcRenderer.invoke('nav:loadURL', url),
|
||||
getCurrentURL: () => ipcRenderer.invoke('nav:getCurrentURL'),
|
||||
getHistory: () => ipcRenderer.invoke('nav:getHistory'),
|
||||
onNavigationUpdate: (callback) => ipcRenderer.on('nav:updated', callback)
|
||||
})
|
||||
84
docs/fiddles/features/navigation-history/renderer.js
Normal file
84
docs/fiddles/features/navigation-history/renderer.js
Normal file
@@ -0,0 +1,84 @@
|
||||
const backBtn = document.getElementById('backBtn')
|
||||
const forwardBtn = document.getElementById('forwardBtn')
|
||||
const backHistoryBtn = document.getElementById('backHistoryBtn')
|
||||
const forwardHistoryBtn = document.getElementById('forwardHistoryBtn')
|
||||
const urlInput = document.getElementById('urlInput')
|
||||
const goBtn = document.getElementById('goBtn')
|
||||
const historyPanel = document.getElementById('historyPanel')
|
||||
|
||||
async function updateButtons () {
|
||||
const canGoBack = await window.electronAPI.canGoBack()
|
||||
const canGoForward = await window.electronAPI.canGoForward()
|
||||
backBtn.disabled = !canGoBack
|
||||
backHistoryBtn.disabled = !canGoBack
|
||||
|
||||
forwardBtn.disabled = !canGoForward
|
||||
forwardHistoryBtn.disabled = !canGoForward
|
||||
}
|
||||
|
||||
async function updateURL () {
|
||||
urlInput.value = await window.electronAPI.getCurrentURL()
|
||||
}
|
||||
|
||||
function transformURL (url) {
|
||||
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
||||
const updatedUrl = 'https://' + url
|
||||
return updatedUrl
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
||||
async function navigate (url) {
|
||||
const urlInput = transformURL(url)
|
||||
|
||||
await window.electronAPI.loadURL(urlInput)
|
||||
}
|
||||
|
||||
async function showHistory (forward = false) {
|
||||
const history = await window.electronAPI.getHistory()
|
||||
const currentIndex = history.findIndex(entry => entry.url === transformURL(urlInput.value))
|
||||
|
||||
if (!currentIndex) {
|
||||
return
|
||||
}
|
||||
|
||||
const relevantHistory = forward
|
||||
? history.slice(currentIndex + 1)
|
||||
: history.slice(0, currentIndex).reverse()
|
||||
|
||||
historyPanel.innerHTML = ''
|
||||
relevantHistory.forEach(entry => {
|
||||
const div = document.createElement('div')
|
||||
div.textContent = `Title: ${entry.title}, URL: ${entry.url}`
|
||||
div.onclick = () => navigate(entry.url)
|
||||
historyPanel.appendChild(div)
|
||||
})
|
||||
|
||||
historyPanel.style.display = 'block'
|
||||
}
|
||||
|
||||
backBtn.addEventListener('click', () => window.electronAPI.goBack())
|
||||
forwardBtn.addEventListener('click', () => window.electronAPI.goForward())
|
||||
backHistoryBtn.addEventListener('click', () => showHistory(false))
|
||||
forwardHistoryBtn.addEventListener('click', () => showHistory(true))
|
||||
goBtn.addEventListener('click', () => navigate(urlInput.value))
|
||||
|
||||
urlInput.addEventListener('keypress', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
navigate(urlInput.value)
|
||||
}
|
||||
})
|
||||
|
||||
document.addEventListener('click', (e) => {
|
||||
if (e.target !== historyPanel && !historyPanel.contains(e.target) &&
|
||||
e.target !== backHistoryBtn && e.target !== forwardHistoryBtn) {
|
||||
historyPanel.style.display = 'none'
|
||||
}
|
||||
})
|
||||
|
||||
window.electronAPI.onNavigationUpdate(() => {
|
||||
updateButtons()
|
||||
updateURL()
|
||||
})
|
||||
|
||||
updateButtons()
|
||||
58
docs/fiddles/features/navigation-history/style.css
Normal file
58
docs/fiddles/features/navigation-history/style.css
Normal file
@@ -0,0 +1,58 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
#controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
background-color: #ffffff;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
button {
|
||||
margin-right: 10px;
|
||||
padding: 8px 12px;
|
||||
font-size: 14px;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
button:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
button:disabled {
|
||||
background-color: #cccccc;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
#urlInput {
|
||||
flex-grow: 1;
|
||||
margin: 0 10px;
|
||||
padding: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#historyPanel {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 60px;
|
||||
left: 10px;
|
||||
background: white;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
z-index: 1000;
|
||||
}
|
||||
#historyPanel div {
|
||||
cursor: pointer;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#description {
|
||||
background-color: #f0f0f0;
|
||||
padding: 10px;
|
||||
margin-top: 150px;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
|
||||
<link href="./styles.css" rel="stylesheet">
|
||||
<title>Custom Titlebar App</title>
|
||||
</head>
|
||||
<body>
|
||||
<!-- mount your title bar at the top of you application's body tag -->
|
||||
<div class="titlebar">Cool titlebar</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,16 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
// remove the default titlebar
|
||||
titleBarStyle: 'hidden',
|
||||
// expose window controlls in Windows/Linux
|
||||
...(process.platform !== 'darwin' ? { titleBarOverlay: true } : {})
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
.titlebar {
|
||||
height: 30px;
|
||||
background: blue;
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
app-region: drag;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
|
||||
<link href="./styles.css" rel="stylesheet">
|
||||
<title>Custom Titlebar App</title>
|
||||
</head>
|
||||
<body>
|
||||
<!-- mount your title bar at the top of you application's body tag -->
|
||||
<div class="titlebar">Cool titlebar</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,16 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
// remove the default titlebar
|
||||
titleBarStyle: 'hidden',
|
||||
// expose window controlls in Windows/Linux
|
||||
...(process.platform !== 'darwin' ? { titleBarOverlay: true } : {})
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.titlebar {
|
||||
height: 30px;
|
||||
background: blue;
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
// remove the default titlebar
|
||||
titleBarStyle: 'hidden',
|
||||
// expose window controlls in Windows/Linux
|
||||
...(process.platform !== 'darwin' ? { titleBarOverlay: true } : {})
|
||||
})
|
||||
win.loadURL('https://example.com')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
})
|
||||
@@ -0,0 +1,13 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
// remove the default titlebar
|
||||
titleBarStyle: 'hidden'
|
||||
})
|
||||
win.loadURL('https://example.com')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
})
|
||||
@@ -0,0 +1,10 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({})
|
||||
win.loadURL('https://example.com')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
})
|
||||
@@ -0,0 +1,14 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 300,
|
||||
height: 200,
|
||||
frame: false
|
||||
})
|
||||
win.loadURL('https://example.com')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
})
|
||||
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
|
||||
<link href="./styles.css" rel="stylesheet">
|
||||
<title>Transparent Hello World</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="white-circle">
|
||||
<div>Hello World!</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,16 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 100,
|
||||
height: 100,
|
||||
resizable: false,
|
||||
frame: false,
|
||||
transparent: true
|
||||
})
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: rgba(0, 0, 0, 0); /* Transparent background */
|
||||
}
|
||||
.white-circle {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: white;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
app-region: drag;
|
||||
user-select: none;
|
||||
}
|
||||
BIN
docs/images/frameless-window.png
Normal file
BIN
docs/images/frameless-window.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 412 KiB |
BIN
docs/images/transparent-window-mission-control.png
Normal file
BIN
docs/images/transparent-window-mission-control.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 215 KiB |
BIN
docs/images/transparent-window.png
Normal file
BIN
docs/images/transparent-window.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
176
docs/tutorial/custom-title-bar.md
Normal file
176
docs/tutorial/custom-title-bar.md
Normal file
@@ -0,0 +1,176 @@
|
||||
# Custom Title Bar
|
||||
|
||||
## Basic tutorial
|
||||
|
||||
Application windows have a default [chrome][] applied by the OS. Not to be confused
|
||||
with the Google Chrome browser, window _chrome_ refers to the parts of the window (e.g.
|
||||
title bar, toolbars, controls) that are not a part of the main web content. While the
|
||||
default title bar provided by the OS chrome is sufficent for simple use cases, many
|
||||
applications opt to remove it. Implementing a custom title bar can help your application
|
||||
feel more modern and consistent across platforms.
|
||||
|
||||
You can follow along with this tutorial by opening Fiddle with the following starter code.
|
||||
|
||||
```fiddle docs/fiddles/features/window-customization/custom-title-bar/starter-code
|
||||
|
||||
```
|
||||
|
||||
### Remove the default title bar
|
||||
|
||||
Let’s start by configuring a window with native window controls and a hidden title bar.
|
||||
To remove the default title bar, set the [`BaseWindowContructorOptions`][] `titleBarStyle`
|
||||
param in the `BrowserWindow` constructor to `'hidden'`.
|
||||
|
||||
```fiddle docs/fiddles/features/window-customization/custom-title-bar/remove-title-bar
|
||||
|
||||
```
|
||||
|
||||
### Add native window controls _Windows_ _Linux_
|
||||
|
||||
On macOS, setting `titleBarStyle: 'hidden'` removes the title bar while keeping the window’s
|
||||
traffic light controls available in the upper left hand corner. However on Windows and Linux,
|
||||
you’ll need to add window controls back into your `BrowserWindow` by setting the
|
||||
[`BaseWindowContructorOptions`][] `titleBarOverlay` param in the `BrowserWindow` constructor.
|
||||
|
||||
```fiddle docs/fiddles/features/window-customization/custom-title-bar/native-window-controls
|
||||
|
||||
```
|
||||
|
||||
Setting `titleBarOverlay: true` is the simplest way to expose window controls back into
|
||||
your `BrowserWindow`. If you’re interested in customizing the window controls further,
|
||||
check out the sections [Custom traffic lights][] and [Custom window controls][] that cover
|
||||
this in more detail.
|
||||
|
||||
### Create a custom title bar
|
||||
|
||||
Now, let’s implement a simple custom title bar in the `webContents` of our `BrowserWindow`.
|
||||
There’s nothing fancy here, just HTML and CSS!
|
||||
|
||||
```fiddle docs/fiddles/features/window-customization/custom-title-bar/custom-title-bar
|
||||
|
||||
```
|
||||
|
||||
Currently our application window can’t be moved. Since we’ve removed the default title bar,
|
||||
the application needs to tell Electron which regions are draggable. We’ll do this by adding
|
||||
the CSS style `app-region: drag` to the custom title bar. Now we can drag the custom title
|
||||
bar to reposition our app window!
|
||||
|
||||
```fiddle docs/fiddles/features/window-customization/custom-title-bar/custom-drag-region
|
||||
|
||||
```
|
||||
|
||||
For more information around how to manage drag regions defined by your electron application,
|
||||
see the [Custom draggable regions][] section below.
|
||||
|
||||
Congratulations, you've just implemented a basic custom title bar!
|
||||
|
||||
## Advanced window customization
|
||||
|
||||
### Custom traffic lights _macOS_
|
||||
|
||||
#### Customize the look of your traffic lights _macOS_
|
||||
|
||||
The `customButtonsOnHover` title bar style will hide the traffic lights until you hover
|
||||
over them. This is useful if you want to create custom traffic lights in your HTML but still
|
||||
use the native UI to control the window.
|
||||
|
||||
```js
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({ titleBarStyle: 'customButtonsOnHover' })
|
||||
```
|
||||
|
||||
#### Customize the traffic light position _macOS_
|
||||
|
||||
To modify the position of the traffic light window controls, there are two configuration
|
||||
options available.
|
||||
|
||||
Applying `hiddenInset` title bar style will shift the vertical inset of the traffic lights
|
||||
by a fixed amount.
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({ titleBarStyle: 'hiddenInset' })
|
||||
```
|
||||
|
||||
If you need more granular control over the positioning of the traffic lights, you can pass
|
||||
a set of coordinates to the `trafficLightPosition` option in the `BrowserWindow`
|
||||
constructor.
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({
|
||||
titleBarStyle: 'hidden',
|
||||
trafficLightPosition: { x: 10, y: 10 }
|
||||
})
|
||||
```
|
||||
|
||||
#### Show and hide the traffic lights programmatically _macOS_
|
||||
|
||||
You can also show and hide the traffic lights programmatically from the main process.
|
||||
The `win.setWindowButtonVisibility` forces traffic lights to be show or hidden depending
|
||||
on the value of its boolean parameter.
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow()
|
||||
// hides the traffic lights
|
||||
win.setWindowButtonVisibility(false)
|
||||
```
|
||||
|
||||
:::note
|
||||
Given the number of APIs available, there are many ways of achieving this. For instance,
|
||||
combining `frame: false` with `win.setWindowButtonVisibility(true)` will yield the same
|
||||
layout outcome as setting `titleBarStyle: 'hidden'`.
|
||||
:::
|
||||
|
||||
#### Custom window controls
|
||||
|
||||
The [Window Controls Overlay API][] is a web standard that gives web apps the ability to
|
||||
customize their title bar region when installed on desktop. Electron exposes this API
|
||||
through the `titleBarOverlay` option in the `BrowserWindow` constructor. When `titleBarOverlay`
|
||||
is enabled, the window controls become exposed in their default position, and DOM elements
|
||||
cannot use the area underneath this region.
|
||||
|
||||
:::note
|
||||
`titleBarOverlay` requires the `titleBarStyle` param in the `BrowserWindow` constructor
|
||||
to have a value other than `default`.
|
||||
:::
|
||||
|
||||
The custom title bar tutorial covers a [basic example][Add native window controls] of exposing
|
||||
window controls by setting `titleBarOverlay: true`. The height, color (_Windows_ _Linux_), and
|
||||
symbol colors (_Windows_) of the window controls can be customized further by setting
|
||||
`titleBarOverlay` to an object.
|
||||
|
||||
The value passed to the `height` property must be an integer. The `color` and `symbolColor`
|
||||
properties accept `rgba()`, `hsla()`, and `#RRGGBBAA` color formats and support transparency.
|
||||
If a color option is not specified, the color will default to its system color for the window
|
||||
control buttons. Similarly, if the height option is not specified, the window controls will
|
||||
default to the standard system height:
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({
|
||||
titleBarStyle: 'hidden',
|
||||
titleBarOverlay: {
|
||||
color: '#2f3241',
|
||||
symbolColor: '#74b1be',
|
||||
height: 60
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
:::note
|
||||
Once your title bar overlay is enabled from the main process, you can access the overlay's
|
||||
color and dimension values from a renderer using a set of readonly
|
||||
[JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars].
|
||||
:::
|
||||
|
||||
[Add native window controls]: #add-native-window-controls-windows-linux
|
||||
[`BaseWindowContructorOptions`]: ../api/structures/base-window-options.md
|
||||
[chrome]: https://developer.mozilla.org/en-US/docs/Glossary/Chrome
|
||||
[Custom draggable regions]: ./custom-window-interactions.md#custom-draggable-regions
|
||||
[Custom traffic lights]: #custom-traffic-lights-macos
|
||||
[Custom window controls]: #custom-window-controls
|
||||
[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables
|
||||
[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis
|
||||
[Window Controls Overlay API]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md
|
||||
107
docs/tutorial/custom-window-interactions.md
Normal file
107
docs/tutorial/custom-window-interactions.md
Normal file
@@ -0,0 +1,107 @@
|
||||
# Custom Window Interactions
|
||||
|
||||
## Custom draggable regions
|
||||
|
||||
By default, windows are dragged using the title bar provided by the OS chrome. Apps
|
||||
that remove the default title bar need to use the `app-region` CSS property to define
|
||||
specific areas that can be used to drag the window. Setting `app-region: drag` marks
|
||||
a rectagular area as draggable.
|
||||
|
||||
It is important to note that draggable areas ignore all pointer events. For example,
|
||||
a button element that overlaps a draggable region will not emit mouse clicks or mouse
|
||||
enter/exit events within that overlapping area. Setting `app-region: no-drag` reenables
|
||||
pointer events by excluding a rectagular area from a draggable region.
|
||||
|
||||
To make the whole window draggable, you can add `app-region: drag` as
|
||||
`body`'s style:
|
||||
|
||||
```css title='styles.css'
|
||||
body {
|
||||
app-region: drag;
|
||||
}
|
||||
```
|
||||
|
||||
And note that if you have made the whole window draggable, you must also mark
|
||||
buttons as non-draggable, otherwise it would be impossible for users to click on
|
||||
them:
|
||||
|
||||
```css title='styles.css'
|
||||
button {
|
||||
app-region: no-drag;
|
||||
}
|
||||
```
|
||||
|
||||
If you're only setting a custom title bar as draggable, you also need to make all
|
||||
buttons in title bar non-draggable.
|
||||
|
||||
### Tip: disable text selection
|
||||
|
||||
When creating a draggable region, the dragging behavior may conflict with text selection.
|
||||
For example, when you drag the title bar, you may accidentally select its text contents.
|
||||
To prevent this, you need to disable text selection within a draggable area like this:
|
||||
|
||||
```css
|
||||
.titlebar {
|
||||
user-select: none;
|
||||
app-region: drag;
|
||||
}
|
||||
```
|
||||
|
||||
### Tip: disable context menus
|
||||
|
||||
On some platforms, the draggable area will be treated as a non-client frame, so
|
||||
when you right click on it, a system menu will pop up. To make the context menu
|
||||
behave correctly on all platforms, you should never use a custom context menu on
|
||||
draggable areas.
|
||||
|
||||
## Click-through windows
|
||||
|
||||
To create a click-through window, i.e. making the window ignore all mouse
|
||||
events, you can call the [win.setIgnoreMouseEvents(ignore)][ignore-mouse-events]
|
||||
API:
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow()
|
||||
win.setIgnoreMouseEvents(true)
|
||||
```
|
||||
|
||||
### Forward mouse events _macOS_ _Windows_
|
||||
|
||||
Ignoring mouse messages makes the web contents oblivious to mouse movement,
|
||||
meaning that mouse movement events will not be emitted. On Windows and macOS, an
|
||||
optional parameter can be used to forward mouse move messages to the web page,
|
||||
allowing events such as `mouseleave` to be emitted:
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow, ipcMain } = require('electron')
|
||||
const path = require('node:path')
|
||||
|
||||
const win = new BrowserWindow({
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js')
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.on('set-ignore-mouse-events', (event, ignore, options) => {
|
||||
const win = BrowserWindow.fromWebContents(event.sender)
|
||||
win.setIgnoreMouseEvents(ignore, options)
|
||||
})
|
||||
```
|
||||
|
||||
```js title='preload.js'
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const el = document.getElementById('clickThroughElement')
|
||||
el.addEventListener('mouseenter', () => {
|
||||
ipcRenderer.send('set-ignore-mouse-events', true, { forward: true })
|
||||
})
|
||||
el.addEventListener('mouseleave', () => {
|
||||
ipcRenderer.send('set-ignore-mouse-events', false)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
This makes the web page click-through when over the `#clickThroughElement` element,
|
||||
and returns to normal outside it.
|
||||
|
||||
[ignore-mouse-events]: ../api/browser-window.md#winsetignoremouseeventsignore-options
|
||||
49
docs/tutorial/custom-window-styles.md
Normal file
49
docs/tutorial/custom-window-styles.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Custom Window Styles
|
||||
|
||||
## Frameless windows
|
||||
|
||||

|
||||
|
||||
A frameless window removes all [chrome][] applied by the OS, including window controls.
|
||||
|
||||
To create a frameless window, set the [`BaseWindowContructorOptions`][] `frame` param in the `BrowserWindow` constructor to `false`.
|
||||
|
||||
```fiddle docs/fiddles/features/window-customization/custom-window-styles/frameless-windows
|
||||
|
||||
```
|
||||
|
||||
## Transparent windows
|
||||
|
||||

|
||||

|
||||
|
||||
To create a fully transparent window, set the [`BaseWindowContructorOptions`][] `transparent` param in the `BrowserWindow` constructor to `true`.
|
||||
|
||||
The following fiddle takes advantage of a tranparent window and CSS styling to create
|
||||
the illusion of a circular window.
|
||||
|
||||
```fiddle docs/fiddles/features/window-customization/custom-window-styles/transparent-windows
|
||||
|
||||
```
|
||||
|
||||
### Limitations
|
||||
|
||||
* You cannot click through the transparent area. See
|
||||
[#1335](https://github.com/electron/electron/issues/1335) for details.
|
||||
* Transparent windows are not resizable. Setting `resizable` to `true` may make
|
||||
a transparent window stop working on some platforms.
|
||||
* The CSS [`blur()`][] filter only applies to the window's web contents, so there is
|
||||
no way to apply blur effect to the content below the window (i.e. other applications
|
||||
open on the user's system).
|
||||
* The window will not be transparent when DevTools is opened.
|
||||
* On _Windows_:
|
||||
* Transparent windows will not work when DWM is disabled.
|
||||
* Transparent windows can not be maximized using the Windows system menu or by double
|
||||
clicking the title bar. The reasoning behind this can be seen on
|
||||
PR [#28207](https://github.com/electron/electron/pull/28207).
|
||||
* On _macOS_:
|
||||
* The native window shadow will not be shown on a transparent window.
|
||||
|
||||
[`BaseWindowContructorOptions`]: ../api/structures/base-window-options.md
|
||||
[`blur()`]: https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/blur()
|
||||
[chrome]: https://developer.mozilla.org/en-US/docs/Glossary/Chrome
|
||||
@@ -9,10 +9,12 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
|
||||
|
||||
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
|
||||
| ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- |
|
||||
| 32.0.0 | 2024-Jun-14 | 2024-Jul-24 | 2024-Aug-20 | 2025-Mar-04 | M128 | TBD | ✅ |
|
||||
| 34.0.0 | 2024-Oct-17 | 2024-Nov-13 | 2024-Jan-07 | 2025-Jun-24 | M132 | TBD | ✅ |
|
||||
| 33.0.0 | 2024-Aug-22 | 2024-Sep-18 | 2024-Oct-15 | 2025-Apr-29 | M130 | v20.18 | ✅ |
|
||||
| 32.0.0 | 2024-Jun-14 | 2024-Jul-24 | 2024-Aug-20 | 2025-Mar-04 | M128 | v20.16 | ✅ |
|
||||
| 31.0.0 | 2024-Apr-18 | 2024-May-15 | 2024-Jun-11 | 2025-Jan-07 | M126 | v20.14 | ✅ |
|
||||
| 30.0.0 | 2024-Feb-22 | 2024-Mar-20 | 2024-Apr-16 | 2024-Oct-15 | M124 | v20.11 | ✅ |
|
||||
| 29.0.0 | 2023-Dec-07 | 2024-Jan-24 | 2024-Feb-20 | 2024-Aug-20 | M122 | v20.9 | ✅ |
|
||||
| 30.0.0 | 2024-Feb-22 | 2024-Mar-20 | 2024-Apr-16 | 2024-Oct-15 | M124 | v20.11 | 🚫 |
|
||||
| 29.0.0 | 2023-Dec-07 | 2024-Jan-24 | 2024-Feb-20 | 2024-Aug-20 | M122 | v20.9 | 🚫 |
|
||||
| 28.0.0 | 2023-Oct-11 | 2023-Nov-06 | 2023-Dec-05 | 2024-Jun-11 | M120 | v18.18 | 🚫 |
|
||||
| 27.0.0 | 2023-Aug-17 | 2023-Sep-13 | 2023-Oct-10 | 2024-Apr-16 | M118 | v18.17 | 🚫 |
|
||||
| 26.0.0 | 2023-Jun-01 | 2023-Jun-27 | 2023-Aug-15 | 2024-Feb-20 | M116 | v18.16 | 🚫 |
|
||||
|
||||
76
docs/tutorial/navigation-history.md
Normal file
76
docs/tutorial/navigation-history.md
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
title: "Navigation History"
|
||||
description: "The NavigationHistory API allows you to manage and interact with the browsing history of your Electron application."
|
||||
slug: navigation-history
|
||||
hide_title: false
|
||||
---
|
||||
|
||||
# Navigation History
|
||||
|
||||
## Overview
|
||||
|
||||
The [NavigationHistory](../api/navigation-history.md) class allows you to manage and interact with the browsing history of your Electron application. This powerful feature enables you to create intuitive navigation experiences for your users.
|
||||
|
||||
## Accessing NavigationHistory
|
||||
|
||||
Navigation history is stored per [`WebContents`](../api/web-contents.md) instance. To access a specific instance of the NavigationHistory class, use the WebContents class's [`contents.navigationHistory` instance property](https://www.electronjs.org/docs/latest/api/web-contents#contentsnavigationhistory-readonly).
|
||||
|
||||
```js
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
const mainWindow = new BrowserWindow()
|
||||
const { navigationHistory } = mainWindow.webContents
|
||||
```
|
||||
|
||||
## Navigating through history
|
||||
|
||||
Easily implement back and forward navigation:
|
||||
|
||||
```js @ts-type={navigationHistory:Electron.NavigationHistory}
|
||||
// Go back
|
||||
if (navigationHistory.canGoBack()) {
|
||||
navigationHistory.goBack()
|
||||
}
|
||||
|
||||
// Go forward
|
||||
if (navigationHistory.canGoForward()) {
|
||||
navigationHistory.goForward()
|
||||
}
|
||||
```
|
||||
|
||||
## Accessing history entries
|
||||
|
||||
Retrieve and display the user's browsing history:
|
||||
|
||||
```js @ts-type={navigationHistory:Electron.NavigationHistory}
|
||||
const entries = navigationHistory.getAllEntries()
|
||||
|
||||
entries.forEach((entry) => {
|
||||
console.log(`${entry.title}: ${entry.url}`)
|
||||
})
|
||||
```
|
||||
|
||||
Each navigation entry corresponds to a specific page. The indexing system follows a sequential order:
|
||||
|
||||
- Index 0: Represents the earliest visited page.
|
||||
- Index N: Represents the most recent page visited.
|
||||
|
||||
## Navigating to specific entries
|
||||
|
||||
Allow users to jump to any point in their browsing history:
|
||||
|
||||
```js @ts-type={navigationHistory:Electron.NavigationHistory}
|
||||
// Navigate to the 5th entry in the history, if the index is valid
|
||||
navigationHistory.goToIndex(4)
|
||||
|
||||
// Navigate to the 2nd entry forward from the current position
|
||||
if (navigationHistory.canGoToOffset(2)) {
|
||||
navigationHistory.goToOffset(2)
|
||||
}
|
||||
```
|
||||
|
||||
Here's a full example that you can open with Electron Fiddle:
|
||||
|
||||
```fiddle docs/fiddles/features/navigation-history
|
||||
|
||||
```
|
||||
@@ -3,7 +3,8 @@
|
||||
## Overview
|
||||
|
||||
Offscreen rendering lets you obtain the content of a `BrowserWindow` in a
|
||||
bitmap, so it can be rendered anywhere, for example, on texture in a 3D scene.
|
||||
bitmap or a shared GPU texture, so it can be rendered anywhere, for example,
|
||||
on texture in a 3D scene.
|
||||
The offscreen rendering in Electron uses a similar approach to that of the
|
||||
[Chromium Embedded Framework](https://bitbucket.org/chromiumembedded/cef)
|
||||
project.
|
||||
@@ -17,22 +18,39 @@ the dirty area is passed to the `paint` event to be more efficient.
|
||||
losses with no benefits.
|
||||
* When nothing is happening on a webpage, no frames are generated.
|
||||
* An offscreen window is always created as a
|
||||
[Frameless Window](../tutorial/window-customization.md)..
|
||||
[Frameless Window](../tutorial/window-customization.md).
|
||||
|
||||
### Rendering Modes
|
||||
|
||||
#### GPU accelerated
|
||||
|
||||
GPU accelerated rendering means that the GPU is used for composition. Because of
|
||||
that, the frame has to be copied from the GPU which requires more resources,
|
||||
thus this mode is slower than the Software output device. The benefit of this
|
||||
mode is that WebGL and 3D CSS animations are supported.
|
||||
GPU accelerated rendering means that the GPU is used for composition. The benefit
|
||||
of this mode is that WebGL and 3D CSS animations are supported. There are two
|
||||
different approaches depending on the `webPreferences.offscreen.useSharedTexture`
|
||||
setting.
|
||||
|
||||
1. Use GPU shared texture
|
||||
|
||||
Used when `webPreferences.offscreen.useSharedTexture` is set to `true`.
|
||||
|
||||
This is an advanced feature requiring a native node module to work with your own code.
|
||||
The frames are directly copied in GPU textures, thus this mode is very fast because
|
||||
there's no CPU-GPU memory copies overhead, and you can directly import the shared
|
||||
texture to your own rendering program.
|
||||
|
||||
2. Use CPU shared memory bitmap
|
||||
|
||||
Used when `webPreferences.offscreen.useSharedTexture` is set to `false` (default behavior).
|
||||
|
||||
The texture is accessible using the `NativeImage` API at the cost of performance.
|
||||
The frame has to be copied from the GPU to the CPU bitmap which requires more system
|
||||
resources, thus this mode is slower than the Software output device mode. But it supports
|
||||
GPU related functionalities.
|
||||
|
||||
#### Software output device
|
||||
|
||||
This mode uses a software output device for rendering in the CPU, so the frame
|
||||
generation is much faster. As a result, this mode is preferred over the GPU
|
||||
accelerated one.
|
||||
generation is faster than shared memory bitmap GPU accelerated mode.
|
||||
|
||||
To enable this mode, GPU acceleration has to be disabled by calling the
|
||||
[`app.disableHardwareAcceleration()`][disablehardwareacceleration] API.
|
||||
|
||||
@@ -261,7 +261,59 @@ server-communication aspect of the process by loading your update from a local d
|
||||
|
||||
## Update server specification
|
||||
|
||||
A Squirrel-compatible update server has different
|
||||
For advanced deployment needs, you can also roll out your own Squirrel-compatible update server.
|
||||
For example, you may want to have percentage-based rollouts, distribute your app through separate
|
||||
release channels, or put your update server behind an authentication check.
|
||||
|
||||
Squirrel.Windows and Squirrel.Mac clients require different response formats,
|
||||
but you can use a single server for both platforms by sending requests to
|
||||
different endpoints depending on the value of `process.platform`.
|
||||
|
||||
```js title='main.js'
|
||||
const { app, autoUpdater } = require('electron')
|
||||
|
||||
const server = 'https://your-deployment-url.com'
|
||||
// e.g. for Windows and app version 1.2.3
|
||||
// https://your-deployment-url.com/update/win32/1.2.3
|
||||
const url = `${server}/update/${process.platform}/${app.getVersion()}`
|
||||
|
||||
autoUpdater.setFeedURL({ url })
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
A Squirrel.Windows client expects the update server to return the `RELEASES` artifact
|
||||
of the latest available build at the `/RELEASES` subpath of your endpoint.
|
||||
|
||||
For example, if your feed URL is `https://your-deployment-url.com/update/win32/1.2.3`,
|
||||
then the `https://your-deployment-url.com/update/win32/1.2.3/RELEASES` endpoint
|
||||
should return the contents of the `RELEASES` artifact of the version you want to serve.
|
||||
|
||||
```plaintext title='https://your-deployment-url.com/update/win32/1.2.3/RELEASES'
|
||||
B0892F3C7AC91D72A6271FF36905FEF8FE993520 https://your-static.storage/your-app-1.2.3-full.nupkg 103298365
|
||||
```
|
||||
|
||||
Squirrel.Windows does the comparison check to see if the current app should update to
|
||||
the version returned in `RELEASES`, so you should return a response even when no update
|
||||
is available.
|
||||
|
||||
### macOS
|
||||
|
||||
When an update is available, the Squirrel.Mac client expects a JSON response at the feed URL's endpoint.
|
||||
This object has a mandatory `url` property that maps to a ZIP archive of the
|
||||
app update. All other properties in the object are optional.
|
||||
|
||||
```json title='https://your-deployment-url.com/update/darwin/0.31.0'
|
||||
{
|
||||
"url": "https://your-static.storage/your-app-1.2.3-darwin.zip",
|
||||
"name": "1.2.3",
|
||||
"notes": "Theses are some release notes innit",
|
||||
"pub_date": "2024-09-18T12:29:53+01:00"
|
||||
}
|
||||
```
|
||||
|
||||
If no update is available, the server should return a [`204 No Content`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204)
|
||||
HTTP response.
|
||||
|
||||
[vercel]: https://vercel.com
|
||||
[hazel]: https://github.com/vercel/hazel
|
||||
|
||||
@@ -1,270 +1,17 @@
|
||||
# Window Customization
|
||||
|
||||
The `BrowserWindow` module is the foundation of your Electron application, and it exposes
|
||||
many APIs that can change the look and behavior of your browser windows. In this
|
||||
tutorial, we will be going over the various use-cases for window customization on
|
||||
macOS, Windows, and Linux.
|
||||
The [`BrowserWindow`][] module is the foundation of your Electron application, and
|
||||
it exposes many APIs that let you customize the look and behavior of your app’s windows.
|
||||
This section covers how to implement various use cases for window customization on macOS,
|
||||
Windows, and Linux.
|
||||
|
||||
## Create frameless windows
|
||||
:::info
|
||||
`BrowserWindow` is a subclass of the [`BaseWindow`][] module. Both modules allow
|
||||
you to create and manage application windows in Electron, with the main difference
|
||||
being that `BrowserWindow` supports a single, full size web view while `BaseWindow`
|
||||
supports composing many web views. `BaseWindow` can be used interchangeably with `BrowserWindow`
|
||||
in the examples of the documents in this section.
|
||||
:::
|
||||
|
||||
A frameless window is a window that has no [chrome][]. Not to be confused with the Google
|
||||
Chrome browser, window _chrome_ refers to the parts of the window (e.g. toolbars, controls)
|
||||
that are not a part of the web page.
|
||||
|
||||
To create a frameless window, you need to set `frame` to `false` in the `BrowserWindow`
|
||||
constructor.
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({ frame: false })
|
||||
```
|
||||
|
||||
## Apply custom title bar styles _macOS_ _Windows_
|
||||
|
||||
Title bar styles allow you to hide most of a BrowserWindow's chrome while keeping the
|
||||
system's native window controls intact and can be configured with the `titleBarStyle`
|
||||
option in the `BrowserWindow` constructor.
|
||||
|
||||
Applying the `hidden` title bar style results in a hidden title bar and a full-size
|
||||
content window.
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({ titleBarStyle: 'hidden' })
|
||||
```
|
||||
|
||||
### Control the traffic lights _macOS_
|
||||
|
||||
On macOS, applying the `hidden` title bar style will still expose the standard window
|
||||
controls (“traffic lights”) in the top left.
|
||||
|
||||
#### Customize the look of your traffic lights _macOS_
|
||||
|
||||
The `customButtonsOnHover` title bar style will hide the traffic lights until you hover
|
||||
over them. This is useful if you want to create custom traffic lights in your HTML but still
|
||||
use the native UI to control the window.
|
||||
|
||||
```js
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({ titleBarStyle: 'customButtonsOnHover' })
|
||||
```
|
||||
|
||||
#### Customize the traffic light position _macOS_
|
||||
|
||||
To modify the position of the traffic light window controls, there are two configuration
|
||||
options available.
|
||||
|
||||
Applying `hiddenInset` title bar style will shift the vertical inset of the traffic lights
|
||||
by a fixed amount.
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({ titleBarStyle: 'hiddenInset' })
|
||||
```
|
||||
|
||||
If you need more granular control over the positioning of the traffic lights, you can pass
|
||||
a set of coordinates to the `trafficLightPosition` option in the `BrowserWindow`
|
||||
constructor.
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({
|
||||
titleBarStyle: 'hidden',
|
||||
trafficLightPosition: { x: 10, y: 10 }
|
||||
})
|
||||
```
|
||||
|
||||
#### Show and hide the traffic lights programmatically _macOS_
|
||||
|
||||
You can also show and hide the traffic lights programmatically from the main process.
|
||||
The `win.setWindowButtonVisibility` forces traffic lights to be show or hidden depending
|
||||
on the value of its boolean parameter.
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow()
|
||||
// hides the traffic lights
|
||||
win.setWindowButtonVisibility(false)
|
||||
```
|
||||
|
||||
> Note: Given the number of APIs available, there are many ways of achieving this. For instance,
|
||||
> combining `frame: false` with `win.setWindowButtonVisibility(true)` will yield the same
|
||||
> layout outcome as setting `titleBarStyle: 'hidden'`.
|
||||
|
||||
## Window Controls Overlay
|
||||
|
||||
The [Window Controls Overlay API][] is a web standard that gives web apps the ability to
|
||||
customize their title bar region when installed on desktop. Electron exposes this API
|
||||
through the `BrowserWindow` constructor option `titleBarOverlay`.
|
||||
|
||||
This option only works whenever a custom `titlebarStyle` is applied on macOS or Windows.
|
||||
When `titleBarOverlay` is enabled, the window controls become exposed in their default
|
||||
position, and DOM elements cannot use the area underneath this region.
|
||||
|
||||
The `titleBarOverlay` option accepts two different value formats.
|
||||
|
||||
Specifying `true` on either platform will result in an overlay region with default
|
||||
system colors:
|
||||
|
||||
```js title='main.js'
|
||||
// on macOS or Windows
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({
|
||||
titleBarStyle: 'hidden',
|
||||
titleBarOverlay: true
|
||||
})
|
||||
```
|
||||
|
||||
On either platform `titleBarOverlay` can also be an object. The height of the overlay can be specified with the `height` property. On Windows and Linux, the color of the overlay and can be specified using the `color` property. On Windows and Linux, the color of the overlay and its symbols can be specified using the `color` and `symbolColor` properties respectively. The `rgba()`, `hsla()`, and `#RRGGBBAA` color formats are supported to apply transparency.
|
||||
|
||||
If a color option is not specified, the color will default to its system color for the window control buttons. Similarly, if the height option is not specified it will default to the default height:
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({
|
||||
titleBarStyle: 'hidden',
|
||||
titleBarOverlay: {
|
||||
color: '#2f3241',
|
||||
symbolColor: '#74b1be',
|
||||
height: 60
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
> Note: Once your title bar overlay is enabled from the main process, you can access the overlay's
|
||||
> color and dimension values from a renderer using a set of readonly
|
||||
> [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars].
|
||||
|
||||
## Create transparent windows
|
||||
|
||||
By setting the `transparent` option to `true`, you can make a fully transparent window.
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({ transparent: true })
|
||||
```
|
||||
|
||||
### Limitations
|
||||
|
||||
* You cannot click through the transparent area. See
|
||||
[#1335](https://github.com/electron/electron/issues/1335) for details.
|
||||
* Transparent windows are not resizable. Setting `resizable` to `true` may make
|
||||
a transparent window stop working on some platforms.
|
||||
* The CSS [`blur()`][] filter only applies to the window's web contents, so there is no way to apply
|
||||
blur effect to the content below the window (i.e. other applications open on
|
||||
the user's system).
|
||||
* The window will not be transparent when DevTools is opened.
|
||||
* On _Windows_:
|
||||
* Transparent windows will not work when DWM is disabled.
|
||||
* Transparent windows can not be maximized using the Windows system menu or by double
|
||||
clicking the title bar. The reasoning behind this can be seen on
|
||||
PR [#28207](https://github.com/electron/electron/pull/28207).
|
||||
* On _macOS_:
|
||||
* The native window shadow will not be shown on a transparent window.
|
||||
|
||||
## Create click-through windows
|
||||
|
||||
To create a click-through window, i.e. making the window ignore all mouse
|
||||
events, you can call the [win.setIgnoreMouseEvents(ignore)][ignore-mouse-events]
|
||||
API:
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow()
|
||||
win.setIgnoreMouseEvents(true)
|
||||
```
|
||||
|
||||
### Forward mouse events _macOS_ _Windows_
|
||||
|
||||
Ignoring mouse messages makes the web contents oblivious to mouse movement,
|
||||
meaning that mouse movement events will not be emitted. On Windows and macOS, an
|
||||
optional parameter can be used to forward mouse move messages to the web page,
|
||||
allowing events such as `mouseleave` to be emitted:
|
||||
|
||||
```js title='main.js'
|
||||
const { BrowserWindow, ipcMain } = require('electron')
|
||||
const path = require('node:path')
|
||||
|
||||
const win = new BrowserWindow({
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js')
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.on('set-ignore-mouse-events', (event, ignore, options) => {
|
||||
const win = BrowserWindow.fromWebContents(event.sender)
|
||||
win.setIgnoreMouseEvents(ignore, options)
|
||||
})
|
||||
```
|
||||
|
||||
```js title='preload.js'
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const el = document.getElementById('clickThroughElement')
|
||||
el.addEventListener('mouseenter', () => {
|
||||
ipcRenderer.send('set-ignore-mouse-events', true, { forward: true })
|
||||
})
|
||||
el.addEventListener('mouseleave', () => {
|
||||
ipcRenderer.send('set-ignore-mouse-events', false)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
This makes the web page click-through when over the `#clickThroughElement` element,
|
||||
and returns to normal outside it.
|
||||
|
||||
## Set custom draggable region
|
||||
|
||||
By default, the frameless window is non-draggable. Apps need to specify
|
||||
`-webkit-app-region: drag` in CSS to tell Electron which regions are draggable
|
||||
(like the OS's standard titlebar), and apps can also use
|
||||
`-webkit-app-region: no-drag` to exclude the non-draggable area from the
|
||||
draggable region. Note that only rectangular shapes are currently supported.
|
||||
|
||||
To make the whole window draggable, you can add `-webkit-app-region: drag` as
|
||||
`body`'s style:
|
||||
|
||||
```css title='styles.css'
|
||||
body {
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
```
|
||||
|
||||
And note that if you have made the whole window draggable, you must also mark
|
||||
buttons as non-draggable, otherwise it would be impossible for users to click on
|
||||
them:
|
||||
|
||||
```css title='styles.css'
|
||||
button {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
```
|
||||
|
||||
If you're only setting a custom titlebar as draggable, you also need to make all
|
||||
buttons in titlebar non-draggable.
|
||||
|
||||
### Tip: disable text selection
|
||||
|
||||
When creating a draggable region, the dragging behavior may conflict with text selection.
|
||||
For example, when you drag the titlebar, you may accidentally select its text contents.
|
||||
To prevent this, you need to disable text selection within a draggable area like this:
|
||||
|
||||
```css
|
||||
.titlebar {
|
||||
-webkit-user-select: none;
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
```
|
||||
|
||||
### Tip: disable context menus
|
||||
|
||||
On some platforms, the draggable area will be treated as a non-client frame, so
|
||||
when you right click on it, a system menu will pop up. To make the context menu
|
||||
behave correctly on all platforms, you should never use a custom context menu on
|
||||
draggable areas.
|
||||
|
||||
[`blur()`]: https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/blur()
|
||||
[chrome]: https://developer.mozilla.org/en-US/docs/Glossary/Chrome
|
||||
[ignore-mouse-events]: ../api/browser-window.md#winsetignoremouseeventsignore-options
|
||||
[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables
|
||||
[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis
|
||||
[Window Controls Overlay API]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md
|
||||
[`BaseWindow`]: ../api/base-window.md
|
||||
[`BrowserWindow`]: ../api/browser-window.md
|
||||
|
||||
@@ -108,6 +108,7 @@ auto_filenames = {
|
||||
"docs/api/structures/navigation-entry.md",
|
||||
"docs/api/structures/notification-action.md",
|
||||
"docs/api/structures/notification-response.md",
|
||||
"docs/api/structures/offscreen-shared-texture.md",
|
||||
"docs/api/structures/open-external-permission-request.md",
|
||||
"docs/api/structures/payment-discount.md",
|
||||
"docs/api/structures/permission-request.md",
|
||||
|
||||
@@ -205,6 +205,8 @@ filenames = {
|
||||
"shell/common/mac/main_application_bundle.mm",
|
||||
"shell/common/mac/codesign_util.cc",
|
||||
"shell/common/mac/codesign_util.h",
|
||||
"shell/common/mac_util.h",
|
||||
"shell/common/mac_util.mm",
|
||||
"shell/common/node_bindings_mac.cc",
|
||||
"shell/common/node_bindings_mac.h",
|
||||
"shell/common/platform_util_mac.mm",
|
||||
@@ -270,6 +272,7 @@ filenames = {
|
||||
"shell/browser/api/electron_api_debugger.h",
|
||||
"shell/browser/api/electron_api_desktop_capturer.cc",
|
||||
"shell/browser/api/electron_api_desktop_capturer.h",
|
||||
"shell/browser/api/electron_api_desktop_capturer_mac.mm",
|
||||
"shell/browser/api/electron_api_dialog.cc",
|
||||
"shell/browser/api/electron_api_download_item.cc",
|
||||
"shell/browser/api/electron_api_download_item.h",
|
||||
@@ -378,8 +381,6 @@ filenames = {
|
||||
"shell/browser/electron_navigation_throttle.h",
|
||||
"shell/browser/electron_permission_manager.cc",
|
||||
"shell/browser/electron_permission_manager.h",
|
||||
"shell/browser/electron_plugin_info_host_impl.cc",
|
||||
"shell/browser/electron_plugin_info_host_impl.h",
|
||||
"shell/browser/electron_speech_recognition_manager_delegate.cc",
|
||||
"shell/browser/electron_speech_recognition_manager_delegate.h",
|
||||
"shell/browser/electron_web_contents_utility_handler_impl.cc",
|
||||
@@ -469,6 +470,8 @@ filenames = {
|
||||
"shell/browser/notifications/platform_notification_service.h",
|
||||
"shell/browser/osr/osr_host_display_client.cc",
|
||||
"shell/browser/osr/osr_host_display_client.h",
|
||||
"shell/browser/osr/osr_paint_event.cc",
|
||||
"shell/browser/osr/osr_paint_event.h",
|
||||
"shell/browser/osr/osr_render_widget_host_view.cc",
|
||||
"shell/browser/osr/osr_render_widget_host_view.h",
|
||||
"shell/browser/osr/osr_video_consumer.cc",
|
||||
@@ -612,6 +615,8 @@ filenames = {
|
||||
"shell/common/gin_converters/net_converter.cc",
|
||||
"shell/common/gin_converters/net_converter.h",
|
||||
"shell/common/gin_converters/optional_converter.h",
|
||||
"shell/common/gin_converters/osr_converter.cc",
|
||||
"shell/common/gin_converters/osr_converter.h",
|
||||
"shell/common/gin_converters/serial_port_info_converter.h",
|
||||
"shell/common/gin_converters/std_converter.h",
|
||||
"shell/common/gin_converters/time_converter.cc",
|
||||
@@ -681,8 +686,8 @@ filenames = {
|
||||
"shell/common/skia_util.cc",
|
||||
"shell/common/skia_util.h",
|
||||
"shell/common/thread_restrictions.h",
|
||||
"shell/common/v8_value_serializer.cc",
|
||||
"shell/common/v8_value_serializer.h",
|
||||
"shell/common/v8_util.cc",
|
||||
"shell/common/v8_util.h",
|
||||
"shell/common/world_ids.h",
|
||||
"shell/renderer/api/context_bridge/object_cache.cc",
|
||||
"shell/renderer/api/context_bridge/object_cache.h",
|
||||
|
||||
@@ -326,6 +326,11 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__coroutine/coroutine_traits.h",
|
||||
"//third_party/libc++/src/include/__coroutine/noop_coroutine_handle.h",
|
||||
"//third_party/libc++/src/include/__coroutine/trivial_awaitables.h",
|
||||
"//third_party/libc++/src/include/__cstddef/byte.h",
|
||||
"//third_party/libc++/src/include/__cstddef/max_align_t.h",
|
||||
"//third_party/libc++/src/include/__cstddef/nullptr_t.h",
|
||||
"//third_party/libc++/src/include/__cstddef/ptrdiff_t.h",
|
||||
"//third_party/libc++/src/include/__cstddef/size_t.h",
|
||||
"//third_party/libc++/src/include/__debug_utils/randomize_range.h",
|
||||
"//third_party/libc++/src/include/__debug_utils/sanitizers.h",
|
||||
"//third_party/libc++/src/include/__debug_utils/strict_weak_ordering_check.h",
|
||||
@@ -415,11 +420,13 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__functional/weak_result_type.h",
|
||||
"//third_party/libc++/src/include/__fwd/array.h",
|
||||
"//third_party/libc++/src/include/__fwd/bit_reference.h",
|
||||
"//third_party/libc++/src/include/__fwd/byte.h",
|
||||
"//third_party/libc++/src/include/__fwd/complex.h",
|
||||
"//third_party/libc++/src/include/__fwd/deque.h",
|
||||
"//third_party/libc++/src/include/__fwd/format.h",
|
||||
"//third_party/libc++/src/include/__fwd/fstream.h",
|
||||
"//third_party/libc++/src/include/__fwd/functional.h",
|
||||
"//third_party/libc++/src/include/__fwd/get.h",
|
||||
"//third_party/libc++/src/include/__fwd/ios.h",
|
||||
"//third_party/libc++/src/include/__fwd/istream.h",
|
||||
"//third_party/libc++/src/include/__fwd/mdspan.h",
|
||||
@@ -436,6 +443,7 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__fwd/string_view.h",
|
||||
"//third_party/libc++/src/include/__fwd/subrange.h",
|
||||
"//third_party/libc++/src/include/__fwd/tuple.h",
|
||||
"//third_party/libc++/src/include/__fwd/variant.h",
|
||||
"//third_party/libc++/src/include/__fwd/vector.h",
|
||||
"//third_party/libc++/src/include/__hash_table",
|
||||
"//third_party/libc++/src/include/__ios/fpos.h",
|
||||
@@ -538,6 +546,7 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__memory/construct_at.h",
|
||||
"//third_party/libc++/src/include/__memory/destruct_n.h",
|
||||
"//third_party/libc++/src/include/__memory/inout_ptr.h",
|
||||
"//third_party/libc++/src/include/__memory/noexcept_move_assign_container.h",
|
||||
"//third_party/libc++/src/include/__memory/out_ptr.h",
|
||||
"//third_party/libc++/src/include/__memory/pointer_traits.h",
|
||||
"//third_party/libc++/src/include/__memory/ranges_construct_at.h",
|
||||
@@ -826,7 +835,6 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__type_traits/maybe_const.h",
|
||||
"//third_party/libc++/src/include/__type_traits/nat.h",
|
||||
"//third_party/libc++/src/include/__type_traits/negation.h",
|
||||
"//third_party/libc++/src/include/__type_traits/noexcept_move_assign_container.h",
|
||||
"//third_party/libc++/src/include/__type_traits/promote.h",
|
||||
"//third_party/libc++/src/include/__type_traits/rank.h",
|
||||
"//third_party/libc++/src/include/__type_traits/remove_all_extents.h",
|
||||
@@ -921,7 +929,6 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/exception",
|
||||
"//third_party/libc++/src/include/execution",
|
||||
"//third_party/libc++/src/include/expected",
|
||||
"//third_party/libc++/src/include/experimental/__config",
|
||||
"//third_party/libc++/src/include/experimental/__simd/aligned_tag.h",
|
||||
"//third_party/libc++/src/include/experimental/__simd/declaration.h",
|
||||
"//third_party/libc++/src/include/experimental/__simd/reference.h",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as fs from 'fs';
|
||||
|
||||
import { Menu } from 'electron/main';
|
||||
|
||||
import * as fs from 'fs';
|
||||
|
||||
const bindings = process._linkedBinding('electron_browser_app');
|
||||
const commandLine = process._linkedBinding('electron_common_command_line');
|
||||
const { app } = bindings;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { app } from 'electron/main';
|
||||
import { EventEmitter } from 'events';
|
||||
import * as squirrelUpdate from '@electron/internal/browser/api/auto-updater/squirrel-update-win';
|
||||
|
||||
import { app } from 'electron/main';
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
updateAvailable: boolean = false;
|
||||
updateURL: string | null = null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { spawn, ChildProcessWithoutNullStreams } from 'child_process';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { spawn, ChildProcessWithoutNullStreams } from 'child_process';
|
||||
|
||||
// i.e. my-app/app-0.1.13/
|
||||
const appFolder = path.dirname(process.execPath);
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import { TouchBar } from 'electron/main';
|
||||
import type { BaseWindow as TLWT } from 'electron/main';
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
const { BaseWindow } = process._linkedBinding('electron_browser_base_window') as { BaseWindow: typeof TLWT };
|
||||
|
||||
Object.setPrototypeOf(BaseWindow.prototype, EventEmitter.prototype);
|
||||
@@ -15,6 +18,10 @@ BaseWindow.prototype._init = function (this: TLWT) {
|
||||
}
|
||||
};
|
||||
|
||||
BaseWindow.prototype.setTouchBar = function (touchBar) {
|
||||
(TouchBar as any)._setOnWindow(touchBar, this);
|
||||
};
|
||||
|
||||
// Properties
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'autoHideMenuBar', {
|
||||
|
||||
@@ -68,10 +68,7 @@ export default class BrowserView {
|
||||
// a webContents can be closed by the user while the BrowserView
|
||||
// remains alive and attached to a BrowserWindow.
|
||||
set ownerWindow (w: BrowserWindow | null) {
|
||||
if (this.#ownerWindow && this.#resizeListener) {
|
||||
this.#ownerWindow.off('resize', this.#resizeListener);
|
||||
this.#resizeListener = null;
|
||||
}
|
||||
this.#removeResizeListener();
|
||||
|
||||
if (this.webContents && !this.webContents.isDestroyed()) {
|
||||
this.webContents._setOwnerWindow(w);
|
||||
@@ -82,6 +79,7 @@ export default class BrowserView {
|
||||
this.#lastWindowSize = w.getBounds();
|
||||
w.on('resize', this.#resizeListener = this.#autoResize.bind(this));
|
||||
w.on('closed', () => {
|
||||
this.#removeResizeListener();
|
||||
this.#ownerWindow = null;
|
||||
this.#destroyListener = null;
|
||||
});
|
||||
@@ -94,6 +92,13 @@ export default class BrowserView {
|
||||
this.#ownerWindow?.contentView.removeChildView(this.webContentsView);
|
||||
}
|
||||
|
||||
#removeResizeListener () {
|
||||
if (this.#ownerWindow && this.#resizeListener) {
|
||||
this.#ownerWindow.off('resize', this.#resizeListener);
|
||||
this.#resizeListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
#autoHorizontalProportion: {width: number, left: number} | null = null;
|
||||
#autoVerticalProportion: {height: number, top: number} | null = null;
|
||||
#autoResize () {
|
||||
@@ -145,6 +150,12 @@ export default class BrowserView {
|
||||
if (this.#autoHorizontalProportion || this.#autoVerticalProportion) {
|
||||
this.#webContentsView.setBounds(newViewBounds);
|
||||
}
|
||||
|
||||
// Update #lastWindowSize value after browser windows resize
|
||||
this.#lastWindowSize = {
|
||||
width: newBounds.width,
|
||||
height: newBounds.height
|
||||
};
|
||||
}
|
||||
|
||||
get webContentsView () {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { BaseWindow, WebContents, TouchBar, BrowserView } from 'electron/main';
|
||||
import { BaseWindow, WebContents, BrowserView } from 'electron/main';
|
||||
import type { BrowserWindow as BWT } from 'electron/main';
|
||||
|
||||
const { BrowserWindow } = process._linkedBinding('electron_browser_window') as { BrowserWindow: typeof BWT };
|
||||
|
||||
Object.setPrototypeOf(BrowserWindow.prototype, BaseWindow.prototype);
|
||||
@@ -100,10 +101,6 @@ BrowserWindow.fromBrowserView = (browserView: BrowserView) => {
|
||||
return BrowserWindow.fromWebContents(browserView.webContents);
|
||||
};
|
||||
|
||||
BrowserWindow.prototype.setTouchBar = function (touchBar) {
|
||||
(TouchBar as any)._setOnWindow(touchBar, this);
|
||||
};
|
||||
|
||||
// Forwarded to webContents:
|
||||
|
||||
BrowserWindow.prototype.loadURL = function (...args) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user