























Electron 35.0.0 has been released! It includes upgrades to Chromium 134.0.6998.44, V8 13.5, and Node 22.14.0.
The Electron team is excited to announce the release of Electron 35.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.
If you have any feedback, please share it with us on Bluesky or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.
Originally proposed in RFC #8 by @samuelmaddock, Electron 35 adds the ability to attach a preload script to Service Workers. With Chrome's Manifest V3 Extensions routing a lot of work through extension service workers, this feature fills in a gap in Electron's support for modern Chrome extensions.
When registering a preload script programmatically at the Session level, you can now specifically apply it to Service Worker contexts with the ses.registerPreloadScript(script) API.
Main Process
// Add our preload realm script to the session.
session.defaultSession.registerPreloadScript({
// Our script should only run in service worker preload realms.
type: 'service-worker',
// The absolute path to the script.
script: path.join(__dirname, 'extension-sw-preload.js'),
});
Furthermore, IPC is now available between Service Workers and their attached preload scripts via the ServiceWorkerMain.ipc class. The preload script will still use the ipcRenderer module to communicate with its Service Worker. See the original RFC for more details.
This feature was preceded by many other changes that laid the groundwork for it:
contextBridge.executeInMainWorld(executionScript) script to evaluate JavaScript in the main world over the context bridge.ServiceWorkerMain class to interact with Service Workers in the main process.134.0.6998.44
22.14.0
13.5Electron 35 upgrades Chromium from 132.0.6834.83 to 134.0.6998.44, Node from 20.18.1 to 22.14.0, and V8 from 13.2 to 13.5.
NSPrefersDisplaySafeAreaCompatibilityMode = false to Info.plist to remove "Scale to fit below built-in camera." from app options. #45357 (Also in v34.1.0)ServiceWorkerMain class to interact with service workers in the main process. #45341
running-status-changed event on ServiceWorkers to indicate when a service worker's running status has changed.startWorkerForScope on ServiceWorkers to start a worker that may have been previously stopped.contextBridge.executeInMainWorld to safely execute code across world boundaries. #45330frame to 'console-message' event. #43617query-session-end event and improved session-end events on Windows. #44598view.getVisible(). #45409webContents.navigationHistory.restore(index, entries) API that allows restoration of navigation history. #45583BrowserWindow.setVibrancy. #35987document.executeCommand("paste"). #45471 (Also in v34.1.0)roundedCorners BrowserWindow constructor option on Windows. #45740 (Also in v34.3.0)globalShortcuts. Electron must be run with --enable-features=GlobalShortcutsPortal in order to have the feature working. #45297isDefault and status properties on PrinterInfoThese properties have been removed from the PrinterInfo object
because they have been removed from upstream Chromium.
getFromVersionID on session.serviceWorkersThe session.serviceWorkers.fromVersionID(versionId) API has been deprecated
in favor of session.serviceWorkers.getInfoFromVersionID(versionId). This was
changed to make it more clear which object is returned with the introduction
of the session.serviceWorkers.getWorkerFromVersionID(versionId) API.
// Deprecated
session.serviceWorkers.fromVersionID(versionId);
// Replace with
session.serviceWorkers.getInfoFromVersionID(versionId);
setPreloads, getPreloads on SessionregisterPreloadScript, unregisterPreloadScript, and getPreloadScripts are introduced as a
replacement for the deprecated methods. These new APIs allow third-party libraries to register
preload scripts without replacing existing scripts. Also, the new type option allows for
additional preload targets beyond frame.
// Deprecated
session.setPreloads([path.join(__dirname, 'preload.js')]);
// Replace with:
session.registerPreloadScript({
type: 'frame',
id: 'app-preload',
filePath: path.join(__dirname, 'preload.js'),
});
level, message, line, and sourceId arguments in console-message event on WebContentsThe console-message event on WebContents has been updated to provide details on the Event
argument.
// Deprecated
webContents.on(
'console-message',
(event, level, message, line, sourceId) => {},
);
// Replace with:
webContents.on(
'console-message',
({ level, message, lineNumber, sourceId, frame }) => {},
);
Additionally, level is now a string with possible values of info, warning, error, and debug.
urls property of WebRequestFilter.Previously, an empty urls array was interpreted as including all URLs. To explicitly include all URLs, developers should now use the <all_urls> pattern, which is a designated URL pattern that matches every possible URL. This change clarifies the intent and ensures more predictable behavior.
// Deprecated
const deprecatedFilter = {
urls: [],
};
// Replace with
const newFilter = {
urls: ['<all_urls>'],
};
systemPreferences.isAeroGlassEnabled()The systemPreferences.isAeroGlassEnabled() function has been deprecated without replacement.
It has been always returning true since Electron 23, which only supports Windows 10+, where DWM composition can no longer be disabled.
Electron 32.x.y has reached end-of-support as per the project's support policy. Developers and applications are encouraged to upgrade to a newer version of Electron.
| E35 (Mar'25) | E36 (Apr'25) | E37 (Jun'25) |
|---|---|---|
| 35.x.y | 36.x.y | 37.x.y |
| 34.x.y | 35.x.y | 36.x.y |
| 33.x.y | 34.x.y | 35.x.y |
In the short term, you can expect the team to continue to focus on keeping up with the development of the major components that make up Electron, including Chromium, Node, and V8.
You can find Electron's public timeline here.
More information about future changes can be found on the Planned Breaking Changes page.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。