mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 21:53:29 +02:00
Fix autoreload failure when appcache is not available
This commit is contained in:
parent
b23b1adcf1
commit
3274ecfa83
1 changed files with 4 additions and 3 deletions
|
|
@ -53,8 +53,9 @@ def reconnect(self):
|
|||
|
||||
def reload_app(self):
|
||||
appcache = window.top.applicationCache
|
||||
for which in 'cached error noupdate obsolete updateready'.split(' '):
|
||||
appcache.addEventListener(which, self.cache_update_done, False)
|
||||
if appcache:
|
||||
for which in 'cached error noupdate obsolete updateready'.split(' '):
|
||||
appcache.addEventListener(which, self.cache_update_done, False)
|
||||
try:
|
||||
appcache.update()
|
||||
except: # In chrome with devtools open, appcache is sometimes disabled/fails
|
||||
|
|
@ -62,7 +63,7 @@ def reload_app(self):
|
|||
|
||||
def cache_update_done(self):
|
||||
appcache = window.top.applicationCache
|
||||
if appcache.status is appcache.UPDATEREADY:
|
||||
if appcache and appcache.status is appcache.UPDATEREADY:
|
||||
appcache.swapCache()
|
||||
window.location.reload(True)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue