Skip to main content

Electron 20.0.0

· 7 min read

Electron 20.0.0 已经发布!它包括对 Chromium 104、V8 10.4 和 Node.js 16.15.0 的升级。请往下阅读了解更多详情!

🌐 Electron 20.0.0 has been released! It includes upgrades to Chromium 104, V8 10.4, and Node.js 16.15.0. Read below for more details!


Electron 团队很高兴宣布发布 Electron 20.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或者从我们的 发布网站 下载。继续阅读以了解此版本的详细信息,并请分享你的任何反馈意见!

🌐 The Electron team is excited to announce the release of Electron 20.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 and please share any feedback you have!

Electron 与 V8 内存笼

· 13 min read

Electron 21 及更高版本将启用 V8 内存笼,这将对某些原生模块产生影响。

🌐 Electron 21 and later will have the V8 Memory Cage enabled, with implications for some native modules.


更新 (2022/11/01)

要跟踪关于在 Electron 21 及以上版本中使用本地模块的持续讨论,请参见 electron/electron#35801

🌐 To track ongoing discussion about native module usage in Electron 21+, see electron/electron#35801.

在 Electron 21 中,我们将启用 Electron 中的 V8 沙箱指针,这与 Chrome 在 Chrome 103 中做出的 相同行动 一致。这对原生模块有一些影响。此外,我们之前在 Electron 14 中启用了一个相关技术,指针压缩。当时我们并没有多加讨论,但指针压缩会影响 V8 堆的最大大小。

🌐 In Electron 21, we will be enabling V8 sandboxed pointers in Electron, following Chrome's decision to do the same in Chrome 103. This has some implications for native modules. Also, we previously enabled a related technology, pointer compression, in Electron 14. We didn't talk about it much then, but pointer compression has implications for the maximum V8 heap size.

启用这两项技术在安全性、性能和内存使用方面都有显著的好处。然而,启用它们也有一些缺点。

🌐 These two technologies, when enabled, are significantly beneficial for security, performance and memory usage. However, there are some downsides to enabling them, too.

启用沙箱指针的主要缺点是 不再允许指向外部(“堆外”)内存的 ArrayBuffers。这意味着依赖 V8 中此功能的原生模块需要进行重构,以便在 Electron 20 及更高版本中继续使用。

🌐 The main downside of enabling sandboxed pointers is that ArrayBuffers which point to external ("off-heap") memory are no longer allowed. This means that native modules which rely on this functionality in V8 will need to be refactored to continue working in Electron 20 and later.

启用指针压缩的主要缺点是 V8 堆的最大大小被限制为 4GB。具体细节有些复杂——例如,ArrayBuffers 是单独计算的,不包括在 V8 堆的其他部分,但它们有自己的限制

🌐 The main downside of enabling pointer compression is that the V8 heap is limited to a maximum size of 4GB. The exact details of this are a little complicated—for example, ArrayBuffers are counted separately from the rest of the V8 heap, but have their own limits.

Electron 升级工作组认为指针压缩和 V8 内存隔离的好处大于其缺点。这样做有三个主要原因:

🌐 The Electron Upgrades Working Group believes that the benefits of pointer compression and the V8 memory cage outweigh the downsides. There are three main reasons for doing so:

  1. 它让 Electron 更接近 Chromium。Electron 在 V8 配置等复杂内部细节上与 Chromium 的偏差越小,我们意外引入漏洞或安全问题的可能性就越低。Chromium 的安全团队非常强大,我们希望确保充分利用他们的成果。此外,如果一个漏洞只影响 Chromium 不使用的配置,Chromium 团队修复它的优先级可能不会很高。
  2. 它的性能更好。指针压缩可以将 V8 堆大小减少最多 40%,并将 CPU 和 GC 性能提高 5%–10%。对于绝大多数不会达到 4GB 堆大小限制且不使用需要外部缓冲区的本地模块的 Electron 应用来说,这些都是显著的性能提升。
  3. 它更安全。一些 Electron 应用会运行不受信任的 JavaScript(希望遵循我们的安全建议!),对于这些应用,启用 V8 内存隔离可以保护它们免受大量恶意 V8 漏洞的影响。

