title: appendChild in a XUL Firefox addon breaks
body: <p>I am working on a Firefox addon and I currently need to dynamically add menuitems to a menupopup element. I have tried basically all of the approaches on the Mozilla Developer Center and none of them work.</p>
  
  <pre><code>    function populateDropdown() {
      var counter = 0;
      for (var key in services) {
          var newMenuItem = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem");
          newMenuItem.setAttribute("label", services[key]['title'])
  
          document.getElementById("mainDropdown").appendChild(newMenuItem);
      }
  }
  </code></pre>
  
  <p>This code breaks at the appendChild command. Any ideas why?</p>