Compare commits
1 Commits
ci/replace
...
print-win
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5edae41504 |
@@ -11,7 +11,6 @@
|
||||
"Bash(e patches:*)",
|
||||
"Bash(e sync:*)",
|
||||
"Skill(electron-chromium-upgrade)",
|
||||
"Skill(electron-node-upgrade)",
|
||||
"Read(*)",
|
||||
"Bash(echo:*)",
|
||||
"Bash(e build:*)",
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
---
|
||||
name: chrome-release-cls
|
||||
description: Given a Chrome Releases blog post URL (chromereleases.googleblog.com), extract every CVE/bug and find the underlying Gerrit CL that fixed it by searching the local Chromium checkout and sub-repos. Use when asked to map Chrome security release notes to fixing CLs, or to find which commits correspond to CVEs in a Chrome stable update.
|
||||
---
|
||||
|
||||
# Chrome Release → Fixing CL Mapper
|
||||
|
||||
Maps every security fix in a Chrome Releases blog post to the Gerrit CL(s) that fixed it.
|
||||
|
||||
## Input
|
||||
|
||||
`$ARGUMENTS` — a `https://chromereleases.googleblog.com/...` URL. If empty, ask the user for one.
|
||||
|
||||
## Procedure
|
||||
|
||||
### 1. Extract CVE → bug ID pairs from the blog post
|
||||
|
||||
The blog HTML buries bug IDs inside `<a>` tags, so strip tags first. Run:
|
||||
|
||||
```bash
|
||||
curl -sL "$URL" | python3 -c '
|
||||
import sys, re, html
|
||||
t = re.sub(r"<[^>]+>", " ", sys.stdin.read())
|
||||
t = re.sub(r"\s+", " ", html.unescape(t))
|
||||
seen = set()
|
||||
for m in re.finditer(r"\[\s*(\d{6,})\s*\]\s*(Critical|High|Medium|Low)\s*(CVE-\d{4}-\d+):\s*([^.]+?)\.", t):
|
||||
if m.group(3) in seen: continue
|
||||
seen.add(m.group(3))
|
||||
print(f"{m.group(3)}|{m.group(1)}|{m.group(2)}|{m.group(4).strip()}")
|
||||
' > /tmp/cve_bugs.txt
|
||||
cat /tmp/cve_bugs.txt
|
||||
```
|
||||
|
||||
If this yields nothing, the page may have changed format — fall back to `grep -oE 'CVE-[0-9]{4}-[0-9]+'` and `grep -oE 'crbug\.com/[0-9]+'` and pair them by order.
|
||||
|
||||
### 2. Find the fixing CL for each bug
|
||||
|
||||
Search git history in the Chromium checkout and relevant sub-repos for commits whose `Bug:` or `Fixed:` footer references the bug ID, then extract the `Reviewed-on:` Gerrit URL.
|
||||
|
||||
Repo selection by component keyword:
|
||||
- ANGLE → `third_party/angle`
|
||||
- Skia, Graphite → `third_party/skia`
|
||||
- PDFium → `third_party/pdfium`
|
||||
- Dawn → `third_party/dawn`
|
||||
- V8, Turbofan, Maglev, Turboshaft → `v8`
|
||||
- everything else → `.` (chromium/src)
|
||||
|
||||
Always also fall back to `.` if the hinted repo has no match.
|
||||
|
||||
```bash
|
||||
cd /root/src/electron/src # chromium root (parent of electron/)
|
||||
|
||||
lookup() {
|
||||
local bug="$1" repos="$2"
|
||||
for repo in $repos . v8 third_party/skia third_party/angle third_party/pdfium third_party/dawn; do
|
||||
local hits
|
||||
hits=$(git -C "$repo" log --all --since='6 months ago' -E \
|
||||
--grep="(Bug|Fixed):.*\\b${bug}\\b" --format='%H' 2>/dev/null | sort -u)
|
||||
[[ -z "$hits" ]] && continue
|
||||
while read -r h; do
|
||||
git -C "$repo" log -1 --format='%B' "$h" | grep '^Reviewed-on:' | sed 's/^/ /'
|
||||
echo " ↳ $(git -C "$repo" log -1 --format='%s' "$h")"
|
||||
done <<<"$hits"
|
||||
return 0
|
||||
done
|
||||
echo " (not found locally)"
|
||||
}
|
||||
```
|
||||
|
||||
Drive it from `/tmp/cve_bugs.txt`. Prefer the **non-`[M1xx]`-prefixed** commit subject as the canonical main CL; the `[M1xx]` ones are branch cherry-picks.
|
||||
|
||||
### 3. Handle misses
|
||||
|
||||
For any bug with no local hit:
|
||||
- `git -C <repo> fetch origin` then re-search `--remotes` (fix may be newer than the checkout).
|
||||
- Query Gerrit directly: `curl -s "https://chromium-review.googlesource.com/changes/?q=bug:${BUG}&n=10" | tail -n +2 | python3 -m json.tool` (also try `skia-review`, `pdfium-review`, `dawn-review`, `aomedia-review`).
|
||||
- **`b/` bug format (Skia, Graphite, Dawn):** These repos reference bugs as `b/<id>` in commit messages rather than `Bug: <id>` footers. The Gerrit `bug:` query will return nothing. Use `message:<id>` search instead:
|
||||
```bash
|
||||
curl -s "https://skia-review.googlesource.com/changes/?q=message:${BUG}&n=5" | tail -n +2
|
||||
```
|
||||
Apply the same pattern for `dawn-review.googlesource.com` when the component is Dawn.
|
||||
- **Tracing main CLs from merges:** When only `[M1xx]` merge CLs are found, query the CL detail for `cherry_pick_of_change` to find the original main CL number:
|
||||
```bash
|
||||
curl -s "https://chromium-review.googlesource.com/changes/${CL_NUM}?o=CURRENT_REVISION" | tail -n +2 | python3 -c "
|
||||
import sys, json
|
||||
d = json.load(sys.stdin)
|
||||
print(d.get('cherry_pick_of_change', 'none'))
|
||||
"
|
||||
```
|
||||
- If still nothing and the bug was reported very recently (especially by "Google Threat Intelligence" or marked in-the-wild), the CL is likely still access-restricted — report it as such rather than guessing.
|
||||
|
||||
### 4. Special cases
|
||||
|
||||
- **Roll CLs — skip and find the upstream fix:** For components whose fixes land in upstream repos (PDFium, Dawn, Skia, Graphite, libaom, libvpx, ffmpeg), the chromium-review hit will be a `Roll src/third_party/...` commit. Do not report the roll CL as the fix. Instead, query the component's own Gerrit instance directly for the actual fixing CL:
|
||||
- PDFium → `pdfium-review.googlesource.com` (use `bug:` or `message:` query)
|
||||
- Dawn → `dawn-review.googlesource.com` (use `message:` query — uses `b/` format)
|
||||
- Skia / Graphite → `skia-review.googlesource.com` (use `message:` query — uses `b/` format)
|
||||
- libaom → `aomedia-review.googlesource.com`
|
||||
|
||||
Only if the upstream Gerrit instance returns no results should you fall back to reporting the roll CL — in that case, include the roll CL and note that the actual fix is upstream but the specific CL could not be identified.
|
||||
- Multiple `Reviewed-on:` lines in one commit body: cherry-picks keep the original line plus a new one. The **first** `Reviewed-on:` is the original CL.
|
||||
- A bug may have multiple distinct fix CLs (fix + follow-up hardening) — list all of them.
|
||||
|
||||
### 5. Output
|
||||
|
||||
Produce a markdown table per severity level: `CVE | Bug | Component | Fix CL (main)`. Link bugs as `https://crbug.com/<id>`. Save raw output (including all branch merges) to `/tmp/cve_cls.txt` and mention the path.
|
||||
@@ -1,123 +0,0 @@
|
||||
---
|
||||
name: chrome-release-verify
|
||||
description: End-to-end Chrome security backport for an Electron release branch. Given a Chrome Releases blog URL and a branch (e.g. 41-x-y), determines which CVE fixes are missing from the *actual synced source*, writes the cherry-pick patches locally, validates them with `e sync --3` + `lint --patches`, then pushes a single PR. Use when asked to backport a Chrome security release to N-x-y, "is CVE-X already in N-x-y?", or to produce/validate the cherry-pick set for a release branch.
|
||||
---
|
||||
|
||||
# Chrome Release → Validated Backport PR
|
||||
|
||||
Input: `$ARGUMENTS` = `<release-branch> <chrome-releases-blog-url>` (e.g. `41-x-y https://chromereleases.googleblog.com/2026/04/stable-channel-update-for-desktop_15.html`). Ask if either is missing.
|
||||
|
||||
The flow is **local-first**: nothing is pushed until every patch applies via `e sync --3` and passes `lint --patches`.
|
||||
|
||||
## 1. Map CVE → bug → fix CL
|
||||
|
||||
Run `/chrome-release-cls <blog-url>` (or its inline procedure) to produce `/tmp/cve_bugs.txt` (`CVE|bug|severity|desc`) and a per-bug canonical fix CL. For each CL also note `repo` (path under `src/`: `.`, `v8`, `third_party/{skia,angle,pdfium,dawn}`, `third_party/libaom/source/libaom`) and `gerrit-host`.
|
||||
|
||||
**Prefer the target-milestone merge CL** if one exists (e.g. on `41-x-y` ≈ M146, prefer the `[M146]` cherry-pick over the main CL) — it's already rebased and far less likely to conflict. Find it via `git log --all --grep` on the Change-Id, or Gerrit `?q=bug:<n>`. If Chrome did *not* merge a fix to the target milestone, that's a strong signal the vulnerable code doesn't exist there — flag it for skip rather than forcing a port.
|
||||
|
||||
## 2. Prepare a synced worktree
|
||||
|
||||
Reuse `bp-<NN>` from `e show configs` if present, else `e worktree add bp-<NN> ~/src/electron-bp-<NN> --source <current> --no-sync`.
|
||||
|
||||
```bash
|
||||
cd <root>/src/electron
|
||||
git fetch origin <branch>
|
||||
git checkout -B security-backport/<branch>/<short-date> origin/<branch>
|
||||
e use bp-<NN>
|
||||
e sync 2>&1 | tee /tmp/bp_sync.log
|
||||
```
|
||||
|
||||
If sync fails with `NotADirectoryError: '<root>/src/.git/objects/info/alternates'`, remove `GIT_CACHE_PATH` from the bp config's `env` and retry.
|
||||
|
||||
## 3. Verify IN-TREE vs NEEDS-BACKPORT
|
||||
|
||||
For each bug, three checks against the **synced** repo:
|
||||
|
||||
1. `git -C "$repo" log HEAD --since='1 year ago' -E --grep="\b${bug}\b" --format='%h %s'`
|
||||
2. Fetch Change-Id from Gerrit, then `git log HEAD --grep="^Change-Id: ${cid}$"`
|
||||
3. `grep -rlE "(\b${bug}\b|${cid})" <root>/src/electron/patches/`
|
||||
|
||||
Any hit ⇒ IN-TREE. All empty ⇒ NEEDS-BACKPORT.
|
||||
|
||||
For each NEEDS-BACKPORT CL, also fetch its file list (`/changes/<proj>~<cl>/revisions/current/files`) and **skip** if every file is under `chrome/browser/`, `chrome/android/`, `ios/`, or `components/**/android/` — Electron doesn't compile those.
|
||||
|
||||
Report the table now (`CVE | Sev | Bug | Component | Verdict | CL`) and the proposed backport set; get user sign-off before continuing.
|
||||
|
||||
## 4. Write patches locally (no push yet)
|
||||
|
||||
For each backport CL, fetch the raw patch and write it into `patches/<dir>/`:
|
||||
|
||||
```bash
|
||||
curl -s "https://${host}.googlesource.com/changes/${proj//\//%2F}~${cl}/revisions/current/patch" \
|
||||
| base64 -d > "patches/${dir}/cherry-pick-${short}.patch"
|
||||
echo "cherry-pick-${short}.patch" >> "patches/${dir}/.patches"
|
||||
```
|
||||
|
||||
For repos with no Gerrit host `e cherry-pick` supports (e.g. **libaom** on aomedia), instead `git cherry-pick` the upstream commits onto the synced sub-repo HEAD and `git format-patch` the result.
|
||||
|
||||
For any newly-created `patches/<dir>/`, append to `patches/config.json` **preserving the compact one-line-per-entry style**:
|
||||
|
||||
```json
|
||||
{ "patch_dir": "src/electron/patches/<dir>", "repo": "src/third_party/<dir-or-nested-path>" }
|
||||
```
|
||||
|
||||
## 5. Validate with `e sync --3`
|
||||
|
||||
```bash
|
||||
e sync --3 2>&1 | tee /tmp/bp_sync3.log
|
||||
```
|
||||
|
||||
On `Patch failed at NNNN <subject>`:
|
||||
|
||||
- `cd` into the failing repo, inspect `git diff` for conflict markers.
|
||||
- **Test-only files** (e.g. `web_tests/VirtualTestSuites`, `*_unittest.cc` context drift): take ours (`git checkout --ours -- <file>`) if the security-relevant hunks merged cleanly.
|
||||
- **Substantive code conflicts**: check whether a target-milestone merge CL exists and swap to it. If none exists upstream and the surrounding code is structurally different, **drop the patch** (delete the file, remove from `.patches` and `config.json`) and note it for a separate manual-port PR — do not improvise security-fix semantics.
|
||||
- After resolving: `git add <files> && git -c commit.gpgsign=false am --continue`, then `e patches <repo>` to export the resolved patch, then re-run `e sync --3`. Repeat until clean.
|
||||
|
||||
## 6. Export → lint → re-apply loop
|
||||
|
||||
```bash
|
||||
e patches all
|
||||
node script/lint.js --patches # must exit 0
|
||||
```
|
||||
|
||||
If lint reports findings (typically trailing whitespace on `+` content lines), fixing them **changes the bytes the patch writes**, which invalidates the `index <old>..<new>` blob hashes that `e patches` baked in. Hand-editing a `.patch` and pushing it as-is will pass lint locally but fail CI's Apply Patches re-export check with a one-line `index` hash diff.
|
||||
|
||||
So whenever lint (or you) modifies any `.patch` file after export, round-trip once more:
|
||||
|
||||
```bash
|
||||
# fix the lint findings in patches/**/*.patch, then:
|
||||
e sync # re-apply the edited patches (no --3 needed; they applied cleanly last time)
|
||||
e patches all # re-export so index blob hashes match the edited content
|
||||
node script/lint.js --patches # must now exit 0
|
||||
git diff --quiet -- patches/ || { echo "patches changed again — repeat the loop"; }
|
||||
```
|
||||
|
||||
Repeat until `lint --patches` exits 0 **and** `git diff -- patches/` is empty after the final `e patches all`. Only then is the patch set CI-stable.
|
||||
|
||||
## 7. Commit, push, PR
|
||||
|
||||
```bash
|
||||
git add patches/
|
||||
git commit -m "chore: cherry-pick <N> changes from <dirs>"
|
||||
git push origin HEAD
|
||||
gh pr create --repo electron/electron --base <branch> --head <this-branch> \
|
||||
--title "chore: cherry-pick <N> changes from <dirs>" \
|
||||
--label "<branch>" --label backport-check-skip --label semver/patch --label "security 🔒" \
|
||||
--body-file /tmp/pr_body.md
|
||||
```
|
||||
|
||||
PR body format:
|
||||
|
||||
```markdown
|
||||
Backports the following changes:
|
||||
|
||||
* [`<shortCommit>`](<gerrit-CL-url>) from <patchDir> — <subject> ([<bug>](https://crbug.com/<bug>), CVE-YYYY-NNNN)
|
||||
* ...
|
||||
|
||||
Notes: Security: backported fixes for CVE-YYYY-NNNN, CVE-YYYY-NNNN, ....
|
||||
```
|
||||
|
||||
Short commit links to the **Gerrit CL**; bug links to `crbug.com`; CVE comes from the blog mapping (the patch's own `Bug:` footer may differ); `Notes:` is the last line. Mention any dropped patches (with reason) above the `Notes:` line.
|
||||
|
||||
Restore `e use <previous>` when done.
|
||||
@@ -1,323 +0,0 @@
|
||||
---
|
||||
name: electron-node-upgrade
|
||||
description: Guide for performing Node.js version upgrades in the Electron project. Use when working on the roller/node/main branch to fix patch conflicts during `e sync --3`. Covers the patch application workflow, conflict resolution, analyzing upstream Node.js changes, building, running the Node.js test suite, and proper commit formatting for patch fixes.
|
||||
---
|
||||
|
||||
# Electron Node.js Upgrade: Phase One
|
||||
|
||||
## Summary
|
||||
|
||||
Run `e sync --3` repeatedly, fixing patch conflicts as they arise, until it succeeds. Then export patches and commit changes atomically.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
Phase One is complete when:
|
||||
- `e sync --3` exits with code 0 (no patch failures)
|
||||
- All changes are committed per the commit guidelines
|
||||
|
||||
Do not stop until these criteria are met.
|
||||
|
||||
**CRITICAL** Do not delete or skip patches unless 100% certain the patch is no longer needed. For major version upgrades, patches that shim deprecated V8 APIs or backport upstream changes are often deletable because the new Node.js version already incorporates them — but verify before removing. Complicated conflicts or hard to resolve issues should be presented to the user after you have exhausted all other options. Do not delete the patch just because you can't solve it.
|
||||
|
||||
**CRITICAL** Never use `git am --skip` and then manually recreate a patch by making a new commit. This destroys the original patch's authorship, commit message, and position in the series. If `git am --continue` reports "No changes", investigate why — the changes were likely absorbed by a prior conflict resolution's 3-way merge. Present this situation to the user rather than skipping and recreating.
|
||||
|
||||
## Context
|
||||
|
||||
The `roller/node/main` branch is created by automation to update Electron's Node.js dependency version in `DEPS`. No work has been done to handle breaking changes between the old and new versions.
|
||||
|
||||
There are two types of Node.js version updates:
|
||||
- **Bumps** (patch/minor): Automated by `electron-roller[bot]` with commit title `chore: bump node to v{version}`. Trivial patch index updates are handled automatically by `patchup[bot]`. These often land cleanly, but may require manual patch fixes.
|
||||
- **Major upgrades** (e.g., v22 → v24): Manual, large PRs with commit title `chore: upgrade Node.js to v{X}.{Y}.{Z}`. These typically involve deleting obsolete patches, adapting many others, and updating `@types/node` in `package.json`.
|
||||
|
||||
**Key directories:**
|
||||
- Current directory: Electron repo (always run `e` commands here)
|
||||
- `../third_party/electron_node`: Node.js repo (where patches apply)
|
||||
- `patches/node/`: Patch files for Node.js
|
||||
- `docs/development/patches.md`: Patch system documentation
|
||||
|
||||
## Pre-flight Checks
|
||||
|
||||
Run these once at the start of each upgrade session:
|
||||
|
||||
1. **Clear rerere cache** (if enabled): `git rerere clear` in both the electron and `../third_party/electron_node` repos. Stale recorded resolutions from a prior attempt can silently apply wrong merges.
|
||||
2. **Ensure pre-commit hooks are installed**: Check that `.git/hooks/pre-commit` exists. If not, run `yarn husky` to install it. The hook runs `lint-staged` which handles clang-format for C++ files.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Run `e sync --3` (the `--3` flag enables 3-way merge, always required)
|
||||
2. If succeeds → skip to step 5
|
||||
3. If patch fails:
|
||||
- Identify target repo and patch from error output
|
||||
- Analyze failure (see references/patch-analysis.md)
|
||||
- Fix conflict in `../third_party/electron_node` working directory
|
||||
- Run `git am --continue` in `../third_party/electron_node`
|
||||
- Repeat until all patches for that repo apply
|
||||
- IMPORTANT: Once `git am --continue` succeeds you MUST run `e patches node` to export fixes
|
||||
- Return to step 1
|
||||
4. When `e sync --3` succeeds, run `e patches all`
|
||||
5. **Read `references/phase-one-commit-guidelines.md` NOW**, then commit changes following those instructions exactly.
|
||||
|
||||
## Commands Reference
|
||||
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `e sync --3` | Clone deps and apply patches with 3-way merge |
|
||||
| `git am --continue` | Continue after resolving conflict (run in node repo) |
|
||||
| `e patches node` | Export commits from node repo to patch files |
|
||||
| `e patches all` | Export all patches from all targets |
|
||||
| `e patches node --commit-updates` | Export patches and auto-commit trivial changes |
|
||||
| `e patches --list-targets` | List targets and config paths |
|
||||
|
||||
## Patch System Mental Model
|
||||
|
||||
```
|
||||
patches/node/*.patch → [e sync --3] → ../third_party/electron_node commits
|
||||
← [e patches] ←
|
||||
```
|
||||
|
||||
## When to Edit Patches
|
||||
|
||||
| Situation | Action |
|
||||
|-----------|--------|
|
||||
| During active `git am` conflict | Fix in node repo, then `git am --continue` |
|
||||
| Modifying patch outside conflict | Edit `.patch` file directly |
|
||||
| Creating new patch (rare, avoid) | Commit in node repo, then `e patches node` |
|
||||
|
||||
Fix existing patches 99% of the time rather than creating new ones.
|
||||
|
||||
## Patch Fixing Rules
|
||||
|
||||
1. **Preserve authorship**: Keep original author in TODO comments (from patch `From:` field)
|
||||
2. **Never change TODO assignees**: `TODO(name)` must retain original name
|
||||
3. **Update descriptions**: If upstream changed APIs or macros, update patch commit message to reflect current state
|
||||
4. **Never skip-and-recreate a patch**: If `git am --continue` says "No changes — did you forget to use 'git add'?", do NOT run `git am --skip` and create a replacement commit. The patch's changes were already absorbed by a prior 3-way merge resolution. This means an earlier conflict resolution pulled in too many changes. Present the situation to the user for guidance — the correct fix may require re-doing an earlier resolution more carefully to keep each patch's changes separate.
|
||||
|
||||
# Electron Node.js Upgrade: Phase Two
|
||||
|
||||
## Summary
|
||||
|
||||
Run `e build -k 999 -- --quiet` repeatedly, fixing build issues as they arise, until it succeeds. Then run `e start --version` to validate Electron launches and commit changes atomically.
|
||||
|
||||
Run Phase Two immediately after Phase One is complete.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
Phase Two is complete when:
|
||||
- `e build -k 999 -- --quiet` exits with code 0 (no build failures)
|
||||
- `e start --version` has been run to check Electron launches
|
||||
- All changes are committed per the commit guidelines
|
||||
|
||||
Do not stop until these criteria are met. Do not delete code or features, never comment out code in order to take short cut. Make all existing code, logic and intention work.
|
||||
|
||||
## Context
|
||||
|
||||
The `roller/node/main` branch is created by automation to update Electron's Node.js dependency version in `DEPS`. No work has been done to handle breaking changes between the old and new versions. Node.js APIs (especially internal V8 integration, OpenSSL/BoringSSL compatibility, and build system files) frequently change between versions. In every case the code in Electron must be updated to account for the change in Node.js, strongly avoid making changes to the code in Node.js to fix Electron's build.
|
||||
|
||||
**Key directories:**
|
||||
- Current directory: Electron repo (always run `e` commands here)
|
||||
- `../third_party/electron_node`: Node.js repo (do not touch this code to fix build issues, just read it to obtain context)
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Run `e build -k 999 -- --quiet` (the `--quiet` flag suppresses per-target status lines, showing only errors and the final result)
|
||||
2. If succeeds → skip to step 6
|
||||
3. If build fails:
|
||||
- Identify underlying file in "electron" from the compilation error message
|
||||
- Analyze failure
|
||||
- Fix build issue by adapting Electron's code for the change in Node.js
|
||||
- Run `e build -t {target_that_failed}.o` to build just the failed target we were specifically fixing
|
||||
- You can identify the target_that_failed from the failure line in the build log. E.g. `FAILED: 2e506007-8d5d-4f38-bdd1-b5cd77999a77 "./obj/electron/shell/browser/api/electron_api_utility_process.o" CXX obj/electron/shell/browser/api/electron_api_utility_process.o` the target name is `obj/electron/shell/browser/api/electron_api_utility_process.o`
|
||||
- **Read `references/phase-two-commit-guidelines.md` NOW**, then commit changes following those instructions exactly.
|
||||
- Return to step 1
|
||||
4. **CRITICAL**: After ANY commit (especially patch commits), immediately run `git status` in the electron repo
|
||||
- Look for other modified `.patch` files that only have index/hunk header changes
|
||||
- These are dependent patches affected by your fix
|
||||
- Commit them immediately with: `git commit -am "chore: update patches (trivial only)"`
|
||||
5. Return to step 1
|
||||
6. When `e build` succeeds, run `e start --version`
|
||||
7. Check if you have any pending changes in the Node.js repo by running `git status` in `../third_party/electron_node`
|
||||
- If you have changes follow the instructions below in "A. Patch Fixes" to correctly commit those modifications into the appropriate patch file
|
||||
|
||||
## Commands Reference
|
||||
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `e build -k 999 -- --quiet` | Build Electron, continue on errors, suppress status lines |
|
||||
| `e build -t {target}.o` | Build just one specific target to verify a fix |
|
||||
| `e start --version` | Validate Electron launches after successful build |
|
||||
|
||||
## Two Types of Build Fixes
|
||||
|
||||
### A. Patch Fixes (for files in patched Node.js files)
|
||||
|
||||
When the error is in a file that Electron patches (check with `grep -l "filename" patches/node/*.patch`):
|
||||
|
||||
1. Edit the file in the Node.js source tree (`../third_party/electron_node/...`)
|
||||
2. Create a fixup commit targeting the original patch commit:
|
||||
```bash
|
||||
cd ../third_party/electron_node
|
||||
git add <modified-file>
|
||||
git commit --fixup=<original-patch-commit-hash>
|
||||
GIT_SEQUENCE_EDITOR=: git rebase --autosquash --autostash -i <commit>^
|
||||
```
|
||||
3. Export the updated patch: `e patches node`
|
||||
4. Commit the updated patch file following `references/phase-one-commit-guidelines.md`.
|
||||
|
||||
To find the original patch commit to fixup: `git log --oneline | grep -i "keyword from patch name"`
|
||||
|
||||
The base commit for rebase is the Node.js commit before patches were applied. Find it by checking the `refs/patches/upstream-head` ref.
|
||||
|
||||
### B. Electron Code Fixes (for files in shell/, electron/, etc.)
|
||||
|
||||
When the error is in Electron's own source code:
|
||||
|
||||
1. Edit files directly in the electron repo
|
||||
2. Commit directly (no patch export needed)
|
||||
|
||||
# Electron Node.js Upgrade: Phase Three
|
||||
|
||||
## Summary
|
||||
|
||||
Run the Node.js test suite via `script/node-spec-runner.js`, fix failing tests, and commit fixes until all tests pass. Certain tests are permanently disabled (listed in `script/node-disabled-tests.json`) and should not be run.
|
||||
|
||||
Run Phase Three immediately after Phase Two is complete.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
Phase Three is complete when:
|
||||
- `node script/node-spec-runner.js --default` exits with zero failures
|
||||
- All changes are committed per the commit guidelines
|
||||
|
||||
Do not stop until these criteria are met.
|
||||
|
||||
## Context
|
||||
|
||||
Electron runs a subset of Node.js's upstream test suite using a custom runner (`script/node-spec-runner.js`). Tests are executed with the built Electron binary via `ELECTRON_RUN_AS_NODE=true`. Many tests need adaptation because Electron uses BoringSSL (not OpenSSL) and Chromium's V8 (which may differ from Node.js's bundled V8).
|
||||
|
||||
**Key files:**
|
||||
- `script/node-spec-runner.js` — Test runner script
|
||||
- `script/node-disabled-tests.json` — Permanently disabled tests (do not try to fix these)
|
||||
- `../third_party/electron_node/test/` — Node.js test files (where patches apply)
|
||||
- `patches/node/fix_crypto_tests_to_run_with_bssl.patch` — BoringSSL crypto test adaptations
|
||||
- `patches/node/test_formally_mark_some_tests_as_flaky.patch` — Flaky test list
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Run `node script/node-spec-runner.js --default` from the electron repo
|
||||
2. If all tests pass → Phase Three is complete
|
||||
3. If tests fail:
|
||||
- Identify the failing test file(s) from the output
|
||||
- Analyze each failure (see "Common Failure Patterns" below)
|
||||
- Fix the test in `../third_party/electron_node/test/...`
|
||||
- Re-run the specific failing test to verify: `node script/node-spec-runner.js {test-path}`
|
||||
- The test path is relative to the node `test/` directory, e.g. `test/parallel/test-crypto-key-objects-raw.js`
|
||||
- Do NOT use `--default` when running specific tests — it adds the full suite flags
|
||||
- Do NOT run tests directly with `ELECTRON_RUN_AS_NODE` — the runner handles environment setup (e.g. temporarily switching `package.json` from ESM to CommonJS)
|
||||
- Commit the fix using the fixup workflow and commit guidelines
|
||||
- Return to step 1
|
||||
|
||||
## Commands Reference
|
||||
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `node script/node-spec-runner.js --default` | Run full Node.js test suite |
|
||||
| `node script/node-spec-runner.js test/parallel/test-foo.js` | Run a single test |
|
||||
| `NODE_REGENERATE_SNAPSHOTS=1 node script/node-spec-runner.js test/test-runner/test-foo.mjs` | Regenerate snapshot for a snapshot-based test |
|
||||
|
||||
## Common Failure Patterns
|
||||
|
||||
### BoringSSL incompatibilities
|
||||
|
||||
Electron uses BoringSSL (via Chromium) instead of OpenSSL. Many crypto features are missing or behave differently:
|
||||
|
||||
| Unsupported in BoringSSL | Guard pattern |
|
||||
|--------------------------|---------------|
|
||||
| ChaCha20-Poly1305 | `if (!process.features.openssl_is_boringssl)` |
|
||||
| AES-CCM (aes-128-ccm, aes-256-ccm) | `if (ciphers.includes('aes-128-ccm'))` |
|
||||
| AES-KW (key wrapping) | `if (!process.features.openssl_is_boringssl)` |
|
||||
| DSA keys | `if (!process.features.openssl_is_boringssl)` |
|
||||
| Ed448 / X448 curves | `if (!process.features.openssl_is_boringssl)` |
|
||||
| DH key PEM loading | `if (!process.features.openssl_is_boringssl)` |
|
||||
| PQC algorithms (ML-KEM, ML-DSA, SLH-DSA) | `if (hasOpenSSL(3, 5))` (already guards these) |
|
||||
|
||||
When guarding tests, prefer checking cipher availability (`ciphers.includes(algo)`) over blanket BoringSSL checks where possible, as it's more precise and self-documenting.
|
||||
|
||||
New upstream tests that exercise these features will need guards added to the `fix_crypto_tests_to_run_with_bssl` patch.
|
||||
|
||||
### Snapshot test mismatches
|
||||
|
||||
Some tests compare output against committed `.snapshot` files using `assert.strictEqual` — these are NOT wildcard comparisons. When Chromium's V8 produces different output (e.g. different stack traces due to V8 enhancements), the snapshot must be regenerated:
|
||||
|
||||
```bash
|
||||
NODE_REGENERATE_SNAPSHOTS=1 node script/node-spec-runner.js test/test-runner/test-foo.mjs
|
||||
```
|
||||
|
||||
Then inspect the diff to verify the changes are expected, and commit the updated snapshot into the appropriate patch.
|
||||
|
||||
### V8 behavioral differences
|
||||
|
||||
Chromium's V8 may be ahead of Node.js's bundled V8. This can cause:
|
||||
- Different stack trace formats (e.g. thenable async stack frames)
|
||||
- Different error messages
|
||||
- Features available in Chromium V8 that aren't in stock Node.js V8 (or vice versa)
|
||||
|
||||
## Two Types of Test Fixes
|
||||
|
||||
### A. Patch Fixes (most common for test failures)
|
||||
|
||||
Most test fixes go into existing patches in `patches/node/`. Use the fixup workflow:
|
||||
|
||||
1. Edit the test file in `../third_party/electron_node/test/...`
|
||||
2. Find the relevant patch commit: `git log --oneline | grep -i "keyword"`
|
||||
- Crypto/BoringSSL tests → `fix crypto tests to run with bssl`
|
||||
- Snapshot tests → the specific snapshot patch (e.g. `test: accomodate V8 thenable`)
|
||||
- Flaky tests → `test: formally mark some tests as flaky`
|
||||
3. Create a fixup commit:
|
||||
```bash
|
||||
cd ../third_party/electron_node
|
||||
git add test/path/to/test.js
|
||||
git commit --fixup=<patch-commit-hash>
|
||||
GIT_SEQUENCE_EDITOR=: git rebase --autosquash --autostash -i <commit>^
|
||||
```
|
||||
4. Export: `e patches node`
|
||||
5. **Read `references/phase-three-commit-guidelines.md` NOW**, then commit the updated patch file.
|
||||
|
||||
### B. New Patches (rare)
|
||||
|
||||
Only create a new patch when the fix doesn't belong in any existing patch. The new patch commit in `../third_party/electron_node` must include a description explaining why the patch exists and when it can be removed — the lint check enforces this.
|
||||
|
||||
## Adding to Disabled Tests
|
||||
|
||||
Only add a test to `script/node-disabled-tests.json` as a **last resort** — when the test is fundamentally incompatible with Electron's architecture (not just a BoringSSL difference that can be guarded). Tests disabled here are completely skipped and never run.
|
||||
|
||||
# Critical: Read Before Committing
|
||||
|
||||
- Before ANY Phase One commits: Read `references/phase-one-commit-guidelines.md`
|
||||
- Before ANY Phase Two commits: Read `references/phase-two-commit-guidelines.md`
|
||||
- Before ANY Phase Three commits: Read `references/phase-three-commit-guidelines.md`
|
||||
|
||||
# High-Churn Patches
|
||||
|
||||
These patches consistently require the most work during Node.js upgrades:
|
||||
|
||||
- **`fix_handle_boringssl_and_openssl_incompatibilities.patch`** — Electron uses BoringSSL (via Chromium) while Node.js expects OpenSSL. This patch is large and complex, and upstream OpenSSL API changes frequently break it.
|
||||
- **`fix_crypto_tests_to_run_with_bssl.patch`** — Companion to the above; adapts Node.js crypto tests for BoringSSL. Can grow significantly during major upgrades.
|
||||
- **`support_v8_sandboxed_pointers.patch`** — V8 sandbox pointer support requires careful adaptation when V8 APIs change.
|
||||
- **`build_add_gn_build_files.patch`** — The GN build file patch is large and touches many build targets. Upstream build system changes frequently conflict.
|
||||
|
||||
# Major Version Upgrades
|
||||
|
||||
Major Node.js version transitions (e.g., v22 → v24) are significantly more involved than patch bumps:
|
||||
|
||||
1. **Expect patch deletions.** Electron uses Chromium's V8, which is often ahead of the V8 version bundled in Node.js. Many patches exist to bridge this gap — shimming newer V8 APIs that Chromium's V8 has but Node.js' older V8 doesn't. When Node.js bumps to a newer major version, its V8 catches up to Chromium's, and those bridge patches can be deleted. In the v22 → v24 upgrade, 17 patches were deleted for this reason.
|
||||
2. **Update `@types/node`** in `package.json` to match the new major version.
|
||||
3. **Post-upgrade regressions are expected.** Even after the upgrade lands, follow-up fix PRs for edge cases (ESM path handling, certificate loading, platform-specific issues) are normal.
|
||||
|
||||
# Skill Directory Structure
|
||||
This skill has additional reference files in `references/`:
|
||||
- patch-analysis.md - How to analyze patch failures
|
||||
- phase-one-commit-guidelines.md - Commit format for Phase One
|
||||
- phase-two-commit-guidelines.md - Commit format for Phase Two
|
||||
- phase-three-commit-guidelines.md - Commit format for Phase Three
|
||||
|
||||
Read these when referenced in the workflow steps.
|
||||
@@ -1,112 +0,0 @@
|
||||
# Analyzing Patch Failures
|
||||
|
||||
## Investigation Steps
|
||||
|
||||
1. **Read the patch file** at `patches/node/{patch_name}.patch`
|
||||
|
||||
2. **Examine current state** of the file in the Node.js repo at mentioned line numbers
|
||||
|
||||
3. **Check recent upstream changes:**
|
||||
```bash
|
||||
cd ../third_party/electron_node
|
||||
git log --oneline -10 -- {file}
|
||||
```
|
||||
|
||||
4. **Find Node.js PR** in commit messages:
|
||||
```
|
||||
PR-URL: https://github.com/nodejs/node/pull/{PR_NUMBER}
|
||||
```
|
||||
|
||||
## Critical: Resolve by Intent, Not by Mechanical Merge
|
||||
|
||||
When resolving a patch conflict, do NOT blindly preserve the patch's old code. Instead:
|
||||
|
||||
1. **Understand the upstream commit's full scope** — not just the conflicting hunk.
|
||||
Run `git show <commit> --stat` and read diffs for all affected files.
|
||||
Upstream may have removed structs, members, or methods that the patch
|
||||
references in other hunks or files.
|
||||
|
||||
2. **Re-read the patch commit message** to understand its *intent* — what
|
||||
behavior does it need to preserve or add?
|
||||
|
||||
3. **Implement the intent against the new upstream code.** If the patch's
|
||||
purpose is "add BoringSSL compatibility", add only the compatibility
|
||||
layer — don't also restore old code that upstream separately removed.
|
||||
|
||||
### Lesson: Upstream Removals Break Patch References
|
||||
|
||||
- **Trigger:** Patch conflict involves an upstream refactor (not just context drift)
|
||||
- **Strategy:** After identifying the upstream commit, check its full diff for
|
||||
removed types, members, and methods. If the patch's old code references
|
||||
something removed, the resolution must use the new upstream mechanism.
|
||||
|
||||
### Lesson: Separate Patch Purpose from Patch Implementation
|
||||
|
||||
- **Trigger:** Conflict between "upstream simplified code" vs "patch has older code"
|
||||
- **Strategy:** Identify the *minimal* change the patch needs. If the patch
|
||||
wraps code in a conditional, only add the conditional — don't restore old
|
||||
code that was inside the conditional but was separately cleaned up upstream.
|
||||
|
||||
### Lesson: Finish the Adaptation at Conflict Time
|
||||
|
||||
- **Trigger:** A patch conflict involves an upstream API removal or replacement
|
||||
- **Strategy:** When resolving the conflict, fully adapt the patch to use the
|
||||
new API in the same commit. Don't remove the old code and leave behind stale
|
||||
references that will "be fixed in Phase Two." Each patch fix commit should be
|
||||
a complete resolution.
|
||||
|
||||
## Common Failure Patterns
|
||||
|
||||
| Pattern | Cause | Solution |
|
||||
|---------|-------|----------|
|
||||
| Context lines don't match | Surrounding code changed | Update context in patch |
|
||||
| File not found | File renamed/moved | Update patch target path |
|
||||
| Function not found | Refactored upstream | Find new function name |
|
||||
| OpenSSL → BoringSSL mismatch | Crypto API change | Update to BoringSSL-compatible API |
|
||||
| GYP/GN build change | Build system refactor | Adapt build patch to new structure |
|
||||
| Deleted code | Feature removed | Verify patch still needed |
|
||||
| V8 API bridge patch conflicts | Node.js caught up to Chromium's V8 | Patch may be deletable — verify the API is now in Node.js' V8 natively |
|
||||
|
||||
## Using Git Blame
|
||||
|
||||
To find the commit that changed specific lines:
|
||||
|
||||
```bash
|
||||
cd ../third_party/electron_node
|
||||
git blame -L {start},{end} -- {file}
|
||||
git log -1 {commit_sha} # Look for PR-URL: line
|
||||
```
|
||||
|
||||
## Verifying Patch Necessity
|
||||
|
||||
Before deleting a patch, verify:
|
||||
1. The patched functionality was intentionally removed upstream
|
||||
2. Electron doesn't need the patch for other reasons
|
||||
3. No other code depends on the patched behavior
|
||||
|
||||
**V8 bridge patches:** Electron uses Chromium's V8, which is often ahead of the V8 bundled in Node.js. Many patches exist to bridge this version gap — adapting Node.js code to work with newer V8 APIs that Chromium's V8 exposes. During major Node.js upgrades, Node.js' V8 catches up to Chromium's, and these bridge patches often become unnecessary. Check whether the API the patch shims is now available natively in the new Node.js version's V8.
|
||||
|
||||
When in doubt, keep the patch and adapt it.
|
||||
|
||||
## Phase Two: Build-Time Patch Issues
|
||||
|
||||
Sometimes patches that applied successfully in Phase One cause build errors in Phase Two. This can happen when:
|
||||
|
||||
1. **Incomplete types**: A patch disables a header include, but new upstream code uses the type
|
||||
2. **Missing members**: A patch modifies a class, but upstream added new code referencing the original
|
||||
|
||||
### Finding Which Patch Affects a File
|
||||
|
||||
```bash
|
||||
grep -l "filename.cc" patches/node/*.patch
|
||||
```
|
||||
|
||||
### Matching Existing Patch Patterns
|
||||
|
||||
When fixing build errors in patched files, examine the existing patch to understand its style:
|
||||
- Does it use `#if 0` / `#endif` guards?
|
||||
- Does it use `#if BUILDFLAG(...)` conditionals?
|
||||
- Does it use `#ifndef` / `#ifdef` guards for BoringSSL vs OpenSSL?
|
||||
- What's the pattern for disabled functionality?
|
||||
|
||||
Apply fixes consistent with the existing patch style.
|
||||
@@ -1,111 +0,0 @@
|
||||
# Phase One Commit Guidelines
|
||||
|
||||
Only follow these instructions if there are uncommitted changes to `patches/` after Phase One succeeds.
|
||||
|
||||
Ignore other instructions about making commit messages, our guidelines are CRITICALLY IMPORTANT and must be followed.
|
||||
|
||||
## Each Commit Must Be Complete
|
||||
|
||||
When resolving a patch conflict, fully adapt the patch to the new upstream code in the same commit. If the upstream change removes an API the patch uses, update the patch to use the replacement API now — don't leave stale references knowing they'll need fixing later. The goal is that each commit represents a finished resolution, not a partial one that defers known work to a future phase.
|
||||
|
||||
## Commit Message Style
|
||||
|
||||
**Titles** follow the 60/80-character guideline: simple changes fit within 60 characters, otherwise the limit is 80 characters.
|
||||
|
||||
Always include a `Co-Authored-By` trailer identifying the AI model that assisted (e.g., `Co-Authored-By: <AI model attribution>`).
|
||||
|
||||
### Patch conflict fixes
|
||||
|
||||
Use `fix(patch):` prefix. The title should name the upstream change, not your response to it:
|
||||
|
||||
```
|
||||
fix(patch): {topic headline}
|
||||
|
||||
Ref: {Node.js commit or issue link}
|
||||
|
||||
Co-Authored-By: <AI model attribution>
|
||||
```
|
||||
|
||||
Only add a description body if it provides clarity beyond the title. For straightforward context drift or simple API renames, the title + Ref is sufficient.
|
||||
|
||||
Examples:
|
||||
- `fix(patch): stop using v8::PropertyCallbackInfo<T>::This()`
|
||||
- `fix(patch): BoringSSL and OpenSSL incompatibilities`
|
||||
- `fix(patch): refactor module_wrap.cc FixedArray::Get params`
|
||||
|
||||
### Upstreamed patch removal
|
||||
|
||||
When patches are no longer needed (applied cleanly with "already applied" or confirmed upstreamed), group ALL removals into a single commit:
|
||||
|
||||
```
|
||||
chore: remove upstreamed patch
|
||||
```
|
||||
|
||||
or (if multiple):
|
||||
|
||||
```
|
||||
chore: remove upstreamed patches
|
||||
```
|
||||
|
||||
Most Node.js patches in Electron are Electron-authored (no upstream `PR-URL:`). If the patch originated from an upstream Node.js PR, no extra `Ref:` is needed. Otherwise, add a `Ref:` pointing to the relevant Node.js issue or commit if one exists.
|
||||
|
||||
### Trivial patch updates
|
||||
|
||||
After all fix commits, stage remaining trivial changes (index, line numbers, context only):
|
||||
|
||||
```bash
|
||||
git add patches
|
||||
git commit -m "chore: update patches (trivial only)"
|
||||
```
|
||||
|
||||
**Conflict resolution can produce trivial results.** A `git am` conflict doesn't always mean the patch content changed — context drift alone can cause a conflict. After resolving and exporting, inspect the patch diff: if only index hashes, line numbers, and context lines changed (not the patch's own `+`/`-` lines), it's trivial and belongs here, not in a `fix(patch):` commit.
|
||||
|
||||
## Atomic Commits
|
||||
|
||||
Each patch conflict fix gets its own commit with its own Ref.
|
||||
|
||||
IMPORTANT: Try really hard to find the PR or commit reference per the instructions below. Each change you made should in theory have been in response to a change made in Node.js that you identified or can identify. Try for a while to identify and include the ref in the commit message. Do not give up easily.
|
||||
|
||||
## Finding Commit/Issue References
|
||||
|
||||
Use `git log` or `git blame` on Node.js source files in `../third_party/electron_node`. Look for:
|
||||
|
||||
```
|
||||
PR-URL: https://github.com/nodejs/node/pull/XXXXX
|
||||
```
|
||||
|
||||
or issue references in the patch itself:
|
||||
|
||||
```
|
||||
Refs: https://github.com/nodejs/node/issues/XXXXX
|
||||
```
|
||||
|
||||
Note: Most Node.js patches in Electron are Electron-authored and won't have upstream references. In that case, check `git log` in the Node.js repo to find which upstream commit caused the conflict.
|
||||
|
||||
If no reference found after searching: `Ref: Unable to locate reference`
|
||||
|
||||
## Example Commits
|
||||
|
||||
### Patch conflict fix (simple — title is sufficient)
|
||||
|
||||
```
|
||||
fix(patch): stop using v8::PropertyCallbackInfo<T>::This()
|
||||
|
||||
Ref: https://github.com/nodejs/node/issues/60616
|
||||
|
||||
Co-Authored-By: <AI model attribution>
|
||||
```
|
||||
|
||||
### Patch conflict fix (complex — description adds value)
|
||||
|
||||
```
|
||||
fix(patch): BoringSSL and OpenSSL incompatibilities
|
||||
|
||||
Upstream updated OpenSSL APIs that diverge from BoringSSL. Adapted
|
||||
the compatibility shims in crypto patches to use the BoringSSL
|
||||
equivalents.
|
||||
|
||||
Ref: Unable to locate reference
|
||||
|
||||
Co-Authored-By: <AI model attribution>
|
||||
```
|
||||
@@ -1,80 +0,0 @@
|
||||
# Phase Three Commit Guidelines
|
||||
|
||||
Only follow these instructions if there are uncommitted changes after fixing a test failure during Phase Three.
|
||||
|
||||
Ignore other instructions about making commit messages, our guidelines are CRITICALLY IMPORTANT and must be followed.
|
||||
|
||||
## Commit Message Style
|
||||
|
||||
**Titles** follow the 60/80-character guideline: simple changes fit within 60 characters, otherwise the limit is 80 characters.
|
||||
|
||||
Always include a `Co-Authored-By` trailer identifying the AI model that assisted (e.g., `Co-Authored-By: <AI model attribution>`).
|
||||
|
||||
## Commit Types
|
||||
|
||||
### Patch updates (most test fixes)
|
||||
|
||||
Test fixes go into existing patches via the fixup workflow. Use `fix(patch):` prefix with a descriptive topic:
|
||||
|
||||
```
|
||||
fix(patch): {topic headline}
|
||||
|
||||
Ref: {Node.js commit or issue link}
|
||||
|
||||
Co-Authored-By: <AI model attribution>
|
||||
```
|
||||
|
||||
Examples:
|
||||
- `fix(patch): guard DH key test for BoringSSL`
|
||||
- `fix(patch): adapt new crypto tests for BoringSSL`
|
||||
- `fix(patch): correct thenable snapshot for Chromium V8`
|
||||
- `fix(patch): skip AES-KW tests with BoringSSL`
|
||||
|
||||
Group related test fixes into a single commit when they address the same root cause (e.g., multiple crypto tests all needing BoringSSL guards for the same missing cipher). Don't create one commit per test file if they share the same fix pattern.
|
||||
|
||||
### Snapshot regeneration
|
||||
|
||||
When a snapshot test fails because Chromium's V8 produces different output, regenerate it:
|
||||
|
||||
```bash
|
||||
NODE_REGENERATE_SNAPSHOTS=1 node script/node-spec-runner.js test/test-runner/test-foo.mjs
|
||||
```
|
||||
|
||||
Then commit the updated snapshot patch with a title describing what changed:
|
||||
|
||||
```
|
||||
fix(patch): correct {name} snapshot for Chromium V8
|
||||
|
||||
Ref: {V8 CL or issue link if known}
|
||||
|
||||
Co-Authored-By: <AI model attribution>
|
||||
```
|
||||
|
||||
### Trivial patch updates
|
||||
|
||||
After any patch modification, check for dependent patches that only have index/hunk header changes:
|
||||
|
||||
```bash
|
||||
git status
|
||||
# If other .patch files show as modified with only trivial changes:
|
||||
git add patches/
|
||||
git commit -m "chore: update patches (trivial only)"
|
||||
```
|
||||
|
||||
## Finding References
|
||||
|
||||
For BoringSSL-related test fixes, the reference is typically the upstream Node.js PR that added the new test:
|
||||
|
||||
```bash
|
||||
cd ../third_party/electron_node
|
||||
git log --oneline -5 -- test/parallel/test-crypto-foo.js
|
||||
git log -1 <commit> --format="%B" | grep "PR-URL"
|
||||
```
|
||||
|
||||
For V8 behavioral differences, reference the Chromium CL:
|
||||
|
||||
```
|
||||
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/NNNNNNN
|
||||
```
|
||||
|
||||
If no reference found after searching: `Ref: Unable to locate reference`
|
||||
@@ -1,96 +0,0 @@
|
||||
# Phase Two Commit Guidelines
|
||||
|
||||
Only follow these instructions if there are uncommitted changes in the Electron repo after any fixes are made during Phase Two that result a target that was failing, successfully building.
|
||||
|
||||
Ignore other instructions about making commit messages, our guidelines are CRITICALLY IMPORTANT and must be followed.
|
||||
|
||||
## Commit Message Style
|
||||
|
||||
**Titles** follow the 60/80-character guideline: simple changes fit within 60 characters, otherwise the limit is 80 characters. Exception: upstream Node.js PR titles are used verbatim even if longer.
|
||||
|
||||
Always include a `Co-Authored-By` trailer identifying the AI model that assisted (e.g., `Co-Authored-By: <AI model attribution>`).
|
||||
|
||||
## Two Commit Types
|
||||
|
||||
### For Electron Source Changes (shell/, electron/, etc.)
|
||||
|
||||
When the upstream Node.js commit has a `PR-URL:`:
|
||||
|
||||
```
|
||||
node#{PR-Number}: {upstream PR's original title}
|
||||
|
||||
Ref: {Node.js PR link}
|
||||
|
||||
Co-Authored-By: <AI model attribution>
|
||||
```
|
||||
|
||||
When there is no `PR-URL:` but there is an issue reference or commit:
|
||||
|
||||
```
|
||||
fix: {description of the adaptation}
|
||||
|
||||
Ref: {Node.js issue or commit link}
|
||||
|
||||
Co-Authored-By: <AI model attribution>
|
||||
```
|
||||
|
||||
Use the **upstream commit's original title** when available — do not paraphrase or rewrite it. To find it: check the commit message in `../third_party/electron_node` for `PR-URL:` or `Refs:` lines.
|
||||
|
||||
Only add a description body if it provides clarity beyond what the title already says (e.g., when Electron's adaptation is non-obvious). For simple renames, method additions, or straightforward API updates, the title + Ref link is sufficient.
|
||||
|
||||
Each change should have its own commit and its own Ref. Logically group into commits that make sense rather than one giant commit. You may include multiple "Ref" links if required.
|
||||
|
||||
IMPORTANT: Try really hard to find a reference. Each change you made should in theory have been in response to a change in Node.js. Check `git log` and `git blame` in the Node.js repo. Do not give up easily.
|
||||
|
||||
### For Patch Updates (patches/node/*.patch)
|
||||
|
||||
Use the same fixup workflow as Phase One and follow `references/phase-one-commit-guidelines.md` for the commit message format (`fix(patch):` prefix, topic style).
|
||||
|
||||
## Dependent Patch Header Updates
|
||||
|
||||
After any patch modification, check for other affected patches:
|
||||
|
||||
```bash
|
||||
git status
|
||||
# If other .patch files show as modified with only index, line number, and context changes:
|
||||
git add patches/
|
||||
git commit -m "chore: update patches (trivial only)"
|
||||
```
|
||||
|
||||
## Finding References
|
||||
|
||||
Use `git log` or `git blame` on Node.js source files in `../third_party/electron_node`. Look for:
|
||||
|
||||
```
|
||||
PR-URL: https://github.com/nodejs/node/pull/XXXXX
|
||||
Refs: https://github.com/nodejs/node/issues/XXXXX
|
||||
```
|
||||
|
||||
Note: Many Node.js patches in Electron are Electron-authored and won't have upstream `PR-URL:` lines. Check the patch's own commit message for `Refs:` lines, or use `git log` in the Node.js repo to find which upstream commit caused the build break.
|
||||
|
||||
If no reference found after searching: `Ref: Unable to locate reference`
|
||||
|
||||
## Example Commits
|
||||
|
||||
### Electron Source Fix (with upstream PR)
|
||||
|
||||
```
|
||||
node#61898: src: stop using v8::PropertyCallbackInfo<T>::This()
|
||||
|
||||
Ref: https://github.com/nodejs/node/pull/61898
|
||||
|
||||
Co-Authored-By: <AI model attribution>
|
||||
```
|
||||
|
||||
### Electron Source Fix (with issue reference, no PR)
|
||||
|
||||
```
|
||||
fix: adapt to v8::PropertyCallbackInfo<T>::This() removal
|
||||
|
||||
Updated NodeBindings to use HolderV2() after upstream Node.js
|
||||
stopped using the deprecated This() API.
|
||||
|
||||
Ref: https://github.com/nodejs/node/issues/60616
|
||||
|
||||
Co-Authored-By: <AI model attribution>
|
||||
```
|
||||
14
.github/ISSUE_TEMPLATE/maintainer_issue.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
name: Maintainer Issue (not for public use)
|
||||
description: Only to be created by Electron maintainers
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Confirmation
|
||||
options:
|
||||
- label: I am a [maintainer](https://github.com/orgs/electron/people) of the Electron project. (If not, please create a [different issue type](https://github.com/electron/electron/issues/new/).)
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Description
|
||||
validations:
|
||||
required: true
|
||||
9
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -6,17 +6,14 @@ the requirements below.
|
||||
|
||||
Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md
|
||||
|
||||
Using a coding agent / AI? Read the policy: https://github.com/electron/governance/blob/main/policy/ai.md
|
||||
|
||||
NOTE: PRs submitted that do not follow this template will be automatically closed.
|
||||
NOTE: PRS submitted without this template will be automatically closed.
|
||||
-->
|
||||
|
||||
#### Checklist
|
||||
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->
|
||||
|
||||
- [ ] I have built and tested this change
|
||||
- [ ] I have filled out the PR description
|
||||
- [ ] [I have reviewed and verified the changes](https://github.com/electron/governance/blob/main/policy/ai.md)
|
||||
- [ ] PR description included
|
||||
- [ ] I have built and tested this PR
|
||||
- [ ] `npm test` passes
|
||||
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
|
||||
- [ ] relevant API documentation, tutorials, and examples are updated and follow the [documentation style guide](https://github.com/electron/electron/blob/main/docs/development/style-guide.md)
|
||||
|
||||
14
.github/actions/build-electron/action.yml
vendored
@@ -40,15 +40,9 @@ runs:
|
||||
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
- name: Set GN_EXTRA_ARGS for Windows
|
||||
shell: bash
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
if: ${{inputs.target-arch != 'x64' && inputs.target-platform == 'win' }}
|
||||
run: |
|
||||
# Resolve .obj paths to absolute in linker response files to work
|
||||
# around BindFlt concurrency bug in Windows containers.
|
||||
# https://github.com/microsoft/Windows-Containers/issues/635
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS win_abs_link_wrapper=\"//electron/build/win/abs_link_wrapper.py\""
|
||||
if [ "${{ inputs.target-arch }}" != "x64" ]; then
|
||||
GN_APPENDED_ARGS="$GN_APPENDED_ARGS target_cpu=\"${{ inputs.target-arch }}\""
|
||||
fi
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"${{ inputs.target-arch }}\""
|
||||
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
- name: Add Clang problem matcher
|
||||
shell: bash
|
||||
@@ -113,10 +107,6 @@ runs:
|
||||
} else {
|
||||
e build --target electron:testing_build
|
||||
}
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "e build failed with exit code $LASTEXITCODE"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
Copy-Item out\Default\.ninja_log out\electron_ninja_log
|
||||
node electron\script\check-symlinks.js
|
||||
|
||||
|
||||
24
.github/actions/build-image-sha/action.yml
vendored
@@ -1,24 +0,0 @@
|
||||
name: 'Build Image SHA'
|
||||
description: 'Single source of truth for the ghcr.io/electron/build image SHA'
|
||||
inputs:
|
||||
override:
|
||||
description: 'Optional override SHA (e.g. from a workflow_dispatch input)'
|
||||
required: false
|
||||
default: ''
|
||||
outputs:
|
||||
build-image-sha:
|
||||
description: 'The electron/build image SHA to use'
|
||||
value: ${{ steps.set.outputs.build-image-sha }}
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- id: set
|
||||
shell: bash
|
||||
env:
|
||||
OVERRIDE: ${{ inputs.override }}
|
||||
run: |
|
||||
if [ -n "$OVERRIDE" ]; then
|
||||
echo "build-image-sha=$OVERRIDE" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "build-image-sha=daad061f4b99a0ae1c841be4aa09188280a9c8a4" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
2
.github/actions/fix-sync/action.yml
vendored
@@ -133,7 +133,7 @@ runs:
|
||||
run : |
|
||||
cd src/third_party/angle
|
||||
rm -f .git/objects/info/alternates
|
||||
git remote set-url origin https://github.com/google/angle.git
|
||||
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
|
||||
cp .git/config .git/config.backup
|
||||
git remote remove origin
|
||||
mv .git/config.backup .git/config
|
||||
|
||||
21
.github/actions/install-dependencies/action.yml
vendored
@@ -21,28 +21,11 @@ runs:
|
||||
if [ "$TARGET_ARCH" = "x86" ]; then
|
||||
export npm_config_arch="ia32"
|
||||
fi
|
||||
ARCH=$(uname -m)
|
||||
node script/yarn.js install --immutable --mode=skip-build
|
||||
# if running on linux arm skip yarn Builds
|
||||
ARCH=$(uname -m)
|
||||
if [ "$ARCH" = "armv7l" ]; then
|
||||
echo "Skipping yarn build on linux arm"
|
||||
node script/yarn.js install --immutable --mode=skip-build
|
||||
else
|
||||
# Pre-seed the node-gyp header cache so the parallel native-addon
|
||||
# builds below don't race on a cold cache. Linux build containers
|
||||
# already ship a warm cache (electron/build-images#68), so only do
|
||||
# this on macOS / Windows runners.
|
||||
if [ "$(uname -s)" != "Linux" ]; then
|
||||
for i in 1 2 3; do
|
||||
if node node_modules/node-gyp/bin/node-gyp.js install; then
|
||||
break
|
||||
fi
|
||||
if [ "$i" = "3" ]; then
|
||||
echo "node-gyp header pre-seed failed after 3 attempts" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "node-gyp header pre-seed failed (attempt $i), retrying in 5s..." >&2
|
||||
sleep 5
|
||||
done
|
||||
fi
|
||||
node script/yarn.js install --immutable
|
||||
fi
|
||||
|
||||
2
.github/problem-matchers/clang.json
vendored
@@ -5,7 +5,7 @@
|
||||
"fromPath": "src/out/Default/args.gn",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(.+)[(:](\\d+)[:,](\\d+)\\)?:\\s+(warning|fatal error|error):\\s+(.*)$",
|
||||
"regexp": "^(.+)[(:](\\d+)[:,](\\d+)\\)?:\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
From aab86e682d6f40e110700f36c9c37f6655fb14f1 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <sam@electronjs.org>
|
||||
Date: Wed, 8 Apr 2026 23:24:15 -0700
|
||||
Subject: [PATCH] siso: reuse the outer *os.File for chunked ReadAt in
|
||||
fileParser.readFile
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The per-chunk goroutine currently re-opens fname to get its own handle
|
||||
for ReadAt. (*os.File).ReadAt is documented as safe for concurrent
|
||||
calls on the same File (on Windows it is ReadFile with an OVERLAPPED
|
||||
offset, so there is no shared seek state), so the extra open is
|
||||
redundant — the goroutines can share the outer f.
|
||||
|
||||
Besides halving the CreateFileW calls per subninja, this avoids an
|
||||
intermittent 'The parameter is incorrect.' (ERROR_INVALID_PARAMETER)
|
||||
from bindflt.sys when out/ is a mapped directory inside a Windows
|
||||
container: bindflt's handle-relative NtCreateFile path races when a
|
||||
second relative open arrives while the first handle to the same target
|
||||
is still being set up. Absolute paths and single opens do not trigger
|
||||
it; see microsoft/Windows-Containers#<tbd>.
|
||||
---
|
||||
siso/toolsupport/ninjautil/file_parser.go | 7 -------
|
||||
1 file changed, 7 deletions(-)
|
||||
|
||||
diff --git a/siso/toolsupport/ninjautil/file_parser.go b/siso/toolsupport/ninjautil/file_parser.go
|
||||
index f8c7eff..75b1d6e 100644
|
||||
--- a/siso/toolsupport/ninjautil/file_parser.go
|
||||
+++ b/siso/toolsupport/ninjautil/file_parser.go
|
||||
@@ -128,13 +128,6 @@ func (p *fileParser) readFile(ctx context.Context, fname string) ([]byte, error)
|
||||
eg.Go(func() error {
|
||||
p.sema <- struct{}{}
|
||||
defer func() { <-p.sema }()
|
||||
- f, err := os.Open(fname)
|
||||
- if err != nil {
|
||||
- return err
|
||||
- }
|
||||
- defer func() {
|
||||
- _ = f.Close()
|
||||
- }()
|
||||
for len(chunkBuf) > 0 {
|
||||
n, err := f.ReadAt(chunkBuf, pos)
|
||||
if err != nil {
|
||||
--
|
||||
2.52.0
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
From 1786f2266cba6a66343e5af2b724214930c8292f Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <sam@electronjs.org>
|
||||
Date: Wed, 22 Apr 2026 16:27:51 -0700
|
||||
Subject: [PATCH] siso: retry transient ERROR_INVALID_PARAMETER when opening
|
||||
ninja files on Windows
|
||||
|
||||
ManifestParser.Load fans out across all subninja files (~90k in a
|
||||
Chromium build) at NumCPU parallelism. On Windows builders where out/
|
||||
is served through a filesystem filter driver (e.g. bindflt/wcifs for
|
||||
container bind mounts), CreateFileW can intermittently return
|
||||
ERROR_INVALID_PARAMETER under this concurrent open burst. The previous
|
||||
patch removes the redundant per-chunk re-open, but the single remaining
|
||||
open per file can still hit the race; without a retry a single transient
|
||||
failure aborts the entire manifest load.
|
||||
|
||||
Wrap the remaining os.Open call in readFile in a small Windows-only
|
||||
retry for ERROR_INVALID_PARAMETER (5 attempts, 5-80ms backoff). Each
|
||||
retry is logged via clog.Warningf and also written to stderr so it is
|
||||
visible in CI step output where glog warnings are file-only by default.
|
||||
Other platforms keep the direct os.Open path.
|
||||
---
|
||||
siso/toolsupport/ninjautil/file_parser.go | 3 +-
|
||||
siso/toolsupport/ninjautil/openfile_other.go | 18 +++++++
|
||||
.../toolsupport/ninjautil/openfile_windows.go | 50 +++++++++++++++++++
|
||||
3 files changed, 69 insertions(+), 2 deletions(-)
|
||||
create mode 100644 siso/toolsupport/ninjautil/openfile_other.go
|
||||
create mode 100644 siso/toolsupport/ninjautil/openfile_windows.go
|
||||
|
||||
diff --git a/siso/toolsupport/ninjautil/file_parser.go b/siso/toolsupport/ninjautil/file_parser.go
|
||||
index 75b1d6e..4a3e639 100644
|
||||
--- a/siso/toolsupport/ninjautil/file_parser.go
|
||||
+++ b/siso/toolsupport/ninjautil/file_parser.go
|
||||
@@ -7,7 +7,6 @@ package ninjautil
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
- "os"
|
||||
"path/filepath"
|
||||
"runtime/trace"
|
||||
"sync"
|
||||
@@ -108,7 +107,7 @@ func (p *fileParser) parseFile(ctx context.Context, fname string) error {
|
||||
// readFile reads a file of fname in parallel.
|
||||
func (p *fileParser) readFile(ctx context.Context, fname string) ([]byte, error) {
|
||||
defer trace.StartRegion(ctx, "ninja.read").End()
|
||||
- f, err := os.Open(fname)
|
||||
+ f, err := openFile(ctx, fname)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
diff --git a/siso/toolsupport/ninjautil/openfile_other.go b/siso/toolsupport/ninjautil/openfile_other.go
|
||||
new file mode 100644
|
||||
index 0000000..9fca690
|
||||
--- /dev/null
|
||||
+++ b/siso/toolsupport/ninjautil/openfile_other.go
|
||||
@@ -0,0 +1,18 @@
|
||||
+// Copyright 2026 The Chromium Authors
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+//go:build !windows
|
||||
+
|
||||
+package ninjautil
|
||||
+
|
||||
+import (
|
||||
+ "context"
|
||||
+ "os"
|
||||
+)
|
||||
+
|
||||
+// openFile opens fname for reading.
|
||||
+// See openfile_windows.go for the Windows variant with transient-error retry.
|
||||
+func openFile(ctx context.Context, fname string) (*os.File, error) {
|
||||
+ return os.Open(fname)
|
||||
+}
|
||||
diff --git a/siso/toolsupport/ninjautil/openfile_windows.go b/siso/toolsupport/ninjautil/openfile_windows.go
|
||||
new file mode 100644
|
||||
index 0000000..f9d8e9d
|
||||
--- /dev/null
|
||||
+++ b/siso/toolsupport/ninjautil/openfile_windows.go
|
||||
@@ -0,0 +1,50 @@
|
||||
+// Copyright 2026 The Chromium Authors
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+//go:build windows
|
||||
+
|
||||
+package ninjautil
|
||||
+
|
||||
+import (
|
||||
+ "context"
|
||||
+ "errors"
|
||||
+ "fmt"
|
||||
+ "os"
|
||||
+ "time"
|
||||
+
|
||||
+ "golang.org/x/sys/windows"
|
||||
+
|
||||
+ "go.chromium.org/build/siso/o11y/clog"
|
||||
+)
|
||||
+
|
||||
+// openFile opens fname for reading, retrying transient
|
||||
+// ERROR_INVALID_PARAMETER failures.
|
||||
+//
|
||||
+// On Windows, CreateFileW can intermittently return
|
||||
+// ERROR_INVALID_PARAMETER when the target lives behind a filesystem
|
||||
+// filter driver (e.g. bindflt/wcifs for container bind mounts) under
|
||||
+// highly concurrent opens. loadFile fans out across ~90k subninja
|
||||
+// files at NumCPU parallelism, so a single transient failure would
|
||||
+// otherwise abort the whole manifest load.
|
||||
+func openFile(ctx context.Context, fname string) (*os.File, error) {
|
||||
+ const maxAttempts = 5
|
||||
+ delay := 5 * time.Millisecond
|
||||
+ for i := 0; ; i++ {
|
||||
+ f, err := os.Open(fname)
|
||||
+ if err == nil {
|
||||
+ return f, nil
|
||||
+ }
|
||||
+ if i+1 >= maxAttempts || !errors.Is(err, windows.ERROR_INVALID_PARAMETER) {
|
||||
+ return nil, err
|
||||
+ }
|
||||
+ clog.Warningf(ctx, "open %s: %v; retrying (%d/%d) after %s", fname, err, i+1, maxAttempts, delay)
|
||||
+ fmt.Fprintf(os.Stderr, "siso: open %s: %v; retrying (%d/%d) after %s\n", fname, err, i+1, maxAttempts, delay)
|
||||
+ select {
|
||||
+ case <-time.After(delay):
|
||||
+ case <-ctx.Done():
|
||||
+ return nil, context.Cause(ctx)
|
||||
+ }
|
||||
+ delay *= 2
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.52.0
|
||||
|
||||
19
.github/workflows/apply-patches.yml
vendored
@@ -18,8 +18,6 @@ jobs:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
has-patches: ${{ steps.filter.outputs.patches }}
|
||||
has-siso-patches: ${{ steps.filter.outputs.siso-patches }}
|
||||
build-image-sha: ${{ steps.build-image-sha.outputs.build-image-sha }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
with:
|
||||
@@ -35,12 +33,6 @@ jobs:
|
||||
patches:
|
||||
- DEPS
|
||||
- 'patches/**'
|
||||
siso-patches:
|
||||
- DEPS
|
||||
- '.github/siso-patches/**'
|
||||
- name: Set Build Image SHA
|
||||
id: build-image-sha
|
||||
uses: ./.github/actions/build-image-sha
|
||||
|
||||
apply-patches:
|
||||
needs: setup
|
||||
@@ -49,7 +41,7 @@ jobs:
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
image: ghcr.io/electron/build:eac3529546ea8f3aa356d31e345715eef342233b
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
@@ -81,16 +73,9 @@ jobs:
|
||||
target-platform: linux
|
||||
- name: Upload Patch Conflict Fix
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
with:
|
||||
name: update-patches
|
||||
path: patches/update-patches.patch
|
||||
if-no-files-found: ignore
|
||||
archive: false
|
||||
|
||||
build-siso:
|
||||
needs: setup
|
||||
if: ${{ needs.setup.outputs.has-siso-patches == 'true' }}
|
||||
uses: ./.github/workflows/pipeline-segment-build-siso-windows.yml
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
4
.github/workflows/archaeologist-dig.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Node.js/npm
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
|
||||
with:
|
||||
node-version: 24.12.x
|
||||
- name: Setting Up Dig Site
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
sha-file: .dig-old
|
||||
filename: electron.old.d.ts
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f #v7.0.0
|
||||
with:
|
||||
name: artifacts
|
||||
path: electron/artifacts
|
||||
|
||||
8
.github/workflows/audit-branch-ci.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: 22.17.x
|
||||
- name: Sparse checkout repository
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
.github
|
||||
.yarn
|
||||
- run: yarn workspaces focus @electron/gha-workflows
|
||||
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
id: audit-errors
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -87,8 +87,6 @@ jobs:
|
||||
!message.startsWith("The hosted runner lost communication with the server") &&
|
||||
!message.startsWith("Dependabot encountered an error performing the update") &&
|
||||
!message.startsWith("The action 'Run Electron Tests' has timed out") &&
|
||||
!message.startsWith("The operation was canceled") &&
|
||||
!message.startsWith("Canceling since") &&
|
||||
!/Unable to make request/.test(message) &&
|
||||
!/The requested URL returned error/.test(message),
|
||||
)
|
||||
@@ -157,7 +155,7 @@ jobs:
|
||||
await core.summary.write();
|
||||
- name: Send Slack message if errors
|
||||
if: ${{ always() && steps.audit-errors.outputs.errorsFound && github.ref == 'refs/heads/main' }}
|
||||
uses: slackapi/slack-github-action@03ea5433c137af7c0495bc0cad1af10403fc800c # v3.0.2
|
||||
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
|
||||
with:
|
||||
payload: |
|
||||
link: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
|
||||
64
.github/workflows/branch-created.yml
vendored
@@ -98,14 +98,14 @@ jobs:
|
||||
done
|
||||
- name: Generate GitHub App token
|
||||
if: ${{ steps.check-major-version.outputs.MAJOR }}
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Generate Release Project Board Metadata
|
||||
if: ${{ steps.check-major-version.outputs.MAJOR }}
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
id: generate-project-metadata
|
||||
env:
|
||||
MAJOR: ${{ steps.check-major-version.outputs.MAJOR }}
|
||||
@@ -157,7 +157,7 @@ jobs:
|
||||
}))
|
||||
- name: Create Release Project Board
|
||||
if: ${{ steps.check-major-version.outputs.MAJOR }}
|
||||
uses: dsanders11/project-actions/copy-project@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
uses: dsanders11/project-actions/copy-project@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
id: create-release-board
|
||||
with:
|
||||
drafts: true
|
||||
@@ -170,60 +170,6 @@ jobs:
|
||||
template-view: ${{ steps.generate-project-metadata.outputs.template-view }}
|
||||
title: ${{ steps.generate-project-metadata.outputs.major }}-x-y
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
- name: Randomly Assign Draft Issues to Release WG Members
|
||||
if: ${{ steps.check-major-version.outputs.MAJOR }}
|
||||
uses: dsanders11/project-actions/github-script@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
env:
|
||||
PROJECT_ID: ${{ steps.create-release-board.outputs.id }}
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
script: |
|
||||
const { data: members } = await github.rest.teams.listMembersInOrg({
|
||||
org: 'electron',
|
||||
team_slug: 'wg-releases',
|
||||
});
|
||||
|
||||
const excludedLogins = ['nikwen'];
|
||||
const memberLogins = new Set(members.map(m => m.login));
|
||||
for (const login of excludedLogins) {
|
||||
if (!memberLogins.has(login)) {
|
||||
core.warning(`Excluded member "${login}" is not in @electron/wg-releases`);
|
||||
}
|
||||
}
|
||||
|
||||
const eligible = members.filter(m => !excludedLogins.includes(m.login));
|
||||
|
||||
if (eligible.length === 0) {
|
||||
core.warning('No eligible members found in @electron/wg-releases team');
|
||||
return;
|
||||
}
|
||||
|
||||
const projectId = process.env.PROJECT_ID;
|
||||
const draftIssues = await actions.getDraftIssues(projectId);
|
||||
|
||||
if (draftIssues.length === 0) {
|
||||
core.info('No draft issues found in the project');
|
||||
return;
|
||||
}
|
||||
|
||||
// Fisher-Yates shuffle for uniform random assignment
|
||||
const shuffled = [...eligible];
|
||||
for (let i = shuffled.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
|
||||
}
|
||||
|
||||
// Assign draft issues round-robin across team members
|
||||
for (let i = 0; i < draftIssues.length; i++) {
|
||||
const member = shuffled[i % shuffled.length];
|
||||
const draftIssue = draftIssues[i];
|
||||
core.info(`Assigning "${draftIssue.content.title}" to ${member.login}`);
|
||||
await actions.editItem(projectId, draftIssue.content.id, {
|
||||
assignees: [member.login],
|
||||
});
|
||||
}
|
||||
|
||||
core.info(`Assigned ${draftIssues.length} draft issues to ${eligible.length} team members`);
|
||||
- name: Dump Release Project Board Contents
|
||||
if: ${{ steps.check-major-version.outputs.MAJOR }}
|
||||
run: gh project item-list ${{ steps.create-release-board.outputs.number }} --owner electron --format json | jq
|
||||
@@ -231,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@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
uses: dsanders11/project-actions/find-project@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
id: find-prev-release-board
|
||||
with:
|
||||
fail-if-project-not-found: false
|
||||
@@ -239,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@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
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 }}
|
||||
|
||||
34
.github/workflows/build-git-cache.yml
vendored
@@ -2,38 +2,25 @@ name: Build Git Cache
|
||||
# This workflow updates git cache on the cross-instance cache volumes
|
||||
# It runs daily at midnight.
|
||||
|
||||
on:
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: ubuntu-slim
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
build-image-sha: ${{ steps.build-image-sha.outputs.build-image-sha }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
- name: Set Build Image SHA
|
||||
id: build-image-sha
|
||||
uses: ./.github/actions/build-image-sha
|
||||
|
||||
build-git-cache-linux:
|
||||
needs: setup
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
image: ghcr.io/electron/build:eac3529546ea8f3aa356d31e345715eef342233b
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
@@ -47,12 +34,12 @@ jobs:
|
||||
target-platform: linux
|
||||
|
||||
build-git-cache-windows:
|
||||
needs: setup
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
image: ghcr.io/electron/build:eac3529546ea8f3aa356d31e345715eef342233b
|
||||
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||
volumes:
|
||||
- /mnt/win-cache:/mnt/win-cache
|
||||
@@ -72,13 +59,14 @@ jobs:
|
||||
target-platform: win
|
||||
|
||||
build-git-cache-macos:
|
||||
# This job updates the same git cache as linux, so it needs to run after the linux one.
|
||||
needs: [setup, build-git-cache-linux]
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
# This job updates the same git cache as linux, so it needs to run after the linux one.
|
||||
needs: build-git-cache-linux
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
image: ghcr.io/electron/build:eac3529546ea8f3aa356d31e345715eef342233b
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
@@ -94,4 +82,4 @@ jobs:
|
||||
- name: Build Git Cache
|
||||
uses: ./src/electron/.github/actions/build-git-cache
|
||||
with:
|
||||
target-platform: macos
|
||||
target-platform: macos
|
||||
52
.github/workflows/build.yml
vendored
@@ -6,8 +6,8 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: ''
|
||||
required: false
|
||||
default: 'eac3529546ea8f3aa356d31e345715eef342233b'
|
||||
required: true
|
||||
skip-macos:
|
||||
type: boolean
|
||||
description: 'Skip macOS builds'
|
||||
@@ -48,14 +48,14 @@ permissions: {}
|
||||
jobs:
|
||||
setup:
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: ubuntu-slim
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
outputs:
|
||||
docs: ${{ steps.filter.outputs.docs }}
|
||||
src: ${{ steps.filter.outputs.src }}
|
||||
build-image-sha: ${{ steps.build-image-sha.outputs.build-image-sha }}
|
||||
build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
|
||||
docs-only: ${{ steps.set-output.outputs.docs-only }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
@@ -67,21 +67,20 @@ jobs:
|
||||
filters: |
|
||||
docs:
|
||||
- 'docs/**'
|
||||
- '.claude/**'
|
||||
- README.md
|
||||
- SECURITY.md
|
||||
- CONTRIBUTING.md
|
||||
- CODE_OF_CONDUCT.md
|
||||
src:
|
||||
- '!{docs,.claude}/**'
|
||||
- name: Set Build Image SHA
|
||||
id: build-image-sha
|
||||
uses: ./.github/actions/build-image-sha
|
||||
with:
|
||||
override: ${{ inputs.build-image-sha }}
|
||||
- name: Set Docs Only
|
||||
- '!docs/**'
|
||||
- name: Set Outputs for Build Image SHA & Docs Only
|
||||
id: set-output
|
||||
run: |
|
||||
if [ -z "${{ inputs.build-image-sha }}" ]; then
|
||||
echo "build-image-sha=eac3529546ea8f3aa356d31e345715eef342233b" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
echo "docs-only=${{ steps.filter.outputs.docs == 'true' && steps.filter.outputs.src == 'false' }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Lint Jobs
|
||||
@@ -201,15 +200,6 @@ jobs:
|
||||
generate-sas-token: 'true'
|
||||
target-platform: win
|
||||
|
||||
# Build a patched siso binary for Windows CI in parallel with checkout-windows.
|
||||
# The Windows build jobs download the resulting artifact and use it via SISO_PATH.
|
||||
build-siso-windows:
|
||||
needs: setup
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
uses: ./.github/workflows/pipeline-segment-build-siso-windows.yml
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# GN Check Jobs
|
||||
macos-gn-check:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
|
||||
@@ -275,11 +265,10 @@ jobs:
|
||||
contents: read
|
||||
issues: read
|
||||
pull-requests: read
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-tidy-and-test.yml
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||
needs: checkout-macos
|
||||
with:
|
||||
build-runs-on: macos-15-xlarge
|
||||
clang-tidy-runs-on: macos-15-large
|
||||
test-runs-on: macos-15
|
||||
target-platform: macos
|
||||
target-arch: arm64
|
||||
@@ -394,14 +383,12 @@ jobs:
|
||||
contents: read
|
||||
issues: read
|
||||
pull-requests: read
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-tidy-and-test.yml
|
||||
needs: [checkout-windows, build-siso-windows]
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
clang-tidy-runs-on: electron-arc-centralus-linux-amd64-8core
|
||||
test-runs-on: windows-latest
|
||||
clang-tidy-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
|
||||
target-platform: win
|
||||
target-arch: x64
|
||||
is-release: false
|
||||
@@ -416,7 +403,7 @@ jobs:
|
||||
issues: read
|
||||
pull-requests: read
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||
needs: [checkout-windows, build-siso-windows]
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
@@ -435,7 +422,7 @@ jobs:
|
||||
issues: read
|
||||
pull-requests: read
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||
needs: [checkout-windows, build-siso-windows]
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
@@ -453,12 +440,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
needs: [docs-only, macos-x64, macos-arm64, linux-x64, linux-x64-asan, linux-arm, linux-arm64, build-siso-windows, windows-x64, windows-x86, windows-arm64]
|
||||
if: always() && github.repository == 'electron/electron'
|
||||
needs: [docs-only, macos-x64, macos-arm64, linux-x64, linux-x64-asan, linux-arm, linux-arm64, windows-x64, windows-x86, windows-arm64]
|
||||
if: always() && github.repository == 'electron/electron' && !contains(needs.*.result, 'failure')
|
||||
steps:
|
||||
- name: Fail if any needed job failed or was cancelled
|
||||
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
|
||||
run: exit 1
|
||||
- name: GitHub Actions Jobs Done
|
||||
run: |
|
||||
echo "All GitHub Actions Jobs are done"
|
||||
|
||||
@@ -13,26 +13,13 @@ on:
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: ubuntu-slim
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
build-image-sha: ${{ steps.build-image-sha.outputs.build-image-sha }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
- name: Set Build Image SHA
|
||||
id: build-image-sha
|
||||
uses: ./.github/actions/build-image-sha
|
||||
|
||||
clean-orphaned-uploads:
|
||||
needs: setup
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
|
||||
17
.github/workflows/clean-src-cache.yml
vendored
@@ -12,28 +12,15 @@ on:
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: ubuntu-slim
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
build-image-sha: ${{ steps.build-image-sha.outputs.build-image-sha }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
- name: Set Build Image SHA
|
||||
id: build-image-sha
|
||||
uses: ./.github/actions/build-image-sha
|
||||
|
||||
clean-src-cache:
|
||||
needs: setup
|
||||
if: github.repository == 'electron/electron'
|
||||
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:${{ needs.setup.outputs.build-image-sha }}
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
|
||||
4
.github/workflows/issue-commented.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
AUTHOR_ASSOCIATION=$(gh api /repos/electron/electron/issues/comments/${{ github.event.comment.id }} --jq '.author_association')
|
||||
echo "author_association=$AUTHOR_ASSOCIATION" >> "$GITHUB_OUTPUT"
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
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:
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: *get-author-association
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
if: ${{ contains(fromJSON('["MEMBER", "OWNER"]'), steps.get-author-association.outputs.author_association) }}
|
||||
id: generate-token
|
||||
with:
|
||||
|
||||
34
.github/workflows/issue-labeled.yml
vendored
@@ -15,13 +15,13 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Set status
|
||||
uses: dsanders11/project-actions/edit-item@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
uses: dsanders11/project-actions/edit-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 90
|
||||
@@ -36,13 +36,13 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Set status
|
||||
uses: dsanders11/project-actions/edit-item@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
uses: dsanders11/project-actions/edit-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 90
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
name: blocked/need-repro label added
|
||||
if: github.event.label.name == 'blocked/need-repro'
|
||||
permissions:
|
||||
issues: write # for gh issue comment to update issues
|
||||
issues: write # for actions-cool/issues-helper to update issues
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if comment needed
|
||||
@@ -70,25 +70,23 @@ jobs:
|
||||
fi
|
||||
- name: Generate GitHub App token
|
||||
if: ${{ steps.check-for-comment.outputs.SHOULD_COMMENT }}
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- name: Create comment
|
||||
if: ${{ steps.check-for-comment.outputs.SHOULD_COMMENT }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
GH_REPO: electron/electron
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
gh issue comment "$ISSUE_NUMBER" --body-file - <<'EOF'
|
||||
<!-- blocked/need-repro -->
|
||||
uses: actions-cool/issues-helper@200c78641dbf33838311e5a1e0c31bbdb92d7cf0 # v3.8.0
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
body: |
|
||||
<!-- blocked/need-repro -->
|
||||
|
||||
Hello @${{ github.event.issue.user.login }}. Thanks for reporting this and helping to make Electron better!
|
||||
Hello @${{ github.event.issue.user.login }}. Thanks for reporting this and helping to make Electron better!
|
||||
|
||||
Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, [Electron Fiddle](https://www.electronjs.org/fiddle) is a great tool for making small test cases and makes it easy to publish your test case to a [gist](https://gist.github.com) that Electron maintainers can use.
|
||||
Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, [Electron Fiddle](https://www.electronjs.org/fiddle) is a great tool for making small test cases and makes it easy to publish your test case to a [gist](https://gist.github.com) that Electron maintainers can use.
|
||||
|
||||
Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.
|
||||
Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.
|
||||
|
||||
Now adding the https://github.com/electron/electron/labels/blocked%2Fneed-repro label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.
|
||||
EOF
|
||||
Now adding the https://github.com/electron/electron/labels/blocked%2Fneed-repro label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.
|
||||
|
||||
30
.github/workflows/issue-opened.yml
vendored
@@ -14,13 +14,13 @@ jobs:
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Add to Issue Triage
|
||||
uses: dsanders11/project-actions/add-item@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
uses: dsanders11/project-actions/add-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
field: Reporter
|
||||
field-value: ${{ github.event.issue.user.login }}
|
||||
@@ -32,7 +32,7 @@ jobs:
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
.yarn
|
||||
- run: yarn workspaces focus @electron/gha-workflows
|
||||
- name: Add labels
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
id: add-labels
|
||||
env:
|
||||
ISSUE_BODY: ${{ github.event.issue.body }}
|
||||
@@ -146,17 +146,15 @@ jobs:
|
||||
}
|
||||
- name: Create unsupported major comment
|
||||
if: ${{ steps.add-labels.outputs.unsupportedMajor }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
GH_REPO: electron/electron
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
gh issue comment "$ISSUE_NUMBER" --body-file - <<'EOF'
|
||||
<!-- end-of-life -->
|
||||
uses: actions-cool/issues-helper@200c78641dbf33838311e5a1e0c31bbdb92d7cf0 # v3.8.0
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
body: |
|
||||
<!-- end-of-life -->
|
||||
|
||||
Hello @${{ github.event.issue.user.login }}. Thanks for reporting this and helping to make Electron better!
|
||||
Hello @${{ github.event.issue.user.login }}. Thanks for reporting this and helping to make Electron better!
|
||||
|
||||
The version of Electron reported in this issue has reached end-of-life and is [no longer supported](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline). If you're still experiencing this issue on a [supported version](https://www.electronjs.org/releases/stable) of Electron, please update this issue to reflect that version of Electron.
|
||||
|
||||
The version of Electron reported in this issue has reached end-of-life and is [no longer supported](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline). If you're still experiencing this issue on a [supported version](https://www.electronjs.org/releases/stable) of Electron, please update this issue to reflect that version of Electron.
|
||||
|
||||
Now adding the https://github.com/electron/electron/labels/blocked%2Fneed-info%20%E2%9D%8C label for this reason. This issue will be closed in 10 days if the above is not addressed.
|
||||
EOF
|
||||
Now adding the https://github.com/electron/electron/labels/blocked%2Fneed-info%20%E2%9D%8C label for this reason. This issue will be closed in 10 days if the above is not addressed.
|
||||
|
||||
4
.github/workflows/issue-transferred.yml
vendored
@@ -14,13 +14,13 @@ jobs:
|
||||
if: ${{ !github.event.changes.new_repository.private }}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Remove from issue triage
|
||||
uses: dsanders11/project-actions/delete-item@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
uses: dsanders11/project-actions/delete-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 90
|
||||
|
||||
4
.github/workflows/issue-unlabeled.yml
vendored
@@ -26,14 +26,14 @@ jobs:
|
||||
fi
|
||||
- name: Generate GitHub App token
|
||||
if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }}
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Set status
|
||||
if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }}
|
||||
uses: dsanders11/project-actions/edit-item@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
uses: dsanders11/project-actions/edit-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 90
|
||||
|
||||
34
.github/workflows/linux-publish.yml
vendored
@@ -6,8 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: ''
|
||||
required: false
|
||||
default: 'eac3529546ea8f3aa356d31e345715eef342233b'
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
required: false
|
||||
@@ -21,28 +20,13 @@ on:
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: ubuntu-slim
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
build-image-sha: ${{ steps.build-image-sha.outputs.build-image-sha }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
- name: Set Build Image SHA
|
||||
id: build-image-sha
|
||||
uses: ./.github/actions/build-image-sha
|
||||
with:
|
||||
override: ${{ inputs.build-image-sha }}
|
||||
|
||||
checkout-linux:
|
||||
needs: setup
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
@@ -66,11 +50,11 @@ jobs:
|
||||
attestations: write
|
||||
contents: read
|
||||
id-token: write
|
||||
needs: [setup, checkout-linux]
|
||||
needs: checkout-linux
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
target-platform: linux
|
||||
target-arch: x64
|
||||
is-release: true
|
||||
@@ -86,11 +70,11 @@ jobs:
|
||||
attestations: write
|
||||
contents: read
|
||||
id-token: write
|
||||
needs: [setup, checkout-linux]
|
||||
needs: checkout-linux
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
target-platform: linux
|
||||
target-arch: arm
|
||||
is-release: true
|
||||
@@ -106,11 +90,11 @@ jobs:
|
||||
attestations: write
|
||||
contents: read
|
||||
id-token: write
|
||||
needs: [setup, checkout-linux]
|
||||
needs: checkout-linux
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
target-platform: linux
|
||||
target-arch: arm64
|
||||
is-release: true
|
||||
|
||||
23
.github/workflows/macos-publish.yml
vendored
@@ -6,8 +6,8 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: ''
|
||||
required: false
|
||||
default: 'eac3529546ea8f3aa356d31e345715eef342233b'
|
||||
required: true
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
required: false
|
||||
@@ -21,28 +21,13 @@ on:
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: ubuntu-slim
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
build-image-sha: ${{ steps.build-image-sha.outputs.build-image-sha }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
- name: Set Build Image SHA
|
||||
id: build-image-sha
|
||||
uses: ./.github/actions/build-image-sha
|
||||
with:
|
||||
override: ${{ inputs.build-image-sha }}
|
||||
|
||||
checkout-macos:
|
||||
needs: setup
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
name: Pipeline Segment - Build Siso (Windows)
|
||||
|
||||
# Builds a patched siso binary for Windows CI. Reads the siso revision from
|
||||
# the Chromium DEPS file at the pinned chromium_version, shallow-clones
|
||||
# chromium.googlesource.com/build at that revision, applies the patches under
|
||||
# .github/siso-patches/, cross-compiles siso.exe for windows/amd64, and
|
||||
# publishes it as the `siso-windows-amd64` artifact. The Windows build jobs
|
||||
# download it and use it via SISO_PATH. The built binary is cached keyed on
|
||||
# the siso revision + sha256 of the patch contents, so subsequent runs just
|
||||
# restore it.
|
||||
|
||||
on:
|
||||
workflow_call: {}
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
sparse-checkout: |
|
||||
DEPS
|
||||
.github/siso-patches
|
||||
- name: Resolve siso revision from Chromium DEPS
|
||||
id: resolve
|
||||
run: |
|
||||
set -euo pipefail
|
||||
CHROMIUM_VERSION=$(python3 -c "import re; print(re.search(r\"'chromium_version':\s*\n\s*'([^']+)'\", open('DEPS').read()).group(1))")
|
||||
if ! [[ "$CHROMIUM_VERSION" =~ ^[0-9]+(\.[0-9]+){1,3}$ ]]; then
|
||||
echo "error: unexpected chromium_version format: $CHROMIUM_VERSION" >&2
|
||||
exit 1
|
||||
fi
|
||||
curl -sfL "https://raw.githubusercontent.com/chromium/chromium/${CHROMIUM_VERSION}/DEPS" -o /tmp/chromium-DEPS
|
||||
SISO_SHA=$(python3 -c "import re; print(re.search(r\"'siso_version':\s*'git_revision:([0-9a-f]+)'\", open('/tmp/chromium-DEPS').read()).group(1))")
|
||||
if ! [[ "$SISO_SHA" =~ ^[0-9a-f]{40}$ ]]; then
|
||||
echo "error: unexpected siso_version SHA: $SISO_SHA" >&2
|
||||
exit 1
|
||||
fi
|
||||
PATCHES_HASH=$(find .github/siso-patches -type f -name '*.patch' | sort | xargs sha256sum | sha256sum | awk '{print $1}')
|
||||
echo "siso-sha=${SISO_SHA}" >> "$GITHUB_OUTPUT"
|
||||
echo "patches-hash=${PATCHES_HASH}" >> "$GITHUB_OUTPUT"
|
||||
echo "Chromium ${CHROMIUM_VERSION} pins siso at ${SISO_SHA}"
|
||||
echo "Patches hash: ${PATCHES_HASH}"
|
||||
- name: Restore cached siso binary
|
||||
id: cache-siso
|
||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||
with:
|
||||
path: siso-out/siso.exe
|
||||
key: siso-windows-amd64-${{ steps.resolve.outputs.siso-sha }}-${{ steps.resolve.outputs.patches-hash }}
|
||||
- name: Shallow clone chromium build repo at pinned revision
|
||||
if: steps.cache-siso.outputs.cache-hit != 'true'
|
||||
env:
|
||||
SISO_SHA: ${{ steps.resolve.outputs.siso-sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir chromium-build
|
||||
cd chromium-build
|
||||
git init -q
|
||||
git remote add origin https://chromium.googlesource.com/build
|
||||
git -c protocol.version=2 fetch --depth=1 origin "$SISO_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- name: Apply in-tree siso patches
|
||||
if: steps.cache-siso.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd chromium-build
|
||||
git -c user.name=electron-ci -c user.email=ci@electronjs.org \
|
||||
am --3way "${GITHUB_WORKSPACE}/.github/siso-patches"/*.patch
|
||||
- name: Set up Go
|
||||
if: steps.cache-siso.outputs.cache-hit != 'true'
|
||||
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
||||
with:
|
||||
go-version-file: chromium-build/siso/go.mod
|
||||
cache: false
|
||||
- name: Build siso (windows/amd64)
|
||||
if: steps.cache-siso.outputs.cache-hit != 'true'
|
||||
working-directory: chromium-build/siso
|
||||
env:
|
||||
CGO_ENABLED: '0'
|
||||
GOOS: windows
|
||||
GOARCH: amd64
|
||||
run: |
|
||||
mkdir -p "${GITHUB_WORKSPACE}/siso-out"
|
||||
go build -trimpath -o "${GITHUB_WORKSPACE}/siso-out/siso.exe" .
|
||||
- name: Upload siso artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: siso-windows-amd64
|
||||
path: siso-out/siso.exe
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
@@ -77,6 +77,7 @@ env:
|
||||
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }}
|
||||
SUDOWOODO_EXCHANGE_TOKEN: ${{ secrets.SUDOWOODO_EXCHANGE_TOKEN }}
|
||||
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || inputs.target-platform == 'win' && '--custom-var=checkout_win=True' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}
|
||||
@@ -123,7 +124,7 @@ jobs:
|
||||
run: df -h
|
||||
- name: Setup Node.js/npm
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
|
||||
with:
|
||||
node-version: 22.21.x
|
||||
cache: yarn
|
||||
@@ -194,22 +195,6 @@ jobs:
|
||||
- name: Free up space (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/free-space-macos
|
||||
- name: Download custom siso binary (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: siso-windows-amd64
|
||||
path: ${{ runner.temp }}/siso
|
||||
- name: Set SISO_PATH (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
run: |
|
||||
SISO_BIN="${RUNNER_TEMP}/siso/siso.exe"
|
||||
if [ ! -f "$SISO_BIN" ]; then
|
||||
echo "error: expected siso binary at $SISO_BIN" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "SISO_PATH=$SISO_BIN" >> "$GITHUB_ENV"
|
||||
echo "Using custom siso binary at $SISO_BIN"
|
||||
- name: Build Electron
|
||||
if: ${{ inputs.target-platform != 'macos' || (inputs.target-variant == 'all' || inputs.target-variant == 'darwin') }}
|
||||
uses: ./src/electron/.github/actions/build-electron
|
||||
|
||||
@@ -135,34 +135,15 @@ jobs:
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json"
|
||||
- name: Run Clang-Tidy
|
||||
run: |
|
||||
e init -f --root=$(pwd) --out=${ELECTRON_OUT_DIR} testing --target-cpu ${TARGET_ARCH} --remote-build none
|
||||
e init -f --root=$(pwd) --out=${ELECTRON_OUT_DIR} testing --target-cpu ${TARGET_ARCH}
|
||||
|
||||
# For macOS use_remoteexec=false will cause GN errors, so even though we're doing no remote build, set it
|
||||
export GN_EXTRA_ARGS="use_remoteexec=true target_cpu=\"${TARGET_ARCH}\""
|
||||
export GN_EXTRA_ARGS="target_cpu=\"${TARGET_ARCH}\""
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS use_v8_context_snapshot=true target_os=\"win\""
|
||||
fi
|
||||
|
||||
e build --only-gen
|
||||
|
||||
# Copy macOS framework headers so clang-tidy can find them via -F.
|
||||
# This must happen after e build --only-gen since e init -f may
|
||||
# recreate the output directory.
|
||||
if [ "${{ inputs.target-platform }}" = "macos" ]; then
|
||||
OUT=src/out/${ELECTRON_OUT_DIR}
|
||||
SQRL=src/third_party/squirrel.mac
|
||||
|
||||
mkdir -p ${OUT}/{ReactiveObjC,Squirrel,Mantle}.framework/Headers
|
||||
|
||||
cp ${SQRL}/vendor/ReactiveObjC/ReactiveObjC/*.h ${OUT}/ReactiveObjC.framework/Headers/
|
||||
cp ${SQRL}/vendor/ReactiveObjC/ReactiveObjC/extobjc/*.h ${OUT}/ReactiveObjC.framework/Headers/
|
||||
|
||||
cp ${SQRL}/Squirrel/*.h ${OUT}/Squirrel.framework/Headers/
|
||||
|
||||
cp ${SQRL}/vendor/Mantle/Mantle/include/*.h ${OUT}/Mantle.framework/Headers/
|
||||
cp ${SQRL}/vendor/Mantle/Mantle/extobjc/include/*.h ${OUT}/Mantle.framework/Headers/
|
||||
fi
|
||||
|
||||
cd src/electron
|
||||
node script/yarn.js lint:clang-tidy --jobs 8 --out-dir ../out/${ELECTRON_OUT_DIR}
|
||||
- name: Remove Clang problem matcher
|
||||
|
||||
@@ -130,7 +130,7 @@ jobs:
|
||||
run: |
|
||||
for target_cpu in ${{ inputs.target-archs }}
|
||||
do
|
||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu $target_cpu --remote-build none
|
||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu $target_cpu
|
||||
cd src
|
||||
export GN_EXTRA_ARGS="target_cpu=\"$target_cpu\""
|
||||
if [ "${{ inputs.target-platform }}" = "linux" ]; then
|
||||
|
||||
@@ -79,6 +79,7 @@ env:
|
||||
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }}
|
||||
SUDOWOODO_EXCHANGE_TOKEN: ${{ secrets.SUDOWOODO_EXCHANGE_TOKEN }}
|
||||
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' &&
|
||||
'--custom-var=checkout_mac=True --custom-var=host_os=mac' ||
|
||||
inputs.target-platform == 'win' && '--custom-var=checkout_win=True' ||
|
||||
@@ -131,7 +132,7 @@ jobs:
|
||||
run: df -h
|
||||
- name: Setup Node.js/npm
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
|
||||
with:
|
||||
node-version: 22.21.x
|
||||
cache: yarn
|
||||
@@ -207,22 +208,6 @@ jobs:
|
||||
- name: Free up space (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/free-space-macos
|
||||
- name: Download custom siso binary (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
||||
with:
|
||||
name: siso-windows-amd64
|
||||
path: ${{ runner.temp }}/siso
|
||||
- name: Set SISO_PATH (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
run: |
|
||||
SISO_BIN="${RUNNER_TEMP}/siso/siso.exe"
|
||||
if [ ! -f "$SISO_BIN" ]; then
|
||||
echo "error: expected siso binary at $SISO_BIN" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "SISO_PATH=$SISO_BIN" >> "$GITHUB_ENV"
|
||||
echo "Using custom siso binary at $SISO_BIN"
|
||||
- name: Build Electron
|
||||
if: ${{ inputs.target-platform != 'macos' || (inputs.target-variant == 'all' ||
|
||||
inputs.target-variant == 'darwin') }}
|
||||
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build-type: ${{ inputs.target-platform == 'macos' && fromJSON('["darwin","mas"]') || (inputs.target-platform == 'win' && fromJSON('["win"]') || fromJSON('["linux"]')) }}
|
||||
shard: ${{ case(inputs.display-server == 'wayland', fromJSON('[1]'), inputs.target-platform == 'linux', fromJSON('[1, 2, 3]'), inputs.target-platform == 'macos' && inputs.target-arch == 'x64', fromJSON('[1, 2, 3]'), fromJSON('[1, 2]')) }}
|
||||
shard: ${{ case(inputs.display-server == 'wayland', fromJSON('[1]'), inputs.target-platform == 'linux', fromJSON('[1, 2, 3]'), fromJSON('[1, 2]')) }}
|
||||
env:
|
||||
BUILD_TYPE: ${{ matrix.build-type }}
|
||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
cp $(which node) /mnt/runner-externals/node24/bin/
|
||||
- name: Setup Node.js/npm
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
|
||||
with:
|
||||
node-version: 22.21.x
|
||||
- name: Add TCC permissions on macOS
|
||||
@@ -227,7 +227,7 @@ jobs:
|
||||
cd src/electron
|
||||
export ELECTRON_TEST_RESULTS_DIR=`pwd`/junit
|
||||
# Get which tests are on this shard
|
||||
tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ case(inputs.display-server == 'wayland', 1, inputs.target-platform == 'linux', 3, inputs.target-platform == 'macos' && inputs.target-arch == 'x64', 3, 2) }})
|
||||
tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ case(inputs.display-server == 'wayland', 1, inputs.target-platform == 'linux', 3, 2) }})
|
||||
if [ "${{ inputs.display-server }}" = "wayland" ]; then
|
||||
allowlist_file=script/wayland-test-allowlist.txt
|
||||
filtered_tests=""
|
||||
@@ -315,7 +315,7 @@ jobs:
|
||||
if: always() && !cancelled()
|
||||
- name: Upload Test Artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f #v7.0.0
|
||||
with:
|
||||
name: ${{ inputs.target-platform == 'linux' && format('test_artifacts_{0}_{1}_{2}', env.ARTIFACT_KEY, inputs.display-server, matrix.shard) || format('test_artifacts_{0}_{1}', env.ARTIFACT_KEY, matrix.shard) }}
|
||||
path: src/electron/spec/artifacts
|
||||
|
||||
8
.github/workflows/pr-template-check.yml
vendored
@@ -25,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@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
@@ -38,12 +38,6 @@ jobs:
|
||||
return;
|
||||
}
|
||||
const body = context.payload.pull_request.body || '';
|
||||
// Allow through if body contains a valid backport line
|
||||
const backportRegex = /Backport of (?:#|https:\/\/github.com\/electron\/electron\/pull\/)\d+/i;
|
||||
if (backportRegex.test(body)) {
|
||||
console.log('Backport PR detected, skipping required section check.');
|
||||
return;
|
||||
}
|
||||
const missingSections = requiredSections.filter(
|
||||
(section) => !body.includes(section),
|
||||
);
|
||||
|
||||
14
.github/workflows/pr-triage-automation.yml
vendored
@@ -31,23 +31,13 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Get project item status
|
||||
uses: dsanders11/project-actions/get-item@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
id: get-item
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 118
|
||||
fail-if-item-not-found: false
|
||||
- name: Set status to Needs Review
|
||||
if: >-
|
||||
(steps.get-item.outputs.field-status == '🛑 Needs Submitter Response'
|
||||
|| steps.get-item.outputs.field-status == '🟡 WIP')
|
||||
uses: dsanders11/project-actions/edit-item@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
uses: dsanders11/project-actions/edit-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 118
|
||||
|
||||
33
.github/workflows/pull-request-labeled.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Trigger Slack workflow
|
||||
uses: slackapi/slack-github-action@03ea5433c137af7c0495bc0cad1af10403fc800c # v3.0.2
|
||||
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
|
||||
with:
|
||||
webhook: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
|
||||
webhook-type: webhook-trigger
|
||||
@@ -36,13 +36,13 @@ jobs:
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Set status
|
||||
uses: dsanders11/project-actions/edit-item@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
uses: dsanders11/project-actions/edit-item@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 94
|
||||
@@ -55,23 +55,28 @@ jobs:
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- name: Comment and close the pull request
|
||||
- name: Create comment
|
||||
uses: actions-cool/issues-helper@200c78641dbf33838311e5a1e0c31bbdb92d7cf0 # v3.8.0
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body: |
|
||||
<!-- ai-pr -->
|
||||
|
||||
*AI PR Detected*
|
||||
|
||||
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](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 }}
|
||||
GH_REPO: electron/electron
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
gh pr comment "$PR_NUMBER" --body-file - <<'EOF'
|
||||
<!-- ai-pr -->
|
||||
|
||||
*AI PR Detected*
|
||||
|
||||
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](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.
|
||||
EOF
|
||||
gh pr close "$PR_NUMBER"
|
||||
|
||||
1
.github/workflows/rerun-apply-patches.yml
vendored
@@ -8,7 +8,6 @@ on:
|
||||
paths:
|
||||
- 'DEPS'
|
||||
- 'patches/**'
|
||||
- '.github/siso-patches/**'
|
||||
|
||||
permissions: {}
|
||||
|
||||
|
||||
4
.github/workflows/scorecards.yml
vendored
@@ -43,7 +43,7 @@ jobs:
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
@@ -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@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v3.29.5
|
||||
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v3.29.5
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
4
.github/workflows/stable-prep-items.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
|
||||
@@ -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@4b06452b0128cf601dac14399aa668a8eed2d684 # v2.0.1
|
||||
uses: dsanders11/project-actions/completed-by@5767984408ccc6742f83acc8b8d8ea5e09f329af # v2.0.0
|
||||
with:
|
||||
field: Prep Status
|
||||
field-value: ✅ Complete
|
||||
|
||||
4
.github/workflows/stale.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
needs: stale
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@5f70a3726af01b612f29aac96d05aa524389c9e9 # v2.1.0
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
|
||||
39
.github/workflows/windows-publish.yml
vendored
@@ -6,8 +6,8 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: ''
|
||||
required: false
|
||||
default: 'eac3529546ea8f3aa356d31e345715eef342233b'
|
||||
required: true
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
required: false
|
||||
@@ -21,28 +21,13 @@ on:
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: ubuntu-slim
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
build-image-sha: ${{ steps.build-image-sha.outputs.build-image-sha }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
- name: Set Build Image SHA
|
||||
id: build-image-sha
|
||||
uses: ./.github/actions/build-image-sha
|
||||
with:
|
||||
override: ${{ inputs.build-image-sha }}
|
||||
|
||||
checkout-windows:
|
||||
needs: setup
|
||||
if: github.repository == 'electron/electron'
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
|
||||
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||
volumes:
|
||||
- /mnt/win-cache:/mnt/win-cache
|
||||
@@ -52,6 +37,8 @@ jobs:
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
|
||||
TARGET_OS: 'win'
|
||||
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
|
||||
outputs:
|
||||
build-image-sha: ${{ inputs.build-image-sha }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
@@ -64,14 +51,6 @@ jobs:
|
||||
generate-sas-token: 'true'
|
||||
target-platform: win
|
||||
|
||||
# Build the patched siso binary in parallel with checkout-windows; the
|
||||
# publish-*-win jobs consume it via SISO_PATH.
|
||||
build-siso-windows:
|
||||
needs: setup
|
||||
uses: ./.github/workflows/pipeline-segment-build-siso-windows.yml
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
publish-x64-win:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-publish.yml
|
||||
permissions:
|
||||
@@ -79,7 +58,7 @@ jobs:
|
||||
attestations: write
|
||||
contents: read
|
||||
id-token: write
|
||||
needs: [checkout-windows, build-siso-windows]
|
||||
needs: checkout-windows
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
@@ -98,7 +77,7 @@ jobs:
|
||||
attestations: write
|
||||
contents: read
|
||||
id-token: write
|
||||
needs: [checkout-windows, build-siso-windows]
|
||||
needs: checkout-windows
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
@@ -117,7 +96,7 @@ jobs:
|
||||
attestations: write
|
||||
contents: read
|
||||
id-token: write
|
||||
needs: [checkout-windows, build-siso-windows]
|
||||
needs: checkout-windows
|
||||
with:
|
||||
environment: production-release
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
||||
"printWidth": 120,
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"sortImports": {
|
||||
"newlinesBetween": true,
|
||||
"groups": [
|
||||
"electron-internal",
|
||||
"electron-scoped",
|
||||
"electron",
|
||||
"external",
|
||||
"builtin",
|
||||
["sibling", "parent"],
|
||||
"index",
|
||||
"type",
|
||||
"unknown"
|
||||
],
|
||||
"customGroups": [
|
||||
{
|
||||
"groupName": "electron-internal",
|
||||
"elementNamePattern": ["@electron/internal", "@electron/internal/**"]
|
||||
},
|
||||
{
|
||||
"groupName": "electron-scoped",
|
||||
"elementNamePattern": ["@electron/**"]
|
||||
},
|
||||
{
|
||||
"groupName": "electron",
|
||||
"elementNamePattern": ["electron", "electron/**"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"ignorePatterns": [
|
||||
"node_modules",
|
||||
"out",
|
||||
"ts-gen",
|
||||
"spec/node_modules",
|
||||
"spec/fixtures/native-addon",
|
||||
".github/workflows/node_modules",
|
||||
"docs/fiddles",
|
||||
"shell/browser/resources/win/resource.h",
|
||||
"shell/common/node_includes.h",
|
||||
"spec/fixtures/pages/jquery-3.6.0.min.js"
|
||||
]
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
# Vendored Yarn release
|
||||
|
||||
This directory holds the Yarn release used by this repo (`yarnPath` in
|
||||
`.yarnrc.yml`). The release file is checked in so every contributor and CI job
|
||||
runs the exact same Yarn, and so we can carry small local patches when needed.
|
||||
|
||||
`releases/yarn-4.12.0.cjs` currently carries one such patch, described below.
|
||||
If you bump the Yarn version, read the **Upgrading Yarn** section first.
|
||||
|
||||
## Patch: use `JsZipImpl` for the node-modules link step
|
||||
|
||||
### What changed
|
||||
|
||||
Two call sites in `releases/yarn-4.12.0.cjs` are modified so the
|
||||
`node-modules` linker (and the `pnpm`-loose linker) construct their read-only
|
||||
`ZipOpenFS` with `customZipImplementation: ST` — Yarn's pure-JS `JsZipImpl` —
|
||||
instead of falling through to the default WASM-backed `LibZipImpl`:
|
||||
|
||||
```text
|
||||
new $f({maxOpenFiles:80,readOnlyArchives:!0})
|
||||
→ new $f({maxOpenFiles:80,readOnlyArchives:!0,customZipImplementation:ST})
|
||||
```
|
||||
|
||||
A comment block at the top of the `.cjs` file marks the file as patched and
|
||||
points back here.
|
||||
|
||||
### Why
|
||||
|
||||
On the `linux-arm` CI test shards we run a 32-bit `arm32v7` container. During
|
||||
`yarn install`'s **Link step**, Yarn opens up to 80 cache zips concurrently.
|
||||
With `LibZipImpl`, each open zip is `readFileSync`'d into a Node `Buffer`
|
||||
**and copied again into the WASM linear memory**, and every file read does a
|
||||
WASM `_malloc(size)` for the entry. The WASM heap has to grow as a single
|
||||
contiguous region of the 32-bit address space; once enough zips are resident,
|
||||
the `_malloc` for a large entry — most often `typescript/lib/typescript.js`
|
||||
(~9 MB inside a ~22 MB zip) — fails.
|
||||
|
||||
Yarn's cross-FS `copyFilePromise` swallows the underlying error and re-throws
|
||||
a generic one, so CI shows:
|
||||
|
||||
```text
|
||||
YN0001: While persisting .../typescript-patch-...zip/node_modules/typescript/
|
||||
EINVAL: invalid argument, copyfile '/node_modules/typescript/lib/typescript.js' -> '...'
|
||||
```
|
||||
|
||||
The unmasked form (occasionally seen on `pdfjs-dist`) is the WASM-heap failure
|
||||
string `Couldn't allocate enough memory`. This started failing ~1-in-3
|
||||
`linux-arm / test` shards at **Install Dependencies** on 2026-04-13, after
|
||||
[#50692](https://github.com/electron/electron/pull/50692) grew the cache enough
|
||||
to push the 32-bit process over the edge nondeterministically — e.g.
|
||||
[run 24739817558](https://github.com/electron/electron/actions/runs/24739817558/job/72380803746).
|
||||
|
||||
`JsZipImpl` avoids the problem entirely: it opens the zip by file descriptor,
|
||||
reads only the central directory into memory, and `readSync`s individual
|
||||
entries into ordinary Node `Buffer`s — **no WASM heap involved**. It is
|
||||
read-only and path-based, which is exactly how the linker uses these archives.
|
||||
|
||||
There is no `.yarnrc.yml` setting or environment variable to select the zip
|
||||
implementation (verified against the bundle), so editing the vendored release
|
||||
is the only way to switch it short of re-implementing the linker in a plugin.
|
||||
|
||||
Upstream references:
|
||||
[yarnpkg/berry#3972](https://github.com/yarnpkg/berry/issues/3972),
|
||||
[yarnpkg/berry#6722](https://github.com/yarnpkg/berry/issues/6722),
|
||||
[yarnpkg/berry#6550](https://github.com/yarnpkg/berry/issues/6550).
|
||||
|
||||
### Upgrading Yarn
|
||||
|
||||
When bumping `releases/yarn-*.cjs`:
|
||||
|
||||
1. Check whether upstream now defaults `readOnlyArchives` opens to `JsZipImpl`,
|
||||
or exposes a config knob for the zip implementation. If so, drop this patch.
|
||||
2. Otherwise, re-apply: search the new bundle for
|
||||
`maxOpenFiles:80,readOnlyArchives:!0` (the surrounding minified identifiers
|
||||
will differ) and add `,customZipImplementation:<JsZipImpl symbol>` — that
|
||||
symbol is whatever the new bundle exports as `JsZipImpl` from
|
||||
`@yarnpkg/libzip`.
|
||||
3. Re-add the header comment pointing back to this README.
|
||||
4. Verify with
|
||||
`rm -rf node_modules spec/node_modules && node script/yarn.js install --immutable --mode=skip-build`
|
||||
and confirm `node_modules/typescript/lib/typescript.js` is byte-identical to
|
||||
an unpatched install.
|
||||
7
.yarn/releases/yarn-4.12.0.cjs
vendored
44
BUILD.gn
@@ -105,25 +105,21 @@ electron_mac_bundle_id = branding.mac_bundle_id
|
||||
if (override_electron_version != "") {
|
||||
electron_version = override_electron_version
|
||||
} else {
|
||||
# When building from a source code tarball there is no git tag available and
|
||||
# When building from source code tarball there is no git tag available and
|
||||
# builders must explicitly pass override_electron_version in gn args.
|
||||
#
|
||||
# Resolve the real locations of packed-refs and HEAD via git so that this
|
||||
# also works when electron/ is a `git worktree` (where .git is a file, not a
|
||||
# directory, and GN's read_file cannot follow the gitdir indirection).
|
||||
electron_git_ref_paths =
|
||||
exec_script("script/get-git-ref-paths.py", [], "list lines")
|
||||
|
||||
# This read_file call will assert if there is no git information, without it
|
||||
# gn will generate a malformed build configuration and ninja will get into
|
||||
# infinite loop.
|
||||
read_file(electron_git_ref_paths[0], "string")
|
||||
read_file(".git/packed-refs", "string")
|
||||
|
||||
# Set electron version from git tag.
|
||||
electron_version = exec_script("script/get-git-version.py",
|
||||
[],
|
||||
"trim string",
|
||||
electron_git_ref_paths)
|
||||
[
|
||||
".git/packed-refs",
|
||||
".git/HEAD",
|
||||
])
|
||||
}
|
||||
|
||||
if (is_mas_build) {
|
||||
@@ -151,25 +147,6 @@ config("branding") {
|
||||
|
||||
config("electron_lib_config") {
|
||||
include_dirs = [ "." ]
|
||||
cflags = []
|
||||
if (is_clang && clang_use_chrome_plugins) {
|
||||
# The plugin is built directly into clang, so there's no need to load it
|
||||
# dynamically.
|
||||
cflags += [
|
||||
"-Xclang",
|
||||
"-add-plugin",
|
||||
"-Xclang",
|
||||
"blink-gc-plugin",
|
||||
"-Xclang",
|
||||
"-plugin-arg-blink-gc-plugin",
|
||||
"-Xclang",
|
||||
"check-directory=electron/shell/",
|
||||
"-Xclang",
|
||||
"-plugin-arg-blink-gc-plugin",
|
||||
"-Xclang",
|
||||
"check-directory=gin/",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# We generate the definitions twice here, once in //electron/electron.d.ts
|
||||
@@ -499,10 +476,8 @@ source_set("electron_lib") {
|
||||
"//components/certificate_transparency",
|
||||
"//components/compose:buildflags",
|
||||
"//components/embedder_support:user_agent",
|
||||
"//components/heap_profiling/multi_process",
|
||||
"//components/input",
|
||||
"//components/language/core/browser",
|
||||
"//components/memory_system",
|
||||
"//components/net_log",
|
||||
"//components/network_hints/browser",
|
||||
"//components/network_hints/common:mojo_bindings",
|
||||
@@ -515,7 +490,6 @@ source_set("electron_lib") {
|
||||
"//components/pref_registry",
|
||||
"//components/prefs",
|
||||
"//components/security_state/content",
|
||||
"//components/tracing:tracing_metrics",
|
||||
"//components/upload_list",
|
||||
"//components/user_prefs",
|
||||
"//components/viz/host",
|
||||
@@ -528,7 +502,6 @@ source_set("electron_lib") {
|
||||
"//content/public/utility",
|
||||
"//device/bluetooth",
|
||||
"//device/bluetooth/public/cpp",
|
||||
"//device/fido",
|
||||
"//gin",
|
||||
"//gpu/ipc/client",
|
||||
"//media/capture/mojom:video_capture",
|
||||
@@ -802,7 +775,7 @@ source_set("electron_lib") {
|
||||
"//components/zoom",
|
||||
"//extensions/browser",
|
||||
"//extensions/browser/api:api_provider",
|
||||
"//extensions/browser/mime_handler",
|
||||
"//extensions/browser/mime_handler:stream_info",
|
||||
"//extensions/browser/updater",
|
||||
"//extensions/common",
|
||||
"//extensions/common:core_api_provider",
|
||||
@@ -1671,9 +1644,8 @@ action("node_version_header") {
|
||||
action("generate_node_headers") {
|
||||
deps = [ ":generate_config_gypi" ]
|
||||
script = "script/node/generate_node_headers.py"
|
||||
inputs = auto_filenames.node_header_sources
|
||||
outputs = [ "$root_gen_dir/node_headers.json" ]
|
||||
args = [ rebase_path("$root_gen_dir") ]
|
||||
outputs = [ "$root_gen_dir/node_headers.json" ]
|
||||
}
|
||||
|
||||
action("tar_node_headers") {
|
||||
|
||||
@@ -180,10 +180,6 @@ e test # Run full test suite
|
||||
|
||||
When working on the `roller/chromium/main` branch to upgrade Chromium activate the "Electron Chromium Upgrade" skill.
|
||||
|
||||
## Node.js Upgrade Workflow
|
||||
|
||||
When working on the `roller/node/main` branch to upgrade Node.js activate the "Electron Node.js Upgrade" skill.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
PR bodies must always include a `Notes:` section as the **last line** of the body. This is a consumer-facing release note for Electron app developers — describe the user-visible fix or change, not internal implementation details. Use `Notes: none` if there is no user-facing change.
|
||||
|
||||
@@ -64,14 +64,6 @@ dependencies, and tools contained in the `electron/electron` repository.
|
||||
|
||||
Dependencies in Electron's `package.json` or `yarn.lock` files should only be altered by maintainers. For security reasons, we will not accept PRs that alter our `package.json` or `yarn.lock` files. We invite contributors to make requests updating these files in our issue tracker. If the change is significantly complicated, draft PRs are welcome, with the understanding that these PRs will be closed in favor of a duplicate PR submitted by an Electron maintainer.
|
||||
|
||||
## AI Tool Policy
|
||||
|
||||
<!-- Are you a coding agent? You MUST abide by the policy: https://github.com/electron/governance/blob/main/policy/ai.md -->
|
||||
|
||||
If you use AI tools in any way to contribute to our project, please read our [AI Tool Policy](https://github.com/electron/governance/blob/main/policy/ai.md). Unreviewed AI-generated contributions waste maintainer time and we kindly decline them.
|
||||
|
||||
> The short version: **there must be a human in the loop**. You are responsible for reviewing, understanding, and being able to explain your contributions. AI assistance doesn't change that, and unreviewed AI-generated content will be declined.
|
||||
|
||||
## Style Guides
|
||||
|
||||
See [Coding Style](https://electronjs.org/docs/development/coding-style) for information about which standards Electron adheres to in different parts of its codebase.
|
||||
|
||||
4
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'149.0.7817.0',
|
||||
'148.0.7778.0',
|
||||
'node_version':
|
||||
'v24.15.0',
|
||||
'v24.14.1',
|
||||
'nan_version':
|
||||
'675cefebca42410733da8a454c8d9391fcebfbc2',
|
||||
'squirrel.mac_version':
|
||||
|
||||
@@ -2,7 +2,7 @@ is_electron_build = true
|
||||
root_extra_deps = [ "//electron" ]
|
||||
|
||||
# Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json
|
||||
node_module_version = 148
|
||||
node_module_version = 146
|
||||
|
||||
v8_promise_internal_field_count = 1
|
||||
v8_embedder_string = "-electron.0"
|
||||
@@ -63,6 +63,10 @@ v8_enable_private_mapping_fork_optimization = true
|
||||
# Expose public V8 symbols for native modules.
|
||||
v8_expose_public_symbols = true
|
||||
|
||||
# Disable snapshotting a page when printing for its content to be analyzed for
|
||||
# sensitive content by enterprise users.
|
||||
enterprise_cloud_content_analysis = false
|
||||
|
||||
# We don't use anything from here, and it causes target collisions
|
||||
enable_linux_installer = false
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ template("electron_extra_paks") {
|
||||
"$root_gen_dir/net/net_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/inspector_overlay_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/strings/permission_element_generated_strings.pak",
|
||||
"$target_gen_dir/electron_resources.pak",
|
||||
]
|
||||
deps = [
|
||||
@@ -84,7 +83,6 @@ template("electron_extra_paks") {
|
||||
"//net:net_resources",
|
||||
"//third_party/blink/public:devtools_inspector_resources",
|
||||
"//third_party/blink/public:resources",
|
||||
"//third_party/blink/public/strings:permission_element_generated_strings",
|
||||
"//ui/webui/resources",
|
||||
]
|
||||
if (defined(invoker.deps)) {
|
||||
@@ -189,7 +187,6 @@ template("electron_paks") {
|
||||
"${root_gen_dir}/extensions/strings/extensions_strings_",
|
||||
"${root_gen_dir}/services/strings/services_strings_",
|
||||
"${root_gen_dir}/third_party/blink/public/strings/blink_strings_",
|
||||
"${root_gen_dir}/third_party/blink/public/strings/permission_element_strings_",
|
||||
"${root_gen_dir}/ui/strings/app_locale_settings_",
|
||||
"${root_gen_dir}/ui/strings/auto_image_annotation_strings_",
|
||||
"${root_gen_dir}/ui/strings/ax_strings_",
|
||||
@@ -207,7 +204,6 @@ template("electron_paks") {
|
||||
"//extensions/strings",
|
||||
"//services/strings",
|
||||
"//third_party/blink/public/strings",
|
||||
"//third_party/blink/public/strings:permission_element_strings",
|
||||
"//ui/strings:app_locale_settings",
|
||||
"//ui/strings:auto_image_annotation_strings",
|
||||
"//ui/strings:ax_strings",
|
||||
|
||||
@@ -8,13 +8,10 @@ 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));
|
||||
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));
|
||||
});
|
||||
});
|
||||
@@ -34,14 +31,7 @@ module.exports = ({
|
||||
entry = path.resolve(electronRoot, 'lib', target, 'init.js');
|
||||
}
|
||||
|
||||
const electronAPIFile = path.resolve(
|
||||
electronRoot,
|
||||
'lib',
|
||||
loadElectronFromAlternateTarget || target,
|
||||
'api',
|
||||
'exports',
|
||||
'electron.ts'
|
||||
);
|
||||
const electronAPIFile = path.resolve(electronRoot, 'lib', loadElectronFromAlternateTarget || target, 'api', 'exports', 'electron.ts');
|
||||
|
||||
return (env = {}, argv = {}) => {
|
||||
const onlyPrintingGraph = !!env.PRINT_WEBPACK_GRAPH;
|
||||
@@ -71,59 +61,49 @@ module.exports = ({
|
||||
}
|
||||
|
||||
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']
|
||||
})
|
||||
);
|
||||
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({
|
||||
Buffer: ['buffer', 'Buffer'],
|
||||
process: 'process/browser'
|
||||
}));
|
||||
}
|
||||
|
||||
plugins.push(
|
||||
new webpack.ProvidePlugin({
|
||||
Promise: ['@electron/internal/common/webpack-globals-provider', 'Promise']
|
||||
})
|
||||
);
|
||||
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: `
|
||||
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: `
|
||||
plugins.push(new WrapperPlugin({
|
||||
header: 'try {',
|
||||
footer: `
|
||||
} catch (err) {
|
||||
console.error('Electron ${outputFilename} script failed to run');
|
||||
console.error(err);
|
||||
}`
|
||||
})
|
||||
);
|
||||
}));
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -153,26 +133,23 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
|
||||
}
|
||||
},
|
||||
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
|
||||
]
|
||||
}
|
||||
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,
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (c) 2026 GitHub, Inc.
|
||||
# Use of this source code is governed by the MIT license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Wrapper for lld-link that resolves relative paths to absolute.
|
||||
|
||||
Usage: abs_link_wrapper.py <lld-link> <args...>
|
||||
|
||||
The first argument is the real linker executable. The script resolves
|
||||
relative .obj/.rlib/.res/.lib paths in both @rspfile contents and direct
|
||||
command-line arguments to absolute paths, then invokes the real linker.
|
||||
"""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def _is_file_path(token):
|
||||
"""Check if a token looks like a relative file path (not a flag or bare lib name)."""
|
||||
# Strip surrounding quotes
|
||||
t = token.strip('"')
|
||||
# Linker flags start with / or -
|
||||
if t.startswith('/') or t.startswith('-'):
|
||||
return False
|
||||
# Must contain a directory separator to be a relative path.
|
||||
# Bare names like "advapi32.lib" are system libraries resolved via
|
||||
# -libpath: or /winsysroot and must not be turned into absolute paths.
|
||||
if '/' not in t and '\\' not in t:
|
||||
return False
|
||||
# File extensions we care about
|
||||
return t.endswith(('.obj', '.res', '.lib', '.a', '.o', '.rlib'))
|
||||
|
||||
|
||||
def _resolve_rsp(rsp_path):
|
||||
"""Rewrite relative file paths in the rsp file to absolute paths."""
|
||||
with open(rsp_path, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
lines = []
|
||||
changed = False
|
||||
for line in content.splitlines():
|
||||
tokens = []
|
||||
for token in line.split():
|
||||
stripped = token.strip('"')
|
||||
if _is_file_path(token) and not os.path.isabs(stripped):
|
||||
abs_path = os.path.abspath(stripped)
|
||||
tokens.append('"' + abs_path + '"')
|
||||
changed = True
|
||||
else:
|
||||
tokens.append(token)
|
||||
lines.append(' '.join(tokens))
|
||||
|
||||
if not changed:
|
||||
return rsp_path
|
||||
|
||||
abs_rsp = rsp_path + '.abs'
|
||||
with open(abs_rsp, 'w') as f:
|
||||
f.write('\n'.join(lines))
|
||||
return abs_rsp
|
||||
|
||||
|
||||
def _resolve_arg(arg):
|
||||
"""Resolve a single command-line argument if it's a relative file path."""
|
||||
stripped = arg.strip('"')
|
||||
if _is_file_path(arg) and not os.path.isabs(stripped):
|
||||
return os.path.abspath(stripped)
|
||||
return arg
|
||||
|
||||
|
||||
def main():
|
||||
args = []
|
||||
for arg in sys.argv[1:]:
|
||||
if arg.startswith('@'):
|
||||
rsp_path = arg[1:].strip('"')
|
||||
resolved = _resolve_rsp(rsp_path)
|
||||
args.append('@' + resolved)
|
||||
else:
|
||||
args.append(_resolve_arg(arg))
|
||||
|
||||
return subprocess.call(args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
@@ -21,8 +21,6 @@ static_library("chrome") {
|
||||
"//chrome/browser/browser_features.h",
|
||||
"//chrome/browser/browser_process.cc",
|
||||
"//chrome/browser/browser_process.h",
|
||||
"//chrome/browser/device_notifications/device_connection_tracker.h",
|
||||
"//chrome/browser/device_notifications/device_system_tray_icon.h",
|
||||
"//chrome/browser/devtools/devtools_contents_resizing_strategy.cc",
|
||||
"//chrome/browser/devtools/devtools_contents_resizing_strategy.h",
|
||||
"//chrome/browser/devtools/devtools_dispatch_http_request_params.cc",
|
||||
@@ -40,7 +38,6 @@ static_library("chrome") {
|
||||
"//chrome/browser/devtools/visual_logging.h",
|
||||
"//chrome/browser/file_system_access/file_system_access_features.cc",
|
||||
"//chrome/browser/file_system_access/file_system_access_features.h",
|
||||
"//chrome/browser/hid/hid_system_tray_icon.h",
|
||||
"//chrome/browser/icon_loader.cc",
|
||||
"//chrome/browser/icon_loader.h",
|
||||
"//chrome/browser/icon_manager.cc",
|
||||
@@ -159,7 +156,6 @@ static_library("chrome") {
|
||||
"//chrome/browser/ui/webui/accessibility/accessibility_ui.h",
|
||||
"//chrome/browser/usb/usb_blocklist.cc",
|
||||
"//chrome/browser/usb/usb_blocklist.h",
|
||||
"//chrome/browser/usb/usb_system_tray_icon.h",
|
||||
"//extensions/browser/app_window/size_constraints.cc",
|
||||
"//extensions/browser/app_window/size_constraints.h",
|
||||
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.cc",
|
||||
@@ -251,6 +247,10 @@ static_library("chrome") {
|
||||
"//chrome/browser/ui/views/dark_mode_manager_linux.cc",
|
||||
"//chrome/browser/ui/views/dark_mode_manager_linux.h",
|
||||
]
|
||||
sources += [
|
||||
"//chrome/browser/ui/views/frame/browser_frame_view_paint_utils_linux.cc",
|
||||
"//chrome/browser/ui/views/frame/browser_frame_view_paint_utils_linux.h",
|
||||
]
|
||||
public_deps += [ "//components/dbus" ]
|
||||
}
|
||||
|
||||
@@ -389,17 +389,16 @@ static_library("chrome") {
|
||||
"//chrome/browser/pdf/chrome_pdf_stream_delegate.h",
|
||||
"//chrome/browser/pdf/pdf_extension_util.cc",
|
||||
"//chrome/browser/pdf/pdf_extension_util.h",
|
||||
"//chrome/browser/pdf/pdf_handler_stream_delegate.cc",
|
||||
"//chrome/browser/pdf/pdf_handler_stream_delegate.h",
|
||||
"//chrome/browser/pdf/pdf_help_bubble_handler_factory.cc",
|
||||
"//chrome/browser/pdf/pdf_help_bubble_handler_factory.h",
|
||||
"//chrome/browser/pdf/pdf_viewer_stream_manager.cc",
|
||||
"//chrome/browser/pdf/pdf_viewer_stream_manager.h",
|
||||
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.cc",
|
||||
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.h",
|
||||
]
|
||||
deps += [
|
||||
"//components/pdf/browser",
|
||||
"//components/pdf/renderer",
|
||||
"//components/zoom",
|
||||
"//ui/base/interaction",
|
||||
"//ui/webui/resources/cr_components/help_bubble:mojo_bindings",
|
||||
]
|
||||
|
||||
@@ -58,15 +58,23 @@ app.whenReady().then(() => {
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
|
||||
});
|
||||
|
||||
function decorateURL (url: string) {
|
||||
// safely add `?utm_source=default_app
|
||||
const parsedUrl = new URL(url);
|
||||
parsedUrl.searchParams.append('utm_source', 'default_app');
|
||||
return parsedUrl.toString();
|
||||
}
|
||||
|
||||
// Find the shortest path to the electron binary
|
||||
const absoluteElectronPath = process.execPath;
|
||||
const relativeElectronPath = path.relative(process.cwd(), absoluteElectronPath);
|
||||
const electronPath =
|
||||
absoluteElectronPath.length < relativeElectronPath.length ? absoluteElectronPath : relativeElectronPath;
|
||||
const electronPath = absoluteElectronPath.length < relativeElectronPath.length
|
||||
? absoluteElectronPath
|
||||
: relativeElectronPath;
|
||||
|
||||
const indexPath = path.resolve(app.getAppPath(), 'index.html');
|
||||
|
||||
function isTrustedSender(webContents: Electron.WebContents) {
|
||||
function isTrustedSender (webContents: Electron.WebContents) {
|
||||
if (webContents !== (mainWindow && mainWindow.webContents)) {
|
||||
return false;
|
||||
}
|
||||
@@ -82,7 +90,7 @@ ipcMain.handle('bootstrap', (event) => {
|
||||
return isTrustedSender(event.sender) ? electronPath : null;
|
||||
});
|
||||
|
||||
async function createWindow(backgroundColor?: string) {
|
||||
async function createWindow (backgroundColor?: string) {
|
||||
await app.whenReady();
|
||||
|
||||
const options: Electron.BrowserWindowConstructorOptions = {
|
||||
@@ -107,8 +115,8 @@ async function createWindow(backgroundColor?: string) {
|
||||
mainWindow = new BrowserWindow(options);
|
||||
mainWindow.on('ready-to-show', () => mainWindow!.show());
|
||||
|
||||
mainWindow.webContents.setWindowOpenHandler((details) => {
|
||||
shell.openExternal(details.url);
|
||||
mainWindow.webContents.setWindowOpenHandler(details => {
|
||||
shell.openExternal(decorateURL(details.url));
|
||||
return { action: 'deny' };
|
||||
});
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ type DefaultAppOptions = {
|
||||
interactive: boolean;
|
||||
abi: boolean;
|
||||
modules: string[];
|
||||
};
|
||||
}
|
||||
|
||||
// Parse command line options.
|
||||
const argv = process.argv.slice(1);
|
||||
@@ -74,7 +74,7 @@ if (option.modules.length > 0) {
|
||||
(Module as any)._preloadModules(option.modules);
|
||||
}
|
||||
|
||||
async function loadApplicationPackage(packagePath: string) {
|
||||
async function loadApplicationPackage (packagePath: string) {
|
||||
// Add a flag indicating app is started from default app.
|
||||
Object.defineProperty(process, 'defaultApp', {
|
||||
configurable: false,
|
||||
@@ -92,11 +92,9 @@ async function loadApplicationPackage(packagePath: string) {
|
||||
const emitWarning = process.emitWarning;
|
||||
try {
|
||||
process.emitWarning = () => {};
|
||||
packageJson = (
|
||||
await import(url.pathToFileURL(packageJsonPath).toString(), {
|
||||
with: { type: 'json' }
|
||||
})
|
||||
).default;
|
||||
packageJson = (await import(url.pathToFileURL(packageJsonPath).toString(), {
|
||||
with: { type: 'json' }
|
||||
})).default;
|
||||
} catch (e) {
|
||||
showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${(e as Error).message}`);
|
||||
return;
|
||||
@@ -145,23 +143,23 @@ async function loadApplicationPackage(packagePath: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function showErrorMessage(message: string) {
|
||||
function showErrorMessage (message: string) {
|
||||
app.focus();
|
||||
dialog.showErrorBox('Error launching app', message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
async function loadApplicationByURL(appUrl: string) {
|
||||
async function loadApplicationByURL (appUrl: string) {
|
||||
const { loadURL } = await import('./default_app.js');
|
||||
loadURL(appUrl);
|
||||
}
|
||||
|
||||
async function loadApplicationByFile(appPath: string) {
|
||||
async function loadApplicationByFile (appPath: string) {
|
||||
const { loadFile } = await import('./default_app.js');
|
||||
loadFile(appPath);
|
||||
}
|
||||
|
||||
async function startRepl() {
|
||||
async function startRepl () {
|
||||
if (process.platform === 'win32') {
|
||||
console.error('Electron REPL not currently supported on Windows');
|
||||
process.exit(1);
|
||||
@@ -189,7 +187,7 @@ async function startRepl() {
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
function defineBuiltin(context: any, name: string, getter: Function) {
|
||||
function defineBuiltin (context: any, name: string, getter: Function) {
|
||||
const setReal = (val: any) => {
|
||||
// Deleting the property before re-assigning it disables the
|
||||
// getter/setter mechanism.
|
||||
@@ -227,42 +225,11 @@ async function startRepl() {
|
||||
// we only trigger custom tab-completion when no common words are
|
||||
// potentially matches.
|
||||
const commonWords = [
|
||||
'async',
|
||||
'await',
|
||||
'break',
|
||||
'case',
|
||||
'catch',
|
||||
'const',
|
||||
'continue',
|
||||
'debugger',
|
||||
'default',
|
||||
'delete',
|
||||
'do',
|
||||
'else',
|
||||
'export',
|
||||
'false',
|
||||
'finally',
|
||||
'for',
|
||||
'function',
|
||||
'if',
|
||||
'import',
|
||||
'in',
|
||||
'instanceof',
|
||||
'let',
|
||||
'new',
|
||||
'null',
|
||||
'return',
|
||||
'switch',
|
||||
'this',
|
||||
'throw',
|
||||
'true',
|
||||
'try',
|
||||
'typeof',
|
||||
'var',
|
||||
'void',
|
||||
'while',
|
||||
'with',
|
||||
'yield'
|
||||
'async', 'await', 'break', 'case', 'catch', 'const', 'continue',
|
||||
'debugger', 'default', 'delete', 'do', 'else', 'export', 'false',
|
||||
'finally', 'for', 'function', 'if', 'import', 'in', 'instanceof', 'let',
|
||||
'new', 'null', 'return', 'switch', 'this', 'throw', 'true', 'try',
|
||||
'typeof', 'var', 'void', 'while', 'with', 'yield'
|
||||
];
|
||||
|
||||
const electronBuiltins = [...Object.keys(electron), 'original-fs', 'electron'];
|
||||
|
||||
@@ -2,10 +2,10 @@ const { ipcRenderer, contextBridge } = require('electron/renderer');
|
||||
|
||||
const policy = window.trustedTypes.createPolicy('electron-default-app', {
|
||||
// we trust the SVG contents
|
||||
createHTML: (input) => input
|
||||
createHTML: input => input
|
||||
});
|
||||
|
||||
async function getOcticonSvg(name: string) {
|
||||
async function getOcticonSvg (name: string) {
|
||||
try {
|
||||
const response = await fetch(`octicon/${name}.svg`);
|
||||
const div = document.createElement('div');
|
||||
@@ -16,7 +16,7 @@ async function getOcticonSvg(name: string) {
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSVG(element: HTMLSpanElement) {
|
||||
async function loadSVG (element: HTMLSpanElement) {
|
||||
for (const cssClass of element.classList) {
|
||||
if (cssClass.startsWith('octicon-')) {
|
||||
const icon = await getOcticonSvg(cssClass.substr(8));
|
||||
@@ -32,9 +32,9 @@ async function loadSVG(element: HTMLSpanElement) {
|
||||
}
|
||||
}
|
||||
|
||||
async function initialize() {
|
||||
async function initialize () {
|
||||
const electronPath = await ipcRenderer.invoke('bootstrap');
|
||||
function replaceText(selector: string, text: string, link?: string) {
|
||||
function replaceText (selector: string, text: string, link?: string) {
|
||||
const element = document.querySelector<HTMLElement>(selector);
|
||||
if (element) {
|
||||
if (link) {
|
||||
@@ -51,11 +51,7 @@ async function initialize() {
|
||||
|
||||
replaceText('.electron-version', `Electron v${process.versions.electron}`, 'https://electronjs.org/docs');
|
||||
replaceText('.chrome-version', `Chromium v${process.versions.chrome}`, 'https://developer.chrome.com/docs/chromium');
|
||||
replaceText(
|
||||
'.node-version',
|
||||
`Node v${process.versions.node}`,
|
||||
`https://nodejs.org/docs/v${process.versions.node}/api`
|
||||
);
|
||||
replaceText('.node-version', `Node v${process.versions.node}`, `https://nodejs.org/docs/v${process.versions.node}/api`);
|
||||
replaceText('.v8-version', `v8 v${process.versions.v8}`, 'https://v8.dev/docs');
|
||||
replaceText('.command-example', `${electronPath} path-to-app`);
|
||||
|
||||
|
||||
@@ -882,7 +882,7 @@ Returns `string` - Name of the application handling the protocol, or an empty
|
||||
This method returns the application name of the default handler for the protocol
|
||||
(aka URI scheme) of a URL.
|
||||
|
||||
### `app.getApplicationInfoForProtocol(url)`
|
||||
### `app.getApplicationInfoForProtocol(url)` _macOS_ _Windows_
|
||||
|
||||
* `url` string - a URL with the protocol name to check. Unlike the other
|
||||
methods in this family, this accepts an entire URL, including `://` at a
|
||||
@@ -1233,51 +1233,6 @@ This API must be called after the `ready` event is emitted.
|
||||
[doh-providers]: https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&ss=chromium%2Fchromium%2Fsrc
|
||||
[RFC8484 § 3]: https://datatracker.ietf.org/doc/html/rfc8484#section-3
|
||||
|
||||
### `app.configureWebAuthn(options)` _macOS_
|
||||
|
||||
* `options` Object
|
||||
* `touchID` Object (optional) - Enables the Touch ID / Secure Enclave platform
|
||||
authenticator for [Web Authentication](https://www.w3.org/TR/webauthn-2/)
|
||||
requests.
|
||||
* `keychainAccessGroup` string - The keychain access group that WebAuthn
|
||||
credentials will be stored under. This value **must** also be present in
|
||||
your app's `keychain-access-groups` code-signing entitlement, and is
|
||||
typically of the form `<TEAM_ID>.<BUNDLE_ID>.webauthn`.
|
||||
|
||||
Configures platform authenticators for the Web Authentication API
|
||||
(`navigator.credentials.create()` / `navigator.credentials.get()`). Until this
|
||||
is called, `PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()`
|
||||
resolves to `false` and platform-authenticator requests are not serviced.
|
||||
|
||||
When `touchID` is provided, WebAuthn credentials are stored in the macOS
|
||||
keychain and bound to this device's Secure Enclave. Electron automatically
|
||||
generates and persists a per-[`session`](session.md) metadata secret so that
|
||||
credentials created in one partition are not visible to another.
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
|
||||
app.configureWebAuthn({
|
||||
touchID: {
|
||||
keychainAccessGroup: 'A1B2C3D4E5.com.example.app.webauthn'
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
With the matching entitlement in your app's `entitlements.plist`:
|
||||
|
||||
```xml
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>A1B2C3D4E5.com.example.app.webauthn</string>
|
||||
</array>
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Touch ID WebAuthn credentials are device-bound and are not synced via iCloud
|
||||
> Keychain. They are only available on Macs with a Secure Enclave (Apple
|
||||
> silicon, or Intel Macs with a T2 chip).
|
||||
|
||||
### `app.disableHardwareAcceleration()`
|
||||
|
||||
Disables hardware acceleration for current app.
|
||||
|
||||
@@ -319,17 +319,6 @@ By default inspector websocket url is available in stderr and under /json/list e
|
||||
|
||||
Enable support for DevTools network inspector events, for visibility into requests made by the nodejs `http` and `https` modules.
|
||||
|
||||
### `--experimental-inspector-network-resource`
|
||||
|
||||
Enable support for resolving source maps over the network when using the Node.js inspector.
|
||||
|
||||
When enabled, DevTools can retrieve remote source maps for main and utility
|
||||
process scripts via the Node.js inspector.
|
||||
|
||||
**Note:** When enabled, the Node.js inspector will make network requests to
|
||||
URLs specified in source maps. Be mindful of this in environments where the
|
||||
process has access to internal networks.
|
||||
|
||||
### `--no-deprecation`
|
||||
|
||||
Silence deprecation warnings.
|
||||
|
||||
@@ -124,65 +124,4 @@ Returns `Promise<Object>` - Resolves with an object containing the `value` and `
|
||||
Get the maximum usage across processes of trace buffer as a percentage of the
|
||||
full state.
|
||||
|
||||
### `contentTracing.enableHeapProfiling([options])` _Experimental_
|
||||
|
||||
<!--
|
||||
```YAML history
|
||||
added:
|
||||
- pr-url: https://github.com/electron/electron/pull/50826
|
||||
```
|
||||
-->
|
||||
|
||||
* `options` ([EnableHeapProfilingOptions](structures/enable-heap-profiling-options.md)) (optional)
|
||||
|
||||
Returns `Promise<void>` - Resolves once heap profiling has been enabled.
|
||||
|
||||
Enable [heap profiling](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/memory-infra/heap_profiler.md)
|
||||
for MemoryInfra traces. Equivalent to the `--memlog` switch in Chrome.
|
||||
|
||||
Only takes effect if the `disabled-by-default-memory-infra` category is included.
|
||||
|
||||
Needs to be called before `contentTracing.startRecording()`.
|
||||
|
||||
Usage:
|
||||
|
||||
```js
|
||||
const { contentTracing } = require('electron')
|
||||
|
||||
async function recordTrace () {
|
||||
await contentTracing.enableHeapProfiling()
|
||||
await contentTracing.startRecording({
|
||||
included_categories: ['disabled-by-default-memory-infra'],
|
||||
excluded_categories: ['*'],
|
||||
memory_dump_config: {
|
||||
triggers: [
|
||||
{ mode: 'detailed', periodic_interval_ms: 1000 }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 5000))
|
||||
|
||||
const filePath = await contentTracing.stopRecording()
|
||||
}
|
||||
```
|
||||
|
||||
To view the recorded heap dumps:
|
||||
|
||||
1. Download the breakpad symbols for your Electron version from the Electron GitHub
|
||||
[releases](https://github.com/electron/electron/releases)
|
||||
2. Clone the [Electron source code](../development/build-instructions-gn.md)
|
||||
3. In your Chromium checkout for Electron, run this command to symbolicate the heap dump:
|
||||
|
||||
```bash
|
||||
python3 third_party/catapult/tracing/bin/symbolize_trace --use-breakpad-symbols --breakpad-symbols-directory /path/to/breakpad_symbols /path/to/trace.json
|
||||
```
|
||||
|
||||
4. Open the symbolicated trace in `chrome://tracing` (the Perfetto UI does not support memory dumps
|
||||
yet)
|
||||
5. Click on one of the `M` symbols
|
||||
6. Click on a `☰` triple bar icon (e.g., in the `malloc` column)
|
||||
|
||||
<img src="../images/viewing-heap-dumps.png" alt="Screenshot showing how to view a heapdump in Chromium's tracing view" />
|
||||
|
||||
[trace viewer]: https://chromium.googlesource.com/catapult/+/HEAD/tracing/README.md
|
||||
|
||||
@@ -203,22 +203,13 @@ the one downloaded by `npm install`. Usage:
|
||||
export ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing
|
||||
```
|
||||
|
||||
### `ELECTRON_INSTALL_PLATFORM`
|
||||
### `ELECTRON_SKIP_BINARY_DOWNLOAD`
|
||||
|
||||
Manually overrides platform used by `electron` package during an install.
|
||||
This can be useful if you are on one platform (e.g macOS) but want to
|
||||
download binaries for another platform (e.g Windows or Linux). Usage:
|
||||
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_INSTALL_PLATFORM=darwin npm install
|
||||
```
|
||||
|
||||
### `ELECTRON_INSTALL_ARCH`
|
||||
|
||||
Manually overrides architecture used by `electron` package during an install.
|
||||
This can be useful if you are on one arch (e.g `arm64`) but want to download
|
||||
binaries meant for another arch. Note that this will not work under Rosetta. Usage:
|
||||
|
||||
```sh
|
||||
ELECTRON_INSTALL_ARCH=arm64 npm install
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install
|
||||
```
|
||||
|
||||
@@ -31,7 +31,6 @@ See [`Menu`](menu.md) for examples.
|
||||
* `header` - Only available on macOS 14 and up.
|
||||
* `palette` - Only available on macOS 14 and up.
|
||||
* `label` string (optional)
|
||||
* `accessibilityLabel` string (optional) _macOS_
|
||||
* `sublabel` string (optional) _macOS_ - Available in macOS >= 14.4
|
||||
* `toolTip` string (optional) _macOS_ - Hover text for this menu item.
|
||||
* `accelerator` string (optional) - An [Accelerator](../tutorial/keyboard-shortcuts.md#accelerators) string.
|
||||
@@ -84,12 +83,6 @@ A `string` indicating the item's visible label.
|
||||
|
||||
This property can be dynamically changed.
|
||||
|
||||
#### `menuItem.accessibilityLabel` _macOS_
|
||||
|
||||
A `string` indicating the item's accessibility label (used by assistive technology), if set.
|
||||
|
||||
This property can be dynamically changed.
|
||||
|
||||
#### `menuItem.click`
|
||||
|
||||
A `Function` that is fired when the MenuItem receives a click event.
|
||||
|
||||
@@ -76,51 +76,11 @@ app.whenReady().then(() => {
|
||||
})
|
||||
```
|
||||
|
||||
#### `Notification.getHistory()` _macOS_
|
||||
|
||||
Returns `Promise<Notification[]>` - Resolves with an array of `Notification` objects representing all delivered notifications still present in Notification Center.
|
||||
|
||||
Each returned `Notification` is a live object connected to the corresponding delivered notification. Interaction events (`click`, `reply`, `action`, `close`) will fire on these objects when the user interacts with the notification in Notification Center. This is useful after an app restart to re-attach event handlers to notifications from a previous session.
|
||||
|
||||
The returned notifications have their `id`, `groupId`, `title`, `subtitle`, and `body` properties populated from information available in the Notification Center. Other properties (e.g., `actions`, `silent`, `icon`) are not available from delivered notifications and will have default values.
|
||||
|
||||
> [!NOTE]
|
||||
> Like all macOS notification APIs, this method requires the application to be
|
||||
> code-signed. In unsigned development builds, notifications are not delivered
|
||||
> to Notification Center and this method will resolve with an empty array.
|
||||
|
||||
> [!NOTE]
|
||||
> Unlike notifications created with `new Notification()`, notifications returned
|
||||
> by `getHistory()` will remain visible in Notification Center when the object
|
||||
> is garbage collected. Calling `show()` on a restored notification will remove
|
||||
> the original from Notification Center and post a new one with the same
|
||||
> properties.
|
||||
|
||||
```js
|
||||
const { Notification, app } = require('electron')
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
// Restore notifications from a previous session
|
||||
const notifications = await Notification.getHistory()
|
||||
for (const n of notifications) {
|
||||
console.log(`Found delivered notification: ${n.id} - ${n.title}`)
|
||||
n.on('click', () => {
|
||||
console.log(`User clicked: ${n.id}`)
|
||||
})
|
||||
n.on('reply', (event) => {
|
||||
console.log(`User replied to ${n.id}: ${event.reply}`)
|
||||
})
|
||||
}
|
||||
// Keep references so events continue to fire
|
||||
})
|
||||
```
|
||||
|
||||
### `new Notification([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
* `id` string (optional) _macOS_ _Windows_ - A unique identifier for the notification. On macOS, maps to `UNNotificationRequest`'s [`identifier`](https://developer.apple.com/documentation/usernotifications/unnotificationrequest/identifier) property. On Windows, maps to the toast notification's [`Tag`](https://learn.microsoft.com/en-us/uwp/api/windows.ui.notifications.toastnotification.tag) property. Defaults to a random UUID if not provided or if an empty string is passed. This can be used to remove or update previously delivered notifications.
|
||||
* `groupId` string (optional) _macOS_ _Windows_ - A string identifier used to visually group notifications together in Notification Center / Action Center. On macOS, maps to `UNNotificationContent`'s [`threadIdentifier`](https://developer.apple.com/documentation/usernotifications/unnotificationcontent/threadidentifier) property. On Windows, maps to the toast notification's [`Group`](https://learn.microsoft.com/en-us/uwp/api/windows.ui.notifications.toastnotification.group) property.
|
||||
* `groupTitle` string (optional) _Windows_ - A title for the notification group header. When both `groupId` and `groupTitle` are specified, Windows will display a header above the notification that groups related notifications together. Maps to the toast notification's [`header`](https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/toast-headers) element.
|
||||
* `id` string (optional) _macOS_ - A unique identifier for the notification, mapping to `UNNotificationRequest`'s [`identifier`](https://developer.apple.com/documentation/usernotifications/unnotificationrequest/identifier) property. Defaults to a random UUID if not provided or if an empty string is passed. This can be used to remove or update previously delivered notifications.
|
||||
* `groupId` string (optional) _macOS_ - A string identifier used to visually group notifications together in Notification Center. Maps to `UNNotificationContent`'s [`threadIdentifier`](https://developer.apple.com/documentation/usernotifications/unnotificationcontent/threadidentifier) property.
|
||||
* `title` string (optional) - A title for the notification, which will be displayed at the top of the notification window when it is shown.
|
||||
* `subtitle` string (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
|
||||
* `body` string (optional) - The body text of the notification, which will be displayed below the title or subtitle.
|
||||
@@ -331,10 +291,6 @@ call this method before the OS will display it.
|
||||
If the notification has been shown before, this method will dismiss the previously
|
||||
shown notification and create a new one with identical properties.
|
||||
|
||||
On macOS, calling `show()` on a notification returned by `Notification.getHistory()` will
|
||||
remove the original notification from Notification Center and post a new one with the same
|
||||
properties.
|
||||
|
||||
```js
|
||||
const { Notification, app } = require('electron')
|
||||
|
||||
@@ -373,17 +329,13 @@ app.whenReady().then(() => {
|
||||
|
||||
### Instance Properties
|
||||
|
||||
#### `notification.id` _macOS_ _Windows_ _Readonly_
|
||||
#### `notification.id` _macOS_ _Readonly_
|
||||
|
||||
A `string` property representing the unique identifier of the notification. This is set at construction time — either from the `id` option or as a generated UUID if none was provided.
|
||||
|
||||
#### `notification.groupId` _macOS_ _Windows_ _Readonly_
|
||||
#### `notification.groupId` _macOS_ _Readonly_
|
||||
|
||||
A `string` property representing the group identifier of the notification. Notifications with the same `groupId` will be visually grouped together in Notification Center (macOS) or Action Center (Windows).
|
||||
|
||||
#### `notification.groupTitle` _Windows_ _Readonly_
|
||||
|
||||
A `string` property representing the title of the notification group header.
|
||||
A `string` property representing the group identifier of the notification. Notifications with the same `groupId` will be visually grouped together in Notification Center.
|
||||
|
||||
#### `notification.title`
|
||||
|
||||
|
||||
@@ -629,54 +629,6 @@ Emitted after `USBDevice.forget()` has been called. This event can be used
|
||||
to help maintain persistent storage of permissions when
|
||||
`setDevicePermissionHandler` is used.
|
||||
|
||||
#### Event: 'select-webauthn-account'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `relyingPartyId` string - The relying party identifier from the WebAuthn request.
|
||||
* `accounts` [WebAuthnAccount[]](structures/webauthn-account.md)
|
||||
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
|
||||
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||
* `callback` Function
|
||||
* `credentialId` string | null (optional)
|
||||
|
||||
Emitted when a call to `navigator.credentials.get()` resolves multiple
|
||||
discoverable WebAuthn credentials and the user must choose one. `callback`
|
||||
should be called with the `credentialId` of the selected account; passing no
|
||||
arguments — or a `credentialId` that does not match one of the provided
|
||||
accounts — will cancel the request and the page will receive a
|
||||
`NotAllowedError`. If no listener is registered for this event, the request is
|
||||
cancelled with the same error. The credential request remains pending until
|
||||
the listener invokes the callback, so always invoke it exactly once — typically
|
||||
from a `try { … } finally { callback(…) }` block.
|
||||
|
||||
On macOS, the Touch ID platform authenticator surfaces accounts via this event
|
||||
once it has been configured with
|
||||
[`app.configureWebAuthn`](app.md#appconfigurewebauthnoptions-macos). The event
|
||||
may also fire on other platforms when a roaming FIDO2 authenticator returns
|
||||
multiple discoverable credentials.
|
||||
|
||||
```js
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
let win = null
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.configureWebAuthn({
|
||||
touchID: { keychainAccessGroup: 'A1B2C3D4E5.com.example.app.webauthn' }
|
||||
})
|
||||
|
||||
win = new BrowserWindow()
|
||||
|
||||
win.webContents.session.on('select-webauthn-account', (event, details, callback) => {
|
||||
const selected = details.accounts.find((a) => a.name === 'alice@example.com')
|
||||
callback(selected?.credentialId)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
### Instance Methods
|
||||
|
||||
The following methods are available on instances of `Session`:
|
||||
@@ -698,7 +650,7 @@ Clears the session’s HTTP cache.
|
||||
`scheme://host:port`.
|
||||
* `storages` string[] (optional) - The types of storages to clear, can be
|
||||
`cookies`, `filesystem`, `indexdb`, `localstorage`,
|
||||
`shadercache`, `serviceworkers`, `cachestorage`. If not
|
||||
`shadercache`, `websql`, `serviceworkers`, `cachestorage`. If not
|
||||
specified, clear all storage types.
|
||||
|
||||
Returns `Promise<void>` - resolves when the storage data has been cleared.
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
# EnableHeapProfilingOptions Object
|
||||
|
||||
* `mode` string (optional) - Controls which processes are profiled. Equivalent to `--memlog` in
|
||||
Chrome. Default is `all`.
|
||||
* `all` - Profile all processes.
|
||||
* `browser` - Profile only the browser process.
|
||||
* `gpu` - Profile only the GPU process.
|
||||
* `minimal` - Profile only the browser and GPU processes.
|
||||
* `renderer-sampling` - Profile at most 1 renderer process. Each renderer process has a fixed
|
||||
probability of being profiled when the renderer process is started or, for existing processes,
|
||||
when heap profiling is enabled.
|
||||
* `all-renderers` - Profile all renderer processes.
|
||||
* `utility-sampling` - Each utility process has a fixed probability of being profiled.
|
||||
* `all-utilities` - Profile all utility processes.
|
||||
* `utility-and-browser` - Profile all utility processes and the browser process.
|
||||
* `samplingRate` number (optional) - Controls the sampling interval in bytes. The lower the
|
||||
interval, the more precise the profile is. However it comes at the cost of performance. Default
|
||||
is `100000` (100KB). That is enough to observe allocation sites that make allocations >500KB
|
||||
total, where total equals to a single allocation size times the number of such allocations at the
|
||||
same call site. Equivalent to `--memlog-sampling-rate` in Chrome. Must be an integer between
|
||||
`1000` and `10000000`.
|
||||
* `stackMode` string (optional) - Controls the type of metadata recorded for each allocation.
|
||||
Equivalent to `--memlog-stack-mode` in Chrome. Default is `native`.
|
||||
* `native` - Instruction addresses from unwinding the stack.
|
||||
* `native-with-thread-names` - Instruction addresses from unwinding the stack. Includes the thread
|
||||
name as the first frame.
|
||||
@@ -5,7 +5,6 @@
|
||||
* `rgba` - 32bpp RGBA (byte-order), 1 plane.
|
||||
* `rgbaf16` - Half float RGBA, 1 plane.
|
||||
* `nv12` - 12bpp with Y plane followed by a 2x2 interleaved UV plane.
|
||||
* `nv16` - 16bpp with Y plane followed by a 2x1 interleaved UV plane.
|
||||
* `p010le` - 4:2:0 10-bit YUV (little-endian), Y plane followed by a 2x2 interleaved UV plane.
|
||||
* `colorSpace` [ColorSpace](color-space.md) (optional) - The color space of the texture.
|
||||
* `codedSize` [Size](size.md) - The full dimensions of the shared texture.
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# WebAuthnAccount Object
|
||||
|
||||
* `credentialId` string - URL-safe base64-encoded (no padding) credential ID of
|
||||
the discoverable credential. Matches `PublicKeyCredential.id` returned by
|
||||
`navigator.credentials.get()` in the renderer.
|
||||
* `userHandle` string (optional) - URL-safe base64-encoded (no padding) user
|
||||
handle (`user.id`) that was provided when the credential was created.
|
||||
* `name` string (optional) - Human-palatable identifier for the account (for example, an email address or username).
|
||||
* `displayName` string (optional) - Human-palatable name for the account, intended for display.
|
||||
@@ -17,16 +17,6 @@ Process: [Main](../glossary.md#main-process)<br />
|
||||
* `env` Object (optional) - Environment key-value pairs. Default is `process.env`.
|
||||
* `execArgv` string[] (optional) - List of string arguments passed to the executable.
|
||||
* `cwd` string (optional) - Current working directory of the child process.
|
||||
* `session` [Session](session.md) (optional) - Sets the session used by the process for network
|
||||
requests. By default, network requests from the utility process will use the system network
|
||||
context which does not have HTTP cache support. Setting a session enables HTTP caching and
|
||||
other session-specific network features. See [session](session.md) for more information.
|
||||
* `partition` string (optional) - Sets the session used by the process according to the
|
||||
session's partition string. If `partition` starts with `persist:`, the process will use a
|
||||
persistent session available to all pages in the app with the same `partition`. If there is
|
||||
no `persist:` prefix, the process will use an in-memory session. By assigning the same
|
||||
`partition`, multiple processes can share the same session. If the `session` option is set,
|
||||
this option is ignored.
|
||||
* `stdio` (string[] | string) (optional) - Allows configuring the mode for `stdout` and `stderr`
|
||||
of the child process. Default is `inherit`.
|
||||
String value can be one of `pipe`, `ignore`, `inherit`, for more details on these values you can refer to
|
||||
@@ -54,9 +44,7 @@ Process: [Main](../glossary.md#main-process)<br />
|
||||
that run third-party or otherwise untrusted code. Default is `false`.
|
||||
* `respondToAuthRequestsFromMainProcess` boolean (optional) - With this flag, all HTTP 401 and 407 network
|
||||
requests created via the [net module](net.md) will allow responding to them via the
|
||||
[`login`](#event-login) event on the `UtilityProcess` instance when a `session` is provided, or via
|
||||
the [`app#login`](app.md#event-login) event in the main process when using the default system network
|
||||
context. Without this flag, auth challenges are handled by the default
|
||||
[`app#login`](app.md#event-login) event in the main process instead of the default
|
||||
[`login`](client-request.md#event-login) event on the [`ClientRequest`](client-request.md) object. Default is
|
||||
`false`.
|
||||
|
||||
@@ -188,45 +176,6 @@ Returns:
|
||||
|
||||
Emitted when the child process sends a message using [`process.parentPort.postMessage()`](process.md#processparentport).
|
||||
|
||||
#### Event: 'login'
|
||||
|
||||
Returns:
|
||||
|
||||
* `authenticationResponseDetails` Object
|
||||
* `url` URL
|
||||
* `pid` number
|
||||
* `authInfo` Object
|
||||
* `isProxy` boolean
|
||||
* `scheme` string
|
||||
* `host` string
|
||||
* `port` Integer
|
||||
* `realm` string
|
||||
* `callback` Function
|
||||
* `username` string (optional)
|
||||
* `password` string (optional)
|
||||
|
||||
Emitted when the utility process encounters an HTTP 401 or 407 authentication challenge, if the
|
||||
process was created with both `respondToAuthRequestsFromMainProcess: true` and a `session` option.
|
||||
The `callback` should be called with credentials to respond to the challenge. Calling `callback`
|
||||
without arguments will cancel the request.
|
||||
|
||||
This behaves the same as the [`login` event on `app`](app.md#event-login) but is scoped to the
|
||||
individual utility process instance.
|
||||
|
||||
```js
|
||||
const { session, utilityProcess } = require('electron')
|
||||
|
||||
const ses = session.defaultSession
|
||||
const child = utilityProcess.fork('./worker.js', [], {
|
||||
session: ses,
|
||||
respondToAuthRequestsFromMainProcess: true
|
||||
})
|
||||
|
||||
child.on('login', (authenticationResponseDetails, authInfo, callback) => {
|
||||
callback('username', 'password')
|
||||
})
|
||||
```
|
||||
|
||||
[`child_process.fork`]: https://nodejs.org/dist/latest-v16.x/docs/api/child_process.html#child_processforkmodulepath-args-options
|
||||
[Services API]: https://chromium.googlesource.com/chromium/src/+/main/docs/mojo_and_services.md
|
||||
[stdio]: https://nodejs.org/dist/latest/docs/api/child_process.html#optionsstdio
|
||||
|
||||
@@ -117,13 +117,6 @@ Examples of valid `color` values:
|
||||
> [!NOTE]
|
||||
> The area cutout of the view's border still captures clicks.
|
||||
|
||||
#### `view.setBackgroundBlur(blurRadius)`
|
||||
|
||||
* `blurRadius` Integer - The radius of the background blur effect (in pixels).
|
||||
|
||||
> [!NOTE]
|
||||
> You must set a background color with an alpha channel (e.g. `#80ffffff`) in order for the blur effect to be visible.
|
||||
|
||||
#### `view.setVisible(visible)`
|
||||
|
||||
* `visible` boolean - If false, the view will be hidden from display.
|
||||
|
||||
@@ -226,16 +226,7 @@ Returns:
|
||||
Only defined when the window is being created by a form that set
|
||||
`target=_blank`.
|
||||
* `disposition` string - Can be `default`, `foreground-tab`,
|
||||
`background-tab`, `new-window` or `other`. Corresponds to the manner
|
||||
an associated link was clicked. See Chromium's
|
||||
[WindowOpenDisposition](https://source.chromium.org/chromium/chromium/src/+/main:ui/base/window_open_disposition.h).
|
||||
* `default` - Indicates Chromium deems in-window navigation valid
|
||||
for a window open call.
|
||||
* `foreground-tab` - Corresponds to a left click or shift + middle click.
|
||||
* `background-tab` - Corresponds to a middle click or ctrl/cmd + click.
|
||||
* `new-window` - Corresponds to a shift + left click.
|
||||
* `other` - A catch-all for the remaining Chromium dispositions not
|
||||
handled by Electron.
|
||||
`background-tab`, `new-window` or `other`.
|
||||
|
||||
Emitted _after_ successful creation of a window via `window.open` in the renderer.
|
||||
Not emitted if the creation of the window is canceled from
|
||||
@@ -1458,17 +1449,8 @@ Ignore application menu shortcuts while this web contents is focused.
|
||||
* `url` string - The _resolved_ version of the URL passed to `window.open()`. e.g. opening a window with `window.open('foo')` will yield something like `https://the-origin/the/current/path/foo`.
|
||||
* `frameName` string - Name of the window provided in `window.open()`
|
||||
* `features` string - Comma separated list of window features provided to `window.open()`.
|
||||
* `disposition` string - Can be `default`, `foreground-tab`,
|
||||
`background-tab`, `new-window` or `other`. Corresponds to the manner
|
||||
an associated link was clicked. See Chromium's
|
||||
[WindowOpenDisposition](https://source.chromium.org/chromium/chromium/src/+/main:ui/base/window_open_disposition.h).
|
||||
* `default` - Indicates Chromium deems in-window navigation valid
|
||||
for a window open call.
|
||||
* `foreground-tab` - Corresponds to a left click or shift + middle click.
|
||||
* `background-tab` - Corresponds to a middle click or ctrl/cmd + click.
|
||||
* `new-window` - Corresponds to a shift + left click.
|
||||
* `other` - A catch-all for the remaining Chromium dispositions not
|
||||
handled by Electron.
|
||||
* `disposition` string - Can be `default`, `foreground-tab`, `background-tab`,
|
||||
`new-window` or `other`.
|
||||
* `referrer` [Referrer](structures/referrer.md) - The referrer that will be
|
||||
passed to the new window. May or may not result in the `Referer` header being
|
||||
sent, depending on the referrer policy.
|
||||
@@ -2293,20 +2275,6 @@ Returns `Integer` - The Chromium internal `pid` of the associated renderer. Can
|
||||
be compared to the `frameProcessId` passed by frame specific navigation events
|
||||
(e.g. `did-frame-navigate`)
|
||||
|
||||
#### `contents.clone()`
|
||||
|
||||
Returns `WebContents` - A cloned WebContents instance. This method creates a copy
|
||||
of the WebContents with the following attributes:
|
||||
|
||||
* **WebPreferences** - All preferences from the original WebContents are copied
|
||||
* **SiteInstance** - Uses the same SiteInstance as the original. This means the cloned WebContents will reuse the same render process as the original when loading same-origin pages, and only spawn a new render process for cross-origin navigations. This process allocation behavior is consistent with window.open and tab duplication in Chromium. For more details, see [Chromium's Site Isolation](https://www.chromium.org/developers/design-documents/site-isolation/) design document.
|
||||
* **Opener relationship** - Inherits the opener (window.opener) relationship
|
||||
* **Navigation state** - Copies the navigation history and controller state
|
||||
|
||||
The cloned WebContents is an independent instance with its own lifecycle that can be destroyed separately and will not contain any open web pages.
|
||||
|
||||
This API is useful for use cases where you want to create a new WebContents that shares the same render process with the original for same-origin content, while maintaining full lifecycle independence. Additionally, reusing the existing render process can help optimize memory usage and page load speed to a certain extent, as it eliminates the overhead of spawning and initializing a new render process from scratch.
|
||||
|
||||
#### `contents.takeHeapSnapshot(filePath)`
|
||||
|
||||
* `filePath` string - Path to the output file.
|
||||
|
||||
@@ -33,14 +33,10 @@ because it is invoked in the main process.
|
||||
Returns [`Window`](https://developer.mozilla.org/en-US/docs/Web/API/Window) | null
|
||||
|
||||
`features` is a comma-separated key-value list, following the standard format of
|
||||
the browser. For convenience, Electron will parse a subset of presentational
|
||||
[`BrowserWindowConstructorOptions`](structures/browser-window-options.md) out of
|
||||
this list (such as `width`, `height`, `x`, `y`, `show`, `frame`, `title`,
|
||||
`backgroundColor`). Because the renderer is untrusted, options that cause the
|
||||
main process to access the filesystem or that are otherwise privileged (such as
|
||||
`icon`) are ignored. For full control and better ergonomics, use
|
||||
`webContents.setWindowOpenHandler` to customize the BrowserWindow creation from
|
||||
the main process.
|
||||
the browser. Electron will parse [`BrowserWindowConstructorOptions`](structures/browser-window-options.md) out of this
|
||||
list where possible, for convenience. For full control and better ergonomics,
|
||||
consider using `webContents.setWindowOpenHandler` to customize the
|
||||
BrowserWindow creation.
|
||||
|
||||
A subset of [`WebPreferences`](structures/web-preferences.md) can be set directly,
|
||||
unnested, from the features string: `zoomFactor`, `nodeIntegration`, `javascript`,
|
||||
@@ -60,10 +56,9 @@ window.open('https://github.com', '_blank', 'top=500,left=200,frame=false,nodeIn
|
||||
enabled on the parent window.
|
||||
* JavaScript will always be disabled in the opened `window` if it is disabled on
|
||||
the parent window.
|
||||
* Features that are not handled by Chromium and not in Electron's allowlist of
|
||||
presentational `BrowserWindowConstructorOptions` are ignored. The raw
|
||||
`features` string is still available to the main process via
|
||||
`setWindowOpenHandler`.
|
||||
* Non-standard features (that are not handled by Chromium or Electron) given in
|
||||
`features` will be passed to any registered `webContents`'s
|
||||
`did-create-window` event handler in the `options` argument.
|
||||
* `frameName` follows the specification of `target` located in the [native documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters).
|
||||
* When opening `about:blank`, the child window's [`WebPreferences`](structures/web-preferences.md) will be copied
|
||||
from the parent window, and there is no way to override it because Chromium
|
||||
|
||||
@@ -14,17 +14,6 @@ This document uses the following convention to categorize breaking changes:
|
||||
|
||||
## Planned Breaking API Changes (43.0)
|
||||
|
||||
### Behavior Changed: `chrome.scripting` CSS injection matches more fallback frames
|
||||
|
||||
Extensions using `chrome.scripting.insertCSS()` or `chrome.scripting.removeCSS()`
|
||||
now follow Chrome's behavior when Electron cannot match a frame's URL directly,
|
||||
such as with `about:blank` or `data:` frames. If the extension has access to the
|
||||
page that created the frame, CSS may now be inserted into or removed from those
|
||||
fallback frames as well.
|
||||
|
||||
Apps or extensions that relied on Electron skipping those frames should narrow their
|
||||
injection target, frame IDs, or match patterns.
|
||||
|
||||
### Behavior Changed: Dialog methods default to Downloads directory
|
||||
|
||||
The `defaultPath` option for the following methods now defaults to the user's Downloads folder (or their home directory if Downloads doesn't exist) when not explicitly provided:
|
||||
@@ -134,12 +123,6 @@ When a cookie is deleted, the change cause remains `explicit`.
|
||||
When the cookie being set is identical to an existing one (same name, domain, path, and value, with no actual changes), the change cause is `inserted-no-change-overwrite`.
|
||||
When the value of the cookie being set remains unchanged but some of its attributes are updated, such as the expiration attribute, the change cause will be `inserted-no-value-change-overwrite`.
|
||||
|
||||
### Deprecated: `showHiddenFiles` in Dialogs on Linux
|
||||
|
||||
This property will still be honored on macOS and Windows, but support on Linux
|
||||
will be removed in Electron 42. GTK intends for this to be a user choice rather
|
||||
than an app choice and has removed the API to do this programmatically.
|
||||
|
||||
## Planned Breaking API Changes (40.0)
|
||||
|
||||
### Deprecated: `clipboard` API access from renderer processes
|
||||
@@ -153,6 +136,12 @@ your preload script and expose it using the [contextBridge](https://www.electron
|
||||
Debug symbols for MacOS (dSYM) now use xz compression in order to handle larger file sizes. `dsym.zip` files are now
|
||||
`dsym.tar.xz` files. End users using debug symbols may need to update their zip utilities.
|
||||
|
||||
### Deprecated: `showHiddenFiles` in Dialogs on Linux
|
||||
|
||||
This property will still be honored on macOS and Windows, but support on Linux
|
||||
will be removed in Electron 42. GTK intends for this to be a user choice rather
|
||||
than an app choice and has removed the API to do this programmatically.
|
||||
|
||||
## Planned Breaking API Changes (39.0)
|
||||
|
||||
### Deprecated: `--host-rules` command line switch
|
||||
|
||||
BIN
docs/images/versioning-sketch-0.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
docs/images/versioning-sketch-1.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
docs/images/versioning-sketch-2.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
docs/images/versioning-sketch-3.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
docs/images/versioning-sketch-4.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
docs/images/versioning-sketch-5.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
docs/images/versioning-sketch-6.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
docs/images/versioning-sketch-7.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 1.7 MiB |
@@ -2,53 +2,28 @@
|
||||
|
||||
Electron frequently releases major versions alongside every other Chromium release.
|
||||
This document focuses on the release cadence and version support policy.
|
||||
|
||||
> [!TIP]
|
||||
> See the [Electron Versioning](./electron-versioning.md) document for more details
|
||||
> on how Electron is versioned.
|
||||
For a more in-depth guide on our git branches and how Electron uses semantic versions,
|
||||
check out our [Electron Versioning](./electron-versioning.md) doc.
|
||||
|
||||
## Timeline
|
||||
|
||||
[Electron's Release Schedule](https://releases.electronjs.org/schedule) lists a schedule of Electron major releases showing key milestones including alpha, beta, and stable release dates, as well as end-of-life dates and dependency versions.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Electron's official support policy is the latest 3 stable releases. Our stable
|
||||
> release and end-of-life dates are determined by Chromium, and may be subject to
|
||||
> change. While we try to keep our planned release and end-of-life dates frequently
|
||||
> updated here, future dates may change if affected by upstream scheduling changes,
|
||||
> and may not always be accurately reflected.
|
||||
>
|
||||
> See [Chromium's public release schedule](https://chromiumdash.appspot.com/schedule) for
|
||||
> definitive information about Chromium's scheduled release dates.
|
||||
:::info Official support dates may change
|
||||
|
||||
Electron's cadence between major version releases is 8 weeks long. Before each major
|
||||
version hits stable, it goes through a four-week **alpha** phase and a four-week
|
||||
**beta** phase.
|
||||
Electron's official support policy is the latest 3 stable releases. Our stable
|
||||
release and end-of-life dates are determined by Chromium, and may be subject to
|
||||
change. While we try to keep our planned release and end-of-life dates frequently
|
||||
updated here, future dates may change if affected by upstream scheduling changes,
|
||||
and may not always be accurately reflected.
|
||||
|
||||
```mermaid
|
||||
gantt
|
||||
title Electron release cycle
|
||||
dateFormat YYYY-MM-DD
|
||||
axisFormat Week %W
|
||||
todayMarker off
|
||||
section v41
|
||||
Alpha phase :a1, 2026-01-19, 4w
|
||||
M146 enters Chrome beta :milestone, bm1, after a1, 0d
|
||||
Beta phase :b1, after a1, 4w
|
||||
M146 enters Chrome stable :milestone, s1, after b1, 0d
|
||||
Supported until v44 release :active, after b1, 12w
|
||||
section v42
|
||||
Alpha phase :a2, after b1, 4w
|
||||
M148 enters Chrome beta :milestone, bm2, after a2, 0d
|
||||
Beta phase :b2, after a2, 4w
|
||||
M148 enters Chrome stable :milestone, s2, after b2, 0d
|
||||
Supported until v45 release :active, after b2, 4w
|
||||
```
|
||||
See [Chromium's public release schedule](https://chromiumdash.appspot.com/schedule) for
|
||||
definitive information about Chromium's scheduled release dates.
|
||||
|
||||
:::
|
||||
|
||||
**Notes:**
|
||||
|
||||
* Alphas are generally less stable than beta releases. The cutoff between the two
|
||||
corresponds to when the underlying Chromium version enters Chrome's Beta channel.
|
||||
* The `-alpha.1`, `-beta.1`, and `stable` dates are our solid release dates.
|
||||
* We strive for weekly alpha/beta releases, but we often release more than scheduled.
|
||||
* All dates are our goals but there may be reasons for adjusting the stable deadline, such as security bugs.
|
||||
@@ -63,11 +38,10 @@ gantt
|
||||
## Version support policy
|
||||
|
||||
The latest three _stable_ major versions are supported by the Electron team.
|
||||
|
||||
For example, if the latest release is 42.1.x, then the 41.0.x as well
|
||||
as the 40.2.x series are supported. We only support the latest minor release
|
||||
For example, if the latest release is 6.1.x, then the 5.0.x as well
|
||||
as the 4.2.x series are supported. We only support the latest minor release
|
||||
for each stable release series. This means that in the case of a security fix,
|
||||
42.1.x will receive the fix, but we will not release a new version of 42.0.x.
|
||||
6.1.x will receive the fix, but we will not release a new version of 6.0.x.
|
||||
|
||||
The latest stable release unilaterally receives all fixes from `main`,
|
||||
and the version prior to that receives the vast majority of those fixes
|
||||
@@ -76,8 +50,11 @@ only security fixes directly.
|
||||
|
||||
### Chromium version support
|
||||
|
||||
> [!TIP]
|
||||
> Chromium's public release schedule is [here](https://chromiumdash.appspot.com/schedule).
|
||||
:::info Chromium release schedule
|
||||
|
||||
Chromium's public release schedule is [here](https://chromiumdash.appspot.com/schedule).
|
||||
|
||||
:::
|
||||
|
||||
Electron targets Chromium even-number versions, releasing every 8 weeks in concert
|
||||
with Chromium's 4-week release schedule. For example, Electron 26 uses Chromium 116, while Electron 27 uses Chromium 118.
|
||||
@@ -105,7 +82,3 @@ and that number is reduced to two in major version 10, the three-argument versio
|
||||
continue to work until, at minimum, major version 12. Past the minimum two-version
|
||||
threshold, we will attempt to support backwards compatibility beyond two versions
|
||||
until the maintainers feel the maintenance burden is too high to continue doing so.
|
||||
|
||||
> [!TIP]
|
||||
> For a canonical list of breaking changes, see the [Breaking Changes](../breaking-changes.md)
|
||||
> document.
|
||||
|
||||
@@ -14,6 +14,18 @@ To update an existing project to use the latest stable version:
|
||||
npm install --save-dev electron@latest
|
||||
```
|
||||
|
||||
## Versioning scheme
|
||||
|
||||
There are several major changes from our 1.x strategy outlined below. Each change is intended to satisfy the needs and priorities of developers/maintainers and app developers.
|
||||
|
||||
1. Strict use of the [SemVer](#semver) spec
|
||||
2. Introduction of semver-compliant `-beta` tags
|
||||
3. Introduction of [conventional commit messages](https://conventionalcommits.org/)
|
||||
4. Well-defined stabilization branches
|
||||
5. The `main` branch is versionless; only stabilization branches contain version information
|
||||
|
||||
We will cover in detail how git branching works, how npm tagging works, what developers should expect to see, and how one can backport changes.
|
||||
|
||||
## SemVer
|
||||
|
||||
Below is a table explicitly mapping types of changes to their corresponding category of SemVer (e.g. Major, Minor, Patch).
|
||||
@@ -22,7 +34,7 @@ Below is a table explicitly mapping types of changes to their corresponding cate
|
||||
| ------------------------------- | ---------------------------------- | ----------------------------- |
|
||||
| Electron breaking API changes | Electron non-breaking API changes | Electron bug fixes |
|
||||
| Node.js major version updates | Node.js minor version updates | Node.js patch version updates |
|
||||
| Chromium version updates | | fix-related Chromium patches |
|
||||
| Chromium version updates | | fix-related chromium patches |
|
||||
|
||||
For more information, see the [Semantic Versioning 2.0.0](https://semver.org/) spec.
|
||||
|
||||
@@ -32,189 +44,68 @@ Note that most Chromium updates will be considered breaking. Fixes that can be b
|
||||
|
||||
Stabilization branches are branches that run parallel to `main`, taking in only cherry-picked commits that are related to security or stability. These branches are never merged back to `main`.
|
||||
|
||||
```mermaid
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
branch N-x-y
|
||||
checkout main
|
||||
commit id:"fix-1"
|
||||
checkout N-x-y
|
||||
cherry-pick id:"fix-1"
|
||||
checkout main
|
||||
commit id:"fix-2"
|
||||
checkout N-x-y
|
||||
cherry-pick id:"fix-2"
|
||||
checkout main
|
||||
commit
|
||||
commit
|
||||

|
||||
|
||||
Since Electron 8, stabilization branches are always **major** version lines, and named against the following template `$MAJOR-x-y` e.g. `8-x-y`. Prior to that we used **minor** version lines and named them as `$MAJOR-$MINOR-x` e.g. `2-0-x`.
|
||||
|
||||
We allow for multiple stabilization branches to exist simultaneously, one for each supported version. For more details on which versions are supported, see our [Electron Releases](./electron-timelines.md) doc.
|
||||
|
||||

|
||||
|
||||
Older lines will not be supported by the Electron project, but other groups can take ownership and backport stability and security fixes on their own. We discourage this, but recognize that it makes life easier for many app developers.
|
||||
|
||||
## Beta releases and bug fixes
|
||||
|
||||
Developers want to know which releases are _safe_ to use. Even seemingly innocent features can introduce regressions in complex applications. At the same time, locking to a fixed version is dangerous because you’re ignoring security patches and bug fixes that may have come out since your version. Our goal is to allow the following standard semver ranges in `package.json` :
|
||||
|
||||
* Use `~2.0.0` to admit only stability or security related fixes to your `2.0.0` release.
|
||||
* Use `^2.0.0` to admit non-breaking _reasonably stable_ feature work as well as security and bug fixes.
|
||||
|
||||
What’s important about the second point is that apps using `^` should still be able to expect a reasonable level of stability. To accomplish this, SemVer allows for a _pre-release identifier_ to indicate a particular version is not yet _safe_ or _stable_.
|
||||
|
||||
Whatever you choose, you will periodically have to bump the version in your `package.json` as breaking changes are a fact of Chromium life.
|
||||
|
||||
The process is as follows:
|
||||
|
||||
1. All new major and minor releases lines begin with a beta series indicated by SemVer prerelease tags of `beta.N`, e.g. `2.0.0-beta.1`. After the first beta, subsequent beta releases must meet all of the following conditions:
|
||||
1. The change is backwards API-compatible (deprecations are allowed)
|
||||
2. The risk to meeting our stability timeline must be low.
|
||||
2. If allowed changes need to be made once a release is beta, they are applied and the prerelease tag is incremented, e.g. `2.0.0-beta.2`.
|
||||
3. If a particular beta release is _generally regarded_ as stable, it will be re-released as a stable build, changing only the version information. e.g. `2.0.0`. After the first stable, all changes must be backwards-compatible bug or security fixes.
|
||||
4. If future bug fixes or security patches need to be made once a release is stable, they are applied and the _patch_ version is incremented
|
||||
e.g. `2.0.1`.
|
||||
|
||||
Specifically, the above means:
|
||||
|
||||
1. Admitting non-breaking-API changes before Week 3 in the beta cycle is okay, even if those changes have the potential to cause moderate side-effects.
|
||||
2. Admitting feature-flagged changes, that do not otherwise alter existing code paths, at most points in the beta cycle is okay. Users can explicitly enable those flags in their apps.
|
||||
3. Admitting features of any sort after Week 3 in the beta cycle is 👎 without a very good reason.
|
||||
|
||||
For each major and minor bump, you should expect to see something like the following:
|
||||
|
||||
```plaintext
|
||||
2.0.0-beta.1
|
||||
2.0.0-beta.2
|
||||
2.0.0-beta.3
|
||||
2.0.0
|
||||
2.0.1
|
||||
2.0.2
|
||||
```
|
||||
|
||||
Since Electron 8, stabilization branches are always **major** version lines, and named against the following template `$MAJOR-x-y` e.g. `8-x-y`. (Prior to that, we used **minor** version lines and named them as `$MAJOR-$MINOR-x` e.g. `2-0-x`.)
|
||||
An example lifecycle in pictures:
|
||||
|
||||
We allow for multiple stabilization branches to exist simultaneously, one for each supported version.
|
||||
* A new release branch is created that includes the latest set of features. It is published as `2.0.0-beta.1`.
|
||||

|
||||
* A bug fix comes into master that can be backported to the release branch. The patch is applied, and a new beta is published as `2.0.0-beta.2`.
|
||||

|
||||
* The beta is considered _generally stable_ and it is published again as a non-beta under `2.0.0`.
|
||||

|
||||
* Later, a zero-day exploit is revealed and a fix is applied to master. We backport the fix to the `2-0-x` line and release `2.0.1`.
|
||||

|
||||
|
||||
> [!TIP]
|
||||
> For more details on which versions are supported, see our [Electron Releases](./electron-timelines.md) doc.
|
||||
A few examples of how various SemVer ranges will pick up new releases:
|
||||
|
||||
```mermaid
|
||||
gitGraph
|
||||
commit
|
||||
branch "41-x-y"
|
||||
checkout main
|
||||
commit
|
||||
commit
|
||||
commit id:"fix-a"
|
||||
checkout "41-x-y"
|
||||
cherry-pick id:"fix-a"
|
||||
checkout main
|
||||
commit
|
||||
commit id:"fix-b"
|
||||
checkout "41-x-y"
|
||||
cherry-pick id:"fix-b"
|
||||
checkout main
|
||||
commit
|
||||
branch "42-x-y"
|
||||
checkout main
|
||||
commit
|
||||
commit id:"fix-c"
|
||||
checkout "41-x-y"
|
||||
cherry-pick id:"fix-c"
|
||||
checkout "42-x-y"
|
||||
cherry-pick id:"fix-c"
|
||||
checkout main
|
||||
commit
|
||||
commit id:"fix-d"
|
||||
checkout "41-x-y"
|
||||
cherry-pick id:"fix-d"
|
||||
checkout "42-x-y"
|
||||
cherry-pick id:"fix-d"
|
||||
checkout main
|
||||
commit
|
||||
```
|
||||
|
||||
Older lines will not be supported by the Electron project.
|
||||
|
||||
## Release cycle
|
||||
|
||||
Electron follows an **8-week regular release cycle** where key milestones correspond to
|
||||
matching dates in the Chromium release cycle.
|
||||
|
||||
```mermaid
|
||||
gantt
|
||||
title Electron release cycle
|
||||
dateFormat YYYY-MM-DD
|
||||
axisFormat Week %W
|
||||
todayMarker off
|
||||
section v41
|
||||
Alpha phase :a1, 2026-01-19, 4w
|
||||
M146 enters Chrome beta :milestone, bm1, after a1, 0d
|
||||
Beta phase :b1, after a1, 4w
|
||||
M146 enters Chrome stable :milestone, s1, after b1, 0d
|
||||
Supported until v44 release :active, after b1, 12w
|
||||
section v42
|
||||
Alpha phase :a2, after b1, 4w
|
||||
M148 enters Chrome beta :milestone, bm2, after a2, 0d
|
||||
Beta phase :b2, after a2, 4w
|
||||
M148 enters Chrome stable :milestone, s2, after b2, 0d
|
||||
Supported until v45 release :active, after b2, 4w
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
When Electron 41 hits its stable release, the release line for Electron 42 is branched off of `main`.
|
||||
Its first alpha release is created with all the changes contained on `main`:
|
||||
|
||||
```mermaid
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
commit
|
||||
branch "42-x-y"
|
||||
checkout "42-x-y"
|
||||
commit tag:"v42.0.0-alpha.1"
|
||||
```
|
||||
|
||||
A bug fix comes into `main` that can be backported to the release branch. The patch is applied,
|
||||
and it is published in the next `v42.0.0-alpha.2` release.
|
||||
|
||||
```mermaid
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
commit
|
||||
branch "42-x-y"
|
||||
checkout "42-x-y"
|
||||
commit id:"42.0.0-alpha.1" tag:"v42.0.0-alpha.1"
|
||||
checkout "main"
|
||||
commit
|
||||
commit id:"fix-1"
|
||||
checkout "42-x-y"
|
||||
cherry-pick id:"fix-1" tag:"v42.0.0-alpha.2"
|
||||
```
|
||||
|
||||
The version of Chromium that powers Electron 42 hits Chrome's beta channel. The `alpha` line is
|
||||
promoted to `beta`.
|
||||
|
||||
```mermaid
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
commit
|
||||
branch "42-x-y"
|
||||
checkout "42-x-y"
|
||||
commit id:"42.0.0-alpha.1" tag:"v42.0.0-alpha.1"
|
||||
checkout "main"
|
||||
commit
|
||||
commit id:"fix-1"
|
||||
checkout "42-x-y"
|
||||
cherry-pick id:"fix-1" tag:"v42.0.0-alpha.2"
|
||||
checkout "main"
|
||||
commit
|
||||
commit
|
||||
commit id:"fix-2"
|
||||
checkout "42-x-y"
|
||||
cherry-pick id:"fix-2" tag:"v42.0.0-beta.1"
|
||||
```
|
||||
|
||||
Beta releases continue weekly until Electron 42 is promoted to stable and the same cycle starts again
|
||||
with `43-x-y`. Later, a zero-day exploit is revealed and a fix is applied to `main`. We backport the
|
||||
fix to the `42-x-y` line and release `42.0.1`.
|
||||
|
||||
```mermaid
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
commit
|
||||
branch "42-x-y"
|
||||
checkout "42-x-y"
|
||||
commit id:"42.0.0-alpha.1" tag:"v42.0.0-alpha.1"
|
||||
checkout "main"
|
||||
commit
|
||||
commit id:"fix-1"
|
||||
checkout "42-x-y"
|
||||
cherry-pick id:"fix-1" tag:"v42.0.0-alpha.2"
|
||||
checkout "main"
|
||||
commit
|
||||
commit
|
||||
commit id:"fix-2"
|
||||
checkout "42-x-y"
|
||||
cherry-pick id:"fix-2" tag:"v42.0.0-beta.1"
|
||||
checkout "main"
|
||||
commit id:"fix-3"
|
||||
checkout "42-x-y"
|
||||
cherry-pick id:"fix-3" tag:"v42.0.0"
|
||||
checkout "main"
|
||||
branch "43-x-y"
|
||||
checkout "43-x-y"
|
||||
commit id:"43.0.0-alpha.1" tag:"v43.0.0-alpha.1"
|
||||
checkout "main"
|
||||
commit id:"security-fix"
|
||||
checkout "42-x-y"
|
||||
cherry-pick id:"security-fix" tag:"v42.0.1"
|
||||
checkout "43-x-y"
|
||||
cherry-pick id:"security-fix" tag:"v43.0.0-alpha.2"
|
||||
```
|
||||

|
||||
|
||||
### Backport request process
|
||||
|
||||
@@ -245,11 +136,10 @@ The `electron/electron` repository also enforces squash merging, so you only nee
|
||||
|
||||
## Versioned `main` branch
|
||||
|
||||
* The `main` branch always corresponds to the major version above the current pre-release line.
|
||||
* Unstable nightly releases of `main` are released under the [`electron-nightly`](https://www.npmjs.com/package/electron-nightly)
|
||||
package on npm.
|
||||
* The `main` branch will always contain the next major version `X.0.0-nightly.DATE` in its `package.json`.
|
||||
* Release branches are never merged back to `main`.
|
||||
* All `package.json` values are fixed at `0.0.0-development`.
|
||||
* Release branches _do_ contain the correct version in their `package.json`.
|
||||
* As soon as a release branch is cut for a major, `main` must be bumped to the next major (i.e. `main` is always versioned as the next theoretical release branch).
|
||||
|
||||
## Historical versioning (Electron 1.X)
|
||||
|
||||
@@ -257,29 +147,6 @@ Electron versions _< 2.0_ did not conform to the [SemVer](https://semver.org) sp
|
||||
|
||||
Here is an example of the 1.x strategy:
|
||||
|
||||
```mermaid
|
||||
---
|
||||
config:
|
||||
gitGraph:
|
||||
mainBranchName: 'master'
|
||||
---
|
||||
gitGraph
|
||||
commit
|
||||
branch "bugfix-1"
|
||||
checkout "bugfix-1"
|
||||
commit
|
||||
checkout master
|
||||
merge "bugfix-1" tag:"1.8.1"
|
||||
branch "feature"
|
||||
checkout "feature"
|
||||
commit
|
||||
checkout master
|
||||
merge "feature" tag:"1.8.2"
|
||||
branch "bugfix-2"
|
||||
checkout "bugfix-2"
|
||||
commit
|
||||
checkout master
|
||||
merge "bugfix-2" tag:"1.8.3"
|
||||
```
|
||||

|
||||
|
||||
An app developed with `1.8.1` cannot take the `1.8.3` bug fix without either absorbing the `1.8.2` feature, or by backporting the fix and maintaining a new release line.
|
||||
|
||||
@@ -25,27 +25,6 @@ included in the `electron` package:
|
||||
npx install-electron --no
|
||||
```
|
||||
|
||||
## Installing prereleases
|
||||
|
||||
Electron [distributes experimental releases of future major versions](./electron-timelines.md)
|
||||
via npm as well.
|
||||
|
||||
Nightly builds contain the latest changes from the `main` branch:
|
||||
|
||||
```sh
|
||||
npm install electron-nightly --save-dev
|
||||
```
|
||||
|
||||
Alpha and beta builds contain changes slated for the next major version:
|
||||
|
||||
```sh
|
||||
npm install electron@alpha --save-dev
|
||||
npm install electron@beta --save-dev
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> For more information on available Electron releases, see the [Release Status dashboard](https://releases.electronjs.org).
|
||||
|
||||
## Running Electron ad-hoc
|
||||
|
||||
If you're in a pinch and would prefer to not use `npm install` in your local
|
||||
|
||||
@@ -107,7 +107,7 @@ When signing the app with `@electron/osx-sign`, it will automatically add the
|
||||
necessary entitlements to your app's entitlements.
|
||||
|
||||
<details>
|
||||
<summary>Extra steps without `@electron/osx-sign`</summary>
|
||||
<summary>Extra steps without `electron-osx-sign`</summary>
|
||||
|
||||
If you are signing your app without using `@electron/osx-sign`, you must ensure
|
||||
the app bundle's entitlements have at least following keys:
|
||||
|
||||
@@ -91,7 +91,6 @@ auto_filenames = {
|
||||
"docs/api/structures/custom-scheme.md",
|
||||
"docs/api/structures/desktop-capturer-source.md",
|
||||
"docs/api/structures/display.md",
|
||||
"docs/api/structures/enable-heap-profiling-options.md",
|
||||
"docs/api/structures/extension-info.md",
|
||||
"docs/api/structures/extension.md",
|
||||
"docs/api/structures/file-filter.md",
|
||||
@@ -171,349 +170,10 @@ auto_filenames = {
|
||||
"docs/api/structures/web-preferences.md",
|
||||
"docs/api/structures/web-request-filter.md",
|
||||
"docs/api/structures/web-source.md",
|
||||
"docs/api/structures/webauthn-account.md",
|
||||
"docs/api/structures/window-open-handler-response.md",
|
||||
"docs/api/structures/window-session-end-event.md",
|
||||
]
|
||||
|
||||
node_header_sources = [
|
||||
"../third_party/electron_node/src/acorn_version.h",
|
||||
"../third_party/electron_node/src/aliased_buffer-inl.h",
|
||||
"../third_party/electron_node/src/aliased_buffer.h",
|
||||
"../third_party/electron_node/src/aliased_struct-inl.h",
|
||||
"../third_party/electron_node/src/aliased_struct.h",
|
||||
"../third_party/electron_node/src/amaro_version.h",
|
||||
"../third_party/electron_node/src/async_context_frame.h",
|
||||
"../third_party/electron_node/src/async_wrap-inl.h",
|
||||
"../third_party/electron_node/src/async_wrap.h",
|
||||
"../third_party/electron_node/src/base_object-inl.h",
|
||||
"../third_party/electron_node/src/base_object.h",
|
||||
"../third_party/electron_node/src/base_object_types.h",
|
||||
"../third_party/electron_node/src/blob_serializer_deserializer-inl.h",
|
||||
"../third_party/electron_node/src/blob_serializer_deserializer.h",
|
||||
"../third_party/electron_node/src/callback_queue-inl.h",
|
||||
"../third_party/electron_node/src/callback_queue.h",
|
||||
"../third_party/electron_node/src/cares_wrap.h",
|
||||
"../third_party/electron_node/src/cleanup_queue-inl.h",
|
||||
"../third_party/electron_node/src/cleanup_queue.h",
|
||||
"../third_party/electron_node/src/compile_cache.h",
|
||||
"../third_party/electron_node/src/connect_wrap.h",
|
||||
"../third_party/electron_node/src/connection_wrap.h",
|
||||
"../third_party/electron_node/src/cppgc_helpers-inl.h",
|
||||
"../third_party/electron_node/src/cppgc_helpers.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_aes.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_argon2.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_bio.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_chacha20_poly1305.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_cipher.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_clienthello-inl.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_clienthello.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_common.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_context.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_dh.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_dsa.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_ec.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_hash.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_hkdf.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_hmac.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_kem.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_keygen.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_keys.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_kmac.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_ml_dsa.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_pbkdf2.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_random.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_rsa.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_scrypt.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_sig.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_spkac.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_timing.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_tls.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_util.h",
|
||||
"../third_party/electron_node/src/crypto/crypto_x509.h",
|
||||
"../third_party/electron_node/src/dataqueue/queue.h",
|
||||
"../third_party/electron_node/src/debug_utils-inl.h",
|
||||
"../third_party/electron_node/src/debug_utils.h",
|
||||
"../third_party/electron_node/src/diagnosticfilename-inl.h",
|
||||
"../third_party/electron_node/src/embedded_data.h",
|
||||
"../third_party/electron_node/src/encoding_binding.h",
|
||||
"../third_party/electron_node/src/env-inl.h",
|
||||
"../third_party/electron_node/src/env.h",
|
||||
"../third_party/electron_node/src/env_properties.h",
|
||||
"../third_party/electron_node/src/handle_wrap.h",
|
||||
"../third_party/electron_node/src/histogram-inl.h",
|
||||
"../third_party/electron_node/src/histogram.h",
|
||||
"../third_party/electron_node/src/inspector/io_agent.h",
|
||||
"../third_party/electron_node/src/inspector/main_thread_interface.h",
|
||||
"../third_party/electron_node/src/inspector/network_agent.h",
|
||||
"../third_party/electron_node/src/inspector/network_inspector.h",
|
||||
"../third_party/electron_node/src/inspector/network_requests_buffer.h",
|
||||
"../third_party/electron_node/src/inspector/network_resource_manager.h",
|
||||
"../third_party/electron_node/src/inspector/node_json.h",
|
||||
"../third_party/electron_node/src/inspector/node_string.h",
|
||||
"../third_party/electron_node/src/inspector/protocol_helper.h",
|
||||
"../third_party/electron_node/src/inspector/runtime_agent.h",
|
||||
"../third_party/electron_node/src/inspector/target_agent.h",
|
||||
"../third_party/electron_node/src/inspector/tracing_agent.h",
|
||||
"../third_party/electron_node/src/inspector/worker_agent.h",
|
||||
"../third_party/electron_node/src/inspector/worker_inspector.h",
|
||||
"../third_party/electron_node/src/inspector_agent.h",
|
||||
"../third_party/electron_node/src/inspector_io.h",
|
||||
"../third_party/electron_node/src/inspector_profiler.h",
|
||||
"../third_party/electron_node/src/inspector_socket.h",
|
||||
"../third_party/electron_node/src/inspector_socket_server.h",
|
||||
"../third_party/electron_node/src/js_native_api.h",
|
||||
"../third_party/electron_node/src/js_native_api_types.h",
|
||||
"../third_party/electron_node/src/js_native_api_v8.h",
|
||||
"../third_party/electron_node/src/js_native_api_v8_internals.h",
|
||||
"../third_party/electron_node/src/js_stream.h",
|
||||
"../third_party/electron_node/src/json_utils.h",
|
||||
"../third_party/electron_node/src/large_pages/node_large_page.h",
|
||||
"../third_party/electron_node/src/lru_cache-inl.h",
|
||||
"../third_party/electron_node/src/memory_tracker-inl.h",
|
||||
"../third_party/electron_node/src/memory_tracker.h",
|
||||
"../third_party/electron_node/src/module_wrap.h",
|
||||
"../third_party/electron_node/src/node.h",
|
||||
"../third_party/electron_node/src/node_api.h",
|
||||
"../third_party/electron_node/src/node_api_internals.h",
|
||||
"../third_party/electron_node/src/node_api_types.h",
|
||||
"../third_party/electron_node/src/node_binding.h",
|
||||
"../third_party/electron_node/src/node_blob.h",
|
||||
"../third_party/electron_node/src/node_bob-inl.h",
|
||||
"../third_party/electron_node/src/node_bob.h",
|
||||
"../third_party/electron_node/src/node_buffer.h",
|
||||
"../third_party/electron_node/src/node_builtins.h",
|
||||
"../third_party/electron_node/src/node_config_file.h",
|
||||
"../third_party/electron_node/src/node_constants.h",
|
||||
"../third_party/electron_node/src/node_context_data.h",
|
||||
"../third_party/electron_node/src/node_contextify.h",
|
||||
"../third_party/electron_node/src/node_crypto.h",
|
||||
"../third_party/electron_node/src/node_debug.h",
|
||||
"../third_party/electron_node/src/node_dir.h",
|
||||
"../third_party/electron_node/src/node_dotenv.h",
|
||||
"../third_party/electron_node/src/node_errors.h",
|
||||
"../third_party/electron_node/src/node_exit_code.h",
|
||||
"../third_party/electron_node/src/node_external_reference.h",
|
||||
"../third_party/electron_node/src/node_file-inl.h",
|
||||
"../third_party/electron_node/src/node_file.h",
|
||||
"../third_party/electron_node/src/node_http2.h",
|
||||
"../third_party/electron_node/src/node_http2_state.h",
|
||||
"../third_party/electron_node/src/node_http_common-inl.h",
|
||||
"../third_party/electron_node/src/node_http_common.h",
|
||||
"../third_party/electron_node/src/node_i18n.h",
|
||||
"../third_party/electron_node/src/node_internals.h",
|
||||
"../third_party/electron_node/src/node_locks.h",
|
||||
"../third_party/electron_node/src/node_main_instance.h",
|
||||
"../third_party/electron_node/src/node_mem-inl.h",
|
||||
"../third_party/electron_node/src/node_mem.h",
|
||||
"../third_party/electron_node/src/node_messaging.h",
|
||||
"../third_party/electron_node/src/node_metadata.h",
|
||||
"../third_party/electron_node/src/node_modules.h",
|
||||
"../third_party/electron_node/src/node_mutex.h",
|
||||
"../third_party/electron_node/src/node_object_wrap.h",
|
||||
"../third_party/electron_node/src/node_options-inl.h",
|
||||
"../third_party/electron_node/src/node_options.h",
|
||||
"../third_party/electron_node/src/node_perf.h",
|
||||
"../third_party/electron_node/src/node_perf_common.h",
|
||||
"../third_party/electron_node/src/node_platform.h",
|
||||
"../third_party/electron_node/src/node_process-inl.h",
|
||||
"../third_party/electron_node/src/node_process.h",
|
||||
"../third_party/electron_node/src/node_realm-inl.h",
|
||||
"../third_party/electron_node/src/node_realm.h",
|
||||
"../third_party/electron_node/src/node_report.h",
|
||||
"../third_party/electron_node/src/node_revert.h",
|
||||
"../third_party/electron_node/src/node_root_certs.h",
|
||||
"../third_party/electron_node/src/node_sea.h",
|
||||
"../third_party/electron_node/src/node_shadow_realm.h",
|
||||
"../third_party/electron_node/src/node_snapshot_builder.h",
|
||||
"../third_party/electron_node/src/node_snapshotable.h",
|
||||
"../third_party/electron_node/src/node_sockaddr-inl.h",
|
||||
"../third_party/electron_node/src/node_sockaddr.h",
|
||||
"../third_party/electron_node/src/node_sqlite.h",
|
||||
"../third_party/electron_node/src/node_stat_watcher.h",
|
||||
"../third_party/electron_node/src/node_task_runner.h",
|
||||
"../third_party/electron_node/src/node_threadsafe_cow-inl.h",
|
||||
"../third_party/electron_node/src/node_threadsafe_cow.h",
|
||||
"../third_party/electron_node/src/node_union_bytes.h",
|
||||
"../third_party/electron_node/src/node_url.h",
|
||||
"../third_party/electron_node/src/node_url_pattern.h",
|
||||
"../third_party/electron_node/src/node_v8.h",
|
||||
"../third_party/electron_node/src/node_v8_platform-inl.h",
|
||||
"../third_party/electron_node/src/node_version.h",
|
||||
"../third_party/electron_node/src/node_wasi.h",
|
||||
"../third_party/electron_node/src/node_wasm_web_api.h",
|
||||
"../third_party/electron_node/src/node_watchdog.h",
|
||||
"../third_party/electron_node/src/node_webstorage.h",
|
||||
"../third_party/electron_node/src/node_worker.h",
|
||||
"../third_party/electron_node/src/path.h",
|
||||
"../third_party/electron_node/src/permission/addon_permission.h",
|
||||
"../third_party/electron_node/src/permission/child_process_permission.h",
|
||||
"../third_party/electron_node/src/permission/fs_permission.h",
|
||||
"../third_party/electron_node/src/permission/inspector_permission.h",
|
||||
"../third_party/electron_node/src/permission/permission.h",
|
||||
"../third_party/electron_node/src/permission/permission_base.h",
|
||||
"../third_party/electron_node/src/permission/wasi_permission.h",
|
||||
"../third_party/electron_node/src/permission/worker_permission.h",
|
||||
"../third_party/electron_node/src/pipe_wrap.h",
|
||||
"../third_party/electron_node/src/quic/application.h",
|
||||
"../third_party/electron_node/src/quic/bindingdata.h",
|
||||
"../third_party/electron_node/src/quic/cid.h",
|
||||
"../third_party/electron_node/src/quic/data.h",
|
||||
"../third_party/electron_node/src/quic/defs.h",
|
||||
"../third_party/electron_node/src/quic/endpoint.h",
|
||||
"../third_party/electron_node/src/quic/http3.h",
|
||||
"../third_party/electron_node/src/quic/logstream.h",
|
||||
"../third_party/electron_node/src/quic/packet.h",
|
||||
"../third_party/electron_node/src/quic/preferredaddress.h",
|
||||
"../third_party/electron_node/src/quic/session.h",
|
||||
"../third_party/electron_node/src/quic/sessionticket.h",
|
||||
"../third_party/electron_node/src/quic/streams.h",
|
||||
"../third_party/electron_node/src/quic/tlscontext.h",
|
||||
"../third_party/electron_node/src/quic/tokens.h",
|
||||
"../third_party/electron_node/src/quic/transportparams.h",
|
||||
"../third_party/electron_node/src/req_wrap-inl.h",
|
||||
"../third_party/electron_node/src/req_wrap.h",
|
||||
"../third_party/electron_node/src/spawn_sync.h",
|
||||
"../third_party/electron_node/src/stream_base-inl.h",
|
||||
"../third_party/electron_node/src/stream_base.h",
|
||||
"../third_party/electron_node/src/stream_pipe.h",
|
||||
"../third_party/electron_node/src/stream_wrap.h",
|
||||
"../third_party/electron_node/src/string_bytes.h",
|
||||
"../third_party/electron_node/src/string_decoder-inl.h",
|
||||
"../third_party/electron_node/src/string_decoder.h",
|
||||
"../third_party/electron_node/src/tcp_wrap.h",
|
||||
"../third_party/electron_node/src/threadpoolwork-inl.h",
|
||||
"../third_party/electron_node/src/timer_wrap-inl.h",
|
||||
"../third_party/electron_node/src/timer_wrap.h",
|
||||
"../third_party/electron_node/src/timers.h",
|
||||
"../third_party/electron_node/src/tracing/agent.h",
|
||||
"../third_party/electron_node/src/tracing/node_trace_buffer.h",
|
||||
"../third_party/electron_node/src/tracing/node_trace_writer.h",
|
||||
"../third_party/electron_node/src/tracing/trace_categories.h",
|
||||
"../third_party/electron_node/src/tracing/trace_event.h",
|
||||
"../third_party/electron_node/src/tracing/trace_event_common.h",
|
||||
"../third_party/electron_node/src/tracing/traced_value.h",
|
||||
"../third_party/electron_node/src/tty_wrap.h",
|
||||
"../third_party/electron_node/src/udp_wrap.h",
|
||||
"../third_party/electron_node/src/undici_version.h",
|
||||
"../third_party/electron_node/src/util-inl.h",
|
||||
"../third_party/electron_node/src/util.h",
|
||||
"../third_party/electron_node/src/zlib_version.h",
|
||||
"../third_party/electron_node/tools/install.py",
|
||||
"../v8/include/cppgc/allocation.h",
|
||||
"../v8/include/cppgc/common.h",
|
||||
"../v8/include/cppgc/cross-thread-persistent.h",
|
||||
"../v8/include/cppgc/custom-space.h",
|
||||
"../v8/include/cppgc/default-platform.h",
|
||||
"../v8/include/cppgc/explicit-management.h",
|
||||
"../v8/include/cppgc/garbage-collected.h",
|
||||
"../v8/include/cppgc/heap-consistency.h",
|
||||
"../v8/include/cppgc/heap-handle.h",
|
||||
"../v8/include/cppgc/heap-state.h",
|
||||
"../v8/include/cppgc/heap-statistics.h",
|
||||
"../v8/include/cppgc/heap.h",
|
||||
"../v8/include/cppgc/internal/api-constants.h",
|
||||
"../v8/include/cppgc/internal/atomic-entry-flag.h",
|
||||
"../v8/include/cppgc/internal/base-page-handle.h",
|
||||
"../v8/include/cppgc/internal/caged-heap-local-data.h",
|
||||
"../v8/include/cppgc/internal/caged-heap.h",
|
||||
"../v8/include/cppgc/internal/compiler-specific.h",
|
||||
"../v8/include/cppgc/internal/conditional-stack-allocated.h",
|
||||
"../v8/include/cppgc/internal/finalizer-trait.h",
|
||||
"../v8/include/cppgc/internal/gc-info.h",
|
||||
"../v8/include/cppgc/internal/logging.h",
|
||||
"../v8/include/cppgc/internal/member-storage.h",
|
||||
"../v8/include/cppgc/internal/name-trait.h",
|
||||
"../v8/include/cppgc/internal/persistent-node.h",
|
||||
"../v8/include/cppgc/internal/pointer-policies.h",
|
||||
"../v8/include/cppgc/internal/write-barrier.h",
|
||||
"../v8/include/cppgc/liveness-broker.h",
|
||||
"../v8/include/cppgc/macros.h",
|
||||
"../v8/include/cppgc/member.h",
|
||||
"../v8/include/cppgc/name-provider.h",
|
||||
"../v8/include/cppgc/object-size-trait.h",
|
||||
"../v8/include/cppgc/persistent.h",
|
||||
"../v8/include/cppgc/platform.h",
|
||||
"../v8/include/cppgc/prefinalizer.h",
|
||||
"../v8/include/cppgc/process-heap-statistics.h",
|
||||
"../v8/include/cppgc/sentinel-pointer.h",
|
||||
"../v8/include/cppgc/source-location.h",
|
||||
"../v8/include/cppgc/tagged-member.h",
|
||||
"../v8/include/cppgc/testing.h",
|
||||
"../v8/include/cppgc/trace-trait.h",
|
||||
"../v8/include/cppgc/type-traits.h",
|
||||
"../v8/include/cppgc/visitor.h",
|
||||
"../v8/include/libplatform/libplatform-export.h",
|
||||
"../v8/include/libplatform/libplatform.h",
|
||||
"../v8/include/libplatform/v8-tracing.h",
|
||||
"../v8/include/v8-array-buffer.h",
|
||||
"../v8/include/v8-callbacks.h",
|
||||
"../v8/include/v8-container.h",
|
||||
"../v8/include/v8-context.h",
|
||||
"../v8/include/v8-cpp-heap-external.h",
|
||||
"../v8/include/v8-cppgc.h",
|
||||
"../v8/include/v8-data.h",
|
||||
"../v8/include/v8-date.h",
|
||||
"../v8/include/v8-debug.h",
|
||||
"../v8/include/v8-embedder-heap.h",
|
||||
"../v8/include/v8-embedder-state-scope.h",
|
||||
"../v8/include/v8-exception.h",
|
||||
"../v8/include/v8-extension.h",
|
||||
"../v8/include/v8-external-memory-accounter.h",
|
||||
"../v8/include/v8-external.h",
|
||||
"../v8/include/v8-fast-api-calls.h",
|
||||
"../v8/include/v8-forward.h",
|
||||
"../v8/include/v8-function-callback.h",
|
||||
"../v8/include/v8-function.h",
|
||||
"../v8/include/v8-handle-base.h",
|
||||
"../v8/include/v8-initialization.h",
|
||||
"../v8/include/v8-inspector-protocol.h",
|
||||
"../v8/include/v8-inspector.h",
|
||||
"../v8/include/v8-internal.h",
|
||||
"../v8/include/v8-isolate.h",
|
||||
"../v8/include/v8-json.h",
|
||||
"../v8/include/v8-local-handle.h",
|
||||
"../v8/include/v8-locker.h",
|
||||
"../v8/include/v8-maybe.h",
|
||||
"../v8/include/v8-memory-span.h",
|
||||
"../v8/include/v8-message.h",
|
||||
"../v8/include/v8-metrics.h",
|
||||
"../v8/include/v8-microtask-queue.h",
|
||||
"../v8/include/v8-microtask.h",
|
||||
"../v8/include/v8-object.h",
|
||||
"../v8/include/v8-persistent-handle.h",
|
||||
"../v8/include/v8-platform.h",
|
||||
"../v8/include/v8-primitive-object.h",
|
||||
"../v8/include/v8-primitive.h",
|
||||
"../v8/include/v8-profiler.h",
|
||||
"../v8/include/v8-promise.h",
|
||||
"../v8/include/v8-proxy.h",
|
||||
"../v8/include/v8-regexp.h",
|
||||
"../v8/include/v8-sandbox.h",
|
||||
"../v8/include/v8-script.h",
|
||||
"../v8/include/v8-snapshot.h",
|
||||
"../v8/include/v8-source-location.h",
|
||||
"../v8/include/v8-statistics.h",
|
||||
"../v8/include/v8-template.h",
|
||||
"../v8/include/v8-trace-categories.h",
|
||||
"../v8/include/v8-traced-handle.h",
|
||||
"../v8/include/v8-typed-array.h",
|
||||
"../v8/include/v8-unwinder-state.h",
|
||||
"../v8/include/v8-unwinder.h",
|
||||
"../v8/include/v8-util.h",
|
||||
"../v8/include/v8-value-serializer-version.h",
|
||||
"../v8/include/v8-value-serializer.h",
|
||||
"../v8/include/v8-value.h",
|
||||
"../v8/include/v8-version-string.h",
|
||||
"../v8/include/v8-version.h",
|
||||
"../v8/include/v8-wasm-trap-handler-posix.h",
|
||||
"../v8/include/v8-wasm-trap-handler-win.h",
|
||||
"../v8/include/v8-wasm.h",
|
||||
"../v8/include/v8-weak-callback-info.h",
|
||||
"../v8/include/v8.h",
|
||||
"../v8/include/v8config.h",
|
||||
]
|
||||
|
||||
sandbox_bundle_deps = [
|
||||
"lib/common/api/native-image.ts",
|
||||
"lib/common/define-properties.ts",
|
||||
|
||||
@@ -48,8 +48,8 @@ filenames = {
|
||||
"shell/browser/ui/views/opaque_frame_view.h",
|
||||
"shell/browser/ui/views/caption_button_placeholder_container.cc",
|
||||
"shell/browser/ui/views/caption_button_placeholder_container.h",
|
||||
"shell/browser/ui/views/native_frame_view_linux.cc",
|
||||
"shell/browser/ui/views/native_frame_view_linux.h",
|
||||
"shell/browser/ui/views/client_frame_view_linux.cc",
|
||||
"shell/browser/ui/views/client_frame_view_linux.h",
|
||||
"shell/browser/ui/views/linux_frame_layout.cc",
|
||||
"shell/browser/ui/views/linux_frame_layout.h",
|
||||
"shell/common/application_info_linux.cc",
|
||||
@@ -432,14 +432,12 @@ filenames = {
|
||||
"shell/browser/media/media_capture_devices_dispatcher.h",
|
||||
"shell/browser/media/media_device_id_salt.cc",
|
||||
"shell/browser/media/media_device_id_salt.h",
|
||||
"shell/browser/metrics/electron_metrics_log_uploader.cc",
|
||||
"shell/browser/metrics/electron_metrics_log_uploader.h",
|
||||
"shell/browser/metrics/electron_metrics_service_client.cc",
|
||||
"shell/browser/metrics/electron_metrics_service_client.h",
|
||||
"shell/browser/microtasks_runner.cc",
|
||||
"shell/browser/microtasks_runner.h",
|
||||
"shell/browser/native_window.cc",
|
||||
"shell/browser/native_window.h",
|
||||
"shell/browser/native_window_features.cc",
|
||||
"shell/browser/native_window_features.h",
|
||||
"shell/browser/native_window_observer.h",
|
||||
"shell/browser/net/asar/asar_file_validator.cc",
|
||||
"shell/browser/net/asar/asar_file_validator.h",
|
||||
@@ -510,10 +508,6 @@ filenames = {
|
||||
"shell/browser/session_preferences.h",
|
||||
"shell/browser/special_storage_policy.cc",
|
||||
"shell/browser/special_storage_policy.h",
|
||||
"shell/browser/tracing/electron_background_tracing_metrics_provider.cc",
|
||||
"shell/browser/tracing/electron_background_tracing_metrics_provider.h",
|
||||
"shell/browser/tracing/electron_tracing_delegate.cc",
|
||||
"shell/browser/tracing/electron_tracing_delegate.h",
|
||||
"shell/browser/ui/accelerator_util.cc",
|
||||
"shell/browser/ui/accelerator_util.h",
|
||||
"shell/browser/ui/autofill_popup.cc",
|
||||
@@ -564,8 +558,6 @@ filenames = {
|
||||
"shell/browser/web_view_guest_delegate.h",
|
||||
"shell/browser/web_view_manager.cc",
|
||||
"shell/browser/web_view_manager.h",
|
||||
"shell/browser/webauthn/electron_authenticator_request_client_delegate.cc",
|
||||
"shell/browser/webauthn/electron_authenticator_request_client_delegate.h",
|
||||
"shell/browser/webauthn/electron_authenticator_request_delegate.cc",
|
||||
"shell/browser/webauthn/electron_authenticator_request_delegate.h",
|
||||
"shell/browser/window_list.cc",
|
||||
@@ -688,7 +680,6 @@ filenames = {
|
||||
"shell/common/gin_helper/wrappable.cc",
|
||||
"shell/common/gin_helper/wrappable.h",
|
||||
"shell/common/gin_helper/wrappable_base.h",
|
||||
"shell/common/gin_helper/wrappable_pointer_tags.h",
|
||||
"shell/common/heap_snapshot.cc",
|
||||
"shell/common/heap_snapshot.h",
|
||||
"shell/common/key_weak_map.h",
|
||||
@@ -743,8 +734,6 @@ filenames = {
|
||||
"shell/renderer/electron_sandboxed_renderer_client.h",
|
||||
"shell/renderer/electron_smooth_round_rect.cc",
|
||||
"shell/renderer/electron_smooth_round_rect.h",
|
||||
"shell/renderer/oom_stack_trace.cc",
|
||||
"shell/renderer/oom_stack_trace.h",
|
||||
"shell/renderer/preload_realm_context.cc",
|
||||
"shell/renderer/preload_realm_context.h",
|
||||
"shell/renderer/preload_utils.cc",
|
||||
@@ -774,6 +763,8 @@ filenames = {
|
||||
"shell/browser/extensions/api/resources_private/resources_private_api.h",
|
||||
"shell/browser/extensions/api/runtime/electron_runtime_api_delegate.cc",
|
||||
"shell/browser/extensions/api/runtime/electron_runtime_api_delegate.h",
|
||||
"shell/browser/extensions/api/scripting/scripting_api.cc",
|
||||
"shell/browser/extensions/api/scripting/scripting_api.h",
|
||||
"shell/browser/extensions/api/streams_private/streams_private_api.cc",
|
||||
"shell/browser/extensions/api/streams_private/streams_private_api.h",
|
||||
"shell/browser/extensions/api/tabs/tabs_api.cc",
|
||||
@@ -790,8 +781,6 @@ filenames = {
|
||||
"shell/browser/extensions/electron_extension_system_factory.h",
|
||||
"shell/browser/extensions/electron_extension_system.cc",
|
||||
"shell/browser/extensions/electron_extension_system.h",
|
||||
"shell/browser/extensions/electron_extension_tab_util.cc",
|
||||
"shell/browser/extensions/electron_extension_tab_util.h",
|
||||
"shell/browser/extensions/electron_extension_web_contents_observer.cc",
|
||||
"shell/browser/extensions/electron_extension_web_contents_observer.h",
|
||||
"shell/browser/extensions/electron_extensions_api_client.cc",
|
||||
|
||||
@@ -158,8 +158,6 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__algorithm/ranges_set_intersection.h",
|
||||
"//third_party/libc++/src/include/__algorithm/ranges_set_symmetric_difference.h",
|
||||
"//third_party/libc++/src/include/__algorithm/ranges_set_union.h",
|
||||
"//third_party/libc++/src/include/__algorithm/ranges_shift_left.h",
|
||||
"//third_party/libc++/src/include/__algorithm/ranges_shift_right.h",
|
||||
"//third_party/libc++/src/include/__algorithm/ranges_shuffle.h",
|
||||
"//third_party/libc++/src/include/__algorithm/ranges_sort.h",
|
||||
"//third_party/libc++/src/include/__algorithm/ranges_sort_heap.h",
|
||||
@@ -217,8 +215,6 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__atomic/atomic_lock_free.h",
|
||||
"//third_party/libc++/src/include/__atomic/atomic_ref.h",
|
||||
"//third_party/libc++/src/include/__atomic/atomic_sync.h",
|
||||
"//third_party/libc++/src/include/__atomic/atomic_sync_timed.h",
|
||||
"//third_party/libc++/src/include/__atomic/atomic_waitable_traits.h",
|
||||
"//third_party/libc++/src/include/__atomic/check_memory_order.h",
|
||||
"//third_party/libc++/src/include/__atomic/contention_t.h",
|
||||
"//third_party/libc++/src/include/__atomic/fence.h",
|
||||
@@ -334,14 +330,11 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__config",
|
||||
"//third_party/libc++/src/include/__config_site.in",
|
||||
"//third_party/libc++/src/include/__configuration/abi.h",
|
||||
"//third_party/libc++/src/include/__configuration/attributes.h",
|
||||
"//third_party/libc++/src/include/__configuration/availability.h",
|
||||
"//third_party/libc++/src/include/__configuration/compiler.h",
|
||||
"//third_party/libc++/src/include/__configuration/diagnostic_suppression.h",
|
||||
"//third_party/libc++/src/include/__configuration/experimental.h",
|
||||
"//third_party/libc++/src/include/__configuration/hardening.h",
|
||||
"//third_party/libc++/src/include/__configuration/language.h",
|
||||
"//third_party/libc++/src/include/__configuration/namespace.h",
|
||||
"//third_party/libc++/src/include/__configuration/platform.h",
|
||||
"//third_party/libc++/src/include/__coroutine/coroutine_handle.h",
|
||||
"//third_party/libc++/src/include/__coroutine/coroutine_traits.h",
|
||||
@@ -982,7 +975,6 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__format/format_to_n_result.h",
|
||||
"//third_party/libc++/src/include/__format/formatter.h",
|
||||
"//third_party/libc++/src/include/__format/formatter_bool.h",
|
||||
"//third_party/libc++/src/include/__format/formatter_bool_impl.h",
|
||||
"//third_party/libc++/src/include/__format/formatter_char.h",
|
||||
"//third_party/libc++/src/include/__format/formatter_floating_point.h",
|
||||
"//third_party/libc++/src/include/__format/formatter_integer.h",
|
||||
@@ -1060,7 +1052,6 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__iterator/aliasing_iterator.h",
|
||||
"//third_party/libc++/src/include/__iterator/back_insert_iterator.h",
|
||||
"//third_party/libc++/src/include/__iterator/bounded_iter.h",
|
||||
"//third_party/libc++/src/include/__iterator/capacity_aware_iterator.h",
|
||||
"//third_party/libc++/src/include/__iterator/common_iterator.h",
|
||||
"//third_party/libc++/src/include/__iterator/concepts.h",
|
||||
"//third_party/libc++/src/include/__iterator/counted_iterator.h",
|
||||
@@ -1191,7 +1182,6 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__memory/unique_temporary_buffer.h",
|
||||
"//third_party/libc++/src/include/__memory/uses_allocator.h",
|
||||
"//third_party/libc++/src/include/__memory/uses_allocator_construction.h",
|
||||
"//third_party/libc++/src/include/__memory/valid_range.h",
|
||||
"//third_party/libc++/src/include/__memory_resource/memory_resource.h",
|
||||
"//third_party/libc++/src/include/__memory_resource/monotonic_buffer_resource.h",
|
||||
"//third_party/libc++/src/include/__memory_resource/polymorphic_allocator.h",
|
||||
@@ -1307,7 +1297,6 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__ranges/empty_view.h",
|
||||
"//third_party/libc++/src/include/__ranges/enable_borrowed_range.h",
|
||||
"//third_party/libc++/src/include/__ranges/enable_view.h",
|
||||
"//third_party/libc++/src/include/__ranges/enumerate_view.h",
|
||||
"//third_party/libc++/src/include/__ranges/filter_view.h",
|
||||
"//third_party/libc++/src/include/__ranges/from_range.h",
|
||||
"//third_party/libc++/src/include/__ranges/iota_view.h",
|
||||
@@ -1327,7 +1316,6 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__ranges/single_view.h",
|
||||
"//third_party/libc++/src/include/__ranges/size.h",
|
||||
"//third_party/libc++/src/include/__ranges/split_view.h",
|
||||
"//third_party/libc++/src/include/__ranges/stride_view.h",
|
||||
"//third_party/libc++/src/include/__ranges/subrange.h",
|
||||
"//third_party/libc++/src/include/__ranges/take_view.h",
|
||||
"//third_party/libc++/src/include/__ranges/take_while_view.h",
|
||||
@@ -1352,6 +1340,7 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__support/ibm/gettod_zos.h",
|
||||
"//third_party/libc++/src/include/__support/ibm/locale_mgmt_zos.h",
|
||||
"//third_party/libc++/src/include/__support/ibm/nanosleep.h",
|
||||
"//third_party/libc++/src/include/__support/xlocale/__nop_locale_mgmt.h",
|
||||
"//third_party/libc++/src/include/__support/xlocale/__posix_l_fallback.h",
|
||||
"//third_party/libc++/src/include/__support/xlocale/__strtonum_fallback.h",
|
||||
"//third_party/libc++/src/include/__system_error/errc.h",
|
||||
@@ -1505,7 +1494,6 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__utility/as_lvalue.h",
|
||||
"//third_party/libc++/src/include/__utility/auto_cast.h",
|
||||
"//third_party/libc++/src/include/__utility/cmp.h",
|
||||
"//third_party/libc++/src/include/__utility/constant_wrapper.h",
|
||||
"//third_party/libc++/src/include/__utility/convert_to_integral.h",
|
||||
"//third_party/libc++/src/include/__utility/declval.h",
|
||||
"//third_party/libc++/src/include/__utility/default_three_way_comparator.h",
|
||||
@@ -1518,6 +1506,7 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__utility/in_place.h",
|
||||
"//third_party/libc++/src/include/__utility/integer_sequence.h",
|
||||
"//third_party/libc++/src/include/__utility/is_pointer_in_range.h",
|
||||
"//third_party/libc++/src/include/__utility/is_valid_range.h",
|
||||
"//third_party/libc++/src/include/__utility/lazy_synth_three_way_comparator.h",
|
||||
"//third_party/libc++/src/include/__utility/move.h",
|
||||
"//third_party/libc++/src/include/__utility/no_destroy.h",
|
||||
@@ -1613,6 +1602,7 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/filesystem",
|
||||
"//third_party/libc++/src/include/flat_map",
|
||||
"//third_party/libc++/src/include/flat_set",
|
||||
"//third_party/libc++/src/include/float.h",
|
||||
"//third_party/libc++/src/include/format",
|
||||
"//third_party/libc++/src/include/forward_list",
|
||||
"//third_party/libc++/src/include/fstream",
|
||||
|
||||
@@ -41,8 +41,7 @@ Object.assign(app, {
|
||||
commandLine: {
|
||||
hasSwitch: (theSwitch: string) => commandLine.hasSwitch(String(theSwitch)),
|
||||
getSwitchValue: (theSwitch: string) => commandLine.getSwitchValue(String(theSwitch)),
|
||||
appendSwitch: (theSwitch: string, value?: string) =>
|
||||
commandLine.appendSwitch(String(theSwitch), typeof value === 'undefined' ? value : String(value)),
|
||||
appendSwitch: (theSwitch: string, value?: string) => commandLine.appendSwitch(String(theSwitch), typeof value === 'undefined' ? value : String(value)),
|
||||
appendArgument: (arg: string) => commandLine.appendArgument(String(arg)),
|
||||
removeSwitch: (theSwitch: string) => commandLine.removeSwitch(String(theSwitch))
|
||||
} as Electron.CommandLine
|
||||
@@ -51,10 +50,10 @@ Object.assign(app, {
|
||||
// we define this here because it'd be overly complicated to
|
||||
// do in native land
|
||||
Object.defineProperty(app, 'applicationMenu', {
|
||||
get() {
|
||||
get () {
|
||||
return Menu.getApplicationMenu();
|
||||
},
|
||||
set(menu: Electron.Menu | null) {
|
||||
set (menu: Electron.Menu | null) {
|
||||
return Menu.setApplicationMenu(menu);
|
||||
}
|
||||
});
|
||||
@@ -117,22 +116,17 @@ for (const name of events) {
|
||||
}
|
||||
|
||||
app._clientCertRequestPasswordHandler = null;
|
||||
app.setClientCertRequestPasswordHandler = function (
|
||||
handler: (params: Electron.ClientCertRequestParams) => Promise<string>
|
||||
) {
|
||||
app.setClientCertRequestPasswordHandler = function (handler: (params: Electron.ClientCertRequestParams) => Promise<string>) {
|
||||
app._clientCertRequestPasswordHandler = handler;
|
||||
};
|
||||
|
||||
app.on(
|
||||
'-client-certificate-request-password',
|
||||
async (event: Electron.Event<Electron.ClientCertRequestParams>, callback: (password: string) => void) => {
|
||||
event.preventDefault();
|
||||
const { hostname, tokenName, isRetry } = event;
|
||||
if (!app._clientCertRequestPasswordHandler) {
|
||||
callback('');
|
||||
return;
|
||||
}
|
||||
const password = await app._clientCertRequestPasswordHandler({ hostname, tokenName, isRetry });
|
||||
callback(password);
|
||||
app.on('-client-certificate-request-password', async (event: Electron.Event<Electron.ClientCertRequestParams>, callback: (password: string) => void) => {
|
||||
event.preventDefault();
|
||||
const { hostname, tokenName, isRetry } = event;
|
||||
if (!app._clientCertRequestPasswordHandler) {
|
||||
callback('');
|
||||
return;
|
||||
}
|
||||
);
|
||||
const password = await app._clientCertRequestPasswordHandler({ hostname, tokenName, isRetry });
|
||||
callback(password);
|
||||
});
|
||||
|
||||
@@ -135,7 +135,7 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
allowAnyVersion: boolean = false;
|
||||
|
||||
// Private: Validate that the URL points to an MSIX file (following redirects)
|
||||
private async validateMsixUrl(url: string): Promise<void> {
|
||||
private async validateMsixUrl (url: string): Promise<void> {
|
||||
try {
|
||||
// Make a HEAD request to follow redirects and get the final URL
|
||||
const response = await net.fetch(url, {
|
||||
@@ -153,9 +153,7 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
const hasMsixExtension = pathname.endsWith('.msix') || pathname.endsWith('.msixbundle');
|
||||
|
||||
if (!hasMsixExtension) {
|
||||
throw new Error(
|
||||
`Update URL does not point to an MSIX file. Expected .msix or .msixbundle extension, got final URL: ${finalUrl}`
|
||||
);
|
||||
throw new Error(`Update URL does not point to an MSIX file. Expected .msix or .msixbundle extension, got final URL: ${finalUrl}`);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof TypeError) {
|
||||
@@ -166,7 +164,7 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
}
|
||||
|
||||
// Private: Check if URL is a direct MSIX file (following redirects)
|
||||
private async isDirectMsixUrl(url: string, emitError: boolean = false): Promise<boolean> {
|
||||
private async isDirectMsixUrl (url: string, emitError: boolean = false): Promise<boolean> {
|
||||
try {
|
||||
await this.validateMsixUrl(url);
|
||||
return true;
|
||||
@@ -180,12 +178,12 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
|
||||
// Supports both versioning (x.y.z) and Windows version format (x.y.z.a)
|
||||
// Returns: 1 if v1 > v2, -1 if v1 < v2, 0 if v1 === v2
|
||||
private compareVersions(v1: string, v2: string): number {
|
||||
const parts1 = v1.split('.').map((part) => {
|
||||
private compareVersions (v1: string, v2: string): number {
|
||||
const parts1 = v1.split('.').map(part => {
|
||||
const parsed = parseInt(part, 10);
|
||||
return isNaN(parsed) ? 0 : parsed;
|
||||
});
|
||||
const parts2 = v2.split('.').map((part) => {
|
||||
const parts2 = v2.split('.').map(part => {
|
||||
const parsed = parseInt(part, 10);
|
||||
return isNaN(parsed) ? 0 : parsed;
|
||||
});
|
||||
@@ -205,12 +203,9 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
|
||||
// Private: Parse the static releases array format
|
||||
// This is a static JSON file containing all releases
|
||||
private parseStaticReleasFile(
|
||||
json: any,
|
||||
currentVersion: string
|
||||
): { ok: boolean; available: boolean; url?: string; name?: string; notes?: string; pub_date?: string } {
|
||||
private parseStaticReleasFile (json: any, currentVersion: string): { ok: boolean; available: boolean; url?: string; name?: string; notes?: string; pub_date?: string } {
|
||||
if (!Array.isArray(json.releases) || !json.currentRelease || typeof json.currentRelease !== 'string') {
|
||||
this.emitError(new Error("Invalid releases format. Expected 'releases' array and 'currentRelease' string."));
|
||||
this.emitError(new Error('Invalid releases format. Expected \'releases\' array and \'currentRelease\' string.'));
|
||||
return { ok: false, available: false };
|
||||
}
|
||||
|
||||
@@ -239,18 +234,14 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
const releaseEntry = json.releases.find((r: any) => r.version === currentReleaseVersion);
|
||||
|
||||
if (!releaseEntry || !releaseEntry.updateTo) {
|
||||
this.emitError(
|
||||
new Error(`Release entry for version '${currentReleaseVersion}' not found or missing 'updateTo' property.`)
|
||||
);
|
||||
this.emitError(new Error(`Release entry for version '${currentReleaseVersion}' not found or missing 'updateTo' property.`));
|
||||
return { ok: false, available: false };
|
||||
}
|
||||
|
||||
const updateTo = releaseEntry.updateTo;
|
||||
|
||||
if (!updateTo.url) {
|
||||
this.emitError(
|
||||
new Error(`Invalid release entry. 'updateTo.url' is missing for version ${currentReleaseVersion}.`)
|
||||
);
|
||||
this.emitError(new Error(`Invalid release entry. 'updateTo.url' is missing for version ${currentReleaseVersion}.`));
|
||||
return { ok: false, available: false };
|
||||
}
|
||||
|
||||
@@ -264,22 +255,15 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
};
|
||||
}
|
||||
|
||||
private parseDynamicReleasFile(json: any): {
|
||||
ok: boolean;
|
||||
available: boolean;
|
||||
url?: string;
|
||||
name?: string;
|
||||
notes?: string;
|
||||
pub_date?: string;
|
||||
} {
|
||||
private parseDynamicReleasFile (json: any): { ok: boolean; available: boolean; url?: string; name?: string; notes?: string; pub_date?: string } {
|
||||
if (!json.url) {
|
||||
this.emitError(new Error("Invalid releases format. Expected 'url' string property."));
|
||||
this.emitError(new Error('Invalid releases format. Expected \'url\' string property.'));
|
||||
return { ok: false, available: false };
|
||||
}
|
||||
return { ok: true, available: true, url: json.url, name: json.name, notes: json.notes, pub_date: json.pub_date };
|
||||
}
|
||||
|
||||
private async fetchSquirrelJson(url: string) {
|
||||
private async fetchSquirrelJson (url: string) {
|
||||
const headers: Record<string, string> = {
|
||||
...this.updateHeaders,
|
||||
Accept: 'application/json' // Always set Accept header, overriding any user-provided Accept
|
||||
@@ -315,8 +299,8 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
}
|
||||
}
|
||||
|
||||
private async getUpdateInfo(url: string): Promise<UpdateInfo> {
|
||||
if (url && (await this.isDirectMsixUrl(url))) {
|
||||
private async getUpdateInfo (url: string): Promise<UpdateInfo> {
|
||||
if (url && await this.isDirectMsixUrl(url)) {
|
||||
return { ok: true, available: true, updateUrl: url, releaseDate: new Date() };
|
||||
} else {
|
||||
const updateJson = await this.fetchSquirrelJson(url);
|
||||
@@ -337,7 +321,7 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
const releaseName = updateJson.name ?? '';
|
||||
releaseDate = releaseDate ?? new Date();
|
||||
|
||||
if (!(await this.isDirectMsixUrl(updateUrl, true))) {
|
||||
if (!await this.isDirectMsixUrl(updateUrl, true)) {
|
||||
return { ok: false };
|
||||
} else {
|
||||
return {
|
||||
@@ -353,11 +337,11 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
}
|
||||
}
|
||||
|
||||
getFeedURL() {
|
||||
getFeedURL () {
|
||||
return this.updateURL ?? '';
|
||||
}
|
||||
|
||||
setFeedURL(options: { url: string; headers?: Record<string, string>; allowAnyVersion?: boolean } | string) {
|
||||
setFeedURL (options: { url: string; headers?: Record<string, string>; allowAnyVersion?: boolean } | string) {
|
||||
let updateURL: string;
|
||||
let headers: Record<string, string> | undefined;
|
||||
let allowAnyVersion: boolean | undefined;
|
||||
@@ -367,23 +351,23 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
headers = options.headers;
|
||||
allowAnyVersion = options.allowAnyVersion;
|
||||
} else {
|
||||
throw new TypeError("Expected options object to contain a 'url' string property in setFeedUrl call");
|
||||
throw new TypeError('Expected options object to contain a \'url\' string property in setFeedUrl call');
|
||||
}
|
||||
} else if (typeof options === 'string') {
|
||||
updateURL = options;
|
||||
} else {
|
||||
throw new TypeError("Expected an options object with a 'url' property to be provided");
|
||||
throw new TypeError('Expected an options object with a \'url\' property to be provided');
|
||||
}
|
||||
this.updateURL = updateURL;
|
||||
this.updateHeaders = headers ?? null;
|
||||
this.allowAnyVersion = allowAnyVersion ?? false;
|
||||
}
|
||||
|
||||
getPackageInfo(): MSIXPackageInfo {
|
||||
getPackageInfo (): MSIXPackageInfo {
|
||||
return msixUpdate.getPackageInfo() as MSIXPackageInfo;
|
||||
}
|
||||
|
||||
async checkForUpdates() {
|
||||
async checkForUpdates () {
|
||||
const url = this.updateURL;
|
||||
if (!url) {
|
||||
return this.emitError(new Error('Update URL is not set'));
|
||||
@@ -398,11 +382,7 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
// If appInstallerUri is set, Windows App Installer manages updates automatically
|
||||
// Prevent updates here to avoid conflicts
|
||||
if (packageInfo.appInstallerUri) {
|
||||
return this.emitError(
|
||||
new Error(
|
||||
'Auto-updates are managed by Windows App Installer. Updates are not allowed when installed via Application Manifest.'
|
||||
)
|
||||
);
|
||||
return this.emitError(new Error('Auto-updates are managed by Windows App Installer. Updates are not allowed when installed via Application Manifest.'));
|
||||
}
|
||||
|
||||
this.emit('checking-for-update');
|
||||
@@ -425,26 +405,18 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
forceUpdateFromAnyVersion: this.allowAnyVersion
|
||||
} as UpdateMsixOptions);
|
||||
|
||||
this.emit(
|
||||
'update-downloaded',
|
||||
{},
|
||||
msixUrlInfo.releaseNotes,
|
||||
msixUrlInfo.releaseName,
|
||||
msixUrlInfo.releaseDate,
|
||||
msixUrlInfo.updateUrl,
|
||||
() => {
|
||||
this.quitAndInstall();
|
||||
}
|
||||
);
|
||||
this.emit('update-downloaded', {}, msixUrlInfo.releaseNotes, msixUrlInfo.releaseName, msixUrlInfo.releaseDate, msixUrlInfo.updateUrl, () => {
|
||||
this.quitAndInstall();
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
this.emitError(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async quitAndInstall() {
|
||||
async quitAndInstall () {
|
||||
if (!this.updateAvailable) {
|
||||
this.emitError(new Error("No update available, can't quit and install"));
|
||||
this.emitError(new Error('No update available, can\'t quit and install'));
|
||||
app.quit();
|
||||
return;
|
||||
}
|
||||
@@ -469,7 +441,7 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
|
||||
// Private: Emit both error object and message, this is to keep compatibility
|
||||
// with Old APIs.
|
||||
emitError(error: Error) {
|
||||
emitError (error: Error) {
|
||||
this.emit('error', error, error.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,40 +8,40 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
updateAvailable: boolean = false;
|
||||
updateURL: string | null = null;
|
||||
|
||||
quitAndInstall() {
|
||||
quitAndInstall () {
|
||||
if (!this.updateAvailable) {
|
||||
return this.emitError(new Error("No update available, can't quit and install"));
|
||||
return this.emitError(new Error('No update available, can\'t quit and install'));
|
||||
}
|
||||
squirrelUpdate.processStart();
|
||||
app.quit();
|
||||
}
|
||||
|
||||
getFeedURL() {
|
||||
getFeedURL () {
|
||||
return this.updateURL ?? '';
|
||||
}
|
||||
|
||||
getPackageInfo() {
|
||||
getPackageInfo () {
|
||||
// Squirrel-based Windows apps don't have MSIX package information
|
||||
return undefined;
|
||||
}
|
||||
|
||||
setFeedURL(options: { url: string } | string) {
|
||||
setFeedURL (options: { url: string } | string) {
|
||||
let updateURL: string;
|
||||
if (typeof options === 'object') {
|
||||
if (typeof options.url === 'string') {
|
||||
updateURL = options.url;
|
||||
} else {
|
||||
throw new TypeError("Expected options object to contain a 'url' string property in setFeedUrl call");
|
||||
throw new TypeError('Expected options object to contain a \'url\' string property in setFeedUrl call');
|
||||
}
|
||||
} else if (typeof options === 'string') {
|
||||
updateURL = options;
|
||||
} else {
|
||||
throw new TypeError("Expected an options object with a 'url' property to be provided");
|
||||
throw new TypeError('Expected an options object with a \'url\' property to be provided');
|
||||
}
|
||||
this.updateURL = updateURL;
|
||||
}
|
||||
|
||||
async checkForUpdates() {
|
||||
async checkForUpdates () {
|
||||
const url = this.updateURL;
|
||||
if (!url) {
|
||||
return this.emitError(new Error('Update URL is not set'));
|
||||
@@ -72,7 +72,7 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
|
||||
|
||||
// Private: Emit both error object and message, this is to keep compatibility
|
||||
// with Old APIs.
|
||||
emitError(error: Error) {
|
||||
emitError (error: Error) {
|
||||
this.emit('error', error, error.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const { updateMsix, registerPackage, registerRestartOnUpdate, getPackageInfo } = process._linkedBinding(
|
||||
'electron_browser_msix_updater'
|
||||
);
|
||||
const { updateMsix, registerPackage, registerRestartOnUpdate, getPackageInfo } =
|
||||
process._linkedBinding('electron_browser_msix_updater');
|
||||
|
||||
export { updateMsix, registerPackage, registerRestartOnUpdate, getPackageInfo };
|
||||
|
||||
@@ -34,12 +34,8 @@ const spawnUpdate = async function (args: string[], options: { detached: boolean
|
||||
let stdout = '';
|
||||
let stderr = '';
|
||||
|
||||
spawnedProcess.stdout.on('data', (data) => {
|
||||
stdout += data;
|
||||
});
|
||||
spawnedProcess.stderr.on('data', (data) => {
|
||||
stderr += data;
|
||||
});
|
||||
spawnedProcess.stdout.on('data', (data) => { stdout += data; });
|
||||
spawnedProcess.stderr.on('data', (data) => { stderr += data; });
|
||||
|
||||
spawnedProcess.on('error', (error) => {
|
||||
spawnedProcess = undefined;
|
||||
@@ -63,12 +59,12 @@ const spawnUpdate = async function (args: string[], options: { detached: boolean
|
||||
};
|
||||
|
||||
// Start an instance of the installed app.
|
||||
export function processStart() {
|
||||
export function processStart () {
|
||||
spawnUpdate(['--processStartAndWait', exeName], { detached: true });
|
||||
}
|
||||
|
||||
// Download the releases specified by the URL and write new results to stdout.
|
||||
export async function checkForUpdate(updateURL: string): Promise<any> {
|
||||
export async function checkForUpdate (updateURL: string): Promise<any> {
|
||||
const stdout = await spawnUpdate(['--checkForUpdate', updateURL], { detached: false });
|
||||
try {
|
||||
// Last line of output is the JSON details about the releases
|
||||
@@ -80,12 +76,12 @@ export async function checkForUpdate(updateURL: string): Promise<any> {
|
||||
}
|
||||
|
||||
// Update the application to the latest remote version specified by URL.
|
||||
export async function update(updateURL: string): Promise<void> {
|
||||
export async function update (updateURL: string): Promise<void> {
|
||||
await spawnUpdate(['--update', updateURL], { detached: false });
|
||||
}
|
||||
|
||||
// Is the Update.exe installed with the current application?
|
||||
export function supported() {
|
||||
export function supported () {
|
||||
try {
|
||||
fs.accessSync(updateExe, fs.constants.R_OK);
|
||||
return true;
|
||||
|
||||
@@ -25,156 +25,88 @@ BaseWindow.prototype.setTouchBar = function (touchBar) {
|
||||
// Properties
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'autoHideMenuBar', {
|
||||
get: function () {
|
||||
return this.isMenuBarAutoHide();
|
||||
},
|
||||
set: function (autoHide) {
|
||||
this.setAutoHideMenuBar(autoHide);
|
||||
}
|
||||
get: function () { return this.isMenuBarAutoHide(); },
|
||||
set: function (autoHide) { this.setAutoHideMenuBar(autoHide); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'visibleOnAllWorkspaces', {
|
||||
get: function () {
|
||||
return this.isVisibleOnAllWorkspaces();
|
||||
},
|
||||
set: function (visible) {
|
||||
this.setVisibleOnAllWorkspaces(visible);
|
||||
}
|
||||
get: function () { return this.isVisibleOnAllWorkspaces(); },
|
||||
set: function (visible) { this.setVisibleOnAllWorkspaces(visible); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'fullScreen', {
|
||||
get: function () {
|
||||
return this.isFullScreen();
|
||||
},
|
||||
set: function (full) {
|
||||
this.setFullScreen(full);
|
||||
}
|
||||
get: function () { return this.isFullScreen(); },
|
||||
set: function (full) { this.setFullScreen(full); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'simpleFullScreen', {
|
||||
get: function () {
|
||||
return this.isSimpleFullScreen();
|
||||
},
|
||||
set: function (simple) {
|
||||
this.setSimpleFullScreen(simple);
|
||||
}
|
||||
get: function () { return this.isSimpleFullScreen(); },
|
||||
set: function (simple) { this.setSimpleFullScreen(simple); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'focusable', {
|
||||
get: function () {
|
||||
return this.isFocusable();
|
||||
},
|
||||
set: function (focusable) {
|
||||
this.setFocusable(focusable);
|
||||
}
|
||||
get: function () { return this.isFocusable(); },
|
||||
set: function (focusable) { this.setFocusable(focusable); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'kiosk', {
|
||||
get: function () {
|
||||
return this.isKiosk();
|
||||
},
|
||||
set: function (kiosk) {
|
||||
this.setKiosk(kiosk);
|
||||
}
|
||||
get: function () { return this.isKiosk(); },
|
||||
set: function (kiosk) { this.setKiosk(kiosk); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'documentEdited', {
|
||||
get: function () {
|
||||
return this.isDocumentEdited();
|
||||
},
|
||||
set: function (edited) {
|
||||
this.setDocumentEdited(edited);
|
||||
}
|
||||
get: function () { return this.isDocumentEdited(); },
|
||||
set: function (edited) { this.setDocumentEdited(edited); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'shadow', {
|
||||
get: function () {
|
||||
return this.hasShadow();
|
||||
},
|
||||
set: function (shadow) {
|
||||
this.setHasShadow(shadow);
|
||||
}
|
||||
get: function () { return this.hasShadow(); },
|
||||
set: function (shadow) { this.setHasShadow(shadow); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'representedFilename', {
|
||||
get: function () {
|
||||
return this.getRepresentedFilename();
|
||||
},
|
||||
set: function (filename) {
|
||||
this.setRepresentedFilename(filename);
|
||||
}
|
||||
get: function () { return this.getRepresentedFilename(); },
|
||||
set: function (filename) { this.setRepresentedFilename(filename); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'minimizable', {
|
||||
get: function () {
|
||||
return this.isMinimizable();
|
||||
},
|
||||
set: function (min) {
|
||||
this.setMinimizable(min);
|
||||
}
|
||||
get: function () { return this.isMinimizable(); },
|
||||
set: function (min) { this.setMinimizable(min); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'title', {
|
||||
get: function () {
|
||||
return this.getTitle();
|
||||
},
|
||||
set: function (title) {
|
||||
this.setTitle(title);
|
||||
}
|
||||
get: function () { return this.getTitle(); },
|
||||
set: function (title) { this.setTitle(title); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'maximizable', {
|
||||
get: function () {
|
||||
return this.isMaximizable();
|
||||
},
|
||||
set: function (max) {
|
||||
this.setMaximizable(max);
|
||||
}
|
||||
get: function () { return this.isMaximizable(); },
|
||||
set: function (max) { this.setMaximizable(max); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'resizable', {
|
||||
get: function () {
|
||||
return this.isResizable();
|
||||
},
|
||||
set: function (res) {
|
||||
this.setResizable(res);
|
||||
}
|
||||
get: function () { return this.isResizable(); },
|
||||
set: function (res) { this.setResizable(res); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'menuBarVisible', {
|
||||
get: function () {
|
||||
return this.isMenuBarVisible();
|
||||
},
|
||||
set: function (visible) {
|
||||
this.setMenuBarVisibility(visible);
|
||||
}
|
||||
get: function () { return this.isMenuBarVisible(); },
|
||||
set: function (visible) { this.setMenuBarVisibility(visible); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'fullScreenable', {
|
||||
get: function () {
|
||||
return this.isFullScreenable();
|
||||
},
|
||||
set: function (full) {
|
||||
this.setFullScreenable(full);
|
||||
}
|
||||
get: function () { return this.isFullScreenable(); },
|
||||
set: function (full) { this.setFullScreenable(full); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'closable', {
|
||||
get: function () {
|
||||
return this.isClosable();
|
||||
},
|
||||
set: function (close) {
|
||||
this.setClosable(close);
|
||||
}
|
||||
get: function () { return this.isClosable(); },
|
||||
set: function (close) { this.setClosable(close); }
|
||||
});
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'movable', {
|
||||
get: function () {
|
||||
return this.isMovable();
|
||||
},
|
||||
set: function (move) {
|
||||
this.setMovable(move);
|
||||
}
|
||||
get: function () { return this.isMovable(); },
|
||||
set: function (move) { this.setMovable(move); }
|
||||
});
|
||||
|
||||
BaseWindow.getFocusedWindow = () => {
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
import {
|
||||
BrowserWindow,
|
||||
AutoResizeOptions,
|
||||
Rectangle,
|
||||
WebContentsView,
|
||||
WebPreferences,
|
||||
WebContents
|
||||
} from 'electron/main';
|
||||
import { BrowserWindow, AutoResizeOptions, Rectangle, WebContentsView, WebPreferences, WebContents } from 'electron/main';
|
||||
|
||||
const v8Util = process._linkedBinding('electron_common_v8_util');
|
||||
|
||||
@@ -17,10 +10,10 @@ export default class BrowserView {
|
||||
|
||||
// AutoResize state
|
||||
#resizeListener: ((...args: any[]) => void) | null = null;
|
||||
#lastWindowSize: { width: number; height: number } = { width: 0, height: 0 };
|
||||
#lastWindowSize: {width: number, height: number} = { width: 0, height: 0 };
|
||||
#autoResizeFlags: AutoResizeOptions = {};
|
||||
|
||||
constructor(options: { webPreferences: WebPreferences; webContents?: WebContents } = { webPreferences: {} }) {
|
||||
constructor (options: {webPreferences: WebPreferences, webContents?: WebContents} = { webPreferences: {} }) {
|
||||
const { webPreferences = {}, webContents } = options;
|
||||
if (webContents) {
|
||||
v8Util.setHiddenValue(webPreferences, 'webContents', webContents);
|
||||
@@ -32,21 +25,21 @@ export default class BrowserView {
|
||||
this.#webContentsView.webContents.once('destroyed', this.#destroyListener);
|
||||
}
|
||||
|
||||
get webContents() {
|
||||
get webContents () {
|
||||
return this.#webContentsView.webContents;
|
||||
}
|
||||
|
||||
setBounds(bounds: Rectangle) {
|
||||
setBounds (bounds: Rectangle) {
|
||||
this.#webContentsView.setBounds(bounds);
|
||||
this.#autoHorizontalProportion = null;
|
||||
this.#autoVerticalProportion = null;
|
||||
}
|
||||
|
||||
getBounds() {
|
||||
getBounds () {
|
||||
return this.#webContentsView.getBounds();
|
||||
}
|
||||
|
||||
setAutoResize(options: AutoResizeOptions) {
|
||||
setAutoResize (options: AutoResizeOptions) {
|
||||
if (options == null || typeof options !== 'object') {
|
||||
throw new Error('Invalid auto resize options');
|
||||
}
|
||||
@@ -62,19 +55,19 @@ export default class BrowserView {
|
||||
this.#autoVerticalProportion = null;
|
||||
}
|
||||
|
||||
setBackgroundColor(color: string) {
|
||||
setBackgroundColor (color: string) {
|
||||
this.#webContentsView.setBackgroundColor(color);
|
||||
}
|
||||
|
||||
// Internal methods
|
||||
get ownerWindow(): BrowserWindow | null {
|
||||
get ownerWindow (): BrowserWindow | null {
|
||||
return this.#ownerWindow;
|
||||
}
|
||||
|
||||
// We can't rely solely on the webContents' owner window because
|
||||
// a webContents can be closed by the user while the BrowserView
|
||||
// remains alive and attached to a BrowserWindow.
|
||||
set ownerWindow(w: BrowserWindow | null) {
|
||||
set ownerWindow (w: BrowserWindow | null) {
|
||||
this.#removeResizeListener();
|
||||
|
||||
if (this.webContents && !this.webContents.isDestroyed()) {
|
||||
@@ -84,7 +77,7 @@ export default class BrowserView {
|
||||
this.#ownerWindow = w;
|
||||
if (w) {
|
||||
this.#lastWindowSize = w.getBounds();
|
||||
w.on('resize', (this.#resizeListener = this.#autoResize.bind(this)));
|
||||
w.on('resize', this.#resizeListener = this.#autoResize.bind(this));
|
||||
w.on('closed', () => {
|
||||
this.#removeResizeListener();
|
||||
this.#ownerWindow = null;
|
||||
@@ -93,25 +86,25 @@ export default class BrowserView {
|
||||
}
|
||||
}
|
||||
|
||||
#onDestroy() {
|
||||
#onDestroy () {
|
||||
// Ensure that if #webContentsView's webContents is destroyed,
|
||||
// the WebContentsView is removed from the view hierarchy.
|
||||
this.#ownerWindow?.contentView.removeChildView(this.webContentsView);
|
||||
}
|
||||
|
||||
#removeResizeListener() {
|
||||
#removeResizeListener () {
|
||||
if (this.#ownerWindow && this.#resizeListener) {
|
||||
this.#ownerWindow.off('resize', this.#resizeListener);
|
||||
this.#resizeListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
#autoHorizontalProportion: { width: number; left: number } | null = null;
|
||||
#autoVerticalProportion: { height: number; top: number } | null = null;
|
||||
#autoResize() {
|
||||
#autoHorizontalProportion: {width: number, left: number} | null = null;
|
||||
#autoVerticalProportion: {height: number, top: number} | null = null;
|
||||
#autoResize () {
|
||||
if (!this.ownerWindow) {
|
||||
throw new Error('Electron bug: #autoResize called without owner window');
|
||||
}
|
||||
};
|
||||
|
||||
if (this.#autoResizeFlags.horizontal && this.#autoHorizontalProportion == null) {
|
||||
const viewBounds = this.#webContentsView.getBounds();
|
||||
@@ -165,7 +158,7 @@ export default class BrowserView {
|
||||
};
|
||||
}
|
||||
|
||||
get webContentsView() {
|
||||
get webContentsView () {
|
||||
return this.#webContentsView;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,14 +40,10 @@ BrowserWindow.prototype._init = function (this: BWT) {
|
||||
let unresponsiveEvent: NodeJS.Timeout | null = null;
|
||||
const emitUnresponsiveEvent = () => {
|
||||
unresponsiveEvent = null;
|
||||
if (!this.isDestroyed() && this.isEnabled()) {
|
||||
this.emit('unresponsive');
|
||||
}
|
||||
if (!this.isDestroyed() && this.isEnabled()) { this.emit('unresponsive'); }
|
||||
};
|
||||
this.webContents.on('unresponsive', () => {
|
||||
if (!unresponsiveEvent) {
|
||||
unresponsiveEvent = setTimeout(emitUnresponsiveEvent, 50);
|
||||
}
|
||||
if (!unresponsiveEvent) { unresponsiveEvent = setTimeout(emitUnresponsiveEvent, 50); }
|
||||
});
|
||||
this.webContents.on('responsive', () => {
|
||||
if (unresponsiveEvent) {
|
||||
@@ -87,16 +83,16 @@ BrowserWindow.prototype._init = function (this: BWT) {
|
||||
this._browserViews = [];
|
||||
|
||||
this.on('closed', () => {
|
||||
this._browserViews.forEach((b) => b.webContents?.close({ waitForBeforeUnload: true }));
|
||||
this._browserViews.forEach(b => b.webContents?.close({ waitForBeforeUnload: true }));
|
||||
});
|
||||
|
||||
// Notify the creation of the window.
|
||||
app.emit('browser-window-created', { preventDefault() {} }, this);
|
||||
app.emit('browser-window-created', { preventDefault () {} }, this);
|
||||
|
||||
Object.defineProperty(this, 'devToolsWebContents', {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
get() {
|
||||
get () {
|
||||
return this.webContents.devToolsWebContents;
|
||||
}
|
||||
});
|
||||
@@ -108,7 +104,7 @@ const isBrowserWindow = (win: any) => {
|
||||
|
||||
BrowserWindow.fromId = (id: number) => {
|
||||
const win = BaseWindow.fromId(id);
|
||||
return isBrowserWindow(win) ? (win as any as BWT) : null;
|
||||
return isBrowserWindow(win) ? win as any as BWT : null;
|
||||
};
|
||||
|
||||
BrowserWindow.getAllWindows = () => {
|
||||
@@ -218,12 +214,10 @@ BrowserWindow.prototype.addBrowserView = function (browserView: BrowserView) {
|
||||
};
|
||||
|
||||
BrowserWindow.prototype.setBrowserView = function (browserView: BrowserView) {
|
||||
this._browserViews.forEach((bv) => {
|
||||
this._browserViews.forEach(bv => {
|
||||
this.removeBrowserView(bv);
|
||||
});
|
||||
if (browserView) {
|
||||
this.addBrowserView(browserView);
|
||||
}
|
||||
if (browserView) { this.addBrowserView(browserView); }
|
||||
};
|
||||
|
||||
BrowserWindow.prototype.removeBrowserView = function (browserView: BrowserView) {
|
||||
|
||||