<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>58636</bug_id>
          
          <creation_ts>2011-04-14 23:11:10 -0700</creation_ts>
          <short_desc>Mime type of javascript should be application/javascript</short_desc>
          <delta_ts>2024-03-13 05:17:00 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>UNCONFIRMED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Hao Zheng">zhenghao</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>annevk</cc>
    
    <cc>ap</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>386402</commentid>
    <comment_count>0</comment_count>
    <who name="Hao Zheng">zhenghao</who>
    <bug_when>2011-04-14 23:11:10 -0700</bug_when>
    <thetext>According to rfc4329, http://tools.ietf.org/html/rfc4329#page-10, javascript should have mime-type &apos;application/javascript&apos; instead of &apos;application/x-javascript&apos;. But currently, it seems we all use the latter one. grep the Source dir:

Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp:    { &quot;js&quot;, &quot;application/x-javascript&quot; },
Source/WebCore/loader/cache/CachedScript.cpp:    // and refuse to serve them if we only accept application/x-javascript.
Source/WebCore/platform/brew/MIMETypeRegistryBrew.cpp:    { &quot;js&quot;, &quot;application/x-javascript&quot; },
Source/WebCore/platform/MIMETypeRegistry.cpp:        Mozilla 1.8 accepts application/javascript, application/ecmascript, and application/x-javascript, but WinIE 7 doesn&apos;t.
Source/WebCore/platform/MIMETypeRegistry.cpp:        &quot;application/x-javascript&quot;,
Source/WebCore/platform/wince/MIMETypeRegistryWinCE.cpp:        mimetypeMap.add(&quot;js&quot;, &quot;application/x-javascript&quot;);
Source/WebCore/platform/efl/MIMETypeRegistryEfl.cpp:    { &quot;js&quot;, &quot;application/x-javascript&quot; },
Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp:    { &quot;js&quot;, &quot;application/x-javascript&quot; },
Source/WebCore/platform/wx/MimeTypeRegistryWx.cpp:    { &quot;js&quot;, &quot;application/x-javascript&quot; },
Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp:    { &quot;js&quot;, &quot;application/x-javascript&quot; },
Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp:    { &quot;js&quot;, &quot;application/x-javascript&quot; },
Source/WebCore/platform/win/MIMETypeRegistryWin.cpp:        mimetypeMap.add(&quot;js&quot;, &quot;application/x-javascript&quot;);
Source/WebKit/chromium/webkit/glue/mimetype_unittest.cc:    &quot;application/x-javascript&quot;,
Source/WebKit/chromium/net/base/mime_util.cc:  { &quot;application/x-javascript&quot;, &quot;js&quot; },
Source/WebKit/chromium/net/base/mime_util.cc:// application/x-javascript, but WinIE 7 doesn&apos;t.
Source/WebKit/chromium/net/base/mime_util.cc:  &quot;application/x-javascript&quot;,
Source/WebKit/chromium/net/proxy/proxy_script_fetcher_impl.cc:    &quot;application/x-javascript-config&quot;,
Source/WebKit/chromium/third_party/mongoose/mongoose.c:  {&quot;.js&quot;,   3,  &quot;application/x-javascript&quot;, 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2020002</commentid>
    <comment_count>1</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-03-10 19:31:07 -0700</bug_when>
    <thetext>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 &apos;RESOLVED CONFIGURATION CHANGED&apos;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2020692</commentid>
    <comment_count>2</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2024-03-13 05:17:00 -0700</bug_when>
    <thetext>Platforms might want to map .js to text/javascript these days.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>