<?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>46544</bug_id>
          
          <creation_ts>2010-09-24 17:59:32 -0700</creation_ts>
          <short_desc>Fix event sequencing in FileWriter</short_desc>
          <delta_ts>2010-09-27 21:28:14 -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>DOM</component>
          <version>528+ (Nightly build)</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>Enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>44358</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Eric U.">ericu</reporter>
          <assigned_to name="Eric U.">ericu</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>kinuko</cc>
    
    <cc>levin</cc>
    
    <cc>michaeln</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>284881</commentid>
    <comment_count>0</comment_count>
    <who name="Eric U.">ericu</who>
    <bug_when>2010-09-24 17:59:32 -0700</bug_when>
    <thetext>There are a couple of problems there.  Some of the progress events are synchronous, and should really be asynchronous.  The variable readyState is set too early [see info at http://lists.w3.org/Archives/Public/public-webapps/2010JulSep/1045.html].</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>284883</commentid>
    <comment_count>1</comment_count>
      <attachid>68796</attachid>
    <who name="Eric U.">ericu</who>
    <bug_when>2010-09-24 18:08:23 -0700</bug_when>
    <thetext>Created attachment 68796
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>284969</commentid>
    <comment_count>2</comment_count>
      <attachid>68796</attachid>
    <who name="Kinuko Yasuda">kinuko</who>
    <bug_when>2010-09-25 01:16:49 -0700</bug_when>
    <thetext>Comment on attachment 68796
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=68796&amp;action=review

LGTM.

&gt; WebCore/fileapi/FileWriter.cpp:172
&gt; +    fireEvent(eventNames().writestartEvent);

hmm... so we fire all of three events when it&apos;s finished. ok (seems like it conforms to the spec).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>285288</commentid>
    <comment_count>3</comment_count>
      <attachid>68796</attachid>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-09-26 21:25:56 -0700</bug_when>
    <thetext>Comment on attachment 68796
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=68796&amp;action=review

We really need testing for this code / these patches.

&gt; WebCore/ChangeLog:13
&gt; +        No new tests, as none of this is fully implemented yet.

What does that mean?  It&apos;s too bad we can&apos;t test these patches.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>285295</commentid>
    <comment_count>4</comment_count>
    <who name="Eric U.">ericu</who>
    <bug_when>2010-09-26 21:35:56 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (From update of attachment 68796 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=68796&amp;action=review
&gt; 
&gt; We really need testing for this code / these patches.
&gt; 
&gt; &gt; WebCore/ChangeLog:13
&gt; &gt; +        No new tests, as none of this is fully implemented yet.
&gt; 
&gt; What does that mean?  It&apos;s too bad we can&apos;t test these patches.

It means that I&apos;m tweaking code that makes up only part of a feature, and we can&apos;t really test it until I put in the rest of the feature.  None of this is exposed yet, and it needs an implementation of AsyncFileWriter to do most of its work.

It could theoretically be unit-tested by making a mock AsyncFileWriter backend, but I was planning just to use layout tests once I got the real thing in [which should be quite soon].  That&apos;s the webkit way of doing the testing, right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>285865</commentid>
    <comment_count>5</comment_count>
    <who name="David Levin">levin</who>
    <bug_when>2010-09-27 16:28:47 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; (In reply to comment #3)
&gt; &gt; (From update of attachment 68796 [details] [details])
&gt; &gt; View in context: https://bugs.webkit.org/attachment.cgi?id=68796&amp;action=review
&gt; &gt; 
&gt; &gt; We really need testing for this code / these patches.
&gt; &gt; 
&gt; &gt; &gt; WebCore/ChangeLog:13
&gt; &gt; &gt; +        No new tests, as none of this is fully implemented yet.
&gt; &gt; 
&gt; &gt; What does that mean?  It&apos;s too bad we can&apos;t test these patches.
&gt; 
&gt; It means that I&apos;m tweaking code that makes up only part of a feature, and we can&apos;t really test it until I put in the rest of the feature.  None of this is exposed yet, and it needs an implementation of AsyncFileWriter to do most of its work.
&gt; 
&gt; It could theoretically be unit-tested by making a mock AsyncFileWriter backend, but I was planning just to use layout tests once I got the real thing in [which should be quite soon].  That&apos;s the webkit way of doing the testing, right?

It is sort of. However with complicated features it is easy to do some minimal testing at the end (but it would have been much greater if the testing had been added as the code went along -- I&apos;m guilty here as well).

Is it possible to add a disabled test that would verify this if the functionality were working?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>285876</commentid>
    <comment_count>6</comment_count>
    <who name="Eric U.">ericu</who>
    <bug_when>2010-09-27 16:40:45 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; (In reply to comment #3)
&gt; &gt; &gt; (From update of attachment 68796 [details] [details] [details])
&gt; &gt; &gt; View in context: https://bugs.webkit.org/attachment.cgi?id=68796&amp;action=review
&gt; &gt; &gt; 
&gt; &gt; &gt; We really need testing for this code / these patches.
&gt; &gt; &gt; 
&gt; &gt; &gt; &gt; WebCore/ChangeLog:13
&gt; &gt; &gt; &gt; +        No new tests, as none of this is fully implemented yet.
&gt; &gt; &gt; 
&gt; &gt; &gt; What does that mean?  It&apos;s too bad we can&apos;t test these patches.
&gt; &gt; 
&gt; &gt; It means that I&apos;m tweaking code that makes up only part of a feature, and we can&apos;t really test it until I put in the rest of the feature.  None of this is exposed yet, and it needs an implementation of AsyncFileWriter to do most of its work.
&gt; &gt; 
&gt; &gt; It could theoretically be unit-tested by making a mock AsyncFileWriter backend, but I was planning just to use layout tests once I got the real thing in [which should be quite soon].  That&apos;s the webkit way of doing the testing, right?
&gt; 
&gt; It is sort of. However with complicated features it is easy to do some minimal testing at the end (but it would have been much greater if the testing had been added as the code went along -- I&apos;m guilty here as well).
&gt; 
&gt; Is it possible to add a disabled test that would verify this if the functionality were working?

Well, of course it&apos;s possible ;&apos;&gt;.  The API is defined in the spec, so I could write any number of FileWriter and FileSystem layout tests based on that and disable them all.  But then we&apos;d have a bunch of code that wasn&apos;t getting run, and could rot by the time it was ready to be turned on.  These APIs are unfortunately changing as we implement them and run into bits that don&apos;t quite work in the spec.  I think it may be premature to write the tests before we have even a single port implementing them.

I expect to have both the Chromium and WebCore ports implemented within the next couple of months, though, and the Chromium one will have at least part of its functionality within a couple of weeks [for M8].  How would you feel about me adding the first test once I&apos;ve got one port that could run it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>285883</commentid>
    <comment_count>7</comment_count>
      <attachid>68796</attachid>
    <who name="Eric U.">ericu</who>
    <bug_when>2010-09-27 16:45:17 -0700</bug_when>
    <thetext>Comment on attachment 68796
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=68796&amp;action=review

&gt;&gt; WebCore/fileapi/FileWriter.cpp:172
&gt;&gt; +    fireEvent(eventNames().writestartEvent);
&gt; 
&gt; hmm... so we fire all of three events when it&apos;s finished. ok (seems like it conforms to the spec).

Yeah, a truncate is sort of an all-at-once operation, so as soon as we know it&apos;s started, it&apos;s done.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>286011</commentid>
    <comment_count>8</comment_count>
      <attachid>68796</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-09-27 19:21:20 -0700</bug_when>
    <thetext>Comment on attachment 68796
Patch

Rejecting patch 68796 from commit-queue.

Failed to run &quot;[&apos;./WebKitTools/Scripts/webkit-patch&apos;, &apos;--status-host=queues.webkit.org&apos;, &apos;build-and-test&apos;, &apos;--no-clean&apos;, &apos;--no-update&apos;, &apos;--test&apos;, &apos;--quiet&apos;, &apos;--non-interactive&apos;]&quot; exit_code: 2
Last 500 characters of output:
th/git/webkit-queue/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py&quot;, line 501, in start_websocket_server
    self._websocket_server.start()
  File &quot;/Users/abarth/git/webkit-queue/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py&quot;, line 219, in start
    (self._server_name, self._port))
PyWebSocketNotStarted: Failed to start PyWebSocket server on port 8880.

----------------------------------------------------------------------
Ran 607 tests in 25.087s

FAILED (errors=1)

Full output: http://queues.webkit.org/results/4042144</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>286048</commentid>
    <comment_count>9</comment_count>
      <attachid>68796</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-09-27 21:28:09 -0700</bug_when>
    <thetext>Comment on attachment 68796
Patch

Clearing flags on attachment: 68796

Committed r68483: &lt;http://trac.webkit.org/changeset/68483&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>286049</commentid>
    <comment_count>10</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-09-27 21:28:14 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>68796</attachid>
            <date>2010-09-24 18:08:23 -0700</date>
            <delta_ts>2010-09-27 21:28:09 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-46544-20100924180822.patch</filename>
            <type>text/plain</type>
            <size>3524</size>
            <attacher name="Eric U.">ericu</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9n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
bGVFcnJvcjo6Y3JlYXRlKGVjKTsKLSAgICBtX3JlYWR5U3RhdGUgPSBET05FOwogICAgIGZpcmVF
dmVudChldmVudE5hbWVzKCkuZXJyb3JFdmVudCk7CisgICAgaWYgKEFCT1JUX0VSUiA9PSBlYykK
KyAgICAgICAgZmlyZUV2ZW50KGV2ZW50TmFtZXMoKS5hYm9ydEV2ZW50KTsKKyAgICBmaXJlRXZl
bnQoZXZlbnROYW1lcygpLmVycm9yRXZlbnQpOworICAgIG1fcmVhZHlTdGF0ZSA9IERPTkU7CiAg
ICAgZmlyZUV2ZW50KGV2ZW50TmFtZXMoKS53cml0ZWVuZEV2ZW50KTsKIH0KIAo=
</data>

          </attachment>
      

    </bug>

</bugzilla>