1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

Merge pull request #319 from MetaMask/pdf

contentscript - skip web3 injection if domain appears to be a pdf
This commit is contained in:
kumavis 2016-06-24 11:25:03 -07:00 committed by GitHub
commit bec7bde883

View File

@ -1,6 +1,13 @@
const LocalMessageDuplexStream = require('./lib/local-message-stream.js')
const PortStream = require('./lib/port-stream.js')
const ObjectMultiplex = require('./lib/obj-multiplex')
const urlUtil = require('url')
if (shouldInjectWeb3()) {
setupInjection()
}
function setupInjection(){
// inject in-page script
var scriptTag = document.createElement('script')
@ -34,3 +41,12 @@ reloadStream.on('error', console.error.bind(console))
pluginStream.on('close', function () {
reloadStream.write({ method: 'reset' })
})
}
function shouldInjectWeb3(){
var urlData = urlUtil.parse(window.location.href)
var extension = urlData.pathname.split('.').slice(-1)[0]
var shouldInject = (extension !== 'pdf')
return shouldInject
}