зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1133763 - Part 1: Remember the security info associated with HTTP fetches and record it inside InternalResponse; r=nsm
This commit is contained in:
Родитель
eed5a8dba4
Коммит
08a57b8a9e
|
@ -665,6 +665,12 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest,
|
|||
|
||||
mResponse = BeginAndGetFilteredResponse(response);
|
||||
|
||||
nsCOMPtr<nsISupports> securityInfo;
|
||||
rv = channel->GetSecurityInfo(getter_AddRefs(securityInfo));
|
||||
if (securityInfo) {
|
||||
mResponse->SetSecurityInfo(securityInfo);
|
||||
}
|
||||
|
||||
// We open a pipe so that we can immediately set the pipe's read end as the
|
||||
// response's body. Setting the segment size to UINT32_MAX means that the
|
||||
// pipe has infinite space. The nsIChannel will continue to buffer data in
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "mozilla/dom/InternalHeaders.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsSerializationHelper.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -84,5 +85,24 @@ InternalResponse::CORSResponse(InternalResponse* aInner)
|
|||
return cors.forget();
|
||||
}
|
||||
|
||||
void
|
||||
InternalResponse::SetSecurityInfo(nsISupports* aSecurityInfo)
|
||||
{
|
||||
MOZ_ASSERT(mSecurityInfo.IsEmpty(), "security info should only be set once");
|
||||
nsCOMPtr<nsISerializable> serializable = do_QueryInterface(aSecurityInfo);
|
||||
if (!serializable) {
|
||||
NS_WARNING("A non-serializable object was passed to InternalResponse::SetSecurityInfo");
|
||||
return;
|
||||
}
|
||||
NS_SerializeToString(serializable, mSecurityInfo);
|
||||
}
|
||||
|
||||
void
|
||||
InternalResponse::SetSecurityInfo(const nsCString& aSecurityInfo)
|
||||
{
|
||||
MOZ_ASSERT(mSecurityInfo.IsEmpty(), "security info should only be set once");
|
||||
mSecurityInfo = aSecurityInfo;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -126,6 +126,18 @@ public:
|
|||
mBody = aBody;
|
||||
}
|
||||
|
||||
const nsCString&
|
||||
GetSecurityInfo() const
|
||||
{
|
||||
return mSecurityInfo;
|
||||
}
|
||||
|
||||
void
|
||||
SetSecurityInfo(nsISupports* aSecurityInfo);
|
||||
|
||||
void
|
||||
SetSecurityInfo(const nsCString& aSecurityInfo);
|
||||
|
||||
private:
|
||||
~InternalResponse()
|
||||
{ }
|
||||
|
@ -143,6 +155,7 @@ private:
|
|||
nsRefPtr<InternalHeaders> mHeaders;
|
||||
nsCOMPtr<nsIInputStream> mBody;
|
||||
nsCString mContentType;
|
||||
nsCString mSecurityInfo;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -146,6 +146,7 @@ EXPORTS += [
|
|||
'nsMIMEInputStream.h',
|
||||
'nsNetUtil.h',
|
||||
'nsReadLine.h',
|
||||
'nsSerializationHelper.h',
|
||||
'nsSimpleNestedURI.h',
|
||||
'nsSimpleURI.h',
|
||||
'nsStreamListenerWrapper.h',
|
||||
|
|
Загрузка…
Ссылка в новой задаче