WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
UNCONFIRMED
58636
Mime type of javascript should be application/javascript
https://bugs.webkit.org/show_bug.cgi?id=58636
Summary
Mime type of javascript should be application/javascript
Hao Zheng
Reported
2011-04-14 23:11:10 PDT
According to rfc4329,
http://tools.ietf.org/html/rfc4329#page-10
, javascript should have mime-type 'application/javascript' instead of 'application/x-javascript'. But currently, it seems we all use the latter one. grep the Source dir: Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp: { "js", "application/x-javascript" }, Source/WebCore/loader/cache/CachedScript.cpp: // and refuse to serve them if we only accept application/x-javascript. Source/WebCore/platform/brew/MIMETypeRegistryBrew.cpp: { "js", "application/x-javascript" }, Source/WebCore/platform/MIMETypeRegistry.cpp: Mozilla 1.8 accepts application/javascript, application/ecmascript, and application/x-javascript, but WinIE 7 doesn't. Source/WebCore/platform/MIMETypeRegistry.cpp: "application/x-javascript", Source/WebCore/platform/wince/MIMETypeRegistryWinCE.cpp: mimetypeMap.add("js", "application/x-javascript"); Source/WebCore/platform/efl/MIMETypeRegistryEfl.cpp: { "js", "application/x-javascript" }, Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp: { "js", "application/x-javascript" }, Source/WebCore/platform/wx/MimeTypeRegistryWx.cpp: { "js", "application/x-javascript" }, Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp: { "js", "application/x-javascript" }, Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp: { "js", "application/x-javascript" }, Source/WebCore/platform/win/MIMETypeRegistryWin.cpp: mimetypeMap.add("js", "application/x-javascript"); Source/WebKit/chromium/webkit/glue/mimetype_unittest.cc: "application/x-javascript", Source/WebKit/chromium/net/base/mime_util.cc: { "application/x-javascript", "js" }, Source/WebKit/chromium/net/base/mime_util.cc:// application/x-javascript, but WinIE 7 doesn't. Source/WebKit/chromium/net/base/mime_util.cc: "application/x-javascript", Source/WebKit/chromium/net/proxy/proxy_script_fetcher_impl.cc: "application/x-javascript-config", Source/WebKit/chromium/third_party/mongoose/mongoose.c: {".js", 3, "application/x-javascript", 24}, And layout test fast/preloader/scan-body-from-head-script.html can comfirm this. It seems only chromium-linux has rebaselined this. LayoutTests/platform/chromium-linux/fast/preloader/script-expected.txt:script1.js has MIME type application/javascript LayoutTests/platform/chromium-linux/fast/preloader/scan-body-from-head-script-expected.txt:script1.js has MIME type application/javascript
Attachments
Add attachment
proposed patch, testcase, etc.
Ahmad Saleem
Comment 1
2024-03-10 19:31:07 PDT
Only references:
https://searchfox.org/wubkat/rev/c67bb750f2c1083399f0dbe7d08b416cd45eee34/Source/WebCore/platform/MIMETypeRegistry.cpp#181
Which is coming from:
https://mimesniff.spec.whatwg.org/#javascript-mime-type
Two more for platform specific MIME:
https://searchfox.org/wubkat/rev/c67bb750f2c1083399f0dbe7d08b416cd45eee34/Source/WebCore/platform/playstation/MIMETypeRegistryPlayStation.cpp#42
and
https://searchfox.org/wubkat/rev/c67bb750f2c1083399f0dbe7d08b416cd45eee34/Source/WebCore/platform/win/MIMETypeRegistryWin.cpp#85
___ Rest is in API Test. Although we do have few Layout Tests using this. @Anne - anything to do here or we can mark this as 'RESOLVED CONFIGURATION CHANGED'.
Anne van Kesteren
Comment 2
2024-03-13 05:17:00 PDT
Platforms might want to map .js to text/javascript these days.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug