title: firefox extension page load not firing
body: <p>I am trying to write a very simple firefox extension, that just run some basic javascript on window load. But the event never fires. I have seen and tried things from several different posts and none of them work for me.</p>
  
  <pre><code>function startup() {
          alert("Hi"); 
  }
  window.addEventListener("load", startup, false);
  document.body.style.border = "5px solid red";
  </code></pre>
  
  <p>I have also tried this:</p>
  
  <pre><code>function startup() {
  mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                           .getInterface(Components.interfaces.nsIWebNavigation)                         .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
                           .rootTreeItem                         .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                           .getInterface(Components.interfaces.nsIDOMWindow);
      mainWindow.getBrowser().addEventListener("load", listener, false);
       Sidebar is loaded and mainwindow is ready
      }
  
      var listener = function(e){
          alert("Hai");
          //To remove event listener
          //mainWindow.getBrowser().removeEventListener("load",listener, false);
      }
  window.addEventListener("load", startup, false);
  document.body.style.border = "5px solid red";
  </code></pre>
  
  <p>In both cases the red border is there on all the pages but the alert never appears.There are no errors in the debug window either. Any help is appreciated. Thanks!</p>