From 5455b8e3fd288dea6aa85091032de7ac68860dc5 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Thu, 31 Oct 2019 21:56:02 -0230 Subject: [PATCH 1/4] Add web3 deprecation warning (#7334) * Add web3 deprecation warning * Update web3 deprecation article URL --- app/scripts/inpage.js | 21 --------------------- app/scripts/lib/auto-reload.js | 6 ++++++ 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index 31e6a1f49..ec88243a4 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -174,27 +174,6 @@ log.debug('MetaMask - injected web3') setupDappAutoReload(web3, inpageProvider.publicConfigStore) -// export global web3, with usage-detection and deprecation warning - -/* TODO: Uncomment this area once auto-reload.js has been deprecated: -let hasBeenWarned = false -global.web3 = new Proxy(web3, { - get: (_web3, key) => { - // show warning once on web3 access - if (!hasBeenWarned && key !== 'currentProvider') { - console.warn('MetaMask: web3 will be deprecated in the near future in favor of the ethereumProvider \nhttps://github.com/MetaMask/faq/blob/master/detecting_metamask.md#web3-deprecation') - hasBeenWarned = true - } - // return value normally - return _web3[key] - }, - set: (_web3, key, value) => { - // set value normally - _web3[key] = value - }, -}) -*/ - // set web3 defaultAccount inpageProvider.publicConfigStore.subscribe(function (state) { web3.eth.defaultAccount = state.selectedAddress diff --git a/app/scripts/lib/auto-reload.js b/app/scripts/lib/auto-reload.js index 44fbe847c..fd209c230 100644 --- a/app/scripts/lib/auto-reload.js +++ b/app/scripts/lib/auto-reload.js @@ -5,11 +5,17 @@ function setupDappAutoReload (web3, observable) { let reloadInProgress = false let lastTimeUsed let lastSeenNetwork + let hasBeenWarned = false global.web3 = new Proxy(web3, { get: (_web3, key) => { // get the time of use lastTimeUsed = Date.now() + // show warning once on web3 access + if (!hasBeenWarned && key !== 'currentProvider') { + console.warn('MetaMask: web3 will be deprecated in the near future in favor of the ethereumProvider\nhttps://medium.com/metamask/4a899ad6e59e') + hasBeenWarned = true + } // return value normally return _web3[key] }, From dcd3b059dfb0e75a7cdf145c06ab6232bc3cecf9 Mon Sep 17 00:00:00 2001 From: MetaMask Bot Date: Tue, 29 Oct 2019 16:13:53 +0000 Subject: [PATCH 2/4] Version v7.4.0 --- CHANGELOG.md | 2 ++ app/manifest.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb39fa58e..d8a8abf3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Current Develop Branch +## 7.4.0 Tue Oct 29 2019 + ## 7.3.1 Mon Oct 21 2019 - [#7298](https://github.com/MetaMask/metamask-extension/pull/7298): Turn off full screen vs popup a/b test diff --git a/app/manifest.json b/app/manifest.json index f23d72f32..47b78819f 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_appName__", "short_name": "__MSG_appName__", - "version": "7.3.1", + "version": "7.4.0", "manifest_version": 2, "author": "https://metamask.io", "description": "__MSG_appDescription__", From 0138b0f9bde1256e7d79fae50bdd529b6d22333f Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 30 Oct 2019 15:34:23 -0300 Subject: [PATCH 3/4] Update Changelog for v7.4.0 --- CHANGELOG.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8a8abf3e..c170c106e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,20 @@ ## Current Develop Branch ## 7.4.0 Tue Oct 29 2019 +- [#7186](https://github.com/MetaMask/metamask-extension/pull/7186): Use `AdvancedGasInputs` in `AdvancedTabContent` +- [#7304](https://github.com/MetaMask/metamask-extension/pull/7304): Move signTypedData signing out to keyrings +- [#7306](https://github.com/MetaMask/metamask-extension/pull/7306): correct the zh-TW translation +- [#7309](https://github.com/MetaMask/metamask-extension/pull/7309): Freeze Promise global on boot +- [#7296](https://github.com/MetaMask/metamask-extension/pull/7296): Add "Retry" option for failed transactions +- [#7319](https://github.com/MetaMask/metamask-extension/pull/7319): Fix transaction list item status spacing issue +- [#7218](https://github.com/MetaMask/metamask-extension/pull/7218): Add hostname and extensionId to site metadata +- [#7324](https://github.com/MetaMask/metamask-extension/pull/7324): Fix contact deletion +- [#7326](https://github.com/MetaMask/metamask-extension/pull/7326): Fix edit contact details +- [#7325](https://github.com/MetaMask/metamask-extension/pull/7325): Update eth-json-rpc-filters to fix memory leak +- [#7334](https://github.com/MetaMask/metamask-extension/pull/7334): Add web3 deprecation warning ## 7.3.1 Mon Oct 21 2019 -- [#7298](https://github.com/MetaMask/metamask-extension/pull/7298): Turn off full screen vs popup a/b test +- [#7298](https://github.com/MetaMask/metamask-extension/pull/7298): Turn off full screen vs popup a/b test ## 7.3.0 Fri Sep 27 2019 - [#6972](https://github.com/MetaMask/metamask-extension/pull/6972): 3box integration From 05b007aa358c47f5d74560c0d1229fd4f9175e82 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Mon, 4 Nov 2019 17:28:50 -0400 Subject: [PATCH 4/4] Fix provider approval metadata (#7349) * Omit MetaMask `extensionId` from site metadata The site metadata was updated in #7218 to include the extension id of the extension connecting to MetaMask. This was done to allow external extensions to connect with MetaMask, so that we could show the id on the provider approval screen. Unbeknownst to me at the time, the extension id was being set for all connections to MetaMask from dapps. The id was set to MetaMask's id, because the connections are made through MetaMask's contentscript. This has been updated to only set the id when accepting a connection from a different extension. * Fix `siteMetadata` property names In #7218 a few things were added to the site metadata, so the provider approval controller was middleware was updated to accept the site metadata as an object rather than accepting each property as a separate parameter. Unfortunately we failed to notice that the site name and icon were named differently in the site metadata than they were in the provider approval controller, so the names of those properties were unintentionally changed in the controller state. The provider approval controller has been updated to restore the original property names of `siteTitle` and `siteIcon`. An unused prop that was added to the provider approval page in #7218 has also been removed. --- app/scripts/background.js | 5 ++++- app/scripts/controllers/provider-approval.js | 3 ++- .../provider-approval/provider-approval.component.js | 9 +++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index 7828c6d80..7c347d62e 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -391,7 +391,10 @@ function setupController (initState, initLangCode) { // communication with page or other extension function connectExternal (remotePort) { const senderUrl = new URL(remotePort.sender.url) - const extensionId = remotePort.sender.id + let extensionId + if (remotePort.sender.id !== extension.runtime.id) { + extensionId = remotePort.sender.id + } const portStream = new PortStream(remotePort) controller.setupUntrustedCommunication(portStream, senderUrl, extensionId) } diff --git a/app/scripts/controllers/provider-approval.js b/app/scripts/controllers/provider-approval.js index 3ece07e13..00ff626f7 100644 --- a/app/scripts/controllers/provider-approval.js +++ b/app/scripts/controllers/provider-approval.js @@ -47,7 +47,8 @@ class ProviderApprovalController extends SafeEventEmitter { if (extensionId) { metadata.extensionId = extensionId } else { - Object.assign(metadata, await getSiteMetadata(origin)) + const siteMetadata = await getSiteMetadata(origin) + Object.assign(metadata, { siteTitle: siteMetadata.name, siteImage: siteMetadata.icon}) } this._handleProviderRequest(metadata) // wait for resolution of request diff --git a/ui/app/pages/provider-approval/provider-approval.component.js b/ui/app/pages/provider-approval/provider-approval.component.js index da177defc..8532fe60d 100644 --- a/ui/app/pages/provider-approval/provider-approval.component.js +++ b/ui/app/pages/provider-approval/provider-approval.component.js @@ -6,7 +6,13 @@ export default class ProviderApproval extends Component { static propTypes = { approveProviderRequestByOrigin: PropTypes.func.isRequired, rejectProviderRequestByOrigin: PropTypes.func.isRequired, - providerRequest: PropTypes.object.isRequired, + providerRequest: PropTypes.exact({ + hostname: PropTypes.string.isRequired, + siteImage: PropTypes.string, + siteTitle: PropTypes.string, + origin: PropTypes.string.isRequired, + extensionId: PropTypes.string, + }).isRequired, }; static contextTypes = { @@ -20,7 +26,6 @@ export default class ProviderApproval extends Component { approveProviderRequestByOrigin={approveProviderRequestByOrigin} rejectProviderRequestByOrigin={rejectProviderRequestByOrigin} origin={providerRequest.origin} - tabID={providerRequest.tabID} siteImage={providerRequest.siteImage} siteTitle={providerRequest.siteTitle} hostname={providerRequest.hostname}