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 343082 b29e907e4fbb
parent 343081 3a90f1f64d8d
child 343083 476a938ee2ab
push id31369
push userkwierso@gmail.com
push dateThu, 16 Feb 2017 00:18:40 +0000
treeherdermozilla-central@e9b926463f9e [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.
  */