最后,对于确实需要更大堆大小的应用,有一些变通方法。例如,可以在你的应用中包含一个禁用了指针压缩的 Node.js 版本,并将内存密集型的工作移到子进程中。虽然有些复杂,但如果你决定针对特定用例进行不同的权衡,也可以构建一个禁用了指针压缩的自定义 Electron 版本。最后,在不久的将来,wasm64 将允许使用 WebAssembly 构建的应用,无论是在网页上还是在 Electron 中,都能使用远超 4GB 的内存。

🌐 Lastly, there are workarounds for apps that really need a larger heap size. For example, it is possible to include a copy of Node.js with your app, which is built with pointer compression disabled, and move the memory-intensive work to a child process. Though somewhat complicated, it is also possible to build a custom version of Electron with pointer compression disabled, if you decide you want a different trade-off for your particular use case. And lastly, in the not-too-distant future, wasm64 will allow apps built with WebAssembly both on the Web and in Electron to use significantly more than 4GB of memory.


常见问题

🌐 FAQ

我如何知道我的应用是否受到此变更的影响?

🌐 How will I know if my app is impacted by this change?

在 Electron 20+ 版本中,尝试用 ArrayBuffer 封装外部内存会导致运行时崩溃。

🌐 Attempting to wrap external memory with an ArrayBuffer will crash at runtime in Electron 20+.

如果你的应用中没有使用任何本地 Node 模块,那么你是安全的——纯 JS 无法触发这种崩溃。此更改仅影响那些在 V8 堆外分配内存(例如使用 mallocnew)并随后使用 ArrayBuffer 封装外部内存的本地 Node 模块。这是一种相对少见的用例,但确实有一些模块使用这种技术,这类模块需要重构才能与 Electron 20 及以上版本兼容。

🌐 If you don't use any native Node modules in your app, you're safe—there's no way to trigger this crash from pure JS. This change only affects native Node modules which allocate memory outside of the V8 heap (e.g. using malloc or new) and then wrap the external memory with an ArrayBuffer. This is a fairly rare use case, but some modules do use this technique, and such modules will need to be refactored in order to be compatible with Electron 20+.

如何测量我的应用使用了多少 V8 堆内存,以了解是否接近 4GB 的限制?

🌐 How can I measure how much V8 heap memory my app is using to know if I'm close to the 4GB limit?

在渲染进程中,你可以使用 performance.memory.usedJSHeapSize,它将返回 V8 堆的使用情况(以字节为单位)。在主进程中,你可以使用 process.memoryUsage().heapUsed,其功能相当。

🌐 In the renderer process, you can use performance.memory.usedJSHeapSize, which will return the V8 heap usage in bytes. In the main process, you can use process.memoryUsage().heapUsed, which is comparable.

什么是 V8 内存笼?

🌐 What is the V8 memory cage?

有些文档将其称为“V8沙箱”,但这个术语容易与在Chromium中发生的其他类型的沙箱混淆,所以我还是使用“内存笼”这个术语。

🌐 Some documents refer to it as the "V8 sandbox", but that term is easily confusable with other kinds of sandboxing that happen in Chromium, so I'll stick to the term "memory cage".

有一种相当常见的 V8 漏洞利用方式如下:

🌐 There's a fairly common kind of V8 exploit that goes something like this:

  1. 在 V8 的 JIT 引擎中找到一个漏洞。JIT 引擎会分析代码,以便能够省略缓慢的运行时类型检查并生成快速的机器码。有时逻辑错误会导致它分析错误,从而省略了实际需要的类型检查——比如,它认为 x 是一个字符串,但实际上它是一个对象。
  2. 利用这种混淆来覆盖 V8 堆中的部分内存,例如,指向 ArrayBuffer 开头的指针。
  3. 现在你有了一个指向任意位置的 ArrayBuffer,因此你可以读取和写入进程中的任何内存,甚至包括 V8 通常无法访问的内存。

V8 内存笼是一种旨在完全防止此类攻击的技术。实现方式是_不在 V8 堆中存储任何指针_。相反,所有对 V8 堆中其他内存的引用都以某个保留区域起始位置的偏移量存储。这样,即使攻击者设法篡改了 ArrayBuffer 的基址,例如通过利用 V8 中的类型混淆错误,最糟糕的情况也只是读取和写入内存笼内的内存,而这些操作他们很可能本来就能做到。
关于 V8 内存笼的工作原理,还有很多资料可以阅读,所以我在这里就不再详细说明——开始阅读的最佳地点可能是 Chromium 团队的高级设计文档

