|
|
|
@ -7,7 +7,9 @@ const ObjectMultiplex = require('obj-multiplex') |
|
|
|
|
const extension = require('extensionizer') |
|
|
|
|
const PortStream = require('./lib/port-stream.js') |
|
|
|
|
|
|
|
|
|
const inpageText = fs.readFileSync(path.join(__dirname, 'inpage.js')).toString() |
|
|
|
|
const inpageContent = fs.readFileSync(path.join(__dirname, '..', '..', 'dist', 'chrome', 'scripts', 'inpage.js')).toString() |
|
|
|
|
const inpageSuffix = '//# sourceURL=' + extension.extension.getURL('scripts/inpage.js') + '\n' |
|
|
|
|
const inpageBundle = inpageContent + inpageSuffix |
|
|
|
|
|
|
|
|
|
// Eventually this streaming injection could be replaced with:
|
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings/Components.utils.exportFunction
|
|
|
|
@ -25,8 +27,7 @@ function setupInjection () { |
|
|
|
|
try { |
|
|
|
|
// inject in-page script
|
|
|
|
|
var scriptTag = document.createElement('script') |
|
|
|
|
scriptTag.src = extension.extension.getURL('scripts/inpage.js') |
|
|
|
|
scriptTag.textContent = inpageText |
|
|
|
|
scriptTag.textContent = inpageBundle |
|
|
|
|
scriptTag.onload = function () { this.parentNode.removeChild(this) } |
|
|
|
|
var container = document.head || document.documentElement |
|
|
|
|
// append as first child
|
|
|
|
|