(function () {
  var queryString = window.location.search
  var devServerPort = queryString && queryString.match(/devServerPort=([^&]*)/)[1]

  let aboutEntryPage = 'gen/aboutPages.entry.js'
  if (devServerPort) {
    aboutEntryPage = 'http://localhost:' + devServerPort + '/' + aboutEntryPage
  }

  var getFavicon = function(){
    var favicon = undefined;
    var nodeList = document.getElementsByTagName("link");
    for (var i = 0; i < nodeList.length; i++)
    {
      if((nodeList[i].getAttribute("rel") == "icon") || (nodeList[i].getAttribute("rel") == "shortcut icon"))
      {
        favicon = nodeList[i].getAttribute("href");
      }
    }
    return favicon;
  }

  // set favicon as a data url because chrome-extension urls don't work correctly
  if (getFavicon()) {
    var img = new Image();
    img.onload = function(){
        var canvas = document.createElement('CANVAS');
        var ctx = canvas.getContext('2d');
        var dataURL;
        canvas.height = this.height;
        canvas.width = this.width;
        ctx.drawImage(this, 0, 0);
        dataURL = canvas.toDataURL();
        var docHead = document.getElementsByTagName('head')[0];
        var newLink = document.createElement('link');
        newLink.rel = 'shortcut icon';
        newLink.href = dataURL;
        docHead.appendChild(newLink);
        canvas = null;
    };
    img.src = 'img/favicon.ico';
  }
  chrome.ipc.on('language', (e, detail) => {
    document.l10n.requestLanguages([detail.langCode])
    document.getElementsByName('availableLanguages')[0].content = detail.languageCodes.join(', ')
  })
  window.addEventListener('load', function () {
    var po = document.createElement('script')
    po.async = true
    po.src = aboutEntryPage
    var s = document.getElementsByTagName('script')[0]
    s.parentNode.insertBefore(po, s)
    chrome.ipc.send('request-language')
  })
})()

@@ -211,30 +211,28 @@
 ) %7B%0A    
-aboutEntryPage
+var baseHref
  = 'http
@@ -265,31 +265,207 @@
 Port
- + '/' + aboutEntryPage
+%0A    aboutEntryPage = baseHref + '/' + aboutEntryPage%0A    var baseNode = document.createElement('base')%0A    baseNode.href = baseHref%0A    document.getElementsByTagName('head')%5B0%5D.appendChild(baseNode)
 %0A  %7D

set base href for about pages auditors: @bsclifton @jkup