code: function setupAddBox() {
    var addBox = document.querySelector('.addRow input');
    addBox.oninput = function() {
      if (addBox.value == '') {
        clearError();
        return;
      }
      fetchAddonManifest(addBox.value);
    };
    function fetchAddonManifest(url) {
      var xhr = new XMLHttpRequest();
      xhr.open('GET', url, true);
      xhr.onerror = function() {
        setError();
      };
      xhr.onload = function() {
        var contentType = xhr.getResponseHeader('content-type') || '';
        if (xhr.status != 200 ||
            contentType.indexOf('/json') == -1) {
          setError();
          return;
        }
  
        var manifest;
        try {
          manifest = JSON.parse(xhr.responseText);
        } catch (e) {
        }
        if (!manifest) {
          setError();
          return;
        }
  
        clearError();
        addAddon(url, manifest);
      };
      try {
        xhr.send(null);
      } catch (e) {
        setError();
      }
    };
    function setError() {
      addBox.classList.add('kTextFieldError');
    };
    function clearError() {
      addBox.classList.remove('kTextFieldError');
    };
  
    function addAddon(url, manifest) {
      _gaq.push(['_trackEvent', 'popup', 'addon_added']);
  
      addBox.value = '';
      port.postMessage({
        command: 'add_addon',
        url: url,
        manifest: manifest
      });
      port.postMessage({
        command: 'toggle_addon',
        enabled: true,
        url: url
      });
    };
  }
docs: Sets up the add addons box.