Skip to content

Instantly share code, notes, and snippets.

@valenting
Last active August 9, 2022 09:09
Show Gist options
  • Save valenting/16aeaf900d21655c4032a5edcf9ee893 to your computer and use it in GitHub Desktop.
Save valenting/16aeaf900d21655c4032a5edcf9ee893 to your computer and use it in GitHub Desktop.
HTTP IPC redirect
  sequenceDiagram  
 participant HttpChannelChild  
 participant HttpChannelParent  
 participant nsHttpChannel

% slightly simplified to avoid HttpChannelParentListener and nsAsyncRedirectVerifyHelper
 
 Note over HttpChannelChild: AsyncOpen
  HttpChannelChild->>HttpChannelParent: gNeckoChild->SendPHttpChannelConstructor
  Note over HttpChannelParent: Init
  Note over HttpChannelParent: NS_NewChannelInternal
  Note over HttpChannelParent: WaitForBgParent
  HttpChannelParent->>nsHttpChannel: mChannel->AsyncOpen
  Note over nsHttpChannel: receiveResponse
  Note over nsHttpChannel: OnStartRequest
  nsHttpChannel->>nsHttpChannel: ContinueProcessRedirectionAfterFallback
  Note over nsHttpChannel: SetupReplacementChannel
  Note over nsHttpChannel: gHttpHandler->AsyncOnChannelRedirect
  nsHttpChannel ->> HttpChannelParent: AsyncOnChannelRedirect
  HttpChannelParent ->>HttpChannelChild: SendRedirect1Begin
  Note over HttpChannelChild: gHttpHandler->AsyncOnChannelRedirect
  HttpChannelChild ->> HttpChannelChild: OnRedirectVerifyCallback
  HttpChannelChild ->> HttpChannelParent: SendRedirect2Verify
  Note over HttpChannelParent: ContinueRedirect2Verify
  HttpChannelParent ->> nsHttpChannel: mRedirectCallback->OnRedirectVerifyCallback
  Note over nsHttpChannel: AutoRedirectVetoNotifier::ReportRedirectResult
  Note over nsHttpChannel: vetoHook->OnRedirectResult
  nsHttpChannel ->> HttpChannelParent: OnRedirectResult
  HttpChannelParent ->> HttpChannelParent: CompleteRedirect
HttpChannelParent ->> HttpChannelChild: SendRedirect3Complete
Note over HttpChannelParent: mRedirectChannel = null
nsHttpChannel ->> nsHttpChannel: OnRedirectVerifyCallback
Note over nsHttpChannel: pop redirect functions & execute `ContinueProcessRedirection`
nsHttpChannel ->> nsHttpChannel: OpenRedirectChannel
Note over nsHttpChannel: newChannel->AsyncOpen
Note over nsHttpChannel: if success <br/> notifier.RedirectSucceeded() <br/> ReleaseListeners()
nsHttpChannel ->> HttpChannelParent: OnRedirectResult
HttpChannelParent ->> HttpChannelParent: CompleteRedirect
HttpChannelParent ->> HttpChannelChild: SendRedirect3Complete
Note over HttpChannelChild: Redirect3Complete <br /> maybe cleanup newchannel channel <br /> vetoHook->OnRedirectResult(rv) <br/> CleanupRedirectingChannel
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment