From 4d9d53977ba40f4d798f1de938e2bd354c4ba0b3 Mon Sep 17 00:00:00 2001 From: DaAwesomeP Date: Sun, 12 Mar 2017 19:58:17 -0500 Subject: [PATCH 1/3] Don't use webextension polyfill for messages --- src/drivers/webextension/js/driver.js | 9 +++++++-- src/drivers/webextension/js/popup.js | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index eeda6b920..77a9b71cd 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -64,7 +64,7 @@ localStorage['version'] = version; } catch(e) { } - browser.runtime.onMessage.addListener(function(message, sender, sendResponse) { + function newMsg(message, sender, sendResponse) { var hostname, a = document.createElement('a'); @@ -105,7 +105,12 @@ break; } } - }); + } + if (typeof chrome === "undefined") { + browser.runtime.onMessage.addListener(newMsg); + } else { + chrome.runtime.onMessage.addListener(newMsg); + } browser.tabs.query({}).then(function(tabs) { tabs.forEach(function(tab) { diff --git a/src/drivers/webextension/js/popup.js b/src/drivers/webextension/js/popup.js index a5dd2cb61..4293aed21 100644 --- a/src/drivers/webextension/js/popup.js +++ b/src/drivers/webextension/js/popup.js @@ -30,7 +30,7 @@ document.addEventListener('DOMContentLoaded', function() { var appName, confidence, version; browser.tabs.query({ active: true }).then(function(tabs) { - browser.runtime.sendMessage({ id: 'get_apps', tab: tabs[0] }, function(response) { + function sendGetApps(response) { if ( response.tabCache && response.tabCache.count > 0 ) { detectedApps.innerHTML = ''; @@ -59,7 +59,12 @@ document.addEventListener('DOMContentLoaded', function() { detectedApps.innerHTML = detectedApps.innerHTML + html; } } - }); + } + if (typeof chrome === "undefined") { + browser.runtime.sendMessage({ id: 'get_apps', tab: tabs[0] }, sendGetApps); + } else { + chrome.runtime.sendMessage({ id: 'get_apps', tab: tabs[0] }, sendGetApps); + } }); } }; From bd1a004eec390de540a5ada38b1d2b04964ce4d3 Mon Sep 17 00:00:00 2001 From: DaAwesomeP Date: Sun, 12 Mar 2017 20:02:10 -0500 Subject: [PATCH 2/3] gitignore Windows and OSX junk files --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 19de018bb..7d65964c0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,8 @@ npm-debug.log tags !.gitkeep + +Thumbs.db +Desktop.ini +*.DS_Store +._* From 56c52c375189c1eb1831867beb8814418cc20c9f Mon Sep 17 00:00:00 2001 From: DaAwesomeP Date: Sun, 12 Mar 2017 20:14:00 -0500 Subject: [PATCH 3/3] fix firefox options page --- src/drivers/webextension/manifest.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/drivers/webextension/manifest.json b/src/drivers/webextension/manifest.json index 37879632e..5e57b50ae 100644 --- a/src/drivers/webextension/manifest.json +++ b/src/drivers/webextension/manifest.json @@ -36,7 +36,10 @@ "web_accessible_resources": [ "js/inject.js" ], - "options_page": "options.html", + "options_ui": { + "page": "options.html", + "open_in_tab": false + }, "permissions": [ "tabs", "webRequest",