1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

Make injected web3 fail hard on sync methods (#471)

Make injected web3 fail hard on sync methods
This commit is contained in:
Dan Finlay 2016-07-20 14:54:07 -07:00 committed by GitHub
parent 5567ea8dc5
commit cdd7e40545
2 changed files with 11 additions and 1 deletions

View File

@ -2,6 +2,8 @@
## Current Master ## Current Master
- MetaMask now throws descriptive errors when apps try to use synchronous web3 methods.
## 2.6.2 2016-07-20 ## 2.6.2 2016-07-20
- Fixed bug that would prevent the plugin from reopening on the first try after receiving a new transaction while locked. - Fixed bug that would prevent the plugin from reopening on the first try after receiving a new transaction while locked.

View File

@ -107,7 +107,15 @@ function createSyncProvider (providerConfig) {
syncProviderUrl = MetamaskConfig.network.default syncProviderUrl = MetamaskConfig.network.default
} }
} }
return new HttpProvider(syncProviderUrl)
const provider = new HttpProvider(syncProviderUrl)
// Stubbing out the send method to throw on sync methods:
provider.send = function() {
var message = 'The MetaMask Web3 object does not support synchronous methods. See https://github.com/MetaMask/faq#all-async---think-of-metamask-as-a-light-client for details.'
throw new Error(message)
}
return provider
} }
function remoteStoreWithLocalStorageCache (storageKey) { function remoteStoreWithLocalStorageCache (storageKey) {