Hi
I’m building a WebExtension using the webRequest API to collect details about requests and responses for the user to review (similar to HttpFox.)
I can see in the webRequest docs that -
“The listener function is passed a details object … This includes a request ID, which is provided to enable an add-on to correlate events associated with a single request … It stays the same throughout a request, even across redirections”
I don’t understand how having redirects maintain the same requestId is helpful in correlating events.
If a request has to go through multiple redirects (like an ad-tracking pixel), there doesn’t seem to be a way to correlate the different request stages (e.g. onBeforeRequest, onCompleted) with each separate redirect request (like what you would see in the Network panel.)
I’m currently storing all requests by ID in an object map, so by default, multiple redirects get overwritten with the most recent event data.
Any suggestions, or should redirects actually be treated as new requestId’s?