mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
Compare commits
152 Commits
refactor/a
...
alice-fix-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9dc42a304 | ||
|
|
08d8163201 | ||
|
|
204e195b6f | ||
|
|
eb621e7c9c | ||
|
|
08dbb388e5 | ||
|
|
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:
|
services:
|
||||||
buildtools:
|
buildtools:
|
||||||
image: ghcr.io/electron/devcontainer:9a43c14f5c19be0359843299f79e736521373adc
|
image: ghcr.io/electron/devcontainer:77262e58c37631ab082482f42c33cdf68c6c394b
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ..:/workspaces/gclient/src/electron:cached
|
- ..:/workspaces/gclient/src/electron:cached
|
||||||
|
|||||||
@@ -19,7 +19,40 @@
|
|||||||
"prefer-const": ["error", {
|
"prefer-const": ["error", {
|
||||||
"destructuring": "all"
|
"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": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 6,
|
"ecmaVersion": 6,
|
||||||
|
|||||||
18
.github/actions/build-electron/action.yml
vendored
18
.github/actions/build-electron/action.yml
vendored
@@ -69,7 +69,7 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd src
|
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
|
if [ "${{ inputs.is-asan }}" != "true" ]; then
|
||||||
target_os=${{ inputs.target-platform == 'linux' && 'linux' || 'mac'}}
|
target_os=${{ inputs.target-platform == 'linux' && 'linux' || 'mac'}}
|
||||||
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
|
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
|
||||||
@@ -81,7 +81,7 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd src
|
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
|
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
||||||
# Remove unused args from mksnapshot_args
|
# Remove unused args from mksnapshot_args
|
||||||
SEDOPTION="-i"
|
SEDOPTION="-i"
|
||||||
@@ -104,7 +104,7 @@ runs:
|
|||||||
fi
|
fi
|
||||||
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)
|
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
|
||||||
- name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }}
|
- name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }}
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -130,24 +130,24 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd src
|
cd src
|
||||||
e build electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
e build --target electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
||||||
e build electron:electron_chromedriver_zip
|
e build --target electron:electron_chromedriver_zip
|
||||||
- name: Build Node.js headers ${{ inputs.step-suffix }}
|
- name: Build Node.js headers ${{ inputs.step-suffix }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd src
|
cd src
|
||||||
e build electron:node_headers
|
e build --target electron:node_headers
|
||||||
- name: Generate & Zip Symbols ${{ inputs.step-suffix }}
|
- name: Generate & Zip Symbols ${{ inputs.step-suffix }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
# Generate breakpad symbols on release builds
|
# Generate breakpad symbols on release builds
|
||||||
if [ "${{ inputs.generate-symbols }}" = "true" ]; then
|
if [ "${{ inputs.generate-symbols }}" = "true" ]; then
|
||||||
e build electron:electron_symbols
|
e build --target electron:electron_symbols
|
||||||
fi
|
fi
|
||||||
cd src
|
cd src
|
||||||
export BUILD_PATH="$(pwd)/out/Default"
|
export BUILD_PATH="$(pwd)/out/Default"
|
||||||
e build electron:licenses
|
e build --target electron:licenses
|
||||||
e build electron:electron_version_file
|
e build --target electron:electron_version_file
|
||||||
if [ "${{ inputs.is-release }}" = "true" ]; then
|
if [ "${{ inputs.is-release }}" = "true" ]; then
|
||||||
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
|
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
|
||||||
else
|
else
|
||||||
|
|||||||
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
|
- name: Install Build Tools
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
export BUILD_TOOLS_SHA=d5b87591842be19058e8d75d2c5b7f1fabe9f450
|
export BUILD_TOOLS_SHA=eeb1a11392e4cec08fd926c93b31ab556dc0c23b
|
||||||
npm i -g @electron/build-tools
|
npm i -g @electron/build-tools
|
||||||
e auto-update disable
|
e auto-update disable
|
||||||
|
|||||||
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
|
||||||
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@@ -40,7 +40,7 @@ jobs:
|
|||||||
build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
|
build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
|
||||||
docs-only: ${{ steps.set-output.outputs.docs-only }}
|
docs-only: ${{ steps.set-output.outputs.docs-only }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.0.2
|
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 #v4.0.2
|
||||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
id: filter
|
id: filter
|
||||||
with:
|
with:
|
||||||
@@ -53,7 +53,7 @@ jobs:
|
|||||||
id: set-output
|
id: set-output
|
||||||
run: |
|
run: |
|
||||||
if [ -z "${{ inputs.build-image-sha }}" ]; then
|
if [ -z "${{ inputs.build-image-sha }}" ]; then
|
||||||
echo "build-image-sha=cf814a4d2501e8e843caea071a6b70a48e78b855" >> "$GITHUB_OUTPUT"
|
echo "build-image-sha=77262e58c37631ab082482f42c33cdf68c6c394b" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
|
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
@@ -94,7 +94,7 @@ jobs:
|
|||||||
build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
|
build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -120,7 +120,7 @@ jobs:
|
|||||||
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
|
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|||||||
2
.github/workflows/linux-publish.yml
vendored
2
.github/workflows/linux-publish.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
|||||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|||||||
38
.github/workflows/macos-publish.yml
vendored
38
.github/workflows/macos-publish.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
|||||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -40,7 +40,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
generate-sas-token: 'true'
|
generate-sas-token: 'true'
|
||||||
|
|
||||||
publish-x64:
|
publish-x64-darwin:
|
||||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||||
needs: checkout-macos
|
needs: checkout-macos
|
||||||
with:
|
with:
|
||||||
@@ -48,13 +48,29 @@ jobs:
|
|||||||
build-runs-on: macos-14-xlarge
|
build-runs-on: macos-14-xlarge
|
||||||
target-platform: macos
|
target-platform: macos
|
||||||
target-arch: x64
|
target-arch: x64
|
||||||
|
target-variant: darwin
|
||||||
is-release: true
|
is-release: true
|
||||||
gn-build-type: release
|
gn-build-type: release
|
||||||
generate-symbols: true
|
generate-symbols: true
|
||||||
upload-to-storage: ${{ inputs.upload-to-storage }}
|
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||||
secrets: inherit
|
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
|
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||||
needs: checkout-macos
|
needs: checkout-macos
|
||||||
with:
|
with:
|
||||||
@@ -62,6 +78,22 @@ jobs:
|
|||||||
build-runs-on: macos-14-xlarge
|
build-runs-on: macos-14-xlarge
|
||||||
target-platform: macos
|
target-platform: macos
|
||||||
target-arch: arm64
|
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
|
is-release: true
|
||||||
gn-build-type: release
|
gn-build-type: release
|
||||||
generate-symbols: true
|
generate-symbols: true
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ jobs:
|
|||||||
container: ${{ fromJSON(inputs.container) }}
|
container: ${{ fromJSON(inputs.container) }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
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) }}
|
container: ${{ fromJSON(inputs.container) }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
description: 'Arch to build for, can be x64, arm64 or arm'
|
description: 'Arch to build for, can be x64, arm64 or arm'
|
||||||
required: true
|
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:
|
build-runs-on:
|
||||||
type: string
|
type: string
|
||||||
description: 'What host to run the build'
|
description: 'What host to run the build'
|
||||||
@@ -57,13 +61,14 @@ on:
|
|||||||
|
|
||||||
|
|
||||||
concurrency:
|
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') }}
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
|
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
|
||||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||||
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' }}
|
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
|
ELECTRON_OUT_DIR: Default
|
||||||
|
|
||||||
@@ -78,13 +83,19 @@ jobs:
|
|||||||
- name: Create src dir
|
- name: Create src dir
|
||||||
run: mkdir src
|
run: mkdir src
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
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
|
- name: Setup Node.js/npm
|
||||||
if: ${{ inputs.target-platform == 'macos' }}
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
|
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
|
||||||
with:
|
with:
|
||||||
node-version: 20.11.x
|
node-version: 20.11.x
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -145,7 +156,7 @@ jobs:
|
|||||||
if: ${{ inputs.target-platform == 'linux' }}
|
if: ${{ inputs.target-platform == 'linux' }}
|
||||||
uses: ./src/electron/.github/actions/restore-cache-aks
|
uses: ./src/electron/.github/actions/restore-cache-aks
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -153,7 +164,7 @@ jobs:
|
|||||||
uses: ./src/electron/.github/actions/install-build-tools
|
uses: ./src/electron/.github/actions/install-build-tools
|
||||||
- name: Init Build Tools
|
- name: Init Build Tools
|
||||||
run: |
|
run: |
|
||||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --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
|
- name: Run Electron Only Hooks
|
||||||
run: |
|
run: |
|
||||||
gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
|
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)
|
- name: Fix Sync (macOS)
|
||||||
if: ${{ inputs.target-platform == 'macos' }}
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
uses: ./src/electron/.github/actions/fix-sync-macos
|
uses: ./src/electron/.github/actions/fix-sync-macos
|
||||||
- name: Install build-tools & Setup RBE
|
- name: Setup Number of Ninja Processes
|
||||||
run: |
|
run: |
|
||||||
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform == 'linux' && '300' || '200' }}" >> $GITHUB_ENV
|
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)
|
- name: Free up space (macOS)
|
||||||
if: ${{ inputs.target-platform == 'macos' }}
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
uses: ./src/electron/.github/actions/free-space-macos
|
uses: ./src/electron/.github/actions/free-space-macos
|
||||||
- name: Build Electron
|
- name: Build Electron
|
||||||
|
if: ${{ inputs.target-platform != 'macos' || (inputs.target-variant == 'all' || inputs.target-variant == 'darwin') }}
|
||||||
uses: ./src/electron/.github/actions/build-electron
|
uses: ./src/electron/.github/actions/build-electron
|
||||||
with:
|
with:
|
||||||
target-arch: ${{ inputs.target-arch }}
|
target-arch: ${{ inputs.target-arch }}
|
||||||
@@ -193,13 +196,13 @@ jobs:
|
|||||||
upload-to-storage: '${{ inputs.upload-to-storage }}'
|
upload-to-storage: '${{ inputs.upload-to-storage }}'
|
||||||
is-asan: '${{ inputs.is-asan }}'
|
is-asan: '${{ inputs.is-asan }}'
|
||||||
- name: Set GN_EXTRA_ARGS for MAS Build
|
- 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: |
|
run: |
|
||||||
echo "MAS_BUILD=true" >> $GITHUB_ENV
|
echo "MAS_BUILD=true" >> $GITHUB_ENV
|
||||||
GN_EXTRA_ARGS='is_mas_build=true'
|
GN_EXTRA_ARGS='is_mas_build=true'
|
||||||
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
|
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
|
||||||
- name: Build Electron (MAS)
|
- 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
|
uses: ./src/electron/.github/actions/build-electron
|
||||||
with:
|
with:
|
||||||
target-arch: ${{ inputs.target-arch }}
|
target-arch: ${{ inputs.target-arch }}
|
||||||
|
|||||||
@@ -50,15 +50,32 @@ jobs:
|
|||||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
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
|
- name: Install Build Tools
|
||||||
uses: ./src/electron/.github/actions/install-build-tools
|
uses: ./src/electron/.github/actions/install-build-tools
|
||||||
- name: Init Build Tools
|
- name: Init Build Tools
|
||||||
run: |
|
run: |
|
||||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --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
|
- name: Get Depot Tools
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
run: |
|
run: |
|
||||||
@@ -111,7 +128,7 @@ jobs:
|
|||||||
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
|
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
|
||||||
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
|
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ permissions:
|
|||||||
env:
|
env:
|
||||||
ELECTRON_OUT_DIR: Default
|
ELECTRON_OUT_DIR: Default
|
||||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||||
ELECTRON_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -92,7 +91,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -147,17 +146,21 @@ jobs:
|
|||||||
sudo security authorizationdb write com.apple.trust-settings.admin allow
|
sudo security authorizationdb write com.apple.trust-settings.admin allow
|
||||||
cd src/electron
|
cd src/electron
|
||||||
./script/codesign/generate-identity.sh
|
./script/codesign/generate-identity.sh
|
||||||
|
- name: Install Datadog CLI
|
||||||
|
run: |
|
||||||
|
cd src/electron
|
||||||
|
node script/yarn global add @datadog/datadog-ci
|
||||||
- name: Run Electron Tests
|
- name: Run Electron Tests
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
MOCHA_REPORTER: mocha-multi-reporters
|
||||||
ELECTRON_TEST_RESULTS_DIR: junit
|
|
||||||
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
||||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
||||||
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
||||||
DISPLAY: ':99.0'
|
DISPLAY: ':99.0'
|
||||||
run: |
|
run: |
|
||||||
cd src/electron
|
cd src/electron
|
||||||
|
export ELECTRON_TEST_RESULTS_DIR=`pwd`/junit
|
||||||
# Get which tests are on this shard
|
# Get which tests are on this shard
|
||||||
tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ inputs.target-platform == 'macos' && 2 || 3 }})
|
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
|
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
- name: Upload Test results to Datadog
|
||||||
|
env:
|
||||||
|
DD_ENV: ci
|
||||||
|
DD_SERVICE: electron
|
||||||
|
DD_API_KEY: ${{ secrets.DD_API_KEY }}
|
||||||
|
DD_CIVISIBILITY_LOGS_ENABLED: true
|
||||||
|
DD_TAGS: "os.architecture:${{ inputs.target-arch }},os.family:${{ inputs.target-platform }},os.platform:${{ inputs.target-platform }},asan:${{ inputs.is-asan }}"
|
||||||
|
run: |
|
||||||
|
if ! [ -z $DD_API_KEY ]; then
|
||||||
|
datadog-ci junit upload src/electron/junit/test-results-main.xml
|
||||||
|
fi
|
||||||
|
if: always() && !cancelled()
|
||||||
- name: Upload Test Artifacts
|
- name: Upload Test Artifacts
|
||||||
if: always() && !cancelled()
|
if: always() && !cancelled()
|
||||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
|
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
|
||||||
with:
|
with:
|
||||||
name: test_artifacts_${{ env.ARTIFACT_KEY }}
|
name: test_artifacts_${{ env.ARTIFACT_KEY }}
|
||||||
path: src/electron/spec/artifacts
|
path: src/electron/spec/artifacts
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ jobs:
|
|||||||
container: ${{ fromJSON(inputs.test-container) }}
|
container: ${{ fromJSON(inputs.test-container) }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -108,7 +108,7 @@ jobs:
|
|||||||
container: ${{ fromJSON(inputs.test-container) }}
|
container: ${{ fromJSON(inputs.test-container) }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Trigger Slack workflow
|
- name: Trigger Slack workflow
|
||||||
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
|
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
|
||||||
with:
|
with:
|
||||||
payload: |
|
payload: |
|
||||||
{
|
{
|
||||||
|
|||||||
6
.github/workflows/scorecards.yml
vendored
6
.github/workflows/scorecards.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout code"
|
- name: "Checkout code"
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ jobs:
|
|||||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||||
# format to the repository Actions tab.
|
# format to the repository Actions tab.
|
||||||
- name: "Upload artifact"
|
- name: "Upload artifact"
|
||||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
|
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
|
||||||
with:
|
with:
|
||||||
name: SARIF file
|
name: SARIF file
|
||||||
path: results.sarif
|
path: results.sarif
|
||||||
@@ -50,6 +50,6 @@ jobs:
|
|||||||
|
|
||||||
# Upload the results to GitHub's code scanning dashboard.
|
# Upload the results to GitHub's code scanning dashboard.
|
||||||
- name: "Upload to code-scanning"
|
- name: "Upload to code-scanning"
|
||||||
uses: github/codeql-action/upload-sarif@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3
|
uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
|
||||||
with:
|
with:
|
||||||
sarif_file: results.sarif
|
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:
|
with:
|
||||||
creds: ${{ secrets.APPVEYOR_UPDATER_GH_APP_CREDS }}
|
creds: ${{ secrets.APPVEYOR_UPDATER_GH_APP_CREDS }}
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ steps.generate-token.outputs.token }}
|
token: ${{ steps.generate-token.outputs.token }}
|
||||||
|
|||||||
5
BUILD.gn
5
BUILD.gn
@@ -74,7 +74,7 @@ if (is_linux) {
|
|||||||
"notify_notification_set_image_from_pixbuf",
|
"notify_notification_set_image_from_pixbuf",
|
||||||
"notify_notification_set_timeout",
|
"notify_notification_set_timeout",
|
||||||
"notify_notification_set_urgency",
|
"notify_notification_set_urgency",
|
||||||
"notify_notification_set_hint_string",
|
"notify_notification_set_hint",
|
||||||
"notify_notification_show",
|
"notify_notification_show",
|
||||||
"notify_notification_close",
|
"notify_notification_close",
|
||||||
]
|
]
|
||||||
@@ -674,6 +674,8 @@ source_set("electron_lib") {
|
|||||||
|
|
||||||
if (enable_plugins) {
|
if (enable_plugins) {
|
||||||
sources += [
|
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.cc",
|
||||||
"shell/common/plugin_info.h",
|
"shell/common/plugin_info.h",
|
||||||
]
|
]
|
||||||
@@ -733,6 +735,7 @@ source_set("electron_lib") {
|
|||||||
"//components/pdf/common:util",
|
"//components/pdf/common:util",
|
||||||
"//components/pdf/renderer",
|
"//components/pdf/renderer",
|
||||||
"//pdf",
|
"//pdf",
|
||||||
|
"//pdf:content_restriction",
|
||||||
]
|
]
|
||||||
sources += [
|
sources += [
|
||||||
"shell/browser/electron_pdf_document_helper_client.cc",
|
"shell/browser/electron_pdf_document_helper_client.cc",
|
||||||
|
|||||||
4
DEPS
4
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
|||||||
|
|
||||||
vars = {
|
vars = {
|
||||||
'chromium_version':
|
'chromium_version':
|
||||||
'129.0.6668.0',
|
'130.0.6723.59',
|
||||||
'node_version':
|
'node_version':
|
||||||
'v20.16.0',
|
'v20.18.0',
|
||||||
'nan_version':
|
'nan_version':
|
||||||
'e14bdcd1f72d62bca1d541b66da43130384ec213',
|
'e14bdcd1f72d62bca1d541b66da43130384ec213',
|
||||||
'squirrel.mac_version':
|
'squirrel.mac_version':
|
||||||
|
|||||||
@@ -29,14 +29,14 @@
|
|||||||
|
|
||||||
version: 1.0.{build}
|
version: 1.0.{build}
|
||||||
build_cloud: electronhq-16-core
|
build_cloud: electronhq-16-core
|
||||||
image: e-129.0.6656.0
|
image: e-130.0.6695.0-node-20
|
||||||
environment:
|
environment:
|
||||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||||
ELECTRON_OUT_DIR: Default
|
ELECTRON_OUT_DIR: Default
|
||||||
ELECTRON_ENABLE_STACK_DUMPING: 1
|
ELECTRON_ENABLE_STACK_DUMPING: 1
|
||||||
ELECTRON_ALSO_LOG_TO_STDERR: 1
|
ELECTRON_ALSO_LOG_TO_STDERR: 1
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
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: 1
|
||||||
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
|
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
|
||||||
GYP_MSVS_HASH_7393122652: 3ba76c5c20
|
GYP_MSVS_HASH_7393122652: 3ba76c5c20
|
||||||
@@ -45,10 +45,16 @@ environment:
|
|||||||
matrix:
|
matrix:
|
||||||
|
|
||||||
- job_name: Build Arm on X64 Windows
|
- 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
|
job_depends_on: Build Arm on X64 Windows
|
||||||
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
|
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
|
||||||
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-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:
|
clone_script:
|
||||||
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
|
- 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
|
- job_name: Build Arm on X64 Windows
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
|
# TODO: Remove --ignore-engines once WOA image is up to node 20
|
||||||
- ps: |
|
- 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
|
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
|
||||||
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
|
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
@@ -95,6 +102,8 @@ for:
|
|||||||
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||||
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
|
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
|
||||||
- depot_tools\bootstrap\win_tools.bat
|
- 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: $env:PATH="$pwd\depot_tools;$env:PATH"
|
||||||
- ps: >-
|
- ps: >-
|
||||||
if (Test-Path -Path "$pwd\src\electron") {
|
if (Test-Path -Path "$pwd\src\electron") {
|
||||||
@@ -115,6 +124,11 @@ for:
|
|||||||
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
|
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
|
||||||
- ps: >-
|
- ps: >-
|
||||||
$env:RBE_experimental_credentials_helper_args = "print"
|
$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 ..\..
|
- cd ..\..
|
||||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||||
- ps: >-
|
- ps: >-
|
||||||
@@ -142,7 +156,7 @@ for:
|
|||||||
- gn check out/Default //electron:electron_app
|
- gn check out/Default //electron:electron_app
|
||||||
- gn check out/Default //electron/shell/common:mojo
|
- gn check out/Default //electron/shell/common:mojo
|
||||||
- gn check out/Default //electron/shell/common:plugin
|
- 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 )
|
- 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%"
|
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
|
||||||
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
|
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
|
||||||
@@ -167,8 +181,8 @@ for:
|
|||||||
if ($env:GN_CONFIG -eq 'release') {
|
if ($env:GN_CONFIG -eq 'release') {
|
||||||
# Needed for msdia140.dll on 64-bit windows
|
# Needed for msdia140.dll on 64-bit windows
|
||||||
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
$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: >-
|
- ps: >-
|
||||||
if ($env:GN_CONFIG -eq 'release') {
|
if ($env:GN_CONFIG -eq 'release') {
|
||||||
python3 electron\script\zip-symbols.py
|
python3 electron\script\zip-symbols.py
|
||||||
@@ -244,18 +258,23 @@ for:
|
|||||||
}
|
}
|
||||||
- matrix:
|
- matrix:
|
||||||
only:
|
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:
|
environment:
|
||||||
IGNORE_YARN_INSTALL_ERROR: 1
|
IGNORE_YARN_INSTALL_ERROR: 1
|
||||||
ELECTRON_TEST_RESULTS_DIR: junit
|
ELECTRON_TEST_RESULTS_DIR: C:\projects\src\electron\junit
|
||||||
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
|
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-reporter, tap"
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
MOCHA_REPORTER: mocha-multi-reporters
|
||||||
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
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:
|
build_script:
|
||||||
- ps: |
|
- 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
|
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
Write-warning "Skipping build for doc only change"
|
Write-warning "Skipping build for doc only change"
|
||||||
@@ -263,6 +282,7 @@ for:
|
|||||||
} else {
|
} else {
|
||||||
$global:LASTEXITCODE = 0
|
$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 ..
|
- cd ..
|
||||||
- mkdir out\Default
|
- mkdir out\Default
|
||||||
- cd ..
|
- cd ..
|
||||||
@@ -311,11 +331,22 @@ for:
|
|||||||
if ($env:TARGET_ARCH -eq 'ia32') {
|
if ($env:TARGET_ARCH -eq 'ia32') {
|
||||||
$env:npm_config_arch = "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 ..
|
- cd ..
|
||||||
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
||||||
|
|
||||||
on_finish:
|
on_finish:
|
||||||
# Uncomment these lines to enable RDP
|
# 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'))
|
# - 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}
|
version: 1.0.{build}
|
||||||
build_cloud: electronhq-16-core
|
build_cloud: electronhq-16-core
|
||||||
image: e-129.0.6656.0
|
image: e-130.0.6695.0-node-20
|
||||||
environment:
|
environment:
|
||||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||||
ELECTRON_OUT_DIR: Default
|
ELECTRON_OUT_DIR: Default
|
||||||
ELECTRON_ENABLE_STACK_DUMPING: 1
|
ELECTRON_ENABLE_STACK_DUMPING: 1
|
||||||
ELECTRON_ALSO_LOG_TO_STDERR: 1
|
ELECTRON_ALSO_LOG_TO_STDERR: 1
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
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: 1
|
||||||
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
|
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
|
||||||
GYP_MSVS_HASH_7393122652: 3ba76c5c20
|
GYP_MSVS_HASH_7393122652: 3ba76c5c20
|
||||||
@@ -45,8 +45,12 @@ environment:
|
|||||||
matrix:
|
matrix:
|
||||||
|
|
||||||
- job_name: Build
|
- job_name: Build
|
||||||
- job_name: Test
|
- job_name: Test 1
|
||||||
job_depends_on: Build
|
job_depends_on: Build
|
||||||
|
shard: 1
|
||||||
|
- job_name: Test 2
|
||||||
|
job_depends_on: Build
|
||||||
|
shard: 2
|
||||||
|
|
||||||
clone_script:
|
clone_script:
|
||||||
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
|
- 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
|
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||||
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
|
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
|
||||||
- depot_tools\bootstrap\win_tools.bat
|
- 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: $env:PATH="$pwd\depot_tools;$env:PATH"
|
||||||
- ps: >-
|
- ps: >-
|
||||||
if (Test-Path -Path "$pwd\src\electron") {
|
if (Test-Path -Path "$pwd\src\electron") {
|
||||||
@@ -113,6 +119,11 @@ for:
|
|||||||
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
|
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
|
||||||
- ps: >-
|
- ps: >-
|
||||||
$env:RBE_experimental_credentials_helper_args = "print"
|
$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 ..\..
|
- cd ..\..
|
||||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||||
- ps: >-
|
- ps: >-
|
||||||
@@ -140,7 +151,7 @@ for:
|
|||||||
- gn check out/Default //electron:electron_app
|
- gn check out/Default //electron:electron_app
|
||||||
- gn check out/Default //electron/shell/common:mojo
|
- gn check out/Default //electron/shell/common:mojo
|
||||||
- gn check out/Default //electron/shell/common:plugin
|
- 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 )
|
- 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%"
|
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
|
||||||
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
|
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
|
||||||
@@ -164,8 +175,8 @@ for:
|
|||||||
if ($env:GN_CONFIG -eq 'release') {
|
if ($env:GN_CONFIG -eq 'release') {
|
||||||
# Needed for msdia140.dll on 64-bit windows
|
# Needed for msdia140.dll on 64-bit windows
|
||||||
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
$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: >-
|
- ps: >-
|
||||||
if ($env:GN_CONFIG -eq 'release') {
|
if ($env:GN_CONFIG -eq 'release') {
|
||||||
python3 electron\script\zip-symbols.py
|
python3 electron\script\zip-symbols.py
|
||||||
@@ -237,7 +248,15 @@ for:
|
|||||||
}
|
}
|
||||||
- matrix:
|
- matrix:
|
||||||
only:
|
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:
|
init:
|
||||||
- ps: |
|
- ps: |
|
||||||
@@ -254,6 +273,7 @@ for:
|
|||||||
} else {
|
} else {
|
||||||
$global:LASTEXITCODE = 0
|
$global:LASTEXITCODE = 0
|
||||||
}
|
}
|
||||||
|
- npm install -g @datadog/datadog-ci
|
||||||
- cd ..
|
- cd ..
|
||||||
- mkdir out\Default
|
- mkdir out\Default
|
||||||
- cd ..
|
- cd ..
|
||||||
@@ -299,7 +319,9 @@ for:
|
|||||||
if ($env:TARGET_ARCH -eq 'ia32') {
|
if ($env:TARGET_ARCH -eq 'ia32') {
|
||||||
$env:npm_config_arch = "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 ..
|
- cd ..
|
||||||
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
||||||
- echo "About to verify mksnapshot"
|
- echo "About to verify mksnapshot"
|
||||||
@@ -311,4 +333,13 @@ for:
|
|||||||
on_finish:
|
on_finish:
|
||||||
# Uncomment these lines to enable RDP
|
# 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'))
|
# - 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 fs = require('node:fs');
|
||||||
const path = require('node:path');
|
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, '../..');
|
const electronRoot = path.resolve(__dirname, '../..');
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ static_library("chrome") {
|
|||||||
"//chrome/browser/ui/view_ids.h",
|
"//chrome/browser/ui/view_ids.h",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
|
"//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/back_to_tab_label_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/close_image_button.cc",
|
"//chrome/browser/ui/views/overlay/close_image_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/close_image_button.h",
|
"//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.h",
|
||||||
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.mm",
|
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.mm",
|
||||||
"//chrome/browser/media/webrtc/window_icon_util_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/platform_util_mac.mm",
|
||||||
"//chrome/browser/process_singleton_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.h",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
|
||||||
]
|
]
|
||||||
|
deps += [ ":system_media_capture_permissions_mac_conflict" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable_widevine) {
|
if (enable_widevine) {
|
||||||
@@ -490,3 +494,16 @@ source_set("chrome_spellchecker") {
|
|||||||
"//components/spellcheck/renderer",
|
"//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 { shell } from 'electron/common';
|
||||||
import { app, dialog, BrowserWindow, ipcMain } from 'electron/main';
|
import { app, dialog, BrowserWindow, ipcMain } from 'electron/main';
|
||||||
|
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import * as url from 'node:url';
|
import * as url from 'node:url';
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import * as fs from 'node:fs';
|
|||||||
import { Module } from 'node:module';
|
import { Module } from 'node:module';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import * as url from 'node:url';
|
import * as url from 'node:url';
|
||||||
|
|
||||||
const { app, dialog } = electron;
|
const { app, dialog } = electron;
|
||||||
|
|
||||||
type DefaultAppOptions = {
|
type DefaultAppOptions = {
|
||||||
@@ -255,6 +256,7 @@ async function startRepl () {
|
|||||||
// start the default app.
|
// start the default app.
|
||||||
if (option.file && !option.webdriver) {
|
if (option.file && !option.webdriver) {
|
||||||
const file = option.file;
|
const file = option.file;
|
||||||
|
// eslint-disable-next-line n/no-deprecated-api
|
||||||
const protocol = url.parse(file).protocol;
|
const protocol = url.parse(file).protocol;
|
||||||
const extension = path.extname(file);
|
const extension = path.extname(file);
|
||||||
if (protocol === 'http:' || protocol === 'https:' || protocol === 'file:' || protocol === 'chrome:') {
|
if (protocol === 'http:' || protocol === 'https:' || protocol === 'file:' || protocol === 'chrome:') {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ an issue:
|
|||||||
* [Offline/Online Detection](tutorial/online-offline-events.md)
|
* [Offline/Online Detection](tutorial/online-offline-events.md)
|
||||||
* [Represented File for macOS BrowserWindows](tutorial/represented-file.md)
|
* [Represented File for macOS BrowserWindows](tutorial/represented-file.md)
|
||||||
* [Native File Drag & Drop](tutorial/native-file-drag-drop.md)
|
* [Native File Drag & Drop](tutorial/native-file-drag-drop.md)
|
||||||
|
* [Navigation History](tutorial/navigation-history.md)
|
||||||
* [Offscreen Rendering](tutorial/offscreen-rendering.md)
|
* [Offscreen Rendering](tutorial/offscreen-rendering.md)
|
||||||
* [Dark Mode](tutorial/dark-mode.md)
|
* [Dark Mode](tutorial/dark-mode.md)
|
||||||
* [Web embeds in Electron](tutorial/web-embeds.md)
|
* [Web embeds in Electron](tutorial/web-embeds.md)
|
||||||
|
|||||||
@@ -32,22 +32,28 @@ This is a requirement of `Squirrel.Mac`.
|
|||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
On Windows, you have to install your app into a user's machine before you can
|
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
|
use the `autoUpdater`, so it is recommended that you use
|
||||||
[electron-winstaller][installer-lib], [Electron Forge][electron-forge-lib] or the [grunt-electron-installer][installer] package to generate a Windows installer.
|
[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
|
[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.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE`, examples are
|
||||||
`com.squirrel.slack.Slack` and `com.squirrel.code.Code`. You have to use the
|
`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
|
same ID for your app with `app.setAppUserModelId` API, otherwise Windows will
|
||||||
not be able to pin your app properly in task bar.
|
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
|
## Events
|
||||||
|
|
||||||
The `autoUpdater` object emits the following events:
|
The `autoUpdater` object emits the following events:
|
||||||
@@ -137,9 +143,7 @@ application starts.
|
|||||||
|
|
||||||
[squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac
|
[squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac
|
||||||
[server-support]: https://github.com/Squirrel/Squirrel.Mac#server-support
|
[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
|
[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
|
[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
|
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||||
|
|||||||
@@ -126,10 +126,18 @@ or session log off.
|
|||||||
|
|
||||||
#### Event: 'blur'
|
#### Event: 'blur'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
|
||||||
Emitted when the window loses focus.
|
Emitted when the window loses focus.
|
||||||
|
|
||||||
#### Event: 'focus'
|
#### Event: 'focus'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
|
||||||
Emitted when the window gains focus.
|
Emitted when the window gains focus.
|
||||||
|
|
||||||
#### Event: 'show'
|
#### Event: 'show'
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ following properties:
|
|||||||
[`request.followRedirect`](#requestfollowredirect) is invoked synchronously
|
[`request.followRedirect`](#requestfollowredirect) is invoked synchronously
|
||||||
during the [`redirect`](#event-redirect) event. Defaults to `follow`.
|
during the [`redirect`](#event-redirect) event. Defaults to `follow`.
|
||||||
* `origin` string (optional) - The origin URL of the request.
|
* `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`,
|
`no-referrer-when-downgrade`, `origin`, `origin-when-cross-origin`,
|
||||||
`unsafe-url`, `same-origin`, `strict-origin`, or
|
`unsafe-url`, `same-origin`, `strict-origin`, or
|
||||||
`strict-origin-when-cross-origin`. Defaults to
|
`strict-origin-when-cross-origin`. Defaults to
|
||||||
|
|||||||
@@ -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.
|
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
|
### Exposing Node Global Symbols
|
||||||
|
|
||||||
The `contextBridge` can be used by the preload script to give your renderer access to Node APIs.
|
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.
|
`url`. Empty implies retrieving cookies of all URLs.
|
||||||
* `name` string (optional) - Filters cookies by name.
|
* `name` string (optional) - Filters cookies by name.
|
||||||
* `domain` string (optional) - Retrieves cookies whose domains match or are
|
* `domain` string (optional) - Retrieves cookies whose domains match or are
|
||||||
subdomains of `domain`.
|
subdomains of `domains`.
|
||||||
* `path` string (optional) - Retrieves cookies whose path matches `path`.
|
* `path` string (optional) - Retrieves cookies whose path matches `path`.
|
||||||
* `secure` boolean (optional) - Filters cookies by their Secure property.
|
* `secure` boolean (optional) - Filters cookies by their Secure property.
|
||||||
* `session` boolean (optional) - Filters out session or persistent cookies.
|
* `session` boolean (optional) - Filters out session or persistent cookies.
|
||||||
|
|||||||
@@ -20,7 +20,11 @@ app.whenReady().then(() => {
|
|||||||
// Grant access to the first screen found.
|
// Grant access to the first screen found.
|
||||||
callback({ video: sources[0], audio: 'loopback' })
|
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')
|
mainWindow.loadFile('index.html')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ Emitted when a request has been canceled during an ongoing HTTP transaction.
|
|||||||
|
|
||||||
Returns:
|
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
|
Emitted when an error was encountered while streaming response data events. For
|
||||||
instance, if the server closes the underlying while the response is still
|
instance, if the server closes the underlying while the response is still
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ See [`Menu`](menu.md) for examples.
|
|||||||
|
|
||||||
* `options` Object
|
* `options` Object
|
||||||
* `click` Function (optional) - Will be called with
|
* `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
|
* `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)
|
* `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
|
* `role` string (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`, `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `showAllTabs`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
||||||
`click` property will be ignored. See [roles](#roles).
|
`click` property will be ignored. See [roles](#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)`.
|
It can be called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
|
||||||
|
|
||||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||||
* `focusedWindow` [BrowserWindow](browser-window.md)
|
* `focusedWindow` [BaseWindow](browser-window.md)
|
||||||
* `focusedWebContents` [WebContents](web-contents.md)
|
* `focusedWebContents` [WebContents](web-contents.md)
|
||||||
|
|
||||||
#### `menuItem.submenu`
|
#### `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.
|
* `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.
|
* `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.
|
* `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.
|
* `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'.
|
* `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.
|
* `replyPlaceholder` string (optional) _macOS_ - The placeholder to write in the inline reply input field.
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ app.whenReady().then(() => {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js @ts-nocheck
|
||||||
// Renderer Process
|
// Renderer Process
|
||||||
|
|
||||||
const portConnect = async () => {
|
const portConnect = async () => {
|
||||||
@@ -953,7 +953,7 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `ses.setDisplayMediaRequestHandler(handler)`
|
#### `ses.setDisplayMediaRequestHandler(handler[, opts])`
|
||||||
|
|
||||||
* `handler` Function | null
|
* `handler` Function | null
|
||||||
* `request` Object
|
* `request` Object
|
||||||
@@ -980,12 +980,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`
|
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
|
to record `WebFrameMain` with this flag set to `true` will allow audio to pass through to the speakers
|
||||||
while recording). Default is `false`.
|
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
|
This handler will be called when web content requests access to display media
|
||||||
via the `navigator.mediaDevices.getDisplayMedia` API. Use the
|
via the `navigator.mediaDevices.getDisplayMedia` API. Use the
|
||||||
[desktopCapturer](desktop-capturer.md) API to choose which stream(s) to grant
|
[desktopCapturer](desktop-capturer.md) API to choose which stream(s) to grant
|
||||||
access to.
|
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
|
```js
|
||||||
const { session, desktopCapturer } = require('electron')
|
const { session, desktopCapturer } = require('electron')
|
||||||
|
|
||||||
@@ -994,7 +1000,11 @@ session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
|
|||||||
// Grant access to the first screen found.
|
// Grant access to the first screen found.
|
||||||
callback({ video: sources[0] })
|
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
|
Passing a [WebFrameMain](web-frame-main.md) object as a video or audio stream
|
||||||
@@ -1511,7 +1521,7 @@ Returns `Promise<void>` - resolves when all data has been cleared.
|
|||||||
|
|
||||||
Clears various different types of data.
|
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.
|
`clearStorageData` method.
|
||||||
|
|
||||||
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
|
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
|
||||||
|
|||||||
@@ -91,6 +91,10 @@
|
|||||||
title bar and a full size content window, the traffic light buttons will
|
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.
|
display when being hovered over in the top left of the window.
|
||||||
**Note:** This option is currently experimental.
|
**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_ -
|
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
|
||||||
Set a custom position for the traffic light buttons in frameless windows.
|
Set a custom position for the traffic light buttons in frameless windows.
|
||||||
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
|
* `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
|
reserved for NSPanel, at runtime. Also, the window will appear on all
|
||||||
spaces (desktops).
|
spaces (desktops).
|
||||||
* On Windows, possible type is `toolbar`.
|
* On Windows, possible type is `toolbar`.
|
||||||
|
|
||||||
|
[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.
|
* `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`.
|
* `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
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ updates the control in the touch bar. Possible values:
|
|||||||
|
|
||||||
#### `touchBarScrubber.overlayStyle`
|
#### `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
|
of the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the
|
||||||
touch bar. Possible values:
|
touch bar. Possible values:
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,20 @@ When the child process exits, then the value is `null` after the `exit` event is
|
|||||||
|
|
||||||
Emitted once the child process has spawned successfully.
|
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'
|
#### Event: 'exit'
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -138,3 +152,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
|
[stdio]: https://nodejs.org/dist/latest/docs/api/child_process.html#optionsstdio
|
||||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||||
[`MessagePortMain`]: message-port-main.md
|
[`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.
|
* `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)`
|
#### `view.setBounds(bounds)`
|
||||||
|
|
||||||
* `bounds` [Rectangle](structures/rectangle.md) - New bounds of the View.
|
* `bounds` [Rectangle](structures/rectangle.md) - New bounds of the View.
|
||||||
|
|||||||
@@ -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.
|
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
|
```js
|
||||||
// Before
|
// Before
|
||||||
|
|||||||
@@ -14,6 +14,33 @@ This document uses the following convention to categorize breaking changes:
|
|||||||
|
|
||||||
## Planned Breaking API Changes (33.0)
|
## Planned Breaking API Changes (33.0)
|
||||||
|
|
||||||
|
### 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`
|
### Behavior Changed: `webContents` property on `login` on `app`
|
||||||
|
|
||||||
The `webContents` property in the `login` event from `app` will be `null`
|
The `webContents` property in the `login` event from `app` will be `null`
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ $ git rebase --autosquash -i [COMMIT_SHA]^
|
|||||||
$ ../electron/script/git-export-patches -o ../electron/patches/v8
|
$ ../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
|
#### Removing a patch
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
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;
|
||||||
|
}
|
||||||
@@ -9,10 +9,12 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
|
|||||||
|
|
||||||
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
|
| 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 | ✅ |
|
| 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 | ✅ |
|
| 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 | ✅ |
|
| 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 | 🚫 |
|
| 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 | 🚫 |
|
| 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 | 🚫 |
|
| 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
|
||||||
|
|
||||||
|
```
|
||||||
@@ -261,7 +261,59 @@ server-communication aspect of the process by loading your update from a local d
|
|||||||
|
|
||||||
## Update server specification
|
## 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
|
[vercel]: https://vercel.com
|
||||||
[hazel]: https://github.com/vercel/hazel
|
[hazel]: https://github.com/vercel/hazel
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ The [Window Controls Overlay API][] is a web standard that gives web apps the ab
|
|||||||
customize their title bar region when installed on desktop. Electron exposes this API
|
customize their title bar region when installed on desktop. Electron exposes this API
|
||||||
through the `BrowserWindow` constructor option `titleBarOverlay`.
|
through the `BrowserWindow` constructor option `titleBarOverlay`.
|
||||||
|
|
||||||
This option only works whenever a custom `titlebarStyle` is applied on macOS or Windows.
|
This option only works whenever a custom `titlebarStyle` is applied.
|
||||||
When `titleBarOverlay` is enabled, the window controls become exposed in their default
|
When `titleBarOverlay` is enabled, the window controls become exposed in their default
|
||||||
position, and DOM elements cannot use the area underneath this region.
|
position, and DOM elements cannot use the area underneath this region.
|
||||||
|
|
||||||
@@ -107,7 +107,6 @@ Specifying `true` on either platform will result in an overlay region with defau
|
|||||||
system colors:
|
system colors:
|
||||||
|
|
||||||
```js title='main.js'
|
```js title='main.js'
|
||||||
// on macOS or Windows
|
|
||||||
const { BrowserWindow } = require('electron')
|
const { BrowserWindow } = require('electron')
|
||||||
const win = new BrowserWindow({
|
const win = new BrowserWindow({
|
||||||
titleBarStyle: 'hidden',
|
titleBarStyle: 'hidden',
|
||||||
|
|||||||
@@ -270,6 +270,7 @@ filenames = {
|
|||||||
"shell/browser/api/electron_api_debugger.h",
|
"shell/browser/api/electron_api_debugger.h",
|
||||||
"shell/browser/api/electron_api_desktop_capturer.cc",
|
"shell/browser/api/electron_api_desktop_capturer.cc",
|
||||||
"shell/browser/api/electron_api_desktop_capturer.h",
|
"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_dialog.cc",
|
||||||
"shell/browser/api/electron_api_download_item.cc",
|
"shell/browser/api/electron_api_download_item.cc",
|
||||||
"shell/browser/api/electron_api_download_item.h",
|
"shell/browser/api/electron_api_download_item.h",
|
||||||
@@ -378,8 +379,6 @@ filenames = {
|
|||||||
"shell/browser/electron_navigation_throttle.h",
|
"shell/browser/electron_navigation_throttle.h",
|
||||||
"shell/browser/electron_permission_manager.cc",
|
"shell/browser/electron_permission_manager.cc",
|
||||||
"shell/browser/electron_permission_manager.h",
|
"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.cc",
|
||||||
"shell/browser/electron_speech_recognition_manager_delegate.h",
|
"shell/browser/electron_speech_recognition_manager_delegate.h",
|
||||||
"shell/browser/electron_web_contents_utility_handler_impl.cc",
|
"shell/browser/electron_web_contents_utility_handler_impl.cc",
|
||||||
@@ -681,8 +680,8 @@ filenames = {
|
|||||||
"shell/common/skia_util.cc",
|
"shell/common/skia_util.cc",
|
||||||
"shell/common/skia_util.h",
|
"shell/common/skia_util.h",
|
||||||
"shell/common/thread_restrictions.h",
|
"shell/common/thread_restrictions.h",
|
||||||
"shell/common/v8_value_serializer.cc",
|
"shell/common/v8_util.cc",
|
||||||
"shell/common/v8_value_serializer.h",
|
"shell/common/v8_util.h",
|
||||||
"shell/common/world_ids.h",
|
"shell/common/world_ids.h",
|
||||||
"shell/renderer/api/context_bridge/object_cache.cc",
|
"shell/renderer/api/context_bridge/object_cache.cc",
|
||||||
"shell/renderer/api/context_bridge/object_cache.h",
|
"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/coroutine_traits.h",
|
||||||
"//third_party/libc++/src/include/__coroutine/noop_coroutine_handle.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/__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/randomize_range.h",
|
||||||
"//third_party/libc++/src/include/__debug_utils/sanitizers.h",
|
"//third_party/libc++/src/include/__debug_utils/sanitizers.h",
|
||||||
"//third_party/libc++/src/include/__debug_utils/strict_weak_ordering_check.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/__functional/weak_result_type.h",
|
||||||
"//third_party/libc++/src/include/__fwd/array.h",
|
"//third_party/libc++/src/include/__fwd/array.h",
|
||||||
"//third_party/libc++/src/include/__fwd/bit_reference.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/complex.h",
|
||||||
"//third_party/libc++/src/include/__fwd/deque.h",
|
"//third_party/libc++/src/include/__fwd/deque.h",
|
||||||
"//third_party/libc++/src/include/__fwd/format.h",
|
"//third_party/libc++/src/include/__fwd/format.h",
|
||||||
"//third_party/libc++/src/include/__fwd/fstream.h",
|
"//third_party/libc++/src/include/__fwd/fstream.h",
|
||||||
"//third_party/libc++/src/include/__fwd/functional.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/ios.h",
|
||||||
"//third_party/libc++/src/include/__fwd/istream.h",
|
"//third_party/libc++/src/include/__fwd/istream.h",
|
||||||
"//third_party/libc++/src/include/__fwd/mdspan.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/string_view.h",
|
||||||
"//third_party/libc++/src/include/__fwd/subrange.h",
|
"//third_party/libc++/src/include/__fwd/subrange.h",
|
||||||
"//third_party/libc++/src/include/__fwd/tuple.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/__fwd/vector.h",
|
||||||
"//third_party/libc++/src/include/__hash_table",
|
"//third_party/libc++/src/include/__hash_table",
|
||||||
"//third_party/libc++/src/include/__ios/fpos.h",
|
"//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/construct_at.h",
|
||||||
"//third_party/libc++/src/include/__memory/destruct_n.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/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/out_ptr.h",
|
||||||
"//third_party/libc++/src/include/__memory/pointer_traits.h",
|
"//third_party/libc++/src/include/__memory/pointer_traits.h",
|
||||||
"//third_party/libc++/src/include/__memory/ranges_construct_at.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/maybe_const.h",
|
||||||
"//third_party/libc++/src/include/__type_traits/nat.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/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/promote.h",
|
||||||
"//third_party/libc++/src/include/__type_traits/rank.h",
|
"//third_party/libc++/src/include/__type_traits/rank.h",
|
||||||
"//third_party/libc++/src/include/__type_traits/remove_all_extents.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/exception",
|
||||||
"//third_party/libc++/src/include/execution",
|
"//third_party/libc++/src/include/execution",
|
||||||
"//third_party/libc++/src/include/expected",
|
"//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/aligned_tag.h",
|
||||||
"//third_party/libc++/src/include/experimental/__simd/declaration.h",
|
"//third_party/libc++/src/include/experimental/__simd/declaration.h",
|
||||||
"//third_party/libc++/src/include/experimental/__simd/reference.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 { Menu } from 'electron/main';
|
||||||
|
|
||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
const bindings = process._linkedBinding('electron_browser_app');
|
const bindings = process._linkedBinding('electron_browser_app');
|
||||||
const commandLine = process._linkedBinding('electron_common_command_line');
|
const commandLine = process._linkedBinding('electron_common_command_line');
|
||||||
const { app } = bindings;
|
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 * 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 {
|
class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||||
updateAvailable: boolean = false;
|
updateAvailable: boolean = false;
|
||||||
updateURL: string | null = null;
|
updateURL: string | null = null;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { spawn, ChildProcessWithoutNullStreams } from 'child_process';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { spawn, ChildProcessWithoutNullStreams } from 'child_process';
|
|
||||||
|
|
||||||
// i.e. my-app/app-0.1.13/
|
// i.e. my-app/app-0.1.13/
|
||||||
const appFolder = path.dirname(process.execPath);
|
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 type { BaseWindow as TLWT } from 'electron/main';
|
||||||
|
|
||||||
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
const { BaseWindow } = process._linkedBinding('electron_browser_base_window') as { BaseWindow: typeof TLWT };
|
const { BaseWindow } = process._linkedBinding('electron_browser_base_window') as { BaseWindow: typeof TLWT };
|
||||||
|
|
||||||
Object.setPrototypeOf(BaseWindow.prototype, EventEmitter.prototype);
|
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
|
// Properties
|
||||||
|
|
||||||
Object.defineProperty(BaseWindow.prototype, 'autoHideMenuBar', {
|
Object.defineProperty(BaseWindow.prototype, 'autoHideMenuBar', {
|
||||||
|
|||||||
@@ -68,10 +68,7 @@ export default class BrowserView {
|
|||||||
// a webContents can be closed by the user while the BrowserView
|
// a webContents can be closed by the user while the BrowserView
|
||||||
// remains alive and attached to a BrowserWindow.
|
// remains alive and attached to a BrowserWindow.
|
||||||
set ownerWindow (w: BrowserWindow | null) {
|
set ownerWindow (w: BrowserWindow | null) {
|
||||||
if (this.#ownerWindow && this.#resizeListener) {
|
this.#removeResizeListener();
|
||||||
this.#ownerWindow.off('resize', this.#resizeListener);
|
|
||||||
this.#resizeListener = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.webContents && !this.webContents.isDestroyed()) {
|
if (this.webContents && !this.webContents.isDestroyed()) {
|
||||||
this.webContents._setOwnerWindow(w);
|
this.webContents._setOwnerWindow(w);
|
||||||
@@ -82,6 +79,7 @@ export default class BrowserView {
|
|||||||
this.#lastWindowSize = w.getBounds();
|
this.#lastWindowSize = w.getBounds();
|
||||||
w.on('resize', this.#resizeListener = this.#autoResize.bind(this));
|
w.on('resize', this.#resizeListener = this.#autoResize.bind(this));
|
||||||
w.on('closed', () => {
|
w.on('closed', () => {
|
||||||
|
this.#removeResizeListener();
|
||||||
this.#ownerWindow = null;
|
this.#ownerWindow = null;
|
||||||
this.#destroyListener = null;
|
this.#destroyListener = null;
|
||||||
});
|
});
|
||||||
@@ -94,6 +92,13 @@ export default class BrowserView {
|
|||||||
this.#ownerWindow?.contentView.removeChildView(this.webContentsView);
|
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;
|
#autoHorizontalProportion: {width: number, left: number} | null = null;
|
||||||
#autoVerticalProportion: {height: number, top: number} | null = null;
|
#autoVerticalProportion: {height: number, top: number} | null = null;
|
||||||
#autoResize () {
|
#autoResize () {
|
||||||
@@ -145,6 +150,12 @@ export default class BrowserView {
|
|||||||
if (this.#autoHorizontalProportion || this.#autoVerticalProportion) {
|
if (this.#autoHorizontalProportion || this.#autoVerticalProportion) {
|
||||||
this.#webContentsView.setBounds(newViewBounds);
|
this.#webContentsView.setBounds(newViewBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update #lastWindowSize value after browser windows resize
|
||||||
|
this.#lastWindowSize = {
|
||||||
|
width: newBounds.width,
|
||||||
|
height: newBounds.height
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
get webContentsView () {
|
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';
|
import type { BrowserWindow as BWT } from 'electron/main';
|
||||||
|
|
||||||
const { BrowserWindow } = process._linkedBinding('electron_browser_window') as { BrowserWindow: typeof BWT };
|
const { BrowserWindow } = process._linkedBinding('electron_browser_window') as { BrowserWindow: typeof BWT };
|
||||||
|
|
||||||
Object.setPrototypeOf(BrowserWindow.prototype, BaseWindow.prototype);
|
Object.setPrototypeOf(BrowserWindow.prototype, BaseWindow.prototype);
|
||||||
@@ -100,10 +101,6 @@ BrowserWindow.fromBrowserView = (browserView: BrowserView) => {
|
|||||||
return BrowserWindow.fromWebContents(browserView.webContents);
|
return BrowserWindow.fromWebContents(browserView.webContents);
|
||||||
};
|
};
|
||||||
|
|
||||||
BrowserWindow.prototype.setTouchBar = function (touchBar) {
|
|
||||||
(TouchBar as any)._setOnWindow(touchBar, this);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Forwarded to webContents:
|
// Forwarded to webContents:
|
||||||
|
|
||||||
BrowserWindow.prototype.loadURL = function (...args) {
|
BrowserWindow.prototype.loadURL = function (...args) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { app } from 'electron/main';
|
|
||||||
import * as deprecate from '@electron/internal/common/deprecate';
|
import * as deprecate from '@electron/internal/common/deprecate';
|
||||||
|
|
||||||
|
import { app } from 'electron/main';
|
||||||
|
|
||||||
const binding = process._linkedBinding('electron_browser_crash_reporter');
|
const binding = process._linkedBinding('electron_browser_crash_reporter');
|
||||||
|
|
||||||
class CrashReporter implements Electron.CrashReporter {
|
class CrashReporter implements Electron.CrashReporter {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { BrowserWindow } from 'electron/main';
|
import { BrowserWindow } from 'electron/main';
|
||||||
const { createDesktopCapturer } = process._linkedBinding('electron_browser_desktop_capturer');
|
|
||||||
|
const { createDesktopCapturer, isDisplayMediaSystemPickerAvailable } = process._linkedBinding('electron_browser_desktop_capturer');
|
||||||
|
|
||||||
const deepEqual = (a: ElectronInternal.GetSourcesOptions, b: ElectronInternal.GetSourcesOptions) => JSON.stringify(a) === JSON.stringify(b);
|
const deepEqual = (a: ElectronInternal.GetSourcesOptions, b: ElectronInternal.GetSourcesOptions) => JSON.stringify(a) === JSON.stringify(b);
|
||||||
|
|
||||||
@@ -13,6 +14,8 @@ function isValid (options: Electron.SourcesOptions) {
|
|||||||
return Array.isArray(options?.types);
|
return Array.isArray(options?.types);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export { isDisplayMediaSystemPickerAvailable };
|
||||||
|
|
||||||
export async function getSources (args: Electron.SourcesOptions) {
|
export async function getSources (args: Electron.SourcesOptions) {
|
||||||
if (!isValid(args)) throw new Error('Invalid options');
|
if (!isValid(args)) throw new Error('Invalid options');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { app, BaseWindow } from 'electron/main';
|
import { app, BaseWindow } from 'electron/main';
|
||||||
import type { OpenDialogOptions, OpenDialogReturnValue, MessageBoxOptions, SaveDialogOptions, SaveDialogReturnValue, MessageBoxReturnValue, CertificateTrustDialogOptions } from 'electron/main';
|
import type { OpenDialogOptions, OpenDialogReturnValue, MessageBoxOptions, SaveDialogOptions, SaveDialogReturnValue, MessageBoxReturnValue, CertificateTrustDialogOptions } from 'electron/main';
|
||||||
|
|
||||||
const dialogBinding = process._linkedBinding('electron_browser_dialog');
|
const dialogBinding = process._linkedBinding('electron_browser_dialog');
|
||||||
|
|
||||||
enum SaveFileDialogProperties {
|
enum SaveFileDialogProperties {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { defineProperties } from '@electron/internal/common/define-properties';
|
|
||||||
import { commonModuleList } from '@electron/internal/common/api/module-list';
|
|
||||||
import { browserModuleList } from '@electron/internal/browser/api/module-list';
|
import { browserModuleList } from '@electron/internal/browser/api/module-list';
|
||||||
|
import { commonModuleList } from '@electron/internal/common/api/module-list';
|
||||||
|
import { defineProperties } from '@electron/internal/common/define-properties';
|
||||||
|
|
||||||
module.exports = {};
|
module.exports = {};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { app, BrowserWindow, session, webContents, WebContents, MenuItemConstructorOptions } from 'electron/main';
|
import { app, BaseWindow, BrowserWindow, session, webContents, WebContents, MenuItemConstructorOptions } from 'electron/main';
|
||||||
|
|
||||||
const isMac = process.platform === 'darwin';
|
const isMac = process.platform === 'darwin';
|
||||||
const isWindows = process.platform === 'win32';
|
const isWindows = process.platform === 'win32';
|
||||||
@@ -13,7 +13,7 @@ interface Role {
|
|||||||
label: string;
|
label: string;
|
||||||
accelerator?: string;
|
accelerator?: string;
|
||||||
checked?: boolean;
|
checked?: boolean;
|
||||||
windowMethod?: ((window: BrowserWindow) => void);
|
windowMethod?: ((window: BaseWindow) => void);
|
||||||
webContentsMethod?: ((webContents: WebContents) => void);
|
webContentsMethod?: ((webContents: WebContents) => void);
|
||||||
appMethod?: () => void;
|
appMethod?: () => void;
|
||||||
registerAccelerator?: boolean;
|
registerAccelerator?: boolean;
|
||||||
@@ -53,9 +53,11 @@ export const roleList: Record<RoleId, Role> = {
|
|||||||
label: 'Force Reload',
|
label: 'Force Reload',
|
||||||
accelerator: 'Shift+CmdOrCtrl+R',
|
accelerator: 'Shift+CmdOrCtrl+R',
|
||||||
nonNativeMacOSRole: true,
|
nonNativeMacOSRole: true,
|
||||||
windowMethod: (window: BrowserWindow) => {
|
windowMethod: (window: BaseWindow) => {
|
||||||
|
if (window instanceof BrowserWindow) {
|
||||||
window.webContents.reloadIgnoringCache();
|
window.webContents.reloadIgnoringCache();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
front: {
|
front: {
|
||||||
label: 'Bring All to Front'
|
label: 'Bring All to Front'
|
||||||
@@ -110,7 +112,11 @@ export const roleList: Record<RoleId, Role> = {
|
|||||||
label: 'Reload',
|
label: 'Reload',
|
||||||
accelerator: 'CmdOrCtrl+R',
|
accelerator: 'CmdOrCtrl+R',
|
||||||
nonNativeMacOSRole: true,
|
nonNativeMacOSRole: true,
|
||||||
windowMethod: w => w.reload()
|
windowMethod: (w: BaseWindow) => {
|
||||||
|
if (w instanceof BrowserWindow) {
|
||||||
|
w.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
resetzoom: {
|
resetzoom: {
|
||||||
label: 'Actual Size',
|
label: 'Actual Size',
|
||||||
@@ -164,7 +170,7 @@ export const roleList: Record<RoleId, Role> = {
|
|||||||
togglefullscreen: {
|
togglefullscreen: {
|
||||||
label: 'Toggle Full Screen',
|
label: 'Toggle Full Screen',
|
||||||
accelerator: isMac ? 'Control+Command+F' : 'F11',
|
accelerator: isMac ? 'Control+Command+F' : 'F11',
|
||||||
windowMethod: (window: BrowserWindow) => {
|
windowMethod: (window: BaseWindow) => {
|
||||||
window.setFullScreen(!window.isFullScreen());
|
window.setFullScreen(!window.isFullScreen());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -245,7 +251,8 @@ export const roleList: Record<RoleId, Role> = {
|
|||||||
{ role: 'cut' },
|
{ role: 'cut' },
|
||||||
{ role: 'copy' },
|
{ role: 'copy' },
|
||||||
{ role: 'paste' },
|
{ role: 'paste' },
|
||||||
...(isMac ? [
|
...(isMac
|
||||||
|
? [
|
||||||
{ role: 'pasteAndMatchStyle' },
|
{ role: 'pasteAndMatchStyle' },
|
||||||
{ role: 'delete' },
|
{ role: 'delete' },
|
||||||
{ role: 'selectAll' },
|
{ role: 'selectAll' },
|
||||||
@@ -267,7 +274,8 @@ export const roleList: Record<RoleId, Role> = {
|
|||||||
{ role: 'stopSpeaking' }
|
{ role: 'stopSpeaking' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
] as MenuItemConstructorOptions[] : [
|
] as MenuItemConstructorOptions[]
|
||||||
|
: [
|
||||||
{ role: 'delete' },
|
{ role: 'delete' },
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ role: 'selectAll' }
|
{ role: 'selectAll' }
|
||||||
@@ -295,10 +303,12 @@ export const roleList: Record<RoleId, Role> = {
|
|||||||
submenu: [
|
submenu: [
|
||||||
{ role: 'minimize' },
|
{ role: 'minimize' },
|
||||||
{ role: 'zoom' },
|
{ role: 'zoom' },
|
||||||
...(isMac ? [
|
...(isMac
|
||||||
|
? [
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ role: 'front' }
|
{ role: 'front' }
|
||||||
] as MenuItemConstructorOptions[] : [
|
] as MenuItemConstructorOptions[]
|
||||||
|
: [
|
||||||
{ role: 'close' }
|
{ role: 'close' }
|
||||||
] as MenuItemConstructorOptions[])
|
] as MenuItemConstructorOptions[])
|
||||||
]
|
]
|
||||||
@@ -361,7 +371,7 @@ export function getDefaultSubmenu (role: RoleId) {
|
|||||||
return submenu;
|
return submenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function execute (role: RoleId, focusedWindow: BrowserWindow, focusedWebContents: WebContents) {
|
export function execute (role: RoleId, focusedWindow: BaseWindow, focusedWebContents: WebContents) {
|
||||||
if (!canExecuteRole(role)) return false;
|
if (!canExecuteRole(role)) return false;
|
||||||
|
|
||||||
const { appMethod, webContentsMethod, windowMethod } = roleList[role];
|
const { appMethod, webContentsMethod, windowMethod } = roleList[role];
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import * as roles from '@electron/internal/browser/api/menu-item-roles';
|
import * as roles from '@electron/internal/browser/api/menu-item-roles';
|
||||||
import { Menu, BrowserWindow, WebContents, KeyboardEvent } from 'electron/main';
|
|
||||||
|
import { Menu, BaseWindow, WebContents, KeyboardEvent } from 'electron/main';
|
||||||
|
|
||||||
let nextCommandId = 0;
|
let nextCommandId = 0;
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ const MenuItem = function (this: any, options: any) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const click = options.click;
|
const click = options.click;
|
||||||
this.click = (event: KeyboardEvent, focusedWindow: BrowserWindow, focusedWebContents: WebContents) => {
|
this.click = (event: KeyboardEvent, focusedWindow: BaseWindow, focusedWebContents: WebContents) => {
|
||||||
// Manually flip the checked flags when clicked.
|
// Manually flip the checked flags when clicked.
|
||||||
if (!roles.shouldOverrideCheckStatus(this.role) &&
|
if (!roles.shouldOverrideCheckStatus(this.role) &&
|
||||||
(this.type === 'checkbox' || this.type === 'radio')) {
|
(this.type === 'checkbox' || this.type === 'radio')) {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { BaseWindow, MenuItem, webContents, Menu as MenuType, BrowserWindow, MenuItemConstructorOptions } from 'electron/main';
|
|
||||||
import { sortMenuItems } from '@electron/internal/browser/api/menu-utils';
|
import { sortMenuItems } from '@electron/internal/browser/api/menu-utils';
|
||||||
import { setApplicationMenuWasSet } from '@electron/internal/browser/default-menu';
|
import { setApplicationMenuWasSet } from '@electron/internal/browser/default-menu';
|
||||||
|
|
||||||
|
import { BaseWindow, MenuItem, webContents, Menu as MenuType, MenuItemConstructorOptions } from 'electron/main';
|
||||||
|
|
||||||
const bindings = process._linkedBinding('electron_browser_menu');
|
const bindings = process._linkedBinding('electron_browser_menu');
|
||||||
|
|
||||||
const { Menu } = bindings as { Menu: typeof MenuType };
|
const { Menu } = bindings as { Menu: typeof MenuType };
|
||||||
@@ -54,7 +55,7 @@ Menu.prototype._executeCommand = function (event, id) {
|
|||||||
const command = this.commandsMap[id];
|
const command = this.commandsMap[id];
|
||||||
if (!command) return;
|
if (!command) return;
|
||||||
const focusedWindow = BaseWindow.getFocusedWindow();
|
const focusedWindow = BaseWindow.getFocusedWindow();
|
||||||
command.click(event, focusedWindow instanceof BrowserWindow ? focusedWindow : undefined, webContents.getFocusedWebContents());
|
command.click(event, focusedWindow, webContents.getFocusedWebContents());
|
||||||
};
|
};
|
||||||
|
|
||||||
Menu.prototype._menuWillShow = function () {
|
Menu.prototype._menuWillShow = function () {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
||||||
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
const { createPair } = process._linkedBinding('electron_browser_message_port');
|
const { createPair } = process._linkedBinding('electron_browser_message_port');
|
||||||
|
|
||||||
export default class MessageChannelMain extends EventEmitter implements Electron.MessageChannelMain {
|
export default class MessageChannelMain extends EventEmitter implements Electron.MessageChannelMain {
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { ClientRequestConstructorOptions, ClientRequest, IncomingMessage, Session as SessionT } from 'electron/main';
|
|
||||||
import { Readable, Writable, isReadable } from 'stream';
|
|
||||||
import { allowAnyProtocol } from '@electron/internal/common/api/net-client-request';
|
import { allowAnyProtocol } from '@electron/internal/common/api/net-client-request';
|
||||||
|
|
||||||
|
import { ClientRequestConstructorOptions, ClientRequest, IncomingMessage, Session as SessionT } from 'electron/main';
|
||||||
|
|
||||||
|
import { Readable, Writable, isReadable } from 'stream';
|
||||||
|
|
||||||
function createDeferredPromise<T, E extends Error = Error> (): { promise: Promise<T>; resolve: (x: T) => void; reject: (e: E) => void; } {
|
function createDeferredPromise<T, E extends Error = Error> (): { promise: Promise<T>; resolve: (x: T) => void; reject: (e: E) => void; } {
|
||||||
let res: (x: T) => void;
|
let res: (x: T) => void;
|
||||||
let rej: (e: E) => void;
|
let rej: (e: E) => void;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
import { ClientRequest } from '@electron/internal/common/api/net-client-request';
|
||||||
|
|
||||||
import { app, IncomingMessage, session } from 'electron/main';
|
import { app, IncomingMessage, session } from 'electron/main';
|
||||||
import type { ClientRequestConstructorOptions } from 'electron/main';
|
import type { ClientRequestConstructorOptions } from 'electron/main';
|
||||||
import { ClientRequest } from '@electron/internal/common/api/net-client-request';
|
|
||||||
|
|
||||||
const { isOnline } = process._linkedBinding('electron_common_net');
|
const { isOnline } = process._linkedBinding('electron_common_net');
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ProtocolRequest, session } from 'electron/main';
|
import { ProtocolRequest, session } from 'electron/main';
|
||||||
|
|
||||||
import { createReadStream } from 'fs';
|
import { createReadStream } from 'fs';
|
||||||
import { Readable } from 'stream';
|
import { Readable } from 'stream';
|
||||||
import { ReadableStream } from 'stream/web';
|
import { ReadableStream } from 'stream/web';
|
||||||
|
|||||||
@@ -1,11 +1,41 @@
|
|||||||
import { fetchWithSession } from '@electron/internal/browser/api/net-fetch';
|
import { fetchWithSession } from '@electron/internal/browser/api/net-fetch';
|
||||||
|
|
||||||
import { net } from 'electron/main';
|
import { net } from 'electron/main';
|
||||||
|
|
||||||
const { fromPartition, fromPath, Session } = process._linkedBinding('electron_browser_session');
|
const { fromPartition, fromPath, Session } = process._linkedBinding('electron_browser_session');
|
||||||
|
const { isDisplayMediaSystemPickerAvailable } = process._linkedBinding('electron_browser_desktop_capturer');
|
||||||
|
|
||||||
|
// Fake video window that activates the native system picker
|
||||||
|
// This is used to get around the need for a screen/window
|
||||||
|
// id in Chrome's desktopCapturer.
|
||||||
|
let fakeVideoWindowId = -1;
|
||||||
|
// See content/public/browser/desktop_media_id.h
|
||||||
|
const kMacOsNativePickerId = -4;
|
||||||
|
const systemPickerVideoSource = Object.create(null);
|
||||||
|
Object.defineProperty(systemPickerVideoSource, 'id', {
|
||||||
|
get () {
|
||||||
|
return `window:${kMacOsNativePickerId}:${fakeVideoWindowId--}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
systemPickerVideoSource.name = '';
|
||||||
|
Object.freeze(systemPickerVideoSource);
|
||||||
|
|
||||||
Session.prototype.fetch = function (input: RequestInfo, init?: RequestInit) {
|
Session.prototype.fetch = function (input: RequestInfo, init?: RequestInit) {
|
||||||
return fetchWithSession(input, init, this, net.request);
|
return fetchWithSession(input, init, this, net.request);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Session.prototype.setDisplayMediaRequestHandler = function (handler, opts) {
|
||||||
|
if (!handler) return this._setDisplayMediaRequestHandler(handler, opts);
|
||||||
|
|
||||||
|
this._setDisplayMediaRequestHandler(async (req, callback) => {
|
||||||
|
if (opts && opts.useSystemPicker && isDisplayMediaSystemPickerAvailable()) {
|
||||||
|
return callback({ video: systemPickerVideoSource });
|
||||||
|
}
|
||||||
|
|
||||||
|
return handler(req, callback);
|
||||||
|
}, opts);
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
fromPartition,
|
fromPartition,
|
||||||
fromPath,
|
fromPath,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { BrowserWindow, Menu, SharingItem, PopupOptions } from 'electron/main';
|
import { BrowserWindow, Menu, SharingItem, PopupOptions } from 'electron/main';
|
||||||
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
class ShareMenu extends EventEmitter implements Electron.ShareMenu {
|
class ShareMenu extends EventEmitter implements Electron.ShareMenu {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import * as deprecate from '@electron/internal/common/deprecate';
|
import * as deprecate from '@electron/internal/common/deprecate';
|
||||||
|
|
||||||
const { systemPreferences } = process._linkedBinding('electron_browser_system_preferences');
|
const { systemPreferences } = process._linkedBinding('electron_browser_system_preferences');
|
||||||
|
|
||||||
if ('getEffectiveAppearance' in systemPreferences) {
|
if ('getEffectiveAppearance' in systemPreferences) {
|
||||||
|
|||||||
@@ -117,10 +117,12 @@ class TouchBarColorPicker extends TouchBarItem<Electron.TouchBarColorPickerConst
|
|||||||
@LiveProperty<TouchBarColorPicker>(config => config.selectedColor)
|
@LiveProperty<TouchBarColorPicker>(config => config.selectedColor)
|
||||||
selectedColor!: string;
|
selectedColor!: string;
|
||||||
|
|
||||||
@ImmutableProperty<TouchBarColorPicker>(({ change: onChange }, setInternalProp) => typeof onChange === 'function' ? (details: { color: string }) => {
|
@ImmutableProperty<TouchBarColorPicker>(({ change: onChange }, setInternalProp) => typeof onChange === 'function'
|
||||||
|
? (details: { color: string }) => {
|
||||||
setInternalProp('selectedColor', details.color);
|
setInternalProp('selectedColor', details.color);
|
||||||
onChange(details.color);
|
onChange(details.color);
|
||||||
} : null)
|
}
|
||||||
|
: null)
|
||||||
onInteraction!: Function | null;
|
onInteraction!: Function | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,10 +205,12 @@ class TouchBarSlider extends TouchBarItem<Electron.TouchBarSliderConstructorOpti
|
|||||||
@LiveProperty<TouchBarSlider>(config => config.value)
|
@LiveProperty<TouchBarSlider>(config => config.value)
|
||||||
value!: number;
|
value!: number;
|
||||||
|
|
||||||
@ImmutableProperty<TouchBarSlider>(({ change: onChange }, setInternalProp) => typeof onChange === 'function' ? (details: { value: number }) => {
|
@ImmutableProperty<TouchBarSlider>(({ change: onChange }, setInternalProp) => typeof onChange === 'function'
|
||||||
|
? (details: { value: number }) => {
|
||||||
setInternalProp('value', details.value);
|
setInternalProp('value', details.value);
|
||||||
onChange(details.value);
|
onChange(details.value);
|
||||||
} : null)
|
}
|
||||||
|
: null)
|
||||||
onInteraction!: Function | null;
|
onInteraction!: Function | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,10 +240,12 @@ class TouchBarSegmentedControl extends TouchBarItem<Electron.TouchBarSegmentedCo
|
|||||||
@LiveProperty<TouchBarSegmentedControl>(config => config.mode)
|
@LiveProperty<TouchBarSegmentedControl>(config => config.mode)
|
||||||
mode!: Electron.TouchBarSegmentedControl['mode'];
|
mode!: Electron.TouchBarSegmentedControl['mode'];
|
||||||
|
|
||||||
@ImmutableProperty<TouchBarSegmentedControl>(({ change: onChange }, setInternalProp) => typeof onChange === 'function' ? (details: { selectedIndex: number, isSelected: boolean }) => {
|
@ImmutableProperty<TouchBarSegmentedControl>(({ change: onChange }, setInternalProp) => typeof onChange === 'function'
|
||||||
|
? (details: { selectedIndex: number, isSelected: boolean }) => {
|
||||||
setInternalProp('selectedIndex', details.selectedIndex);
|
setInternalProp('selectedIndex', details.selectedIndex);
|
||||||
onChange(details.selectedIndex, details.isSelected);
|
onChange(details.selectedIndex, details.isSelected);
|
||||||
} : null)
|
}
|
||||||
|
: null)
|
||||||
onInteraction!: Function | null;
|
onInteraction!: Function | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,13 +271,15 @@ class TouchBarScrubber extends TouchBarItem<Electron.TouchBarScrubberConstructor
|
|||||||
@LiveProperty<TouchBarScrubber>(config => typeof config.continuous === 'undefined' ? true : config.continuous)
|
@LiveProperty<TouchBarScrubber>(config => typeof config.continuous === 'undefined' ? true : config.continuous)
|
||||||
continuous!: boolean;
|
continuous!: boolean;
|
||||||
|
|
||||||
@ImmutableProperty<TouchBarScrubber>(({ select: onSelect, highlight: onHighlight }) => typeof onSelect === 'function' || typeof onHighlight === 'function' ? (details: { type: 'select'; selectedIndex: number } | { type: 'highlight'; highlightedIndex: number }) => {
|
@ImmutableProperty<TouchBarScrubber>(({ select: onSelect, highlight: onHighlight }) => typeof onSelect === 'function' || typeof onHighlight === 'function'
|
||||||
|
? (details: { type: 'select'; selectedIndex: number } | { type: 'highlight'; highlightedIndex: number }) => {
|
||||||
if (details.type === 'select') {
|
if (details.type === 'select') {
|
||||||
if (onSelect) onSelect(details.selectedIndex);
|
if (onSelect) onSelect(details.selectedIndex);
|
||||||
} else {
|
} else {
|
||||||
if (onHighlight) onHighlight(details.highlightedIndex);
|
if (onHighlight) onHighlight(details.highlightedIndex);
|
||||||
}
|
}
|
||||||
} : null)
|
}
|
||||||
|
: null)
|
||||||
onInteraction!: Function | null;
|
onInteraction!: Function | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,7 +292,7 @@ const escapeItemSymbol = Symbol('escape item');
|
|||||||
|
|
||||||
class TouchBar extends EventEmitter implements Electron.TouchBar {
|
class TouchBar extends EventEmitter implements Electron.TouchBar {
|
||||||
// Bind a touch bar to a window
|
// Bind a touch bar to a window
|
||||||
static _setOnWindow (touchBar: TouchBar | Electron.TouchBarConstructorOptions['items'], window: Electron.BrowserWindow) {
|
static _setOnWindow (touchBar: TouchBar | Electron.TouchBarConstructorOptions['items'], window: Electron.BaseWindow) {
|
||||||
if (window._touchBar != null) {
|
if (window._touchBar != null) {
|
||||||
window._touchBar._removeFromWindow(window);
|
window._touchBar._removeFromWindow(window);
|
||||||
}
|
}
|
||||||
@@ -383,7 +391,7 @@ class TouchBar extends EventEmitter implements Electron.TouchBar {
|
|||||||
return this[escapeItemSymbol];
|
return this[escapeItemSymbol];
|
||||||
}
|
}
|
||||||
|
|
||||||
_addToWindow (window: Electron.BrowserWindow) {
|
_addToWindow (window: Electron.BaseWindow) {
|
||||||
const { id } = window;
|
const { id } = window;
|
||||||
|
|
||||||
// Already added to window
|
// Already added to window
|
||||||
@@ -439,7 +447,7 @@ class TouchBar extends EventEmitter implements Electron.TouchBar {
|
|||||||
escapeItemListener(this.escapeItem);
|
escapeItemListener(this.escapeItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
_removeFromWindow (window: Electron.BrowserWindow) {
|
_removeFromWindow (window: Electron.BaseWindow) {
|
||||||
const removeListeners = this.windowListeners.get(window.id);
|
const removeListeners = this.windowListeners.get(window.id);
|
||||||
if (removeListeners != null) removeListeners();
|
if (removeListeners != null) removeListeners();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { EventEmitter } from 'events';
|
|
||||||
import { Duplex, PassThrough } from 'stream';
|
|
||||||
import { Socket } from 'net';
|
|
||||||
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
||||||
|
|
||||||
|
import { EventEmitter } from 'events';
|
||||||
|
import { Socket } from 'net';
|
||||||
|
import { Duplex, PassThrough } from 'stream';
|
||||||
|
|
||||||
const { _fork } = process._linkedBinding('electron_browser_utility_process');
|
const { _fork } = process._linkedBinding('electron_browser_utility_process');
|
||||||
|
|
||||||
class ForkUtilityProcess extends EventEmitter implements Electron.UtilityProcess {
|
class ForkUtilityProcess extends EventEmitter implements Electron.UtilityProcess {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
const { View } = process._linkedBinding('electron_browser_view');
|
const { View } = process._linkedBinding('electron_browser_view');
|
||||||
|
|
||||||
Object.setPrototypeOf((View as any).prototype, EventEmitter.prototype);
|
Object.setPrototypeOf((View as any).prototype, EventEmitter.prototype);
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
import { app, ipcMain, session, webFrameMain, dialog } from 'electron/main';
|
|
||||||
import type { BrowserWindowConstructorOptions, LoadURLOptions, MessageBoxOptions, WebFrameMain } from 'electron/main';
|
|
||||||
|
|
||||||
import * as url from 'url';
|
|
||||||
import * as path from 'path';
|
|
||||||
import { openGuestWindow, makeWebPreferences, parseContentTypeFormat } from '@electron/internal/browser/guest-window-manager';
|
import { openGuestWindow, makeWebPreferences, parseContentTypeFormat } from '@electron/internal/browser/guest-window-manager';
|
||||||
import { parseFeatures } from '@electron/internal/browser/parse-features-string';
|
import { IpcMainImpl } from '@electron/internal/browser/ipc-main-impl';
|
||||||
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
|
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
|
||||||
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
|
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
|
||||||
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
||||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
import { parseFeatures } from '@electron/internal/browser/parse-features-string';
|
||||||
import { IpcMainImpl } from '@electron/internal/browser/ipc-main-impl';
|
|
||||||
import * as deprecate from '@electron/internal/common/deprecate';
|
import * as deprecate from '@electron/internal/common/deprecate';
|
||||||
|
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||||
|
|
||||||
|
import { app, ipcMain, session, webFrameMain, dialog } from 'electron/main';
|
||||||
|
import type { BrowserWindowConstructorOptions, MessageBoxOptions } from 'electron/main';
|
||||||
|
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as url from 'url';
|
||||||
|
|
||||||
// session is not used here, the purpose is to make sure session is initialized
|
// session is not used here, the purpose is to make sure session is initialized
|
||||||
// before the webContents module.
|
// before the webContents module.
|
||||||
@@ -24,8 +25,6 @@ const getNextId = function () {
|
|||||||
return ++nextId;
|
return ++nextId;
|
||||||
};
|
};
|
||||||
|
|
||||||
type PostData = LoadURLOptions['postData']
|
|
||||||
|
|
||||||
// Stock page sizes
|
// Stock page sizes
|
||||||
const PDFPageSizes: Record<string, ElectronInternal.MediaSize> = {
|
const PDFPageSizes: Record<string, ElectronInternal.MediaSize> = {
|
||||||
Letter: {
|
Letter: {
|
||||||
@@ -403,7 +402,7 @@ WebContents.prototype.loadURL = function (url, options) {
|
|||||||
// the only one is with a bad scheme, perhaps ERR_INVALID_ARGUMENT
|
// the only one is with a bad scheme, perhaps ERR_INVALID_ARGUMENT
|
||||||
// would be more appropriate.
|
// would be more appropriate.
|
||||||
if (!error) {
|
if (!error) {
|
||||||
error = { errorCode: -2, errorDescription: 'ERR_FAILED', url: url };
|
error = { errorCode: -2, errorDescription: 'ERR_FAILED', url };
|
||||||
}
|
}
|
||||||
finishListener();
|
finishListener();
|
||||||
};
|
};
|
||||||
@@ -604,7 +603,7 @@ WebContents.prototype._init = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Dispatch IPC messages to the ipc module.
|
// Dispatch IPC messages to the ipc module.
|
||||||
this.on('-ipc-message' as any, function (this: Electron.WebContents, event: Electron.IpcMainEvent, internal: boolean, channel: string, args: any[]) {
|
this.on('-ipc-message', function (this: Electron.WebContents, event, internal, channel, args) {
|
||||||
addSenderToEvent(event, this);
|
addSenderToEvent(event, this);
|
||||||
if (internal) {
|
if (internal) {
|
||||||
ipcMainInternal.emit(channel, event, ...args);
|
ipcMainInternal.emit(channel, event, ...args);
|
||||||
@@ -618,7 +617,7 @@ WebContents.prototype._init = function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('-ipc-invoke' as any, async function (this: Electron.WebContents, event: Electron.IpcMainInvokeEvent, internal: boolean, channel: string, args: any[]) {
|
this.on('-ipc-invoke', async function (this: Electron.WebContents, event, internal, channel, args) {
|
||||||
addSenderToEvent(event, this);
|
addSenderToEvent(event, this);
|
||||||
const replyWithResult = (result: any) => event._replyChannel.sendReply({ result });
|
const replyWithResult = (result: any) => event._replyChannel.sendReply({ result });
|
||||||
const replyWithError = (error: Error) => {
|
const replyWithError = (error: Error) => {
|
||||||
@@ -640,7 +639,7 @@ WebContents.prototype._init = function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('-ipc-message-sync' as any, function (this: Electron.WebContents, event: Electron.IpcMainEvent, internal: boolean, channel: string, args: any[]) {
|
this.on('-ipc-message-sync', function (this: Electron.WebContents, event, internal, channel, args) {
|
||||||
addSenderToEvent(event, this);
|
addSenderToEvent(event, this);
|
||||||
addReturnValueToEvent(event);
|
addReturnValueToEvent(event);
|
||||||
if (internal) {
|
if (internal) {
|
||||||
@@ -658,7 +657,7 @@ WebContents.prototype._init = function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('-ipc-ports' as any, function (this: Electron.WebContents, event: Electron.IpcMainEvent, internal: boolean, channel: string, message: any, ports: any[]) {
|
this.on('-ipc-ports', function (this: Electron.WebContents, event: Electron.IpcMainEvent, internal: boolean, channel: string, message: any, ports: any[]) {
|
||||||
addSenderToEvent(event, this);
|
addSenderToEvent(event, this);
|
||||||
event.ports = ports.map(p => new MessagePortMain(p));
|
event.ports = ports.map(p => new MessagePortMain(p));
|
||||||
const maybeWebFrame = getWebFrameForEvent(event);
|
const maybeWebFrame = getWebFrameForEvent(event);
|
||||||
@@ -676,7 +675,7 @@ WebContents.prototype._init = function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('-before-unload-fired' as any, function (this: Electron.WebContents, event: Electron.Event, proceed: boolean) {
|
this.on('-before-unload-fired', function (this: Electron.WebContents, event, proceed) {
|
||||||
const type = this.getType();
|
const type = this.getType();
|
||||||
// These are the "interactive" types, i.e. ones a user might be looking at.
|
// These are the "interactive" types, i.e. ones a user might be looking at.
|
||||||
// All other types should ignore the "proceed" signal and unload
|
// All other types should ignore the "proceed" signal and unload
|
||||||
@@ -693,12 +692,13 @@ WebContents.prototype._init = function () {
|
|||||||
|
|
||||||
if (this.getType() !== 'remote') {
|
if (this.getType() !== 'remote') {
|
||||||
// Make new windows requested by links behave like "window.open".
|
// Make new windows requested by links behave like "window.open".
|
||||||
this.on('-new-window' as any, (event: Electron.Event, url: string, frameName: string, disposition: Electron.HandlerDetails['disposition'],
|
this.on('-new-window', (event, url, frameName, disposition, rawFeatures, referrer, postData) => {
|
||||||
rawFeatures: string, referrer: Electron.Referrer, postData: PostData) => {
|
const postBody = postData
|
||||||
const postBody = postData ? {
|
? {
|
||||||
data: postData,
|
data: postData,
|
||||||
...parseContentTypeFormat(postData)
|
...parseContentTypeFormat(postData)
|
||||||
} : undefined;
|
}
|
||||||
|
: undefined;
|
||||||
const details: Electron.HandlerDetails = {
|
const details: Electron.HandlerDetails = {
|
||||||
url,
|
url,
|
||||||
frameName,
|
frameName,
|
||||||
@@ -735,11 +735,13 @@ WebContents.prototype._init = function () {
|
|||||||
let windowOpenOutlivesOpenerOption: boolean = false;
|
let windowOpenOutlivesOpenerOption: boolean = false;
|
||||||
let createWindow: Electron.CreateWindowFunction | undefined;
|
let createWindow: Electron.CreateWindowFunction | undefined;
|
||||||
|
|
||||||
this.on('-will-add-new-contents' as any, (event: Electron.Event, url: string, frameName: string, rawFeatures: string, disposition: Electron.HandlerDetails['disposition'], referrer: Electron.Referrer, postData: PostData) => {
|
this.on('-will-add-new-contents', (event, url, frameName, rawFeatures, disposition, referrer, postData) => {
|
||||||
const postBody = postData ? {
|
const postBody = postData
|
||||||
|
? {
|
||||||
data: postData,
|
data: postData,
|
||||||
...parseContentTypeFormat(postData)
|
...parseContentTypeFormat(postData)
|
||||||
} : undefined;
|
}
|
||||||
|
: undefined;
|
||||||
const details: Electron.HandlerDetails = {
|
const details: Electron.HandlerDetails = {
|
||||||
url,
|
url,
|
||||||
frameName,
|
frameName,
|
||||||
@@ -761,14 +763,16 @@ WebContents.prototype._init = function () {
|
|||||||
windowOpenOverriddenOptions = result.browserWindowConstructorOptions;
|
windowOpenOverriddenOptions = result.browserWindowConstructorOptions;
|
||||||
createWindow = result.createWindow;
|
createWindow = result.createWindow;
|
||||||
if (!event.defaultPrevented) {
|
if (!event.defaultPrevented) {
|
||||||
const secureOverrideWebPreferences = windowOpenOverriddenOptions ? {
|
const secureOverrideWebPreferences = windowOpenOverriddenOptions
|
||||||
|
? {
|
||||||
// Allow setting of backgroundColor as a webPreference even though
|
// Allow setting of backgroundColor as a webPreference even though
|
||||||
// it's technically a BrowserWindowConstructorOptions option because
|
// it's technically a BrowserWindowConstructorOptions option because
|
||||||
// we need to access it in the renderer at init time.
|
// we need to access it in the renderer at init time.
|
||||||
backgroundColor: windowOpenOverriddenOptions.backgroundColor,
|
backgroundColor: windowOpenOverriddenOptions.backgroundColor,
|
||||||
transparent: windowOpenOverriddenOptions.transparent,
|
transparent: windowOpenOverriddenOptions.transparent,
|
||||||
...windowOpenOverriddenOptions.webPreferences
|
...windowOpenOverriddenOptions.webPreferences
|
||||||
} : undefined;
|
}
|
||||||
|
: undefined;
|
||||||
const { webPreferences: parsedWebPreferences } = parseFeatures(rawFeatures);
|
const { webPreferences: parsedWebPreferences } = parseFeatures(rawFeatures);
|
||||||
const webPreferences = makeWebPreferences({
|
const webPreferences = makeWebPreferences({
|
||||||
embedder: this,
|
embedder: this,
|
||||||
@@ -784,9 +788,7 @@ WebContents.prototype._init = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Create a new browser window for "window.open"
|
// Create a new browser window for "window.open"
|
||||||
this.on('-add-new-contents' as any, (event: Electron.Event, webContents: Electron.WebContents, disposition: string,
|
this.on('-add-new-contents', (event, webContents, disposition, _userGesture, _left, _top, _width, _height, url, frameName, referrer, rawFeatures, postData) => {
|
||||||
_userGesture: boolean, _left: number, _top: number, _width: number, _height: number, url: string, frameName: string,
|
|
||||||
referrer: Electron.Referrer, rawFeatures: string, postData: PostData) => {
|
|
||||||
const overriddenOptions = windowOpenOverriddenOptions || undefined;
|
const overriddenOptions = windowOpenOverriddenOptions || undefined;
|
||||||
const outlivesOpener = windowOpenOutlivesOpenerOption;
|
const outlivesOpener = windowOpenOutlivesOpenerOption;
|
||||||
const windowOpenFunction = createWindow;
|
const windowOpenFunction = createWindow;
|
||||||
@@ -824,7 +826,7 @@ WebContents.prototype._init = function () {
|
|||||||
app.emit('login', event, this, ...args);
|
app.emit('login', event, this, ...args);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('ready-to-show' as any, () => {
|
this.on('ready-to-show', () => {
|
||||||
const owner = this.getOwnerBrowserWindow();
|
const owner = this.getOwnerBrowserWindow();
|
||||||
if (owner && !owner.isDestroyed()) {
|
if (owner && !owner.isDestroyed()) {
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
@@ -843,7 +845,7 @@ WebContents.prototype._init = function () {
|
|||||||
|
|
||||||
const originCounts = new Map<string, number>();
|
const originCounts = new Map<string, number>();
|
||||||
const openDialogs = new Set<AbortController>();
|
const openDialogs = new Set<AbortController>();
|
||||||
this.on('-run-dialog' as any, async (info: {frame: WebFrameMain, dialogType: 'prompt' | 'confirm' | 'alert', messageText: string, defaultPromptText: string}, callback: (success: boolean, user_input: string) => void) => {
|
this.on('-run-dialog', async (info, callback) => {
|
||||||
const originUrl = new URL(info.frame.url);
|
const originUrl = new URL(info.frame.url);
|
||||||
const origin = originUrl.protocol === 'file:' ? originUrl.href : originUrl.origin;
|
const origin = originUrl.protocol === 'file:' ? originUrl.href : originUrl.origin;
|
||||||
if ((originCounts.get(origin) ?? 0) < 0) return callback(false, '');
|
if ((originCounts.get(origin) ?? 0) < 0) return callback(false, '');
|
||||||
@@ -864,11 +866,13 @@ WebContents.prototype._init = function () {
|
|||||||
message: info.messageText,
|
message: info.messageText,
|
||||||
checkboxLabel: checkbox,
|
checkboxLabel: checkbox,
|
||||||
signal: abortController.signal,
|
signal: abortController.signal,
|
||||||
...(info.dialogType === 'confirm') ? {
|
...(info.dialogType === 'confirm')
|
||||||
|
? {
|
||||||
buttons: ['OK', 'Cancel'],
|
buttons: ['OK', 'Cancel'],
|
||||||
defaultId: 0,
|
defaultId: 0,
|
||||||
cancelId: 1
|
cancelId: 1
|
||||||
} : {
|
}
|
||||||
|
: {
|
||||||
buttons: ['OK'],
|
buttons: ['OK'],
|
||||||
defaultId: -1, // No default button
|
defaultId: -1, // No default button
|
||||||
cancelId: 0
|
cancelId: 0
|
||||||
@@ -886,7 +890,7 @@ WebContents.prototype._init = function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('-cancel-dialogs' as any, () => {
|
this.on('-cancel-dialogs', () => {
|
||||||
for (const controller of openDialogs) { controller.abort(); }
|
for (const controller of openDialogs) { controller.abort(); }
|
||||||
openDialogs.clear();
|
openDialogs.clear();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
|
||||||
import { IpcMainImpl } from '@electron/internal/browser/ipc-main-impl';
|
import { IpcMainImpl } from '@electron/internal/browser/ipc-main-impl';
|
||||||
|
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
||||||
|
|
||||||
const { WebFrameMain, fromId } = process._linkedBinding('electron_browser_web_frame_main');
|
const { WebFrameMain, fromId } = process._linkedBinding('electron_browser_web_frame_main');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { app, Menu } from 'electron/main';
|
|
||||||
import { shell } from 'electron/common';
|
import { shell } from 'electron/common';
|
||||||
|
import { app, Menu } from 'electron/main';
|
||||||
|
|
||||||
const isMac = process.platform === 'darwin';
|
const isMac = process.platform === 'darwin';
|
||||||
|
|
||||||
@@ -14,7 +14,9 @@ export const setDefaultApplicationMenu = () => {
|
|||||||
|
|
||||||
const helpMenu: Electron.MenuItemConstructorOptions = {
|
const helpMenu: Electron.MenuItemConstructorOptions = {
|
||||||
role: 'help',
|
role: 'help',
|
||||||
submenu: app.isPackaged ? [] : [
|
submenu: app.isPackaged
|
||||||
|
? []
|
||||||
|
: [
|
||||||
{
|
{
|
||||||
label: 'Learn More',
|
label: 'Learn More',
|
||||||
click: async () => {
|
click: async () => {
|
||||||
|
|||||||
@@ -1,25 +1,32 @@
|
|||||||
import { dialog, Menu } from 'electron/main';
|
import { IPC_MESSAGES } from '@electron/internal//common/ipc-messages';
|
||||||
import * as fs from 'fs';
|
|
||||||
|
|
||||||
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
|
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
|
||||||
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
|
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
|
||||||
import { IPC_MESSAGES } from '@electron/internal//common/ipc-messages';
|
|
||||||
|
import { dialog, Menu } from 'electron/main';
|
||||||
|
|
||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
const convertToMenuTemplate = function (items: ContextMenuItem[], handler: (id: number) => void) {
|
const convertToMenuTemplate = function (items: ContextMenuItem[], handler: (id: number) => void) {
|
||||||
return items.map(function (item) {
|
return items.map(function (item) {
|
||||||
const transformed: Electron.MenuItemConstructorOptions = item.type === 'subMenu' ? {
|
const transformed: Electron.MenuItemConstructorOptions = item.type === 'subMenu'
|
||||||
|
? {
|
||||||
type: 'submenu',
|
type: 'submenu',
|
||||||
label: item.label,
|
label: item.label,
|
||||||
enabled: item.enabled,
|
enabled: item.enabled,
|
||||||
submenu: convertToMenuTemplate(item.subItems, handler)
|
submenu: convertToMenuTemplate(item.subItems, handler)
|
||||||
} : item.type === 'separator' ? {
|
}
|
||||||
|
: item.type === 'separator'
|
||||||
|
? {
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
} : item.type === 'checkbox' ? {
|
}
|
||||||
|
: item.type === 'checkbox'
|
||||||
|
? {
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
label: item.label,
|
label: item.label,
|
||||||
enabled: item.enabled,
|
enabled: item.enabled,
|
||||||
checked: item.checked
|
checked: item.checked
|
||||||
} : {
|
}
|
||||||
|
: {
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
label: item.label,
|
label: item.label,
|
||||||
enabled: item.enabled
|
enabled: item.enabled
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { webContents } from 'electron/main';
|
|
||||||
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
|
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
|
||||||
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
|
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
|
||||||
import { parseWebViewWebPreferences } from '@electron/internal/browser/parse-features-string';
|
import { parseWebViewWebPreferences } from '@electron/internal/browser/parse-features-string';
|
||||||
import { syncMethods, asyncMethods, properties, navigationHistorySyncMethods } from '@electron/internal/common/web-view-methods';
|
|
||||||
import { webViewEvents } from '@electron/internal/browser/web-view-events';
|
import { webViewEvents } from '@electron/internal/browser/web-view-events';
|
||||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||||
|
import { syncMethods, asyncMethods, properties, navigationHistorySyncMethods } from '@electron/internal/common/web-view-methods';
|
||||||
|
|
||||||
|
import { webContents } from 'electron/main';
|
||||||
|
|
||||||
interface GuestInstance {
|
interface GuestInstance {
|
||||||
elementInstanceId: number;
|
elementInstanceId: number;
|
||||||
@@ -237,7 +238,7 @@ const watchEmbedder = function (embedder: Electron.WebContents) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
embedder.on('-window-visibility-change' as any, onVisibilityChange);
|
embedder.on('-window-visibility-change', onVisibilityChange);
|
||||||
|
|
||||||
embedder.once('will-destroy' as any, () => {
|
embedder.once('will-destroy' as any, () => {
|
||||||
// Usually the guestInstances is cleared when guest is destroyed, but it
|
// Usually the guestInstances is cleared when guest is destroyed, but it
|
||||||
@@ -249,7 +250,7 @@ const watchEmbedder = function (embedder: Electron.WebContents) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Clear the listeners.
|
// Clear the listeners.
|
||||||
embedder.removeListener('-window-visibility-change' as any, onVisibilityChange);
|
embedder.removeListener('-window-visibility-change', onVisibilityChange);
|
||||||
watchedEmbedders.delete(embedder);
|
watchedEmbedders.delete(embedder);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
* out-of-process (cross-origin) are created here. "Embedder" roughly means
|
* out-of-process (cross-origin) are created here. "Embedder" roughly means
|
||||||
* "parent."
|
* "parent."
|
||||||
*/
|
*/
|
||||||
|
import { parseFeatures } from '@electron/internal/browser/parse-features-string';
|
||||||
|
|
||||||
import { BrowserWindow } from 'electron/main';
|
import { BrowserWindow } from 'electron/main';
|
||||||
import type { BrowserWindowConstructorOptions, Referrer, WebContents, LoadURLOptions } from 'electron/main';
|
import type { BrowserWindowConstructorOptions, Referrer, WebContents, LoadURLOptions } from 'electron/main';
|
||||||
import { parseFeatures } from '@electron/internal/browser/parse-features-string';
|
|
||||||
|
|
||||||
type PostData = LoadURLOptions['postData']
|
type PostData = LoadURLOptions['postData']
|
||||||
export type WindowOpenArgs = {
|
export type WindowOpenArgs = {
|
||||||
@@ -71,14 +72,6 @@ export function openGuestWindow ({ embedder, guest, referrer, disposition, postD
|
|||||||
throw new Error('Invalid webContents. Created window should be connected to webContents passed with options object.');
|
throw new Error('Invalid webContents. Created window should be connected to webContents passed with options object.');
|
||||||
}
|
}
|
||||||
|
|
||||||
webContents.loadURL(url, {
|
|
||||||
httpReferrer: referrer,
|
|
||||||
...(postData && {
|
|
||||||
postData,
|
|
||||||
extraHeaders: formatPostDataHeaders(postData as Electron.UploadRawData[])
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
handleWindowLifecycleEvents({ embedder, frameName, guest, outlivesOpener });
|
handleWindowLifecycleEvents({ embedder, frameName, guest, outlivesOpener });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import type * as defaultMenuModule from '@electron/internal/browser/default-menu';
|
||||||
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import type * as defaultMenuModule from '@electron/internal/browser/default-menu';
|
|
||||||
import type * as url from 'url';
|
import type * as url from 'url';
|
||||||
import type * as v8 from 'v8';
|
import type * as v8 from 'v8';
|
||||||
|
|
||||||
@@ -212,7 +213,7 @@ if (packagePath) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Call appCodeLoaded before just for safety, it doesn't matter here as _load is syncronous
|
// Call appCodeLoaded before just for safety, it doesn't matter here as _load is synchronous
|
||||||
appCodeLoaded!();
|
appCodeLoaded!();
|
||||||
process._firstFileName = Module._resolveFilename(path.join(packagePath, mainStartupScript), null, false);
|
process._firstFileName = Module._resolveFilename(path.join(packagePath, mainStartupScript), null, false);
|
||||||
Module._load(path.join(packagePath, mainStartupScript), Module, true);
|
Module._load(path.join(packagePath, mainStartupScript), Module, true);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { EventEmitter } from 'events';
|
|
||||||
import { IpcMainInvokeEvent } from 'electron/main';
|
import { IpcMainInvokeEvent } from 'electron/main';
|
||||||
|
|
||||||
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
export class IpcMainImpl extends EventEmitter implements Electron.IpcMain {
|
export class IpcMainImpl extends EventEmitter implements Electron.IpcMain {
|
||||||
private _invokeHandlers: Map<string, (e: IpcMainInvokeEvent, ...args: any[]) => void> = new Map();
|
private _invokeHandlers: Map<string, (e: IpcMainInvokeEvent, ...args: any[]) => void> = new Map();
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { clipboard } from 'electron/common';
|
|
||||||
import * as fs from 'fs';
|
|
||||||
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
|
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
|
||||||
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
|
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
|
||||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||||
|
|
||||||
|
import { clipboard } from 'electron/common';
|
||||||
|
|
||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
// Implements window.close()
|
// Implements window.close()
|
||||||
ipcMainInternal.on(IPC_MESSAGES.BROWSER_WINDOW_CLOSE, function (event) {
|
ipcMainInternal.on(IPC_MESSAGES.BROWSER_WINDOW_CLOSE, function (event) {
|
||||||
const window = event.sender.getOwnerBrowserWindow();
|
const window = event.sender.getOwnerBrowserWindow();
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import * as url from 'url';
|
|
||||||
import { Readable, Writable } from 'stream';
|
|
||||||
import type {
|
import type {
|
||||||
ClientRequestConstructorOptions,
|
ClientRequestConstructorOptions,
|
||||||
UploadProgress
|
UploadProgress
|
||||||
} from 'electron/common';
|
} from 'electron/common';
|
||||||
|
|
||||||
|
import { Readable, Writable } from 'stream';
|
||||||
|
import * as url from 'url';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isValidHeaderName,
|
isValidHeaderName,
|
||||||
isValidHeaderValue,
|
isValidHeaderValue,
|
||||||
@@ -226,7 +227,7 @@ function validateHeader (name: any, value: any): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parseOptions (optionsIn: ClientRequestConstructorOptions | string): NodeJS.CreateURLLoaderOptions & ExtraURLLoaderOptions {
|
function parseOptions (optionsIn: ClientRequestConstructorOptions | string): NodeJS.CreateURLLoaderOptions & ExtraURLLoaderOptions {
|
||||||
// eslint-disable-next-line node/no-deprecated-api
|
// eslint-disable-next-line n/no-deprecated-api
|
||||||
const options: any = typeof optionsIn === 'string' ? url.parse(optionsIn) : { ...optionsIn };
|
const options: any = typeof optionsIn === 'string' ? url.parse(optionsIn) : { ...optionsIn };
|
||||||
|
|
||||||
let urlStr: string = options.url;
|
let urlStr: string = options.url;
|
||||||
@@ -259,7 +260,7 @@ function parseOptions (optionsIn: ClientRequestConstructorOptions | string): Nod
|
|||||||
// an invalid request.
|
// an invalid request.
|
||||||
throw new TypeError('Request path contains unescaped characters');
|
throw new TypeError('Request path contains unescaped characters');
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line node/no-deprecated-api
|
// eslint-disable-next-line n/no-deprecated-api
|
||||||
const pathObj = url.parse(options.path || '/');
|
const pathObj = url.parse(options.path || '/');
|
||||||
urlObj.pathname = pathObj.pathname;
|
urlObj.pathname = pathObj.pathname;
|
||||||
urlObj.search = pathObj.search;
|
urlObj.search = pathObj.search;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as util from 'util';
|
|
||||||
import type * as stream from 'stream';
|
|
||||||
|
|
||||||
import timers = require('timers');
|
import timers = require('timers');
|
||||||
|
import * as util from 'util';
|
||||||
|
|
||||||
|
import type * as stream from 'stream';
|
||||||
|
|
||||||
type AnyFn = (...args: any[]) => any
|
type AnyFn = (...args: any[]) => any
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
/* eslint-disable import/newline-after-import */
|
||||||
|
/* eslint-disable import/order */
|
||||||
// Initialize ASAR support in fs module.
|
// Initialize ASAR support in fs module.
|
||||||
import { wrapFsWithAsar } from './asar-fs-wrapper';
|
import { wrapFsWithAsar } from './asar-fs-wrapper';
|
||||||
wrapFsWithAsar(require('fs'));
|
wrapFsWithAsar(require('fs'));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { defineProperties } from '@electron/internal/common/define-properties';
|
|
||||||
import { commonModuleList } from '@electron/internal/common/api/module-list';
|
import { commonModuleList } from '@electron/internal/common/api/module-list';
|
||||||
|
import { defineProperties } from '@electron/internal/common/define-properties';
|
||||||
import { rendererModuleList } from '@electron/internal/renderer/api/module-list';
|
import { rendererModuleList } from '@electron/internal/renderer/api/module-list';
|
||||||
|
|
||||||
module.exports = {};
|
module.exports = {};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { ipcRenderer } from 'electron/renderer';
|
|
||||||
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
||||||
|
import type * as securityWarningsModule from '@electron/internal/renderer/security-warnings';
|
||||||
|
import type * as webFrameInitModule from '@electron/internal/renderer/web-frame-init';
|
||||||
import type * as webViewInitModule from '@electron/internal/renderer/web-view/web-view-init';
|
import type * as webViewInitModule from '@electron/internal/renderer/web-view/web-view-init';
|
||||||
import type * as windowSetupModule from '@electron/internal/renderer/window-setup';
|
import type * as windowSetupModule from '@electron/internal/renderer/window-setup';
|
||||||
import type * as webFrameInitModule from '@electron/internal/renderer/web-frame-init';
|
|
||||||
import type * as securityWarningsModule from '@electron/internal/renderer/security-warnings';
|
import { ipcRenderer } from 'electron/renderer';
|
||||||
|
|
||||||
const { mainFrame } = process._linkedBinding('electron_renderer_web_frame');
|
const { mainFrame } = process._linkedBinding('electron_renderer_web_frame');
|
||||||
const v8Util = process._linkedBinding('electron_common_v8_util');
|
const v8Util = process._linkedBinding('electron_common_v8_util');
|
||||||
@@ -49,6 +49,7 @@ if (process.isMainFrame) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { webFrameInit } = require('@electron/internal/renderer/web-frame-init') as typeof webFrameInitModule;
|
const { webFrameInit } = require('@electron/internal/renderer/web-frame-init') as typeof webFrameInitModule;
|
||||||
|
|
||||||
webFrameInit();
|
webFrameInit();
|
||||||
|
|
||||||
// Warn about security issues
|
// Warn about security issues
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import * as path from 'path';
|
|
||||||
import { pathToFileURL } from 'url';
|
|
||||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||||
|
|
||||||
import type * as ipcRendererInternalModule from '@electron/internal/renderer/ipc-renderer-internal';
|
import type * as ipcRendererInternalModule from '@electron/internal/renderer/ipc-renderer-internal';
|
||||||
import type * as ipcRendererUtilsModule from '@electron/internal/renderer/ipc-renderer-internal-utils';
|
import type * as ipcRendererUtilsModule from '@electron/internal/renderer/ipc-renderer-internal-utils';
|
||||||
|
|
||||||
|
import * as path from 'path';
|
||||||
|
import { pathToFileURL } from 'url';
|
||||||
|
|
||||||
const Module = require('module') as NodeJS.ModuleInternal;
|
const Module = require('module') as NodeJS.ModuleInternal;
|
||||||
|
|
||||||
// We do not want to allow use of the VM module in the renderer process as
|
// We do not want to allow use of the VM module in the renderer process as
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||||
import { internalContextBridge } from '@electron/internal/renderer/api/context-bridge';
|
import { internalContextBridge } from '@electron/internal/renderer/api/context-bridge';
|
||||||
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
||||||
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
|
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
|
||||||
|
|
||||||
import { webFrame } from 'electron/renderer';
|
import { webFrame } from 'electron/renderer';
|
||||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
|
||||||
|
|
||||||
const { contextIsolationEnabled } = internalContextBridge;
|
const { contextIsolationEnabled } = internalContextBridge;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
|
||||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||||
|
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
||||||
|
|
||||||
const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame');
|
const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame');
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { webFrame, WebFrame } from 'electron/renderer';
|
|
||||||
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
|
|
||||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||||
|
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
|
||||||
|
|
||||||
|
import { webFrame, WebFrame } from 'electron/renderer';
|
||||||
|
|
||||||
// All keys of WebFrame that extend Function
|
// All keys of WebFrame that extend Function
|
||||||
type WebFrameMethod = {
|
type WebFrameMethod = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||||
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
||||||
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
|
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
|
||||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
|
||||||
|
|
||||||
const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame');
|
const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { WebViewImpl } from '@electron/internal/renderer/web-view/web-view-impl';
|
|
||||||
import { WEB_VIEW_ATTRIBUTES, WEB_VIEW_ERROR_MESSAGES } from '@electron/internal/renderer/web-view/web-view-constants';
|
import { WEB_VIEW_ATTRIBUTES, WEB_VIEW_ERROR_MESSAGES } from '@electron/internal/renderer/web-view/web-view-constants';
|
||||||
|
import type { WebViewImpl } from '@electron/internal/renderer/web-view/web-view-impl';
|
||||||
|
|
||||||
const resolveURL = function (url?: string | null) {
|
const resolveURL = function (url?: string | null) {
|
||||||
return url ? new URL(url, location.href).href : '';
|
return url ? new URL(url, location.href).href : '';
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
// which runs in browserify environment instead of Node environment, all native
|
// which runs in browserify environment instead of Node environment, all native
|
||||||
// modules must be passed from outside, all included files must be plain JS.
|
// modules must be passed from outside, all included files must be plain JS.
|
||||||
|
|
||||||
|
import type { SrcAttribute } from '@electron/internal/renderer/web-view/web-view-attributes';
|
||||||
import { WEB_VIEW_ATTRIBUTES, WEB_VIEW_ERROR_MESSAGES } from '@electron/internal/renderer/web-view/web-view-constants';
|
import { WEB_VIEW_ATTRIBUTES, WEB_VIEW_ERROR_MESSAGES } from '@electron/internal/renderer/web-view/web-view-constants';
|
||||||
import { WebViewImpl, WebViewImplHooks, setupMethods } from '@electron/internal/renderer/web-view/web-view-impl';
|
import { WebViewImpl, WebViewImplHooks, setupMethods } from '@electron/internal/renderer/web-view/web-view-impl';
|
||||||
import type { SrcAttribute } from '@electron/internal/renderer/web-view/web-view-attributes';
|
|
||||||
|
|
||||||
const internals = new WeakMap<HTMLElement, WebViewImpl>();
|
const internals = new WeakMap<HTMLElement, WebViewImpl>();
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user