Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Unified Diff: Source/core/fileapi/FileReader.cpp

Issue 114953006: Add missing FileReader argument typechecking. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/files/workers/worker-read-file-async-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fileapi/FileReader.cpp
diff --git a/Source/core/fileapi/FileReader.cpp b/Source/core/fileapi/FileReader.cpp
index ed36fe5a192c4643e2aa2a3d17629b321b5d887b..c94eadb93f630995f4302f736f19d287a60275d6 100644
--- a/Source/core/fileapi/FileReader.cpp
+++ b/Source/core/fileapi/FileReader.cpp
@@ -160,8 +160,10 @@ void FileReader::stop()
void FileReader::readAsArrayBuffer(Blob* blob, ExceptionState& exceptionState)
{
- if (!blob)
+ if (!blob) {
+ exceptionState.throwTypeError("The argument is not a Blob.");
return;
+ }
WTF_LOG(FileAPI, "FileReader: reading as array buffer: %s %s\n", utf8BlobUUID(blob).data(), utf8FilePath(blob).data());
@@ -170,8 +172,10 @@ void FileReader::readAsArrayBuffer(Blob* blob, ExceptionState& exceptionState)
void FileReader::readAsBinaryString(Blob* blob, ExceptionState& exceptionState)
{
- if (!blob)
+ if (!blob) {
+ exceptionState.throwTypeError("The argument is not a Blob.");
return;
+ }
WTF_LOG(FileAPI, "FileReader: reading as binary: %s %s\n", utf8BlobUUID(blob).data(), utf8FilePath(blob).data());
@@ -180,8 +184,10 @@ void FileReader::readAsBinaryString(Blob* blob, ExceptionState& exceptionState)
void FileReader::readAsText(Blob* blob, const String& encoding, ExceptionState& exceptionState)
{
- if (!blob)
+ if (!blob) {
+ exceptionState.throwTypeError("The argument is not a Blob.");
return;
+ }
WTF_LOG(FileAPI, "FileReader: reading as text: %s %s\n", utf8BlobUUID(blob).data(), utf8FilePath(blob).data());
@@ -196,8 +202,10 @@ void FileReader::readAsText(Blob* blob, ExceptionState& exceptionState)
void FileReader::readAsDataURL(Blob* blob, ExceptionState& exceptionState)
{
- if (!blob)
+ if (!blob) {
+ exceptionState.throwTypeError("The argument is not a Blob.");
return;
+ }
WTF_LOG(FileAPI, "FileReader: reading as data URL: %s %s\n", utf8BlobUUID(blob).data(), utf8FilePath(blob).data());
@@ -208,7 +216,7 @@ void FileReader::readInternal(Blob* blob, FileReaderLoader::ReadType type, Excep
{
// If multiple concurrent read methods are called on the same FileReader, InvalidStateError should be thrown when the state is LOADING.
if (m_state == LOADING) {
- exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError);
+ exceptionState.throwDOMException(InvalidStateError, "The object is already busy reading Blobs.");
return;
}
« no previous file with comments | « LayoutTests/fast/files/workers/worker-read-file-async-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698