Skip to main content

Electron 44

· 16 min read

Electron 44 已经发布啦!它包含 Chromium 152.0.7977.54、V8 15.2 和 Node v24.18.1 的升级。

🌐 Electron 44 has been released! It includes upgrades to Chromium 152.0.7977.54, V8 15.2, and Node v24.18.1.


Electron 团队很高兴地宣布 Electron 44 正式发布!你可以通过 npm install electron@latest 用 npm 安装,或者从我们的发布网站 下载。继续往下看看本次发布的详细信息吧。

🌐 The Electron team is excited to announce the release of Electron 44! 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

clipboard 模块现在与 W3C 剪贴板 API 对齐了

🌐 The clipboard module now aligns with the W3C Clipboard API

Electron 的 clipboard 模块已经重新设计,以符合 W3C 剪贴板 API。它的读取和写入方法现在都是异步的,新的 ClipboardItem 类提供了一个基于 MIME 的接口来处理剪贴板数据。在 Linux 上,现在可以通过 clipboard.selection 命名空间访问选择剪贴板。有关迁移的详细信息,请参见 RFC 0019计划中的重大更改文档#52508

🌐 Electron's clipboard module has been rearchitected to align with the W3C Clipboard API. Its read and write methods are now asynchronous, and the new ClipboardItem class provides a MIME-based interface for working with clipboard data. On Linux, the selection clipboard is now available through the clipboard.selection namespace. See RFC 0019 and the planned breaking changes document for migration details. #52508

作为这次更改的一部分,clipboard 模块不再直接向渲染进程暴露。渲染器应该使用 navigator.clipboard,或者通过 contextBridge 从预加载脚本中小心地只暴露所需的功能。

🌐 As part of this change, the clipboard module is no longer exposed directly to renderer processes. Renderers should use navigator.clipboard, or carefully expose only the required functionality from a preload script through contextBridge.

跨平台窗口状态持久化

🌐 Cross-platform window state persistence

Electron 44 增加了用于保存和恢复窗口状态的 API。在 BaseWindowBrowserWindow 构造函数中设置 windowStatePersistence: true 并提供唯一的 name,即可在多次启动之间保留窗口的位置、大小和显示模式。应用可以选择性地保留边界或显示模式,并使用 BaseWindow.clearPersistedState() 清除已保存的状态。详情请参见 窗口状态持久化教程#52270

🌐 Electron 44 adds API for saving and restoring window state. Set windowStatePersistence: true and provide a unique name in the BaseWindow or BrowserWindow constructor to preserve the window's position, size, and display mode across launches. Applications can selectively persist bounds or display modes, and clear saved state with BaseWindow.clearPersistedState(). See the Window State Persistence tutorial for details. #52270

改进的 Linux 桌面整合

🌐 Improved Linux desktop integration

Electron 44 在 Linux 上恢复了 app.setBadgeCount()win.setProgressBar(),无需 libunity。这些 API 现在可以在实现了 LauncherEntry D-Bus API 的停靠栏和任务栏上使用。本次更新还增加了 win.setOpacity() 支持、系统主题的窗口控制覆盖图标,以及其他针对无边框窗口的改进。#52895 #51455 #52531

🌐 Electron 44 restores app.setBadgeCount() and win.setProgressBar() on Linux without requiring libunity. These APIs now work with docks and taskbars that implement the LauncherEntry D-Bus API. This release also adds win.setOpacity() support, system-themed Window Controls Overlay icons, and other improvements for frameless windows on Linux. #52895 #51455 #52531

技术栈变更

🌐 Stack Changes

Electron 44 将 Chromium 从 150.0.7871.46 升级到 152.0.7977.54,Node.js 从 v24.17.0 升级到 v24.18.1,V8 从 15.0 升级到 15.2

🌐 Electron 44 upgrades Chromium from 150.0.7871.46 to 152.0.7977.54, Node.js from v24.17.0 to v24.18.1, and V8 from 15.0 to 15.2.

新功能和改进

