summaryrefslogtreecommitdiff
path: root/image
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-01-21 14:02:56 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-01-21 14:02:56 +0100
commitda14d828fc48eb208fae8bc756a9333b2acf6ee1 (patch)
tree36c5769bf55fe3854f018dde4b43327b389844b2 /image
parent78f8556ed32fffc2711755e0b920beb10e453375 (diff)
downloaduxp-da14d828fc48eb208fae8bc756a9333b2acf6ee1.tar.gz
Make Sourcebuffer::AppendFromInputStream handle canceled image loads.
Diffstat (limited to 'image')
-rw-r--r--image/SourceBuffer.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/image/SourceBuffer.cpp b/image/SourceBuffer.cpp
index de0719d451..de066e29fc 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;
}