From e81e4d768650ab3c088eaabbe35eb357e31e07c6 Mon Sep 17 00:00:00 2001 From: Kevin Ngo Date: Thu, 26 Feb 2015 15:26:58 -0800 Subject: [PATCH] v1.12.0 more aggressive fix for groupCollapsed on nightly (bug 1136550) --- bower.json | 2 +- log.js | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bower.json b/bower.json index 845850b..627c59c 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "author": "Mozilla", "name": "marketplace-core-modules", - "version": "1.11.0", + "version": "1.12.0", "ignore": [ "bower.json", "LICENSE", diff --git a/log.js b/log.js index a21d938..f005ff1 100644 --- a/log.js +++ b/log.js @@ -5,8 +5,10 @@ define('log', ['storage', 'utils'], function(storage, utils) { - if (!window.console.groupCollapsed) { - window.console.groupCollapsed = window.console.group = window.console.log; + if (window.console.groupCollapsed === undefined) { + // If conslole group API not available. Use log instead. + window.console.groupCollapsed = window.console.log; + window.console.group = window.console.log; window.console.groupEnd = function() {}; } @@ -18,7 +20,6 @@ define('log', var persistent_logs = storage.getItem('persistent_logs') || {}; var logger = function(type, tag, onlog) { - // Give nice log prefixes: // > [log] This is a nice message! var prefix = '[' + type + ']'; @@ -49,9 +50,14 @@ define('log', } } - // TODO: Add colorification support here for browsers that support it. + if (window.console[log_level] === undefined) { + // Firefox Nightly refusing the polyfill above. + window.console[log_level] = window.console.log; + } + + // TODO: Add colorification here for browsers that support it. // *cough cough* not firefox *cough* - window.console[log_level].apply(console, args); + window.console[log_level].apply(window.console, args); }; }