Raymond Hill 6 years ago
parent
commit
3795b99fc5
No known key found for this signature in database GPG Key ID: 25E1490B761470C2
  1. 22
      platform/chromium/vapi-background.js
  2. 6
      src/js/cloud-ui.js

22
platform/chromium/vapi-background.js

@ -2,7 +2,7 @@
uMatrix - a browser extension to block requests. uMatrix - a browser extension to block requests.
Copyright (C) 2014-2018 The uBlock Origin authors 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 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 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. // and chrome.storage.sync.MAX_WRITE_OPERATIONS_PER_HOUR.
var getCoarseChunkCount = function(dataKey, callback) { 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()] = ''; bin[dataKey + i.toString()] = '';
} }
@ -767,10 +767,8 @@ vAPI.cloud = (function() {
} }
var chunkCount = 0; 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; chunkCount = i + 16;
} }
@ -844,18 +842,16 @@ vAPI.cloud = (function() {
} }
// Assemble chunks into a single string. // Assemble chunks into a single string.
var json = [], jsonSlice;
var i = 0;
let json = [], jsonSlice;
let i = 0;
for (;;) { for (;;) {
jsonSlice = bin[dataKey + i.toString()]; jsonSlice = bin[dataKey + i.toString()];
if ( jsonSlice === '' ) {
break;
}
if ( jsonSlice === '' || jsonSlice === undefined ) { break; }
json.push(jsonSlice); json.push(jsonSlice);
i += 1; i += 1;
} }
var entry = null;
let entry = null;
try { try {
entry = JSON.parse(json.join('')); entry = JSON.parse(json.join(''));
} catch(ex) { } catch(ex) {

6
src/js/cloud-ui.js

@ -1,7 +1,7 @@
/******************************************************************************* /*******************************************************************************
uBlock Origin - a browser extension to block requests. 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 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 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) { var onCloudDataReceived = function(entry) {
if ( typeof entry !== 'object' || entry === null ) {
return;
}
if ( entry instanceof Object === false ) { return; }
self.cloud.data = entry.data; self.cloud.data = entry.data;

Loading…
Cancel
Save