Skip to content

chore(deps): upgrade Electron to 42.2.0 - #117

Merged
ThomasHalwax merged 2 commits into
mainfrom
chore/electron-42
May 21, 2026
Merged

ThomasHalwax merged 2 commits into
mainfrom
chore/electron-42

Conversation

@ThomasHalwax

@ThomasHalwax ThomasHalwax commented May 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Upgrades Electron from 38.8.6 to 42.2.0, resolving the last remaining high-severity npm audit finding (electron <=39.8.4, 17 advisories).

Changes

  • electron 38.8.6 → 42.2.0 (package.json ^42.2.0)
  • Harden the app:// protocol handler so it always resolves to a Response (404 on a missing file) instead of returning a rejected net.fetch() promise, which surfaced as a net::ERR_FILE_NOT_FOUND error
  • Document build hygiene in the README

Breaking change review (v39–42)

Reviewed Electron's breaking-changes.md for v39–42 against our main-process API usage (app, BrowserWindow, ipcMain/ipcRenderer, webContents, session.webRequest, protocol.handle, Menu, dialog, shell, screen, net). No code changes required — none of the removed or deprecated APIs are used.

Notes:

  • leveldown 6.x ships N-API prebuilds (ABI-stable) — no native module rebuild needed for the new Node ABI.
  • macOS notifications now use UNNotification (v42) and require a code-signed app to display; release builds are signed, unsigned dev builds emit a failed event instead.
  • nativeWindowOpen webPreference has been a no-op since v22 (left as-is).

Validation

  • App launched on Electron 42.2.0: renderer runs un-sandboxed as required by nodeIntegration, leveldown loads, preload initializes correctly.
  • npm run lint: clean · test suite: 332 passing.

Note on the DevTools freeze

While testing, opening Chrome DevTools froze the renderer. Investigation (stack sampling the frozen renderer — main thread blocked in mach_msg) traced this to a mismatched bundle/source map in a partially built dist/, not an app-code or Electron 42 defect: a clean rebuild does not freeze, and npm run hot never did. There is no freeze-related code fix here — the README now documents the build-hygiene workaround.

Major bump from 38.8.6 to 42.2.0, resolving the remaining high-severity
audit finding (electron <=39.8.4, 17 advisories).

Reviewed Electron breaking changes for v39-42 against our main-process
API usage (app, BrowserWindow, ipcMain/Renderer, webContents,
session.webRequest, protocol.handle, Menu, dialog, shell, screen, net):
no code changes required. None of the removed/deprecated APIs are used.

Notes:
- leveldown 6.x ships N-API prebuilds (ABI-stable), so no native
  module rebuild is needed for the new Node ABI.
- macOS notifications now use UNNotification (v42): they require a
  code-signed app to display. Release builds are signed; unsigned dev
  builds will emit a 'failed' event instead.
- nativeWindowOpen webPreference (WindowManager.js) has been a no-op
  since v22; left as-is, not introduced here.

Validated by launching the app on Electron 42: renderer runs
un-sandboxed as required by nodeIntegration, leveldown loads, preload
initializes correctly.
The app:// protocol handler returned net.fetch() directly, so a request
for a missing file produced a rejected handler promise instead of a
proper response, surfacing as a net::ERR_FILE_NOT_FOUND error. The
handler now always resolves to a Response (404 on a missing file).

Also documents build hygiene in the README: a partial webpack build can
leave dist/ with a mismatched bundle and source map, which freezes the
renderer when DevTools is opened. A clean rebuild resolves it.
@ThomasHalwax
ThomasHalwax merged commit e81a8cf into main May 21, 2026
1 check passed
quachhung94 pushed a commit to quachhung94/ODINv2 that referenced this pull request Sep 30, 2026
PR syncpoint#117 bumped the `electron` devDependency to 42.2.0 but left
electron-builder.yml pinned at `electronVersion: 38.8.0`. That field is
the single source of truth for both packaging and the webpack build
target (webpack.config.js derives electronXX-* from it), so release
builds would have bundled Electron 38 — leaving the audit advisories
that syncpoint#117 set out to close still present in shipped artifacts.

No released artifact is affected: the Electron 42 bump is in no tagged
release (latest, v3.3.0, predates it by ~2 months); this lands before
the next release.

- electron-builder.yml: electronVersion 38.8.0 -> 42.2.0
- bumping electronVersion surfaced that node-abi@4.26.0 (under
  @electron/rebuild) cannot detect the Electron 42 ABI, which fails
  `electron-builder install-app-deps`. Pinned node-abi to ^4.31.0 via
  overrides.

Verified: install-app-deps rebuilds leveldown for Electron 42.2.0,
webpack compiles with the electron42.2 target, lint and tests green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant