aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2016-02-16 03:03:50 +0800
committerkumavis <aaron@kumavis.me>2016-02-16 03:03:50 +0800
commitdbd3b8f76f3a84a04c7dfd1db174345a875b1db9 (patch)
treed260e667c9e9641f3ac2213cfcad295e19aefaef
parent519d4b11922f24ed65e7115f0ddc644414adf4ac (diff)
downloadtangerine-wallet-browser-dbd3b8f76f3a84a04c7dfd1db174345a875b1db9.tar
tangerine-wallet-browser-dbd3b8f76f3a84a04c7dfd1db174345a875b1db9.tar.gz
tangerine-wallet-browser-dbd3b8f76f3a84a04c7dfd1db174345a875b1db9.tar.bz2
tangerine-wallet-browser-dbd3b8f76f3a84a04c7dfd1db174345a875b1db9.tar.lz
tangerine-wallet-browser-dbd3b8f76f3a84a04c7dfd1db174345a875b1db9.tar.xz
tangerine-wallet-browser-dbd3b8f76f3a84a04c7dfd1db174345a875b1db9.tar.zst
tangerine-wallet-browser-dbd3b8f76f3a84a04c7dfd1db174345a875b1db9.zip
disable localhost interception
-rw-r--r--app/scripts/inpage.js126
1 files changed, 63 insertions, 63 deletions
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js
index b574cd488..4b42c2570 100644
--- a/app/scripts/inpage.js
+++ b/app/scripts/inpage.js
@@ -1,6 +1,6 @@
const XHR = window.XMLHttpRequest
-const fauxJax = require('faux-jax')
-fauxJax.install()
+// const fauxJax = require('faux-jax')
+// fauxJax.install()
const Web3 = require('web3')
const createPayload = require('web3-provider-engine/util/create-payload')
const StreamProvider = require('./lib/stream-provider.js')
@@ -96,64 +96,64 @@ console.log('MetaMask - injected web3')
//
-console.log('MetaMask - intercepting localhost:8545 requests')
-
-fauxJax.on('request', function(req){
- // check if local node request
- if (req.requestURL.indexOf('localhost:8545') !== -1) {
- var rpcReq = JSON.parse(req.requestBody)
- if (req.async) {
- remoteProvider.sendAsync(rpcReq, function(err, result){
- // console.log('intercepted request (async):', rpcReq, result)
- handleResult(result)
- })
- } else {
- var result = remoteProvider.send(rpcReq)
- // console.log('intercepted request (sync):', rpcReq, result)
- handleResult(result)
- }
- } else {
- // console.log('request continuing normally:', req.requestURL)
- continueRequestNormally(req)
- }
-
- function handleResult(result){
- var serializedResult = JSON.stringify(result)
- req.respond(200, {
- 'content-type': 'application/json',
- }, serializedResult)
- }
-})
-
-function continueRequestNormally(req){
- var xhr = new XHR()
- // set target url and method
- xhr.open(req.requestMethod, req.requestURL, req.async)
- // set headers
- Object.keys(req.requestHeaders || {}).forEach(function(headerKey){
- xhr.setRequestHeader(headerKey, req.requestHeaders[headerKey])
- })
- // send and call completion handler
- if (req.async) {
- xhr.onload = copyResult
- xhr.send(req.requestBody)
- } else {
- xhr.send(req.requestBody)
- copyResult()
- }
-
- function copyResult() {
- var headers = extractResponseHeaders(xhr.getAllResponseHeaders())
- req.respond(xhr.status, headers, xhr.response)
- }
-}
-
-function extractResponseHeaders(rawHeaders){
- var headers = {}
- var headerKeyValues = rawHeaders.split('\r\n').filter(Boolean)
- headerKeyValues.forEach(function(keyValue){
- var data = keyValue.split(': ')
- headers[data[0]] = data[1]
- })
- return headers
-}
+// console.log('MetaMask - intercepting localhost:8545 requests')
+
+// fauxJax.on('request', function(req){
+// // check if local node request
+// if (req.requestURL.indexOf('localhost:8545') !== -1) {
+// var rpcReq = JSON.parse(req.requestBody)
+// if (req.async) {
+// remoteProvider.sendAsync(rpcReq, function(err, result){
+// // console.log('intercepted request (async):', rpcReq, result)
+// handleResult(result)
+// })
+// } else {
+// var result = remoteProvider.send(rpcReq)
+// // console.log('intercepted request (sync):', rpcReq, result)
+// handleResult(result)
+// }
+// } else {
+// // console.log('request continuing normally:', req.requestURL)
+// continueRequestNormally(req)
+// }
+
+// function handleResult(result){
+// var serializedResult = JSON.stringify(result)
+// req.respond(200, {
+// 'content-type': 'application/json',
+// }, serializedResult)
+// }
+// })
+
+// function continueRequestNormally(req){
+// var xhr = new XHR()
+// // set target url and method
+// xhr.open(req.requestMethod, req.requestURL, req.async)
+// // set headers
+// Object.keys(req.requestHeaders || {}).forEach(function(headerKey){
+// xhr.setRequestHeader(headerKey, req.requestHeaders[headerKey])
+// })
+// // send and call completion handler
+// if (req.async) {
+// xhr.onload = copyResult
+// xhr.send(req.requestBody)
+// } else {
+// xhr.send(req.requestBody)
+// copyResult()
+// }
+
+// function copyResult() {
+// var headers = extractResponseHeaders(xhr.getAllResponseHeaders())
+// req.respond(xhr.status, headers, xhr.response)
+// }
+// }
+
+// function extractResponseHeaders(rawHeaders){
+// var headers = {}
+// var headerKeyValues = rawHeaders.split('\r\n').filter(Boolean)
+// headerKeyValues.forEach(function(keyValue){
+// var data = keyValue.split(': ')
+// headers[data[0]] = data[1]
+// })
+// return headers
+// }