Changeset 69560 in webkit


Ignore:
Timestamp:
Oct 11, 2010 9:08:42 PM (14 years ago)
Author:
dumi@chromium.org
Message:

2010-10-11 Eric Uhrhane <ericu@chromium.org>

Reviewed by Dumitru Daniliuc.

FileWriter should hold a reference to a Blob during write
https://bugs.webkit.org/show_bug.cgi?id=47318

Without this reference, the Blob might get garbage-collected from JS
before the write has completed, which would be quite unintuitive to the
user. I just grab a RefPtr to the Blob at write(), then clear it when
we're done.

  • fileapi/FileWriter.cpp: (WebCore::FileWriter::stop): (WebCore::FileWriter::write): (WebCore::FileWriter::didWrite): (WebCore::FileWriter::didFail):
  • fileapi/FileWriter.h:

2010-10-11 Eric Uhrhane <ericu@chromium.org>

Reviewed by Dumitru Daniliuc.

FileWriter should hold a reference to a Blob during write
https://bugs.webkit.org/show_bug.cgi?id=47318

Added the first FileWriter test to cover this.
Problem #1: it's not a deterministic problem; the test might or might
not catch the error, but at least it won't ever trigger a false
positive.
Problem #2: no platform fully implements FileWriter yet, so this test
must start out completely supressed. All non-chromium platforms
already skip all filesystem tests, so I'm only adding a suppression in
chromium.

  • fast/filesystem/file-writer-gc-blob-expected.txt: Added.
  • fast/filesystem/file-writer-gc-blob.html: Added.
  • platform/chromium/test_expectations.txt:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r69558 r69560  
     12010-10-11  Eric Uhrhane  <ericu@chromium.org>
     2
     3        Reviewed by Dumitru Daniliuc.
     4
     5        FileWriter should hold a reference to a Blob during write
     6        https://bugs.webkit.org/show_bug.cgi?id=47318
     7
     8        Added the first FileWriter test to cover this.
     9        Problem #1: it's not a deterministic problem; the test might or might
     10        not catch the error, but at least it won't ever trigger a false
     11        positive.
     12        Problem #2: no platform fully implements FileWriter yet, so this test
     13        must start out completely supressed.  All non-chromium platforms
     14        already skip all filesystem tests, so I'm only adding a suppression in
     15        chromium.
     16        * fast/filesystem/file-writer-gc-blob-expected.txt: Added.
     17        * fast/filesystem/file-writer-gc-blob.html: Added.
     18        * platform/chromium/test_expectations.txt:
     19
    1202010-10-11  Martin Robinson  <mrobinson@igalia.com>
    221
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r69557 r69560  
    32093209BUG58358 MAC : fast/css/transformed-mask.html = IMAGE
    32103210
     3211// FileWriter isn't in TestShell yet.
     3212BUG58587 SKIP : fast/filesystem/file-writer-gc-blob.html = FAIL
     3213
    32113214// Failing somewhere between after Webkit r69367 and r69417.
    32123215BUG_AJWONG WIN LINUX : svg/W3C-SVG-1.1/pservers-grad-17-b.svg = IMAGE
  • trunk/WebCore/ChangeLog

    r69553 r69560  
     12010-10-11  Eric Uhrhane  <ericu@chromium.org>
     2
     3        Reviewed by Dumitru Daniliuc.
     4
     5        FileWriter should hold a reference to a Blob during write
     6        https://bugs.webkit.org/show_bug.cgi?id=47318
     7
     8        Without this reference, the Blob might get garbage-collected from JS
     9        before the write has completed, which would be quite unintuitive to the
     10        user.  I just grab a RefPtr to the Blob at write(), then clear it when
     11        we're done.
     12
     13        * fileapi/FileWriter.cpp:
     14        (WebCore::FileWriter::stop):
     15        (WebCore::FileWriter::write):
     16        (WebCore::FileWriter::didWrite):
     17        (WebCore::FileWriter::didFail):
     18        * fileapi/FileWriter.h:
     19
    1202010-10-11  Michael Saboff  <msaboff@apple.com>
    221
  • trunk/WebCore/fileapi/FileWriter.cpp

    r69463 r69560  
    8383    if (m_writer && m_readyState == WRITING)
    8484        m_writer->abort();
     85    m_blobBeingWritten.clear();
    8586    m_readyState = DONE;
    8687}
     
    100101    }
    101102
     103    m_blobBeingWritten = data;
    102104    m_readyState = WRITING;
    103105    m_startedWriting = false;
     
    170172    fireEvent(eventNames().progressEvent);
    171173    if (complete) {
     174        m_blobBeingWritten.clear();
    172175        fireEvent(eventNames().writeEvent);
    173176        m_readyState = DONE;
     
    196199        fireEvent(eventNames().abortEvent);
    197200    fireEvent(eventNames().errorEvent);
     201    m_blobBeingWritten.clear();
    198202    m_readyState = DONE;
    199203    fireEvent(eventNames().writeendEvent);
  • trunk/WebCore/fileapi/FileWriter.h

    r69140 r69560  
    124124    long long m_bytesToWrite;
    125125    long long m_truncateLength;
     126    RefPtr<Blob> m_blobBeingWritten;
    126127};
    127128
Note: See TracChangeset for help on using the changeset viewer.