🌐 The V8 memory cage is a technique designed to categorically prevent this kind of attack. The way this is accomplished is by not storing any pointers in the V8 heap. Instead, all references to other memory inside the V8 heap are stored as offsets from the beginning of some reserved region. Then, even if an attacker manages to corrupt the base address of an ArrayBuffer, for instance by exploiting a type confusion error in V8, the worst they can do is read and write memory inside the cage, which they could likely already do anyway. There's a lot more available to read on how the V8 memory cage works, so I won't go into further detail here—the best place to start reading is probably the high-level design doc from the Chromium team.

我想重构一个 Node 原生模块以支持 Electron 21 及以上版本。我该如何做?

🌐 I want to refactor a Node native module to support Electron 21+. How do I do that?

重构原生模块以兼容 V8 内存隔离有两种方法。第一种是在将外部创建的缓冲区传递给 JavaScript 之前,将其复制到 V8 内存隔离中。这通常是一个简单的重构,但当缓冲区很大时,可能会比较慢。另一种方法是使用 V8 的内存分配器来分配你打算最终传给 JavaScript 的内存。这方法稍微复杂一些,但可以避免复制操作,从而在处理大缓冲区时获得更好的性能。

🌐 There are two ways to go about refactoring a native module to be compatible with the V8 memory cage. The first is to copy externally-created buffers into the V8 memory cage before passing them to JavaScript. This is generally a simple refactor, but it can be slow when the buffers are large. The other approach is to use V8's memory allocator to allocate memory which you intend to eventually pass to JavaScript. This is a bit more involved, but will allow you to avoid the copy, meaning better performance for large buffers.

为了更具体说明,以下是一个使用外部数组缓冲区的 N-API 模块示例:

🌐 To make this more concrete, here's an example N-API module that uses external array buffers:

// Create some externally-allocated buffer.
// |create_external_resource| allocates memory via malloc().
size_t length = 0;
void* data = create_external_resource(&length);
// Wrap it in a Buffer--will fail if the memory cage is enabled!
napi_value result;
napi_create_external_buffer(
env, length, data,
finalize_external_resource, NULL, &result);

当启用内存笼时,这将会崩溃,因为数据是在笼子之外分配的。通过重构将数据复制到笼子中,我们得到:

🌐 This will crash when the memory cage is enabled, because data is allocated outside the cage. Refactoring to instead copy the data into the cage, we get:

size_t length = 0;
void* data = create_external_resource(&length);
// Create a new Buffer by copying the data into V8-allocated memory
napi_value result;
void* copied_data = NULL;
napi_create_buffer_copy(env, length, data, &copied_data, &result);
// If you need to access the new copy, |copied_data| is a pointer
// to it!

这将把数据复制到 V8 内存范围内新分配的内存区域中。可选地,N-API 也可以提供指向新复制数据的指针,以防你之后需要修改或引用它。

🌐 This will copy the data into a newly-allocated memory region that is inside the V8 memory cage. Optionally, N-API can also provide a pointer to the newly-copied data, in case you need to modify or reference it after the fact.

重构以使用 V8 的内存分配器要复杂一些,因为这需要修改 create_external_resource 函数以使用 V8 分配的内存,而不是使用 malloc。这在多大程度上可行取决于你是否能够控制 create_external_resource 的定义。思路是先使用 V8 创建缓冲区,例如通过 napi_create_buffer,然后将资源初始化到 V8 分配的内存中。在资源的生命周期内保留对 Buffer 对象的 napi_ref 是很重要的,否则 V8 可能会回收该 Buffer,从而可能导致使用后释放的错误。

🌐 Refactoring to use V8's memory allocator is a little more complicated, because it requires modifying the create_external_resource function to use memory allocated by V8, instead of using malloc. This may be more or less feasible, depending on whether or not you control the definition of create_external_resource. The idea is to first create the buffer using V8, e.g. with napi_create_buffer, and then initialize the resource into the memory that has been allocated by V8. It is important to retain a napi_ref to the Buffer object for the lifetime of the resource, otherwise V8 may garbage-collect the Buffer and potentially result in use-after-free errors.

Electron 19.0.0

· 5 min read

Electron 19.0.0 已经发布!它包括对 Chromium 102、V8 10.2 和 Node.js 16.14.2 的升级。请往下阅读了解更多详情!

🌐 Electron 19.0.0 has been released! It includes upgrades to Chromium 102, V8 10.2, and Node.js 16.14.2. Read below for more details!


Electron 团队很高兴宣布发布 Electron 19.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或者从我们的 发布网站 下载。继续阅读以了解此版本的详细信息,并请分享你的任何反馈意见!

🌐 The Electron team is excited to announce the release of Electron 19.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 and please share any feedback you have!

Electron 发布节奏变更

🌐 Electron Release Cadence Change

该项目正在回归其早期的政策,支持最近的三个主要版本。请参阅我们的版本文档以获取有关 Electron 版本和支持的更详细信息。为了帮助用户适应从 Electron 15 开始的新发布节奏,这一政策曾暂时扩展为支持四个主要版本。你可以在此处阅读完整详情

🌐 The project is returning to its earlier policy of supporting the latest three major versions. See our versioning document for more detailed information about Electron versioning and support. This had temporarily been four major versions to help users adjust to the new release cadence that began in Electron 15. You can read the full details here.

S3 存储桶迁移

· 4 min read

Electron 正在更改其主要的 S3 存储桶,你可能需要更新构建脚本。

🌐 Electron is changing its primary S3 bucket, you may need to update your build scripts


发生了什么?

🌐 What is happening?

大量 Electron 的构建产物会上传到名为 gh-contractor-zcbenz 的 S3 存储桶。作为自 2020 年开始的持续基础设施/所有权迁移的一部分,我们将把所有使用 gh-contractor-zcbenz 的内容从其在 S3 的旧位置迁移到托管在 https://artifacts.electronjs.org 的新存储系统。我们大部分资源使用的路径前缀也会有所变化。示例如下:

🌐 A significant amount of Electron's build artifacts are uploaded to an S3 bucket called gh-contractor-zcbenz. As part of ongoing infrastructure/ownership migrations that started way back in 2020, we will be changing everything that used gh-contractor-zcbenz from its old home in S3 to a new storage system hosted at https://artifacts.electronjs.org. The path prefix that most of our assets use is changing slightly as well. Examples are included below:

之前: https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/v17.0.0/node.lib 之后: https://artifacts.electronjs.org/headers/dist/v17.0.0/node.lib

这里重要的是 主机名 已更改,以及 /atom-shell 前缀 已更改。另一个例子,这次是针对调试符号的:

🌐 The important things here are the Hostname changed and the /atom-shell prefix changed. Another example, this time for debug symbols:

之前: https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/symbols/path/to/symbol.pdb 之后: https://artifacts.electronjs.org/symbols/path/to/symbol.pdb

再次,主机名发生了变化,并且 /atom-shell 前缀也被更改了。

🌐 Again, the hostname changed and the /atom-shell prefix was changed.

这会对你有什么影响?

🌐 How might this impact you?

任何使用标准构建工具如 electron-rebuildelectron-packager@electron/get 的人无需做任何操作。这应该适用于大多数人。

🌐 Anyone using standard build tooling such as electron-rebuild, electron-packager or @electron/get won't have to do anything. This should be the majority of people.

对于直接引用 S3 存储桶的任何人,你必须更新引用以指向主机名并更新路径。

🌐 For anyone directly referencing the S3 bucket, you must update your reference to point at the hostname and update the path as well.

现有数据怎么办?

🌐 What about existing data?

大部分存在于 gh-contractor-zcbenz 桶中的数据已经克隆到新的存储系统中。这意味着所有调试符号和所有头文件都已被复制。如果你依赖于该桶中的某些尚未被复制的数据,请在 electron/electron 提出问题并告知我们。

🌐 Most data that existed on the gh-contractor-zcbenz bucket has been cloned into the new storage system. This means all debug symbols and all headers have been copied. If you relied on some data in that bucket that hasn't been copied over please raise an issue in electron/electron and let us know.

当前的 gh-contractor-zcbenz S3 存储桶不会被主动删除。但是,我们无法保证该存储桶会保持可用多久。我们强烈建议尽快更新以指向新的存储桶。

🌐 The current gh-contractor-zcbenz S3 bucket will not be actively deleted. However, we can't guarantee how long that bucket will be left alive. We strongly recommend updating to target the new bucket as soon as possible.

Electron 18.0.0

· 7 min read

Electron 18.0.0 已经发布!它包括对 Chromium 100、V8 10.0 和 Node.js 16.13.2 的升级。请往下阅读了解更多详情!

🌐 Electron 18.0.0 has been released! It includes upgrades to Chromium 100, V8 10.0, and Node.js 16.13.2. Read below for more details!


