Various Firefox error and warning fixes #166

This commit is contained in:
Jason 2016-03-07 23:22:28 -06:00
parent 2973cac28f
commit cc95a62c7c
6 changed files with 24 additions and 13 deletions

View File

@ -83,7 +83,10 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
} }
}); });
chrome.commands.onCommand.addListener(function(command) {
// 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) { switch (command) {
case "openManage": case "openManage":
openURL({url: chrome.extension.getURL("manage.html")}); openURL({url: chrome.extension.getURL("manage.html")});
@ -93,7 +96,8 @@ chrome.commands.onCommand.addListener(function(command) {
chrome.contextMenus.update("disableAll", {checked: prefs.get("disableAll")}); chrome.contextMenus.update("disableAll", {checked: prefs.get("disableAll")});
break; break;
} }
}); });
}
// contextMenus API is present in ancient Chrome but it throws an exception // 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. // upon encountering the unsupported parameter value "browser_action", so we have to catch it.

View File

@ -1,5 +1,6 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<script src="codemirror/lib/codemirror.js"></script> <script src="codemirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="codemirror/lib/codemirror.css"> <link rel="stylesheet" href="codemirror/lib/codemirror.css">
<script src="codemirror/mode/css/css.js"></script> <script src="codemirror/mode/css/css.js"></script>

View File

@ -48,7 +48,7 @@ function tNodeList(nodes) {
continue; continue;
} }
name = name.substr(5); // "i18n-".length name = name.substr(5); // "i18n-".length
var value = t(attr.nodeValue); var value = t(attr.value);
switch (name) { switch (name) {
case "text": case "text":
node.insertBefore(document.createTextNode(value), node.firstChild); node.insertBefore(document.createTextNode(value), node.firstChild);
@ -59,7 +59,7 @@ function tNodeList(nodes) {
default: default:
node.setAttribute(name, value); node.setAttribute(name, value);
} }
node.removeAttributeNode(attr); node.removeAttribute(attr.nodeName);
} }
} }
} }

View File

@ -1,5 +1,6 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title i18n-text="manageTitle"></title> <title i18n-text="manageTitle"></title>
<style> <style>
body { body {

View File

@ -1,5 +1,6 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<style> <style>
body { body {
width: 200px; width: 200px;

View File

@ -1,6 +1,10 @@
var webSqlStorage = { var webSqlStorage = {
migrate: function() { migrate: function() {
if (typeof openDatabase == "undefined") {
// No WebSQL - no migration!
return;
}
webSqlStorage.getStyles(function(styles) { webSqlStorage.getStyles(function(styles) {
getDatabase(function(db) { getDatabase(function(db) {
var tx = db.transaction(["styles"], "readwrite"); var tx = db.transaction(["styles"], "readwrite");