mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-03 10:31:54 +01:00
Merge pull request #10 from jay/stack1
Show caller when asking for readout permission
This commit is contained in:
commit
61cb9ffb45
@ -101,10 +101,27 @@
|
|||||||
status = askStatus.answer;
|
status = askStatus.answer;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// console.log("asking");
|
//unsafeWindow.console.log("asking");
|
||||||
status = window.confirm(_(changedFunction.mode.askText))? "allow": "block";
|
var callers = new Error().stack.split('\n');
|
||||||
|
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"){
|
||||||
|
msg += "\n\nCaller: " + callers[0];
|
||||||
|
// maybe show full stack here if some pref
|
||||||
|
//msg += "\n\nFull stack: \n" + callers.join('\n');
|
||||||
|
}
|
||||||
|
status = window.confirm(msg) ? "allow": "block";
|
||||||
askStatus.alreadyAsked = true;
|
askStatus.alreadyAsked = true;
|
||||||
askStatus.answer = status;
|
askStatus.answer = status;
|
||||||
|
//unsafeWindow.console.log("asking (done)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (status){
|
switch (status){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user