1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 21:00:23 +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;
}
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');
//console.log(callers);
var findme = callers.shift(); // Remove us from the stack
findme = findme.replace(/(:[0-9]+){1,2}$/, ""); // rm line & column
// Eliminate squashed stack. stack may contain 2+ stacks, but why...
for (var i = 0; callers[i]; i++){
if (callers[i].search(findme) == 0){
callers.splice(i, callers.length - i);
break;
}
}
var msg = _(changedFunction.mode.askText);
if (changedFunction.mode.askText === "askForReadoutPermission"){
callers = callers.filter(function(caller){
return caller.search(findme) === -1;
});
msg += "\n\nCaller: " + callers[0];
// maybe show full stack here if some pref
//msg += "\n\nFull stack: \n" + callers.join('\n');
@ -121,7 +119,7 @@
status = window.confirm(msg) ? "allow": "block";
askStatus.alreadyAsked = true;
askStatus.answer = status;
//unsafeWindow.console.log("asking (done)");
//console.log("asking (done)");
}
}
switch (status){