<?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>51457</bug_id>
          
          <creation_ts>2010-12-22 02:47:03 -0800</creation_ts>
          <short_desc>[EFL] Return an empty string instead of &apos;application/octet-stream&apos; in getMIMETypeForExtension()</short_desc>
          <delta_ts>2010-12-24 03:23:38 -0800</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 EFL</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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>1</everconfirmed>
          <reporter name="Gyuyoung Kim">gyuyoung.kim</reporter>
          <assigned_to name="Gyuyoung Kim">gyuyoung.kim</assigned_to>
          <cc>antognolli+webkit</cc>
    
    <cc>commit-queue</cc>
    
    <cc>kenneth</cc>
    
    <cc>leandro</cc>
    
    <cc>lucas.de.marchi</cc>
    
    <cc>tonikitoo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>325429</commentid>
    <comment_count>0</comment_count>
    <who name="Gyuyoung Kim">gyuyoung.kim</who>
    <bug_when>2010-12-22 02:47:03 -0800</bug_when>
    <thetext>WebKit EFL can&apos;t play html5 audio now. I look into WebCore in order to find the reason. When MediaPlayer loads content via url, it checks mediaType with file extension. But, if getMIMETypeForExtension() of MIMETypeRegistryEfl.cpp cannot find same mime type with the extension, it returns &quot;application/octet-stream&quot;.

String MIMETypeRegistry::getMIMETypeForExtension(const String &amp;ext)
{
    String s = ext.lower();
    const ExtensionMap *e = extensionMap;
    while (e-&gt;extension) {
        if (s == e-&gt;extension)
            return e-&gt;mimeType;
        ++e;
    }

    return &quot;application/octet-stream&quot;;
}

But, if the getMIMETypeForExtension() of MIMETypeRegistryEfl.cpp cannot find appropriate mime type, getMIMETypeForExtension() of MIMETypeRegistry.cpp tries to find mime type in mediaMIMETypeMap() of MIMETypeRegistry.cpp.

Unfortunately, HTML5 Audio doesn&apos;t be played in WebKit EFL because getMIMETypeForExtension() of MIMETypeRegistryEfl.cpp returns &quot;application/octet-stream&quot;.

String MIMETypeRegistry::getMediaMIMETypeForExtension(const String&amp; ext)
{
    // Look in the system-specific registry first.
    String type = getMIMETypeForExtension(ext);
    if (!type.isEmpty())
        return type;

    Vector&lt;String&gt;* typeList = mediaMIMETypeMap().get(ext);
    if (typeList)
        return (*typeList)[0];
    
    return String();
}

So, I change the &quot;application/octet-stream&quot; with &quot;String()&quot;. Below demo sites can be worked based on this patch.
 - http://moztw.org/demo/audioplayer/
 - http://www.scottandrew.com/pub/html5audioplayer/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>325430</commentid>
    <comment_count>1</comment_count>
      <attachid>77199</attachid>
    <who name="Gyuyoung Kim">gyuyoung.kim</who>
    <bug_when>2010-12-22 02:54:42 -0800</bug_when>
    <thetext>Created attachment 77199
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>325477</commentid>
    <comment_count>2</comment_count>
    <who name="Antonio Gomes">tonikitoo</who>
    <bug_when>2010-12-22 06:17:28 -0800</bug_when>
    <thetext>Is it what other ports do?

(On the airport now, and can not check myself at the moment)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>325754</commentid>
    <comment_count>3</comment_count>
    <who name="Gyuyoung Kim">gyuyoung.kim</who>
    <bug_when>2010-12-22 16:08:10 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; Is it what other ports do?
&gt; 
&gt; (On the airport now, and can not check myself at the moment)

Yes, other port also tries to find mime type for the extension type. But, if it cannot find mime type, it just returns empty string. Then, if the other port&apos;s getMIMETypeForExtension() returns empty string, the getMediaMIMETypeForExtension() of MIMETypeRegistry.cpp finds a proper mime type in mediaMIMETypeMap() for the extension. (The mediaMIMETypeMap() is defined in MIMETypeRegistry.cpp).

In MIMETypeRegistryGtk.cpp

    String MIMETypeRegistry::getMIMETypeForExtension(const String &amp;ext)
    {
        String s = ext.lower();
        const ExtensionMap *e = extensionMap;
        while (e-&gt;extension) {
            if (s == e-&gt;extension)
                return e-&gt;mimeType;
            ++e;
        }

        return String();
    }

In MIMETypeRegistryQt.cpp

    String MIMETypeRegistry::getMIMETypeForExtension(const String &amp;ext)
    {
        String s = ext.lower();

        const ExtensionMap *e = extensionMap;
        while (e-&gt;extension) {
            if (s == e-&gt;extension)
                return e-&gt;mimeType;
            ++e;
        }

        return String();
    }

