mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 04:26:35 +02:00
Minor performance improvements
This commit is contained in:
parent
a89bf0aba8
commit
103397e35d
2 changed files with 12 additions and 23 deletions
|
@ -59,7 +59,7 @@
|
|||
return getURL(window.opener);
|
||||
}
|
||||
}
|
||||
return window.location.href;
|
||||
return href;
|
||||
}
|
||||
|
||||
scope.preIntercept = function preIntercept({subject: window}, apis){
|
||||
|
@ -200,15 +200,13 @@
|
|||
}
|
||||
function generateChecker(name, changedFunction, siteStatus, original){
|
||||
return function checker(callingDepth = 2){
|
||||
const url = getURL(window);
|
||||
if (!url){
|
||||
return undef;
|
||||
}
|
||||
const error = new Error();
|
||||
const errorStack = error.stack;
|
||||
|
||||
try {
|
||||
// return original if the extension itself requested the function
|
||||
if (
|
||||
error.stack
|
||||
errorStack
|
||||
.split("\n", callingDepth + 2)[callingDepth + 1]
|
||||
.split("@", callingDepth + 1)[1]
|
||||
.startsWith(extensionID)
|
||||
|
@ -219,7 +217,7 @@
|
|||
catch (e) {
|
||||
// stack had an unknown form
|
||||
}
|
||||
if (checkStack(error.stack)){
|
||||
if (checkStack(errorStack)){
|
||||
return {allow: true, original, window};
|
||||
}
|
||||
const funcStatus = changedFunction.getStatus(this, siteStatus, prefs);
|
||||
|
@ -227,8 +225,8 @@
|
|||
const This = this;
|
||||
function notifyCallback(messageId){
|
||||
notify({
|
||||
url,
|
||||
errorStack: error.stack,
|
||||
url: getURL(window),
|
||||
errorStack,
|
||||
messageId,
|
||||
timestamp: new Date(),
|
||||
functionName: name,
|
||||
|
@ -257,7 +255,7 @@
|
|||
this.canvas:
|
||||
false
|
||||
),
|
||||
errorStack: error.stack
|
||||
errorStack
|
||||
});
|
||||
}
|
||||
switch (funcStatus.mode){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue