Skip to content

Instantly share code, notes, and snippets.

@mildred
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mildred/1c12cd7b4af6f24c145b to your computer and use it in GitHub Desktop.
Save mildred/1c12cd7b4af6f24c145b to your computer and use it in GitHub Desktop.
Hacking.firefox
Path from a URL typed by a user to the HTTP request:
- browser.xul
- tabbrowser.xml: <method name="addTab">
- tabbrowser.xml: <browser/>.loadURIWithFlags(...)
- toolkit/content/widgets/browser.xml: <method name="loadURIWithFlags">
- toolkit/content/widgets/browser.xml: nsIWebNavigation::loadURIWithOptions(...)
- docshell/base/nsIWebNavigation.idl (we should add a auth callback to this interface)
alternatives:
- toolkit/modules/RemoteWebNavigation.jsm
- toolkit/content/browser-child.js
- back to nsIWebNavigation after communicating with e10s child
- docshell/base/nsDocShell.cpp:4772:nsDocShell::LoadURIWithOptions(const char16_t* aURI,
- docshell/base/nsDocShell.cpp:1368:nsDocShell::LoadURI(nsIURI* aURI,
- docshell/base/nsDocShell.cpp:9571:nsDocShell::InternalLoad(nsIURI* aURI,
- docshell/base/nsDocShell.cpp:10450: nsDocShell::DoURILoad(nsIURI* aURI,
- netwerk/base/nsNetUtil.h:593:NS_NewInputStreamChannelInternal(nsIChannel** outChannel,
- netwerk/base/nsInputStreamChannel.cpp (netwerk/base/nsIInputStreamChannel.idl) with netwerk/base/LoadInfo.h (netwerk/base/nsILoadInfo.idl)
- nsIChannel <- (nsBaseChannel, nsIHttpChannel <- HttpBaseChannel <- ...)
- nsDocShell::DoChannelLoad
- uriloader/base/nsIURILoader.idl OpenURI(...)
- uriloader/base/nsURILoader.cpp:804:NS_IMETHODIMP nsURILoader::OpenURI(nsIChannel *channel,
- nsURILoader::OpenChannel
- ruriloader/base/nsURILoader.cpp:rv = channel->AsyncOpen(loader, nullptr);
- netwerk/protocol/http/nsHttpChannel.cpp: nsHttpChannel::AsyncOpen
- HttpBaseChannel::AddCookiesToRequest
- gHttpHandler->nsHttpHandler::GetCookieService()
- nsHttpChannel::BeginConnect <-- here we set the auth provider, we could choose another one
- nsHttpChannel::ContinueBeginConnect
- nsHttpChannel::Connect <-- a cache entry is opened
- OpenCacheEntry
- SpeculativeConnect
- nsHttpChannel::ContinueConnect <-- here, we read from cache
/!\ l409. If we have the doc in cache but are in offline mode, we don't show it. What a pity.
- gHttpHandler->nsHttpHandler::InitiateTransaction
- mTransactionPump->nsInputStreamPump::AsyncRead
- ... (TODO)
- ... (TODO)
- docshell/shistory/src/nsSHistory.cpp:1515:nsSHistory::LoadURIWithOptions(const char16_t* aURI,
- ... (TODO)
- embedding/browser/nsWebBrowser.cpp:581:NS_IMETHODIMP nsWebBrowser::LoadURIWithOptions(const char16_t* aURI,
- ... (TODO)
Path from the HTTP auth request to the user interface:
alternatives1:
- ...
- ContinueProcessNormal | ProcessPartialContent | ContinueOnStartRequest3 | ...
- CallOnStartRequest
alternative2:
- ...
- OnStopRequest
same path:
- nsHttpChannel::OnStartRequest(...) <-- we look at cached info there
- netwerk/protocol/http/nsHttpChannel.cpp: nsHttpChannel::ProcessResponse(...)
- netwerk/protocol/http/nsHttpChannelAuthProvider.cpp: nsHttpChannelAuthProvider::ProcessAuthentication(...)
- netwerk/protocol/http/nsHttpChannelAuthProvider.cpp: nsHttpChannelAuthProvider::GetCredentials
- netwerk/protocol/http/nsHttpChannelAuthProvider.cpp: nsHttpChannelAuthProvider::GetCredentialsForChallenge(...)
- netwerk/protocol/http/nsHttpChannelAuthProvider.cpp: nsHttpChannelAuthProvider::PromptForIdentity(...) {
- netwerk/protocol/http/nsHttpChannelAuthProvider.cpp: nsCOMPtr<nsIAuthPrompt2> authPrompt;
- netwerk/protocol/http/nsHttpChannelAuthProvider.cpp: rv = authPrompt->AsyncPromptAuth(...)
- netwerk/protocol/http/nsHttpChannelAuthProvider.cpp: rv = authPrompt->authPrompt->PromptAuth(...)
- netwerk/base/nsIAuthPrompt2.idl
- ...
- toolkit/...
Work:
- The DocShell represents a frame that contains a document
- The DocShell shuld be able to have a separate Cookie Jar, a separate cache
(private browsing) and separate auth credentials cache.
- When auth credentials are needed, the DocShell should be notified and should
be responsible to notify upper layers to display the UI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment