Backed out changeset ae9c77fa58d1 (bug 1168208) for bustage on a CLOSED TREE
This commit is contained in:
3
dom/cache/CacheTypes.ipdlh
vendored
3
dom/cache/CacheTypes.ipdlh
vendored
@@ -6,7 +6,6 @@ include protocol PCache;
|
|||||||
include protocol PCachePushStream;
|
include protocol PCachePushStream;
|
||||||
include protocol PCacheStreamControl;
|
include protocol PCacheStreamControl;
|
||||||
include InputStreamParams;
|
include InputStreamParams;
|
||||||
include ChannelInfo;
|
|
||||||
|
|
||||||
using HeadersGuardEnum from "mozilla/dom/cache/IPCUtils.h";
|
using HeadersGuardEnum from "mozilla/dom/cache/IPCUtils.h";
|
||||||
using RequestCredentials from "mozilla/dom/cache/IPCUtils.h";
|
using RequestCredentials from "mozilla/dom/cache/IPCUtils.h";
|
||||||
@@ -82,7 +81,7 @@ struct CacheResponse
|
|||||||
HeadersEntry[] headers;
|
HeadersEntry[] headers;
|
||||||
HeadersGuardEnum headersGuard;
|
HeadersGuardEnum headersGuard;
|
||||||
CacheReadStreamOrVoid body;
|
CacheReadStreamOrVoid body;
|
||||||
IPCChannelInfo channelInfo;
|
nsCString securityInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
union CacheResponseOrVoid
|
union CacheResponseOrVoid
|
||||||
|
|||||||
18
dom/cache/DBSchema.cpp
vendored
18
dom/cache/DBSchema.cpp
vendored
@@ -175,8 +175,8 @@ static nsresult DeleteEntries(mozIStorageConnection* aConn,
|
|||||||
nsTArray<nsID>& aDeletedBodyIdListOut,
|
nsTArray<nsID>& aDeletedBodyIdListOut,
|
||||||
nsTArray<IdCount>& aDeletedSecurityIdListOut,
|
nsTArray<IdCount>& aDeletedSecurityIdListOut,
|
||||||
uint32_t aPos=0, int32_t aLen=-1);
|
uint32_t aPos=0, int32_t aLen=-1);
|
||||||
static nsresult InsertSecurityInfo(mozIStorageConnection* aConn,
|
static nsresult InsertSecurity(mozIStorageConnection* aConn,
|
||||||
const nsACString& aData, int32_t *aIdOut);
|
const nsACString& aData, int32_t *aIdOut);
|
||||||
static nsresult DeleteSecurityInfo(mozIStorageConnection* aConn, int32_t aId,
|
static nsresult DeleteSecurityInfo(mozIStorageConnection* aConn, int32_t aId,
|
||||||
int32_t aCount);
|
int32_t aCount);
|
||||||
static nsresult DeleteSecurityInfoList(mozIStorageConnection* aConn,
|
static nsresult DeleteSecurityInfoList(mozIStorageConnection* aConn,
|
||||||
@@ -1194,8 +1194,8 @@ DeleteEntries(mozIStorageConnection* aConn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
InsertSecurityInfo(mozIStorageConnection* aConn, const nsACString& aData,
|
InsertSecurity(mozIStorageConnection* aConn, const nsACString& aData,
|
||||||
int32_t *aIdOut)
|
int32_t *aIdOut)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aConn);
|
MOZ_ASSERT(aConn);
|
||||||
MOZ_ASSERT(aIdOut);
|
MOZ_ASSERT(aIdOut);
|
||||||
@@ -1394,10 +1394,8 @@ InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
|||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
int32_t securityId = -1;
|
int32_t securityId = -1;
|
||||||
|
|
||||||
if (!aResponse.channelInfo().securityInfo().IsEmpty()) {
|
if (!aResponse.securityInfo().IsEmpty()) {
|
||||||
rv = InsertSecurityInfo(aConn,
|
rv = InsertSecurity(aConn, aResponse.securityInfo(), &securityId);
|
||||||
aResponse.channelInfo().securityInfo(),
|
|
||||||
&securityId);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1513,7 +1511,7 @@ InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
|||||||
rv = BindId(state, NS_LITERAL_CSTRING("response_body_id"), aResponseBodyId);
|
rv = BindId(state, NS_LITERAL_CSTRING("response_body_id"), aResponseBodyId);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||||
|
|
||||||
if (aResponse.channelInfo().securityInfo().IsEmpty()) {
|
if (aResponse.securityInfo().IsEmpty()) {
|
||||||
rv = state->BindNullByName(NS_LITERAL_CSTRING("response_security_info_id"));
|
rv = state->BindNullByName(NS_LITERAL_CSTRING("response_security_info_id"));
|
||||||
} else {
|
} else {
|
||||||
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("response_security_info_id"),
|
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("response_security_info_id"),
|
||||||
@@ -1659,7 +1657,7 @@ ReadResponse(mozIStorageConnection* aConn, EntryId aEntryId,
|
|||||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = state->GetBlobAsUTF8String(6, aSavedResponseOut->mValue.channelInfo().securityInfo());
|
rv = state->GetBlobAsUTF8String(6, aSavedResponseOut->mValue.securityInfo());
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||||
|
|
||||||
rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||||
|
|||||||
4
dom/cache/TypeUtils.cpp
vendored
4
dom/cache/TypeUtils.cpp
vendored
@@ -224,7 +224,7 @@ TypeUtils::ToCacheResponseWithoutBody(CacheResponse& aOut,
|
|||||||
}
|
}
|
||||||
ToHeadersEntryList(aOut.headers(), headers);
|
ToHeadersEntryList(aOut.headers(), headers);
|
||||||
aOut.headersGuard() = headers->Guard();
|
aOut.headersGuard() = headers->Guard();
|
||||||
aOut.channelInfo() = aIn.GetChannelInfo().AsIPCChannelInfo();
|
aOut.securityInfo() = aIn.GetSecurityInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -290,7 +290,7 @@ TypeUtils::ToResponse(const CacheResponse& aIn)
|
|||||||
ir->Headers()->Fill(*internalHeaders, result);
|
ir->Headers()->Fill(*internalHeaders, result);
|
||||||
MOZ_ASSERT(!result.Failed());
|
MOZ_ASSERT(!result.Failed());
|
||||||
|
|
||||||
ir->InitChannelInfo(aIn.channelInfo());
|
ir->SetSecurityInfo(aIn.securityInfo());
|
||||||
|
|
||||||
nsCOMPtr<nsIInputStream> stream = ReadStream::Create(aIn.body());
|
nsCOMPtr<nsIInputStream> stream = ReadStream::Create(aIn.body());
|
||||||
ir->SetBody(stream);
|
ir->SetBody(stream);
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "mozilla/dom/ChannelInfo.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsIChannel.h"
|
|
||||||
#include "nsIHttpChannel.h"
|
|
||||||
#include "nsSerializationHelper.h"
|
|
||||||
#include "mozilla/net/HttpBaseChannel.h"
|
|
||||||
#include "mozilla/ipc/ChannelInfo.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
using namespace mozilla::dom;
|
|
||||||
|
|
||||||
void
|
|
||||||
ChannelInfo::InitFromChannel(nsIChannel* aChannel)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(!mInited, "Cannot initialize the object twice");
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> securityInfo;
|
|
||||||
aChannel->GetSecurityInfo(getter_AddRefs(securityInfo));
|
|
||||||
if (securityInfo) {
|
|
||||||
SetSecurityInfo(securityInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
mInited = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ChannelInfo::InitFromIPCChannelInfo(const ipc::IPCChannelInfo& aChannelInfo)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(!mInited, "Cannot initialize the object twice");
|
|
||||||
|
|
||||||
mSecurityInfo = aChannelInfo.securityInfo();
|
|
||||||
|
|
||||||
mInited = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ChannelInfo::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);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
ChannelInfo::ResurrectInfoOnChannel(nsIChannel* aChannel)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(mInited);
|
|
||||||
|
|
||||||
if (!mSecurityInfo.IsEmpty()) {
|
|
||||||
nsCOMPtr<nsISupports> infoObj;
|
|
||||||
nsresult rv = NS_DeserializeObject(mSecurityInfo, getter_AddRefs(infoObj));
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
nsCOMPtr<nsIHttpChannel> httpChannel =
|
|
||||||
do_QueryInterface(aChannel);
|
|
||||||
if (NS_WARN_IF(!httpChannel)) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
net::HttpBaseChannel* httpBaseChannel =
|
|
||||||
static_cast<net::HttpBaseChannel*>(httpChannel.get());
|
|
||||||
rv = httpBaseChannel->OverrideSecurityInfo(infoObj);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
ipc::IPCChannelInfo
|
|
||||||
ChannelInfo::AsIPCChannelInfo() const
|
|
||||||
{
|
|
||||||
// This may be called when mInited is false, for example if we try to store
|
|
||||||
// a synthesized Response object into the Cache. Uninitialized and empty
|
|
||||||
// ChannelInfo objects are indistinguishable at the IPC level, so this is
|
|
||||||
// fine.
|
|
||||||
|
|
||||||
IPCChannelInfo ipcInfo;
|
|
||||||
|
|
||||||
ipcInfo.securityInfo() = mSecurityInfo;
|
|
||||||
|
|
||||||
return ipcInfo;
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#ifndef mozilla_dom_ChannelInfo_h
|
|
||||||
#define mozilla_dom_ChannelInfo_h
|
|
||||||
|
|
||||||
#include "nsString.h"
|
|
||||||
|
|
||||||
class nsIChannel;
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace ipc {
|
|
||||||
class IPCChannelInfo;
|
|
||||||
} // namespace ipc
|
|
||||||
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
// This class represents the information related to a Response that we
|
|
||||||
// retrieve from the corresponding channel that is used to perform the fetch.
|
|
||||||
//
|
|
||||||
// When adding new members to this object, the following code needs to be
|
|
||||||
// updated:
|
|
||||||
// * IPCChannelInfo
|
|
||||||
// * InitFromChannel and InitFromIPCChannelInfo members
|
|
||||||
// * ResurrectInfoOnChannel member
|
|
||||||
// * AsIPCChannelInfo member
|
|
||||||
// * constructors and assignment operators for this class.
|
|
||||||
// * DOM Cache schema code (in dom/cache/DBSchema.cpp) to ensure that the newly
|
|
||||||
// added member is saved into the DB and loaded from it properly.
|
|
||||||
//
|
|
||||||
// Care must be taken when initializing this object, or when calling
|
|
||||||
// ResurrectInfoOnChannel(). This object cannot be initialized twice, and
|
|
||||||
// ResurrectInfoOnChannel() cannot be called on it before it has been
|
|
||||||
// initialized. There are assertions ensuring these invariants.
|
|
||||||
class ChannelInfo final
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef mozilla::ipc::IPCChannelInfo IPCChannelInfo;
|
|
||||||
|
|
||||||
ChannelInfo()
|
|
||||||
: mInited(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ChannelInfo(const ChannelInfo& aRHS)
|
|
||||||
: mSecurityInfo(aRHS.mSecurityInfo)
|
|
||||||
, mInited(aRHS.mInited)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ChannelInfo&
|
|
||||||
operator=(const ChannelInfo& aRHS)
|
|
||||||
{
|
|
||||||
mSecurityInfo = aRHS.mSecurityInfo;
|
|
||||||
mInited = aRHS.mInited;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitFromChannel(nsIChannel* aChannel);
|
|
||||||
void InitFromIPCChannelInfo(const IPCChannelInfo& aChannelInfo);
|
|
||||||
|
|
||||||
// This restores every possible information stored from a previous channel
|
|
||||||
// object on a new one.
|
|
||||||
nsresult ResurrectInfoOnChannel(nsIChannel* aChannel);
|
|
||||||
|
|
||||||
bool IsInitialized() const
|
|
||||||
{
|
|
||||||
return mInited;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCChannelInfo AsIPCChannelInfo() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void SetSecurityInfo(nsISupports* aSecurityInfo);
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsCString mSecurityInfo;
|
|
||||||
bool mInited;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
#endif // mozilla_dom_ChannelInfo_h
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace ipc {
|
|
||||||
|
|
||||||
struct IPCChannelInfo
|
|
||||||
{
|
|
||||||
nsCString securityInfo;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ipc
|
|
||||||
} // namespace mozilla
|
|
||||||
@@ -706,8 +706,12 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest,
|
|||||||
}
|
}
|
||||||
response->SetBody(pipeInputStream);
|
response->SetBody(pipeInputStream);
|
||||||
|
|
||||||
|
nsCOMPtr<nsISupports> securityInfo;
|
||||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||||
response->InitChannelInfo(channel);
|
rv = channel->GetSecurityInfo(getter_AddRefs(securityInfo));
|
||||||
|
if (securityInfo) {
|
||||||
|
response->SetSecurityInfo(securityInfo);
|
||||||
|
}
|
||||||
|
|
||||||
// Resolves fetch() promise which may trigger code running in a worker. Make
|
// Resolves fetch() promise which may trigger code running in a worker. Make
|
||||||
// sure the Response is fully initialized before calling this.
|
// sure the Response is fully initialized before calling this.
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "mozilla/dom/InternalHeaders.h"
|
#include "mozilla/dom/InternalHeaders.h"
|
||||||
#include "nsStreamUtils.h"
|
#include "nsStreamUtils.h"
|
||||||
|
#include "nsSerializationHelper.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
@@ -74,5 +75,24 @@ InternalResponse::CORSResponse()
|
|||||||
return cors.forget();
|
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 dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "nsISupportsImpl.h"
|
#include "nsISupportsImpl.h"
|
||||||
|
|
||||||
#include "mozilla/dom/ResponseBinding.h"
|
#include "mozilla/dom/ResponseBinding.h"
|
||||||
#include "mozilla/dom/ChannelInfo.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
@@ -49,7 +48,7 @@ public:
|
|||||||
response->mTerminationReason = mTerminationReason;
|
response->mTerminationReason = mTerminationReason;
|
||||||
response->mURL = mURL;
|
response->mURL = mURL;
|
||||||
response->mFinalURL = mFinalURL;
|
response->mFinalURL = mFinalURL;
|
||||||
response->mChannelInfo = mChannelInfo;
|
response->mSecurityInfo = mSecurityInfo;
|
||||||
response->mWrappedResponse = this;
|
response->mWrappedResponse = this;
|
||||||
return response.forget();
|
return response.forget();
|
||||||
}
|
}
|
||||||
@@ -157,29 +156,17 @@ public:
|
|||||||
mBody = aBody;
|
mBody = aBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
const nsCString&
|
||||||
InitChannelInfo(nsIChannel* aChannel)
|
GetSecurityInfo() const
|
||||||
{
|
{
|
||||||
mChannelInfo.InitFromChannel(aChannel);
|
return mSecurityInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InitChannelInfo(const mozilla::ipc::IPCChannelInfo& aChannelInfo)
|
SetSecurityInfo(nsISupports* aSecurityInfo);
|
||||||
{
|
|
||||||
mChannelInfo.InitFromIPCChannelInfo(aChannelInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InitChannelInfo(const ChannelInfo& aChannelInfo)
|
SetSecurityInfo(const nsCString& aSecurityInfo);
|
||||||
{
|
|
||||||
mChannelInfo = aChannelInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ChannelInfo&
|
|
||||||
GetChannelInfo() const
|
|
||||||
{
|
|
||||||
return mChannelInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~InternalResponse()
|
~InternalResponse()
|
||||||
@@ -198,7 +185,7 @@ private:
|
|||||||
copy->mTerminationReason = mTerminationReason;
|
copy->mTerminationReason = mTerminationReason;
|
||||||
copy->mURL = mURL;
|
copy->mURL = mURL;
|
||||||
copy->mFinalURL = mFinalURL;
|
copy->mFinalURL = mFinalURL;
|
||||||
copy->mChannelInfo = mChannelInfo;
|
copy->mSecurityInfo = mSecurityInfo;
|
||||||
return copy.forget();
|
return copy.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +197,7 @@ private:
|
|||||||
const nsCString mStatusText;
|
const nsCString mStatusText;
|
||||||
nsRefPtr<InternalHeaders> mHeaders;
|
nsRefPtr<InternalHeaders> mHeaders;
|
||||||
nsCOMPtr<nsIInputStream> mBody;
|
nsCOMPtr<nsIInputStream> mBody;
|
||||||
ChannelInfo mChannelInfo;
|
nsCString mSecurityInfo;
|
||||||
|
|
||||||
// For filtered responses.
|
// For filtered responses.
|
||||||
// Cache, and SW interception should always serialize/access the underlying
|
// Cache, and SW interception should always serialize/access the underlying
|
||||||
|
|||||||
@@ -78,16 +78,10 @@ public:
|
|||||||
return mInternalResponse->Headers();
|
return mInternalResponse->Headers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
const nsCString&
|
||||||
InitChannelInfo(nsIChannel* aChannel)
|
GetSecurityInfo() const
|
||||||
{
|
{
|
||||||
mInternalResponse->InitChannelInfo(aChannel);
|
return mInternalResponse->GetSecurityInfo();
|
||||||
}
|
|
||||||
|
|
||||||
const ChannelInfo&
|
|
||||||
GetChannelInfo() const
|
|
||||||
{
|
|
||||||
return mInternalResponse->GetChannelInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Headers* Headers_();
|
Headers* Headers_();
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
EXPORTS.mozilla.dom += [
|
EXPORTS.mozilla.dom += [
|
||||||
'ChannelInfo.h',
|
|
||||||
'Fetch.h',
|
'Fetch.h',
|
||||||
'FetchDriver.h',
|
'FetchDriver.h',
|
||||||
'Headers.h',
|
'Headers.h',
|
||||||
@@ -17,7 +16,6 @@ EXPORTS.mozilla.dom += [
|
|||||||
]
|
]
|
||||||
|
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'ChannelInfo.cpp',
|
|
||||||
'Fetch.cpp',
|
'Fetch.cpp',
|
||||||
'FetchDriver.cpp',
|
'FetchDriver.cpp',
|
||||||
'Headers.cpp',
|
'Headers.cpp',
|
||||||
@@ -28,21 +26,11 @@ UNIFIED_SOURCES += [
|
|||||||
'Response.cpp',
|
'Response.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
IPDL_SOURCES += [
|
|
||||||
'ChannelInfo.ipdlh',
|
|
||||||
]
|
|
||||||
|
|
||||||
LOCAL_INCLUDES += [
|
LOCAL_INCLUDES += [
|
||||||
'../workers',
|
'../workers',
|
||||||
# For HttpBaseChannel.h dependencies
|
|
||||||
'/netwerk/base',
|
|
||||||
# For nsDataHandler.h
|
# For nsDataHandler.h
|
||||||
'/netwerk/protocol/data',
|
'/netwerk/protocol/data',
|
||||||
# For HttpBaseChannel.h
|
|
||||||
'/netwerk/protocol/http',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
FAIL_ON_WARNINGS = True
|
FAIL_ON_WARNINGS = True
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
|
||||||
include('/ipc/chromium/chromium-config.mozbuild')
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "nsIIOService.h"
|
#include "nsIIOService.h"
|
||||||
#include "nsIProtocolHandler.h"
|
#include "nsIProtocolHandler.h"
|
||||||
#include "nsIScriptSecurityManager.h"
|
#include "nsIScriptSecurityManager.h"
|
||||||
|
#include "nsISerializable.h"
|
||||||
#include "nsIStreamLoader.h"
|
#include "nsIStreamLoader.h"
|
||||||
#include "nsIStreamListenerTee.h"
|
#include "nsIStreamListenerTee.h"
|
||||||
#include "nsIThreadRetargetableRequest.h"
|
#include "nsIThreadRetargetableRequest.h"
|
||||||
@@ -421,7 +422,7 @@ private:
|
|||||||
bool mFailed;
|
bool mFailed;
|
||||||
nsCOMPtr<nsIInputStreamPump> mPump;
|
nsCOMPtr<nsIInputStreamPump> mPump;
|
||||||
nsCOMPtr<nsIURI> mBaseURI;
|
nsCOMPtr<nsIURI> mBaseURI;
|
||||||
ChannelInfo mChannelInfo;
|
nsCString mSecurityInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(CacheScriptLoader, nsIStreamLoaderObserver)
|
NS_IMPL_ISUPPORTS(CacheScriptLoader, nsIStreamLoaderObserver)
|
||||||
@@ -588,9 +589,19 @@ private:
|
|||||||
new InternalResponse(200, NS_LITERAL_CSTRING("OK"));
|
new InternalResponse(200, NS_LITERAL_CSTRING("OK"));
|
||||||
ir->SetBody(mReader);
|
ir->SetBody(mReader);
|
||||||
|
|
||||||
// Set the channel info of the channel on the response so that it's
|
// Set the security info of the channel on the response so that it's
|
||||||
// saved in the cache.
|
// saved in the cache.
|
||||||
ir->InitChannelInfo(channel);
|
nsCOMPtr<nsISupports> infoObj;
|
||||||
|
channel->GetSecurityInfo(getter_AddRefs(infoObj));
|
||||||
|
if (infoObj) {
|
||||||
|
nsCOMPtr<nsISerializable> serializable = do_QueryInterface(infoObj);
|
||||||
|
if (serializable) {
|
||||||
|
ir->SetSecurityInfo(serializable);
|
||||||
|
MOZ_ASSERT(!ir->GetSecurityInfo().IsEmpty());
|
||||||
|
} else {
|
||||||
|
NS_WARNING("A non-serializable object was obtained from nsIChannel::GetSecurityInfo()!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nsRefPtr<Response> response = new Response(mCacheCreator->Global(), ir);
|
nsRefPtr<Response> response = new Response(mCacheCreator->Global(), ir);
|
||||||
|
|
||||||
@@ -954,9 +965,18 @@ private:
|
|||||||
// Take care of the base URI first.
|
// Take care of the base URI first.
|
||||||
mWorkerPrivate->SetBaseURI(finalURI);
|
mWorkerPrivate->SetBaseURI(finalURI);
|
||||||
|
|
||||||
// Store the channel info if needed.
|
// Store the security info if needed.
|
||||||
if (mWorkerPrivate->IsServiceWorker()) {
|
if (mWorkerPrivate->IsServiceWorker()) {
|
||||||
mWorkerPrivate->InitChannelInfo(channel);
|
nsCOMPtr<nsISupports> infoObj;
|
||||||
|
channel->GetSecurityInfo(getter_AddRefs(infoObj));
|
||||||
|
if (infoObj) {
|
||||||
|
nsCOMPtr<nsISerializable> serializable = do_QueryInterface(infoObj);
|
||||||
|
if (serializable) {
|
||||||
|
mWorkerPrivate->SetSecurityInfo(serializable);
|
||||||
|
} else {
|
||||||
|
NS_WARNING("A non-serializable object was obtained from nsIChannel::GetSecurityInfo()!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now to figure out which principal to give this worker.
|
// Now to figure out which principal to give this worker.
|
||||||
@@ -1027,8 +1047,7 @@ private:
|
|||||||
|
|
||||||
void
|
void
|
||||||
DataReceivedFromCache(uint32_t aIndex, const uint8_t* aString,
|
DataReceivedFromCache(uint32_t aIndex, const uint8_t* aString,
|
||||||
uint32_t aStringLen,
|
uint32_t aStringLen, const nsCString& aSecurityInfo)
|
||||||
const ChannelInfo& aChannelInfo)
|
|
||||||
{
|
{
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
MOZ_ASSERT(aIndex < mLoadInfos.Length());
|
MOZ_ASSERT(aIndex < mLoadInfos.Length());
|
||||||
@@ -1056,7 +1075,7 @@ private:
|
|||||||
MOZ_ASSERT(principal);
|
MOZ_ASSERT(principal);
|
||||||
nsILoadGroup* loadGroup = mWorkerPrivate->GetLoadGroup();
|
nsILoadGroup* loadGroup = mWorkerPrivate->GetLoadGroup();
|
||||||
MOZ_ASSERT(loadGroup);
|
MOZ_ASSERT(loadGroup);
|
||||||
mWorkerPrivate->InitChannelInfo(aChannelInfo);
|
mWorkerPrivate->SetSecurityInfo(aSecurityInfo);
|
||||||
// Needed to initialize the principal info. This is fine because
|
// Needed to initialize the principal info. This is fine because
|
||||||
// the cache principal cannot change, unlike the channel principal.
|
// the cache principal cannot change, unlike the channel principal.
|
||||||
mWorkerPrivate->SetPrincipal(principal, loadGroup);
|
mWorkerPrivate->SetPrincipal(principal, loadGroup);
|
||||||
@@ -1410,11 +1429,11 @@ CacheScriptLoader::ResolvedCallback(JSContext* aCx,
|
|||||||
|
|
||||||
nsCOMPtr<nsIInputStream> inputStream;
|
nsCOMPtr<nsIInputStream> inputStream;
|
||||||
response->GetBody(getter_AddRefs(inputStream));
|
response->GetBody(getter_AddRefs(inputStream));
|
||||||
mChannelInfo = response->GetChannelInfo();
|
mSecurityInfo = response->GetSecurityInfo();
|
||||||
|
|
||||||
if (!inputStream) {
|
if (!inputStream) {
|
||||||
mLoadInfo.mCacheStatus = ScriptLoadInfo::Cached;
|
mLoadInfo.mCacheStatus = ScriptLoadInfo::Cached;
|
||||||
mRunnable->DataReceivedFromCache(mIndex, (uint8_t*)"", 0, mChannelInfo);
|
mRunnable->DataReceivedFromCache(mIndex, (uint8_t*)"", 0, mSecurityInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1470,7 +1489,7 @@ CacheScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader, nsISupports* aCont
|
|||||||
|
|
||||||
mLoadInfo.mCacheStatus = ScriptLoadInfo::Cached;
|
mLoadInfo.mCacheStatus = ScriptLoadInfo::Cached;
|
||||||
|
|
||||||
mRunnable->DataReceivedFromCache(mIndex, aString, aStringLen, mChannelInfo);
|
mRunnable->DataReceivedFromCache(mIndex, aString, aStringLen, mSecurityInfo);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,14 +98,14 @@ class FinishResponse final : public nsRunnable
|
|||||||
{
|
{
|
||||||
nsMainThreadPtrHandle<nsIInterceptedChannel> mChannel;
|
nsMainThreadPtrHandle<nsIInterceptedChannel> mChannel;
|
||||||
nsRefPtr<InternalResponse> mInternalResponse;
|
nsRefPtr<InternalResponse> mInternalResponse;
|
||||||
ChannelInfo mWorkerChannelInfo;
|
nsCString mWorkerSecurityInfo;
|
||||||
public:
|
public:
|
||||||
FinishResponse(nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel,
|
FinishResponse(nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel,
|
||||||
InternalResponse* aInternalResponse,
|
InternalResponse* aInternalResponse,
|
||||||
const ChannelInfo& aWorkerChannelInfo)
|
const nsCString& aWorkerSecurityInfo)
|
||||||
: mChannel(aChannel)
|
: mChannel(aChannel)
|
||||||
, mInternalResponse(aInternalResponse)
|
, mInternalResponse(aInternalResponse)
|
||||||
, mWorkerChannelInfo(aWorkerChannelInfo)
|
, mWorkerSecurityInfo(aWorkerSecurityInfo)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,17 +114,19 @@ public:
|
|||||||
{
|
{
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
|
|
||||||
ChannelInfo channelInfo;
|
nsCOMPtr<nsISupports> infoObj;
|
||||||
if (mInternalResponse->GetChannelInfo().IsInitialized()) {
|
nsAutoCString securityInfo(mInternalResponse->GetSecurityInfo());
|
||||||
channelInfo = mInternalResponse->GetChannelInfo();
|
if (securityInfo.IsEmpty()) {
|
||||||
} else {
|
|
||||||
// We are dealing with a synthesized response here, so fall back to the
|
// We are dealing with a synthesized response here, so fall back to the
|
||||||
// channel info for the worker script.
|
// security info for the worker script.
|
||||||
channelInfo = mWorkerChannelInfo;
|
securityInfo = mWorkerSecurityInfo;
|
||||||
}
|
}
|
||||||
nsresult rv = mChannel->SetChannelInfo(&channelInfo);
|
nsresult rv = NS_DeserializeObject(securityInfo, getter_AddRefs(infoObj));
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
return rv;
|
rv = mChannel->SetSecurityInfo(infoObj);
|
||||||
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mChannel->SynthesizeStatus(mInternalResponse->GetStatus(), mInternalResponse->GetStatusText());
|
mChannel->SynthesizeStatus(mInternalResponse->GetStatus(), mInternalResponse->GetStatusText());
|
||||||
@@ -167,14 +169,14 @@ struct RespondWithClosure
|
|||||||
{
|
{
|
||||||
nsMainThreadPtrHandle<nsIInterceptedChannel> mInterceptedChannel;
|
nsMainThreadPtrHandle<nsIInterceptedChannel> mInterceptedChannel;
|
||||||
nsRefPtr<InternalResponse> mInternalResponse;
|
nsRefPtr<InternalResponse> mInternalResponse;
|
||||||
ChannelInfo mWorkerChannelInfo;
|
nsCString mWorkerSecurityInfo;
|
||||||
|
|
||||||
RespondWithClosure(nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel,
|
RespondWithClosure(nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel,
|
||||||
InternalResponse* aInternalResponse,
|
InternalResponse* aInternalResponse,
|
||||||
const ChannelInfo& aWorkerChannelInfo)
|
const nsCString& aWorkerSecurityInfo)
|
||||||
: mInterceptedChannel(aChannel)
|
: mInterceptedChannel(aChannel)
|
||||||
, mInternalResponse(aInternalResponse)
|
, mInternalResponse(aInternalResponse)
|
||||||
, mWorkerChannelInfo(aWorkerChannelInfo)
|
, mWorkerSecurityInfo(aWorkerSecurityInfo)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -186,7 +188,7 @@ void RespondWithCopyComplete(void* aClosure, nsresult aStatus)
|
|||||||
if (NS_SUCCEEDED(aStatus)) {
|
if (NS_SUCCEEDED(aStatus)) {
|
||||||
event = new FinishResponse(data->mInterceptedChannel,
|
event = new FinishResponse(data->mInterceptedChannel,
|
||||||
data->mInternalResponse,
|
data->mInternalResponse,
|
||||||
data->mWorkerChannelInfo);
|
data->mWorkerSecurityInfo);
|
||||||
} else {
|
} else {
|
||||||
event = new CancelChannelRunnable(data->mInterceptedChannel);
|
event = new CancelChannelRunnable(data->mInterceptedChannel);
|
||||||
}
|
}
|
||||||
@@ -253,7 +255,7 @@ RespondWithHandler::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValu
|
|||||||
worker->AssertIsOnWorkerThread();
|
worker->AssertIsOnWorkerThread();
|
||||||
|
|
||||||
nsAutoPtr<RespondWithClosure> closure(
|
nsAutoPtr<RespondWithClosure> closure(
|
||||||
new RespondWithClosure(mInterceptedChannel, ir, worker->GetChannelInfo()));
|
new RespondWithClosure(mInterceptedChannel, ir, worker->GetSecurityInfo()));
|
||||||
nsCOMPtr<nsIInputStream> body;
|
nsCOMPtr<nsIInputStream> body;
|
||||||
response->GetBody(getter_AddRefs(body));
|
response->GetBody(getter_AddRefs(body));
|
||||||
// Errors and redirects may not have a body.
|
// Errors and redirects may not have a body.
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "mozilla/dom/cache/CacheStorage.h"
|
#include "mozilla/dom/cache/CacheStorage.h"
|
||||||
#include "mozilla/dom/cache/Cache.h"
|
#include "mozilla/dom/cache/Cache.h"
|
||||||
#include "nsIThreadRetargetableRequest.h"
|
#include "nsIThreadRetargetableRequest.h"
|
||||||
|
#include "nsSerializationHelper.h"
|
||||||
|
|
||||||
#include "nsIPrincipal.h"
|
#include "nsIPrincipal.h"
|
||||||
#include "Workers.h"
|
#include "Workers.h"
|
||||||
@@ -445,9 +446,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InitChannelInfo(nsIChannel* aChannel)
|
SetSecurityInfo(nsISerializable* aSecurityInfo)
|
||||||
{
|
{
|
||||||
mChannelInfo.InitFromChannel(aChannel);
|
NS_SerializeToString(aSecurityInfo, mSecurityInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -544,7 +545,7 @@ private:
|
|||||||
new InternalResponse(200, NS_LITERAL_CSTRING("OK"));
|
new InternalResponse(200, NS_LITERAL_CSTRING("OK"));
|
||||||
ir->SetBody(body);
|
ir->SetBody(body);
|
||||||
|
|
||||||
ir->InitChannelInfo(mChannelInfo);
|
ir->SetSecurityInfo(mSecurityInfo);
|
||||||
|
|
||||||
nsRefPtr<Response> response = new Response(aCache->GetGlobalObject(), ir);
|
nsRefPtr<Response> response = new Response(aCache->GetGlobalObject(), ir);
|
||||||
|
|
||||||
@@ -576,7 +577,7 @@ private:
|
|||||||
// Only used if the network script has changed and needs to be cached.
|
// Only used if the network script has changed and needs to be cached.
|
||||||
nsString mNewCacheName;
|
nsString mNewCacheName;
|
||||||
|
|
||||||
ChannelInfo mChannelInfo;
|
nsCString mSecurityInfo;
|
||||||
|
|
||||||
nsCString mMaxScope;
|
nsCString mMaxScope;
|
||||||
|
|
||||||
@@ -605,7 +606,16 @@ CompareNetwork::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
|
|||||||
MOZ_ASSERT(channel == mChannel);
|
MOZ_ASSERT(channel == mChannel);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mManager->InitChannelInfo(mChannel);
|
nsCOMPtr<nsISupports> infoObj;
|
||||||
|
mChannel->GetSecurityInfo(getter_AddRefs(infoObj));
|
||||||
|
if (infoObj) {
|
||||||
|
nsCOMPtr<nsISerializable> serializable = do_QueryInterface(infoObj);
|
||||||
|
if (serializable) {
|
||||||
|
mManager->SetSecurityInfo(serializable);
|
||||||
|
} else {
|
||||||
|
NS_WARNING("A non-serializable object was obtained from nsIChannel::GetSecurityInfo()!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include "nsIXPConnect.h"
|
#include "nsIXPConnect.h"
|
||||||
#include "nsPerformance.h"
|
#include "nsPerformance.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
|
#include "nsSerializationHelper.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
@@ -4074,6 +4075,17 @@ WorkerPrivateParent<Derived>::SetPrincipal(nsIPrincipal* aPrincipal,
|
|||||||
PrincipalToPrincipalInfo(aPrincipal, mLoadInfo.mPrincipalInfo)));
|
PrincipalToPrincipalInfo(aPrincipal, mLoadInfo.mPrincipalInfo)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class Derived>
|
||||||
|
void
|
||||||
|
WorkerPrivateParent<Derived>::SetSecurityInfo(nsISerializable* aSerializable)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(IsServiceWorker());
|
||||||
|
AssertIsOnMainThread();
|
||||||
|
nsAutoCString securityInfo;
|
||||||
|
NS_SerializeToString(aSerializable, securityInfo);
|
||||||
|
SetSecurityInfo(securityInfo);
|
||||||
|
}
|
||||||
|
|
||||||
template <class Derived>
|
template <class Derived>
|
||||||
JSContext*
|
JSContext*
|
||||||
WorkerPrivateParent<Derived>::ParentJSContext() const
|
WorkerPrivateParent<Derived>::ParentJSContext() const
|
||||||
|
|||||||
@@ -498,34 +498,24 @@ public:
|
|||||||
return mLoadInfo.mServiceWorkerCacheName;
|
return mLoadInfo.mServiceWorkerCacheName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ChannelInfo&
|
const nsCString&
|
||||||
GetChannelInfo() const
|
GetSecurityInfo() const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsServiceWorker());
|
MOZ_ASSERT(IsServiceWorker());
|
||||||
return mLoadInfo.mChannelInfo;
|
return mLoadInfo.mSecurityInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SetChannelInfo(const ChannelInfo& aChannelInfo)
|
SetSecurityInfo(const nsCString& aSecurityInfo)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsServiceWorker());
|
MOZ_ASSERT(IsServiceWorker());
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
MOZ_ASSERT(!mLoadInfo.mChannelInfo.IsInitialized());
|
MOZ_ASSERT(mLoadInfo.mSecurityInfo.IsEmpty());
|
||||||
MOZ_ASSERT(aChannelInfo.IsInitialized());
|
mLoadInfo.mSecurityInfo = aSecurityInfo;
|
||||||
mLoadInfo.mChannelInfo = aChannelInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InitChannelInfo(nsIChannel* aChannel)
|
SetSecurityInfo(nsISerializable* aSerializable);
|
||||||
{
|
|
||||||
mLoadInfo.mChannelInfo.InitFromChannel(aChannel);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InitChannelInfo(const ChannelInfo& aChannelInfo)
|
|
||||||
{
|
|
||||||
mLoadInfo.mChannelInfo = aChannelInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is used to handle importScripts(). When the worker is first loaded
|
// This is used to handle importScripts(). When the worker is first loaded
|
||||||
// and executed, it happens in a sync loop. At this point it sets
|
// and executed, it happens in a sync loop. At this point it sets
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#include "nsILoadContext.h"
|
#include "nsILoadContext.h"
|
||||||
#include "nsIWeakReferenceUtils.h"
|
#include "nsIWeakReferenceUtils.h"
|
||||||
#include "nsIInterfaceRequestor.h"
|
#include "nsIInterfaceRequestor.h"
|
||||||
#include "mozilla/dom/ChannelInfo.h"
|
|
||||||
|
|
||||||
#define BEGIN_WORKERS_NAMESPACE \
|
#define BEGIN_WORKERS_NAMESPACE \
|
||||||
namespace mozilla { namespace dom { namespace workers {
|
namespace mozilla { namespace dom { namespace workers {
|
||||||
@@ -245,7 +244,7 @@ struct WorkerLoadInfo
|
|||||||
|
|
||||||
nsString mServiceWorkerCacheName;
|
nsString mServiceWorkerCacheName;
|
||||||
|
|
||||||
ChannelInfo mChannelInfo;
|
nsCString mSecurityInfo;
|
||||||
|
|
||||||
uint64_t mWindowID;
|
uint64_t mWindowID;
|
||||||
uint64_t mServiceWorkerID;
|
uint64_t mServiceWorkerID;
|
||||||
|
|||||||
@@ -9,16 +9,6 @@ interface nsIChannel;
|
|||||||
interface nsIOutputStream;
|
interface nsIOutputStream;
|
||||||
interface nsIURI;
|
interface nsIURI;
|
||||||
|
|
||||||
%{C++
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
class ChannelInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
%}
|
|
||||||
|
|
||||||
[ptr] native ChannelInfo(mozilla::dom::ChannelInfo);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to allow implementors of nsINetworkInterceptController to control the behaviour
|
* Interface to allow implementors of nsINetworkInterceptController to control the behaviour
|
||||||
* of intercepted channels without tying implementation details of the interception to
|
* of intercepted channels without tying implementation details of the interception to
|
||||||
@@ -26,7 +16,7 @@ class ChannelInfo;
|
|||||||
* which do not implement nsIChannel.
|
* which do not implement nsIChannel.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[scriptable, uuid(f2c07a6b-366d-4ef4-85ab-a77f4bcb1646)]
|
[scriptable, uuid(2fc1170c-4f9d-4c9e-8e5d-2d351dbe03f2)]
|
||||||
interface nsIInterceptedChannel : nsISupports
|
interface nsIInterceptedChannel : nsISupports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -77,10 +67,9 @@ interface nsIInterceptedChannel : nsISupports
|
|||||||
readonly attribute bool isNavigation;
|
readonly attribute bool isNavigation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method allows to override the channel info for the channel.
|
* This method allows to override the security info for the channel.
|
||||||
*/
|
*/
|
||||||
[noscript]
|
void setSecurityInfo(in nsISupports securityInfo);
|
||||||
void setChannelInfo(in ChannelInfo channelInfo);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "nsHttpChannel.h"
|
#include "nsHttpChannel.h"
|
||||||
#include "HttpChannelChild.h"
|
#include "HttpChannelChild.h"
|
||||||
#include "nsHttpResponseHead.h"
|
#include "nsHttpResponseHead.h"
|
||||||
#include "mozilla/dom/ChannelInfo.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace net {
|
namespace net {
|
||||||
@@ -234,13 +233,13 @@ InterceptedChannelChrome::Cancel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
InterceptedChannelChrome::SetChannelInfo(dom::ChannelInfo* aChannelInfo)
|
InterceptedChannelChrome::SetSecurityInfo(nsISupports* aSecurityInfo)
|
||||||
{
|
{
|
||||||
if (!mChannel) {
|
if (!mChannel) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aChannelInfo->ResurrectInfoOnChannel(mChannel);
|
return mChannel->OverrideSecurityInfo(aSecurityInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
InterceptedChannelContent::InterceptedChannelContent(HttpChannelChild* aChannel,
|
InterceptedChannelContent::InterceptedChannelContent(HttpChannelChild* aChannel,
|
||||||
@@ -341,13 +340,13 @@ InterceptedChannelContent::Cancel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
InterceptedChannelContent::SetChannelInfo(dom::ChannelInfo* aChannelInfo)
|
InterceptedChannelContent::SetSecurityInfo(nsISupports* aSecurityInfo)
|
||||||
{
|
{
|
||||||
if (!mChannel) {
|
if (!mChannel) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aChannelInfo->ResurrectInfoOnChannel(mChannel);
|
return mChannel->OverrideSecurityInfo(aSecurityInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace net
|
} // namespace net
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public:
|
|||||||
NS_IMETHOD SynthesizeStatus(uint16_t aStatus, const nsACString& aReason) override;
|
NS_IMETHOD SynthesizeStatus(uint16_t aStatus, const nsACString& aReason) override;
|
||||||
NS_IMETHOD SynthesizeHeader(const nsACString& aName, const nsACString& aValue) override;
|
NS_IMETHOD SynthesizeHeader(const nsACString& aName, const nsACString& aValue) override;
|
||||||
NS_IMETHOD Cancel() override;
|
NS_IMETHOD Cancel() override;
|
||||||
NS_IMETHOD SetChannelInfo(mozilla::dom::ChannelInfo* aChannelInfo) override;
|
NS_IMETHOD SetSecurityInfo(nsISupports* aSecurityInfo) override;
|
||||||
|
|
||||||
virtual void NotifyController() override;
|
virtual void NotifyController() override;
|
||||||
};
|
};
|
||||||
@@ -109,7 +109,7 @@ public:
|
|||||||
NS_IMETHOD SynthesizeStatus(uint16_t aStatus, const nsACString& aReason) override;
|
NS_IMETHOD SynthesizeStatus(uint16_t aStatus, const nsACString& aReason) override;
|
||||||
NS_IMETHOD SynthesizeHeader(const nsACString& aName, const nsACString& aValue) override;
|
NS_IMETHOD SynthesizeHeader(const nsACString& aName, const nsACString& aValue) override;
|
||||||
NS_IMETHOD Cancel() override;
|
NS_IMETHOD Cancel() override;
|
||||||
NS_IMETHOD SetChannelInfo(mozilla::dom::ChannelInfo* aChannelInfo) override;
|
NS_IMETHOD SetSecurityInfo(nsISupports* aSecurityInfo) override;
|
||||||
|
|
||||||
virtual void NotifyController() override;
|
virtual void NotifyController() override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include "nsITimer.h"
|
#include "nsITimer.h"
|
||||||
#include "NullHttpTransaction.h"
|
#include "NullHttpTransaction.h"
|
||||||
#include "mozilla/TimeStamp.h"
|
#include "mozilla/TimeStamp.h"
|
||||||
#include "prio.h"
|
|
||||||
|
|
||||||
// a TLSFilterTransaction wraps another nsAHttpTransaction but
|
// a TLSFilterTransaction wraps another nsAHttpTransaction but
|
||||||
// applies a encode/decode filter of TLS onto the ReadSegments
|
// applies a encode/decode filter of TLS onto the ReadSegments
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "nsProxyInfo.h"
|
#include "nsProxyInfo.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsStringFwd.h"
|
#include "nsStringFwd.h"
|
||||||
#include "mozilla/Logging.h"
|
|
||||||
|
|
||||||
extern PRLogModuleInfo *gHttpLog;
|
extern PRLogModuleInfo *gHttpLog;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user