Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
feat(browser-emulator): remove setAppBadge and clearAppBadge proxies,…
Browse files Browse the repository at this point in the history
… fixed upstream
  • Loading branch information
soundofspace committed Sep 3, 2024
1 parent 71ea535 commit d8bfb88
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions plugins/default-browser-emulator/injected-scripts/navigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,38 +79,7 @@ replaceGetter(self.navigator, 'platform', () => typedArgs.platform, {
onlyForInstance: true,
});

if ('setAppBadge' in self.navigator) {
// @ts-ignore
replaceFunction(self.navigator, 'setAppBadge', async (target, thisArg, argArray) => {
if (ObjectCached.getPrototypeOf(thisArg) !== Navigator.prototype) {
throw new TypeError("Failed to execute 'setAppBadge' on 'Navigator': Illegal invocation");
} else if (argArray.length) {
const arg = argArray[0];
if (typeof arg === 'number') {
if (arg < 0 || arg > Number.MAX_SAFE_INTEGER) {
throw new TypeError(
`Failed to execute 'setAppBadge' on 'Navigator': Value is outside the 'unsigned long long' value range.`,
);
}
} else {
throw new TypeError(
`Failed to execute 'setAppBadge' on 'Navigator': Value is not of type 'unsigned long long'.`,
);
}
}
return undefined;
});
}

if ('clearAppBadge' in self.navigator) {
// @ts-ignore
replaceFunction(self.navigator, 'clearAppBadge', async (target, thisArg, argArray) => {
if (ObjectCached.getPrototypeOf(thisArg) !== Navigator.prototype) {
throw new TypeError("Failed to execute 'clearAppBadge' on 'Navigator': Illegal invocation");
}
return undefined;
});
}

if (typedArgs.headless === true && 'requestMediaKeySystemAccess' in self.navigator) {
replaceFunction(
Expand Down

0 comments on commit d8bfb88

Please sign in to comment.