Bug 1167808 P0 Cache.put() should use internal body of opaque Response. r=nsm

This commit is contained in:
Ben Kelly 2015-06-12 18:59:01 -07:00
parent 152d3ac357
commit 8606edd8de
2 changed files with 13 additions and 7 deletions

View File

@ -242,7 +242,7 @@ TypeUtils::ToCacheResponse(CacheResponse& aOut, Response& aIn, ErrorResult& aRv)
}
nsCOMPtr<nsIInputStream> stream;
aIn.GetBody(getter_AddRefs(stream));
ir->GetInternalBody(getter_AddRefs(stream));
if (stream) {
aIn.SetBodyUsed();
}

View File

@ -117,6 +117,17 @@ public:
return Headers();
}
void
GetInternalBody(nsIInputStream** aStream)
{
if (mWrappedResponse) {
MOZ_ASSERT(!mBody);
return mWrappedResponse->GetBody(aStream);
}
nsCOMPtr<nsIInputStream> stream = mBody;
stream.forget(aStream);
}
void
GetBody(nsIInputStream** aStream)
{
@ -125,12 +136,7 @@ public:
return;
}
if (mWrappedResponse) {
MOZ_ASSERT(!mBody);
return mWrappedResponse->GetBody(aStream);
}
nsCOMPtr<nsIInputStream> stream = mBody;
stream.forget(aStream);
return GetInternalBody(aStream);
}
void