1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00

#900: code review

This commit is contained in:
gorhill 2015-11-03 08:46:21 -05:00
parent 0c5a9bfba6
commit b3669218e6

View File

@ -37,7 +37,6 @@ var chrome = self.chrome;
var manifest = chrome.runtime.getManifest(); var manifest = chrome.runtime.getManifest();
vAPI.chrome = true; vAPI.chrome = true;
vAPI.opera = /\bOPR\/[\d.]+\b/.test(self.navigator.appVersion);
var noopFunc = function(){}; var noopFunc = function(){};
@ -1028,31 +1027,24 @@ vAPI.punycodeURL = function(url) {
// Also, UC Browser: http://www.upsieutoc.com/image/WXuH // Also, UC Browser: http://www.upsieutoc.com/image/WXuH
vAPI.adminStorage = { vAPI.adminStorage = {
getItem: (function() { getItem: function(key, callback) {
if ( vAPI.opera ) { var onRead = function(store) {
return function(key, callback) { var data;
callback(); if (
}; !chrome.runtime.lastError &&
} typeof store === 'object' &&
return function(key, callback) { store !== null
var onRead = function(store) { ) {
var data; data = store[key];
if (
!chrome.runtime.lastError &&
typeof store === 'object' &&
store !== null
) {
data = store[key];
}
callback(data);
};
try {
chrome.storage.managed.get(key, onRead);
} catch (ex) {
callback();
} }
callback(data);
}; };
})() try {
chrome.storage.managed.get(key, onRead);
} catch (ex) {
callback();
}
}
}; };
/******************************************************************************/ /******************************************************************************/