1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Merge pull request #164 from MetaMask/i126

inpage - add and remove 'define' from global context
This commit is contained in:
kumavis 2016-04-29 15:43:39 -07:00
commit 3a3444aad1
2 changed files with 16 additions and 0 deletions

View File

@ -8,6 +8,7 @@
- Selected account is now persisted between sessions, so the current account stays selected. - Selected account is now persisted between sessions, so the current account stays selected.
- Account icons are now "identicons" (deterministically generated from the address). - Account icons are now "identicons" (deterministically generated from the address).
- Fixed link to Slack channel. - Fixed link to Slack channel.
- Added a context guard for "define" to avoid UMD's exporting themselves to the wrong module system
# 1.6.0 2016-04-22 # 1.6.0 2016-04-22

View File

@ -1,9 +1,11 @@
cleanContextForImports()
const createPayload = require('web3-provider-engine/util/create-payload') const createPayload = require('web3-provider-engine/util/create-payload')
const StreamProvider = require('./lib/stream-provider.js') const StreamProvider = require('./lib/stream-provider.js')
const LocalMessageDuplexStream = require('./lib/local-message-stream.js') const LocalMessageDuplexStream = require('./lib/local-message-stream.js')
const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
const RemoteStore = require('./lib/remote-store.js').RemoteStore const RemoteStore = require('./lib/remote-store.js').RemoteStore
const Web3 = require('web3') const Web3 = require('web3')
restoreContextAfterImports()
// rename on window // rename on window
delete window.Web3 delete window.Web3
@ -102,3 +104,16 @@ remoteProvider.send = function(payload){
} }
} }
// need to make sure we aren't affected by overlapping namespaces
// and that we dont affect the app with our namespace
// mostly a fix for web3's BigNumber if AMD's "define" is defined...
var __define = undefined
function cleanContextForImports(){
__define = global.define
delete global.define
}
function restoreContextAfterImports(){
global.define = __define
}