/* THIS FILE IS AUTOGENERATED FROM NetDashboard.webidl BY Codegen.py - DO NOT EDIT */ #include #include "AtomList.h" #include "MainThreadUtils.h" #include "NetDashboardBinding.h" #include "js/Array.h" #include "js/CallAndConstruct.h" #include "js/Exception.h" #include "js/ForOfIterator.h" #include "js/MapAndSet.h" #include "js/Object.h" #include "js/PropertyAndElement.h" #include "js/PropertyDescriptor.h" #include "js/experimental/JitInfo.h" #include "jsfriendapi.h" #include "mozilla/FloatingPoint.h" #include "mozilla/OwningNonNull.h" #include "mozilla/dom/BindingCallContext.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/NonRefcountedDOMObject.h" #include "mozilla/dom/PrimitiveConversions.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/SimpleGlobalObject.h" namespace mozilla::dom { namespace binding_detail {}; // Just to make sure it's known as a namespace using namespace mozilla::dom::binding_detail; AltSvcMappingElement::AltSvcMappingElement() { // Safe to pass a null context if we pass a null value Init(); } bool AltSvcMappingElement::InitIds(JSContext* cx, AltSvcMappingElementAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->validated_id.init(cx, "validated") || !atomsCache->ttl_id.init(cx, "ttl") || !atomsCache->originPort_id.init(cx, "originPort") || !atomsCache->originHost_id.init(cx, "originHost") || !atomsCache->originAttributesSuffix_id.init(cx, "originAttributesSuffix") || !atomsCache->https_id.init(cx, "https") || !atomsCache->alternatePort_id.init(cx, "alternatePort") || !atomsCache->alternateHost_id.init(cx, "alternateHost") || !atomsCache->alpn_id.init(cx, "alpn")) { return false; } return true; } bool AltSvcMappingElement::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mAlpn.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mAlternateHost.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mAlternatePort = 0U; } { // scope for any temporaries our default value setting needs. mHttps = false; } { // scope for any temporaries our default value setting needs. mOriginAttributesSuffix.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mOriginHost.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mOriginPort = 0U; } { // scope for any temporaries our default value setting needs. mTtl = 0; } { // scope for any temporaries our default value setting needs. mValidated = false; } return true; } bool AltSvcMappingElement::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { AltSvcMappingElementAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mAlpn; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->alpn_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mAlternateHost; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->alternateHost_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint32_t const & currentValue = mAlternatePort; temp.setNumber(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->alternatePort_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); bool const & currentValue = mHttps; temp.setBoolean(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->https_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mOriginAttributesSuffix; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->originAttributesSuffix_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mOriginHost; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->originHost_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint32_t const & currentValue = mOriginPort; temp.setNumber(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->originPort_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); int32_t const & currentValue = mTtl; temp.setInt32(int32_t(currentValue)); if (!JS_DefinePropertyById(cx, obj, atomsCache->ttl_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); bool const & currentValue = mValidated; temp.setBoolean(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->validated_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void AltSvcMappingElement::TraceDictionary(JSTracer* trc) { } AltSvcMappingElement& AltSvcMappingElement::operator=(const AltSvcMappingElement& aOther) { DictionaryBase::operator=(aOther); mAlpn = aOther.mAlpn; mAlternateHost = aOther.mAlternateHost; mAlternatePort = aOther.mAlternatePort; mHttps = aOther.mHttps; mOriginAttributesSuffix = aOther.mOriginAttributesSuffix; mOriginHost = aOther.mOriginHost; mOriginPort = aOther.mOriginPort; mTtl = aOther.mTtl; mValidated = aOther.mValidated; return *this; } ConnStatusDict::ConnStatusDict() { // Safe to pass a null context if we pass a null value Init(); } bool ConnStatusDict::InitIds(JSContext* cx, ConnStatusDictAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->status_id.init(cx, "status")) { return false; } return true; } bool ConnStatusDict::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mStatus.AssignLiteral(u""); } return true; } bool ConnStatusDict::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { ConnStatusDictAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mStatus; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->status_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void ConnStatusDict::TraceDictionary(JSTracer* trc) { } ConnStatusDict& ConnStatusDict::operator=(const ConnStatusDict& aOther) { DictionaryBase::operator=(aOther); mStatus = aOther.mStatus; return *this; } DNSLookupDict::DNSLookupDict() { // Safe to pass a null context if we pass a null value Init(); } bool DNSLookupDict::InitIds(JSContext* cx, DNSLookupDictAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->error_id.init(cx, "error") || !atomsCache->answer_id.init(cx, "answer") || !atomsCache->address_id.init(cx, "address")) { return false; } return true; } bool DNSLookupDict::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mAnswer = false; } { // scope for any temporaries our default value setting needs. mError.AssignLiteral(u""); } return true; } bool DNSLookupDict::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { DNSLookupDictAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); if (mAddress.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mAddress.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!xpc::NonVoidStringToJsval(cx, currentValue[sequenceIdx0], &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->address_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); bool const & currentValue = mAnswer; temp.setBoolean(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->answer_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mError; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->error_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void DNSLookupDict::TraceDictionary(JSTracer* trc) { } DNSLookupDict& DNSLookupDict::operator=(const DNSLookupDict& aOther) { DictionaryBase::operator=(aOther); mAddress.Reset(); if (aOther.mAddress.WasPassed()) { mAddress.Construct(aOther.mAddress.Value()); } mAnswer = aOther.mAnswer; mError = aOther.mError; return *this; } bool DnsAndSockInfoDict::InitIds(JSContext* cx, DnsAndSockInfoDictAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->speculative_id.init(cx, "speculative")) { return false; } return true; } bool DnsAndSockInfoDict::Init(const char* sourceDescription, bool passedToJSImpl) { return true; } bool DnsAndSockInfoDict::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { DnsAndSockInfoDictAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); bool const & currentValue = mSpeculative; temp.setBoolean(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->speculative_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void DnsAndSockInfoDict::TraceDictionary(JSTracer* trc) { } DnsAndSockInfoDict& DnsAndSockInfoDict::operator=(const DnsAndSockInfoDict& aOther) { DictionaryBase::operator=(aOther); mSpeculative = aOther.mSpeculative; return *this; } DnsCacheEntry::DnsCacheEntry() { // Safe to pass a null context if we pass a null value Init(); } bool DnsCacheEntry::InitIds(JSContext* cx, DnsCacheEntryAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->type_id.init(cx, "type") || !atomsCache->trr_id.init(cx, "trr") || !atomsCache->originAttributesSuffix_id.init(cx, "originAttributesSuffix") || !atomsCache->hostname_id.init(cx, "hostname") || !atomsCache->hostaddr_id.init(cx, "hostaddr") || !atomsCache->flags_id.init(cx, "flags") || !atomsCache->family_id.init(cx, "family") || !atomsCache->expiration_id.init(cx, "expiration")) { return false; } return true; } bool DnsCacheEntry::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mExpiration = 0.0; } { // scope for any temporaries our default value setting needs. mFamily.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mFlags.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mHostname.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mOriginAttributesSuffix.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mTrr = false; } { // scope for any temporaries our default value setting needs. mType = 0; } return true; } bool DnsCacheEntry::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { DnsCacheEntryAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); double const & currentValue = mExpiration; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->expiration_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mFamily; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->family_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mFlags; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->flags_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); if (mHostaddr.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mHostaddr.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!xpc::NonVoidStringToJsval(cx, currentValue[sequenceIdx0], &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->hostaddr_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mHostname; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->hostname_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mOriginAttributesSuffix; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->originAttributesSuffix_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); bool const & currentValue = mTrr; temp.setBoolean(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->trr_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint16_t const & currentValue = mType; temp.setInt32(int32_t(currentValue)); if (!JS_DefinePropertyById(cx, obj, atomsCache->type_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void DnsCacheEntry::TraceDictionary(JSTracer* trc) { } DnsCacheEntry& DnsCacheEntry::operator=(const DnsCacheEntry& aOther) { DictionaryBase::operator=(aOther); mExpiration = aOther.mExpiration; mFamily = aOther.mFamily; mFlags = aOther.mFlags; mHostaddr.Reset(); if (aOther.mHostaddr.WasPassed()) { mHostaddr.Construct(aOther.mHostaddr.Value()); } mHostname = aOther.mHostname; mOriginAttributesSuffix = aOther.mOriginAttributesSuffix; mTrr = aOther.mTrr; mType = aOther.mType; return *this; } Http3ConnStats::Http3ConnStats() { // Safe to pass a null context if we pass a null value Init(); } bool Http3ConnStats::InitIds(JSContext* cx, Http3ConnStatsAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->wouldBlockTx_id.init(cx, "wouldBlockTx") || !atomsCache->wouldBlockRx_id.init(cx, "wouldBlockRx") || !atomsCache->savedDatagrams_id.init(cx, "savedDatagrams") || !atomsCache->ptoCounts_id.init(cx, "ptoCounts") || !atomsCache->ptoAck_id.init(cx, "ptoAck") || !atomsCache->packetsTx_id.init(cx, "packetsTx") || !atomsCache->packetsRx_id.init(cx, "packetsRx") || !atomsCache->lost_id.init(cx, "lost") || !atomsCache->lateAck_id.init(cx, "lateAck") || !atomsCache->dupsRx_id.init(cx, "dupsRx") || !atomsCache->droppedRx_id.init(cx, "droppedRx")) { return false; } return true; } bool Http3ConnStats::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mDroppedRx = 0ULL; } { // scope for any temporaries our default value setting needs. mDupsRx = 0ULL; } { // scope for any temporaries our default value setting needs. mLateAck = 0ULL; } { // scope for any temporaries our default value setting needs. mLost = 0ULL; } { // scope for any temporaries our default value setting needs. mPacketsRx = 0ULL; } { // scope for any temporaries our default value setting needs. mPacketsTx = 0ULL; } { // scope for any temporaries our default value setting needs. mPtoAck = 0ULL; } { // scope for any temporaries our default value setting needs. mSavedDatagrams = 0ULL; } { // scope for any temporaries our default value setting needs. mWouldBlockRx = 0ULL; } { // scope for any temporaries our default value setting needs. mWouldBlockTx = 0ULL; } return true; } bool Http3ConnStats::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { Http3ConnStatsAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint64_t const & currentValue = mDroppedRx; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->droppedRx_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint64_t const & currentValue = mDupsRx; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->dupsRx_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint64_t const & currentValue = mLateAck; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->lateAck_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint64_t const & currentValue = mLost; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->lost_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint64_t const & currentValue = mPacketsRx; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->packetsRx_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint64_t const & currentValue = mPacketsTx; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->packetsTx_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint64_t const & currentValue = mPtoAck; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->ptoAck_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); if (mPtoCounts.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mPtoCounts.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { tmp.set(JS::NumberValue(double(currentValue[sequenceIdx0]))); break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->ptoCounts_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint64_t const & currentValue = mSavedDatagrams; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->savedDatagrams_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint64_t const & currentValue = mWouldBlockRx; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->wouldBlockRx_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint64_t const & currentValue = mWouldBlockTx; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->wouldBlockTx_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void Http3ConnStats::TraceDictionary(JSTracer* trc) { } Http3ConnStats& Http3ConnStats::operator=(const Http3ConnStats& aOther) { DictionaryBase::operator=(aOther); mDroppedRx = aOther.mDroppedRx; mDupsRx = aOther.mDupsRx; mLateAck = aOther.mLateAck; mLost = aOther.mLost; mPacketsRx = aOther.mPacketsRx; mPacketsTx = aOther.mPacketsTx; mPtoAck = aOther.mPtoAck; mPtoCounts.Reset(); if (aOther.mPtoCounts.WasPassed()) { mPtoCounts.Construct(aOther.mPtoCounts.Value()); } mSavedDatagrams = aOther.mSavedDatagrams; mWouldBlockRx = aOther.mWouldBlockRx; mWouldBlockTx = aOther.mWouldBlockTx; return *this; } HttpConnInfo::HttpConnInfo() { // Safe to pass a null context if we pass a null value Init(); } bool HttpConnInfo::InitIds(JSContext* cx, HttpConnInfoAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->ttl_id.init(cx, "ttl") || !atomsCache->rtt_id.init(cx, "rtt") || !atomsCache->protocolVersion_id.init(cx, "protocolVersion")) { return false; } return true; } bool HttpConnInfo::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mProtocolVersion.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mRtt = 0U; } { // scope for any temporaries our default value setting needs. mTtl = 0U; } return true; } bool HttpConnInfo::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { HttpConnInfoAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mProtocolVersion; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->protocolVersion_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint32_t const & currentValue = mRtt; temp.setNumber(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->rtt_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint32_t const & currentValue = mTtl; temp.setNumber(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->ttl_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void HttpConnInfo::TraceDictionary(JSTracer* trc) { } HttpConnInfo& HttpConnInfo::operator=(const HttpConnInfo& aOther) { DictionaryBase::operator=(aOther); mProtocolVersion = aOther.mProtocolVersion; mRtt = aOther.mRtt; mTtl = aOther.mTtl; return *this; } SSLTokensCacheElement::SSLTokensCacheElement() { // Safe to pass a null context if we pass a null value Init(); } bool SSLTokensCacheElement::InitIds(JSContext* cx, SSLTokensCacheElementAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->tokenLength_id.init(cx, "tokenLength") || !atomsCache->tokenId_id.init(cx, "tokenId") || !atomsCache->succeededCertChainDER_id.init(cx, "succeededCertChainDER") || !atomsCache->serverCertDER_id.init(cx, "serverCertDER") || !atomsCache->restored_id.init(cx, "restored") || !atomsCache->overridableErrorCategory_id.init(cx, "overridableErrorCategory") || !atomsCache->key_id.init(cx, "key") || !atomsCache->handshakeCertDER_id.init(cx, "handshakeCertDER") || !atomsCache->expirationTime_id.init(cx, "expirationTime") || !atomsCache->evStatus_id.init(cx, "evStatus") || !atomsCache->decompressedLength_id.init(cx, "decompressedLength") || !atomsCache->compressedLength_id.init(cx, "compressedLength") || !atomsCache->certificateTransparencyStatus_id.init(cx, "certificateTransparencyStatus") || !atomsCache->builtInRoot_id.init(cx, "builtInRoot")) { return false; } return true; } bool SSLTokensCacheElement::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mBuiltInRoot = -1; } { // scope for any temporaries our default value setting needs. mCertificateTransparencyStatus = 0; } { // scope for any temporaries our default value setting needs. mCompressedLength = 0U; } { // scope for any temporaries our default value setting needs. mDecompressedLength = 0U; } { // scope for any temporaries our default value setting needs. mEvStatus = false; } { // scope for any temporaries our default value setting needs. mExpirationTime = 0.0; } { // scope for any temporaries our default value setting needs. mKey.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mOverridableErrorCategory = 0; } { // scope for any temporaries our default value setting needs. mRestored = false; } { // scope for any temporaries our default value setting needs. mTokenId = 0ULL; } { // scope for any temporaries our default value setting needs. mTokenLength = 0U; } return true; } bool SSLTokensCacheElement::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { SSLTokensCacheElementAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); int32_t const & currentValue = mBuiltInRoot; temp.setInt32(int32_t(currentValue)); if (!JS_DefinePropertyById(cx, obj, atomsCache->builtInRoot_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint16_t const & currentValue = mCertificateTransparencyStatus; temp.setInt32(int32_t(currentValue)); if (!JS_DefinePropertyById(cx, obj, atomsCache->certificateTransparencyStatus_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint32_t const & currentValue = mCompressedLength; temp.setNumber(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->compressedLength_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint32_t const & currentValue = mDecompressedLength; temp.setNumber(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->decompressedLength_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); bool const & currentValue = mEvStatus; temp.setBoolean(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->evStatus_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); double const & currentValue = mExpirationTime; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->expirationTime_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); if (mHandshakeCertDER.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mHandshakeCertDER.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { tmp.setObject(*currentValue[sequenceIdx0].Obj()); if (!MaybeWrapNonDOMObjectValue(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->handshakeCertDER_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mKey; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->key_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint8_t const & currentValue = mOverridableErrorCategory; temp.setInt32(int32_t(currentValue)); if (!JS_DefinePropertyById(cx, obj, atomsCache->overridableErrorCategory_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); bool const & currentValue = mRestored; temp.setBoolean(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->restored_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); if (mServerCertDER.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Uint8Array const & currentValue = mServerCertDER.InternalValue(); temp.setObject(*currentValue.Obj()); if (!MaybeWrapNonDOMObjectValue(cx, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->serverCertDER_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } if (mSucceededCertChainDER.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mSucceededCertChainDER.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { tmp.setObject(*currentValue[sequenceIdx0].Obj()); if (!MaybeWrapNonDOMObjectValue(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->succeededCertChainDER_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint64_t const & currentValue = mTokenId; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->tokenId_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint32_t const & currentValue = mTokenLength; temp.setNumber(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->tokenLength_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void SSLTokensCacheElement::TraceDictionary(JSTracer* trc) { if (mHandshakeCertDER.WasPassed()) { DoTraceSequence(trc, mHandshakeCertDER.Value()); } if (mServerCertDER.WasPassed()) { mServerCertDER.Value().TraceSelf(trc); } if (mSucceededCertChainDER.WasPassed()) { DoTraceSequence(trc, mSucceededCertChainDER.Value()); } } bool SVCParam::InitIds(JSContext* cx, SVCParamAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->type_id.init(cx, "type")) { return false; } return true; } bool SVCParam::Init(const char* sourceDescription, bool passedToJSImpl) { return true; } bool SVCParam::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { SVCParamAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint16_t const & currentValue = mType; temp.setInt32(int32_t(currentValue)); if (!JS_DefinePropertyById(cx, obj, atomsCache->type_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void SVCParam::TraceDictionary(JSTracer* trc) { } SVCParam& SVCParam::operator=(const SVCParam& aOther) { DictionaryBase::operator=(aOther); mType = aOther.mType; return *this; } SocketElement::SocketElement() { // Safe to pass a null context if we pass a null value Init(); } bool SocketElement::InitIds(JSContext* cx, SocketElementAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->type_id.init(cx, "type") || !atomsCache->sent_id.init(cx, "sent") || !atomsCache->received_id.init(cx, "received") || !atomsCache->port_id.init(cx, "port") || !atomsCache->originAttributesSuffix_id.init(cx, "originAttributesSuffix") || !atomsCache->host_id.init(cx, "host") || !atomsCache->active_id.init(cx, "active")) { return false; } return true; } bool SocketElement::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mActive = false; } { // scope for any temporaries our default value setting needs. mHost.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mOriginAttributesSuffix.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mPort = 0U; } { // scope for any temporaries our default value setting needs. mReceived = 0.0; } { // scope for any temporaries our default value setting needs. mSent = 0.0; } { // scope for any temporaries our default value setting needs. mType.AssignLiteral(u""); } return true; } bool SocketElement::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { SocketElementAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); bool const & currentValue = mActive; temp.setBoolean(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->active_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mHost; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->host_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mOriginAttributesSuffix; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->originAttributesSuffix_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint32_t const & currentValue = mPort; temp.setNumber(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->port_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); double const & currentValue = mReceived; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->received_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); double const & currentValue = mSent; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->sent_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mType; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->type_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void SocketElement::TraceDictionary(JSTracer* trc) { } SocketElement& SocketElement::operator=(const SocketElement& aOther) { DictionaryBase::operator=(aOther); mActive = aOther.mActive; mHost = aOther.mHost; mOriginAttributesSuffix = aOther.mOriginAttributesSuffix; mPort = aOther.mPort; mReceived = aOther.mReceived; mSent = aOther.mSent; mType = aOther.mType; return *this; } WebSocketElement::WebSocketElement() { // Safe to pass a null context if we pass a null value Init(); } bool WebSocketElement::InitIds(JSContext* cx, WebSocketElementAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->sentsize_id.init(cx, "sentsize") || !atomsCache->receivedsize_id.init(cx, "receivedsize") || !atomsCache->msgsent_id.init(cx, "msgsent") || !atomsCache->msgreceived_id.init(cx, "msgreceived") || !atomsCache->hostport_id.init(cx, "hostport") || !atomsCache->encrypted_id.init(cx, "encrypted")) { return false; } return true; } bool WebSocketElement::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mEncrypted = false; } { // scope for any temporaries our default value setting needs. mHostport.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mMsgreceived = 0U; } { // scope for any temporaries our default value setting needs. mMsgsent = 0U; } { // scope for any temporaries our default value setting needs. mReceivedsize = 0.0; } { // scope for any temporaries our default value setting needs. mSentsize = 0.0; } return true; } bool WebSocketElement::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { WebSocketElementAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); bool const & currentValue = mEncrypted; temp.setBoolean(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->encrypted_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mHostport; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->hostport_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint32_t const & currentValue = mMsgreceived; temp.setNumber(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->msgreceived_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint32_t const & currentValue = mMsgsent; temp.setNumber(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->msgsent_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); double const & currentValue = mReceivedsize; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->receivedsize_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); double const & currentValue = mSentsize; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->sentsize_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void WebSocketElement::TraceDictionary(JSTracer* trc) { } WebSocketElement& WebSocketElement::operator=(const WebSocketElement& aOther) { DictionaryBase::operator=(aOther); mEncrypted = aOther.mEncrypted; mHostport = aOther.mHostport; mMsgreceived = aOther.mMsgreceived; mMsgsent = aOther.mMsgsent; mReceivedsize = aOther.mReceivedsize; mSentsize = aOther.mSentsize; return *this; } AltSvcCacheDict::AltSvcCacheDict() { // Safe to pass a null context if we pass a null value Init(); } bool AltSvcCacheDict::InitIds(JSContext* cx, AltSvcCacheDictAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->entries_id.init(cx, "entries")) { return false; } return true; } bool AltSvcCacheDict::Init(const char* sourceDescription, bool passedToJSImpl) { return true; } bool AltSvcCacheDict::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { AltSvcCacheDictAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); if (mEntries.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mEntries.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->entries_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } return true; } void AltSvcCacheDict::TraceDictionary(JSTracer* trc) { } AltSvcCacheDict& AltSvcCacheDict::operator=(const AltSvcCacheDict& aOther) { DictionaryBase::operator=(aOther); mEntries.Reset(); if (aOther.mEntries.WasPassed()) { mEntries.Construct(aOther.mEntries.Value()); } return *this; } DNSCacheDict::DNSCacheDict() { // Safe to pass a null context if we pass a null value Init(); } bool DNSCacheDict::InitIds(JSContext* cx, DNSCacheDictAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->entries_id.init(cx, "entries")) { return false; } return true; } bool DNSCacheDict::Init(const char* sourceDescription, bool passedToJSImpl) { return true; } bool DNSCacheDict::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { DNSCacheDictAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); if (mEntries.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mEntries.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->entries_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } return true; } void DNSCacheDict::TraceDictionary(JSTracer* trc) { } DNSCacheDict& DNSCacheDict::operator=(const DNSCacheDict& aOther) { DictionaryBase::operator=(aOther); mEntries.Reset(); if (aOther.mEntries.WasPassed()) { mEntries.Construct(aOther.mEntries.Value()); } return *this; } Http3ConnectionStatsElement::Http3ConnectionStatsElement() { // Safe to pass a null context if we pass a null value Init(); } bool Http3ConnectionStatsElement::InitIds(JSContext* cx, Http3ConnectionStatsElementAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->stats_id.init(cx, "stats") || !atomsCache->port_id.init(cx, "port") || !atomsCache->host_id.init(cx, "host")) { return false; } return true; } bool Http3ConnectionStatsElement::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mHost.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mPort = 0U; } return true; } bool Http3ConnectionStatsElement::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { Http3ConnectionStatsElementAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mHost; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->host_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint32_t const & currentValue = mPort; temp.setNumber(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->port_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); if (mStats.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mStats.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->stats_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } return true; } void Http3ConnectionStatsElement::TraceDictionary(JSTracer* trc) { } Http3ConnectionStatsElement& Http3ConnectionStatsElement::operator=(const Http3ConnectionStatsElement& aOther) { DictionaryBase::operator=(aOther); mHost = aOther.mHost; mPort = aOther.mPort; mStats.Reset(); if (aOther.mStats.WasPassed()) { mStats.Construct(aOther.mStats.Value()); } return *this; } HttpConnectionElement::HttpConnectionElement() { // Safe to pass a null context if we pass a null value Init(); } bool HttpConnectionElement::InitIds(JSContext* cx, HttpConnectionElementAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->ssl_id.init(cx, "ssl") || !atomsCache->port_id.init(cx, "port") || !atomsCache->originAttributesSuffix_id.init(cx, "originAttributesSuffix") || !atomsCache->idle_id.init(cx, "idle") || !atomsCache->httpVersion_id.init(cx, "httpVersion") || !atomsCache->host_id.init(cx, "host") || !atomsCache->dnsAndSocks_id.init(cx, "dnsAndSocks") || !atomsCache->active_id.init(cx, "active")) { return false; } return true; } bool HttpConnectionElement::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mHost.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mHttpVersion.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mOriginAttributesSuffix.AssignLiteral(u""); } { // scope for any temporaries our default value setting needs. mPort = 0U; } { // scope for any temporaries our default value setting needs. mSsl = false; } return true; } bool HttpConnectionElement::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { HttpConnectionElementAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); if (mActive.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mActive.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->active_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } if (mDnsAndSocks.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mDnsAndSocks.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->dnsAndSocks_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mHost; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->host_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mHttpVersion; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->httpVersion_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); if (mIdle.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mIdle.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->idle_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mOriginAttributesSuffix; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->originAttributesSuffix_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint32_t const & currentValue = mPort; temp.setNumber(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->port_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); bool const & currentValue = mSsl; temp.setBoolean(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->ssl_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void HttpConnectionElement::TraceDictionary(JSTracer* trc) { } HttpConnectionElement& HttpConnectionElement::operator=(const HttpConnectionElement& aOther) { DictionaryBase::operator=(aOther); mActive.Reset(); if (aOther.mActive.WasPassed()) { mActive.Construct(aOther.mActive.Value()); } mDnsAndSocks.Reset(); if (aOther.mDnsAndSocks.WasPassed()) { mDnsAndSocks.Construct(aOther.mDnsAndSocks.Value()); } mHost = aOther.mHost; mHttpVersion = aOther.mHttpVersion; mIdle.Reset(); if (aOther.mIdle.WasPassed()) { mIdle.Construct(aOther.mIdle.Value()); } mOriginAttributesSuffix = aOther.mOriginAttributesSuffix; mPort = aOther.mPort; mSsl = aOther.mSsl; return *this; } SSLTokensCacheDict::SSLTokensCacheDict() { // Safe to pass a null context if we pass a null value Init(); } bool SSLTokensCacheDict::InitIds(JSContext* cx, SSLTokensCacheDictAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->entries_id.init(cx, "entries")) { return false; } return true; } bool SSLTokensCacheDict::Init(const char* sourceDescription, bool passedToJSImpl) { return true; } bool SSLTokensCacheDict::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { SSLTokensCacheDictAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); if (mEntries.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mEntries.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->entries_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } return true; } void SSLTokensCacheDict::TraceDictionary(JSTracer* trc) { if (mEntries.WasPassed()) { DoTraceSequence(trc, mEntries.Value()); } } SVCParamAlpn::SVCParamAlpn() : SVCParam(FastDictionaryInitializer()) { // Safe to pass a null context if we pass a null value Init(); } bool SVCParamAlpn::InitIds(JSContext* cx, SVCParamAlpnAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->alpn_id.init(cx, "alpn")) { return false; } return true; } bool SVCParamAlpn::Init(const char* sourceDescription, bool passedToJSImpl) { // We init the parent's members first if (!SVCParam::Init()) { return false; } { // scope for any temporaries our default value setting needs. mAlpn.AssignLiteral(u""); } return true; } bool SVCParamAlpn::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { SVCParamAlpnAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } // Per spec, we define the parent's members first if (!SVCParam::ToObjectInternal(cx, rval)) { return false; } JS::Rooted obj(cx, &rval.toObject()); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mAlpn; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->alpn_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void SVCParamAlpn::TraceDictionary(JSTracer* trc) { SVCParam::TraceDictionary(trc); } SVCParamAlpn& SVCParamAlpn::operator=(const SVCParamAlpn& aOther) { SVCParam::operator=(aOther); mAlpn = aOther.mAlpn; return *this; } SVCParamEchConfig::SVCParamEchConfig() : SVCParam(FastDictionaryInitializer()) { // Safe to pass a null context if we pass a null value Init(); } bool SVCParamEchConfig::InitIds(JSContext* cx, SVCParamEchConfigAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->echConfig_id.init(cx, "echConfig")) { return false; } return true; } bool SVCParamEchConfig::Init(const char* sourceDescription, bool passedToJSImpl) { // We init the parent's members first if (!SVCParam::Init()) { return false; } { // scope for any temporaries our default value setting needs. mEchConfig.AssignLiteral(u""); } return true; } bool SVCParamEchConfig::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { SVCParamEchConfigAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } // Per spec, we define the parent's members first if (!SVCParam::ToObjectInternal(cx, rval)) { return false; } JS::Rooted obj(cx, &rval.toObject()); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mEchConfig; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->echConfig_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void SVCParamEchConfig::TraceDictionary(JSTracer* trc) { SVCParam::TraceDictionary(trc); } SVCParamEchConfig& SVCParamEchConfig::operator=(const SVCParamEchConfig& aOther) { SVCParam::operator=(aOther); mEchConfig = aOther.mEchConfig; return *this; } SVCParamIPv4Hint::SVCParamIPv4Hint() : SVCParam(FastDictionaryInitializer()) { // Safe to pass a null context if we pass a null value Init(); } bool SVCParamIPv4Hint::InitIds(JSContext* cx, SVCParamIPv4HintAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->address_id.init(cx, "address")) { return false; } return true; } bool SVCParamIPv4Hint::Init(const char* sourceDescription, bool passedToJSImpl) { // We init the parent's members first if (!SVCParam::Init()) { return false; } return true; } bool SVCParamIPv4Hint::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { SVCParamIPv4HintAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } // Per spec, we define the parent's members first if (!SVCParam::ToObjectInternal(cx, rval)) { return false; } JS::Rooted obj(cx, &rval.toObject()); if (mAddress.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mAddress.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!xpc::NonVoidStringToJsval(cx, currentValue[sequenceIdx0], &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->address_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } return true; } void SVCParamIPv4Hint::TraceDictionary(JSTracer* trc) { SVCParam::TraceDictionary(trc); } SVCParamIPv4Hint& SVCParamIPv4Hint::operator=(const SVCParamIPv4Hint& aOther) { SVCParam::operator=(aOther); mAddress.Reset(); if (aOther.mAddress.WasPassed()) { mAddress.Construct(aOther.mAddress.Value()); } return *this; } SVCParamIPv6Hint::SVCParamIPv6Hint() : SVCParam(FastDictionaryInitializer()) { // Safe to pass a null context if we pass a null value Init(); } bool SVCParamIPv6Hint::InitIds(JSContext* cx, SVCParamIPv6HintAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->address_id.init(cx, "address")) { return false; } return true; } bool SVCParamIPv6Hint::Init(const char* sourceDescription, bool passedToJSImpl) { // We init the parent's members first if (!SVCParam::Init()) { return false; } return true; } bool SVCParamIPv6Hint::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { SVCParamIPv6HintAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } // Per spec, we define the parent's members first if (!SVCParam::ToObjectInternal(cx, rval)) { return false; } JS::Rooted obj(cx, &rval.toObject()); if (mAddress.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mAddress.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!xpc::NonVoidStringToJsval(cx, currentValue[sequenceIdx0], &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->address_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } return true; } void SVCParamIPv6Hint::TraceDictionary(JSTracer* trc) { SVCParam::TraceDictionary(trc); } SVCParamIPv6Hint& SVCParamIPv6Hint::operator=(const SVCParamIPv6Hint& aOther) { SVCParam::operator=(aOther); mAddress.Reset(); if (aOther.mAddress.WasPassed()) { mAddress.Construct(aOther.mAddress.Value()); } return *this; } SVCParamNoDefaultAlpn::SVCParamNoDefaultAlpn() : SVCParam(FastDictionaryInitializer()) { // Safe to pass a null context if we pass a null value Init(); } bool SVCParamNoDefaultAlpn::Init(const char* sourceDescription, bool passedToJSImpl) { // We init the parent's members first if (!SVCParam::Init()) { return false; } return true; } bool SVCParamNoDefaultAlpn::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { // Per spec, we define the parent's members first if (!SVCParam::ToObjectInternal(cx, rval)) { return false; } JS::Rooted obj(cx, &rval.toObject()); return true; } void SVCParamNoDefaultAlpn::TraceDictionary(JSTracer* trc) { SVCParam::TraceDictionary(trc); } SVCParamNoDefaultAlpn& SVCParamNoDefaultAlpn::operator=(const SVCParamNoDefaultAlpn& aOther) { SVCParam::operator=(aOther); return *this; } SVCParamODoHConfig::SVCParamODoHConfig() : SVCParam(FastDictionaryInitializer()) { // Safe to pass a null context if we pass a null value Init(); } bool SVCParamODoHConfig::InitIds(JSContext* cx, SVCParamODoHConfigAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->ODoHConfig_id.init(cx, "ODoHConfig")) { return false; } return true; } bool SVCParamODoHConfig::Init(const char* sourceDescription, bool passedToJSImpl) { // We init the parent's members first if (!SVCParam::Init()) { return false; } { // scope for any temporaries our default value setting needs. mODoHConfig.AssignLiteral(u""); } return true; } bool SVCParamODoHConfig::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { SVCParamODoHConfigAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } // Per spec, we define the parent's members first if (!SVCParam::ToObjectInternal(cx, rval)) { return false; } JS::Rooted obj(cx, &rval.toObject()); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mODoHConfig; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->ODoHConfig_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void SVCParamODoHConfig::TraceDictionary(JSTracer* trc) { SVCParam::TraceDictionary(trc); } SVCParamODoHConfig& SVCParamODoHConfig::operator=(const SVCParamODoHConfig& aOther) { SVCParam::operator=(aOther); mODoHConfig = aOther.mODoHConfig; return *this; } SVCParamPort::SVCParamPort() : SVCParam(FastDictionaryInitializer()) { // Safe to pass a null context if we pass a null value Init(); } bool SVCParamPort::InitIds(JSContext* cx, SVCParamPortAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->port_id.init(cx, "port")) { return false; } return true; } bool SVCParamPort::Init(const char* sourceDescription, bool passedToJSImpl) { // We init the parent's members first if (!SVCParam::Init()) { return false; } { // scope for any temporaries our default value setting needs. mPort = 0; } return true; } bool SVCParamPort::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { SVCParamPortAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } // Per spec, we define the parent's members first if (!SVCParam::ToObjectInternal(cx, rval)) { return false; } JS::Rooted obj(cx, &rval.toObject()); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint16_t const & currentValue = mPort; temp.setInt32(int32_t(currentValue)); if (!JS_DefinePropertyById(cx, obj, atomsCache->port_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void SVCParamPort::TraceDictionary(JSTracer* trc) { SVCParam::TraceDictionary(trc); } SVCParamPort& SVCParamPort::operator=(const SVCParamPort& aOther) { SVCParam::operator=(aOther); mPort = aOther.mPort; return *this; } SocketsDict::SocketsDict() { // Safe to pass a null context if we pass a null value Init(); } bool SocketsDict::InitIds(JSContext* cx, SocketsDictAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->sockets_id.init(cx, "sockets") || !atomsCache->sent_id.init(cx, "sent") || !atomsCache->received_id.init(cx, "received")) { return false; } return true; } bool SocketsDict::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mReceived = 0.0; } { // scope for any temporaries our default value setting needs. mSent = 0.0; } return true; } bool SocketsDict::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { SocketsDictAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); double const & currentValue = mReceived; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->received_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); double const & currentValue = mSent; temp.set(JS::NumberValue(double(currentValue))); if (!JS_DefinePropertyById(cx, obj, atomsCache->sent_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); if (mSockets.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mSockets.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->sockets_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } return true; } void SocketsDict::TraceDictionary(JSTracer* trc) { } SocketsDict& SocketsDict::operator=(const SocketsDict& aOther) { DictionaryBase::operator=(aOther); mReceived = aOther.mReceived; mSent = aOther.mSent; mSockets.Reset(); if (aOther.mSockets.WasPassed()) { mSockets.Construct(aOther.mSockets.Value()); } return *this; } WebSocketDict::WebSocketDict() { // Safe to pass a null context if we pass a null value Init(); } bool WebSocketDict::InitIds(JSContext* cx, WebSocketDictAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->websockets_id.init(cx, "websockets")) { return false; } return true; } bool WebSocketDict::Init(const char* sourceDescription, bool passedToJSImpl) { return true; } bool WebSocketDict::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { WebSocketDictAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); if (mWebsockets.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mWebsockets.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->websockets_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } return true; } void WebSocketDict::TraceDictionary(JSTracer* trc) { } WebSocketDict& WebSocketDict::operator=(const WebSocketDict& aOther) { DictionaryBase::operator=(aOther); mWebsockets.Reset(); if (aOther.mWebsockets.WasPassed()) { mWebsockets.Construct(aOther.mWebsockets.Value()); } return *this; } HTTPSRecord::HTTPSRecord() { // Safe to pass a null context if we pass a null value Init(); } bool HTTPSRecord::InitIds(JSContext* cx, HTTPSRecordAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->targetName_id.init(cx, "targetName") || !atomsCache->priority_id.init(cx, "priority") || !atomsCache->port_id.init(cx, "port") || !atomsCache->noDefaultAlpn_id.init(cx, "noDefaultAlpn") || !atomsCache->ipv6Hint_id.init(cx, "ipv6Hint") || !atomsCache->ipv4Hint_id.init(cx, "ipv4Hint") || !atomsCache->echConfig_id.init(cx, "echConfig") || !atomsCache->alpn_id.init(cx, "alpn") || !atomsCache->ODoHConfig_id.init(cx, "ODoHConfig")) { return false; } return true; } bool HTTPSRecord::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mPriority = 0; } { // scope for any temporaries our default value setting needs. mTargetName.AssignLiteral(u""); } return true; } bool HTTPSRecord::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { HTTPSRecordAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); if (mODoHConfig.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); SVCParamODoHConfig const & currentValue = mODoHConfig.InternalValue(); if (!currentValue.ToObjectInternal(cx, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->ODoHConfig_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } if (mAlpn.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); SVCParamAlpn const & currentValue = mAlpn.InternalValue(); if (!currentValue.ToObjectInternal(cx, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->alpn_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } if (mEchConfig.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); SVCParamEchConfig const & currentValue = mEchConfig.InternalValue(); if (!currentValue.ToObjectInternal(cx, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->echConfig_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } if (mIpv4Hint.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); SVCParamIPv4Hint const & currentValue = mIpv4Hint.InternalValue(); if (!currentValue.ToObjectInternal(cx, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->ipv4Hint_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } if (mIpv6Hint.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); SVCParamIPv6Hint const & currentValue = mIpv6Hint.InternalValue(); if (!currentValue.ToObjectInternal(cx, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->ipv6Hint_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } if (mNoDefaultAlpn.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); SVCParamNoDefaultAlpn const & currentValue = mNoDefaultAlpn.InternalValue(); if (!currentValue.ToObjectInternal(cx, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->noDefaultAlpn_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } if (mPort.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); SVCParamPort const & currentValue = mPort.InternalValue(); if (!currentValue.ToObjectInternal(cx, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->port_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); uint16_t const & currentValue = mPriority; temp.setInt32(int32_t(currentValue)); if (!JS_DefinePropertyById(cx, obj, atomsCache->priority_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mTargetName; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->targetName_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); return true; } void HTTPSRecord::TraceDictionary(JSTracer* trc) { } HTTPSRecord& HTTPSRecord::operator=(const HTTPSRecord& aOther) { DictionaryBase::operator=(aOther); mODoHConfig.Reset(); if (aOther.mODoHConfig.WasPassed()) { mODoHConfig.Construct(aOther.mODoHConfig.Value()); } mAlpn.Reset(); if (aOther.mAlpn.WasPassed()) { mAlpn.Construct(aOther.mAlpn.Value()); } mEchConfig.Reset(); if (aOther.mEchConfig.WasPassed()) { mEchConfig.Construct(aOther.mEchConfig.Value()); } mIpv4Hint.Reset(); if (aOther.mIpv4Hint.WasPassed()) { mIpv4Hint.Construct(aOther.mIpv4Hint.Value()); } mIpv6Hint.Reset(); if (aOther.mIpv6Hint.WasPassed()) { mIpv6Hint.Construct(aOther.mIpv6Hint.Value()); } mNoDefaultAlpn.Reset(); if (aOther.mNoDefaultAlpn.WasPassed()) { mNoDefaultAlpn.Construct(aOther.mNoDefaultAlpn.Value()); } mPort.Reset(); if (aOther.mPort.WasPassed()) { mPort.Construct(aOther.mPort.Value()); } mPriority = aOther.mPriority; mTargetName = aOther.mTargetName; return *this; } Http3ConnStatsDict::Http3ConnStatsDict() { // Safe to pass a null context if we pass a null value Init(); } bool Http3ConnStatsDict::InitIds(JSContext* cx, Http3ConnStatsDictAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->connections_id.init(cx, "connections")) { return false; } return true; } bool Http3ConnStatsDict::Init(const char* sourceDescription, bool passedToJSImpl) { return true; } bool Http3ConnStatsDict::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { Http3ConnStatsDictAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); if (mConnections.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mConnections.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->connections_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } return true; } void Http3ConnStatsDict::TraceDictionary(JSTracer* trc) { } Http3ConnStatsDict& Http3ConnStatsDict::operator=(const Http3ConnStatsDict& aOther) { DictionaryBase::operator=(aOther); mConnections.Reset(); if (aOther.mConnections.WasPassed()) { mConnections.Construct(aOther.mConnections.Value()); } return *this; } HttpConnDict::HttpConnDict() { // Safe to pass a null context if we pass a null value Init(); } bool HttpConnDict::InitIds(JSContext* cx, HttpConnDictAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->connections_id.init(cx, "connections")) { return false; } return true; } bool HttpConnDict::Init(const char* sourceDescription, bool passedToJSImpl) { return true; } bool HttpConnDict::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { HttpConnDictAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); if (mConnections.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mConnections.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->connections_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } return true; } void HttpConnDict::TraceDictionary(JSTracer* trc) { } HttpConnDict& HttpConnDict::operator=(const HttpConnDict& aOther) { DictionaryBase::operator=(aOther); mConnections.Reset(); if (aOther.mConnections.WasPassed()) { mConnections.Construct(aOther.mConnections.Value()); } return *this; } HTTPSRRLookupDict::HTTPSRRLookupDict() { // Safe to pass a null context if we pass a null value Init(); } bool HTTPSRRLookupDict::InitIds(JSContext* cx, HTTPSRRLookupDictAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->records_id.init(cx, "records") || !atomsCache->error_id.init(cx, "error") || !atomsCache->answer_id.init(cx, "answer")) { return false; } return true; } bool HTTPSRRLookupDict::Init(const char* sourceDescription, bool passedToJSImpl) { { // scope for any temporaries our default value setting needs. mAnswer = false; } { // scope for any temporaries our default value setting needs. mError.AssignLiteral(u""); } return true; } bool HTTPSRRLookupDict::ToObjectInternal(JSContext* cx, JS::MutableHandle rval) const { HTTPSRRLookupDictAtoms* atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } JS::Rooted obj(cx, JS_NewPlainObject(cx)); if (!obj) { return false; } rval.setObject(*obj); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); bool const & currentValue = mAnswer; temp.setBoolean(currentValue); if (!JS_DefinePropertyById(cx, obj, atomsCache->answer_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); nsString const & currentValue = mError; if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { return false; } if (!JS_DefinePropertyById(cx, obj, atomsCache->error_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); if (mRecords.WasPassed()) { do { // block for our 'break' successCode and scope for 'temp' and 'currentValue' JS::Rooted temp(cx); Sequence const & currentValue = mRecords.InternalValue(); uint32_t length = currentValue.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!currentValue[sequenceIdx0].ToObjectInternal(cx, &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } temp.setObject(*returnArray); if (!JS_DefinePropertyById(cx, obj, atomsCache->records_id, temp, JSPROP_ENUMERATE)) { return false; } break; } while(false); } return true; } void HTTPSRRLookupDict::TraceDictionary(JSTracer* trc) { } HTTPSRRLookupDict& HTTPSRRLookupDict::operator=(const HTTPSRRLookupDict& aOther) { DictionaryBase::operator=(aOther); mAnswer = aOther.mAnswer; mError = aOther.mError; mRecords.Reset(); if (aOther.mRecords.WasPassed()) { mRecords.Construct(aOther.mRecords.Value()); } return *this; } } // namespace mozilla::dom