mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-03 18:42:00 +01:00
Added better logging to pre intercepting
This commit is contained in:
parent
3d05b48089
commit
41a8112920
@ -61,11 +61,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
scope.preIntercept = function preIntercept({subject: window}, apis){
|
scope.preIntercept = function preIntercept({subject: window}, apis){
|
||||||
settings.forceLoad();
|
|
||||||
if (!settings.isStillDefault){
|
if (!settings.isStillDefault){
|
||||||
|
logging.message("settings already loaded -> no need to pre intercept");
|
||||||
scope.intercept({subject: window}, apis);
|
scope.intercept({subject: window}, apis);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
logging.message("settings not loaded -> need to pre intercep");
|
||||||
let forceLoad = true;
|
let forceLoad = true;
|
||||||
let preIntercepted = false;
|
let preIntercepted = false;
|
||||||
let intercepted = false;
|
let intercepted = false;
|
||||||
@ -99,6 +100,7 @@
|
|||||||
configureable: true,
|
configureable: true,
|
||||||
get: exportFunction(function(){
|
get: exportFunction(function(){
|
||||||
if (forceLoad){
|
if (forceLoad){
|
||||||
|
logging.warning("force load the settings. Calling stack:", (new Error()).stack);
|
||||||
undoPreIntercept();
|
undoPreIntercept();
|
||||||
settings.forceLoad();
|
settings.forceLoad();
|
||||||
doRealIntercept();
|
doRealIntercept();
|
||||||
@ -106,6 +108,7 @@
|
|||||||
return descriptor.value || descriptor.get();
|
return descriptor.value || descriptor.get();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
logging.notice("API blocked (%s)", name);
|
||||||
var url = getURL(window);
|
var url = getURL(window);
|
||||||
if (!url){
|
if (!url){
|
||||||
return undef;
|
return undef;
|
||||||
@ -148,7 +151,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
logging.verbose("pre intercept until settings are loaded");
|
|
||||||
doPreIntercept();
|
doPreIntercept();
|
||||||
settings.onloaded(function(){
|
settings.onloaded(function(){
|
||||||
undoPreIntercept();
|
undoPreIntercept();
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
const settings = require("./settings");
|
const settings = require("./settings");
|
||||||
const logging = require("./logging");
|
const logging = require("./logging");
|
||||||
if (settings.init(${JSON.stringify(data)})){
|
if (settings.init(${JSON.stringify(data)})){
|
||||||
logging.message("Initiaized settings by dynamic content script.");
|
logging.message("Initialized settings by dynamic content script.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logging.error("Dynamic content script was too late to provide settings.");
|
logging.error("Dynamic content script was too late to provide settings.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user