Skip to content

Commit a483df4

Browse files
Fix the error class in sensor API override (#618)
Co-authored-by: Jonathan Kingston <[email protected]>
1 parent 50eb0d7 commit a483df4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/features/harmful-apis.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ export default class HarmfulApis extends ContentFeature {
116116
if (settings.blockSensorStart) {
117117
wrapMethod(globalThis.Sensor?.prototype, 'start', function () {
118118
// block all sensors
119-
const ErrorCls = 'SensorErrorEvent' in globalThis ? globalThis.SensorErrorEvent : Error
120-
const error = new ErrorCls('error', {
119+
const EventCls = 'SensorErrorEvent' in globalThis ? globalThis.SensorErrorEvent : Event
120+
const error = new EventCls('error', {
121121
error: new DOMException('Permissions to access sensor are not granted', 'NotAllowedError')
122122
})
123123
// isTrusted will be false, but not much we can do here

0 commit comments

Comments
 (0)