Skip to main content

Electron 34.0.0

· 8 min read

Electron 34.0.0 已发布!此更新包含对 Chromium 132.0.6834.83、V8 13.2 和 Node 20.18.1 的升级。

¥Electron 34.0.0 has been released! It includes upgrades to Chromium 132.0.6834.83, V8 13.2, and Node 20.18.1.


Electron 团队很高兴地宣布 Electron 34.0.0 正式发布!你可以通过 npm install electron@latest 使用 npm 安装它,也可以从我们的 发布网站。继续阅读以了解有关此版本的详细信息。

¥The Electron team is excited to announce the release of Electron 34.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.

如果你有任何反馈,请在 BlueskyMastodon 上与我们分享,或加入我们的社区 Discord!可以在 Electron 的 问题跟踪器 中报告错误和功能请求。

¥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.

显著变化

¥Notable Changes

HTTP 压缩共享字典管理 API

¥HTTP Compression Shared Dictionary Management APIs

HTTP 压缩允许 Web 服务器在数据被浏览器接收之前对其进行压缩。现代版本的 Chromium 支持 Brotli 和 Zstandard,它们是较新的压缩算法,与 gzip 等旧方案相比,它们对文本文件的性能更佳。

¥HTTP compression allows data to be compressed by a web server before being received by the browser. Modern versions of Chromium support Brotli and Zstandard, which are newer compression algorithms that perform better for text files than older schemes such as gzip.

自定义共享字典进一步提高了 Brotli 和 Zstandard 压缩的效率。请参阅 Chrome 开发者博客:共享词典 了解更多信息。

¥Custom shared dictionaries further improve the efficiency of Brotli and Zstandard compression. See the Chrome for Developers blog on shared dictionaries for more information.

@felixrieseberg#44950 中添加了以下 API,用于在会话级别管理共享字典:

¥@felixrieseberg added the following APIs in #44950 to manage shared dictionaries at the Session level:

  • session.getSharedDictionaryUsageInfo()

  • session.getSharedDictionaryInfo(options)

  • session.clearSharedDictionaryCache()

  • session.clearSharedDictionaryCacheForIsolationKey(options)

无响应的渲染器 JavaScript 调用堆栈

¥Unresponsive Renderer JavaScript Call Stacks

每当渲染器进程长时间挂起时,就会发生 Electron 的 unresponsive 事件。@samuelmaddock#44204 中添加的新 WebFrameMain.collectJavaScriptCallStack() API 允许你从关联的 WebFrameMain 对象(webContnets.mainFrame)收集 JavaScript 调用堆栈。

¥Electron's unresponsive event occurs whenever a renderer process hangs for an excessive period of time. The new WebFrameMain.collectJavaScriptCallStack() API added by @samuelmaddock in #44204 allows you to collect the JavaScript call stack from the associated WebFrameMain object (webContnets.mainFrame).

此 API 可用于在长时间运行的 JavaScript 事件导致进程挂起的情况下确定框架无响应的原因。有关详细信息,请参阅 拟议的 Web 标准崩溃报告 API

¥This API can be useful to determine why the frame is unresponsive in cases where there's long-running JavaScript events causing the process to hang. For more information, see the proposed web standard Crash Reporting API.

Main Process
const { app } = require('electron');

app.commandLine.appendSwitch(
'enable-features',
'DocumentPolicyIncludeJSCallStacksInCrashReports',
);

app.on('web-contents-created', (_, webContents) => {
webContents.on('unresponsive', async () => {
// Interrupt execution and collect call stack from unresponsive renderer
const callStack = await webContents.mainFrame.collectJavaScriptCallStack();
console.log('Renderer unresponsive\n', callStack);
});
});

[!WARNING] 此 API 需要启用 'Document-Policy': 'include-js-call-stacks-in-crash-reports' 标头。详细信息请参见 #45356

¥[!WARNING] This API requires the 'Document-Policy': 'include-js-call-stacks-in-crash-reports' header to be enabled. See #45356 for more details.

