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:
commit
bec7bde883
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user