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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM SettingChangeNotification.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "AtomList.h"
       4             : #include "SettingChangeNotificationBinding.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             : 
      11             : namespace mozilla {
      12             : namespace dom {
      13             : 
      14             : 
      15           0 : SettingChangeNotification::SettingChangeNotification()
      16           0 :   : mValue(JS::UndefinedValue())
      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             : bool
      24           0 : SettingChangeNotification::InitIds(JSContext* cx, SettingChangeNotificationAtoms* atomsCache)
      25             : {
      26           0 :   MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache));
      27             : 
      28             :   // Initialize these in reverse order so that any failure leaves the first one
      29             :   // uninitialized.
      30           0 :   if (!atomsCache->value_id.init(cx, "value") ||
      31           0 :       !atomsCache->key_id.init(cx, "key") ||
      32           0 :       !atomsCache->isInternalChange_id.init(cx, "isInternalChange")) {
      33           0 :     return false;
      34             :   }
      35           0 :   return true;
      36             : }
      37             : 
      38             : bool
      39           0 : SettingChangeNotification::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl)
      40             : {
      41             :   // Passing a null JSContext is OK only if we're initing from null,
      42             :   // Since in that case we will not have to do any property gets
      43             :   // Also evaluate isNullOrUndefined in order to avoid false-positive
      44             :   // checkers by static analysis tools
      45           0 :   MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
      46           0 :   SettingChangeNotificationAtoms* atomsCache = nullptr;
      47           0 :   if (cx) {
      48           0 :     atomsCache = GetAtomCache<SettingChangeNotificationAtoms>(cx);
      49           0 :     if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
      50           0 :       return false;
      51             :     }
      52             :   }
      53             : 
      54           0 :   if (!IsConvertibleToDictionary(val)) {
      55           0 :     return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription);
      56             :   }
      57             : 
      58           0 :   bool isNull = val.isNullOrUndefined();
      59             :   // We only need these if !isNull, in which case we have |cx|.
      60           0 :   Maybe<JS::Rooted<JSObject *> > object;
      61           0 :   Maybe<JS::Rooted<JS::Value> > temp;
      62           0 :   if (!isNull) {
      63           0 :     MOZ_ASSERT(cx);
      64           0 :     object.emplace(cx, &val.toObject());
      65           0 :     temp.emplace(cx);
      66             :   }
      67           0 :   if (!isNull) {
      68           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->isInternalChange_id, temp.ptr())) {
      69           0 :       return false;
      70             :     }
      71             :   }
      72           0 :   if (!isNull && !temp->isUndefined()) {
      73           0 :     if (!ValueToPrimitive<bool, eDefault>(cx, temp.ref(), &mIsInternalChange)) {
      74           0 :       return false;
      75             :     }
      76             :   } else {
      77           0 :     mIsInternalChange = false;
      78             :   }
      79           0 :   mIsAnyMemberPresent = true;
      80             : 
      81           0 :   if (!isNull) {
      82           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->key_id, temp.ptr())) {
      83           0 :       return false;
      84             :     }
      85             :   }
      86           0 :   if (!isNull && !temp->isUndefined()) {
      87           0 :     if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mKey)) {
      88           0 :       return false;
      89             :     }
      90             :   } else {
      91             :     static const char16_t data[] = { 0 };
      92           0 :     mKey.Rebind(data, ArrayLength(data) - 1);
      93             :   }
      94           0 :   mIsAnyMemberPresent = true;
      95             : 
      96           0 :   if (!isNull) {
      97           0 :     if (!JS_GetPropertyById(cx, *object, atomsCache->value_id, temp.ptr())) {
      98           0 :       return false;
      99             :     }
     100             :   }
     101           0 :   if (!isNull && !temp->isUndefined()) {
     102             : #ifdef __clang__
     103             : #pragma clang diagnostic push
     104             : #pragma clang diagnostic ignored "-Wunreachable-code"
     105             : #pragma clang diagnostic ignored "-Wunreachable-code-return"
     106             : #endif // __clang__
     107           0 :     if ((passedToJSImpl) && !CallerSubsumes(temp.ref())) {
     108           0 :       ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "'value' member of SettingChangeNotification");
     109           0 :       return false;
     110             :     }
     111             : #ifdef __clang__
     112             : #pragma clang diagnostic pop
     113             : #endif // __clang__
     114           0 :     mValue = temp.ref();
     115             :   } else {
     116           0 :     mValue = JS::UndefinedValue();
     117             :   }
     118           0 :   mIsAnyMemberPresent = true;
     119           0 :   return true;
     120             : }
     121             : 
     122             : bool
     123           0 : SettingChangeNotification::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
     124             : {
     125           0 :   SettingChangeNotificationAtoms* atomsCache = GetAtomCache<SettingChangeNotificationAtoms>(cx);
     126           0 :   if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
     127           0 :     return false;
     128             :   }
     129             : 
     130           0 :   JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
     131           0 :   if (!obj) {
     132           0 :     return false;
     133             :   }
     134           0 :   rval.set(JS::ObjectValue(*obj));
     135             : 
     136             :   do {
     137             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     138           0 :     JS::Rooted<JS::Value> temp(cx);
     139           0 :     bool const & currentValue = mIsInternalChange;
     140           0 :     temp.setBoolean(currentValue);
     141           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->isInternalChange_id, temp, JSPROP_ENUMERATE)) {
     142           0 :       return false;
     143             :     }
     144           0 :     break;
     145             :   } while(0);
     146             : 
     147             :   do {
     148             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     149           0 :     JS::Rooted<JS::Value> temp(cx);
     150           0 :     nsString const & currentValue = mKey;
     151           0 :     if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
     152           0 :       return false;
     153             :     }
     154           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->key_id, temp, JSPROP_ENUMERATE)) {
     155           0 :       return false;
     156             :     }
     157           0 :     break;
     158             :   } while(0);
     159             : 
     160             :   do {
     161             :     // block for our 'break' successCode and scope for 'temp' and 'currentValue'
     162           0 :     JS::Rooted<JS::Value> temp(cx);
     163           0 :     JS::Value const & currentValue = mValue;
     164           0 :     JS::ExposeValueToActiveJS(currentValue);
     165           0 :     temp.set(currentValue);
     166           0 :     if (!MaybeWrapValue(cx, &temp)) {
     167           0 :       return false;
     168             :     }
     169           0 :     if (!JS_DefinePropertyById(cx, obj, atomsCache->value_id, temp, JSPROP_ENUMERATE)) {
     170           0 :       return false;
     171             :     }
     172           0 :     break;
     173             :   } while(0);
     174             : 
     175           0 :   return true;
     176             : }
     177             : 
     178             : void
     179           0 : SettingChangeNotification::TraceDictionary(JSTracer* trc)
     180             : {
     181           0 :   JS::UnsafeTraceRoot(trc, &mValue, "SettingChangeNotification.mValue");
     182           0 : }
     183             : 
     184             : namespace binding_detail {
     185             : } // namespace binding_detail
     186             : 
     187             : 
     188             : } // namespace dom
     189             : } // namespace mozilla

Generated by: LCOV version 1.13