diff options
Implement some cross-browser practices (#473)
* Add mozilla plugin key to manifest
* Move all chrome references into platform-checking module
Addresses #453
* Add chrome global back to linter blacklist
* Add tests
Diffstat (limited to 'app/scripts/contentscript.js')
-rw-r--r-- | app/scripts/contentscript.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index 60b37284e..0ffe93e3c 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -1,6 +1,7 @@ const LocalMessageDuplexStream = require('./lib/local-message-stream.js') const PortStream = require('./lib/port-stream.js') const ObjectMultiplex = require('./lib/obj-multiplex') +const extension = require('./lib/extension') if (shouldInjectWeb3()) { setupInjection() @@ -10,7 +11,7 @@ if (shouldInjectWeb3()) { function setupInjection(){ // inject in-page script var scriptTag = document.createElement('script') - scriptTag.src = chrome.extension.getURL('scripts/inpage.js') + scriptTag.src = extension.extension.getURL('scripts/inpage.js') scriptTag.onload = function () { this.parentNode.removeChild(this) } var container = document.head || document.documentElement // append as first child @@ -25,7 +26,7 @@ function setupStreams(){ target: 'inpage', }) pageStream.on('error', console.error.bind(console)) - var pluginPort = chrome.runtime.connect({name: 'contentscript'}) + var pluginPort = extension.runtime.connect({name: 'contentscript'}) var pluginStream = new PortStream(pluginPort) pluginStream.on('error', console.error.bind(console)) @@ -49,4 +50,4 @@ function setupStreams(){ function shouldInjectWeb3(){ var shouldInject = (window.location.href.indexOf('.pdf') === -1) return shouldInject -}
\ No newline at end of file +} |