diff --git a/data/inject.js b/data/inject.js index fbb1099..da3bf6b 100644 --- a/data/inject.js +++ b/data/inject.js @@ -101,10 +101,27 @@ status = askStatus.answer; } else { - // console.log("asking"); - status = window.confirm(_(changedFunction.mode.askText))? "allow": "block"; + //unsafeWindow.console.log("asking"); + 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.answer = status; + //unsafeWindow.console.log("asking (done)"); } } switch (status){