Commit f8d8988a authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Net] Update MIME type for .js files

According to https://html.spec.whatwg.org/multipage/scripting.html#scriptingLanguages,
JS files should have a MIME type of text/javascript. Update our mappings.

Bug: 857588

Change-Id: I6c9ce8c52a3e6afcb8768392b59e766a0db3b5c5
Reviewed-on: https://chromium-review.googlesource.com/1117564
Commit-Queue: Asanka Herath <asanka@chromium.org>
Reviewed-by: default avatarAsanka Herath <asanka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571472}
parent f75b418b
...@@ -747,8 +747,7 @@ TEST_P(ExtensionProtocolsTest, MimeTypesForKnownFiles) { ...@@ -747,8 +747,7 @@ TEST_P(ExtensionProtocolsTest, MimeTypesForKnownFiles) {
const char* file_name; const char* file_name;
const char* expected_mime_type; const char* expected_mime_type;
} test_cases[] = { } test_cases[] = {
{"json_file.json", "application/json"}, {"json_file.json", "application/json"}, {"js_file.js", "text/javascript"},
{"js_file.js", "application/javascript"},
}; };
for (const auto& test_case : test_cases) { for (const auto& test_case : test_cases) {
......
...@@ -80,7 +80,6 @@ static const MimeInfo kPrimaryMappings[] = { ...@@ -80,7 +80,6 @@ static const MimeInfo kPrimaryMappings[] = {
// Must precede audio/webm . // Must precede audio/webm .
{"video/webm", "webm"}, {"video/webm", "webm"},
{"application/javascript", "js"},
{"application/wasm", "wasm"}, {"application/wasm", "wasm"},
{"application/x-chrome-extension", "crx"}, {"application/x-chrome-extension", "crx"},
{"application/xhtml+xml", "xhtml,xht,xhtm"}, {"application/xhtml+xml", "xhtml,xht,xhtm"},
...@@ -98,6 +97,7 @@ static const MimeInfo kPrimaryMappings[] = { ...@@ -98,6 +97,7 @@ static const MimeInfo kPrimaryMappings[] = {
{"multipart/related", "mht,mhtml"}, {"multipart/related", "mht,mhtml"},
{"text/css", "css"}, {"text/css", "css"},
{"text/html", "html,htm,shtml,shtm"}, {"text/html", "html,htm,shtml,shtm"},
{"text/javascript", "js"},
{"text/xml", "xml"}, {"text/xml", "xml"},
{"video/mp4", "mp4,m4v"}, {"video/mp4", "mp4,m4v"},
{"video/ogg", "ogv,ogm"}, {"video/ogg", "ogv,ogm"},
...@@ -110,6 +110,7 @@ static const MimeInfo kSecondaryMappings[] = { ...@@ -110,6 +110,7 @@ static const MimeInfo kSecondaryMappings[] = {
{"application/epub+zip", "epub"}, {"application/epub+zip", "epub"},
{"application/font-woff", "woff"}, {"application/font-woff", "woff"},
{"application/gzip", "gz,tgz"}, {"application/gzip", "gz,tgz"},
{"application/javascript", "js"},
{"application/json", "json"}, // Per http://www.ietf.org/rfc/rfc4627.txt. {"application/json", "json"}, // Per http://www.ietf.org/rfc/rfc4627.txt.
{"application/octet-stream", "bin,exe,com"}, {"application/octet-stream", "bin,exe,com"},
{"application/pdf", "pdf"}, {"application/pdf", "pdf"},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment