LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - NetworkOptionsBinding.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1666 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 16 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM NetworkOptions.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "AtomList.h"
       4             : #include "NetworkOptionsBinding.h"
       5             : #include "mozilla/OwningNonNull.h"
       6             : #include "mozilla/dom/BindingUtils.h"
       7             : #include "mozilla/dom/NonRefcountedDOMObject.h"
       8             : #include "mozilla/dom/PrimitiveConversions.h"
       9             : #include "mozilla/dom/ScriptSettings.h"
      10             : #include "mozilla/dom/SimpleGlobalObject.h"
      11             : 
      12             : namespace mozilla {
      13             : namespace dom {
      14             : 
      15             : 
      16           0 : NetworkCommandOptions::NetworkCommandOptions()
      17             : {
      18             :   // Safe to pass a null context if we pass a null value
      19           0 :   Init(nullptr, JS::NullHandleValue);
      20           0 : }
      21             : 
      22             : 
      23             : 
      24             : bool
      25           0 : NetworkCommandOptions::InitIds(JSContext* cx, NetworkCommandOptionsAtoms* atomsCache)
      26             : {
      27           0 :   MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
      28             : 
      29             :   // Initialize these in reverse order so that any failure leaves the first one
      30             :   // uninitialized.
      31           0 :   if (!atomsCache->wifictrlinterfacename_id.init(cx, "wifictrlinterfacename") ||
      32           0 :       !atomsCache->wifiStartIp_id.init(cx, "wifiStartIp") ||
      33           0 :       !atomsCache->wifiEndIp_id.init(cx, "wifiEndIp") ||
      34           0 :       !atomsCache->usbStartIp_id.init(cx, "usbStartIp") ||
      35           0 :       !atomsCache->usbEndIp_id.init(cx, "usbEndIp") ||
      36           0 :       !atomsCache->threshold_id.init(cx, "threshold") ||
      37           0 :       !atomsCache->startIp_id.init(cx, "startIp") ||
      38           0 :       !atomsCache->ssid_id.init(cx, "ssid") ||
      39           0 :       !atomsCache->serverIp_id.init(cx, "serverIp") ||
      40           0 :       !atomsCache->security_id.init(cx, "security") ||
      41           0 :       !atomsCache->report_id.init(cx, "report") ||
      42           0 :       !atomsCache->prefixLength_id.init(cx, "prefixLength") ||
      43           0 :       !atomsCache->prefix_id.init(cx, "prefix") ||
      44           0 :       !atomsCache->preInternalIfname_id.init(cx, "preInternalIfname") ||
      45           0 :       !atomsCache->preExternalIfname_id.init(cx, "preExternalIfname") ||
      46           0 :       !atomsCache->mtu_id.init(cx, "mtu") ||
      47           0 :       !atomsCache->mode_id.init(cx, "mode") ||
      48           0 :       !atomsCache->maskLength_id.init(cx, "maskLength") ||
      49           0 :       !atomsCache->mask_id.init(cx, "mask") ||
      50           0 :       !atomsCache->link_id.init(cx, "link") ||
      51           0 :       !atomsCache->key_id.init(cx, "key") ||
      52           0 :       !atomsCache->ipaddr_id.init(cx, "ipaddr") ||
      53           0 :       !atomsCache->ip_id.init(cx, "ip") ||
      54           0 :       !atomsCache->internalIfname_id.init(cx, "internalIfname") ||
      55           0 :       !atomsCache->interfaceList_id.init(cx, "interfaceList") ||
      56           0 :       !atomsCache->ifname_id.init(cx, "ifname") ||
      57           0 :       !atomsCache->id_id.init(cx, "id") ||
      58           0 :       !atomsCache->gateways_id.init(cx, "gateways") ||
      59           0 :       !atomsCache->gateway_long_id.init(cx, "gateway_long") ||
      60           0 :       !atomsCache->gateway_id.init(cx, "gateway") ||
      61           0 :       !atomsCache->externalIfname_id.init(cx, "externalIfname") ||
      62           0 :       !atomsCache->endIp_id.init(cx, "endIp") ||
      63           0 :       !atomsCache->enabled_id.init(cx, "enabled") ||
      64           0 :       !atomsCache->enable_id.init(cx, "enable") ||
      65           0 :       !atomsCache->domain_id.init(cx, "domain") ||
      66           0 :       !atomsCache->dnses_id.init(cx, "dnses") ||
      67           0 :       !atomsCache->dns2_long_id.init(cx, "dns2_long") ||
      68           0 :       !atomsCache->dns2_id.init(cx, "dns2") ||
      69           0 :       !atomsCache->dns1_long_id.init(cx, "dns1_long") ||
      70           0 :       !atomsCache->dns1_id.init(cx, "dns1") ||
      71           0 :       !atomsCache->curInternalIfname_id.init(cx, "curInternalIfname") ||
      72           0 :       !atomsCache->curExternalIfname_id.init(cx, "curExternalIfname") ||
      73           0 :       !atomsCache->cmd_id.init(cx, "cmd")) {
      74           0 :     return false;
      75             :   }
      76           0 :   return true;
      77             : }
      78             : 
      79             : bool
      80           0 : NetworkCommandOptions::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
      81             : {
      82             :   // Passing a null JSContext is OK only if we're initing from null,
      83             :   // Since in that case we will not have to do any property gets
      84             :   // Also evaluate isNullOrUndefined in order to avoid false-positive
      85             :   // checkers by static analysis tools
      86           0 :   MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
      87           0 :   NetworkCommandOptionsAtoms* atomsCache = nullptr;
      88           0 :   if (cx) {
      89           0 :     atomsCache = GetAtomCache<NetworkCommandOptionsAtoms>(cx);
      90           0 :     if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
      91           0 :       return false;
      92             :     }
      93             :   }
      94             : 
      95           0 :   if (!IsConvertibleToDictionary(val)) {
      96           0 :     return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription);
      97             :   }
      98             : 
      99           0 :   bool isNull = val.isNullOrUndefined();
     100             :   // We only need these if !isNull, in which case we have |cx|.
     101           0 :   Maybe<JS::Rooted<JSObject *> > object;
     102           0 :   Maybe<JS::Rooted<JS::Value> > temp;
     103           0 :   if (!isNull) {
     104           0 :     MOZ_ASSERT(cx);
     105           0 :     object.emplace(cx, &val.toObject());
     106           0 :     temp.emplace(cx);
     107             :   }
     108           0 :   if (!isNull) {
     109           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->cmd_id, temp.ptr())) {
     110           0 :       return false;
     111             :     }
     112             :   }
     113           0 :   if (!isNull && !temp->isUndefined()) {
     114           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mCmd)) {
     115           0 :       return false;
     116             :     }
     117             :   } else {
     118             :     static const char16_t data[] = { 0 };
     119           0 :     mCmd.Rebind(data, ArrayLength(data) - 1);
     120             :   }
     121           0 :   mIsAnyMemberPresent = true;
     122             : 
     123           0 :   if (!isNull) {
     124           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->curExternalIfname_id, temp.ptr())) {
     125           0 :       return false;
     126             :     }
     127             :   }
     128           0 :   if (!isNull && !temp->isUndefined()) {
     129           0 :     mCurExternalIfname.Construct();
     130           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mCurExternalIfname.Value()))) {
     131           0 :       return false;
     132             :     }
     133           0 :     mIsAnyMemberPresent = true;
     134             :   }
     135             : 
     136           0 :   if (!isNull) {
     137           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->curInternalIfname_id, temp.ptr())) {
     138           0 :       return false;
     139             :     }
     140             :   }
     141           0 :   if (!isNull && !temp->isUndefined()) {
     142           0 :     mCurInternalIfname.Construct();
     143           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mCurInternalIfname.Value()))) {
     144           0 :       return false;
     145             :     }
     146           0 :     mIsAnyMemberPresent = true;
     147             :   }
     148             : 
     149           0 :   if (!isNull) {
     150           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->dns1_id, temp.ptr())) {
     151           0 :       return false;
     152             :     }
     153             :   }
     154           0 :   if (!isNull && !temp->isUndefined()) {
     155           0 :     mDns1.Construct();
     156           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mDns1.Value()))) {
     157           0 :       return false;
     158             :     }
     159           0 :     mIsAnyMemberPresent = true;
     160             :   }
     161             : 
     162           0 :   if (!isNull) {
     163           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->dns1_long_id, temp.ptr())) {
     164           0 :       return false;
     165             :     }
     166             :   }
     167           0 :   if (!isNull && !temp->isUndefined()) {
     168           0 :     mDns1_long.Construct();
     169           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mDns1_long.Value()))) {
     170           0 :       return false;
     171             :     }
     172           0 :     mIsAnyMemberPresent = true;
     173             :   }
     174             : 
     175           0 :   if (!isNull) {
     176           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->dns2_id, temp.ptr())) {
     177           0 :       return false;
     178             :     }
     179             :   }
     180           0 :   if (!isNull && !temp->isUndefined()) {
     181           0 :     mDns2.Construct();
     182           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mDns2.Value()))) {
     183           0 :       return false;
     184             :     }
     185           0 :     mIsAnyMemberPresent = true;
     186             :   }
     187             : 
     188           0 :   if (!isNull) {
     189           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->dns2_long_id, temp.ptr())) {
     190           0 :       return false;
     191             :     }
     192             :   }
     193           0 :   if (!isNull && !temp->isUndefined()) {
     194           0 :     mDns2_long.Construct();
     195           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mDns2_long.Value()))) {
     196           0 :       return false;
     197             :     }
     198           0 :     mIsAnyMemberPresent = true;
     199             :   }
     200             : 
     201           0 :   if (!isNull) {
     202           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->dnses_id, temp.ptr())) {
     203           0 :       return false;
     204             :     }
     205             :   }
     206           0 :   if (!isNull && !temp->isUndefined()) {
     207           0 :     mDnses.Construct();
     208           0 :     if (temp.ref().isObject()) {
     209           0 :       JS::ForOfIterator iter(cx);
     210           0 :       if (!iter.init(temp.ref(), JS::ForOfIterator::AllowNonIterable)) {
     211           0 :         return false;
     212             :       }
     213           0 :       if (!iter.valueIsIterable()) {
     214           0 :         ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'dnses' member of NetworkCommandOptions");
     215           0 :         return false;
     216             :       }
     217           0 :       Sequence<nsString> &arr = (mDnses.Value());
     218           0 :       JS::Rooted<JS::Value> temp(cx);
     219             :       while (true) {
     220             :         bool done;
     221           0 :         if (!iter.next(&temp, &done)) {
     222           0 :           return false;
     223             :         }
     224           0 :         if (done) {
     225           0 :           break;
     226             :         }
     227           0 :         nsString* slotPtr = arr.AppendElement(mozilla::fallible);
     228           0 :         if (!slotPtr) {
     229           0 :           JS_ReportOutOfMemory(cx);
     230           0 :           return false;
     231             :         }
     232           0 :         nsString& slot = *slotPtr;
     233           0 :         if (!ConvertJSValueToString(cx, temp, eStringify, eStringify, slot)) {
     234           0 :           return false;
     235             :         }
     236           0 :       }
     237             :     } else {
     238           0 :       ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'dnses' member of NetworkCommandOptions");
     239           0 :       return false;
     240             :     }
     241           0 :     mIsAnyMemberPresent = true;
     242             :   }
     243             : 
     244           0 :   if (!isNull) {
     245           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->domain_id, temp.ptr())) {
     246           0 :       return false;
     247             :     }
     248             :   }
     249           0 :   if (!isNull && !temp->isUndefined()) {
     250           0 :     mDomain.Construct();
     251           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mDomain.Value()))) {
     252           0 :       return false;
     253             :     }
     254           0 :     mIsAnyMemberPresent = true;
     255             :   }
     256             : 
     257           0 :   if (!isNull) {
     258           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->enable_id, temp.ptr())) {
     259           0 :       return false;
     260             :     }
     261             :   }
     262           0 :   if (!isNull && !temp->isUndefined()) {
     263           0 :     mEnable.Construct();
     264           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &(mEnable.Value()))) {
     265           0 :       return false;
     266             :     }
     267           0 :     mIsAnyMemberPresent = true;
     268             :   }
     269             : 
     270           0 :   if (!isNull) {
     271           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->enabled_id, temp.ptr())) {
     272           0 :       return false;
     273             :     }
     274             :   }
     275           0 :   if (!isNull && !temp->isUndefined()) {
     276           0 :     mEnabled.Construct();
     277           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &(mEnabled.Value()))) {
     278           0 :       return false;
     279             :     }
     280           0 :     mIsAnyMemberPresent = true;
     281             :   }
     282             : 
     283           0 :   if (!isNull) {
     284           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->endIp_id, temp.ptr())) {
     285           0 :       return false;
     286             :     }
     287             :   }
     288           0 :   if (!isNull && !temp->isUndefined()) {
     289           0 :     mEndIp.Construct();
     290           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mEndIp.Value()))) {
     291           0 :       return false;
     292             :     }
     293           0 :     mIsAnyMemberPresent = true;
     294             :   }
     295             : 
     296           0 :   if (!isNull) {
     297           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->externalIfname_id, temp.ptr())) {
     298           0 :       return false;
     299             :     }
     300             :   }
     301           0 :   if (!isNull && !temp->isUndefined()) {
     302           0 :     mExternalIfname.Construct();
     303           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mExternalIfname.Value()))) {
     304           0 :       return false;
     305             :     }
     306           0 :     mIsAnyMemberPresent = true;
     307             :   }
     308             : 
     309           0 :   if (!isNull) {
     310           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->gateway_id, temp.ptr())) {
     311           0 :       return false;
     312             :     }
     313             :   }
     314           0 :   if (!isNull && !temp->isUndefined()) {
     315           0 :     mGateway.Construct();
     316           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mGateway.Value()))) {
     317           0 :       return false;
     318             :     }
     319           0 :     mIsAnyMemberPresent = true;
     320             :   }
     321             : 
     322           0 :   if (!isNull) {
     323           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->gateway_long_id, temp.ptr())) {
     324           0 :       return false;
     325             :     }
     326             :   }
     327           0 :   if (!isNull && !temp->isUndefined()) {
     328           0 :     mGateway_long.Construct();
     329           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mGateway_long.Value()))) {
     330           0 :       return false;
     331             :     }
     332           0 :     mIsAnyMemberPresent = true;
     333             :   }
     334             : 
     335           0 :   if (!isNull) {
     336           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->gateways_id, temp.ptr())) {
     337           0 :       return false;
     338             :     }
     339             :   }
     340           0 :   if (!isNull && !temp->isUndefined()) {
     341           0 :     mGateways.Construct();
     342           0 :     if (temp.ref().isObject()) {
     343           0 :       JS::ForOfIterator iter(cx);
     344           0 :       if (!iter.init(temp.ref(), JS::ForOfIterator::AllowNonIterable)) {
     345           0 :         return false;
     346             :       }
     347           0 :       if (!iter.valueIsIterable()) {
     348           0 :         ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'gateways' member of NetworkCommandOptions");
     349           0 :         return false;
     350             :       }
     351           0 :       Sequence<nsString> &arr = (mGateways.Value());
     352           0 :       JS::Rooted<JS::Value> temp(cx);
     353             :       while (true) {
     354             :         bool done;
     355           0 :         if (!iter.next(&temp, &done)) {
     356           0 :           return false;
     357             :         }
     358           0 :         if (done) {
     359           0 :           break;
     360             :         }
     361           0 :         nsString* slotPtr = arr.AppendElement(mozilla::fallible);
     362           0 :         if (!slotPtr) {
     363           0 :           JS_ReportOutOfMemory(cx);
     364           0 :           return false;
     365             :         }
     366           0 :         nsString& slot = *slotPtr;
     367           0 :         if (!ConvertJSValueToString(cx, temp, eStringify, eStringify, slot)) {
     368           0 :           return false;
     369             :         }
     370           0 :       }
     371             :     } else {
     372           0 :       ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'gateways' member of NetworkCommandOptions");
     373           0 :       return false;
     374             :     }
     375           0 :     mIsAnyMemberPresent = true;
     376             :   }
     377             : 
     378           0 :   if (!isNull) {
     379           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->id_id, temp.ptr())) {
     380           0 :       return false;
     381             :     }
     382             :   }
     383           0 :   if (!isNull && !temp->isUndefined()) {
     384           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &mId)) {
     385           0 :       return false;
     386             :     }
     387             :   } else {
     388           0 :     mId = 0;
     389             :   }
     390           0 :   mIsAnyMemberPresent = true;
     391             : 
     392           0 :   if (!isNull) {
     393           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->ifname_id, temp.ptr())) {
     394           0 :       return false;
     395             :     }
     396             :   }
     397           0 :   if (!isNull && !temp->isUndefined()) {
     398           0 :     mIfname.Construct();
     399           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mIfname.Value()))) {
     400           0 :       return false;
     401             :     }
     402           0 :     mIsAnyMemberPresent = true;
     403             :   }
     404             : 
     405           0 :   if (!isNull) {
     406           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->interfaceList_id, temp.ptr())) {
     407           0 :       return false;
     408             :     }
     409             :   }
     410           0 :   if (!isNull && !temp->isUndefined()) {
     411           0 :     mInterfaceList.Construct();
     412           0 :     if (temp.ref().isObject()) {
     413           0 :       JS::ForOfIterator iter(cx);
     414           0 :       if (!iter.init(temp.ref(), JS::ForOfIterator::AllowNonIterable)) {
     415           0 :         return false;
     416             :       }
     417           0 :       if (!iter.valueIsIterable()) {
     418           0 :         ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'interfaceList' member of NetworkCommandOptions");
     419           0 :         return false;
     420             :       }
     421           0 :       Sequence<nsString> &arr = (mInterfaceList.Value());
     422           0 :       JS::Rooted<JS::Value> temp(cx);
     423             :       while (true) {
     424             :         bool done;
     425           0 :         if (!iter.next(&temp, &done)) {
     426           0 :           return false;
     427             :         }
     428           0 :         if (done) {
     429           0 :           break;
     430             :         }
     431           0 :         nsString* slotPtr = arr.AppendElement(mozilla::fallible);
     432           0 :         if (!slotPtr) {
     433           0 :           JS_ReportOutOfMemory(cx);
     434           0 :           return false;
     435             :         }
     436           0 :         nsString& slot = *slotPtr;
     437           0 :         if (!ConvertJSValueToString(cx, temp, eStringify, eStringify, slot)) {
     438           0 :           return false;
     439             :         }
     440           0 :       }
     441             :     } else {
     442           0 :       ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'interfaceList' member of NetworkCommandOptions");
     443           0 :       return false;
     444             :     }
     445           0 :     mIsAnyMemberPresent = true;
     446             :   }
     447             : 
     448           0 :   if (!isNull) {
     449           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->internalIfname_id, temp.ptr())) {
     450           0 :       return false;
     451             :     }
     452             :   }
     453           0 :   if (!isNull && !temp->isUndefined()) {
     454           0 :     mInternalIfname.Construct();
     455           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mInternalIfname.Value()))) {
     456           0 :       return false;
     457             :     }
     458           0 :     mIsAnyMemberPresent = true;
     459             :   }
     460             : 
     461           0 :   if (!isNull) {
     462           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->ip_id, temp.ptr())) {
     463           0 :       return false;
     464             :     }
     465             :   }
     466           0 :   if (!isNull && !temp->isUndefined()) {
     467           0 :     mIp.Construct();
     468           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mIp.Value()))) {
     469           0 :       return false;
     470             :     }
     471           0 :     mIsAnyMemberPresent = true;
     472             :   }
     473             : 
     474           0 :   if (!isNull) {
     475           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->ipaddr_id, temp.ptr())) {
     476           0 :       return false;
     477             :     }
     478             :   }
     479           0 :   if (!isNull && !temp->isUndefined()) {
     480           0 :     mIpaddr.Construct();
     481           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mIpaddr.Value()))) {
     482           0 :       return false;
     483             :     }
     484           0 :     mIsAnyMemberPresent = true;
     485             :   }
     486             : 
     487           0 :   if (!isNull) {
     488           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->key_id, temp.ptr())) {
     489           0 :       return false;
     490             :     }
     491             :   }
     492           0 :   if (!isNull && !temp->isUndefined()) {
     493           0 :     mKey.Construct();
     494           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mKey.Value()))) {
     495           0 :       return false;
     496             :     }
     497           0 :     mIsAnyMemberPresent = true;
     498             :   }
     499             : 
     500           0 :   if (!isNull) {
     501           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->link_id, temp.ptr())) {
     502           0 :       return false;
     503             :     }
     504             :   }
     505           0 :   if (!isNull && !temp->isUndefined()) {
     506           0 :     mLink.Construct();
     507           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mLink.Value()))) {
     508           0 :       return false;
     509             :     }
     510           0 :     mIsAnyMemberPresent = true;
     511             :   }
     512             : 
     513           0 :   if (!isNull) {
     514           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->mask_id, temp.ptr())) {
     515           0 :       return false;
     516             :     }
     517             :   }
     518           0 :   if (!isNull && !temp->isUndefined()) {
     519           0 :     mMask.Construct();
     520           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mMask.Value()))) {
     521           0 :       return false;
     522             :     }
     523           0 :     mIsAnyMemberPresent = true;
     524             :   }
     525             : 
     526           0 :   if (!isNull) {
     527           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->maskLength_id, temp.ptr())) {
     528           0 :       return false;
     529             :     }
     530             :   }
     531           0 :   if (!isNull && !temp->isUndefined()) {
     532           0 :     mMaskLength.Construct();
     533           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mMaskLength.Value()))) {
     534           0 :       return false;
     535             :     }
     536           0 :     mIsAnyMemberPresent = true;
     537             :   }
     538             : 
     539           0 :   if (!isNull) {
     540           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->mode_id, temp.ptr())) {
     541           0 :       return false;
     542             :     }
     543             :   }
     544           0 :   if (!isNull && !temp->isUndefined()) {
     545           0 :     mMode.Construct();
     546           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mMode.Value()))) {
     547           0 :       return false;
     548             :     }
     549           0 :     mIsAnyMemberPresent = true;
     550             :   }
     551             : 
     552           0 :   if (!isNull) {
     553           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->mtu_id, temp.ptr())) {
     554           0 :       return false;
     555             :     }
     556             :   }
     557           0 :   if (!isNull && !temp->isUndefined()) {
     558           0 :     mMtu.Construct();
     559           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mMtu.Value()))) {
     560           0 :       return false;
     561             :     }
     562           0 :     mIsAnyMemberPresent = true;
     563             :   }
     564             : 
     565           0 :   if (!isNull) {
     566           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->preExternalIfname_id, temp.ptr())) {
     567           0 :       return false;
     568             :     }
     569             :   }
     570           0 :   if (!isNull && !temp->isUndefined()) {
     571           0 :     mPreExternalIfname.Construct();
     572           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mPreExternalIfname.Value()))) {
     573           0 :       return false;
     574             :     }
     575           0 :     mIsAnyMemberPresent = true;
     576             :   }
     577             : 
     578           0 :   if (!isNull) {
     579           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->preInternalIfname_id, temp.ptr())) {
     580           0 :       return false;
     581             :     }
     582             :   }
     583           0 :   if (!isNull && !temp->isUndefined()) {
     584           0 :     mPreInternalIfname.Construct();
     585           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mPreInternalIfname.Value()))) {
     586           0 :       return false;
     587             :     }
     588           0 :     mIsAnyMemberPresent = true;
     589             :   }
     590             : 
     591           0 :   if (!isNull) {
     592           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->prefix_id, temp.ptr())) {
     593           0 :       return false;
     594             :     }
     595             :   }
     596           0 :   if (!isNull && !temp->isUndefined()) {
     597           0 :     mPrefix.Construct();
     598           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mPrefix.Value()))) {
     599           0 :       return false;
     600             :     }
     601           0 :     mIsAnyMemberPresent = true;
     602             :   }
     603             : 
     604           0 :   if (!isNull) {
     605           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->prefixLength_id, temp.ptr())) {
     606           0 :       return false;
     607             :     }
     608             :   }
     609           0 :   if (!isNull && !temp->isUndefined()) {
     610           0 :     mPrefixLength.Construct();
     611           0 :     if (!ValueToPrimitive<uint32_t, eDefault>(cx, temp.ref(), &(mPrefixLength.Value()))) {
     612           0 :       return false;
     613             :     }
     614           0 :     mIsAnyMemberPresent = true;
     615             :   }
     616             : 
     617           0 :   if (!isNull) {
     618           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->report_id, temp.ptr())) {
     619           0 :       return false;
     620             :     }
     621             :   }
     622           0 :   if (!isNull && !temp->isUndefined()) {
     623           0 :     mReport.Construct();
     624           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &(mReport.Value()))) {
     625           0 :       return false;
     626             :     }
     627           0 :     mIsAnyMemberPresent = true;
     628             :   }
     629             : 
     630           0 :   if (!isNull) {
     631           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->security_id, temp.ptr())) {
     632           0 :       return false;
     633             :     }
     634             :   }
     635           0 :   if (!isNull && !temp->isUndefined()) {
     636           0 :     mSecurity.Construct();
     637           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mSecurity.Value()))) {
     638           0 :       return false;
     639             :     }
     640           0 :     mIsAnyMemberPresent = true;
     641             :   }
     642             : 
     643           0 :   if (!isNull) {
     644           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->serverIp_id, temp.ptr())) {
     645           0 :       return false;
     646             :     }
     647             :   }
     648           0 :   if (!isNull && !temp->isUndefined()) {
     649           0 :     mServerIp.Construct();
     650           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mServerIp.Value()))) {
     651           0 :       return false;
     652             :     }
     653           0 :     mIsAnyMemberPresent = true;
     654             :   }
     655             : 
     656           0 :   if (!isNull) {
     657           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->ssid_id, temp.ptr())) {
     658           0 :       return false;
     659             :     }
     660             :   }
     661           0 :   if (!isNull && !temp->isUndefined()) {
     662           0 :     mSsid.Construct();
     663           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mSsid.Value()))) {
     664           0 :       return false;
     665             :     }
     666           0 :     mIsAnyMemberPresent = true;
     667             :   }
     668             : 
     669           0 :   if (!isNull) {
     670           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->startIp_id, temp.ptr())) {
     671           0 :       return false;
     672             :     }
     673             :   }
     674           0 :   if (!isNull && !temp->isUndefined()) {
     675           0 :     mStartIp.Construct();
     676           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mStartIp.Value()))) {
     677           0 :       return false;
     678             :     }
     679           0 :     mIsAnyMemberPresent = true;
     680             :   }
     681             : 
     682           0 :   if (!isNull) {
     683           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->threshold_id, temp.ptr())) {
     684           0 :       return false;
     685             :     }
     686             :   }
     687           0 :   if (!isNull && !temp->isUndefined()) {
     688           0 :     mThreshold.Construct();
     689           0 :     if (!ValueToPrimitive<int64_t, eDefault>(cx, temp.ref(), &(mThreshold.Value()))) {
     690           0 :       return false;
     691             :     }
     692           0 :     mIsAnyMemberPresent = true;
     693             :   }
     694             : 
     695           0 :   if (!isNull) {
     696           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->usbEndIp_id, temp.ptr())) {
     697           0 :       return false;
     698             :     }
     699             :   }
     700           0 :   if (!isNull && !temp->isUndefined()) {
     701           0 :     mUsbEndIp.Construct();
     702           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mUsbEndIp.Value()))) {
     703           0 :       return false;
     704             :     }
     705           0 :     mIsAnyMemberPresent = true;
     706             :   }
     707             : 
     708           0 :   if (!isNull) {
     709           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->usbStartIp_id, temp.ptr())) {
     710           0 :       return false;
     711             :     }
     712             :   }
     713           0 :   if (!isNull && !temp->isUndefined()) {
     714           0 :     mUsbStartIp.Construct();
     715           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mUsbStartIp.Value()))) {
     716           0 :       return false;
     717             :     }
     718           0 :     mIsAnyMemberPresent = true;
     719             :   }
     720             : 
     721           0 :   if (!isNull) {
     722           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->wifiEndIp_id, temp.ptr())) {
     723           0 :       return false;
     724             :     }
     725             :   }
     726           0 :   if (!isNull && !temp->isUndefined()) {
     727           0 :     mWifiEndIp.Construct();
     728           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mWifiEndIp.Value()))) {
     729           0 :       return false;
     730             :     }
     731           0 :     mIsAnyMemberPresent = true;
     732             :   }
     733             : 
     734           0 :   if (!isNull) {
     735           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->wifiStartIp_id, temp.ptr())) {
     736           0 :       return false;
     737             :     }
     738             :   }
     739           0 :   if (!isNull && !temp->isUndefined()) {
     740           0 :     mWifiStartIp.Construct();
     741           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mWifiStartIp.Value()))) {
     742           0 :       return false;
     743             :     }
     744           0 :     mIsAnyMemberPresent = true;
     745             :   }
     746             : 
     747           0 :   if (!isNull) {
     748           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->wifictrlinterfacename_id, temp.ptr())) {
     749           0 :       return false;
     750             :     }
     751             :   }
     752           0 :   if (!isNull && !temp->isUndefined()) {
     753           0 :     mWifictrlinterfacename.Construct();
     754           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, (mWifictrlinterfacename.Value()))) {
     755           0 :       return false;
     756             :     }
     757           0 :     mIsAnyMemberPresent = true;
     758             :   }
     759           0 :   return true;
     760             : }
     761             : 
     762             : bool
     763           0 : NetworkCommandOptions::Init(const nsAString& aJSON)
     764             : {
     765           0 :   AutoJSAPI jsapi;
     766           0 :   JSObject* cleanGlobal = SimpleGlobalObject::Create(SimpleGlobalObject::GlobalType::BindingDetail);
     767           0 :   if (!cleanGlobal) {
     768           0 :     return false;
     769             :   }
     770           0 :   if (!jsapi.Init(cleanGlobal)) {
     771           0 :     return false;
     772             :   }
     773           0 :   JSContext* cx = jsapi.cx();
     774           0 :   JS::Rooted<JS::Value> json(cx);
     775           0 :   bool ok = ParseJSON(cx, aJSON, &json);
     776           0 :   NS_ENSURE_TRUE(ok, false);
     777           0 :   return Init(cx, json);
     778             : }
     779             : 
     780             : bool
     781           0 : NetworkCommandOptions::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
     782             : {
     783           0 :   NetworkCommandOptionsAtoms* atomsCache = GetAtomCache<NetworkCommandOptionsAtoms>(cx);
     784           0 :   if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
     785           0 :     return false;
     786             :   }
     787             : 
     788           0 :   JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
     789           0 :   if (!obj) {
     790           0 :     return false;
     791             :   }
     792           0 :   rval.set(JS::ObjectValue(*obj));
     793             : 
     794             :   do {
     795             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     796           0 :     JS::Rooted<JS::Value> temp(cx);
     797           0 :     nsString const & currentValue = mCmd;
     798           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
     799           0 :       return false;
     800             :     }
     801           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->cmd_id, temp, JSPROP_ENUMERATE)) {
     802           0 :       return false;
     803             :     }
     804           0 :     break;
     805             :   } while(0);
     806             : 
     807           0 :   if (mCurExternalIfname.WasPassed()) {
     808             :     do {
     809             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     810           0 :       JS::Rooted<JS::Value> temp(cx);
     811           0 :       nsString const & currentValue = mCurExternalIfname.InternalValue();
     812           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
     813           0 :         return false;
     814             :       }
     815           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->curExternalIfname_id, temp, JSPROP_ENUMERATE)) {
     816           0 :         return false;
     817             :       }
     818           0 :       break;
     819             :     } while(0);
     820             :   }
     821             : 
     822           0 :   if (mCurInternalIfname.WasPassed()) {
     823             :     do {
     824             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     825           0 :       JS::Rooted<JS::Value> temp(cx);
     826           0 :       nsString const & currentValue = mCurInternalIfname.InternalValue();
     827           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
     828           0 :         return false;
     829             :       }
     830           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->curInternalIfname_id, temp, JSPROP_ENUMERATE)) {
     831           0 :         return false;
     832             :       }
     833           0 :       break;
     834             :     } while(0);
     835             :   }
     836             : 
     837           0 :   if (mDns1.WasPassed()) {
     838             :     do {
     839             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     840           0 :       JS::Rooted<JS::Value> temp(cx);
     841           0 :       nsString const & currentValue = mDns1.InternalValue();
     842           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
     843           0 :         return false;
     844             :       }
     845           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->dns1_id, temp, JSPROP_ENUMERATE)) {
     846           0 :         return false;
     847             :       }
     848           0 :       break;
     849             :     } while(0);
     850             :   }
     851             : 
     852           0 :   if (mDns1_long.WasPassed()) {
     853             :     do {
     854             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     855           0 :       JS::Rooted<JS::Value> temp(cx);
     856           0 :       int32_t const & currentValue = mDns1_long.InternalValue();
     857           0 :       temp.setInt32(int32_t(currentValue));
     858           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->dns1_long_id, temp, JSPROP_ENUMERATE)) {
     859           0 :         return false;
     860             :       }
     861           0 :       break;
     862             :     } while(0);
     863             :   }
     864             : 
     865           0 :   if (mDns2.WasPassed()) {
     866             :     do {
     867             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     868           0 :       JS::Rooted<JS::Value> temp(cx);
     869           0 :       nsString const & currentValue = mDns2.InternalValue();
     870           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
     871           0 :         return false;
     872             :       }
     873           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->dns2_id, temp, JSPROP_ENUMERATE)) {
     874           0 :         return false;
     875             :       }
     876           0 :       break;
     877             :     } while(0);
     878             :   }
     879             : 
     880           0 :   if (mDns2_long.WasPassed()) {
     881             :     do {
     882             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     883           0 :       JS::Rooted<JS::Value> temp(cx);
     884           0 :       int32_t const & currentValue = mDns2_long.InternalValue();
     885           0 :       temp.setInt32(int32_t(currentValue));
     886           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->dns2_long_id, temp, JSPROP_ENUMERATE)) {
     887           0 :         return false;
     888             :       }
     889           0 :       break;
     890             :     } while(0);
     891             :   }
     892             : 
     893           0 :   if (mDnses.WasPassed()) {
     894             :     do {
     895             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     896           0 :       JS::Rooted<JS::Value> temp(cx);
     897           0 :       Sequence<nsString> const & currentValue = mDnses.InternalValue();
     898             : 
     899           0 :       uint32_t length = currentValue.Length();
     900           0 :       JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
     901           0 :       if (!returnArray) {
     902           0 :         return false;
     903             :       }
     904             :       // Scope for 'tmp'
     905             :       {
     906           0 :         JS::Rooted<JS::Value> tmp(cx);
     907           0 :         for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
     908             :           // Control block to let us common up the JS_DefineElement calls when there
     909             :           // are different ways to succeed at wrapping the object.
     910             :           do {
     911           0 :             if (!xpc::NonVoidStringToJsval(cx, currentValue[sequenceIdx0], &tmp)) {
     912           0 :               return false;
     913             :             }
     914           0 :             break;
     915             :           } while (0);
     916           0 :           if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
     917             :                                 JSPROP_ENUMERATE)) {
     918           0 :             return false;
     919             :           }
     920             :         }
     921             :       }
     922           0 :       temp.setObject(*returnArray);
     923           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->dnses_id, temp, JSPROP_ENUMERATE)) {
     924           0 :         return false;
     925             :       }
     926           0 :       break;
     927             :     } while(0);
     928             :   }
     929             : 
     930           0 :   if (mDomain.WasPassed()) {
     931             :     do {
     932             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     933           0 :       JS::Rooted<JS::Value> temp(cx);
     934           0 :       nsString const & currentValue = mDomain.InternalValue();
     935           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
     936           0 :         return false;
     937             :       }
     938           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->domain_id, temp, JSPROP_ENUMERATE)) {
     939           0 :         return false;
     940             :       }
     941           0 :       break;
     942             :     } while(0);
     943             :   }
     944             : 
     945           0 :   if (mEnable.WasPassed()) {
     946             :     do {
     947             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     948           0 :       JS::Rooted<JS::Value> temp(cx);
     949           0 :       bool const & currentValue = mEnable.InternalValue();
     950           0 :       temp.setBoolean(currentValue);
     951           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->enable_id, temp, JSPROP_ENUMERATE)) {
     952           0 :         return false;
     953             :       }
     954           0 :       break;
     955             :     } while(0);
     956             :   }
     957             : 
     958           0 :   if (mEnabled.WasPassed()) {
     959             :     do {
     960             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     961           0 :       JS::Rooted<JS::Value> temp(cx);
     962           0 :       bool const & currentValue = mEnabled.InternalValue();
     963           0 :       temp.setBoolean(currentValue);
     964           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->enabled_id, temp, JSPROP_ENUMERATE)) {
     965           0 :         return false;
     966             :       }
     967           0 :       break;
     968             :     } while(0);
     969             :   }
     970             : 
     971           0 :   if (mEndIp.WasPassed()) {
     972             :     do {
     973             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     974           0 :       JS::Rooted<JS::Value> temp(cx);
     975           0 :       nsString const & currentValue = mEndIp.InternalValue();
     976           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
     977           0 :         return false;
     978             :       }
     979           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->endIp_id, temp, JSPROP_ENUMERATE)) {
     980           0 :         return false;
     981             :       }
     982           0 :       break;
     983             :     } while(0);
     984             :   }
     985             : 
     986           0 :   if (mExternalIfname.WasPassed()) {
     987             :     do {
     988             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     989           0 :       JS::Rooted<JS::Value> temp(cx);
     990           0 :       nsString const & currentValue = mExternalIfname.InternalValue();
     991           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
     992           0 :         return false;
     993             :       }
     994           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->externalIfname_id, temp, JSPROP_ENUMERATE)) {
     995           0 :         return false;
     996             :       }
     997           0 :       break;
     998             :     } while(0);
     999             :   }
    1000             : 
    1001           0 :   if (mGateway.WasPassed()) {
    1002             :     do {
    1003             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1004           0 :       JS::Rooted<JS::Value> temp(cx);
    1005           0 :       nsString const & currentValue = mGateway.InternalValue();
    1006           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1007           0 :         return false;
    1008             :       }
    1009           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->gateway_id, temp, JSPROP_ENUMERATE)) {
    1010           0 :         return false;
    1011             :       }
    1012           0 :       break;
    1013             :     } while(0);
    1014             :   }
    1015             : 
    1016           0 :   if (mGateway_long.WasPassed()) {
    1017             :     do {
    1018             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1019           0 :       JS::Rooted<JS::Value> temp(cx);
    1020           0 :       int32_t const & currentValue = mGateway_long.InternalValue();
    1021           0 :       temp.setInt32(int32_t(currentValue));
    1022           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->gateway_long_id, temp, JSPROP_ENUMERATE)) {
    1023           0 :         return false;
    1024             :       }
    1025           0 :       break;
    1026             :     } while(0);
    1027             :   }
    1028             : 
    1029           0 :   if (mGateways.WasPassed()) {
    1030             :     do {
    1031             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1032           0 :       JS::Rooted<JS::Value> temp(cx);
    1033           0 :       Sequence<nsString> const & currentValue = mGateways.InternalValue();
    1034             : 
    1035           0 :       uint32_t length = currentValue.Length();
    1036           0 :       JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
    1037           0 :       if (!returnArray) {
    1038           0 :         return false;
    1039             :       }
    1040             :       // Scope for 'tmp'
    1041             :       {
    1042           0 :         JS::Rooted<JS::Value> tmp(cx);
    1043           0 :         for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
    1044             :           // Control block to let us common up the JS_DefineElement calls when there
    1045             :           // are different ways to succeed at wrapping the object.
    1046             :           do {
    1047           0 :             if (!xpc::NonVoidStringToJsval(cx, currentValue[sequenceIdx0], &tmp)) {
    1048           0 :               return false;
    1049             :             }
    1050           0 :             break;
    1051             :           } while (0);
    1052           0 :           if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
    1053             :                                 JSPROP_ENUMERATE)) {
    1054           0 :             return false;
    1055             :           }
    1056             :         }
    1057             :       }
    1058           0 :       temp.setObject(*returnArray);
    1059           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->gateways_id, temp, JSPROP_ENUMERATE)) {
    1060           0 :         return false;
    1061             :       }
    1062           0 :       break;
    1063             :     } while(0);
    1064             :   }
    1065             : 
    1066             :   do {
    1067             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1068           0 :     JS::Rooted<JS::Value> temp(cx);
    1069           0 :     int32_t const & currentValue = mId;
    1070           0 :     temp.setInt32(int32_t(currentValue));
    1071           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->id_id, temp, JSPROP_ENUMERATE)) {
    1072           0 :       return false;
    1073             :     }
    1074           0 :     break;
    1075             :   } while(0);
    1076             : 
    1077           0 :   if (mIfname.WasPassed()) {
    1078             :     do {
    1079             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1080           0 :       JS::Rooted<JS::Value> temp(cx);
    1081           0 :       nsString const & currentValue = mIfname.InternalValue();
    1082           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1083           0 :         return false;
    1084             :       }
    1085           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->ifname_id, temp, JSPROP_ENUMERATE)) {
    1086           0 :         return false;
    1087             :       }
    1088           0 :       break;
    1089             :     } while(0);
    1090             :   }
    1091             : 
    1092           0 :   if (mInterfaceList.WasPassed()) {
    1093             :     do {
    1094             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1095           0 :       JS::Rooted<JS::Value> temp(cx);
    1096           0 :       Sequence<nsString> const & currentValue = mInterfaceList.InternalValue();
    1097             : 
    1098           0 :       uint32_t length = currentValue.Length();
    1099           0 :       JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
    1100           0 :       if (!returnArray) {
    1101           0 :         return false;
    1102             :       }
    1103             :       // Scope for 'tmp'
    1104             :       {
    1105           0 :         JS::Rooted<JS::Value> tmp(cx);
    1106           0 :         for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
    1107             :           // Control block to let us common up the JS_DefineElement calls when there
    1108             :           // are different ways to succeed at wrapping the object.
    1109             :           do {
    1110           0 :             if (!xpc::NonVoidStringToJsval(cx, currentValue[sequenceIdx0], &tmp)) {
    1111           0 :               return false;
    1112             :             }
    1113           0 :             break;
    1114             :           } while (0);
    1115           0 :           if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
    1116             :                                 JSPROP_ENUMERATE)) {
    1117           0 :             return false;
    1118             :           }
    1119             :         }
    1120             :       }
    1121           0 :       temp.setObject(*returnArray);
    1122           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->interfaceList_id, temp, JSPROP_ENUMERATE)) {
    1123           0 :         return false;
    1124             :       }
    1125           0 :       break;
    1126             :     } while(0);
    1127             :   }
    1128             : 
    1129           0 :   if (mInternalIfname.WasPassed()) {
    1130             :     do {
    1131             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1132           0 :       JS::Rooted<JS::Value> temp(cx);
    1133           0 :       nsString const & currentValue = mInternalIfname.InternalValue();
    1134           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1135           0 :         return false;
    1136             :       }
    1137           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->internalIfname_id, temp, JSPROP_ENUMERATE)) {
    1138           0 :         return false;
    1139             :       }
    1140           0 :       break;
    1141             :     } while(0);
    1142             :   }
    1143             : 
    1144           0 :   if (mIp.WasPassed()) {
    1145             :     do {
    1146             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1147           0 :       JS::Rooted<JS::Value> temp(cx);
    1148           0 :       nsString const & currentValue = mIp.InternalValue();
    1149           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1150           0 :         return false;
    1151             :       }
    1152           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->ip_id, temp, JSPROP_ENUMERATE)) {
    1153           0 :         return false;
    1154             :       }
    1155           0 :       break;
    1156             :     } while(0);
    1157             :   }
    1158             : 
    1159           0 :   if (mIpaddr.WasPassed()) {
    1160             :     do {
    1161             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1162           0 :       JS::Rooted<JS::Value> temp(cx);
    1163           0 :       int32_t const & currentValue = mIpaddr.InternalValue();
    1164           0 :       temp.setInt32(int32_t(currentValue));
    1165           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->ipaddr_id, temp, JSPROP_ENUMERATE)) {
    1166           0 :         return false;
    1167             :       }
    1168           0 :       break;
    1169             :     } while(0);
    1170             :   }
    1171             : 
    1172           0 :   if (mKey.WasPassed()) {
    1173             :     do {
    1174             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1175           0 :       JS::Rooted<JS::Value> temp(cx);
    1176           0 :       nsString const & currentValue = mKey.InternalValue();
    1177           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1178           0 :         return false;
    1179             :       }
    1180           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->key_id, temp, JSPROP_ENUMERATE)) {
    1181           0 :         return false;
    1182             :       }
    1183           0 :       break;
    1184             :     } while(0);
    1185             :   }
    1186             : 
    1187           0 :   if (mLink.WasPassed()) {
    1188             :     do {
    1189             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1190           0 :       JS::Rooted<JS::Value> temp(cx);
    1191           0 :       nsString const & currentValue = mLink.InternalValue();
    1192           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1193           0 :         return false;
    1194             :       }
    1195           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->link_id, temp, JSPROP_ENUMERATE)) {
    1196           0 :         return false;
    1197             :       }
    1198           0 :       break;
    1199             :     } while(0);
    1200             :   }
    1201             : 
    1202           0 :   if (mMask.WasPassed()) {
    1203             :     do {
    1204             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1205           0 :       JS::Rooted<JS::Value> temp(cx);
    1206           0 :       int32_t const & currentValue = mMask.InternalValue();
    1207           0 :       temp.setInt32(int32_t(currentValue));
    1208           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->mask_id, temp, JSPROP_ENUMERATE)) {
    1209           0 :         return false;
    1210             :       }
    1211           0 :       break;
    1212             :     } while(0);
    1213             :   }
    1214             : 
    1215           0 :   if (mMaskLength.WasPassed()) {
    1216             :     do {
    1217             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1218           0 :       JS::Rooted<JS::Value> temp(cx);
    1219           0 :       nsString const & currentValue = mMaskLength.InternalValue();
    1220           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1221           0 :         return false;
    1222             :       }
    1223           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->maskLength_id, temp, JSPROP_ENUMERATE)) {
    1224           0 :         return false;
    1225             :       }
    1226           0 :       break;
    1227             :     } while(0);
    1228             :   }
    1229             : 
    1230           0 :   if (mMode.WasPassed()) {
    1231             :     do {
    1232             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1233           0 :       JS::Rooted<JS::Value> temp(cx);
    1234           0 :       nsString const & currentValue = mMode.InternalValue();
    1235           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1236           0 :         return false;
    1237             :       }
    1238           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->mode_id, temp, JSPROP_ENUMERATE)) {
    1239           0 :         return false;
    1240             :       }
    1241           0 :       break;
    1242             :     } while(0);
    1243             :   }
    1244             : 
    1245           0 :   if (mMtu.WasPassed()) {
    1246             :     do {
    1247             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1248           0 :       JS::Rooted<JS::Value> temp(cx);
    1249           0 :       int32_t const & currentValue = mMtu.InternalValue();
    1250           0 :       temp.setInt32(int32_t(currentValue));
    1251           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->mtu_id, temp, JSPROP_ENUMERATE)) {
    1252           0 :         return false;
    1253             :       }
    1254           0 :       break;
    1255             :     } while(0);
    1256             :   }
    1257             : 
    1258           0 :   if (mPreExternalIfname.WasPassed()) {
    1259             :     do {
    1260             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1261           0 :       JS::Rooted<JS::Value> temp(cx);
    1262           0 :       nsString const & currentValue = mPreExternalIfname.InternalValue();
    1263           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1264           0 :         return false;
    1265             :       }
    1266           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->preExternalIfname_id, temp, JSPROP_ENUMERATE)) {
    1267           0 :         return false;
    1268             :       }
    1269           0 :       break;
    1270             :     } while(0);
    1271             :   }
    1272             : 
    1273           0 :   if (mPreInternalIfname.WasPassed()) {
    1274             :     do {
    1275             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1276           0 :       JS::Rooted<JS::Value> temp(cx);
    1277           0 :       nsString const & currentValue = mPreInternalIfname.InternalValue();
    1278           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1279           0 :         return false;
    1280             :       }
    1281           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->preInternalIfname_id, temp, JSPROP_ENUMERATE)) {
    1282           0 :         return false;
    1283             :       }
    1284           0 :       break;
    1285             :     } while(0);
    1286             :   }
    1287             : 
    1288           0 :   if (mPrefix.WasPassed()) {
    1289             :     do {
    1290             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1291           0 :       JS::Rooted<JS::Value> temp(cx);
    1292           0 :       nsString const & currentValue = mPrefix.InternalValue();
    1293           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1294           0 :         return false;
    1295             :       }
    1296           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->prefix_id, temp, JSPROP_ENUMERATE)) {
    1297           0 :         return false;
    1298             :       }
    1299           0 :       break;
    1300             :     } while(0);
    1301             :   }
    1302             : 
    1303           0 :   if (mPrefixLength.WasPassed()) {
    1304             :     do {
    1305             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1306           0 :       JS::Rooted<JS::Value> temp(cx);
    1307           0 :       uint32_t const & currentValue = mPrefixLength.InternalValue();
    1308           0 :       temp.setNumber(currentValue);
    1309           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->prefixLength_id, temp, JSPROP_ENUMERATE)) {
    1310           0 :         return false;
    1311             :       }
    1312           0 :       break;
    1313             :     } while(0);
    1314             :   }
    1315             : 
    1316           0 :   if (mReport.WasPassed()) {
    1317             :     do {
    1318             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1319           0 :       JS::Rooted<JS::Value> temp(cx);
    1320           0 :       bool const & currentValue = mReport.InternalValue();
    1321           0 :       temp.setBoolean(currentValue);
    1322           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->report_id, temp, JSPROP_ENUMERATE)) {
    1323           0 :         return false;
    1324             :       }
    1325           0 :       break;
    1326             :     } while(0);
    1327             :   }
    1328             : 
    1329           0 :   if (mSecurity.WasPassed()) {
    1330             :     do {
    1331             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1332           0 :       JS::Rooted<JS::Value> temp(cx);
    1333           0 :       nsString const & currentValue = mSecurity.InternalValue();
    1334           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1335           0 :         return false;
    1336             :       }
    1337           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->security_id, temp, JSPROP_ENUMERATE)) {
    1338           0 :         return false;
    1339             :       }
    1340           0 :       break;
    1341             :     } while(0);
    1342             :   }
    1343             : 
    1344           0 :   if (mServerIp.WasPassed()) {
    1345             :     do {
    1346             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1347           0 :       JS::Rooted<JS::Value> temp(cx);
    1348           0 :       nsString const & currentValue = mServerIp.InternalValue();
    1349           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1350           0 :         return false;
    1351             :       }
    1352           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->serverIp_id, temp, JSPROP_ENUMERATE)) {
    1353           0 :         return false;
    1354             :       }
    1355           0 :       break;
    1356             :     } while(0);
    1357             :   }
    1358             : 
    1359           0 :   if (mSsid.WasPassed()) {
    1360             :     do {
    1361             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1362           0 :       JS::Rooted<JS::Value> temp(cx);
    1363           0 :       nsString const & currentValue = mSsid.InternalValue();
    1364           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1365           0 :         return false;
    1366             :       }
    1367           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->ssid_id, temp, JSPROP_ENUMERATE)) {
    1368           0 :         return false;
    1369             :       }
    1370           0 :       break;
    1371             :     } while(0);
    1372             :   }
    1373             : 
    1374           0 :   if (mStartIp.WasPassed()) {
    1375             :     do {
    1376             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1377           0 :       JS::Rooted<JS::Value> temp(cx);
    1378           0 :       nsString const & currentValue = mStartIp.InternalValue();
    1379           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1380           0 :         return false;
    1381             :       }
    1382           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->startIp_id, temp, JSPROP_ENUMERATE)) {
    1383           0 :         return false;
    1384             :       }
    1385           0 :       break;
    1386             :     } while(0);
    1387             :   }
    1388             : 
    1389           0 :   if (mThreshold.WasPassed()) {
    1390             :     do {
    1391             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1392           0 :       JS::Rooted<JS::Value> temp(cx);
    1393           0 :       int64_t const & currentValue = mThreshold.InternalValue();
    1394           0 :       temp.set(JS_NumberValue(double(currentValue)));
    1395           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->threshold_id, temp, JSPROP_ENUMERATE)) {
    1396           0 :         return false;
    1397             :       }
    1398           0 :       break;
    1399             :     } while(0);
    1400             :   }
    1401             : 
    1402           0 :   if (mUsbEndIp.WasPassed()) {
    1403             :     do {
    1404             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1405           0 :       JS::Rooted<JS::Value> temp(cx);
    1406           0 :       nsString const & currentValue = mUsbEndIp.InternalValue();
    1407           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1408           0 :         return false;
    1409             :       }
    1410           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->usbEndIp_id, temp, JSPROP_ENUMERATE)) {
    1411           0 :         return false;
    1412             :       }
    1413           0 :       break;
    1414             :     } while(0);
    1415             :   }
    1416             : 
    1417           0 :   if (mUsbStartIp.WasPassed()) {
    1418             :     do {
    1419             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1420           0 :       JS::Rooted<JS::Value> temp(cx);
    1421           0 :       nsString const & currentValue = mUsbStartIp.InternalValue();
    1422           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1423           0 :         return false;
    1424             :       }
    1425           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->usbStartIp_id, temp, JSPROP_ENUMERATE)) {
    1426           0 :         return false;
    1427             :       }
    1428           0 :       break;
    1429             :     } while(0);
    1430             :   }
    1431             : 
    1432           0 :   if (mWifiEndIp.WasPassed()) {
    1433             :     do {
    1434             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1435           0 :       JS::Rooted<JS::Value> temp(cx);
    1436           0 :       nsString const & currentValue = mWifiEndIp.InternalValue();
    1437           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1438           0 :         return false;
    1439             :       }
    1440           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->wifiEndIp_id, temp, JSPROP_ENUMERATE)) {
    1441           0 :         return false;
    1442             :       }
    1443           0 :       break;
    1444             :     } while(0);
    1445             :   }
    1446             : 
    1447           0 :   if (mWifiStartIp.WasPassed()) {
    1448             :     do {
    1449             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1450           0 :       JS::Rooted<JS::Value> temp(cx);
    1451           0 :       nsString const & currentValue = mWifiStartIp.InternalValue();
    1452           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1453           0 :         return false;
    1454             :       }
    1455           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->wifiStartIp_id, temp, JSPROP_ENUMERATE)) {
    1456           0 :         return false;
    1457             :       }
    1458           0 :       break;
    1459             :     } while(0);
    1460             :   }
    1461             : 
    1462           0 :   if (mWifictrlinterfacename.WasPassed()) {
    1463             :     do {
    1464             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    1465           0 :       JS::Rooted<JS::Value> temp(cx);
    1466           0 :       nsString const & currentValue = mWifictrlinterfacename.InternalValue();
    1467           0 :       if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    1468           0 :         return false;
    1469             :       }
    1470           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->wifictrlinterfacename_id, temp, JSPROP_ENUMERATE)) {
    1471           0 :         return false;
    1472             :       }
    1473           0 :       break;
    1474             :     } while(0);
    1475             :   }
    1476             : 
    1477           0 :   return true;
    1478             : }
    1479             : 
    1480             : bool
    1481           0 : NetworkCommandOptions::ToJSON(nsAString& aJSON) const
    1482             : {
    1483           0 :   AutoJSAPI jsapi;
    1484           0 :   jsapi.Init();
    1485           0 :   JSContext *cx = jsapi.cx();
    1486             :   // It's safe to use UnprivilegedJunkScopeOrWorkerGlobal here
    1487             :   // because we'll only be creating objects, in ways that have no
    1488             :   // side-effects, followed by a call to JS::ToJSONMaybeSafely,
    1489             :   // which likewise guarantees no side-effects for the sorts of
    1490             :   // things we will pass it.
    1491           0 :   JSAutoCompartment ac(cx, binding_detail::UnprivilegedJunkScopeOrWorkerGlobal());
    1492           0 :   JS::Rooted<JS::Value> val(cx);
    1493           0 :   if (!ToObjectInternal(cx, &val)) {
    1494           0 :     return false;
    1495             :   }
    1496           0 :   JS::Rooted<JSObject*> obj(cx, &val.toObject());
    1497           0 :   return StringifyToJSON(cx, obj, aJSON);
    1498             : }
    1499             : 
    1500             : void
    1501           0 : NetworkCommandOptions::TraceDictionary(JSTracer* trc)
    1502             : {
    1503           0 : }
    1504             : 
    1505             : NetworkCommandOptions&
    1506           0 : NetworkCommandOptions::operator=(const NetworkCommandOptions& aOther)
    1507             : {
    1508           0 :   mCmd = aOther.mCmd;
    1509           0 :   mCurExternalIfname.Reset();
    1510           0 :   if (aOther.mCurExternalIfname.WasPassed()) {
    1511           0 :     mCurExternalIfname.Construct(aOther.mCurExternalIfname.Value());
    1512             :   }
    1513           0 :   mCurInternalIfname.Reset();
    1514           0 :   if (aOther.mCurInternalIfname.WasPassed()) {
    1515           0 :     mCurInternalIfname.Construct(aOther.mCurInternalIfname.Value());
    1516             :   }
    1517           0 :   mDns1.Reset();
    1518           0 :   if (aOther.mDns1.WasPassed()) {
    1519           0 :     mDns1.Construct(aOther.mDns1.Value());
    1520             :   }
    1521           0 :   mDns1_long.Reset();
    1522           0 :   if (aOther.mDns1_long.WasPassed()) {
    1523           0 :     mDns1_long.Construct(aOther.mDns1_long.Value());
    1524             :   }
    1525           0 :   mDns2.Reset();
    1526           0 :   if (aOther.mDns2.WasPassed()) {
    1527           0 :     mDns2.Construct(aOther.mDns2.Value());
    1528             :   }
    1529           0 :   mDns2_long.Reset();
    1530           0 :   if (aOther.mDns2_long.WasPassed()) {
    1531           0 :     mDns2_long.Construct(aOther.mDns2_long.Value());
    1532             :   }
    1533           0 :   mDnses.Reset();
    1534           0 :   if (aOther.mDnses.WasPassed()) {
    1535           0 :     mDnses.Construct(aOther.mDnses.Value());
    1536             :   }
    1537           0 :   mDomain.Reset();
    1538           0 :   if (aOther.mDomain.WasPassed()) {
    1539           0 :     mDomain.Construct(aOther.mDomain.Value());
    1540             :   }
    1541           0 :   mEnable.Reset();
    1542           0 :   if (aOther.mEnable.WasPassed()) {
    1543           0 :     mEnable.Construct(aOther.mEnable.Value());
    1544             :   }
    1545           0 :   mEnabled.Reset();
    1546           0 :   if (aOther.mEnabled.WasPassed()) {
    1547           0 :     mEnabled.Construct(aOther.mEnabled.Value());
    1548             :   }
    1549           0 :   mEndIp.Reset();
    1550           0 :   if (aOther.mEndIp.WasPassed()) {
    1551           0 :     mEndIp.Construct(aOther.mEndIp.Value());
    1552             :   }
    1553           0 :   mExternalIfname.Reset();
    1554           0 :   if (aOther.mExternalIfname.WasPassed()) {
    1555           0 :     mExternalIfname.Construct(aOther.mExternalIfname.Value());
    1556             :   }
    1557           0 :   mGateway.Reset();
    1558           0 :   if (aOther.mGateway.WasPassed()) {
    1559           0 :     mGateway.Construct(aOther.mGateway.Value());
    1560             :   }
    1561           0 :   mGateway_long.Reset();
    1562           0 :   if (aOther.mGateway_long.WasPassed()) {
    1563           0 :     mGateway_long.Construct(aOther.mGateway_long.Value());
    1564             :   }
    1565           0 :   mGateways.Reset();
    1566           0 :   if (aOther.mGateways.WasPassed()) {
    1567           0 :     mGateways.Construct(aOther.mGateways.Value());
    1568             :   }
    1569           0 :   mId = aOther.mId;
    1570           0 :   mIfname.Reset();
    1571           0 :   if (aOther.mIfname.WasPassed()) {
    1572           0 :     mIfname.Construct(aOther.mIfname.Value());
    1573             :   }
    1574           0 :   mInterfaceList.Reset();
    1575           0 :   if (aOther.mInterfaceList.WasPassed()) {
    1576           0 :     mInterfaceList.Construct(aOther.mInterfaceList.Value());
    1577             :   }
    1578           0 :   mInternalIfname.Reset();
    1579           0 :   if (aOther.mInternalIfname.WasPassed()) {
    1580           0 :     mInternalIfname.Construct(aOther.mInternalIfname.Value());
    1581             :   }
    1582           0 :   mIp.Reset();
    1583           0 :   if (aOther.mIp.WasPassed()) {
    1584           0 :     mIp.Construct(aOther.mIp.Value());
    1585             :   }
    1586           0 :   mIpaddr.Reset();
    1587           0 :   if (aOther.mIpaddr.WasPassed()) {
    1588           0 :     mIpaddr.Construct(aOther.mIpaddr.Value());
    1589             :   }
    1590           0 :   mKey.Reset();
    1591           0 :   if (aOther.mKey.WasPassed()) {
    1592           0 :     mKey.Construct(aOther.mKey.Value());
    1593             :   }
    1594           0 :   mLink.Reset();
    1595           0 :   if (aOther.mLink.WasPassed()) {
    1596           0 :     mLink.Construct(aOther.mLink.Value());
    1597             :   }
    1598           0 :   mMask.Reset();
    1599           0 :   if (aOther.mMask.WasPassed()) {
    1600           0 :     mMask.Construct(aOther.mMask.Value());
    1601             :   }
    1602           0 :   mMaskLength.Reset();
    1603           0 :   if (aOther.mMaskLength.WasPassed()) {
    1604           0 :     mMaskLength.Construct(aOther.mMaskLength.Value());
    1605             :   }
    1606           0 :   mMode.Reset();
    1607           0 :   if (aOther.mMode.WasPassed()) {
    1608           0 :     mMode.Construct(aOther.mMode.Value());
    1609             :   }
    1610           0 :   mMtu.Reset();
    1611           0 :   if (aOther.mMtu.WasPassed()) {
    1612           0 :     mMtu.Construct(aOther.mMtu.Value());
    1613             :   }
    1614           0 :   mPreExternalIfname.Reset();
    1615           0 :   if (aOther.mPreExternalIfname.WasPassed()) {
    1616           0 :     mPreExternalIfname.Construct(aOther.mPreExternalIfname.Value());
    1617             :   }
    1618           0 :   mPreInternalIfname.Reset();
    1619           0 :   if (aOther.mPreInternalIfname.WasPassed()) {
    1620           0 :     mPreInternalIfname.Construct(aOther.mPreInternalIfname.Value());
    1621             :   }
    1622           0 :   mPrefix.Reset();
    1623           0 :   if (aOther.mPrefix.WasPassed()) {
    1624           0 :     mPrefix.Construct(aOther.mPrefix.Value());
    1625             :   }
    1626           0 :   mPrefixLength.Reset();
    1627           0 :   if (aOther.mPrefixLength.WasPassed()) {
    1628           0 :     mPrefixLength.Construct(aOther.mPrefixLength.Value());
    1629             :   }
    1630           0 :   mReport.Reset();
    1631           0 :   if (aOther.mReport.WasPassed()) {
    1632           0 :     mReport.Construct(aOther.mReport.Value());
    1633             :   }
    1634           0 :   mSecurity.Reset();
    1635           0 :   if (aOther.mSecurity.WasPassed()) {
    1636           0 :     mSecurity.Construct(aOther.mSecurity.Value());
    1637             :   }
    1638           0 :   mServerIp.Reset();
    1639           0 :   if (aOther.mServerIp.WasPassed()) {
    1640           0 :     mServerIp.Construct(aOther.mServerIp.Value());
    1641             :   }
    1642           0 :   mSsid.Reset();
    1643           0 :   if (aOther.mSsid.WasPassed()) {
    1644           0 :     mSsid.Construct(aOther.mSsid.Value());
    1645             :   }
    1646           0 :   mStartIp.Reset();
    1647           0 :   if (aOther.mStartIp.WasPassed()) {
    1648           0 :     mStartIp.Construct(aOther.mStartIp.Value());
    1649             :   }
    1650           0 :   mThreshold.Reset();
    1651           0 :   if (aOther.mThreshold.WasPassed()) {
    1652           0 :     mThreshold.Construct(aOther.mThreshold.Value());
    1653             :   }
    1654           0 :   mUsbEndIp.Reset();
    1655           0 :   if (aOther.mUsbEndIp.WasPassed()) {
    1656           0 :     mUsbEndIp.Construct(aOther.mUsbEndIp.Value());
    1657             :   }
    1658           0 :   mUsbStartIp.Reset();
    1659           0 :   if (aOther.mUsbStartIp.WasPassed()) {
    1660           0 :     mUsbStartIp.Construct(aOther.mUsbStartIp.Value());
    1661             :   }
    1662           0 :   mWifiEndIp.Reset();
    1663           0 :   if (aOther.mWifiEndIp.WasPassed()) {
    1664           0 :     mWifiEndIp.Construct(aOther.mWifiEndIp.Value());
    1665             :   }
    1666           0 :   mWifiStartIp.Reset();
    1667           0 :   if (aOther.mWifiStartIp.WasPassed()) {
    1668           0 :     mWifiStartIp.Construct(aOther.mWifiStartIp.Value());
    1669             :   }
    1670           0 :   mWifictrlinterfacename.Reset();
    1671           0 :   if (aOther.mWifictrlinterfacename.WasPassed()) {
    1672           0 :     mWifictrlinterfacename.Construct(aOther.mWifictrlinterfacename.Value());
    1673             :   }
    1674           0 :   return *this;
    1675             : }
    1676             : 
    1677             : namespace binding_detail {
    1678             : } // namespace binding_detail
    1679             : 
    1680             : 
    1681             : 
    1682           0 : NetworkResultOptions::NetworkResultOptions()
    1683             : {
    1684             :   // Safe to pass a null context if we pass a null value
    1685           0 :   Init(nullptr, JS::NullHandleValue);
    1686           0 : }
    1687             : 
    1688             : 
    1689             : 
    1690             : bool
    1691           0 : NetworkResultOptions::InitIds(JSContext* cx, NetworkResultOptionsAtoms* atomsCache)
    1692             : {
    1693           0 :   MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
    1694             : 
    1695             :   // Initialize these in reverse order so that any failure leaves the first one
    1696             :   // uninitialized.
    1697           0 :   if (!atomsCache->vendor_str_id.init(cx, "vendor_str") ||
    1698           0 :       !atomsCache->topic_id.init(cx, "topic") ||
    1699           0 :       !atomsCache->success_id.init(cx, "success") ||
    1700           0 :       !atomsCache->server_str_id.init(cx, "server_str") ||
    1701           0 :       !atomsCache->server_id.init(cx, "server") ||
    1702           0 :       !atomsCache->route_id.init(cx, "route") ||
    1703           0 :       !atomsCache->ret_id.init(cx, "ret") ||
    1704           0 :       !atomsCache->resultReason_id.init(cx, "resultReason") ||
    1705           0 :       !atomsCache->resultCode_id.init(cx, "resultCode") ||
    1706           0 :       !atomsCache->result_id.init(cx, "result") ||
    1707           0 :       !atomsCache->reply_id.init(cx, "reply") ||
    1708           0 :       !atomsCache->reason_id.init(cx, "reason") ||
    1709           0 :       !atomsCache->prefixLength_id.init(cx, "prefixLength") ||
    1710           0 :       !atomsCache->netId_id.init(cx, "netId") ||
    1711           0 :       !atomsCache->mask_str_id.init(cx, "mask_str") ||
    1712           0 :       !atomsCache->mask_id.init(cx, "mask") ||
    1713           0 :       !atomsCache->macAddr_id.init(cx, "macAddr") ||
    1714           0 :       !atomsCache->lease_id.init(cx, "lease") ||
    1715           0 :       !atomsCache->ipaddr_str_id.init(cx, "ipaddr_str") ||
    1716           0 :       !atomsCache->ipaddr_id.init(cx, "ipaddr") ||
    1717           0 :       !atomsCache->ipAddr_id.init(cx, "ipAddr") ||
    1718           0 :       !atomsCache->interfaceList_id.init(cx, "interfaceList") ||
    1719           0 :       !atomsCache->id_id.init(cx, "id") ||
    1720           0 :       !atomsCache->gateway_str_id.init(cx, "gateway_str") ||
    1721           0 :       !atomsCache->gateway_id.init(cx, "gateway") ||
    1722           0 :       !atomsCache->flag_id.init(cx, "flag") ||
    1723           0 :       !atomsCache->error_id.init(cx, "error") ||
    1724           0 :       !atomsCache->enable_id.init(cx, "enable") ||
    1725           0 :       !atomsCache->dns2_str_id.init(cx, "dns2_str") ||
    1726           0 :       !atomsCache->dns2_id.init(cx, "dns2") ||
    1727           0 :       !atomsCache->dns1_str_id.init(cx, "dns1_str") ||
    1728           0 :       !atomsCache->dns1_id.init(cx, "dns1") ||
    1729           0 :       !atomsCache->curInternalIfname_id.init(cx, "curInternalIfname") ||
    1730           0 :       !atomsCache->curExternalIfname_id.init(cx, "curExternalIfname") ||
    1731           0 :       !atomsCache->broadcast_id.init(cx, "broadcast")) {
    1732           0 :     return false;
    1733             :   }
    1734           0 :   return true;
    1735             : }
    1736             : 
    1737             : bool
    1738           0 : NetworkResultOptions::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
    1739             : {
    1740             :   // Passing a null JSContext is OK only if we're initing from null,
    1741             :   // Since in that case we will not have to do any property gets
    1742             :   // Also evaluate isNullOrUndefined in order to avoid false-positive
    1743             :   // checkers by static analysis tools
    1744           0 :   MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
    1745           0 :   NetworkResultOptionsAtoms* atomsCache = nullptr;
    1746           0 :   if (cx) {
    1747           0 :     atomsCache = GetAtomCache<NetworkResultOptionsAtoms>(cx);
    1748           0 :     if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
    1749           0 :       return false;
    1750             :     }
    1751             :   }
    1752             : 
    1753           0 :   if (!IsConvertibleToDictionary(val)) {
    1754           0 :     return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription);
    1755             :   }
    1756             : 
    1757           0 :   bool isNull = val.isNullOrUndefined();
    1758             :   // We only need these if !isNull, in which case we have |cx|.
    1759           0 :   Maybe<JS::Rooted<JSObject *> > object;
    1760           0 :   Maybe<JS::Rooted<JS::Value> > temp;
    1761           0 :   if (!isNull) {
    1762           0 :     MOZ_ASSERT(cx);
    1763           0 :     object.emplace(cx, &val.toObject());
    1764           0 :     temp.emplace(cx);
    1765             :   }
    1766           0 :   if (!isNull) {
    1767           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->broadcast_id, temp.ptr())) {
    1768           0 :       return false;
    1769             :     }
    1770             :   }
    1771           0 :   if (!isNull && !temp->isUndefined()) {
    1772           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mBroadcast)) {
    1773           0 :       return false;
    1774             :     }
    1775             :   } else {
    1776           0 :     mBroadcast = false;
    1777             :   }
    1778           0 :   mIsAnyMemberPresent = true;
    1779             : 
    1780           0 :   if (!isNull) {
    1781           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->curExternalIfname_id, temp.ptr())) {
    1782           0 :       return false;
    1783             :     }
    1784             :   }
    1785           0 :   if (!isNull && !temp->isUndefined()) {
    1786           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mCurExternalIfname)) {
    1787           0 :       return false;
    1788             :     }
    1789             :   } else {
    1790             :     static const char16_t data[] = { 0 };
    1791           0 :     mCurExternalIfname.Rebind(data, ArrayLength(data) - 1);
    1792             :   }
    1793           0 :   mIsAnyMemberPresent = true;
    1794             : 
    1795           0 :   if (!isNull) {
    1796           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->curInternalIfname_id, temp.ptr())) {
    1797           0 :       return false;
    1798             :     }
    1799             :   }
    1800           0 :   if (!isNull && !temp->isUndefined()) {
    1801           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mCurInternalIfname)) {
    1802           0 :       return false;
    1803             :     }
    1804             :   } else {
    1805             :     static const char16_t data[] = { 0 };
    1806           0 :     mCurInternalIfname.Rebind(data, ArrayLength(data) - 1);
    1807             :   }
    1808           0 :   mIsAnyMemberPresent = true;
    1809             : 
    1810           0 :   if (!isNull) {
    1811           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->dns1_id, temp.ptr())) {
    1812           0 :       return false;
    1813             :     }
    1814             :   }
    1815           0 :   if (!isNull && !temp->isUndefined()) {
    1816           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &mDns1)) {
    1817           0 :       return false;
    1818             :     }
    1819             :   } else {
    1820           0 :     mDns1 = 0;
    1821             :   }
    1822           0 :   mIsAnyMemberPresent = true;
    1823             : 
    1824           0 :   if (!isNull) {
    1825           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->dns1_str_id, temp.ptr())) {
    1826           0 :       return false;
    1827             :     }
    1828             :   }
    1829           0 :   if (!isNull && !temp->isUndefined()) {
    1830           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mDns1_str)) {
    1831           0 :       return false;
    1832             :     }
    1833             :   } else {
    1834             :     static const char16_t data[] = { 0 };
    1835           0 :     mDns1_str.Rebind(data, ArrayLength(data) - 1);
    1836             :   }
    1837           0 :   mIsAnyMemberPresent = true;
    1838             : 
    1839           0 :   if (!isNull) {
    1840           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->dns2_id, temp.ptr())) {
    1841           0 :       return false;
    1842             :     }
    1843             :   }
    1844           0 :   if (!isNull && !temp->isUndefined()) {
    1845           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &mDns2)) {
    1846           0 :       return false;
    1847             :     }
    1848             :   } else {
    1849           0 :     mDns2 = 0;
    1850             :   }
    1851           0 :   mIsAnyMemberPresent = true;
    1852             : 
    1853           0 :   if (!isNull) {
    1854           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->dns2_str_id, temp.ptr())) {
    1855           0 :       return false;
    1856             :     }
    1857             :   }
    1858           0 :   if (!isNull && !temp->isUndefined()) {
    1859           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mDns2_str)) {
    1860           0 :       return false;
    1861             :     }
    1862             :   } else {
    1863             :     static const char16_t data[] = { 0 };
    1864           0 :     mDns2_str.Rebind(data, ArrayLength(data) - 1);
    1865             :   }
    1866           0 :   mIsAnyMemberPresent = true;
    1867             : 
    1868           0 :   if (!isNull) {
    1869           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->enable_id, temp.ptr())) {
    1870           0 :       return false;
    1871             :     }
    1872             :   }
    1873           0 :   if (!isNull && !temp->isUndefined()) {
    1874           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mEnable)) {
    1875           0 :       return false;
    1876             :     }
    1877             :   } else {
    1878           0 :     mEnable = false;
    1879             :   }
    1880           0 :   mIsAnyMemberPresent = true;
    1881             : 
    1882           0 :   if (!isNull) {
    1883           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->error_id, temp.ptr())) {
    1884           0 :       return false;
    1885             :     }
    1886             :   }
    1887           0 :   if (!isNull && !temp->isUndefined()) {
    1888           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mError)) {
    1889           0 :       return false;
    1890             :     }
    1891             :   } else {
    1892           0 :     mError = false;
    1893             :   }
    1894           0 :   mIsAnyMemberPresent = true;
    1895             : 
    1896           0 :   if (!isNull) {
    1897           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->flag_id, temp.ptr())) {
    1898           0 :       return false;
    1899             :     }
    1900             :   }
    1901           0 :   if (!isNull && !temp->isUndefined()) {
    1902           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mFlag)) {
    1903           0 :       return false;
    1904             :     }
    1905             :   } else {
    1906             :     static const char16_t data[] = { 'd', 'o', 'w', 'n', 0 };
    1907           0 :     mFlag.Rebind(data, ArrayLength(data) - 1);
    1908             :   }
    1909           0 :   mIsAnyMemberPresent = true;
    1910             : 
    1911           0 :   if (!isNull) {
    1912           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->gateway_id, temp.ptr())) {
    1913           0 :       return false;
    1914             :     }
    1915             :   }
    1916           0 :   if (!isNull && !temp->isUndefined()) {
    1917           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &mGateway)) {
    1918           0 :       return false;
    1919             :     }
    1920             :   } else {
    1921           0 :     mGateway = 0;
    1922             :   }
    1923           0 :   mIsAnyMemberPresent = true;
    1924             : 
    1925           0 :   if (!isNull) {
    1926           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->gateway_str_id, temp.ptr())) {
    1927           0 :       return false;
    1928             :     }
    1929             :   }
    1930           0 :   if (!isNull && !temp->isUndefined()) {
    1931           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mGateway_str)) {
    1932           0 :       return false;
    1933             :     }
    1934             :   } else {
    1935             :     static const char16_t data[] = { 0 };
    1936           0 :     mGateway_str.Rebind(data, ArrayLength(data) - 1);
    1937             :   }
    1938           0 :   mIsAnyMemberPresent = true;
    1939             : 
    1940           0 :   if (!isNull) {
    1941           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->id_id, temp.ptr())) {
    1942           0 :       return false;
    1943             :     }
    1944             :   }
    1945           0 :   if (!isNull && !temp->isUndefined()) {
    1946           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &mId)) {
    1947           0 :       return false;
    1948             :     }
    1949             :   } else {
    1950           0 :     mId = 0;
    1951             :   }
    1952           0 :   mIsAnyMemberPresent = true;
    1953             : 
    1954           0 :   if (!isNull) {
    1955           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->interfaceList_id, temp.ptr())) {
    1956           0 :       return false;
    1957             :     }
    1958             :   }
    1959           0 :   if (!isNull && !temp->isUndefined()) {
    1960           0 :     mInterfaceList.Construct();
    1961           0 :     if (temp.ref().isObject()) {
    1962           0 :       JS::ForOfIterator iter(cx);
    1963           0 :       if (!iter.init(temp.ref(), JS::ForOfIterator::AllowNonIterable)) {
    1964           0 :         return false;
    1965             :       }
    1966           0 :       if (!iter.valueIsIterable()) {
    1967           0 :         ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'interfaceList' member of NetworkResultOptions");
    1968           0 :         return false;
    1969             :       }
    1970           0 :       Sequence<nsString> &arr = (mInterfaceList.Value());
    1971           0 :       JS::Rooted<JS::Value> temp(cx);
    1972             :       while (true) {
    1973             :         bool done;
    1974           0 :         if (!iter.next(&temp, &done)) {
    1975           0 :           return false;
    1976             :         }
    1977           0 :         if (done) {
    1978           0 :           break;
    1979             :         }
    1980           0 :         nsString* slotPtr = arr.AppendElement(mozilla::fallible);
    1981           0 :         if (!slotPtr) {
    1982           0 :           JS_ReportOutOfMemory(cx);
    1983           0 :           return false;
    1984             :         }
    1985           0 :         nsString& slot = *slotPtr;
    1986           0 :         if (!ConvertJSValueToString(cx, temp, eStringify, eStringify, slot)) {
    1987           0 :           return false;
    1988             :         }
    1989           0 :       }
    1990             :     } else {
    1991           0 :       ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "'interfaceList' member of NetworkResultOptions");
    1992           0 :       return false;
    1993             :     }
    1994           0 :     mIsAnyMemberPresent = true;
    1995             :   }
    1996             : 
    1997           0 :   if (!isNull) {
    1998           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->ipAddr_id, temp.ptr())) {
    1999           0 :       return false;
    2000             :     }
    2001             :   }
    2002           0 :   if (!isNull && !temp->isUndefined()) {
    2003           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mIpAddr)) {
    2004           0 :       return false;
    2005             :     }
    2006             :   } else {
    2007             :     static const char16_t data[] = { 0 };
    2008           0 :     mIpAddr.Rebind(data, ArrayLength(data) - 1);
    2009             :   }
    2010           0 :   mIsAnyMemberPresent = true;
    2011             : 
    2012           0 :   if (!isNull) {
    2013           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->ipaddr_id, temp.ptr())) {
    2014           0 :       return false;
    2015             :     }
    2016             :   }
    2017           0 :   if (!isNull && !temp->isUndefined()) {
    2018           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &mIpaddr)) {
    2019           0 :       return false;
    2020             :     }
    2021             :   } else {
    2022           0 :     mIpaddr = 0;
    2023             :   }
    2024           0 :   mIsAnyMemberPresent = true;
    2025             : 
    2026           0 :   if (!isNull) {
    2027           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->ipaddr_str_id, temp.ptr())) {
    2028           0 :       return false;
    2029             :     }
    2030             :   }
    2031           0 :   if (!isNull && !temp->isUndefined()) {
    2032           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mIpaddr_str)) {
    2033           0 :       return false;
    2034             :     }
    2035             :   } else {
    2036             :     static const char16_t data[] = { 0 };
    2037           0 :     mIpaddr_str.Rebind(data, ArrayLength(data) - 1);
    2038             :   }
    2039           0 :   mIsAnyMemberPresent = true;
    2040             : 
    2041           0 :   if (!isNull) {
    2042           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->lease_id, temp.ptr())) {
    2043           0 :       return false;
    2044             :     }
    2045             :   }
    2046           0 :   if (!isNull && !temp->isUndefined()) {
    2047           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &mLease)) {
    2048           0 :       return false;
    2049             :     }
    2050             :   } else {
    2051           0 :     mLease = 0;
    2052             :   }
    2053           0 :   mIsAnyMemberPresent = true;
    2054             : 
    2055           0 :   if (!isNull) {
    2056           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->macAddr_id, temp.ptr())) {
    2057           0 :       return false;
    2058             :     }
    2059             :   }
    2060           0 :   if (!isNull && !temp->isUndefined()) {
    2061           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mMacAddr)) {
    2062           0 :       return false;
    2063             :     }
    2064             :   } else {
    2065             :     static const char16_t data[] = { 0 };
    2066           0 :     mMacAddr.Rebind(data, ArrayLength(data) - 1);
    2067             :   }
    2068           0 :   mIsAnyMemberPresent = true;
    2069             : 
    2070           0 :   if (!isNull) {
    2071           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->mask_id, temp.ptr())) {
    2072           0 :       return false;
    2073             :     }
    2074             :   }
    2075           0 :   if (!isNull && !temp->isUndefined()) {
    2076           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &mMask)) {
    2077           0 :       return false;
    2078             :     }
    2079             :   } else {
    2080           0 :     mMask = 0;
    2081             :   }
    2082           0 :   mIsAnyMemberPresent = true;
    2083             : 
    2084           0 :   if (!isNull) {
    2085           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->mask_str_id, temp.ptr())) {
    2086           0 :       return false;
    2087             :     }
    2088             :   }
    2089           0 :   if (!isNull && !temp->isUndefined()) {
    2090           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mMask_str)) {
    2091           0 :       return false;
    2092             :     }
    2093             :   } else {
    2094             :     static const char16_t data[] = { 0 };
    2095           0 :     mMask_str.Rebind(data, ArrayLength(data) - 1);
    2096             :   }
    2097           0 :   mIsAnyMemberPresent = true;
    2098             : 
    2099           0 :   if (!isNull) {
    2100           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->netId_id, temp.ptr())) {
    2101           0 :       return false;
    2102             :     }
    2103             :   }
    2104           0 :   if (!isNull && !temp->isUndefined()) {
    2105           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mNetId)) {
    2106           0 :       return false;
    2107             :     }
    2108             :   } else {
    2109             :     static const char16_t data[] = { 0 };
    2110           0 :     mNetId.Rebind(data, ArrayLength(data) - 1);
    2111             :   }
    2112           0 :   mIsAnyMemberPresent = true;
    2113             : 
    2114           0 :   if (!isNull) {
    2115           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->prefixLength_id, temp.ptr())) {
    2116           0 :       return false;
    2117             :     }
    2118             :   }
    2119           0 :   if (!isNull && !temp->isUndefined()) {
    2120           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &mPrefixLength)) {
    2121           0 :       return false;
    2122             :     }
    2123             :   } else {
    2124           0 :     mPrefixLength = 0;
    2125             :   }
    2126           0 :   mIsAnyMemberPresent = true;
    2127             : 
    2128           0 :   if (!isNull) {
    2129           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->reason_id, temp.ptr())) {
    2130           0 :       return false;
    2131             :     }
    2132             :   }
    2133           0 :   if (!isNull && !temp->isUndefined()) {
    2134           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mReason)) {
    2135           0 :       return false;
    2136             :     }
    2137             :   } else {
    2138             :     static const char16_t data[] = { 0 };
    2139           0 :     mReason.Rebind(data, ArrayLength(data) - 1);
    2140             :   }
    2141           0 :   mIsAnyMemberPresent = true;
    2142             : 
    2143           0 :   if (!isNull) {
    2144           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->reply_id, temp.ptr())) {
    2145           0 :       return false;
    2146             :     }
    2147             :   }
    2148           0 :   if (!isNull && !temp->isUndefined()) {
    2149           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mReply)) {
    2150           0 :       return false;
    2151             :     }
    2152             :   } else {
    2153             :     static const char16_t data[] = { 0 };
    2154           0 :     mReply.Rebind(data, ArrayLength(data) - 1);
    2155             :   }
    2156           0 :   mIsAnyMemberPresent = true;
    2157             : 
    2158           0 :   if (!isNull) {
    2159           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->result_id, temp.ptr())) {
    2160           0 :       return false;
    2161             :     }
    2162             :   }
    2163           0 :   if (!isNull && !temp->isUndefined()) {
    2164           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mResult)) {
    2165           0 :       return false;
    2166             :     }
    2167             :   } else {
    2168           0 :     mResult = false;
    2169             :   }
    2170           0 :   mIsAnyMemberPresent = true;
    2171             : 
    2172           0 :   if (!isNull) {
    2173           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->resultCode_id, temp.ptr())) {
    2174           0 :       return false;
    2175             :     }
    2176             :   }
    2177           0 :   if (!isNull && !temp->isUndefined()) {
    2178           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &mResultCode)) {
    2179           0 :       return false;
    2180             :     }
    2181             :   } else {
    2182           0 :     mResultCode = 0;
    2183             :   }
    2184           0 :   mIsAnyMemberPresent = true;
    2185             : 
    2186           0 :   if (!isNull) {
    2187           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->resultReason_id, temp.ptr())) {
    2188           0 :       return false;
    2189             :     }
    2190             :   }
    2191           0 :   if (!isNull && !temp->isUndefined()) {
    2192           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mResultReason)) {
    2193           0 :       return false;
    2194             :     }
    2195             :   } else {
    2196             :     static const char16_t data[] = { 0 };
    2197           0 :     mResultReason.Rebind(data, ArrayLength(data) - 1);
    2198             :   }
    2199           0 :   mIsAnyMemberPresent = true;
    2200             : 
    2201           0 :   if (!isNull) {
    2202           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->ret_id, temp.ptr())) {
    2203           0 :       return false;
    2204             :     }
    2205             :   }
    2206           0 :   if (!isNull && !temp->isUndefined()) {
    2207           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mRet)) {
    2208           0 :       return false;
    2209             :     }
    2210             :   } else {
    2211           0 :     mRet = false;
    2212             :   }
    2213           0 :   mIsAnyMemberPresent = true;
    2214             : 
    2215           0 :   if (!isNull) {
    2216           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->route_id, temp.ptr())) {
    2217           0 :       return false;
    2218             :     }
    2219             :   }
    2220           0 :   if (!isNull && !temp->isUndefined()) {
    2221           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mRoute)) {
    2222           0 :       return false;
    2223             :     }
    2224             :   } else {
    2225             :     static const char16_t data[] = { 0 };
    2226           0 :     mRoute.Rebind(data, ArrayLength(data) - 1);
    2227             :   }
    2228           0 :   mIsAnyMemberPresent = true;
    2229             : 
    2230           0 :   if (!isNull) {
    2231           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->server_id, temp.ptr())) {
    2232           0 :       return false;
    2233             :     }
    2234             :   }
    2235           0 :   if (!isNull && !temp->isUndefined()) {
    2236           0 :     if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &mServer)) {
    2237           0 :       return false;
    2238             :     }
    2239             :   } else {
    2240           0 :     mServer = 0;
    2241             :   }
    2242           0 :   mIsAnyMemberPresent = true;
    2243             : 
    2244           0 :   if (!isNull) {
    2245           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->server_str_id, temp.ptr())) {
    2246           0 :       return false;
    2247             :     }
    2248             :   }
    2249           0 :   if (!isNull && !temp->isUndefined()) {
    2250           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mServer_str)) {
    2251           0 :       return false;
    2252             :     }
    2253             :   } else {
    2254             :     static const char16_t data[] = { 0 };
    2255           0 :     mServer_str.Rebind(data, ArrayLength(data) - 1);
    2256             :   }
    2257           0 :   mIsAnyMemberPresent = true;
    2258             : 
    2259           0 :   if (!isNull) {
    2260           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->success_id, temp.ptr())) {
    2261           0 :       return false;
    2262             :     }
    2263             :   }
    2264           0 :   if (!isNull && !temp->isUndefined()) {
    2265           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mSuccess)) {
    2266           0 :       return false;
    2267             :     }
    2268             :   } else {
    2269           0 :     mSuccess = false;
    2270             :   }
    2271           0 :   mIsAnyMemberPresent = true;
    2272             : 
    2273           0 :   if (!isNull) {
    2274           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->topic_id, temp.ptr())) {
    2275           0 :       return false;
    2276             :     }
    2277             :   }
    2278           0 :   if (!isNull && !temp->isUndefined()) {
    2279           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mTopic)) {
    2280           0 :       return false;
    2281             :     }
    2282             :   } else {
    2283             :     static const char16_t data[] = { 0 };
    2284           0 :     mTopic.Rebind(data, ArrayLength(data) - 1);
    2285             :   }
    2286           0 :   mIsAnyMemberPresent = true;
    2287             : 
    2288           0 :   if (!isNull) {
    2289           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->vendor_str_id, temp.ptr())) {
    2290           0 :       return false;
    2291             :     }
    2292             :   }
    2293           0 :   if (!isNull && !temp->isUndefined()) {
    2294           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mVendor_str)) {
    2295           0 :       return false;
    2296             :     }
    2297             :   } else {
    2298             :     static const char16_t data[] = { 0 };
    2299           0 :     mVendor_str.Rebind(data, ArrayLength(data) - 1);
    2300             :   }
    2301           0 :   mIsAnyMemberPresent = true;
    2302           0 :   return true;
    2303             : }
    2304             : 
    2305             : bool
    2306           0 : NetworkResultOptions::Init(const nsAString& aJSON)
    2307             : {
    2308           0 :   AutoJSAPI jsapi;
    2309           0 :   JSObject* cleanGlobal = SimpleGlobalObject::Create(SimpleGlobalObject::GlobalType::BindingDetail);
    2310           0 :   if (!cleanGlobal) {
    2311           0 :     return false;
    2312             :   }
    2313           0 :   if (!jsapi.Init(cleanGlobal)) {
    2314           0 :     return false;
    2315             :   }
    2316           0 :   JSContext* cx = jsapi.cx();
    2317           0 :   JS::Rooted<JS::Value> json(cx);
    2318           0 :   bool ok = ParseJSON(cx, aJSON, &json);
    2319           0 :   NS_ENSURE_TRUE(ok, false);
    2320           0 :   return Init(cx, json);
    2321             : }
    2322             : 
    2323             : bool
    2324           0 : NetworkResultOptions::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
    2325             : {
    2326           0 :   NetworkResultOptionsAtoms* atomsCache = GetAtomCache<NetworkResultOptionsAtoms>(cx);
    2327           0 :   if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
    2328           0 :     return false;
    2329             :   }
    2330             : 
    2331           0 :   JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
    2332           0 :   if (!obj) {
    2333           0 :     return false;
    2334             :   }
    2335           0 :   rval.set(JS::ObjectValue(*obj));
    2336             : 
    2337             :   do {
    2338             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2339           0 :     JS::Rooted<JS::Value> temp(cx);
    2340           0 :     bool const & currentValue = mBroadcast;
    2341           0 :     temp.setBoolean(currentValue);
    2342           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->broadcast_id, temp, JSPROP_ENUMERATE)) {
    2343           0 :       return false;
    2344             :     }
    2345           0 :     break;
    2346             :   } while(0);
    2347             : 
    2348             :   do {
    2349             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2350           0 :     JS::Rooted<JS::Value> temp(cx);
    2351           0 :     nsString const & currentValue = mCurExternalIfname;
    2352           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2353           0 :       return false;
    2354             :     }
    2355           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->curExternalIfname_id, temp, JSPROP_ENUMERATE)) {
    2356           0 :       return false;
    2357             :     }
    2358           0 :     break;
    2359             :   } while(0);
    2360             : 
    2361             :   do {
    2362             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2363           0 :     JS::Rooted<JS::Value> temp(cx);
    2364           0 :     nsString const & currentValue = mCurInternalIfname;
    2365           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2366           0 :       return false;
    2367             :     }
    2368           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->curInternalIfname_id, temp, JSPROP_ENUMERATE)) {
    2369           0 :       return false;
    2370             :     }
    2371           0 :     break;
    2372             :   } while(0);
    2373             : 
    2374             :   do {
    2375             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2376           0 :     JS::Rooted<JS::Value> temp(cx);
    2377           0 :     int32_t const & currentValue = mDns1;
    2378           0 :     temp.setInt32(int32_t(currentValue));
    2379           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->dns1_id, temp, JSPROP_ENUMERATE)) {
    2380           0 :       return false;
    2381             :     }
    2382           0 :     break;
    2383             :   } while(0);
    2384             : 
    2385             :   do {
    2386             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2387           0 :     JS::Rooted<JS::Value> temp(cx);
    2388           0 :     nsString const & currentValue = mDns1_str;
    2389           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2390           0 :       return false;
    2391             :     }
    2392           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->dns1_str_id, temp, JSPROP_ENUMERATE)) {
    2393           0 :       return false;
    2394             :     }
    2395           0 :     break;
    2396             :   } while(0);
    2397             : 
    2398             :   do {
    2399             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2400           0 :     JS::Rooted<JS::Value> temp(cx);
    2401           0 :     int32_t const & currentValue = mDns2;
    2402           0 :     temp.setInt32(int32_t(currentValue));
    2403           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->dns2_id, temp, JSPROP_ENUMERATE)) {
    2404           0 :       return false;
    2405             :     }
    2406           0 :     break;
    2407             :   } while(0);
    2408             : 
    2409             :   do {
    2410             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2411           0 :     JS::Rooted<JS::Value> temp(cx);
    2412           0 :     nsString const & currentValue = mDns2_str;
    2413           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2414           0 :       return false;
    2415             :     }
    2416           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->dns2_str_id, temp, JSPROP_ENUMERATE)) {
    2417           0 :       return false;
    2418             :     }
    2419           0 :     break;
    2420             :   } while(0);
    2421             : 
    2422             :   do {
    2423             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2424           0 :     JS::Rooted<JS::Value> temp(cx);
    2425           0 :     bool const & currentValue = mEnable;
    2426           0 :     temp.setBoolean(currentValue);
    2427           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->enable_id, temp, JSPROP_ENUMERATE)) {
    2428           0 :       return false;
    2429             :     }
    2430           0 :     break;
    2431             :   } while(0);
    2432             : 
    2433             :   do {
    2434             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2435           0 :     JS::Rooted<JS::Value> temp(cx);
    2436           0 :     bool const & currentValue = mError;
    2437           0 :     temp.setBoolean(currentValue);
    2438           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->error_id, temp, JSPROP_ENUMERATE)) {
    2439           0 :       return false;
    2440             :     }
    2441           0 :     break;
    2442             :   } while(0);
    2443             : 
    2444             :   do {
    2445             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2446           0 :     JS::Rooted<JS::Value> temp(cx);
    2447           0 :     nsString const & currentValue = mFlag;
    2448           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2449           0 :       return false;
    2450             :     }
    2451           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->flag_id, temp, JSPROP_ENUMERATE)) {
    2452           0 :       return false;
    2453             :     }
    2454           0 :     break;
    2455             :   } while(0);
    2456             : 
    2457             :   do {
    2458             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2459           0 :     JS::Rooted<JS::Value> temp(cx);
    2460           0 :     int32_t const & currentValue = mGateway;
    2461           0 :     temp.setInt32(int32_t(currentValue));
    2462           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->gateway_id, temp, JSPROP_ENUMERATE)) {
    2463           0 :       return false;
    2464             :     }
    2465           0 :     break;
    2466             :   } while(0);
    2467             : 
    2468             :   do {
    2469             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2470           0 :     JS::Rooted<JS::Value> temp(cx);
    2471           0 :     nsString const & currentValue = mGateway_str;
    2472           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2473           0 :       return false;
    2474             :     }
    2475           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->gateway_str_id, temp, JSPROP_ENUMERATE)) {
    2476           0 :       return false;
    2477             :     }
    2478           0 :     break;
    2479             :   } while(0);
    2480             : 
    2481             :   do {
    2482             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2483           0 :     JS::Rooted<JS::Value> temp(cx);
    2484           0 :     int32_t const & currentValue = mId;
    2485           0 :     temp.setInt32(int32_t(currentValue));
    2486           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->id_id, temp, JSPROP_ENUMERATE)) {
    2487           0 :       return false;
    2488             :     }
    2489           0 :     break;
    2490             :   } while(0);
    2491             : 
    2492           0 :   if (mInterfaceList.WasPassed()) {
    2493             :     do {
    2494             :       // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2495           0 :       JS::Rooted<JS::Value> temp(cx);
    2496           0 :       Sequence<nsString> const & currentValue = mInterfaceList.InternalValue();
    2497             : 
    2498           0 :       uint32_t length = currentValue.Length();
    2499           0 :       JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length));
    2500           0 :       if (!returnArray) {
    2501           0 :         return false;
    2502             :       }
    2503             :       // Scope for 'tmp'
    2504             :       {
    2505           0 :         JS::Rooted<JS::Value> tmp(cx);
    2506           0 :         for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) {
    2507             :           // Control block to let us common up the JS_DefineElement calls when there
    2508             :           // are different ways to succeed at wrapping the object.
    2509             :           do {
    2510           0 :             if (!xpc::NonVoidStringToJsval(cx, currentValue[sequenceIdx0], &tmp)) {
    2511           0 :               return false;
    2512             :             }
    2513           0 :             break;
    2514             :           } while (0);
    2515           0 :           if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp,
    2516             :                                 JSPROP_ENUMERATE)) {
    2517           0 :             return false;
    2518             :           }
    2519             :         }
    2520             :       }
    2521           0 :       temp.setObject(*returnArray);
    2522           0 :       if (!JS_DefinePropertyById(cx, obj, atomsCache->interfaceList_id, temp, JSPROP_ENUMERATE)) {
    2523           0 :         return false;
    2524             :       }
    2525           0 :       break;
    2526             :     } while(0);
    2527             :   }
    2528             : 
    2529             :   do {
    2530             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2531           0 :     JS::Rooted<JS::Value> temp(cx);
    2532           0 :     nsString const & currentValue = mIpAddr;
    2533           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2534           0 :       return false;
    2535             :     }
    2536           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->ipAddr_id, temp, JSPROP_ENUMERATE)) {
    2537           0 :       return false;
    2538             :     }
    2539           0 :     break;
    2540             :   } while(0);
    2541             : 
    2542             :   do {
    2543             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2544           0 :     JS::Rooted<JS::Value> temp(cx);
    2545           0 :     int32_t const & currentValue = mIpaddr;
    2546           0 :     temp.setInt32(int32_t(currentValue));
    2547           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->ipaddr_id, temp, JSPROP_ENUMERATE)) {
    2548           0 :       return false;
    2549             :     }
    2550           0 :     break;
    2551             :   } while(0);
    2552             : 
    2553             :   do {
    2554             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2555           0 :     JS::Rooted<JS::Value> temp(cx);
    2556           0 :     nsString const & currentValue = mIpaddr_str;
    2557           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2558           0 :       return false;
    2559             :     }
    2560           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->ipaddr_str_id, temp, JSPROP_ENUMERATE)) {
    2561           0 :       return false;
    2562             :     }
    2563           0 :     break;
    2564             :   } while(0);
    2565             : 
    2566             :   do {
    2567             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2568           0 :     JS::Rooted<JS::Value> temp(cx);
    2569           0 :     int32_t const & currentValue = mLease;
    2570           0 :     temp.setInt32(int32_t(currentValue));
    2571           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->lease_id, temp, JSPROP_ENUMERATE)) {
    2572           0 :       return false;
    2573             :     }
    2574           0 :     break;
    2575             :   } while(0);
    2576             : 
    2577             :   do {
    2578             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2579           0 :     JS::Rooted<JS::Value> temp(cx);
    2580           0 :     nsString const & currentValue = mMacAddr;
    2581           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2582           0 :       return false;
    2583             :     }
    2584           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->macAddr_id, temp, JSPROP_ENUMERATE)) {
    2585           0 :       return false;
    2586             :     }
    2587           0 :     break;
    2588             :   } while(0);
    2589             : 
    2590             :   do {
    2591             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2592           0 :     JS::Rooted<JS::Value> temp(cx);
    2593           0 :     int32_t const & currentValue = mMask;
    2594           0 :     temp.setInt32(int32_t(currentValue));
    2595           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->mask_id, temp, JSPROP_ENUMERATE)) {
    2596           0 :       return false;
    2597             :     }
    2598           0 :     break;
    2599             :   } while(0);
    2600             : 
    2601             :   do {
    2602             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2603           0 :     JS::Rooted<JS::Value> temp(cx);
    2604           0 :     nsString const & currentValue = mMask_str;
    2605           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2606           0 :       return false;
    2607             :     }
    2608           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->mask_str_id, temp, JSPROP_ENUMERATE)) {
    2609           0 :       return false;
    2610             :     }
    2611           0 :     break;
    2612             :   } while(0);
    2613             : 
    2614             :   do {
    2615             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2616           0 :     JS::Rooted<JS::Value> temp(cx);
    2617           0 :     nsString const & currentValue = mNetId;
    2618           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2619           0 :       return false;
    2620             :     }
    2621           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->netId_id, temp, JSPROP_ENUMERATE)) {
    2622           0 :       return false;
    2623             :     }
    2624           0 :     break;
    2625             :   } while(0);
    2626             : 
    2627             :   do {
    2628             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2629           0 :     JS::Rooted<JS::Value> temp(cx);
    2630           0 :     int32_t const & currentValue = mPrefixLength;
    2631           0 :     temp.setInt32(int32_t(currentValue));
    2632           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->prefixLength_id, temp, JSPROP_ENUMERATE)) {
    2633           0 :       return false;
    2634             :     }
    2635           0 :     break;
    2636             :   } while(0);
    2637             : 
    2638             :   do {
    2639             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2640           0 :     JS::Rooted<JS::Value> temp(cx);
    2641           0 :     nsString const & currentValue = mReason;
    2642           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2643           0 :       return false;
    2644             :     }
    2645           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->reason_id, temp, JSPROP_ENUMERATE)) {
    2646           0 :       return false;
    2647             :     }
    2648           0 :     break;
    2649             :   } while(0);
    2650             : 
    2651             :   do {
    2652             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2653           0 :     JS::Rooted<JS::Value> temp(cx);
    2654           0 :     nsString const & currentValue = mReply;
    2655           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2656           0 :       return false;
    2657             :     }
    2658           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->reply_id, temp, JSPROP_ENUMERATE)) {
    2659           0 :       return false;
    2660             :     }
    2661           0 :     break;
    2662             :   } while(0);
    2663             : 
    2664             :   do {
    2665             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2666           0 :     JS::Rooted<JS::Value> temp(cx);
    2667           0 :     bool const & currentValue = mResult;
    2668           0 :     temp.setBoolean(currentValue);
    2669           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->result_id, temp, JSPROP_ENUMERATE)) {
    2670           0 :       return false;
    2671             :     }
    2672           0 :     break;
    2673             :   } while(0);
    2674             : 
    2675             :   do {
    2676             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2677           0 :     JS::Rooted<JS::Value> temp(cx);
    2678           0 :     int32_t const & currentValue = mResultCode;
    2679           0 :     temp.setInt32(int32_t(currentValue));
    2680           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->resultCode_id, temp, JSPROP_ENUMERATE)) {
    2681           0 :       return false;
    2682             :     }
    2683           0 :     break;
    2684             :   } while(0);
    2685             : 
    2686             :   do {
    2687             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2688           0 :     JS::Rooted<JS::Value> temp(cx);
    2689           0 :     nsString const & currentValue = mResultReason;
    2690           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2691           0 :       return false;
    2692             :     }
    2693           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->resultReason_id, temp, JSPROP_ENUMERATE)) {
    2694           0 :       return false;
    2695             :     }
    2696           0 :     break;
    2697             :   } while(0);
    2698             : 
    2699             :   do {
    2700             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2701           0 :     JS::Rooted<JS::Value> temp(cx);
    2702           0 :     bool const & currentValue = mRet;
    2703           0 :     temp.setBoolean(currentValue);
    2704           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->ret_id, temp, JSPROP_ENUMERATE)) {
    2705           0 :       return false;
    2706             :     }
    2707           0 :     break;
    2708             :   } while(0);
    2709             : 
    2710             :   do {
    2711             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2712           0 :     JS::Rooted<JS::Value> temp(cx);
    2713           0 :     nsString const & currentValue = mRoute;
    2714           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2715           0 :       return false;
    2716             :     }
    2717           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->route_id, temp, JSPROP_ENUMERATE)) {
    2718           0 :       return false;
    2719             :     }
    2720           0 :     break;
    2721             :   } while(0);
    2722             : 
    2723             :   do {
    2724             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2725           0 :     JS::Rooted<JS::Value> temp(cx);
    2726           0 :     int32_t const & currentValue = mServer;
    2727           0 :     temp.setInt32(int32_t(currentValue));
    2728           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->server_id, temp, JSPROP_ENUMERATE)) {
    2729           0 :       return false;
    2730             :     }
    2731           0 :     break;
    2732             :   } while(0);
    2733             : 
    2734             :   do {
    2735             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2736           0 :     JS::Rooted<JS::Value> temp(cx);
    2737           0 :     nsString const & currentValue = mServer_str;
    2738           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2739           0 :       return false;
    2740             :     }
    2741           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->server_str_id, temp, JSPROP_ENUMERATE)) {
    2742           0 :       return false;
    2743             :     }
    2744           0 :     break;
    2745             :   } while(0);
    2746             : 
    2747             :   do {
    2748             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2749           0 :     JS::Rooted<JS::Value> temp(cx);
    2750           0 :     bool const & currentValue = mSuccess;
    2751           0 :     temp.setBoolean(currentValue);
    2752           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->success_id, temp, JSPROP_ENUMERATE)) {
    2753           0 :       return false;
    2754             :     }
    2755           0 :     break;
    2756             :   } while(0);
    2757             : 
    2758             :   do {
    2759             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2760           0 :     JS::Rooted<JS::Value> temp(cx);
    2761           0 :     nsString const & currentValue = mTopic;
    2762           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2763           0 :       return false;
    2764             :     }
    2765           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->topic_id, temp, JSPROP_ENUMERATE)) {
    2766           0 :       return false;
    2767             :     }
    2768           0 :     break;
    2769             :   } while(0);
    2770             : 
    2771             :   do {
    2772             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
    2773           0 :     JS::Rooted<JS::Value> temp(cx);
    2774           0 :     nsString const & currentValue = mVendor_str;
    2775           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
    2776           0 :       return false;
    2777             :     }
    2778           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->vendor_str_id, temp, JSPROP_ENUMERATE)) {
    2779           0 :       return false;
    2780             :     }
    2781           0 :     break;
    2782             :   } while(0);
    2783             : 
    2784           0 :   return true;
    2785             : }
    2786             : 
    2787             : bool
    2788           0 : NetworkResultOptions::ToJSON(nsAString& aJSON) const
    2789             : {
    2790           0 :   AutoJSAPI jsapi;
    2791           0 :   jsapi.Init();
    2792           0 :   JSContext *cx = jsapi.cx();
    2793             :   // It's safe to use UnprivilegedJunkScopeOrWorkerGlobal here
    2794             :   // because we'll only be creating objects, in ways that have no
    2795             :   // side-effects, followed by a call to JS::ToJSONMaybeSafely,
    2796             :   // which likewise guarantees no side-effects for the sorts of
    2797             :   // things we will pass it.
    2798           0 :   JSAutoCompartment ac(cx, binding_detail::UnprivilegedJunkScopeOrWorkerGlobal());
    2799           0 :   JS::Rooted<JS::Value> val(cx);
    2800           0 :   if (!ToObjectInternal(cx, &val)) {
    2801           0 :     return false;
    2802             :   }
    2803           0 :   JS::Rooted<JSObject*> obj(cx, &val.toObject());
    2804           0 :   return StringifyToJSON(cx, obj, aJSON);
    2805             : }
    2806             : 
    2807             : void
    2808           0 : NetworkResultOptions::TraceDictionary(JSTracer* trc)
    2809             : {
    2810           0 : }
    2811             : 
    2812             : NetworkResultOptions&
    2813           0 : NetworkResultOptions::operator=(const NetworkResultOptions& aOther)
    2814             : {
    2815           0 :   mBroadcast = aOther.mBroadcast;
    2816           0 :   mCurExternalIfname = aOther.mCurExternalIfname;
    2817           0 :   mCurInternalIfname = aOther.mCurInternalIfname;
    2818           0 :   mDns1 = aOther.mDns1;
    2819           0 :   mDns1_str = aOther.mDns1_str;
    2820           0 :   mDns2 = aOther.mDns2;
    2821           0 :   mDns2_str = aOther.mDns2_str;
    2822           0 :   mEnable = aOther.mEnable;
    2823           0 :   mError = aOther.mError;
    2824           0 :   mFlag = aOther.mFlag;
    2825           0 :   mGateway = aOther.mGateway;
    2826           0 :   mGateway_str = aOther.mGateway_str;
    2827           0 :   mId = aOther.mId;
    2828           0 :   mInterfaceList.Reset();
    2829           0 :   if (aOther.mInterfaceList.WasPassed()) {
    2830           0 :     mInterfaceList.Construct(aOther.mInterfaceList.Value());
    2831             :   }
    2832           0 :   mIpAddr = aOther.mIpAddr;
    2833           0 :   mIpaddr = aOther.mIpaddr;
    2834           0 :   mIpaddr_str = aOther.mIpaddr_str;
    2835           0 :   mLease = aOther.mLease;
    2836           0 :   mMacAddr = aOther.mMacAddr;
    2837           0 :   mMask = aOther.mMask;
    2838           0 :   mMask_str = aOther.mMask_str;
    2839           0 :   mNetId = aOther.mNetId;
    2840           0 :   mPrefixLength = aOther.mPrefixLength;
    2841           0 :   mReason = aOther.mReason;
    2842           0 :   mReply = aOther.mReply;
    2843           0 :   mResult = aOther.mResult;
    2844           0 :   mResultCode = aOther.mResultCode;
    2845           0 :   mResultReason = aOther.mResultReason;
    2846           0 :   mRet = aOther.mRet;
    2847           0 :   mRoute = aOther.mRoute;
    2848           0 :   mServer = aOther.mServer;
    2849           0 :   mServer_str = aOther.mServer_str;
    2850           0 :   mSuccess = aOther.mSuccess;
    2851           0 :   mTopic = aOther.mTopic;
    2852           0 :   mVendor_str = aOther.mVendor_str;
    2853           0 :   return *this;
    2854             : }
    2855             : 
    2856             : namespace binding_detail {
    2857             : } // namespace binding_detail
    2858             : 
    2859             : 
    2860             : } // namespace dom
    2861             : } // namespace mozilla

Generated by: LCOV version 1.13