Bug 1343888 – Add more MDN HTTP pages to mdn-utils.js; r=Honza
authorFlorian Scholz <fscholz@mozilla.com>
Thu, 02 Mar 2017 10:59:00 +0100
changeset 374843 c3e6f013c7718a829dbd34f2941708fb86bca4b5
parent 374842 b9f1821ed5111b515912051c692d98bace3b2943
child 374844 4dbbd735c27d7a4a2968c819c5022d31e71b2dc8
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1343888
milestone54.0a1
Bug 1343888 – Add more MDN HTTP pages to mdn-utils.js; r=Honza
devtools/client/netmonitor/utils/mdn-utils.js
--- a/devtools/client/netmonitor/utils/mdn-utils.js
+++ b/devtools/client/netmonitor/utils/mdn-utils.js
@@ -18,119 +18,158 @@ const SUPPORTED_HEADERS = [
   "Access-Control-Allow-Headers",
   "Access-Control-Allow-Methods",
   "Access-Control-Allow-Origin",
   "Access-Control-Expose-Headers",
   "Access-Control-Max-Age",
   "Access-Control-Request-Headers",
   "Access-Control-Request-Method",
   "Age",
+  "Allow",
+  "Authorization",
   "Cache-Control",
   "Connection",
   "Content-Disposition",
   "Content-Encoding",
   "Content-Language",
   "Content-Length",
   "Content-Location",
+  "Content-Range",
   "Content-Security-Policy",
   "Content-Security-Policy-Report-Only",
   "Content-Type",
   "Cookie",
   "Cookie2",
   "DNT",
   "Date",
   "ETag",
+  "Expect",
   "Expires",
+  "Forwarded",
   "From",
   "Host",
   "If-Match",
   "If-Modified-Since",
   "If-None-Match",
   "If-Range",
   "If-Unmodified-Since",
   "Keep-Alive",
+  "Large-Allocation",
   "Last-Modified",
   "Location",
   "Origin",
   "Pragma",
+  "Proxy-Authenticate",
+  "Proxy-Authorization",
   "Public-Key-Pins",
   "Public-Key-Pins-Report-Only",
+  "Range",
   "Referer",
   "Referrer-Policy",
   "Retry-After",
   "Server",
   "Set-Cookie",
   "Set-Cookie2",
   "Strict-Transport-Security",
   "TE",
   "Tk",
   "Trailer",
   "Transfer-Encoding",
   "Upgrade-Insecure-Requests",
   "User-Agent",
   "Vary",
   "Via",
+  "WWW-Authenticate",
   "Warning",
   "X-Content-Type-Options",
   "X-DNS-Prefetch-Control",
+  "X-Forwarded-For",
+  "X-Forwarded-Host",
+  "X-Forwarded-Proto",
   "X-Frame-Options",
   "X-XSS-Protection"
 ];
 
 /**
  * A mapping of HTTP status codes to external documentation. Any code included
  * here will show a MDN link alongside it.
  */
 const SUPPORTED_HTTP_CODES = [
     "100",
+    "101",
     "200",
     "201",
+    "202",
+    "203",
     "204",
+    "205",
     "206",
+    "300",
     "301",
     "302",
     "303",
     "304",
     "307",
     "308",
+    "400",
+    "401",
+    "403",
     "404",
+    "405",
     "406",
+    "407",
+    "408",
+    "409",
     "410",
+    "411",
     "412",
+    "413",
+    "414",
+    "415",
+    "416",
+    "417",
+    "426",
+    "428",
+    "429",
+    "431",
     "451",
     "500",
     "501",
     "502",
     "503",
-    "504"
+    "504",
+    "505",
+    "511"
 ];
 
+const GA_PARAMS = "?utm_source=mozilla&utm_medium=devtools-netmonitor&utm_campaign=default";
+
 /**
  * Get the MDN URL for the specified header.
  *
  * @param {string} header Name of the header for the baseURL to use.
  *
  * @return {string} The MDN URL for the header, or null if not available.
  */
 function getHeadersURL(header) {
   const lowerCaseHeader = header.toLowerCase();
   let idx = SUPPORTED_HEADERS.findIndex(item =>
     item.toLowerCase() === lowerCaseHeader);
   return idx > -1 ?
-    `https://developer.mozilla.org/docs/Web/HTTP/Headers/${SUPPORTED_HEADERS[idx]}?utm_source=mozilla&utm_medium=devtools-netmonitor&utm_campaign=default` : null;
+    `https://developer.mozilla.org/docs/Web/HTTP/Headers/${SUPPORTED_HEADERS[idx] + GA_PARAMS}` : null;
 }
 
 /**
  * Get the MDN URL for the specified HTTP status code.
  *
  * @param {string} HTTP status code for the baseURL to use.
  *
  * @return {string} The MDN URL for the HTTP status code, or null if not available.
  */
 function getHTTPStatusCodeURL(statusCode) {
   let idx = SUPPORTED_HTTP_CODES.indexOf(statusCode);
-  return idx > -1 ? `https://developer.mozilla.org/docs/Web/HTTP/Status/${SUPPORTED_HTTP_CODES[idx]}` : null;
+  return idx > -1 ? `https://developer.mozilla.org/docs/Web/HTTP/Status/${SUPPORTED_HTTP_CODES[idx] + GA_PARAMS}` : null;
 }
 
 module.exports = {
   getHeadersURL,
   getHTTPStatusCodeURL,
 };