mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1179505 - Make LoadInfo arguments optional in ipdl (r=bent,sicking)
This commit is contained in:
parent
809f712373
commit
1fe4e1e149
@ -18,6 +18,12 @@
|
|||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
namespace net {
|
||||||
|
class OptionalLoadInfoArgs;
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace mozilla::net;
|
||||||
|
|
||||||
namespace ipc {
|
namespace ipc {
|
||||||
|
|
||||||
already_AddRefed<nsIPrincipal>
|
already_AddRefed<nsIPrincipal>
|
||||||
@ -220,66 +226,70 @@ PrincipalToPrincipalInfo(nsIPrincipal* aPrincipal,
|
|||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo,
|
LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo,
|
||||||
mozilla::net::LoadInfoArgs* aLoadInfoArgs)
|
OptionalLoadInfoArgs* aOptionalLoadInfoArgs)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
if (!aLoadInfo) {
|
||||||
|
// if there is no loadInfo, then there is nothing to serialize
|
||||||
if (aLoadInfo) {
|
*aOptionalLoadInfoArgs = void_t();
|
||||||
rv = PrincipalToPrincipalInfo(aLoadInfo->LoadingPrincipal(),
|
|
||||||
&aLoadInfoArgs->requestingPrincipalInfo());
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
rv = PrincipalToPrincipalInfo(aLoadInfo->TriggeringPrincipal(),
|
|
||||||
&aLoadInfoArgs->triggeringPrincipalInfo());
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
aLoadInfoArgs->securityFlags() = aLoadInfo->GetSecurityFlags();
|
|
||||||
aLoadInfoArgs->contentPolicyType() = aLoadInfo->GetContentPolicyType();
|
|
||||||
aLoadInfoArgs->upgradeInsecureRequests() = aLoadInfo->GetUpgradeInsecureRequests();
|
|
||||||
aLoadInfoArgs->innerWindowID() = aLoadInfo->GetInnerWindowID();
|
|
||||||
aLoadInfoArgs->outerWindowID() = aLoadInfo->GetOuterWindowID();
|
|
||||||
aLoadInfoArgs->parentOuterWindowID() = aLoadInfo->GetParentOuterWindowID();
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use default values if no loadInfo is provided
|
nsresult rv = NS_OK;
|
||||||
rv = PrincipalToPrincipalInfo(nsContentUtils::GetSystemPrincipal(),
|
PrincipalInfo requestingPrincipalInfo;
|
||||||
&aLoadInfoArgs->requestingPrincipalInfo());
|
rv = PrincipalToPrincipalInfo(aLoadInfo->LoadingPrincipal(),
|
||||||
|
&requestingPrincipalInfo);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = PrincipalToPrincipalInfo(nsContentUtils::GetSystemPrincipal(),
|
|
||||||
&aLoadInfoArgs->triggeringPrincipalInfo());
|
PrincipalInfo triggeringPrincipalInfo;
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
rv = PrincipalToPrincipalInfo(aLoadInfo->TriggeringPrincipal(),
|
||||||
aLoadInfoArgs->securityFlags() = nsILoadInfo::SEC_NORMAL;
|
&triggeringPrincipalInfo);
|
||||||
aLoadInfoArgs->contentPolicyType() = nsIContentPolicy::TYPE_OTHER;
|
|
||||||
aLoadInfoArgs->upgradeInsecureRequests() = false;
|
*aOptionalLoadInfoArgs =
|
||||||
aLoadInfoArgs->innerWindowID() = 0;
|
LoadInfoArgs(
|
||||||
aLoadInfoArgs->outerWindowID() = 0;
|
requestingPrincipalInfo,
|
||||||
aLoadInfoArgs->parentOuterWindowID() = 0;
|
triggeringPrincipalInfo,
|
||||||
|
aLoadInfo->GetSecurityFlags(),
|
||||||
|
aLoadInfo->GetContentPolicyType(),
|
||||||
|
aLoadInfo->GetUpgradeInsecureRequests(),
|
||||||
|
aLoadInfo->GetInnerWindowID(),
|
||||||
|
aLoadInfo->GetOuterWindowID(),
|
||||||
|
aLoadInfo->GetParentOuterWindowID());
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
LoadInfoArgsToLoadInfo(const mozilla::net::LoadInfoArgs& aLoadInfoArgs,
|
LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs,
|
||||||
nsILoadInfo** outLoadInfo)
|
nsILoadInfo** outLoadInfo)
|
||||||
{
|
{
|
||||||
|
if (aOptionalLoadInfoArgs.type() == OptionalLoadInfoArgs::Tvoid_t) {
|
||||||
|
*outLoadInfo = nullptr;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
const LoadInfoArgs& loadInfoArgs =
|
||||||
|
aOptionalLoadInfoArgs.get_LoadInfoArgs();
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIPrincipal> requestingPrincipal =
|
nsCOMPtr<nsIPrincipal> requestingPrincipal =
|
||||||
PrincipalInfoToPrincipal(aLoadInfoArgs.requestingPrincipalInfo(), &rv);
|
PrincipalInfoToPrincipal(loadInfoArgs.requestingPrincipalInfo(), &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
nsCOMPtr<nsIPrincipal> triggeringPrincipal =
|
nsCOMPtr<nsIPrincipal> triggeringPrincipal =
|
||||||
PrincipalInfoToPrincipal(aLoadInfoArgs.triggeringPrincipalInfo(), &rv);
|
PrincipalInfoToPrincipal(loadInfoArgs.triggeringPrincipalInfo(), &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||||
new mozilla::LoadInfo(requestingPrincipal,
|
new mozilla::LoadInfo(requestingPrincipal,
|
||||||
triggeringPrincipal,
|
triggeringPrincipal,
|
||||||
aLoadInfoArgs.securityFlags(),
|
loadInfoArgs.securityFlags(),
|
||||||
aLoadInfoArgs.contentPolicyType(),
|
loadInfoArgs.contentPolicyType(),
|
||||||
aLoadInfoArgs.upgradeInsecureRequests(),
|
loadInfoArgs.upgradeInsecureRequests(),
|
||||||
aLoadInfoArgs.innerWindowID(),
|
loadInfoArgs.innerWindowID(),
|
||||||
aLoadInfoArgs.outerWindowID(),
|
loadInfoArgs.outerWindowID(),
|
||||||
aLoadInfoArgs.parentOuterWindowID());
|
loadInfoArgs.parentOuterWindowID());
|
||||||
|
|
||||||
loadInfo.forget(outLoadInfo);
|
loadInfo.forget(outLoadInfo);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ipc
|
} // namespace ipc
|
||||||
|
@ -40,9 +40,11 @@ struct ParamTraits<mozilla::OriginAttributes>
|
|||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace net {
|
namespace net {
|
||||||
class LoadInfoArgs;
|
class OptionalLoadInfoArgs;
|
||||||
} // namespace net
|
} // namespace net
|
||||||
|
|
||||||
|
using namespace mozilla::net;
|
||||||
|
|
||||||
namespace ipc {
|
namespace ipc {
|
||||||
|
|
||||||
class PrincipalInfo;
|
class PrincipalInfo;
|
||||||
@ -70,17 +72,15 @@ PrincipalToPrincipalInfo(nsIPrincipal* aPrincipal,
|
|||||||
*/
|
*/
|
||||||
nsresult
|
nsresult
|
||||||
LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo,
|
LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo,
|
||||||
mozilla::net::LoadInfoArgs* outLoadInfoArgs);
|
OptionalLoadInfoArgs* outOptionalLoadInfoArgs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert LoadInfoArgs to a LoadInfo.
|
* Convert LoadInfoArgs to a LoadInfo.
|
||||||
*/
|
*/
|
||||||
nsresult
|
nsresult
|
||||||
LoadInfoArgsToLoadInfo(const mozilla::net::LoadInfoArgs& aLoadInfoArgs,
|
LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs,
|
||||||
nsILoadInfo** outLoadInfo);
|
nsILoadInfo** outLoadInfo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace ipc
|
} // namespace ipc
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
@ -18,13 +18,13 @@ class nsINode;
|
|||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
namespace net {
|
namespace net {
|
||||||
class LoadInfoArgs;
|
class OptionalLoadInfoArgs;
|
||||||
} // namespace net
|
} // namespace net
|
||||||
|
|
||||||
namespace ipc {
|
namespace ipc {
|
||||||
// we have to forward declare that function so we can use it as a friend.
|
// we have to forward declare that function so we can use it as a friend.
|
||||||
nsresult
|
nsresult
|
||||||
LoadInfoArgsToLoadInfo(const mozilla::net::LoadInfoArgs& aLoadInfoArgs,
|
LoadInfoArgsToLoadInfo(const mozilla::net::OptionalLoadInfoArgs& aLoadInfoArgs,
|
||||||
nsILoadInfo** outLoadInfo);
|
nsILoadInfo** outLoadInfo);
|
||||||
} // namespace ipc
|
} // namespace ipc
|
||||||
|
|
||||||
@ -64,8 +64,9 @@ private:
|
|||||||
uint64_t aParentOuterWindowID);
|
uint64_t aParentOuterWindowID);
|
||||||
|
|
||||||
friend nsresult
|
friend nsresult
|
||||||
mozilla::ipc::LoadInfoArgsToLoadInfo(const mozilla::net::LoadInfoArgs& aLoadInfoArgs,
|
mozilla::ipc::LoadInfoArgsToLoadInfo(
|
||||||
nsILoadInfo** outLoadInfo);
|
const mozilla::net::OptionalLoadInfoArgs& aLoadInfoArgs,
|
||||||
|
nsILoadInfo** outLoadInfo);
|
||||||
|
|
||||||
~LoadInfo();
|
~LoadInfo();
|
||||||
|
|
||||||
|
@ -36,6 +36,15 @@ struct LoadInfoArgs
|
|||||||
uint64_t parentOuterWindowID;
|
uint64_t parentOuterWindowID;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Not every channel necessarily has a loadInfo attached.
|
||||||
|
*/
|
||||||
|
union OptionalLoadInfoArgs
|
||||||
|
{
|
||||||
|
void_t;
|
||||||
|
LoadInfoArgs;
|
||||||
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// HTTP IPDL structs
|
// HTTP IPDL structs
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -77,7 +86,7 @@ struct HttpChannelOpenArgs
|
|||||||
bool allowSpdy;
|
bool allowSpdy;
|
||||||
bool allowAltSvc;
|
bool allowAltSvc;
|
||||||
OptionalFileDescriptorSet fds;
|
OptionalFileDescriptorSet fds;
|
||||||
LoadInfoArgs loadInfo;
|
OptionalLoadInfoArgs loadInfo;
|
||||||
OptionalHttpResponseHead synthesizedResponseHead;
|
OptionalHttpResponseHead synthesizedResponseHead;
|
||||||
uint32_t cacheKey;
|
uint32_t cacheKey;
|
||||||
};
|
};
|
||||||
@ -104,7 +113,7 @@ struct FTPChannelOpenArgs
|
|||||||
uint64_t startPos;
|
uint64_t startPos;
|
||||||
nsCString entityID;
|
nsCString entityID;
|
||||||
OptionalInputStreamParams uploadStream;
|
OptionalInputStreamParams uploadStream;
|
||||||
LoadInfoArgs loadInfo;
|
OptionalLoadInfoArgs loadInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FTPChannelConnectArgs
|
struct FTPChannelConnectArgs
|
||||||
|
@ -107,7 +107,7 @@ FTPChannelParent::DoAsyncOpen(const URIParams& aURI,
|
|||||||
const uint64_t& aStartPos,
|
const uint64_t& aStartPos,
|
||||||
const nsCString& aEntityID,
|
const nsCString& aEntityID,
|
||||||
const OptionalInputStreamParams& aUploadStream,
|
const OptionalInputStreamParams& aUploadStream,
|
||||||
const LoadInfoArgs& aLoadInfoArgs)
|
const OptionalLoadInfoArgs& aLoadInfoArgs)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
|
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
|
||||||
if (!uri)
|
if (!uri)
|
||||||
|
@ -65,7 +65,7 @@ protected:
|
|||||||
bool DoAsyncOpen(const URIParams& aURI, const uint64_t& aStartPos,
|
bool DoAsyncOpen(const URIParams& aURI, const uint64_t& aStartPos,
|
||||||
const nsCString& aEntityID,
|
const nsCString& aEntityID,
|
||||||
const OptionalInputStreamParams& aUploadStream,
|
const OptionalInputStreamParams& aUploadStream,
|
||||||
const LoadInfoArgs& aLoadInfoArgs);
|
const OptionalLoadInfoArgs& aLoadInfoArgs);
|
||||||
|
|
||||||
// used to connect redirected-to channel in parent with just created
|
// used to connect redirected-to channel in parent with just created
|
||||||
// ChildChannel. Used during HTTP->FTP redirects.
|
// ChildChannel. Used during HTTP->FTP redirects.
|
||||||
|
@ -274,7 +274,7 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
|||||||
const bool& allowSpdy,
|
const bool& allowSpdy,
|
||||||
const bool& allowAltSvc,
|
const bool& allowAltSvc,
|
||||||
const OptionalFileDescriptorSet& aFds,
|
const OptionalFileDescriptorSet& aFds,
|
||||||
const LoadInfoArgs& aLoadInfoArgs,
|
const OptionalLoadInfoArgs& aLoadInfoArgs,
|
||||||
const OptionalHttpResponseHead& aSynthesizedResponseHead,
|
const OptionalHttpResponseHead& aSynthesizedResponseHead,
|
||||||
const uint32_t& aCacheKey)
|
const uint32_t& aCacheKey)
|
||||||
{
|
{
|
||||||
|
@ -116,7 +116,7 @@ protected:
|
|||||||
const bool& allowSpdy,
|
const bool& allowSpdy,
|
||||||
const bool& allowAltSvc,
|
const bool& allowAltSvc,
|
||||||
const OptionalFileDescriptorSet& aFds,
|
const OptionalFileDescriptorSet& aFds,
|
||||||
const LoadInfoArgs& aLoadInfoArgs,
|
const OptionalLoadInfoArgs& aLoadInfoArgs,
|
||||||
const OptionalHttpResponseHead& aSynthesizedResponseHead,
|
const OptionalHttpResponseHead& aSynthesizedResponseHead,
|
||||||
const uint32_t& aCacheKey);
|
const uint32_t& aCacheKey);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ parent:
|
|||||||
bool aClientSetPingInterval,
|
bool aClientSetPingInterval,
|
||||||
uint32_t aPingTimeout,
|
uint32_t aPingTimeout,
|
||||||
bool aClientSetPingTimeout,
|
bool aClientSetPingTimeout,
|
||||||
LoadInfoArgs aLoadInfoArgs);
|
OptionalLoadInfoArgs aLoadInfoArgs);
|
||||||
Close(uint16_t code, nsCString reason);
|
Close(uint16_t code, nsCString reason);
|
||||||
SendMsg(nsCString aMsg);
|
SendMsg(nsCString aMsg);
|
||||||
SendBinaryMsg(nsCString aMsg);
|
SendBinaryMsg(nsCString aMsg);
|
||||||
|
@ -483,7 +483,7 @@ WebSocketChannelChild::AsyncOpen(nsIURI *aURI,
|
|||||||
// Corresponding release in DeallocPWebSocket
|
// Corresponding release in DeallocPWebSocket
|
||||||
AddIPDLReference();
|
AddIPDLReference();
|
||||||
|
|
||||||
LoadInfoArgs loadInfoArgs;
|
OptionalLoadInfoArgs loadInfoArgs;
|
||||||
nsresult rv = LoadInfoToLoadInfoArgs(mLoadInfo, &loadInfoArgs);
|
nsresult rv = LoadInfoToLoadInfoArgs(mLoadInfo, &loadInfoArgs);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ WebSocketChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
|||||||
const bool& aClientSetPingInterval,
|
const bool& aClientSetPingInterval,
|
||||||
const uint32_t& aPingTimeout,
|
const uint32_t& aPingTimeout,
|
||||||
const bool& aClientSetPingTimeout,
|
const bool& aClientSetPingTimeout,
|
||||||
const LoadInfoArgs& aLoadInfoArgs)
|
const OptionalLoadInfoArgs& aLoadInfoArgs)
|
||||||
{
|
{
|
||||||
LOG(("WebSocketChannelParent::RecvAsyncOpen() %p\n", this));
|
LOG(("WebSocketChannelParent::RecvAsyncOpen() %p\n", this));
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class WebSocketChannelParent : public PWebSocketParent,
|
|||||||
const bool& aClientSetPingInterval,
|
const bool& aClientSetPingInterval,
|
||||||
const uint32_t& aPingTimeout,
|
const uint32_t& aPingTimeout,
|
||||||
const bool& aClientSetPingTimeout,
|
const bool& aClientSetPingTimeout,
|
||||||
const LoadInfoArgs& aLoadInfoArgs) override;
|
const OptionalLoadInfoArgs& aLoadInfoArgs) override;
|
||||||
bool RecvClose(const uint16_t & code, const nsCString & reason) override;
|
bool RecvClose(const uint16_t & code, const nsCString & reason) override;
|
||||||
bool RecvSendMsg(const nsCString& aMsg) override;
|
bool RecvSendMsg(const nsCString& aMsg) override;
|
||||||
bool RecvSendBinaryMsg(const nsCString& aMsg) override;
|
bool RecvSendBinaryMsg(const nsCString& aMsg) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user