contentscript - skip web3 injection if domain appears to be a pdf

feature/default_network_editable
kumavis 9 years ago
parent ac2269b16e
commit fce748c118
  1. 16
      app/scripts/contentscript.js

@ -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…
Cancel
Save