Make FileWriter writes from current position and change failure condition
authorJihye Kang <jye.kang@samsung.com>
Tue, 9 Apr 2013 07:31:28 +0000 (16:31 +0900)
committerJihye Kang <jye.kang@samsung.com>
Tue, 9 Apr 2013 07:31:28 +0000 (16:31 +0900)
[Title] Make FileWriter writes from current position and fire error type progress event when written bytes are less than expectation
[Issue#] N/A
[Problem]
[Cause]
[Solution]

Change-Id: If92febf74ad7987b417e452e1b77ae5e877f9f40

Source/WebCore/platform/efl/tizen/AsyncFileWriterTizen.cpp

index 2925e1f..18767d2 100644 (file)
@@ -61,6 +61,7 @@ static void writeAsync(ScriptExecutionContext* context, PassOwnPtr<AsyncFileWrit
         return;
     }
 
+    seekFile(handle, position, SeekFromBeginning);
     RefPtr<BlobStorageData> blobStorage = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(data->url());
     if (blobStorage) {
         for (size_t i = 0; i < blobStorage->items().size(); i++) {
@@ -69,7 +70,7 @@ static void writeAsync(ScriptExecutionContext* context, PassOwnPtr<AsyncFileWrit
                 bytesWritten = 0;
                 bytesWritten = writeToFile(handle, blobItem.data->data(), blobItem.data->length());
 
-                if (bytesWritten < 0)
+                if (bytesWritten != blobItem.data->length()) {
                     helperClient->didFail(FileError::SECURITY_ERR);
                 else
                     helperClient->didWrite(bytesWritten, (i + 1 == blobStorage->items().size()) ? true : false);