diff --git a/background/background.js b/background/background.js
index 57e3e281..7ab9dd6b 100644
--- a/background/background.js
+++ b/background/background.js
@@ -15,7 +15,7 @@ window.API_METHODS = Object.assign(window.API_METHODS || {}, {
editSave: styleManager.editSave,
getTabUrlPrefix() {
- return this.sender.tab.url.match(/^([\w-]+:\/\/[^/#]+)/)[1];
+ return this.sender.tab.url.match(/^([\w-]+:\/+[^/#]+)/)[1];
},
getStyleFromDB: id =>
@@ -254,12 +254,12 @@ if (chrome.contextMenus) {
createContextMenus(keys);
}
+// reinject content scripts when the extension is reloaded/updated. Firefox
+// would handle this automatically.
if (!FIREFOX) {
reinjectContentScripts();
}
-// FIXME: implement exposeIframes in apply.js
-
// register hotkeys
if (FIREFOX && browser.commands && browser.commands.update) {
const hotkeyPrefs = Object.keys(prefs.defaults).filter(k => k.startsWith('hotkey.'));
@@ -305,7 +305,6 @@ function reinjectContentScripts() {
cs.matches.some(match => {
if ((match === ALL_URLS || url.match(match)) &&
(!url.startsWith('chrome') || url === NTP)) {
- // TODO: add a `msg.pingTab` API?
msg.sendTab(id, {method: 'ping'})
.catch(() => false)
.then(pong => !pong && injectCS(cs, id));
diff --git a/background/style-manager.js b/background/style-manager.js
index f3e47619..653ad29d 100644
--- a/background/style-manager.js
+++ b/background/style-manager.js
@@ -463,7 +463,7 @@ const styleManager = (() => {
}
function getDomain(url) {
- return url.match(/^[\w-]+:\/\/(?:[\w:-]+@)?([^:/#]+)/)[1];
+ return url.match(/^[\w-]+:\/+(?:[\w:-]+@)?([^:/#]+)/)[1];
}
function getUrlNoHash(url) {
diff --git a/background/usercss-helper.js b/background/usercss-helper.js
index d0341d64..572f925c 100644
--- a/background/usercss-helper.js
+++ b/background/usercss-helper.js
@@ -163,7 +163,7 @@
});
}
- function install({url, direct, downloaded, tab}, sender) {
+ function install({url, direct, downloaded, tab}, sender = this.sender) {
tab = tab !== undefined ? tab : sender.tab;
url = url || tab.url;
if (direct && !downloaded) {
diff --git a/install-usercss.html b/install-usercss.html
index 9caec3d1..00e71cb8 100644
--- a/install-usercss.html
+++ b/install-usercss.html
@@ -9,6 +9,8 @@
+
+
diff --git a/manifest.json b/manifest.json
index 01129353..bf69609a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -68,13 +68,13 @@
"matches": ["http://userstyles.org/*", "https://userstyles.org/*"],
"run_at": "document_start",
"all_frames": true,
- "js": ["js/promisify.js", "js/msg.js", "content/install-hook-userstyles.js"]
+ "js": ["content/install-hook-userstyles.js"]
},
{
"matches": ["https://openusercss.org/*", "https://openusercss.com/*"],
"run_at": "document_start",
"all_frames": false,
- "js": ["js/promisify.js", "js/msg.js", "content/install-hook-openusercss.js"]
+ "js": ["content/install-hook-openusercss.js"]
},
{
"matches": [
@@ -98,7 +98,7 @@
],
"run_at": "document_idle",
"all_frames": false,
- "js": ["js/promisify.js", "js/msg.js", "content/install-hook-usercss.js"]
+ "js": ["content/install-hook-usercss.js"]
}
],
"browser_action": {