You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
513 B
19 lines
513 B
2 years ago
|
/**
|
||
|
* This script add properties in globalThis and initialises them with undefined.
|
||
|
* This is workaround needed to avoid error in dependencies expecting to be run in a browser
|
||
|
* these dependencies are not available to service worker in MV3.
|
||
|
*/
|
||
|
|
||
|
// eslint-disable-next-line import/unambiguous
|
||
|
const keys = ['XMLHttpRequest'];
|
||
|
|
||
|
keys.forEach((key) => {
|
||
|
if (!Reflect.has(globalThis, key)) {
|
||
|
globalThis[key] = undefined;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
if (!Reflect.has(globalThis, 'window')) {
|
||
|
globalThis.window = globalThis;
|
||
|
}
|