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
1 changed files with 10 additions and 2 deletions

View File

@ -1206,7 +1206,9 @@ vAPI.cloud = (function() {
for ( var i = start; i < n; i++ ) {
keys.push(dataKey + i.toString());
}
if ( keys.length !== 0 ) {
chrome.storage.sync.remove(keys);
}
};
var start = function(/* dataKeys */) {
@ -1242,8 +1244,14 @@ 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.
// - 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);
// Remove potentially unused trailing chunks