From 8a5007a396cff02b15fb85c3ed910e14cf71d59c Mon Sep 17 00:00:00 2001 From: kumavis Date: Mon, 12 Sep 2016 21:30:04 -0700 Subject: [PATCH] ui - remove unused currentDomain prop --- app/scripts/popup.js | 19 ++----------------- ui/app/accounts/index.js | 1 - ui/app/reducers/app.js | 1 - ui/app/reducers/metamask.js | 1 - ui/index.js | 4 +--- 5 files changed, 3 insertions(+), 23 deletions(-) diff --git a/app/scripts/popup.js b/app/scripts/popup.js index 096b56115..c7145bdd8 100644 --- a/app/scripts/popup.js +++ b/app/scripts/popup.js @@ -1,4 +1,3 @@ -const url = require('url') const EventEmitter = require('events').EventEmitter const async = require('async') const Dnode = require('dnode') @@ -18,7 +17,6 @@ var css = MetaMaskUiCss() injectCss(css) async.parallel({ - currentDomain: getCurrentDomain, accountManager: connectToAccountManager, }, setupApp) @@ -46,6 +44,8 @@ function setupWeb3Connection (stream) { } function setupControllerConnection (stream, cb) { + // this is a really sneaky way of adding EventEmitter api + // to a bi-directional dnode instance var eventEmitter = new EventEmitter() var background = Dnode({ sendUpdate: function (state) { @@ -60,20 +60,6 @@ function setupControllerConnection (stream, cb) { }) } -function getCurrentDomain (cb) { - const unknown = '' - if (!extension.tabs) return cb(null, unknown) - extension.tabs.query({active: true, currentWindow: true}, function (results) { - var activeTab = results[0] - var currentUrl = activeTab && activeTab.url - var currentDomain = url.parse(currentUrl).host - if (!currentUrl) { - return cb(null, unknown) - } - cb(null, currentDomain) - }) -} - function setupApp (err, opts) { if (err) { alert(err.stack) @@ -85,7 +71,6 @@ function setupApp (err, opts) { MetaMaskUi({ container: container, accountManager: opts.accountManager, - currentDomain: opts.currentDomain, networkVersion: opts.networkVersion, }) } diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js index c20900c1e..3af8267b5 100644 --- a/ui/app/accounts/index.js +++ b/ui/app/accounts/index.js @@ -20,7 +20,6 @@ function mapStateToProps (state) { identities: state.metamask.identities, unconfTxs: state.metamask.unconfTxs, selectedAddress: state.metamask.selectedAddress, - currentDomain: state.appState.currentDomain, scrollToBottom: state.appState.scrollToBottom, pending, } diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index a6cd9ca1b..c39d89a4d 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -39,7 +39,6 @@ function reduceApp (state, action) { accountDetail: { subview: 'transactions', }, - currentDomain: 'example.com', transForward: true, // Used to render transition direction isLoading: false, // Used to display loading indicator warning: null, // Used to display error text diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js index 7f18480cb..84953d734 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -11,7 +11,6 @@ function reduceMetamask (state, action) { isInitialized: false, isUnlocked: false, isEthConfirmed: false, - currentDomain: 'example.com', rpcTarget: 'https://rawtestrpc.metamask.io/', identities: {}, unconfTxs: {}, diff --git a/ui/index.js b/ui/index.js index 0e69b00d6..a6905b639 100644 --- a/ui/index.js +++ b/ui/index.js @@ -25,9 +25,7 @@ function startApp (metamaskState, accountManager, opts) { metamask: metamaskState, // appState represents the current tab's popup state - appState: { - currentDomain: opts.currentDomain, - }, + appState: {}, // Which blockchain we are using: networkVersion: opts.networkVersion,