diff options
author | kumavis <aaron@kumavis.me> | 2017-10-13 03:51:48 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2017-10-13 03:51:48 +0800 |
commit | 53a360b65d6b97fa4551c2953072a21cbe9f708d (patch) | |
tree | 36a051f22d6dc099fce6bdd9f22a24219769cadb /app | |
parent | c9a984a237ccacf8994e6c4c2f49b7a17da92d6b (diff) | |
download | tangerine-wallet-browser-53a360b65d6b97fa4551c2953072a21cbe9f708d.tar.gz tangerine-wallet-browser-53a360b65d6b97fa4551c2953072a21cbe9f708d.tar.zst tangerine-wallet-browser-53a360b65d6b97fa4551c2953072a21cbe9f708d.zip |
contentscript - fix inpage require and bundling
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/contentscript.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index 445608214..ffbbc73cc 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -7,9 +7,9 @@ const ObjectMultiplex = require('obj-multiplex') const extension = require('extensionizer') const PortStream = require('./lib/port-stream.js') -const inpagePath = path.join(__dirname, '..', '..', 'dist', 'chrome', 'scripts', 'inpage.js') -const inpageString = fs.readFileSync(inpagePath).toString() -const inpageText = inpageString + '//# sourceURL=' + extension.extension.getURL('scripts/inpage.js') + '\n' +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 @@ -27,7 +27,7 @@ function setupInjection () { try { // inject in-page script var scriptTag = document.createElement('script') - scriptTag.textContent = inpageText + scriptTag.textContent = inpageBundle scriptTag.onload = function () { this.parentNode.removeChild(this) } var container = document.head || document.documentElement // append as first child |