electron/docs/breaking-changes.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

2474 строки
80 KiB
Markdown
Исходник Обычный вид История

# Breaking Changes
Breaking changes will be documented here, and deprecation warnings added to JS code where possible, at least [one major version](tutorial/electron-versioning.md#semver) before the change is made.
### Types of Breaking Changes
This document uses the following convention to categorize breaking changes:
* **API Changed:** An API was changed in such a way that code that has not been updated is guaranteed to throw an exception.
* **Behavior Changed:** The behavior of Electron has changed, but not in such a way that an exception will necessarily be thrown.
* **Default Changed:** Code depending on the old default may break, not necessarily throwing an exception. The old behavior can be restored by explicitly specifying the value.
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
2024-10-29 02:16:36 +03:00
## Planned Breaking API Changes (35.0)
### Deprecated: `setPreloads`, `getPreloads` on `Session`
`registerPreloadScript`, `unregisterPreloadScript`, and `getPreloadScripts` are introduced as a
replacement for the deprecated methods. These new APIs allow third-party libraries to register
preload scripts without replacing existing scripts. Also, the new `type` option allows for
additional preload targets such as `service-worker`.
```ts
// Deprecated
session.setPreloads([path.join(__dirname, 'preload.js')])
// Replace with:
session.registerPreloadScript({
type: 'frame',
id: 'app-preload',
filePath: path.join(__dirname, 'preload.js')
})
```
## Planned Breaking API Changes (34.0)
### Deprecated: `level`, `message`, `line`, and `sourceId` arguments in `console-message` event on `WebContents`
The `console-message` event on `WebContents` has been updated to provide details on the `Event`
argument.
```js
// Deprecated
webContents.on('console-message', (event, level, message, line, sourceId) => {})
// Replace with:
webContents.on('console-message', ({ level, message, lineNumber, sourceId, frame }) => {})
```
Additionally, `level` is now a string with possible values of `info`, `warning`, `error`, and `debug`.
## Planned Breaking API Changes (33.0)
### Behavior Changed: frame properties may retrieve detached WebFrameMain instances or none at all
APIs which provide access to a `WebFrameMain` instance may return an instance
with `frame.detached` set to `true`, or possibly return `null`.
When a frame performs a cross-origin navigation, it enters into a detached state
in which it's no longer attached to the page. In this state, it may be running
[unload](https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event)
handlers prior to being deleted. In the event of an IPC sent during this state,
`frame.detached` will be set to `true` with the frame being destroyed shortly
thereafter.
When receiving an event, it's important to access WebFrameMain properties
immediately upon being received. Otherwise, it's not guaranteed to point to the
same webpage as when received. To avoid misaligned expectations, Electron will
return `null` in the case of late access where the webpage has changed.
```ts
ipcMain.on('unload-event', (event) => {
event.senderFrame; // ✅ accessed immediately
});
ipcMain.on('unload-event', async (event) => {
await crossOriginNavigationPromise;
event.senderFrame; // ❌ returns `null` due to late access
});
```
### Behavior Changed: custom protocol URL handling on Windows
Due to changes made in Chromium to support [Non-Special Scheme URLs](http://bit.ly/url-non-special), custom protocol URLs that use Windows file paths will no longer work correctly with the deprecated `protocol.registerFileProtocol` and the `baseURLForDataURL` property on `BrowserWindow.loadURL`, `WebContents.loadURL`, and `<webview>.loadURL`. `protocol.handle` will also not work with these types of URLs but this is not a change since it has always worked that way.
```js
// No longer works
protocol.registerFileProtocol('other', () => {
callback({ filePath: '/path/to/my/file' })
})
const mainWindow = new BrowserWindow()
mainWindow.loadURL('data:text/html,<script src="loaded-from-dataurl.js"></script>', { baseURLForDataURL: 'other://C:\\myapp' })
mainWindow.loadURL('other://C:\\myapp\\index.html')
// Replace with
const path = require('node:path')
const nodeUrl = require('node:url')
protocol.handle(other, (req) => {
const srcPath = 'C:\\myapp\\'
const reqURL = new URL(req.url)
return net.fetch(nodeUrl.pathToFileURL(path.join(srcPath, reqURL.pathname)).toString())
})
mainWindow.loadURL('data:text/html,<script src="loaded-from-dataurl.js"></script>', { baseURLForDataURL: 'other://' })
mainWindow.loadURL('other://index.html')
```
### Behavior Changed: menu bar will be hidden during fullscreen on Windows
This brings the behavior to parity with Linux. Prior behavior: Menu bar is still visible during fullscreen on Windows. New behavior: Menu bar is hidden during fullscreen on Windows.
### Behavior Changed: `webContents` property on `login` on `app`
The `webContents` property in the `login` event from `app` will be `null`
when the event is triggered for requests from the [utility process](api/utility-process.md)
created with `respondToAuthRequestsFromMainProcess` option.
### Deprecated: `textured` option in `BrowserWindowConstructorOption.type`
The `textured` option of `type` in `BrowserWindowConstructorOptions` has been deprecated with no replacement. This option relied on the [`NSWindowStyleMaskTexturedBackground`](https://developer.apple.com/documentation/appkit/nswindowstylemask/nswindowstylemasktexturedbackground) style mask on macOS, which has been deprecated with no alternative.
chore: bump chromium to 129.0.6630.0 (main) (#43087) * chore: bump chromium in DEPS to 129.0.6623.0 * chore: update mas_avoid_private_macos_api_usage.patch.patch remove the changes to media/audio/mac/audio_manager_mac.cc, since upstream has also made this change now. Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5738654 * chore: update fix_disable_scope_reuse_associated_dchecks.patch We had been removing a couple of `DCHECK`. Upstream changed their code to limit when these `DCHECK`s get called, so let's see if our change is still needed. Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5739076 * chore: e patches all * Bump the Chrome macOS deployment target to 11.0 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5734361 BREAKING CHANGE: Bump the Chrome macOS deployment target to 11.0 * src: stop using deprecated fields of `v8::FastApiCallbackOptions` Xref: https://github.com/nodejs/node/commit/d0000b118d9d7966afda4da209e09830d2a4aa95 Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5741336 Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5741199 * fixup! chore: update fix_disable_scope_reuse_associated_dchecks.patch chore: re-disable DCHECKs yep, it is still needed * refactor use non-deprecated variant of openApplicationAtURL old version is deprecated now in macOS 11 Xref: https://developer.apple.com/documentation/appkit/nsworkspace/1534810-launchapplicationaturl Xref: https://developer.apple.com/documentation/appkit/nsworkspace/3172700-openapplicationaturl * chore: bump chromium in DEPS to 129.0.6626.0 * chore: e patches all * chore: disable NSUserNotification deprecation errors * chore: disable NSWindowStyleMaskTexturedBackground deprecation errors Xref: https://github.com/electron/electron/issues/43125 * chore: disable deprecation errors in platform_util_mac.mm * chore: disable launchApplication deprecation errors * chore: bump chromium in DEPS to 129.0.6630.0 * chore: update refactor_expose_file_system_access_blocklist.patch apply patch manually due to context shear Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5745444 * chore: update deps_add_v8_object_setinternalfieldfornodecore.patch no manual changes. patch applied with fuzz 1 (offset -5 lines) * chore: e patches all * fix: add clang_x64_v8_arm64/snapshot_blob.bin to the zip manifest Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5746173 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2024-08-02 17:02:11 +03:00
### Removed: macOS 10.15 support
macOS 10.15 (Catalina) is no longer supported by [Chromium](https://chromium-review.googlesource.com/c/chromium/src/+/5734361).
Older versions of Electron will continue to run on Catalina, but macOS 11 (Big Sur)
or later will be required to run Electron v33.0.0 and higher.
### Deprecated: `systemPreferences.accessibilityDisplayShouldReduceTransparency`
The `systemPreferences.accessibilityDisplayShouldReduceTransparency` property is now deprecated in favor of the new `nativeTheme.prefersReducedTransparency`, which provides identical information and works cross-platform.
```js
// Deprecated
const shouldReduceTransparency = systemPreferences.accessibilityDisplayShouldReduceTransparency
// Replace with:
const prefersReducedTransparency = nativeTheme.prefersReducedTransparency
```
2024-05-15 21:07:23 +03:00
## Planned Breaking API Changes (32.0)
### Removed: `File.path`
The nonstandard `path` property of the Web `File` object was added in an early version of Electron as a convenience method for working with native files when doing everything in the renderer was more common. However, it represents a deviation from the standard and poses a minor security risk as well, so beginning in Electron 32.0 it has been removed in favor of the [`webUtils.getPathForFile`](api/web-utils.md#webutilsgetpathforfilefile) method.
```js
// Before (renderer)
const file = document.querySelector('input[type=file]')
alert(`Uploaded file path was: ${file.path}`)
```
```js
// After (renderer)
const file = document.querySelector('input[type=file]')
electron.showFilePath(file)
// (preload)
const { contextBridge, webUtils } = require('electron')
contextBridge.exposeInMainWorld('electron', {
showFilePath (file) {
// It's best not to expose the full file path to the web content if
// possible.
const path = webUtils.getPathForFile(file)
alert(`Uploaded file path was: ${path}`)
}
})
```
### Deprecated: `clearHistory`, `canGoBack`, `goBack`, `canGoForward`, `goForward`, `goToIndex`, `canGoToOffset`, `goToOffset` on `WebContents`
The navigation-related APIs are now deprecated.
These APIs have been moved to the `navigationHistory` property of `WebContents` to provide a more structured and intuitive interface for managing navigation history.
```js
// Deprecated
win.webContents.clearHistory()
win.webContents.canGoBack()
win.webContents.goBack()
win.webContents.canGoForward()
win.webContents.goForward()
win.webContents.goToIndex(index)
win.webContents.canGoToOffset()
win.webContents.goToOffset(index)
// Replace with
win.webContents.navigationHistory.clear()
win.webContents.navigationHistory.canGoBack()
win.webContents.navigationHistory.goBack()
win.webContents.navigationHistory.canGoForward()
win.webContents.navigationHistory.goForward()
win.webContents.navigationHistory.canGoToOffset()
win.webContents.navigationHistory.goToOffset(index)
```
chore: bump chromium to 125.0.6412.0 (main) (#41610) * chore: bump chromium in DEPS to 124.0.6361.0 * chore: bump chromium in DEPS to 124.0.6363.0 * chore: update patches Manually apply printing.patch w/no code changes due to upstream shear. Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5349263 * chore: bump chromium in DEPS to 124.0.6365.0 * chore: bump chromium in DEPS to 124.0.6367.0 * update patches * 5371735: Rename SystemGeolocationSourceMac to SystemGeolocationSourceApple https://chromium-review.googlesource.com/c/chromium/src/+/5371735 * missed a MAS bit * chore: update windows toolchain 5350823: New toolchain for Windows 11 10.0.22621.2428 SDK | https://chromium-review.googlesource.com/c/chromium/src/+/5350823 * chore: bump chromium in DEPS to 125.0.6368.0 * fix patches * chore: update patches * 5232401: [PDF] Move generic utils from //chrome to //components/pdf (1/2) https://chromium-review.googlesource.com/c/chromium/src/+/5232401 * revert https://chromium-review.googlesource.com/c/chromium/src/+/5380898 * chore: bump chromium in DEPS to 125.0.6370.0 * build: use updated windows toolchain * fix patches * chore: update patches * more pdf_util to components * 5372414: [Extensions] Remove DispatcherDelegate https://chromium-review.googlesource.com/c/chromium/src/+/5372414 * fix accessibility_ui patch * chore: bump chromium in DEPS to 125.0.6372.0 * chore: bump chromium in DEPS to 125.0.6374.0 * chore: bump chromium in DEPS to 125.0.6376.0 * chore: bump chromium in DEPS to 125.0.6378.0 * chore: bump chromium in DEPS to 125.0.6379.3 * chore: update patches (+ MAS patch changes) * chore: update patches * 5381159: Cleanup media::KeySystemSupportObserver https://chromium-review.googlesource.com/c/chromium/src/+/5381159 * 5382233: Reland "Web `Speech to Text` with SODA backend" https://chromium-review.googlesource.com/c/chromium/src/+/5382233 * chore: update `exclusive_access` patch - 5367497: Add a metric for the website state when Fullscreen API is requested - https://chromium-review.googlesource.com/c/chromium/src/+/5367497 * chore: add build dependency 5367497: Add a metric for the website state when Fullscreen API is requested https://chromium-review.googlesource.com/c/chromium/src/+/5367497 * chore: bump chromium in DEPS to 125.0.6382.0 * chore: update libcxx filenames * chore: update patches * chore: bump chromium in DEPS to 125.0.6384.0 * chore: remove old patch * 5394039: [Extensions] Change "blessed" -> "privileged" in extension feature files https://chromium-review.googlesource.com/c/chromium/src/+/5394039 * fix: remove deprecated errno constants in node/libuv * 5362194: Return expected from ProcessMetrics CPU methods https://chromium-review.googlesource.com/c/chromium/src/+/5362194 * 5383927: Add new Pickle factory functions with explicit ownership https://chromium-review.googlesource.com/c/chromium/src/+/5383927 * 5373340: Simplify app-region/Draggable Region implementation https://chromium-review.googlesource.com/c/chromium/src/+/5373340 * 5386875: Cleanup printing preferences files https://chromium-review.googlesource.com/c/chromium/src/+/5386875 * chore: update libc++ filenames * fix: add enterprise buildflags dep * chore: bump chromium in DEPS to 125.0.6386.0 * chore: add build dep * chore: update patches * chore: bump chromium in DEPS to 125.0.6388.0 * chore: bump chromium in DEPS to 125.0.6390.0 * chore: update patches * 4918014: preloading: Add NewTabPagePageLoadMetricsObserver https://chromium-review.googlesource.com/c/chromium/src/+/4918014 * 5401234: [PDF] Remove `PDFDocumentHelperClient::FindPdfChildFrame` API https://chromium-review.googlesource.com/c/chromium/src/+/5401234 * 5116175: Relocate Windows XPS printing feature helper methods https://chromium-review.googlesource.com/c/chromium/src/+/5116175 * fixup! 5373340: Simplify app-region/Draggable Region implementation https://chromium-review.googlesource.com/c/chromium/src/+/5373340 * fixup! chore: add build dep * chore: remove dead code & dead patch Was dealing with https://chromium-review.googlesource.com/c/chromium/src/+/5402805 when I realized this code is no longer possible to call. It seems like this code became dead in the previous roll (#41514). The patch exposed a `DxdiagDx12VulkanRequested` method on Chromium's `GpuDataManagerImpl`, which we consumed only in our own `GPUInfoManager::NeedsCompleteGpuInfoCollection`. There are no other references to this method, so it and the patch can both be deleted. Yay! * chore: bump chromium in DEPS to 125.0.6392.0 * chore: bump chromium in DEPS to 125.0.6393.0 * chore: update patches * chore: bump chromium in DEPS to 125.0.6394.0 * chore: bump chromium in DEPS to 125.0.6396.0 * chore: bump chromium in DEPS to 125.0.6397.0 * chore: update printing.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5100842 No code changes, but had to apply patch manually due to upstream code shear * chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch No manual changes; patch applied with fuzz 1 * chore: update feat_allow_code_cache_in_custom_schemes.patch No manual changes; patch applied with fuzz 2 * chore: silence "space before tab in indent" git rebase-apply warning * chore: e patches all * build: update all.gn to avoid FTBFS when disabling raw_ptr Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5371737 * Rename PdfService Mojo interface to PdfHost Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5411957 * chore: bump chromium in DEPS to 125.0.6398.0 * chore: update patches * chore: bump chromium in DEPS to 125.0.6400.0 * chore: update patches * [media] Remove unused `GetSupportedKeySystems` from MediaClient Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5420247 * chore: update JSInjection::New call to match upstream change Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5403967 [Extensions] Wire up the renderer for multiple user script worlds * 5362362: Derive display ID from monitor adapter ID instead of szDevice. https://chromium-review.googlesource.com/c/chromium/src/+/5362362 * 5116175: Relocate Windows XPS printing feature helper methods https://chromium-review.googlesource.com/c/chromium/src/+/5116175 * chore: add v8-sandbox.h to electron-node * chore: update patches * chore: update patches * fixup! 5394039: [Extensions] Change blessed -> privileged in extension feature files * chore: bump chromium in DEPS to 125.0.6412.0 * chore: update patches * chore: node script/gen-libc++-filenames.js * [FPF] Create Fingerprinting Protection ruleset service. Refs https://chromium-review.googlesource.com/c/chromium/src/+/5420158 * Add ExclusiveAccessPermissionManager Refs https://chromium-review.googlesource.com/c/chromium/src/+/5273787 * Preserve the PNG colorspace when decoding into a SkBitmap. Refs https://chromium-review.googlesource.com/c/chromium/src/+/5421254 * chore: iwyu * fix: abstract-socket compilation * ci: bump container for node 20 support * fixup! abstract-socket compilation * fix: compiling nan specs * chore: revert winreg version bump accidental bump to 1.2.5 revealed failing app.setasdefaultprotocolclient test suite. Should be revisited separately. * ci: set node 20 for darwin x64 tests * fix: broken patch export * chore: cleanup mas_avoid_private_macos_api_usage.patch.patch Removed code that was inadvertently put back after https://chromium-review.googlesource.com/c/chromium/src/+/5348565 removed it --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: clavin <clavin@electronjs.org> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
2024-04-16 01:10:32 +03:00
## Planned Breaking API Changes (31.0)
chore: bump chromium to 126.0.6445.0 (main) (#41868) * chore: bump chromium in DEPS to 125.0.6421.0 * chore: bump chromium in DEPS to 125.0.6422.0 * Add ENABLE_BASE_TRACING flags for compatibility with enable_base_tracing = false on Windows https://chromium-review.googlesource.com/c/chromium/src/+/5434658 * chore: update patches * fixup: Add ENABLE_BASE_TRACING flags for compatibility with enable_base_tracing = false on Windows * chore: bump chromium in DEPS to 126.0.6423.0 * chore: update patches * 5426599: Next generation control of unsafe-buffers-usage plugin https://chromium-review.googlesource.com/c/chromium/src/+/5426599 * chore: bump chromium in DEPS to 126.0.6425.0 * chore: update patches * Roll clang+rust llvmorg-19-init-7229-g315c88c5-2 : llvmorg-19-init-8091-gab037c4f-1 / ceab6128fa48a616bfd3e3adf4bc80133b8ee223-1 : ab71ee7a9214c2793108a41efb065aa77aeb7326-1 https://chromium-review.googlesource.com/c/chromium/src/+/5444328 Also see https://issues.chromium.org/issues/332931387 * 5445074: [Views AX] Move AXEventNotificationDetails to ui/accessibility/ https://chromium-review.googlesource.com/c/chromium/src/+/5445074 Also 5455993: [Views AX] Rename AXEventNotificationDetails to AXUpdatesAndEvents | https://chromium-review.googlesource.com/c/chromium/src/+/5455993 * Pass IsolationInfo to ContentBrowserClient::WillCreateURLLoaderFactory() https://chromium-review.googlesource.com/c/chromium/src/+/5405301 * chore: bump chromium in DEPS to 126.0.6427.0 * chore: update patches * chore: remove no longer needed patch perfetto is now turned on so this patch is no longer needed. * chore: bump chromium in DEPS to 126.0.6429.0 * chore: bump chromium in DEPS to 126.0.6431.0 * chore: bump chromium in DEPS to 126.0.6433.0 * 5466654: Do not create a console if logging to a handle https://chromium-review.googlesource.com/c/chromium/src/+/5466654 * chore: fixup patch indices * Address Linux NonClientFrameView Changes - https://chromium-review.googlesource.com/c/chromium/src/+/5180720 - https://chromium-review.googlesource.com/c/chromium/src/+/5367794 * chore: bump chromium in DEPS to 126.0.6435.0 * chore: bump chromium in DEPS to 126.0.6437.0 * chore: update patches * chore: bump chromium in DEPS to 126.0.6439.0 * chore: bump chromium in DEPS to 126.0.6441.0 * 5477689: components/crash/content/tools: Format with yapf | https://chromium-review.googlesource.com/c/chromium/src/+/5477689 * 5485006: Remove enable_print_content_analysis GN flag | https://chromium-review.googlesource.com/c/chromium/src/+/5485006 * chore: update chromium patches * chore: bump chromium in DEPS to 126.0.6443.0 * 5465608: Convert DCHECKs near RenderWidgetHost, DelegatedFrameHost to CHECK | https://chromium-review.googlesource.com/c/chromium/src/+/5465608 * 5492605: Migrate TODOs referencing old crbug IDs to the new issue tracker IDs | https://chromium-review.googlesource.com/c/chromium/src/+/5492605 * chore: update patches * chore: bump chromium in DEPS to 126.0.6445.0 * chore: update patches * 5468588: Fullscreen: Encapsulate ExclusiveAccessBubble params in a struct | https://chromium-review.googlesource.com/c/chromium/src/+/5468588 * fixup! 5485006: Remove enable_print_content_analysis GN flag | https://chromium-review.googlesource.com/c/chromium/src/+/5485006 * 5461340: `size_t` in `mojo::DataPipe[Consumer|Producer]Handle`: /components. | https://chromium-review.googlesource.com/c/chromium/src/+/5461340 * 5480213: Add an EvictIds struct to FrameEvictorClient | https://chromium-review.googlesource.com/c/chromium/src/+/5480213 * 4341506: [api] Deprecate Isolate::IdleNotificationDeadline | https://chromium-review.googlesource.com/c/v8/v8/+/4341506 * 5300826: [v8-tasks] Add source location to v8::TaskRunner, step 4/4. | https://chromium-review.googlesource.com/c/v8/v8/+/5300826 * partially revert is_newly_created to allow for browser initiated about:blank loads * add dep on app_launch_prefetch Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5420149 * install sysroots from electron not from chrome We should add a new var upstream for `download_sysroots` so that we can skip downloading chromes at all. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5462469 * refactor: make UpdateFrameHints an override Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5473548 * fix ppapi * refactor: update namespace for pwm switches Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5444617 * 5459367: WebSQL: Restrict WebSQL service creation to Android only | https://chromium-review.googlesource.com/c/chromium/src/+/5459367 * 5455853: Revert "[Clipboard] Don't add meta charset tag for async write() method on Mac." | https://chromium-review.googlesource.com/c/chromium/src/+/5455853 * fixup! refactor: update namespace for pwm switches edd9e26 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5444617 * 5147611: [heap] Add checks for ensuring position info slow path is not used in heap snapshot | https://chromium-review.googlesource.com/c/v8/v8/+/5147611 * fixup! 5412666: [heap] Also avoid heap allocation for allocation tracked functions | https://chromium-review.googlesource.com/c/v8/v8/+/5412666 * chore: add websql removal to breaking-changes.md --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2024-05-10 18:21:10 +03:00
### Removed: `WebSQL` support
Chromium has removed support for WebSQL upstream, transitioning it to Android only. See
[Chromium's intent to remove discussion](https://groups.google.com/a/chromium.org/g/blink-dev/c/fWYb6evVA-w/m/wGI863zaAAAJ)
for more information.
### Behavior Changed: `nativeImage.toDataURL` will preserve PNG colorspace
chore: bump chromium to 125.0.6412.0 (main) (#41610) * chore: bump chromium in DEPS to 124.0.6361.0 * chore: bump chromium in DEPS to 124.0.6363.0 * chore: update patches Manually apply printing.patch w/no code changes due to upstream shear. Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5349263 * chore: bump chromium in DEPS to 124.0.6365.0 * chore: bump chromium in DEPS to 124.0.6367.0 * update patches * 5371735: Rename SystemGeolocationSourceMac to SystemGeolocationSourceApple https://chromium-review.googlesource.com/c/chromium/src/+/5371735 * missed a MAS bit * chore: update windows toolchain 5350823: New toolchain for Windows 11 10.0.22621.2428 SDK | https://chromium-review.googlesource.com/c/chromium/src/+/5350823 * chore: bump chromium in DEPS to 125.0.6368.0 * fix patches * chore: update patches * 5232401: [PDF] Move generic utils from //chrome to //components/pdf (1/2) https://chromium-review.googlesource.com/c/chromium/src/+/5232401 * revert https://chromium-review.googlesource.com/c/chromium/src/+/5380898 * chore: bump chromium in DEPS to 125.0.6370.0 * build: use updated windows toolchain * fix patches * chore: update patches * more pdf_util to components * 5372414: [Extensions] Remove DispatcherDelegate https://chromium-review.googlesource.com/c/chromium/src/+/5372414 * fix accessibility_ui patch * chore: bump chromium in DEPS to 125.0.6372.0 * chore: bump chromium in DEPS to 125.0.6374.0 * chore: bump chromium in DEPS to 125.0.6376.0 * chore: bump chromium in DEPS to 125.0.6378.0 * chore: bump chromium in DEPS to 125.0.6379.3 * chore: update patches (+ MAS patch changes) * chore: update patches * 5381159: Cleanup media::KeySystemSupportObserver https://chromium-review.googlesource.com/c/chromium/src/+/5381159 * 5382233: Reland "Web `Speech to Text` with SODA backend" https://chromium-review.googlesource.com/c/chromium/src/+/5382233 * chore: update `exclusive_access` patch - 5367497: Add a metric for the website state when Fullscreen API is requested - https://chromium-review.googlesource.com/c/chromium/src/+/5367497 * chore: add build dependency 5367497: Add a metric for the website state when Fullscreen API is requested https://chromium-review.googlesource.com/c/chromium/src/+/5367497 * chore: bump chromium in DEPS to 125.0.6382.0 * chore: update libcxx filenames * chore: update patches * chore: bump chromium in DEPS to 125.0.6384.0 * chore: remove old patch * 5394039: [Extensions] Change "blessed" -> "privileged" in extension feature files https://chromium-review.googlesource.com/c/chromium/src/+/5394039 * fix: remove deprecated errno constants in node/libuv * 5362194: Return expected from ProcessMetrics CPU methods https://chromium-review.googlesource.com/c/chromium/src/+/5362194 * 5383927: Add new Pickle factory functions with explicit ownership https://chromium-review.googlesource.com/c/chromium/src/+/5383927 * 5373340: Simplify app-region/Draggable Region implementation https://chromium-review.googlesource.com/c/chromium/src/+/5373340 * 5386875: Cleanup printing preferences files https://chromium-review.googlesource.com/c/chromium/src/+/5386875 * chore: update libc++ filenames * fix: add enterprise buildflags dep * chore: bump chromium in DEPS to 125.0.6386.0 * chore: add build dep * chore: update patches * chore: bump chromium in DEPS to 125.0.6388.0 * chore: bump chromium in DEPS to 125.0.6390.0 * chore: update patches * 4918014: preloading: Add NewTabPagePageLoadMetricsObserver https://chromium-review.googlesource.com/c/chromium/src/+/4918014 * 5401234: [PDF] Remove `PDFDocumentHelperClient::FindPdfChildFrame` API https://chromium-review.googlesource.com/c/chromium/src/+/5401234 * 5116175: Relocate Windows XPS printing feature helper methods https://chromium-review.googlesource.com/c/chromium/src/+/5116175 * fixup! 5373340: Simplify app-region/Draggable Region implementation https://chromium-review.googlesource.com/c/chromium/src/+/5373340 * fixup! chore: add build dep * chore: remove dead code & dead patch Was dealing with https://chromium-review.googlesource.com/c/chromium/src/+/5402805 when I realized this code is no longer possible to call. It seems like this code became dead in the previous roll (#41514). The patch exposed a `DxdiagDx12VulkanRequested` method on Chromium's `GpuDataManagerImpl`, which we consumed only in our own `GPUInfoManager::NeedsCompleteGpuInfoCollection`. There are no other references to this method, so it and the patch can both be deleted. Yay! * chore: bump chromium in DEPS to 125.0.6392.0 * chore: bump chromium in DEPS to 125.0.6393.0 * chore: update patches * chore: bump chromium in DEPS to 125.0.6394.0 * chore: bump chromium in DEPS to 125.0.6396.0 * chore: bump chromium in DEPS to 125.0.6397.0 * chore: update printing.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5100842 No code changes, but had to apply patch manually due to upstream code shear * chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch No manual changes; patch applied with fuzz 1 * chore: update feat_allow_code_cache_in_custom_schemes.patch No manual changes; patch applied with fuzz 2 * chore: silence "space before tab in indent" git rebase-apply warning * chore: e patches all * build: update all.gn to avoid FTBFS when disabling raw_ptr Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5371737 * Rename PdfService Mojo interface to PdfHost Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5411957 * chore: bump chromium in DEPS to 125.0.6398.0 * chore: update patches * chore: bump chromium in DEPS to 125.0.6400.0 * chore: update patches * [media] Remove unused `GetSupportedKeySystems` from MediaClient Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5420247 * chore: update JSInjection::New call to match upstream change Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5403967 [Extensions] Wire up the renderer for multiple user script worlds * 5362362: Derive display ID from monitor adapter ID instead of szDevice. https://chromium-review.googlesource.com/c/chromium/src/+/5362362 * 5116175: Relocate Windows XPS printing feature helper methods https://chromium-review.googlesource.com/c/chromium/src/+/5116175 * chore: add v8-sandbox.h to electron-node * chore: update patches * chore: update patches * fixup! 5394039: [Extensions] Change blessed -> privileged in extension feature files * chore: bump chromium in DEPS to 125.0.6412.0 * chore: update patches * chore: node script/gen-libc++-filenames.js * [FPF] Create Fingerprinting Protection ruleset service. Refs https://chromium-review.googlesource.com/c/chromium/src/+/5420158 * Add ExclusiveAccessPermissionManager Refs https://chromium-review.googlesource.com/c/chromium/src/+/5273787 * Preserve the PNG colorspace when decoding into a SkBitmap. Refs https://chromium-review.googlesource.com/c/chromium/src/+/5421254 * chore: iwyu * fix: abstract-socket compilation * ci: bump container for node 20 support * fixup! abstract-socket compilation * fix: compiling nan specs * chore: revert winreg version bump accidental bump to 1.2.5 revealed failing app.setasdefaultprotocolclient test suite. Should be revisited separately. * ci: set node 20 for darwin x64 tests * fix: broken patch export * chore: cleanup mas_avoid_private_macos_api_usage.patch.patch Removed code that was inadvertently put back after https://chromium-review.googlesource.com/c/chromium/src/+/5348565 removed it --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: clavin <clavin@electronjs.org> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
2024-04-16 01:10:32 +03:00
PNG decoder implementation has been changed to preserve colorspace data, the
encoded data returned from this function now matches it.
See [crbug.com/332584706](https://issues.chromium.org/issues/332584706) for more information.
### Behavior Changed: `window.flashFrame(bool)` will flash dock icon continuously on macOS
This brings the behavior to parity with Windows and Linux. Prior behavior: The first `flashFrame(true)` bounces the dock icon only once (using the [NSInformationalRequest](https://developer.apple.com/documentation/appkit/nsrequestuserattentiontype/nsinformationalrequest) level) and `flashFrame(false)` does nothing. New behavior: Flash continuously until `flashFrame(false)` is called. This uses the [NSCriticalRequest](https://developer.apple.com/documentation/appkit/nsrequestuserattentiontype/nscriticalrequest) level instead. To explicitly use `NSInformationalRequest` to cause a single dock icon bounce, it is still possible to use [`dock.bounce('informational')`](https://www.electronjs.org/docs/latest/api/dock#dockbouncetype-macos).
chore: bump chromium to 122.0.6194.0 (main) (#40750) * chore: bump chromium in DEPS to 122.0.6180.0 * chore: update render_widget_host_view_base.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5079532 minor manual changes to match upstream changes * chore: update printing.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5094777 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5054299 Update patch to upstream changes in print_view_manager_base.cc. CC @codebytere for :eyes: * chore: update feat_add_onclose_to_messageport.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5083156 no manual changes; patch applied with fuzz 1 * chore: update build_do_not_depend_on_packed_resource_integrity.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5087072 minor manual changes to match upstream changes * chore: update port_autofill_colors_to_the_color_pipeline.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4960481 no manual changes; patch applied with fuzz 2 * chore: update revert_api_dcheck-fail_when_we_reenter_v8_while_terminating.patch Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5076902 Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5096253 The `bailout_value` variable, which allowed us to fail gracefully in these macros, has been removed upstream. This raises the temperature on https://github.com/electron/electron/issues/40741 ... Since we don't have a bailout value, return a default-constructed instance of whatever the return type is of the function that invokes the macro. * Remove performActionOnRemotePage Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5068017 It appears it is not used by anything within Chromium or outside. * perf: in SubmenuButton ctor, move() the PressedCallback Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5066872 The copy construtor is more expensive and has been removed upstream * chore: update constructor call for ElectronExtensionsRendererClient::dispatcher_ Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5055146 * chore: handle CAPTURED_SURFACE_CONTROL in Converter<blink::PermissionType>::ToV8() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5096614 * chore: e patches all * chore: bump chromium to 122.0.6181.0 * chore: e patches all * refactor: Add lookup for per-RenderFrame SpellCheckProvider Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5075094 Previously we could pass a routing ID into the spellcheck methods. This ID arg has been replaced with a SpellCheckHost& arg. We can get the SpellCheckHost from an accessor in SpellCheckProvider, which was already being created on a per-render-frame basis in RenderClientBase. This commit adds a RenderFrame-to-SpellCheckProvider accessor in RenderClientBase so that it can be used to get that needed SpellCheckHost. * chore: make lint happy * chore: restore the will_cause_resize arg to WebContents::ExitFullscreen Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5074445 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5031312 upstream reverted this change * chore: bump chromium in DEPS to 122.0.6182.0 * chore: update patches * chore: fix virtual function names that were renamed upstream Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5115241 * chore: handle new blink::PermissionType::SMART_CARD in PermissionType converter Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5049989 * chore: node script/gen-libc++-filenames.js * fixup! chore: update build_do_not_depend_on_packed_resource_integrity.patch * chore: remove revert_api_dcheck-fail_when_we_reenter_v8_while_terminating.patch The previous experiment of removing the DCHECK in 35093783 was a huge failure. We either need to either: A) use upstream as-is and fix the DCHECK failure, or B) revert https://chromium-review.googlesource.com/c/v8/v8/+/5076902 too C) find some other workaround This commit is the first half of option A, removing the patch to use upstream as-is. * chore: bump chromium in DEPS to 122.0.6184.0 * chore: bump chromium in DEPS to 122.0.6186.0 * chore; update mas_avoid_private_macos_api_usage.patch.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5085619 minor manual changes to match upstream changes * chore: update build_do_not_depend_on_packed_resource_integrity.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5120922 minor manual changes to match upstream changes * chore: update fix_move_autopipsettingshelper_behind_branding_buildflag.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5041595 no manual changes; patch applied with fuzz 1 * chore: e patches all * chore: add refactor_update_node-platform_to_match_v8-platform_api_changes.patch * chore: bump chromium in DEPS to 122.0.6188.0 * chore: bump chromium in DEPS to 122.0.6190.0 * chore: bump chromium in DEPS to 122.0.6192.0 * chore: bump chromium in DEPS to 122.0.6194.0 * Remove an unnecessary DCHECK which causes Lacros to crash. https://chromium-review.googlesource.com/c/chromium/src/+/5124880 * [FixIt Week] Add shared regular profile function that includes ash https://chromium-review.googlesource.com/c/chromium/src/+/5100709 * Simplify the PrintManagerHost::ScriptedPrint() call https://chromium-review.googlesource.com/c/chromium/src/+/5019703 * [local compile hints] Add tests https://chromium-review.googlesource.com/c/chromium/src/+/5024173 * chore: update patches * fixup! chore: add refactor_update_node-platform_to_match_v8-platform_api_changes.patch * chore: node script/gen-libc++-filenames.js * Remove //ui/ozone/buildflags.h https://chromium-review.googlesource.com/c/chromium/src/+/5119048 * fixup! Remove //ui/ozone/buildflags.h * fixup! Remove //ui/ozone/buildflags.h * chore: update patches * fixup! refactor: Add lookup for per-RenderFrame SpellCheckProvider * fixup! Remove //ui/ozone/buildflags.h * Add permission policy verification in PermissionControllerImpl https://chromium-review.googlesource.com/c/chromium/src/+/5059112 * fix: ensure spellcheck interface is registered for frame * [exceptions] Unify pending and scheduled exceptions https://chromium-review.googlesource.com/c/v8/v8/+/5050065 * fix: dchecks in node.js tests * fix: try adding termination check * chore: document breaking iframe change --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-01-03 11:52:49 +03:00
## Planned Breaking API Changes (30.0)
### Behavior Changed: cross-origin iframes now use Permission Policy to access features
Cross-origin iframes must now specify features available to a given `iframe` via the `allow`
attribute in order to access them.
See [documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#allow) for
more information.
chore: bump chromium to 122.0.6236.2 (main) (#40871) * chore: bump chromium in DEPS to 122.0.6223.0 * 5129828: Removes special cases for selenium-atoms dependencies. https://chromium-review.googlesource.com/c/chromium/src/+/5129828 * chore: fixup patch indices * 5139789: Deduplicate BrowserContext's ResourceContext https://chromium-review.googlesource.com/c/chromium/src/+/5139789 * 5148579: Simplify SelectFileDialog::Listener https://chromium-review.googlesource.com/c/chromium/src/+/5148579 * 5134038: Code Health: Use string_view in base::i18n::BreakIterator::SetText https://chromium-review.googlesource.com/c/chromium/src/+/5134038 * 5137427: Code Health: Use string_view in SpellCheck::SpellCheckWord https://chromium-review.googlesource.com/c/chromium/src/+/5137427 * [libcxx] adds ranges::fold_left_with_iter and ranges::fold_left Notable things in this commit: * refactors `__indirect_binary_left_foldable`, making it slightly different (but equivalent) to _`indirect-binary-left-foldable`_, which improves readability (a [patch to the Working Paper][patch] was made) * omits `__cpo` namespace, since it is not required for implementing niebloids (a cleanup should happen in 2024) * puts tests ensuring invocable robustness and dangling correctness inside the correctness testing to ensure that the algorithms' results are still correct [patch]: https://github.com/cplusplus/draft/pull/6734 * chore: bump chromium in DEPS to 122.0.6224.0 * 5154766: [Refresh 2023] [GTK] Fix gap above toolbar with fractional scaling https://chromium-review.googlesource.com/c/chromium/src/+/5154766 * chore: fixup patch indices * 5094458: Remove extra CGColorSpace parameters from skia and ui helpers https://chromium-review.googlesource.com/c/chromium/src/+/5094458 * chore: bump chromium in DEPS to 122.0.6226.0 * chore: update patches * chore: bump chromium in DEPS to 122.0.6227.0 * chore: update patches * chore: bump chromium in DEPS to 122.0.6228.0 * chore: update patches * chore: bump chromium in DEPS to 122.0.6230.0 * chore: bump chromium in DEPS to 122.0.6232.0 * chore: bump chromium in DEPS to 122.0.6234.0 * chore: bump chromium in DEPS to 122.0.6236.2 * chore: update patches * fix: remove --disable-color-correct-renderering Per https://electronhq.slack.com/archives/CB6CG54DB/p1698444047862459 it is not used any more and was never documented. * chore: add WEB_PRINTING to content permission converter Unused in non-cros so no need to document Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5136178 * chore: Views is now vec<raw_ptr> instead of raw<T*> Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5140028 * spec: add Iterator to global intrinsics --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2024-01-11 09:33:40 +03:00
### Removed: The `--disable-color-correct-rendering` switch
This switch was never formally documented but it's removal is being noted here regardless. Chromium itself now has better support for color spaces so this flag should not be needed.
### Behavior Changed: `BrowserView.setAutoResize` behavior on macOS
In Electron 30, BrowserView is now a wrapper around the new [WebContentsView](api/web-contents-view.md) API.
Previously, the `setAutoResize` function of the `BrowserView` API was backed by [autoresizing](https://developer.apple.com/documentation/appkit/nsview/1483281-autoresizingmask?language=objc) 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.
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.
### Deprecated: `BrowserView`
The [`BrowserView`](./api/browser-view.md) class has been deprecated and
replaced by the new [`WebContentsView`](./api/web-contents-view.md) class.
`BrowserView` related methods in [`BrowserWindow`](./api/browser-window.md) have
also been deprecated:
```js
BrowserWindow.fromBrowserView(browserView)
win.setBrowserView(browserView)
win.getBrowserView()
win.addBrowserView(browserView)
win.removeBrowserView(browserView)
win.setTopBrowserView(browserView)
win.getBrowserViews()
```
### Removed: `params.inputFormType` property on `context-menu` on `WebContents`
The `inputFormType` property of the params object in the `context-menu`
event from `WebContents` has been removed. Use the new `formControlType`
property instead.
chore: bump chromium to 124.0.6323.0 (main) (#41412) * chore: bump chromium in DEPS to 124.0.6315.0 * chore: update patches * 5279678: Stream AIDA responses https://chromium-review.googlesource.com/c/chromium/src/+/5279678 * 5276439: Remove non_network_url_loader_factory_remotes_ https://chromium-review.googlesource.com/c/chromium/src/+/5276439 * 5310165: Add DevTools API to show search results https://chromium-review.googlesource.com/c/chromium/src/+/5310165 * chore: bump chromium in DEPS to 124.0.6317.0 * chore: update patches * Remove Setup.Install.CumulativeDiskUsage2 and supporting code https://chromium-review.googlesource.com/c/chromium/src/+/5314269 * browser: Make cmd line non-const in process singleton callback https://chromium-review.googlesource.com/c/chromium/src/+/5311256 * chore: bump chromium in DEPS to 124.0.6319.0 * chore: bump chromium in DEPS to 124.0.6321.0 * chore: bump chromium in DEPS to 124.0.6323.0 * 5318335: Roll src/third_party/boringssl/src 23824fa0f..4fe29ebc7 https://chromium-review.googlesource.com/c/chromium/src/+/5318335 * 5318051: [CBE Watermarking] Hoist `watermark_view` to a member variable. https://chromium-review.googlesource.com/c/chromium/src/+/5318051 * chore: fixup patch indices * 4946553: Delegate HID permission to Chrome App in webview https://chromium-review.googlesource.com/c/chromium/src/+/4946553 * 5310001: DevTools UI binding for reporting client events to AIDA https://chromium-review.googlesource.com/c/chromium/src/+/5310001 * [libc++] Refactor the predicate taking variant of `__cxx_atomic_wait` * chore: fix browser_view patch harder * 5293937: Reland "[gUM] Use preferred device if more than one is eligible" https://chromium-review.googlesource.com/c/chromium/src/+/5293937 * fix: filter {video|audio} devices by eligible device id * 5267921: enable speak content under the pointer on PWA and WV2 https://chromium-review.googlesource.com/c/chromium/src/+/5267921 * 5310195: heap: Remove Blink's GCTaskRunner https://chromium-review.googlesource.com/c/chromium/src/+/5310195 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-02-29 12:31:13 +03:00
### Removed: `process.getIOCounters()`
Chromium has removed access to this information.
## Planned Breaking API Changes (29.0)
### Behavior Changed: `ipcRenderer` can no longer be sent over the `contextBridge`
Attempting to send the entire `ipcRenderer` module as an object over the `contextBridge` will now result in
an empty object on the receiving side of the bridge. This change was made to remove / mitigate
a security footgun. You should not directly expose ipcRenderer or its methods over the bridge.
Instead, provide a safe wrapper like below:
```js
contextBridge.exposeInMainWorld('app', {
onEvent: (cb) => ipcRenderer.on('foo', (e, ...args) => cb(args))
})
```
### Removed: `renderer-process-crashed` event on `app`
The `renderer-process-crashed` event on `app` has been removed.
Use the new `render-process-gone` event instead.
```js
// Removed
app.on('renderer-process-crashed', (event, webContents, killed) => { /* ... */ })
// Replace with
app.on('render-process-gone', (event, webContents, details) => { /* ... */ })
```
### Removed: `crashed` event on `WebContents` and `<webview>`
The `crashed` events on `WebContents` and `<webview>` have been removed.
Use the new `render-process-gone` event instead.
```js
// Removed
win.webContents.on('crashed', (event, killed) => { /* ... */ })
webview.addEventListener('crashed', (event) => { /* ... */ })
// Replace with
win.webContents.on('render-process-gone', (event, details) => { /* ... */ })
webview.addEventListener('render-process-gone', (event) => { /* ... */ })
```
### Removed: `gpu-process-crashed` event on `app`
The `gpu-process-crashed` event on `app` has been removed.
Use the new `child-process-gone` event instead.
```js
// Removed
app.on('gpu-process-crashed', (event, killed) => { /* ... */ })
// Replace with
app.on('child-process-gone', (event, details) => { /* ... */ })
```
## Planned Breaking API Changes (28.0)
fix: disable background throttling also in the `viz::DisplayScheduler` (#38924) * fix: disable background throttling also in the `viz::DisplayScheduler` `viz::DisplayScheduler` is responsible for drawing and swapping frames in the `DisplayScheduler::DrawAndSwap` which is called from the `DisplayScheduler::AttemptDrawAndSwap` if the `DisplayScheduler::ShouldDraw` returns true. `ShouldDraw` depends on the `DisplayScheduler` visibility and when it is not visible then it returns false. In order to keep producing frames, disabling `backgroundThrottling` should also prevent changing `DisplayScheduler` visibility to false. `DisplayScheduler` lives in the `ui::Compositor` where every `electron::NativewWindow` has its own `Compositor`. `electron::NativewWindow` may be host of the multiple `electron::api::WebContents` instances which may have different `WebPreferences` settings. Therefore if at least one of the `WebContents` requires disabling throttling then all other `WebContents` using the same window will have it disabled in the `ui::Compositor`. BREAKING CHANGE: `backgroundThrottling` set to false will disable frames throttling in the `BrowserWindow` for all `WebContents` displayed by it. Close: [#31016](https://github.com/electron/electron/issues/31016) * fixup! fix: disable background throttling also in the `viz::DisplayScheduler` * fixup! fix: disable background throttling also in the `viz::DisplayScheduler` * fixup! fix: disable background throttling also in the `viz::DisplayScheduler` --------- Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-09-26 23:00:46 +03:00
### Behavior Changed: `WebContents.backgroundThrottling` set to false affects all `WebContents` in the host `BrowserWindow`
`WebContents.backgroundThrottling` set to false will disable frames throttling
in the `BrowserWindow` for all `WebContents` displayed by it.
### Removed: `BrowserWindow.setTrafficLightPosition(position)`
`BrowserWindow.setTrafficLightPosition(position)` has been removed, the
`BrowserWindow.setWindowButtonPosition(position)` API should be used instead
which accepts `null` instead of `{ x: 0, y: 0 }` to reset the position to
system default.
```js
// Removed in Electron 28
win.setTrafficLightPosition({ x: 10, y: 10 })
win.setTrafficLightPosition({ x: 0, y: 0 })
// Replace with
win.setWindowButtonPosition({ x: 10, y: 10 })
win.setWindowButtonPosition(null)
```
### Removed: `BrowserWindow.getTrafficLightPosition()`
`BrowserWindow.getTrafficLightPosition()` has been removed, the
`BrowserWindow.getWindowButtonPosition()` API should be used instead
which returns `null` instead of `{ x: 0, y: 0 }` when there is no custom
position.
```js
// Removed in Electron 28
const pos = win.getTrafficLightPosition()
if (pos.x === 0 && pos.y === 0) {
// No custom position.
}
// Replace with
const ret = win.getWindowButtonPosition()
if (ret === null) {
// No custom position.
}
```
### Removed: `ipcRenderer.sendTo()`
The `ipcRenderer.sendTo()` API has been removed. It should be replaced by setting up a [`MessageChannel`](tutorial/message-ports.md#setting-up-a-messagechannel-between-two-renderers) between the renderers.
The `senderId` and `senderIsMainFrame` properties of `IpcRendererEvent` have been removed as well.
### Removed: `app.runningUnderRosettaTranslation`
The `app.runningUnderRosettaTranslation` property has been removed.
Use `app.runningUnderARM64Translation` instead.
```js
// Removed
console.log(app.runningUnderRosettaTranslation)
// Replace with
console.log(app.runningUnderARM64Translation)
```
### Deprecated: `renderer-process-crashed` event on `app`
The `renderer-process-crashed` event on `app` has been deprecated.
Use the new `render-process-gone` event instead.
```js
// Deprecated
app.on('renderer-process-crashed', (event, webContents, killed) => { /* ... */ })
// Replace with
app.on('render-process-gone', (event, webContents, details) => { /* ... */ })
```
chore: bump chromium to 120.0.6099.0 (main) (#40316) * chore: bump chromium in DEPS to 120.0.6086.0 * chore: update patches * chore: rename FrameSubscriber::OnNewCropVersion() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4905819 just a simple renaming * chore: rename ToJsTime() to .InMillisecondsFSinceUnixEpoch() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4956111 function renamed upstream * chore: rename ToDoubleT() to .InSecondsFSinceUnixEpoch() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4956111 function renamed upstream * chore: rename FromDoubleT() to .FromSecondsSinceUnixEpoch() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4956111 function renamed upstream * chore: bump chromium in DEPS to 120.0.6088.2 * chore: update patches * chore: regen filenames.libcxx.gni * chore: migrate from (removed upstream) inputFormType to formControlType * chore: bump chromium in DEPS to 120.0.6089.0 * chore: update allow_disabling_blink_scheduler_throttling_per_renderview.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4828507 manually sync to upstream changes + reduce diff size * chore: update patches * chore: bump chromium in DEPS to 120.0.6090.0 * chore: update fix_disabling_background_throttling_in_compositor.patch no manual changes; patch applied with fuzz 2 (4 lines) Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4944206 * chore: update fix_handle_no_top_level_aura_window_in_webcontentsimpl.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4946653 do not patch WebContentsImpl::SetWindowShowState() any longer because it has been removed * chore: update patches * chore: bump chromium in DEPS to 120.0.6091.0 * chore: update patches * chore: bump chromium in DEPS to 120.0.6093.0 * chore: bump chromium in DEPS to 120.0.6095.0 * chore: bump chromium in DEPS to 120.0.6096.0 * chore: bump chromium in DEPS to 120.0.6097.0 * chore: update patches * chore: update patch after rebase * 4961495: [document pip] Focus the window when opened manually https://chromium-review.googlesource.com/c/chromium/src/+/4961495 * [Extensions UserScripts] Store extensions with user scripts in tracker | https://chromium-review.googlesource.com/c/chromium/src/+/4950530 * chore: bump chromium in DEPS to 120.0.6099.0 * chore: update patches * chore: update filenames.libcxx.gni * chore: remove trailing space --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-11-01 17:02:12 +03:00
### Deprecated: `params.inputFormType` property on `context-menu` on `WebContents`
The `inputFormType` property of the params object in the `context-menu`
event from `WebContents` has been deprecated. Use the new `formControlType`
property instead.
### Deprecated: `crashed` event on `WebContents` and `<webview>`
The `crashed` events on `WebContents` and `<webview>` have been deprecated.
Use the new `render-process-gone` event instead.
```js
// Deprecated
win.webContents.on('crashed', (event, killed) => { /* ... */ })
webview.addEventListener('crashed', (event) => { /* ... */ })
// Replace with
win.webContents.on('render-process-gone', (event, details) => { /* ... */ })
webview.addEventListener('render-process-gone', (event) => { /* ... */ })
```
### Deprecated: `gpu-process-crashed` event on `app`
The `gpu-process-crashed` event on `app` has been deprecated.
Use the new `child-process-gone` event instead.
```js
// Deprecated
app.on('gpu-process-crashed', (event, killed) => { /* ... */ })
// Replace with
app.on('child-process-gone', (event, details) => { /* ... */ })
```
## Planned Breaking API Changes (27.0)
### Removed: macOS 10.13 / 10.14 support
macOS 10.13 (High Sierra) and macOS 10.14 (Mojave) are no longer supported by [Chromium](https://chromium-review.googlesource.com/c/chromium/src/+/4629466).
Older versions of Electron will continue to run on these operating systems, but macOS 10.15 (Catalina)
or later will be required to run Electron v27.0.0 and higher.
### Deprecated: `ipcRenderer.sendTo()`
The `ipcRenderer.sendTo()` API has been deprecated. It should be replaced by setting up a [`MessageChannel`](tutorial/message-ports.md#setting-up-a-messagechannel-between-two-renderers) between the renderers.
The `senderId` and `senderIsMainFrame` properties of `IpcRendererEvent` have been deprecated as well.
### Removed: color scheme events in `systemPreferences`
The following `systemPreferences` events have been removed:
* `inverted-color-scheme-changed`
* `high-contrast-color-scheme-changed`
Use the new `updated` event on the `nativeTheme` module instead.
```js
// Removed
systemPreferences.on('inverted-color-scheme-changed', () => { /* ... */ })
systemPreferences.on('high-contrast-color-scheme-changed', () => { /* ... */ })
// Replace with
nativeTheme.on('updated', () => { /* ... */ })
```
### Removed: Some `window.setVibrancy` options on macOS
The following vibrancy options have been removed:
* 'light'
* 'medium-light'
* 'dark'
* 'ultra-dark'
* 'appearance-based'
These were previously deprecated and have been removed by Apple in 10.15.
### Removed: `webContents.getPrinters`
The `webContents.getPrinters` method has been removed. Use
`webContents.getPrintersAsync` instead.
```js
const w = new BrowserWindow({ show: false })
// Removed
console.log(w.webContents.getPrinters())
// Replace with
w.webContents.getPrintersAsync().then((printers) => {
console.log(printers)
})
```
### Removed: `systemPreferences.{get,set}AppLevelAppearance` and `systemPreferences.appLevelAppearance`
The `systemPreferences.getAppLevelAppearance` and `systemPreferences.setAppLevelAppearance`
methods have been removed, as well as the `systemPreferences.appLevelAppearance` property.
Use the `nativeTheme` module instead.
```js
// Removed
systemPreferences.getAppLevelAppearance()
// Replace with
nativeTheme.shouldUseDarkColors
// Removed
systemPreferences.appLevelAppearance
// Replace with
nativeTheme.shouldUseDarkColors
// Removed
systemPreferences.setAppLevelAppearance('dark')
// Replace with
nativeTheme.themeSource = 'dark'
```
### Removed: `alternate-selected-control-text` value for `systemPreferences.getColor`
The `alternate-selected-control-text` value for `systemPreferences.getColor`
has been removed. Use `selected-content-background` instead.
```js
// Removed
systemPreferences.getColor('alternate-selected-control-text')
// Replace with
systemPreferences.getColor('selected-content-background')
```
## Planned Breaking API Changes (26.0)
### Deprecated: `webContents.getPrinters`
The `webContents.getPrinters` method has been deprecated. Use
`webContents.getPrintersAsync` instead.
```js
const w = new BrowserWindow({ show: false })
// Deprecated
console.log(w.webContents.getPrinters())
// Replace with
w.webContents.getPrintersAsync().then((printers) => {
console.log(printers)
})
```
### Deprecated: `systemPreferences.{get,set}AppLevelAppearance` and `systemPreferences.appLevelAppearance`
The `systemPreferences.getAppLevelAppearance` and `systemPreferences.setAppLevelAppearance`
methods have been deprecated, as well as the `systemPreferences.appLevelAppearance` property.
Use the `nativeTheme` module instead.
```js
// Deprecated
systemPreferences.getAppLevelAppearance()
// Replace with
nativeTheme.shouldUseDarkColors
// Deprecated
systemPreferences.appLevelAppearance
// Replace with
nativeTheme.shouldUseDarkColors
// Deprecated
systemPreferences.setAppLevelAppearance('dark')
// Replace with
nativeTheme.themeSource = 'dark'
```
### Deprecated: `alternate-selected-control-text` value for `systemPreferences.getColor`
The `alternate-selected-control-text` value for `systemPreferences.getColor`
has been deprecated. Use `selected-content-background` instead.
```js
// Deprecated
systemPreferences.getColor('alternate-selected-control-text')
// Replace with
systemPreferences.getColor('selected-content-background')
```
2023-03-27 20:00:55 +03:00
## Planned Breaking API Changes (25.0)
### Deprecated: `protocol.{un,}{register,intercept}{Buffer,String,Stream,File,Http}Protocol` and `protocol.isProtocol{Registered,Intercepted}`
2023-03-27 20:00:55 +03:00
The `protocol.register*Protocol` and `protocol.intercept*Protocol` methods have
been replaced with [`protocol.handle`](api/protocol.md#protocolhandlescheme-handler).
The new method can either register a new protocol or intercept an existing
protocol, and responses can be of any type.
```js
// Deprecated in Electron 25
protocol.registerBufferProtocol('some-protocol', () => {
callback({ mimeType: 'text/html', data: Buffer.from('<h5>Response</h5>') })
})
// Replace with
protocol.handle('some-protocol', () => {
return new Response(
Buffer.from('<h5>Response</h5>'), // Could also be a string or ReadableStream.
{ headers: { 'content-type': 'text/html' } }
)
})
```
```js
// Deprecated in Electron 25
protocol.registerHttpProtocol('some-protocol', () => {
callback({ url: 'https://electronjs.org' })
})
// Replace with
protocol.handle('some-protocol', () => {
return net.fetch('https://electronjs.org')
})
```
```js
// Deprecated in Electron 25
protocol.registerFileProtocol('some-protocol', () => {
callback({ filePath: '/path/to/my/file' })
})
// Replace with
protocol.handle('some-protocol', () => {
return net.fetch('file:///path/to/my/file')
})
```
### Deprecated: `BrowserWindow.setTrafficLightPosition(position)`
`BrowserWindow.setTrafficLightPosition(position)` has been deprecated, the
`BrowserWindow.setWindowButtonPosition(position)` API should be used instead
which accepts `null` instead of `{ x: 0, y: 0 }` to reset the position to
system default.
```js
// Deprecated in Electron 25
win.setTrafficLightPosition({ x: 10, y: 10 })
win.setTrafficLightPosition({ x: 0, y: 0 })
// Replace with
win.setWindowButtonPosition({ x: 10, y: 10 })
win.setWindowButtonPosition(null)
```
### Deprecated: `BrowserWindow.getTrafficLightPosition()`
`BrowserWindow.getTrafficLightPosition()` has been deprecated, the
`BrowserWindow.getWindowButtonPosition()` API should be used instead
which returns `null` instead of `{ x: 0, y: 0 }` when there is no custom
position.
```js
// Deprecated in Electron 25
const pos = win.getTrafficLightPosition()
if (pos.x === 0 && pos.y === 0) {
// No custom position.
}
// Replace with
const ret = win.getWindowButtonPosition()
if (ret === null) {
// No custom position.
}
```
## Planned Breaking API Changes (24.0)
### API Changed: `nativeImage.createThumbnailFromPath(path, size)`
The `maxSize` parameter has been changed to `size` to reflect that the size passed in will be the size the thumbnail created. Previously, Windows would not scale the image up if it were smaller than `maxSize`, and
macOS would always set the size to `maxSize`. Behavior is now the same across platforms.
Updated Behavior:
```js
// a 128x128 image.
const imagePath = path.join('path', 'to', 'capybara.png')
// Scaling up a smaller image.
const upSize = { width: 256, height: 256 }
nativeImage.createThumbnailFromPath(imagePath, upSize).then(result => {
console.log(result.getSize()) // { width: 256, height: 256 }
})
// Scaling down a larger image.
const downSize = { width: 64, height: 64 }
nativeImage.createThumbnailFromPath(imagePath, downSize).then(result => {
console.log(result.getSize()) // { width: 64, height: 64 }
})
```
Previous Behavior (on Windows):
```js
// a 128x128 image
const imagePath = path.join('path', 'to', 'capybara.png')
const size = { width: 256, height: 256 }
nativeImage.createThumbnailFromPath(imagePath, size).then(result => {
console.log(result.getSize()) // { width: 128, height: 128 }
})
```
## Planned Breaking API Changes (23.0)
### Behavior Changed: Draggable Regions on macOS
The implementation of draggable regions (using the CSS property `-webkit-app-region: drag`) has changed on macOS to bring it in line with Windows and Linux. Previously, when a region with `-webkit-app-region: no-drag` overlapped a region with `-webkit-app-region: drag`, the `no-drag` region would always take precedence on macOS, regardless of CSS layering. That is, if a `drag` region was above a `no-drag` region, it would be ignored. Beginning in Electron 23, a `drag` region on top of a `no-drag` region will correctly cause the region to be draggable.
Additionally, the `customButtonsOnHover` BrowserWindow property previously created a draggable region which ignored the `-webkit-app-region` CSS property. This has now been fixed (see [#37210](https://github.com/electron/electron/issues/37210#issuecomment-1440509592) for discussion).
As a result, if your app uses a frameless window with draggable regions on macOS, the regions which are draggable in your app may change in Electron 23.
### Removed: Windows 7 / 8 / 8.1 support
[Windows 7, Windows 8, and Windows 8.1 are no longer supported](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice). Electron follows the planned Chromium deprecation policy, which will [deprecate Windows 7 support beginning in Chromium 109](https://support.google.com/chrome/thread/185534985/sunsetting-support-for-windows-7-8-8-1-in-early-2023?hl=en).
Older versions of Electron will continue to run on these operating systems, but Windows 10 or later will be required to run Electron v23.0.0 and higher.
### Removed: BrowserWindow `scroll-touch-*` events
The deprecated `scroll-touch-begin`, `scroll-touch-end` and `scroll-touch-edge`
events on BrowserWindow have been removed. Instead, use the newly available
[`input-event` event](api/web-contents.md#event-input-event) on WebContents.
```js
// Removed in Electron 23.0
win.on('scroll-touch-begin', scrollTouchBegin)
win.on('scroll-touch-edge', scrollTouchEdge)
win.on('scroll-touch-end', scrollTouchEnd)
// Replace with
win.webContents.on('input-event', (_, event) => {
if (event.type === 'gestureScrollBegin') {
scrollTouchBegin()
} else if (event.type === 'gestureScrollUpdate') {
scrollTouchEdge()
} else if (event.type === 'gestureScrollEnd') {
scrollTouchEnd()
}
})
```
### Removed: `webContents.incrementCapturerCount(stayHidden, stayAwake)`
The `webContents.incrementCapturerCount(stayHidden, stayAwake)` function has been removed.
It is now automatically handled by `webContents.capturePage` when a page capture completes.
```js
const w = new BrowserWindow({ show: false })
// Removed in Electron 23
w.webContents.incrementCapturerCount()
w.capturePage().then(image => {
console.log(image.toDataURL())
w.webContents.decrementCapturerCount()
})
// Replace with
w.capturePage().then(image => {
console.log(image.toDataURL())
})
```
### Removed: `webContents.decrementCapturerCount(stayHidden, stayAwake)`
The `webContents.decrementCapturerCount(stayHidden, stayAwake)` function has been removed.
It is now automatically handled by `webContents.capturePage` when a page capture completes.
```js
const w = new BrowserWindow({ show: false })
// Removed in Electron 23
w.webContents.incrementCapturerCount()
w.capturePage().then(image => {
console.log(image.toDataURL())
w.webContents.decrementCapturerCount()
})
// Replace with
w.capturePage().then(image => {
console.log(image.toDataURL())
})
```
## Planned Breaking API Changes (22.0)
### Deprecated: `webContents.incrementCapturerCount(stayHidden, stayAwake)`
`webContents.incrementCapturerCount(stayHidden, stayAwake)` has been deprecated.
It is now automatically handled by `webContents.capturePage` when a page capture completes.
```js
const w = new BrowserWindow({ show: false })
// Removed in Electron 23
w.webContents.incrementCapturerCount()
w.capturePage().then(image => {
console.log(image.toDataURL())
w.webContents.decrementCapturerCount()
})
// Replace with
w.capturePage().then(image => {
console.log(image.toDataURL())
})
```
### Deprecated: `webContents.decrementCapturerCount(stayHidden, stayAwake)`
`webContents.decrementCapturerCount(stayHidden, stayAwake)` has been deprecated.
It is now automatically handled by `webContents.capturePage` when a page capture completes.
```js
const w = new BrowserWindow({ show: false })
// Removed in Electron 23
w.webContents.incrementCapturerCount()
w.capturePage().then(image => {
console.log(image.toDataURL())
w.webContents.decrementCapturerCount()
})
// Replace with
w.capturePage().then(image => {
console.log(image.toDataURL())
})
```
### Removed: WebContents `new-window` event
The `new-window` event of WebContents has been removed. It is replaced by [`webContents.setWindowOpenHandler()`](api/web-contents.md#contentssetwindowopenhandlerhandler).
```js
// Removed in Electron 22
webContents.on('new-window', (event) => {
event.preventDefault()
})
// Replace with
webContents.setWindowOpenHandler((details) => {
return { action: 'deny' }
})
```
### Removed: `<webview>` `new-window` event
The `new-window` event of `<webview>` has been removed. There is no direct replacement.
```js
// Removed in Electron 22
webview.addEventListener('new-window', (event) => {})
```
```js
// Replace with
// main.js
mainWindow.webContents.on('did-attach-webview', (event, wc) => {
wc.setWindowOpenHandler((details) => {
mainWindow.webContents.send('webview-new-window', wc.id, details)
return { action: 'deny' }
})
})
// preload.js
const { ipcRenderer } = require('electron')
ipcRenderer.on('webview-new-window', (e, webContentsId, details) => {
console.log('webview-new-window', webContentsId, details)
document.getElementById('webview').dispatchEvent(new Event('new-window'))
})
// renderer.js
document.getElementById('webview').addEventListener('new-window', () => {
console.log('got new-window event')
})
```
### Deprecated: BrowserWindow `scroll-touch-*` events
The `scroll-touch-begin`, `scroll-touch-end` and `scroll-touch-edge` events on
BrowserWindow are deprecated. Instead, use the newly available
[`input-event` event](api/web-contents.md#event-input-event) on WebContents.
```js
// Deprecated
win.on('scroll-touch-begin', scrollTouchBegin)
win.on('scroll-touch-edge', scrollTouchEdge)
win.on('scroll-touch-end', scrollTouchEnd)
// Replace with
win.webContents.on('input-event', (_, event) => {
if (event.type === 'gestureScrollBegin') {
scrollTouchBegin()
} else if (event.type === 'gestureScrollUpdate') {
scrollTouchEdge()
} else if (event.type === 'gestureScrollEnd') {
scrollTouchEnd()
}
})
```
## Planned Breaking API Changes (21.0)
### Behavior Changed: V8 Memory Cage enabled
The V8 memory cage has been enabled, which has implications for native modules
which wrap non-V8 memory with `ArrayBuffer` or `Buffer`. See the
[blog post about the V8 memory cage](https://www.electronjs.org/blog/v8-memory-cage) for
more details.
### API Changed: `webContents.printToPDF()`
`webContents.printToPDF()` has been modified to conform to [`Page.printToPDF`](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF) in the Chrome DevTools Protocol. This has been changes in order to
address changes upstream that made our previous implementation untenable and rife with bugs.
**Arguments Changed**
* `pageRanges`
**Arguments Removed**
* `printSelectionOnly`
* `marginsType`
* `headerFooter`
* `scaleFactor`
**Arguments Added**
* `headerTemplate`
* `footerTemplate`
* `displayHeaderFooter`
* `margins`
* `scale`
* `preferCSSPageSize`
```js
// Main process
const { webContents } = require('electron')
webContents.printToPDF({
landscape: true,
displayHeaderFooter: true,
printBackground: true,
scale: 2,
pageSize: 'Ledger',
margins: {
top: 2,
bottom: 2,
left: 2,
right: 2
},
pageRanges: '1-5, 8, 11-13',
headerTemplate: '<h1>Title</h1>',
footerTemplate: '<div><span class="pageNumber"></span></div>',
preferCSSPageSize: true
}).then(data => {
fs.writeFile(pdfPath, data, (error) => {
if (error) throw error
console.log(`Wrote PDF successfully to ${pdfPath}`)
})
}).catch(error => {
console.log(`Failed to write PDF to ${pdfPath}: `, error)
})
```
## Planned Breaking API Changes (20.0)
### Removed: macOS 10.11 / 10.12 support
macOS 10.11 (El Capitan) and macOS 10.12 (Sierra) are no longer supported by [Chromium](https://chromium-review.googlesource.com/c/chromium/src/+/3646050).
Older versions of Electron will continue to run on these operating systems, but macOS 10.13 (High Sierra)
or later will be required to run Electron v20.0.0 and higher.
### Default Changed: renderers without `nodeIntegration: true` are sandboxed by default
Previously, renderers that specified a preload script defaulted to being
unsandboxed. This meant that by default, preload scripts had access to Node.js.
In Electron 20, this default has changed. Beginning in Electron 20, renderers
will be sandboxed by default, unless `nodeIntegration: true` or `sandbox: false`
is specified.
If your preload scripts do not depend on Node, no action is needed. If your
preload scripts _do_ depend on Node, either refactor them to remove Node usage
from the renderer, or explicitly specify `sandbox: false` for the relevant
renderers.
### Removed: `skipTaskbar` on Linux
On X11, `skipTaskbar` sends a `_NET_WM_STATE_SKIP_TASKBAR` message to the X11
window manager. There is not a direct equivalent for Wayland, and the known
workarounds have unacceptable tradeoffs (e.g. Window.is_skip_taskbar in GNOME
requires unsafe mode), so Electron is unable to support this feature on Linux.
chore: bump chromium to 105.0.5129.0 (main) (#34403) * chore: bump chromium in DEPS to 104.0.5096.0 * 3651284: Use the entry settings object for window.open navigation https://chromium-review.googlesource.com/c/chromium/src/+/3651284 * 3644598: Make RenderFrameHost used for notification permission decision https://chromium-review.googlesource.com/c/chromium/src/+/3644598 * 3642842: Window Placement: Prototype Fullscreen Capability Delegation - Part 2 https://chromium-review.googlesource.com/c/chromium/src/+/3642842 * 3652785: [sandbox] Enable sandboxed pointers on sanitizer builds https://chromium-review.googlesource.com/c/v8/v8/+/3652785 * 3611967: webhid: Migrate HidDelegate to use BrowserContext and Origin https://chromium-review.googlesource.com/c/chromium/src/+/3611967 * 3665762: Remove RenderFrameHost::IsRenderFrameCreated from //content/. https://chromium-review.googlesource.com/c/chromium/src/+/3665762 * 3659375: Fold x509_util_ios and most of x509_util_mac into x509_util_apple https://chromium-review.googlesource.com/c/chromium/src/+/3659375 * 3656234: [CodeHealth] Remove uses of base::ListValue::Append() (Final, take 2) https://chromium-review.googlesource.com/c/chromium/src/+/3656234 * chore: update patch indices * chore: fix lint * 3644598: Make RenderFrameHost used for notification permission decision https://chromium-review.googlesource.com/c/chromium/src/+/3644598 * webhid: Migrate HidDelegate to use BrowserContext and Origin This is a temporary fix for https://chromium-review.googlesource.com/c/chromium/src/+/3611967 to get the build compiling, but we need to either patch around https://chromium-review.googlesource.com/c/chromium/src/+/3611967 or move our device permissioning to BrowserContext * chore: fix lint * build: run electron/script/gen-libc++-filenames.js fixes gn check * chore: bump chromium in DEPS to 104.0.5098.0 * chore: disable flaking tests * 3682394: Change pipes surrounding code references in comments to backticks https://chromium-review.googlesource.com/c/chromium/src/+/3682394 * 3652749: Delete GLRenderer and related classes https://chromium-review.googlesource.com/c/chromium/src/+/3652749 * chore: fixup patch indices * 3671199: Remove ContentMainDelegate::PostFieldTrialInitialization https://chromium-review.googlesource.com/c/chromium/src/+/3671199 * 3607963: hid: Do not exclude HID device with no collections https://chromium-review.googlesource.com/c/chromium/src/+/3607963 * refactor: use ElectronBrowserContext instead of WebContents to persist devices due to changes like https://chromium-review.googlesource.com/c/chromium/src/+/3611967, we can no longer use WebContents to store device permissions so this commit moves device permission storage to live in memory in ElectronBrowserContext instead. * 3557253: Deprecate some signature checks https://chromium-review.googlesource.com/c/v8/v8/+/3557253 * chore: bump chromium in DEPS to 104.0.5100.0 * 3680781: Add policy for Renderer App Container. https://chromium-review.googlesource.com/c/chromium/src/+/3680781 * chore: update patch indices * 3675465: Update NetLog network service API to use mojom::DictionaryValue. https://chromium-review.googlesource.com/c/chromium/src/+/3675465 * chore: bump chromium in DEPS to 104.0.5102.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5103.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5104.0 * chore: update patches * fix: add patch for DCHECK in fullscreen test * build: fix nan build * build: make the nan spec runner work on macOS * chore: bump chromium in DEPS to 104.0.5106.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5108.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5110.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5112.0 * chore: bump chromium in DEPS to 105.0.5113.0 * chore: bump chromium in DEPS to 105.0.5115.0 * chore: bump chromium in DEPS to 105.0.5117.0 * chore: update patches * chore: update libcpp patch * 3693745: Delete base::LowerCaseEqualsASCII() Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3693745 * 3669226: Remove printing PostTask usage of IO thread Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3669226 * 3687395: Remove DictionaryValue::HasKey(). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3687395 * 3691014: Prevent unsafe narrowing: ui/accessibility, part 2 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3691014 * 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560567 * 3684873: [Bluetooth][Win/Linux] Add bluetooth pair confirmation prompt https://chromium-review.googlesource.com/c/chromium/src/+/3684873 * chore: bump chromium in DEPS to 105.0.5119.0 * chore: missing includes in desktop_notification_controller * chore: update patches * 3685951: Reland "Make sure screen object is created once in tests." https://chromium-review.googlesource.com/c/chromium/src/+/3685951 * fixup: Reland "Make sure screen object is created once in tests." * 3646014: [API] Deprecate LegacyOOMErrorCallback Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3646014 * chore: bump chromium in DEPS to 105.0.5121.0 * chore: update patches * 3699085: [cleanup] update PrintBackend::EnumeratePrinters to use reference Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3699085 * chore: bump chromium in DEPS to 105.0.5123.0 * chore: update patches * chore: bump chromium in DEPS to 105.0.5125.0 * chore: update patches * 3630082: [sandbox] Also enable the sandbox outside of Chromium builds Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3630082 * chore: bump chromium in DEPS to 105.0.5127.0 * chore: update patches * chore: bump chromium in DEPS to 105.0.5129.0 * chore: update patches * 3703741: Remove WebContents::GetMainFrame. https://chromium-review.googlesource.com/c/chromium/src/+/3703741 * chore: update patches * fixup! 3703741: Remove WebContents::GetMainFrame. * fix lint * more lint * chore: document breaking change * 3687671: [v8] Freeze flags after initialization https://chromium-review.googlesource.com/c/chromium/src/+/3687671 * fixup! 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors. * use the v8 allocator for node serdes * chore: update patches * remove faulty non-v8-sandbox-compatible code * make NodeArrayBufferAllocator use the v8 allocator under the hood * fixup! 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors. * fix build on windows * 3691954: [Reland][Extensions Bindings] Validate arguments sent to API events https://chromium-review.googlesource.com/c/chromium/src/+/3691954 * chore: remove deprecated AccessorSignatures https://github.com/nodejs/nan/pull/941 * Update patches/chromium/notification_provenance.patch Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * remove chore_expose_v8_initialization_isolate_callbacks.patch * add link to nodejs/nan#941 * 52026: Do not allow md4 or md5 based signatures in X.509 certificates. https://boringssl-review.googlesource.com/c/boringssl/+/52026 * chore: update patches * disable nan buffer-test * disable sandboxed pointers for now * force sandboxed pointers off * improve node allocation patch * restore accidentally dropped node crypto test patch Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@salesforce.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: VerteDinde <keeleymhammond@gmail.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Jeremy Rose <japthorp@slack-corp.com>
2022-06-27 23:50:08 +03:00
### API Changed: `session.setDevicePermissionHandler(handler)`
The handler invoked when `session.setDevicePermissionHandler(handler)` is used
has a change to its arguments. This handler no longer is passed a frame
[`WebFrameMain`](api/web-frame-main.md), but instead is passed the `origin`, which
chore: bump chromium to 105.0.5129.0 (main) (#34403) * chore: bump chromium in DEPS to 104.0.5096.0 * 3651284: Use the entry settings object for window.open navigation https://chromium-review.googlesource.com/c/chromium/src/+/3651284 * 3644598: Make RenderFrameHost used for notification permission decision https://chromium-review.googlesource.com/c/chromium/src/+/3644598 * 3642842: Window Placement: Prototype Fullscreen Capability Delegation - Part 2 https://chromium-review.googlesource.com/c/chromium/src/+/3642842 * 3652785: [sandbox] Enable sandboxed pointers on sanitizer builds https://chromium-review.googlesource.com/c/v8/v8/+/3652785 * 3611967: webhid: Migrate HidDelegate to use BrowserContext and Origin https://chromium-review.googlesource.com/c/chromium/src/+/3611967 * 3665762: Remove RenderFrameHost::IsRenderFrameCreated from //content/. https://chromium-review.googlesource.com/c/chromium/src/+/3665762 * 3659375: Fold x509_util_ios and most of x509_util_mac into x509_util_apple https://chromium-review.googlesource.com/c/chromium/src/+/3659375 * 3656234: [CodeHealth] Remove uses of base::ListValue::Append() (Final, take 2) https://chromium-review.googlesource.com/c/chromium/src/+/3656234 * chore: update patch indices * chore: fix lint * 3644598: Make RenderFrameHost used for notification permission decision https://chromium-review.googlesource.com/c/chromium/src/+/3644598 * webhid: Migrate HidDelegate to use BrowserContext and Origin This is a temporary fix for https://chromium-review.googlesource.com/c/chromium/src/+/3611967 to get the build compiling, but we need to either patch around https://chromium-review.googlesource.com/c/chromium/src/+/3611967 or move our device permissioning to BrowserContext * chore: fix lint * build: run electron/script/gen-libc++-filenames.js fixes gn check * chore: bump chromium in DEPS to 104.0.5098.0 * chore: disable flaking tests * 3682394: Change pipes surrounding code references in comments to backticks https://chromium-review.googlesource.com/c/chromium/src/+/3682394 * 3652749: Delete GLRenderer and related classes https://chromium-review.googlesource.com/c/chromium/src/+/3652749 * chore: fixup patch indices * 3671199: Remove ContentMainDelegate::PostFieldTrialInitialization https://chromium-review.googlesource.com/c/chromium/src/+/3671199 * 3607963: hid: Do not exclude HID device with no collections https://chromium-review.googlesource.com/c/chromium/src/+/3607963 * refactor: use ElectronBrowserContext instead of WebContents to persist devices due to changes like https://chromium-review.googlesource.com/c/chromium/src/+/3611967, we can no longer use WebContents to store device permissions so this commit moves device permission storage to live in memory in ElectronBrowserContext instead. * 3557253: Deprecate some signature checks https://chromium-review.googlesource.com/c/v8/v8/+/3557253 * chore: bump chromium in DEPS to 104.0.5100.0 * 3680781: Add policy for Renderer App Container. https://chromium-review.googlesource.com/c/chromium/src/+/3680781 * chore: update patch indices * 3675465: Update NetLog network service API to use mojom::DictionaryValue. https://chromium-review.googlesource.com/c/chromium/src/+/3675465 * chore: bump chromium in DEPS to 104.0.5102.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5103.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5104.0 * chore: update patches * fix: add patch for DCHECK in fullscreen test * build: fix nan build * build: make the nan spec runner work on macOS * chore: bump chromium in DEPS to 104.0.5106.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5108.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5110.0 * chore: update patches * chore: bump chromium in DEPS to 104.0.5112.0 * chore: bump chromium in DEPS to 105.0.5113.0 * chore: bump chromium in DEPS to 105.0.5115.0 * chore: bump chromium in DEPS to 105.0.5117.0 * chore: update patches * chore: update libcpp patch * 3693745: Delete base::LowerCaseEqualsASCII() Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3693745 * 3669226: Remove printing PostTask usage of IO thread Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3669226 * 3687395: Remove DictionaryValue::HasKey(). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3687395 * 3691014: Prevent unsafe narrowing: ui/accessibility, part 2 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3691014 * 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560567 * 3684873: [Bluetooth][Win/Linux] Add bluetooth pair confirmation prompt https://chromium-review.googlesource.com/c/chromium/src/+/3684873 * chore: bump chromium in DEPS to 105.0.5119.0 * chore: missing includes in desktop_notification_controller * chore: update patches * 3685951: Reland "Make sure screen object is created once in tests." https://chromium-review.googlesource.com/c/chromium/src/+/3685951 * fixup: Reland "Make sure screen object is created once in tests." * 3646014: [API] Deprecate LegacyOOMErrorCallback Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3646014 * chore: bump chromium in DEPS to 105.0.5121.0 * chore: update patches * 3699085: [cleanup] update PrintBackend::EnumeratePrinters to use reference Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3699085 * chore: bump chromium in DEPS to 105.0.5123.0 * chore: update patches * chore: bump chromium in DEPS to 105.0.5125.0 * chore: update patches * 3630082: [sandbox] Also enable the sandbox outside of Chromium builds Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3630082 * chore: bump chromium in DEPS to 105.0.5127.0 * chore: update patches * chore: bump chromium in DEPS to 105.0.5129.0 * chore: update patches * 3703741: Remove WebContents::GetMainFrame. https://chromium-review.googlesource.com/c/chromium/src/+/3703741 * chore: update patches * fixup! 3703741: Remove WebContents::GetMainFrame. * fix lint * more lint * chore: document breaking change * 3687671: [v8] Freeze flags after initialization https://chromium-review.googlesource.com/c/chromium/src/+/3687671 * fixup! 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors. * use the v8 allocator for node serdes * chore: update patches * remove faulty non-v8-sandbox-compatible code * make NodeArrayBufferAllocator use the v8 allocator under the hood * fixup! 3560567: [MSC] Porting GenerateStreams clients to handle stream vectors. * fix build on windows * 3691954: [Reland][Extensions Bindings] Validate arguments sent to API events https://chromium-review.googlesource.com/c/chromium/src/+/3691954 * chore: remove deprecated AccessorSignatures https://github.com/nodejs/nan/pull/941 * Update patches/chromium/notification_provenance.patch Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * remove chore_expose_v8_initialization_isolate_callbacks.patch * add link to nodejs/nan#941 * 52026: Do not allow md4 or md5 based signatures in X.509 certificates. https://boringssl-review.googlesource.com/c/boringssl/+/52026 * chore: update patches * disable nan buffer-test * disable sandboxed pointers for now * force sandboxed pointers off * improve node allocation patch * restore accidentally dropped node crypto test patch Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@salesforce.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: VerteDinde <keeleymhammond@gmail.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Jeremy Rose <japthorp@slack-corp.com>
2022-06-27 23:50:08 +03:00
is the origin that is checking for device permission.
## Planned Breaking API Changes (19.0)
### Removed: IA32 Linux binaries
This is a result of Chromium 102.0.4999.0 dropping support for IA32 Linux.
This concludes the [removal of support for IA32 Linux](#removed-ia32-linux-support).
## Planned Breaking API Changes (18.0)
### Removed: `nativeWindowOpen`
Prior to Electron 15, `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.
Since Electron 15, `nativeWindowOpen` has been enabled by default.
See the documentation for [window.open in Electron](api/window-open.md)
for more details.
## Planned Breaking API Changes (17.0)
### Removed: `desktopCapturer.getSources` in the renderer
The `desktopCapturer.getSources` API is now only available in the main process.
This has been changed in order to improve the default security of Electron
apps.
If you need this functionality, it can be replaced as follows:
```js
// Main process
const { ipcMain, desktopCapturer } = require('electron')
ipcMain.handle(
'DESKTOP_CAPTURER_GET_SOURCES',
(event, opts) => desktopCapturer.getSources(opts)
)
```
```js
// Renderer process
const { ipcRenderer } = require('electron')
const desktopCapturer = {
getSources: (opts) => ipcRenderer.invoke('DESKTOP_CAPTURER_GET_SOURCES', opts)
}
```
However, you should consider further restricting the information returned to
the renderer; for instance, displaying a source selector to the user and only
returning the selected source.
### Deprecated: `nativeWindowOpen`
Prior to Electron 15, `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.
Since Electron 15, `nativeWindowOpen` has been enabled by default.
See the documentation for [window.open in Electron](api/window-open.md)
for more details.
## Planned Breaking API Changes (16.0)
### Behavior Changed: `crashReporter` implementation switched to Crashpad on Linux
The underlying implementation of the `crashReporter` API on Linux has changed
from Breakpad to Crashpad, bringing it in line with Windows and Mac. As a
result of this, child processes are now automatically monitored, and calling
`process.crashReporter.start` in Node child processes is no longer needed (and
is not advisable, as it will start a second instance of the Crashpad reporter).
There are also some subtle changes to how annotations will be reported on
Linux, including that long values will no longer be split between annotations
appended with `__1`, `__2` and so on, and instead will be truncated at the
(new, longer) annotation value limit.
### Deprecated: `desktopCapturer.getSources` in the renderer
Usage of the `desktopCapturer.getSources` API in the renderer has been
deprecated and will be removed. This change improves the default security of
Electron apps.
See [here](#removed-desktopcapturergetsources-in-the-renderer) for details on
how to replace this API in your app.
## Planned Breaking API Changes (15.0)
### Default Changed: `nativeWindowOpen` defaults to `true`
Prior to Electron 15, `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](api/window-open.md)
for more details.
### Deprecated: `app.runningUnderRosettaTranslation`
The `app.runningUnderRosettaTranslation` property has been deprecated.
Use `app.runningUnderARM64Translation` instead.
```js
// Deprecated
console.log(app.runningUnderRosettaTranslation)
// Replace with
console.log(app.runningUnderARM64Translation)
```
## Planned Breaking API Changes (14.0)
### Removed: `remote` module
The `remote` module was deprecated in Electron 12, and will be removed in
Electron 14. It is replaced by the
[`@electron/remote`](https://github.com/electron/remote) module.
```js
// Deprecated in Electron 12:
const { BrowserWindow } = require('electron').remote
```
```js
// Replace with:
const { BrowserWindow } = require('@electron/remote')
// In the main process:
require('@electron/remote/main').initialize()
```
### Removed: `app.allowRendererProcessReuse`
The `app.allowRendererProcessReuse` property will be 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](https://github.com/electron/electron/issues/18397).
### Removed: Browser Window Affinity
The `affinity` option when constructing a new `BrowserWindow` will be 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](https://github.com/electron/electron/issues/18397).
### API Changed: `window.open()`
The optional parameter `frameName` will no longer set the title of the window. This now follows the specification described by the [native documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters) under the corresponding parameter `windowName`.
If you were using this parameter to set the title of a window, you can instead use [win.setTitle(title)](api/browser-window.md#winsettitletitle).
### Removed: `worldSafeExecuteJavaScript`
In Electron 14, `worldSafeExecuteJavaScript` will be removed. There is no alternative, please
ensure your code works with this property enabled. It has been enabled by default since Electron
12.
You will be affected by this change if you use either `webFrame.executeJavaScript` or `webFrame.executeJavaScriptInIsolatedWorld`. You will need to ensure that values returned by either of those methods are supported by the [Context Bridge API](api/context-bridge.md#parameter--error--return-type-support) as these methods use the same value passing semantics.
### 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 is removed, and
windows will not inherit any BrowserWindow constructor options from their
parents.
Instead, explicitly set options for the new window with `setWindowOpenHandler`:
```js
webContents.setWindowOpenHandler((details) => {
return {
action: 'allow',
overrideBrowserWindowOptions: {
// ...
}
}
})
```
### Removed: `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 `[]`. (Though note, the `new-window` event itself is
deprecated, and is replaced by `setWindowOpenHandler`.) Bare keys in window
features will now present as keys with the value `true` in the options object.
```js
// 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']) {
// ...
}
})
```
## Planned Breaking API Changes (13.0)
### API Changed: `session.setPermissionCheckHandler(handler)`
The `handler` methods first parameter was previously always a `webContents`, it can now sometimes be `null`. You should use the `requestingOrigin`, `embeddingOrigin` and `securityOrigin` properties to respond to the permission check correctly. As the `webContents` can be `null` it can no longer be relied on.
```js
// Old code
session.setPermissionCheckHandler((webContents, permission) => {
if (webContents.getURL().startsWith('https://google.com/') && permission === 'notification') {
return true
}
return false
})
// Replace with
session.setPermissionCheckHandler((webContents, permission, requestingOrigin) => {
if (new URL(requestingOrigin).hostname === 'google.com' && permission === 'notification') {
return true
}
return false
})
```
### Removed: `shell.moveItemToTrash()`
The deprecated synchronous `shell.moveItemToTrash()` API has been removed. Use
the asynchronous `shell.trashItem()` instead.
```js
// Removed in Electron 13
shell.moveItemToTrash(path)
// Replace with
shell.trashItem(path).then(/* ... */)
```
### Removed: `BrowserWindow` extension APIs
The deprecated extension APIs have been removed:
* `BrowserWindow.addExtension(path)`
* `BrowserWindow.addDevToolsExtension(path)`
* `BrowserWindow.removeExtension(name)`
* `BrowserWindow.removeDevToolsExtension(name)`
* `BrowserWindow.getExtensions()`
* `BrowserWindow.getDevToolsExtensions()`
Use the session APIs instead:
* `ses.loadExtension(path)`
* `ses.removeExtension(extension_id)`
* `ses.getAllExtensions()`
```js
// Removed in Electron 13
BrowserWindow.addExtension(path)
BrowserWindow.addDevToolsExtension(path)
// Replace with
session.defaultSession.loadExtension(path)
```
```js
// Removed in Electron 13
BrowserWindow.removeExtension(name)
BrowserWindow.removeDevToolsExtension(name)
// Replace with
session.defaultSession.removeExtension(extension_id)
```
```js
// Removed in Electron 13
BrowserWindow.getExtensions()
BrowserWindow.getDevToolsExtensions()
// Replace with
session.defaultSession.getAllExtensions()
```
### Removed: methods in `systemPreferences`
The following `systemPreferences` methods have been deprecated:
* `systemPreferences.isDarkMode()`
* `systemPreferences.isInvertedColorScheme()`
* `systemPreferences.isHighContrastColorScheme()`
Use the following `nativeTheme` properties instead:
* `nativeTheme.shouldUseDarkColors`
* `nativeTheme.shouldUseInvertedColorScheme`
* `nativeTheme.shouldUseHighContrastColors`
```js
// Removed in Electron 13
systemPreferences.isDarkMode()
// Replace with
nativeTheme.shouldUseDarkColors
// Removed in Electron 13
systemPreferences.isInvertedColorScheme()
// Replace with
nativeTheme.shouldUseInvertedColorScheme
// Removed in Electron 13
systemPreferences.isHighContrastColorScheme()
// Replace with
nativeTheme.shouldUseHighContrastColors
```
### Deprecated: WebContents `new-window` event
The `new-window` event of WebContents has been deprecated. It is replaced by [`webContents.setWindowOpenHandler()`](api/web-contents.md#contentssetwindowopenhandlerhandler).
```js
// Deprecated in Electron 13
webContents.on('new-window', (event) => {
event.preventDefault()
})
// Replace with
webContents.setWindowOpenHandler((details) => {
return { action: 'deny' }
})
```
## Planned Breaking API Changes (12.0)
chore: bump chromium to 6b9fa6b352d824d052222e1abe541 (master) (#25558) * chore: bump chromium in DEPS to d5c9bf9e2a18fa508201a88e5803bec1d107b1ae * chore: bump chromium in DEPS to 45f1316afae33e52c92480b34bf4f7fe4a7db898 * update patches * WillCreateURLLoaderFactory now gets a ukm_source_id Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2346803 * ink_drop_visible_opacity -> GetInkDropVisibleOpacity Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2415368 * chore: bump chromium in DEPS to ddb5b6db5e35ab1a7b5adbd9f15373af6c35ea2a * 2418471: PDF Viewer update: Add missing aria-labels to various buttons. https://chromium-review.googlesource.com/c/chromium/src/+/2418471 * update printing.patch given print settings mojoification Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2409467 * update patches * content::BluetoothChooser::Event -> content::BluetoothChooserEvent Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2387901 * set_ink_drop_base_color -> SetInkDropBaseColor Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2419388 * chore: bump chromium in DEPS to ecf7c9ee830d4d85f300b461a2fa13aa40c79a4c * update patches * gfx::ConvertPointToPixel -> gfx::ConvertPointToPixels Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2418568 * remove ContentSettingsObserver::AllowStorage() Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2401847 * service_manager::kCrashDumpSignal -> kCrashDumpSignal Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2417073 * chore: bump chromium in DEPS to abdb7ebe5f8c8328b8f435283df90d0a3ecff7bd * chore: bump chromium in DEPS to 2a7e138ab1066534ceb2622e8a9d2c8ebf574215 * chore: bump chromium in DEPS to ab1884e75ced904e4276851eb4e1ad89919ca93b * chore: bump chromium in DEPS to a12413902380dcc2a73ac74d582328280a8af686 * Fixup printing patch https://chromium-review.googlesource.com/c/chromium/src/+/2428623 * Fixup OSR patch https://chromium-review.googlesource.com/c/chromium/src/+/2415128 * Make ExtensionURLLoaderFactory always owned by its |receivers_|. https://chromium-review.googlesource.com/c/chromium/src/+/2357523 * Add deprecated_default_sources_assignment_filter variable https://chromium-review.googlesource.com/c/chromium/src/+/2416496 * Fixup patch indices * Remove several references to BrowserPlugin from content https://chromium-review.googlesource.com/c/chromium/src/+/2401031 * Remove SurfaceEmbeddingTime and LocalSurfaceIdAllocation https://chromium-review.googlesource.com/c/chromium/src/+/2415128 * Add DragOperation and AllowedDragOperations Mojo types https://chromium-review.googlesource.com/c/chromium/src/+/2196167 * chore: bump chromium in DEPS to 378450342cf6aa160663d0ce3a178a11b570c25a * Fixup patch indices * Remove SurfaceEmbeddingTime and LocalSurfaceIdAllocation https://chromium-review.googlesource.com/c/chromium/src/+/2415128 * Add DragOperation and AllowedDragOperations Mojo types https://chromium-review.googlesource.com/c/chromium/src/+/2196167 * 2426564: Remove global sources assignment filter value https://chromium-review.googlesource.com/c/chromium/src/+/2426564 * Fixup blink_local_frame.patch * [XProto] Remove a subset of ui/gfx/x/x11.h https://chromium-review.googlesource.com/c/chromium/src/+/2430328 * Fixup patch indices * Remove several references to BrowserPlugin from content https://chromium-review.googlesource.com/c/chromium/src/+/2401031 * Remove lossy ConvertSizeToPixel() methods https://chromium-review.googlesource.com/c/chromium/src/+/2419534 * serial: Use USB driver name to disambiguate ports https://chromium-review.googlesource.com/c/chromium/src/+/2413176 * Remove set_sources_filter import * Fix ModMask usage * [XProto] Remove usage of all Xlib headers https://chromium-review.googlesource.com/c/chromium/src/+/2392140 * [XProto] Remove usage of Xlib Visuals https://chromium-review.googlesource.com/c/chromium/src/+/2429933 * Skip Angle manifest file https://chromium-review.googlesource.com/c/angle/angle/+/2425197 * Add whole src\third_party\angle\.git directory This directory is needed in order to properly generate gen/angle/angle_commit.h * [libvpx] Fix HighBD config on Windows ARM64 https://chromium-review.googlesource.com/c/chromium/src/+/2437745 * update patches * fix: correct calling convention for Windows on Arm https://chromium-review.googlesource.com/c/v8/v8/+/2440717 * Add third_party/angle/.git to the archive before adding the rest of the source * fixup source caching on Windows * Fixup erroneous close paren * fixup for goma issues * This should work * chore: bump chromium roll manually https://chromium-review.googlesource.com/c/chromium/src/+/2435142 This landed the day after we paused roller-bot and may resolve the visibility test flakes that we're seeing. h/t to @jkleinsc for finding this with me. * chore: remove obsoleted cherry-pick fix for libvpx https://chromium-review.googlesource.com/c/chromium/src/+/2437745 * chore: remove obsoleted cherry-pick libvpx patch https://chromium-review.googlesource.com/c/chromium/src/+/2437745 * chore: re-export patches * chore: add tracer comment to visibility-stat-spec. The line numbers between the source and the CI runs don't seem to match up, so this temp tracer is to help track the source of that difference. * chore: bump chromium in DEPS to 7c2b8cc3b8638aee8abeb013042a6c1d15b2da6b * update patches * impl SortingLSH service Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2425327 * 2446525: [Flash] Remove some Flash APIs https://chromium-review.googlesource.com/c/chromium/src/+/2446525 * 2440974: Reland "Delete service_manager/embedder/switches.h" https://chromium-review.googlesource.com/c/chromium/src/+/2440974 * 2359402: Remove ContentBrowserClient::NonNetworkURLLoaderFactoryDeprecatedMap. https://chromium-review.googlesource.com/c/chromium/src/+/2359402 * 2250506: Implement tabs.removeCSS https://chromium-review.googlesource.com/c/chromium/src/+/2250506 * 2429143: Remove implicit-conversion-to-integer ConvertRectToPixel() methods. https://chromium-review.googlesource.com/c/chromium/src/+/2429143 * 2444430: Remove DataElementType::kBlob https://chromium-review.googlesource.com/c/chromium/src/+/2444430 * 2441964: Clean up WebView public API https://chromium-review.googlesource.com/c/chromium/src/+/2441964 * 2357523: Make ExtensionURLLoaderFactory always owned by its |receivers_|. https://chromium-review.googlesource.com/c/chromium/src/+/2357523 * 2461606: Use blink::mojom::PreferredColorScheme instead of blink::PreferredColorScheme https://chromium-review.googlesource.com/c/chromium/src/+/2461606 * 2461235: a11y inspect reorg: move PropertyFilter struct to a new location https://chromium-review.googlesource.com/c/chromium/src/+/2461235 * remove flash support * fix frame_host_manager patch * fix lint * remove flash info from docs * fix build * fix osr * chore: bump chromium in DEPS to 9269f9eb1d98d29564c2b2ab97f30c6e148c4e11 * fix visibilityState tests * 2463049: Replace all uses of web_pref::AutoplayPolicy with mojom::AutoplayPolicy https://chromium-review.googlesource.com/c/chromium/src/+/2463049 * update patches * fix tests harder * 2414921: Add Group and Ungroup functions to Tabs extension API https://chromium-review.googlesource.com/c/chromium/src/+/2414921 * more test fix * Remove all keyboard related usage of Xlib Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2436787 * fix linux build * 2453807: [XProto] Remove usage of Xlib error handling https://chromium-review.googlesource.com/c/chromium/src/+/2453807 * lint * fixup! 2453807: [XProto] Remove usage of Xlib error handling * disable CalculateNativeWinOcclusion on win ci * remove UploadBlob from docs * Update appveyor.yml Co-authored-by: Andy Locascio <andy@slack-corp.com> Co-authored-by: John Kleinschmidt <jkleinsc@github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Jeremy Rose <nornagon@nornagon.net> Co-authored-by: Electron Bot <anonymous@electronjs.org> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2020-10-16 04:30:41 +03:00
### Removed: Pepper Flash support
Chromium has removed support for Flash, and so we must follow suit. See
Chromium's [Flash Roadmap](https://www.chromium.org/flash-roadmap) for more
details.
### Default Changed: `worldSafeExecuteJavaScript` defaults to `true`
In Electron 12, `worldSafeExecuteJavaScript` will be enabled by default. To restore
the previous behavior, `worldSafeExecuteJavaScript: false` must be specified in WebPreferences.
Please note that setting this option to `false` is **insecure**.
This option will be removed in Electron 14 so please migrate your code to support the default
value.
### Default Changed: `contextIsolation` defaults to `true`
In Electron 12, `contextIsolation` will be enabled by default. To restore
the previous behavior, `contextIsolation: false` must be specified in WebPreferences.
We [recommend having contextIsolation enabled](tutorial/security.md#3-enable-context-isolation) for the security of your application.
Another implication is that `require()` cannot be used in the renderer process unless
`nodeIntegration` is `true` and `contextIsolation` is `false`.
For more details see: https://github.com/electron/electron/issues/23506
### Removed: `crashReporter.getCrashesDirectory()`
The `crashReporter.getCrashesDirectory` method has been removed. Usage
should be replaced by `app.getPath('crashDumps')`.
```js
// Removed in Electron 12
crashReporter.getCrashesDirectory()
// Replace with
app.getPath('crashDumps')
```
### Removed: `crashReporter` methods in the renderer process
The following `crashReporter` methods are no longer available in the renderer
process:
* `crashReporter.start`
* `crashReporter.getLastCrashReport`
* `crashReporter.getUploadedReports`
* `crashReporter.getUploadToServer`
* `crashReporter.setUploadToServer`
* `crashReporter.getCrashesDirectory`
They should be called only from the main process.
See [#23265](https://github.com/electron/electron/pull/23265) for more details.
### Default Changed: `crashReporter.start({ compress: true })`
The default value of the `compress` option to `crashReporter.start` has changed
from `false` to `true`. This means that crash dumps will be uploaded to the
crash ingestion server with the `Content-Encoding: gzip` header, and the body
will be compressed.
If your crash ingestion server does not support compressed payloads, you can
turn off compression by specifying `{ compress: false }` in the crash reporter
options.
2020-09-10 19:17:17 +03:00
### Deprecated: `remote` module
The `remote` module is deprecated in Electron 12, and will be removed in
Electron 14. It is replaced by the
[`@electron/remote`](https://github.com/electron/remote) module.
```js
// Deprecated in Electron 12:
const { BrowserWindow } = require('electron').remote
```
```js
// Replace with:
const { BrowserWindow } = require('@electron/remote')
// In the main process:
require('@electron/remote/main').initialize()
```
### Deprecated: `shell.moveItemToTrash()`
The synchronous `shell.moveItemToTrash()` has been replaced by the new,
asynchronous `shell.trashItem()`.
```js
// Deprecated in Electron 12
shell.moveItemToTrash(path)
// Replace with
shell.trashItem(path).then(/* ... */)
```
## Planned Breaking API Changes (11.0)
### Removed: `BrowserView.{destroy, fromId, fromWebContents, getAllViews}` and `id` property of `BrowserView`
2020-11-19 07:58:47 +03:00
The experimental APIs `BrowserView.{destroy, fromId, fromWebContents, getAllViews}`
have now been removed. Additionally, the `id` property of `BrowserView`
has also been removed.
For more detailed information, see [#23578](https://github.com/electron/electron/pull/23578).
## Planned Breaking API Changes (10.0)
### Deprecated: `companyName` argument to `crashReporter.start()`
The `companyName` argument to `crashReporter.start()`, which was previously
required, is now optional, and further, is deprecated. To get the same
behavior in a non-deprecated way, you can pass a `companyName` value in
`globalExtra`.
```js
// Deprecated in Electron 10
crashReporter.start({ companyName: 'Umbrella Corporation' })
// Replace with
crashReporter.start({ globalExtra: { _companyName: 'Umbrella Corporation' } })
```
### Deprecated: `crashReporter.getCrashesDirectory()`
The `crashReporter.getCrashesDirectory` method has been deprecated. Usage
should be replaced by `app.getPath('crashDumps')`.
```js
// Deprecated in Electron 10
crashReporter.getCrashesDirectory()
// Replace with
app.getPath('crashDumps')
```
### Deprecated: `crashReporter` methods in the renderer process
Calling the following `crashReporter` methods from the renderer process is
deprecated:
* `crashReporter.start`
* `crashReporter.getLastCrashReport`
* `crashReporter.getUploadedReports`
* `crashReporter.getUploadToServer`
* `crashReporter.setUploadToServer`
* `crashReporter.getCrashesDirectory`
The only non-deprecated methods remaining in the `crashReporter` module in the
renderer are `addExtraParameter`, `removeExtraParameter` and `getParameters`.
All above methods remain non-deprecated when called from the main process.
See [#23265](https://github.com/electron/electron/pull/23265) for more details.
### Deprecated: `crashReporter.start({ compress: false })`
Setting `{ compress: false }` in `crashReporter.start` is deprecated. Nearly
all crash ingestion servers support gzip compression. This option will be
removed in a future version of Electron.
### Default Changed: `enableRemoteModule` defaults to `false`
In Electron 9, using the remote module without explicitly enabling it via the
`enableRemoteModule` WebPreferences option began emitting a warning. In
Electron 10, the remote module is now disabled by default. To use the remote
module, `enableRemoteModule: true` must be specified in WebPreferences:
```js
const w = new BrowserWindow({
webPreferences: {
enableRemoteModule: true
}
})
```
We [recommend moving away from the remote module](https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31).
### `protocol.unregisterProtocol`
2020-11-19 07:58:47 +03:00
### `protocol.uninterceptProtocol`
The APIs are now synchronous and the optional callback is no longer needed.
```js
// Deprecated
protocol.unregisterProtocol(scheme, () => { /* ... */ })
// Replace with
protocol.unregisterProtocol(scheme)
```
### `protocol.registerFileProtocol`
2020-11-19 07:58:47 +03:00
### `protocol.registerBufferProtocol`
2020-11-19 07:58:47 +03:00
### `protocol.registerStringProtocol`
2020-11-19 07:58:47 +03:00
### `protocol.registerHttpProtocol`
2020-11-19 07:58:47 +03:00
### `protocol.registerStreamProtocol`
2020-11-19 07:58:47 +03:00
### `protocol.interceptFileProtocol`
2020-11-19 07:58:47 +03:00
### `protocol.interceptStringProtocol`
2020-11-19 07:58:47 +03:00
### `protocol.interceptBufferProtocol`
2020-11-19 07:58:47 +03:00
### `protocol.interceptHttpProtocol`
2020-11-19 07:58:47 +03:00
### `protocol.interceptStreamProtocol`
The APIs are now synchronous and the optional callback is no longer needed.
```js
// Deprecated
protocol.registerFileProtocol(scheme, handler, () => { /* ... */ })
// Replace with
protocol.registerFileProtocol(scheme, handler)
```
The registered or intercepted protocol does not have effect on current page
until navigation happens.
### `protocol.isProtocolHandled`
This API is deprecated and users should use `protocol.isProtocolRegistered`
and `protocol.isProtocolIntercepted` instead.
```js
// Deprecated
protocol.isProtocolHandled(scheme).then(() => { /* ... */ })
// Replace with
const isRegistered = protocol.isProtocolRegistered(scheme)
const isIntercepted = protocol.isProtocolIntercepted(scheme)
```
## Planned Breaking API Changes (9.0)
### Default Changed: Loading non-context-aware native modules in the renderer process is disabled by default
As of Electron 9 we do not allow loading of non-context-aware native modules in
the renderer process. This is to improve security, performance and maintainability
of Electron as a project.
If this impacts you, you can temporarily set `app.allowRendererProcessReuse` to `false`
to revert to the old behavior. This flag will only be an option until Electron 11 so
you should plan to update your native modules to be context aware.
For more detailed information see [#18397](https://github.com/electron/electron/issues/18397).
### Deprecated: `BrowserWindow` extension APIs
The following extension APIs have been deprecated:
* `BrowserWindow.addExtension(path)`
* `BrowserWindow.addDevToolsExtension(path)`
* `BrowserWindow.removeExtension(name)`
* `BrowserWindow.removeDevToolsExtension(name)`
* `BrowserWindow.getExtensions()`
* `BrowserWindow.getDevToolsExtensions()`
Use the session APIs instead:
* `ses.loadExtension(path)`
* `ses.removeExtension(extension_id)`
* `ses.getAllExtensions()`
```js
// Deprecated in Electron 9
BrowserWindow.addExtension(path)
BrowserWindow.addDevToolsExtension(path)
// Replace with
session.defaultSession.loadExtension(path)
```
```js
// Deprecated in Electron 9
BrowserWindow.removeExtension(name)
BrowserWindow.removeDevToolsExtension(name)
// Replace with
session.defaultSession.removeExtension(extension_id)
```
```js
// Deprecated in Electron 9
BrowserWindow.getExtensions()
BrowserWindow.getDevToolsExtensions()
// Replace with
session.defaultSession.getAllExtensions()
```
### Removed: `<webview>.getWebContents()`
This API, which was deprecated in Electron 8.0, is now removed.
```js
// Removed in Electron 9.0
webview.getWebContents()
// Replace with
const { remote } = require('electron')
remote.webContents.fromId(webview.getWebContentsId())
```
### Removed: `webFrame.setLayoutZoomLevelLimits()`
Chromium has removed support for changing the layout zoom level limits, and it
is beyond Electron's capacity to maintain it. The function was deprecated in
Electron 8.x, and has been removed in Electron 9.x. The layout zoom level limits
are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined
[here](https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11).
### Behavior Changed: Sending non-JS objects over IPC now throws an exception
In Electron 8.0, IPC was changed to use the Structured Clone Algorithm,
bringing significant performance improvements. To help ease the transition, the
old IPC serialization algorithm was kept and used for some objects that aren't
serializable with Structured Clone. In particular, DOM objects (e.g. `Element`,
`Location` and `DOMMatrix`), Node.js objects backed by C++ classes (e.g.
`process.env`, some members of `Stream`), and Electron objects backed by C++
classes (e.g. `WebContents`, `BrowserWindow` and `WebFrame`) are not
serializable with Structured Clone. Whenever the old algorithm was invoked, a
deprecation warning was printed.
In Electron 9.0, the old serialization algorithm has been removed, and sending
such non-serializable objects will now throw an "object could not be cloned"
error.
### API Changed: `shell.openItem` is now `shell.openPath`
The `shell.openItem` API has been replaced with an asynchronous `shell.openPath` API.
You can see the original API proposal and reasoning [here](https://github.com/electron/governance/blob/main/wg-api/spec-documents/shell-openitem.md).
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
## Planned Breaking API Changes (8.0)
### Behavior Changed: Values sent over IPC are now serialized with Structured Clone Algorithm
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
The algorithm used to serialize objects sent over IPC (through `ipcRenderer.send`,
`ipcRenderer.sendSync`, `WebContents.send` and related methods) has been switched from a custom
algorithm to V8's built-in [Structured Clone Algorithm][SCA], the same algorithm used to serialize
messages for `postMessage`. This brings about a 2x performance improvement for large messages,
but also brings some breaking changes in behavior.
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
* Sending Functions, Promises, WeakMaps, WeakSets, or objects containing any
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
such values, over IPC will now throw an exception, instead of silently
converting the functions to `undefined`.
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
```js
// Previously:
ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
// => results in { value: 3 } arriving in the main process
// From Electron 8:
ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
// => throws Error("() => {} could not be cloned.")
```
* `NaN`, `Infinity` and `-Infinity` will now be correctly serialized, instead
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
of being converted to `null`.
* Objects containing cyclic references will now be correctly serialized,
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
instead of being converted to `null`.
* `Set`, `Map`, `Error` and `RegExp` values will be correctly serialized,
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
instead of being converted to `{}`.
* `BigInt` values will be correctly serialized, instead of being converted to
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
`null`.
* Sparse arrays will be serialized as such, instead of being converted to dense
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
arrays with `null`s.
* `Date` objects will be transferred as `Date` objects, instead of being
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
converted to their ISO string representation.
* Typed Arrays (such as `Uint8Array`, `Uint16Array`, `Uint32Array` and so on)
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
will be transferred as such, instead of being converted to Node.js `Buffer`.
* Node.js `Buffer` objects will be transferred as `Uint8Array`s. You can
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
convert a `Uint8Array` back to a Node.js `Buffer` by wrapping the underlying
`ArrayBuffer`:
refactor: use v8 serialization for ipc (#20214) * refactor: use v8 serialization for ipc * cloning process.env doesn't work * serialize host objects by enumerating key/values * new serialization can handle NaN, Infinity, and undefined correctly * can't allocate v8 objects during GC * backport microtasks fix * fix compile * fix node_stream_loader reentrancy * update subframe spec to expect undefined instead of null * write undefined instead of crashing when serializing host objects * fix webview spec * fix download spec * buffers are transformed into uint8arrays * can't serialize promises * fix chrome.i18n.getMessage * fix devtools tests * fix zoom test * fix debug build * fix lint * update ipcRenderer tests * fix printToPDF test * update patch * remove accidentally re-added remote-side spec * wip * don't attempt to serialize host objects * jump through different hoops to set options.webContents sometimes * whoops * fix lint * clean up error-handling logic * fix memory leak * fix lint * convert host objects using old base::Value serialization * fix lint more * fall back to base::Value-based serialization * remove commented-out code * add docs to breaking-changes.md * Update breaking-changes.md * update ipcRenderer and WebContents docs * lint * use named values for format tag * save a memcpy for ~30% speedup * get rid of calls to ShallowClone * extra debugging for paranoia * d'oh, use the correct named tags * apparently msstl doesn't like this DCHECK * funny story about that DCHECK * disable remote-related functions when enable_remote_module = false * nits * use EnableIf to disable remote methods in mojom * fix include * review comments
2019-10-09 20:59:08 +03:00
```js
Buffer.from(value.buffer, value.byteOffset, value.byteLength)
```
Sending any objects that aren't native JS types, such as DOM objects (e.g.
`Element`, `Location`, `DOMMatrix`), Node.js objects (e.g. `process.env`,
`Stream`), or Electron objects (e.g. `WebContents`, `BrowserWindow`,
`WebFrame`) is deprecated. In Electron 8, these objects will be serialized as
before with a DeprecationWarning message, but starting in Electron 9, sending
these kinds of objects will throw a 'could not be cloned' error.
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
### Deprecated: `<webview>.getWebContents()`
This API is implemented using the `remote` module, which has both performance
and security implications. Therefore its usage should be explicit.
```js
// Deprecated
webview.getWebContents()
// Replace with
const { remote } = require('electron')
remote.webContents.fromId(webview.getWebContentsId())
```
However, it is recommended to avoid using the `remote` module altogether.
```js
// main
const { ipcMain, webContents } = require('electron')
const getGuestForWebContents = (webContentsId, contents) => {
const guest = webContents.fromId(webContentsId)
if (!guest) {
throw new Error(`Invalid webContentsId: ${webContentsId}`)
}
if (guest.hostWebContents !== contents) {
2020-07-09 20:18:49 +03:00
throw new Error('Access denied to webContents')
}
return guest
}
ipcMain.handle('openDevTools', (event, webContentsId) => {
const guest = getGuestForWebContents(webContentsId, event.sender)
guest.openDevTools()
})
// renderer
const { ipcRenderer } = require('electron')
ipcRenderer.invoke('openDevTools', webview.getWebContentsId())
```
### Deprecated: `webFrame.setLayoutZoomLevelLimits()`
Chromium has removed support for changing the layout zoom level limits, and it
is beyond Electron's capacity to maintain it. The function will emit a warning
in Electron 8.x, and cease to exist in Electron 9.x. The layout zoom level
limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined
[here](https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11).
### Deprecated events in `systemPreferences`
The following `systemPreferences` events have been deprecated:
* `inverted-color-scheme-changed`
* `high-contrast-color-scheme-changed`
Use the new `updated` event on the `nativeTheme` module instead.
```js
// Deprecated
systemPreferences.on('inverted-color-scheme-changed', () => { /* ... */ })
systemPreferences.on('high-contrast-color-scheme-changed', () => { /* ... */ })
// Replace with
nativeTheme.on('updated', () => { /* ... */ })
```
### Deprecated: methods in `systemPreferences`
The following `systemPreferences` methods have been deprecated:
* `systemPreferences.isDarkMode()`
* `systemPreferences.isInvertedColorScheme()`
* `systemPreferences.isHighContrastColorScheme()`
Use the following `nativeTheme` properties instead:
* `nativeTheme.shouldUseDarkColors`
* `nativeTheme.shouldUseInvertedColorScheme`
* `nativeTheme.shouldUseHighContrastColors`
```js
// Deprecated
systemPreferences.isDarkMode()
// Replace with
nativeTheme.shouldUseDarkColors
// Deprecated
systemPreferences.isInvertedColorScheme()
// Replace with
nativeTheme.shouldUseInvertedColorScheme
// Deprecated
systemPreferences.isHighContrastColorScheme()
// Replace with
nativeTheme.shouldUseHighContrastColors
```
## Planned Breaking API Changes (7.0)
### Deprecated: Atom.io Node Headers URL
This is the URL specified as `disturl` in a `.npmrc` file or as the `--dist-url`
command line flag when building native Node modules. Both will be supported for
the foreseeable future but it is recommended that you switch.
Deprecated: https://atom.io/download/electron
Replace with: https://electronjs.org/headers
### API Changed: `session.clearAuthCache()` no longer accepts options
The `session.clearAuthCache` API no longer accepts options for what to clear, and instead unconditionally clears the whole cache.
```js
// Deprecated
session.clearAuthCache({ type: 'password' })
// Replace with
session.clearAuthCache()
```
### API Changed: `powerMonitor.querySystemIdleState` is now `powerMonitor.getSystemIdleState`
2019-05-09 21:48:10 +03:00
```js
// Removed in Electron 7.0
powerMonitor.querySystemIdleState(threshold, callback)
// Replace with synchronous API
const idleState = powerMonitor.getSystemIdleState(threshold)
2019-05-09 21:48:10 +03:00
```
### API Changed: `powerMonitor.querySystemIdleTime` is now `powerMonitor.getSystemIdleTime`
2019-05-09 21:48:10 +03:00
```js
// Removed in Electron 7.0
powerMonitor.querySystemIdleTime(callback)
// Replace with synchronous API
const idleTime = powerMonitor.getSystemIdleTime()
2019-05-09 21:48:10 +03:00
```
### API Changed: `webFrame.setIsolatedWorldInfo` replaces separate methods
2019-05-09 21:48:10 +03:00
```js
// Removed in Electron 7.0
2019-05-09 21:48:10 +03:00
webFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)
webFrame.setIsolatedWorldHumanReadableName(worldId, name)
webFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)
// Replace with
webFrame.setIsolatedWorldInfo(
worldId,
{
securityOrigin: 'some_origin',
name: 'human_readable_name',
csp: 'content_security_policy'
})
```
### Removed: `marked` property on `getBlinkMemoryInfo`
chore: bump chromium to f1d9522c04ca8fa0a906f88ababe9 (master) (#18648) * chore: bump chromium in DEPS to 675d7dc9f3334b15c3ec28c27db3dc19b26bd12e * chore: update patches * chore: bump chromium in DEPS to dce3562696f165a324273fcb6893f0e1fef42ab1 * chore: const interfaces are being removed from //content Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1631749 Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=908139 * chore: update patches * chore: blink::MediaStreamType is now consistent and deduplicated * chore: update patches and printing code for ref -> uniq * chore: bridge_impl() --> GetInProcessNSWindowBridge Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1642988 * fixme: TotalMarkedObjectSize has been removed * chore: fix linting * chore: bump chromium in DEPS to 9503e1a2fcbf17db08094d8caae3e1407e918af3 * chore: fix slightly broken printing patch * chore: update patches for SiteInstanceImpl changes Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1612025 * chore: update patches for SiteInstanceImpl changes * chore: bump chromium in DEPS to 6801e6c1ddd1b7b73e594e97157ddd539ca335d7 * chore: update patches * chore: bump chromium in DEPS to 27e198912d7c1767052ec785c22e2e88b2cb4d8b * chore: remove system_request_context Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1647172 * chore: creation of FtpProtocolHandler needs an auth cache Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1639683 * fixme: disable marked spec * chore: bump chromium in DEPS to 3dcd7fe453ad13a22b114b95f05590eba74c5471 * chore: bump chromium in DEPS to bdc24128b75008743d819e298557a53205706e7c * chore: bump chromium in DEPS to 7da330b58fbe0ba94b9b94abbb8085bead220228 * update patches * remove TotalMarkedObjectSize https://chromium-review.googlesource.com/c/chromium/src/+/1631708 * add libvulkan.so to dist zip manifest on linux * chore: bump chromium in DEPS to 1e85d0f45b52649efd0010cc9dab6d2804f24443 * update patches * add angle features to gpuinfo https://chromium-review.googlesource.com/c/chromium/src/+/1638658 * mark 'marked' property as deprecated * disable webview resize test * FIXME: disable vulkan on 32-bit arm * chore: bump chromium in DEPS to cd0297c6a83fdd2b1f6bc312e7d5acca736a3c56 * Revert "FIXME: disable vulkan on 32-bit arm" This reverts commit 5c1e0ef302a6db1e72231d4e823f91bb08e281af. * backport from upstream: fix swiftshader build on arm https://swiftshader-review.googlesource.com/c/SwiftShader/+/32768/ * update patches * viz: update OutputDeviceWin to new shared memory api https://chromium-review.googlesource.com/c/chromium/src/+/1649574 * base::Contains{Key,Value} => base::Contains https://chromium-review.googlesource.com/c/chromium/src/+/1649478 * fixup! viz: update OutputDeviceWin to new shared memory api * stub out StatusIconLinuxDbus-related delegate methods https://chromium-review.googlesource.com/c/chromium/src/+/1638180 * chore: bump chromium in DEPS to 964ea3fd4bdc006d62533f5755043076220181f1 * Remove the BrowserContext methods to create URLRequestContexts for main/media partitions when a partition_domain is specified https://chromium-review.googlesource.com/c/chromium/src/+/1655087 * fixup! stub out StatusIconLinuxDbus-related delegate methods * add remote_cocoa to chromium_src deps https://chromium-review.googlesource.com/c/chromium/src/+/1657068 * fixup! stub out StatusIconLinuxDbus-related delegate methods * attempt at fix linux-debug build * add swiftshader/libvulkan.so to arm manifest * chore: bump chromium in DEPS to 28688f76afef27c36631aa274691e333ddecdc22 * update patches * chore: bump chromium in DEPS to fe7450e1578a9584189f87d59d0d1a8548bf6b90 * chore: bump chromium in DEPS to f304dfd682dc86a755a6c49a16ee6876e0db45fb * chore: bump chromium in DEPS to f0fd4d6c365aad9edd83bdfff9954c47d271b75c * Update patches * Remove no longer needed WOA patch * Put back IOThread in BrowserProcess We need this until we enable the network service. * move atom.ico to inputs * Update to latest LKGR to fix no template named 'bitset' in namespace 'std' * fixup! Put back IOThread in BrowserProcess * chore: bump chromium in DEPS to dcf9662dc9a896a175d791001350324167b1cad3 * Update patches content_allow_embedder_to_prevent_locking_scheme_registry.patch is no longer necessary as it was upstreamed via https://chromium-review.googlesource.com/c/chromium/src/+/1637040 * Fix renamed enum * Use newer docker container Contains updated dependencies * Try to track down arm test failures * Fix arm tests * chore: bump chromium in DEPS to 8cbceef57b37ee14b9c4c3405a3f7663922c5b5d * Update patches * Add needed dependencies for testing 32-bit linux * Remove arm debugging. * Remove additional debugging * Fix compiler errors * Handle new macOS helper * Fix compile error on Linux * chore: bump chromium in DEPS to 66a93991ddaff6a9f1b13d110959947cb03a1860 * Add new helper files to manifests * fix BUILD.gn for macOS * Fix compile errors * Add patch to put back colors needed for autofill/datalist * chore: bump chromium in DEPS to e89617079f11e33f33cdb3924f719a579c73704b * Updated patches * Remove no longer needed patch * Remove no longer needed patch * Fix compile error with patch * Really fix the patch * chore: bump chromium in DEPS to c70f12476a45840408f1d5ff5968e7f7ceaad9d4 * chore: bump chromium in DEPS to 06d2dd7a8933b41545a7c26349c802f570563fd5 * chore: bump chromium in DEPS to b0b9ff8f727deb519ccbec7cf1c8d9ed543d88ab * Update patches * Fix compiler errors * Fix removed ChromeNetLog * Revert "Fix removed ChromeNetLog" This reverts commit 426dfd90b5ab0a9c1df415d71c88e8aed2bd5bbe. * Remove ChromeNetLog. https://chromium-review.googlesource.com/c/chromium/src/+/1663846 * chore: bump chromium in DEPS to fefcc4926d58dccd59ac95be65eab3a4ebfe2f29 * Update patches * Update v8 patches * Fix lint error * Fix compile errors * chore: bump chromium in DEPS to 4de815ef92ef2eef515506fe09bdc466526a8fd9 * Use custom protocol to test baseURLForDataURL * Use newer SDK (10.0.18362) for Windows * Update patches * Update arm manifest since swiftshader reenabled. * Don't delete dir that isn't ever there. * Fix compile errors. * Need src dir created * Update for removed InspectorFrontendAPI.addExtensions * Revert "Use newer SDK (10.0.18362) for Windows" This reverts commit 68763a0c88cdc44b971462e49662aecc167d3d99. * Revert "Need src dir created" This reverts commit 7daedc29d0844316d4097648dde7f40f1a3848fb. * Revert "Don't delete dir that isn't ever there." This reverts commit bf424bc30ffcb23b1d9a634d4df410342536640e. * chore: bump chromium in DEPS to 97dab6b0124ea53244caf123921b5d14893bcca7 * chore: bump chromium in DEPS to c87d16d49a85dc7122781f6c979d354c20f7f78b * chore: bump chromium in DEPS to 004bcee2ea336687cedfda8f8a151806ac757d15 * chore: bump chromium in DEPS to 24428b26a9d15a013b2a253e1084ec3cb54b660b * chore: bump chromium in DEPS to fd25914e875237df88035a6abf89a70bf1360b57 * Update patches * Update node to fix build error * Fix compile errors * chore: bump chromium in DEPS to 3062b7cf090f1d9522c04ca8fa0a906f88ababe9 * chore: update node ref for pushed tags * chore: update patches for new chromium * chore: fix printing patches * Use new (10.0.18362) Windows SDK * roll node to fix v8 build issues in debug build * Add support for plugin helper * fix: add patch to fix gpu info enumeration Can be removed once CL lands upstream. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1685993 * spec: navigator.requestMIDIAccess now requires a secure origin This test requires a secure origin so we fake one. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1657952 * FIXME: temporarily disable SharedWorker tests * use released version of node-abstractsocket * fix abstract-socket
2019-07-03 04:22:09 +03:00
This property was removed in Chromium 77, and as such is no longer available.
### Behavior Changed: `webkitdirectory` attribute for `<input type="file"/>` now lists directory contents
The `webkitdirectory` property on HTML file inputs allows them to select folders.
Previous versions of Electron had an incorrect implementation where the `event.target.files`
of the input returned a `FileList` that returned one `File` corresponding to the selected folder.
As of Electron 7, that `FileList` is now list of all files contained within
the folder, similarly to Chrome, Firefox, and Edge
([link to MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory)).
As an illustration, take a folder with this structure:
```console
folder
├── file1
├── file2
└── file3
```
In Electron &lt;=6, this would return a `FileList` with a `File` object for:
```console
path/to/folder
```
In Electron 7, this now returns a `FileList` with a `File` object for:
```console
/path/to/folder/file3
/path/to/folder/file2
/path/to/folder/file1
```
Note that `webkitdirectory` no longer exposes the path to the selected folder.
If you require the path to the selected folder rather than the folder contents,
see the `dialog.showOpenDialog` API ([link](api/dialog.md#dialogshowopendialogwindow-options)).
### API Changed: Callback-based versions of promisified APIs
Electron 5 and Electron 6 introduced Promise-based versions of existing
asynchronous APIs and deprecated their older, callback-based counterparts.
In Electron 7, all deprecated callback-based APIs are now removed.
These functions now only return Promises:
* `app.getFileIcon()` [#15742](https://github.com/electron/electron/pull/15742)
* `app.dock.show()` [#16904](https://github.com/electron/electron/pull/16904)
* `contentTracing.getCategories()` [#16583](https://github.com/electron/electron/pull/16583)
* `contentTracing.getTraceBufferUsage()` [#16600](https://github.com/electron/electron/pull/16600)
* `contentTracing.startRecording()` [#16584](https://github.com/electron/electron/pull/16584)
* `contentTracing.stopRecording()` [#16584](https://github.com/electron/electron/pull/16584)
* `contents.executeJavaScript()` [#17312](https://github.com/electron/electron/pull/17312)
* `cookies.flushStore()` [#16464](https://github.com/electron/electron/pull/16464)
* `cookies.get()` [#16464](https://github.com/electron/electron/pull/16464)
* `cookies.remove()` [#16464](https://github.com/electron/electron/pull/16464)
* `cookies.set()` [#16464](https://github.com/electron/electron/pull/16464)
* `debugger.sendCommand()` [#16861](https://github.com/electron/electron/pull/16861)
* `dialog.showCertificateTrustDialog()` [#17181](https://github.com/electron/electron/pull/17181)
* `inAppPurchase.getProducts()` [#17355](https://github.com/electron/electron/pull/17355)
* `inAppPurchase.purchaseProduct()`[#17355](https://github.com/electron/electron/pull/17355)
* `netLog.stopLogging()` [#16862](https://github.com/electron/electron/pull/16862)
* `session.clearAuthCache()` [#17259](https://github.com/electron/electron/pull/17259)
* `session.clearCache()` [#17185](https://github.com/electron/electron/pull/17185)
* `session.clearHostResolverCache()` [#17229](https://github.com/electron/electron/pull/17229)
* `session.clearStorageData()` [#17249](https://github.com/electron/electron/pull/17249)
* `session.getBlobData()` [#17303](https://github.com/electron/electron/pull/17303)
* `session.getCacheSize()` [#17185](https://github.com/electron/electron/pull/17185)
* `session.resolveProxy()` [#17222](https://github.com/electron/electron/pull/17222)
* `session.setProxy()` [#17222](https://github.com/electron/electron/pull/17222)
* `shell.openExternal()` [#16176](https://github.com/electron/electron/pull/16176)
* `webContents.loadFile()` [#15855](https://github.com/electron/electron/pull/15855)
* `webContents.loadURL()` [#15855](https://github.com/electron/electron/pull/15855)
* `webContents.hasServiceWorker()` [#16535](https://github.com/electron/electron/pull/16535)
* `webContents.printToPDF()` [#16795](https://github.com/electron/electron/pull/16795)
* `webContents.savePage()` [#16742](https://github.com/electron/electron/pull/16742)
* `webFrame.executeJavaScript()` [#17312](https://github.com/electron/electron/pull/17312)
* `webFrame.executeJavaScriptInIsolatedWorld()` [#17312](https://github.com/electron/electron/pull/17312)
* `webviewTag.executeJavaScript()` [#17312](https://github.com/electron/electron/pull/17312)
* `win.capturePage()` [#15743](https://github.com/electron/electron/pull/15743)
These functions now have two forms, synchronous and Promise-based asynchronous:
* `dialog.showMessageBox()`/`dialog.showMessageBoxSync()` [#17298](https://github.com/electron/electron/pull/17298)
* `dialog.showOpenDialog()`/`dialog.showOpenDialogSync()` [#16973](https://github.com/electron/electron/pull/16973)
* `dialog.showSaveDialog()`/`dialog.showSaveDialogSync()` [#17054](https://github.com/electron/electron/pull/17054)
## Planned Breaking API Changes (6.0)
### API Changed: `win.setMenu(null)` is now `win.removeMenu()`
```js
// Deprecated
win.setMenu(null)
// Replace with
win.removeMenu()
```
### API Changed: `electron.screen` in the renderer process should be accessed via `remote`
```js
// Deprecated
require('electron').screen
// Replace with
require('electron').remote.screen
```
### API Changed: `require()`ing node builtins in sandboxed renderers no longer implicitly loads the `remote` version
```js
// Deprecated
require('child_process')
// Replace with
require('electron').remote.require('child_process')
// Deprecated
require('fs')
// Replace with
require('electron').remote.require('fs')
// Deprecated
require('os')
// Replace with
require('electron').remote.require('os')
// Deprecated
require('path')
// Replace with
require('electron').remote.require('path')
```
### Deprecated: `powerMonitor.querySystemIdleState` replaced with `powerMonitor.getSystemIdleState`
```js
// Deprecated
powerMonitor.querySystemIdleState(threshold, callback)
// Replace with synchronous API
const idleState = powerMonitor.getSystemIdleState(threshold)
```
### Deprecated: `powerMonitor.querySystemIdleTime` replaced with `powerMonitor.getSystemIdleTime`
```js
// Deprecated
powerMonitor.querySystemIdleTime(callback)
// Replace with synchronous API
const idleTime = powerMonitor.getSystemIdleTime()
```
### Deprecated: `app.enableMixedSandbox()` is no longer needed
```js
// Deprecated
app.enableMixedSandbox()
```
Mixed-sandbox mode is now enabled by default.
### Deprecated: `Tray.setHighlightMode`
Under macOS Catalina our former Tray implementation breaks.
Apple's native substitute doesn't support changing the highlighting behavior.
```js
// Deprecated
tray.setHighlightMode(mode)
// API will be removed in v7.0 without replacement.
```
## Planned Breaking API Changes (5.0)
### Default Changed: `nodeIntegration` and `webviewTag` default to false, `contextIsolation` defaults to true
The following `webPreferences` option default values are deprecated in favor of the new defaults listed below.
| Property | Deprecated Default | New Default |
|----------|--------------------|-------------|
| `contextIsolation` | `false` | `true` |
| `nodeIntegration` | `true` | `false` |
| `webviewTag` | `nodeIntegration` if set else `true` | `false` |
E.g. Re-enabling the webviewTag
```js
const w = new BrowserWindow({
webPreferences: {
webviewTag: true
}
})
```
### Behavior Changed: `nodeIntegration` in child windows opened via `nativeWindowOpen`
Child windows opened with the `nativeWindowOpen` option will always have Node.js integration disabled, unless `nodeIntegrationInSubFrames` is `true`.
### API Changed: Registering privileged schemes must now be done before app ready
Renderer process APIs `webFrame.registerURLSchemeAsPrivileged` and `webFrame.registerURLSchemeAsBypassingCSP` as well as browser process API `protocol.registerStandardSchemes` have been removed.
A new API, `protocol.registerSchemesAsPrivileged` has been added and should be used for registering custom schemes with the required privileges. Custom schemes are required to be registered before app ready.
### Deprecated: `webFrame.setIsolatedWorld*` replaced with `webFrame.setIsolatedWorldInfo`
```js
// Deprecated
webFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)
webFrame.setIsolatedWorldHumanReadableName(worldId, name)
webFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)
// Replace with
webFrame.setIsolatedWorldInfo(
worldId,
{
securityOrigin: 'some_origin',
name: 'human_readable_name',
csp: 'content_security_policy'
})
```
### API Changed: `webFrame.setSpellCheckProvider` now takes an asynchronous callback
The `spellCheck` callback is now asynchronous, and `autoCorrectWord` parameter has been removed.
```js
// Deprecated
webFrame.setSpellCheckProvider('en-US', true, {
spellCheck: (text) => {
return !spellchecker.isMisspelled(text)
}
})
// Replace with
webFrame.setSpellCheckProvider('en-US', {
spellCheck: (words, callback) => {
callback(words.filter(text => spellchecker.isMisspelled(text)))
}
})
```
### API Changed: `webContents.getZoomLevel` and `webContents.getZoomFactor` are now synchronous
`webContents.getZoomLevel` and `webContents.getZoomFactor` no longer take callback parameters,
instead directly returning their number values.
```js
// Deprecated
webContents.getZoomLevel((level) => {
console.log(level)
})
// Replace with
const level = webContents.getZoomLevel()
console.log(level)
```
```js
// Deprecated
webContents.getZoomFactor((factor) => {
console.log(factor)
})
// Replace with
const factor = webContents.getZoomFactor()
console.log(factor)
```
## Planned Breaking API Changes (4.0)
The following list includes the breaking API changes made in Electron 4.0.
### `app.makeSingleInstance`
```js
// Deprecated
app.makeSingleInstance((argv, cwd) => {
/* ... */
})
// Replace with
app.requestSingleInstanceLock()
app.on('second-instance', (event, argv, cwd) => {
/* ... */
})
```
### `app.releaseSingleInstance`
```js
// Deprecated
app.releaseSingleInstance()
// Replace with
app.releaseSingleInstanceLock()
```
### `app.getGPUInfo`
```js
app.getGPUInfo('complete')
// Now behaves the same with `basic` on macOS
app.getGPUInfo('basic')
```
### `win_delay_load_hook`
When building native modules for windows, the `win_delay_load_hook` variable in
the module's `binding.gyp` must be true (which is the default). If this hook is
not present, then the native module will fail to load on Windows, with an error
message like `Cannot find module`.
See the [native module guide](./tutorial/using-native-node-modules.md) for more.
### Removed: IA32 Linux support
Electron 18 will no longer run on 32-bit Linux systems. See [discontinuing support for 32-bit Linux](https://www.electronjs.org/blog/linux-32bit-support) for more information.
## Breaking API Changes (3.0)
2016-09-07 21:41:54 +03:00
The following list includes the breaking API changes in Electron 3.0.
2016-09-07 21:41:54 +03:00
### `app`
2017-05-18 06:01:06 +03:00
```js
// Deprecated
app.getAppMemoryInfo()
// Replace with
app.getAppMetrics()
// Deprecated
const metrics = app.getAppMetrics()
2018-09-13 19:10:51 +03:00
const { memory } = metrics[0] // Deprecated property
2017-05-18 06:01:06 +03:00
```
### `BrowserWindow`
2016-09-08 19:09:49 +03:00
```js
// Deprecated
2020-07-09 20:18:49 +03:00
const optionsA = { webPreferences: { blinkFeatures: '' } }
const windowA = new BrowserWindow(optionsA)
2016-09-08 19:09:49 +03:00
// Replace with
2020-07-09 20:18:49 +03:00
const optionsB = { webPreferences: { enableBlinkFeatures: '' } }
const windowB = new BrowserWindow(optionsB)
// Deprecated
window.on('app-command', (e, cmd) => {
if (cmd === 'media-play_pause') {
// do something
}
})
// Replace with
window.on('app-command', (e, cmd) => {
if (cmd === 'media-play-pause') {
// do something
}
})
2016-09-08 19:09:49 +03:00
```
### `clipboard`
2016-09-08 19:09:49 +03:00
2016-09-07 21:41:54 +03:00
```js
// Deprecated
clipboard.readRtf()
// Replace with
clipboard.readRTF()
// Deprecated
clipboard.writeRtf()
// Replace with
clipboard.writeRTF()
// Deprecated
clipboard.readHtml()
// Replace with
clipboard.readHTML()
// Deprecated
clipboard.writeHtml()
// Replace with
clipboard.writeHTML()
2016-09-08 19:09:49 +03:00
```
### `crashReporter`
2016-11-29 02:06:03 +03:00
```js
// Deprecated
crashReporter.start({
companyName: 'Crashly',
submitURL: 'https://crash.server.com',
autoSubmit: true
})
// Replace with
crashReporter.start({
companyName: 'Crashly',
submitURL: 'https://crash.server.com',
uploadToServer: true
})
```
### `nativeImage`
2016-09-07 21:41:54 +03:00
2016-09-08 19:09:49 +03:00
```js
// Deprecated
nativeImage.createFromBuffer(buffer, 1.0)
// Replace with
nativeImage.createFromBuffer(buffer, {
scaleFactor: 1.0
})
2016-09-08 19:09:49 +03:00
```
2016-09-07 21:41:54 +03:00
### `process`
```js
// Deprecated
const info = process.getProcessMemoryInfo()
```
### `screen`
2016-09-17 01:57:07 +03:00
```js
// Deprecated
screen.getMenuBarHeight()
2016-09-17 01:57:07 +03:00
// Replace with
screen.getPrimaryDisplay().workArea
2016-09-17 01:57:07 +03:00
```
### `session`
2017-02-08 02:44:56 +03:00
```js
// Deprecated
ses.setCertificateVerifyProc((hostname, certificate, callback) => {
2017-02-08 02:44:56 +03:00
callback(true)
})
// Replace with
ses.setCertificateVerifyProc((request, callback) => {
2017-02-08 02:44:56 +03:00
callback(0)
})
```
### `Tray`
2016-09-07 21:41:54 +03:00
2016-09-08 19:09:49 +03:00
```js
2016-09-07 21:41:54 +03:00
// Deprecated
tray.setHighlightMode(true)
// Replace with
tray.setHighlightMode('on')
// Deprecated
tray.setHighlightMode(false)
// Replace with
tray.setHighlightMode('off')
2016-09-08 19:09:49 +03:00
```
2016-09-07 21:41:54 +03:00
### `webContents`
2016-09-08 19:09:49 +03:00
```js
2016-09-07 21:41:54 +03:00
// Deprecated
2018-09-13 19:10:51 +03:00
webContents.openDevTools({ detach: true })
2016-09-07 21:41:54 +03:00
// Replace with
2018-09-13 19:10:51 +03:00
webContents.openDevTools({ mode: 'detach' })
// Removed
webContents.setSize(options)
// There is no replacement for this API
2016-09-07 21:41:54 +03:00
```
### `webFrame`
```js
2016-11-14 21:33:30 +03:00
// Deprecated
webFrame.registerURLSchemeAsSecure('app')
// Replace with
2018-09-13 19:10:51 +03:00
protocol.registerStandardSchemes(['app'], { secure: true })
2016-11-14 21:33:30 +03:00
// Deprecated
2018-09-13 19:10:51 +03:00
webFrame.registerURLSchemeAsPrivileged('app', { secure: true })
2016-11-14 21:33:30 +03:00
// Replace with
2018-09-13 19:10:51 +03:00
protocol.registerStandardSchemes(['app'], { secure: true })
```
### `<webview>`
```js
// Removed
webview.setAttribute('disableguestresize', '')
// There is no replacement for this API
// Removed
webview.setAttribute('guestinstance', instanceId)
// There is no replacement for this API
// Keyboard listeners no longer work on webview tag
webview.onkeydown = () => { /* handler */ }
webview.onkeyup = () => { /* handler */ }
```
### Node Headers URL
This is the URL specified as `disturl` in a `.npmrc` file or as the `--dist-url`
command line flag when building native Node modules.
Deprecated: https://atom.io/download/atom-shell
Replace with: https://atom.io/download/electron
## Breaking API Changes (2.0)
The following list includes the breaking API changes made in Electron 2.0.
### `BrowserWindow`
```js
// Deprecated
2020-07-09 20:18:49 +03:00
const optionsA = { titleBarStyle: 'hidden-inset' }
const windowA = new BrowserWindow(optionsA)
// Replace with
2020-07-09 20:18:49 +03:00
const optionsB = { titleBarStyle: 'hiddenInset' }
const windowB = new BrowserWindow(optionsB)
```
### `menu`
```js
// Removed
menu.popup(browserWindow, 100, 200, 2)
// Replaced with
2018-09-13 19:10:51 +03:00
menu.popup(browserWindow, { x: 100, y: 200, positioningItem: 2 })
```
### `nativeImage`
```js
// Removed
nativeImage.toPng()
// Replaced with
nativeImage.toPNG()
// Removed
nativeImage.toJpeg()
// Replaced with
nativeImage.toJPEG()
```
### `process`
* `process.versions.electron` and `process.version.chrome` will be made
read-only properties for consistency with the other `process.versions`
properties set by Node.
### `webContents`
```js
// Removed
webContents.setZoomLevelLimits(1, 2)
// Replaced with
webContents.setVisualZoomLevelLimits(1, 2)
```
### `webFrame`
```js
// Removed
webFrame.setZoomLevelLimits(1, 2)
// Replaced with
webFrame.setVisualZoomLevelLimits(1, 2)
```
### `<webview>`
```js
// Removed
webview.setZoomLevelLimits(1, 2)
// Replaced with
webview.setVisualZoomLevelLimits(1, 2)
```
### Duplicate ARM Assets
Each Electron release includes two identical ARM builds with slightly different
filenames, like `electron-v1.7.3-linux-arm.zip` and
`electron-v1.7.3-linux-armv7l.zip`. The asset with the `v7l` prefix was added
to clarify to users which ARM version it supports, and to disambiguate it from
future armv6l and arm64 assets that may be produced.
The file _without the prefix_ is still being published to avoid breaking any
setups that may be consuming it. Starting at 2.0, the unprefixed file will
no longer be published.
For details, see
[6986](https://github.com/electron/electron/pull/6986)
and
[7189](https://github.com/electron/electron/pull/7189).