LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dist/include/mozilla/dom - TestInterfaceJSBinding.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 240 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 82 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM TestInterfaceJS.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #ifndef mozilla_dom_TestInterfaceJSBinding_h
       4             : #define mozilla_dom_TestInterfaceJSBinding_h
       5             : 
       6             : #include "js/RootingAPI.h"
       7             : #include "jspubtd.h"
       8             : #include "mozilla/DOMEventTargetHelper.h"
       9             : #include "mozilla/ErrorResult.h"
      10             : #include "mozilla/dom/BindingDeclarations.h"
      11             : #include "mozilla/dom/CallbackInterface.h"
      12             : #include "mozilla/dom/FakeString.h"
      13             : #include "mozilla/dom/Nullable.h"
      14             : #include "mozilla/dom/Record.h"
      15             : #include "mozilla/dom/RootedDictionary.h"
      16             : #include "mozilla/dom/ToJSValue.h"
      17             : #include "mozilla/dom/UnionMember.h"
      18             : #include "nsWeakReference.h"
      19             : 
      20             : namespace mozilla {
      21             : namespace dom {
      22             : 
      23             : class AnyCallback;
      24             : class EventHandlerNonNull;
      25             : class Function;
      26             : class Location;
      27             : class LocationOrTestInterfaceJS;
      28             : struct NativePropertyHooks;
      29             : class ObjectOrString;
      30             : class OwningLocationOrTestInterfaceJS;
      31             : class OwningObjectOrString;
      32             : class OwningStringOrTestInterfaceJSOrNull;
      33             : class OwningStringSequenceOrString;
      34             : class OwningTestInterfaceJSOrLong;
      35             : class OwningTestInterfaceJSOrNullOrString;
      36             : class OwningTestInterfaceJSUnionableDictionaryOrLong;
      37             : class Promise;
      38             : class ProtoAndIfaceCache;
      39             : class StringOrTestInterfaceJSOrNull;
      40             : class StringSequenceOrString;
      41             : class TestInterfaceJS;
      42             : struct TestInterfaceJSAtoms;
      43             : struct TestInterfaceJSDictionary;
      44             : class TestInterfaceJSOrLong;
      45             : class TestInterfaceJSOrNullOrString;
      46             : struct TestInterfaceJSUnionableDictionaryAtoms;
      47             : class TestInterfaceJSUnionableDictionaryOrLong;
      48             : 
      49             : } // namespace dom
      50             : } // namespace mozilla
      51             : 
      52             : namespace mozilla {
      53             : namespace dom {
      54             : 
      55             : void
      56             : ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningLocationOrTestInterfaceJS& aUnion, const char* aName, uint32_t aFlags = 0);
      57             : 
      58             : 
      59             : void
      60             : ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningStringOrTestInterfaceJSOrNull& aUnion, const char* aName, uint32_t aFlags = 0);
      61             : 
      62             : 
      63             : void
      64             : ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningTestInterfaceJSOrLong& aUnion, const char* aName, uint32_t aFlags = 0);
      65             : 
      66             : 
      67             : void
      68             : ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningTestInterfaceJSOrNullOrString& aUnion, const char* aName, uint32_t aFlags = 0);
      69             : 
      70             : 
      71             : void
      72             : ImplCycleCollectionUnlink(OwningLocationOrTestInterfaceJS& aUnion);
      73             : 
      74             : 
      75             : void
      76             : ImplCycleCollectionUnlink(OwningStringOrTestInterfaceJSOrNull& aUnion);
      77             : 
      78             : 
      79             : void
      80             : ImplCycleCollectionUnlink(OwningTestInterfaceJSOrLong& aUnion);
      81             : 
      82             : 
      83             : void
      84             : ImplCycleCollectionUnlink(OwningTestInterfaceJSOrNullOrString& aUnion);
      85             : 
      86             : 
      87             : class LocationOrTestInterfaceJS
      88             : {
      89             :   friend class LocationOrTestInterfaceJSArgument;
      90             :   enum Type
      91             :   {
      92             :     eUninitialized,
      93             :     eLocation,
      94             :     eTestInterfaceJS
      95             :   };
      96             : 
      97             :   union Value
      98             :   {
      99             :     UnionMember<NonNull<mozilla::dom::Location> > mLocation;
     100             :     UnionMember<NonNull<mozilla::dom::TestInterfaceJS> > mTestInterfaceJS;
     101             : 
     102             :   };
     103             : 
     104             :   Type mType;
     105             :   Value mValue;
     106             : 
     107             :   LocationOrTestInterfaceJS(const LocationOrTestInterfaceJS&) = delete;
     108             :   LocationOrTestInterfaceJS& operator=(const LocationOrTestInterfaceJS&) = delete;
     109             : public:
     110             :   explicit inline LocationOrTestInterfaceJS()
     111             :     : mType(eUninitialized)
     112             :   {
     113             :   }
     114             : 
     115             :   inline ~LocationOrTestInterfaceJS()
     116             :   {
     117             :     Uninit();
     118             :   }
     119             : 
     120             :   inline NonNull<mozilla::dom::Location>&
     121             :   RawSetAsLocation()
     122             :   {
     123             :     if (mType == eLocation) {
     124             :       return mValue.mLocation.Value();
     125             :     }
     126             :     MOZ_ASSERT(mType == eUninitialized);
     127             :     mType = eLocation;
     128             :     return mValue.mLocation.SetValue();
     129             :   }
     130             : 
     131             :   inline NonNull<mozilla::dom::Location>&
     132             :   SetAsLocation()
     133             :   {
     134             :     if (mType == eLocation) {
     135             :       return mValue.mLocation.Value();
     136             :     }
     137             :     Uninit();
     138             :     mType = eLocation;
     139             :     return mValue.mLocation.SetValue();
     140             :   }
     141             : 
     142             :   inline bool
     143             :   IsLocation() const
     144             :   {
     145             :     return mType == eLocation;
     146             :   }
     147             : 
     148             :   inline NonNull<mozilla::dom::Location>&
     149             :   GetAsLocation()
     150             :   {
     151             :     MOZ_ASSERT(IsLocation(), "Wrong type!");
     152             :     return mValue.mLocation.Value();
     153             :   }
     154             : 
     155             :   inline mozilla::dom::Location&
     156             :   GetAsLocation() const
     157             :   {
     158             :     MOZ_ASSERT(IsLocation(), "Wrong type!");
     159             :     return mValue.mLocation.Value();
     160             :   }
     161             : 
     162             :   inline NonNull<mozilla::dom::TestInterfaceJS>&
     163             :   RawSetAsTestInterfaceJS()
     164             :   {
     165             :     if (mType == eTestInterfaceJS) {
     166             :       return mValue.mTestInterfaceJS.Value();
     167             :     }
     168             :     MOZ_ASSERT(mType == eUninitialized);
     169             :     mType = eTestInterfaceJS;
     170             :     return mValue.mTestInterfaceJS.SetValue();
     171             :   }
     172             : 
     173             :   inline NonNull<mozilla::dom::TestInterfaceJS>&
     174             :   SetAsTestInterfaceJS()
     175             :   {
     176             :     if (mType == eTestInterfaceJS) {
     177             :       return mValue.mTestInterfaceJS.Value();
     178             :     }
     179             :     Uninit();
     180             :     mType = eTestInterfaceJS;
     181             :     return mValue.mTestInterfaceJS.SetValue();
     182             :   }
     183             : 
     184             :   inline bool
     185             :   IsTestInterfaceJS() const
     186             :   {
     187             :     return mType == eTestInterfaceJS;
     188             :   }
     189             : 
     190             :   inline NonNull<mozilla::dom::TestInterfaceJS>&
     191             :   GetAsTestInterfaceJS()
     192             :   {
     193             :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
     194             :     return mValue.mTestInterfaceJS.Value();
     195             :   }
     196             : 
     197             :   inline mozilla::dom::TestInterfaceJS&
     198             :   GetAsTestInterfaceJS() const
     199             :   {
     200             :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
     201             :     return mValue.mTestInterfaceJS.Value();
     202             :   }
     203             : 
     204             :   inline void
     205             :   Uninit()
     206             :   {
     207             :     switch (mType) {
     208             :       case eUninitialized: {
     209             :         break;
     210             :       }
     211             :       case eLocation: {
     212             :         DestroyLocation();
     213             :         break;
     214             :       }
     215             :       case eTestInterfaceJS: {
     216             :         DestroyTestInterfaceJS();
     217             :         break;
     218             :       }
     219             :     }
     220             :   }
     221             : 
     222             :   bool
     223             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     224             : 
     225             : private:
     226             :   inline void
     227             :   DestroyLocation()
     228             :   {
     229             :     MOZ_ASSERT(IsLocation(), "Wrong type!");
     230             :     mValue.mLocation.Destroy();
     231             :     mType = eUninitialized;
     232             :   }
     233             : 
     234             :   inline void
     235             :   DestroyTestInterfaceJS()
     236             :   {
     237             :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
     238             :     mValue.mTestInterfaceJS.Destroy();
     239             :     mType = eUninitialized;
     240             :   }
     241             : };
     242             : 
     243             : 
     244             : class OwningLocationOrTestInterfaceJS : public AllOwningUnionBase
     245             : {
     246             :   friend void ImplCycleCollectionUnlink(OwningLocationOrTestInterfaceJS& aUnion);
     247             :   enum Type
     248             :   {
     249             :     eUninitialized,
     250             :     eLocation,
     251             :     eTestInterfaceJS
     252             :   };
     253             : 
     254           0 :   union Value
     255             :   {
     256             :     UnionMember<OwningNonNull<mozilla::dom::Location> > mLocation;
     257             :     UnionMember<OwningNonNull<mozilla::dom::TestInterfaceJS> > mTestInterfaceJS;
     258             : 
     259             :   };
     260             : 
     261             :   Type mType;
     262             :   Value mValue;
     263             : 
     264             : public:
     265           0 :   explicit inline OwningLocationOrTestInterfaceJS()
     266           0 :     : mType(eUninitialized)
     267             :   {
     268           0 :   }
     269             : 
     270             :   explicit inline OwningLocationOrTestInterfaceJS(const OwningLocationOrTestInterfaceJS& aOther)
     271             :     : mType(eUninitialized)
     272             :   {
     273             :     *this = aOther;
     274             :   }
     275             : 
     276           0 :   inline ~OwningLocationOrTestInterfaceJS()
     277           0 :   {
     278           0 :     Uninit();
     279           0 :   }
     280             : 
     281             :   OwningNonNull<mozilla::dom::Location>&
     282             :   RawSetAsLocation();
     283             : 
     284             :   OwningNonNull<mozilla::dom::Location>&
     285             :   SetAsLocation();
     286             : 
     287             :   bool
     288             :   TrySetToLocation(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     289             : 
     290             :   inline bool
     291           0 :   IsLocation() const
     292             :   {
     293           0 :     return mType == eLocation;
     294             :   }
     295             : 
     296             :   inline OwningNonNull<mozilla::dom::Location>&
     297           0 :   GetAsLocation()
     298             :   {
     299           0 :     MOZ_ASSERT(IsLocation(), "Wrong type!");
     300           0 :     return mValue.mLocation.Value();
     301             :   }
     302             : 
     303             :   inline OwningNonNull<mozilla::dom::Location> const &
     304           0 :   GetAsLocation() const
     305             :   {
     306           0 :     MOZ_ASSERT(IsLocation(), "Wrong type!");
     307           0 :     return mValue.mLocation.Value();
     308             :   }
     309             : 
     310             :   OwningNonNull<mozilla::dom::TestInterfaceJS>&
     311             :   RawSetAsTestInterfaceJS();
     312             : 
     313             :   OwningNonNull<mozilla::dom::TestInterfaceJS>&
     314             :   SetAsTestInterfaceJS();
     315             : 
     316             :   bool
     317             :   TrySetToTestInterfaceJS(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     318             : 
     319             :   inline bool
     320           0 :   IsTestInterfaceJS() const
     321             :   {
     322           0 :     return mType == eTestInterfaceJS;
     323             :   }
     324             : 
     325             :   inline OwningNonNull<mozilla::dom::TestInterfaceJS>&
     326           0 :   GetAsTestInterfaceJS()
     327             :   {
     328           0 :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
     329           0 :     return mValue.mTestInterfaceJS.Value();
     330             :   }
     331             : 
     332             :   inline OwningNonNull<mozilla::dom::TestInterfaceJS> const &
     333           0 :   GetAsTestInterfaceJS() const
     334             :   {
     335           0 :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
     336           0 :     return mValue.mTestInterfaceJS.Value();
     337             :   }
     338             : 
     339             :   void
     340             :   Uninit();
     341             : 
     342             :   bool
     343             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     344             : 
     345             :   void
     346             :   TraceUnion(JSTracer* trc);
     347             : 
     348             :   OwningLocationOrTestInterfaceJS&
     349             :   operator=(const OwningLocationOrTestInterfaceJS& aOther);
     350             : 
     351             : private:
     352             :   void
     353             :   DestroyLocation();
     354             : 
     355             :   void
     356             :   DestroyTestInterfaceJS();
     357             : };
     358             : 
     359             : 
     360             : class StringOrTestInterfaceJSOrNull
     361             : {
     362             :   friend class StringOrTestInterfaceJSOrNullArgument;
     363             :   enum Type
     364             :   {
     365             :     eUninitialized,
     366             :     eNull,
     367             :     eString,
     368             :     eTestInterfaceJS
     369             :   };
     370             : 
     371             :   union Value
     372             :   {
     373             :     UnionMember<binding_detail::FakeString > mString;
     374             :     UnionMember<NonNull<mozilla::dom::TestInterfaceJS> > mTestInterfaceJS;
     375             : 
     376             :   };
     377             : 
     378             :   Type mType;
     379             :   Value mValue;
     380             : 
     381             :   StringOrTestInterfaceJSOrNull(const StringOrTestInterfaceJSOrNull&) = delete;
     382             :   StringOrTestInterfaceJSOrNull& operator=(const StringOrTestInterfaceJSOrNull&) = delete;
     383             : public:
     384             :   explicit inline StringOrTestInterfaceJSOrNull()
     385             :     : mType(eUninitialized)
     386             :   {
     387             :   }
     388             : 
     389             :   inline ~StringOrTestInterfaceJSOrNull()
     390             :   {
     391             :     Uninit();
     392             :   }
     393             : 
     394             :   inline bool
     395             :   IsNull() const
     396             :   {
     397             :     return mType == eNull;
     398             :   }
     399             : 
     400             :   inline void
     401             :   SetNull()
     402             :   {
     403             :     Uninit();
     404             :     mType = eNull;
     405             :   }
     406             : 
     407             :   inline binding_detail::FakeString&
     408             :   RawSetAsString()
     409             :   {
     410             :     if (mType == eString) {
     411             :       return mValue.mString.Value();
     412             :     }
     413             :     MOZ_ASSERT(mType == eUninitialized);
     414             :     mType = eString;
     415             :     return mValue.mString.SetValue();
     416             :   }
     417             : 
     418             :   inline binding_detail::FakeString&
     419             :   SetAsString()
     420             :   {
     421             :     if (mType == eString) {
     422             :       return mValue.mString.Value();
     423             :     }
     424             :     Uninit();
     425             :     mType = eString;
     426             :     return mValue.mString.SetValue();
     427             :   }
     428             : 
     429             :   inline bool
     430             :   IsString() const
     431             :   {
     432             :     return mType == eString;
     433             :   }
     434             : 
     435             :   inline binding_detail::FakeString&
     436             :   GetAsString()
     437             :   {
     438             :     MOZ_ASSERT(IsString(), "Wrong type!");
     439             :     return mValue.mString.Value();
     440             :   }
     441             : 
     442             :   inline const nsAString&
     443             :   GetAsString() const
     444             :   {
     445             :     MOZ_ASSERT(IsString(), "Wrong type!");
     446             :     return mValue.mString.Value();
     447             :   }
     448             : 
     449             :   inline NonNull<mozilla::dom::TestInterfaceJS>&
     450             :   RawSetAsTestInterfaceJS()
     451             :   {
     452             :     if (mType == eTestInterfaceJS) {
     453             :       return mValue.mTestInterfaceJS.Value();
     454             :     }
     455             :     MOZ_ASSERT(mType == eUninitialized);
     456             :     mType = eTestInterfaceJS;
     457             :     return mValue.mTestInterfaceJS.SetValue();
     458             :   }
     459             : 
     460             :   inline NonNull<mozilla::dom::TestInterfaceJS>&
     461             :   SetAsTestInterfaceJS()
     462             :   {
     463             :     if (mType == eTestInterfaceJS) {
     464             :       return mValue.mTestInterfaceJS.Value();
     465             :     }
     466             :     Uninit();
     467             :     mType = eTestInterfaceJS;
     468             :     return mValue.mTestInterfaceJS.SetValue();
     469             :   }
     470             : 
     471             :   inline bool
     472             :   IsTestInterfaceJS() const
     473             :   {
     474             :     return mType == eTestInterfaceJS;
     475             :   }
     476             : 
     477             :   inline NonNull<mozilla::dom::TestInterfaceJS>&
     478             :   GetAsTestInterfaceJS()
     479             :   {
     480             :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
     481             :     return mValue.mTestInterfaceJS.Value();
     482             :   }
     483             : 
     484             :   inline mozilla::dom::TestInterfaceJS&
     485             :   GetAsTestInterfaceJS() const
     486             :   {
     487             :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
     488             :     return mValue.mTestInterfaceJS.Value();
     489             :   }
     490             : 
     491             :   inline void
     492             :   Uninit()
     493             :   {
     494             :     switch (mType) {
     495             :       case eUninitialized: {
     496             :         break;
     497             :       }
     498             :       case eNull: {
     499             :         break;
     500             :       }
     501             :       case eString: {
     502             :         DestroyString();
     503             :         break;
     504             :       }
     505             :       case eTestInterfaceJS: {
     506             :         DestroyTestInterfaceJS();
     507             :         break;
     508             :       }
     509             :     }
     510             :   }
     511             : 
     512             :   bool
     513             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     514             : 
     515             : private:
     516             :   inline void
     517             :   DestroyString()
     518             :   {
     519             :     MOZ_ASSERT(IsString(), "Wrong type!");
     520             :     mValue.mString.Destroy();
     521             :     mType = eUninitialized;
     522             :   }
     523             : 
     524             :   inline void
     525             :   DestroyTestInterfaceJS()
     526             :   {
     527             :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
     528             :     mValue.mTestInterfaceJS.Destroy();
     529             :     mType = eUninitialized;
     530             :   }
     531             : };
     532             : 
     533             : 
     534             : class OwningStringOrTestInterfaceJSOrNull : public AllOwningUnionBase
     535             : {
     536             :   friend void ImplCycleCollectionUnlink(OwningStringOrTestInterfaceJSOrNull& aUnion);
     537             :   enum Type
     538             :   {
     539             :     eUninitialized,
     540             :     eNull,
     541             :     eString,
     542             :     eTestInterfaceJS
     543             :   };
     544             : 
     545           0 :   union Value
     546             :   {
     547             :     UnionMember<nsString > mString;
     548             :     UnionMember<OwningNonNull<mozilla::dom::TestInterfaceJS> > mTestInterfaceJS;
     549             : 
     550             :   };
     551             : 
     552             :   Type mType;
     553             :   Value mValue;
     554             : 
     555             : public:
     556           0 :   explicit inline OwningStringOrTestInterfaceJSOrNull()
     557           0 :     : mType(eUninitialized)
     558             :   {
     559           0 :   }
     560             : 
     561             :   explicit inline OwningStringOrTestInterfaceJSOrNull(const OwningStringOrTestInterfaceJSOrNull& aOther)
     562             :     : mType(eUninitialized)
     563             :   {
     564             :     *this = aOther;
     565             :   }
     566             : 
     567           0 :   inline ~OwningStringOrTestInterfaceJSOrNull()
     568           0 :   {
     569           0 :     Uninit();
     570           0 :   }
     571             : 
     572             :   inline bool
     573             :   IsNull() const
     574             :   {
     575             :     return mType == eNull;
     576             :   }
     577             : 
     578             :   inline void
     579           0 :   SetNull()
     580             :   {
     581           0 :     Uninit();
     582           0 :     mType = eNull;
     583           0 :   }
     584             : 
     585             :   nsString&
     586             :   RawSetAsString();
     587             : 
     588             :   nsString&
     589             :   SetAsString();
     590             : 
     591             :   bool
     592             :   TrySetToString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     593             : 
     594             :   inline void
     595             :   SetStringData(const nsString::char_type* aData, nsString::size_type aLength)
     596             :   {
     597             :     RawSetAsString().Assign(aData, aLength);
     598             :   }
     599             : 
     600             :   inline bool
     601           0 :   IsString() const
     602             :   {
     603           0 :     return mType == eString;
     604             :   }
     605             : 
     606             :   inline nsString&
     607             :   GetAsString()
     608             :   {
     609             :     MOZ_ASSERT(IsString(), "Wrong type!");
     610             :     return mValue.mString.Value();
     611             :   }
     612             : 
     613             :   inline nsString const &
     614           0 :   GetAsString() const
     615             :   {
     616           0 :     MOZ_ASSERT(IsString(), "Wrong type!");
     617           0 :     return mValue.mString.Value();
     618             :   }
     619             : 
     620             :   OwningNonNull<mozilla::dom::TestInterfaceJS>&
     621             :   RawSetAsTestInterfaceJS();
     622             : 
     623             :   OwningNonNull<mozilla::dom::TestInterfaceJS>&
     624             :   SetAsTestInterfaceJS();
     625             : 
     626             :   bool
     627             :   TrySetToTestInterfaceJS(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     628             : 
     629             :   inline bool
     630           0 :   IsTestInterfaceJS() const
     631             :   {
     632           0 :     return mType == eTestInterfaceJS;
     633             :   }
     634             : 
     635             :   inline OwningNonNull<mozilla::dom::TestInterfaceJS>&
     636           0 :   GetAsTestInterfaceJS()
     637             :   {
     638           0 :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
     639           0 :     return mValue.mTestInterfaceJS.Value();
     640             :   }
     641             : 
     642             :   inline OwningNonNull<mozilla::dom::TestInterfaceJS> const &
     643           0 :   GetAsTestInterfaceJS() const
     644             :   {
     645           0 :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
     646           0 :     return mValue.mTestInterfaceJS.Value();
     647             :   }
     648             : 
     649             :   void
     650             :   Uninit();
     651             : 
     652             :   bool
     653             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     654             : 
     655             :   void
     656             :   TraceUnion(JSTracer* trc);
     657             : 
     658             :   OwningStringOrTestInterfaceJSOrNull&
     659             :   operator=(const OwningStringOrTestInterfaceJSOrNull& aOther);
     660             : 
     661             : private:
     662             :   void
     663             :   DestroyString();
     664             : 
     665             :   void
     666             :   DestroyTestInterfaceJS();
     667             : };
     668             : 
     669             : 
     670             : class StringSequenceOrString
     671             : {
     672             :   friend class StringSequenceOrStringArgument;
     673             :   enum Type
     674             :   {
     675             :     eUninitialized,
     676             :     eStringSequence,
     677             :     eString
     678             :   };
     679             : 
     680           0 :   union Value
     681             :   {
     682             :     UnionMember<binding_detail::AutoSequence<nsString> > mStringSequence;
     683             :     UnionMember<binding_detail::FakeString > mString;
     684             : 
     685             :   };
     686             : 
     687             :   Type mType;
     688             :   Value mValue;
     689             : 
     690             :   StringSequenceOrString(const StringSequenceOrString&) = delete;
     691             :   StringSequenceOrString& operator=(const StringSequenceOrString&) = delete;
     692             : public:
     693           0 :   explicit inline StringSequenceOrString()
     694           0 :     : mType(eUninitialized)
     695             :   {
     696           0 :   }
     697             : 
     698           0 :   inline ~StringSequenceOrString()
     699           0 :   {
     700           0 :     Uninit();
     701           0 :   }
     702             : 
     703             :   inline binding_detail::AutoSequence<nsString>&
     704             :   RawSetAsStringSequence()
     705             :   {
     706             :     if (mType == eStringSequence) {
     707             :       return mValue.mStringSequence.Value();
     708             :     }
     709             :     MOZ_ASSERT(mType == eUninitialized);
     710             :     mType = eStringSequence;
     711             :     return mValue.mStringSequence.SetValue();
     712             :   }
     713             : 
     714             :   inline binding_detail::AutoSequence<nsString>&
     715             :   SetAsStringSequence()
     716             :   {
     717             :     if (mType == eStringSequence) {
     718             :       return mValue.mStringSequence.Value();
     719             :     }
     720             :     Uninit();
     721             :     mType = eStringSequence;
     722             :     return mValue.mStringSequence.SetValue();
     723             :   }
     724             : 
     725             :   inline bool
     726           0 :   IsStringSequence() const
     727             :   {
     728           0 :     return mType == eStringSequence;
     729             :   }
     730             : 
     731             :   inline binding_detail::AutoSequence<nsString>&
     732             :   GetAsStringSequence()
     733             :   {
     734             :     MOZ_ASSERT(IsStringSequence(), "Wrong type!");
     735             :     return mValue.mStringSequence.Value();
     736             :   }
     737             : 
     738             :   inline const Sequence<nsString>&
     739             :   GetAsStringSequence() const
     740             :   {
     741             :     MOZ_ASSERT(IsStringSequence(), "Wrong type!");
     742             :     return mValue.mStringSequence.Value();
     743             :   }
     744             : 
     745             :   inline binding_detail::FakeString&
     746             :   RawSetAsString()
     747             :   {
     748             :     if (mType == eString) {
     749             :       return mValue.mString.Value();
     750             :     }
     751             :     MOZ_ASSERT(mType == eUninitialized);
     752             :     mType = eString;
     753             :     return mValue.mString.SetValue();
     754             :   }
     755             : 
     756             :   inline binding_detail::FakeString&
     757             :   SetAsString()
     758             :   {
     759             :     if (mType == eString) {
     760             :       return mValue.mString.Value();
     761             :     }
     762             :     Uninit();
     763             :     mType = eString;
     764             :     return mValue.mString.SetValue();
     765             :   }
     766             : 
     767             :   inline bool
     768           0 :   IsString() const
     769             :   {
     770           0 :     return mType == eString;
     771             :   }
     772             : 
     773             :   inline binding_detail::FakeString&
     774             :   GetAsString()
     775             :   {
     776             :     MOZ_ASSERT(IsString(), "Wrong type!");
     777             :     return mValue.mString.Value();
     778             :   }
     779             : 
     780             :   inline const nsAString&
     781             :   GetAsString() const
     782             :   {
     783             :     MOZ_ASSERT(IsString(), "Wrong type!");
     784             :     return mValue.mString.Value();
     785             :   }
     786             : 
     787             :   inline void
     788           0 :   Uninit()
     789             :   {
     790           0 :     switch (mType) {
     791             :       case eUninitialized: {
     792           0 :         break;
     793             :       }
     794             :       case eStringSequence: {
     795           0 :         DestroyStringSequence();
     796           0 :         break;
     797             :       }
     798             :       case eString: {
     799           0 :         DestroyString();
     800           0 :         break;
     801             :       }
     802             :     }
     803           0 :   }
     804             : 
     805             :   bool
     806             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     807             : 
     808             : private:
     809             :   inline void
     810           0 :   DestroyStringSequence()
     811             :   {
     812           0 :     MOZ_ASSERT(IsStringSequence(), "Wrong type!");
     813           0 :     mValue.mStringSequence.Destroy();
     814           0 :     mType = eUninitialized;
     815           0 :   }
     816             : 
     817             :   inline void
     818           0 :   DestroyString()
     819             :   {
     820           0 :     MOZ_ASSERT(IsString(), "Wrong type!");
     821           0 :     mValue.mString.Destroy();
     822           0 :     mType = eUninitialized;
     823           0 :   }
     824             : };
     825             : 
     826             : 
     827             : class OwningStringSequenceOrString : public AllOwningUnionBase
     828             : {
     829             :   friend void ImplCycleCollectionUnlink(OwningStringSequenceOrString& aUnion);
     830             :   enum Type
     831             :   {
     832             :     eUninitialized,
     833             :     eStringSequence,
     834             :     eString
     835             :   };
     836             : 
     837             :   union Value
     838             :   {
     839             :     UnionMember<Sequence<nsString> > mStringSequence;
     840             :     UnionMember<nsString > mString;
     841             : 
     842             :   };
     843             : 
     844             :   Type mType;
     845             :   Value mValue;
     846             : 
     847             : public:
     848             :   explicit inline OwningStringSequenceOrString()
     849             :     : mType(eUninitialized)
     850             :   {
     851             :   }
     852             : 
     853             :   explicit inline OwningStringSequenceOrString(const OwningStringSequenceOrString& aOther)
     854             :     : mType(eUninitialized)
     855             :   {
     856             :     *this = aOther;
     857             :   }
     858             : 
     859             :   inline ~OwningStringSequenceOrString()
     860             :   {
     861             :     Uninit();
     862             :   }
     863             : 
     864             :   Sequence<nsString>&
     865             :   RawSetAsStringSequence();
     866             : 
     867             :   Sequence<nsString>&
     868             :   SetAsStringSequence();
     869             : 
     870             :   bool
     871             :   TrySetToStringSequence(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     872             : 
     873             :   inline bool
     874           0 :   IsStringSequence() const
     875             :   {
     876           0 :     return mType == eStringSequence;
     877             :   }
     878             : 
     879             :   inline Sequence<nsString>&
     880             :   GetAsStringSequence()
     881             :   {
     882             :     MOZ_ASSERT(IsStringSequence(), "Wrong type!");
     883             :     return mValue.mStringSequence.Value();
     884             :   }
     885             : 
     886             :   inline Sequence<nsString> const &
     887           0 :   GetAsStringSequence() const
     888             :   {
     889           0 :     MOZ_ASSERT(IsStringSequence(), "Wrong type!");
     890           0 :     return mValue.mStringSequence.Value();
     891             :   }
     892             : 
     893             :   nsString&
     894             :   RawSetAsString();
     895             : 
     896             :   nsString&
     897             :   SetAsString();
     898             : 
     899             :   bool
     900             :   TrySetToString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     901             : 
     902             :   inline void
     903             :   SetStringData(const nsString::char_type* aData, nsString::size_type aLength)
     904             :   {
     905             :     RawSetAsString().Assign(aData, aLength);
     906             :   }
     907             : 
     908             :   inline bool
     909           0 :   IsString() const
     910             :   {
     911           0 :     return mType == eString;
     912             :   }
     913             : 
     914             :   inline nsString&
     915             :   GetAsString()
     916             :   {
     917             :     MOZ_ASSERT(IsString(), "Wrong type!");
     918             :     return mValue.mString.Value();
     919             :   }
     920             : 
     921             :   inline nsString const &
     922           0 :   GetAsString() const
     923             :   {
     924           0 :     MOZ_ASSERT(IsString(), "Wrong type!");
     925           0 :     return mValue.mString.Value();
     926             :   }
     927             : 
     928             :   void
     929             :   Uninit();
     930             : 
     931             :   bool
     932             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     933             : 
     934             :   void
     935             :   TraceUnion(JSTracer* trc);
     936             : 
     937             :   OwningStringSequenceOrString&
     938             :   operator=(const OwningStringSequenceOrString& aOther);
     939             : 
     940             : private:
     941             :   void
     942             :   DestroyStringSequence();
     943             : 
     944             :   void
     945             :   DestroyString();
     946             : };
     947             : 
     948             : 
     949             : class TestInterfaceJSOrLong
     950             : {
     951             :   friend class TestInterfaceJSOrLongArgument;
     952             :   enum Type
     953             :   {
     954             :     eUninitialized,
     955             :     eTestInterfaceJS,
     956             :     eLong
     957             :   };
     958             : 
     959           0 :   union Value
     960             :   {
     961             :     UnionMember<NonNull<mozilla::dom::TestInterfaceJS> > mTestInterfaceJS;
     962             :     UnionMember<int32_t > mLong;
     963             : 
     964             :   };
     965             : 
     966             :   Type mType;
     967             :   Value mValue;
     968             : 
     969             :   TestInterfaceJSOrLong(const TestInterfaceJSOrLong&) = delete;
     970             :   TestInterfaceJSOrLong& operator=(const TestInterfaceJSOrLong&) = delete;
     971             : public:
     972           0 :   explicit inline TestInterfaceJSOrLong()
     973           0 :     : mType(eUninitialized)
     974             :   {
     975           0 :   }
     976             : 
     977           0 :   inline ~TestInterfaceJSOrLong()
     978           0 :   {
     979           0 :     Uninit();
     980           0 :   }
     981             : 
     982             :   inline NonNull<mozilla::dom::TestInterfaceJS>&
     983             :   RawSetAsTestInterfaceJS()
     984             :   {
     985             :     if (mType == eTestInterfaceJS) {
     986             :       return mValue.mTestInterfaceJS.Value();
     987             :     }
     988             :     MOZ_ASSERT(mType == eUninitialized);
     989             :     mType = eTestInterfaceJS;
     990             :     return mValue.mTestInterfaceJS.SetValue();
     991             :   }
     992             : 
     993             :   inline NonNull<mozilla::dom::TestInterfaceJS>&
     994             :   SetAsTestInterfaceJS()
     995             :   {
     996             :     if (mType == eTestInterfaceJS) {
     997             :       return mValue.mTestInterfaceJS.Value();
     998             :     }
     999             :     Uninit();
    1000             :     mType = eTestInterfaceJS;
    1001             :     return mValue.mTestInterfaceJS.SetValue();
    1002             :   }
    1003             : 
    1004             :   inline bool
    1005           0 :   IsTestInterfaceJS() const
    1006             :   {
    1007           0 :     return mType == eTestInterfaceJS;
    1008             :   }
    1009             : 
    1010             :   inline NonNull<mozilla::dom::TestInterfaceJS>&
    1011             :   GetAsTestInterfaceJS()
    1012             :   {
    1013             :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
    1014             :     return mValue.mTestInterfaceJS.Value();
    1015             :   }
    1016             : 
    1017             :   inline mozilla::dom::TestInterfaceJS&
    1018             :   GetAsTestInterfaceJS() const
    1019             :   {
    1020             :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
    1021             :     return mValue.mTestInterfaceJS.Value();
    1022             :   }
    1023             : 
    1024             :   inline int32_t&
    1025             :   RawSetAsLong()
    1026             :   {
    1027             :     if (mType == eLong) {
    1028             :       return mValue.mLong.Value();
    1029             :     }
    1030             :     MOZ_ASSERT(mType == eUninitialized);
    1031             :     mType = eLong;
    1032             :     return mValue.mLong.SetValue();
    1033             :   }
    1034             : 
    1035             :   inline int32_t&
    1036             :   SetAsLong()
    1037             :   {
    1038             :     if (mType == eLong) {
    1039             :       return mValue.mLong.Value();
    1040             :     }
    1041             :     Uninit();
    1042             :     mType = eLong;
    1043             :     return mValue.mLong.SetValue();
    1044             :   }
    1045             : 
    1046             :   inline bool
    1047           0 :   IsLong() const
    1048             :   {
    1049           0 :     return mType == eLong;
    1050             :   }
    1051             : 
    1052             :   inline int32_t&
    1053             :   GetAsLong()
    1054             :   {
    1055             :     MOZ_ASSERT(IsLong(), "Wrong type!");
    1056             :     return mValue.mLong.Value();
    1057             :   }
    1058             : 
    1059             :   inline int32_t
    1060             :   GetAsLong() const
    1061             :   {
    1062             :     MOZ_ASSERT(IsLong(), "Wrong type!");
    1063             :     return mValue.mLong.Value();
    1064             :   }
    1065             : 
    1066             :   inline void
    1067           0 :   Uninit()
    1068             :   {
    1069           0 :     switch (mType) {
    1070             :       case eUninitialized: {
    1071           0 :         break;
    1072             :       }
    1073             :       case eTestInterfaceJS: {
    1074           0 :         DestroyTestInterfaceJS();
    1075           0 :         break;
    1076             :       }
    1077             :       case eLong: {
    1078           0 :         DestroyLong();
    1079           0 :         break;
    1080             :       }
    1081             :     }
    1082           0 :   }
    1083             : 
    1084             :   bool
    1085             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
    1086             : 
    1087             : private:
    1088             :   inline void
    1089           0 :   DestroyTestInterfaceJS()
    1090             :   {
    1091           0 :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
    1092           0 :     mValue.mTestInterfaceJS.Destroy();
    1093           0 :     mType = eUninitialized;
    1094           0 :   }
    1095             : 
    1096             :   inline void
    1097           0 :   DestroyLong()
    1098             :   {
    1099           0 :     MOZ_ASSERT(IsLong(), "Wrong type!");
    1100           0 :     mValue.mLong.Destroy();
    1101           0 :     mType = eUninitialized;
    1102           0 :   }
    1103             : };
    1104             : 
    1105             : 
    1106             : class OwningTestInterfaceJSOrLong : public AllOwningUnionBase
    1107             : {
    1108             :   friend void ImplCycleCollectionUnlink(OwningTestInterfaceJSOrLong& aUnion);
    1109             :   enum Type
    1110             :   {
    1111             :     eUninitialized,
    1112             :     eTestInterfaceJS,
    1113             :     eLong
    1114             :   };
    1115             : 
    1116           0 :   union Value
    1117             :   {
    1118             :     UnionMember<OwningNonNull<mozilla::dom::TestInterfaceJS> > mTestInterfaceJS;
    1119             :     UnionMember<int32_t > mLong;
    1120             : 
    1121             :   };
    1122             : 
    1123             :   Type mType;
    1124             :   Value mValue;
    1125             : 
    1126             : public:
    1127           0 :   explicit inline OwningTestInterfaceJSOrLong()
    1128           0 :     : mType(eUninitialized)
    1129             :   {
    1130           0 :   }
    1131             : 
    1132             :   explicit inline OwningTestInterfaceJSOrLong(const OwningTestInterfaceJSOrLong& aOther)
    1133             :     : mType(eUninitialized)
    1134             :   {
    1135             :     *this = aOther;
    1136             :   }
    1137             : 
    1138           0 :   inline ~OwningTestInterfaceJSOrLong()
    1139           0 :   {
    1140           0 :     Uninit();
    1141           0 :   }
    1142             : 
    1143             :   OwningNonNull<mozilla::dom::TestInterfaceJS>&
    1144             :   RawSetAsTestInterfaceJS();
    1145             : 
    1146             :   OwningNonNull<mozilla::dom::TestInterfaceJS>&
    1147             :   SetAsTestInterfaceJS();
    1148             : 
    1149             :   bool
    1150             :   TrySetToTestInterfaceJS(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
    1151             : 
    1152             :   inline bool
    1153           0 :   IsTestInterfaceJS() const
    1154             :   {
    1155           0 :     return mType == eTestInterfaceJS;
    1156             :   }
    1157             : 
    1158             :   inline OwningNonNull<mozilla::dom::TestInterfaceJS>&
    1159           0 :   GetAsTestInterfaceJS()
    1160             :   {
    1161           0 :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
    1162           0 :     return mValue.mTestInterfaceJS.Value();
    1163             :   }
    1164             : 
    1165             :   inline OwningNonNull<mozilla::dom::TestInterfaceJS> const &
    1166           0 :   GetAsTestInterfaceJS() const
    1167             :   {
    1168           0 :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
    1169           0 :     return mValue.mTestInterfaceJS.Value();
    1170             :   }
    1171             : 
    1172             :   int32_t&
    1173             :   RawSetAsLong();
    1174             : 
    1175             :   int32_t&
    1176             :   SetAsLong();
    1177             : 
    1178             :   bool
    1179             :   TrySetToLong(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
    1180             : 
    1181             :   inline bool
    1182           0 :   IsLong() const
    1183             :   {
    1184           0 :     return mType == eLong;
    1185             :   }
    1186             : 
    1187             :   inline int32_t&
    1188             :   GetAsLong()
    1189             :   {
    1190             :     MOZ_ASSERT(IsLong(), "Wrong type!");
    1191             :     return mValue.mLong.Value();
    1192             :   }
    1193             : 
    1194             :   inline int32_t const &
    1195           0 :   GetAsLong() const
    1196             :   {
    1197           0 :     MOZ_ASSERT(IsLong(), "Wrong type!");
    1198           0 :     return mValue.mLong.Value();
    1199             :   }
    1200             : 
    1201             :   void
    1202             :   Uninit();
    1203             : 
    1204             :   bool
    1205             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
    1206             : 
    1207             :   void
    1208             :   TraceUnion(JSTracer* trc);
    1209             : 
    1210             :   OwningTestInterfaceJSOrLong&
    1211             :   operator=(const OwningTestInterfaceJSOrLong& aOther);
    1212             : 
    1213             : private:
    1214             :   void
    1215             :   DestroyTestInterfaceJS();
    1216             : 
    1217             :   void
    1218             :   DestroyLong();
    1219             : };
    1220             : 
    1221             : 
    1222             : class TestInterfaceJSOrNullOrString
    1223             : {
    1224             :   friend class TestInterfaceJSOrNullOrStringArgument;
    1225             :   enum Type
    1226             :   {
    1227             :     eUninitialized,
    1228             :     eNull,
    1229             :     eTestInterfaceJS,
    1230             :     eString
    1231             :   };
    1232             : 
    1233           0 :   union Value
    1234             :   {
    1235             :     UnionMember<NonNull<mozilla::dom::TestInterfaceJS> > mTestInterfaceJS;
    1236             :     UnionMember<binding_detail::FakeString > mString;
    1237             : 
    1238             :   };
    1239             : 
    1240             :   Type mType;
    1241             :   Value mValue;
    1242             : 
    1243             :   TestInterfaceJSOrNullOrString(const TestInterfaceJSOrNullOrString&) = delete;
    1244             :   TestInterfaceJSOrNullOrString& operator=(const TestInterfaceJSOrNullOrString&) = delete;
    1245             : public:
    1246           0 :   explicit inline TestInterfaceJSOrNullOrString()
    1247           0 :     : mType(eUninitialized)
    1248             :   {
    1249           0 :   }
    1250             : 
    1251           0 :   inline ~TestInterfaceJSOrNullOrString()
    1252           0 :   {
    1253           0 :     Uninit();
    1254           0 :   }
    1255             : 
    1256             :   inline bool
    1257             :   IsNull() const
    1258             :   {
    1259             :     return mType == eNull;
    1260             :   }
    1261             : 
    1262             :   inline void
    1263             :   SetNull()
    1264             :   {
    1265             :     Uninit();
    1266             :     mType = eNull;
    1267             :   }
    1268             : 
    1269             :   inline NonNull<mozilla::dom::TestInterfaceJS>&
    1270             :   RawSetAsTestInterfaceJS()
    1271             :   {
    1272             :     if (mType == eTestInterfaceJS) {
    1273             :       return mValue.mTestInterfaceJS.Value();
    1274             :     }
    1275             :     MOZ_ASSERT(mType == eUninitialized);
    1276             :     mType = eTestInterfaceJS;
    1277             :     return mValue.mTestInterfaceJS.SetValue();
    1278             :   }
    1279             : 
    1280             :   inline NonNull<mozilla::dom::TestInterfaceJS>&
    1281             :   SetAsTestInterfaceJS()
    1282             :   {
    1283             :     if (mType == eTestInterfaceJS) {
    1284             :       return mValue.mTestInterfaceJS.Value();
    1285             :     }
    1286             :     Uninit();
    1287             :     mType = eTestInterfaceJS;
    1288             :     return mValue.mTestInterfaceJS.SetValue();
    1289             :   }
    1290             : 
    1291             :   inline bool
    1292           0 :   IsTestInterfaceJS() const
    1293             :   {
    1294           0 :     return mType == eTestInterfaceJS;
    1295             :   }
    1296             : 
    1297             :   inline NonNull<mozilla::dom::TestInterfaceJS>&
    1298             :   GetAsTestInterfaceJS()
    1299             :   {
    1300             :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
    1301             :     return mValue.mTestInterfaceJS.Value();
    1302             :   }
    1303             : 
    1304             :   inline mozilla::dom::TestInterfaceJS&
    1305             :   GetAsTestInterfaceJS() const
    1306             :   {
    1307             :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
    1308             :     return mValue.mTestInterfaceJS.Value();
    1309             :   }
    1310             : 
    1311             :   inline binding_detail::FakeString&
    1312             :   RawSetAsString()
    1313             :   {
    1314             :     if (mType == eString) {
    1315             :       return mValue.mString.Value();
    1316             :     }
    1317             :     MOZ_ASSERT(mType == eUninitialized);
    1318             :     mType = eString;
    1319             :     return mValue.mString.SetValue();
    1320             :   }
    1321             : 
    1322             :   inline binding_detail::FakeString&
    1323             :   SetAsString()
    1324             :   {
    1325             :     if (mType == eString) {
    1326             :       return mValue.mString.Value();
    1327             :     }
    1328             :     Uninit();
    1329             :     mType = eString;
    1330             :     return mValue.mString.SetValue();
    1331             :   }
    1332             : 
    1333             :   inline bool
    1334           0 :   IsString() const
    1335             :   {
    1336           0 :     return mType == eString;
    1337             :   }
    1338             : 
    1339             :   inline binding_detail::FakeString&
    1340             :   GetAsString()
    1341             :   {
    1342             :     MOZ_ASSERT(IsString(), "Wrong type!");
    1343             :     return mValue.mString.Value();
    1344             :   }
    1345             : 
    1346             :   inline const nsAString&
    1347             :   GetAsString() const
    1348             :   {
    1349             :     MOZ_ASSERT(IsString(), "Wrong type!");
    1350             :     return mValue.mString.Value();
    1351             :   }
    1352             : 
    1353             :   inline void
    1354           0 :   Uninit()
    1355             :   {
    1356           0 :     switch (mType) {
    1357             :       case eUninitialized: {
    1358           0 :         break;
    1359             :       }
    1360             :       case eNull: {
    1361           0 :         break;
    1362             :       }
    1363             :       case eTestInterfaceJS: {
    1364           0 :         DestroyTestInterfaceJS();
    1365           0 :         break;
    1366             :       }
    1367             :       case eString: {
    1368           0 :         DestroyString();
    1369           0 :         break;
    1370             :       }
    1371             :     }
    1372           0 :   }
    1373             : 
    1374             :   bool
    1375             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
    1376             : 
    1377             : private:
    1378             :   inline void
    1379           0 :   DestroyTestInterfaceJS()
    1380             :   {
    1381           0 :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
    1382           0 :     mValue.mTestInterfaceJS.Destroy();
    1383           0 :     mType = eUninitialized;
    1384           0 :   }
    1385             : 
    1386             :   inline void
    1387           0 :   DestroyString()
    1388             :   {
    1389           0 :     MOZ_ASSERT(IsString(), "Wrong type!");
    1390           0 :     mValue.mString.Destroy();
    1391           0 :     mType = eUninitialized;
    1392           0 :   }
    1393             : };
    1394             : 
    1395             : 
    1396             : class OwningTestInterfaceJSOrNullOrString : public AllOwningUnionBase
    1397             : {
    1398             :   friend void ImplCycleCollectionUnlink(OwningTestInterfaceJSOrNullOrString& aUnion);
    1399             :   enum Type
    1400             :   {
    1401             :     eUninitialized,
    1402             :     eNull,
    1403             :     eTestInterfaceJS,
    1404             :     eString
    1405             :   };
    1406             : 
    1407             :   union Value
    1408             :   {
    1409             :     UnionMember<OwningNonNull<mozilla::dom::TestInterfaceJS> > mTestInterfaceJS;
    1410             :     UnionMember<nsString > mString;
    1411             : 
    1412             :   };
    1413             : 
    1414             :   Type mType;
    1415             :   Value mValue;
    1416             : 
    1417             : public:
    1418             :   explicit inline OwningTestInterfaceJSOrNullOrString()
    1419             :     : mType(eUninitialized)
    1420             :   {
    1421             :   }
    1422             : 
    1423             :   explicit inline OwningTestInterfaceJSOrNullOrString(const OwningTestInterfaceJSOrNullOrString& aOther)
    1424             :     : mType(eUninitialized)
    1425             :   {
    1426             :     *this = aOther;
    1427             :   }
    1428             : 
    1429             :   inline ~OwningTestInterfaceJSOrNullOrString()
    1430             :   {
    1431             :     Uninit();
    1432             :   }
    1433             : 
    1434             :   inline bool
    1435             :   IsNull() const
    1436             :   {
    1437             :     return mType == eNull;
    1438             :   }
    1439             : 
    1440             :   inline void
    1441             :   SetNull()
    1442             :   {
    1443             :     Uninit();
    1444             :     mType = eNull;
    1445             :   }
    1446             : 
    1447             :   OwningNonNull<mozilla::dom::TestInterfaceJS>&
    1448             :   RawSetAsTestInterfaceJS();
    1449             : 
    1450             :   OwningNonNull<mozilla::dom::TestInterfaceJS>&
    1451             :   SetAsTestInterfaceJS();
    1452             : 
    1453             :   bool
    1454             :   TrySetToTestInterfaceJS(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
    1455             : 
    1456             :   inline bool
    1457           0 :   IsTestInterfaceJS() const
    1458             :   {
    1459           0 :     return mType == eTestInterfaceJS;
    1460             :   }
    1461             : 
    1462             :   inline OwningNonNull<mozilla::dom::TestInterfaceJS>&
    1463           0 :   GetAsTestInterfaceJS()
    1464             :   {
    1465           0 :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
    1466           0 :     return mValue.mTestInterfaceJS.Value();
    1467             :   }
    1468             : 
    1469             :   inline OwningNonNull<mozilla::dom::TestInterfaceJS> const &
    1470           0 :   GetAsTestInterfaceJS() const
    1471             :   {
    1472           0 :     MOZ_ASSERT(IsTestInterfaceJS(), "Wrong type!");
    1473           0 :     return mValue.mTestInterfaceJS.Value();
    1474             :   }
    1475             : 
    1476             :   nsString&
    1477             :   RawSetAsString();
    1478             : 
    1479             :   nsString&
    1480             :   SetAsString();
    1481             : 
    1482             :   bool
    1483             :   TrySetToString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
    1484             : 
    1485             :   inline void
    1486             :   SetStringData(const nsString::char_type* aData, nsString::size_type aLength)
    1487             :   {
    1488             :     RawSetAsString().Assign(aData, aLength);
    1489             :   }
    1490             : 
    1491             :   inline bool
    1492           0 :   IsString() const
    1493             :   {
    1494           0 :     return mType == eString;
    1495             :   }
    1496             : 
    1497             :   inline nsString&
    1498             :   GetAsString()
    1499             :   {
    1500             :     MOZ_ASSERT(IsString(), "Wrong type!");
    1501             :     return mValue.mString.Value();
    1502             :   }
    1503             : 
    1504             :   inline nsString const &
    1505           0 :   GetAsString() const
    1506             :   {
    1507           0 :     MOZ_ASSERT(IsString(), "Wrong type!");
    1508           0 :     return mValue.mString.Value();
    1509             :   }
    1510             : 
    1511             :   void
    1512             :   Uninit();
    1513             : 
    1514             :   bool
    1515             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
    1516             : 
    1517             :   void
    1518             :   TraceUnion(JSTracer* trc);
    1519             : 
    1520             :   OwningTestInterfaceJSOrNullOrString&
    1521             :   operator=(const OwningTestInterfaceJSOrNullOrString& aOther);
    1522             : 
    1523             : private:
    1524             :   void
    1525             :   DestroyTestInterfaceJS();
    1526             : 
    1527             :   void
    1528             :   DestroyString();
    1529             : };
    1530             : 
    1531             : 
    1532           0 : struct TestInterfaceJSUnionableDictionary : public DictionaryBase
    1533             : {
    1534             :   MOZ_INIT_OUTSIDE_CTOR JS::Value mAnyMember;
    1535             :   MOZ_INIT_OUTSIDE_CTOR Optional<JSObject*> mObjectMember;
    1536             : 
    1537             :   TestInterfaceJSUnionableDictionary();
    1538             : 
    1539           0 :   explicit inline TestInterfaceJSUnionableDictionary(const FastDictionaryInitializer& )
    1540           0 :     : mAnyMember(JS::UndefinedValue())
    1541             :   {
    1542             :     // Do nothing here; this is used by our "Fast" subclass
    1543           0 :   }
    1544             : 
    1545             : private:
    1546             :   TestInterfaceJSUnionableDictionary(const TestInterfaceJSUnionableDictionary&) = delete;
    1547             :   TestInterfaceJSUnionableDictionary& operator=(const TestInterfaceJSUnionableDictionary&) = delete;
    1548             : 
    1549             :   static bool
    1550             :   InitIds(JSContext* cx, TestInterfaceJSUnionableDictionaryAtoms* atomsCache);
    1551             : 
    1552             : public:
    1553             :   bool
    1554             :   Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
    1555             : 
    1556             :   bool
    1557             :   ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
    1558             : 
    1559             :   void
    1560             :   TraceDictionary(JSTracer* trc);
    1561             : };
    1562             : 
    1563             : namespace binding_detail {
    1564           0 : struct FastTestInterfaceJSUnionableDictionary : public TestInterfaceJSUnionableDictionary
    1565             : {
    1566           0 :   inline FastTestInterfaceJSUnionableDictionary()
    1567           0 :     : TestInterfaceJSUnionableDictionary(FastDictionaryInitializer())
    1568             :   {
    1569             :     // Doesn't matter what int we pass to the parent constructor
    1570           0 :   }
    1571             : };
    1572             : } // namespace binding_detail
    1573             : 
    1574             : 
    1575             : class TestInterfaceJSUnionableDictionaryOrLong
    1576             : {
    1577             :   friend class TestInterfaceJSUnionableDictionaryOrLongArgument;
    1578             :   enum Type
    1579             :   {
    1580             :     eUninitialized,
    1581             :     eTestInterfaceJSUnionableDictionary,
    1582             :     eLong
    1583             :   };
    1584             : 
    1585           0 :   union Value
    1586             :   {
    1587             :     UnionMember<RootedDictionary<binding_detail::FastTestInterfaceJSUnionableDictionary> > mTestInterfaceJSUnionableDictionary;
    1588             :     UnionMember<int32_t > mLong;
    1589             : 
    1590             :   };
    1591             : 
    1592             :   Type mType;
    1593             :   Value mValue;
    1594             : 
    1595             :   TestInterfaceJSUnionableDictionaryOrLong(const TestInterfaceJSUnionableDictionaryOrLong&) = delete;
    1596             :   TestInterfaceJSUnionableDictionaryOrLong& operator=(const TestInterfaceJSUnionableDictionaryOrLong&) = delete;
    1597             : public:
    1598           0 :   explicit inline TestInterfaceJSUnionableDictionaryOrLong()
    1599           0 :     : mType(eUninitialized)
    1600             :   {
    1601           0 :   }
    1602             : 
    1603           0 :   inline ~TestInterfaceJSUnionableDictionaryOrLong()
    1604           0 :   {
    1605           0 :     Uninit();
    1606           0 :   }
    1607             : 
    1608             :   inline RootedDictionary<binding_detail::FastTestInterfaceJSUnionableDictionary>&
    1609           0 :   RawSetAsTestInterfaceJSUnionableDictionary(JSContext* cx)
    1610             :   {
    1611           0 :     if (mType == eTestInterfaceJSUnionableDictionary) {
    1612           0 :       return mValue.mTestInterfaceJSUnionableDictionary.Value();
    1613             :     }
    1614           0 :     MOZ_ASSERT(mType == eUninitialized);
    1615           0 :     mType = eTestInterfaceJSUnionableDictionary;
    1616           0 :     return mValue.mTestInterfaceJSUnionableDictionary.SetValue(cx);
    1617             :   }
    1618             : 
    1619             :   inline RootedDictionary<binding_detail::FastTestInterfaceJSUnionableDictionary>&
    1620             :   SetAsTestInterfaceJSUnionableDictionary(JSContext* cx)
    1621             :   {
    1622             :     if (mType == eTestInterfaceJSUnionableDictionary) {
    1623             :       return mValue.mTestInterfaceJSUnionableDictionary.Value();
    1624             :     }
    1625             :     Uninit();
    1626             :     mType = eTestInterfaceJSUnionableDictionary;
    1627             :     return mValue.mTestInterfaceJSUnionableDictionary.SetValue(cx);
    1628             :   }
    1629             : 
    1630             :   inline bool
    1631           0 :   IsTestInterfaceJSUnionableDictionary() const
    1632             :   {
    1633           0 :     return mType == eTestInterfaceJSUnionableDictionary;
    1634             :   }
    1635             : 
    1636             :   inline RootedDictionary<binding_detail::FastTestInterfaceJSUnionableDictionary>&
    1637             :   GetAsTestInterfaceJSUnionableDictionary()
    1638             :   {
    1639             :     MOZ_ASSERT(IsTestInterfaceJSUnionableDictionary(), "Wrong type!");
    1640             :     return mValue.mTestInterfaceJSUnionableDictionary.Value();
    1641             :   }
    1642             : 
    1643             :   inline const TestInterfaceJSUnionableDictionary&
    1644             :   GetAsTestInterfaceJSUnionableDictionary() const
    1645             :   {
    1646             :     MOZ_ASSERT(IsTestInterfaceJSUnionableDictionary(), "Wrong type!");
    1647             :     return mValue.mTestInterfaceJSUnionableDictionary.Value();
    1648             :   }
    1649             : 
    1650             :   inline int32_t&
    1651             :   RawSetAsLong()
    1652             :   {
    1653             :     if (mType == eLong) {
    1654             :       return mValue.mLong.Value();
    1655             :     }
    1656             :     MOZ_ASSERT(mType == eUninitialized);
    1657             :     mType = eLong;
    1658             :     return mValue.mLong.SetValue();
    1659             :   }
    1660             : 
    1661             :   inline int32_t&
    1662             :   SetAsLong()
    1663             :   {
    1664             :     if (mType == eLong) {
    1665             :       return mValue.mLong.Value();
    1666             :     }
    1667             :     Uninit();
    1668             :     mType = eLong;
    1669             :     return mValue.mLong.SetValue();
    1670             :   }
    1671             : 
    1672             :   inline bool
    1673           0 :   IsLong() const
    1674             :   {
    1675           0 :     return mType == eLong;
    1676             :   }
    1677             : 
    1678             :   inline int32_t&
    1679             :   GetAsLong()
    1680             :   {
    1681             :     MOZ_ASSERT(IsLong(), "Wrong type!");
    1682             :     return mValue.mLong.Value();
    1683             :   }
    1684             : 
    1685             :   inline int32_t
    1686             :   GetAsLong() const
    1687             :   {
    1688             :     MOZ_ASSERT(IsLong(), "Wrong type!");
    1689             :     return mValue.mLong.Value();
    1690             :   }
    1691             : 
    1692             :   inline void
    1693           0 :   Uninit()
    1694             :   {
    1695           0 :     switch (mType) {
    1696             :       case eUninitialized: {
    1697           0 :         break;
    1698             :       }
    1699             :       case eTestInterfaceJSUnionableDictionary: {
    1700           0 :         DestroyTestInterfaceJSUnionableDictionary();
    1701           0 :         break;
    1702             :       }
    1703             :       case eLong: {
    1704           0 :         DestroyLong();
    1705           0 :         break;
    1706             :       }
    1707             :     }
    1708           0 :   }
    1709             : 
    1710             :   bool
    1711             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
    1712             : 
    1713             : private:
    1714             :   inline void
    1715           0 :   DestroyTestInterfaceJSUnionableDictionary()
    1716             :   {
    1717           0 :     MOZ_ASSERT(IsTestInterfaceJSUnionableDictionary(), "Wrong type!");
    1718           0 :     mValue.mTestInterfaceJSUnionableDictionary.Destroy();
    1719           0 :     mType = eUninitialized;
    1720           0 :   }
    1721             : 
    1722             :   inline void
    1723           0 :   DestroyLong()
    1724             :   {
    1725           0 :     MOZ_ASSERT(IsLong(), "Wrong type!");
    1726           0 :     mValue.mLong.Destroy();
    1727           0 :     mType = eUninitialized;
    1728           0 :   }
    1729             : };
    1730             : 
    1731             : 
    1732             : class OwningTestInterfaceJSUnionableDictionaryOrLong : public AllOwningUnionBase
    1733             : {
    1734             :   friend void ImplCycleCollectionUnlink(OwningTestInterfaceJSUnionableDictionaryOrLong& aUnion);
    1735             :   enum Type
    1736             :   {
    1737             :     eUninitialized,
    1738             :     eTestInterfaceJSUnionableDictionary,
    1739             :     eLong
    1740             :   };
    1741             : 
    1742             :   union Value
    1743             :   {
    1744             :     UnionMember<TestInterfaceJSUnionableDictionary > mTestInterfaceJSUnionableDictionary;
    1745             :     UnionMember<int32_t > mLong;
    1746             : 
    1747             :   };
    1748             : 
    1749             :   Type mType;
    1750             :   Value mValue;
    1751             : 
    1752             :   OwningTestInterfaceJSUnionableDictionaryOrLong(const OwningTestInterfaceJSUnionableDictionaryOrLong&) = delete;
    1753             :   OwningTestInterfaceJSUnionableDictionaryOrLong& operator=(const OwningTestInterfaceJSUnionableDictionaryOrLong&) = delete;
    1754             : public:
    1755             :   explicit inline OwningTestInterfaceJSUnionableDictionaryOrLong()
    1756             :     : mType(eUninitialized)
    1757             :   {
    1758             :   }
    1759             : 
    1760             :   inline ~OwningTestInterfaceJSUnionableDictionaryOrLong()
    1761             :   {
    1762             :     Uninit();
    1763             :   }
    1764             : 
    1765             :   TestInterfaceJSUnionableDictionary&
    1766             :   RawSetAsTestInterfaceJSUnionableDictionary();
    1767             : 
    1768             :   TestInterfaceJSUnionableDictionary&
    1769             :   SetAsTestInterfaceJSUnionableDictionary();
    1770             : 
    1771             :   bool
    1772             :   TrySetToTestInterfaceJSUnionableDictionary(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
    1773             : 
    1774             :   inline bool
    1775           0 :   IsTestInterfaceJSUnionableDictionary() const
    1776             :   {
    1777           0 :     return mType == eTestInterfaceJSUnionableDictionary;
    1778             :   }
    1779             : 
    1780             :   inline TestInterfaceJSUnionableDictionary&
    1781             :   GetAsTestInterfaceJSUnionableDictionary()
    1782             :   {
    1783             :     MOZ_ASSERT(IsTestInterfaceJSUnionableDictionary(), "Wrong type!");
    1784             :     return mValue.mTestInterfaceJSUnionableDictionary.Value();
    1785             :   }
    1786             : 
    1787             :   inline TestInterfaceJSUnionableDictionary const &
    1788             :   GetAsTestInterfaceJSUnionableDictionary() const
    1789             :   {
    1790             :     MOZ_ASSERT(IsTestInterfaceJSUnionableDictionary(), "Wrong type!");
    1791             :     return mValue.mTestInterfaceJSUnionableDictionary.Value();
    1792             :   }
    1793             : 
    1794             :   int32_t&
    1795             :   RawSetAsLong();
    1796             : 
    1797             :   int32_t&
    1798             :   SetAsLong();
    1799             : 
    1800             :   bool
    1801             :   TrySetToLong(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
    1802             : 
    1803             :   inline bool
    1804           0 :   IsLong() const
    1805             :   {
    1806           0 :     return mType == eLong;
    1807             :   }
    1808             : 
    1809             :   inline int32_t&
    1810             :   GetAsLong()
    1811             :   {
    1812             :     MOZ_ASSERT(IsLong(), "Wrong type!");
    1813             :     return mValue.mLong.Value();
    1814             :   }
    1815             : 
    1816             :   inline int32_t const &
    1817             :   GetAsLong() const
    1818             :   {
    1819             :     MOZ_ASSERT(IsLong(), "Wrong type!");
    1820             :     return mValue.mLong.Value();
    1821             :   }
    1822             : 
    1823             :   void
    1824             :   Uninit();
    1825             : 
    1826             :   bool
    1827             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
    1828             : 
    1829             :   void
    1830             :   TraceUnion(JSTracer* trc);
    1831             : 
    1832             : private:
    1833             :   void
    1834             :   DestroyTestInterfaceJSUnionableDictionary();
    1835             : 
    1836             :   void
    1837             :   DestroyLong();
    1838             : };
    1839             : 
    1840             : 
    1841             : namespace TestInterfaceJSBinding {
    1842             : 
    1843             :   typedef mozilla::dom::TestInterfaceJS NativeType;
    1844             : 
    1845             :   bool
    1846             :   ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
    1847             : 
    1848             :   JSObject*
    1849             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
    1850             : 
    1851             :   const JSClass*
    1852             :   GetJSClass();
    1853             : 
    1854             :   bool
    1855             :   Wrap(JSContext* aCx, mozilla::dom::TestInterfaceJS* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
    1856             : 
    1857             :   template <class T>
    1858           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
    1859             :   {
    1860           0 :     JS::Rooted<JSObject*> reflector(aCx);
    1861           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
    1862             :   }
    1863             : 
    1864             :   // We declare this as an array so that retrieving a pointer to this
    1865             :   // binding's property hooks only requires compile/link-time resolvable
    1866             :   // address arithmetic.  Declaring it as a pointer instead would require
    1867             :   // doing a run-time load to fetch a pointer to this binding's property
    1868             :   // hooks.  And then structures which embedded a pointer to this structure
    1869             :   // would require a run-time load for proper initialization, which would
    1870             :   // then induce static constructors.  Lots of static constructors.
    1871             :   extern const NativePropertyHooks sNativePropertyHooks[];
    1872             : 
    1873             :   void
    1874             :   ClearCachedDictionaryArgValue(mozilla::dom::TestInterfaceJS* aObject);
    1875             : 
    1876             :   void
    1877             :   ClearCachedDictionaryAttrValue(mozilla::dom::TestInterfaceJS* aObject);
    1878             : 
    1879             :   void
    1880             :   ClearCachedCachedAttrValue(mozilla::dom::TestInterfaceJS* aObject);
    1881             : 
    1882             :   void
    1883             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
    1884             : 
    1885             :   JS::Handle<JSObject*>
    1886             :   GetProtoObjectHandle(JSContext* aCx);
    1887             : 
    1888             :   JS::Handle<JSObject*>
    1889             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
    1890             : 
    1891             :   JSObject*
    1892             :   GetConstructorObject(JSContext* aCx);
    1893             : 
    1894             : } // namespace TestInterfaceJSBinding
    1895             : 
    1896             : 
    1897             : 
    1898           0 : class TestInterfaceJSJSImpl : public CallbackInterface
    1899             : {
    1900             : public:
    1901           0 :   explicit inline TestInterfaceJSJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
    1902           0 :     : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
    1903             :   {
    1904           0 :   }
    1905             : 
    1906             :   explicit inline TestInterfaceJSJSImpl(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
    1907             :     : CallbackInterface(aCallback, FastCallbackConstructor())
    1908             :   {
    1909             :   }
    1910             : 
    1911             :   explicit inline TestInterfaceJSJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
    1912             :     : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
    1913             :   {
    1914             :   }
    1915             : 
    1916             :   void PingPongAny(JS::Handle<JS::Value> arg, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1917             : 
    1918             :   void PingPongObject(JS::Handle<JSObject*> obj, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1919             : 
    1920             :   void PingPongObjectOrString(const ObjectOrString& objOrString, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1921             : 
    1922             :   void PingPongDictionary(const TestInterfaceJSDictionary& dict, TestInterfaceJSDictionary& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1923             : 
    1924             :   int32_t PingPongDictionaryOrLong(const TestInterfaceJSUnionableDictionaryOrLong& dictOrLong, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1925             : 
    1926             :   void PingPongMap(const Record<nsString, JS::Value>& map, nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1927             : 
    1928             :   int32_t ObjectSequenceLength(const Sequence<JSObject*>& seq, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1929             : 
    1930             :   int32_t AnySequenceLength(const Sequence<JS::Value>& seq, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1931             : 
    1932             :   void GetCallerPrincipal(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1933             : 
    1934             :   void ConvertSVS(const nsAString& svs, nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1935             : 
    1936             :   void PingPongUnion(const TestInterfaceJSOrLong& something, OwningTestInterfaceJSOrLong& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1937             : 
    1938             :   void PingPongUnionContainingNull(const TestInterfaceJSOrNullOrString& something, OwningStringOrTestInterfaceJSOrNull& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1939             : 
    1940             :   void PingPongNullableUnion(const Nullable<TestInterfaceJSOrLong>& something, Nullable<OwningTestInterfaceJSOrLong>& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1941             : 
    1942             :   void ReturnBadUnion(OwningLocationOrTestInterfaceJS& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1943             : 
    1944             :   void SetCachedAttr(int16_t n, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1945             : 
    1946             :   void ClearCachedAttrCache(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1947             : 
    1948             :   void TestSequenceOverload(const Sequence<nsString>& arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1949             : 
    1950             :   void TestSequenceOverload(const nsAString& arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1951             : 
    1952             :   void TestSequenceUnion(const StringSequenceOrString& arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1953             : 
    1954             :   void TestThrowError(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1955             : 
    1956             :   void TestThrowDOMException(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1957             : 
    1958             :   void TestThrowTypeError(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1959             : 
    1960             :   void TestThrowCallbackError(Function& callback, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1961             : 
    1962             :   void TestThrowXraySelfHosted(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1963             : 
    1964             :   void TestThrowSelfHosted(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1965             : 
    1966             :   already_AddRefed<Promise> TestPromiseWithThrowingChromePromiseInit(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1967             : 
    1968             :   already_AddRefed<Promise> TestPromiseWithThrowingContentPromiseInit(Function& func, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1969             : 
    1970             :   already_AddRefed<Promise> TestPromiseWithDOMExceptionThrowingPromiseInit(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1971             : 
    1972             :   already_AddRefed<Promise> TestPromiseWithThrowingChromeThenFunction(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1973             : 
    1974             :   already_AddRefed<Promise> TestPromiseWithThrowingContentThenFunction(AnyCallback& func, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1975             : 
    1976             :   already_AddRefed<Promise> TestPromiseWithDOMExceptionThrowingThenFunction(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1977             : 
    1978             :   already_AddRefed<Promise> TestPromiseWithThrowingChromeThenable(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1979             : 
    1980             :   already_AddRefed<Promise> TestPromiseWithThrowingContentThenable(JS::Handle<JSObject*> thenable, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1981             : 
    1982             :   already_AddRefed<Promise> TestPromiseWithDOMExceptionThrowingThenable(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1983             : 
    1984             :   void __Init(JS::Handle<JS::Value> anyArg, const Optional<JS::Handle<JSObject*>>& objectArg, const TestInterfaceJSDictionary& dictionaryArg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1985             : 
    1986             :   inline bool
    1987             :   operator==(const TestInterfaceJSJSImpl& aOther) const
    1988             :   {
    1989             :     return CallbackInterface::operator==(aOther);
    1990             :   }
    1991             : 
    1992             :   void GetAnyArg(JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1993             : 
    1994             :   void GetObjectArg(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1995             : 
    1996             :   void GetDictionaryArg(TestInterfaceJSDictionary& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1997             : 
    1998             :   void GetAnyAttr(JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    1999             : 
    2000             :   void GetObjectAttr(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2001             : 
    2002             :   void GetDictionaryAttr(TestInterfaceJSDictionary& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2003             : 
    2004             :   int16_t GetCachedAttr(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2005             : 
    2006             :   already_AddRefed<EventHandlerNonNull> GetOnsomething(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2007             : 
    2008             :   void SetAnyAttr(JS::Handle<JS::Value> arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2009             : 
    2010             :   void SetObjectAttr(JS::Handle<JSObject*> arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2011             : 
    2012             :   void SetDictionaryAttr(const TestInterfaceJSDictionary& arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2013             : 
    2014             :   void SetOnsomething(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2015             : 
    2016             : private:
    2017             :   static bool
    2018             :   InitIds(JSContext* cx, TestInterfaceJSAtoms* atomsCache);
    2019             : };
    2020             : 
    2021             : 
    2022             : class TestInterfaceJS final : public mozilla::DOMEventTargetHelper
    2023             : {
    2024             : public:
    2025             :   NS_DECL_ISUPPORTS_INHERITED
    2026           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TestInterfaceJS, mozilla::DOMEventTargetHelper)
    2027             : 
    2028             : private:
    2029             :   RefPtr<TestInterfaceJSJSImpl> mImpl;
    2030             :   nsCOMPtr<nsISupports> mParent;
    2031             : 
    2032             : public:
    2033             :   TestInterfaceJS(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);
    2034             : 
    2035             : private:
    2036             :   ~TestInterfaceJS();
    2037             : 
    2038             : public:
    2039             :   nsISupports* GetParentObject() const;
    2040             : 
    2041             :   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
    2042             : 
    2043             :   static already_AddRefed<TestInterfaceJS> Constructor(const GlobalObject& global, JSContext* cx, JS::Handle<JS::Value> anyArg, const Optional<JS::Handle<JSObject*>>& objectArg, const TestInterfaceJSDictionary& dictionaryArg, ErrorResult& aRv);
    2044             : 
    2045             :   void GetAnyArg(JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    2046             : 
    2047             :   void GetObjectArg(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    2048             : 
    2049             :   void GetDictionaryArg(TestInterfaceJSDictionary& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    2050             : 
    2051             :   void GetAnyAttr(JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    2052             : 
    2053             :   void SetAnyAttr(JS::Handle<JS::Value> arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2054             : 
    2055             :   void GetObjectAttr(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    2056             : 
    2057             :   void SetObjectAttr(JS::Handle<JSObject*> arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2058             : 
    2059             :   void GetDictionaryAttr(TestInterfaceJSDictionary& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    2060             : 
    2061             :   void SetDictionaryAttr(const TestInterfaceJSDictionary& arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2062             : 
    2063             :   void PingPongAny(JS::Handle<JS::Value> arg, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2064             : 
    2065             :   void PingPongObject(JS::Handle<JSObject*> obj, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2066             : 
    2067             :   void PingPongObjectOrString(const ObjectOrString& objOrString, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2068             : 
    2069             :   void PingPongDictionary(const TestInterfaceJSDictionary& dict, TestInterfaceJSDictionary& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2070             : 
    2071             :   int32_t PingPongDictionaryOrLong(const TestInterfaceJSUnionableDictionaryOrLong& dictOrLong, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2072             : 
    2073             :   void PingPongMap(const Record<nsString, JS::Value>& map, nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2074             : 
    2075             :   int32_t ObjectSequenceLength(const Sequence<JSObject*>& seq, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2076             : 
    2077             :   int32_t AnySequenceLength(const Sequence<JS::Value>& seq, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2078             : 
    2079             :   void GetCallerPrincipal(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2080             : 
    2081             :   void ConvertSVS(const nsAString& svs, nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2082             : 
    2083             :   void PingPongUnion(const TestInterfaceJSOrLong& something, OwningTestInterfaceJSOrLong& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2084             : 
    2085             :   void PingPongUnionContainingNull(const TestInterfaceJSOrNullOrString& something, OwningStringOrTestInterfaceJSOrNull& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2086             : 
    2087             :   void PingPongNullableUnion(const Nullable<TestInterfaceJSOrLong>& something, Nullable<OwningTestInterfaceJSOrLong>& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2088             : 
    2089             :   void ReturnBadUnion(OwningLocationOrTestInterfaceJS& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2090             : 
    2091             :   int16_t GetCachedAttr(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    2092             : 
    2093             :   void SetCachedAttr(int16_t n, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2094             : 
    2095             :   void ClearCachedAttrCache(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2096             : 
    2097             :   void TestSequenceOverload(const Sequence<nsString>& arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2098             :   void TestSequenceOverload(const nsAString& arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2099             : 
    2100             :   void TestSequenceUnion(const StringSequenceOrString& arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2101             : 
    2102             :   void TestThrowError(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2103             : 
    2104             :   void TestThrowDOMException(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2105             : 
    2106             :   void TestThrowTypeError(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2107             : 
    2108             :   void TestThrowCallbackError(Function& callback, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2109             : 
    2110             :   void TestThrowXraySelfHosted(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2111             : 
    2112             :   void TestThrowSelfHosted(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2113             : 
    2114             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    2115             :   already_AddRefed<Promise> TestPromiseWithThrowingChromePromiseInit(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2116             : 
    2117             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    2118             :   already_AddRefed<Promise> TestPromiseWithThrowingContentPromiseInit(Function& func, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2119             : 
    2120             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    2121             :   already_AddRefed<Promise> TestPromiseWithDOMExceptionThrowingPromiseInit(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2122             : 
    2123             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    2124             :   already_AddRefed<Promise> TestPromiseWithThrowingChromeThenFunction(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2125             : 
    2126             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    2127             :   already_AddRefed<Promise> TestPromiseWithThrowingContentThenFunction(AnyCallback& func, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2128             : 
    2129             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    2130             :   already_AddRefed<Promise> TestPromiseWithDOMExceptionThrowingThenFunction(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2131             : 
    2132             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    2133             :   already_AddRefed<Promise> TestPromiseWithThrowingChromeThenable(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2134             : 
    2135             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    2136             :   already_AddRefed<Promise> TestPromiseWithThrowingContentThenable(JS::Handle<JSObject*> thenable, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2137             : 
    2138             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
    2139             :   already_AddRefed<Promise> TestPromiseWithDOMExceptionThrowingThenable(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2140             : 
    2141             :   already_AddRefed<EventHandlerNonNull> GetOnsomething(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
    2142             : 
    2143             :   void SetOnsomething(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
    2144             : 
    2145             :   static bool
    2146             :   _Create(JSContext* cx, unsigned argc, JS::Value* vp);
    2147             : };
    2148             : 
    2149             : 
    2150             : } // namespace dom
    2151             : } // namespace mozilla
    2152             : 
    2153             : #endif // mozilla_dom_TestInterfaceJSBinding_h

Generated by: LCOV version 1.13