admin storage is accessed only by main context

This commit is contained in:
gorhill 2015-10-21 13:30:04 -04:00
parent 892913d185
commit 43a5ed735b
4 changed files with 29 additions and 27 deletions

View file

@ -1008,6 +1008,20 @@ vAPI.punycodeURL = function(url) {
/******************************************************************************/
/******************************************************************************/
// https://github.com/gorhill/uBlock/issues/531
// Storage area dedicated to admin settings. Read-only.
vAPI.adminStorage = {
getItem: function(key, callback) {
chrome.storage.managed.get(key, function(store) {
callback(store[key] || undefined);
});
}
};
/******************************************************************************/
/******************************************************************************/
vAPI.cloud = (function() {
var chunkCountPerFetch = 16; // Must be a power of 2

View file

@ -98,19 +98,6 @@ try {
/******************************************************************************/
// https://github.com/gorhill/uBlock/issues/531
// Storage area dedicated to admin settings. Read-only.
vAPI.adminStorage = {
getItem: function(key, callback) {
chrome.storage.managed.get(key, function(store) {
callback(store[key] || undefined);
});
}
};
/******************************************************************************/
})();
/******************************************************************************/

View file

@ -3179,6 +3179,21 @@ vAPI.punycodeURL = function(url) {
/******************************************************************************/
/******************************************************************************/
// https://github.com/gorhill/uBlock/issues/531
// Storage area dedicated to admin settings. Read-only.
vAPI.adminStorage = {
getItem: function(key, callback) {
if ( typeof callback !== 'function' ) {
return;
}
callback(vAPI.localStorage.getItem(key));
}
};
/******************************************************************************/
/******************************************************************************/
vAPI.cloud = (function() {
var extensionBranchPath = 'extensions.' + location.host;
var cloudBranchPath = extensionBranchPath + '.cloudStorage';

View file

@ -181,20 +181,6 @@ vAPI.localStorage.init('extensions.' + location.host + '.');
/******************************************************************************/
// https://github.com/gorhill/uBlock/issues/531
// Storage area dedicated to admin settings. Read-only.
vAPI.adminStorage = {
getItem: function(key, callback) {
if ( typeof callback !== 'function' ) {
return;
}
callback(vAPI.localStorage.getItem(key));
}
};
/******************************************************************************/
})();
/******************************************************************************/