summaryrefslogtreecommitdiffstats
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
commit87bef3e99e30c47435b7dff37c098c9d99965d22 (patch)
tree36c5769bf55fe3854f018dde4b43327b389844b2
parent64d65e096bd762bfa54c362a83edd8dcd5ba2e53 (diff)
downloadUXP-87bef3e99e30c47435b7dff37c098c9d99965d22.tar
UXP-87bef3e99e30c47435b7dff37c098c9d99965d22.tar.gz
UXP-87bef3e99e30c47435b7dff37c098c9d99965d22.tar.lz
UXP-87bef3e99e30c47435b7dff37c098c9d99965d22.tar.xz
UXP-87bef3e99e30c47435b7dff37c098c9d99965d22.zip
Make Sourcebuffer::AppendFromInputStream handle canceled image loads.
-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;
}