From 6ff251b24a1fcd19d557056cf5dca7f20a8e3188 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Mon, 6 Nov 2017 14:09:15 -0800 Subject: [PATCH] fixes #319 - unsupported redirect --- app/main.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/main.js b/app/main.js index 8888718f..7e47e13a 100644 --- a/app/main.js +++ b/app/main.js @@ -21,20 +21,23 @@ app.use((state, emitter) => { state.storage = storage; state.raven = Raven; emitter.on('DOMContentLoaded', async () => { + let reason = null; if ( /firefox/i.test(navigator.userAgent) && parseInt(navigator.userAgent.match(/firefox\/*([^\n\r]*)\./i)[1], 10) <= 49 ) { - return emitter.emit('replaceState', '/unsupported/outdated'); + reason = 'outdated'; } if (/edge\/\d+/i.test(navigator.userAgent)) { - return emitter.emit('replaceState', '/unsupported/edge'); + reason = 'edge'; } const ok = await canHasSend(assets.get('cryptofill.js')); if (!ok) { - const reason = /firefox/i.test(navigator.userAgent) ? 'outdated' : 'gcm'; - emitter.emit('replaceState', `/unsupported/${reason}`); + reason = /firefox/i.test(navigator.userAgent) ? 'outdated' : 'gcm'; + } + if (reason) { + setTimeout(() => emitter.emit('replaceState', `/unsupported/${reason}`)); } }); });