Bug 1504344 - Remove the pref dom.xhr.lowercase_header.enabled; r=baku
authorThomas Wisniewski <twisniewski@mozilla.com>
Wed, 31 Jul 2019 11:16:25 +0000
changeset 485608 501b7b7bab15ae99db696bdb7701334cd8ada8ee
parent 485607 bac526dab75d49d99d8802cab1c6f88e10d5198e
child 485609 9ddbcd39c9c74fbfc37fc9d745d5e136bf9b0672
push id91352
push usertwisniewski@mozilla.com
push dateWed, 31 Jul 2019 15:47:41 +0000
treeherderautoland@501b7b7bab15 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1504344, 1540688
milestone70.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 1504344 - Remove the pref dom.xhr.lowercase_header.enabled; r=baku Remove the pref dom.xhr.lowercase_header.enabled, as we are unaware of any actionable compat concerns now that bug 1540688 landed, and an ESR had been spun off. Differential Revision: https://phabricator.services.mozilla.com/D39636
dom/xhr/XMLHttpRequestMainThread.cpp
dom/xhr/XMLHttpRequestMainThread.h
modules/libpref/init/all.js
testing/web-platform/meta/xhr/__dir__.ini
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -2964,30 +2964,16 @@ bool XMLHttpRequestMainThread::IsMappedA
     Preferences::AddBoolVarCache(&sIsMappedArrayBufferEnabled,
                                  "dom.mapped_arraybuffer.enabled", true);
     sMappedArrayBufferAdded = true;
   }
 
   return sIsMappedArrayBufferEnabled;
 }
 
-/* static */
-bool XMLHttpRequestMainThread::IsLowercaseResponseHeader() {
-  static bool sLowercaseResponseHeaderAdded = false;
-  static bool sIsLowercaseResponseHeaderEnabled;
-
-  if (!sLowercaseResponseHeaderAdded) {
-    Preferences::AddBoolVarCache(&sIsLowercaseResponseHeaderEnabled,
-                                 "dom.xhr.lowercase_header.enabled", false);
-    sLowercaseResponseHeaderAdded = true;
-  }
-
-  return sIsLowercaseResponseHeaderEnabled;
-}
-
 // http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttprequest-setrequestheader
 void XMLHttpRequestMainThread::SetRequestHeader(const nsACString& aName,
                                                 const nsACString& aValue,
                                                 ErrorResult& aRv) {
   NOT_CALLABLE_IN_SYNC_SEND_RV
 
   // Step 1
   if (mState != XMLHttpRequest_Binding::OPENED) {
@@ -3567,24 +3553,16 @@ void XMLHttpRequestMainThread::TruncateR
 }
 
 NS_IMPL_ISUPPORTS(XMLHttpRequestMainThread::nsHeaderVisitor,
                   nsIHttpHeaderVisitor)
 
 NS_IMETHODIMP XMLHttpRequestMainThread::nsHeaderVisitor::VisitHeader(
     const nsACString& header, const nsACString& value) {
   if (mXHR.IsSafeHeader(header, mHttpChannel)) {
-    if (!IsLowercaseResponseHeader()) {
-      if (!mHeaderList.InsertElementSorted(HeaderEntry(header, value),
-                                           fallible)) {
-        return NS_ERROR_OUT_OF_MEMORY;
-      }
-      return NS_OK;
-    }
-
     nsAutoCString lowerHeader(header);
     ToLowerCase(lowerHeader);
     if (!mHeaderList.InsertElementSorted(HeaderEntry(lowerHeader, value),
                                          fallible)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
   }
   return NS_OK;
--- a/dom/xhr/XMLHttpRequestMainThread.h
+++ b/dom/xhr/XMLHttpRequestMainThread.h
@@ -299,20 +299,16 @@ class XMLHttpRequestMainThread final : p
   bool IsDeniedCrossSiteCORSRequest();
 
   void UnsuppressEventHandlingAndResume();
 
   // Check pref "dom.mapped_arraybuffer.enabled" to make sure ArrayBuffer is
   // supported.
   static bool IsMappedArrayBufferEnabled();
 
-  // Check pref "dom.xhr.lowercase_header.enabled" to make sure lowercased
-  // response header is supported.
-  static bool IsLowercaseResponseHeader();
-
   void MaybeLowerChannelPriority();
 
  public:
   virtual void Send(
       JSContext* aCx,
       const Nullable<
           DocumentOrBlobOrArrayBufferViewOrArrayBufferOrFormDataOrURLSearchParamsOrUSVString>&
           aData,
@@ -521,19 +517,16 @@ class XMLHttpRequestMainThread final : p
       HeaderEntry(const nsACString& aName, const nsACString& aValue)
           : mName(aName), mValue(aValue) {}
 
       bool operator==(const HeaderEntry& aOther) const {
         return mName == aOther.mName;
       }
 
       bool operator<(const HeaderEntry& aOther) const {
-        if (!IsLowercaseResponseHeader()) {
-          return mName < aOther.mName;
-        }
         uint32_t selfLen = mName.Length();
         uint32_t otherLen = aOther.mName.Length();
         uint32_t min = XPCOM_MIN(selfLen, otherLen);
         for (uint32_t i = 0; i < min; ++i) {
           unsigned char self = mName[i];
           unsigned char other = aOther.mName[i];
           MOZ_ASSERT(!(self >= 'A' && self <= 'Z'));
           MOZ_ASSERT(!(other >= 'A' && other <= 'Z'));
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5448,19 +5448,16 @@ pref("toolkit.telemetry.overrideUpdateCh
 #endif
 
 #if defined(XP_WIN)
 // Both this and the master "enabled" pref must be on to use Advanced Layers
 // on Windows 7.
 pref("layers.mlgpu.enable-on-windows7", true);
 #endif
 
-// Enable lowercased response header name
-pref("dom.xhr.lowercase_header.enabled", true);
-
 // Control whether clients.openWindow() opens windows in the same process
 // that called the API vs following our normal multi-process selection
 // algorithm.  Restricting openWindow to same process improves service worker
 // web compat in the short term.  Once the SW multi-e10s refactor is complete
 // this can be removed.
 pref("dom.clients.openwindow_favors_same_process", true);
 
 #ifdef RELEASE_OR_BETA
--- a/testing/web-platform/meta/xhr/__dir__.ini
+++ b/testing/web-platform/meta/xhr/__dir__.ini
@@ -1,1 +1,1 @@
-prefs: [dom.xhr.lowercase_header.enabled:true, javascript.options.streams:true, dom.xhr.standard_content_type_normalization:true]
+prefs: [javascript.options.streams:true, dom.xhr.standard_content_type_normalization:true]