From 426a6ea9a7c319b741b218e5ce274d9434a9a310 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 18 Feb 2019 14:41:04 -0500 Subject: [PATCH] Fix spurious output at uBO's dev console Regression from https://github.com/gorhill/uBlock/commit/0d369cda21bb --- src/js/background.js | 27 +++++++++++---------------- src/js/console.js | 2 +- src/js/storage.js | 3 +-- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/js/background.js b/src/js/background.js index 9e4b3c1ed..0e8e5e807 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -35,9 +35,6 @@ if ( vAPI.webextFlavor === undefined ) { const µBlock = (function() { // jshint ignore:line - const oneSecond = 1000, - oneMinute = 60 * oneSecond; - const hiddenSettingsDefault = { assetFetchTimeout: 30, autoCommentFilterTemplate: '{{date}} {{origin}}', @@ -97,21 +94,19 @@ const µBlock = (function() { // jshint ignore:line hiddenSettingsDefault: hiddenSettingsDefault, hiddenSettings: (function() { - const out = Object.assign({}, hiddenSettingsDefault), - json = vAPI.localStorage.getItem('immediateHiddenSettings'); - if ( typeof json === 'string' ) { - try { - const o = JSON.parse(json); - if ( o instanceof Object ) { - for ( const k in o ) { - if ( out.hasOwnProperty(k) ) { - out[k] = o[k]; - } - } + const out = Object.assign({}, hiddenSettingsDefault); + const json = vAPI.localStorage.getItem('immediateHiddenSettings'); + if ( typeof json !== 'string' ) { return out; } + try { + const o = JSON.parse(json); + if ( o instanceof Object ) { + for ( const k in o ) { + if ( out.hasOwnProperty(k) ) { out[k] = o[k]; } } + self.log.verbosity = out.consoleLogLevel; } - catch(ex) { - } + } + catch(ex) { } return out; })(), diff --git a/src/js/console.js b/src/js/console.js index 9e7fafb5c..1545882ef 100644 --- a/src/js/console.js +++ b/src/js/console.js @@ -29,6 +29,6 @@ self.log = (function() { set verbosity(level) { this.info = console.info = level === 'info' ? info : noopFunc; }, - info, + info: noopFunc, }; })(); diff --git a/src/js/storage.js b/src/js/storage.js index 16c958941..71b5c0c09 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -196,10 +196,9 @@ vAPI.localStorage.setItem( 'immediateHiddenSettings', JSON.stringify({ - cacheStorageAPI: this.hiddenSettings.cacheStorageAPI, + consoleLogLevel: this.hiddenSettings.consoleLogLevel, disableWebAssembly: this.hiddenSettings.disableWebAssembly, suspendTabsUntilReady: this.hiddenSettings.suspendTabsUntilReady, - userResourcesLocation: this.hiddenSettings.userResourcesLocation, }) ); };