mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
parent
16f88a5daa
commit
363940014d
2 changed files with 12 additions and 0 deletions
|
@ -13,6 +13,7 @@
|
|||
}
|
||||
|
||||
const browserAvailable = typeof browser !== "undefined";
|
||||
const logging = require("./logging");
|
||||
|
||||
scope.inBackgroundScript = !!(
|
||||
browserAvailable &&
|
||||
|
@ -60,6 +61,13 @@
|
|||
defineAs: name
|
||||
};
|
||||
const oldDescriptor = Object.getOwnPropertyDescriptor(wrappedContext, name);
|
||||
if (oldDescriptor && !oldDescriptor.configurable){
|
||||
logging.error(
|
||||
"Unable to export function with the correct name", name,
|
||||
"instead we have to use", exportedTry.name
|
||||
);
|
||||
return exportedTry;
|
||||
}
|
||||
const exported = exportFunction(func, context, options);
|
||||
if (oldDescriptor){
|
||||
Object.defineProperty(wrappedContext, name, oldDescriptor);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue