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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM FormData.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #ifndef mozilla_dom_FormDataBinding_h
       4             : #define mozilla_dom_FormDataBinding_h
       5             : 
       6             : #include "js/RootingAPI.h"
       7             : #include "jspubtd.h"
       8             : #include "mozilla/ErrorResult.h"
       9             : #include "mozilla/dom/BindingDeclarations.h"
      10             : #include "mozilla/dom/FakeString.h"
      11             : #include "mozilla/dom/IterableIterator.h"
      12             : #include "mozilla/dom/Nullable.h"
      13             : #include "mozilla/dom/UnionMember.h"
      14             : 
      15             : namespace mozilla {
      16             : namespace dom {
      17             : 
      18             : class Blob;
      19             : class BlobOrDirectoryOrUSVString;
      20             : class Directory;
      21             : class FormData;
      22             : struct FormDataAtoms;
      23             : struct NativePropertyHooks;
      24             : class OwningBlobOrDirectoryOrUSVString;
      25             : class ProtoAndIfaceCache;
      26             : 
      27             : } // namespace dom
      28             : } // namespace mozilla
      29             : 
      30             : namespace mozilla {
      31             : namespace dom {
      32             : 
      33             : void
      34             : ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningBlobOrDirectoryOrUSVString& aUnion, const char* aName, uint32_t aFlags = 0);
      35             : 
      36             : 
      37             : void
      38             : ImplCycleCollectionUnlink(OwningBlobOrDirectoryOrUSVString& aUnion);
      39             : 
      40             : 
      41             : class BlobOrDirectoryOrUSVString
      42             : {
      43             :   friend class BlobOrDirectoryOrUSVStringArgument;
      44             :   enum Type
      45             :   {
      46             :     eUninitialized,
      47             :     eBlob,
      48             :     eDirectory,
      49             :     eUSVString
      50             :   };
      51             : 
      52             :   union Value
      53             :   {
      54             :     UnionMember<NonNull<mozilla::dom::Blob> > mBlob;
      55             :     UnionMember<NonNull<mozilla::dom::Directory> > mDirectory;
      56             :     UnionMember<binding_detail::FakeString > mUSVString;
      57             : 
      58             :   };
      59             : 
      60             :   Type mType;
      61             :   Value mValue;
      62             : 
      63             :   BlobOrDirectoryOrUSVString(const BlobOrDirectoryOrUSVString&) = delete;
      64             :   BlobOrDirectoryOrUSVString& operator=(const BlobOrDirectoryOrUSVString&) = delete;
      65             : public:
      66             :   explicit inline BlobOrDirectoryOrUSVString()
      67             :     : mType(eUninitialized)
      68             :   {
      69             :   }
      70             : 
      71             :   inline ~BlobOrDirectoryOrUSVString()
      72             :   {
      73             :     Uninit();
      74             :   }
      75             : 
      76             :   inline NonNull<mozilla::dom::Blob>&
      77             :   RawSetAsBlob()
      78             :   {
      79             :     if (mType == eBlob) {
      80             :       return mValue.mBlob.Value();
      81             :     }
      82             :     MOZ_ASSERT(mType == eUninitialized);
      83             :     mType = eBlob;
      84             :     return mValue.mBlob.SetValue();
      85             :   }
      86             : 
      87             :   inline NonNull<mozilla::dom::Blob>&
      88             :   SetAsBlob()
      89             :   {
      90             :     if (mType == eBlob) {
      91             :       return mValue.mBlob.Value();
      92             :     }
      93             :     Uninit();
      94             :     mType = eBlob;
      95             :     return mValue.mBlob.SetValue();
      96             :   }
      97             : 
      98             :   inline bool
      99             :   IsBlob() const
     100             :   {
     101             :     return mType == eBlob;
     102             :   }
     103             : 
     104             :   inline NonNull<mozilla::dom::Blob>&
     105             :   GetAsBlob()
     106             :   {
     107             :     MOZ_ASSERT(IsBlob(), "Wrong type!");
     108             :     return mValue.mBlob.Value();
     109             :   }
     110             : 
     111             :   inline mozilla::dom::Blob&
     112             :   GetAsBlob() const
     113             :   {
     114             :     MOZ_ASSERT(IsBlob(), "Wrong type!");
     115             :     return mValue.mBlob.Value();
     116             :   }
     117             : 
     118             :   inline NonNull<mozilla::dom::Directory>&
     119             :   RawSetAsDirectory()
     120             :   {
     121             :     if (mType == eDirectory) {
     122             :       return mValue.mDirectory.Value();
     123             :     }
     124             :     MOZ_ASSERT(mType == eUninitialized);
     125             :     mType = eDirectory;
     126             :     return mValue.mDirectory.SetValue();
     127             :   }
     128             : 
     129             :   inline NonNull<mozilla::dom::Directory>&
     130             :   SetAsDirectory()
     131             :   {
     132             :     if (mType == eDirectory) {
     133             :       return mValue.mDirectory.Value();
     134             :     }
     135             :     Uninit();
     136             :     mType = eDirectory;
     137             :     return mValue.mDirectory.SetValue();
     138             :   }
     139             : 
     140             :   inline bool
     141             :   IsDirectory() const
     142             :   {
     143             :     return mType == eDirectory;
     144             :   }
     145             : 
     146             :   inline NonNull<mozilla::dom::Directory>&
     147             :   GetAsDirectory()
     148             :   {
     149             :     MOZ_ASSERT(IsDirectory(), "Wrong type!");
     150             :     return mValue.mDirectory.Value();
     151             :   }
     152             : 
     153             :   inline mozilla::dom::Directory&
     154             :   GetAsDirectory() const
     155             :   {
     156             :     MOZ_ASSERT(IsDirectory(), "Wrong type!");
     157             :     return mValue.mDirectory.Value();
     158             :   }
     159             : 
     160             :   inline binding_detail::FakeString&
     161             :   RawSetAsUSVString()
     162             :   {
     163             :     if (mType == eUSVString) {
     164             :       return mValue.mUSVString.Value();
     165             :     }
     166             :     MOZ_ASSERT(mType == eUninitialized);
     167             :     mType = eUSVString;
     168             :     return mValue.mUSVString.SetValue();
     169             :   }
     170             : 
     171             :   inline binding_detail::FakeString&
     172             :   SetAsUSVString()
     173             :   {
     174             :     if (mType == eUSVString) {
     175             :       return mValue.mUSVString.Value();
     176             :     }
     177             :     Uninit();
     178             :     mType = eUSVString;
     179             :     return mValue.mUSVString.SetValue();
     180             :   }
     181             : 
     182             :   inline bool
     183             :   IsUSVString() const
     184             :   {
     185             :     return mType == eUSVString;
     186             :   }
     187             : 
     188             :   inline binding_detail::FakeString&
     189             :   GetAsUSVString()
     190             :   {
     191             :     MOZ_ASSERT(IsUSVString(), "Wrong type!");
     192             :     return mValue.mUSVString.Value();
     193             :   }
     194             : 
     195             :   inline const nsAString&
     196             :   GetAsUSVString() const
     197             :   {
     198             :     MOZ_ASSERT(IsUSVString(), "Wrong type!");
     199             :     return mValue.mUSVString.Value();
     200             :   }
     201             : 
     202             :   inline void
     203             :   Uninit()
     204             :   {
     205             :     switch (mType) {
     206             :       case eUninitialized: {
     207             :         break;
     208             :       }
     209             :       case eBlob: {
     210             :         DestroyBlob();
     211             :         break;
     212             :       }
     213             :       case eDirectory: {
     214             :         DestroyDirectory();
     215             :         break;
     216             :       }
     217             :       case eUSVString: {
     218             :         DestroyUSVString();
     219             :         break;
     220             :       }
     221             :     }
     222             :   }
     223             : 
     224             :   bool
     225             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     226             : 
     227             : private:
     228             :   inline void
     229             :   DestroyBlob()
     230             :   {
     231             :     MOZ_ASSERT(IsBlob(), "Wrong type!");
     232             :     mValue.mBlob.Destroy();
     233             :     mType = eUninitialized;
     234             :   }
     235             : 
     236             :   inline void
     237             :   DestroyDirectory()
     238             :   {
     239             :     MOZ_ASSERT(IsDirectory(), "Wrong type!");
     240             :     mValue.mDirectory.Destroy();
     241             :     mType = eUninitialized;
     242             :   }
     243             : 
     244             :   inline void
     245             :   DestroyUSVString()
     246             :   {
     247             :     MOZ_ASSERT(IsUSVString(), "Wrong type!");
     248             :     mValue.mUSVString.Destroy();
     249             :     mType = eUninitialized;
     250             :   }
     251             : };
     252             : 
     253             : 
     254             : class OwningBlobOrDirectoryOrUSVString : public AllOwningUnionBase
     255             : {
     256             :   friend void ImplCycleCollectionUnlink(OwningBlobOrDirectoryOrUSVString& aUnion);
     257             :   enum Type
     258             :   {
     259             :     eUninitialized,
     260             :     eBlob,
     261             :     eDirectory,
     262             :     eUSVString
     263             :   };
     264             : 
     265           0 :   union Value
     266             :   {
     267             :     UnionMember<OwningNonNull<mozilla::dom::Blob> > mBlob;
     268             :     UnionMember<OwningNonNull<mozilla::dom::Directory> > mDirectory;
     269             :     UnionMember<nsString > mUSVString;
     270             : 
     271             :   };
     272             : 
     273             :   Type mType;
     274             :   Value mValue;
     275             : 
     276             : public:
     277           0 :   explicit inline OwningBlobOrDirectoryOrUSVString()
     278           0 :     : mType(eUninitialized)
     279             :   {
     280           0 :   }
     281             : 
     282             :   explicit inline OwningBlobOrDirectoryOrUSVString(const OwningBlobOrDirectoryOrUSVString& aOther)
     283             :     : mType(eUninitialized)
     284             :   {
     285             :     *this = aOther;
     286             :   }
     287             : 
     288           0 :   inline ~OwningBlobOrDirectoryOrUSVString()
     289           0 :   {
     290           0 :     Uninit();
     291           0 :   }
     292             : 
     293             :   OwningNonNull<mozilla::dom::Blob>&
     294             :   RawSetAsBlob();
     295             : 
     296             :   OwningNonNull<mozilla::dom::Blob>&
     297             :   SetAsBlob();
     298             : 
     299             :   bool
     300             :   TrySetToBlob(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     301             : 
     302             :   inline bool
     303           0 :   IsBlob() const
     304             :   {
     305           0 :     return mType == eBlob;
     306             :   }
     307             : 
     308             :   inline OwningNonNull<mozilla::dom::Blob>&
     309           0 :   GetAsBlob()
     310             :   {
     311           0 :     MOZ_ASSERT(IsBlob(), "Wrong type!");
     312           0 :     return mValue.mBlob.Value();
     313             :   }
     314             : 
     315             :   inline OwningNonNull<mozilla::dom::Blob> const &
     316           0 :   GetAsBlob() const
     317             :   {
     318           0 :     MOZ_ASSERT(IsBlob(), "Wrong type!");
     319           0 :     return mValue.mBlob.Value();
     320             :   }
     321             : 
     322             :   OwningNonNull<mozilla::dom::Directory>&
     323             :   RawSetAsDirectory();
     324             : 
     325             :   OwningNonNull<mozilla::dom::Directory>&
     326             :   SetAsDirectory();
     327             : 
     328             :   bool
     329             :   TrySetToDirectory(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     330             : 
     331             :   inline bool
     332           0 :   IsDirectory() const
     333             :   {
     334           0 :     return mType == eDirectory;
     335             :   }
     336             : 
     337             :   inline OwningNonNull<mozilla::dom::Directory>&
     338           0 :   GetAsDirectory()
     339             :   {
     340           0 :     MOZ_ASSERT(IsDirectory(), "Wrong type!");
     341           0 :     return mValue.mDirectory.Value();
     342             :   }
     343             : 
     344             :   inline OwningNonNull<mozilla::dom::Directory> const &
     345           0 :   GetAsDirectory() const
     346             :   {
     347           0 :     MOZ_ASSERT(IsDirectory(), "Wrong type!");
     348           0 :     return mValue.mDirectory.Value();
     349             :   }
     350             : 
     351             :   nsString&
     352             :   RawSetAsUSVString();
     353             : 
     354             :   nsString&
     355             :   SetAsUSVString();
     356             : 
     357             :   bool
     358             :   TrySetToUSVString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     359             : 
     360             :   inline void
     361             :   SetStringData(const nsString::char_type* aData, nsString::size_type aLength)
     362             :   {
     363             :     RawSetAsUSVString().Assign(aData, aLength);
     364             :   }
     365             : 
     366             :   inline bool
     367           0 :   IsUSVString() const
     368             :   {
     369           0 :     return mType == eUSVString;
     370             :   }
     371             : 
     372             :   inline nsString&
     373           0 :   GetAsUSVString()
     374             :   {
     375           0 :     MOZ_ASSERT(IsUSVString(), "Wrong type!");
     376           0 :     return mValue.mUSVString.Value();
     377             :   }
     378             : 
     379             :   inline nsString const &
     380           0 :   GetAsUSVString() const
     381             :   {
     382           0 :     MOZ_ASSERT(IsUSVString(), "Wrong type!");
     383           0 :     return mValue.mUSVString.Value();
     384             :   }
     385             : 
     386             :   void
     387             :   Uninit();
     388             : 
     389             :   bool
     390             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     391             : 
     392             :   void
     393             :   TraceUnion(JSTracer* trc);
     394             : 
     395             :   OwningBlobOrDirectoryOrUSVString&
     396             :   operator=(const OwningBlobOrDirectoryOrUSVString& aOther);
     397             : 
     398             : private:
     399             :   void
     400             :   DestroyBlob();
     401             : 
     402             :   void
     403             :   DestroyDirectory();
     404             : 
     405             :   void
     406             :   DestroyUSVString();
     407             : };
     408             : 
     409             : 
     410             : namespace FormDataBinding {
     411             : 
     412             :   typedef mozilla::dom::FormData NativeType;
     413             : 
     414             :   JSObject*
     415             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
     416             : 
     417             :   const JSClass*
     418             :   GetJSClass();
     419             : 
     420             :   bool
     421             :   Wrap(JSContext* aCx, mozilla::dom::FormData* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     422             : 
     423             :   template <class T>
     424           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
     425             :   {
     426           0 :     JS::Rooted<JSObject*> reflector(aCx);
     427           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
     428             :   }
     429             : 
     430             :   // We declare this as an array so that retrieving a pointer to this
     431             :   // binding's property hooks only requires compile/link-time resolvable
     432             :   // address arithmetic.  Declaring it as a pointer instead would require
     433             :   // doing a run-time load to fetch a pointer to this binding's property
     434             :   // hooks.  And then structures which embedded a pointer to this structure
     435             :   // would require a run-time load for proper initialization, which would
     436             :   // then induce static constructors.  Lots of static constructors.
     437             :   extern const NativePropertyHooks sNativePropertyHooks[];
     438             : 
     439             :   void
     440             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     441             : 
     442             :   JS::Handle<JSObject*>
     443             :   GetProtoObjectHandle(JSContext* aCx);
     444             : 
     445             :   JS::Handle<JSObject*>
     446             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
     447             : 
     448             :   JSObject*
     449             :   GetConstructorObject(JSContext* aCx);
     450             : 
     451             : } // namespace FormDataBinding
     452             : 
     453             : 
     454             : 
     455             : namespace FormDataIteratorBinding {
     456             : 
     457             :   typedef mozilla::dom::IterableIterator<mozilla::dom::FormData> NativeType;
     458             : 
     459             :   const JSClass*
     460             :   GetJSClass();
     461             : 
     462             :   bool
     463             :   Wrap(JSContext* aCx, mozilla::dom::IterableIterator<mozilla::dom::FormData>* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     464             : 
     465             :   // We declare this as an array so that retrieving a pointer to this
     466             :   // binding's property hooks only requires compile/link-time resolvable
     467             :   // address arithmetic.  Declaring it as a pointer instead would require
     468             :   // doing a run-time load to fetch a pointer to this binding's property
     469             :   // hooks.  And then structures which embedded a pointer to this structure
     470             :   // would require a run-time load for proper initialization, which would
     471             :   // then induce static constructors.  Lots of static constructors.
     472             :   extern const NativePropertyHooks sNativePropertyHooks[];
     473             : 
     474             :   void
     475             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     476             : 
     477             :   JS::Handle<JSObject*>
     478             :   GetProtoObjectHandle(JSContext* aCx);
     479             : 
     480             : } // namespace FormDataIteratorBinding
     481             : 
     482             : 
     483             : 
     484             : } // namespace dom
     485             : } // namespace mozilla
     486             : 
     487             : #endif // mozilla_dom_FormDataBinding_h

Generated by: LCOV version 1.13