From a362e195f9eb0a45eb2d73850801f60c8ae4cc47 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 31 May 2017 09:42:07 +0530 Subject: [PATCH] Fix unhandled error when no IndexedDB is present at all --- src/pyj/read_book/db.pyj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pyj/read_book/db.pyj b/src/pyj/read_book/db.pyj index bb12b30d2a..d8c649056f 100644 --- a/src/pyj/read_book/db.pyj +++ b/src/pyj/read_book/db.pyj @@ -65,9 +65,12 @@ class DB: def initialize_stage1(self): 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.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 request = window.indexedDB.open(DB_NAME, DB_VERSION)