Skip to content

Instantly share code, notes, and snippets.

@valenting
Last active May 16, 2019 10:16
Show Gist options
  • Save valenting/ce444c31bb8ef2f53b9acfc3f59feedb to your computer and use it in GitHub Desktop.
Save valenting/ce444c31bb8ef2f53b9acfc3f59feedb to your computer and use it in GitHub Desktop.
e10s HTTP channel redirect flow
Parent Process Child Process 1 Child Process 2
nsHttpChannel HttpChannelParentListener HttpChannelParent HttpChannelChild
+
|
SessionStore.jsm::onMayChangeProcess <-----------------------+
aChannel.switchProcessTo(tabPromise, identifier)
StartCrossProcessRedirect() --->TriggerCrossProcessRedirect
browserParent->SendCrossProcessRedirect() +-----------------------------------------------------------------------------------------> ContentChild::RecvCrossProcessRedirect
- NS_NewChannelInternal
ConnectChannel <---------------------------------------------------------------------------+ConnectParent
- processListener->OnChannelReady +------+
|
HttpChannelChild::CompleteRedirectSetup <-------------+
RecvCrossProcessRedirectDone <------------------------------------------------------------------+ - CrossProcessRedirectFinished
FinishCrossProcessRedirect
OnRedirectResult <----------------------------------+
parent->Delete() +---------------------------------------------------------------> RecvDeleteSelf
mNextListener = redirectChannel;
OnRedirectVerifyCallback <----------------------------------------------------------------------------------------------------------+
nsHttpChannel HttpChannelParentListener HttpChannelParent HttpChannelChild
StartRedirectChannelToURI
-AsyncOnChannelRedirect +--------------------------------> RegisterChannel +-------------------------------------> StartRedirect
(creates parent side newChannel) (creates mRedirectChannelId) -SendRedirect1Begin +------------------------------> Redirect1Begin
-WaitForRedirectCallback -SetupRedirect
(suspends channel) (creates newChannel)
-ConnectParent(redirectChannelID)
ConnectChannel <-------------------------------------+ SendPHttpChannelConstructor(connectArgs)
-NS_LinkRedirectChannels
-AsyncOnChannelRedirect
+
|
|
v
OnRedirectVerifyCallback
OnRedirectVerifyCallback <--------------------------------------------------------------------------------------------+ RecvRedirect2Verify <------------------------------------+ -SendRedirect2Verify
(resumes original channel) -ContinueRedirect2Verify
- OpenRedirectChannel
- newChannel->AsyncOpen(listener)
+
|
|
+---> AutoRedirectVetoNotifier +----------------------> OnRedirectResult +------------------------------------------> CompleteRedirect
- SendRedirect3Complete +-------------------------------> Redirect3Complete
- CompleteRedirectSetup
(equivalent of AsyncOpen
sets the channel listeners)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment