Backout changeset 8bbed05c1661 r=bz a=lizzard
authorTooru Fujisawa <arai_a@mac.com>
Fri, 22 Jan 2016 06:40:03 +0900
changeset 310956 23056818e2a5759d863da75aa6e7c9fd104d9350
parent 310955 fa3cde1291744ba44d43ec9790bbf4d13af61b59
child 310957 a50cd2c62d68f1a7710dcb412d251159cefb8a45
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, lizzard
milestone45.0a2
backs out8bbed05c1661a1e4c5936106612c8c713f7e0cd4
Backout changeset 8bbed05c1661 r=bz a=lizzard
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -10690,42 +10690,46 @@ nsDocShell::DoURILoad(nsIURI* aURI,
   nsCOMPtr<nsIWritablePropertyBag2> props(do_QueryInterface(channel));
   if (props) {
     // save true referrer for those who need it (e.g. xpinstall whitelisting)
     // Currently only http and ftp channels support this.
     props->SetPropertyAsInterface(NS_LITERAL_STRING("docshell.internalReferrer"),
                                   aReferrerURI);
   }
 
-  nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(channel));
-  nsCOMPtr<nsIUploadChannel> uploadChannel(do_QueryInterface(channel));
-
-
-  /* Get the cache Key from SH */
-  nsCOMPtr<nsISupports> cacheKey;
-  if (mLSHE) {
-    mLSHE->GetCacheKey(getter_AddRefs(cacheKey));
-  } else if (mOSHE) {  // for reload cases
-    mOSHE->GetCacheKey(getter_AddRefs(cacheKey));
-  }
-
-  if (uploadChannel) {
+  //
+  // If this is a HTTP channel, then set up the HTTP specific information
+  // (ie. POST data, referrer, ...)
+  //
+  if (httpChannel) {
+    nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(httpChannel));
+    /* Get the cache Key from SH */
+    nsCOMPtr<nsISupports> cacheKey;
+    if (mLSHE) {
+      mLSHE->GetCacheKey(getter_AddRefs(cacheKey));
+    } else if (mOSHE) {  // for reload cases
+      mOSHE->GetCacheKey(getter_AddRefs(cacheKey));
+    }
+
     // figure out if we need to set the post data stream on the channel...
     // right now, this is only done for http channels.....
     if (aPostData) {
       // XXX it's a bit of a hack to rewind the postdata stream here but
       // it has to be done in case the post data is being reused multiple
       // times.
       nsCOMPtr<nsISeekableStream> postDataSeekable =
         do_QueryInterface(aPostData);
       if (postDataSeekable) {
         rv = postDataSeekable->Seek(nsISeekableStream::NS_SEEK_SET, 0);
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
+      nsCOMPtr<nsIUploadChannel> uploadChannel(do_QueryInterface(httpChannel));
+      NS_ASSERTION(uploadChannel, "http must support nsIUploadChannel");
+
       // we really need to have a content type associated with this stream!!
       uploadChannel->SetUploadStream(aPostData, EmptyCString(), -1);
       /* If there is a valid postdata *and* it is a History Load,
        * set up the cache key on the channel, to retrieve the
        * data *only* from the cache. If it is a normal reload, the
        * cache is free to go to the server for updated postdata.
        */
       if (cacheChannel && cacheKey) {
@@ -10751,19 +10755,16 @@ nsDocShell::DoURILoad(nsIURI* aURI,
       if (mLoadType == LOAD_HISTORY ||
           mLoadType == LOAD_RELOAD_NORMAL ||
           mLoadType == LOAD_RELOAD_CHARSET_CHANGE) {
         if (cacheChannel && cacheKey) {
           cacheChannel->SetCacheKey(cacheKey);
         }
       }
     }
-  }
-
-  if (httpChannel) {
     if (aHeadersData) {
       rv = AddHeadersToChannel(aHeadersData, httpChannel);
     }
     // Set the referrer explicitly
     if (aReferrerURI && aSendReferrer) {
       // Referrer is currenly only set for link clicks here.
       httpChannel->SetReferrerWithPolicy(aReferrerURI, aReferrerPolicy);
     }