diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index de5b9bd..6c64de0 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -2,7 +2,7 @@ uMatrix - a browser extension to block requests. Copyright (C) 2014-2018 The uBlock Origin authors - Copyright (C) 2017-2018 Raymond Hill + Copyright (C) 2017-present Raymond Hill This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -755,8 +755,8 @@ vAPI.cloud = (function() { // and chrome.storage.sync.MAX_WRITE_OPERATIONS_PER_HOUR. var getCoarseChunkCount = function(dataKey, callback) { - var bin = {}; - for ( var i = 0; i < maxChunkCountPerItem; i += 16 ) { + let bin = {}; + for ( let i = 0; i < maxChunkCountPerItem; i += 16 ) { bin[dataKey + i.toString()] = ''; } @@ -767,10 +767,8 @@ vAPI.cloud = (function() { } var chunkCount = 0; - for ( var i = 0; i < maxChunkCountPerItem; i += 16 ) { - if ( bin[dataKey + i.toString()] === '' ) { - break; - } + for ( let i = 0; i < maxChunkCountPerItem; i += 16 ) { + if ( bin[dataKey + i.toString()] === '' ) { break; } chunkCount = i + 16; } @@ -844,18 +842,16 @@ vAPI.cloud = (function() { } // Assemble chunks into a single string. - var json = [], jsonSlice; - var i = 0; + let json = [], jsonSlice; + let i = 0; for (;;) { jsonSlice = bin[dataKey + i.toString()]; - if ( jsonSlice === '' ) { - break; - } + if ( jsonSlice === '' || jsonSlice === undefined ) { break; } json.push(jsonSlice); i += 1; } - var entry = null; + let entry = null; try { entry = JSON.parse(json.join('')); } catch(ex) { diff --git a/src/js/cloud-ui.js b/src/js/cloud-ui.js index cb77f4a..02f3822 100644 --- a/src/js/cloud-ui.js +++ b/src/js/cloud-ui.js @@ -1,7 +1,7 @@ /******************************************************************************* uBlock Origin - a browser extension to block requests. - Copyright (C) 2015-2017 Raymond Hill + Copyright (C) 2015-present Raymond Hill This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,9 +52,7 @@ if ( self.cloud.datakey === '' ) { /******************************************************************************/ var onCloudDataReceived = function(entry) { - if ( typeof entry !== 'object' || entry === null ) { - return; - } + if ( entry instanceof Object === false ) { return; } self.cloud.data = entry.data;