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

Added better logging to pre intercepting

This commit is contained in:
kkapsner 2017-12-18 23:55:13 +01:00
parent 3d05b48089
commit 41a8112920
2 changed files with 6 additions and 4 deletions

View File

@ -61,11 +61,12 @@
}
scope.preIntercept = function preIntercept({subject: window}, apis){
settings.forceLoad();
if (!settings.isStillDefault){
logging.message("settings already loaded -> no need to pre intercept");
scope.intercept({subject: window}, apis);
}
else {
logging.message("settings not loaded -> need to pre intercep");
let forceLoad = true;
let preIntercepted = false;
let intercepted = false;
@ -99,6 +100,7 @@
configureable: true,
get: exportFunction(function(){
if (forceLoad){
logging.warning("force load the settings. Calling stack:", (new Error()).stack);
undoPreIntercept();
settings.forceLoad();
doRealIntercept();
@ -106,6 +108,7 @@
return descriptor.value || descriptor.get();
}
else {
logging.notice("API blocked (%s)", name);
var url = getURL(window);
if (!url){
return undef;
@ -147,8 +150,7 @@
intercepted = true;
}
};
logging.verbose("pre intercept until settings are loaded");
doPreIntercept();
settings.onloaded(function(){
undoPreIntercept();

View File

@ -106,7 +106,7 @@
const settings = require("./settings");
const logging = require("./logging");
if (settings.init(${JSON.stringify(data)})){
logging.message("Initiaized settings by dynamic content script.");
logging.message("Initialized settings by dynamic content script.");
}
else {
logging.error("Dynamic content script was too late to provide settings.");