Begin implementing sync injection idea

feature/default_network_editable
Dan Finlay 7 years ago
parent 852c27bad4
commit 1cba6543a4
  1. 3
      app/scripts/contentscript.js
  2. 4
      gulpfile.js

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

@ -186,8 +186,8 @@ jsFiles.forEach((jsFile) => {
gulp.task(`build:js:${jsFile}`, bundleTask({ watch: false, label: jsFile, filename: `${jsFile}.js` })) gulp.task(`build:js:${jsFile}`, bundleTask({ watch: false, label: jsFile, filename: `${jsFile}.js` }))
}) })
gulp.task('dev:js', gulp.parallel(...jsDevStrings)) gulp.task('dev:js', gulp.series(jsDevStrings.shift(), gulp.parallel(...jsDevStrings)))
gulp.task('build:js', gulp.parallel(...jsBuildStrings)) gulp.task('build:js', gulp.series(jsBuildStrings.shift(), gulp.parallel(...jsBuildStrings)))
// disc bundle analyzer tasks // disc bundle analyzer tasks

Loading…
Cancel
Save