mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-09-28 07:11:20 +12:00
possible fix for https://www.reddit.com/r/uMatrix/comments/8lc9ia/
This commit is contained in:
parent
4b4db46663
commit
3795b99fc5
2 changed files with 11 additions and 17 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue