Bug 382383 - nsDocShell::LoadURI discards LOAD_FLAGS_FIRST_LOAD. r=bzbarsky, sr=cbiesinger
authorsdwilsh@shawnwilsher.com
Sun, 10 Jun 2007 16:28:27 -0700
changeset 2235 3d35cb04e2c002f65976e4bc36b4f28a95e9ed43
parent 2234 660810e17b4253f06f186a79e242a0130b891572
child 2236 860bfdb032d0eef7e703c6b0af1fe88e203424fd
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky, cbiesinger
bugs382383
milestone1.9a6pre
Bug 382383 - nsDocShell::LoadURI discards LOAD_FLAGS_FIRST_LOAD. r=bzbarsky, sr=cbiesinger
docshell/base/nsDocShell.cpp
docshell/base/nsDocShellLoadTypes.h
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -2762,34 +2762,33 @@ nsDocShell::LoadURI(const PRUnichar * aU
 
     if (NS_ERROR_MALFORMED_URI == rv) {
         DisplayLoadError(rv, uri, aURI);
     }
 
     if (NS_FAILED(rv) || !uri)
         return NS_ERROR_FAILURE;
 
-    // Don't pass the fixup flag to MAKE_LOAD_TYPE, since it isn't needed and
-    // confuses ConvertLoadTypeToDocShellLoadInfo. We do need to ensure that
-    // it is passed to LoadURI though, since it uses it to determine whether it
-    // can do fixup.
-    PRUint32 fixupFlag = (aLoadFlags & LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP);
-    aLoadFlags &= ~LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
+    // Don't pass certain flags that aren't needed and end up confusing
+    // ConvertLoadTypeToDocShellLoadInfo.  We do need to ensure that they are
+    // passed to LoadURI though, since it uses them.
+    PRUint32 extraFlags = (aLoadFlags & EXTRA_LOAD_FLAGS);
+    aLoadFlags &= ~EXTRA_LOAD_FLAGS;
 
     nsCOMPtr<nsIDocShellLoadInfo> loadInfo;
     rv = CreateLoadInfo(getter_AddRefs(loadInfo));
     if (NS_FAILED(rv)) return rv;
     
     PRUint32 loadType = MAKE_LOAD_TYPE(LOAD_NORMAL, aLoadFlags);
     loadInfo->SetLoadType(ConvertLoadTypeToDocShellLoadInfo(loadType));
     loadInfo->SetPostDataStream(aPostStream);
     loadInfo->SetReferrer(aReferringURI);
     loadInfo->SetHeadersStream(aHeaderStream);
 
-    rv = LoadURI(uri, loadInfo, fixupFlag, PR_TRUE);
+    rv = LoadURI(uri, loadInfo, extraFlags, PR_TRUE);
 
     return rv;
 }
 
 NS_IMETHODIMP
 nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI,
                              const PRUnichar *aURL,
                              nsIChannel* aFailedChannel)
--- a/docshell/base/nsDocShellLoadTypes.h
+++ b/docshell/base/nsDocShellLoadTypes.h
@@ -50,16 +50,23 @@
  * Load flag for error pages. This should be bigger than all flags on
  * nsIWebNavigation.
  */
 #define LOAD_FLAGS_ERROR_PAGE 0x8000U
 
 #define MAKE_LOAD_TYPE(type, flags) ((type) | ((flags) << 16))
 #define LOAD_TYPE_HAS_FLAGS(type, flags) ((type) & ((flags) << 16))
 
+/**
+ * These are flags that confuse ConvertLoadTypeToDocShellLoadInfo and should not
+ * be passed to MAKE_LOAD_TYPE.
+ */
+#define EXTRA_LOAD_FLAGS (LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP | \
+                          LOAD_FLAGS_FIRST_LOAD)
+
 /* load types are legal combinations of load commands and flags 
  *  
  * NOTE:
  *  Remember to update the IsValidLoadType function below if you change this
  *  enum to ensure bad flag combinations will be rejected.
  */
 enum LoadType {
     LOAD_NORMAL = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_NONE),