跳转到主内容

Electron 34.0.0

· 阅读时间:约 5 分钟

Electron 34.0.0 已发布! 它包括对 Chromium 132.0.6834.83、V8 13.2 和 Node 20.18.1 的升级。


Electron 团队很高兴发布了 Electron 34.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

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

重要变化

HTTP Compression Shared Dictionary Management APIs

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.

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 added the following APIs in #44950 to manage shared dictionaries at the Session level:

  • session.getSharedDictionaryUsageInfo()
  • session.getSharedDictionaryInfo(options)
  • session.clearSharedDictionaryCache()
  • session.clearSharedDictionaryCacheForIsolationKey(options)

Unresponsive Renderer JavaScript Call Stacks

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

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);
});
});
警告

This API requires the 'Document-Policy': 'include-js-call-stacks-in-crash-reports' header to be enabled. 详见: #45356

架构(Stack)更新

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

新特性

  • 添加了API以管理共享字典,以提高使用 Brotli 或 ZStandard 的压缩效率。 新的 APIs 是 session.getSharedDictionaryUsageInfo(), session.getSharedDictionaryInfo(options), session.clear. SharedDictionaryCache(), 和 session.clear. SharedDictionaryCacheForIsolation(options). #44950
  • 添加了 WebFrameMain.collectJavaScriptCallStack() 用于访问无响应渲染器的 JavaScript 调用堆栈。 #44938
  • 为处于卸载状态的帧添加了 WebFrameMain.detached
    • 添加了 WebFrameMain.isDestroyed() 方法,用于判断 frame 是否已被销毁。
    • 修复了 webFrameMain.fromId(processId, frameId) 在框架卸载时返回的 WebFrameMain 实例与给定参数不匹配的问题。 #43473
  • 在 utility process 中增加了 error 事件,以支持有关 V8 致命错误的诊断报告。 #43774
  • 新功能:GPU 加速的共享纹理离屏渲染。 #42953

重大更改

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

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

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

终止对 31.x.y 的支持

根据项目的支持政策,Electron 31.x.y 已经达到了支持的终点。 我们鼓励开发者将应用程序升级到更新的 Electron 版本。

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

接下来

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

您可以在此处找到 Electron 的公开时间表

有关这些和未来变化的更多信息可在计划的突破性变化页面找到。