Title: [125643] trunk
Revision
125643
Author
[email protected]
Date
2012-08-14 21:00:39 -0700 (Tue, 14 Aug 2012)

Log Message

FileWriter fails with assertion when trying to write empty Blob
https://bugs.webkit.org/show_bug.cgi?id=93694

Reviewed by Kent Tamura.

if the given data size is zero (i.e. m_bytesToWrite is zero) the assertion 'bytes + m_bytesWritten > 0' should not be tested.

Source/WebCore:

Tests: fast/filesystem/file-writer-empty-blob.html
       fast/filesystem/workers/file-writer-empty-blob.html

* Modules/filesystem/FileWriter.cpp:
(WebCore::FileWriter::didWrite):

LayoutTests:

* fast/filesystem/file-writer-empty-blob-expected.txt: Added.
* fast/filesystem/file-writer-empty-blob.html: Added.
* fast/filesystem/resources/file-writer-empty-blob.js: Added.
* fast/filesystem/workers/file-writer-empty-blob-expected.txt: Added.
* fast/filesystem/workers/file-writer-empty-blob.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125642 => 125643)


--- trunk/LayoutTests/ChangeLog	2012-08-15 03:45:05 UTC (rev 125642)
+++ trunk/LayoutTests/ChangeLog	2012-08-15 04:00:39 UTC (rev 125643)
@@ -1,3 +1,18 @@
+2012-08-10  Kinuko Yasuda  <[email protected]>
+
+        FileWriter fails with assertion when trying to write empty Blob
+        https://bugs.webkit.org/show_bug.cgi?id=93694
+
+        Reviewed by Kent Tamura.
+
+        if the given data size is zero (i.e. m_bytesToWrite is zero) the assertion 'bytes + m_bytesWritten > 0' should not be tested.
+
+        * fast/filesystem/file-writer-empty-blob-expected.txt: Added.
+        * fast/filesystem/file-writer-empty-blob.html: Added.
+        * fast/filesystem/resources/file-writer-empty-blob.js: Added.
+        * fast/filesystem/workers/file-writer-empty-blob-expected.txt: Added.
+        * fast/filesystem/workers/file-writer-empty-blob.html: Added.
+
 2012-08-14  Yuta Kitamura  <[email protected]>
 
         [Chromium] Unreviewed, another gardening. Add one slow test.

Added: trunk/LayoutTests/fast/filesystem/file-writer-empty-blob-expected.txt (0 => 125643)


--- trunk/LayoutTests/fast/filesystem/file-writer-empty-blob-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/filesystem/file-writer-empty-blob-expected.txt	2012-08-15 04:00:39 UTC (rev 125643)
@@ -0,0 +1,10 @@
+Test that FileWriter works without crash when trying to write an empty blob.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+starting test
+PASS Successfully wrote blob.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/filesystem/file-writer-empty-blob-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/filesystem/file-writer-empty-blob.html (0 => 125643)


--- trunk/LayoutTests/fast/filesystem/file-writer-empty-blob.html	                        (rev 0)
+++ trunk/LayoutTests/fast/filesystem/file-writer-empty-blob.html	2012-08-15 04:00:39 UTC (rev 125643)
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>File Writer with empty Blob</title>
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>
+
Property changes on: trunk/LayoutTests/fast/filesystem/file-writer-empty-blob.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/filesystem/resources/file-writer-empty-blob.js (0 => 125643)


