1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 04:26:35 +02: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();