mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Compare commits
76 Commits
print-win
...
replace-we
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
225fc5aa08 | ||
|
|
43d61d4cd0 | ||
|
|
646dfd24f7 | ||
|
|
f89c8efc9d | ||
|
|
ec30e4cdae | ||
|
|
40033db422 | ||
|
|
c3d441cf7d | ||
|
|
14583d22e6 | ||
|
|
68bfe49120 | ||
|
|
2c6332a7d6 | ||
|
|
ddc1bd9553 | ||
|
|
12109371d3 | ||
|
|
69891d04bf | ||
|
|
188813e206 | ||
|
|
8b768b8211 | ||
|
|
82b97ddf5b | ||
|
|
16f408a502 | ||
|
|
246aa63910 | ||
|
|
230f02faf2 | ||
|
|
1362d7b94d | ||
|
|
877fe479b5 | ||
|
|
f41438ff73 | ||
|
|
c6e201c965 | ||
|
|
156a4e610c | ||
|
|
81f8fc1880 | ||
|
|
343d6e5f3f | ||
|
|
e7080835f1 | ||
|
|
7c1a6f7e95 | ||
|
|
22ac2b13fb | ||
|
|
a8acb96608 | ||
|
|
97773bf50c | ||
|
|
1e0846749b | ||
|
|
8cd766ff53 | ||
|
|
e5b20a11d2 | ||
|
|
e0bd4ffc39 | ||
|
|
bbbcae1a12 | ||
|
|
3e1666be08 | ||
|
|
a06b49aca1 | ||
|
|
d318893aa0 | ||
|
|
f133e2f775 | ||
|
|
b44b9ba316 | ||
|
|
d5e4429724 | ||
|
|
8f11366f50 | ||
|
|
0dabcfdec4 | ||
|
|
b4460a05da | ||
|
|
0a1ea1f028 | ||
|
|
b41ec6586a | ||
|
|
4eff8f20f2 | ||
|
|
8cb61e8b9b | ||
|
|
b9731b89dc | ||
|
|
d64e1146dd | ||
|
|
ae6b219545 | ||
|
|
c44d60cfe4 | ||
|
|
9928c7d828 | ||
|
|
f5bc6f7949 | ||
|
|
a839fb94aa | ||
|
|
2e2c56adde | ||
|
|
678adeaf7c | ||
|
|
1d14694dec | ||
|
|
a48f03fb8d | ||
|
|
f6b43cb0ef | ||
|
|
7451d560ba | ||
|
|
27edd6e21c | ||
|
|
ec3a18d438 | ||
|
|
02d4101ca3 | ||
|
|
fdaba4c6b0 | ||
|
|
542ff828ab | ||
|
|
4371a4dceb | ||
|
|
60f4b07723 | ||
|
|
f282bec8ef | ||
|
|
cef388de3d | ||
|
|
1828690467 | ||
|
|
f4c4cd14ac | ||
|
|
3db3996102 | ||
|
|
dbcf0fb5f0 | ||
|
|
29750dda08 |
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@@ -19,6 +19,7 @@ DEPS @electron/wg-upgrades
|
||||
/lib/renderer/security-warnings.ts @electron/wg-security
|
||||
|
||||
# Infra WG
|
||||
/.claude/ @electron/wg-infra
|
||||
/.github/actions/ @electron/wg-infra
|
||||
/.github/workflows/*-publish.yml @electron/wg-infra
|
||||
/.github/workflows/build.yml @electron/wg-infra
|
||||
|
||||
48
.github/actions/build-electron/action.yml
vendored
48
.github/actions/build-electron/action.yml
vendored
@@ -47,6 +47,16 @@ runs:
|
||||
- name: Add Clang problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json"
|
||||
- name: Download previous object checksums
|
||||
shell: bash
|
||||
if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request') && inputs.is-asan != 'true' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
ARTIFACT_NAME: object-checksums.${{ inputs.artifact-platform }}_${{ inputs.target-arch }}.json
|
||||
SEARCH_BRANCH: ${{ case(github.event_name == 'push', github.ref_name, github.event.pull_request.base.ref) }}
|
||||
REPO: ${{ github.repository }}
|
||||
OUTPUT_PATH: src/previous-object-checksums.json
|
||||
run: node src/electron/.github/actions/build-electron/download-previous-object-checksums.mjs
|
||||
- name: Build Electron ${{ inputs.step-suffix }}
|
||||
if: ${{ inputs.target-platform != 'win' }}
|
||||
shell: bash
|
||||
@@ -72,12 +82,17 @@ runs:
|
||||
cp out/Default/.ninja_log out/electron_ninja_log
|
||||
node electron/script/check-symlinks.js
|
||||
|
||||
# Upload build stats to Datadog
|
||||
if ! [ -z $DD_API_KEY ]; then
|
||||
npx node electron/script/build-stats.mjs out/Default/siso.INFO --upload-stats || true
|
||||
# Build stats and object checksums
|
||||
BUILD_STATS_ARGS="out/Default/siso.INFO --out-dir out/Default --output-object-checksums object-checksums.${{ inputs.artifact-platform }}_${{ inputs.target-arch }}.json"
|
||||
if [ -f previous-object-checksums.json ]; then
|
||||
BUILD_STATS_ARGS="$BUILD_STATS_ARGS --input-object-checksums previous-object-checksums.json"
|
||||
fi
|
||||
if ! [ -z "$DD_API_KEY" ]; then
|
||||
BUILD_STATS_ARGS="$BUILD_STATS_ARGS --upload-stats"
|
||||
else
|
||||
echo "Skipping build-stats.mjs upload because DD_API_KEY is not set"
|
||||
fi
|
||||
node electron/script/build-stats.mjs $BUILD_STATS_ARGS || true
|
||||
- name: Build Electron (Windows) ${{ inputs.step-suffix }}
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
shell: powershell
|
||||
@@ -95,16 +110,21 @@ runs:
|
||||
Copy-Item out\Default\.ninja_log out\electron_ninja_log
|
||||
node electron\script\check-symlinks.js
|
||||
|
||||
# Upload build stats to Datadog
|
||||
# Build stats and object checksums
|
||||
$statsArgs = @("out\Default\siso.exe.INFO", "--out-dir", "out\Default", "--output-object-checksums", "object-checksums.${{ inputs.artifact-platform }}_${{ inputs.target-arch }}.json")
|
||||
if (Test-Path previous-object-checksums.json) {
|
||||
$statsArgs += @("--input-object-checksums", "previous-object-checksums.json")
|
||||
}
|
||||
if ($env:DD_API_KEY) {
|
||||
try {
|
||||
npx node electron\script\build-stats.mjs out\Default\siso.exe.INFO --upload-stats ; $LASTEXITCODE = 0
|
||||
} catch {
|
||||
Write-Host "Build stats upload failed, continuing..."
|
||||
}
|
||||
$statsArgs += "--upload-stats"
|
||||
} else {
|
||||
Write-Host "Skipping build-stats.mjs upload because DD_API_KEY is not set"
|
||||
}
|
||||
try {
|
||||
& node electron\script\build-stats.mjs @statsArgs ; $LASTEXITCODE = 0
|
||||
} catch {
|
||||
Write-Host "Build stats failed, continuing..."
|
||||
}
|
||||
- name: Verify dist.zip ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -128,6 +148,9 @@ runs:
|
||||
fi
|
||||
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
|
||||
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
|
||||
sed $SEDOPTION '/--reorder-builtins/d' out/Default/mksnapshot_args
|
||||
sed $SEDOPTION '/--warn-about-builtin-profile-data/d' out/Default/mksnapshot_args
|
||||
sed $SEDOPTION '/--abort-on-bad-builtin-profile-data/d' out/Default/mksnapshot_args
|
||||
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
cd out/Default
|
||||
@@ -289,3 +312,10 @@ runs:
|
||||
with:
|
||||
name: out_gen_artifacts_${{ env.ARTIFACT_KEY }}
|
||||
path: ./src/out/Default/gen
|
||||
- name: Upload Object Checksums ${{ inputs.step-suffix }}
|
||||
if: ${{ always() && !cancelled() && inputs.is-asan != 'true' }}
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
with:
|
||||
name: object_checksums_${{ inputs.artifact-platform }}_${{ inputs.target-arch }}
|
||||
path: ./src/object-checksums.${{ inputs.artifact-platform }}_${{ inputs.target-arch }}.json
|
||||
archive: false
|
||||
|
||||
82
.github/actions/build-electron/download-previous-object-checksums.mjs
vendored
Normal file
82
.github/actions/build-electron/download-previous-object-checksums.mjs
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
import { Octokit } from '@octokit/rest';
|
||||
|
||||
import { writeFileSync } from 'node:fs';
|
||||
|
||||
const token = process.env.GITHUB_TOKEN;
|
||||
const repo = process.env.REPO;
|
||||
const artifactName = process.env.ARTIFACT_NAME;
|
||||
const branch = process.env.SEARCH_BRANCH;
|
||||
const outputPath = process.env.OUTPUT_PATH;
|
||||
|
||||
const required = { GITHUB_TOKEN: token, REPO: repo, ARTIFACT_NAME: artifactName, SEARCH_BRANCH: branch, OUTPUT_PATH: outputPath };
|
||||
const missing = Object.entries(required).filter(([, v]) => !v).map(([k]) => k);
|
||||
if (missing.length > 0) {
|
||||
console.error(`Missing required environment variables: ${missing.join(', ')}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const [owner, repoName] = repo.split('/');
|
||||
const octokit = new Octokit({ auth: token });
|
||||
|
||||
async function main () {
|
||||
console.log(`Searching for artifact '${artifactName}' on branch '${branch}'...`);
|
||||
|
||||
// Resolve the "Build" workflow name to an ID, mirroring how `gh run list --workflow` works
|
||||
// under the hood (it uses /repos/{owner}/{repo}/actions/workflows/{id}/runs).
|
||||
const { data: workflows } = await octokit.actions.listRepoWorkflows({ owner, repo: repoName });
|
||||
const buildWorkflow = workflows.workflows.find((w) => w.name === 'Build');
|
||||
if (!buildWorkflow) {
|
||||
console.log('Could not find "Build" workflow, continuing without previous checksums');
|
||||
return;
|
||||
}
|
||||
|
||||
const { data: runs } = await octokit.actions.listWorkflowRuns({
|
||||
owner,
|
||||
repo: repoName,
|
||||
workflow_id: buildWorkflow.id,
|
||||
branch,
|
||||
status: 'completed',
|
||||
event: 'push',
|
||||
per_page: 20,
|
||||
exclude_pull_requests: true
|
||||
});
|
||||
|
||||
for (const run of runs.workflow_runs) {
|
||||
const { data: artifacts } = await octokit.actions.listWorkflowRunArtifacts({
|
||||
owner,
|
||||
repo: repoName,
|
||||
run_id: run.id,
|
||||
name: artifactName
|
||||
});
|
||||
|
||||
if (artifacts.artifacts.length > 0) {
|
||||
const artifact = artifacts.artifacts[0];
|
||||
console.log(`Found artifact in run ${run.id} (artifact ID: ${artifact.id}), downloading...`);
|
||||
|
||||
// Non-archived artifacts are still downloaded from the /zip endpoint
|
||||
const response = await octokit.actions.downloadArtifact({
|
||||
owner,
|
||||
repo: repoName,
|
||||
artifact_id: artifact.id,
|
||||
archive_format: 'zip'
|
||||
});
|
||||
|
||||
if (response.headers['content-type'] !== 'application/json') {
|
||||
console.error(`Unexpected content type for artifact download: ${response.headers['content-type']}`);
|
||||
console.error('Expected application/json, continuing without previous checksums');
|
||||
return;
|
||||
}
|
||||
|
||||
writeFileSync(outputPath, JSON.stringify(response.data));
|
||||
console.log('Downloaded previous object checksums successfully');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`No previous object checksums found in last ${runs.workflow_runs.length} runs, continuing without them`);
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error('Failed to download previous object checksums, continuing without them:', err.message);
|
||||
process.exit(0);
|
||||
});
|
||||
38
.github/actions/cipd-install/action.yml
vendored
38
.github/actions/cipd-install/action.yml
vendored
@@ -22,30 +22,50 @@ runs:
|
||||
steps:
|
||||
- name: Delete wrong ${{ inputs.dependency }}
|
||||
shell: bash
|
||||
env:
|
||||
CIPD_ROOT_PREFIX: ${{ inputs.cipd-root-prefix-path }}
|
||||
INSTALLATION_DIR: ${{ inputs.installation-dir }}
|
||||
run : |
|
||||
rm -rf ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }}
|
||||
rm -rf "${CIPD_ROOT_PREFIX}${INSTALLATION_DIR}"
|
||||
- name: Create ensure file for ${{ inputs.dependency }}
|
||||
if: ${{ inputs.dependency-version == '' }}
|
||||
shell: bash
|
||||
env:
|
||||
PACKAGE: ${{ inputs.package }}
|
||||
DEPS_FILE: ${{ inputs.deps-file }}
|
||||
INSTALLATION_DIR: ${{ inputs.installation-dir }}
|
||||
DEPENDENCY: ${{ inputs.dependency }}
|
||||
run: |
|
||||
echo '${{ inputs.package }}' `e d gclient getdep --deps-file=${{ inputs.deps-file }} -r '${{ inputs.installation-dir }}:${{ inputs.package }}'` > ${{ inputs.dependency }}_ensure_file
|
||||
cat ${{ inputs.dependency }}_ensure_file
|
||||
echo "$PACKAGE" $(e d gclient getdep --deps-file="$DEPS_FILE" -r "${INSTALLATION_DIR}:${PACKAGE}") > "${DEPENDENCY}_ensure_file"
|
||||
cat "${DEPENDENCY}_ensure_file"
|
||||
|
||||
- name: Create ensure file for ${{ inputs.dependency }} from dependency-version
|
||||
if: ${{ inputs.dependency-version != '' }}
|
||||
shell: bash
|
||||
env:
|
||||
PACKAGE: ${{ inputs.package }}
|
||||
DEPENDENCY_VERSION: ${{ inputs.dependency-version }}
|
||||
DEPENDENCY: ${{ inputs.dependency }}
|
||||
run: |
|
||||
echo '${{ inputs.package }} ${{ inputs.dependency-version }}' > ${{ inputs.dependency }}_ensure_file
|
||||
cat ${{ inputs.dependency }}_ensure_file
|
||||
echo "$PACKAGE $DEPENDENCY_VERSION" > "${DEPENDENCY}_ensure_file"
|
||||
cat "${DEPENDENCY}_ensure_file"
|
||||
- name: CIPD installation of ${{ inputs.dependency }} (macOS)
|
||||
if: ${{ inputs.target-platform != 'win' }}
|
||||
shell: bash
|
||||
env:
|
||||
CIPD_ROOT_PREFIX: ${{ inputs.cipd-root-prefix-path }}
|
||||
INSTALLATION_DIR: ${{ inputs.installation-dir }}
|
||||
DEPENDENCY: ${{ inputs.dependency }}
|
||||
run: |
|
||||
echo "ensuring ${{ inputs.dependency }}"
|
||||
e d cipd ensure --root ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }} -ensure-file ${{ inputs.dependency }}_ensure_file
|
||||
echo "ensuring $DEPENDENCY"
|
||||
e d cipd ensure --root "${CIPD_ROOT_PREFIX}${INSTALLATION_DIR}" -ensure-file "${DEPENDENCY}_ensure_file"
|
||||
- name: CIPD installation of ${{ inputs.dependency }} (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
shell: powershell
|
||||
env:
|
||||
CIPD_ROOT_PREFIX: ${{ inputs.cipd-root-prefix-path }}
|
||||
INSTALLATION_DIR: ${{ inputs.installation-dir }}
|
||||
DEPENDENCY: ${{ inputs.dependency }}
|
||||
run: |
|
||||
echo "ensuring ${{ inputs.dependency }} on Windows"
|
||||
e d cipd ensure --root ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }} -ensure-file ${{ inputs.dependency }}_ensure_file
|
||||
echo "ensuring $env:DEPENDENCY on Windows"
|
||||
e d cipd ensure --root "$env:CIPD_ROOT_PREFIX$env:INSTALLATION_DIR" -ensure-file "$($env:DEPENDENCY)_ensure_file"
|
||||
|
||||
@@ -24,7 +24,7 @@ runs:
|
||||
# The cache will always exist here as a result of the checkout job
|
||||
# Either it was uploaded to Azure in the checkout job for this commit
|
||||
# or it was uploaded in the checkout job for a previous commit.
|
||||
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
|
||||
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
|
||||
with:
|
||||
timeout_minutes: 30
|
||||
max_attempts: 3
|
||||
@@ -101,7 +101,7 @@ runs:
|
||||
|
||||
- name: Move Src Cache (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
|
||||
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
|
||||
with:
|
||||
timeout_minutes: 30
|
||||
max_attempts: 3
|
||||
|
||||
@@ -7,7 +7,7 @@ runs:
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ -z "${{ env.CHROMIUM_GIT_COOKIE }}" ]]; then
|
||||
if [[ -z "$CHROMIUM_GIT_COOKIE" ]]; then
|
||||
echo "CHROMIUM_GIT_COOKIE is not set - cannot authenticate."
|
||||
exit 0
|
||||
fi
|
||||
@@ -18,9 +18,7 @@ runs:
|
||||
|
||||
git config --global http.cookiefile ~/.gitcookies
|
||||
|
||||
tr , \\t <<\__END__ >>~/.gitcookies
|
||||
${{ env.CHROMIUM_GIT_COOKIE }}
|
||||
__END__
|
||||
echo "$CHROMIUM_GIT_COOKIE" | tr , \\t >>~/.gitcookies
|
||||
eval 'set -o history' 2>/dev/null || unsetopt HIST_IGNORE_SPACE 2>/dev/null
|
||||
|
||||
RESPONSE=$(curl -s -b ~/.gitcookies https://chromium-review.googlesource.com/a/accounts/self)
|
||||
@@ -42,7 +40,7 @@ runs:
|
||||
)
|
||||
|
||||
git config --global http.cookiefile "%USERPROFILE%\.gitcookies"
|
||||
powershell -noprofile -nologo -command Write-Output "${{ env.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}" >>"%USERPROFILE%\.gitcookies"
|
||||
powershell -noprofile -nologo -command Write-Output $env:CHROMIUM_GIT_COOKIE_WINDOWS_STRING >>"%USERPROFILE%\.gitcookies"
|
||||
|
||||
curl -s -b "%USERPROFILE%\.gitcookies" https://chromium-review.googlesource.com/a/accounts/self > response.txt
|
||||
|
||||
|
||||
20
.github/workflows/archaeologist-dig.yml
vendored
20
.github/workflows/archaeologist-dig.yml
vendored
@@ -21,17 +21,21 @@ jobs:
|
||||
with:
|
||||
node-version: 24.12.x
|
||||
- name: Setting Up Dig Site
|
||||
env:
|
||||
CLONE_URL: ${{ github.event.pull_request.head.repo.clone_url }}
|
||||
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
BASE_REF: ${{ github.event.pull_request.base.ref }}
|
||||
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
|
||||
echo "remote: $CLONE_URL"
|
||||
echo "sha $HEAD_SHA"
|
||||
echo "base ref $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
|
||||
git remote add fork "$CLONE_URL" && git fetch fork
|
||||
git checkout "$HEAD_SHA"
|
||||
git merge-base "origin/$BASE_REF" HEAD > .dig-old
|
||||
echo "$HEAD_SHA" > .dig-new
|
||||
cp .dig-old artifacts
|
||||
|
||||
- name: Generating Types for SHA in .dig-new
|
||||
|
||||
6
.github/workflows/branch-created.yml
vendored
6
.github/workflows/branch-created.yml
vendored
@@ -157,7 +157,7 @@ jobs:
|
||||
}))
|
||||
- name: Create Release Project Board
|
||||
if: ${{ steps.check-major-version.outputs.MAJOR }}
|
||||
uses: dsanders11/project-actions/copy-project@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
||||
uses: dsanders11/project-actions/copy-project@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
id: create-release-board
|
||||
with:
|
||||
drafts: true
|
||||
@@ -177,7 +177,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
- name: Find Previous Release Project Board
|
||||
if: ${{ steps.check-major-version.outputs.MAJOR }}
|
||||
uses: dsanders11/project-actions/find-project@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
||||
uses: dsanders11/project-actions/find-project@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
id: find-prev-release-board
|
||||
with:
|
||||
fail-if-project-not-found: false
|
||||
@@ -185,7 +185,7 @@ jobs:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
- name: Close Previous Release Project Board
|
||||
if: ${{ steps.find-prev-release-board.outputs.number }}
|
||||
uses: dsanders11/project-actions/close-project@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
||||
uses: dsanders11/project-actions/close-project@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
project-number: ${{ steps.find-prev-release-board.outputs.number }}
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
27
.github/workflows/build.yml
vendored
27
.github/workflows/build.yml
vendored
@@ -446,3 +446,30 @@ jobs:
|
||||
- name: GitHub Actions Jobs Done
|
||||
run: |
|
||||
echo "All GitHub Actions Jobs are done"
|
||||
|
||||
check-signed-commits:
|
||||
name: Check signed commits in green PR
|
||||
needs: gha-done
|
||||
if: ${{ contains(github.event.pull_request.labels.*.name, 'needs-signed-commits')}}
|
||||
runs-on: ubuntu-slim
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Check signed commits in PR
|
||||
uses: 1Password/check-signed-commits-action@ed2885f3ed2577a4f5d3c3fe895432a557d23d52 # v1
|
||||
with:
|
||||
comment: |
|
||||
⚠️ This PR contains unsigned commits. This repository enforces [commit signatures](https://docs.github.com/en/authentication/managing-commit-signature-verification)
|
||||
for all incoming PRs. To get your PR merged, please sign those commits
|
||||
(`git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}`) and force push them to this branch
|
||||
(`git push --force-with-lease`)
|
||||
|
||||
For more information on signing commits, see GitHub's documentation on [Telling Git about your signing key](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key).
|
||||
|
||||
- name: Remove needs-signed-commits label
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||
run: |
|
||||
gh pr edit $PR_URL --remove-label needs-signed-commits
|
||||
|
||||
127
.github/workflows/clean-src-cache.yml
vendored
127
.github/workflows/clean-src-cache.yml
vendored
@@ -7,6 +7,7 @@ name: Clean Source Cache
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
@@ -16,6 +17,8 @@ jobs:
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
DD_API_KEY: ${{ secrets.DD_API_KEY }}
|
||||
container:
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
options: --user root
|
||||
@@ -23,12 +26,130 @@ jobs:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
- /mnt/win-cache:/mnt/win-cache
|
||||
steps:
|
||||
- name: Get Disk Space Before Cleanup
|
||||
id: disk-before
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Disk space before cleanup:"
|
||||
df -h /mnt/cross-instance-cache
|
||||
df -h /mnt/win-cache
|
||||
CROSS_FREE_BEFORE=$(df -k /mnt/cross-instance-cache | tail -1 | awk '{print $4}')
|
||||
CROSS_TOTAL=$(df -k /mnt/cross-instance-cache | tail -1 | awk '{print $2}')
|
||||
WIN_FREE_BEFORE=$(df -k /mnt/win-cache | tail -1 | awk '{print $4}')
|
||||
WIN_TOTAL=$(df -k /mnt/win-cache | tail -1 | awk '{print $2}')
|
||||
echo "cross_free_kb=$CROSS_FREE_BEFORE" >> $GITHUB_OUTPUT
|
||||
echo "cross_total_kb=$CROSS_TOTAL" >> $GITHUB_OUTPUT
|
||||
echo "win_free_kb=$WIN_FREE_BEFORE" >> $GITHUB_OUTPUT
|
||||
echo "win_total_kb=$WIN_TOTAL" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cleanup Source Cache
|
||||
shell: bash
|
||||
run: |
|
||||
df -h /mnt/cross-instance-cache
|
||||
find /mnt/cross-instance-cache -type f -mtime +15 -delete
|
||||
find /mnt/win-cache -type f -mtime +15 -delete
|
||||
|
||||
- name: Get Disk Space After Cleanup
|
||||
id: disk-after
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Disk space after cleanup:"
|
||||
df -h /mnt/cross-instance-cache
|
||||
df -h /mnt/win-cache
|
||||
find /mnt/win-cache -type f -mtime +15 -delete
|
||||
df -h /mnt/win-cache
|
||||
CROSS_FREE_AFTER=$(df -k /mnt/cross-instance-cache | tail -1 | awk '{print $4}')
|
||||
WIN_FREE_AFTER=$(df -k /mnt/win-cache | tail -1 | awk '{print $4}')
|
||||
echo "cross_free_kb=$CROSS_FREE_AFTER" >> $GITHUB_OUTPUT
|
||||
echo "win_free_kb=$WIN_FREE_AFTER" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Log Disk Space to Datadog
|
||||
if: ${{ env.DD_API_KEY != '' }}
|
||||
shell: bash
|
||||
env:
|
||||
CROSS_FREE_BEFORE: ${{ steps.disk-before.outputs.cross_free_kb }}
|
||||
CROSS_FREE_AFTER: ${{ steps.disk-after.outputs.cross_free_kb }}
|
||||
CROSS_TOTAL: ${{ steps.disk-before.outputs.cross_total_kb }}
|
||||
WIN_FREE_BEFORE: ${{ steps.disk-before.outputs.win_free_kb }}
|
||||
WIN_FREE_AFTER: ${{ steps.disk-after.outputs.win_free_kb }}
|
||||
WIN_TOTAL: ${{ steps.disk-before.outputs.win_total_kb }}
|
||||
run: |
|
||||
TIMESTAMP=$(date +%s)
|
||||
|
||||
CROSS_FREE_BEFORE_GB=$(awk "BEGIN {printf \"%.2f\", $CROSS_FREE_BEFORE / 1024 / 1024}")
|
||||
CROSS_FREE_AFTER_GB=$(awk "BEGIN {printf \"%.2f\", $CROSS_FREE_AFTER / 1024 / 1024}")
|
||||
CROSS_FREED_GB=$(awk "BEGIN {printf \"%.2f\", ($CROSS_FREE_AFTER - $CROSS_FREE_BEFORE) / 1024 / 1024}")
|
||||
CROSS_TOTAL_GB=$(awk "BEGIN {printf \"%.2f\", $CROSS_TOTAL / 1024 / 1024}")
|
||||
|
||||
WIN_FREE_BEFORE_GB=$(awk "BEGIN {printf \"%.2f\", $WIN_FREE_BEFORE / 1024 / 1024}")
|
||||
WIN_FREE_AFTER_GB=$(awk "BEGIN {printf \"%.2f\", $WIN_FREE_AFTER / 1024 / 1024}")
|
||||
WIN_FREED_GB=$(awk "BEGIN {printf \"%.2f\", ($WIN_FREE_AFTER - $WIN_FREE_BEFORE) / 1024 / 1024}")
|
||||
WIN_TOTAL_GB=$(awk "BEGIN {printf \"%.2f\", $WIN_TOTAL / 1024 / 1024}")
|
||||
|
||||
echo "cross-instance-cache: free before=${CROSS_FREE_BEFORE_GB}GB, after=${CROSS_FREE_AFTER_GB}GB, freed=${CROSS_FREED_GB}GB, total=${CROSS_TOTAL_GB}GB"
|
||||
echo "win-cache: free before=${WIN_FREE_BEFORE_GB}GB, after=${WIN_FREE_AFTER_GB}GB, freed=${WIN_FREED_GB}GB, total=${WIN_TOTAL_GB}GB"
|
||||
|
||||
curl -s -X POST "https://api.datadoghq.com/api/v2/series" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "DD-API-KEY: ${DD_API_KEY}" \
|
||||
-d @- << EOF
|
||||
{
|
||||
"series": [
|
||||
{
|
||||
"metric": "electron.src_cache.disk.free_space_before_cleanup_gb",
|
||||
"points": [{"timestamp": ${TIMESTAMP}, "value": ${CROSS_FREE_BEFORE_GB}}],
|
||||
"type": 3,
|
||||
"unit": "gigabyte",
|
||||
"tags": ["volume:cross-instance-cache", "platform:linux"]
|
||||
},
|
||||
{
|
||||
"metric": "electron.src_cache.disk.free_space_after_cleanup_gb",
|
||||
"points": [{"timestamp": ${TIMESTAMP}, "value": ${CROSS_FREE_AFTER_GB}}],
|
||||
"type": 3,
|
||||
"unit": "gigabyte",
|
||||
"tags": ["volume:cross-instance-cache", "platform:linux"]
|
||||
},
|
||||
{
|
||||
"metric": "electron.src_cache.disk.space_freed_gb",
|
||||
"points": [{"timestamp": ${TIMESTAMP}, "value": ${CROSS_FREED_GB}}],
|
||||
"type": 3,
|
||||
"unit": "gigabyte",
|
||||
"tags": ["volume:cross-instance-cache", "platform:linux"]
|
||||
},
|
||||
{
|
||||
"metric": "electron.src_cache.disk.total_space_gb",
|
||||
"points": [{"timestamp": ${TIMESTAMP}, "value": ${CROSS_TOTAL_GB}}],
|
||||
"type": 3,
|
||||
"unit": "gigabyte",
|
||||
"tags": ["volume:cross-instance-cache", "platform:linux"]
|
||||
},
|
||||
{
|
||||
"metric": "electron.src_cache.disk.free_space_before_cleanup_gb",
|
||||
"points": [{"timestamp": ${TIMESTAMP}, "value": ${WIN_FREE_BEFORE_GB}}],
|
||||
"type": 3,
|
||||
"unit": "gigabyte",
|
||||
"tags": ["volume:win-cache", "platform:linux"]
|
||||
},
|
||||
{
|
||||
"metric": "electron.src_cache.disk.free_space_after_cleanup_gb",
|
||||
"points": [{"timestamp": ${TIMESTAMP}, "value": ${WIN_FREE_AFTER_GB}}],
|
||||
"type": 3,
|
||||
"unit": "gigabyte",
|
||||
"tags": ["volume:win-cache", "platform:linux"]
|
||||
},
|
||||
{
|
||||
"metric": "electron.src_cache.disk.space_freed_gb",
|
||||
"points": [{"timestamp": ${TIMESTAMP}, "value": ${WIN_FREED_GB}}],
|
||||
"type": 3,
|
||||
"unit": "gigabyte",
|
||||
"tags": ["volume:win-cache", "platform:linux"]
|
||||
},
|
||||
{
|
||||
"metric": "electron.src_cache.disk.total_space_gb",
|
||||
"points": [{"timestamp": ${TIMESTAMP}, "value": ${WIN_TOTAL_GB}}],
|
||||
"type": 3,
|
||||
"unit": "gigabyte",
|
||||
"tags": ["volume:win-cache", "platform:linux"]
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "Disk space metrics logged to Datadog"
|
||||
|
||||
24
.github/workflows/issue-commented.yml
vendored
24
.github/workflows/issue-commented.yml
vendored
@@ -34,30 +34,6 @@ jobs:
|
||||
run: |
|
||||
gh issue edit $ISSUE_URL --remove-label 'blocked/need-repro','blocked/need-info ❌'
|
||||
|
||||
pr-needs-signed-commits-commented:
|
||||
name: Remove needs-signed-commits on comment
|
||||
if: ${{ github.event.issue.pull_request && (contains(github.event.issue.labels.*.name, 'needs-signed-commits')) && (github.event.comment.user.login == github.event.issue.user.login) }}
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- name: Get author association
|
||||
id: get-author-association
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: *get-author-association
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
if: ${{ !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR"]'), steps.get-author-association.outputs.author_association) }}
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- name: Remove label
|
||||
if: ${{ !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR"]'), steps.get-author-association.outputs.author_association) }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
ISSUE_URL: ${{ github.event.issue.html_url }}
|
||||
run: |
|
||||
gh issue edit $ISSUE_URL --remove-label 'needs-signed-commits'
|
||||
|
||||
pr-reviewer-requested:
|
||||
name: Maintainer requested reviewer on PR
|
||||
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/request-review') && github.event.comment.user.type != 'Bot' }}
|
||||
|
||||
9
.github/workflows/issue-labeled.yml
vendored
9
.github/workflows/issue-labeled.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Set status
|
||||
uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
||||
uses: dsanders11/project-actions/edit-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 90
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Set status
|
||||
uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
||||
uses: dsanders11/project-actions/edit-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 90
|
||||
@@ -61,9 +61,10 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_REPO: electron/electron
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
set -eo pipefail
|
||||
COMMENT_COUNT=$(gh issue view ${{ github.event.issue.number }} --comments --json comments | jq '[ .comments[] | select(.author.login == "electron-issue-triage" or .authorAssociation == "OWNER" or .authorAssociation == "MEMBER") | select(.body | startswith("<!-- blocked/need-repro -->")) ] | length')
|
||||
COMMENT_COUNT=$(gh issue view "$ISSUE_NUMBER" --comments --json comments | jq '[ .comments[] | select(.author.login == "electron-issue-triage" or .authorAssociation == "OWNER" or .authorAssociation == "MEMBER") | select(.body | startswith("<!-- blocked/need-repro -->")) ] | length')
|
||||
if [[ $COMMENT_COUNT -eq 0 ]]; then
|
||||
echo "SHOULD_COMMENT=1" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
@@ -75,7 +76,7 @@ jobs:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- name: Create comment
|
||||
if: ${{ steps.check-for-comment.outputs.SHOULD_COMMENT }}
|
||||
uses: actions-cool/issues-helper@71b62d7da76e59ff7b193904feb6e77d4dbb2777 # v3.7.6
|
||||
uses: actions-cool/issues-helper@200c78641dbf33838311e5a1e0c31bbdb92d7cf0 # v3.8.0
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
4
.github/workflows/issue-opened.yml
vendored
4
.github/workflows/issue-opened.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Add to Issue Triage
|
||||
uses: dsanders11/project-actions/add-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
||||
uses: dsanders11/project-actions/add-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
field: Reporter
|
||||
field-value: ${{ github.event.issue.user.login }}
|
||||
@@ -146,7 +146,7 @@ jobs:
|
||||
}
|
||||
- name: Create unsupported major comment
|
||||
if: ${{ steps.add-labels.outputs.unsupportedMajor }}
|
||||
uses: actions-cool/issues-helper@71b62d7da76e59ff7b193904feb6e77d4dbb2777 # v3.7.6
|
||||
uses: actions-cool/issues-helper@200c78641dbf33838311e5a1e0c31bbdb92d7cf0 # v3.8.0
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
2
.github/workflows/issue-transferred.yml
vendored
2
.github/workflows/issue-transferred.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Remove from issue triage
|
||||
uses: dsanders11/project-actions/delete-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
||||
uses: dsanders11/project-actions/delete-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 90
|
||||
|
||||
6
.github/workflows/issue-unlabeled.yml
vendored
6
.github/workflows/issue-unlabeled.yml
vendored
@@ -16,9 +16,11 @@ jobs:
|
||||
steps:
|
||||
- name: Check for any blocked labels
|
||||
id: check-for-blocked-labels
|
||||
env:
|
||||
LABELS_JSON: ${{ toJSON(github.event.issue.labels.*.name) }}
|
||||
run: |
|
||||
set -eo pipefail
|
||||
BLOCKED_LABEL_COUNT=$(echo '${{ toJSON(github.event.issue.labels.*.name) }}' | jq '[ .[] | select(startswith("blocked/")) ] | length')
|
||||
BLOCKED_LABEL_COUNT=$(echo "$LABELS_JSON" | jq '[ .[] | select(startswith("blocked/")) ] | length')
|
||||
if [[ $BLOCKED_LABEL_COUNT -eq 0 ]]; then
|
||||
echo "NOT_BLOCKED=1" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
@@ -31,7 +33,7 @@ jobs:
|
||||
org: electron
|
||||
- name: Set status
|
||||
if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }}
|
||||
uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
||||
uses: dsanders11/project-actions/edit-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 90
|
||||
|
||||
@@ -10,6 +10,10 @@ on:
|
||||
- '.yarn/**'
|
||||
- '.yarnrc.yml'
|
||||
|
||||
# SECURITY: This workflow uses pull_request_target and has access to secrets.
|
||||
# Do NOT checkout or run code from the PR head. All code execution must use
|
||||
# the base branch only. Adding a ref to PR head would expose secrets to
|
||||
# untrusted code.
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
@@ -45,8 +49,9 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
|
||||
run: |
|
||||
cat <<'REVIEW_EOF' | sed "s/%AUTHOR%/${{ github.event.pull_request.user.login }}/g" | gh pr review $PR_URL -r --body-file=-
|
||||
cat <<'REVIEW_EOF' | sed "s/%AUTHOR%/$PR_AUTHOR/g" | gh pr review $PR_URL -r --body-file=-
|
||||
<!-- disallowed-non-maintainer-change -->
|
||||
|
||||
Hello @%AUTHOR%! It looks like this pull request touches one of our dependency or CI files, and per [our contribution policy](https://github.com/electron/electron/blob/main/CONTRIBUTING.md#dependencies-upgrades-policy) we do not accept these types of changes in PRs.
|
||||
|
||||
8
.github/workflows/pipeline-electron-lint.yml
vendored
8
.github/workflows/pipeline-electron-lint.yml
vendored
@@ -46,6 +46,10 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
||||
if [[ ! "$chromium_revision" =~ ^[a-zA-Z0-9._-]+$ ]]; then
|
||||
echo "::error::Invalid chromium_revision: $chromium_revision"
|
||||
exit 1
|
||||
fi
|
||||
gn_version="$(curl -sL -b ~/.gitcookies "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/DEPS?format=TEXT" | base64 -d | grep gn_version | head -n1 | cut -d\' -f4)"
|
||||
|
||||
cipd ensure -ensure-file - -root . <<-CIPD
|
||||
@@ -60,6 +64,10 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
||||
if [[ ! "$chromium_revision" =~ ^[a-zA-Z0-9._-]+$ ]]; then
|
||||
echo "::error::Invalid chromium_revision: $chromium_revision"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p src/buildtools
|
||||
curl -sL -b ~/.gitcookies "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
|
||||
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Download Generated Artifacts
|
||||
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
||||
with:
|
||||
name: generated_artifacts_linux_arm64
|
||||
path: ./generated_artifacts_linux_arm64
|
||||
|
||||
@@ -48,6 +48,8 @@ env:
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}
|
||||
# @sentry/cli is only needed by release upload-symbols.py; skip the ~17MB CDN download on test jobs
|
||||
SENTRYCLI_SKIP_DOWNLOAD: 1
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
@@ -36,6 +36,8 @@ env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
# @sentry/cli is only needed by release upload-symbols.py; skip the ~17MB CDN download on test jobs
|
||||
SENTRYCLI_SKIP_DOWNLOAD: 1
|
||||
|
||||
jobs:
|
||||
node-tests:
|
||||
|
||||
6
.github/workflows/pr-template-check.yml
vendored
6
.github/workflows/pr-template-check.yml
vendored
@@ -4,6 +4,10 @@ on:
|
||||
pull_request_target:
|
||||
types: [opened, ready_for_review]
|
||||
|
||||
# SECURITY: This workflow uses pull_request_target and has access to secrets.
|
||||
# Do NOT checkout or run code from the PR head. All code execution must use
|
||||
# the base branch only. Adding a ref to PR head would expose secrets to
|
||||
# untrusted code.
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
@@ -21,7 +25,7 @@ jobs:
|
||||
sparse-checkout: .github/PULL_REQUEST_TEMPLATE.md
|
||||
sparse-checkout-cone-mode: false
|
||||
- name: Check for required sections
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
|
||||
13
.github/workflows/pr-triage-automation.yml
vendored
13
.github/workflows/pr-triage-automation.yml
vendored
@@ -6,16 +6,23 @@ on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
# SECURITY: This workflow uses pull_request_target and has access to secrets.
|
||||
# Do NOT checkout or run code from the PR head. All code execution must use
|
||||
# the base branch only. Adding a ref to PR head would expose secrets to
|
||||
# untrusted code.
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
set-needs-review:
|
||||
name: Set status to Needs Review
|
||||
if: >-
|
||||
(github.event_name == 'pull_request_target' && github.event.action == 'synchronize')
|
||||
|| (github.event_name == 'pull_request_target' && github.event.action == 'review_requested')
|
||||
(github.event_name == 'pull_request_target'
|
||||
&& github.event.pull_request.draft != true
|
||||
&& !contains(github.event.pull_request.labels.*.name, 'wip ⚒')
|
||||
&& (github.event.action == 'synchronize' || github.event.action == 'review_requested'))
|
||||
|| (github.event_name == 'issue_comment'
|
||||
&& github.event.issue.pull_request
|
||||
&& !contains(github.event.issue.labels.*.name, 'wip ⚒')
|
||||
&& github.event.comment.user.login == github.event.issue.user.login)
|
||||
runs-on: ubuntu-slim
|
||||
permissions:
|
||||
@@ -28,7 +35,7 @@ jobs:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Set status to Needs Review
|
||||
uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
||||
uses: dsanders11/project-actions/edit-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 118
|
||||
|
||||
10
.github/workflows/pull-request-labeled.yml
vendored
10
.github/workflows/pull-request-labeled.yml
vendored
@@ -4,6 +4,10 @@ on:
|
||||
pull_request_target:
|
||||
types: [labeled]
|
||||
|
||||
# SECURITY: This workflow uses pull_request_target and has access to secrets.
|
||||
# Do NOT checkout or run code from the PR head. All code execution must use
|
||||
# the base branch only. Adding a ref to PR head would expose secrets to
|
||||
# untrusted code.
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
@@ -38,7 +42,7 @@ jobs:
|
||||
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Set status
|
||||
uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
||||
uses: dsanders11/project-actions/edit-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 94
|
||||
@@ -56,7 +60,7 @@ jobs:
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- name: Create comment
|
||||
uses: actions-cool/issues-helper@71b62d7da76e59ff7b193904feb6e77d4dbb2777 # v3.7.6
|
||||
uses: actions-cool/issues-helper@200c78641dbf33838311e5a1e0c31bbdb92d7cf0 # v3.8.0
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
@@ -68,7 +72,7 @@ jobs:
|
||||
|
||||
Hello @${{ github.event.pull_request.user.login }}. Due to the high amount of AI spam PRs we receive, if a PR is detected to be majority AI-generated without disclosure and untested, we will automatically close the PR.
|
||||
|
||||
We welcome the use of AI tools, as long as the PR meets our quality standards and has clearly been built and tested. If you believe your PR was closed in error, we welcome you to resubmit. However, please read our [CONTRIBUTING.md](http://contributing.md/) carefully before reopening. Thanks for your contribution.
|
||||
We welcome the use of AI tools, as long as the PR meets our quality standards and has clearly been built and tested. If you believe your PR was closed in error, we welcome you to resubmit. However, please read our [CONTRIBUTING.md](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) and [AI Tool Policy](https://github.com/electron/governance/blob/main/policy/ai.md) carefully before reopening. Thanks for your contribution.
|
||||
- name: Close the pull request
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
39
.github/workflows/pull-request-opened-synchronized.yml
vendored
Normal file
39
.github/workflows/pull-request-opened-synchronized.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Pull Request Opened/Synchronized
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, synchronize]
|
||||
|
||||
# SECURITY: This workflow uses pull_request_target and has access to secrets.
|
||||
# Do NOT checkout or run code from the PR head. All code execution must use
|
||||
# the base branch only. Adding a ref to PR head would expose secrets to
|
||||
# untrusted code.
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
check-signed-commits:
|
||||
name: Check signed commits in PR
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'needs-signed-commits')}}
|
||||
runs-on: ubuntu-slim
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Check signed commits in PR
|
||||
uses: 1Password/check-signed-commits-action@ed2885f3ed2577a4f5d3c3fe895432a557d23d52 # v1
|
||||
with:
|
||||
comment: |
|
||||
⚠️ This PR contains unsigned commits. This repository enforces [commit signatures](https://docs.github.com/en/authentication/managing-commit-signature-verification)
|
||||
for all incoming PRs. To get your PR merged, please sign those commits
|
||||
(`git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}`) and force push them to this branch
|
||||
(`git push --force-with-lease`)
|
||||
|
||||
For more information on signing commits, see GitHub's documentation on [Telling Git about your signing key](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key).
|
||||
|
||||
- name: Add needs-signed-commits label
|
||||
if: ${{ failure() }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||
run: |
|
||||
gh pr edit $PR_URL --add-label needs-signed-commits
|
||||
2
.github/workflows/scorecards.yml
vendored
2
.github/workflows/scorecards.yml
vendored
@@ -51,6 +51,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@b1bff81932f5cdfc8695c7752dcee935dcd061c8 # v3.29.5
|
||||
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v3.29.5
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
2
.github/workflows/stable-prep-items.yml
vendored
2
.github/workflows/stable-prep-items.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
PROJECT_NUMBER=$(gh project list --owner electron --format json | jq -r '.projects | map(select(.title | test("^[0-9]+-x-y$"))) | max_by(.number) | .number')
|
||||
echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> "$GITHUB_OUTPUT"
|
||||
- name: Update Completed Stable Prep Items
|
||||
uses: dsanders11/project-actions/completed-by@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
|
||||
uses: dsanders11/project-actions/completed-by@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
field: Prep Status
|
||||
field-value: ✅ Complete
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -42,6 +42,7 @@ spec/.hash
|
||||
|
||||
# Generated native addon files
|
||||
/spec/fixtures/native-addon/echo/build/
|
||||
/spec/fixtures/native-addon/dialog-helper/build/
|
||||
|
||||
# If someone runs tsc this is where stuff will end up
|
||||
ts-gen
|
||||
|
||||
41
BUILD.gn
41
BUILD.gn
@@ -18,12 +18,12 @@ import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
|
||||
import("//v8/gni/snapshot_toolchain.gni")
|
||||
import("build/asar.gni")
|
||||
import("build/electron_paks.gni")
|
||||
import("build/esbuild/esbuild.gni")
|
||||
import("build/extract_symbols.gni")
|
||||
import("build/js2c_toolchain.gni")
|
||||
import("build/npm.gni")
|
||||
import("build/templated_file.gni")
|
||||
import("build/tsc.gni")
|
||||
import("build/webpack/webpack.gni")
|
||||
import("buildflags/buildflags.gni")
|
||||
import("filenames.auto.gni")
|
||||
import("filenames.gni")
|
||||
@@ -162,75 +162,81 @@ npm_action("build_electron_definitions") {
|
||||
outputs = [ "$target_gen_dir/tsc/typings/electron.d.ts" ]
|
||||
}
|
||||
|
||||
webpack_build("electron_browser_bundle") {
|
||||
typescript_check("electron_lib_typecheck") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
tsconfig = "//electron/tsconfig.electron.json"
|
||||
sources = auto_filenames.typecheck_sources
|
||||
}
|
||||
|
||||
esbuild_build("electron_browser_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
|
||||
inputs = auto_filenames.browser_bundle_deps
|
||||
|
||||
config_file = "//electron/build/webpack/webpack.config.browser.js"
|
||||
config_file = "//electron/build/esbuild/configs/browser.js"
|
||||
out_file = "$target_gen_dir/js2c/browser_init.js"
|
||||
}
|
||||
|
||||
webpack_build("electron_renderer_bundle") {
|
||||
esbuild_build("electron_renderer_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
|
||||
inputs = auto_filenames.renderer_bundle_deps
|
||||
|
||||
config_file = "//electron/build/webpack/webpack.config.renderer.js"
|
||||
config_file = "//electron/build/esbuild/configs/renderer.js"
|
||||
out_file = "$target_gen_dir/js2c/renderer_init.js"
|
||||
}
|
||||
|
||||
webpack_build("electron_worker_bundle") {
|
||||
esbuild_build("electron_worker_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
|
||||
inputs = auto_filenames.worker_bundle_deps
|
||||
|
||||
config_file = "//electron/build/webpack/webpack.config.worker.js"
|
||||
config_file = "//electron/build/esbuild/configs/worker.js"
|
||||
out_file = "$target_gen_dir/js2c/worker_init.js"
|
||||
}
|
||||
|
||||
webpack_build("electron_sandboxed_renderer_bundle") {
|
||||
esbuild_build("electron_sandboxed_renderer_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
|
||||
inputs = auto_filenames.sandbox_bundle_deps
|
||||
|
||||
config_file = "//electron/build/webpack/webpack.config.sandboxed_renderer.js"
|
||||
config_file = "//electron/build/esbuild/configs/sandboxed_renderer.js"
|
||||
out_file = "$target_gen_dir/js2c/sandbox_bundle.js"
|
||||
}
|
||||
|
||||
webpack_build("electron_isolated_renderer_bundle") {
|
||||
esbuild_build("electron_isolated_renderer_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
|
||||
inputs = auto_filenames.isolated_bundle_deps
|
||||
|
||||
config_file = "//electron/build/webpack/webpack.config.isolated_renderer.js"
|
||||
config_file = "//electron/build/esbuild/configs/isolated_renderer.js"
|
||||
out_file = "$target_gen_dir/js2c/isolated_bundle.js"
|
||||
}
|
||||
|
||||
webpack_build("electron_node_bundle") {
|
||||
esbuild_build("electron_node_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
|
||||
inputs = auto_filenames.node_bundle_deps
|
||||
|
||||
config_file = "//electron/build/webpack/webpack.config.node.js"
|
||||
config_file = "//electron/build/esbuild/configs/node.js"
|
||||
out_file = "$target_gen_dir/js2c/node_init.js"
|
||||
}
|
||||
|
||||
webpack_build("electron_utility_bundle") {
|
||||
esbuild_build("electron_utility_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
|
||||
inputs = auto_filenames.utility_bundle_deps
|
||||
|
||||
config_file = "//electron/build/webpack/webpack.config.utility.js"
|
||||
config_file = "//electron/build/esbuild/configs/utility.js"
|
||||
out_file = "$target_gen_dir/js2c/utility_init.js"
|
||||
}
|
||||
|
||||
webpack_build("electron_preload_realm_bundle") {
|
||||
esbuild_build("electron_preload_realm_bundle") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
|
||||
inputs = auto_filenames.preload_realm_bundle_deps
|
||||
|
||||
config_file = "//electron/build/webpack/webpack.config.preload_realm.js"
|
||||
config_file = "//electron/build/esbuild/configs/preload_realm.js"
|
||||
out_file = "$target_gen_dir/js2c/preload_realm_bundle.js"
|
||||
}
|
||||
|
||||
@@ -238,6 +244,7 @@ action("electron_js2c") {
|
||||
deps = [
|
||||
":electron_browser_bundle",
|
||||
":electron_isolated_renderer_bundle",
|
||||
":electron_lib_typecheck",
|
||||
":electron_node_bundle",
|
||||
":electron_preload_realm_bundle",
|
||||
":electron_renderer_bundle",
|
||||
|
||||
4
DEPS
4
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'148.0.7741.0',
|
||||
'148.0.7763.0',
|
||||
'node_version':
|
||||
'v24.14.0',
|
||||
'v24.14.1',
|
||||
'nan_version':
|
||||
'675cefebca42410733da8a454c8d9391fcebfbc2',
|
||||
'squirrel.mac_version':
|
||||
|
||||
@@ -51,9 +51,6 @@ is_cfi = false
|
||||
use_qt5 = false
|
||||
use_qt6 = false
|
||||
|
||||
# Disables the builtins PGO for V8
|
||||
v8_builtins_profiling_log_file = ""
|
||||
|
||||
# https://chromium.googlesource.com/chromium/src/+/main/docs/dangling_ptr.md
|
||||
# TODO(vertedinde): hunt down dangling pointers on Linux
|
||||
enable_dangling_raw_ptr_checks = false
|
||||
|
||||
326
build/esbuild/bundle.js
Normal file
326
build/esbuild/bundle.js
Normal file
@@ -0,0 +1,326 @@
|
||||
#!/usr/bin/env node
|
||||
// Driver script that replaces webpack for building Electron's internal
|
||||
// JS bundles. Each bundle is a single esbuild invocation parameterized by
|
||||
// the per-target configuration files under build/esbuild/configs.
|
||||
//
|
||||
// Invoked by the GN `esbuild_build` template via `npm run bundle -- …`.
|
||||
|
||||
'use strict';
|
||||
|
||||
const esbuild = require('esbuild');
|
||||
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const electronRoot = path.resolve(__dirname, '../..');
|
||||
|
||||
function parseArgs (argv) {
|
||||
const args = {};
|
||||
for (let i = 0; i < argv.length; i++) {
|
||||
const a = argv[i];
|
||||
if (a.startsWith('--')) {
|
||||
const key = a.slice(2);
|
||||
const next = argv[i + 1];
|
||||
if (next === undefined || next.startsWith('--')) {
|
||||
args[key] = true;
|
||||
} else {
|
||||
args[key] = next;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
// Parse $target_gen_dir/buildflags/buildflags.h (a C++ header containing
|
||||
// `#define BUILDFLAG_INTERNAL_NAME() (0|1)` lines) into a map of flag name
|
||||
// to boolean. Used to seed the `define` table so that `BUILDFLAG(NAME)` call
|
||||
// sites can be statically folded to `true`/`false` at build time.
|
||||
function parseBuildflags (buildflagsPath) {
|
||||
const flags = {};
|
||||
if (!buildflagsPath) return flags;
|
||||
const source = fs.readFileSync(buildflagsPath, 'utf8');
|
||||
const re = /#define BUILDFLAG_INTERNAL_(.+?)\(\) \(([01])\)/g;
|
||||
let match;
|
||||
while ((match = re.exec(source)) !== null) {
|
||||
const [, name, value] = match;
|
||||
flags[name] = value === '1';
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
// Return the list of esbuild `alias` entries used by every bundle. esbuild's
|
||||
// alias matches the full module specifier (no `$` suffix trickery like
|
||||
// webpack), so the bare `electron` alias also matches `electron/main`, etc.,
|
||||
// because esbuild matches the leftmost segment first.
|
||||
function buildAliases (electronAPIFile, { aliasTimers }) {
|
||||
const aliases = {
|
||||
electron: electronAPIFile,
|
||||
'electron/main': electronAPIFile,
|
||||
'electron/renderer': electronAPIFile,
|
||||
'electron/common': electronAPIFile,
|
||||
'electron/utility': electronAPIFile
|
||||
};
|
||||
// Only browser-platform bundles (sandboxed_renderer, isolated_renderer,
|
||||
// preload_realm) need the timers shim — Node's `timers` builtin is not
|
||||
// available there. For node-platform bundles (browser, renderer, worker,
|
||||
// utility, node) the alias MUST NOT apply: lib/common/init.ts wraps the
|
||||
// real Node timers and then assigns the wrappers onto globalThis. If
|
||||
// those bundles saw the shim, the wrappers would recursively call back
|
||||
// into globalThis.setTimeout and blow the stack.
|
||||
if (aliasTimers) {
|
||||
aliases.timers = path.resolve(electronRoot, 'lib', 'common', 'timers-shim.ts');
|
||||
}
|
||||
return aliases;
|
||||
}
|
||||
|
||||
// esbuild's `alias` does not support wildcard prefixes like `@electron/internal/*`.
|
||||
// We instead install a tiny resolve plugin that rewrites any import starting
|
||||
// with that prefix to an absolute path under `lib/`. The plugin must also
|
||||
// replicate esbuild's extension/index resolution because returning a path
|
||||
// from onResolve bypasses the default resolver.
|
||||
function internalAliasPlugin () {
|
||||
const candidates = (base) => [
|
||||
base,
|
||||
`${base}.ts`,
|
||||
`${base}.js`,
|
||||
path.join(base, 'index.ts'),
|
||||
path.join(base, 'index.js')
|
||||
];
|
||||
return {
|
||||
name: 'electron-internal-alias',
|
||||
setup (build) {
|
||||
build.onResolve({ filter: /^@electron\/internal(\/|$)/ }, (args) => {
|
||||
// Tolerate stray double slashes in import paths (webpack was lenient).
|
||||
const rel = args.path.replace(/^@electron\/internal\/?/, '').replace(/^\/+/, '');
|
||||
const base = path.resolve(electronRoot, 'lib', rel);
|
||||
for (const c of candidates(base)) {
|
||||
try {
|
||||
if (fs.statSync(c).isFile()) return { path: c };
|
||||
} catch { /* keep looking */ }
|
||||
}
|
||||
return { errors: [{ text: `Cannot resolve @electron/internal path: ${args.path}` }] };
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Rewrites `BUILDFLAG(NAME)` call-sites to `(true)` or `(false)` at load
|
||||
// time, equivalent to the combination of webpack's DefinePlugin substitution
|
||||
// (BUILDFLAG -> "" and NAME -> "true"/"false") that the old config used.
|
||||
// Doing it in a single regex pass keeps the semantics identical and avoids
|
||||
// fighting with esbuild's AST-level `define` quoting rules.
|
||||
function buildflagPlugin (buildflags, { allowUnknown = false } = {}) {
|
||||
return {
|
||||
name: 'electron-buildflag',
|
||||
setup (build) {
|
||||
build.onLoad({ filter: /\.(ts|js)$/ }, async (args) => {
|
||||
const source = await fs.promises.readFile(args.path, 'utf8');
|
||||
if (!source.includes('BUILDFLAG(')) {
|
||||
return { contents: source, loader: args.path.endsWith('.ts') ? 'ts' : 'js' };
|
||||
}
|
||||
const rewritten = source.replace(/BUILDFLAG\(([A-Z0-9_]+)\)/g, (_, name) => {
|
||||
if (!Object.prototype.hasOwnProperty.call(buildflags, name)) {
|
||||
if (allowUnknown) return '(false)';
|
||||
throw new Error(`Unknown BUILDFLAG: ${name} (in ${args.path})`);
|
||||
}
|
||||
return `(${buildflags[name]})`;
|
||||
});
|
||||
return { contents: rewritten, loader: args.path.endsWith('.ts') ? 'ts' : 'js' };
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// TODO(MarshallOfSound): drop this patch once evanw/esbuild#4441 lands and
|
||||
// we bump esbuild — that PR adds a `__toCommonJSCached` helper for the
|
||||
// inline-require path so identity is preserved upstream. Tracked at
|
||||
// https://github.com/evanw/esbuild/issues/4440.
|
||||
//
|
||||
// esbuild's runtime emits `__toCommonJS = (mod) => __copyProps(__defProp({},
|
||||
// "__esModule", { value: true }), mod)`, which allocates a fresh wrapper
|
||||
// object every time `require()` resolves to a bundled ESM module. That
|
||||
// breaks identity expectations our code relies on (e.g. sandboxed preloads
|
||||
// expecting `require('timers') === require('node:timers')`, and the
|
||||
// defineProperties getters in lib/common/define-properties.ts expecting
|
||||
// stable namespaces). A cached WeakMap-backed version of __toCommonJS
|
||||
// existed in older esbuild releases (see evanw/esbuild#2126) but was
|
||||
// removed in evanw/esbuild@f4ff26d3 (0.14.27). Substitute a memoized
|
||||
// variant in post-processing so every call site returns the same wrapper
|
||||
// for the same underlying namespace, matching webpack's
|
||||
// `__webpack_require__` cache semantics.
|
||||
const ESBUILD_TO_COMMONJS_PATTERN =
|
||||
/var __toCommonJS = \(mod\) => __copyProps\(__defProp\(\{\}, "__esModule", \{ value: true \}\), mod\);/;
|
||||
const ESBUILD_TO_COMMONJS_REPLACEMENT =
|
||||
'var __toCommonJS = /* @__PURE__ */ ((cache) => (mod) => {\n' +
|
||||
' var cached = cache.get(mod);\n' +
|
||||
' if (cached) return cached;\n' +
|
||||
' var result = __copyProps(__defProp({}, "__esModule", { value: true }), mod);\n' +
|
||||
' cache.set(mod, result);\n' +
|
||||
' return result;\n' +
|
||||
' })(new WeakMap());';
|
||||
|
||||
function patchToCommonJS (source) {
|
||||
// Once evanw/esbuild#4441 lands, esbuild will emit `__toCommonJSCached`
|
||||
// for inline require() — when we see that helper in the output, the
|
||||
// upstream fix is active and this whole patch is a no-op (and should be
|
||||
// deleted on the next esbuild bump).
|
||||
if (source.includes('__toCommonJSCached')) {
|
||||
return source;
|
||||
}
|
||||
if (!ESBUILD_TO_COMMONJS_PATTERN.test(source)) {
|
||||
// Some bundles may not contain any ESM-shaped modules, in which case
|
||||
// esbuild omits the helper entirely and there is nothing to patch.
|
||||
if (source.includes('__toCommonJS')) {
|
||||
throw new Error(
|
||||
'esbuild bundle contains __toCommonJS but did not match the ' +
|
||||
'expected pattern; the runtime helper has likely changed upstream. ' +
|
||||
'Update ESBUILD_TO_COMMONJS_PATTERN in build/esbuild/bundle.js, or ' +
|
||||
'delete patchToCommonJS entirely if evanw/esbuild#4441 has landed.'
|
||||
);
|
||||
}
|
||||
return source;
|
||||
}
|
||||
return source.replace(ESBUILD_TO_COMMONJS_PATTERN, ESBUILD_TO_COMMONJS_REPLACEMENT);
|
||||
}
|
||||
|
||||
// Wrap bundle source text in the same header/footer pairs webpack's
|
||||
// wrapper-webpack-plugin used. The try/catch wrapper is load-bearing:
|
||||
// shell/common/node_util.cc's CompileAndCall relies on it to prevent
|
||||
// exceptions from tearing down bootstrap.
|
||||
function applyWrappers (source, opts, outputFilename) {
|
||||
let wrapped = patchToCommonJS(source);
|
||||
if (opts.wrapInitWithProfilingTimeout) {
|
||||
const header = 'function ___electron_webpack_init__() {';
|
||||
const footer = '\n};\nif ((globalThis.process || binding.process).argv.includes("--profile-electron-init")) {\n setTimeout(___electron_webpack_init__, 0);\n} else {\n ___electron_webpack_init__();\n}';
|
||||
wrapped = header + wrapped + footer;
|
||||
}
|
||||
if (opts.wrapInitWithTryCatch) {
|
||||
const header = 'try {';
|
||||
const footer = `\n} catch (err) {\n console.error('Electron ${outputFilename} script failed to run');\n console.error(err);\n}`;
|
||||
wrapped = header + wrapped + footer;
|
||||
}
|
||||
return wrapped;
|
||||
}
|
||||
|
||||
async function buildBundle (opts, cliArgs) {
|
||||
const {
|
||||
target,
|
||||
alwaysHasNode,
|
||||
loadElectronFromAlternateTarget,
|
||||
wrapInitWithProfilingTimeout,
|
||||
wrapInitWithTryCatch
|
||||
} = opts;
|
||||
|
||||
const outputFilename = cliArgs['output-filename'] || `${target}.bundle.js`;
|
||||
const outputPath = cliArgs['output-path'] || path.resolve(electronRoot, 'out');
|
||||
const mode = cliArgs.mode || 'development';
|
||||
const minify = mode === 'production';
|
||||
const printGraph = !!cliArgs['print-graph'];
|
||||
|
||||
let entry = path.resolve(electronRoot, 'lib', target, 'init.ts');
|
||||
if (!fs.existsSync(entry)) {
|
||||
entry = path.resolve(electronRoot, 'lib', target, 'init.js');
|
||||
}
|
||||
|
||||
const electronAPIFile = path.resolve(
|
||||
electronRoot,
|
||||
'lib',
|
||||
loadElectronFromAlternateTarget || target,
|
||||
'api',
|
||||
'exports',
|
||||
'electron.ts'
|
||||
);
|
||||
|
||||
const buildflags = parseBuildflags(cliArgs.buildflags);
|
||||
|
||||
// Shims that stand in for webpack ProvidePlugin. Each target gets the
|
||||
// minimum set of globals it needs; the capture files mirror the originals
|
||||
// under lib/common so the behavior (grab globals before user code can
|
||||
// delete them) is preserved exactly.
|
||||
const inject = [];
|
||||
if (opts.targetDeletesNodeGlobals) {
|
||||
inject.push(path.resolve(__dirname, 'shims', 'node-globals-shim.js'));
|
||||
}
|
||||
if (!alwaysHasNode) {
|
||||
inject.push(path.resolve(__dirname, 'shims', 'browser-globals-shim.js'));
|
||||
}
|
||||
inject.push(path.resolve(__dirname, 'shims', 'promise-shim.js'));
|
||||
|
||||
const result = await esbuild.build({
|
||||
entryPoints: [entry],
|
||||
bundle: true,
|
||||
format: 'iife',
|
||||
platform: alwaysHasNode ? 'node' : 'browser',
|
||||
target: 'es2022',
|
||||
minify,
|
||||
// Preserve class/function names in both development and production so
|
||||
// gin_helper-surfaced constructor names and stack traces stay readable.
|
||||
// (Under webpack this only mattered when terser ran in is_official_build;
|
||||
// esbuild applies the same rename pressure in dev too, so keep it on
|
||||
// unconditionally for consistency.)
|
||||
keepNames: true,
|
||||
sourcemap: false,
|
||||
logLevel: 'warning',
|
||||
metafile: true,
|
||||
write: false,
|
||||
resolveExtensions: ['.ts', '.js'],
|
||||
alias: buildAliases(electronAPIFile, { aliasTimers: !alwaysHasNode }),
|
||||
inject,
|
||||
define: {
|
||||
__non_webpack_require__: 'require'
|
||||
},
|
||||
// Node internal modules we pull through __non_webpack_require__ at runtime.
|
||||
// These must not be bundled — esbuild should leave the literal require()
|
||||
// call alone so the outer Node scope resolves them.
|
||||
external: [
|
||||
'internal/modules/helpers',
|
||||
'internal/modules/run_main',
|
||||
'internal/fs/utils',
|
||||
'internal/util',
|
||||
'internal/validators',
|
||||
'internal/url'
|
||||
],
|
||||
plugins: [
|
||||
internalAliasPlugin(),
|
||||
buildflagPlugin(buildflags, { allowUnknown: printGraph })
|
||||
]
|
||||
});
|
||||
|
||||
if (printGraph) {
|
||||
const inputs = Object.keys(result.metafile.inputs)
|
||||
.filter((p) => !p.includes('node_modules') && !p.startsWith('..'))
|
||||
.map((p) => path.relative(electronRoot, path.resolve(electronRoot, p)));
|
||||
process.stdout.write(JSON.stringify(inputs) + '\n');
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.outputFiles.length !== 1) {
|
||||
throw new Error(`Expected exactly one output file, got ${result.outputFiles.length}`);
|
||||
}
|
||||
|
||||
const wrapped = applyWrappers(
|
||||
result.outputFiles[0].text,
|
||||
{ wrapInitWithProfilingTimeout, wrapInitWithTryCatch },
|
||||
outputFilename
|
||||
);
|
||||
|
||||
await fs.promises.mkdir(outputPath, { recursive: true });
|
||||
await fs.promises.writeFile(path.join(outputPath, outputFilename), wrapped);
|
||||
}
|
||||
|
||||
async function main () {
|
||||
const cliArgs = parseArgs(process.argv.slice(2));
|
||||
if (!cliArgs.config) {
|
||||
console.error('Usage: bundle.js --config <path> [--output-filename X] [--output-path Y] [--mode development|production] [--buildflags path/to/buildflags.h] [--print-graph]');
|
||||
process.exit(1);
|
||||
}
|
||||
const configPath = path.resolve(cliArgs.config);
|
||||
const opts = require(configPath);
|
||||
await buildBundle(opts, cliArgs);
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
4
build/esbuild/configs/browser.js
Normal file
4
build/esbuild/configs/browser.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
target: 'browser',
|
||||
alwaysHasNode: true
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
module.exports = {
|
||||
target: 'isolated_renderer',
|
||||
alwaysHasNode: false,
|
||||
wrapInitWithTryCatch: true
|
||||
});
|
||||
};
|
||||
4
build/esbuild/configs/node.js
Normal file
4
build/esbuild/configs/node.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
target: 'node',
|
||||
alwaysHasNode: true
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
module.exports = {
|
||||
target: 'preload_realm',
|
||||
alwaysHasNode: false,
|
||||
wrapInitWithProfilingTimeout: true,
|
||||
wrapInitWithTryCatch: true
|
||||
});
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
module.exports = {
|
||||
target: 'renderer',
|
||||
alwaysHasNode: true,
|
||||
targetDeletesNodeGlobals: true,
|
||||
wrapInitWithProfilingTimeout: true,
|
||||
wrapInitWithTryCatch: true
|
||||
});
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
module.exports = {
|
||||
target: 'sandboxed_renderer',
|
||||
alwaysHasNode: false,
|
||||
wrapInitWithProfilingTimeout: true,
|
||||
wrapInitWithTryCatch: true
|
||||
});
|
||||
};
|
||||
4
build/esbuild/configs/utility.js
Normal file
4
build/esbuild/configs/utility.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
target: 'utility',
|
||||
alwaysHasNode: true
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
module.exports = {
|
||||
target: 'worker',
|
||||
loadElectronFromAlternateTarget: 'renderer',
|
||||
alwaysHasNode: true,
|
||||
targetDeletesNodeGlobals: true,
|
||||
wrapInitWithTryCatch: true
|
||||
});
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
import("../npm.gni")
|
||||
|
||||
template("webpack_build") {
|
||||
assert(defined(invoker.config_file), "Need webpack config file to run")
|
||||
template("esbuild_build") {
|
||||
assert(defined(invoker.config_file), "Need esbuild config file to run")
|
||||
assert(defined(invoker.out_file), "Need output file to run")
|
||||
assert(defined(invoker.inputs), "Need webpack inputs to run")
|
||||
assert(defined(invoker.inputs), "Need esbuild inputs to run")
|
||||
|
||||
npm_action(target_name) {
|
||||
forward_variables_from(invoker,
|
||||
@@ -11,11 +11,14 @@ template("webpack_build") {
|
||||
"deps",
|
||||
"public_deps",
|
||||
])
|
||||
script = "webpack"
|
||||
script = "bundle"
|
||||
|
||||
inputs = [
|
||||
invoker.config_file,
|
||||
"//electron/build/webpack/webpack.config.base.js",
|
||||
"//electron/build/esbuild/bundle.js",
|
||||
"//electron/build/esbuild/shims/node-globals-shim.js",
|
||||
"//electron/build/esbuild/shims/browser-globals-shim.js",
|
||||
"//electron/build/esbuild/shims/promise-shim.js",
|
||||
"//electron/tsconfig.json",
|
||||
"//electron/yarn.lock",
|
||||
"//electron/typings/internal-ambient.d.ts",
|
||||
@@ -34,10 +37,10 @@ template("webpack_build") {
|
||||
get_path_info(invoker.out_file, "file"),
|
||||
"--output-path",
|
||||
rebase_path(get_path_info(invoker.out_file, "dir")),
|
||||
"--env",
|
||||
"buildflags=" + rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||
"--env",
|
||||
"mode=" + mode,
|
||||
"--buildflags",
|
||||
rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||
"--mode",
|
||||
mode,
|
||||
]
|
||||
deps += [ "//electron/buildflags" ]
|
||||
|
||||
18
build/esbuild/shims/browser-globals-shim.js
Normal file
18
build/esbuild/shims/browser-globals-shim.js
Normal file
@@ -0,0 +1,18 @@
|
||||
// Injected into browser-platform bundles (sandboxed_renderer, isolated_renderer,
|
||||
// preload_realm) where Node globals are not implicitly available. Supplies
|
||||
// `Buffer`, `process`, and `global` — replacing webpack's ProvidePlugin
|
||||
// polyfill injection plus webpack 5's built-in `global -> globalThis` rewrite
|
||||
// that `target: 'web'` performed automatically.
|
||||
//
|
||||
// The `buffer` and `process/browser` imports below intentionally use the
|
||||
// npm polyfill packages, not Node's built-in `node:buffer` / `node:process`
|
||||
// modules, because these shims ship into browser-platform bundles that do
|
||||
// not have Node globals available at runtime.
|
||||
|
||||
/* eslint-disable import/order, import/enforce-node-protocol-usage */
|
||||
import { Buffer as _Buffer } from 'buffer';
|
||||
import _process from 'process/browser';
|
||||
|
||||
const _global = globalThis;
|
||||
|
||||
export { _Buffer as Buffer, _process as process, _global as global };
|
||||
14
build/esbuild/shims/node-globals-shim.js
Normal file
14
build/esbuild/shims/node-globals-shim.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// Injected into renderer/worker bundles to replace webpack's ProvidePlugin
|
||||
// that captured `Buffer`, `global`, and `process` before user code could
|
||||
// delete them from the global scope. The Module.wrapper override in
|
||||
// lib/renderer/init.ts re-injects these into user preload scripts later.
|
||||
|
||||
// Rip globals off of globalThis/self/window so they are captured in this
|
||||
// module's closure and retained even if the caller later deletes them.
|
||||
const _global = typeof globalThis !== 'undefined'
|
||||
? globalThis.global
|
||||
: (self || window).global;
|
||||
const _process = _global.process;
|
||||
const _Buffer = _global.Buffer;
|
||||
|
||||
export { _global as global, _process as process, _Buffer as Buffer };
|
||||
7
build/esbuild/shims/promise-shim.js
Normal file
7
build/esbuild/shims/promise-shim.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// Captures the original `Promise` constructor so that userland mutations of
|
||||
// `global.Promise.resolve` do not affect Electron's internal code. Mirrors
|
||||
// webpack's ProvidePlugin reference to lib/common/webpack-globals-provider.
|
||||
|
||||
const _Promise = globalThis.Promise;
|
||||
|
||||
export { _Promise as Promise };
|
||||
@@ -1,5 +1,42 @@
|
||||
import("npm.gni")
|
||||
|
||||
# Runs `tsgo --noEmit` over a tsconfig via the `tsc-check` npm script (which
|
||||
# wraps script/typecheck.js) and writes a stamp on success. Use this to gate
|
||||
# downstream targets on a successful typecheck without emitting JS.
|
||||
template("typescript_check") {
|
||||
assert(defined(invoker.tsconfig), "Need tsconfig name to run")
|
||||
assert(defined(invoker.sources), "Need tsc sources to run")
|
||||
|
||||
npm_action(target_name) {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"deps",
|
||||
"public_deps",
|
||||
])
|
||||
script = "tsc-check"
|
||||
|
||||
sources = invoker.sources
|
||||
inputs = [
|
||||
invoker.tsconfig,
|
||||
"//electron/tsconfig.json",
|
||||
"//electron/yarn.lock",
|
||||
"//electron/script/typecheck.js",
|
||||
"//electron/typings/internal-ambient.d.ts",
|
||||
"//electron/typings/internal-electron.d.ts",
|
||||
]
|
||||
|
||||
stamp_file = "$target_gen_dir/$target_name.stamp"
|
||||
outputs = [ stamp_file ]
|
||||
|
||||
args = [
|
||||
"--tsconfig",
|
||||
rebase_path(invoker.tsconfig),
|
||||
"--stamp",
|
||||
rebase_path(stamp_file),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
template("typescript_build") {
|
||||
assert(defined(invoker.tsconfig), "Need tsconfig name to run")
|
||||
assert(defined(invoker.sources), "Need tsc sources to run")
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const webpack = require('webpack');
|
||||
const WrapperPlugin = require('wrapper-webpack-plugin');
|
||||
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const electronRoot = path.resolve(__dirname, '../..');
|
||||
|
||||
class AccessDependenciesPlugin {
|
||||
apply (compiler) {
|
||||
compiler.hooks.compilation.tap('AccessDependenciesPlugin', compilation => {
|
||||
compilation.hooks.finishModules.tap('AccessDependenciesPlugin', modules => {
|
||||
const filePaths = modules.map(m => m.resource).filter(p => p).map(p => path.relative(electronRoot, p));
|
||||
console.info(JSON.stringify(filePaths));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ({
|
||||
alwaysHasNode,
|
||||
loadElectronFromAlternateTarget,
|
||||
targetDeletesNodeGlobals,
|
||||
target,
|
||||
wrapInitWithProfilingTimeout,
|
||||
wrapInitWithTryCatch
|
||||
}) => {
|
||||
let entry = path.resolve(electronRoot, 'lib', target, 'init.ts');
|
||||
if (!fs.existsSync(entry)) {
|
||||
entry = path.resolve(electronRoot, 'lib', target, 'init.js');
|
||||
}
|
||||
|
||||
const electronAPIFile = path.resolve(electronRoot, 'lib', loadElectronFromAlternateTarget || target, 'api', 'exports', 'electron.ts');
|
||||
|
||||
return (env = {}, argv = {}) => {
|
||||
const onlyPrintingGraph = !!env.PRINT_WEBPACK_GRAPH;
|
||||
const outputFilename = argv['output-filename'] || `${target}.bundle.js`;
|
||||
|
||||
const defines = {
|
||||
BUILDFLAG: onlyPrintingGraph ? '(a => a)' : ''
|
||||
};
|
||||
|
||||
if (env.buildflags) {
|
||||
const flagFile = fs.readFileSync(env.buildflags, 'utf8');
|
||||
for (const line of flagFile.split(/(\r\n|\r|\n)/g)) {
|
||||
const flagMatch = line.match(/#define BUILDFLAG_INTERNAL_(.+?)\(\) \(([01])\)/);
|
||||
if (flagMatch) {
|
||||
const [, flagName, flagValue] = flagMatch;
|
||||
defines[flagName] = JSON.stringify(Boolean(parseInt(flagValue, 10)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const ignoredModules = [];
|
||||
|
||||
const plugins = [];
|
||||
|
||||
if (onlyPrintingGraph) {
|
||||
plugins.push(new AccessDependenciesPlugin());
|
||||
}
|
||||
|
||||
if (targetDeletesNodeGlobals) {
|
||||
plugins.push(new webpack.ProvidePlugin({
|
||||
Buffer: ['@electron/internal/common/webpack-provider', 'Buffer'],
|
||||
global: ['@electron/internal/common/webpack-provider', '_global'],
|
||||
process: ['@electron/internal/common/webpack-provider', 'process']
|
||||
}));
|
||||
}
|
||||
|
||||
// Webpack 5 no longer polyfills process or Buffer.
|
||||
if (!alwaysHasNode) {
|
||||
plugins.push(new webpack.ProvidePlugin({
|
||||
Buffer: ['buffer', 'Buffer'],
|
||||
process: 'process/browser'
|
||||
}));
|
||||
}
|
||||
|
||||
plugins.push(new webpack.ProvidePlugin({
|
||||
Promise: ['@electron/internal/common/webpack-globals-provider', 'Promise']
|
||||
}));
|
||||
|
||||
plugins.push(new webpack.DefinePlugin(defines));
|
||||
|
||||
if (wrapInitWithProfilingTimeout) {
|
||||
plugins.push(new WrapperPlugin({
|
||||
header: 'function ___electron_webpack_init__() {',
|
||||
footer: `
|
||||
};
|
||||
if ((globalThis.process || binding.process).argv.includes("--profile-electron-init")) {
|
||||
setTimeout(___electron_webpack_init__, 0);
|
||||
} else {
|
||||
___electron_webpack_init__();
|
||||
}`
|
||||
}));
|
||||
}
|
||||
|
||||
if (wrapInitWithTryCatch) {
|
||||
plugins.push(new WrapperPlugin({
|
||||
header: 'try {',
|
||||
footer: `
|
||||
} catch (err) {
|
||||
console.error('Electron ${outputFilename} script failed to run');
|
||||
console.error(err);
|
||||
}`
|
||||
}));
|
||||
}
|
||||
|
||||
return {
|
||||
mode: 'development',
|
||||
devtool: false,
|
||||
entry,
|
||||
target: alwaysHasNode ? 'node' : 'web',
|
||||
output: {
|
||||
filename: outputFilename
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@electron/internal': path.resolve(electronRoot, 'lib'),
|
||||
electron$: electronAPIFile,
|
||||
'electron/main$': electronAPIFile,
|
||||
'electron/renderer$': electronAPIFile,
|
||||
'electron/common$': electronAPIFile,
|
||||
'electron/utility$': electronAPIFile,
|
||||
// Force timers to resolve to our own shim that doesn't use window.postMessage
|
||||
timers: path.resolve(electronRoot, 'lib', 'common', 'timers-shim.ts')
|
||||
},
|
||||
extensions: ['.ts', '.js'],
|
||||
fallback: {
|
||||
// We provide our own "timers" import above, any usage of setImmediate inside
|
||||
// one of our renderer bundles should import it from the 'timers' package
|
||||
setImmediate: false
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: (moduleName) => !onlyPrintingGraph && ignoredModules.includes(moduleName),
|
||||
loader: 'null-loader'
|
||||
}, {
|
||||
test: /\.ts$/,
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
configFile: path.resolve(electronRoot, 'tsconfig.electron.json'),
|
||||
transpileOnly: onlyPrintingGraph,
|
||||
ignoreDiagnostics: [
|
||||
// File '{0}' is not under 'rootDir' '{1}'.
|
||||
6059,
|
||||
// Private field '{0}' must be declared in an enclosing class.
|
||||
1111
|
||||
]
|
||||
}
|
||||
}]
|
||||
},
|
||||
node: {
|
||||
__dirname: false,
|
||||
__filename: false
|
||||
},
|
||||
optimization: {
|
||||
minimize: env.mode === 'production',
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
terserOptions: {
|
||||
keep_classnames: true,
|
||||
keep_fnames: true
|
||||
}
|
||||
})
|
||||
]
|
||||
},
|
||||
plugins
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -1,4 +0,0 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'browser',
|
||||
alwaysHasNode: true
|
||||
});
|
||||
@@ -1,4 +0,0 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'node',
|
||||
alwaysHasNode: true
|
||||
});
|
||||
@@ -1,4 +0,0 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'utility',
|
||||
alwaysHasNode: true
|
||||
});
|
||||
@@ -615,7 +615,11 @@ Returns `string` - The current application directory.
|
||||
by default is the `appData` directory appended with your app's name. By
|
||||
convention files storing user data should be written to this directory, and
|
||||
it is not recommended to write large files here because some environments
|
||||
may backup this directory to cloud storage.
|
||||
may backup this directory to cloud storage. It is recommended to store
|
||||
app-specific files within a subdirectory of `userData` (e.g.,
|
||||
`path.join(app.getPath('userData'), 'my-app-data')`) rather than directly
|
||||
in `userData` itself, to avoid naming conflicts with Chromium's own
|
||||
subdirectories (such as `Cache`, `GPUCache`, and `Local Storage`).
|
||||
* `sessionData` The directory for storing data generated by `Session`, such
|
||||
as localStorage, cookies, disk cache, downloaded dictionaries, network
|
||||
state, DevTools files. By default this points to `userData`. Chromium may
|
||||
|
||||
@@ -56,6 +56,9 @@ Returns `string` - The badge string of the dock.
|
||||
|
||||
Hides the dock icon.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Known issue:** Calling `dock.hide()` within one second of a previous call will have no effect. As a workaround, ensure at least one second has elapsed between calls — for example, by deferring with a `setTimeout` of 1100ms or more after a previous call.
|
||||
|
||||
#### `dock.show()` _macOS_
|
||||
|
||||
Returns `Promise<void>` - Resolves when the dock icon is shown.
|
||||
|
||||
@@ -86,12 +86,12 @@ app.whenReady().then(() => {
|
||||
* `body` string (optional) - The body text of the notification, which will be displayed below the title or subtitle.
|
||||
* `silent` boolean (optional) - Whether or not to suppress the OS notification noise when showing the notification.
|
||||
* `icon` (string | [NativeImage](native-image.md)) (optional) - An icon to use in the notification. 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_ _Windows_ - Whether or not to add an inline reply option to the notification.
|
||||
* `timeoutType` string (optional) _Linux_ _Windows_ - The timeout duration of the notification. Can be 'default' or 'never'.
|
||||
* `replyPlaceholder` string (optional) _macOS_ - The placeholder to write in the inline reply input field.
|
||||
* `replyPlaceholder` string (optional) _macOS_ _Windows_ - The placeholder to write in the inline reply input field.
|
||||
* `sound` string (optional) _macOS_ - The name of the sound file to play when the notification is shown.
|
||||
* `urgency` string (optional) _Linux_ _Windows_ - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
|
||||
* `actions` [NotificationAction[]](structures/notification-action.md) (optional) _macOS_ - Actions to add to the notification. Please read the available actions and limitations in the `NotificationAction` documentation.
|
||||
* `actions` [NotificationAction[]](structures/notification-action.md) (optional) _macOS_ _Windows_ - Actions to add to the notification. Please read the available actions and limitations in the `NotificationAction` documentation.
|
||||
* `closeButtonText` string (optional) _macOS_ - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.
|
||||
* `toastXml` string (optional) _Windows_ - A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.
|
||||
|
||||
|
||||
@@ -56,6 +56,15 @@ app.whenReady().then(() => {
|
||||
})
|
||||
```
|
||||
|
||||
## Protocol names
|
||||
|
||||
[RFC 3986](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) defines what a valid
|
||||
protocol name is:
|
||||
|
||||
> Scheme names consist of a sequence of characters beginning with a letter and followed
|
||||
> by any combination of letters, digits, plus ("+"), period ("."), or hyphen ("-").
|
||||
> Although schemes are case-insensitive, the canonical form is lowercase […].
|
||||
|
||||
## Methods
|
||||
|
||||
The `protocol` module has the following methods:
|
||||
|
||||
@@ -59,7 +59,12 @@ On Windows, returns true once the app has emitted the `ready` event.
|
||||
|
||||
### `safeStorage.isAsyncEncryptionAvailable()`
|
||||
|
||||
Returns `Promise<Boolean>` - Whether encryption is available for asynchronous safeStorage operations.
|
||||
Returns `Promise<boolean>` - Resolves with whether encryption is available for
|
||||
asynchronous safeStorage operations.
|
||||
|
||||
The asynchronous encryptor is initialized lazily the first time this method,
|
||||
`encryptStringAsync`, or `decryptStringAsync` is called after the app is ready.
|
||||
The returned promise resolves once initialization completes.
|
||||
|
||||
### `safeStorage.encryptString(plainText)`
|
||||
|
||||
|
||||
@@ -11,3 +11,5 @@
|
||||
* `stream` boolean (optional) - Default false.
|
||||
* `codeCache` boolean (optional) - Enable V8 code cache for the scheme, only
|
||||
works when `standard` is also set to true. Default false.
|
||||
* `allowExtensions` boolean (optional) - Allow Chrome extensions to be used
|
||||
on pages served over this protocol. Default false.
|
||||
|
||||
@@ -98,6 +98,9 @@ npm install electron --save-dev
|
||||
ELECTRON_INSTALL_PLATFORM=mas npx electron . --no
|
||||
```
|
||||
|
||||
This also means the `ELECTRON_SKIP_BINARY_DOWNLOAD` environment variable is no
|
||||
longer supported, as its primary purpose was to prevent the `postinstall` script from running.
|
||||
|
||||
### Removed: `quotas` object from `Session.clearStorageData(options)`
|
||||
|
||||
When calling `Session.clearStorageData(options)`, the `options.quotas` object is no longer supported because it has been
|
||||
|
||||
@@ -25,16 +25,6 @@ included in the `electron` package:
|
||||
npx install-electron --no
|
||||
```
|
||||
|
||||
If you want to install your project's dependencies but don't need to use
|
||||
Electron functionality, you can set the `ELECTRON_SKIP_BINARY_DOWNLOAD` environment
|
||||
variable to prevent the binary from being downloaded. For instance, this feature can
|
||||
be useful in continuous integration environments when running unit tests that mock
|
||||
out the `electron` module.
|
||||
|
||||
```sh
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install
|
||||
```
|
||||
|
||||
## Running Electron ad-hoc
|
||||
|
||||
If you're in a pinch and would prefer to not use `npm install` in your local
|
||||
|
||||
@@ -87,6 +87,13 @@ if (!gotTheLock) {
|
||||
// Create mainWindow, load the rest of the app, etc...
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
// Check for deep link on cold start
|
||||
if (process.argv.length >= 2) {
|
||||
const lastArg = process.argv[process.argv.length - 1]
|
||||
if (lastArg.startsWith('electron-fiddle://')) {
|
||||
dialog.showErrorBox('Welcome Back', `You arrived from: ${lastArg}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1097,7 +1097,8 @@ public:
|
||||
Napi::Function func = DefineClass(env, "CppLinuxAddon", {
|
||||
InstanceMethod("helloWorld", &CppAddon::HelloWorld),
|
||||
InstanceMethod("helloGui", &CppAddon::HelloGui),
|
||||
InstanceMethod("on", &CppAddon::On)
|
||||
InstanceMethod("on", &CppAddon::On),
|
||||
InstanceMethod("destroy", &CppAddon::Destroy)
|
||||
});
|
||||
|
||||
Napi::FunctionReference *constructor = new Napi::FunctionReference();
|
||||
@@ -1139,11 +1140,12 @@ private:
|
||||
|
||||
Here, we create a C++ class that inherits from `Napi::ObjectWrap<CppAddon>`:
|
||||
|
||||
`static Napi::Object Init` defines our JavaScript interface with three methods:
|
||||
`static Napi::Object Init` defines our JavaScript interface with four methods:
|
||||
|
||||
* `helloWorld`: A simple function to test the bridge
|
||||
* `helloGui`: The function to launch our GTK3 UI
|
||||
* `on`: A method to register event callbacks
|
||||
* `destroy`: A method to release all persistent references before app quit
|
||||
|
||||
The constructor initializes:
|
||||
|
||||
@@ -1354,7 +1356,8 @@ public:
|
||||
Napi::Function func = DefineClass(env, "CppLinuxAddon", {
|
||||
InstanceMethod("helloWorld", &CppAddon::HelloWorld),
|
||||
InstanceMethod("helloGui", &CppAddon::HelloGui),
|
||||
InstanceMethod("on", &CppAddon::On)
|
||||
InstanceMethod("on", &CppAddon::On),
|
||||
InstanceMethod("destroy", &CppAddon::Destroy)
|
||||
});
|
||||
|
||||
Napi::FunctionReference *constructor = new Napi::FunctionReference();
|
||||
@@ -1497,6 +1500,20 @@ private:
|
||||
callbacks.Value().Set(info[0].As<Napi::String>(), info[1].As<Napi::Function>());
|
||||
return env.Undefined();
|
||||
}
|
||||
|
||||
Napi::Value Destroy(const Napi::CallbackInfo &info)
|
||||
{
|
||||
callbacks.Reset();
|
||||
emitter.Reset();
|
||||
|
||||
if (tsfn_ != nullptr)
|
||||
{
|
||||
napi_release_threadsafe_function(tsfn_, napi_tsfn_abort);
|
||||
tsfn_ = nullptr;
|
||||
}
|
||||
|
||||
return info.Env().Undefined();
|
||||
}
|
||||
};
|
||||
|
||||
Napi::Object Init(Napi::Env env, Napi::Object exports)
|
||||
@@ -1547,6 +1564,10 @@ class CppLinuxAddon extends EventEmitter {
|
||||
return this.addon.helloGui()
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.addon.destroy()
|
||||
}
|
||||
|
||||
// Parse JSON and convert date to JavaScript Date object
|
||||
parse(payload) {
|
||||
const parsed = JSON.parse(payload)
|
||||
@@ -1569,8 +1590,12 @@ This wrapper:
|
||||
* Only loads on Linux platforms
|
||||
* Forwards events from C++ to JavaScript
|
||||
* Provides clean methods to call into C++
|
||||
* Provides a `destroy()` method to release native resources
|
||||
* Converts JSON data into proper JavaScript objects
|
||||
|
||||
> [!IMPORTANT]
|
||||
> You must call `destroy()` before the app quits (e.g. in the `will-quit` or `before-quit` event handler). Without this, persistent references to callbacks and the threadsafe function will prevent the native addon's destructor from running, causing Electron to hang on quit.
|
||||
|
||||
## 7) Building and testing the addon
|
||||
|
||||
With all files in place, you can build the addon:
|
||||
|
||||
@@ -1099,7 +1099,8 @@ static Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
||||
Napi::Function func = DefineClass(env, "CppWin32Addon", {
|
||||
InstanceMethod("helloWorld", &CppAddon::HelloWorld),
|
||||
InstanceMethod("helloGui", &CppAddon::HelloGui),
|
||||
InstanceMethod("on", &CppAddon::On)
|
||||
InstanceMethod("on", &CppAddon::On),
|
||||
InstanceMethod("destroy", &CppAddon::Destroy)
|
||||
});
|
||||
|
||||
// ... rest of Init function
|
||||
@@ -1117,9 +1118,21 @@ Napi::Value On(const Napi::CallbackInfo& info) {
|
||||
callbacks.Value().Set(info[0].As<Napi::String>(), info[1].As<Napi::Function>());
|
||||
return env.Undefined();
|
||||
}
|
||||
|
||||
Napi::Value Destroy(const Napi::CallbackInfo& info) {
|
||||
callbacks.Reset();
|
||||
emitter.Reset();
|
||||
|
||||
if (tsfn_ != nullptr) {
|
||||
napi_release_threadsafe_function(tsfn_, napi_tsfn_abort);
|
||||
tsfn_ = nullptr;
|
||||
}
|
||||
|
||||
return info.Env().Undefined();
|
||||
}
|
||||
```
|
||||
|
||||
This allows JavaScript to register callbacks for specific event types.
|
||||
This allows JavaScript to register callbacks for specific event types. The `Destroy` method releases all persistent references and aborts the threadsafe function, which must be called before the app quits to prevent the process from hanging.
|
||||
|
||||
### Putting the bridge together
|
||||
|
||||
@@ -1261,6 +1274,18 @@ private:
|
||||
callbacks.Value().Set(info[0].As<Napi::String>(), info[1].As<Napi::Function>());
|
||||
return env.Undefined();
|
||||
}
|
||||
|
||||
Napi::Value Destroy(const Napi::CallbackInfo& info) {
|
||||
callbacks.Reset();
|
||||
emitter.Reset();
|
||||
|
||||
if (tsfn_ != nullptr) {
|
||||
napi_release_threadsafe_function(tsfn_, napi_tsfn_abort);
|
||||
tsfn_ = nullptr;
|
||||
}
|
||||
|
||||
return info.Env().Undefined();
|
||||
}
|
||||
};
|
||||
|
||||
Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
||||
@@ -1309,6 +1334,10 @@ class CppWin32Addon extends EventEmitter {
|
||||
this.addon.helloGui()
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.addon.destroy()
|
||||
}
|
||||
|
||||
#parse(payload) {
|
||||
const parsed = JSON.parse(payload)
|
||||
|
||||
@@ -1323,6 +1352,9 @@ if (process.platform === 'win32') {
|
||||
}
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> You must call `destroy()` before the app quits (e.g. in the `will-quit` or `before-quit` event handler). Without this, persistent references to callbacks and the threadsafe function will prevent the native addon's destructor from running, causing Electron to hang on quit.
|
||||
|
||||
## 7) Building and Testing the Addon
|
||||
|
||||
With all files in place, you can build the addon:
|
||||
|
||||
@@ -753,7 +753,8 @@ public:
|
||||
Napi::Function func = DefineClass(env, "ObjcMacosAddon", {
|
||||
InstanceMethod("helloWorld", &ObjcAddon::HelloWorld),
|
||||
InstanceMethod("helloGui", &ObjcAddon::HelloGui),
|
||||
InstanceMethod("on", &ObjcAddon::On)
|
||||
InstanceMethod("on", &ObjcAddon::On),
|
||||
InstanceMethod("destroy", &ObjcAddon::Destroy)
|
||||
});
|
||||
|
||||
Napi::FunctionReference* constructor = new Napi::FunctionReference();
|
||||
@@ -915,6 +916,18 @@ Napi::Value On(const Napi::CallbackInfo& info) {
|
||||
callbacks.Value().Set(info[0].As<Napi::String>(), info[1].As<Napi::Function>());
|
||||
return env.Undefined();
|
||||
}
|
||||
|
||||
Napi::Value Destroy(const Napi::CallbackInfo& info) {
|
||||
callbacks.Reset();
|
||||
emitter.Reset();
|
||||
|
||||
if (tsfn_ != nullptr) {
|
||||
napi_release_threadsafe_function(tsfn_, napi_tsfn_abort);
|
||||
tsfn_ = nullptr;
|
||||
}
|
||||
|
||||
return info.Env().Undefined();
|
||||
}
|
||||
```
|
||||
|
||||
Let's take a look at what we've added in this step:
|
||||
@@ -922,10 +935,11 @@ Let's take a look at what we've added in this step:
|
||||
* `HelloWorld()`: Takes a string input, calls our Objective-C function, and returns the result
|
||||
* `HelloGui()`: A simple wrapper around the Objective-C `hello_gui` function
|
||||
* `On`: Allows JavaScript to register event listeners that will be called when native events occur
|
||||
* `Destroy`: Releases all persistent references (callbacks and emitter) and aborts the threadsafe function, allowing the addon to be properly cleaned up on quit
|
||||
|
||||
The `On` method is particularly important as it creates the event system that our JavaScript code will use to receive notifications from the native UI.
|
||||
|
||||
Together, these three components form a complete bridge between our Objective-C code and the JavaScript world, allowing bidirectional communication. Here's what the finished file should look like:
|
||||
Together, these four components form a complete bridge between our Objective-C code and the JavaScript world, allowing bidirectional communication. Here's what the finished file should look like:
|
||||
|
||||
```objc title='src/objc_addon.mm'
|
||||
#include <napi.h>
|
||||
@@ -938,7 +952,8 @@ public:
|
||||
Napi::Function func = DefineClass(env, "ObjcMacosAddon", {
|
||||
InstanceMethod("helloWorld", &ObjcAddon::HelloWorld),
|
||||
InstanceMethod("helloGui", &ObjcAddon::HelloGui),
|
||||
InstanceMethod("on", &ObjcAddon::On)
|
||||
InstanceMethod("on", &ObjcAddon::On),
|
||||
InstanceMethod("destroy", &ObjcAddon::Destroy)
|
||||
});
|
||||
|
||||
Napi::FunctionReference* constructor = new Napi::FunctionReference();
|
||||
@@ -1061,6 +1076,18 @@ private:
|
||||
callbacks.Value().Set(info[0].As<Napi::String>(), info[1].As<Napi::Function>());
|
||||
return env.Undefined();
|
||||
}
|
||||
|
||||
Napi::Value Destroy(const Napi::CallbackInfo& info) {
|
||||
callbacks.Reset();
|
||||
emitter.Reset();
|
||||
|
||||
if (tsfn_ != nullptr) {
|
||||
napi_release_threadsafe_function(tsfn_, napi_tsfn_abort);
|
||||
tsfn_ = nullptr;
|
||||
}
|
||||
|
||||
return info.Env().Undefined();
|
||||
}
|
||||
};
|
||||
|
||||
Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
||||
@@ -1101,6 +1128,10 @@ class ObjcMacosAddon extends EventEmitter {
|
||||
this.addon.helloGui()
|
||||
}
|
||||
|
||||
destroy () {
|
||||
this.addon.destroy()
|
||||
}
|
||||
|
||||
parse (payload) {
|
||||
const parsed = JSON.parse(payload)
|
||||
|
||||
@@ -1122,7 +1153,11 @@ This wrapper:
|
||||
3. Loads the native addon
|
||||
4. Sets up event listeners and forwards them
|
||||
5. Provides a clean API for our functions
|
||||
6. Parses JSON payloads and converts timestamps to JavaScript Date objects
|
||||
6. Provides a `destroy()` method to release native resources
|
||||
7. Parses JSON payloads and converts timestamps to JavaScript Date objects
|
||||
|
||||
> [!IMPORTANT]
|
||||
> You must call `destroy()` before the app quits (e.g. in the `will-quit` or `before-quit` event handler). Without this, persistent references to callbacks and the threadsafe function will prevent the native addon's destructor from running, causing Electron to hang on quit.
|
||||
|
||||
## 7) Building and Testing the Addon
|
||||
|
||||
|
||||
@@ -752,7 +752,8 @@ public:
|
||||
Napi::Function func = DefineClass(env, "SwiftAddon", {
|
||||
InstanceMethod("helloWorld", &SwiftAddon::HelloWorld),
|
||||
InstanceMethod("helloGui", &SwiftAddon::HelloGui),
|
||||
InstanceMethod("on", &SwiftAddon::On)
|
||||
InstanceMethod("on", &SwiftAddon::On),
|
||||
InstanceMethod("destroy", &SwiftAddon::Destroy)
|
||||
});
|
||||
|
||||
Napi::FunctionReference* constructor = new Napi::FunctionReference();
|
||||
@@ -770,7 +771,7 @@ This first part:
|
||||
|
||||
1. Defines a C++ class that inherits from `Napi::ObjectWrap`
|
||||
2. Creates a static `Init` method to register our class with Node.js
|
||||
3. Defines three methods: `helloWorld`, `helloGui`, and `on`
|
||||
3. Defines four methods: `helloWorld`, `helloGui`, `on`, and `destroy`
|
||||
|
||||
### Callback Mechanism
|
||||
|
||||
@@ -919,6 +920,18 @@ private:
|
||||
callbacks.Value().Set(info[0].As<Napi::String>(), info[1].As<Napi::Function>());
|
||||
return env.Undefined();
|
||||
}
|
||||
|
||||
Napi::Value Destroy(const Napi::CallbackInfo& info) {
|
||||
callbacks.Reset();
|
||||
emitter.Reset();
|
||||
|
||||
if (tsfn_ != nullptr) {
|
||||
napi_release_threadsafe_function(tsfn_, napi_tsfn_abort);
|
||||
tsfn_ = nullptr;
|
||||
}
|
||||
|
||||
return info.Env().Undefined();
|
||||
}
|
||||
};
|
||||
|
||||
Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
||||
@@ -934,7 +947,8 @@ This final part does multiple things:
|
||||
2. The HelloWorld method implementation takes a string input from JavaScript, passes it to the Swift code, and returns the processed result back to the JavaScript environment.
|
||||
3. The `HelloGui` method implementation provides a simple wrapper that calls the Swift UI creation function to display the native macOS window.
|
||||
4. The `On` method implementation allows JavaScript code to register callback functions that will be invoked when specific events occur in the native Swift code.
|
||||
5. The code sets up the module initialization process that registers the addon with Node.js and makes its functionality available to JavaScript.
|
||||
5. The `Destroy` method releases all persistent references (callbacks and emitter) and aborts the threadsafe function. This must be called before the app quits to allow the destructor to run and prevent the process from hanging.
|
||||
6. The code sets up the module initialization process that registers the addon with Node.js and makes its functionality available to JavaScript.
|
||||
|
||||
The final and full `src/swift_addon.mm` should look like:
|
||||
|
||||
@@ -949,7 +963,8 @@ public:
|
||||
Napi::Function func = DefineClass(env, "SwiftAddon", {
|
||||
InstanceMethod("helloWorld", &SwiftAddon::HelloWorld),
|
||||
InstanceMethod("helloGui", &SwiftAddon::HelloGui),
|
||||
InstanceMethod("on", &SwiftAddon::On)
|
||||
InstanceMethod("on", &SwiftAddon::On),
|
||||
InstanceMethod("destroy", &SwiftAddon::Destroy)
|
||||
});
|
||||
|
||||
Napi::FunctionReference* constructor = new Napi::FunctionReference();
|
||||
@@ -1074,6 +1089,18 @@ private:
|
||||
callbacks.Value().Set(info[0].As<Napi::String>(), info[1].As<Napi::Function>());
|
||||
return env.Undefined();
|
||||
}
|
||||
|
||||
Napi::Value Destroy(const Napi::CallbackInfo& info) {
|
||||
callbacks.Reset();
|
||||
emitter.Reset();
|
||||
|
||||
if (tsfn_ != nullptr) {
|
||||
napi_release_threadsafe_function(tsfn_, napi_tsfn_abort);
|
||||
tsfn_ = nullptr;
|
||||
}
|
||||
|
||||
return info.Env().Undefined();
|
||||
}
|
||||
};
|
||||
|
||||
Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
||||
@@ -1122,6 +1149,10 @@ class SwiftAddon extends EventEmitter {
|
||||
this.addon.helloGui()
|
||||
}
|
||||
|
||||
destroy () {
|
||||
this.addon.destroy()
|
||||
}
|
||||
|
||||
parse (payload) {
|
||||
const parsed = JSON.parse(payload)
|
||||
|
||||
@@ -1143,7 +1174,11 @@ This wrapper:
|
||||
3. Loads the native addon
|
||||
4. Sets up event listeners and forwards them
|
||||
5. Provides a clean API for our functions
|
||||
6. Parses JSON payloads and converts timestamps to JavaScript Date objects
|
||||
6. Provides a `destroy()` method to release native resources
|
||||
7. Parses JSON payloads and converts timestamps to JavaScript Date objects
|
||||
|
||||
> [!IMPORTANT]
|
||||
> You must call `destroy()` before the app quits (e.g. in the `will-quit` or `before-quit` event handler). Without this, persistent references to callbacks and the threadsafe function will prevent the native addon's destructor from running, causing Electron to hang on quit.
|
||||
|
||||
## 7) Building and Testing the Addon
|
||||
|
||||
|
||||
@@ -174,62 +174,10 @@ auto_filenames = {
|
||||
"docs/api/structures/window-session-end-event.md",
|
||||
]
|
||||
|
||||
sandbox_bundle_deps = [
|
||||
"lib/common/api/native-image.ts",
|
||||
"lib/common/define-properties.ts",
|
||||
"lib/common/deprecate.ts",
|
||||
"lib/common/ipc-messages.ts",
|
||||
"lib/common/timers-shim.ts",
|
||||
"lib/common/web-view-methods.ts",
|
||||
"lib/common/webpack-globals-provider.ts",
|
||||
"lib/renderer/api/context-bridge.ts",
|
||||
"lib/renderer/api/crash-reporter.ts",
|
||||
"lib/renderer/api/ipc-renderer.ts",
|
||||
"lib/renderer/api/shared-texture.ts",
|
||||
"lib/renderer/api/web-frame.ts",
|
||||
"lib/renderer/api/web-utils.ts",
|
||||
"lib/renderer/common-init.ts",
|
||||
"lib/renderer/inspector.ts",
|
||||
"lib/renderer/ipc-native-setup.ts",
|
||||
"lib/renderer/ipc-renderer-bindings.ts",
|
||||
"lib/renderer/ipc-renderer-internal-utils.ts",
|
||||
"lib/renderer/ipc-renderer-internal.ts",
|
||||
"lib/renderer/security-warnings.ts",
|
||||
"lib/renderer/web-frame-init.ts",
|
||||
"lib/renderer/web-view/guest-view-internal.ts",
|
||||
"lib/renderer/web-view/web-view-attributes.ts",
|
||||
"lib/renderer/web-view/web-view-constants.ts",
|
||||
"lib/renderer/web-view/web-view-element.ts",
|
||||
"lib/renderer/web-view/web-view-impl.ts",
|
||||
"lib/renderer/web-view/web-view-init.ts",
|
||||
"lib/renderer/window-setup.ts",
|
||||
"lib/sandboxed_renderer/api/exports/electron.ts",
|
||||
"lib/sandboxed_renderer/api/module-list.ts",
|
||||
"lib/sandboxed_renderer/init.ts",
|
||||
"lib/sandboxed_renderer/pre-init.ts",
|
||||
"lib/sandboxed_renderer/preload.ts",
|
||||
"package.json",
|
||||
"tsconfig.electron.json",
|
||||
"tsconfig.json",
|
||||
"typings/internal-ambient.d.ts",
|
||||
"typings/internal-electron.d.ts",
|
||||
]
|
||||
|
||||
isolated_bundle_deps = [
|
||||
"lib/common/web-view-methods.ts",
|
||||
"lib/isolated_renderer/init.ts",
|
||||
"lib/renderer/web-view/web-view-attributes.ts",
|
||||
"lib/renderer/web-view/web-view-constants.ts",
|
||||
"lib/renderer/web-view/web-view-element.ts",
|
||||
"lib/renderer/web-view/web-view-impl.ts",
|
||||
"package.json",
|
||||
"tsconfig.electron.json",
|
||||
"tsconfig.json",
|
||||
"typings/internal-ambient.d.ts",
|
||||
"typings/internal-electron.d.ts",
|
||||
]
|
||||
|
||||
browser_bundle_deps = [
|
||||
typecheck_sources = [
|
||||
"build/esbuild/shims/browser-globals-shim.js",
|
||||
"build/esbuild/shims/node-globals-shim.js",
|
||||
"build/esbuild/shims/promise-shim.js",
|
||||
"lib/browser/api/app.ts",
|
||||
"lib/browser/api/auto-updater.ts",
|
||||
"lib/browser/api/auto-updater/auto-updater-msix.ts",
|
||||
@@ -300,8 +248,189 @@ auto_filenames = {
|
||||
"lib/common/deprecate.ts",
|
||||
"lib/common/init.ts",
|
||||
"lib/common/ipc-messages.ts",
|
||||
"lib/common/timers-shim.ts",
|
||||
"lib/common/web-view-methods.ts",
|
||||
"lib/isolated_renderer/init.ts",
|
||||
"lib/node/asar-fs-wrapper.ts",
|
||||
"lib/node/init.ts",
|
||||
"lib/preload_realm/api/exports/electron.ts",
|
||||
"lib/preload_realm/api/module-list.ts",
|
||||
"lib/preload_realm/init.ts",
|
||||
"lib/renderer/api/clipboard.ts",
|
||||
"lib/renderer/api/context-bridge.ts",
|
||||
"lib/renderer/api/crash-reporter.ts",
|
||||
"lib/renderer/api/exports/electron.ts",
|
||||
"lib/renderer/api/ipc-renderer.ts",
|
||||
"lib/renderer/api/module-list.ts",
|
||||
"lib/renderer/api/shared-texture.ts",
|
||||
"lib/renderer/api/web-frame.ts",
|
||||
"lib/renderer/api/web-utils.ts",
|
||||
"lib/renderer/common-init.ts",
|
||||
"lib/renderer/init.ts",
|
||||
"lib/renderer/inspector.ts",
|
||||
"lib/renderer/ipc-native-setup.ts",
|
||||
"lib/renderer/ipc-renderer-bindings.ts",
|
||||
"lib/renderer/ipc-renderer-internal-utils.ts",
|
||||
"lib/renderer/ipc-renderer-internal.ts",
|
||||
"lib/renderer/security-warnings.ts",
|
||||
"lib/renderer/web-frame-init.ts",
|
||||
"lib/renderer/web-view/guest-view-internal.ts",
|
||||
"lib/renderer/web-view/web-view-attributes.ts",
|
||||
"lib/renderer/web-view/web-view-constants.ts",
|
||||
"lib/renderer/web-view/web-view-element.ts",
|
||||
"lib/renderer/web-view/web-view-impl.ts",
|
||||
"lib/renderer/web-view/web-view-init.ts",
|
||||
"lib/renderer/window-setup.ts",
|
||||
"lib/sandboxed_renderer/api/exports/electron.ts",
|
||||
"lib/sandboxed_renderer/api/module-list.ts",
|
||||
"lib/sandboxed_renderer/init.ts",
|
||||
"lib/sandboxed_renderer/pre-init.ts",
|
||||
"lib/sandboxed_renderer/preload.ts",
|
||||
"lib/utility/api/exports/electron.ts",
|
||||
"lib/utility/api/module-list.ts",
|
||||
"lib/utility/api/net.ts",
|
||||
"lib/utility/init.ts",
|
||||
"lib/utility/parent-port.ts",
|
||||
"lib/worker/init.ts",
|
||||
"package.json",
|
||||
"tsconfig.electron.json",
|
||||
"tsconfig.json",
|
||||
"typings/internal-ambient.d.ts",
|
||||
"typings/internal-electron.d.ts",
|
||||
]
|
||||
|
||||
sandbox_bundle_deps = [
|
||||
"build/esbuild/shims/browser-globals-shim.js",
|
||||
"build/esbuild/shims/promise-shim.js",
|
||||
"lib/common/api/native-image.ts",
|
||||
"lib/common/define-properties.ts",
|
||||
"lib/common/deprecate.ts",
|
||||
"lib/common/ipc-messages.ts",
|
||||
"lib/common/timers-shim.ts",
|
||||
"lib/common/web-view-methods.ts",
|
||||
"lib/renderer/api/context-bridge.ts",
|
||||
"lib/renderer/api/crash-reporter.ts",
|
||||
"lib/renderer/api/ipc-renderer.ts",
|
||||
"lib/renderer/api/shared-texture.ts",
|
||||
"lib/renderer/api/web-frame.ts",
|
||||
"lib/renderer/api/web-utils.ts",
|
||||
"lib/renderer/common-init.ts",
|
||||
"lib/renderer/inspector.ts",
|
||||
"lib/renderer/ipc-native-setup.ts",
|
||||
"lib/renderer/ipc-renderer-bindings.ts",
|
||||
"lib/renderer/ipc-renderer-internal-utils.ts",
|
||||
"lib/renderer/ipc-renderer-internal.ts",
|
||||
"lib/renderer/security-warnings.ts",
|
||||
"lib/renderer/web-frame-init.ts",
|
||||
"lib/renderer/web-view/guest-view-internal.ts",
|
||||
"lib/renderer/web-view/web-view-attributes.ts",
|
||||
"lib/renderer/web-view/web-view-constants.ts",
|
||||
"lib/renderer/web-view/web-view-element.ts",
|
||||
"lib/renderer/web-view/web-view-impl.ts",
|
||||
"lib/renderer/web-view/web-view-init.ts",
|
||||
"lib/renderer/window-setup.ts",
|
||||
"lib/sandboxed_renderer/api/exports/electron.ts",
|
||||
"lib/sandboxed_renderer/api/module-list.ts",
|
||||
"lib/sandboxed_renderer/init.ts",
|
||||
"lib/sandboxed_renderer/pre-init.ts",
|
||||
"lib/sandboxed_renderer/preload.ts",
|
||||
"package.json",
|
||||
"tsconfig.electron.json",
|
||||
"tsconfig.json",
|
||||
"typings/internal-ambient.d.ts",
|
||||
"typings/internal-electron.d.ts",
|
||||
]
|
||||
|
||||
isolated_bundle_deps = [
|
||||
"build/esbuild/shims/browser-globals-shim.js",
|
||||
"build/esbuild/shims/promise-shim.js",
|
||||
"lib/common/web-view-methods.ts",
|
||||
"lib/isolated_renderer/init.ts",
|
||||
"lib/renderer/web-view/web-view-attributes.ts",
|
||||
"lib/renderer/web-view/web-view-constants.ts",
|
||||
"lib/renderer/web-view/web-view-element.ts",
|
||||
"lib/renderer/web-view/web-view-impl.ts",
|
||||
"package.json",
|
||||
"tsconfig.electron.json",
|
||||
"tsconfig.json",
|
||||
"typings/internal-ambient.d.ts",
|
||||
"typings/internal-electron.d.ts",
|
||||
]
|
||||
|
||||
browser_bundle_deps = [
|
||||
"build/esbuild/shims/promise-shim.js",
|
||||
"lib/browser/api/app.ts",
|
||||
"lib/browser/api/auto-updater.ts",
|
||||
"lib/browser/api/auto-updater/auto-updater-msix.ts",
|
||||
"lib/browser/api/auto-updater/auto-updater-native.ts",
|
||||
"lib/browser/api/auto-updater/auto-updater-win.ts",
|
||||
"lib/browser/api/auto-updater/msix-update-win.ts",
|
||||
"lib/browser/api/auto-updater/squirrel-update-win.ts",
|
||||
"lib/browser/api/base-window.ts",
|
||||
"lib/browser/api/browser-view.ts",
|
||||
"lib/browser/api/browser-window.ts",
|
||||
"lib/browser/api/clipboard.ts",
|
||||
"lib/browser/api/content-tracing.ts",
|
||||
"lib/browser/api/crash-reporter.ts",
|
||||
"lib/browser/api/desktop-capturer.ts",
|
||||
"lib/browser/api/dialog.ts",
|
||||
"lib/browser/api/exports/electron.ts",
|
||||
"lib/browser/api/global-shortcut.ts",
|
||||
"lib/browser/api/in-app-purchase.ts",
|
||||
"lib/browser/api/ipc-main.ts",
|
||||
"lib/browser/api/menu-item-roles.ts",
|
||||
"lib/browser/api/menu-item.ts",
|
||||
"lib/browser/api/menu-utils.ts",
|
||||
"lib/browser/api/menu.ts",
|
||||
"lib/browser/api/message-channel.ts",
|
||||
"lib/browser/api/module-list.ts",
|
||||
"lib/browser/api/native-theme.ts",
|
||||
"lib/browser/api/net-fetch.ts",
|
||||
"lib/browser/api/net-log.ts",
|
||||
"lib/browser/api/net.ts",
|
||||
"lib/browser/api/notification.ts",
|
||||
"lib/browser/api/power-monitor.ts",
|
||||
"lib/browser/api/power-save-blocker.ts",
|
||||
"lib/browser/api/protocol.ts",
|
||||
"lib/browser/api/push-notifications.ts",
|
||||
"lib/browser/api/safe-storage.ts",
|
||||
"lib/browser/api/screen.ts",
|
||||
"lib/browser/api/service-worker-main.ts",
|
||||
"lib/browser/api/session.ts",
|
||||
"lib/browser/api/share-menu.ts",
|
||||
"lib/browser/api/shared-texture.ts",
|
||||
"lib/browser/api/system-preferences.ts",
|
||||
"lib/browser/api/touch-bar.ts",
|
||||
"lib/browser/api/tray.ts",
|
||||
"lib/browser/api/utility-process.ts",
|
||||
"lib/browser/api/view.ts",
|
||||
"lib/browser/api/views/image-view.ts",
|
||||
"lib/browser/api/web-contents-view.ts",
|
||||
"lib/browser/api/web-contents.ts",
|
||||
"lib/browser/api/web-frame-main.ts",
|
||||
"lib/browser/default-menu.ts",
|
||||
"lib/browser/devtools.ts",
|
||||
"lib/browser/guest-view-manager.ts",
|
||||
"lib/browser/guest-window-manager.ts",
|
||||
"lib/browser/init.ts",
|
||||
"lib/browser/ipc-dispatch.ts",
|
||||
"lib/browser/ipc-main-impl.ts",
|
||||
"lib/browser/ipc-main-internal-utils.ts",
|
||||
"lib/browser/ipc-main-internal.ts",
|
||||
"lib/browser/message-port-main.ts",
|
||||
"lib/browser/parse-features-string.ts",
|
||||
"lib/browser/rpc-server.ts",
|
||||
"lib/browser/web-view-events.ts",
|
||||
"lib/common/api/module-list.ts",
|
||||
"lib/common/api/native-image.ts",
|
||||
"lib/common/api/net-client-request.ts",
|
||||
"lib/common/api/shell.ts",
|
||||
"lib/common/define-properties.ts",
|
||||
"lib/common/deprecate.ts",
|
||||
"lib/common/init.ts",
|
||||
"lib/common/ipc-messages.ts",
|
||||
"lib/common/timers-shim.ts",
|
||||
"lib/common/web-view-methods.ts",
|
||||
"lib/common/webpack-globals-provider.ts",
|
||||
"package.json",
|
||||
"tsconfig.electron.json",
|
||||
"tsconfig.json",
|
||||
@@ -310,6 +439,8 @@ auto_filenames = {
|
||||
]
|
||||
|
||||
renderer_bundle_deps = [
|
||||
"build/esbuild/shims/node-globals-shim.js",
|
||||
"build/esbuild/shims/promise-shim.js",
|
||||
"lib/common/api/module-list.ts",
|
||||
"lib/common/api/native-image.ts",
|
||||
"lib/common/api/shell.ts",
|
||||
@@ -317,8 +448,8 @@ auto_filenames = {
|
||||
"lib/common/deprecate.ts",
|
||||
"lib/common/init.ts",
|
||||
"lib/common/ipc-messages.ts",
|
||||
"lib/common/timers-shim.ts",
|
||||
"lib/common/web-view-methods.ts",
|
||||
"lib/common/webpack-provider.ts",
|
||||
"lib/renderer/api/clipboard.ts",
|
||||
"lib/renderer/api/context-bridge.ts",
|
||||
"lib/renderer/api/crash-reporter.ts",
|
||||
@@ -352,6 +483,8 @@ auto_filenames = {
|
||||
]
|
||||
|
||||
worker_bundle_deps = [
|
||||
"build/esbuild/shims/node-globals-shim.js",
|
||||
"build/esbuild/shims/promise-shim.js",
|
||||
"lib/common/api/module-list.ts",
|
||||
"lib/common/api/native-image.ts",
|
||||
"lib/common/api/shell.ts",
|
||||
@@ -359,7 +492,7 @@ auto_filenames = {
|
||||
"lib/common/deprecate.ts",
|
||||
"lib/common/init.ts",
|
||||
"lib/common/ipc-messages.ts",
|
||||
"lib/common/webpack-provider.ts",
|
||||
"lib/common/timers-shim.ts",
|
||||
"lib/renderer/api/clipboard.ts",
|
||||
"lib/renderer/api/context-bridge.ts",
|
||||
"lib/renderer/api/crash-reporter.ts",
|
||||
@@ -381,6 +514,7 @@ auto_filenames = {
|
||||
]
|
||||
|
||||
node_bundle_deps = [
|
||||
"build/esbuild/shims/promise-shim.js",
|
||||
"lib/node/asar-fs-wrapper.ts",
|
||||
"lib/node/init.ts",
|
||||
"package.json",
|
||||
@@ -391,6 +525,7 @@ auto_filenames = {
|
||||
]
|
||||
|
||||
utility_bundle_deps = [
|
||||
"build/esbuild/shims/promise-shim.js",
|
||||
"lib/browser/api/net-fetch.ts",
|
||||
"lib/browser/api/system-preferences.ts",
|
||||
"lib/browser/message-port-main.ts",
|
||||
@@ -398,7 +533,7 @@ auto_filenames = {
|
||||
"lib/common/define-properties.ts",
|
||||
"lib/common/deprecate.ts",
|
||||
"lib/common/init.ts",
|
||||
"lib/common/webpack-globals-provider.ts",
|
||||
"lib/common/timers-shim.ts",
|
||||
"lib/utility/api/exports/electron.ts",
|
||||
"lib/utility/api/module-list.ts",
|
||||
"lib/utility/api/net.ts",
|
||||
@@ -412,10 +547,11 @@ auto_filenames = {
|
||||
]
|
||||
|
||||
preload_realm_bundle_deps = [
|
||||
"build/esbuild/shims/browser-globals-shim.js",
|
||||
"build/esbuild/shims/promise-shim.js",
|
||||
"lib/common/api/native-image.ts",
|
||||
"lib/common/define-properties.ts",
|
||||
"lib/common/ipc-messages.ts",
|
||||
"lib/common/webpack-globals-provider.ts",
|
||||
"lib/preload_realm/api/exports/electron.ts",
|
||||
"lib/preload_realm/api/module-list.ts",
|
||||
"lib/preload_realm/init.ts",
|
||||
|
||||
@@ -793,8 +793,6 @@ filenames = {
|
||||
"shell/browser/extensions/electron_kiosk_delegate.h",
|
||||
"shell/browser/extensions/electron_messaging_delegate.cc",
|
||||
"shell/browser/extensions/electron_messaging_delegate.h",
|
||||
"shell/browser/extensions/electron_navigation_ui_data.cc",
|
||||
"shell/browser/extensions/electron_navigation_ui_data.h",
|
||||
"shell/browser/extensions/electron_process_manager_delegate.cc",
|
||||
"shell/browser/extensions/electron_process_manager_delegate.h",
|
||||
"shell/common/extensions/electron_extensions_api_provider.cc",
|
||||
|
||||
@@ -5,23 +5,27 @@ import type { ClientRequestConstructorOptions } from 'electron/main';
|
||||
|
||||
const { isOnline } = process._linkedBinding('electron_common_net');
|
||||
|
||||
export function request (options: ClientRequestConstructorOptions | string, callback?: (message: IncomingMessage) => void) {
|
||||
function request (options: ClientRequestConstructorOptions | string, callback?: (message: IncomingMessage) => void) {
|
||||
if (!app.isReady()) {
|
||||
throw new Error('net module can only be used after app is ready');
|
||||
}
|
||||
return new ClientRequest(options, callback);
|
||||
}
|
||||
|
||||
export function fetch (input: RequestInfo, init?: RequestInit): Promise<Response> {
|
||||
function fetch (input: RequestInfo, init?: RequestInit): Promise<Response> {
|
||||
return session.defaultSession.fetch(input, init);
|
||||
}
|
||||
|
||||
export function resolveHost (host: string, options?: Electron.ResolveHostOptions): Promise<Electron.ResolvedHost> {
|
||||
function resolveHost (host: string, options?: Electron.ResolveHostOptions): Promise<Electron.ResolvedHost> {
|
||||
return session.defaultSession.resolveHost(host, options);
|
||||
}
|
||||
|
||||
exports.isOnline = isOnline;
|
||||
|
||||
Object.defineProperty(exports, 'online', {
|
||||
get: () => isOnline()
|
||||
});
|
||||
module.exports = {
|
||||
request,
|
||||
fetch,
|
||||
resolveHost,
|
||||
isOnline,
|
||||
get online () {
|
||||
return isOnline();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,11 +17,6 @@ export type WindowOpenArgs = {
|
||||
features: string,
|
||||
}
|
||||
|
||||
const frameNamesToWindow = new Map<string, WebContents>();
|
||||
const registerFrameNameToGuestWindow = (name: string, webContents: WebContents) => frameNamesToWindow.set(name, webContents);
|
||||
const unregisterFrameName = (name: string) => frameNamesToWindow.delete(name);
|
||||
const getGuestWebContentsByFrameName = (name: string) => frameNamesToWindow.get(name);
|
||||
|
||||
/**
|
||||
* `openGuestWindow` is called to create and setup event handling for the new
|
||||
* window.
|
||||
@@ -47,20 +42,6 @@ export function openGuestWindow ({ embedder, guest, referrer, disposition, postD
|
||||
...overrideBrowserWindowOptions
|
||||
};
|
||||
|
||||
// To spec, subsequent window.open calls with the same frame name (`target` in
|
||||
// spec parlance) will reuse the previous window.
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#apis-for-creating-and-navigating-browsing-contexts-by-name
|
||||
const existingWebContents = getGuestWebContentsByFrameName(frameName);
|
||||
if (existingWebContents) {
|
||||
if (existingWebContents.isDestroyed()) {
|
||||
// FIXME(t57ser): The webContents is destroyed for some reason, unregister the frame name
|
||||
unregisterFrameName(frameName);
|
||||
} else {
|
||||
existingWebContents.loadURL(url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (createWindow) {
|
||||
const webContents = createWindow({
|
||||
webContents: guest,
|
||||
@@ -72,7 +53,7 @@ export function openGuestWindow ({ embedder, guest, referrer, disposition, postD
|
||||
throw new Error('Invalid webContents. Created window should be connected to webContents passed with options object.');
|
||||
}
|
||||
|
||||
handleWindowLifecycleEvents({ embedder, frameName, guest, outlivesOpener });
|
||||
handleWindowLifecycleEvents({ embedder, guest, outlivesOpener });
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -96,7 +77,7 @@ export function openGuestWindow ({ embedder, guest, referrer, disposition, postD
|
||||
});
|
||||
}
|
||||
|
||||
handleWindowLifecycleEvents({ embedder, frameName, guest: window.webContents, outlivesOpener });
|
||||
handleWindowLifecycleEvents({ embedder, guest: window.webContents, outlivesOpener });
|
||||
|
||||
embedder.emit('did-create-window', window, { url, frameName, options: browserWindowOptions, disposition, referrer, postData });
|
||||
}
|
||||
@@ -107,10 +88,9 @@ export function openGuestWindow ({ embedder, guest, referrer, disposition, postD
|
||||
* too is the guest destroyed; this is Electron convention and isn't based in
|
||||
* browser behavior.
|
||||
*/
|
||||
const handleWindowLifecycleEvents = function ({ embedder, guest, frameName, outlivesOpener }: {
|
||||
const handleWindowLifecycleEvents = function ({ embedder, guest, outlivesOpener }: {
|
||||
embedder: WebContents,
|
||||
guest: WebContents,
|
||||
frameName: string,
|
||||
outlivesOpener: boolean
|
||||
}) {
|
||||
const closedByEmbedder = function () {
|
||||
@@ -128,13 +108,6 @@ const handleWindowLifecycleEvents = function ({ embedder, guest, frameName, outl
|
||||
embedder.once('current-render-view-deleted' as any, closedByEmbedder);
|
||||
}
|
||||
guest.once('destroyed', closedByUser);
|
||||
|
||||
if (frameName) {
|
||||
registerFrameNameToGuestWindow(frameName, guest);
|
||||
guest.once('destroyed', function () {
|
||||
unregisterFrameName(frameName);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Security options that child windows will always inherit from parent windows
|
||||
|
||||
@@ -181,7 +181,7 @@ delete process.appCodeLoaded;
|
||||
if (packagePath) {
|
||||
// Finally load app's main.js and transfer control to C++.
|
||||
if ((packageJson.type === 'module' && !mainStartupScript.endsWith('.cjs')) || mainStartupScript.endsWith('.mjs')) {
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
|
||||
const main = (require('url') as typeof url).pathToFileURL(path.join(packagePath, mainStartupScript));
|
||||
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
|
||||
try {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import timers = require('timers');
|
||||
import * as timers from 'timers';
|
||||
import * as util from 'util';
|
||||
|
||||
import type * as stream from 'stream';
|
||||
@@ -41,15 +41,15 @@ function wrap <T extends AnyFn> (func: T, wrapper: (fn: AnyFn) => T) {
|
||||
// initiatively activate the uv loop once process.nextTick and setImmediate is
|
||||
// called.
|
||||
process.nextTick = wrapWithActivateUvLoop(process.nextTick);
|
||||
global.setImmediate = timers.setImmediate = wrapWithActivateUvLoop(timers.setImmediate);
|
||||
global.setImmediate = wrapWithActivateUvLoop(timers.setImmediate);
|
||||
global.clearImmediate = timers.clearImmediate;
|
||||
|
||||
// setTimeout needs to update the polling timeout of the event loop, when
|
||||
// called under Chromium's event loop the node's event loop won't get a chance
|
||||
// to update the timeout, so we have to force the node's event loop to
|
||||
// recalculate the timeout in the process.
|
||||
timers.setTimeout = wrapWithActivateUvLoop(timers.setTimeout);
|
||||
timers.setInterval = wrapWithActivateUvLoop(timers.setInterval);
|
||||
const wrappedSetTimeout = wrapWithActivateUvLoop(timers.setTimeout);
|
||||
const wrappedSetInterval = wrapWithActivateUvLoop(timers.setInterval);
|
||||
|
||||
// Update the global version of the timer apis to use the above wrapper
|
||||
// only in the process that runs node event loop alongside chromium
|
||||
@@ -57,8 +57,8 @@ timers.setInterval = wrapWithActivateUvLoop(timers.setInterval);
|
||||
// are deleted in these processes, see renderer/init.js for reference.
|
||||
if (process.type === 'browser' ||
|
||||
process.type === 'utility') {
|
||||
global.setTimeout = timers.setTimeout;
|
||||
global.setInterval = timers.setInterval;
|
||||
global.setTimeout = wrappedSetTimeout;
|
||||
global.setInterval = wrappedSetInterval;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Drop-in replacement for timers-browserify@1.4.2.
|
||||
// Provides the Node.js 'timers' API surface for renderer/web webpack bundles
|
||||
// Provides the Node.js 'timers' API surface for renderer/web bundles
|
||||
// without relying on window.postMessage (which the newer timers-browserify 2.x
|
||||
// polyfill uses and can interfere with Electron IPC).
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
// Captures original globals into a scope to ensure that userland modifications do
|
||||
// not impact Electron. Note that users doing:
|
||||
//
|
||||
// global.Promise.resolve = myFn
|
||||
//
|
||||
// Will mutate this captured one as well and that is OK.
|
||||
|
||||
export const Promise = global.Promise;
|
||||
@@ -1,18 +0,0 @@
|
||||
// This file provides the global, process and Buffer variables to internal
|
||||
// Electron code once they have been deleted from the global scope.
|
||||
//
|
||||
// It does this through the ProvidePlugin in the webpack.config.base.js file
|
||||
// Check out the Module.wrapper override in renderer/init.ts for more
|
||||
// information on how this works and why we need it
|
||||
|
||||
// Rip global off of window (which is also global) so that webpack doesn't
|
||||
// auto replace it with a looped reference to this file
|
||||
const _global = typeof globalThis !== 'undefined' ? globalThis.global : (self || window).global;
|
||||
const process = _global.process;
|
||||
const Buffer = _global.Buffer;
|
||||
|
||||
export {
|
||||
_global,
|
||||
process,
|
||||
Buffer
|
||||
};
|
||||
@@ -52,20 +52,20 @@ const {
|
||||
getValidatedPath,
|
||||
getOptions,
|
||||
getDirent
|
||||
} = __non_webpack_require__('internal/fs/utils') as typeof import('@node/lib/internal/fs/utils');
|
||||
} = __non_webpack_require__('internal/fs/utils');
|
||||
|
||||
const {
|
||||
assignFunctionName
|
||||
} = __non_webpack_require__('internal/util') as typeof import('@node/lib/internal/util');
|
||||
} = __non_webpack_require__('internal/util');
|
||||
|
||||
const {
|
||||
validateBoolean,
|
||||
validateFunction
|
||||
} = __non_webpack_require__('internal/validators') as typeof import('@node/lib/internal/validators');
|
||||
} = __non_webpack_require__('internal/validators');
|
||||
|
||||
// In the renderer node internals use the node global URL but we do not set that to be
|
||||
// the global URL instance. We need to do instanceof checks against the internal URL impl
|
||||
const { URL: NodeURL } = __non_webpack_require__('internal/url') as typeof import('@node/lib/internal/url');
|
||||
// the global URL instance. We need to do instanceof checks against the internal URL impl.
|
||||
const { URL: NodeURL } = __non_webpack_require__('internal/url');
|
||||
|
||||
// Separate asar package's path from full path.
|
||||
const splitPath = (archivePathOrBuffer: string | Buffer | URL) => {
|
||||
|
||||
@@ -29,8 +29,9 @@ Module._load = function (request: string) {
|
||||
// code with JavaScript.
|
||||
//
|
||||
// Note 3: We provide the equivalent extra variables internally through the
|
||||
// webpack ProvidePlugin in webpack.config.base.js. If you add any extra
|
||||
// variables to this wrapper please ensure to update that plugin as well.
|
||||
// esbuild inject shim in build/esbuild/shims/node-globals-shim.js. If you
|
||||
// add any extra variables to this wrapper please ensure to update that shim
|
||||
// as well.
|
||||
Module.wrapper = [
|
||||
'(function (exports, require, module, __filename, __dirname, process, global, Buffer) { ' +
|
||||
// By running the code in a new closure, it would be possible for the module
|
||||
@@ -65,9 +66,9 @@ require('@electron/internal/renderer/common-init');
|
||||
|
||||
if (nodeIntegration) {
|
||||
// Export node bindings to global.
|
||||
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers') as typeof import('@node/lib/internal/modules/helpers');
|
||||
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers');
|
||||
global.module = new Module('electron/js2c/renderer_init');
|
||||
global.require = makeRequireFunction(global.module) as NodeRequire;
|
||||
global.require = makeRequireFunction(global.module);
|
||||
|
||||
// Set the __filename to the path of html file if it is file: protocol.
|
||||
if (window.location.protocol === 'file:') {
|
||||
@@ -152,7 +153,7 @@ if (cjsPreloads.length) {
|
||||
}
|
||||
}
|
||||
if (esmPreloads.length) {
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
|
||||
|
||||
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
|
||||
// Load the preload scripts.
|
||||
|
||||
@@ -5,18 +5,20 @@ import type { ClientRequestConstructorOptions, IncomingMessage } from 'electron/
|
||||
|
||||
const { isOnline, resolveHost } = process._linkedBinding('electron_common_net');
|
||||
|
||||
export function request (options: ClientRequestConstructorOptions | string, callback?: (message: IncomingMessage) => void) {
|
||||
function request (options: ClientRequestConstructorOptions | string, callback?: (message: IncomingMessage) => void) {
|
||||
return new ClientRequest(options, callback);
|
||||
}
|
||||
|
||||
export function fetch (input: RequestInfo, init?: RequestInit): Promise<Response> {
|
||||
function fetch (input: RequestInfo, init?: RequestInit): Promise<Response> {
|
||||
return fetchWithSession(input, init, undefined, request);
|
||||
}
|
||||
|
||||
exports.resolveHost = resolveHost;
|
||||
|
||||
exports.isOnline = isOnline;
|
||||
|
||||
Object.defineProperty(exports, 'online', {
|
||||
get: () => isOnline()
|
||||
});
|
||||
module.exports = {
|
||||
request,
|
||||
fetch,
|
||||
resolveHost,
|
||||
isOnline,
|
||||
get online () {
|
||||
return isOnline();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ parentPort.on('removeListener', (name: string) => {
|
||||
});
|
||||
|
||||
// Finally load entry script.
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
|
||||
const mainEntry = pathToFileURL(entryScript);
|
||||
|
||||
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
|
||||
|
||||
@@ -13,9 +13,9 @@ require('@electron/internal/common/init');
|
||||
const { hasSwitch, getSwitchValue } = process._linkedBinding('electron_common_command_line');
|
||||
|
||||
// Export node bindings to global.
|
||||
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers') as typeof import('@node/lib/internal/modules/helpers');
|
||||
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers');
|
||||
global.module = new Module('electron/js2c/worker_init');
|
||||
global.require = makeRequireFunction(global.module) as NodeRequire;
|
||||
global.require = makeRequireFunction(global.module);
|
||||
|
||||
// See WebWorkerObserver::WorkerScriptReadyForEvaluation.
|
||||
if ((globalThis as any).blinkfetch) {
|
||||
|
||||
@@ -11,10 +11,6 @@ const path = require('path');
|
||||
|
||||
const { version } = require('./package');
|
||||
|
||||
if (process.env.ELECTRON_SKIP_BINARY_DOWNLOAD) {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const platformPath = getPlatformPath();
|
||||
|
||||
if (isInstalled()) {
|
||||
|
||||
18
package.json
18
package.json
@@ -5,7 +5,7 @@
|
||||
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
|
||||
"devDependencies": {
|
||||
"@azure/storage-blob": "^12.28.0",
|
||||
"@datadog/datadog-ci": "^4.1.2",
|
||||
"@datadog/datadog-ci": "^5.9.1",
|
||||
"@electron/asar": "^4.0.1",
|
||||
"@electron/docs-parser": "^2.0.0",
|
||||
"@electron/fiddle-core": "^1.3.4",
|
||||
@@ -15,6 +15,7 @@
|
||||
"@hurdlegroup/robotjs": "^0.12.3",
|
||||
"@octokit/rest": "^20.1.2",
|
||||
"@primer/octicons": "^10.0.0",
|
||||
"@sentry/cli": "1.72.0",
|
||||
"@types/minimist": "^1.2.5",
|
||||
"@types/node": "^24.9.0",
|
||||
"@types/semver": "^7.5.8",
|
||||
@@ -22,10 +23,12 @@
|
||||
"@types/temp": "^0.9.4",
|
||||
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
||||
"@typescript-eslint/parser": "^8.7.0",
|
||||
"@typescript/native-preview": "^7.0.0-dev.20260324.1",
|
||||
"@xmldom/xmldom": "^0.8.11",
|
||||
"buffer": "^6.0.3",
|
||||
"chalk": "^4.1.0",
|
||||
"check-for-leaks": "^1.2.1",
|
||||
"esbuild": "^0.25.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
@@ -42,20 +45,15 @@
|
||||
"markdownlint-cli2": "^0.18.0",
|
||||
"minimist": "^1.2.8",
|
||||
"node-gyp": "^11.4.2",
|
||||
"null-loader": "^4.0.1",
|
||||
"pre-flight": "^2.0.0",
|
||||
"process": "^0.11.10",
|
||||
"semver": "^7.6.3",
|
||||
"stream-json": "^1.9.1",
|
||||
"tap-xunit": "^2.4.1",
|
||||
"temp": "^0.9.4",
|
||||
"ts-loader": "^8.0.2",
|
||||
"ts-node": "6.2.0",
|
||||
"typescript": "^5.8.3",
|
||||
"url": "^0.11.4",
|
||||
"webpack": "^5.104.1",
|
||||
"webpack-cli": "^6.0.1",
|
||||
"wrapper-webpack-plugin": "^2.2.0",
|
||||
"yaml": "^2.8.1"
|
||||
},
|
||||
"private": true,
|
||||
@@ -92,8 +90,9 @@
|
||||
"repl": "node ./script/start.js --interactive",
|
||||
"start": "node ./script/start.js",
|
||||
"test": "node ./script/spec-runner.js",
|
||||
"tsc": "tsc",
|
||||
"webpack": "webpack"
|
||||
"tsc": "tsgo",
|
||||
"tsc-check": "node script/typecheck.js",
|
||||
"bundle": "node build/esbuild/bundle.js"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "Electron Community",
|
||||
@@ -153,6 +152,9 @@
|
||||
"spec/fixtures/native-addon/*"
|
||||
],
|
||||
"dependenciesMeta": {
|
||||
"@sentry/cli": {
|
||||
"built": true
|
||||
},
|
||||
"abstract-socket": {
|
||||
"built": true
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ adjust_accessibility_ui_for_electron.patch
|
||||
worker_feat_add_hook_to_notify_script_ready.patch
|
||||
chore_provide_iswebcontentscreationoverridden_with_full_params.patch
|
||||
fix_properly_honor_printing_page_ranges.patch
|
||||
export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch
|
||||
fix_export_zlib_symbols.patch
|
||||
web_contents.patch
|
||||
webview_fullscreen.patch
|
||||
@@ -104,7 +103,6 @@ chore_remove_check_is_test_on_script_injection_tracker.patch
|
||||
fix_restore_original_resize_performance_on_macos.patch
|
||||
feat_allow_code_cache_in_custom_schemes.patch
|
||||
build_run_reclient_cfg_generator_after_chrome.patch
|
||||
fix_getcursorscreenpoint_wrongly_returns_0_0.patch
|
||||
fix_add_support_for_skipping_first_2_no-op_refreshes_in_thumb_cap.patch
|
||||
refactor_expose_file_system_access_blocklist.patch
|
||||
feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch
|
||||
@@ -121,7 +119,7 @@ build_disable_thin_lto_mac.patch
|
||||
feat_corner_smoothing_css_rule_and_blink_painting.patch
|
||||
build_add_public_config_simdutf_config.patch
|
||||
fix_multiple_scopedpumpmessagesinprivatemodes_instances.patch
|
||||
revert_code_health_clean_up_stale_macwebcontentsocclusion.patch
|
||||
fix_handle_embedder_windows_shown_after_webcontentsviewcocoa_attach.patch
|
||||
feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch
|
||||
feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch
|
||||
fix_win32_synchronous_spellcheck.patch
|
||||
@@ -149,3 +147,6 @@ fix_pass_trigger_for_global_shortcuts_on_wayland.patch
|
||||
feat_plumb_node_integration_in_worker_through_workersettings.patch
|
||||
fix_restore_sdk_inputs_cross-toolchain_deps_for_macos.patch
|
||||
fix_use_fresh_lazynow_for_onendworkitemimpl_after_didruntask.patch
|
||||
fix_pulseaudio_stream_and_icon_names.patch
|
||||
fix_fire_menu_popup_start_for_dynamically_created_aria_menus.patch
|
||||
feat_allow_enabling_extensions_on_custom_protocols.patch
|
||||
|
||||
@@ -10,10 +10,10 @@ Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set.
|
||||
This should be upstreamed.
|
||||
|
||||
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
|
||||
index 35ec6d493c548e5ae3e60711bc71983ce57c1662..fbd53e2a8785cb92b0fa03d470249f3579c55a67 100644
|
||||
index 26619daf25f3cc455d2dba7b5f16c9449e6103c1..387fca1b54b818a5af435e96bf8f435e2963fe39 100644
|
||||
--- a/content/gpu/gpu_main.cc
|
||||
+++ b/content/gpu/gpu_main.cc
|
||||
@@ -278,6 +278,10 @@ int GpuMain(MainFunctionParams parameters) {
|
||||
@@ -277,6 +277,10 @@ int GpuMain(MainFunctionParams parameters) {
|
||||
// to the GpuProcessHost once the GpuServiceImpl has started.
|
||||
viz::GpuLogMessageManager::GetInstance()->InstallPreInitializeLogHandler();
|
||||
|
||||
@@ -24,7 +24,7 @@ index 35ec6d493c548e5ae3e60711bc71983ce57c1662..fbd53e2a8785cb92b0fa03d470249f35
|
||||
// We are experiencing what appear to be memory-stomp issues in the GPU
|
||||
// process. These issues seem to be impacting the task executor and listeners
|
||||
// registered to it. Create the task executor on the heap to guard against
|
||||
@@ -386,7 +390,6 @@ int GpuMain(MainFunctionParams parameters) {
|
||||
@@ -385,7 +389,6 @@ int GpuMain(MainFunctionParams parameters) {
|
||||
#endif
|
||||
const bool dead_on_arrival = !init_success;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ DidCreateScriptContext is called, not all JS APIs are available in the
|
||||
context, which can cause some preload scripts to trip.
|
||||
|
||||
diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h
|
||||
index 8077ed85e45e56d6cccb691223216c1f6a94b5ee..dd4cee346f16df703d414bf206bbe6c9f4b1f796 100644
|
||||
index 3f8cf4edc7448e6b584adae8fcbb872d27377126..1d03dc809d4c18f24314d94811e0bf527aa7b5b4 100644
|
||||
--- a/content/public/renderer/render_frame_observer.h
|
||||
+++ b/content/public/renderer/render_frame_observer.h
|
||||
@@ -141,6 +141,8 @@ class CONTENT_EXPORT RenderFrameObserver {
|
||||
@@ -23,10 +23,10 @@ index 8077ed85e45e56d6cccb691223216c1f6a94b5ee..dd4cee346f16df703d414bf206bbe6c9
|
||||
int32_t world_id) {}
|
||||
virtual void DidClearWindowObject() {}
|
||||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
||||
index 42a0a7e5be01fe346cc2ad83d3395425a41e1699..40d1f104794795dba6cd59518819e98a4cdbfc44 100644
|
||||
index 0e64b0a0ac8387ab15b201a9fc0f0fd36cd5ab29..f28214d369138eb854a556165f0a946c07cfdb9c 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -4769,6 +4769,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
@@ -4731,6 +4731,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
observer.DidCreateScriptContext(context, world_id);
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ index 42a0a7e5be01fe346cc2ad83d3395425a41e1699..40d1f104794795dba6cd59518819e98a
|
||||
int world_id) {
|
||||
for (auto& observer : observers_)
|
||||
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
|
||||
index c803bf1d93bb9aabf0f9098c4d58aa7528d18d79..ced097d57cec93b3d3062a6d7d9f7d037a355e6c 100644
|
||||
index 1733f28e69b331b33f36084391f1d3ddb47c8e14..2ce05bce0a02338aba018c18f0a808a4eb392ff4 100644
|
||||
--- a/content/renderer/render_frame_impl.h
|
||||
+++ b/content/renderer/render_frame_impl.h
|
||||
@@ -606,6 +606,8 @@ class CONTENT_EXPORT RenderFrameImpl
|
||||
@@ -607,6 +607,8 @@ class CONTENT_EXPORT RenderFrameImpl
|
||||
void DidObserveLayoutShift(double score, bool after_input_or_scroll) override;
|
||||
void DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
int world_id) override;
|
||||
@@ -53,10 +53,10 @@ index c803bf1d93bb9aabf0f9098c4d58aa7528d18d79..ced097d57cec93b3d3062a6d7d9f7d03
|
||||
int world_id) override;
|
||||
void DidChangeScrollOffset() override;
|
||||
diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h
|
||||
index 7e5f1d80ff5395ea11eb558acabe63ccc3e5a17e..d241042fc37ffe4a2afecbc3c02e89f18e990929 100644
|
||||
index 0f218d3f96f0c3a3a5773937e50ba9e8d7df0498..27b21f02d2dbfd60cb64f09be393b0e50928756f 100644
|
||||
--- a/third_party/blink/public/web/web_local_frame_client.h
|
||||
+++ b/third_party/blink/public/web/web_local_frame_client.h
|
||||
@@ -674,6 +674,9 @@ class BLINK_EXPORT WebLocalFrameClient {
|
||||
@@ -675,6 +675,9 @@ class BLINK_EXPORT WebLocalFrameClient {
|
||||
virtual void DidCreateScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) {}
|
||||
|
||||
@@ -79,10 +79,10 @@ index d293c49e6774de889fa9959234c82b41a4b1efe1..0787bc8a602c60e5b42933813baa6b9d
|
||||
if (World().IsMainWorld()) {
|
||||
probe::DidCreateMainWorldContext(GetFrame());
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame_client.h b/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
index 52cc48e0099ded3686c6fc056514b6446afcae5d..a6331653b0aaf30cedba6ff6df787aa944142ac4 100644
|
||||
index a68832975b5d359f7eddaf2326bd47ff1e7e18df..ae565a4d3fdc2d02e2c7a27312d8296bbdf61e0b 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
@@ -309,6 +309,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
|
||||
@@ -310,6 +310,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
|
||||
|
||||
virtual void DidCreateScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) = 0;
|
||||
@@ -92,7 +92,7 @@ index 52cc48e0099ded3686c6fc056514b6446afcae5d..a6331653b0aaf30cedba6ff6df787aa9
|
||||
int32_t world_id) = 0;
|
||||
virtual bool AllowScriptExtensions() = 0;
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
|
||||
index ebf1c82da02efbe73f1bb7b20cb1011c1bd7a335..26410fc221baf1fadb6220eb653c651b47fb3da7 100644
|
||||
index 5e5e43e204f006989a859a6077dcb56c81a08e60..aaf03855e53d5529bb51d70cd9b4355d68fed48c 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
|
||||
@@ -301,6 +301,13 @@ void LocalFrameClientImpl::DidCreateScriptContext(
|
||||
@@ -110,7 +110,7 @@ index ebf1c82da02efbe73f1bb7b20cb1011c1bd7a335..26410fc221baf1fadb6220eb653c651b
|
||||
v8::Local<v8::Context> context,
|
||||
int32_t world_id) {
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.h b/third_party/blink/renderer/core/frame/local_frame_client_impl.h
|
||||
index 9bdfacfc0270bf4ac3a965f6308e4cfc19193f4f..ea9e16b6dd6c96333c653fc602edfbd84cd9e5de 100644
|
||||
index b00211cf215fb820b3fe49139b8ef95be6a10d21..cc593168947e469b599794260692e1deb9b5f1a5 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.h
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.h
|
||||
@@ -78,6 +78,8 @@ class CORE_EXPORT LocalFrameClientImpl final : public LocalFrameClient {
|
||||
@@ -123,10 +123,10 @@ index 9bdfacfc0270bf4ac3a965f6308e4cfc19193f4f..ea9e16b6dd6c96333c653fc602edfbd8
|
||||
int32_t world_id) override;
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
index 1f9061d660d7395a6a9e32d783228fc5ae85c898..f762722e2e2a27db2488aae25d78e79598f6a4b4 100644
|
||||
index bcdcc5f04edaf06d89375b05eb2d5f6bfa3d3237..5a0f42b4b7e5eb67d476c948caa201ee6fc7b3ca 100644
|
||||
--- a/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
+++ b/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
@@ -422,6 +422,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
|
||||
@@ -425,6 +425,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
|
||||
|
||||
void DidCreateScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) override {}
|
||||
|
||||
@@ -8,10 +8,10 @@ was removed as part of the Raw Clipboard API scrubbing.
|
||||
https://bugs.chromium.org/p/chromium/issues/detail?id=1217643
|
||||
|
||||
diff --git a/ui/base/clipboard/scoped_clipboard_writer.cc b/ui/base/clipboard/scoped_clipboard_writer.cc
|
||||
index 503225a84c1fe3835e97d8cc521f661339de105e..9949bd699ccca7fef8750816663fd66701b08d69 100644
|
||||
index 12695bb8f3d2cc3f498e5c6e37e4729d9586962f..6bd7b6f2908d3c8316191e3106e50b2137068a0f 100644
|
||||
--- a/ui/base/clipboard/scoped_clipboard_writer.cc
|
||||
+++ b/ui/base/clipboard/scoped_clipboard_writer.cc
|
||||
@@ -240,6 +240,16 @@ void ScopedClipboardWriter::WriteData(std::u16string_view format,
|
||||
@@ -239,6 +239,16 @@ void ScopedClipboardWriter::WriteData(std::u16string_view format,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ index 503225a84c1fe3835e97d8cc521f661339de105e..9949bd699ccca7fef8750816663fd667
|
||||
objects_.clear();
|
||||
raw_objects_.clear();
|
||||
diff --git a/ui/base/clipboard/scoped_clipboard_writer.h b/ui/base/clipboard/scoped_clipboard_writer.h
|
||||
index 8c2be540757856a3e704764fe56003205b24812f..e31fbc01f68c0e92284a72298cac878d7247e7fb 100644
|
||||
index 7d7d015f9725ef39b7d5e82b83ac5195e2cfe309..83565b6d73cbe30e3c24913468862173cfd3a83e 100644
|
||||
--- a/ui/base/clipboard/scoped_clipboard_writer.h
|
||||
+++ b/ui/base/clipboard/scoped_clipboard_writer.h
|
||||
@@ -91,6 +91,10 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD) ScopedClipboardWriter {
|
||||
|
||||
@@ -10,7 +10,7 @@ usage of BrowserList and Browser as we subclass related methods and use our
|
||||
WindowList.
|
||||
|
||||
diff --git a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc
|
||||
index 9b22efa07e43b60a8bd8bb6288792846709fae87..cf60a541720ffbcdaa5163d727a7761dcb30f131 100644
|
||||
index 1322a7c5f9b3baca837488de2e5323ee5c49800c..cb1895f2be25d210f7508433a352bc1e93369f4a 100644
|
||||
--- a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc
|
||||
+++ b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc
|
||||
@@ -48,6 +48,7 @@
|
||||
@@ -64,7 +64,7 @@ index 9b22efa07e43b60a8bd8bb6288792846709fae87..cf60a541720ffbcdaa5163d727a7761d
|
||||
data.Set(kBrowsersField, std::move(browser_list));
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
@@ -847,7 +848,8 @@ void AccessibilityUIMessageHandler::SetGlobalString(
|
||||
@@ -870,7 +871,8 @@ void AccessibilityUIMessageHandler::HandleSetGlobalString(
|
||||
const std::string value = CheckJSValue(data.FindString(kValueField));
|
||||
|
||||
if (string_name == kApiTypeField) {
|
||||
@@ -74,7 +74,7 @@ index 9b22efa07e43b60a8bd8bb6288792846709fae87..cf60a541720ffbcdaa5163d727a7761d
|
||||
pref->SetString(prefs::kShownAccessibilityApiType, value);
|
||||
}
|
||||
}
|
||||
@@ -901,7 +903,8 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree(
|
||||
@@ -924,7 +926,8 @@ void AccessibilityUIMessageHandler::HandleRequestWebContentsTree(
|
||||
AXPropertyFilter::ALLOW_EMPTY);
|
||||
AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY);
|
||||
|
||||
@@ -84,7 +84,7 @@ index 9b22efa07e43b60a8bd8bb6288792846709fae87..cf60a541720ffbcdaa5163d727a7761d
|
||||
ui::AXApiType::Type api_type =
|
||||
ui::AXApiType::From(pref->GetString(prefs::kShownAccessibilityApiType));
|
||||
std::string accessibility_contents =
|
||||
@@ -921,7 +924,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree(
|
||||
@@ -944,7 +947,7 @@ void AccessibilityUIMessageHandler::HandleRequestNativeUITree(
|
||||
|
||||
AllowJavascript();
|
||||
|
||||
@@ -93,7 +93,7 @@ index 9b22efa07e43b60a8bd8bb6288792846709fae87..cf60a541720ffbcdaa5163d727a7761d
|
||||
std::vector<AXPropertyFilter> property_filters;
|
||||
AddPropertyFilters(property_filters, allow, AXPropertyFilter::ALLOW);
|
||||
AddPropertyFilters(property_filters, allow_empty,
|
||||
@@ -948,7 +951,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree(
|
||||
@@ -971,7 +974,7 @@ void AccessibilityUIMessageHandler::HandleRequestNativeUITree(
|
||||
if (found) {
|
||||
return;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ index 9b22efa07e43b60a8bd8bb6288792846709fae87..cf60a541720ffbcdaa5163d727a7761d
|
||||
// No browser with the specified |session_id| was found.
|
||||
base::DictValue result;
|
||||
result.Set(kSessionIdField, session_id);
|
||||
@@ -991,11 +994,13 @@ void AccessibilityUIMessageHandler::StopRecording(
|
||||
@@ -1014,11 +1017,13 @@ void AccessibilityUIMessageHandler::StopRecording(
|
||||
}
|
||||
|
||||
ui::AXApiType::Type AccessibilityUIMessageHandler::GetRecordingApiType() {
|
||||
@@ -119,7 +119,7 @@ index 9b22efa07e43b60a8bd8bb6288792846709fae87..cf60a541720ffbcdaa5163d727a7761d
|
||||
// Check to see if it is in the supported types list.
|
||||
if (std::find(supported_types.begin(), supported_types.end(), api_type) ==
|
||||
supported_types.end()) {
|
||||
@@ -1065,10 +1070,13 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents(
|
||||
@@ -1088,10 +1093,13 @@ void AccessibilityUIMessageHandler::HandleRequestAccessibilityEvents(
|
||||
// static
|
||||
void AccessibilityUIMessageHandler::RegisterProfilePrefs(
|
||||
user_prefs::PrefRegistrySyncable* registry) {
|
||||
@@ -134,7 +134,7 @@ index 9b22efa07e43b60a8bd8bb6288792846709fae87..cf60a541720ffbcdaa5163d727a7761d
|
||||
|
||||
void AccessibilityUIMessageHandler::OnVisibilityChanged(
|
||||
diff --git a/chrome/browser/ui/webui/accessibility/accessibility_ui.h b/chrome/browser/ui/webui/accessibility/accessibility_ui.h
|
||||
index 67f7e34271994ff66da2a3c3b90c2f02797c2d14..8f786bc00dc4a7cc775ca3ff3fca4da680272682 100644
|
||||
index 184a10239d7072572a043f2b4e29bcdb5344f3ec..77d3ca336eaa28b7c476861c8d4a43e45804ac7a 100644
|
||||
--- a/chrome/browser/ui/webui/accessibility/accessibility_ui.h
|
||||
+++ b/chrome/browser/ui/webui/accessibility/accessibility_ui.h
|
||||
@@ -28,6 +28,8 @@ namespace content {
|
||||
@@ -146,12 +146,12 @@ index 67f7e34271994ff66da2a3c3b90c2f02797c2d14..8f786bc00dc4a7cc775ca3ff3fca4da6
|
||||
namespace user_prefs {
|
||||
class PrefRegistrySyncable;
|
||||
} // namespace user_prefs
|
||||
@@ -79,6 +81,8 @@ class AccessibilityUIMessageHandler : public content::WebUIMessageHandler,
|
||||
@@ -81,6 +83,8 @@ class AccessibilityUIMessageHandler : public content::WebUIMessageHandler,
|
||||
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
|
||||
|
||||
private:
|
||||
+ friend class ElectronAccessibilityUIMessageHandler;
|
||||
+
|
||||
void ToggleAccessibilityForWebContents(const base::ListValue& args);
|
||||
void SetGlobalFlag(const base::ListValue& args);
|
||||
void SetGlobalString(const base::ListValue& args);
|
||||
void HandleInitialize(const base::ListValue& args);
|
||||
void HandleToggleAccessibilityForWebContents(const base::ListValue& args);
|
||||
void HandleSetGlobalFlag(const base::ListValue& args);
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: allow disabling blink scheduler throttling per RenderView
|
||||
This allows us to disable throttling for hidden windows.
|
||||
|
||||
diff --git a/content/browser/renderer_host/navigation_controller_impl_unittest.cc b/content/browser/renderer_host/navigation_controller_impl_unittest.cc
|
||||
index c33775220e161d38e41efe8fea897815737341f8..e9636b69a8eb748aaa493466c3190ec602e16449 100644
|
||||
index 29d5b174e122cbd140554687548106ead8f8e8d9..da74da96c3fe35a0f3838f04bca08846f7b41abe 100644
|
||||
--- a/content/browser/renderer_host/navigation_controller_impl_unittest.cc
|
||||
+++ b/content/browser/renderer_host/navigation_controller_impl_unittest.cc
|
||||
@@ -168,6 +168,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast {
|
||||
@@ -23,10 +23,10 @@ index c33775220e161d38e41efe8fea897815737341f8..e9636b69a8eb748aaa493466c3190ec6
|
||||
return receiver_.BindNewEndpointAndPassDedicatedRemote();
|
||||
}
|
||||
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
|
||||
index 5b1453e29d09170b698eb67a95f2822510525740..24d72cca5a230af3aaa43ad9ada92c2af17f06bf 100644
|
||||
index 6b881f610932eacd5412accd61431e6a59124e71..999022342a06592cc1bc7838b49afddaed1f9995 100644
|
||||
--- a/content/browser/renderer_host/render_view_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_view_host_impl.cc
|
||||
@@ -762,6 +762,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
|
||||
@@ -761,6 +761,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
|
||||
GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ index 932658273154ef2e022358e493a8e7c00c86e732..57bbfb5cde62c9496c351c861880a189
|
||||
// Visibility -----------------------------------------------------------
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
index b74b9ce6c4e100e095fe7050cd8bc397b682d056..4aa7a851d7280411009ed8a50fd04c78f9cb41cd 100644
|
||||
index 611ecffa47703196dc40550b1e920afc4c1be716..be26284387dcfa4e72592862f313a2c7e9a81d1b 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
@@ -2471,6 +2471,10 @@ void WebViewImpl::SetPageLifecycleStateInternal(
|
||||
@@ -130,7 +130,7 @@ index b74b9ce6c4e100e095fe7050cd8bc397b682d056..4aa7a851d7280411009ed8a50fd04c78
|
||||
bool storing_in_bfcache = new_state->is_in_back_forward_cache &&
|
||||
!old_state->is_in_back_forward_cache;
|
||||
bool restoring_from_bfcache = !new_state->is_in_back_forward_cache &&
|
||||
@@ -4151,10 +4155,23 @@ PageScheduler* WebViewImpl::Scheduler() const {
|
||||
@@ -4163,10 +4167,23 @@ PageScheduler* WebViewImpl::Scheduler() const {
|
||||
return GetPage()->GetPageScheduler();
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ index b74b9ce6c4e100e095fe7050cd8bc397b682d056..4aa7a851d7280411009ed8a50fd04c78
|
||||
// Do not throttle if the page should be painting.
|
||||
bool is_visible =
|
||||
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h
|
||||
index 645ac2435db59cb76878de87cdd3e54d0958fce1..654f2ccfdff54742af06450aafe62cdf6e6157f6 100644
|
||||
index 8d5c7349c360726778e37976fc54d660d7424f1f..96ee25c8ae4b50ab265bd698517efe15e2f1f44d 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.h
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.h
|
||||
@@ -446,6 +446,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
@@ -166,7 +166,7 @@ index 645ac2435db59cb76878de87cdd3e54d0958fce1..654f2ccfdff54742af06450aafe62cdf
|
||||
void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state,
|
||||
bool is_initial_state) override;
|
||||
mojom::blink::PageVisibilityState GetVisibilityState() override;
|
||||
@@ -955,6 +956,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
@@ -957,6 +958,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
// If true, we send IPC messages when |preferred_size_| changes.
|
||||
bool send_preferred_size_changes_ = false;
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ WebPreferences of in-process child windows, rather than relying on
|
||||
process-level command line switches, as before.
|
||||
|
||||
diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
|
||||
index 23672617af41f1d88b551da7b4ad0a19e39a2092..df032abeeca76c0cd914cbefcb6ba1a9509e7f95 100644
|
||||
index c6552b25ffba3bf8d806d8bf2410a89533c9bef1..9920c3146c6cf700414a679e80087c469395eee9 100644
|
||||
--- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
|
||||
+++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
|
||||
@@ -149,6 +149,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
|
||||
@@ -150,6 +150,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
|
||||
out->v8_cache_options = data.v8_cache_options();
|
||||
out->record_whole_document = data.record_whole_document();
|
||||
out->stylus_handwriting_enabled = data.stylus_handwriting_enabled();
|
||||
@@ -32,18 +32,18 @@ index 23672617af41f1d88b551da7b4ad0a19e39a2092..df032abeeca76c0cd914cbefcb6ba1a9
|
||||
out->accelerated_video_decode_enabled =
|
||||
data.accelerated_video_decode_enabled();
|
||||
diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h
|
||||
index cd34e8f534e86d4ff11ea1d8020d215f37cd730b..9ee7cd49b021ff4277b7bfd9c9e015eb75489562 100644
|
||||
index 1188e60da33c292febf45be4cd6055671c21b4aa..43a1e777536ce2079d81deb5c7f440a1ba9b43d9 100644
|
||||
--- a/third_party/blink/public/common/web_preferences/web_preferences.h
|
||||
+++ b/third_party/blink/public/common/web_preferences/web_preferences.h
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <string>
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/time/time.h"
|
||||
+#include "base/files/file_path.h"
|
||||
#include "build/build_config.h"
|
||||
#include "net/nqe/effective_connection_type.h"
|
||||
#include "third_party/blink/public/common/common_export.h"
|
||||
@@ -472,6 +473,19 @@ struct BLINK_COMMON_EXPORT WebPreferences {
|
||||
@@ -481,6 +482,19 @@ struct BLINK_COMMON_EXPORT WebPreferences {
|
||||
bool should_screenshot_on_mainframe_same_doc_navigation = true;
|
||||
#endif // BUILDFLAG(IS_ANDROID)
|
||||
|
||||
@@ -64,7 +64,7 @@ index cd34e8f534e86d4ff11ea1d8020d215f37cd730b..9ee7cd49b021ff4277b7bfd9c9e015eb
|
||||
// chrome, except for the cases where it would require lots of extra work for
|
||||
// the embedder to use the same default value.
|
||||
diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
|
||||
index 9bb06fb430cbf31b6fc1343229191565a62421a8..a69327c42d386390bafb29d89063dd91315de834 100644
|
||||
index ac91e8bad952dad5fc6ff673ffd19b0edd30bdb2..0f1715711056c83bb53e03dd8b675cb40a0c42cc 100644
|
||||
--- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
|
||||
+++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
|
||||
@@ -8,6 +8,7 @@
|
||||
@@ -129,7 +129,7 @@ index 9bb06fb430cbf31b6fc1343229191565a62421a8..a69327c42d386390bafb29d89063dd91
|
||||
return r.cookie_enabled;
|
||||
}
|
||||
diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
|
||||
index ec6f13d3924cf861c505ed6d3abde0371fd65475..4830affa94db76d7cf87482671b9e20a68bcc449 100644
|
||||
index 0ed21e64a0b43580feb99166953babfb633d5af6..f06db564760e8f7e785bb3d6d4b80270a8783a23 100644
|
||||
--- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
|
||||
+++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
|
||||
@@ -4,6 +4,7 @@
|
||||
@@ -138,9 +138,9 @@ index ec6f13d3924cf861c505ed6d3abde0371fd65475..4830affa94db76d7cf87482671b9e20a
|
||||
|
||||
+import "mojo/public/mojom/base/file_path.mojom";
|
||||
import "mojo/public/mojom/base/string16.mojom";
|
||||
import "mojo/public/mojom/base/time.mojom";
|
||||
import "skia/public/mojom/skcolor.mojom";
|
||||
import "third_party/blink/public/mojom/css/preferred_color_scheme.mojom";
|
||||
@@ -221,6 +222,19 @@ struct WebPreferences {
|
||||
@@ -222,6 +223,19 @@ struct WebPreferences {
|
||||
// If true, stylus handwriting recognition to text input will be available in
|
||||
// editable input fields which are non-password type.
|
||||
bool stylus_handwriting_enabled;
|
||||
|
||||
@@ -49,7 +49,7 @@ index 901b727ed898cdd840df5ff7e2380fbee5d7fde2..1caacaeed9ddf1162cfa393fe4a7c86a
|
||||
// its owning reference back to our owning LocalFrame.
|
||||
client_->Detached(type);
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
index 8d1aa4435bb815b2e8d4b2e14f60e7e11a29ae7d..34603bffa39cf2aaedfd7c3152464c524995f6f0 100644
|
||||
index 802c876dd85d8100fc3d6e634ad4e390fd48747f..abe5b3c6e5eadf30f3e00013fceddaa0ead36cb1 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
@@ -758,10 +758,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
@@ -63,7 +63,7 @@ index 8d1aa4435bb815b2e8d4b2e14f60e7e11a29ae7d..34603bffa39cf2aaedfd7c3152464c52
|
||||
if (!Client())
|
||||
return false;
|
||||
|
||||
@@ -818,6 +814,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
@@ -817,6 +813,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
DCHECK(!view_->IsAttached());
|
||||
Client()->WillBeDetached();
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ Subject: build: allow electron to use exec_script
|
||||
This is similar to the //build usecase so we're OK adding ourselves here
|
||||
|
||||
diff --git a/.gn b/.gn
|
||||
index ae58a0b0a64ae1fdb3f9cd8587041d71a121c6b9..f9d4e9b015ad266452dfa2a442b432ef31d09a5b 100644
|
||||
index 0013a7fd5a260ea4f04f6421031a571c7bbf90b9..216974ae53ec574514abbfb0a1d7276a396380e5 100644
|
||||
--- a/.gn
|
||||
+++ b/.gn
|
||||
@@ -167,4 +167,28 @@ exec_script_allowlist =
|
||||
|
||||
"//tools/grit/grit_rule.gni",
|
||||
@@ -169,4 +169,28 @@ exec_script_allowlist =
|
||||
"//tools/gritsettings/BUILD.gn",
|
||||
|
||||
"//third_party/blink/renderer/build/scripts/scripts.gni",
|
||||
+
|
||||
+ "//electron/BUILD.gn",
|
||||
+ "//third_party/electron_node/deps/ada/unofficial.gni",
|
||||
|
||||
@@ -11,10 +11,10 @@ This patch can (and should) be removed when we can prevent those symbols
|
||||
from being stripped in the release build.
|
||||
|
||||
diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni
|
||||
index beb5213714e1ab6260ed735099b0bcac90cdab66..fcbf88740deea6335ec70ab61795f501f4b432ce 100644
|
||||
index 9e7353df432d5de6c24c485579c1d99bc1dc5bb2..0d799db2dcd3dfd635b0b7f8e0142ef76ae29beb 100644
|
||||
--- a/build/config/compiler/compiler.gni
|
||||
+++ b/build/config/compiler/compiler.gni
|
||||
@@ -113,7 +113,7 @@ declare_args() {
|
||||
@@ -149,7 +149,7 @@ declare_args() {
|
||||
# Chrome's clang. crbug.com/1033839
|
||||
use_thin_lto =
|
||||
is_cfi || (is_clang && is_official_build && chrome_pgo_phase != 1 &&
|
||||
|
||||
@@ -11,7 +11,7 @@ if we ever align our .pak file generation with Chrome we can remove this
|
||||
patch.
|
||||
|
||||
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
|
||||
index 74aadd24a27d31291bb42d452ff247bbf6dad14a..a0d74156745c0d22a332b2547c59b98d1ae8a7c5 100644
|
||||
index 9a5b03af14d68c0c64380f84901aaeef11757ccb..933c03f197a8510c168775d5f8d19ebf375389d2 100644
|
||||
--- a/chrome/BUILD.gn
|
||||
+++ b/chrome/BUILD.gn
|
||||
@@ -201,11 +201,16 @@ if (!is_android && !is_mac) {
|
||||
@@ -33,10 +33,10 @@ index 74aadd24a27d31291bb42d452ff247bbf6dad14a..a0d74156745c0d22a332b2547c59b98d
|
||||
"//base",
|
||||
"//build:branding_buildflags",
|
||||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||||
index f195e70c33b1a88e44f8ad51be6573d609d91b7f..a9195e0149385e7ffc95eb809bc30256683861d7 100644
|
||||
index 5768066ed65810d14d8ad4b6839c6c632af6bb57..d8d4e66f1c96f630e60001425d16fc4d6e22212b 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -4532,7 +4532,7 @@ static_library("browser") {
|
||||
@@ -4455,7 +4455,7 @@ static_library("browser") {
|
||||
]
|
||||
}
|
||||
|
||||
@@ -46,10 +46,10 @@ index f195e70c33b1a88e44f8ad51be6573d609d91b7f..a9195e0149385e7ffc95eb809bc30256
|
||||
# than here in :chrome_dll.
|
||||
deps += [ "//chrome:packed_resources_integrity_header" ]
|
||||
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
|
||||
index cf7e31b7b1b8eab0e82a669902dc37020f74195a..dfeb9048a85ab2076259c01687d30c2c7f36d8b0 100644
|
||||
index 98ce26437751543c5c93574bc9561409e214d8a8..853eda4503954de04d50caba63f55fd74f390069 100644
|
||||
--- a/chrome/test/BUILD.gn
|
||||
+++ b/chrome/test/BUILD.gn
|
||||
@@ -7770,9 +7770,12 @@ test("unit_tests") {
|
||||
@@ -7718,9 +7718,12 @@ test("unit_tests") {
|
||||
"//chrome/notification_helper",
|
||||
]
|
||||
|
||||
@@ -63,7 +63,7 @@ index cf7e31b7b1b8eab0e82a669902dc37020f74195a..dfeb9048a85ab2076259c01687d30c2c
|
||||
"//chrome//services/util_win:unit_tests",
|
||||
"//chrome/app:chrome_dll_resources",
|
||||
"//chrome/app:win_unit_tests",
|
||||
@@ -8771,6 +8774,10 @@ test("unit_tests") {
|
||||
@@ -8723,6 +8726,10 @@ test("unit_tests") {
|
||||
"../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc",
|
||||
]
|
||||
|
||||
@@ -74,7 +74,7 @@ index cf7e31b7b1b8eab0e82a669902dc37020f74195a..dfeb9048a85ab2076259c01687d30c2c
|
||||
sources += [
|
||||
# The importer code is not used on Android.
|
||||
"../common/importer/firefox_importer_utils_unittest.cc",
|
||||
@@ -8828,7 +8835,6 @@ test("unit_tests") {
|
||||
@@ -8779,7 +8786,6 @@ test("unit_tests") {
|
||||
# TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above?
|
||||
deps += [
|
||||
"../browser/screen_ai:screen_ai_install_state",
|
||||
|
||||
@@ -9,10 +9,10 @@ potentially prevent a window from being created.
|
||||
TODO(loc): this patch is currently broken.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index 4e7b516f145312e353f112499b2792b27207d84b..222cf1b2bbc98aa5e271426478a774f8a48e693d 100644
|
||||
index 914b06175825f79c03d34e0bdb1c3749a934bfdb..89f4af078c151adc1d9d471056bacab5dace0833 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -10125,6 +10125,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -10170,6 +10170,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
last_committed_origin_, params->window_container_type,
|
||||
params->target_url, params->referrer.To<Referrer>(),
|
||||
params->frame_name, params->disposition, *params->features,
|
||||
@@ -21,10 +21,10 @@ index 4e7b516f145312e353f112499b2792b27207d84b..222cf1b2bbc98aa5e271426478a774f8
|
||||
&no_javascript_access);
|
||||
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index b0f3579f18f3b6dd5a9b328324348770319ccf67..1567ac2a65d222080430a47dce97b6d387ebe49d 100644
|
||||
index 299324868f7bf88c7105015c1925881b06ec40a6..d40eb3c0670a9b3053db7773cef229adae8ecbec 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -5385,6 +5385,10 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -5497,6 +5497,10 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
create_params.initially_hidden = renderer_started_hidden;
|
||||
create_params.initial_popup_url = params.target_url;
|
||||
|
||||
@@ -35,7 +35,7 @@ index b0f3579f18f3b6dd5a9b328324348770319ccf67..1567ac2a65d222080430a47dce97b6d3
|
||||
// Even though all codepaths leading here are in response to a renderer
|
||||
// trying to open a new window, if the new window ends up in a different
|
||||
// browsing instance, then the RenderViewHost, RenderWidgetHost,
|
||||
@@ -5439,6 +5443,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -5551,6 +5555,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
// Sets the newly created WebContents WindowOpenDisposition.
|
||||
new_contents_impl->original_window_open_disposition_ = params.disposition;
|
||||
|
||||
@@ -48,7 +48,7 @@ index b0f3579f18f3b6dd5a9b328324348770319ccf67..1567ac2a65d222080430a47dce97b6d3
|
||||
// If the new frame has a name, make sure any SiteInstances that can find
|
||||
// this named frame have proxies for it. Must be called after
|
||||
// SetSessionStorageNamespace, since this calls CreateRenderView, which uses
|
||||
@@ -5480,12 +5490,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -5592,12 +5602,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
AddWebContentsDestructionObserver(new_contents_impl);
|
||||
}
|
||||
|
||||
@@ -62,10 +62,10 @@ index b0f3579f18f3b6dd5a9b328324348770319ccf67..1567ac2a65d222080430a47dce97b6d3
|
||||
new_contents_impl, opener, params.target_url,
|
||||
params.referrer.To<Referrer>(), params.disposition,
|
||||
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
|
||||
index 19dbb921c9644522588ff74d0a1925f826736957..4e7b36729741a79cfdf04f89a8ec615d3148b294 100644
|
||||
index 444fa7009d0db33470cac9ab9cfdc23ceacec942..ab9aeb852e5ea89583284386d9a78a3e3e17a310 100644
|
||||
--- a/content/common/frame.mojom
|
||||
+++ b/content/common/frame.mojom
|
||||
@@ -658,6 +658,10 @@ struct CreateNewWindowParams {
|
||||
@@ -617,6 +617,10 @@ struct CreateNewWindowParams {
|
||||
pending_associated_remote<blink.mojom.Widget> widget;
|
||||
pending_associated_receiver<blink.mojom.FrameWidgetHost> frame_widget_host;
|
||||
pending_associated_remote<blink.mojom.FrameWidget> frame_widget;
|
||||
@@ -77,10 +77,10 @@ index 19dbb921c9644522588ff74d0a1925f826736957..4e7b36729741a79cfdf04f89a8ec615d
|
||||
|
||||
// Operation result when the renderer asks the browser to create a new window.
|
||||
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
|
||||
index d2dccc29b0e13ab5c87b4c6803e79dc781e52ea2..be6639ef1a7eebb147afee483a35898d1ea5d95f 100644
|
||||
index 836d27b82b0798be4a17484903284810d86e4ff9..b06cd802b7e9bedf038a0b84fd1f242c1664a6ed 100644
|
||||
--- a/content/public/browser/content_browser_client.cc
|
||||
+++ b/content/public/browser/content_browser_client.cc
|
||||
@@ -877,6 +877,8 @@ bool ContentBrowserClient::CanCreateWindow(
|
||||
@@ -874,6 +874,8 @@ bool ContentBrowserClient::CanCreateWindow(
|
||||
const std::string& frame_name,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& features,
|
||||
@@ -90,7 +90,7 @@ index d2dccc29b0e13ab5c87b4c6803e79dc781e52ea2..be6639ef1a7eebb147afee483a35898d
|
||||
bool opener_suppressed,
|
||||
bool* no_javascript_access) {
|
||||
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
|
||||
index 3b6c42b2c4cd5d9e5753af25b27925ff0d933568..e6f51d39b4f2f6b162814996921958ca1252e1d7 100644
|
||||
index 7032139f91aadab0e854182d95eb97422a4182b3..f6ceaf652707d355780d8009339a42bbc271bd07 100644
|
||||
--- a/content/public/browser/content_browser_client.h
|
||||
+++ b/content/public/browser/content_browser_client.h
|
||||
@@ -205,6 +205,7 @@ class NetworkService;
|
||||
@@ -101,7 +101,7 @@ index 3b6c42b2c4cd5d9e5753af25b27925ff0d933568..e6f51d39b4f2f6b162814996921958ca
|
||||
} // namespace network
|
||||
|
||||
namespace sandbox {
|
||||
@@ -1468,6 +1469,8 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
@@ -1457,6 +1458,8 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
const std::string& frame_name,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& features,
|
||||
@@ -170,10 +170,10 @@ index 0650197909d484b8a0f48ab61b22471c71bce0e8..29c380d7845aab1a7b3417e0d3940ea0
|
||||
// typically happens when popups are created.
|
||||
virtual void WebContentsCreated(WebContents* source_contents,
|
||||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
||||
index 6ee766c52202804adc532b1585224b4e35239f9a..42a0a7e5be01fe346cc2ad83d3395425a41e1699 100644
|
||||
index 017007ee611e3cbb718085096b38c60677c0863c..0e64b0a0ac8387ab15b201a9fc0f0fd36cd5ab29 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -6879,6 +6879,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
|
||||
@@ -6842,6 +6842,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
|
||||
params->started_by_ad =
|
||||
GetWebFrame()->IsAdFrame() || GetWebFrame()->IsAdScriptInStack();
|
||||
|
||||
@@ -224,10 +224,10 @@ index d92bab531c12c62a5321a23f4a0cb89691668127..2060e04795ba8e7a923fd0fe3485b8c5
|
||||
|
||||
} // namespace blink
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
index 715ca6e188c7e821478fcbaa4496efd25a673c61..e58465eb936b2a8b3479201ec24580501f7fc2f3 100644
|
||||
index 87856b74d5e0a323b8527d783316d1aab1cf9b1e..9f0d95954ed3d7c7e3ac4825f31ee55255e0c46f 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
@@ -2341,6 +2341,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
||||
@@ -2366,6 +2366,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
||||
WebWindowFeatures window_features =
|
||||
GetWindowFeaturesFromString(features, entered_window);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ index d64fef6bfc37264dcdc1bbea22eb5c4e099553dd..41d40326505c4ced9837df7f03b791c9
|
||||
int64_t service_worker_version_id,
|
||||
const GURL& service_worker_scope,
|
||||
diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h
|
||||
index dd4cee346f16df703d414bf206bbe6c9f4b1f796..5565f5a9259bd7da0722080bf01b34158cf0b72b 100644
|
||||
index 1d03dc809d4c18f24314d94811e0bf527aa7b5b4..16030bcecb2e39b8870144ce7c3d11dd4c7fb15e 100644
|
||||
--- a/content/public/renderer/render_frame_observer.h
|
||||
+++ b/content/public/renderer/render_frame_observer.h
|
||||
@@ -143,7 +143,8 @@ class CONTENT_EXPORT RenderFrameObserver {
|
||||
@@ -34,10 +34,10 @@ index dd4cee346f16df703d414bf206bbe6c9f4b1f796..5565f5a9259bd7da0722080bf01b3415
|
||||
virtual void DidClearWindowObject() {}
|
||||
virtual void DidChangeScrollOffset() {}
|
||||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
||||
index 40d1f104794795dba6cd59518819e98a4cdbfc44..8352f70c6c11af2890a03a2fae1729d27fc8da1f 100644
|
||||
index f28214d369138eb854a556165f0a946c07cfdb9c..7fb428cfdda42d1aac6922f2ed6f37369d4979e2 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -4775,10 +4775,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures(
|
||||
@@ -4737,10 +4737,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures(
|
||||
observer.DidInstallConditionalFeatures(context, world_id);
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ index 40d1f104794795dba6cd59518819e98a4cdbfc44..8352f70c6c11af2890a03a2fae1729d2
|
||||
|
||||
void RenderFrameImpl::DidChangeScrollOffset() {
|
||||
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
|
||||
index ced097d57cec93b3d3062a6d7d9f7d037a355e6c..c08b9323175e5ec62203fa74d93a307aa35f3616 100644
|
||||
index 2ce05bce0a02338aba018c18f0a808a4eb392ff4..2736b65de7f0a6e4cd2d56970d35687da8fcab6b 100644
|
||||
--- a/content/renderer/render_frame_impl.h
|
||||
+++ b/content/renderer/render_frame_impl.h
|
||||
@@ -608,7 +608,8 @@ class CONTENT_EXPORT RenderFrameImpl
|
||||
@@ -609,7 +609,8 @@ class CONTENT_EXPORT RenderFrameImpl
|
||||
int world_id) override;
|
||||
void DidInstallConditionalFeatures(v8::Local<v8::Context> context,
|
||||
int world_id) override;
|
||||
@@ -66,10 +66,10 @@ index ced097d57cec93b3d3062a6d7d9f7d037a355e6c..c08b9323175e5ec62203fa74d93a307a
|
||||
void DidChangeScrollOffset() override;
|
||||
blink::WebMediaStreamDeviceObserver* MediaStreamDeviceObserver() override;
|
||||
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc
|
||||
index 4ccae569b496608901a3c634a3ac41de5d0bf3e8..332f2d2bc690de8f5e9787ba22ad268a21781b95 100644
|
||||
index b708018b7061eaf610758d6c9230cff1c4e272ef..79cec0d0c508e590f6e5ad481c9e26f91ab68da9 100644
|
||||
--- a/content/renderer/service_worker/service_worker_context_client.cc
|
||||
+++ b/content/renderer/service_worker/service_worker_context_client.cc
|
||||
@@ -319,6 +319,7 @@ void ServiceWorkerContextClient::WorkerContextStarted(
|
||||
@@ -318,6 +318,7 @@ void ServiceWorkerContextClient::WorkerContextStarted(
|
||||
}
|
||||
|
||||
void ServiceWorkerContextClient::WillEvaluateScript(
|
||||
@@ -77,7 +77,7 @@ index 4ccae569b496608901a3c634a3ac41de5d0bf3e8..332f2d2bc690de8f5e9787ba22ad268a
|
||||
v8::Local<v8::Context> v8_context) {
|
||||
DCHECK(worker_task_runner_->RunsTasksInCurrentSequence());
|
||||
start_timing_->script_evaluation_start_time = base::TimeTicks::Now();
|
||||
@@ -337,8 +338,8 @@ void ServiceWorkerContextClient::WillEvaluateScript(
|
||||
@@ -336,8 +337,8 @@ void ServiceWorkerContextClient::WillEvaluateScript(
|
||||
|
||||
DCHECK(proxy_);
|
||||
GetContentClient()->renderer()->WillEvaluateServiceWorkerOnWorkerThread(
|
||||
@@ -127,10 +127,10 @@ index c2a6eb257469647183167dad78f1ea42fa3922bb..3423e3a8315c5fc5958ec75adf3a844f
|
||||
int64_t service_worker_version_id,
|
||||
const GURL& service_worker_scope,
|
||||
diff --git a/extensions/renderer/extension_frame_helper.cc b/extensions/renderer/extension_frame_helper.cc
|
||||
index 89515878024756de8263622e054e50a9ad284232..f1e94fd2583d18641ab91d9d598ad94a4fd607e0 100644
|
||||
index 1ab0e8afc84b8e14f3a7f241f8d24ceac0abf188..2d1dbc6f57a0c6ba91194dde5da4de9d0bd5d383 100644
|
||||
--- a/extensions/renderer/extension_frame_helper.cc
|
||||
+++ b/extensions/renderer/extension_frame_helper.cc
|
||||
@@ -450,6 +450,7 @@ void ExtensionFrameHelper::DidCreateScriptContext(
|
||||
@@ -449,6 +449,7 @@ void ExtensionFrameHelper::DidCreateScriptContext(
|
||||
}
|
||||
|
||||
void ExtensionFrameHelper::WillReleaseScriptContext(
|
||||
@@ -167,10 +167,10 @@ index f96781a047056876b030581b539be0507acc3a1c..cd9be80be2500a001b1895c81ee597dd
|
||||
// Called when initial script evaluation finished for the main script.
|
||||
// |success| is true if the evaluation completed with no uncaught exception.
|
||||
diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h
|
||||
index d241042fc37ffe4a2afecbc3c02e89f18e990929..044c38438029702fdbb6747b64932bd0d26372a5 100644
|
||||
index 27b21f02d2dbfd60cb64f09be393b0e50928756f..c8da817ffab883573ae2dcfb6fb02d2baf8bcdaf 100644
|
||||
--- a/third_party/blink/public/web/web_local_frame_client.h
|
||||
+++ b/third_party/blink/public/web/web_local_frame_client.h
|
||||
@@ -678,7 +678,8 @@ class BLINK_EXPORT WebLocalFrameClient {
|
||||
@@ -679,7 +679,8 @@ class BLINK_EXPORT WebLocalFrameClient {
|
||||
int32_t world_id) {}
|
||||
|
||||
// WebKit is about to release its reference to a v8 context for a frame.
|
||||
@@ -200,10 +200,10 @@ index 0787bc8a602c60e5b42933813baa6b9d923c9823..c4adcc6083e09e56416587fbcde10c90
|
||||
->ContextWillBeDestroyed(script_state_);
|
||||
if (next_status == Lifecycle::kV8MemoryIsForciblyPurged ||
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame_client.h b/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
index a6331653b0aaf30cedba6ff6df787aa944142ac4..434376be228962e08f49fbfc3b81e8f79557301c 100644
|
||||
index ae565a4d3fdc2d02e2c7a27312d8296bbdf61e0b..f54cc6c10a957a2218258f72de2b92a2ba96f9ea 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
@@ -311,7 +311,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
|
||||
@@ -312,7 +312,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
|
||||
int32_t world_id) = 0;
|
||||
virtual void DidInstallConditionalFeatures(v8::Local<v8::Context>,
|
||||
int32_t world_id) = 0;
|
||||
@@ -214,7 +214,7 @@ index a6331653b0aaf30cedba6ff6df787aa944142ac4..434376be228962e08f49fbfc3b81e8f7
|
||||
virtual bool AllowScriptExtensions() = 0;
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
|
||||
index 26410fc221baf1fadb6220eb653c651b47fb3da7..462a581f4acb44e44a65cb163a1530e57c903e8f 100644
|
||||
index aaf03855e53d5529bb51d70cd9b4355d68fed48c..a889202f30bc4a3b6bc7dc3fc7b4fc5058684bcb 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
|
||||
@@ -309,10 +309,11 @@ void LocalFrameClientImpl::DidInstallConditionalFeatures(
|
||||
@@ -231,7 +231,7 @@ index 26410fc221baf1fadb6220eb653c651b47fb3da7..462a581f4acb44e44a65cb163a1530e5
|
||||
}
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.h b/third_party/blink/renderer/core/frame/local_frame_client_impl.h
|
||||
index ea9e16b6dd6c96333c653fc602edfbd84cd9e5de..78c7c3a446a531fb7c77813f4cae45546c868561 100644
|
||||
index cc593168947e469b599794260692e1deb9b5f1a5..6b360ad1c123f5e6fef9b127ae55968456172776 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.h
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.h
|
||||
@@ -80,7 +80,8 @@ class CORE_EXPORT LocalFrameClientImpl final : public LocalFrameClient {
|
||||
@@ -245,10 +245,10 @@ index ea9e16b6dd6c96333c653fc602edfbd84cd9e5de..78c7c3a446a531fb7c77813f4cae4554
|
||||
|
||||
// Returns true if we should allow register V8 extensions to be added.
|
||||
diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
index f762722e2e2a27db2488aae25d78e79598f6a4b4..477a22d283796e60762d3be2a951bca58bfce182 100644
|
||||
index 5a0f42b4b7e5eb67d476c948caa201ee6fc7b3ca..1a0562ad9ccfd414d6295b597b9d8094df384ff5 100644
|
||||
--- a/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
+++ b/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
@@ -424,7 +424,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
|
||||
@@ -427,7 +427,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
|
||||
int32_t world_id) override {}
|
||||
void DidInstallConditionalFeatures(v8::Local<v8::Context>,
|
||||
int32_t world_id) override {}
|
||||
|
||||
@@ -34,10 +34,10 @@ index cc3f9bc9383f8272a5cd95b1f2ac56529d86e493..5ca29b84cdaf42ef516ef819ae32b230
|
||||
|
||||
class ScrollEvent;
|
||||
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
index 31060227432ab705c4f2c4c52233f2f23d860124..ceb6e3ad0e60b1aaee47c24564ca9fd8b3c2e71f 100644
|
||||
index 340a8d61e302c1b1ca6ad0dfb859fc9b0e4106b6..e4da40256ce94d6a0896792a8ef2faa18e1fa5d2 100644
|
||||
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
@@ -1405,6 +1405,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() {
|
||||
@@ -1417,6 +1417,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() {
|
||||
return background_paint_brush_;
|
||||
}
|
||||
|
||||
@@ -49,10 +49,10 @@ index 31060227432ab705c4f2c4c52233f2f23d860124..ceb6e3ad0e60b1aaee47c24564ca9fd8
|
||||
DesktopWindowTreeHostWin::GetSingletonDesktopNativeCursorManager() {
|
||||
return new DesktopNativeCursorManagerWin();
|
||||
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
|
||||
index b65ced55f997d5064b9d9338190567f8c264fce8..e8acd2828ed05deefa335ce2bb461f0c3be8d7b7 100644
|
||||
index a389e96de45c8a380e4db23821feb396dab9bcbb..27322ef34edf3fa8bfbd20b1baddcaf3b7555618 100644
|
||||
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
|
||||
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
|
||||
@@ -273,6 +273,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
|
||||
@@ -275,6 +275,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
|
||||
void HandleWindowScaleFactorChanged(float window_scale_factor) override;
|
||||
void HandleHeadlessWindowBoundsChanged(const gfx::Rect& bounds) override;
|
||||
HBRUSH GetBackgroundPaintBrush() override;
|
||||
@@ -61,10 +61,10 @@ index b65ced55f997d5064b9d9338190567f8c264fce8..e8acd2828ed05deefa335ce2bb461f0c
|
||||
Widget* GetWidget();
|
||||
const Widget* GetWidget() const;
|
||||
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
|
||||
index cc86c89d5670fd53eb3eea2aa31f054475b47b4b..b1950dade1cc98a82c75b4b242a34338b2ba741c 100644
|
||||
index 19f6ade2c4b3b9c66c949c944c41c6a238448016..efa35533610a034ef77d22970273088445976343 100644
|
||||
--- a/ui/views/win/hwnd_message_handler.cc
|
||||
+++ b/ui/views/win/hwnd_message_handler.cc
|
||||
@@ -3268,15 +3268,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
||||
@@ -3277,15 +3277,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
||||
}
|
||||
// We must let Windows handle the caption buttons if it's drawing them, or
|
||||
// they won't work.
|
||||
@@ -86,7 +86,7 @@ index cc86c89d5670fd53eb3eea2aa31f054475b47b4b..b1950dade1cc98a82c75b4b242a34338
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -3299,6 +3303,7 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
||||
@@ -3308,6 +3312,7 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
||||
// handle alt-space, or in the frame itself.
|
||||
is_right_mouse_pressed_on_caption_ = false;
|
||||
::ReleaseCapture();
|
||||
@@ -94,7 +94,7 @@ index cc86c89d5670fd53eb3eea2aa31f054475b47b4b..b1950dade1cc98a82c75b4b242a34338
|
||||
// |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu()
|
||||
// expect screen coordinates.
|
||||
POINT screen_point = CR_POINT_INITIALIZER_FROM_LPARAM(l_param);
|
||||
@@ -3306,7 +3311,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
||||
@@ -3315,7 +3320,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
||||
w_param = static_cast<WPARAM>(::SendMessage(
|
||||
hwnd(), WM_NCHITTEST, 0, MAKELPARAM(screen_point.x, screen_point.y)));
|
||||
if (w_param == HTCAPTION || w_param == HTSYSMENU) {
|
||||
@@ -114,10 +114,10 @@ index cc86c89d5670fd53eb3eea2aa31f054475b47b4b..b1950dade1cc98a82c75b4b242a34338
|
||||
}
|
||||
} else if (message == WM_NCLBUTTONDOWN &&
|
||||
diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h
|
||||
index 20cfb50af8d5131ca87d1fafce6f2ab43771f67b..eee40a56bebe52187a35daacfc788bf2f1f27e29 100644
|
||||
index 727cb38b1198a2fde104b4f45e566383c4446de5..1261be469317cdfb20d03f0e34c570ac2c3b0ba1 100644
|
||||
--- a/ui/views/win/hwnd_message_handler_delegate.h
|
||||
+++ b/ui/views/win/hwnd_message_handler_delegate.h
|
||||
@@ -260,6 +260,10 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate {
|
||||
@@ -263,6 +263,10 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate {
|
||||
// if the default should be used.
|
||||
virtual HBRUSH GetBackgroundPaintBrush() = 0;
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it
|
||||
by changing something in Electron.
|
||||
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index b3215ec81f8d750cfaa9b66a4880c6a90a6e183d..2d993b4265f6be26da1f0bc98520eec3fe393645 100644
|
||||
index 97af9d9d374b9145e0e8a05cd5e48a621e2b0e87..a10a56827e0d277dfcc5bc8e72f90f7539ed50fd 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -5356,7 +5356,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -5468,7 +5468,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
: IsGuest();
|
||||
// While some guest types do not have a guest SiteInstance, the ones that
|
||||
// don't all override WebContents creation above.
|
||||
|
||||
@@ -7,10 +7,10 @@ Electron does not support Profiles, so we need to patch it out of any
|
||||
code that we use.
|
||||
|
||||
diff --git a/chrome/browser/pdf/chrome_pdf_stream_delegate.cc b/chrome/browser/pdf/chrome_pdf_stream_delegate.cc
|
||||
index 21d5ab99800c0830cc31ec4ebb24e3f05cd904d8..3f8f514519d6e4a0abe3690f5df35de8ffae6fd4 100644
|
||||
index 9ee981bbb9b7bd10a33e619b5ac7ff35373bbc53..f31e633db609fb211f3db25e563f357166ca510e 100644
|
||||
--- a/chrome/browser/pdf/chrome_pdf_stream_delegate.cc
|
||||
+++ b/chrome/browser/pdf/chrome_pdf_stream_delegate.cc
|
||||
@@ -45,6 +45,7 @@ namespace {
|
||||
@@ -46,6 +46,7 @@ namespace {
|
||||
// hierarchy is: enterprise policy > user choice > finch experiment.
|
||||
bool ShouldEnableSkiaRenderer(content::WebContents* contents) {
|
||||
CHECK(contents);
|
||||
@@ -18,7 +18,7 @@ index 21d5ab99800c0830cc31ec4ebb24e3f05cd904d8..3f8f514519d6e4a0abe3690f5df35de8
|
||||
const PrefService* prefs =
|
||||
Profile::FromBrowserContext(contents->GetBrowserContext())->GetPrefs();
|
||||
|
||||
@@ -52,6 +53,7 @@ bool ShouldEnableSkiaRenderer(content::WebContents* contents) {
|
||||
@@ -53,6 +54,7 @@ bool ShouldEnableSkiaRenderer(content::WebContents* contents) {
|
||||
if (prefs->IsManagedPreference(prefs::kPdfUseSkiaRendererEnabled)) {
|
||||
return prefs->GetBoolean(prefs::kPdfUseSkiaRendererEnabled);
|
||||
}
|
||||
@@ -26,7 +26,7 @@ index 21d5ab99800c0830cc31ec4ebb24e3f05cd904d8..3f8f514519d6e4a0abe3690f5df35de8
|
||||
|
||||
// When the enterprise policy is not set, use finch/feature flag choice.
|
||||
return base::FeatureList::IsEnabled(
|
||||
@@ -63,6 +65,7 @@ bool ShouldEnableSkiaRenderer(content::WebContents* contents) {
|
||||
@@ -64,6 +66,7 @@ bool ShouldEnableSkiaRenderer(content::WebContents* contents) {
|
||||
// priority hierarchy is: enterprise policy > user choice > finch experiment.
|
||||
bool ShouldEnableXfaForms(content::WebContents* contents) {
|
||||
CHECK(contents);
|
||||
@@ -34,7 +34,7 @@ index 21d5ab99800c0830cc31ec4ebb24e3f05cd904d8..3f8f514519d6e4a0abe3690f5df35de8
|
||||
const PrefService* prefs =
|
||||
Profile::FromBrowserContext(contents->GetBrowserContext())->GetPrefs();
|
||||
|
||||
@@ -70,6 +73,7 @@ bool ShouldEnableXfaForms(content::WebContents* contents) {
|
||||
@@ -71,6 +74,7 @@ bool ShouldEnableXfaForms(content::WebContents* contents) {
|
||||
if (prefs->IsManagedPreference(prefs::kPdfXfaFormsEnabled)) {
|
||||
return prefs->GetBoolean(prefs::kPdfXfaFormsEnabled);
|
||||
}
|
||||
@@ -43,10 +43,10 @@ index 21d5ab99800c0830cc31ec4ebb24e3f05cd904d8..3f8f514519d6e4a0abe3690f5df35de8
|
||||
// When the enterprise policy is not set, use finch/feature flag choice.
|
||||
return base::FeatureList::IsEnabled(chrome_pdf::features::kPdfXfaSupport);
|
||||
diff --git a/chrome/browser/pdf/pdf_extension_util.cc b/chrome/browser/pdf/pdf_extension_util.cc
|
||||
index 6f0d11aaf59d1f84b24a5cf33690035b84288f55..64d41eb402b0199d99ec6e37747a1a1a05733052 100644
|
||||
index 41ebdb0c0af1ab94d3376a51e66c44cd26b6ed3f..274d3432576c36262885ec8fdf6c8f75c919dbe9 100644
|
||||
--- a/chrome/browser/pdf/pdf_extension_util.cc
|
||||
+++ b/chrome/browser/pdf/pdf_extension_util.cc
|
||||
@@ -256,10 +256,13 @@ bool IsPrintingEnabled(content::BrowserContext* context) {
|
||||
@@ -257,10 +257,13 @@ bool IsPrintingEnabled(content::BrowserContext* context) {
|
||||
|
||||
#if BUILDFLAG(ENABLE_PDF_INK2)
|
||||
bool IsPdfAnnotationsEnabledByPolicy(content::BrowserContext* context) {
|
||||
@@ -60,7 +60,7 @@ index 6f0d11aaf59d1f84b24a5cf33690035b84288f55..64d41eb402b0199d99ec6e37747a1a1a
|
||||
}
|
||||
|
||||
bool IsPdfInk2AnnotationsEnabled(content::BrowserContext* context) {
|
||||
@@ -452,6 +455,7 @@ void DispatchShouldUpdateViewportEvent(content::RenderFrameHost* embedder_host,
|
||||
@@ -453,6 +456,7 @@ void DispatchShouldUpdateViewportEvent(content::RenderFrameHost* embedder_host,
|
||||
}
|
||||
|
||||
bool ShouldShowGlicSummarizeButton(content::BrowserContext* context) {
|
||||
@@ -68,16 +68,15 @@ index 6f0d11aaf59d1f84b24a5cf33690035b84288f55..64d41eb402b0199d99ec6e37747a1a1a
|
||||
Profile* profile = Profile::FromBrowserContext(context);
|
||||
if (!glic::GlicEnabling::IsEnabledForProfile(profile)) {
|
||||
return false;
|
||||
@@ -465,6 +469,9 @@ bool ShouldShowGlicSummarizeButton(content::BrowserContext* context) {
|
||||
@@ -469,7 +473,7 @@ bool ShouldShowGlicSummarizeButton(content::BrowserContext* context) {
|
||||
if (glic::GlicEnabling::IsTrustFirstOnboardingEnabledForProfile(profile)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return base::FeatureList::IsEnabled(features::kPdfGlicSummarize);
|
||||
+#else
|
||||
+ return false;
|
||||
-
|
||||
+#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace pdf_extension_util
|
||||
diff --git a/chrome/browser/profiles/profile_selections.cc b/chrome/browser/profiles/profile_selections.cc
|
||||
index bc0bad82ebcdceadc505e912ff27202b452fefab..6b77c57fccc4619a1df3b4ed661d2bdd60960228 100644
|
||||
--- a/chrome/browser/profiles/profile_selections.cc
|
||||
|
||||
@@ -80,10 +80,10 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params,
|
||||
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
|
||||
index 8899a3216052582e35c5c046e1e0baee48052452..461cb574dc1083fae0bc96e53ed94ba117f7691d 100644
|
||||
index e7fe85a1eae545b1bdcfd81d23ec607a42f3941a..d33125fb7e76b15d68d3c88be319f5ca93f82163 100644
|
||||
--- a/chrome/browser/ui/browser.cc
|
||||
+++ b/chrome/browser/ui/browser.cc
|
||||
@@ -2288,7 +2288,8 @@ bool Browser::IsWebContentsCreationOverridden(
|
||||
@@ -2292,7 +2292,8 @@ bool Browser::IsWebContentsCreationOverridden(
|
||||
content::mojom::WindowContainerType window_container_type,
|
||||
const GURL& opener_url,
|
||||
const std::string& frame_name,
|
||||
@@ -93,7 +93,7 @@ index 8899a3216052582e35c5c046e1e0baee48052452..461cb574dc1083fae0bc96e53ed94ba1
|
||||
if (HasActorTaskPreventingNewWebContents(profile(), opener)) {
|
||||
// If an ExecutionEngine is acting on the opener, prevent it from creating a
|
||||
// new WebContents. We'll instead force the navigation to happen in the same
|
||||
@@ -2301,7 +2302,7 @@ bool Browser::IsWebContentsCreationOverridden(
|
||||
@@ -2305,7 +2306,7 @@ bool Browser::IsWebContentsCreationOverridden(
|
||||
return (window_container_type ==
|
||||
content::mojom::WindowContainerType::BACKGROUND &&
|
||||
ShouldCreateBackgroundContents(source_site_instance, opener_url,
|
||||
@@ -103,10 +103,10 @@ index 8899a3216052582e35c5c046e1e0baee48052452..461cb574dc1083fae0bc96e53ed94ba1
|
||||
|
||||
WebContents* Browser::CreateCustomWebContents(
|
||||
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
|
||||
index e92caadbec713996d7eb0af9e59ed4a3f14ea148..fe904aaa2ee0f94d3ff34174bac82464dfded91a 100644
|
||||
index b78f6ff36aaf1f541fedb8e2cb652f69227c506e..a8c426b0c1099822e9f2396981bf347d9318c451 100644
|
||||
--- a/chrome/browser/ui/browser.h
|
||||
+++ b/chrome/browser/ui/browser.h
|
||||
@@ -916,8 +916,7 @@ class Browser : public TabStripModelObserver,
|
||||
@@ -917,8 +917,7 @@ class Browser : public TabStripModelObserver,
|
||||
content::SiteInstance* source_site_instance,
|
||||
content::mojom::WindowContainerType window_container_type,
|
||||
const GURL& opener_url,
|
||||
@@ -223,10 +223,10 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5
|
||||
content::WebContents* AddNewContents(
|
||||
content::WebContents* source,
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index f605f46115cda0f8f06e5274a26e3b997ca4c62e..16c4c2f73643314a9b8287e13a6472dff2671652 100644
|
||||
index e70e2ecc3d0c5563a47f7b8a38a4face1d78d6d5..3b3f3ec690311d2f6e20fee8cf280c26bef77e76 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -5320,8 +5320,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -5432,8 +5432,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
if (delegate_ &&
|
||||
delegate_->IsWebContentsCreationOverridden(
|
||||
opener, source_site_instance, params.window_container_type,
|
||||
@@ -329,10 +329,10 @@ index 709994f0523c39d432fe45882ad839d9ab721822..af9f5907d729a2d8225abea37ee6ceb5
|
||||
content::RenderFrameHost* opener,
|
||||
content::SiteInstance* source_site_instance,
|
||||
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
|
||||
index 850e8688c769e62e6ed88182e1d46d00495d1a49..264149120abd0a0697a09465008eb007657175bc 100644
|
||||
index 55fe63822bbdead27e607e7827d1e743162d17ee..8f4dc7840372f8734a004d27eabd190bf260b020 100644
|
||||
--- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
|
||||
+++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
|
||||
@@ -411,8 +411,7 @@ bool MimeHandlerViewGuest::IsWebContentsCreationOverridden(
|
||||
@@ -384,8 +384,7 @@ bool MimeHandlerViewGuest::IsWebContentsCreationOverridden(
|
||||
content::SiteInstance* source_site_instance,
|
||||
content::mojom::WindowContainerType window_container_type,
|
||||
const GURL& opener_url,
|
||||
@@ -343,10 +343,10 @@ index 850e8688c769e62e6ed88182e1d46d00495d1a49..264149120abd0a0697a09465008eb007
|
||||
|
||||
return true;
|
||||
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
|
||||
index a23493edbd1cac256a9914aabe2a53042326a192..b2d50c7cbfe30baa0f2a3218ef5190242d7ad0a7 100644
|
||||
index f459dddeb3f8f3a33ffead0e96fba791d18a0108..f7a229b186774ca3a01f2d747eab139ad6fc17a2 100644
|
||||
--- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
|
||||
+++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
|
||||
@@ -185,8 +185,7 @@ class MimeHandlerViewGuest
|
||||
@@ -128,8 +128,7 @@ class MimeHandlerViewGuest
|
||||
content::SiteInstance* source_site_instance,
|
||||
content::mojom::WindowContainerType window_container_type,
|
||||
const GURL& opener_url,
|
||||
|
||||
@@ -9,7 +9,7 @@ Electron when a session is non persistent we do not initialize the
|
||||
ExtensionSystem, so this check is not relevant for Electron.
|
||||
|
||||
diff --git a/extensions/browser/script_injection_tracker.cc b/extensions/browser/script_injection_tracker.cc
|
||||
index 78e82a70e4a5d323f25d4d90eac1c5e4f070d24d..f7ab8718503695217d398f2ee7c2b37ab4320341 100644
|
||||
index 3376f8a35490899440697d8643a096dc9d6151d9..7797626646b282dcd9e16b3b38fee07c6f75a0bc 100644
|
||||
--- a/extensions/browser/script_injection_tracker.cc
|
||||
+++ b/extensions/browser/script_injection_tracker.cc
|
||||
@@ -176,7 +176,6 @@ std::vector<const UserScript*> GetLoadedDynamicScripts(
|
||||
|
||||
@@ -8,10 +8,10 @@ Allow registering custom protocols to handle service worker main script fetching
|
||||
Refs https://bugs.chromium.org/p/chromium/issues/detail?id=996511
|
||||
|
||||
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc
|
||||
index fdfa916eac0b6dd3f0fd09f284245f0ceb1b176e..26400bf6d5e0f48d649a31a27e33c8bc812990a6 100644
|
||||
index 701ce5df52e77f9277b5d548b82eef3120435bf2..0974935ea7a72ade31270c10abfee1be92a3dcb9 100644
|
||||
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
|
||||
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
|
||||
@@ -1958,6 +1958,25 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
@@ -1954,6 +1954,25 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
loader_factory_bundle_info =
|
||||
context()->loader_factory_bundle_for_update_check()->Clone();
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ index 786c526588d81b8b5b1b5dd3760719a53e005995..f66b7d0b4dfcbb8ed3dde5a9ff463ae2
|
||||
const Source& GetSource(int index) const override;
|
||||
DesktopMediaList::Type GetMediaListType() const override;
|
||||
diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc
|
||||
index 7c72345e20589fe078169426d9b5b5a0ae81bae8..2c86b75c43651bd78d5ff7eeb54aa366ee3228bc 100644
|
||||
index 2b745dbb254c714756a953ac0a32c1430af2c91d..9a8ebb4edfb92d9fe28ae4b87463a68547ea1ab3 100644
|
||||
--- a/chrome/browser/media/webrtc/native_desktop_media_list.cc
|
||||
+++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc
|
||||
@@ -216,9 +216,13 @@ content::DesktopMediaID::Id GetUpdatedWindowId(
|
||||
@@ -121,7 +121,7 @@ index 7c72345e20589fe078169426d9b5b5a0ae81bae8..2c86b75c43651bd78d5ff7eeb54aa366
|
||||
}
|
||||
|
||||
void NativeDesktopMediaList::Worker::OnCaptureResult(
|
||||
@@ -1009,6 +1019,11 @@ void NativeDesktopMediaList::RefreshForVizFrameSinkWindows(
|
||||
@@ -1015,6 +1025,11 @@ void NativeDesktopMediaList::RefreshForVizFrameSinkWindows(
|
||||
FROM_HERE, base::BindOnce(&Worker::RefreshThumbnails,
|
||||
base::Unretained(worker_.get()),
|
||||
std::move(native_ids), thumbnail_size_));
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: fix: disabling compositor recycling
|
||||
Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
||||
index 2375ed828ee173932754c49299ccb6e5b0521a1c..cbdbbdba6d5d836a7e942450a87510c1873bbbca 100644
|
||||
index 0747a20b283151a75c524dc0fa74c7b799725e54..7541f191cc20c10a6bb85a7bd5f3eaa71051a519 100644
|
||||
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
|
||||
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
||||
@@ -588,7 +588,11 @@
|
||||
@@ -592,7 +592,11 @@
|
||||
}
|
||||
|
||||
host()->WasHidden();
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: feat: enable setting aspect ratio to 0
|
||||
Make SetAspectRatio accept 0 as valid input, which would reset to null.
|
||||
|
||||
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
index c9edcfeb4df4a52dd744b43f04ff1675f566a620..31060227432ab705c4f2c4c52233f2f23d860124 100644
|
||||
index 4c1c0c60b69f1a0ee7f98e03e6d8d2ca05645b0a..340a8d61e302c1b1ca6ad0dfb859fc9b0e4106b6 100644
|
||||
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
@@ -638,7 +638,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) {
|
||||
@@ -19,10 +19,10 @@ index c9edcfeb4df4a52dd744b43f04ff1675f566a620..31060227432ab705c4f2c4c52233f2f2
|
||||
excluded_margin);
|
||||
}
|
||||
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
|
||||
index 6a4f780c6921d901e9f954d1f7ba18c40d8847b9..29560b1f244ba56018799eff1cf5d2eae3eb4e7c 100644
|
||||
index e00c2c13c180367375639838a13a7a7c846b3072..074223b543e70abd7fc3cb304424e166127b440c 100644
|
||||
--- a/ui/views/win/hwnd_message_handler.cc
|
||||
+++ b/ui/views/win/hwnd_message_handler.cc
|
||||
@@ -1047,8 +1047,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen,
|
||||
@@ -1051,8 +1051,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen,
|
||||
|
||||
void HWNDMessageHandler::SetAspectRatio(float aspect_ratio,
|
||||
const gfx::Size& excluded_margin) {
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <samuel.r.attard@gmail.com>
|
||||
Date: Tue, 3 Nov 2020 16:49:32 -0800
|
||||
Subject: export gin::V8Platform::PageAllocator for usage outside of the gin
|
||||
platform
|
||||
|
||||
In order for memory allocation in the main process node environment to be
|
||||
correctly tagged with MAP_JIT we need to use gins page allocator instead
|
||||
of the default V8 allocator. This probably can't be usptreamed.
|
||||
|
||||
diff --git a/gin/public/v8_platform.h b/gin/public/v8_platform.h
|
||||
index 8c32005730153251e93516340e4baa500d777178..ff444dc689542a909ec5aada39816931b3320921 100644
|
||||
--- a/gin/public/v8_platform.h
|
||||
+++ b/gin/public/v8_platform.h
|
||||
@@ -32,6 +32,7 @@ class GIN_EXPORT V8Platform : public v8::Platform {
|
||||
// enabling Arm's Branch Target Instructions for executable pages. This is
|
||||
// verified in the tests for gin::PageAllocator.
|
||||
PageAllocator* GetPageAllocator() override;
|
||||
+ static PageAllocator* GetCurrentPageAllocator();
|
||||
#if PA_BUILDFLAG(ENABLE_THREAD_ISOLATION)
|
||||
ThreadIsolatedAllocator* GetThreadIsolatedAllocator() override;
|
||||
#endif
|
||||
diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc
|
||||
index fe339f6a069064ec92bddd5df9df96f84d13bd9a..41bc93d602c6558620ec728ac8207dedbabdd407 100644
|
||||
--- a/gin/v8_platform.cc
|
||||
+++ b/gin/v8_platform.cc
|
||||
@@ -222,6 +222,10 @@ ThreadIsolatedAllocator* V8Platform::GetThreadIsolatedAllocator() {
|
||||
}
|
||||
#endif // PA_BUILDFLAG(ENABLE_THREAD_ISOLATION)
|
||||
|
||||
+PageAllocator* V8Platform::GetCurrentPageAllocator() {
|
||||
+ return g_page_allocator.Pointer();
|
||||
+}
|
||||
+
|
||||
void V8Platform::OnCriticalMemoryPressure() {
|
||||
// We only have a reservation on 32-bit Windows systems.
|
||||
// TODO(bbudge) Make the #if's in BlinkInitializer match.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user