diff --git a/builds/crx/script.js b/builds/crx/script.js index 146e670e3..ecd3c2dac 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -797,20 +797,22 @@ }; timeout = {}; setArea = function(area) { - var data; + var data, keys; data = items[area]; - if (!Object.keys(data).length || timeout[area] > Date.now()) { + keys = Object.keys(data); + if (!keys.length || timeout[area] > Date.now()) { return; } chrome.storage[area].set(data, function() { - var key, val; + var key, val, _i, _len; if (chrome.runtime.lastError) { c.error(chrome.runtime.lastError.message); - for (key in data) { - val = data[key]; - if (!(!(key in items[area]))) { + for (_i = 0, _len = keys.length; _i < _len; _i++) { + key = keys[_i]; + if (!(!items[area][key])) { continue; } + val = data[key]; if (area === 'sync' && chrome.storage.sync.QUOTA_BYTES_PER_ITEM < JSON.stringify(val).length + key.length) { c.error(chrome.runtime.lastError.message, key, val); continue; diff --git a/src/General/lib/$.coffee b/src/General/lib/$.coffee index 7762d8a17..a957fa75d 100755 --- a/src/General/lib/$.coffee +++ b/src/General/lib/$.coffee @@ -347,11 +347,13 @@ do -> timeout = {} setArea = (area) -> data = items[area] - return if !Object.keys(data).length or timeout[area] > Date.now() + keys = Object.keys data + return if !keys.length or timeout[area] > Date.now() chrome.storage[area].set data, -> if chrome.runtime.lastError c.error chrome.runtime.lastError.message - for key, val of data when key not of items[area] + for key in keys when !items[area][key] + val = data[key] if area is 'sync' and chrome.storage.sync.QUOTA_BYTES_PER_ITEM < JSON.stringify(val).length + key.length c.error chrome.runtime.lastError.message, key, val continue