1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 04:26:35 +02:00

prevent possible double faking

This commit is contained in:
kkapsner 2018-01-03 10:59:56 +01:00
parent 575df224ae
commit 66336d1b65
2 changed files with 11 additions and 1 deletions

View file

@ -159,6 +159,7 @@
}
};
let extensionID = browser.extension.getURL("");
scope.intercept = function intercept({subject: window}, {check, checkStack, ask, notify, prefs}){
var siteStatus = check({url: getURL(window)});
logging.verbose("status for page", window, siteStatus);
@ -189,6 +190,15 @@
return undef;
}
var error = new Error();
try {
// return original if the extension itself requested the function
if (error.stack.split("\n", 3)[1].split("@", 2)[1].startsWith(extensionID)){
return original;
}
}
catch (e) {
// stack had an unknown form
}
if (checkStack(error.stack)){
return original;
}