From cc95a62c7c36720deebc9331de46e49c991d6f21 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 7 Mar 2016 23:22:28 -0600 Subject: [PATCH] Various Firefox error and warning fixes #166 --- background.js | 26 +++++++++++++++----------- edit.html | 1 + localization.js | 4 ++-- manage.html | 1 + popup.html | 1 + storage-websql.js | 4 ++++ 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/background.js b/background.js index 6608c3d6..ab4ca9ca 100644 --- a/background.js +++ b/background.js @@ -83,17 +83,21 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { } }); -chrome.commands.onCommand.addListener(function(command) { - switch (command) { - case "openManage": - openURL({url: chrome.extension.getURL("manage.html")}); - break; - case "styleDisableAll": - disableAllStylesToggle(); - chrome.contextMenus.update("disableAll", {checked: prefs.get("disableAll")}); - break; - } -}); + +// Not available in Firefox - https://bugzilla.mozilla.org/show_bug.cgi?id=1240350 +if (("commands") in chrome) { + chrome.commands.onCommand.addListener(function(command) { + switch (command) { + case "openManage": + openURL({url: chrome.extension.getURL("manage.html")}); + break; + case "styleDisableAll": + disableAllStylesToggle(); + chrome.contextMenus.update("disableAll", {checked: prefs.get("disableAll")}); + break; + } + }); +} // contextMenus API is present in ancient Chrome but it throws an exception // upon encountering the unsupported parameter value "browser_action", so we have to catch it. diff --git a/edit.html b/edit.html index 33fc617e..0b70fd67 100644 --- a/edit.html +++ b/edit.html @@ -1,5 +1,6 @@ + diff --git a/localization.js b/localization.js index 23871ab6..f30f814c 100644 --- a/localization.js +++ b/localization.js @@ -48,7 +48,7 @@ function tNodeList(nodes) { continue; } name = name.substr(5); // "i18n-".length - var value = t(attr.nodeValue); + var value = t(attr.value); switch (name) { case "text": node.insertBefore(document.createTextNode(value), node.firstChild); @@ -59,7 +59,7 @@ function tNodeList(nodes) { default: node.setAttribute(name, value); } - node.removeAttributeNode(attr); + node.removeAttribute(attr.nodeName); } } } diff --git a/manage.html b/manage.html index 37af1467..79c044db 100644 --- a/manage.html +++ b/manage.html @@ -1,5 +1,6 @@ +