// // Automatically generated by ipdlc. // Edit at your own risk // #include "mozilla/PWebBrowserPersistDocumentChild.h" #include "mozilla/AntiTrackingIPCUtils.h" #include "mozilla/ProfilerLabels.h" #include "mozilla/TimeStamp.h" #include "mozilla/WebBrowserPersistDocumentChild.h" #include "mozilla/dom/ConsoleReportIPCUtils.h" #include "mozilla/dom/DomSecurityIPCUtils.h" #include "mozilla/dom/FetchIPCTypes.h" #include "mozilla/dom/NavigationAPIIPCUtils.h" #include "mozilla/dom/PermissionsPolicyUtils.h" #include "mozilla/dom/PropertyBagUtils.h" #include "mozilla/dom/ReferrerInfoUtils.h" #include "mozilla/dom/RemoteType.h" #include "mozilla/dom/SessionHistoryEntry.h" #include "mozilla/ipc/IPCCore.h" #include "mozilla/ipc/IPCStreamUtils.h" #include "mozilla/ipc/URIUtils.h" #include "mozilla/net/CacheInfoIPCTypes.h" #include "mozilla/net/ClassOfService.h" #include "nsDOMNavigationTiming.h" #include "nsDocShellLoadState.h" #include "nsHttp.h" #include "nsHttpResponseHead.h" #include "nsIPrincipal.h" #include "nsIPropertyBag2.h" #include "nsIReferrerInfo.h" #include "mozilla/dom/PContentChild.h" #include "mozilla/PWebBrowserPersistResourcesChild.h" #include "mozilla/PWebBrowserPersistSerializeChild.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 { auto PWebBrowserPersistDocumentChild::RecvPWebBrowserPersistResourcesConstructor(PWebBrowserPersistResourcesChild* actor) -> mozilla::ipc::IPCResult { return IPC_OK(); } auto PWebBrowserPersistDocumentChild::RecvPWebBrowserPersistSerializeConstructor( PWebBrowserPersistSerializeChild* actor, const WebBrowserPersistURIMap& aMap, const nsACString& aRequestedContentType, const uint32_t& aEncoderFlags, const uint32_t& aWrapColumn) -> mozilla::ipc::IPCResult { return IPC_OK(); } auto PWebBrowserPersistDocumentChild::Recv__delete__() -> mozilla::ipc::IPCResult { return IPC_OK(); } MOZ_IMPLICIT PWebBrowserPersistDocumentChild::PWebBrowserPersistDocumentChild() : mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ChildSide) { MOZ_COUNT_CTOR(PWebBrowserPersistDocumentChild); } PWebBrowserPersistDocumentChild::~PWebBrowserPersistDocumentChild() { MOZ_COUNT_DTOR(PWebBrowserPersistDocumentChild); } auto PWebBrowserPersistDocumentChild::ActorAlloc() -> void { AddRef(); } auto PWebBrowserPersistDocumentChild::ActorDealloc() -> void { Release(); } auto PWebBrowserPersistDocumentChild::OtherPid() const -> ::base::ProcessId { ::base::ProcessId pid = ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid(); MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId); return pid; } auto PWebBrowserPersistDocumentChild::OtherChildID() const -> ::GeckoChildID { ::GeckoChildID childID = ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid(); MOZ_RELEASE_ASSERT(childID != -1); return childID; } auto PWebBrowserPersistDocumentChild::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo { return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()}; } auto PWebBrowserPersistDocumentChild::Manager() const -> PContentChild* { return static_cast(IProtocol::Manager()); } auto PWebBrowserPersistDocumentChild::ManagedPWebBrowserPersistResourcesChild(nsTArray& aArr) const -> void { mManagedPWebBrowserPersistResourcesChild.ToArray(aArr); } auto PWebBrowserPersistDocumentChild::ManagedPWebBrowserPersistResourcesChild() const -> const ManagedContainer& { return mManagedPWebBrowserPersistResourcesChild; } auto PWebBrowserPersistDocumentChild::ManagedPWebBrowserPersistSerializeChild(nsTArray& aArr) const -> void { mManagedPWebBrowserPersistSerializeChild.ToArray(aArr); } auto PWebBrowserPersistDocumentChild::ManagedPWebBrowserPersistSerializeChild() const -> const ManagedContainer& { return mManagedPWebBrowserPersistSerializeChild; } auto PWebBrowserPersistDocumentChild::ManagedProtocolIds() const -> mozilla::Span { static constexpr ::mozilla::ipc::ProtocolId sIds[] = { PWebBrowserPersistResourcesMsgStart, PWebBrowserPersistSerializeMsgStart }; return sIds; } auto PWebBrowserPersistDocumentChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer* { switch (aProtocol) { case PWebBrowserPersistResourcesMsgStart: return (&(mManagedPWebBrowserPersistResourcesChild)); case PWebBrowserPersistSerializeMsgStart: return (&(mManagedPWebBrowserPersistSerializeChild)); default: return nullptr; } } auto PWebBrowserPersistDocumentChild::OpenPWebBrowserPersistResourcesEndpoint(PWebBrowserPersistResourcesChild* aActor) -> ManagedEndpoint { if (!aActor) { NS_WARNING("Cannot bind null PWebBrowserPersistResourcesChild actor"); return ManagedEndpoint(); } if (!aActor->SetManagerAndRegister(this)) { NS_WARNING("Failed to bind PWebBrowserPersistResourcesChild actor"); return ManagedEndpoint(); } // Mark our actor as awaiting the other side to be bound. This will // be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is // received. aActor->mAwaitingManagedEndpointBind = true; return ManagedEndpoint(mozilla::ipc::PrivateIPDLInterface(), aActor); } auto PWebBrowserPersistDocumentChild::BindPWebBrowserPersistResourcesEndpoint( ManagedEndpoint aEndpoint, PWebBrowserPersistResourcesChild* aActor) -> bool { return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this); } auto PWebBrowserPersistDocumentChild::OpenPWebBrowserPersistSerializeEndpoint(PWebBrowserPersistSerializeChild* aActor) -> ManagedEndpoint { if (!aActor) { NS_WARNING("Cannot bind null PWebBrowserPersistSerializeChild actor"); return ManagedEndpoint(); } if (!aActor->SetManagerAndRegister(this)) { NS_WARNING("Failed to bind PWebBrowserPersistSerializeChild actor"); return ManagedEndpoint(); } // Mark our actor as awaiting the other side to be bound. This will // be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is // received. aActor->mAwaitingManagedEndpointBind = true; return ManagedEndpoint(mozilla::ipc::PrivateIPDLInterface(), aActor); } auto PWebBrowserPersistDocumentChild::BindPWebBrowserPersistSerializeEndpoint( ManagedEndpoint aEndpoint, PWebBrowserPersistSerializeChild* aActor) -> bool { return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this); } auto PWebBrowserPersistDocumentChild::SendAttributes( const WebBrowserPersistDocumentAttrs& aAttrs, mozilla::NotNull aPrincipal, nsIInputStream* aStream) -> bool { UniquePtr msg__ = PWebBrowserPersistDocument::Msg_Attributes(Id()); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), aAttrs); // Sentinel = 'aAttrs' ((&(writer__)))->WriteSentinel(135529072); IPC::WriteParam((&(writer__)), aPrincipal); // Sentinel = 'aPrincipal' ((&(writer__)))->WriteSentinel(364381188); IPC::WriteParam((&(writer__)), aStream); // Sentinel = 'aStream' ((&(writer__)))->WriteSentinel(185205454); if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_Attributes", OTHER); bool sendok__ = ChannelSend(std::move(msg__)); return sendok__; } auto PWebBrowserPersistDocumentChild::SendInitFailure(const nsresult& aStatus) -> bool { UniquePtr msg__ = PWebBrowserPersistDocument::Msg_InitFailure(Id()); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), aStatus); // Sentinel = 'aStatus' ((&(writer__)))->WriteSentinel(186712806); if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_InitFailure", OTHER); bool sendok__ = ChannelSend(std::move(msg__)); return sendok__; } auto PWebBrowserPersistDocumentChild::DeallocManagee( mozilla::ipc::ProtocolId aProtocolId, IProtocol* aListener) -> void { switch (aProtocolId) { case PWebBrowserPersistResourcesMsgStart: static_cast<::mozilla::WebBrowserPersistDocumentChild*>(this)->DeallocPWebBrowserPersistResourcesChild(static_cast(aListener)); return; case PWebBrowserPersistSerializeMsgStart: static_cast<::mozilla::WebBrowserPersistDocumentChild*>(this)->DeallocPWebBrowserPersistSerializeChild(static_cast(aListener)); return; default: FatalError("unreached"); return; } } auto PWebBrowserPersistDocumentChild::OnMessageReceived(const Message& msg__) -> PWebBrowserPersistDocumentChild::Result { if (!CanSend()) { if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Ignored message for dead actor", (&(msg__))->type(), mozilla::ipc::MessageDirection::eSending); } return MsgProcessed; } 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 PWebBrowserPersistDocument::Msg_SetPersistFlags__ID: { if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_SetPersistFlags", OTHER); IPC::MessageReader reader__{ msg__, this}; auto maybe__aNewFlags = IPC::ReadParam((&(reader__))); if (!maybe__aNewFlags) { FatalError("Error deserializing 'uint32_t'"); return MsgValueError; } auto& aNewFlags = *maybe__aNewFlags; // Sentinel = 'aNewFlags' if ((!(((&(reader__)))->ReadSentinel(283181945)))) { mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'"); return MsgValueError; } reader__.EndRead(); mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::WebBrowserPersistDocumentChild*>(this))->RecvSetPersistFlags(std::move(aNewFlags)); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } case PWebBrowserPersistDocument::Msg_PWebBrowserPersistResourcesConstructor__ID: { if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_PWebBrowserPersistResourcesConstructor", OTHER); IPC::MessageReader reader__{ msg__, this}; auto maybe__actorid__ = IPC::ReadParam((&(reader__))); if (!maybe__actorid__) { FatalError("Error deserializing 'mozilla::ipc::ActorId'"); return MsgValueError; } auto& actorid__ = *maybe__actorid__; // Sentinel = 'actorid' if ((!(((&(reader__)))->ReadSentinel(193725159)))) { mozilla::ipc::SentinelReadError("Error deserializing 'mozilla::ipc::ActorId'"); return MsgValueError; } reader__.EndRead(); // Ensure the ID which was sent to us is valid, and reserve a spot // in the table for the new actor before we bother to alloc it. if (!ToplevelProtocol()->TryReserve(actorid__)) { NS_WARNING("Failed to reserve ActorId for constructor"); return MsgValueError; } PWebBrowserPersistResourcesChild* actor = (static_cast<::mozilla::WebBrowserPersistDocumentChild*>(this))->AllocPWebBrowserPersistResourcesChild(); if (!actor) { NS_WARNING("Alloc function returned null"); // Clean up the reservation taken above if this fails, to avoid // leaving zombie entries in the map. ToplevelProtocol()->ClearReservation(actorid__); return MsgValueError; } // NOTE: SetManagerAndRegister unconditionally consumes the // reservation taken by TryReserve, so we don't need to clear it on // failure. if (!actor->SetManagerAndRegister(this, actorid__)) { NS_WARNING("Failed to set manager for constructor"); return MsgValueError; } mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::WebBrowserPersistDocumentChild*>(this))->RecvPWebBrowserPersistResourcesConstructor(std::move(actor)); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } case PWebBrowserPersistDocument::Msg_PWebBrowserPersistSerializeConstructor__ID: { if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_PWebBrowserPersistSerializeConstructor", OTHER); IPC::MessageReader reader__{ msg__, this}; auto maybe__actorid__ = IPC::ReadParam((&(reader__))); if (!maybe__actorid__) { FatalError("Error deserializing 'mozilla::ipc::ActorId'"); return MsgValueError; } auto& actorid__ = *maybe__actorid__; // Sentinel = 'actorid' if ((!(((&(reader__)))->ReadSentinel(193725159)))) { mozilla::ipc::SentinelReadError("Error deserializing 'mozilla::ipc::ActorId'"); return MsgValueError; } auto maybe__aMap = IPC::ReadParam((&(reader__))); if (!maybe__aMap) { FatalError("Error deserializing 'WebBrowserPersistURIMap'"); return MsgValueError; } auto& aMap = *maybe__aMap; // Sentinel = 'aMap' if ((!(((&(reader__)))->ReadSentinel(60883328)))) { mozilla::ipc::SentinelReadError("Error deserializing 'WebBrowserPersistURIMap'"); return MsgValueError; } auto maybe__aRequestedContentType = IPC::ReadParam((&(reader__))); if (!maybe__aRequestedContentType) { FatalError("Error deserializing 'nsCString'"); return MsgValueError; } auto& aRequestedContentType = *maybe__aRequestedContentType; // Sentinel = 'aRequestedContentType' if ((!(((&(reader__)))->ReadSentinel(1563297937)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'"); return MsgValueError; } auto maybe__aEncoderFlags = IPC::ReadParam((&(reader__))); if (!maybe__aEncoderFlags) { FatalError("Error deserializing 'uint32_t'"); return MsgValueError; } auto& aEncoderFlags = *maybe__aEncoderFlags; // Sentinel = 'aEncoderFlags' if ((!(((&(reader__)))->ReadSentinel(582354191)))) { mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'"); return MsgValueError; } auto maybe__aWrapColumn = IPC::ReadParam((&(reader__))); if (!maybe__aWrapColumn) { FatalError("Error deserializing 'uint32_t'"); return MsgValueError; } auto& aWrapColumn = *maybe__aWrapColumn; // Sentinel = 'aWrapColumn' if ((!(((&(reader__)))->ReadSentinel(432669802)))) { mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'"); return MsgValueError; } reader__.EndRead(); // Ensure the ID which was sent to us is valid, and reserve a spot // in the table for the new actor before we bother to alloc it. if (!ToplevelProtocol()->TryReserve(actorid__)) { NS_WARNING("Failed to reserve ActorId for constructor"); return MsgValueError; } PWebBrowserPersistSerializeChild* actor = (static_cast<::mozilla::WebBrowserPersistDocumentChild*>(this))->AllocPWebBrowserPersistSerializeChild(aMap, aRequestedContentType, aEncoderFlags, aWrapColumn); if (!actor) { NS_WARNING("Alloc function returned null"); // Clean up the reservation taken above if this fails, to avoid // leaving zombie entries in the map. ToplevelProtocol()->ClearReservation(actorid__); return MsgValueError; } // NOTE: SetManagerAndRegister unconditionally consumes the // reservation taken by TryReserve, so we don't need to clear it on // failure. if (!actor->SetManagerAndRegister(this, actorid__)) { NS_WARNING("Failed to set manager for constructor"); return MsgValueError; } mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::WebBrowserPersistDocumentChild*>(this))->RecvPWebBrowserPersistSerializeConstructor(std::move(actor), std::move(aMap), std::move(aRequestedContentType), std::move(aEncoderFlags), std::move(aWrapColumn)); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } case PWebBrowserPersistDocument::Msg___delete____ID: { if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg___delete__", OTHER); DoomSubtree(); mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::WebBrowserPersistDocumentChild*>(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; } default: return MsgNotKnown; } } auto PWebBrowserPersistDocumentChild::OnMessageReceived( const Message& msg__, UniquePtr& reply__) -> PWebBrowserPersistDocumentChild::Result { if (!CanSend()) { return MsgDropped; } return MsgNotKnown; } } // namespace mozilla