In MIMETypeRegistryWinCE.cpp

    String MIMETypeRegistry::getMIMETypeForExtension(const String &amp;ext)
    {
        if (ext.isEmpty())
            return String();

        initMIMETypeEntensionMap();

        String result = mimetypeMap.get(ext.lower());
        if (result.isEmpty()) {
            result = mimeTypeForExtension(ext);
            if (!result.isEmpty())
                mimetypeMap.add(ext, result);
        }
        return result.isEmpty() ? &quot;unknown/unknown&quot; : result;
    }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>325976</commentid>
    <comment_count>4</comment_count>
      <attachid>77199</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2010-12-23 01:16:00 -0800</bug_when>
    <thetext>Comment on attachment 77199
Patch

Tests should be layout tests.  Does EFL run the layout tests yet?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>325991</commentid>
    <comment_count>5</comment_count>
    <who name="Gyuyoung Kim">gyuyoung.kim</who>
    <bug_when>2010-12-23 01:58:09 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; (From update of attachment 77199 [details])
&gt; Tests should be layout tests.  Does EFL run the layout tests yet?

Yes, right. WebKit EFL doesn&apos;t have layout test yet. But, we are preparing to contribute DRT for WebKit EFL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>326010</commentid>
    <comment_count>6</comment_count>
    <who name="Gyuyoung Kim">gyuyoung.kim</who>
    <bug_when>2010-12-23 03:20:07 -0800</bug_when>
    <thetext>Should I remove the test sites in ChangeLog ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>326320</commentid>
    <comment_count>7</comment_count>
      <attachid>77375</attachid>
    <who name="Gyuyoung Kim">gyuyoung.kim</who>
    <bug_when>2010-12-23 15:23:15 -0800</bug_when>
    <thetext>Created attachment 77375
Patch

Remove test sites in ChangeLog</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>326567</commentid>
    <comment_count>8</comment_count>
      <attachid>77375</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-12-24 03:23:31 -0800</bug_when>
    <thetext>Comment on attachment 77375
Patch

Clearing flags on attachment: 77375

Committed r74625: &lt;http://trac.webkit.org/changeset/74625&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>326568</commentid>
    <comment_count>9</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-12-24 03:23:38 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>77199</attachid>
            <date>2010-12-22 02:54:42 -0800</date>
            <delta_ts>2010-12-23 15:23:15 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>patch-mimetype.patch</filename>
            <type>text/plain</type>
            <size>1426</size>
            <attacher name="Gyuyoung Kim">gyuyoung.kim</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
OGEyMjY2My4uYW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CAgUGF2ZWwgRmVsZG1hbiAgPHBmZWxkbWFuQGNocm9taXVtLm9yZz4KIAogICAg
ICAgICBSZXZpZXdlZCBieSBKb3NlcGggUGVjb3Jhcm8uCmRpZmYgLS1naXQgYS9XZWJDb3JlL3Bs
YXRmb3JtL2VmbC9NSU1FVHlwZVJlZ2lzdHJ5RWZsLmNwcCBiL1dlYkNvcmUvcGxhdGZvcm0vZWZs
L01JTUVUeXBlUmVnaXN0cnlFZmwuY3BwCmluZGV4IGI5OGM4MTguLmQwYzk1YmYgMTAwNjQ0Ci0t
LSBhL1dlYkNvcmUvcGxhdGZvcm0vZWZsL01JTUVUeXBlUmVnaXN0cnlFZmwuY3BwCisrKyBiL1dl
YkNvcmUvcGxhdGZvcm0vZWZsL01JTUVUeXBlUmVnaXN0cnlFZmwuY3BwCkBAIC04MCw3ICs4MCw3
IEBAIFN0cmluZyBNSU1FVHlwZVJlZ2lzdHJ5OjpnZXRNSU1FVHlwZUZvckV4dGVuc2lvbihjb25z
dCBTdHJpbmcgJmV4dCkKICAgICAgICAgKytlOwogICAgIH0KIAotICAgIHJldHVybiAiYXBwbGlj
YXRpb24vb2N0ZXQtc3RyZWFtIjsKKyAgICByZXR1cm4gU3RyaW5nKCk7CiB9CiAKIGJvb2wgTUlN
RVR5cGVSZWdpc3RyeTo6aXNBcHBsaWNhdGlvblBsdWdpbk1JTUVUeXBlKGNvbnN0IFN0cmluZyYp
Cg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>77375</attachid>
            <date>2010-12-23 15:23:15 -0800</date>
            <delta_ts>2010-12-24 03:23:31 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>patch-mimetype.patch</filename>
            <type>text/plain</type>
            <size>1346</size>
            <attacher name="Gyuyoung Kim">gyuyoung.kim</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb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