🌐 New Features and Improvements

  • 在 Linux 上将 available 添加到 process.getSystemMemoryInfo(),从 /proc/meminfo 暴露出 MemAvailable#52380 (也在 42, 43)
  • 添加了 net.WebSocket,一个与 WHATWG 兼容的 WebSocket 客户端,用于主进程,通过 Chromium 的网络栈路由。 #51593 (也在 42, 43)
  • 为每个 WebContents 添加了 webContents.setZoomMode(mode)webContents.getZoomMode()webContents.zoomMode 来控制缩放。#49962
  • 添加了 webFrameMain.printToPDF(),以允许从主进程将单个帧打印到 PDF。#52625 (也在 4243 中)
  • BaseWindowBrowserWindow 中添加了 windowStatePersistence,用于在多次启动之间保存和恢复窗口边界和显示模式。 #52270
  • 在 macOS 14 及更高版本中,向 MenuItem 添加了一个 badge 属性,可在菜单项标签旁显示计数或自定义文本徽章。#53046
  • 在 Linux 上添加了对 win.setOpacity(opacity) 的支持。 #51455
  • WebContents 中添加了 webContents.caretBrowsingEnabled 用于切换插入符号浏览。 #53035
  • Linux 上的无框窗口现在在窗口控制覆盖上使用系统主题的标题栏图标。#52531
  • 已为 Linux 恢复 app.setBadgeCount()win.setProgressBar()。这些 API 现在支持任何实现了 LauncherEntry D-Bus API 的停靠栏或任务栏,并且它们不再需要 libunity#52895
  • 对初始化和进程间通信(IPC)进行了各种性能改进。#53017 (也在4243)
  • 通过在工具包初始化期间跳过 GDK 的 OpenGL 探测并在主线程之外加载 FontConfig,提升了 Linux 上的应用启动速度。 #53107 (也包含在 43)
  • 通过使用 Electron 生成的 PGO 配置文件而不是 Chrome 发布的配置文件,提升了运行时性能。#51815 (也在 42, 43)
  • 改进了 utilityProcess.fork()child_process.fork()ELECTRON_RUN_AS_NODE 子进程以及支持 Node.js 的渲染器的启动时间。 #53134 (也在 42, 43)
  • Linux arm64、Windows arm64 和 macOS x64 构建现在像其他平台一样,从嵌入的 Node.js 启动快照启动主进程。#52879 (也在 4243)
  • 减少了由 Node.js 定时器和立即执行引起的空闲主进程 CPU 唤醒。 #52906 (也在 43)
  • 通过只提供 Electron 可以使用的本地化字符串和资源,将 Linux 发行版的大小减少了大约 37 MB。#51804
  • 第一个沙盒化的 BrowserWindow 现在会在默认会话已经存在时,提前启动的渲染进程中启动。打开很多窗口的应用可以用 --enable-features=SpareRendererForSitePerProcess 保持一个备用渲染器处于活跃状态。#53144

重大变化

🌐 Breaking Changes

已移除:macOS 12 支持

🌐 Removed: macOS 12 support

macOS 12(Monterey)不再被 Chromium 支持。较早版本的 Electron 仍然可以在 Monterey 上运行,但要运行 Electron 44 及以上版本,则需要 macOS 13(Ventura)或更高版本。 #51967

🌐 macOS 12 (Monterey) is no longer supported by Chromium. Older versions of Electron will continue to run on Monterey, but macOS 13 (Ventura) or later is required to run Electron 44 and higher. #51967

行为已改变:webContentsselect-client-certificate 中可能是 null

🌐 Behavior Changed: webContents may be null in select-client-certificate

app 'select-client-certificate' 事件现在也会在通过 net 模块发出的请求以及使用 respondToAuthRequestsFromMainProcess: true 创建的工具进程时触发。对于这些请求,webContents 参数的值是 null。处理该事件的应用在使用该参数之前必须先检查它。#52397

🌐 The app 'select-client-certificate' event is now also emitted for requests made through the net module and for utility processes created with respondToAuthRequestsFromMainProcess: true. For these requests, the webContents argument is null. Applications handling the event must check the argument before using it. #52397

这也意味着 net.request()net.fetch() 现在可以选择客户端证书,而不是在服务器请求时因为 ERR_SSL_CLIENT_AUTH_CERT_NEEDED 而失败。

🌐 This also means that net.request() and net.fetch() can now select a client certificate instead of failing with ERR_SSL_CLIENT_AUTH_CERT_NEEDED when a server requests one.

行为已更改:ANGLE 在所有平台上都是静态链接的

🌐 Behavior Changed: ANGLE is statically linked on all platforms

ANGLE 现在已经在所有平台上以静态链接方式集成到 Electron 二进制文件中,与上游 Chromium 保持一致。libEGL.(so|dylib|dll)libGLESv2.(so|dylib|dll) 库不再提供。那些通过替换这些库来替换或管理自己 ANGLE 版本的应用现在无法再这样做了。#52288

