disable streaming download if registering sw fails. fixes #1226

This commit is contained in:
Danny Coates 2019-03-12 20:53:54 -07:00
parent 9da70931e4
commit f78e025d33
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB

View file

@ -35,8 +35,13 @@ if (process.env.NODE_ENV === 'production') {
return window.location.assign('/unsupported/crypto'); return window.location.assign('/unsupported/crypto');
} }
if (capabilities.serviceWorker) { if (capabilities.serviceWorker) {
await navigator.serviceWorker.register('/serviceWorker.js'); try {
await navigator.serviceWorker.ready; await navigator.serviceWorker.register('/serviceWorker.js');
await navigator.serviceWorker.ready;
} catch (e) {
// continue but disable streaming downloads
capabilities.streamDownload = false;
}
} }
const translate = await getTranslator(LOCALE); const translate = await getTranslator(LOCALE);