|
@@ -14,6 +14,33 @@ This document uses the following convention to categorize breaking changes:
|
|
|
|
|
|
## Planned Breaking API Changes (33.0)
|
|
|
|
|
|
+### 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: `webContents` property on `login` on `app`
|
|
|
|
|
|
The `webContents` property in the `login` event from `app` will be `null`
|
|
@@ -45,33 +72,6 @@ const prefersReducedTransparency = nativeTheme.prefersReducedTransparency
|
|
|
|
|
|
## Planned Breaking API Changes (32.0)
|
|
|
|
|
|
-### 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')
|
|
|
-```
|
|
|
-
|
|
|
### 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.
|