diff options
author | kumavis <kumavis@users.noreply.github.com> | 2017-10-13 04:01:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-13 04:01:29 +0800 |
commit | 701887bb19171b1cef0f6d5f6359d8cf39d80a01 (patch) | |
tree | 36a051f22d6dc099fce6bdd9f22a24219769cadb /app | |
parent | 29ee33359e818525549b5241adb6f5903a054bba (diff) | |
parent | 53a360b65d6b97fa4551c2953072a21cbe9f708d (diff) | |
download | tangerine-wallet-browser-701887bb19171b1cef0f6d5f6359d8cf39d80a01.tar.gz tangerine-wallet-browser-701887bb19171b1cef0f6d5f6359d8cf39d80a01.tar.zst tangerine-wallet-browser-701887bb19171b1cef0f6d5f6359d8cf39d80a01.zip |
Merge pull request #2352 from MetaMask/i1340-SynchronousInjection
Fix slow web3 injection bug
Diffstat (limited to 'app')
-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 b4708189e..ffbbc73cc 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -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 |