技术栈变更

¥Stack Changes

Electron 34 将 Chromium 从 130.0.6723.44 升级到 132.0.6834.83,将 Node 从 20.18.0 升级到 20.18.1,将 V8 从 13.0 升级到 13.2

¥Electron 34 upgrades Chromium from 130.0.6723.44 to 132.0.6834.83, Node from 20.18.0 to 20.18.1, and V8 from 13.0 to 13.2.

新功能

¥New Features

  • 添加了用于管理共享字典的 API,以提高使用 Brotli 或 ZStandard 的压缩效率。新的 API 包括 session.getSharedDictionaryUsageInfo()session.getSharedDictionaryInfo(options)session.clearSharedDictionaryCache()session.clearSharedDictionaryCacheForIsolationKey(options)#44950

    ¥Added APIs to manage shared dictionaries for compression efficiency using Brotli or ZStandard. The new APIs are session.getSharedDictionaryUsageInfo(), session.getSharedDictionaryInfo(options), session.clearSharedDictionaryCache(), and session.clearSharedDictionaryCacheForIsolationKey(options). #44950

  • 添加了 WebFrameMain.collectJavaScriptCallStack(),用于访问无响应渲染器的 JavaScript 调用堆栈。#44938

    ¥Added WebFrameMain.collectJavaScriptCallStack() for accessing the JavaScript call stack of unresponsive renderers. #44938

  • 添加了 WebFrameMain.detached,用于检测处于卸载状态的帧。

    ¥Added WebFrameMain.detached for frames in an unloading state.

    • 添加 WebFrameMain.isDestroyed() 以判断框架是否已被破坏。

      ¥Added WebFrameMain.isDestroyed() to determine if a frame has been destroyed.

    • 修复了 webFrameMain.fromId(processId, frameId) 在框架卸载时返回与给定参数不匹配的 WebFrameMain 实例的问题。#43473

      ¥Fixed webFrameMain.fromId(processId, frameId) returning a WebFrameMain instance which doesn't match the given parameters when the frame is unloading. #43473

  • 在实用程序进程中添加了错误事件,以支持 V8 致命错误的诊断报告。#43774

    ¥Added error event in utility process to support diagnostic reports on V8 fatal errors. #43774

  • 功能:GPU 加速共享纹理离屏渲染。#42953

    ¥Feat: GPU accelerated shared texture offscreen rendering. #42953

重大变化

¥Breaking Changes

行为改变:Windows 全屏时菜单栏将被隐藏

¥Behavior Changed: menu bar will be hidden during fullscreen on Windows

这使行为与 Linux 保持一致。先前行为:在 Windows 全屏显示时,菜单栏仍然可见。新行为:在 Windows 全屏显示时,菜单栏是隐藏的。

¥This brings the behavior to parity with Linux. Prior behavior: Menu bar is still visible during fullscreen on Windows. New behavior: Menu bar is hidden during fullscreen on Windows.

更正:这之前被列为 Electron 33 中的重大更改,但首次发布是在 Electron 34 中。

¥Correction: This was previously listed as a breaking change in Electron 33, but was first released in Electron 34.

31.x.y 停止支持

¥End of Support for 31.x.y

Electron 31.x.y 已根据项目的 支持政策 终止支持。建议开发者和应用升级到较新版本的 Electron。

¥Electron 31.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.

E34 (2025 年 1 月)E35 (2025 年 4 月)E36 (2025 年 6 月)
34.x.y35.x.y36.x.y
33.x.y34.x.y35.x.y
32.x.y33.x.y34.x.y

下一步计划

¥What's Next

短期内,你可以预期团队将继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。

¥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.

你可以找到 Electron 公开时间线

¥You can find Electron's public timeline here.

有关未来变更的更多信息,请参阅 计划中的突发事件变更 页面。

¥More information about future changes can be found on the Planned Breaking Changes page.