🌐 ANGLE is now statically linked into the Electron binary on all platforms, matching upstream Chromium. The libEGL.(so|dylib|dll) and libGLESv2.(so|dylib|dll) libraries are no longer shipped. Applications that replaced or managed their own ANGLE versions by swapping these libraries can no longer do so. #52288

行为更改:net.request 会拒绝没有导航模式的框架目标

🌐 Behavior Changed: net.request rejects frame destinations without navigate mode

net.request 现在会拒绝当 Sec-Fetch-Destdocumentframeiframefencedframe 的请求,除非 Sec-Fetch-Mode 也设置为 navigate。这符合 Chromium 的规定,即框架类型的请求目标必须是导航。#52216

已移除:Linux 上的 Unity 桌面环境支持

🌐 Removed: Unity desktop environment support on Linux

Electron 不再在 Linux 上提供针对 Unity 的特定集成,并且 app.isUnityRunning() 已被移除。Electron 仍然支持现代的 Freedesktop 标准。 #51649

🌐 Electron no longer provides Unity-specific integration on Linux, and app.isUnityRunning() has been removed. Electron continues to support modern Freedesktop standards. #51649

已移除:Windows 32位和Linux 32位ARM支持

🌐 Removed: Windows 32-bit and Linux 32-bit ARM support

Electron 不再为 Windows x86(win32-ia32)或 Linux ARM(linux-armv7l)发布预构建二进制文件。Electron 44 及更高版本只为 64 位 x64 和 arm64 平台发布。较旧的 Electron 版本将在 Electron 43 系列于 2027 年 1 月结束生命周期之前继续支持这些平台。#52326

🌐 Electron no longer publishes prebuilt binaries for Windows x86 (win32-ia32) or Linux ARM (linux-armv7l). Electron 44 and higher are published only for 64-bit x64 and arm64 platforms. Older Electron versions will continue to support these platforms until the Electron 43 series reaches end-of-life in January 2027. #52326

已移除:渲染进程对 clipboard 模块的访问

🌐 Removed: clipboard module access from renderer processes

clipboard 模块不再直接暴露给渲染进程。渲染进程应该使用网页平台的 navigator.clipboard API。对于更高级的用例,只需通过 contextBridge 从预加载脚本中暴露所需的辅助功能,同时注意不要向不受信任的内容暴露剪贴板访问权限。#52508

🌐 The clipboard module is no longer exposed directly to renderer processes. Renderers should use the web platform's navigator.clipboard API. For more advanced use cases, expose only the required helpers from a preload script through contextBridge, taking care not to expose clipboard access to untrusted content. #52508

API 已更改:clipboard 模块已重新架构,以符合 W3C 剪贴板 API

🌐 API Changed: clipboard module rearchitected to align with the W3C Clipboard API

clipboard 模块的 read()write()readText()writeText()has() 方法现在都是异步的。剪贴板数据由新的 ClipboardItem 类表示,而像 readImage()writeHTML()availableFormats() 这样范围很小的辅助方法已经被移除了。Linux 的选择剪贴板现在可以通过 clipboard.selection 使用。完整的 API 映射和示例请参见 迁移指南#52508

🌐 The clipboard module's read(), write(), readText(), writeText(), and has() methods are now asynchronous. Clipboard data is represented by the new ClipboardItem class, and narrowly scoped helpers such as readImage(), writeHTML(), and availableFormats() have been removed. The Linux selection clipboard is now available through clipboard.selection. See the migration guide for the full API mapping and examples. #52508

已移除:macOS 13 之前的登录项属性

🌐 Removed: Pre-macOS 13 login item attributes

app.setLoginItemSettings() 已经移除了 openAsHidden 选项,同时 app.getLoginItemSettings() 的返回值中也移除了 openAsHiddenwasOpenedAsHiddenrestoreState 字段。这些属性只在 macOS 12 及更早版本上有效,而 Electron 44 已经不再支持这些版本。#52667

🌐 The openAsHidden option has been removed from app.setLoginItemSettings(), and the openAsHidden, wasOpenedAsHidden, and restoreState fields have been removed from the return value of app.getLoginItemSettings(). These attributes only worked on macOS 12 and earlier, which Electron 44 no longer supports. #52667

41.x.y版本停止支持

🌐 End of Support for 41.x.y

根据项目的支持政策,Electron 41.x.y 已经达到支持结束。我们建议开发者和应用升级到更新版本的 Electron。可以访问 https://releases.electronjs.org/schedule 查看 Electron 支持版本的时间表。

🌐 Electron 41.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. See https://releases.electronjs.org/schedule to see the timeline for supported versions of Electron.

下一步计划

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