diff options
author | gorhill <rhill@raymondhill.net> | 2015-08-16 08:17:01 -0400 |
---|---|---|
committer | gorhill <rhill@raymondhill.net> | 2015-08-16 08:17:01 -0400 |
commit | 69ec33dc3ab436a7afa9be6675780165497ece09 (patch) | |
tree | 4b3a3637a435c0c6f976f26b1a4c3a4e647f079d /platform/chromium | |
parent | 682add2b89cc9aff6a6cc3d5e11a0e9333f88a82 (diff) | |
download | uBlock-69ec33dc3ab436a7afa9be6675780165497ece09.zip uBlock-69ec33dc3ab436a7afa9be6675780165497ece09.tar.gz uBlock-69ec33dc3ab436a7afa9be6675780165497ece09.tar.bz2 |
fixed typo in comment + return size of cloud storage
- fixed typo as per https://github.com/gorhill/uBlock/commit/7a38cd756d07dedd010d3bc01c42770a33cbb271#commitcomment-12702437
- store size of cloud storage item, I might decide to use this in the UI
Diffstat (limited to 'platform/chromium')
-rw-r--r-- | platform/chromium/vapi-background.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index 99d1f3b..c167b8e 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -67,10 +67,10 @@ vAPI.storage = chrome.storage.local; // https://developer.chrome.com/extensions/privacy#property-network // 2015-08-12: Wrapped Chrome API in try-catch statements. I had a fluke -// event in which it appeared the Chrome 46 decided to restart uBlock (for +// event in which it appeared Chrome 46 decided to restart uBlock (for // unknown reasons) and again for unknown reasons the browser acted as if // uBlock did not declare the `privacy` permission in its manifest, putting -// uBlock in a bad, non-fonctional state -- because call to `chrome.privacy` +// uBlock in a bad, non-functional state -- because call to `chrome.privacy` // API threw an exception. vAPI.browserSettings = { @@ -1057,18 +1057,21 @@ vAPI.cloud = (function() { }; var push = function(dataKey, data, callback) { - var item = JSON.stringify({ + var bin = { 'source': options.deviceName || options.defaultDeviceName, 'tstamp': Date.now(), - 'data': data - }); + 'data': data, + 'size': 0 + }; + bin.size = JSON.stringify(bin).length; + var item = JSON.stringify(bin); // Chunkify taking into account QUOTA_BYTES_PER_ITEM: // https://developer.chrome.com/extensions/storage#property-sync // "The maximum size (in bytes) of each individual item in sync // "storage, as measured by the JSON stringification of its value // "plus its key length." - var bin = {}; + bin = {}; var chunkCount = Math.ceil(item.length / maxChunkSize); for ( var i = 0; i < chunkCount; i++ ) { bin[dataKey + i.toString()] = item.substr(i * maxChunkSize, maxChunkSize); |