Skip to main content

Electron 30.0.0

· 9 min read

Electron 30.0.0 已发布!它包含对 Chromium 124.0.6367.49、V8 12.4 和 Node.js 20.11.1 的升级。

¥Electron 30.0.0 has been released! It includes upgrades to Chromium 124.0.6367.49, V8 12.4, and Node.js 20.11.1.


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

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

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

¥If you have any feedback, please share it with us on Twitter or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

显著变化

¥Notable Changes

亮点

¥Highlights

  • ASAR Integrity fuse 现已支持 Windows (#40504)

    ¥ASAR Integrity fuse now supported on Windows (#40504)

    • 如果配置不正确,启用 ASAR Integrity 的现有应用可能无法在 Windows 上运行。使用 Electron 打包工具的应用应升级到 @electron/packager@18.3.1@electron/forge@7.4.0

      ¥Existing apps with ASAR Integrity enabled may not work on Windows if not configured correctly. Apps using Electron packaging tools should upgrade to @electron/packager@18.3.1 or @electron/forge@7.4.0.

    • 查看我们的 ASAR 完整性教程 了解更多信息。

      ¥Take a look at our ASAR Integrity tutorial for more information.

  • 添加了 WebContentsViewBaseWindow 主进程模块,弃用并替换了 BrowserView (#35658)。了解更多关于如何在 这篇博文 中从 BrowserView 迁移到 WebContentsView 的信息。

    ¥Added WebContentsView and BaseWindow main process modules, deprecating & replacing BrowserView (#35658). Learn more about how to migrate from BrowserView to WebContentsView in this blog post.

    • BrowserView 现在是 WebContentsView 的垫片,旧的实现已被移除。

      ¥BrowserView is now a shim over WebContentsView and the old implementation has been removed.

    • 请参阅 我们的 Web Embeds 文档,了解新的 WebContentsView API 与其他类似 API 的比较。

      ¥See our Web Embeds documentation for a comparison of the new WebContentsView API to other similar APIs.

  • 实现了对 文件系统 API#41827)的支持

    ¥Implemented support for the File System API (#41827)

技术栈变更

¥Stack Changes

Electron 30 将 Chromium 从 122.0.6261.39 升级到 124.0.6367.49,将 Node 从 20.9.0 升级到 20.11.1,并将 V8 从 12.2 升级到 12.4

¥Electron 30 upgrades Chromium from 122.0.6261.39 to 124.0.6367.49, Node from 20.9.0 to 20.11.1, and V8 from 12.2 to 12.4.

新功能

¥New Features

  • 在 Web 视图中添加了 transparent WebPreference。(#40301)

    ¥Added a transparent webpreference to webviews. (#40301)

  • 在 webContents API 中,通过 navigationHistory.getEntryAtIndex 方法添加了新的实例属性 navigationHistory,使应用能够检索浏览历史记录中任何导航条目的 URL 和标题。(#41662)

    ¥Added a new instance property navigationHistory on webContents API with navigationHistory.getEntryAtIndex method, enabling applications to retrieve the URL and title of any navigation entry within the browsing history. (#41662)

  • 添加了新的 BrowserWindow.isOccluded() 方法,允许应用检查遮挡状态。(#38982)

    ¥Added new BrowserWindow.isOccluded() method to allow apps to check occlusion status. (#38982)

  • 为实用程序进程中使用 net 模块发出的请求添加了代理配置支持。(#41417)

    ¥Added proxy configuring support for requests made with the net module from the utility process. (#41417)

  • navigator.serial 中添加了对通过服务类别 ID 请求蓝牙端口的支持。(#41734)

    ¥Added support for Bluetooth ports being requested by service class ID in navigator.serial. (#41734)

  • 添加了对 Node.js NODE_EXTRA_CA_CERTS CLI 标志的支持。(#41822)

    ¥Added support for the Node.js NODE_EXTRA_CA_CERTS CLI flag. (#41822)

重大变化

¥Breaking Changes

行为改变:跨源 iframe 现在使用权限策略来访问功能

¥Behavior Changed: cross-origin iframes now use Permission Policy to access features

跨源 iframe 现在必须通过 allow 属性指定给定 iframe 可用的功能才能访问它们。

¥Cross-origin iframes must now specify features available to a given iframe via the allow attribute in order to access them.

请参阅 documentation 了解更多信息。

¥See documentation for more information.

删除:--disable-color-correct-rendering 命令行开关

¥Removed: The --disable-color-correct-rendering command line switch

此开关从未正式记录,但无论如何,都会在此处注明其删除。Chromium 本身现在对颜色空间有更好的支持,因此不需要这个标志。

¥This switch was never formally documented but its removal is being noted here regardless. Chromium itself now has better support for color spaces so this flag should not be needed.

行为改变:macOS 上的 BrowserView.setAutoResize 行为

¥Behavior Changed: BrowserView.setAutoResize behavior on macOS

在 Electron 30 中,BrowserView 现在是新 WebContentsView API 的封装器。

¥In Electron 30, BrowserView is now a wrapper around the new WebContentsView API.

此前,BrowserView API 的 setAutoResize 函数在 macOS 上由 autoresizing 支持,在 Windows 和 Linux 上由自定义算法支持。对于简单的用例(例如使 BrowserView 填充整个窗口),这两种方法的行为是相同的。然而,在更高级的情况下,BrowserViews 在 macOS 上的自动调整大小将与在其他平台上不同,因为 Windows 和 Linux 的自定义调整大小算法并不完全匹配 macOS 自动调整大小 API 的行为。自动调整大小行为现已在所有平台上标准化。

¥Previously, the setAutoResize function of the BrowserView API was backed by autoresizing on macOS, and by a custom algorithm on Windows and Linux. For simple use cases such as making a BrowserView fill the entire window, the behavior of these two approaches was identical. However, in more advanced cases, BrowserViews would be autoresized differently on macOS than they would be on other platforms, as the custom resizing algorithm for Windows and Linux did not perfectly match the behavior of macOS's autoresizing API. The autoresizing behavior is now standardized across all platforms.

如果你的应用使用 BrowserView.setAutoResize 执行比让 BrowserView 填充整个窗口更复杂的操作,则你可能已经有自定义逻辑来处理 macOS 上的这种行为差异。如果是这样,Electron 30 将不再需要该逻辑,因为自动调整大小行为是一致的。

¥If your app uses BrowserView.setAutoResize to do anything more complex than making a BrowserView fill the entire window, it's likely you already had custom logic in place to handle this difference in behavior on macOS. If so, that logic will no longer be needed in Electron 30 as autoresizing behavior is consistent.

删除:params.inputFormType 属性于 context-menuWebContents

¥Removed: params.inputFormType property on context-menu on WebContents

WebContents 中的 context-menu 事件中的 params 对象的 inputFormType 属性已被删除。请改用新的 formControlType 属性。

¥The inputFormType property of the params object in the context-menu event from WebContents has been removed. Use the new formControlType property instead.

删除:process.getIOCounters()

¥Removed: process.getIOCounters()

Chromium 已删除对此信息的访问。

¥Chromium has removed access to this information.

27.x.y 支持终止

¥End of Support for 27.x.y

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

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

E30 (2024 年 4 月)E31 (2024 年 6 月)E32 (2024 年 8 月)
30.x.y31.x.y32.x.y
29.x.y30.x.y31.x.y
28.x.y29.x.y30.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.