fix: ensure bluetooth devices are not returned by default (#32178)

This commit is contained in:
Samuel Attard 2021-12-16 08:46:48 +13:00 committed by GitHub
parent 1facbb4a09
commit a11f5cbb27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -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);