From 41a81129200ee1843026801686538b8d198b3cdd Mon Sep 17 00:00:00 2001 From: kkapsner Date: Mon, 18 Dec 2017 23:55:13 +0100 Subject: [PATCH] Added better logging to pre intercepting --- lib/intercept.js | 8 +++++--- lib/main.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/intercept.js b/lib/intercept.js index 1ebb0b3..627a6f6 100644 --- a/lib/intercept.js +++ b/lib/intercept.js @@ -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(); diff --git a/lib/main.js b/lib/main.js index d373a1d..2343862 100644 --- a/lib/main.js +++ b/lib/main.js @@ -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.");