Fix unhandled error when no IndexedDB is present at all

This commit is contained in:
Kovid Goyal 2017-05-31 09:42:07 +05:30
parent f732d03d75
commit a362e195f9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -65,9 +65,12 @@ class DB:
def initialize_stage1(self): def initialize_stage1(self):
if not window.indexedDB: if not window.indexedDB:
self.initialize_error_msg = _('Your browser does not support IndexedDB. Cannot read books. Consider using a modern browser, such as Firefox, Chrome or Edge.') self.initialize_error_msg = _('Your browser does not support IndexedDB. Cannot read books. Consider using a modern browser, such as Chrome or Firefox.')
self.initialized = True self.initialized = True
self.callback() # Callers assume __init__ has finished before the callback is
# called, since we are called in __init__, only callback after
# event loop ticks over
window.setTimeout(self.callback, 0)
return return
request = window.indexedDB.open(DB_NAME, DB_VERSION) request = window.indexedDB.open(DB_NAME, DB_VERSION)