Is there any way from an nsIChannel/nsIStreamListener to get the HTML element that caused the request to be sent in the first place?
I subscribed to http-on-examine-response and I am using nsITraceableChannel.setNewListener to read and modify incoming content. I want to only modify javascript content loaded from script tags, but I haven't found a reliable way to identify which responses are suitable. The MIME header cannot be trusted. Can I access information about what FF is planning to use this request for?
Perhaps something to do with the callbacks or the observers in the loadgroup?
Edit: is the aContentType argument of nsIContentPolicy.shouldLoad trustworthy? If I was able to pass information through the channel, I'd be set...