From bfff229415e33fca14ece9e8cf6946b2413c8399 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Mon, 3 Nov 2025 11:48:56 +0000 Subject: [PATCH 1/2] Access check prototypes that aren't present in http:// --- .../src/features/windows-permission-usage.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/injected/src/features/windows-permission-usage.js b/injected/src/features/windows-permission-usage.js index 4f28f828eb..799c96df1e 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,12 @@ 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 { From cbe8461acec9aa747b13029852285c50fd1b6950 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Mon, 3 Nov 2025 14:53:15 +0000 Subject: [PATCH 2/2] lint fix --- injected/src/features/windows-permission-usage.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/injected/src/features/windows-permission-usage.js b/injected/src/features/windows-permission-usage.js index 799c96df1e..fe20948f61 100644 --- a/injected/src/features/windows-permission-usage.js +++ b/injected/src/features/windows-permission-usage.js @@ -387,7 +387,12 @@ export default class WindowsPermissionUsage extends ContentFeature { { 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: '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) {