author | Jason Duell <jduell.mcbugs@gmail.com> |
Tue, 27 Nov 2012 11:54:58 -0800 | |
changeset 114253 | 3c3a8eed0578c1a17a3cfaff427fe25b4afe05a9 |
parent 114252 | 3d5420af2c2773800d9af5d7aa26567d8de204e1 |
child 114254 | 514b3edf578357320e20a6f49b6750dcce9ebc76 |
child 114258 | 1c53e57a11ba46fb4e02e082a31a36e2d0faa415 |
child 117349 | c097ef134b78750e8ff32ebc911e28c04770dcb6 |
push id | 23910 |
push user | ryanvm@gmail.com |
push date | Wed, 28 Nov 2012 00:19:51 +0000 |
treeherder | mozilla-central@3c3a8eed0578 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bz |
bugs | 800799 |
milestone | 20.0a1 |
first release with | nightly linux32
3c3a8eed0578
/
20.0a1
/
20121128030742
/
files
nightly linux64
3c3a8eed0578
/
20.0a1
/
20121128030742
/
files
nightly mac
3c3a8eed0578
/
20.0a1
/
20121128030742
/
files
nightly win32
3c3a8eed0578
/
20.0a1
/
20121128030742
/
files
nightly win64
3c3a8eed0578
/
20.0a1
/
20121128030742
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
20.0a1
/
20121128030742
/
pushlog to previous
nightly linux64
20.0a1
/
20121128030742
/
pushlog to previous
nightly mac
20.0a1
/
20121128030742
/
pushlog to previous
nightly win32
20.0a1
/
20121128030742
/
pushlog to previous
nightly win64
20.0a1
/
20121128030742
/
pushlog to previous
|
--- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -4289,16 +4289,21 @@ nsHttpChannel::AsyncOpen(nsIStreamListen // Remember the cookie header that was set, if any const char *cookieHeader = mRequestHead.PeekHeader(nsHttp::Cookie); if (cookieHeader) { mUserSetCookieHeader = cookieHeader; } AddCookiesToRequest(); + // notify "http-on-opening-request" observers, but not if this is a redirect + if (!(mLoadFlags & LOAD_REPLACE)) { + gHttpHandler->OnOpeningRequest(this); + } + mIsPending = true; mWasOpened = true; mListener = listener; mListenerContext = context; // add ourselves to the load group. from this point forward, we'll report // all failures asynchronously.
--- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -172,16 +172,22 @@ public: nsresult GetStreamConverterService(nsIStreamConverterService **); nsresult GetIOService(nsIIOService** service); nsICookieService * GetCookieService(); // not addrefed nsIStrictTransportSecurityService * GetSTSService(); // callable from socket thread only uint32_t Get32BitsOfPseudoRandom(); + // Called by the channel synchronously during asyncOpen + void OnOpeningRequest(nsIHttpChannel *chan) + { + NotifyObservers(chan, NS_HTTP_ON_OPENING_REQUEST_TOPIC); + } + // Called by the channel before writing a request void OnModifyRequest(nsIHttpChannel *chan) { NotifyObservers(chan, NS_HTTP_ON_MODIFY_REQUEST_TOPIC); } // Called by the channel once headers are available void OnExamineResponse(nsIHttpChannel *chan)
--- a/netwerk/protocol/http/nsIHttpProtocolHandler.idl +++ b/netwerk/protocol/http/nsIHttpProtocolHandler.idl @@ -62,16 +62,34 @@ interface nsIHttpProtocolHandler : nsIPr * nsIObserver notification corresponding to startup category. Services * registered under the startup category will receive this observer topic at * startup if they implement nsIObserver. The "subject" of the notification * is the nsIHttpProtocolHandler instance. */ #define NS_HTTP_STARTUP_TOPIC "http-startup" /** + * This observer topic is notified when an HTTP channel is opened. + * It is similar to http-on-modify-request, except that + * 1) The notification is guaranteed to occur before on-modify-request, during + * the AsyncOpen call itself. + * 2) It only occurs for the initial open of a channel, not for internal + * asyncOpens that happen during redirects, etc. + * 3) Some information (most notably nsIProxiedChannel.proxyInfo) may not be set + * on the channel object yet. + * + * The "subject" of the notification is the nsIHttpChannel instance. + * + * Generally the 'http-on-modify-request' notification is preferred unless the + * synchronous, during-asyncOpen behavior that this notification provides is + * required. + */ +#define NS_HTTP_ON_OPENING_REQUEST_TOPIC "http-on-opening-request" + +/** * Before an HTTP request is sent to the server, this observer topic is * notified. The observer of this topic can then choose to set any additional * headers for this request before the request is actually sent to the server. * The "subject" of the notification is the nsIHttpChannel instance. */ #define NS_HTTP_ON_MODIFY_REQUEST_TOPIC "http-on-modify-request" /**