Fix autoreload failure when appcache is not available

This commit is contained in:
Kovid Goyal 2019-10-01 10:07:21 +05:30
parent b23b1adcf1
commit 3274ecfa83
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -53,6 +53,7 @@ class Watcher:
def reload_app(self):
appcache = window.top.applicationCache
if appcache:
for which in 'cached error noupdate obsolete updateready'.split(' '):
appcache.addEventListener(which, self.cache_update_done, False)
try:
@ -62,7 +63,7 @@ class Watcher:
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)