diff options
| -rw-r--r-- | js/background.js | 14 | ||||
| -rw-r--r-- | js/firefox/background-shim.js | 14 | ||||
| -rw-r--r-- | package.json | 4 | 
3 files changed, 20 insertions, 12 deletions
diff --git a/js/background.js b/js/background.js index 4cd3d62..40998f7 100644 --- a/js/background.js +++ b/js/background.js @@ -33,11 +33,13 @@ function log(msg) {  log.enabled = true;  function setIcon(image) { -	var sizes = [16,19,32,38,48,64]; -	var data = { path: {}}; -	for (var s of sizes) { -		data.path[s] = 'images/' + image + '-' + s + '.png'; -	}  +	var data = {  +		path: { +			19 : 'images/' + image + '-19.png', +			38 : 'images/' + image + '-38.png' +		} +	}; +  	chrome.browserAction.setIcon(data, function() {  		var err = chrome.runtime.lastError;  		if (err) { @@ -132,7 +134,7 @@ function createFilter(redirects) {  	//FIXME: The Firefox implementation of the url matching is seriously broken still,  	//so we can't filter by url on Firefox for now, have to cut non http urls out in checkRedirects.  	return { -		urls: isFirefox ? null : ["https://*", "http://*"], +		urls: isFirefox ? null : ["https://*/*", "http://*/*"],  		types : types  	};  } diff --git a/js/firefox/background-shim.js b/js/firefox/background-shim.js index 83e4cc7..d61d312 100644 --- a/js/firefox/background-shim.js +++ b/js/firefox/background-shim.js @@ -27,7 +27,6 @@ var button = ToggleButton({  	}  }); -  var extensionId = require('../../package.json').id;  var chrome = { @@ -59,8 +58,8 @@ var chrome = {  	browserAction : {  		setIcon : function(data, callback) {  			var icon = {}; -			for (var key in data.path) { -				icon[key] = makeUrl(data.path[key]); +			for (var s of ['16','32','48', '64']) { +				icon[s] = makeUrl(data.path['19'].replace('19', s));  			}  			button.icon = icon;  		} @@ -71,7 +70,7 @@ var pageMod = require("sdk/page-mod");  var panel = panels.Panel({  	width: 200, -	height: 130, +	height: 110,  	contentURL: makeUrl('popup.html'),  	contentScriptFile : makeUrl('js/firefox/content-script-proxy.js'),  	onHide: function() { @@ -89,7 +88,6 @@ function attachedPage(worker) {  		console.info('background got message: ' + JSON.stringify(message));  		if (message.messageType == 'storage.get') { -			console.info('Getting from storage');  			chrome.storage.local.get(message.payload, function(data) {  				sendReply(message, data);  			}); @@ -99,7 +97,9 @@ function attachedPage(worker) {  			});  		} else if (message.messageType == 'tabs.query') {  			var result = []; -			for (let tab of tabs) { +			var windows = require("sdk/windows").browserWindows; +			 +			for (let tab of windows.activeWindow.tabs) {  				if (tab.url == message.payload.url) {  					result.push({id:tab.id, url:tab.url});  				} @@ -109,12 +109,14 @@ function attachedPage(worker) {  			for (let tab of tabs) {  				if (tab.id == message.payload.tabId) {  					tab.activate(); +					panel.hide();  					sendReply(message, tab);  				}  			}  			sendReply(message, null);  		} else if (message.messageType == 'tabs.create') {  			tabs.open(message.payload.url); +			panel.hide();  			sendReply(message, null);  		}   	}); diff --git a/package.json b/package.json index 38e4f23..91fe391 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,13 @@    "name": "redirector",    "id" : "redirector@einaregilsson.com",    "version": "3.0.0", +  "homepage" : "http://einaregilsson.com/redirector", +  "icon" : "images/icon-active-48.png", +  "icon64" : "images/icon-active-64.png",    "description": "A basic add-on",    "main": "js/background.js",    "author": "Einar Egilsson", +  "permissions" : { "multiprocess" : true },    "engines": {      "firefox": ">=38.0a1",      "fennec": ">=38.0a1"  | 
