// // Automatically generated by ipdlc. // Edit at your own risk // #include "mozilla/PWebBrowserPersistDocumentParent.h" #include "mozilla/AntiTrackingIPCUtils.h" #include "mozilla/ProfilerLabels.h" #include "mozilla/TimeStamp.h" #include "mozilla/WebBrowserPersistDocumentParent.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/PContentParent.h" #include "mozilla/PWebBrowserPersistResourcesParent.h" #include "mozilla/PWebBrowserPersistSerializeParent.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 { MOZ_IMPLICIT PWebBrowserPersistDocumentParent::PWebBrowserPersistDocumentParent() : mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ParentSide) { MOZ_COUNT_CTOR(PWebBrowserPersistDocumentParent); } PWebBrowserPersistDocumentParent::~PWebBrowserPersistDocumentParent() { MOZ_COUNT_DTOR(PWebBrowserPersistDocumentParent); } auto PWebBrowserPersistDocumentParent::ActorAlloc() -> void { AddRef(); } auto PWebBrowserPersistDocumentParent::ActorDealloc() -> void { Release(); } auto PWebBrowserPersistDocumentParent::OtherPid() const -> ::base::ProcessId { ::base::ProcessId pid = ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid(); MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId); return pid; } auto PWebBrowserPersistDocumentParent::OtherChildID() const -> ::GeckoChildID { ::GeckoChildID childID = ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid(); MOZ_RELEASE_ASSERT(childID != -1); return childID; } auto PWebBrowserPersistDocumentParent::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo { return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()}; } auto PWebBrowserPersistDocumentParent::Manager() const -> PContentParent* { return static_cast(IProtocol::Manager()); } auto PWebBrowserPersistDocumentParent::ManagedPWebBrowserPersistResourcesParent(nsTArray& aArr) const -> void { mManagedPWebBrowserPersistResourcesParent.ToArray(aArr); } auto PWebBrowserPersistDocumentParent::ManagedPWebBrowserPersistResourcesParent() const -> const ManagedContainer& { return mManagedPWebBrowserPersistResourcesParent; } auto PWebBrowserPersistDocumentParent::ManagedPWebBrowserPersistSerializeParent(nsTArray& aArr) const -> void { mManagedPWebBrowserPersistSerializeParent.ToArray(aArr); } auto PWebBrowserPersistDocumentParent::ManagedPWebBrowserPersistSerializeParent() const -> const ManagedContainer& { return mManagedPWebBrowserPersistSerializeParent; } auto PWebBrowserPersistDocumentParent::ManagedProtocolIds() const -> mozilla::Span { static constexpr ::mozilla::ipc::ProtocolId sIds[] = { PWebBrowserPersistResourcesMsgStart, PWebBrowserPersistSerializeMsgStart }; return sIds; } auto PWebBrowserPersistDocumentParent::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer* { switch (aProtocol) { case PWebBrowserPersistResourcesMsgStart: return (&(mManagedPWebBrowserPersistResourcesParent)); case PWebBrowserPersistSerializeMsgStart: return (&(mManagedPWebBrowserPersistSerializeParent)); default: return nullptr; } } auto PWebBrowserPersistDocumentParent::OpenPWebBrowserPersistResourcesEndpoint(PWebBrowserPersistResourcesParent* aActor) -> ManagedEndpoint { if (!aActor) { NS_WARNING("Cannot bind null PWebBrowserPersistResourcesParent actor"); return ManagedEndpoint(); } if (!aActor->SetManagerAndRegister(this)) { NS_WARNING("Failed to bind PWebBrowserPersistResourcesParent 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 PWebBrowserPersistDocumentParent::BindPWebBrowserPersistResourcesEndpoint( ManagedEndpoint aEndpoint, PWebBrowserPersistResourcesParent* aActor) -> bool { return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this); } auto PWebBrowserPersistDocumentParent::OpenPWebBrowserPersistSerializeEndpoint(PWebBrowserPersistSerializeParent* aActor) -> ManagedEndpoint { if (!aActor) { NS_WARNING("Cannot bind null PWebBrowserPersistSerializeParent actor"); return ManagedEndpoint(); } if (!aActor->SetManagerAndRegister(this)) { NS_WARNING("Failed to bind PWebBrowserPersistSerializeParent 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 PWebBrowserPersistDocumentParent::BindPWebBrowserPersistSerializeEndpoint( ManagedEndpoint aEndpoint, PWebBrowserPersistSerializeParent* aActor) -> bool { return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this); } auto PWebBrowserPersistDocumentParent::SendSetPersistFlags(const uint32_t& aNewFlags) -> bool { UniquePtr msg__ = PWebBrowserPersistDocument::Msg_SetPersistFlags(Id()); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), aNewFlags); // Sentinel = 'aNewFlags' ((&(writer__)))->WriteSentinel(283181945); if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentParent", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_SetPersistFlags", OTHER); bool sendok__ = ChannelSend(std::move(msg__)); return sendok__; } auto PWebBrowserPersistDocumentParent::SendPWebBrowserPersistResourcesConstructor() -> PWebBrowserPersistResourcesParent* { PWebBrowserPersistResourcesParent* actor = (static_cast<::mozilla::WebBrowserPersistDocumentParent*>(this))->AllocPWebBrowserPersistResourcesParent(); return SendPWebBrowserPersistResourcesConstructor(std::forward(actor)); } auto PWebBrowserPersistDocumentParent::SendPWebBrowserPersistResourcesConstructor(PWebBrowserPersistResourcesParent* actor) -> PWebBrowserPersistResourcesParent* { if (!actor) { NS_WARNING("Cannot bind null PWebBrowserPersistResourcesParent actor"); return nullptr; } if (!actor->SetManagerAndRegister(this)) { NS_WARNING("Failed to bind PWebBrowserPersistResourcesParent actor"); return nullptr; } // Build our constructor message. UniquePtr msg__ = PWebBrowserPersistDocument::Msg_PWebBrowserPersistResourcesConstructor(Id()); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), (actor)->Id()); // Sentinel = 'actorid' ((&(writer__)))->WriteSentinel(193725159); // Notify the other side about the newly created actor. This can // fail if our manager has already been destroyed. // // NOTE: If the send call fails due to toplevel channel teardown, // the `IProtocol::ChannelSend` wrapper absorbs the error for us, // so we don't tear down actors unexpectedly. if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentParent", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_PWebBrowserPersistResourcesConstructor", OTHER); bool sendok__ = ChannelSend(std::move(msg__)); // Warn, destroy the actor, and return null if the message failed to // send. Otherwise, return the successfully created actor reference. if (!sendok__) { NS_WARNING("Error sending PWebBrowserPersistResourcesParent constructor"); actor->ActorDisconnected(FailedConstructor); return nullptr; } return actor; } auto PWebBrowserPersistDocumentParent::SendPWebBrowserPersistSerializeConstructor( const WebBrowserPersistURIMap& aMap, const nsACString& aRequestedContentType, const uint32_t& aEncoderFlags, const uint32_t& aWrapColumn) -> PWebBrowserPersistSerializeParent* { PWebBrowserPersistSerializeParent* actor = (static_cast<::mozilla::WebBrowserPersistDocumentParent*>(this))->AllocPWebBrowserPersistSerializeParent(aMap, aRequestedContentType, aEncoderFlags, aWrapColumn); return SendPWebBrowserPersistSerializeConstructor(std::forward(actor), std::forward(aMap), std::forward(aRequestedContentType), std::forward(aEncoderFlags), std::forward(aWrapColumn)); } auto PWebBrowserPersistDocumentParent::SendPWebBrowserPersistSerializeConstructor( PWebBrowserPersistSerializeParent* actor, const WebBrowserPersistURIMap& aMap, const nsACString& aRequestedContentType, const uint32_t& aEncoderFlags, const uint32_t& aWrapColumn) -> PWebBrowserPersistSerializeParent* { if (!actor) { NS_WARNING("Cannot bind null PWebBrowserPersistSerializeParent actor"); return nullptr; } if (!actor->SetManagerAndRegister(this)) { NS_WARNING("Failed to bind PWebBrowserPersistSerializeParent actor"); return nullptr; } // Build our constructor message. UniquePtr msg__ = PWebBrowserPersistDocument::Msg_PWebBrowserPersistSerializeConstructor(Id()); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), (actor)->Id()); // Sentinel = 'actorid' ((&(writer__)))->WriteSentinel(193725159); IPC::WriteParam((&(writer__)), aMap); // Sentinel = 'aMap' ((&(writer__)))->WriteSentinel(60883328); IPC::WriteParam((&(writer__)), aRequestedContentType); // Sentinel = 'aRequestedContentType' ((&(writer__)))->WriteSentinel(1563297937); IPC::WriteParam((&(writer__)), aEncoderFlags); // Sentinel = 'aEncoderFlags' ((&(writer__)))->WriteSentinel(582354191); IPC::WriteParam((&(writer__)), aWrapColumn); // Sentinel = 'aWrapColumn' ((&(writer__)))->WriteSentinel(432669802); // Notify the other side about the newly created actor. This can // fail if our manager has already been destroyed. // // NOTE: If the send call fails due to toplevel channel teardown, // the `IProtocol::ChannelSend` wrapper absorbs the error for us, // so we don't tear down actors unexpectedly. if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentParent", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_PWebBrowserPersistSerializeConstructor", OTHER); bool sendok__ = ChannelSend(std::move(msg__)); // Warn, destroy the actor, and return null if the message failed to // send. Otherwise, return the successfully created actor reference. if (!sendok__) { NS_WARNING("Error sending PWebBrowserPersistSerializeParent constructor"); actor->ActorDisconnected(FailedConstructor); return nullptr; } return actor; } auto PWebBrowserPersistDocumentParent::Send__delete__(PWebBrowserPersistDocumentParent* actor) -> bool { if (!actor || !actor->CanSend()) { NS_WARNING("Attempt to __delete__ missing or closed actor"); return false; } UniquePtr msg__ = PWebBrowserPersistDocument::Msg___delete__((actor)->Id()); IPC::MessageWriter writer__{ (*(msg__)), actor}; if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentParent", actor->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg___delete__", OTHER); bool sendok__ = (actor)->ChannelSend(std::move(msg__)); actor->ActorDisconnected(Deletion); return sendok__; } auto PWebBrowserPersistDocumentParent::DeallocManagee( mozilla::ipc::ProtocolId aProtocolId, IProtocol* aListener) -> void { switch (aProtocolId) { case PWebBrowserPersistResourcesMsgStart: static_cast<::mozilla::WebBrowserPersistDocumentParent*>(this)->DeallocPWebBrowserPersistResourcesParent(static_cast(aListener)); return; case PWebBrowserPersistSerializeMsgStart: static_cast<::mozilla::WebBrowserPersistDocumentParent*>(this)->DeallocPWebBrowserPersistSerializeParent(static_cast(aListener)); return; default: FatalError("unreached"); return; } } auto PWebBrowserPersistDocumentParent::OnMessageReceived(const Message& msg__) -> PWebBrowserPersistDocumentParent::Result { if (!CanSend()) { if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentParent", 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_Attributes__ID: { if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentParent", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_Attributes", OTHER); IPC::MessageReader reader__{ msg__, this}; auto maybe__aAttrs = IPC::ReadParam((&(reader__))); if (!maybe__aAttrs) { FatalError("Error deserializing 'WebBrowserPersistDocumentAttrs'"); return MsgValueError; } auto& aAttrs = *maybe__aAttrs; // Sentinel = 'aAttrs' if ((!(((&(reader__)))->ReadSentinel(135529072)))) { mozilla::ipc::SentinelReadError("Error deserializing 'WebBrowserPersistDocumentAttrs'"); return MsgValueError; } auto maybe__aPrincipal = IPC::ReadParam>>((&(reader__))); if (!maybe__aPrincipal) { FatalError("Error deserializing 'NotNull'"); return MsgValueError; } auto& aPrincipal = *maybe__aPrincipal; // Sentinel = 'aPrincipal' if ((!(((&(reader__)))->ReadSentinel(364381188)))) { mozilla::ipc::SentinelReadError("Error deserializing 'NotNull'"); return MsgValueError; } auto maybe__aStream = IPC::ReadParam>((&(reader__))); if (!maybe__aStream) { FatalError("Error deserializing 'nsIInputStream'"); return MsgValueError; } auto& aStream = *maybe__aStream; // Sentinel = 'aStream' if ((!(((&(reader__)))->ReadSentinel(185205454)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsIInputStream'"); return MsgValueError; } reader__.EndRead(); mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::WebBrowserPersistDocumentParent*>(this))->RecvAttributes(std::move(aAttrs), aPrincipal, aStream); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } case PWebBrowserPersistDocument::Msg_InitFailure__ID: { if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocument", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PWebBrowserPersistDocumentParent", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_InitFailure", OTHER); IPC::MessageReader reader__{ msg__, this}; auto maybe__aStatus = IPC::ReadParam((&(reader__))); if (!maybe__aStatus) { FatalError("Error deserializing 'nsresult'"); return MsgValueError; } auto& aStatus = *maybe__aStatus; // Sentinel = 'aStatus' if ((!(((&(reader__)))->ReadSentinel(186712806)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'"); return MsgValueError; } reader__.EndRead(); mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::WebBrowserPersistDocumentParent*>(this))->RecvInitFailure(std::move(aStatus)); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } case PWebBrowserPersistDocument::Reply_PWebBrowserPersistResourcesConstructor__ID: { return MsgProcessed; } case PWebBrowserPersistDocument::Reply_PWebBrowserPersistSerializeConstructor__ID: { return MsgProcessed; } case PWebBrowserPersistDocument::Reply___delete____ID: { return MsgProcessed; } default: return MsgNotKnown; } } auto PWebBrowserPersistDocumentParent::OnMessageReceived( const Message& msg__, UniquePtr& reply__) -> PWebBrowserPersistDocumentParent::Result { if (!CanSend()) { return MsgDropped; } return MsgNotKnown; } } // namespace mozilla