extensions/wtf-injector-chrome/wtf-injector.js
function resolveUrl(base, url) {
  var value = '';
  if (url.indexOf('://') != -1) {
    // Likely absolute...
    value = url;
  } else {
    // Combine by smashing together and letting the browser figure it out.
    if (url.length && url[0] == '/') {
      // URL is absolute, so strip base to just host.
      var i = url.indexOf('://') + 3;
      i = url.indexOf('/', i);
      if (i != -1) {
        value = base + url;
      } else {
        value = base.substr(0, i) + url;
      }
    } else {
      // URL is relative, so combine with base.
      if (base[base.length] == '/') {
        value = base + '/' + url;
      } else {
        value = base + '/../' + url;
      }
    }
  }
  return value;
}
function resolveUrl(base, url) {
  var value = '';
  if (url.indexOf('://') != -1) {
    // Likely absolute...
    value = url;
  } else {
    // Combine by smashing together and letting the browser figure it out.
    if (url.length && url[0] == '/') {
      // URL is absolute, so strip base to just host.
      var i = url.indexOf('://') + 3;
      i = url.indexOf('/', i);
      if (i != -1) {
        value = base + url;
      } else {
        value = base.substr(0, i) + url;
      }
    } else {
      // URL is relative, so combine with base.
      if (base[base.length] == '/') {
        value = base + '/' + url;
      } else {
        value = base + '/../' + url;
      }
    }
  }
  return value;
}
function resolveUrl ( base , url ) { var value = '' ; if ( url . indexOf ( '://' ) != - 1 ) { // Likely absolute... value = url ; } else { // Combine by smashing together and letting the browser figure it out. if ( url . length && url [ 0 ] == '/' ) { // URL is absolute, so strip base to just host. var i = url . indexOf ( '://' ) + 3 ; i = url . indexOf ( '/' , i ) ; if ( i != - 1 ) { value = base + url ; } else { value = base . substr ( 0 , i ) + url ; } } else { // URL is relative, so combine with base. if ( base [ base . length ] == '/' ) { value = base + '/' + url ; } else { value = base + '/../' + url ; } } } return value ; }
Hackily resolves a URL relative to a base.
@param {string} base Base URL.
@param {string} url Relative or absolute URL.
@return {string} Resolved URL.
Hackily resolves a URL relative to a base .