Hi all,

How can I register the observer "http-on-modify-request" available only to each window instead of the entire application? I have notice that this event "http-on-modify-request" will be triggered even more if i Open more navigator window, ie: Open 2 Firefox window will trigger this event 2 times which i think is redundant, and hence i could not get the HttpChannel correctly...

My question is, can I eliminate this by making the "http-on-modify-request" only available to each window? and how?

Please advice.

Below is my code:


//***************************************
var a =
{
  QueryInterface : function(aIID)
  {
    if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
        aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
        aIID.equals(Components.interfaces.nsIObserver) ||
        aIID.equals(Components.interfaces.nsIHttpNotify) ||
        aIID.equals(Components.interfaces.nsISupports))
      return this;
    throw Components.results.NS_NOINTERFACE;
  },

  observe: function(aSubject, aTopic, aData)
  {
    if (aTopic == "http-on-modify-request")
    {
      aSubject.QueryInterface(Components.interfaces.nsIHttpChannel);
      var uri = aSubject.URI.asciiSpec;
      dump("*** " + uri + " ***\n");
    }
  }
}


function regListener()
{
 observerService.addObserver(a, "http-on-modify-request", false);
}
function unregListener()
{
 observerService.removeObserver(a, "http-on-modify-request");
}

window.addEventListener("load", regListener, false);
window.addEventListener("unload", unregListener, false);
//***************************************
_______________________________________________
Mozilla-xpcom mailing list
Mozilla-xpcom@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to