From c3b7029667fa63b3777ed6403075ef14e7dc19c4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 16 Feb 2023 11:01:24 +0530 Subject: [PATCH] Content server: Workaround for Safari regression causing bookmarks to disappear on reload. Fixes #2006726 [calibre web view - missing bookmarks](https://bugs.launchpad.net/calibre/+bug/2006726) --- src/pyj/read_book/db.pyj | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pyj/read_book/db.pyj b/src/pyj/read_book/db.pyj index 0965112f6c..5512f46e26 100644 --- a/src/pyj/read_book/db.pyj +++ b/src/pyj/read_book/db.pyj @@ -172,11 +172,13 @@ class DB: transaction = self.idb.transaction(stores) req = transaction.objectStore(store).get(data) req.onsuccess = def(event): - proceed(req.result) + if proceed: + proceed(req.result) elif op is 'put': transaction = self.idb.transaction(stores, 'readwrite') req = transaction.objectStore(store).put(data) - req.onsuccess = proceed + if proceed: + req.onsuccess = proceed req.onerror = def(event): self.display_error(error_msg, event) @@ -327,7 +329,7 @@ class DB: changed = True book.annotations_map[unkey] = merged if changed: - self.do_op(['books'], book, _('Failed to write to the books database'), op='put') + self.do_op(['books'], book, _('Failed to write to the books database'), def(): None;, op='put') ) def get_file(self, book, name, proceed):