summaryrefslogtreecommitdiffstats
path: root/image/SourceBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'image/SourceBuffer.cpp')
-rw-r--r--image/SourceBuffer.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/image/SourceBuffer.cpp b/image/SourceBuffer.cpp
index de0719d45..de066e29f 100644
--- a/image/SourceBuffer.cpp
+++ b/image/SourceBuffer.cpp
@@ -451,10 +451,18 @@ SourceBuffer::AppendFromInputStream(nsIInputStream* aInputStream,
uint32_t bytesRead;
nsresult rv = aInputStream->ReadSegments(AppendToSourceBuffer, this,
aCount, &bytesRead);
- if (!NS_WARN_IF(NS_FAILED(rv))) {
- MOZ_ASSERT(bytesRead == aCount,
- "AppendToSourceBuffer should consume everything");
+ if (NS_WARN_IF(NS_FAILED(rv))) {
+ return rv;
+ }
+
+ if (bytesRead == 0) {
+ // The loading of the image has been canceled.
+ return NS_ERROR_FAILURE;
}
+
+ MOZ_ASSERT(bytesRead == aCount,
+ "AppendToSourceBuffer should consume everything");
+
return rv;
}