From 6b291ae01207e0b72b41fb4fb80ffeca00dbbcb0 Mon Sep 17 00:00:00 2001 From: Erica Wright Date: Thu, 27 Jul 2017 11:13:59 -0400 Subject: [PATCH] show error page on firefox v49 and below --- frontend/src/common.js | 16 ++++++++++++++++ frontend/src/download.js | 10 +--------- frontend/src/upload.js | 10 ---------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/frontend/src/common.js b/frontend/src/common.js index 5fa712a3..e2790798 100644 --- a/frontend/src/common.js +++ b/frontend/src/common.js @@ -3,8 +3,24 @@ window.Raven.config(window.dsn).install(); window.dsn = undefined; const testPilotGA = require('testpilot-ga'); +const {gcmCompliant, sendEvent} = require('./utils'); window.analytics = new testPilotGA({ an: 'Firefox Send', ds: 'web', tid: window.trackerId }); + +gcmCompliant().catch(err => { + $('#page-one').attr('hidden', true); + $('#download').attr('hidden', true); + sendEvent('sender', 'unsupported', { + cd6: err + }).then(() => { + location.replace('/unsupported'); + }); +}); + +if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && + parseInt(navigator.userAgent.toLowerCase().match(/firefox\/*([^\n\r]*)\./)[1]) <= 49) { + location.replace('/unsupported'); +} diff --git a/frontend/src/download.js b/frontend/src/download.js index 0a90f3dc..224d3731 100644 --- a/frontend/src/download.js +++ b/frontend/src/download.js @@ -1,6 +1,6 @@ require('./common'); const FileReceiver = require('./fileReceiver'); -const { notify, findMetric, gcmCompliant, sendEvent } = require('./utils'); +const { notify, findMetric, sendEvent } = require('./utils'); const bytes = require('bytes'); const Storage = require('./storage'); const storage = new Storage(localStorage); @@ -11,14 +11,6 @@ require('jquery-circle-progress'); const Raven = window.Raven; $(document).ready(function() { - gcmCompliant().catch(err => { - $('#download').attr('hidden', true); - sendEvent('recipient', 'unsupported', { - cd6: err - }).then(() => { - location.replace('/unsupported'); - }); - }); //link back to homepage $('.send-new').attr('href', window.location.origin); diff --git a/frontend/src/upload.js b/frontend/src/upload.js index ab8a0c13..bb1c3f55 100644 --- a/frontend/src/upload.js +++ b/frontend/src/upload.js @@ -3,7 +3,6 @@ require('./common'); const FileSender = require('./fileSender'); const { notify, - gcmCompliant, findMetric, sendEvent, ONE_DAY_IN_MS @@ -25,15 +24,6 @@ if (storage.has('referrer')) { } $(document).ready(function() { - gcmCompliant().catch(err => { - $('#page-one').attr('hidden', true); - sendEvent('sender', 'unsupported', { - cd6: err - }).then(() => { - location.replace('/unsupported'); - }); - }); - $('#file-upload').change(onUpload); $('.legal-links a, .social-links a, #dl-firefox').click(function(target) {