feat: route frame based permission checks through our permission check handler (#19903)
* feat: route frame based permission checks through our permission check handler * docs: add change to setPermissionCheckHandler to breaking changes doc
This commit is contained in:
parent
3db4e612f4
commit
771e34a53a
3 changed files with 70 additions and 17 deletions
|
@ -14,6 +14,28 @@ This document uses the following convention to categorize breaking changes:
|
|||
|
||||
## 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue