зеркало из https://github.com/mozilla/pjs.git
Bug 648878 - I will backout: investigating inbound-only failure r=jduell
This commit is contained in:
Родитель
fedf994668
Коммит
e3a3c49b9b
|
@ -287,10 +287,18 @@ HttpChannelChild::OnStartRequest(const nsHttpResponseHead& responseHead,
|
||||||
getter_AddRefs(mSecurityInfo));
|
getter_AddRefs(mSecurityInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sanity check: we should have either both remove/local socket address or
|
||||||
|
// neither.
|
||||||
|
if (selfAddr.raw.family != peerAddr.raw.family) {
|
||||||
|
NS_WARNING("Child: socket has multiple address families!");
|
||||||
|
}
|
||||||
|
|
||||||
mIsFromCache = isFromCache;
|
mIsFromCache = isFromCache;
|
||||||
mCacheEntryAvailable = cacheEntryAvailable;
|
mCacheEntryAvailable = cacheEntryAvailable;
|
||||||
mCacheExpirationTime = cacheExpirationTime;
|
mCacheExpirationTime = cacheExpirationTime;
|
||||||
mCachedCharset = cachedCharset;
|
mCachedCharset = cachedCharset;
|
||||||
|
mSelfAddr = selfAddr;
|
||||||
|
mPeerAddr = peerAddr;
|
||||||
|
|
||||||
AutoEventEnqueuer ensureSerialDispatch(mEventQ);
|
AutoEventEnqueuer ensureSerialDispatch(mEventQ);
|
||||||
|
|
||||||
|
@ -313,9 +321,6 @@ HttpChannelChild::OnStartRequest(const nsHttpResponseHead& responseHead,
|
||||||
rv = ApplyContentConversions();
|
rv = ApplyContentConversions();
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
Cancel(rv);
|
Cancel(rv);
|
||||||
|
|
||||||
mSelfAddr = selfAddr;
|
|
||||||
mPeerAddr = peerAddr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TransportAndDataEvent : public ChannelEvent
|
class TransportAndDataEvent : public ChannelEvent
|
||||||
|
@ -1113,36 +1118,6 @@ HttpChannelChild::SetupFallbackChannel(const char *aFallbackKey)
|
||||||
DROP_DEAD();
|
DROP_DEAD();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The next four _should_ be implemented, but we need to figure out how
|
|
||||||
// to transfer the data from the chrome process first.
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
HttpChannelChild::GetRemoteAddress(nsACString & _result)
|
|
||||||
{
|
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
HttpChannelChild::GetRemotePort(PRInt32 * _result)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(_result);
|
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
HttpChannelChild::GetLocalAddress(nsACString & _result)
|
|
||||||
{
|
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
HttpChannelChild::GetLocalPort(PRInt32 * _result)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(_result);
|
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// HttpChannelChild::nsICacheInfoChannel
|
// HttpChannelChild::nsICacheInfoChannel
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -106,10 +106,6 @@ public:
|
||||||
bool aMerge);
|
bool aMerge);
|
||||||
// nsIHttpChannelInternal
|
// nsIHttpChannelInternal
|
||||||
NS_IMETHOD SetupFallbackChannel(const char *aFallbackKey);
|
NS_IMETHOD SetupFallbackChannel(const char *aFallbackKey);
|
||||||
NS_IMETHOD GetLocalAddress(nsACString& addr);
|
|
||||||
NS_IMETHOD GetLocalPort(PRInt32* port);
|
|
||||||
NS_IMETHOD GetRemoteAddress(nsACString& addr);
|
|
||||||
NS_IMETHOD GetRemotePort(PRInt32* port);
|
|
||||||
// nsISupportsPriority
|
// nsISupportsPriority
|
||||||
NS_IMETHOD SetPriority(PRInt32 value);
|
NS_IMETHOD SetPriority(PRInt32 value);
|
||||||
// nsIResumableChannel
|
// nsIResumableChannel
|
||||||
|
|
|
@ -450,6 +450,15 @@ HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsHttpChannel *httpChan = static_cast<nsHttpChannel *>(mChannel.get());
|
nsHttpChannel *httpChan = static_cast<nsHttpChannel *>(mChannel.get());
|
||||||
|
|
||||||
|
// Sanity check: we should have either both remove/local socket address or
|
||||||
|
// neither.
|
||||||
|
PRNetAddr selfAddr = httpChan->GetSelfAddr();
|
||||||
|
PRNetAddr peerAddr = httpChan->GetPeerAddr();
|
||||||
|
if (selfAddr.raw.family != peerAddr.raw.family) {
|
||||||
|
NS_WARNING("Parent: socket has multiple address families!");
|
||||||
|
}
|
||||||
|
|
||||||
if (mIPCClosed ||
|
if (mIPCClosed ||
|
||||||
!SendOnStartRequest(responseHead ? *responseHead : nsHttpResponseHead(),
|
!SendOnStartRequest(responseHead ? *responseHead : nsHttpResponseHead(),
|
||||||
!!responseHead,
|
!!responseHead,
|
||||||
|
|
|
@ -22,14 +22,42 @@ TracingListener.prototype = {
|
||||||
|
|
||||||
request.QueryInterface(Components.interfaces.nsIHttpChannelInternal);
|
request.QueryInterface(Components.interfaces.nsIHttpChannelInternal);
|
||||||
|
|
||||||
// local/remote addresses broken in e10s: disable for now
|
var localAddr = "unknown";
|
||||||
/*
|
var localPort = "unknown";
|
||||||
do_check_eq(request.localAddress, "127.0.0.1");
|
var remoteAddr = "unknown";
|
||||||
do_check_eq(request.localPort > 0, true);
|
var remotePort = "unknown";
|
||||||
do_check_neq(request.localPort, 4444);
|
try {
|
||||||
do_check_eq(request.remoteAddress, "127.0.0.1");
|
localAddr = request.localAddress;
|
||||||
do_check_eq(request.remotePort, 4444);
|
dump("got local address\n");
|
||||||
*/
|
} catch(e) {
|
||||||
|
dump("couldn't get local address\n");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
localPort = request.localPort;
|
||||||
|
dump("got local port\n");
|
||||||
|
} catch(e) {
|
||||||
|
dump("couldn't get local port\n");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
remoteAddr = request.remoteAddress;
|
||||||
|
dump("got remote address\n");
|
||||||
|
} catch(e) {
|
||||||
|
dump("couldn't get remote address\n");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
remotePort = request.remotePort;
|
||||||
|
dump("got remote port\n");
|
||||||
|
} catch(e) {
|
||||||
|
dump("couldn't get remote port\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
do_check_eq(localAddr, "127.0.0.1");
|
||||||
|
do_check_eq(localPort > 0, true);
|
||||||
|
do_check_eq(remoteAddr, "127.0.0.1");
|
||||||
|
do_check_eq(remotePort, 4444);
|
||||||
|
|
||||||
|
request.QueryInterface(Components.interfaces.nsISupportsPriority);
|
||||||
|
request.priority = Ci.nsISupportsPriority.PRIORITY_LOW;
|
||||||
|
|
||||||
// Make sure listener can't be replaced after OnStartRequest was called.
|
// Make sure listener can't be replaced after OnStartRequest was called.
|
||||||
request.QueryInterface(Components.interfaces.nsITraceableChannel);
|
request.QueryInterface(Components.interfaces.nsITraceableChannel);
|
||||||
|
@ -63,9 +91,10 @@ TracingListener.prototype = {
|
||||||
input.close();
|
input.close();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
dump("TracingListener.onStopRequest swallowing exception: " + e + "\n");
|
dump("TracingListener.onStopRequest swallowing exception: " + e + "\n");
|
||||||
} finally {
|
|
||||||
httpserver.stop(do_test_finished);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we're the last OnStopRequest called by the nsIStreamListenerTee
|
||||||
|
run_next_test();
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function(iid) {
|
QueryInterface: function(iid) {
|
||||||
|
@ -135,18 +164,37 @@ function make_channel(url) {
|
||||||
|
|
||||||
// Check if received body is correctly modified.
|
// Check if received body is correctly modified.
|
||||||
function channel_finished(request, input, ctx) {
|
function channel_finished(request, input, ctx) {
|
||||||
httpserver.stop(do_test_finished);
|
// No-op: since the nsIStreamListenerTee calls the observer's OnStopRequest
|
||||||
|
// after this, we call run_next_test() there
|
||||||
|
}
|
||||||
|
|
||||||
|
// needs to be global or it'll go out of scope before it observes request
|
||||||
|
var observer = new HttpResponseExaminer();
|
||||||
|
|
||||||
|
var testRuns = 1; // change this to >1 to run test multiple times
|
||||||
|
var iteration = 1;
|
||||||
|
|
||||||
|
function run_next_test() {
|
||||||
|
if (iteration > testRuns) {
|
||||||
|
dump("Shutting down\n");
|
||||||
|
httpserver.stop(do_test_finished);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (iteration > 1) {
|
||||||
|
dump("^^^ test iteration=" + iteration + "\n");
|
||||||
|
}
|
||||||
|
var channel = make_channel("http://localhost:4444/testdir");
|
||||||
|
channel.asyncOpen(new ChannelListener(channel_finished), null);
|
||||||
|
iteration++;
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
var observer = new HttpResponseExaminer();
|
|
||||||
observer.register();
|
observer.register();
|
||||||
|
|
||||||
httpserver = new nsHttpServer();
|
httpserver = new nsHttpServer();
|
||||||
httpserver.registerPathHandler("/testdir", test_handler);
|
httpserver.registerPathHandler("/testdir", test_handler);
|
||||||
httpserver.start(4444);
|
httpserver.start(4444);
|
||||||
|
|
||||||
var channel = make_channel("http://localhost:4444/testdir");
|
run_next_test();
|
||||||
channel.asyncOpen(new ChannelListener(channel_finished), null);
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче