diff --git a/injected/src/features/windows-permission-usage.js b/injected/src/features/windows-permission-usage.js index 4f28f828eb..fe20948f61 100644 --- a/injected/src/features/windows-permission-usage.js +++ b/injected/src/features/windows-permission-usage.js @@ -1,4 +1,4 @@ -/* global Bluetooth, Geolocation, HID, Serial, USB */ +/* global Geolocation */ import { DDGProxy, DDGReflect } from '../utils'; import ContentFeature from '../content-feature'; @@ -383,16 +383,17 @@ export default class WindowsPermissionUsage extends ContentFeature { // these permissions cannot be disabled using WebView2 or DevTools protocol const permissionsToDisable = [ - // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f - { name: 'Bluetooth', prototype: () => Bluetooth.prototype, method: 'requestDevice', isPromise: true }, - // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f - { name: 'USB', prototype: () => USB.prototype, method: 'requestDevice', isPromise: true }, - // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f - { name: 'Serial', prototype: () => Serial.prototype, method: 'requestPort', isPromise: true }, - // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f - { name: 'HID', prototype: () => HID.prototype, method: 'requestDevice', isPromise: true }, - { name: 'Protocol handler', prototype: () => Navigator.prototype, method: 'registerProtocolHandler', isPromise: false }, - { name: 'MIDI', prototype: () => Navigator.prototype, method: 'requestMIDIAccess', isPromise: true }, + { name: 'Bluetooth', prototype: () => globalThis?.Bluetooth?.prototype, method: 'requestDevice', isPromise: true }, + { name: 'USB', prototype: () => globalThis?.USB?.prototype, method: 'requestDevice', isPromise: true }, + { name: 'Serial', prototype: () => globalThis?.Serial?.prototype, method: 'requestPort', isPromise: true }, + { name: 'HID', prototype: () => globalThis?.HID?.prototype, method: 'requestDevice', isPromise: true }, + { + name: 'Protocol handler', + prototype: () => globalThis?.Navigator.prototype, + method: 'registerProtocolHandler', + isPromise: false, + }, + { name: 'MIDI', prototype: () => globalThis?.Navigator.prototype, method: 'requestMIDIAccess', isPromise: true }, ]; for (const { name, prototype, method, isPromise } of permissionsToDisable) { try {