From d703d0ec56d6a779b8c3bab84d61086868e2a4a3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 2 Sep 2018 08:53:51 +0530 Subject: [PATCH] Disable offline access if application cache is not available, rather than failing. Apparently the next version of Firefox will disable app cache on HTTP sites. See https://bugs.launchpad.net/calibre/+bug/1737642 --- src/pyj/srv.pyj | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pyj/srv.pyj b/src/pyj/srv.pyj index 7d1954e445..31fcb5373d 100644 --- a/src/pyj/srv.pyj +++ b/src/pyj/srv.pyj @@ -46,9 +46,12 @@ else: print('WARNING: failed to swap applicationCache') console.log(e) - window.applicationCache.addEventListener('updateready', on_appcache_ready) - if window.applicationCache.status is window.applicationCache.UPDATEREADY: - on_appcache_ready() + if window.applicationCache: + window.applicationCache.addEventListener('updateready', on_appcache_ready) + if window.applicationCache.status is window.applicationCache.UPDATEREADY: + on_appcache_ready() + else: + console.warn("Your browser does not have a working Application Cache, offline access will not work") script = document.currentScript or document.scripts[0] main_js(script.textContent) script.parentNode.removeChild(script) # save some memory