From 43a5ed735b95a575a9339b6e71a1fcb27a99663b Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 21 Oct 2015 13:30:04 -0400 Subject: [PATCH] admin storage is accessed only by main context --- platform/chromium/vapi-background.js | 14 ++++++++++++++ platform/chromium/vapi-common.js | 13 ------------- platform/firefox/vapi-background.js | 15 +++++++++++++++ platform/firefox/vapi-common.js | 14 -------------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index 853accbca..8b3b6a808 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -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 diff --git a/platform/chromium/vapi-common.js b/platform/chromium/vapi-common.js index 3f78ba06b..4df7b9968 100644 --- a/platform/chromium/vapi-common.js +++ b/platform/chromium/vapi-common.js @@ -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); - }); - } -}; - -/******************************************************************************/ - })(); /******************************************************************************/ diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 5df6011a5..12ac84273 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -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'; diff --git a/platform/firefox/vapi-common.js b/platform/firefox/vapi-common.js index ab5c47867..374890a66 100644 --- a/platform/firefox/vapi-common.js +++ b/platform/firefox/vapi-common.js @@ -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)); - } -}; - -/******************************************************************************/ - })(); /******************************************************************************/