Adds a default value to the shell version cache response in case it returns undefined (#9250)

This commit is contained in:
Fernando Valverde 2020-07-14 04:09:19 -06:00 committed by GitHub
parent b4bfcd3ebc
commit 0dc2a6860e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -159,7 +159,9 @@
}
fetch('/async_info/shell_version').then(response => response.json()).then(json => {
caches.match('/async_info/shell_version').then(cachedResponse => cachedResponse.json()).then(cacheJson => {
caches.match('/async_info/shell_version')
.then(cachedResponse => (cachedResponse === undefined) ? {} : cachedResponse.json())
.then(cacheJson => {
if (cacheJson['version'] != json['version']) {
caches.open(staticCacheName)
.then(cache => cache.addAll([