Electron 团队很高兴宣布发布 Electron 18.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或者从我们的 发布网站 下载。继续阅读以了解此版本的详细信息,并请分享你的任何反馈意见!

🌐 The Electron team is excited to announce the release of Electron 18.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 and please share any feedback you have!

Electron 发布节奏变更

🌐 Electron Release Cadence Change

从 Electron 15 开始,Electron 将每 8 周发布一个新的主要稳定版本。你可以在这里阅读完整详情。

🌐 As of Electron 15, Electron will release a new major stable version every 8 weeks. You can read the full details here.

此外,Electron 将支持的版本范围从最新的三个版本改为截至 2022 年 5 月的最新四个版本。查看我们的版本控制文档以获取有关 Electron 版本控制的详细信息。在 2022 年 5 月之后,我们将恢复支持最新的三个版本。

🌐 Additionally, Electron has changed supported versions from latest three versions to latest four versions until May 2022. See our versioning document for more detailed information about versioning in Electron. After May 2022, we will return to supporting latest three versions.

显著变化

🌐 Notable Changes

  • 已添加用于设置代码缓存目录的 ses.setCodeCachePath() API。#33286
  • 移除了基于旧 BrowserWindowProxywindow.open 实现。这也从 webPreferences 中移除了 nativeWindowOpen 选项。#29405
  • 已向 WebContents 添加“focus”和“blur”事件。#25873
  • 在 macOS 上添加了替换菜单角色:showSubstitutionstoggleSmartQuotestoggleSmartDashestoggleTextReplacement#32024
  • app.requestSingleInstanceLock() 进程中添加了 first-instance-ack 事件,允许用户将数据从第一个实例无缝传输到第二个实例。#31460
  • setBackgroundColor 中增加了对更多颜色格式的支持。 #33364

请查看 18.0.0 版本说明 以获取新功能和更改的完整列表。

🌐 See the 18.0.0 release notes for a full list of new features and changes.

谷歌2022夏季编程项目

· 4 min read

Electron 团队非常高兴地宣布,我们将在今年首次参加 Google Summer of Code!

🌐 The Electron team is excited to announce that we will be participating in Google Summer of Code for the first time this year!


什么是 Google Summer of Code?

🌐 What is Google Summer of Code?

谷歌夏季编码计划(GSoC)是一个年度指导项目,将开源软件项目与潜在贡献者联系起来。以前仅对学生开放,现在任何18岁及以上的人都可以注册GSoC。

🌐 Google Summer of Code (GSoC) is a yearly mentoring program connecting open source software projects with potential contributors. Previously open only to students, anyone ages 18 and up can now register for GSoC.

欲了解更多信息,请查看代码之夏主页

🌐 For more information, check out the Summer of Code homepage.

如何注册?

🌐 How do I sign up?

你有兴趣与 Electron 合作吗?如果你是新的或初学的开源贡献者,我们欢迎你申请!

🌐 Are you interested in collaborating with Electron? If you are a new or beginner open source contributor, we welcome you to apply!

为了被选为 Google 夏季编码计划的 Electron 贡献者,你需要提交申请。申请将于 2022 年 4 月 4 日 开放,并于 2022 年 4 月 19 日 关闭。你可以在这里关注 Google 夏季编码申请指南的最新信息

🌐 In order to be selected as an Electron contributor for Google Summer of Code, you will need to submit an application. Applications will open on April 4th, 2022 and close on April 19th, 2022. You can follow updates for Google: Summer of Code application guidelines here.

想要申请吗?首先,请查看我们准备的五个项目创意草案。所有列出的创意目前都接受提案。我们也欢迎提交不在提议项目列表中的新创意。

🌐 Want to apply? First, check out the five project idea drafts that we have prepared. All of the listed ideas are currently open for proposals. We are also open to accepting new ideas that are not on the proposed project list.

你的应用应包含:

🌐 Your application should include:

  • 你的提案,即一份书面文件,详细描述了你计划在夏季实现的目标。
  • 你的开发者背景。如果你有简历,请附上复印件,否则请告诉我们你的过去经历,并强调与相关技术经验相关的部分。

关于作为你 Electron 应用提交内容的详细指南,请点击这里。

你也可以阅读官方GSoC学生/贡献者指南,了解准备提案的重要提示。

🌐 You can also read through the official GSoC student/contributor guide for important tips on preparing your proposal.

如果你想讨论项目提案或有任何问题,来我们的 #gsoc-general Discord 通道 一起聊聊吧!

🌐 If you want to discuss project proposals or have questions, come hang out in our #gsoc-general Discord channel!

参考

🌐 References

Electron 17.0.0

· 6 min read

Electron 17.0.0 已经发布!它包括对 Chromium 98、V8 9.8 和 Node.js 16.13.0 的升级。请往下阅读了解更多详情!

🌐 Electron 17.0.0 has been released! It includes upgrades to Chromium 98, V8 9.8, and Node.js 16.13.0. Read below for more details!


Electron 团队很高兴宣布发布 Electron 17.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或者从我们的 发布网站 下载。继续阅读以了解此版本的详细信息,并请分享你的任何反馈意见!

🌐 The Electron team is excited to announce the release of Electron 17.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 and please share any feedback you have!

Electron 发布节奏变更

🌐 Electron Release Cadence Change

从 Electron 15 开始,Electron 将每 8 周发布一个新的主要稳定版本。你可以在这里阅读完整详情。

🌐 As of Electron 15, Electron will release a new major stable version every 8 weeks. You can read the full details here.

此外,Electron 将支持的版本范围从最新的三个版本改为截至 2022 年 5 月的最新四个版本。查看我们的版本控制文档以获取有关 Electron 版本控制的详细信息。在 2022 年 5 月之后,我们将恢复支持最新的三个版本。

🌐 Additionally, Electron has changed supported versions from latest three versions to latest four versions until May 2022. See our versioning document for more detailed information about versioning in Electron. After May 2022, we will return to supporting latest three versions.

显著变化

🌐 Notable Changes

  • 添加了 webContents.getMediaSourceId(),可以与 getUserMedia 一起使用以获取 WebContents 的流。 #31204
  • 弃用 webContents.getPrinters() 并引入 webContents.getPrintersAsync()#31023
  • desktopCapturer.getSources 现在仅在主进程中可用。#30720

请查看 17.0.0 发布说明 以获取新功能和更改的完整列表。

🌐 See the 17.0.0 release notes for a full list of new features and changes.

Spectron 弃用通知

· 4 min read

Spectron 将于 2022 年 2 月 1 日弃用。

🌐 Spectron will be deprecated on February 1st, 2022.


从2022年2月开始,Spectron 将被 Electron 团队正式弃用

🌐 Beginning in February 2022, Spectron will be officially deprecated by the Electron team.

为什么要弃用 Spectron?

🌐 Why Deprecate Spectron?

虽然 Spectron 一直为每个新版本的 Electron 发布新版本,但该项目的维护和改进已经非常少持续了一年多,目前没有全职维护者。随着远程模块从 Electron 核心移出并在 Electron 14 中成为外部模块,Spectron 将需要进行重大重写才能继续可靠运行。

🌐 While Spectron has consistently put out new releases for each new version of Electron, the project has had very little maintenance and improvements for well over a year, and currently has no full-time maintainers. With the remote module moving outside of Electron core and into an external module in Electron 14, Spectron will require a major rewrite to continue working reliably.

在审查了 Spectron 持续维护的几个可用选项后,Electron 团队决定在 2022 年弃用 Spectron。

🌐 After reviewing several available options for Spectron's continued maintenance, the Electron team has decided to deprecate Spectron in 2022.

弃用时间表

🌐 Deprecation Timeline

以下是我们计划的弃用时间表:

🌐 The following is our planned deprecation timeline:

  • 2021年11月 - 2022年1月:Electron 团队将继续接受社区的拉取请求。
  • 2022年1月:将发布关于Spectron弃用的最终警告公告版本。
  • 2022年2月1日:Spectron 的仓库将被标记为“已归档”。不再接受任何拉取请求。

自2022年2月1日之后,Electron 将继续无限期保留 Spectron 仓库,以便他人可以分叉或使用现有代码进行项目开发。我们希望这能为仍依赖 Spectron 的项目提供更长的过渡时间。

🌐 Following February 1st, 2022, Electron will continue to leave the Spectron repo up indefinitely, so that others are welcome to fork or use the existing code for their projects. We hope this will help provide a longer transition to any projects that may still depend on Spectron.

Spectron 的替代方案

🌐 Alternatives to Spectron

如果你当前在项目中使用 Spectron 并希望迁移到其他测试解决方案,你可以阅读我们的自动化测试指南

🌐 If you're currently using Spectron in your project and would like to migrate to an alternative testing solution, you can read our guide for automated testing here.

