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

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: Fix another layout test 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 // Firefox 47 accepts all of the values in
asanka 2016/07/08 22:52:09 At this point we should be keeping this list in sy
Charlie Harrison 2016/07/11 14:43:32 Is the link to the whatwg spec not sufficient here
asanka 2016/07/11 14:52:39 Yup. That's sufficient. To clarify, I was referri
40 // Mozilla 1.8 accepts application/javascript, application/ecmascript, and 40 // https://html.spec.whatwg.org/#javascript-mime-type, so we should too.
41 // application/x-javascript, but WinIE 7 doesn't.
42 // WinIE 7 accepts text/javascript1.1 - text/javascript1.3, text/jscript, and
43 // text/livescript, but Mozilla 1.8 doesn't.
44 // Mozilla 1.8 allows leading and trailing whitespace, but WinIE 7 doesn't.
45 // Mozilla 1.8 and WinIE 7 both accept the empty string, but neither accept a
46 // whitespace-only string.
47 // We want to accept all the values that either of these browsers accept, but
48 // not other values.
49 const char* const kSupportedJavascriptTypes[] = {"text/javascript", 41 const char* const kSupportedJavascriptTypes[] = {"text/javascript",
asanka 2016/07/08 22:52:09 Sort to match spec.
Charlie Harrison 2016/07/11 14:43:32 Done.
50 "text/ecmascript", 42 "text/ecmascript",
51 "application/javascript", 43 "application/javascript",
52 "application/ecmascript", 44 "application/ecmascript",
53 "application/x-javascript", 45 "application/x-javascript",
46 "application/x-ecmascript",
47 "text/javascript1.0",
54 "text/javascript1.1", 48 "text/javascript1.1",
55 "text/javascript1.2", 49 "text/javascript1.2",
56 "text/javascript1.3", 50 "text/javascript1.3",
51 "text/javascript1.4",
52 "text/javascript1.5",
57 "text/jscript", 53 "text/jscript",
58 "text/livescript"}; 54 "text/livescript",
55 "text/x-ecmascript",
56 "text/x-javascript"};
59 57
60 // These types are excluded from the logic that allows all text/ types because 58 // 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 59 // while they are technically text, it's very unlikely that a user expects to
62 // see them rendered in text form. 60 // see them rendered in text form.
63 static const char* const kUnsupportedTextTypes[] = { 61 static const char* const kUnsupportedTextTypes[] = {
64 "text/calendar", 62 "text/calendar",
65 "text/x-calendar", 63 "text/x-calendar",
66 "text/x-vcalendar", 64 "text/x-vcalendar",
67 "text/vcalendar", 65 "text/vcalendar",
68 "text/vcard", 66 "text/vcard",
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 191
194 bool IsSupportedJavascriptMimeType(const std::string& mime_type) { 192 bool IsSupportedJavascriptMimeType(const std::string& mime_type) {
195 return g_mime_util.Get().IsSupportedJavascriptMimeType(mime_type); 193 return g_mime_util.Get().IsSupportedJavascriptMimeType(mime_type);
196 } 194 }
197 195
198 bool IsSupportedMimeType(const std::string& mime_type) { 196 bool IsSupportedMimeType(const std::string& mime_type) {
199 return g_mime_util.Get().IsSupportedMimeType(mime_type); 197 return g_mime_util.Get().IsSupportedMimeType(mime_type);
200 } 198 }
201 199
202 } // namespace mime_util 200 } // 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