Changeset 85556 in webkit
- Timestamp:
- May 2, 2011 5:10:45 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r85553 r85556 1 2011-05-02 Eric Uhrhane <ericu@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Some FileWriter progress events should be queued 6 https://bugs.webkit.org/show_bug.cgi?id=50846 7 8 * fast/filesystem/resources/file-writer-events.js: 9 (onWrite): Expect readyState at onwrite to be DONE now, not WRITING. 10 * fast/filesystem/resources/file-writer-utils.js: 11 Switch to using onwrite, now that it works. 12 1 13 2011-05-02 Mark Pilgrim <pilgrim@chromium.org> 2 14 -
trunk/LayoutTests/fast/filesystem/resources/file-writer-events.js
r83884 r85556 50 50 51 51 function onWrite(e) { 52 assert(writer.readyState == writer. WRITING);52 assert(writer.readyState == writer.DONE); 53 53 assert(sawWriteStart); 54 54 assert(sawProgress); -
trunk/LayoutTests/fast/filesystem/resources/file-writer-utils.js
r84224 r85556 117 117 var successFunc = getSuccessFunc(fileEntry); 118 118 fileWriter.onError = onError; 119 // FIXME: This should be onwrite, but the spec and code need to be changed to allow that. See https://bugs.webkit.org/show_bug.cgi?id=50846.120 fileWriter.onwriteend = function() {119 fileWriter.onwrite = function() { 120 fileWriter.onwrite = null; 121 121 verifyFileLength(fileEntry, 0, successFunc); 122 122 }; … … 144 144 offset += fileWriter.length; 145 145 assert(offset >= 0); 146 // FIXME: This should be onwrite, but the spec and code need to be changed to allow that. See https://bugs.webkit.org/show_bug.cgi?id=50846. 147 fileWriter.onwriteend = function() { 148 fileWriter.onwriteend = null; 146 fileWriter.onwrite = function() { 147 fileWriter.onwrite = null; 149 148 verifyByteRangeAsString(fileEntry, offset, data, onSuccess); 150 149 }; … … 153 152 function setFileContents(fileEntry, fileWriter, contents, onSuccess) { 154 153 fileWriter.onerror = onError; 155 // FIXME: This should be onwrite, but the spec and code need to be changed to allow that. See https://bugs.webkit.org/show_bug.cgi?id=50846.156 fileWriter.onwriteend = function() {154 fileWriter.onwrite = function() { 155 fileWriter.onwrite = null; 157 156 writeString(fileEntry, fileWriter, 0, contents, onSuccess); 158 157 }; -
trunk/Source/WebCore/ChangeLog
r85551 r85556 1 2011-05-02 Eric Uhrhane <ericu@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Some FileWriter progress events should be queued 6 https://bugs.webkit.org/show_bug.cgi?id=50846 7 8 * fileapi/FileWriter.cpp: 9 * fileapi/FileWriter.h: 10 Create a new asynchronous Task [FileWriterCompletionEventTask] that will set readyState to DONE and fire off the right events. 11 1 12 2011-05-02 Jia Pu <jpu@apple.com> 2 13 -
trunk/Source/WebCore/fileapi/FileWriter.cpp
r72985 r85556 134 134 } 135 135 136 m_error = FileError::create(FileError::ABORT_ERR);137 136 writer()->abort(); 138 137 } … … 154 153 if (complete) { 155 154 m_blobBeingWritten.clear(); 156 fireEvent(eventNames().writeEvent); 157 m_readyState = DONE; 158 fireEvent(eventNames().writeendEvent); 155 scriptExecutionContext()->postTask(FileWriterCompletionEventTask::create(this, FileError::OK)); 159 156 } 160 157 } … … 168 165 setPosition(length()); 169 166 m_truncateLength = -1; 170 fireEvent(eventNames().writeEvent); 167 scriptExecutionContext()->postTask(FileWriterCompletionEventTask::create(this, FileError::OK)); 168 } 169 170 void FileWriter::didFail(FileError::ErrorCode code) 171 { 172 ASSERT(code != FileError::OK); 173 m_blobBeingWritten.clear(); 174 scriptExecutionContext()->postTask(FileWriterCompletionEventTask::create(this, code)); 175 } 176 177 void FileWriter::signalCompletion(FileError::ErrorCode code) 178 { 171 179 m_readyState = DONE; 172 fireEvent(eventNames().writeendEvent); 173 } 174 175 void FileWriter::didFail(FileError::ErrorCode code) 176 { 177 m_error = FileError::create(code); 178 fireEvent(eventNames().errorEvent); 179 if (FileError::ABORT_ERR == code) 180 fireEvent(eventNames().abortEvent); 181 fireEvent(eventNames().errorEvent); 182 m_blobBeingWritten.clear(); 183 m_readyState = DONE; 180 if (FileError::OK != code) { 181 m_error = FileError::create(code); 182 fireEvent(eventNames().errorEvent); 183 if (FileError::ABORT_ERR == code) 184 fireEvent(eventNames().abortEvent); 185 } else 186 fireEvent(eventNames().writeEvent); 184 187 fireEvent(eventNames().writeendEvent); 185 188 } -
trunk/Source/WebCore/fileapi/FileWriter.h
r72715 r85556 37 37 #include "EventTarget.h" 38 38 #include "FileWriterBase.h" 39 #include "ScriptExecutionContext.h" 39 40 #include <wtf/PassRefPtr.h> 40 41 #include <wtf/RefPtr.h> … … 103 104 void setError(FileError::ErrorCode, ExceptionCode&); 104 105 106 void signalCompletion(FileError::ErrorCode); 107 108 class FileWriterCompletionEventTask : public ScriptExecutionContext::Task { 109 public: 110 static PassOwnPtr<FileWriterCompletionEventTask> create(PassRefPtr<FileWriter> fileWriter, FileError::ErrorCode code) 111 { 112 return adoptPtr(new FileWriterCompletionEventTask(fileWriter, code)); 113 } 114 115 116 virtual void performTask(ScriptExecutionContext*) 117 { 118 m_fileWriter->signalCompletion(m_code); 119 } 120 private: 121 FileWriterCompletionEventTask(PassRefPtr<FileWriter> fileWriter, FileError::ErrorCode code) 122 : m_fileWriter(fileWriter) 123 , m_code(code) 124 { 125 } 126 127 RefPtr<FileWriter> m_fileWriter; 128 FileError::ErrorCode m_code; 129 }; 130 105 131 RefPtr<FileError> m_error; 106 132 EventTargetData m_eventTargetData;
Note: See TracChangeset
for help on using the changeset viewer.