Chromium Code Reviews| Index: Source/core/fileapi/FileReader.cpp |
| diff --git a/Source/core/fileapi/FileReader.cpp b/Source/core/fileapi/FileReader.cpp |
| index c94eadb93f630995f4302f736f19d287a60275d6..fe615df78c88ac0529f28c1045fd3b60154eb27c 100644 |
| --- a/Source/core/fileapi/FileReader.cpp |
| +++ b/Source/core/fileapi/FileReader.cpp |
| @@ -220,7 +220,16 @@ void FileReader::readInternal(Blob* blob, FileReaderLoader::ReadType type, Excep |
| return; |
| } |
| - m_blob = blob; |
| + if (blob->hasBeenClosed()) { |
|
michaeln
2014/02/12 20:33:04
The big question is where else do we have to make
sof
2014/02/12 22:28:26
Yes, that is a question still on the table. I don'
|
| + exceptionState.throwDOMException(InvalidStateError, String(blob->isFile() ? "File" : "Blob") + " has been closed."); |
| + return; |
| + } |
| + |
| + // "Snapshot" the Blob data rather than the Blob itself as ongoing |
| + // read operations should not be affected if close() is called on |
| + // the Blob being read. |
| + m_blobDataHandle = blob->blobDataHandle(); |
| + m_blobType = blob->type(); |
| m_readType = type; |
| m_state = LOADING; |
| m_loadingState = LoadingStatePending; |
| @@ -235,8 +244,9 @@ void FileReader::executePendingRead() |
| m_loader = adoptPtr(new FileReaderLoader(m_readType, this)); |
| m_loader->setEncoding(m_encoding); |
| - m_loader->setDataType(m_blob->type()); |
| - m_loader->start(executionContext(), m_blob->blobDataHandle()); |
| + m_loader->setDataType(m_blobType); |
| + m_loader->start(executionContext(), m_blobDataHandle); |
| + m_blobDataHandle = 0; |
| } |
| static void delayedAbort(ExecutionContext*, FileReader* reader) |