mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-06-15 16:54:56 +12:00
possible fix for https://www.reddit.com/r/uMatrix/comments/8lc9ia/
This commit is contained in:
parent
4b4db46663
commit
3795b99fc5
|
@ -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 = {};
|
let bin = {};
|
||||||
for ( var i = 0; i < maxChunkCountPerItem; i += 16 ) {
|
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 ) {
|
for ( let i = 0; i < maxChunkCountPerItem; i += 16 ) {
|
||||||
if ( bin[dataKey + i.toString()] === '' ) {
|
if ( bin[dataKey + i.toString()] === '' ) { break; }
|
||||||
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;
|
let json = [], jsonSlice;
|
||||||
var i = 0;
|
let i = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
jsonSlice = bin[dataKey + i.toString()];
|
jsonSlice = bin[dataKey + i.toString()];
|
||||||
if ( jsonSlice === '' ) {
|
if ( jsonSlice === '' || jsonSlice === undefined ) { break; }
|
||||||
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) {
|
||||||
|
|
|
@ -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 ) {
|
if ( entry instanceof Object === false ) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.cloud.data = entry.data;
|
self.cloud.data = entry.data;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue