From 66cab1606a78a75b5d1b974d7819182c4c1cf147 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 11 Sep 2019 18:32:50 -0300 Subject: [PATCH] Add polyfill for AbortController The AbortController is used in both the background and the UI. Support for AbortController was added to Chrome in version 66, which is above our minimum supported version. I did consider increasing the minimum Chrome version to 66, but we have a decent number of users still on Chrome 65 unfortunately. --- app/scripts/background.js | 3 +++ app/scripts/ui.js | 3 +++ package.json | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index db2d9e8bb230..37ccba44e9cf 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -5,6 +5,9 @@ // this needs to run before anything else require('./lib/setupFetchDebugging')() +// polyfills +import 'abortcontroller-polyfill/dist/polyfill-patch-fetch' + const urlUtil = require('url') const endOfStream = require('end-of-stream') const pump = require('pump') diff --git a/app/scripts/ui.js b/app/scripts/ui.js index a99da37a0b13..0fe92d47c93c 100644 --- a/app/scripts/ui.js +++ b/app/scripts/ui.js @@ -1,3 +1,6 @@ +// polyfills +import 'abortcontroller-polyfill/dist/polyfill-patch-fetch' + const PortStream = require('extension-port-stream') const { getEnvironmentType } = require('./lib/util') const { ENVIRONMENT_TYPE_NOTIFICATION, ENVIRONMENT_TYPE_FULLSCREEN, ENVIRONMENT_TYPE_POPUP } = require('./lib/enums') diff --git a/package.json b/package.json index 9b4737ef5d92..d3ae9061863b 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@sentry/browser": "^4.1.1", "@zxing/library": "^0.8.0", "abi-decoder": "^1.2.0", + "abortcontroller-polyfill": "^1.3.0", "asmcrypto.js": "^2.3.2", "await-semaphore": "^0.1.1", "bignumber.js": "^4.1.0", @@ -180,7 +181,6 @@ "@storybook/addon-info": "^5.1.1", "@storybook/addon-knobs": "^3.4.2", "@storybook/react": "^5.1.1", - "abortcontroller-polyfill": "^1.3.0", "addons-linter": "^1.10.0", "babel-eslint": "^10.0.2", "babelify": "^10.0.0",