From feea508a8e4ad6825da48ff5ecc8bdf2f2da5023 Mon Sep 17 00:00:00 2001 From: Deathamns Date: Thu, 18 Dec 2014 11:59:04 +0100 Subject: [PATCH] Firefox: location.host isntead of app.cleanName --- platform/firefox/vapi-background.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index a357cd3..5481723 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -45,8 +45,7 @@ vAPI.firefox = true; vAPI.app = { name: 'µBlock', - version: '0.7.2.0', - cleanName: location.host + version: '0.8.2.0' }; /******************************************************************************/ @@ -75,7 +74,7 @@ var SQLite = { throw Error('Should be a directory...'); } - path.append(vAPI.app.cleanName + '.sqlite'); + path.append(location.host + '.sqlite'); this.db = Services.storage.openDatabase(path); this.db.executeSimpleSQL( 'CREATE TABLE IF NOT EXISTS settings' + @@ -83,6 +82,7 @@ var SQLite = { ); vAPI.unload.push(function() { + // VACUUM somewhere else, instead on unload? SQLite.run('VACUUM'); SQLite.db.asyncClose(); }); @@ -343,7 +343,7 @@ vAPI.tabs.registerListeners = function() { for (var tab of win.gBrowser.tabs) { var URI = tab.linkedBrowser.currentURI; - if (URI.scheme === 'chrome' && URI.host === vAPI.app.cleanName) { + if (URI.scheme === 'chrome' && URI.host === location.host) { win.gBrowser.removeTab(tab); } } @@ -551,7 +551,7 @@ vAPI.tabs.injectScript = function(tabId, details, callback) { } tab.linkedBrowser.messageManager.sendAsyncMessage( - vAPI.app.cleanName + ':broadcast', + location.host + ':broadcast', JSON.stringify({ broadcast: true, portName: 'vAPI', @@ -599,8 +599,8 @@ vAPI.setIcon = function(tabId, img, badge) { /******************************************************************************/ vAPI.toolbarButton = { - widgetId: vAPI.app.cleanName + '-button', - panelId: vAPI.app.cleanName + '-panel' + widgetId: location.host + '-button', + panelId: location.host + '-panel' }; /******************************************************************************/ @@ -663,7 +663,7 @@ vAPI.toolbarButton.add = function(doc) { var onPopupReady = function() { if (!this.contentWindow - || this.contentWindow.location.host !== vAPI.app.cleanName) { + || this.contentWindow.location.host !== location.host) { return; } @@ -822,7 +822,7 @@ vAPI.messaging.setup = function(defaultHandler) { this.defaultHandler = defaultHandler; this.globalMessageManager.addMessageListener( - vAPI.app.cleanName + ':background', + location.host + ':background', this.onMessage ); @@ -833,7 +833,7 @@ vAPI.messaging.setup = function(defaultHandler) { gmm.removeDelayedFrameScript(vAPI.messaging.frameScript); gmm.removeMessageListener( - vAPI.app.cleanName + ':background', + location.host + ':background', vAPI.messaging.onMessage ); }); @@ -843,7 +843,7 @@ vAPI.messaging.setup = function(defaultHandler) { vAPI.messaging.broadcast = function(message) { this.globalMessageManager.broadcastAsyncMessage( - vAPI.app.cleanName + ':broadcast', + location.host + ':broadcast', JSON.stringify({broadcast: true, msg: message}) ); }; @@ -851,7 +851,7 @@ vAPI.messaging.broadcast = function(message) { /******************************************************************************/ vAPI.net = { - beforeRequestMessageName: vAPI.app.cleanName + ':onBeforeRequest' + beforeRequestMessageName: location.host + ':onBeforeRequest' }; /******************************************************************************/