Electron 14.0.0 已发布! 它包括了到 Chromium 93
和 V8 9.3
的更新。 我们添加了多个 API 更新、错误修复和一般改进。 请阅读下文了解更多详情!
Electron 团队很高兴发布了 Electron 14.0.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!
Notable Changes
Electron 发布时间变更
Beginning in September 2021 with Electron 15, Electron will release a new major stable version every 8 weeks. 您可以在此处阅读 完整详细信息。 Electron 15 will begin beta on September 1, 2021 and stable release will be on September 21, 2021. You can find Electron's public timeline here.
Additionally, Electron will be changing supported versions from latest three versions to latest four versions until May 2022. See see our versioning document for more detailed information about versioning in Electron.
Stack Changes
- Chromium
93
- Node.js
14.17.0
- V8
9.3
Highlight Features
- Default Changed:
nativeWindowOpen
now defaults totrue
. (see docs) - Child windows no longer inherit BrowserWindow construction options from their parents. #28550
- Added new
session.storagePath
API to get the path on disk for session-specific data. #28665 - Added
process.contextId
used by@electron/remote
. #28007 - Added experimental cookie encryption support behind an Electron Fuse. #29492
See the 14.0.0 release notes for a full list of new features and changes.
重大更改
Below are breaking changes introduced in Electron 14. More information about these and future changes can be found on the Planned Breaking Changes page.
已移除: app.allowRendererProcessReuse
The app.allowRendererProcessReuse
property has been removed as part of our plan to more closely align with Chromium's process model for security, performance and maintainability.
For more detailed information see #18397.
Removed: Browser Window Affinity
The affinity
option when constructing a new BrowserWindow
has been removed as part of our plan to more closely align with Chromium's process model for security, performance and maintainability.
For more detailed information see #18397.
API 更改: window.open()
The optional parameter frameName
no longer sets the title of the window. This behavior now follows the specification described by the native documentation for the windowName
parameter.
If you were using this parameter to set the title of a window, you can instead use the win.setTitle(title)
method.
已移除: worldSafeExecuteJavaScript
worldSafeExecuteJavaScript
has been removed with no alternative. Please ensure your code works with this property enabled. It has been enabled by default since Electron 12.
若您使用了 webFrame.executeJavaScript
或 webFrame.executeJavaScriptInIsolatedWorld
,这个改动会对您造成影响。 您需要保证 Context Bridge API 支持这些方法的返回值,因为这些方法使用相同的值传递语义。
默认更改: nativeWindowOpen
默认为 true
Prior to Electron 14, window.open
was by default shimmed to use BrowserWindowProxy
. This meant that window.open('about:blank')
did not work to open synchronously scriptable child windows, among other incompatibilities. nativeWindowOpen
is no longer experimental, and is now the default.
See the documentation for window.open in Electron for more details.
Removed: BrowserWindowConstructorOptions inheriting from parent windows
Prior to Electron 14, windows opened with window.open
would inherit BrowserWindow constructor options such as transparent
and resizable
from their parent window. Beginning with Electron 14, this behavior has been removed and windows will not inherit any BrowserWindow constructor options from their parents.
Instead, explicitly set options for the new window with setWindowOpenHandler
:
webContents.setWindowOpenHandler((details) => {
return {
action: 'allow',
overrideBrowserWindowOptions: {
// ...
}
}
})
已移除: additionalFeatures
The deprecated additionalFeatures
property in the new-window
and did-create-window
events of WebContents has been removed. Since new-window
uses positional arguments, the argument is still present, but will always be the empty array []
. (Note: the new-window
event itself is already deprecated and has been replaced by setWindowOpenHandler
.) Bare keys in window features will now present as keys with the value true
in the options object.
// Removed in Electron 14
// Triggered by window.open('...', '', 'my-key')
webContents.on('did-create-window', (window, details) => {
if (details.additionalFeatures.includes('my-key')) {
// ...
}
})
// Replace with
webContents.on('did-create-window', (window, details) => {
if (details.options['my-key']) {
// ...
}
})
Removed: remote
module
Deprecated in Electron 12, the remote
module has now been removed from Electron itself and extracted into a separate package, @electron/remote
. The @electron/remote
module bridges JavaScript objects from the main process to the renderer process. This lets you access main-process-only objects as if they were available in the renderer process. This is a direct replacement for the remote
module. See the module's readme for migration instructions and reference.
API 更改
- Added
BrowserWindow.isFocusable()
method to determine whether a window is focusable. #28642 - Added
WebFrameMain.visibilityState
instance property. #28706 - Added
disposition
,referrer
andpostBody
to the details object passed to the window open handler registered withsetWindowOpenHandler
. #28518 - Added
process.contextId
used by@electron/remote
. #28007 - Added experimental cookie encryption support behind an Electron Fuse. #29492
- Added missing
resourceType
conversions forwebRequest
listener details:font
,ping
,cspReport
,media
,webSocket
. #30050 - Added new
session.storagePath
API to get the path on disk for session-specific data. #28665 - Added support for Windows Control Overlay on macOS. #29986
- Added support for directing Chromium logging to a file with
--log-file=.../path/to/file.log
. Also, it's now possible to enable logging from JavaScript by appending command-line switches during the first JS tick. #29963 - Added support for the des-ede3 cipher in node crypto. #27897
- Added a
ContextBridgeMutability
feature that allows context bridge objects to be mutated. #27348
Removed/Deprecated Changes
The following APIs have been removed or are now deprecated:
- The
remote
module has been removed after being deprecated in Electron 12. #25734 - Child windows no longer inherit BrowserWindow construction options from their parents. #28550
- Removed deprecated
additionalFeatures
property fromnew-window
anddid-create-window
WebContents events. #28548 - Removed the deprecated
app.allowRendererProcessReuse
and BrowserWindowaffinity
options. #26874 - The
submitURL
option forcrashReporter.start
is no longer a required argument whenuploadToServer
is false. #28105
End of Support for 11.x.y
Electron 11.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
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.
For information on planned breaking changes in upcoming versions of Electron, see our Planned Breaking Changes.