extensions/wtf-injector-firefox/data/content-script.js
function injectScriptFile(url, rawText) {
  var filename = url;
  var lastSlash = url.lastIndexOf('/');
  if (lastSlash != -1) {
    filename = url.substr(lastSlash + 1);
  }

  var source = [
    '(function() {' + rawText + '})();',
    '// Web Tracing Framework injected file: ' + url,
    '//# sourceURL=x://wtf-injector/' + filename
  ].join('\n');

  // Setup script tag with the raw source.
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.text = source;

  // Add to page.
  injectScriptTag(script);
}
function injectScriptFile(url, rawText) {
  var filename = url;
  var lastSlash = url.lastIndexOf('/');
  if (lastSlash != -1) {
    filename = url.substr(lastSlash + 1);
  }

  var source = [
    '(function() {' + rawText + '})();',
    '// Web Tracing Framework injected file: ' + url,
    '//# sourceURL=x://wtf-injector/' + filename
  ].join('\n');

  // Setup script tag with the raw source.
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.text = source;

  // Add to page.
  injectScriptTag(script);
}
function injectScriptFile ( url , rawText ) { var filename = url ; var lastSlash = url . lastIndexOf ( '/' ) ; if ( lastSlash != - 1 ) { filename = url . substr ( lastSlash + 1 ) ; } var source = [ '(function() {' + rawText + '})();' , '// Web Tracing Framework injected file: ' + url , '//# sourceURL=x://wtf-injector/' + filename ] . join ( '\n' ) ; // Setup script tag with the raw source. var script = document . createElement ( 'script' ) ; script . type = 'text/javascript' ; script . text = source ; // Add to page. injectScriptTag ( script ) ; }
Injects a script file into the page.
@param {string} url Script URL.
@param {string} rawText Script raw text contents.
Injects a script file into the page .