1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-23 05:10:27 +01:00

Built with caller display.

This commit is contained in:
kkapsner 2014-12-10 15:58:26 +01:00
parent 61cb9ffb45
commit a408a73629
2 changed files with 10 additions and 12 deletions

Binary file not shown.

View File

@ -101,19 +101,17 @@
status = askStatus.answer; status = askStatus.answer;
} }
else { else {
//unsafeWindow.console.log("asking"); //console.log("asking");
var msg = _(changedFunction.mode.askText);
if (changedFunction.mode.askText === "askForReadoutPermission"){
var callers = new Error().stack.split('\n'); var callers = new Error().stack.split('\n');
//console.log(callers);
var findme = callers.shift(); // Remove us from the stack var findme = callers.shift(); // Remove us from the stack
findme = findme.replace(/(:[0-9]+){1,2}$/, ""); // rm line & column findme = findme.replace(/(:[0-9]+){1,2}$/, ""); // rm line & column
// Eliminate squashed stack. stack may contain 2+ stacks, but why... // Eliminate squashed stack. stack may contain 2+ stacks, but why...
for (var i = 0; callers[i]; i++){ callers = callers.filter(function(caller){
if (callers[i].search(findme) == 0){ return caller.search(findme) === -1;
callers.splice(i, callers.length - i); });
break;
}
}
var msg = _(changedFunction.mode.askText);
if (changedFunction.mode.askText === "askForReadoutPermission"){
msg += "\n\nCaller: " + callers[0]; msg += "\n\nCaller: " + callers[0];
// maybe show full stack here if some pref // maybe show full stack here if some pref
//msg += "\n\nFull stack: \n" + callers.join('\n'); //msg += "\n\nFull stack: \n" + callers.join('\n');
@ -121,7 +119,7 @@
status = window.confirm(msg) ? "allow": "block"; status = window.confirm(msg) ? "allow": "block";
askStatus.alreadyAsked = true; askStatus.alreadyAsked = true;
askStatus.answer = status; askStatus.answer = status;
//unsafeWindow.console.log("asking (done)"); //console.log("asking (done)");
} }
} }
switch (status){ switch (status){