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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>18529</bug_id>
          
          <creation_ts>2012-08-10 18:07:40 +0000</creation_ts>
          <short_desc>Existence of separators in token should throw SyntaxError</short_desc>
          <delta_ts>2012-10-15 18:05:25 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>File API</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</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="Saurabh Anand">saurabhanandiit</reporter>
          <assigned_to name="Arun">arun</assigned_to>
          <cc>jonas</cc>
    
    <cc>Ms2ger</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>72050</commentid>
    <comment_count>0</comment_count>
      <attachid>1173</attachid>
    <who name="Saurabh Anand">saurabhanandiit</who>
    <bug_when>2012-08-10 18:07:40 +0000</bug_when>
    <thetext>Created attachment 1173
Test Case

http://tools.ietf.org/html/rfc2616#section-3.7 says that media-type should be type &quot;/&quot; subtype *( &quot;;&quot; parameter ) , where type and subtype both are tokens. http://tools.ietf.org/html/rfc2616#page-17 says that tokens should not contain CTL&apos;s or separators, hence according to section 4.B.d of http://dev.w3.org/2006/webapi/FileAPI/#slide-method-algo, it should throw a SyntaxError, but it does not.

I feel the spec doesn&apos;t match implementation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72055</commentid>
    <comment_count>1</comment_count>
    <who name="Arun">arun</who>
    <bug_when>2012-08-10 19:04:15 +0000</bug_when>
    <thetext>Cc&apos;ing Jonas for Firefox.

I wonder if mandating throwing is too strict a condition.  It makes sense, but I&apos;d rather not spec. fiction.

Note that the sample needs to be rewritten a bit.  Also, the original reporter should file this bug under Chromium&apos;s bug database and under Mozilla&apos;s bug database (bugzilla.mozilla.org).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72056</commentid>
    <comment_count>2</comment_count>
    <who name="Saurabh Anand">saurabhanandiit</who>
    <bug_when>2012-08-10 19:21:29 +0000</bug_when>
    <thetext>Hi Arun,

(In reply to comment #1)
&gt; Cc&apos;ing Jonas for Firefox.
&gt; 
&gt; I wonder if mandating throwing is too strict a condition.  It makes sense, but
&gt; I&apos;d rather not spec. fiction.
&gt; 
&gt; Note that the sample needs to be rewritten a bit.
Which sample are you referring to ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72060</commentid>
    <comment_count>3</comment_count>
    <who name="Arun">arun</who>
    <bug_when>2012-08-10 20:37:11 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Hi Arun,
&gt; 
&gt; (In reply to comment #1)
&gt; &gt; Cc&apos;ing Jonas for Firefox.
&gt; &gt; 
&gt; &gt; I wonder if mandating throwing is too strict a condition.  It makes sense, but
&gt; &gt; I&apos;d rather not spec. fiction.
&gt; &gt; 
&gt; &gt; Note that the sample needs to be rewritten a bit.
&gt; Which sample are you referring to ?

I meant attachment 1173.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72064</commentid>
    <comment_count>4</comment_count>
    <who name="Saurabh Anand">saurabhanandiit</who>
    <bug_when>2012-08-10 21:29:08 +0000</bug_when>
    <thetext>@Arun, I&apos;ve filed both Chromium (https://code.google.com/p/chromium/issues/detail?id=141922) and Mozilla (https://bugzilla.mozilla.org/show_bug.cgi?id=781896) issues.

What is the improvement that you are suggesting for attachment 1173. It is part of a larger test that I&apos;m writing for the slice method.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72071</commentid>
    <comment_count>5</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-08-11 01:38:53 +0000</bug_when>
    <thetext>I&apos;d rather not get into the business of enforcing correct mimetypes. That rabbit hole can go deep once you start considering that different mimetypes accept different parameters.

I&apos;d rather just treat the mimetype as an opaque string and forward it to whatever API that is using the mimetype. So for example if a page does

xhr = new XMLHttpRequest();
xhr.open(&quot;GET&quot;, URL.createObjectURL(new Blob(..., &quot;;;foopy//&quot;)));
xhr.send();

in this case the XHR code already has to be able to deal with malformed incoming mimetypes since the server could be sending anything. Likewise a page could do


xhr = new XMLHttpRequest();
xhr.open(&quot;GET&quot;, uri);
xhr.send(new Blob(..., &quot;;;foopy//&quot;));

which isn&apos;t that different from a page calling

xhr.setRequestHeader(&quot;Content-Type&quot;, &quot;;;foopy//&quot;);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72082</commentid>
    <comment_count>6</comment_count>
    <who name="Arun">arun</who>
    <bug_when>2012-08-11 23:35:21 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; I&apos;d rather not get into the business of enforcing correct mimetypes. That
&gt; rabbit hole can go deep once you start considering that different mimetypes
&gt; accept different parameters.
&gt; 
&gt; I&apos;d rather just treat the mimetype as an opaque string and forward it to
&gt; whatever API that is using the mimetype. 


So what each API does with mimetypes is actually inconsistent!  I think that by throwing, we make it clear what *this* API does and doesn&apos;t allow.

On the other hand, it does involve parsing mimetype strings; other bugs have been logged showing inconsistency RFC2616.

I&apos;d still rather throw, unless you feel strongly that this is too strong (or of course if you feel strongly that this will never be implemented and that the bug mentioned in Comment 4 will be marked WONTFIX :) )</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72084</commentid>
    <comment_count>7</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-08-12 03:50:36 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; I think that by throwing, we make it clear what *this* API does and doesn&apos;t
&gt; allow.

Can you elaborate on what you mean by this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72085</commentid>
    <comment_count>8</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2012-08-12 07:10:47 +0000</bug_when>
    <thetext>Additional data point: Opera, Chrome and Firefox all fail the exact same tests of &lt;http://w3c-test.org/webapps/FileAPI/tests/submissions/Mozilla/slice.html&gt;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73367</commentid>
    <comment_count>9</comment_count>
    <who name="Arun">arun</who>
    <bug_when>2012-09-06 21:12:21 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; (In reply to comment #6)
&gt; &gt; I think that by throwing, we make it clear what *this* API does and doesn&apos;t
&gt; &gt; allow.
&gt; 
&gt; Can you elaborate on what you mean by this?

I mean simply that we make it clear that you can only coin a valid mimetype string; if you don&apos;t, the application throws.

Should I remove the fiction that we should validly parse for mimetypes (such as http://dev.w3.org/2006/webapi/FileAPI/#dfn-contentTypeBlob) and merely say that it SHOULD be an RFC2616 mimetype?  It&apos;s clear from Comment 8 that implementations don&apos;t respect this anyway.  

I&apos;m disappointed, but can remove it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76321</commentid>
    <comment_count>10</comment_count>
    <who name="Arun">arun</who>
    <bug_when>2012-10-15 18:05:25 +0000</bug_when>
    <thetext>We&apos;ve decided to treat type as an opaque string.  Implementations don&apos;t throw; browser developers are reluctant to throw, and thus validation against the RFC is not useful.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1173</attachid>
            <date>2012-08-10 18:07:40 +0000</date>
            <delta_ts>2012-08-10 18:07:40 +0000</delta_ts>
            <desc>Test Case</desc>
            <filename>Blob-slice.html</filename>
            <type>text/html</type>
            <size>661</size>
            <attacher name="Saurabh Anand">saurabhanandiit</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxtZXRhIGNoYXJzZXQ9dXRmLTg+Cjx0aXRsZT5CbG9iIHNsaWNlPC90
aXRsZT4KPGxpbmsgcmVsPWhlbHAgaHJlZj0iaHR0cDovL2Rldi53My5vcmcvMjAwNi93ZWJhcGkv
RmlsZUFQSS8jc2xpZGUtbWV0aG9kLWFsZ28iPgo8c2NyaXB0IHNyYz0iL3Jlc291cmNlcy90ZXN0
aGFybmVzcy5qcyI+PC9zY3JpcHQ+CjxzY3JpcHQgc3JjPSIvcmVzb3VyY2VzL3Rlc3RoYXJuZXNz
cmVwb3J0LmpzIj48L3NjcmlwdD4KPGRpdiBpZD0ibG9nIj48L2Rpdj4KPHNjcmlwdD4KLy8gRXhw
ZWN0ZWQgUmVzdWx0IDogdHlwZS9zdWJ5cGUgYXJlIHRva2Vucywgd2hpY2ggYXJlIG5vdCBhbGxv
d2VkIHRvIGNvbnNpc3Qgb2Ygc2VwYXJhdG9ycywgYW5kIHNob3VsZCB0aHJvdyBTeW50YXhFcnJv
cgovLyBBY3R1YWwgUmVzdWx0IDogRG9lcyBub3QgdGhyb3cKdGVzdChmdW5jdGlvbigpIHsKICB2
YXIgYmxvYlRlbXAgPSBuZXcgQmxvYihbIlBBU1MiXSk7CiAgYXNzZXJ0X3Rocm93cyhuZXcgU3lu
dGF4RXJyb3IoKSwgZnVuY3Rpb24oKSB7CiAgICBibG9iVGVtcC5zbGljZSgwLCA0LCAidGUoeHQv
cGxhaW4iKTsKICB9KTsKfSwgInR5cGUgY29uc2lzdHMgb2YgYW55IENUTHMgb3Igc2VwYXJhdG9y
cywgdGhyb3cgU3ludGF4RXJyb3IiKTsKPC9zY3JpcHQ+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>