aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2016-04-30 06:38:24 +0800
committerkumavis <aaron@kumavis.me>2016-04-30 06:38:24 +0800
commit9fcf07db6b2aa63f54d813cc194eb13d7f05c079 (patch)
treea0d50fac7cc48e0e3c257bd1f6167f4648414e32 /app
parent4fee97a6b01a47fa2879612b0638bfa952ebbd77 (diff)
downloadtangerine-wallet-browser-9fcf07db6b2aa63f54d813cc194eb13d7f05c079.tar.gz
tangerine-wallet-browser-9fcf07db6b2aa63f54d813cc194eb13d7f05c079.tar.zst
tangerine-wallet-browser-9fcf07db6b2aa63f54d813cc194eb13d7f05c079.zip
inpage - add and remove 'define' from global context. updates #126
Diffstat (limited to 'app')
-rw-r--r--app/scripts/inpage.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js
index e6684cbd4..54470220f 100644
--- a/app/scripts/inpage.js
+++ b/app/scripts/inpage.js
@@ -1,9 +1,11 @@
+cleanContextForImports()
const createPayload = require('web3-provider-engine/util/create-payload')
const StreamProvider = require('./lib/stream-provider.js')
const LocalMessageDuplexStream = require('./lib/local-message-stream.js')
const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
const RemoteStore = require('./lib/remote-store.js').RemoteStore
const Web3 = require('web3')
+restoreContextAfterImports()
// rename on window
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
+} \ No newline at end of file