code review re. #3006

This commit is contained in:
gorhill 2017-09-29 08:49:22 -04:00
parent 6a71fc59a4
commit 4865561ca4
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -1206,7 +1206,9 @@ vAPI.cloud = (function() {
for ( var i = start; i < n; i++ ) {
keys.push(dataKey + i.toString());
}
chrome.storage.sync.remove(keys);
if ( keys.length !== 0 ) {
chrome.storage.sync.remove(keys);
}
};
var start = function(/* dataKeys */) {
@ -1242,7 +1244,13 @@ vAPI.cloud = (function() {
errorStr = chrome.runtime.lastError.message;
// https://github.com/gorhill/uBlock/issues/3006#issuecomment-332597677
// - Delete all that was pushed in case of failure.
chunkCount = 0;
// - It's unknown whether such issue applies only to Firefox:
// until such cases are reported for other browsers, we will
// reset the (now corrupted) content of the cloud storage
// only on Firefox.
if ( vAPI.webextFlavor.startsWith('Mozilla-Firefox-') ) {
chunkCount = 0;
}
}
callback(errorStr);