From 354b7325e453c3fa259ecd9a07b4634d09cf5afe Mon Sep 17 00:00:00 2001 From: Einar Egilsson Date: Wed, 23 Sep 2015 10:58:44 +0000 Subject: Build correctly for Firefox + allow to turn on logging --- js/background.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'js/background.js') diff --git a/js/background.js b/js/background.js index 40998f7..81bf405 100644 --- a/js/background.js +++ b/js/background.js @@ -1,6 +1,13 @@ //This is the background script. It is responsible for actually redirecting requests, //as well as monitoring changes in the redirects and the disabled status and reacting to them. +function log(msg) { + if (log.enabled) { + console.log('REDIRECTOR: ' + msg); + } +} +log.enabled = false; + //TODO: Better browser detection... var isFirefox = false; @@ -8,6 +15,7 @@ var isFirefox = false; if (typeof chrome == 'undefined') { isFirefox = true; var firefoxShim = require('./firefox/background-shim'); + firefoxShim.setLogger(log); chrome = firefoxShim.chrome; Redirect = firefoxShim.Redirect; } @@ -25,13 +33,6 @@ var ignoreNextRequest = { }; -function log(msg) { - if (log.enabled) { - console.log('REDIRECTOR: ' + msg); - } -} -log.enabled = true; - function setIcon(image) { var data = { path: { -- cgit v1.2.3