Backed out changeset fd30aea30b03
authorJason Duell <jduell.mcbugs@gmail.com>
Tue, 13 Mar 2012 15:12:46 -0700
changeset 92292 2485d40bdbe5b6ae61c67e5e32067dc37c460841
parent 92290 90f6b58ce0fa0e83b16bbb0670fd1c86d491bd96 (current diff)
parent 92291 f6ab14e921740322fb09673be374e1d083a54368 (diff)
child 92293 ec55dae77b79ba6b413b44ae0a4bb362d1ac4dfd
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone14.0a1
backs outfd30aea30b032eea5036da9cb52db27f7c4c24df
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset fd30aea30b03
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -286,18 +286,16 @@ HttpChannelChild::OnStartRequest(const n
     NS_DeserializeObject(securityInfoSerialization, 
                          getter_AddRefs(mSecurityInfo));
   }
 
   mIsFromCache = isFromCache;
   mCacheEntryAvailable = cacheEntryAvailable;
   mCacheExpirationTime = cacheExpirationTime;
   mCachedCharset = cachedCharset;
-  mSelfAddr = selfAddr;
-  mPeerAddr = peerAddr;
 
   AutoEventEnqueuer ensureSerialDispatch(mEventQ);
 
   // replace our request headers with what actually got sent in the parent
   mRequestHead.Headers() = requestHeaders;
 
   // notify "http-on-examine-response" observers
   gHttpHandler->OnExamineResponse(this);
@@ -310,16 +308,19 @@ HttpChannelChild::OnStartRequest(const n
   }
 
   if (mResponseHead)
     SetCookie(mResponseHead->PeekHeader(nsHttp::Set_Cookie));
 
   rv = ApplyContentConversions();
   if (NS_FAILED(rv))
     Cancel(rv);
+
+  mSelfAddr = selfAddr;
+  mPeerAddr = peerAddr;
 }
 
 class TransportAndDataEvent : public ChannelEvent
 {
  public:
   TransportAndDataEvent(HttpChannelChild* child,
                         const nsresult& status,
                         const PRUint64& progress,
@@ -1107,16 +1108,46 @@ HttpChannelChild::SetRequestHeader(const
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpChannelChild::SetupFallbackChannel(const char *aFallbackKey)
 {
   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
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpChannelChild::GetCacheTokenExpirationTime(PRUint32 *_retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
--- a/netwerk/protocol/http/HttpChannelChild.h
+++ b/netwerk/protocol/http/HttpChannelChild.h
@@ -101,16 +101,20 @@ public:
   NS_IMETHOD GetSecurityInfo(nsISupports **aSecurityInfo);
   NS_IMETHOD AsyncOpen(nsIStreamListener *listener, nsISupports *aContext);
   // HttpBaseChannel::nsIHttpChannel
   NS_IMETHOD SetRequestHeader(const nsACString& aHeader, 
                               const nsACString& aValue, 
                               bool aMerge);
   // nsIHttpChannelInternal
   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
   NS_IMETHOD SetPriority(PRInt32 value);
   // nsIResumableChannel
   NS_IMETHOD ResumeAt(PRUint64 startPos, const nsACString& entityID);
 
   // IPDL holds a reference while the PHttpChannel protocol is live (starting at
   // AsyncOpen, and ending at either OnStopRequest or any IPDL error, either of
   // which call NeckoChild::DeallocPHttpChannel()).
--- a/netwerk/test/unit/test_traceable_channel.js
+++ b/netwerk/test/unit/test_traceable_channel.js
@@ -17,52 +17,24 @@ function TracingListener() {}
 TracingListener.prototype = {
   onStartRequest: function(request, context) {
     dump("*** tracing listener onStartRequest\n");
 
     gotOnStartRequest = true;
 
     request.QueryInterface(Components.interfaces.nsIHttpChannelInternal);
 
-    var localAddr = "unknown";
-    var localPort = "unknown";
-    var remoteAddr = "unknown";
-    var remotePort = "unknown";
-    try {
-      localAddr = request.localAddress;
-      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;
+// local/remote addresses broken in e10s: disable for now
+/*
+    do_check_eq(request.localAddress, "127.0.0.1");
+    do_check_eq(request.localPort > 0, true);
+    do_check_neq(request.localPort, 4444);
+    do_check_eq(request.remoteAddress, "127.0.0.1");
+    do_check_eq(request.remotePort, 4444);
+*/
 
     // Make sure listener can't be replaced after OnStartRequest was called.
     request.QueryInterface(Components.interfaces.nsITraceableChannel);
     try {
       var newListener = new TracingListener();
       newListener.listener = request.setNewListener(newListener);
     } catch(e) {
       dump("TracingListener.onStartRequest swallowing exception: " + e + "\n");
@@ -86,20 +58,19 @@ TracingListener.prototype = {
       do_check_eq(sin.available(), originalBody.length);
     
       var result = sin.read(originalBody.length);
       do_check_eq(result, originalBody);
     
       input.close();
     } catch (e) {
       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) {
     if (iid.equals(Components.interfaces.nsIRequestObserver) ||
         iid.equals(Components.interfaces.nsISupports)
         )
       return this;
     throw Components.results.NS_NOINTERFACE;
@@ -159,42 +130,23 @@ function make_channel(url) {
   var ios = Cc["@mozilla.org/network/io-service;1"].
     getService(Ci.nsIIOService);
   return ios.newChannel(url, null, null).
     QueryInterface(Components.interfaces.nsIHttpChannel);
 }
 
 // Check if received body is correctly modified.
 function channel_finished(request, input, ctx) {
-  // 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++;
+  httpserver.stop(do_test_finished);
 }
 
 function run_test() {
+  var observer = new HttpResponseExaminer();
   observer.register();
 
   httpserver = new nsHttpServer();
   httpserver.registerPathHandler("/testdir", test_handler);
   httpserver.start(4444);
 
-  run_next_test();
+  var channel = make_channel("http://localhost:4444/testdir");
+  channel.asyncOpen(new ChannelListener(channel_finished), null);
   do_test_pending();
 }