//
// Automatically generated by ipdlc.
// Edit at your own risk
//


#include "mozilla/dom/BindingIPCUtils.h"
#include "mozilla/dom/ClientIPCUtils.h"
#include "ipc/ErrorIPCUtils.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/dom/CSPMessageUtils.h"
#include "mozilla/dom/PolicyContainerMessageUtils.h"
#include "mozilla/dom/DocShellMessageUtils.h"
#include "mozilla/dom/NavigationAPIIPCUtils.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/PropertyBagUtils.h"
#include "mozilla/dom/ReferrerInfoUtils.h"
#include "mozilla/dom/TabMessageUtils.h"
#include "mozilla/dom/notification/IPCUtils.h"
#include "mozilla/ipc/URIUtils.h"
#include "mozilla/layers/LayersMessageUtils.h"
#include "mozilla/net/NeckoMessageUtils.h"
#include "mozilla/URLClassifierIPCUtils.h"
#include "mozilla/dom/JSIPCValue.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"


//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct JSIPCDOMRect|
//
namespace mozilla {
namespace dom {
auto JSIPCDOMRect::StaticAssertions() const -> void
{
    static_assert(
        (offsetof(JSIPCDOMRect, height_) - offsetof(JSIPCDOMRect, x_)) == 24,
        "Bad assumptions about field layout!");
}

} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::JSIPCDOMRect>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    (aWriter)->WriteBytes((&((aVar).x())), 32);
    // Sentinel = 'x | y | width | height'
    (aWriter)->WriteSentinel(1431373759);
}

auto ParamTraits<::mozilla::dom::JSIPCDOMRect>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    IPC::ReadResult<paramType> result__{
            std::in_place,
            double{0},
            double{0},
            double{0},
            double{0}};
    if ((!((aReader)->ReadBytesInto((&((result__)->x())), 32)))) {
        aReader->FatalError("Error bulk reading fields from double");
        return {};
    }
    // Sentinel = 'x | y | width | height'
    if ((!((aReader)->ReadSentinel(1431373759)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from double");
        return {};
    }
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct JSIPCProperty|
//
namespace mozilla {
namespace dom {
} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::JSIPCProperty>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).name());
    // Sentinel = 'name'
    (aWriter)->WriteSentinel(69075362);
    IPC::WriteParam(aWriter, (aVar).value());
    // Sentinel = 'value'
    (aWriter)->WriteSentinel(107610654);
}

auto ParamTraits<::mozilla::dom::JSIPCProperty>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___name = IPC::ReadParam<::nsString>(aReader);
    if (!maybe___name) {
        aReader->FatalError("Error deserializing 'name' (nsString) member of 'JSIPCProperty'");
        return {};

    }
    auto& _name = *maybe___name;
    // Sentinel = 'name'
    if ((!((aReader)->ReadSentinel(69075362)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'name' (nsString) member of 'JSIPCProperty'");
        return {};
    }
    auto maybe___value = IPC::ReadParam<::mozilla::dom::JSIPCValue>(aReader);
    if (!maybe___value) {
        aReader->FatalError("Error deserializing 'value' (JSIPCValue) member of 'JSIPCProperty'");
        return {};

    }
    auto& _value = *maybe___value;
    // Sentinel = 'value'
    if ((!((aReader)->ReadSentinel(107610654)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'value' (JSIPCValue) member of 'JSIPCProperty'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_name),
            std::move(_value)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct JSIPCArray|
//
namespace mozilla {
namespace dom {
} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::JSIPCArray>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).elements());
    // Sentinel = 'elements'
    (aWriter)->WriteSentinel(249299806);
}

auto ParamTraits<::mozilla::dom::JSIPCArray>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___elements = IPC::ReadParam<nsTArray<::mozilla::dom::JSIPCValue>>(aReader);
    if (!maybe___elements) {
        aReader->FatalError("Error deserializing 'elements' (JSIPCValue[]) member of 'JSIPCArray'");
        return {};

    }
    auto& _elements = *maybe___elements;
    // Sentinel = 'elements'
    if ((!((aReader)->ReadSentinel(249299806)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'elements' (JSIPCValue[]) member of 'JSIPCArray'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_elements)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct JSIPCSet|
//
namespace mozilla {
namespace dom {
} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::JSIPCSet>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).elements());
    // Sentinel = 'elements'
    (aWriter)->WriteSentinel(249299806);
}

auto ParamTraits<::mozilla::dom::JSIPCSet>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___elements = IPC::ReadParam<nsTArray<::mozilla::dom::JSIPCValue>>(aReader);
    if (!maybe___elements) {
        aReader->FatalError("Error deserializing 'elements' (JSIPCValue[]) member of 'JSIPCSet'");
        return {};

    }
    auto& _elements = *maybe___elements;
    // Sentinel = 'elements'
    if ((!((aReader)->ReadSentinel(249299806)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'elements' (JSIPCValue[]) member of 'JSIPCSet'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_elements)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct JSIPCMapEntry|
//
namespace mozilla {
namespace dom {
} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::JSIPCMapEntry>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).key());
    // Sentinel = 'key'
    (aWriter)->WriteSentinel(42402122);
    IPC::WriteParam(aWriter, (aVar).value());
    // Sentinel = 'value'
    (aWriter)->WriteSentinel(107610654);
}

auto ParamTraits<::mozilla::dom::JSIPCMapEntry>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___key = IPC::ReadParam<::mozilla::dom::JSIPCValue>(aReader);
    if (!maybe___key) {
        aReader->FatalError("Error deserializing 'key' (JSIPCValue) member of 'JSIPCMapEntry'");
        return {};

    }
    auto& _key = *maybe___key;
    // Sentinel = 'key'
    if ((!((aReader)->ReadSentinel(42402122)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'key' (JSIPCValue) member of 'JSIPCMapEntry'");
        return {};
    }
    auto maybe___value = IPC::ReadParam<::mozilla::dom::JSIPCValue>(aReader);
    if (!maybe___value) {
        aReader->FatalError("Error deserializing 'value' (JSIPCValue) member of 'JSIPCMapEntry'");
        return {};

    }
    auto& _value = *maybe___value;
    // Sentinel = 'value'
    if ((!((aReader)->ReadSentinel(107610654)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'value' (JSIPCValue) member of 'JSIPCMapEntry'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_key),
            std::move(_value)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union JSIPCValue|
//
namespace mozilla {
namespace dom {
auto JSIPCValue::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case Tvoid_t:
        {
            (ptr_void_t())->~void_t__tdef();
            break;
        }
    case Tnull_t:
        {
            (ptr_null_t())->~null_t__tdef();
            break;
        }
    case TnsString:
        {
            (ptr_nsString())->~nsString__tdef();
            break;
        }
    case Tbool:
        {
            (ptr_bool())->~bool__tdef();
            break;
        }
    case Tdouble:
        {
            (ptr_double())->~double__tdef();
            break;
        }
    case Tint32_t:
        {
            (ptr_int32_t())->~int32_t__tdef();
            break;
        }
    case TStructuredCloneData:
        {
            (ptr_StructuredCloneData())->~StructuredCloneData__tdef();
            break;
        }
    case TClonedMessageData:
        {
            (ptr_ClonedMessageData())->~ClonedMessageData__tdef();
            break;
        }
    case TnsIPrincipal:
        {
            (ptr_nsIPrincipal())->~nsIPrincipal__tdef();
            break;
        }
    case TMaybeDiscardedBrowsingContext:
        {
            (ptr_MaybeDiscardedBrowsingContext())->~MaybeDiscardedBrowsingContext__tdef();
            break;
        }
    case TJSIPCDOMRect:
        {
            (ptr_JSIPCDOMRect())->~JSIPCDOMRect__tdef();
            break;
        }
    case TArrayOfJSIPCProperty:
        {
            delete ptr_ArrayOfJSIPCProperty();
            break;
        }
    case TJSIPCArray:
        {
            delete ptr_JSIPCArray();
            break;
        }
    case TJSIPCSet:
        {
            delete ptr_JSIPCSet();
            break;
        }
    case TArrayOfJSIPCMapEntry:
        {
            delete ptr_ArrayOfJSIPCMapEntry();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(const void_t& aOther)
{
    new (mozilla::KnownNotNull, ptr_void_t()) void_t(aOther);
    mType = Tvoid_t;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(void_t&& aOther)
{
    new (mozilla::KnownNotNull, ptr_void_t()) void_t(std::move(aOther));
    mType = Tvoid_t;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(const null_t& aOther)
{
    new (mozilla::KnownNotNull, ptr_null_t()) null_t(aOther);
    mType = Tnull_t;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(null_t&& aOther)
{
    new (mozilla::KnownNotNull, ptr_null_t()) null_t(std::move(aOther));
    mType = Tnull_t;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(const nsString& aOther)
{
    new (mozilla::KnownNotNull, ptr_nsString()) nsString(aOther);
    mType = TnsString;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(nsString&& aOther)
{
    new (mozilla::KnownNotNull, ptr_nsString()) nsString(std::move(aOther));
    mType = TnsString;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(const bool& aOther)
{
    new (mozilla::KnownNotNull, ptr_bool()) bool(aOther);
    mType = Tbool;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(bool&& aOther)
{
    new (mozilla::KnownNotNull, ptr_bool()) bool(std::move(aOther));
    mType = Tbool;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(const double& aOther)
{
    new (mozilla::KnownNotNull, ptr_double()) double(aOther);
    mType = Tdouble;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(double&& aOther)
{
    new (mozilla::KnownNotNull, ptr_double()) double(std::move(aOther));
    mType = Tdouble;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(const int32_t& aOther)
{
    new (mozilla::KnownNotNull, ptr_int32_t()) int32_t(aOther);
    mType = Tint32_t;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(int32_t&& aOther)
{
    new (mozilla::KnownNotNull, ptr_int32_t()) int32_t(std::move(aOther));
    mType = Tint32_t;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(UniquePtr<StructuredCloneData>&& aOther)
{
    new (mozilla::KnownNotNull, ptr_StructuredCloneData()) UniquePtr<StructuredCloneData>(std::move(aOther));
    mType = TStructuredCloneData;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(UniquePtr<ClonedMessageData>&& aOther)
{
    new (mozilla::KnownNotNull, ptr_ClonedMessageData()) UniquePtr<ClonedMessageData>(std::move(aOther));
    mType = TClonedMessageData;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(mozilla::NotNull<nsIPrincipal*> aOther)
{
    new (mozilla::KnownNotNull, ptr_nsIPrincipal()) mozilla::NotNull<RefPtr<nsIPrincipal>>(aOther);
    mType = TnsIPrincipal;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(mozilla::NotNull<RefPtr<nsIPrincipal>>&& aOther)
{
    new (mozilla::KnownNotNull, ptr_nsIPrincipal()) mozilla::NotNull<RefPtr<nsIPrincipal>>(std::move(aOther));
    mType = TnsIPrincipal;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(const MaybeDiscardedBrowsingContext& aOther)
{
    new (mozilla::KnownNotNull, ptr_MaybeDiscardedBrowsingContext()) MaybeDiscardedBrowsingContext(aOther);
    mType = TMaybeDiscardedBrowsingContext;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(MaybeDiscardedBrowsingContext&& aOther)
{
    new (mozilla::KnownNotNull, ptr_MaybeDiscardedBrowsingContext()) MaybeDiscardedBrowsingContext(std::move(aOther));
    mType = TMaybeDiscardedBrowsingContext;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(const JSIPCDOMRect& aOther)
{
    new (mozilla::KnownNotNull, ptr_JSIPCDOMRect()) JSIPCDOMRect(aOther);
    mType = TJSIPCDOMRect;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(JSIPCDOMRect&& aOther)
{
    new (mozilla::KnownNotNull, ptr_JSIPCDOMRect()) JSIPCDOMRect(std::move(aOther));
    mType = TJSIPCDOMRect;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(nsTArray<JSIPCProperty>&& aOther)
{
    ptr_ArrayOfJSIPCProperty() = new nsTArray<JSIPCProperty>(std::move(aOther));
    mType = TArrayOfJSIPCProperty;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(JSIPCArray&& aOther)
{
    ptr_JSIPCArray() = new JSIPCArray(std::move(aOther));
    mType = TJSIPCArray;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(JSIPCSet&& aOther)
{
    ptr_JSIPCSet() = new JSIPCSet(std::move(aOther));
    mType = TJSIPCSet;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(nsTArray<JSIPCMapEntry>&& aOther)
{
    ptr_ArrayOfJSIPCMapEntry() = new nsTArray<JSIPCMapEntry>(std::move(aOther));
    mType = TArrayOfJSIPCMapEntry;
}

MOZ_IMPLICIT JSIPCValue::JSIPCValue(JSIPCValue&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case Tvoid_t:
        {
            new (mozilla::KnownNotNull, ptr_void_t()) void_t(std::move((aOther).get_void_t()));
            (aOther).MaybeDestroy();
            break;
        }
    case Tnull_t:
        {
            new (mozilla::KnownNotNull, ptr_null_t()) null_t(std::move((aOther).get_null_t()));
            (aOther).MaybeDestroy();
            break;
        }
    case TnsString:
        {
            new (mozilla::KnownNotNull, ptr_nsString()) nsString(std::move((aOther).get_nsString()));
            (aOther).MaybeDestroy();
            break;
        }
    case Tbool:
        {
            new (mozilla::KnownNotNull, ptr_bool()) bool(std::move((aOther).get_bool()));
            (aOther).MaybeDestroy();
            break;
        }
    case Tdouble:
        {
            new (mozilla::KnownNotNull, ptr_double()) double(std::move((aOther).get_double()));
            (aOther).MaybeDestroy();
            break;
        }
    case Tint32_t:
        {
            new (mozilla::KnownNotNull, ptr_int32_t()) int32_t(std::move((aOther).get_int32_t()));
            (aOther).MaybeDestroy();
            break;
        }
    case TStructuredCloneData:
        {
            new (mozilla::KnownNotNull, ptr_StructuredCloneData()) UniquePtr<StructuredCloneData>(std::move((aOther).get_StructuredCloneData()));
            (aOther).MaybeDestroy();
            break;
        }
    case TClonedMessageData:
        {
            new (mozilla::KnownNotNull, ptr_ClonedMessageData()) UniquePtr<ClonedMessageData>(std::move((aOther).get_ClonedMessageData()));
            (aOther).MaybeDestroy();
            break;
        }
    case TnsIPrincipal:
        {
            new (mozilla::KnownNotNull, ptr_nsIPrincipal()) mozilla::NotNull<RefPtr<nsIPrincipal>>(std::move((aOther).get_nsIPrincipal()));
            (aOther).MaybeDestroy();
            break;
        }
    case TMaybeDiscardedBrowsingContext:
        {
            new (mozilla::KnownNotNull, ptr_MaybeDiscardedBrowsingContext()) MaybeDiscardedBrowsingContext(std::move((aOther).get_MaybeDiscardedBrowsingContext()));
            (aOther).MaybeDestroy();
            break;
        }
    case TJSIPCDOMRect:
        {
            new (mozilla::KnownNotNull, ptr_JSIPCDOMRect()) JSIPCDOMRect(std::move((aOther).get_JSIPCDOMRect()));
            (aOther).MaybeDestroy();
            break;
        }
    case TArrayOfJSIPCProperty:
        {
            ptr_ArrayOfJSIPCProperty() = (aOther).ptr_ArrayOfJSIPCProperty();
            break;
        }
    case TJSIPCArray:
        {
            ptr_JSIPCArray() = (aOther).ptr_JSIPCArray();
            break;
        }
    case TJSIPCSet:
        {
            ptr_JSIPCSet() = (aOther).ptr_JSIPCSet();
            break;
        }
    case TArrayOfJSIPCMapEntry:
        {
            ptr_ArrayOfJSIPCMapEntry() = (aOther).ptr_ArrayOfJSIPCMapEntry();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

JSIPCValue::~JSIPCValue()
{
    MaybeDestroy();
}

auto JSIPCValue::operator=(const void_t& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_void_t()) void_t(aRhs);
    mType = Tvoid_t;
    return (*(this));
}

auto JSIPCValue::operator=(void_t&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_void_t()) void_t(std::move(aRhs));
    mType = Tvoid_t;
    return (*(this));
}

auto JSIPCValue::operator=(const null_t& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_null_t()) null_t(aRhs);
    mType = Tnull_t;
    return (*(this));
}

auto JSIPCValue::operator=(null_t&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_null_t()) null_t(std::move(aRhs));
    mType = Tnull_t;
    return (*(this));
}

auto JSIPCValue::operator=(const nsString& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_nsString()) nsString(aRhs);
    mType = TnsString;
    return (*(this));
}

auto JSIPCValue::operator=(nsString&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_nsString()) nsString(std::move(aRhs));
    mType = TnsString;
    return (*(this));
}

auto JSIPCValue::operator=(const bool& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_bool()) bool(aRhs);
    mType = Tbool;
    return (*(this));
}

auto JSIPCValue::operator=(bool&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_bool()) bool(std::move(aRhs));
    mType = Tbool;
    return (*(this));
}

auto JSIPCValue::operator=(const double& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_double()) double(aRhs);
    mType = Tdouble;
    return (*(this));
}

auto JSIPCValue::operator=(double&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_double()) double(std::move(aRhs));
    mType = Tdouble;
    return (*(this));
}

auto JSIPCValue::operator=(const int32_t& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_int32_t()) int32_t(aRhs);
    mType = Tint32_t;
    return (*(this));
}

auto JSIPCValue::operator=(int32_t&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_int32_t()) int32_t(std::move(aRhs));
    mType = Tint32_t;
    return (*(this));
}

auto JSIPCValue::operator=(UniquePtr<StructuredCloneData>&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_StructuredCloneData()) UniquePtr<StructuredCloneData>(std::move(aRhs));
    mType = TStructuredCloneData;
    return (*(this));
}

auto JSIPCValue::operator=(UniquePtr<ClonedMessageData>&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_ClonedMessageData()) UniquePtr<ClonedMessageData>(std::move(aRhs));
    mType = TClonedMessageData;
    return (*(this));
}

auto JSIPCValue::operator=(mozilla::NotNull<nsIPrincipal*> aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_nsIPrincipal()) mozilla::NotNull<RefPtr<nsIPrincipal>>(aRhs);
    mType = TnsIPrincipal;
    return (*(this));
}

auto JSIPCValue::operator=(mozilla::NotNull<RefPtr<nsIPrincipal>>&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_nsIPrincipal()) mozilla::NotNull<RefPtr<nsIPrincipal>>(std::move(aRhs));
    mType = TnsIPrincipal;
    return (*(this));
}

auto JSIPCValue::operator=(const MaybeDiscardedBrowsingContext& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_MaybeDiscardedBrowsingContext()) MaybeDiscardedBrowsingContext(aRhs);
    mType = TMaybeDiscardedBrowsingContext;
    return (*(this));
}

auto JSIPCValue::operator=(MaybeDiscardedBrowsingContext&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_MaybeDiscardedBrowsingContext()) MaybeDiscardedBrowsingContext(std::move(aRhs));
    mType = TMaybeDiscardedBrowsingContext;
    return (*(this));
}

auto JSIPCValue::operator=(const JSIPCDOMRect& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_JSIPCDOMRect()) JSIPCDOMRect(aRhs);
    mType = TJSIPCDOMRect;
    return (*(this));
}

auto JSIPCValue::operator=(JSIPCDOMRect&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_JSIPCDOMRect()) JSIPCDOMRect(std::move(aRhs));
    mType = TJSIPCDOMRect;
    return (*(this));
}

auto JSIPCValue::operator=(nsTArray<JSIPCProperty>&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    ptr_ArrayOfJSIPCProperty() = new nsTArray<JSIPCProperty>(std::move(aRhs));
    mType = TArrayOfJSIPCProperty;
    return (*(this));
}

auto JSIPCValue::operator=(JSIPCArray&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    ptr_JSIPCArray() = new JSIPCArray(std::move(aRhs));
    mType = TJSIPCArray;
    return (*(this));
}

auto JSIPCValue::operator=(JSIPCSet&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    ptr_JSIPCSet() = new JSIPCSet(std::move(aRhs));
    mType = TJSIPCSet;
    return (*(this));
}

auto JSIPCValue::operator=(nsTArray<JSIPCMapEntry>&& aRhs) -> JSIPCValue&
{
    MaybeDestroy();
    ptr_ArrayOfJSIPCMapEntry() = new nsTArray<JSIPCMapEntry>(std::move(aRhs));
    mType = TArrayOfJSIPCMapEntry;
    return (*(this));
}

auto JSIPCValue::operator=(JSIPCValue&& aRhs) -> JSIPCValue&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case Tvoid_t:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_void_t()) void_t(std::move((aRhs).get_void_t()));
            (aRhs).MaybeDestroy();
            break;
        }
    case Tnull_t:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_null_t()) null_t(std::move((aRhs).get_null_t()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TnsString:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_nsString()) nsString(std::move((aRhs).get_nsString()));
            (aRhs).MaybeDestroy();
            break;
        }
    case Tbool:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_bool()) bool(std::move((aRhs).get_bool()));
            (aRhs).MaybeDestroy();
            break;
        }
    case Tdouble:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_double()) double(std::move((aRhs).get_double()));
            (aRhs).MaybeDestroy();
            break;
        }
    case Tint32_t:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_int32_t()) int32_t(std::move((aRhs).get_int32_t()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TStructuredCloneData:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_StructuredCloneData()) UniquePtr<StructuredCloneData>(std::move((aRhs).get_StructuredCloneData()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TClonedMessageData:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_ClonedMessageData()) UniquePtr<ClonedMessageData>(std::move((aRhs).get_ClonedMessageData()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TnsIPrincipal:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_nsIPrincipal()) mozilla::NotNull<RefPtr<nsIPrincipal>>(std::move((aRhs).get_nsIPrincipal()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TMaybeDiscardedBrowsingContext:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_MaybeDiscardedBrowsingContext()) MaybeDiscardedBrowsingContext(std::move((aRhs).get_MaybeDiscardedBrowsingContext()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TJSIPCDOMRect:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_JSIPCDOMRect()) JSIPCDOMRect(std::move((aRhs).get_JSIPCDOMRect()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TArrayOfJSIPCProperty:
        {
            MaybeDestroy();
            ptr_ArrayOfJSIPCProperty() = (aRhs).ptr_ArrayOfJSIPCProperty();
            break;
        }
    case TJSIPCArray:
        {
            MaybeDestroy();
            ptr_JSIPCArray() = (aRhs).ptr_JSIPCArray();
            break;
        }
    case TJSIPCSet:
        {
            MaybeDestroy();
            ptr_JSIPCSet() = (aRhs).ptr_JSIPCSet();
            break;
        }
    case TArrayOfJSIPCMapEntry:
        {
            MaybeDestroy();
            ptr_ArrayOfJSIPCMapEntry() = (aRhs).ptr_ArrayOfJSIPCMapEntry();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::JSIPCValue>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::dom::JSIPCValue union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'JSIPCValue'
    (aWriter)->WriteSentinel(296223607);

    switch (type) {
    case union__::Tvoid_t:
        {
            IPC::WriteParam(aWriter, (aVar).get_void_t());
            // Sentinel = 'Tvoid_t'
            (aWriter)->WriteSentinel(189006554);
            return;
        }
    case union__::Tnull_t:
        {
            IPC::WriteParam(aWriter, (aVar).get_null_t());
            // Sentinel = 'Tnull_t'
            (aWriter)->WriteSentinel(190186211);
            return;
        }
    case union__::TnsString:
        {
            IPC::WriteParam(aWriter, (aVar).get_nsString());
            // Sentinel = 'TnsString'
            (aWriter)->WriteSentinel(302908333);
            return;
        }
    case union__::Tbool:
        {
            IPC::WriteParam(aWriter, (aVar).get_bool());
            // Sentinel = 'Tbool'
            (aWriter)->WriteSentinel(96993793);
            return;
        }
    case union__::Tdouble:
        {
            IPC::WriteParam(aWriter, (aVar).get_double());
            // Sentinel = 'Tdouble'
            (aWriter)->WriteSentinel(185402064);
            return;
        }
    case union__::Tint32_t:
        {
            IPC::WriteParam(aWriter, (aVar).get_int32_t());
            // Sentinel = 'Tint32_t'
            (aWriter)->WriteSentinel(217252568);
            return;
        }
    case union__::TStructuredCloneData:
        {
            IPC::WriteParam(aWriter, (aVar).get_StructuredCloneData());
            // Sentinel = 'TStructuredCloneData'
            (aWriter)->WriteSentinel(1414596597);
            return;
        }
    case union__::TClonedMessageData:
        {
            IPC::WriteParam(aWriter, (aVar).get_ClonedMessageData());
            // Sentinel = 'TClonedMessageData'
            (aWriter)->WriteSentinel(1089275625);
            return;
        }
    case union__::TnsIPrincipal:
        {
            IPC::WriteParam(aWriter, (aVar).get_nsIPrincipal());
            // Sentinel = 'TnsIPrincipal'
            (aWriter)->WriteSentinel(589825313);
            return;
        }
    case union__::TMaybeDiscardedBrowsingContext:
        {
            IPC::WriteParam(aWriter, (aVar).get_MaybeDiscardedBrowsingContext());
            // Sentinel = 'TMaybeDiscardedBrowsingContext'
            (aWriter)->WriteSentinel(3021999094);
            return;
        }
    case union__::TJSIPCDOMRect:
        {
            IPC::WriteParam(aWriter, (aVar).get_JSIPCDOMRect());
            // Sentinel = 'TJSIPCDOMRect'
            (aWriter)->WriteSentinel(470025276);
            return;
        }
    case union__::TArrayOfJSIPCProperty:
        {
            IPC::WriteParam(aWriter, (aVar).get_ArrayOfJSIPCProperty());
            // Sentinel = 'TArrayOfJSIPCProperty'
            (aWriter)->WriteSentinel(1404307431);
            return;
        }
    case union__::TJSIPCArray:
        {
            IPC::WriteParam(aWriter, (aVar).get_JSIPCArray());
            // Sentinel = 'TJSIPCArray'
            (aWriter)->WriteSentinel(354288589);
            return;
        }
    case union__::TJSIPCSet:
        {
            IPC::WriteParam(aWriter, (aVar).get_JSIPCSet());
            // Sentinel = 'TJSIPCSet'
            (aWriter)->WriteSentinel(236651258);
            return;
        }
    case union__::TArrayOfJSIPCMapEntry:
        {
            IPC::WriteParam(aWriter, (aVar).get_ArrayOfJSIPCMapEntry());
            // Sentinel = 'TArrayOfJSIPCMapEntry'
            (aWriter)->WriteSentinel(1383729074);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union JSIPCValue");
            return;
        }
    }
}

auto ParamTraits<::mozilla::dom::JSIPCValue>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    typedef ::mozilla::dom::JSIPCValue union__;
    auto maybe__type = IPC::ReadParam<int>(aReader);
    if (!maybe__type) {
        aReader->FatalError("Error deserializing type of union JSIPCValue");
        return {};

    }
    auto& type = *maybe__type;
    // Sentinel = 'JSIPCValue'
    if ((!((aReader)->ReadSentinel(296223607)))) {
        mozilla::ipc::SentinelReadError("Error deserializing type of union JSIPCValue");
        return {};
    }

    switch (type) {
    case union__::Tvoid_t:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::void_t>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant Tvoid_t of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'Tvoid_t'
            if ((!((aReader)->ReadSentinel(189006554)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant Tvoid_t of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::Tnull_t:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::null_t>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant Tnull_t of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'Tnull_t'
            if ((!((aReader)->ReadSentinel(190186211)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant Tnull_t of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TnsString:
        {
            auto maybe__tmp = IPC::ReadParam<::nsString>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TnsString of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TnsString'
            if ((!((aReader)->ReadSentinel(302908333)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TnsString of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::Tbool:
        {
            auto maybe__tmp = IPC::ReadParam<bool>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant Tbool of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'Tbool'
            if ((!((aReader)->ReadSentinel(96993793)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant Tbool of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::Tdouble:
        {
            auto maybe__tmp = IPC::ReadParam<double>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant Tdouble of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'Tdouble'
            if ((!((aReader)->ReadSentinel(185402064)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant Tdouble of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::Tint32_t:
        {
            auto maybe__tmp = IPC::ReadParam<::int32_t>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant Tint32_t of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'Tint32_t'
            if ((!((aReader)->ReadSentinel(217252568)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant Tint32_t of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TStructuredCloneData:
        {
            auto maybe__tmp = IPC::ReadParam<mozilla::UniquePtr<::mozilla::dom::ipc::StructuredCloneData>>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TStructuredCloneData of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TStructuredCloneData'
            if ((!((aReader)->ReadSentinel(1414596597)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TStructuredCloneData of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TClonedMessageData:
        {
            auto maybe__tmp = IPC::ReadParam<mozilla::UniquePtr<::mozilla::dom::ClonedMessageData>>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TClonedMessageData of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TClonedMessageData'
            if ((!((aReader)->ReadSentinel(1089275625)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TClonedMessageData of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TnsIPrincipal:
        {
            auto maybe__tmp = IPC::ReadParam<mozilla::NotNull<RefPtr<::nsIPrincipal>>>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TnsIPrincipal of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TnsIPrincipal'
            if ((!((aReader)->ReadSentinel(589825313)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TnsIPrincipal of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TMaybeDiscardedBrowsingContext:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::dom::MaybeDiscardedBrowsingContext>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TMaybeDiscardedBrowsingContext of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TMaybeDiscardedBrowsingContext'
            if ((!((aReader)->ReadSentinel(3021999094)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TMaybeDiscardedBrowsingContext of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TJSIPCDOMRect:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::dom::JSIPCDOMRect>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TJSIPCDOMRect of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TJSIPCDOMRect'
            if ((!((aReader)->ReadSentinel(470025276)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TJSIPCDOMRect of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TArrayOfJSIPCProperty:
        {
            auto maybe__tmp = IPC::ReadParam<nsTArray<::mozilla::dom::JSIPCProperty>>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TArrayOfJSIPCProperty of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TArrayOfJSIPCProperty'
            if ((!((aReader)->ReadSentinel(1404307431)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TArrayOfJSIPCProperty of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TJSIPCArray:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::dom::JSIPCArray>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TJSIPCArray of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TJSIPCArray'
            if ((!((aReader)->ReadSentinel(354288589)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TJSIPCArray of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TJSIPCSet:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::dom::JSIPCSet>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TJSIPCSet of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TJSIPCSet'
            if ((!((aReader)->ReadSentinel(236651258)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TJSIPCSet of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TArrayOfJSIPCMapEntry:
        {
            auto maybe__tmp = IPC::ReadParam<nsTArray<::mozilla::dom::JSIPCMapEntry>>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TArrayOfJSIPCMapEntry of union JSIPCValue");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TArrayOfJSIPCMapEntry'
            if ((!((aReader)->ReadSentinel(1383729074)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TArrayOfJSIPCMapEntry of union JSIPCValue");
                return {};
            }
            return std::move(tmp);
        }
    default:
        {
            aReader->FatalError("unknown variant of union JSIPCValue");
            return {};
        }
    }
}

} // namespace IPC
