fix: ensure bluetooth devices are not returned by default (#32178)
This commit is contained in:
parent
1facbb4a09
commit
a11f5cbb27
2 changed files with 10 additions and 0 deletions
|
@ -736,6 +736,8 @@ first available device will be selected. `callback` should be called with
|
|||
`deviceId` to be selected, passing empty string to `callback` will
|
||||
cancel the request.
|
||||
|
||||
If no event listener is added for this event, all bluetooth requests will be cancelled.
|
||||
|
||||
```javascript
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
|
|
|
@ -749,6 +749,14 @@ WebContents.prototype._init = function () {
|
|||
}
|
||||
});
|
||||
|
||||
this.on('select-bluetooth-device', (event, devices, callback) => {
|
||||
if (this.listenerCount('select-bluetooth-device') === 0) {
|
||||
// Cancel it if there are no handlers
|
||||
event.preventDefault();
|
||||
callback('');
|
||||
}
|
||||
});
|
||||
|
||||
const event = process._linkedBinding('electron_browser_event').createEmpty();
|
||||
app.emit('web-contents-created', event, this);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue