Skip to main content

Electron 34.0.0

· 7 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 使用 npm install electron@latest 安装,或从我们的发布网站下载。请继续阅读以了解此次发布的详细信息。

🌐 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,以在会话级别管理共享字典:

  • 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).

当存在长时间运行的 JavaScript 事件导致进程挂起时,这个 API 可以用来确定为什么帧无响应。有关更多信息,请参阅提议中的网页标准崩溃报告 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

技术栈变更

🌐 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

  • 新增了用于管理共享字典以提高使用 Brotli 或 ZStandard 压缩效率的 API。新的 API 包括 session.getSharedDictionaryUsageInfo()session.getSharedDictionaryInfo(options)session.clearSharedDictionaryCache()session.clearSharedDictionaryCacheForIsolationKey(options)#44950
  • 添加了 WebFrameMain.collectJavaScriptCallStack() 用于访问无响应渲染器的 JavaScript 调用堆栈。#44938
  • 为处于卸载状态的帧添加了 WebFrameMain.detached
    • 添加了 WebFrameMain.isDestroyed() 来确定一个帧是否已被销毁。
    • 修复了在卸载框架时 webFrameMain.fromId(processId, frameId) 返回不符合给定参数的 WebFrameMain 实例的问题。#43473
  • 在实用程序进程中添加了错误事件,以支持 V8 致命错误的诊断报告。#43774
  • 特性:GPU 加速的共享纹理离屏渲染。#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。

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.