From 578ec0b6d176f72d578e240b2c6712e588e8ed2a Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 22 Sep 2017 20:38:23 -0700 Subject: rewrite indexedDb errors to work around firefox issues --- ext/bg/js/settings.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'ext/bg/js') 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(); -- cgit v1.2.3