aboutsummaryrefslogtreecommitdiff
path: root/js/firefox/background-shim.js
diff options
context:
space:
mode:
authorEinar Egilsson <einar@einaregilsson.com>2015-09-23 14:13:04 +0000
committerEinar Egilsson <einar@einaregilsson.com>2015-09-23 14:13:04 +0000
commit44a77ad615bee660ffdf325606fc806175c536bd (patch)
tree70c3d64787edfd9ab6773c59a04ce3f2550858b6 /js/firefox/background-shim.js
parent4d40b9c971fecfd270491e00e0f40c4e41fb1c82 (diff)
3.0 ready
Diffstat (limited to 'js/firefox/background-shim.js')
-rw-r--r--js/firefox/background-shim.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/js/firefox/background-shim.js b/js/firefox/background-shim.js
index 0763c8c..5598920 100644
--- a/js/firefox/background-shim.js
+++ b/js/firefox/background-shim.js
@@ -3,10 +3,9 @@ var tabs = require('sdk/tabs');
const {Cu} = require('chrome');
-exports.setLogger = function(logger){
- log = logger;
-}
-
+function log(msg) {
+ console.log(msg);
+}
function migrateFromOlderVersion() {
const { pathFor } = require('sdk/system');
@@ -146,15 +145,15 @@ var panel = panels.Panel({
function attachedPage(worker) {
function sendReply(originalMessage, reply) {
var msg = {messageId:originalMessage.messageId, payload:reply};
+ if (typeof log == 'undefined') {
+ Cu.reportError('LOG IS DEAD DEAD DEAD');
+ }
log('background sending message: ' + JSON.stringify(msg));
worker.port.emit('message', msg);
}
- function logger(logMessage) {
- log(logMessage);
- }
//We proxy all logging over here so we can control it with one switch
- worker.port.on('log', logger);
+ worker.port.on('log', log);
function receive(message) {
log('background got message: ' + JSON.stringify(message));
@@ -204,7 +203,7 @@ function attachedPage(worker) {
worker.on('detach', function() {
worker.port.removeListener('message', receive);
- worker.port.removeListener('log', logger);
+ worker.port.removeListener('log', log);
});
}
@@ -223,4 +222,4 @@ exports.chrome = chrome;
//Get redirect.js, which is included in the background page in webextensions.
exports.Redirect = require('../redirect').Redirect;
-
+exports.log = log;