[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

dumi at chromium.org dumi at chromium.org
Wed Dec 22 14:31:01 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 070246f1475d31bf57490b36fea9827708b3d2ea
Author: dumi at chromium.org <dumi at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 12 04:08:42 2010 +0000

    2010-10-11  Eric Uhrhane  <ericu at 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 at 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:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69560 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2c618f3..721aa6f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,22 @@
+2010-10-11  Eric Uhrhane  <ericu at 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:
+
 2010-10-11  Martin Robinson  <mrobinson at igalia.com>
 
         Rebaseline some failing GTK+ tests.
diff --git a/LayoutTests/fast/filesystem/file-writer-gc-blob-expected.txt b/LayoutTests/fast/filesystem/file-writer-gc-blob-expected.txt
new file mode 100644
index 0000000..1f5a03e
--- /dev/null
+++ b/LayoutTests/fast/filesystem/file-writer-gc-blob-expected.txt
@@ -0,0 +1,5 @@
+starting test
+PASS Successfully wrote blob.
+PASS successfullyParsed is true
+
+TEST COMPLETE
diff --git a/LayoutTests/fast/filesystem/file-writer-gc-blob.html b/LayoutTests/fast/filesystem/file-writer-gc-blob.html
new file mode 100644
index 0000000..0d6e0fb
--- /dev/null
+++ b/LayoutTests/fast/filesystem/file-writer-gc-blob.html
@@ -0,0 +1,102 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>File Writer test</title>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+<script>
+    var fileEntry;
+
+    function cleanUp() {
+      var needToCallFinish = true;
+      try {
+        if (fileEntry) {
+          fileEntry.remove(finishJSTest, finishJSTest);
+          needToCallFinish = false;
+        }
+      } catch (ex) {
+      }
+      if (needToCallFinish) {
+        finishJSTest();
+      }
+    }
+
+    function stringifyObj(o) {
+        s = "";
+        if (o)
+            for (index in o) {
+                s += index + ": " + o[index] + "\n";
+            }
+        return s;
+    }
+
+    function onError(e) {
+        debug("Caught an error.");
+        if (e && e.code) {  // Each FileError has a code.
+          debug("Error code: " + e.code);
+        }
+        testFailed(stringifyObj(e));
+        cleanUp();
+    }
+
+    function onSuccess() {
+        testPassed("Successfully wrote blob.");
+        cleanUp();
+    }
+
+    function tenXBlob(blob) {
+        var bb = new BlobBuilder();
+        for (var i = 0; i < 10; ++i) {
+            bb.append(blob);
+        }
+        return bb.getBlob();
+    }
+
+    function startWrite(writer) {
+        // Let's make it about a megabyte.
+        var bb = new BlobBuilder();
+        bb.append("lorem ipsum");
+        var blob = tenXBlob(bb.getBlob());
+        blob = tenXBlob(bb.getBlob());
+        blob = tenXBlob(bb.getBlob());
+        blob = tenXBlob(bb.getBlob());
+        blob = tenXBlob(bb.getBlob());
+        writer.onerror = onError;
+        writer.onwriteend = onSuccess;
+        writer.write(blob);
+    }
+
+    function useFileWriter(writer) {
+        startWrite(writer);
+        gc();
+    }
+
+    function fileCallback(f) {
+        fileEntry = f;
+        fileEntry.createWriter(useFileWriter, onError);
+    }
+
+    function runTest() {
+        debug("starting test");
+        if (window.requestFileSystem) {
+            requestFileSystem(0, 1024*1024,
+                function(fs) {
+                    fs.root.getFile("test.txt", {create:true}, fileCallback,
+                                    onError);
+                },
+                onError);
+        } else {
+            debug("This test requires FileSystem API support.");
+        }
+    }
+    window.successfullyParsed = true;
+    window.jsTestIsAsync = true;
+</script>
+</head>
+<body onload="runTest()">
+    <div id="description"></div>
+    <div id="console"></div>
+    <script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
+
diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt
index dc5d611..d70856e 100644
--- a/LayoutTests/platform/chromium/test_expectations.txt
+++ b/LayoutTests/platform/chromium/test_expectations.txt
@@ -3208,6 +3208,9 @@ BUGWK47375 WIN : fast/filesystem/op-get-entry.html = TEXT
 BUG58358 WIN LINUX : fast/css/transformed-mask.html = IMAGE+TEXT
 BUG58358 MAC : fast/css/transformed-mask.html = IMAGE
 
+// FileWriter isn't in TestShell yet.
+BUG58587 SKIP : fast/filesystem/file-writer-gc-blob.html = FAIL
+
 // Failing somewhere between after Webkit r69367 and r69417.
 BUG_AJWONG WIN LINUX : svg/W3C-SVG-1.1/pservers-grad-17-b.svg = IMAGE
 
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3b83b88..4f33570 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-10-11  Eric Uhrhane  <ericu at 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  Michael Saboff  <msaboff at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/fileapi/FileWriter.cpp b/WebCore/fileapi/FileWriter.cpp
index b9d9453..bc76984 100644
--- a/WebCore/fileapi/FileWriter.cpp
+++ b/WebCore/fileapi/FileWriter.cpp
@@ -82,6 +82,7 @@ void FileWriter::stop()
 {
     if (m_writer && m_readyState == WRITING)
         m_writer->abort();
+    m_blobBeingWritten.clear();
     m_readyState = DONE;
 }
 
@@ -99,6 +100,7 @@ void FileWriter::write(Blob* data, ExceptionCode& ec)
         return;
     }
 
+    m_blobBeingWritten = data;
     m_readyState = WRITING;
     m_startedWriting = false;
     m_bytesWritten = 0;
@@ -169,6 +171,7 @@ void FileWriter::didWrite(long long bytes, bool complete)
         m_length = m_position;
     fireEvent(eventNames().progressEvent);
     if (complete) {
+        m_blobBeingWritten.clear();
         fireEvent(eventNames().writeEvent);
         m_readyState = DONE;
         fireEvent(eventNames().writeendEvent);
@@ -195,6 +198,7 @@ void FileWriter::didFail(ExceptionCode ec)
     if (ABORT_ERR == ec)
         fireEvent(eventNames().abortEvent);
     fireEvent(eventNames().errorEvent);
+    m_blobBeingWritten.clear();
     m_readyState = DONE;
     fireEvent(eventNames().writeendEvent);
 }
diff --git a/WebCore/fileapi/FileWriter.h b/WebCore/fileapi/FileWriter.h
index b36d0e8..454081c 100644
--- a/WebCore/fileapi/FileWriter.h
+++ b/WebCore/fileapi/FileWriter.h
@@ -123,6 +123,7 @@ private:
     long long m_bytesWritten;
     long long m_bytesToWrite;
     long long m_truncateLength;
+    RefPtr<Blob> m_blobBeingWritten;
 };
 
 } // namespace WebCore

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list