Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: components/mime_util/mime_util.cc

Issue 2135753002: Update supported javascript mimetypes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comment language slightly Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/html/script-allowed-types-languages.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/mime_util/mime_util.h" 5 #include "components/mime_util/mime_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 18 matching lines...) Expand all
29 "image/jpg", 29 "image/jpg",
30 "image/webp", 30 "image/webp",
31 "image/png", 31 "image/png",
32 "image/gif", 32 "image/gif",
33 "image/bmp", 33 "image/bmp",
34 "image/vnd.microsoft.icon", // ico 34 "image/vnd.microsoft.icon", // ico
35 "image/x-icon", // ico 35 "image/x-icon", // ico
36 "image/x-xbitmap", // xbm 36 "image/x-xbitmap", // xbm
37 "image/x-png"}; 37 "image/x-png"};
38 38
39 // Mozilla 1.8 and WinIE 7 both accept text/javascript and text/ecmascript. 39 // Support every script type mentioned in the spec, as it notes that "User
40 // Mozilla 1.8 accepts application/javascript, application/ecmascript, and 40 // agents must recognize all JavaScript MIME types." See
41 // application/x-javascript, but WinIE 7 doesn't. 41 // https://html.spec.whatwg.org/#javascript-mime-type.
42 // WinIE 7 accepts text/javascript1.1 - text/javascript1.3, text/jscript, and 42 const char* const kSupportedJavascriptTypes[] = {
43 // text/livescript, but Mozilla 1.8 doesn't. 43 "application/ecmascript",
44 // Mozilla 1.8 allows leading and trailing whitespace, but WinIE 7 doesn't. 44 "application/javascript",
45 // Mozilla 1.8 and WinIE 7 both accept the empty string, but neither accept a 45 "application/x-ecmascript",
46 // whitespace-only string. 46 "application/x-javascript",
47 // We want to accept all the values that either of these browsers accept, but 47 "text/ecmascript",
48 // not other values. 48 "text/javascript",
49 const char* const kSupportedJavascriptTypes[] = {"text/javascript", 49 "text/javascript1.0",
50 "text/ecmascript", 50 "text/javascript1.1",
51 "application/javascript", 51 "text/javascript1.2",
52 "application/ecmascript", 52 "text/javascript1.3",
53 "application/x-javascript", 53 "text/javascript1.4",
54 "text/javascript1.1", 54 "text/javascript1.5",
55 "text/javascript1.2", 55 "text/jscript",
56 "text/javascript1.3", 56 "text/livescript",
57 "text/jscript", 57 "text/x-ecmascript",
58 "text/livescript"}; 58 "text/x-javascript",
59 };
59 60
60 // These types are excluded from the logic that allows all text/ types because 61 // These types are excluded from the logic that allows all text/ types because
61 // while they are technically text, it's very unlikely that a user expects to 62 // while they are technically text, it's very unlikely that a user expects to
62 // see them rendered in text form. 63 // see them rendered in text form.
63 static const char* const kUnsupportedTextTypes[] = { 64 static const char* const kUnsupportedTextTypes[] = {
64 "text/calendar", 65 "text/calendar",
65 "text/x-calendar", 66 "text/x-calendar",
66 "text/x-vcalendar", 67 "text/x-vcalendar",
67 "text/vcalendar", 68 "text/vcalendar",
68 "text/vcard", 69 "text/vcard",
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 194
194 bool IsSupportedJavascriptMimeType(const std::string& mime_type) { 195 bool IsSupportedJavascriptMimeType(const std::string& mime_type) {
195 return g_mime_util.Get().IsSupportedJavascriptMimeType(mime_type); 196 return g_mime_util.Get().IsSupportedJavascriptMimeType(mime_type);
196 } 197 }
197 198
198 bool IsSupportedMimeType(const std::string& mime_type) { 199 bool IsSupportedMimeType(const std::string& mime_type) {
199 return g_mime_util.Get().IsSupportedMimeType(mime_type); 200 return g_mime_util.Get().IsSupportedMimeType(mime_type);
200 } 201 }
201 202
202 } // namespace mime_util 203 } // namespace mime_util
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/html/script-allowed-types-languages.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698