mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +09:00
Issue #1442 - Part 10a - Unify body extraction in Fetch/Beacon/XHR. https://bugzilla.mozilla.org/show_bug.cgi?id=1329298 Pre-requisite for Part 11.
This commit is contained in:
parent
3979e4847c
commit
a4146b60a4
15 changed files with 439 additions and 447 deletions
|
|
@ -224,22 +224,23 @@ Response::Constructor(const GlobalObject& aGlobal,
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> bodyStream;
|
||||
nsCString contentType;
|
||||
nsCString contentTypeWithCharset;
|
||||
uint64_t bodySize = 0;
|
||||
aRv = ExtractByteStreamFromBody(aBody.Value().Value(),
|
||||
getter_AddRefs(bodyStream),
|
||||
contentType,
|
||||
contentTypeWithCharset,
|
||||
bodySize);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
internalResponse->SetBody(bodyStream, bodySize);
|
||||
|
||||
if (!contentType.IsVoid() &&
|
||||
if (!contentTypeWithCharset.IsVoid() &&
|
||||
!internalResponse->Headers()->Has(NS_LITERAL_CSTRING("Content-Type"), aRv)) {
|
||||
// Ignore Append() failing here.
|
||||
ErrorResult error;
|
||||
internalResponse->Headers()->Append(NS_LITERAL_CSTRING("Content-Type"), contentType, error);
|
||||
internalResponse->Headers()->Append(NS_LITERAL_CSTRING("Content-Type"),
|
||||
contentTypeWithCharset, error);
|
||||
error.SuppressException();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue