1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 04:40:20 +01:00

Protect exportFunction with defineAs

For #429
This commit is contained in:
kkapsner 2020-01-19 01:27:26 +01:00
parent 16f88a5daa
commit 363940014d
2 changed files with 12 additions and 0 deletions

View File

@ -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);

View File

@ -101,6 +101,10 @@
{
"version": "1.1Alpha20191801",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.1Alpha20191801-an+fx.xpi"
},
{
"version": "1.1Alpha20191901",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.1Alpha20191901-an+fx.xpi"
}
]
}