我们目前还有其他几个推荐替代 Spectron 的方案,包括 Playwright 和 WebDriverIO。每个选项的官方教程可以在我们的自动化测试文档中找到。

🌐 We currently have several other recommended alternatives to Spectron, including Playwright and WebDriverIO. Official tutorials for each option can be found in our Automated Testing documentation.

下一步计划

🌐 What's Next

我们 Electron 团队感谢你使用 Spectron 和 Electron。我们理解许多人依赖 Spectron 来测试应用,因此我们希望尽可能让你在过渡进程中感到轻松。感谢你选择 Electron!

🌐 We here on the Electron team appreciate you using Spectron and Electron. We understand that many of you depend on Spectron for testing your apps, and we want to make this transition as painless for you as possible. Thank you for choosing Electron!

Electron 16.0.0

· 8 min read

Electron 16.0.0 已经发布!它包括对 Chromium 96、V8 9.6 和 Node.js 16.9.1 的升级。请往下阅读了解更多详情!

🌐 Electron 16.0.0 has been released! It includes upgrades to Chromium 96, V8 9.6, and Node.js 16.9.1. Read below for more details!


Electron 团队很高兴宣布发布 Electron 16.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或者从我们的 发布网站 下载。继续阅读以了解此版本的详细信息,并请分享你的任何反馈意见!

🌐 The Electron team is excited to announce the release of Electron 16.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 and please share any feedback you have!

Electron 发布节奏变更

🌐 Electron Release Cadence Change

从 Electron 15 开始,Electron 将每 8 周发布一个新的主要稳定版本。你可以在这里阅读完整详情。

🌐 As of Electron 15, Electron will release a new major stable version every 8 weeks. You can read the full details here.

此外,Electron 将支持的版本范围从最新的三个版本改为截至 2022 年 5 月的最新四个版本。查看我们的版本控制文档以获取有关 Electron 版本控制的详细信息。在 2022 年 5 月之后,我们将恢复支持最新的三个版本。

🌐 Additionally, Electron has changed supported versions from latest three versions to latest four versions until May 2022. See our versioning document for more detailed information about versioning in Electron. After May 2022, we will return to supporting latest three versions.

显著变化

🌐 Notable Changes

  • 现在支持 WebHID API。 #30213
  • app.requestSingleInstanceLock 添加数据参数,以便在实例之间共享数据。#30891
  • 将 securityOrigin 传递给媒体权限请求处理程序。#31357
  • 添加 commandLine.removeSwitch#30933

请查看 16.0.0 发布说明 以获取所有新功能和更改的完整列表。

🌐 See the 16.0.0 release notes for a full list of new features and changes.

寂静之地(2021年12月)

· 3 min read

Electron 项目将在 2021 年 12 月暂停,然后在 2022 年 1 月恢复全速运行。

🌐 The Electron project will pause for the month of December 2021, then return to full speed in January 2022.

via GIPHY


12 月会有什么相同之处?

🌐 What will be the same in December

  1. 零日漏洞及其他主要的安全相关版本将在必要时发布。安全事件应通过 SECURITY.md 报告。
  2. 行为准则 的举报和管理将继续进行。

12 月会有什么不同?

🌐 What will be different in December

  1. 十二月没有新的 Beta 或稳定版发布。十二月的最后两周没有 Nightly 版本发布。
  2. 除了少数例外,无需进行拉取请求审核或合并。
  3. 任何代码库均未更新问题跟踪器。
  4. 维护人员未提供 Discord 调试帮助。
  5. 无需更新社交媒体内容。

为什么会发生这种情况?

🌐 Why is this happening?

总之,尽管维护者对项目感到满意并积极参与,但_世界已经疲惫不堪_。十二月是大多数公司相对平静的月份,因此我们希望给维护者一个充电的机会。我们鼓励其他项目也考虑采取类似的措施。

🌐 In short, while maintainers are happy and engaged with the project, THE WORLD IS TIRED. December is a quiet month for most companies, so we want to give our maintainers a chance to recharge. We encourage other projects to consider similar measures.

我应该担心 Electron 的未来吗?

🌐 Should I be worried about the future of Electron?

不行。我们之所以能采取这一步,是因为项目状况良好。大家都在期待2022年,并且我们期待好事将至!

🌐 No. We are able to take this step because the project is in good shape. Everyone is looking forward to 2022, and we expect good things to come!