diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index b9d25651..5108b661 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -72,6 +72,10 @@
"message": "Checking...",
"description": "Text to display when checking a style for an update"
},
+ "dbError": {
+ "message": "An error has occurred using the Stylish database. Would you like to visit a web page with possible solutions?",
+ "description": "Prompt when a DB error is encountered"
+ },
"deleteStyleLabel": {
"message": "Delete",
"description": "Label for the button to delete a style"
diff --git a/background.js b/background.js
index fcd74f07..86da312d 100644
--- a/background.js
+++ b/background.js
@@ -21,6 +21,9 @@ chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
case "styleChanged":
cachedStyles = null;
break;
+ case "healthCheck":
+ getDatabase(function() { sendResponse(true); }, function() { sendResponse(false); });
+ break;
}
});
diff --git a/health.js b/health.js
new file mode 100644
index 00000000..37faf120
--- /dev/null
+++ b/health.js
@@ -0,0 +1,7 @@
+chrome.extension.sendMessage({method: "healthCheck"}, function(ok) {
+ if (!ok) {
+ if (confirm(t("dbError"))) {
+ window.open("http://userstyles.org/dberror");
+ }
+ }
+});
diff --git a/manage.html b/manage.html
index 3baba1ed..66b34d26 100644
--- a/manage.html
+++ b/manage.html
@@ -85,6 +85,7 @@
}
+
diff --git a/popup.html b/popup.html
index d7e84be4..a847cf60 100644
--- a/popup.html
+++ b/popup.html
@@ -39,6 +39,7 @@
+
diff --git a/storage.js b/storage.js
index e774482f..3bee18b3 100644
--- a/storage.js
+++ b/storage.js
@@ -4,7 +4,12 @@ function getDatabase(ready, error) {
ready(stylishDb);
return;
}
- stylishDb = openDatabase('stylish', '', 'Stylish Styles', 5*1024*1024);
+ try {
+ stylishDb = openDatabase('stylish', '', 'Stylish Styles', 5*1024*1024);
+ } catch (ex) {
+ error();
+ throw ex;
+ }
if (stylishDb.version == "1.0" || stylishDb.version == "") {
dbV11(stylishDb, error, ready);
} else if (stylishDb.version == "1.1") {