--- trunk/LayoutTests/fast/filesystem/resources/file-writer-empty-blob.js	                        (rev 0)
+++ trunk/LayoutTests/fast/filesystem/resources/file-writer-empty-blob.js	2012-08-15 04:00:39 UTC (rev 125643)
@@ -0,0 +1,29 @@
+if (this.importScripts) {
+    importScripts('fs-worker-common.js');
+    importScripts('../../js/resources/js-test-pre.js');
+    importScripts('file-writer-utils.js');
+}
+
+description("Test that FileWriter works without crash when trying to write an empty blob.");
+
+var fileEntry;
+
+function onTestSuccess() {
+    testPassed("Successfully wrote blob.");
+    cleanUp();
+}
+
+function startWrite(writer) {
+    var blob = new Blob([""]);
+    writer._onerror_ = onError;
+    writer._onwriteend_ = onTestSuccess;
+    writer.write(blob);
+}
+
+function runTest(unusedFileEntry, fileWriter) {
+    startWrite(fileWriter);
+    gc();
+}
+var jsTestIsAsync = true;
+setupAndRunTest(2 * 1024 * 1024, 'file-writer-empty-blob', runTest);
+
Property changes on: trunk/LayoutTests/fast/filesystem/resources/file-writer-empty-blob.js
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/filesystem/workers/file-writer-empty-blob-expected.txt (0 => 125643)


--- trunk/LayoutTests/fast/filesystem/workers/file-writer-empty-blob-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/filesystem/workers/file-writer-empty-blob-expected.txt	2012-08-15 04:00:39 UTC (rev 125643)
@@ -0,0 +1,11 @@
+[Worker] Test that FileWriter works without crash when trying to write an empty blob.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+Starting worker: ../resources/file-writer-empty-blob.js
+[Worker] starting test
+PASS [Worker] Successfully wrote blob.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/filesystem/workers/file-writer-empty-blob-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/filesystem/workers/file-writer-empty-blob.html (0 => 125643)


--- trunk/LayoutTests/fast/filesystem/workers/file-writer-empty-blob.html	                        (rev 0)
+++ trunk/LayoutTests/fast/filesystem/workers/file-writer-empty-blob.html	2012-08-15 04:00:39 UTC (rev 125643)
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>File Writer with empty Blob in Worker</title>
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+startWorker("../resources/file-writer-empty-blob.js");
+</script>
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/filesystem/workers/file-writer-empty-blob.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (125642 => 125643)


--- trunk/Source/WebCore/ChangeLog	2012-08-15 03:45:05 UTC (rev 125642)
+++ trunk/Source/WebCore/ChangeLog	2012-08-15 04:00:39 UTC (rev 125643)
@@ -1,3 +1,18 @@
+2012-08-10  Kinuko Yasuda  <[email protected]>
+
+        FileWriter fails with assertion when trying to write empty Blob
+        https://bugs.webkit.org/show_bug.cgi?id=93694
+
+        Reviewed by Kent Tamura.
+
+        if the given data size is zero (i.e. m_bytesToWrite is zero) the assertion 'bytes + m_bytesWritten > 0' should not be tested.
+
+        Tests: fast/filesystem/file-writer-empty-blob.html
+               fast/filesystem/workers/file-writer-empty-blob.html
+
+        * Modules/filesystem/FileWriter.cpp:
+        (WebCore::FileWriter::didWrite):
+
 2012-08-14  Keishi Hattori  <[email protected]>
 
         Share common code between calendar picker and color suggestion picker

Modified: trunk/Source/WebCore/Modules/filesystem/FileWriter.cpp (125642 => 125643)


--- trunk/Source/WebCore/Modules/filesystem/FileWriter.cpp	2012-08-15 03:45:05 UTC (rev 125642)
+++ trunk/Source/WebCore/Modules/filesystem/FileWriter.cpp	2012-08-15 04:00:39 UTC (rev 125643)
@@ -188,7 +188,7 @@
     ASSERT(m_readyState == WRITING);
     ASSERT(m_truncateLength == -1);
     ASSERT(m_operationInProgress == OperationWrite);
-    ASSERT(bytes + m_bytesWritten > 0);
+    ASSERT(!m_bytesToWrite || bytes + m_bytesWritten > 0);
     ASSERT(bytes + m_bytesWritten <= m_bytesToWrite);
     m_bytesWritten += bytes;
     ASSERT((m_bytesWritten == m_bytesToWrite) || !complete);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to