1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00
This commit is contained in:
brunobar79 2018-08-12 01:43:41 -04:00
parent 0b9b892c6b
commit 8f9a0a535c
4 changed files with 4 additions and 43 deletions

View File

@ -68,6 +68,8 @@ initialize().catch(log.error)
// setup metamask mesh testing container
setupMetamaskMeshMetrics()
/**
* An object representing a transaction, in whatever state it is in.
* @typedef TransactionMeta
@ -444,4 +446,3 @@ extension.runtime.onInstalled.addListener(function (details) {
extension.tabs.create({url: 'https://metamask.io/#how-it-works'})
}
})

View File

@ -200,4 +200,4 @@ function redirectToPhishingWarning () {
console.log('MetaMask - routing to Phishing Warning component')
const extensionURL = extension.runtime.getURL('phishing.html')
window.location.href = extensionURL
}
}

View File

@ -14,7 +14,7 @@ function createLoggerMiddleware (opts) {
log.error('Error in RPC response:\n', res)
}
if (req.isMetamaskInternal) return
//log.info(`RPC (${opts.origin}):`, req, '->', res)
log.info(`RPC (${opts.origin}):`, req, '->', res)
cb()
})
}

View File

@ -1,40 +0,0 @@
const extension = require('extensionizer')
module.exports = setupLedgerIframe
/**
* Injects an iframe into the current document to
* enable the interaction with ledger devices
*/
function setupLedgerIframe () {
const ORIGIN = 'http://localhost:9000'
const ledgerIframe = document.createElement('iframe')
ledgerIframe.src = ORIGIN
console.log('Injecting ledger iframe')
document.head.appendChild(ledgerIframe)
console.log('[LEDGER]: LEDGER BG LISTENER READY')
extension.runtime.onMessage.addListener(({action, params}) => {
console.log('[LEDGER]: GOT MSG FROM THE KEYRING', action, params)
if (action.search('ledger-') !== -1) {
//Forward messages from the keyring to the iframe
sendMessage({action, params})
}
})
function sendMessage(msg) {
ledgerIframe.contentWindow.postMessage({...msg, target: 'LEDGER-IFRAME'}, '*')
}
/*
Passing messages from iframe to background script
*/
console.log('[LEDGER]: LEDGER FROM-IFRAME LISTENER READY')
window.addEventListener('message', event => {
if(event.origin !== ORIGIN) return false
if (event.data && event.data.action && event.data.action.search('ledger-') !== -1) {
// Forward messages from the iframe to the keyring
console.log('[LEDGER] : forwarding msg', event.data)
extension.runtime.sendMessage(event.data)
}
})
}