0

in my Firefox-Extension I've allready implemented the method onLocationChange() of my Progresslistener. The Change of the URI in the Location bar is detected correctly. Now I want to implement the method onProgressChange().

What I tried to do here: I'd like to detect, when a defined URI is requested. Just for starting, I tried to alert the requested URI:

onProgressChange: function(aWebProgress, aRequest, curSelf, maxSelf, curTot, maxTot) {
    if (aRequest != null) {
        var reqName = aRequest.name;

        alert(reqName);
    } else {
        alert("Request is null");
    }
}

So, I thought requesting a Website would fire this method and aRequest.name has to be the URL of the requested page. But instead there is only the alert "is null" for several times...

Can anybody please help me on that issue?

I read in the docs, that the Name Attribute not always is the requested URI. Is there a better way to get the requested URI?

Thank you all very much for help!

1 Answers1

0

QueryInterface aRequest to nsIChannel and get the .URI.spec on that?

Boris Zbarsky
  • 34,758
  • 5
  • 52
  • 55
  • Thank you for your answer. I thought of this possibility, too. But the Problem is, that aRequest is said to be null by the alert. So, there will also be no channel... Any idea, why aRequest is null? – kwonilchang Mar 23 '13 at 18:58
  • Oh, I see, you're hitting the `else` branch... Have you tried using `onStateChange` instead for `STATE_START` if you want to see requests starting? – Boris Zbarsky Mar 24 '13 at 06:24