title: window.location.replace in firefox addon removes entire chrome!
body: <p>I'm using the <code>nsIWebProgressListener</code> <a href="https://developer.mozilla.org/en/Code_snippets/Progress_Listeners" rel="nofollow noreferrer">interface</a> to find out if a url has been changed. If it has, I'd like to rewrite the link.
  Here's a snippet (code taken from the bottom of the page from the link above)</p>
  
  <pre><code>
  var myExt_urlBarListener = {
    QueryInterface: function(aIID)
    {
     if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
         aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
         aIID.equals(Components.interfaces.nsISupports))
       return this;
     throw Components.results.NS_NOINTERFACE;
    },
  
    onLocationChange: function(aProgress, aRequest, aURI)
    {
      myExtension.processNewURL(aURI);
    },
  
    onStateChange: function(a, b, c, d) {},
    onProgressChange: function(a, b, c, d, e, f) {},
    onStatusChange: function(a, b, c, d) {},
    onSecurityChange: function(a, b, c) {}
  };
  
  var myExtension = {
    oldURL: null,
  
    init: function() {
      // Listen for webpage loads
      gBrowser.addProgressListener(myExt_urlBarListener,
          Components.interfaces.nsIWebProgress.NOTIFY_LOCATION);
    },
  
    uninit: function() {
      gBrowser.removeProgressListener(myExt_urlBarListener);
    },
  
    processNewURL: function(aURI) {
      if (aURI.spec == this.oldURL)
        return;
  
      // now we know the url is new...
      start_work(aURI.spec);
      this.oldURL = aURI.spec;
    }
  };
  
  window.addEventListener("load", function() {myExtension.init()}, false);
  window.addEventListener("unload", function() {myExtension.uninit()}, false);
  
  </code></pre>
  
  <p>And a function to handle the change:</p>
  
  <pre><code>
  function start_work(url)
  {
      result = check(url);
      if (result) {
              setCookie('bws', 'true', 1, '/');
              window.location = result; // or window.location.replace, doesn't matter
          }
  }
  </code></pre>
  
  <p>Here's what happens!
  <a href="http://grab.by/20eP" rel="nofollow noreferrer">alt text http://grab.by/20eP</a>
  As you can see the entire browser/address bar/chrome disappeared!</p>
  
  <p>Any help on this?</p>