aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-04-30 06:43:39 +0800
committerkumavis <kumavis@users.noreply.github.com>2016-04-30 06:43:39 +0800
commit3a3444aad1493db512cfba7f8ba230b7eb12f14a (patch)
treeb899fb557b8ae0b61cfa477a805e255d111fa424
parent4fee97a6b01a47fa2879612b0638bfa952ebbd77 (diff)
parent62e4cc8e67d369d2d3fd4930201cd88db7a9b540 (diff)
downloadtangerine-wallet-browser-3a3444aad1493db512cfba7f8ba230b7eb12f14a.tar
tangerine-wallet-browser-3a3444aad1493db512cfba7f8ba230b7eb12f14a.tar.gz
tangerine-wallet-browser-3a3444aad1493db512cfba7f8ba230b7eb12f14a.tar.bz2
tangerine-wallet-browser-3a3444aad1493db512cfba7f8ba230b7eb12f14a.tar.lz
tangerine-wallet-browser-3a3444aad1493db512cfba7f8ba230b7eb12f14a.tar.xz
tangerine-wallet-browser-3a3444aad1493db512cfba7f8ba230b7eb12f14a.tar.zst
tangerine-wallet-browser-3a3444aad1493db512cfba7f8ba230b7eb12f14a.zip
Merge pull request #164 from MetaMask/i126
inpage - add and remove 'define' from global context
-rw-r--r--CHANGELOG.md1
-rw-r--r--app/scripts/inpage.js15
2 files changed, 16 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ba591dfa1..a2e9e1afa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
- Selected account is now persisted between sessions, so the current account stays selected.
- Account icons are now "identicons" (deterministically generated from the address).
- 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
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