Bug 1337737 - Make lookup of MDN headers case-insensitive. r=Honza
authorEduardo Boucas <mail@eduardoboucas.com>
Thu, 09 Feb 2017 20:51:06 +0000
changeset 342993 b29e907e4fbb
parent 342992 3a90f1f64d8d
child 342994 476a938ee2ab
push id87010
push usercbook@mozilla.com
push dateWed, 15 Feb 2017 14:34:23 +0000
treeherdermozilla-inbound@b29e907e4fbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1337737
milestone54.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 1337737 - Make lookup of MDN headers case-insensitive. r=Honza
devtools/client/netmonitor/shared/components/headers-mdn.js
--- a/devtools/client/netmonitor/shared/components/headers-mdn.js
+++ b/devtools/client/netmonitor/shared/components/headers-mdn.js
@@ -86,21 +86,27 @@ var SUPPORTED_HEADERS = [
  *
  * @param {string} Name of the header
  * The baseURL to use.
  *
  * @return {string}
  * The MDN URL for the header, or null if not available.
  */
 exports.getURL = (header) => {
-  if (SUPPORTED_HEADERS.indexOf(header) === -1) {
+  const lowerCaseHeader = header.toLowerCase();
+
+  let matchingHeader = SUPPORTED_HEADERS.find(supportedHeader => {
+    return lowerCaseHeader === supportedHeader.toLowerCase();
+  });
+
+  if (!matchingHeader) {
     return null;
   }
 
-  return URL_DOMAIN + URL_PATH + header + URL_PARAMS;
+  return URL_DOMAIN + URL_PATH + matchingHeader + URL_PARAMS;
 };
 
 /**
  * Use a different domain for the URLs. Used only for testing.
  *
  * @param {string} domain
  * The domain to use.
  */