diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-08-08 02:31:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-08 02:31:42 +0800 |
commit | 0601df9dae488d997277bb6b52c28df27546e27c (patch) | |
tree | ae33a0c4610b9a9e865c797258232542a72f57b6 /app/scripts/background.js | |
parent | 4598554fea7b9435e5cbecc4735c479ffbadf37e (diff) | |
parent | f6490a2a6eda943a374c01df5884acb07ba28869 (diff) | |
download | tangerine-wallet-browser-0601df9dae488d997277bb6b52c28df27546e27c.tar tangerine-wallet-browser-0601df9dae488d997277bb6b52c28df27546e27c.tar.gz tangerine-wallet-browser-0601df9dae488d997277bb6b52c28df27546e27c.tar.bz2 tangerine-wallet-browser-0601df9dae488d997277bb6b52c28df27546e27c.tar.lz tangerine-wallet-browser-0601df9dae488d997277bb6b52c28df27546e27c.tar.xz tangerine-wallet-browser-0601df9dae488d997277bb6b52c28df27546e27c.tar.zst tangerine-wallet-browser-0601df9dae488d997277bb6b52c28df27546e27c.zip |
Merge pull request #4954 from MetaMask/v4.9.0
V4.9.0
Diffstat (limited to 'app/scripts/background.js')
-rw-r--r-- | app/scripts/background.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js index 2451cddb6..7eb7b1255 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -26,6 +26,8 @@ const setupMetamaskMeshMetrics = require('./lib/setupMetamaskMeshMetrics') const EdgeEncryptor = require('./edge-encryptor') const getFirstPreferredLangCode = require('./lib/get-first-preferred-lang-code') const getObjStructure = require('./lib/getObjStructure') +const ipfsContent = require('./lib/ipfsContent.js') + const { ENVIRONMENT_TYPE_POPUP, ENVIRONMENT_TYPE_NOTIFICATION, @@ -42,8 +44,8 @@ const notificationManager = new NotificationManager() global.METAMASK_NOTIFIER = notificationManager // setup sentry error reporting -const release = platform.getVersion() -const raven = setupRaven({ release }) +const releaseVersion = platform.getVersion() +const raven = setupRaven({ releaseVersion }) // browser check if it is Edge - https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser // Internet Explorer 6-11 @@ -51,6 +53,7 @@ const isIE = !!document.documentMode // Edge 20+ const isEdge = !isIE && !!window.StyleMedia +let ipfsHandle let popupIsOpen = false let notificationIsOpen = false const openMetamaskTabsIDs = {} @@ -66,6 +69,7 @@ initialize().catch(log.error) // setup metamask mesh testing container setupMetamaskMeshMetrics() + /** * An object representing a transaction, in whatever state it is in. * @typedef TransactionMeta @@ -155,6 +159,7 @@ async function initialize () { const initLangCode = await getFirstPreferredLangCode() await setupController(initState, initLangCode) log.debug('MetaMask initialization complete.') + ipfsHandle = ipfsContent(initState.NetworkController.provider) } // @@ -258,6 +263,11 @@ function setupController (initState, initLangCode) { }) global.metamaskController = controller + controller.networkController.on('networkDidChange', () => { + ipfsHandle && ipfsHandle.remove() + ipfsHandle = ipfsContent(controller.networkController.providerStore.getState()) + }) + // report failed transactions to Sentry controller.txController.on(`tx:status-update`, (txId, status) => { if (status !== 'failed') return @@ -378,7 +388,7 @@ function setupController (initState, initLangCode) { } // communication with page or other extension - function connectExternal(remotePort) { + function connectExternal (remotePort) { const originDomain = urlUtil.parse(remotePort.sender.url).hostname const portStream = new PortStream(remotePort) controller.setupUntrustedCommunication(portStream, originDomain) |