mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1169613 - Use content type of synthesized response for JAR channel requests if available. Part 1: Set Content-Type of synthesized reponses for JAR channel requests. r=jdm
This commit is contained in:
parent
56767ce3c5
commit
ce7ac6d031
@ -68,6 +68,9 @@ NS_IMETHODIMP
|
||||
InterceptedJARChannel::SynthesizeHeader(const nsACString& aName,
|
||||
const nsACString& aValue)
|
||||
{
|
||||
if (aName.LowerCaseEqualsLiteral("content-type")) {
|
||||
mContentType = aValue;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -78,7 +81,7 @@ InterceptedJARChannel::FinishSynthesizedResponse()
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
mChannel->OverrideWithSynthesizedResponse(mSynthesizedInput);
|
||||
mChannel->OverrideWithSynthesizedResponse(mSynthesizedInput, mContentType);
|
||||
|
||||
mResponseBody = nullptr;
|
||||
mChannel = nullptr;
|
||||
|
@ -41,6 +41,9 @@ class InterceptedJARChannel : public nsIInterceptedChannel
|
||||
// The stream to write the body of the synthesized response.
|
||||
nsCOMPtr<nsIOutputStream> mResponseBody;
|
||||
|
||||
// The content type of the synthesized response.
|
||||
nsCString mContentType;
|
||||
|
||||
// Wether this intercepted channel was performing a navigation.
|
||||
bool mIsNavigation;
|
||||
|
||||
|
@ -896,7 +896,8 @@ void nsJARChannel::ResetInterception()
|
||||
}
|
||||
|
||||
void
|
||||
nsJARChannel::OverrideWithSynthesizedResponse(nsIInputStream* aSynthesizedInput)
|
||||
nsJARChannel::OverrideWithSynthesizedResponse(nsIInputStream* aSynthesizedInput,
|
||||
const nsACString& aContentType)
|
||||
{
|
||||
// In our current implementation, the FetchEvent handler will copy the
|
||||
// response stream completely into the pipe backing the input stream so we
|
||||
@ -917,6 +918,8 @@ nsJARChannel::OverrideWithSynthesizedResponse(nsIInputStream* aSynthesizedInput)
|
||||
return;
|
||||
}
|
||||
|
||||
SetContentType(aContentType);
|
||||
|
||||
FinishAsyncOpen();
|
||||
|
||||
rv = mSynthesizedResponsePump->AsyncRead(this, nullptr);
|
||||
|
@ -91,7 +91,8 @@ private:
|
||||
void ResetInterception();
|
||||
// Override this channel's pending response with a synthesized one. The
|
||||
// content will be asynchronously read from the pump.
|
||||
void OverrideWithSynthesizedResponse(nsIInputStream* aSynthesizedInput);
|
||||
void OverrideWithSynthesizedResponse(nsIInputStream* aSynthesizedInput,
|
||||
const nsACString& aContentType);
|
||||
|
||||
nsCString mSpec;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user