Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/net/PDocumentChannelParent.h"
#include "mozilla/AntiTrackingIPCUtils.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/RemoteLazyInputStream.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/CSPMessageUtils.h"
#include "mozilla/dom/DocShellMessageUtils.h"
#include "mozilla/dom/FetchIPCTypes.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/PropertyBagUtils.h"
#include "mozilla/dom/ReferrerInfoUtils.h"
#include "mozilla/dom/ServiceWorkerIPCUtils.h"
#include "mozilla/dom/SessionHistoryEntry.h"
#include "mozilla/dom/TabMessageUtils.h"
#include "mozilla/ipc/BigBuffer.h"
#include "mozilla/ipc/IPCCore.h"
#include "mozilla/ipc/IPCStreamUtils.h"
#include "mozilla/ipc/SerializedStructuredCloneBuffer.h"
#include "mozilla/ipc/URIUtils.h"
#include "mozilla/layers/LayersMessageUtils.h"
#include "mozilla/net/CacheInfoIPCTypes.h"
#include "mozilla/net/ClassOfService.h"
#include "mozilla/net/DocumentChannelParent.h"
#include "mozilla/net/NeckoMessageUtils.h"
#include "nsDOMNavigationTiming.h"
#include "nsDocShellLoadState.h"
#include "nsHttp.h"
#include "nsHttpHeaderArray.h"
#include "nsHttpResponseHead.h"
#include "nsIContentSecurityPolicy.h"
#include "nsIPrincipal.h"
#include "nsIPropertyBag2.h"
#include "nsIReferrerInfo.h"
#include "nsIURI.h"
#include "nsIVariant.h"
#include "mozilla/net/PNeckoParent.h"
#include "mozilla/extensions/PStreamFilterParent.h"
#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "nsIFile.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/ProtocolMessageUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/ShmemMessageUtils.h"
#include "mozilla/ipc/TaintingIPCUtils.h"
namespace mozilla {
namespace net {
auto PDocumentChannelParent::Recv__delete__() -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
MOZ_IMPLICIT PDocumentChannelParent::PDocumentChannelParent() :
mozilla::ipc::IRefCountedProtocol(PDocumentChannelMsgStart, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PDocumentChannelParent);
}
PDocumentChannelParent::~PDocumentChannelParent()
{
MOZ_COUNT_DTOR(PDocumentChannelParent);
}
auto PDocumentChannelParent::ActorAlloc() -> void
{
AddRef();
}
auto PDocumentChannelParent::ActorDealloc() -> void
{
Release();
}
auto PDocumentChannelParent::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PDocumentChannelParent::Manager() const -> PNeckoParent*
{
return static_cast<PNeckoParent*>(IProtocol::Manager());
}
auto PDocumentChannelParent::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PDocumentChannelParent::SendFailedAsyncOpen(const nsresult& status) -> bool
{
UniquePtr<IPC::Message> msg__ = PDocumentChannel::Msg_FailedAsyncOpen(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), status);
// Sentinel = 'status'
((&(writer__)))->WriteSentinel(154731173);
if (mozilla::ipc::LoggingEnabledFor("PDocumentChannel", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PDocumentChannelParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PDocumentChannel::Msg_FailedAsyncOpen", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PDocumentChannelParent::SendDisconnectChildListeners(
const nsresult& aStatus,
const nsresult& aLoadGroupReason,
const bool& aContinueNavigating) -> bool
{
UniquePtr<IPC::Message> msg__ = PDocumentChannel::Msg_DisconnectChildListeners(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aStatus);
// Sentinel = 'aStatus'
((&(writer__)))->WriteSentinel(186712806);
IPC::WriteParam((&(writer__)), aLoadGroupReason);
// Sentinel = 'aLoadGroupReason'
((&(writer__)))->WriteSentinel(879822423);
IPC::WriteParam((&(writer__)), aContinueNavigating);
// Sentinel = 'aContinueNavigating'
((&(writer__)))->WriteSentinel(1271859119);
if (mozilla::ipc::LoggingEnabledFor("PDocumentChannel", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PDocumentChannelParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PDocumentChannel::Msg_DisconnectChildListeners", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PDocumentChannelParent::SendRedirectToRealChannel(
const RedirectToRealChannelArgs& args,
nsTArray<Endpoint<::mozilla::extensions::PStreamFilterParent>>&& aEndpoint,
mozilla::ipc::ResolveCallback<nsresult>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PDocumentChannel::Msg_RedirectToRealChannel(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), args);
// Sentinel = 'args'
((&(writer__)))->WriteSentinel(69140910);
IPC::WriteParam((&(writer__)), std::move(aEndpoint));
// Sentinel = 'aEndpoint'
((&(writer__)))->WriteSentinel(292225955);
if (mozilla::ipc::LoggingEnabledFor("PDocumentChannel", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PDocumentChannelParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PDocumentChannel::Msg_RedirectToRealChannel", OTHER);
ChannelSend(std::move(msg__), PDocumentChannel::Reply_RedirectToRealChannel__ID, std::move(aResolve), std::move(aReject));
return;
}
auto PDocumentChannelParent::SendRedirectToRealChannel(
const RedirectToRealChannelArgs& args,
nsTArray<Endpoint<::mozilla::extensions::PStreamFilterParent>>&& aEndpoint) -> RefPtr<RedirectToRealChannelPromise>
{
RefPtr<MozPromise<nsresult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<nsresult, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendRedirectToRealChannel(std::move(args), std::move(aEndpoint), [promise__](nsresult&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PDocumentChannelParent::SendUpgradeObjectLoad(
mozilla::ipc::ResolveCallback<MaybeDiscardedBrowsingContext>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PDocumentChannel::Msg_UpgradeObjectLoad(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PDocumentChannel", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PDocumentChannelParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PDocumentChannel::Msg_UpgradeObjectLoad", OTHER);
ChannelSend(std::move(msg__), PDocumentChannel::Reply_UpgradeObjectLoad__ID, std::move(aResolve), std::move(aReject));
return;
}
auto PDocumentChannelParent::SendUpgradeObjectLoad() -> RefPtr<UpgradeObjectLoadPromise>
{
RefPtr<MozPromise<MaybeDiscardedBrowsingContext, ResponseRejectReason, true>::Private> promise__ = new MozPromise<MaybeDiscardedBrowsingContext, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendUpgradeObjectLoad([promise__](MaybeDiscardedBrowsingContext&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PDocumentChannelParent::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PDocumentChannelParent::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PDocumentChannelParent::OnMessageReceived(const Message& msg__) -> PDocumentChannelParent::Result
{
switch (msg__.type()) {
case MANAGED_ENDPOINT_BOUND_MESSAGE_TYPE:
{
if (!mAwaitingManagedEndpointBind) {
NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
return MsgNotAllowed;
}
mAwaitingManagedEndpointBind = false;
return MsgProcessed;
}
case MANAGED_ENDPOINT_DROPPED_MESSAGE_TYPE:
{
if (!mAwaitingManagedEndpointBind) {
NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
return MsgNotAllowed;
}
mAwaitingManagedEndpointBind = false;
this->ActorDisconnected(ManagedEndpointDropped);
return MsgProcessed;
}
case PDocumentChannel::Msg_Cancel__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PDocumentChannel", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PDocumentChannelParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PDocumentChannel::Msg_Cancel", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__status = IPC::ReadParam<nsresult>((&(reader__)));
if (!maybe__status) {
FatalError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto& status = *maybe__status;
// Sentinel = 'status'
if ((!(((&(reader__)))->ReadSentinel(154731173)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto maybe__reason = IPC::ReadParam<nsCString>((&(reader__)));
if (!maybe__reason) {
FatalError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto& reason = *maybe__reason;
// Sentinel = 'reason'
if ((!(((&(reader__)))->ReadSentinel(148112009)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<DocumentChannelParent*>(this))->RecvCancel(std::move(status), std::move(reason));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PDocumentChannel::Msg___delete____ID:
{
if (mozilla::ipc::LoggingEnabledFor("PDocumentChannel", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PDocumentChannelParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PDocumentChannel::Msg___delete__", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<DocumentChannelParent*>(this))->Recv__delete__();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
this->ActorDisconnected(Deletion);
return MsgProcessed;
}
case PDocumentChannel::Reply_RedirectToRealChannel__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PDocumentChannel", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PDocumentChannelParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PDocumentChannel::Msg_RedirectToRealChannel", OTHER);
IPC::MessageReader reader__{
msg__,
this};
bool resolve__ = false;
if (!IPC::ReadParam(&reader__, &resolve__)) {
FatalError("Error deserializing bool");
return MsgValueError;
}
UniquePtr<MessageChannel::UntypedCallbackHolder> untypedCallback =
GetIPCChannel()->PopCallback(msg__, Id());
typedef MessageChannel::CallbackHolder<nsresult> CallbackHolder;
auto* callback = static_cast<CallbackHolder*>(untypedCallback.get());
if (!callback) {
FatalError("Error unknown callback");
return MsgProcessingError;
}
if (resolve__) {
auto maybe__rv = IPC::ReadParam<nsresult>((&(reader__)));
if (!maybe__rv) {
FatalError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto& rv = *maybe__rv;
// Sentinel = 'rv'
if ((!(((&(reader__)))->ReadSentinel(22806761)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
return MsgValueError;
}
reader__.EndRead();
callback->Resolve(std::move(rv));
} else {
ResponseRejectReason reason__{};
if (!IPC::ReadParam(&reader__, &reason__)) {
FatalError("Error deserializing ResponseRejectReason");
return MsgValueError;
}
reader__.EndRead();
callback->Reject(std::move(reason__));
}
return MsgProcessed;
}
case PDocumentChannel::Reply_UpgradeObjectLoad__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PDocumentChannel", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PDocumentChannelParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PDocumentChannel::Msg_UpgradeObjectLoad", OTHER);
IPC::MessageReader reader__{
msg__,
this};
bool resolve__ = false;
if (!IPC::ReadParam(&reader__, &resolve__)) {
FatalError("Error deserializing bool");
return MsgValueError;
}
UniquePtr<MessageChannel::UntypedCallbackHolder> untypedCallback =
GetIPCChannel()->PopCallback(msg__, Id());
typedef MessageChannel::CallbackHolder<MaybeDiscardedBrowsingContext> CallbackHolder;
auto* callback = static_cast<CallbackHolder*>(untypedCallback.get());
if (!callback) {
FatalError("Error unknown callback");
return MsgProcessingError;
}
if (resolve__) {
auto maybe__frameContext = IPC::ReadParam<MaybeDiscardedBrowsingContext>((&(reader__)));
if (!maybe__frameContext) {
FatalError("Error deserializing 'MaybeDiscardedBrowsingContext'");
return MsgValueError;
}
auto& frameContext = *maybe__frameContext;
// Sentinel = 'frameContext'
if ((!(((&(reader__)))->ReadSentinel(528024817)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'MaybeDiscardedBrowsingContext'");
return MsgValueError;
}
reader__.EndRead();
callback->Resolve(std::move(frameContext));
} else {
ResponseRejectReason reason__{};
if (!IPC::ReadParam(&reader__, &reason__)) {
FatalError("Error deserializing ResponseRejectReason");
return MsgValueError;
}
reader__.EndRead();
callback->Reject(std::move(reason__));
}
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
auto PDocumentChannelParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PDocumentChannelParent::Result
{
return MsgNotKnown;
}
auto PDocumentChannelParent::DoomSubtree() -> void
{
SetDoomed();
}
auto PDocumentChannelParent::PeekManagedActor() -> IProtocol*
{
return nullptr;
}
} // namespace net
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::net::PDocumentChannelParent*>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
MOZ_RELEASE_ASSERT(
aWriter->GetActor(),
"Cannot serialize managed actors without an actor");
int32_t id;
if (!aVar) {
id = 0; // kNullActorId
} else {
id = aVar->Id();
if (id == 1) { // kFreedActorId
aVar->FatalError("Actor has been |delete|d");
}
MOZ_RELEASE_ASSERT(
aWriter->GetActor()->GetIPCChannel() == aVar->GetIPCChannel(),
"Actor must be from the same channel as the"
" actor it's being sent over");
MOZ_RELEASE_ASSERT(
aVar->CanSend(),
"Actor must still be open when sending");
}
IPC::WriteParam(aWriter, id);
}
auto ParamTraits<::mozilla::net::PDocumentChannelParent*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
MOZ_RELEASE_ASSERT(
aReader->GetActor(),
"Cannot deserialize managed actors without an actor");
mozilla::Maybe<mozilla::ipc::IProtocol*> actor = aReader->GetActor()
->ReadActor(aReader, true, "PDocumentChannel", PDocumentChannelMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::net::PDocumentChannelParent*>(actor.ref());
}
return {};
}
} // namespace IPC