Skip to content

Instantly share code, notes, and snippets.

@jdm
Created July 5, 2017 15:03
Show Gist options
  • Save jdm/6bdb7d6a5cdd5bcfbcf9bc8cc83ebb16 to your computer and use it in GitHub Desktop.
Save jdm/6bdb7d6a5cdd5bcfbcf9bc8cc83ebb16 to your computer and use it in GitHub Desktop.
10:53 <jdm> mayhemer: when an HTTP redirect occurs, which channels see the OnStartRequest notification?
10:54 <mayhemer> jdm: channels?
10:54 <jdm> mayhemer: so there is the channel that gets redirected, and the new channel that is the result of the redirect
10:55 <jdm> mayhemer: does the original channel have OnStartRequest called?
10:55 <mayhemer> jdm: depends
10:55 <mayhemer> jdm: if go to network for the response, we definitely get called with the 30X response
10:56 <mayhemer> so, the first channel gets onStart
10:56 <jdm> ok, that's helpful
10:56 <mayhemer> when we go from the cache and some other conditions are met, we skip and redirect immediately (the first channel doesn't open any pump)
10:56 <jdm> mayhemer: is there some API to determine if a redirection has occurred so we can ignore that?
10:57 <mayhemer> jdm: but, the final listener is of course called only once, as the contract dictates
10:57 <mayhemer> jdm: ignore what?
10:57 <jdm> mayhemer: in this case, we want to use OnStartRequest to send cookies to the child process when a document response has been received
10:58 <jdm> mayhemer: but we don't want to do this for a 3XX response
10:58 <mayhemer> jdm: aha, where exactly the code is to be added, to nsHttpChannel?
10:58 cmuresan has left IRC (Quit: Instantbird 1.5 -- http://www.instantbird.com)
10:59 <mayhemer> jdm: or rather to HttpChannelParent?
10:59 <jdm> mayhemer: it's in ContentParent::AboutToLoadHttp right now, which is invoked from HttpChannelParent::OnStartRequest
10:59 <mayhemer> jdm: then it's easies!
10:59 <mayhemer> easier
11:00 <mayhemer> jdm: HttpChannelParent stands as the final listener
11:00 <mayhemer> jdm: so, it's not called when we receive 30X and the redirect is allowed
11:00 jaypoulz has left IRC (Ping timeout: 121 seconds)
11:01 <jdm> huh
11:01 jdm needs to look at Amy's changes again, in that case
11:01 <mayhemer> jdm: let me double check
11:02 <mayhemer> jdm: yeah, it works that way.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment