mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix autoreload failure when appcache is not available
This commit is contained in:
parent
b23b1adcf1
commit
3274ecfa83
@ -53,8 +53,9 @@ class Watcher:
|
|||||||
|
|
||||||
def reload_app(self):
|
def reload_app(self):
|
||||||
appcache = window.top.applicationCache
|
appcache = window.top.applicationCache
|
||||||
for which in 'cached error noupdate obsolete updateready'.split(' '):
|
if appcache:
|
||||||
appcache.addEventListener(which, self.cache_update_done, False)
|
for which in 'cached error noupdate obsolete updateready'.split(' '):
|
||||||
|
appcache.addEventListener(which, self.cache_update_done, False)
|
||||||
try:
|
try:
|
||||||
appcache.update()
|
appcache.update()
|
||||||
except: # In chrome with devtools open, appcache is sometimes disabled/fails
|
except: # In chrome with devtools open, appcache is sometimes disabled/fails
|
||||||
@ -62,7 +63,7 @@ class Watcher:
|
|||||||
|
|
||||||
def cache_update_done(self):
|
def cache_update_done(self):
|
||||||
appcache = window.top.applicationCache
|
appcache = window.top.applicationCache
|
||||||
if appcache.status is appcache.UPDATEREADY:
|
if appcache and appcache.status is appcache.UPDATEREADY:
|
||||||
appcache.swapCache()
|
appcache.swapCache()
|
||||||
window.location.reload(True)
|
window.location.reload(True)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user