diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-09-22 20:38:23 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-09-22 20:38:23 -0700 |
commit | 578ec0b6d176f72d578e240b2c6712e588e8ed2a (patch) | |
tree | ff85c7eb2c8c85ecb5d59949cbf4e9be4dc89a68 | |
parent | 7a6e2925bdf94cf93c858323587d24e156d8b7ac (diff) |
rewrite indexedDb errors to work around firefox issues
-rw-r--r-- | ext/bg/js/settings.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/bg/js/settings.js b/ext/bg/js/settings.js index 161e9abe..6a864dfb 100644 --- a/ext/bg/js/settings.js +++ b/ext/bg/js/settings.js @@ -179,6 +179,32 @@ $(document).ready(utilAsync(onReady)); function dictionaryErrorShow(error) { const dialog = $('#dict-error'); if (error) { + const overrides = [ + [ + 'A mutation operation was attempted on a database that did not allow mutations.', + 'Access to IndexedDB is restricted; please change history settings to "Remember history" to use this extension' + ], + [ + 'The operation failed for reasons unrelated to the database itself and not covered by any other error code.', + 'Unable to access IndexedDB; please use the "Refresh Firefox" feature to reset your user profile' + ], + [ + 'BulkError', + 'Unable to import dictionary data into IndexedDB; make sure you have sufficient disk space available' + ] + ]; + + if (error.toString) { + error = error.toString(); + } + + for (const [match, subst] of overrides) { + if (error.includes(match)) { + error = subst; + break; + } + } + dialog.show().text(error); } else { dialog.hide(); |