Electron 9.0.0
Electron 9.0.0 已经发布!它包括对 Chromium 83、V8 8.3 和 Node.js 12.14 的升级。我们为拼写检查器功能添加了几个新的 API 集成,启用了 PDF 查看器功能,还有更多更新!
🌐 Electron 9.0.0 has been released! It includes upgrades to Chromium 83, V8 8.3, and Node.js 12.14. We've added several new API integrations for our spellchecker feature, enabled PDF viewer, and much more!
Electron 团队很高兴地宣布 Electron 9.0.0 正式发布!你可以通过 npm 使用 npm install electron@latest 安装,或从我们的发布网站下载。本次发布包含了大量升级、修复和新功能。我们迫不及待想看看你会用它们创造出什么作品!继续阅读以了解本次发布的详细信息,并请分享你的任何反馈!
🌐 The Electron team is excited to announce the release of Electron 9.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. The release is packed with upgrades, fixes, and new features. We can't wait to see what you build with them! Continue reading for details about this release, and please share any feedback you have!
显著变化
🌐 Notable Changes
请查看 9.0.0 版本说明 以获取完整的新功能和更改列表。
🌐 See the 9.0.0 release notes for a full list of new features and changes.
技术栈变更
🌐 Stack Changes
- Chromium
83.0.4103.64 - Node.js
12.14.1 - V8
8.3
重大变化
🌐 Breaking Changes
- 在未使用
enableRemoteModule: true的情况下使用remote会出现弃用警告。 #21546- 这是我们计划弃用
remote模块并将其移至用户空间的第一步。你可以阅读并关注此问题,其中详细说明了我们的原因,并包含了建议的弃用时间表。
- 这是我们计划弃用
- 默认将
app.enableRendererProcessReuse设置为 true。#22336- 这是为未来需求而进行的持续工作,即渲染进程中加载的本地 Node 模块必须是 N-API 或 Context Aware。完整信息和拟议时间表详见 此问题。
- 通过 IPC 发送非 JavaScript 对象现在会抛出异常。 #21560
- 在 Electron 8.0 中,此行为已被弃用。在 Electron 9.0 中,旧的序列化算法已被移除,发送此类不可序列化的对象现在会抛出“对象无法克隆”错误。
有关这些和未来更改的更多信息,请参阅计划中的重大更改页面。
🌐 More information about these and future changes can be found on the Planned Breaking Changes page.
API 变更
🌐 API Changes
shellAPI 变更:shell.openItemAPI 已被异步的shell.openPath API替代。 提案
sessionAPI 变更:appAPI 变更:- 在 macOS 的
app.focus()中添加了一个新的强制参数,以允许应用强制获取焦点。 #23447
- 在 macOS 的
BrowserWindowAPI 变更:- 为
BrowserWindow上的某些 getter/setter 对添加了属性访问支持。 #23208
- 为
已弃用的 API
🌐 Deprecated APIs
以下 API 现已弃用或删除:
🌐 The following APIs are now deprecated or removed:
shell.openItemAPI 现已弃用,已被异步的shell.openPath API替代。<webview>.getWebContents在 Electron 8.0 中已被弃用,现在已被移除。webFrame.setLayoutZoomLevelLimits在 Electron 8.0 中已被弃用,现在已被移除。
6.x.y 停止支持
🌐 End of Support for 6.x.y
根据该项目的支持政策,Electron 6.x.y 已停止支持。建议开发者和应用升级到更新版本的 Electron。
🌐 Electron 6.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.
下一步计划
🌐 What's Next
在短期内,你可以预期团队将继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。虽然我们谨慎地不对发布日期做出承诺,但我们的计划是大约每季度发布一次包含这些组件新版本的 Electron 主要版本。初步的 10.0.0 计划 列出了 Electron 10.0 开发生命周期中的关键日期。此外,请参阅我们的版本控制文档 以获取关于 Electron 版本控制的更详细信息。
🌐 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. Although we are careful not to make promises about release dates, our plan is release new major versions of Electron with new versions of those components approximately quarterly. The tentative 10.0.0 schedule maps out key dates in the Electron 10.0 development life cycle. Also, see our versioning document for more detailed information about versioning in Electron.
有关即将发布的 Electron 版本中计划的重大更改的信息,请参阅我们的计划中的重大更改文档。
🌐 For information on planned breaking changes in upcoming versions of Electron, see our Planned Breaking Changes doc.
将 contextIsolation 的默认值从 false 改为 true(从 Electron 10 开始)
🌐 Change the default of contextIsolation from false to true (Starting in Electron 10)
如果没有 contextIsolation,在渲染进程中运行的任何代码都可以很容易地访问 Electron 内部或应用的 preload 脚本。然后,这些代码就可以执行 Electron 想要限制的特权操作。
🌐 Without contextIsolation, any code running in a renderer process can quite easily reach into Electron internals or an app's preload script. That code can then perform privileged actions that Electron wants to keep restricted.
更改此默认设置可以提高 Electron 应用的默认安全性,因此应用将需要刻意选择使用不安全的行为。Electron 会在 Electron 10.0 中弃用当前的默认值 contextIsolation,并在 Electron 12.0 中更改为新的默认值 (true)。
🌐 Changing this default improves the default security of Electron apps, so that apps will need to deliberately opt in to the insecure behaviour. Electron will depreciate the current default of contextIsolation in Electron 10.0, and change to the new default (true) in Electron 12.0.
有关 contextIsolation 的更多信息、如何轻松启用它以及它的安全优势,请参阅我们专门的 上下文隔离文档。
🌐 For more information on contextIsolation, how to enable it easily and it's security benefits please see our dedicated Context Isolation Document.