Bug 1348036 - Add a hidden permission for making all document loads act like Large-Allocation loads for manual testing, r=smaug
authorMichael Layzell <michael@thelayzells.com>
Thu, 16 Mar 2017 14:26:13 -0400
changeset 348184 4073a0ab8f399e6bf47d0d84bcebe08efafa7568
parent 348183 126828c05e0838795debf813cac591bf0ea5ecd5
child 348185 341125a09b1309ca9a11fdff2cd3804706ba146f
push id39092
push userkwierso@gmail.com
push dateFri, 17 Mar 2017 18:14:05 +0000
treeherderautoland@88576fd417e7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1348036
milestone55.0a1
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
Bug 1348036 - Add a hidden permission for making all document loads act like Large-Allocation loads for manual testing, r=smaug MozReview-Commit-ID: DIMb0a3TJi9
uriloader/base/nsURILoader.cpp
--- a/uriloader/base/nsURILoader.cpp
+++ b/uriloader/base/nsURILoader.cpp
@@ -232,25 +232,43 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnStar
     }
 
     LOG(("  HTTP response status: %d", responseCode));
 
     if (204 == responseCode || 205 == responseCode) {
       return NS_BINDING_ABORTED;
     }
 
+    static bool sLargeAllocationTestingAllHttpLoads = false;
     static bool sLargeAllocationHeaderEnabled = false;
     static bool sCachedLargeAllocationPref = false;
     if (!sCachedLargeAllocationPref) {
       sCachedLargeAllocationPref = true;
       mozilla::Preferences::AddBoolVarCache(&sLargeAllocationHeaderEnabled,
                                             "dom.largeAllocationHeader.enabled");
+      mozilla::Preferences::AddBoolVarCache(&sLargeAllocationTestingAllHttpLoads,
+                                            "dom.largeAllocation.testing.allHttpLoads");
     }
 
     if (sLargeAllocationHeaderEnabled) {
+      if (sLargeAllocationTestingAllHttpLoads) {
+        nsCOMPtr<nsIURI> uri;
+        rv = httpChannel->GetURI(getter_AddRefs(uri));
+        if (NS_SUCCEEDED(rv) && uri) {
+          bool httpScheme = false;
+          bool httpsScheme = false;
+          uri->SchemeIs("http", &httpScheme);
+          uri->SchemeIs("https", &httpsScheme);
+          if ((httpScheme || httpsScheme) &&
+              nsContentUtils::AttemptLargeAllocationLoad(httpChannel)) {
+            return NS_BINDING_ABORTED;
+          }
+        }
+      }
+
       // If we have a Large-Allocation header, let's check if we should perform a process switch.
       nsAutoCString largeAllocationHeader;
       rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Large-Allocation"), largeAllocationHeader);
       if (NS_SUCCEEDED(rv) && nsContentUtils::AttemptLargeAllocationLoad(httpChannel)) {
         return NS_BINDING_ABORTED;
       }
     }
   }