diff --git a/src/background.html b/src/background.html index 07eb25d40..9e006ec0c 100644 --- a/src/background.html +++ b/src/background.html @@ -11,7 +11,6 @@ - diff --git a/src/js/async.js b/src/js/async.js index 0dea156b5..93af28fca 100644 --- a/src/js/async.js +++ b/src/js/async.js @@ -84,7 +84,7 @@ AsyncJobManager.prototype.restartTimer = function() { // TODO: Maybe use chrome.alarms() API when the next job is at more than // one minute in the future... From reading about it, chrome.alarms() is // smarter in that it will fire the event only when the browser is not - // too busy. (through XAL to abstract API specificities) + // too busy. if ( when < this.timerWhen ) { clearTimeout(this.timerId); this.timerWhen = when; diff --git a/src/js/messaging.js b/src/js/messaging.js index cef099ac0..3eeb62df1 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -1113,7 +1113,7 @@ var backupUserData = function(callback) { µb.restoreBackupSettings.lastBackupFile = filename; µb.restoreBackupSettings.lastBackupTime = Date.now(); - µb.XAL.keyvalSetMany(µb.restoreBackupSettings); + µb.keyvalSetMany(µb.restoreBackupSettings); getLocalData(callback); }; @@ -1135,20 +1135,20 @@ var restoreUserData = function(request) { var onAllRemoved = function() { // Be sure to adjust `countdown` if adding/removing anything below - µb.XAL.keyvalSetOne('version', userData.version); + µb.keyvalSetOne('version', userData.version); µBlock.saveLocalSettings(true); - µb.XAL.keyvalSetMany(userData.userSettings, onCountdown); - µb.XAL.keyvalSetOne('remoteBlacklists', userData.filterLists, onCountdown); - µb.XAL.keyvalSetOne('netWhitelist', userData.netWhitelist || '', onCountdown); + µb.keyvalSetMany(userData.userSettings, onCountdown); + µb.keyvalSetOne('remoteBlacklists', userData.filterLists, onCountdown); + µb.keyvalSetOne('netWhitelist', userData.netWhitelist || '', onCountdown); // With versions 0.9.2.4-, dynamic rules were saved within the // `userSettings` object. No longer the case. var s = userData.dynamicFilteringString || userData.userSettings.dynamicFilteringString || ''; - µb.XAL.keyvalSetOne('dynamicFilteringString', s, onCountdown); + µb.keyvalSetOne('dynamicFilteringString', s, onCountdown); - µb.XAL.keyvalSetOne('hostnameSwitchesString', userData.hostnameSwitchesString || '', onCountdown); + µb.keyvalSetOne('hostnameSwitchesString', userData.hostnameSwitchesString || '', onCountdown); µb.assets.put('assets/user/filters.txt', userData.userFilters, onCountdown); - µb.XAL.keyvalSetMany({ + µb.keyvalSetMany({ lastRestoreFile: request.file || '', lastRestoreTime: Date.now(), lastBackupFile: '', @@ -1162,13 +1162,13 @@ var restoreUserData = function(request) { // If we are going to restore all, might as well wipe out clean local // storage - µb.XAL.keyvalRemoveAll(onAllRemoved); + vAPI.storage.clear(onAllRemoved); }; /******************************************************************************/ var resetUserData = function() { - µb.XAL.keyvalRemoveAll(); + vAPI.storage.clear(); // Keep global counts, people can become quite attached to numbers µb.saveLocalSettings(true); diff --git a/src/js/start.js b/src/js/start.js index d5ecec0ae..f335dc003 100644 --- a/src/js/start.js +++ b/src/js/start.js @@ -141,7 +141,7 @@ var onUserSettingsReady = function(fetched) { // Remove obsolete setting delete userSettings.logRequests; - µb.XAL.keyvalRemoveOne('logRequests'); + vAPI.storage.remove('logRequests'); }; /******************************************************************************/ diff --git a/src/js/storage.js b/src/js/storage.js index dd70d4dac..67b7bb1f0 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -38,6 +38,20 @@ /******************************************************************************/ +µBlock.keyvalSetOne = function(key, val, callback) { + var bin = {}; + bin[key] = val; + vAPI.storage.set(bin, callback || this.noopFunc); +}; + +/******************************************************************************/ + +µBlock.keyvalSetMany = function(dict, callback) { + vAPI.storage.set(dict, callback || this.noopFunc); +}; + +/******************************************************************************/ + µBlock.saveLocalSettings = function(force) { if ( force ) { this.localSettingsModifyTime = Date.now(); @@ -70,13 +84,13 @@ /******************************************************************************/ µBlock.savePermanentFirewallRules = function() { - this.XAL.keyvalSetOne('dynamicFilteringString', this.permanentFirewall.toString()); + this.keyvalSetOne('dynamicFilteringString', this.permanentFirewall.toString()); }; /******************************************************************************/ µBlock.saveHostnameSwitches = function() { - this.XAL.keyvalSetOne('hostnameSwitchesString', this.hnSwitches.toString()); + this.keyvalSetOne('hostnameSwitchesString', this.hnSwitches.toString()); }; /******************************************************************************/ diff --git a/src/js/xal.js b/src/js/xal.js deleted file mode 100644 index 872471b19..000000000 --- a/src/js/xal.js +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - - µBlock - a browser extension to block requests. - Copyright (C) 2014 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see {http://www.gnu.org/licenses/}. - - Home: https://github.com/gorhill/uBlock -*/ - -/* global µBlock */ -'use strict'; - -/******************************************************************************/ - -µBlock.XAL = (function(){ - -/******************************************************************************/ - -var exports = {}; -var noopFunc = function(){}; - - -/******************************************************************************/ - -exports.keyvalSetOne = function(key, val, callback) { - var bin = {}; - bin[key] = val; - vAPI.storage.set(bin, callback || noopFunc); -}; - -/******************************************************************************/ - -exports.keyvalSetMany = function(dict, callback) { - vAPI.storage.set(dict, callback || noopFunc); -}; - -/******************************************************************************/ - -exports.keyvalRemoveOne = function(key, callback) { - vAPI.storage.remove(key, callback || noopFunc); -}; - -/******************************************************************************/ - -exports.keyvalRemoveAll = function(callback) { - vAPI.storage.clear(callback || noopFunc); -}; - -/******************************************************************************/ - -return exports; - -/******************************************************************************/ - -})();