1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00

FF webext does not support getBytesInUse()

This commit is contained in:
gorhill 2016-10-30 13:06:23 -04:00
parent f3458e95f5
commit efdf43f1d5
2 changed files with 14 additions and 5 deletions

View File

@ -109,7 +109,11 @@ var exportToFile = function() {
var onLocalDataReceived = function(details) {
uDom('#localData > ul > li:nth-of-type(1)').text(
vAPI.i18n('settingsStorageUsed').replace('{{value}}', details.storageUsed.toLocaleString())
vAPI.i18n('settingsStorageUsed')
.replace(
'{{value}}',
typeof details.storageUsed === 'number' ? details.storageUsed.toLocaleString() : '?'
)
);
var elem, dt;

View File

@ -1,7 +1,7 @@
/*******************************************************************************
uBlock - a browser extension to block requests.
Copyright (C) 2014-2015 Raymond Hill
uBlock Origin - a browser extension to block requests.
Copyright (C) 2014-2016 Raymond Hill
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
@ -19,7 +19,7 @@
Home: https://github.com/gorhill/uBlock
*/
/* global YaMD5, µBlock, vAPI, punycode, publicSuffixList */
/* global YaMD5, punycode, publicSuffixList */
'use strict';
@ -33,7 +33,12 @@
µBlock.storageUsed = bytesInUse;
callback(bytesInUse);
};
// Not all platforms implement this method.
if ( vAPI.storage.getBytesInUse instanceof Function ) {
vAPI.storage.getBytesInUse(null, getBytesInUseHandler);
} else {
callback();
}
};
/******************************************************************************/