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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM SecureElement.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #ifndef mozilla_dom_SecureElementBinding_h
       4             : #define mozilla_dom_SecureElementBinding_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/CallbackInterface.h"
      11             : #include "mozilla/dom/Nullable.h"
      12             : #include "mozilla/dom/ToJSValue.h"
      13             : #include "mozilla/dom/TypedArray.h"
      14             : #include "nsWeakReference.h"
      15             : 
      16             : namespace mozilla {
      17             : namespace dom {
      18             : 
      19             : struct NativePropertyHooks;
      20             : class Promise;
      21             : class ProtoAndIfaceCache;
      22             : class SEChannel;
      23             : struct SEChannelAtoms;
      24             : struct SECommand;
      25             : struct SECommandAtoms;
      26             : class SEReader;
      27             : struct SEReaderAtoms;
      28             : class SEResponse;
      29             : struct SEResponseAtoms;
      30             : class SESession;
      31             : struct SESessionAtoms;
      32             : 
      33             : } // namespace dom
      34             : } // namespace mozilla
      35             : 
      36             : namespace mozilla {
      37             : namespace dom {
      38             : 
      39             : enum class SEType : uint8_t {
      40             :   Uicc,
      41             :   ESE,
      42             :   EndGuard_
      43             : };
      44             : 
      45             : namespace SETypeValues {
      46             : extern const EnumEntry strings[3];
      47             : } // namespace SETypeValues
      48             : 
      49             : bool
      50             : ToJSValue(JSContext* aCx, SEType aArgument, JS::MutableHandle<JS::Value> aValue);
      51             : 
      52             : 
      53             : enum class SEError : uint8_t {
      54             :   SESecurityError,
      55             :   SEIoError,
      56             :   SEBadStateError,
      57             :   SEInvalidChannelError,
      58             :   SEInvalidApplicationError,
      59             :   SENotPresentError,
      60             :   SEIllegalParameterError,
      61             :   SEGenericError,
      62             :   EndGuard_
      63             : };
      64             : 
      65             : namespace SEErrorValues {
      66             : extern const EnumEntry strings[9];
      67             : } // namespace SEErrorValues
      68             : 
      69             : bool
      70             : ToJSValue(JSContext* aCx, SEError aArgument, JS::MutableHandle<JS::Value> aValue);
      71             : 
      72             : 
      73             : enum class SEChannelType : uint8_t {
      74             :   Basic,
      75             :   Logical,
      76             :   EndGuard_
      77             : };
      78             : 
      79             : namespace SEChannelTypeValues {
      80             : extern const EnumEntry strings[3];
      81             : } // namespace SEChannelTypeValues
      82             : 
      83             : bool
      84             : ToJSValue(JSContext* aCx, SEChannelType aArgument, JS::MutableHandle<JS::Value> aValue);
      85             : 
      86             : 
      87           0 : struct SECommand : public DictionaryBase
      88             : {
      89             :   MOZ_INIT_OUTSIDE_CTOR uint8_t mCla;
      90             :   MOZ_INIT_OUTSIDE_CTOR Nullable<Sequence<uint8_t>> mData;
      91             :   MOZ_INIT_OUTSIDE_CTOR uint8_t mIns;
      92             :   MOZ_INIT_OUTSIDE_CTOR int16_t mLe;
      93             :   MOZ_INIT_OUTSIDE_CTOR uint8_t mP1;
      94             :   MOZ_INIT_OUTSIDE_CTOR uint8_t mP2;
      95             : 
      96             :   SECommand();
      97             : 
      98           0 :   explicit inline SECommand(const FastDictionaryInitializer& )
      99           0 :   {
     100             :     // Do nothing here; this is used by our "Fast" subclass
     101           0 :   }
     102             : 
     103             :   explicit inline SECommand(const SECommand& aOther)
     104             :   {
     105             :     *this = aOther;
     106             :   }
     107             : 
     108             :   bool
     109             :   Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
     110             : 
     111             :   bool
     112             :   Init(const nsAString& aJSON);
     113             : 
     114             :   bool
     115             :   ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
     116             : 
     117             :   bool
     118             :   ToJSON(nsAString& aJSON) const;
     119             : 
     120             :   void
     121             :   TraceDictionary(JSTracer* trc);
     122             : 
     123             :   SECommand&
     124             :   operator=(const SECommand& aOther);
     125             : 
     126             : private:
     127             :   static bool
     128             :   InitIds(JSContext* cx, SECommandAtoms* atomsCache);
     129             : };
     130             : 
     131             : namespace binding_detail {
     132           0 : struct FastSECommand : public SECommand
     133             : {
     134           0 :   inline FastSECommand()
     135           0 :     : SECommand(FastDictionaryInitializer())
     136             :   {
     137             :     // Doesn't matter what int we pass to the parent constructor
     138           0 :   }
     139             : };
     140             : } // namespace binding_detail
     141             : 
     142             : 
     143             : namespace SEChannelBinding {
     144             : 
     145             :   typedef mozilla::dom::SEChannel NativeType;
     146             : 
     147             :   bool
     148             :   ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
     149             : 
     150             :   JSObject*
     151             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
     152             : 
     153             :   const JSClass*
     154             :   GetJSClass();
     155             : 
     156             :   bool
     157             :   Wrap(JSContext* aCx, mozilla::dom::SEChannel* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     158             : 
     159             :   template <class T>
     160           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
     161             :   {
     162           0 :     JS::Rooted<JSObject*> reflector(aCx);
     163           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
     164             :   }
     165             : 
     166             :   // We declare this as an array so that retrieving a pointer to this
     167             :   // binding's property hooks only requires compile/link-time resolvable
     168             :   // address arithmetic.  Declaring it as a pointer instead would require
     169             :   // doing a run-time load to fetch a pointer to this binding's property
     170             :   // hooks.  And then structures which embedded a pointer to this structure
     171             :   // would require a run-time load for proper initialization, which would
     172             :   // then induce static constructors.  Lots of static constructors.
     173             :   extern const NativePropertyHooks sNativePropertyHooks[];
     174             : 
     175             :   void
     176             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     177             : 
     178             :   JS::Handle<JSObject*>
     179             :   GetProtoObjectHandle(JSContext* aCx);
     180             : 
     181             :   JS::Handle<JSObject*>
     182             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
     183             : 
     184             :   JSObject*
     185             :   GetConstructorObject(JSContext* aCx);
     186             : 
     187             : } // namespace SEChannelBinding
     188             : 
     189             : 
     190             : 
     191             : namespace SEReaderBinding {
     192             : 
     193             :   typedef mozilla::dom::SEReader NativeType;
     194             : 
     195             :   bool
     196             :   ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
     197             : 
     198             :   JSObject*
     199             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
     200             : 
     201             :   const JSClass*
     202             :   GetJSClass();
     203             : 
     204             :   bool
     205             :   Wrap(JSContext* aCx, mozilla::dom::SEReader* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     206             : 
     207             :   template <class T>
     208           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
     209             :   {
     210           0 :     JS::Rooted<JSObject*> reflector(aCx);
     211           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
     212             :   }
     213             : 
     214             :   // We declare this as an array so that retrieving a pointer to this
     215             :   // binding's property hooks only requires compile/link-time resolvable
     216             :   // address arithmetic.  Declaring it as a pointer instead would require
     217             :   // doing a run-time load to fetch a pointer to this binding's property
     218             :   // hooks.  And then structures which embedded a pointer to this structure
     219             :   // would require a run-time load for proper initialization, which would
     220             :   // then induce static constructors.  Lots of static constructors.
     221             :   extern const NativePropertyHooks sNativePropertyHooks[];
     222             : 
     223             :   void
     224             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     225             : 
     226             :   JS::Handle<JSObject*>
     227             :   GetProtoObjectHandle(JSContext* aCx);
     228             : 
     229             :   JS::Handle<JSObject*>
     230             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
     231             : 
     232             :   JSObject*
     233             :   GetConstructorObject(JSContext* aCx);
     234             : 
     235             : } // namespace SEReaderBinding
     236             : 
     237             : 
     238             : 
     239             : namespace SEResponseBinding {
     240             : 
     241             :   typedef mozilla::dom::SEResponse NativeType;
     242             : 
     243             :   bool
     244             :   ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
     245             : 
     246             :   JSObject*
     247             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
     248             : 
     249             :   const JSClass*
     250             :   GetJSClass();
     251             : 
     252             :   bool
     253             :   Wrap(JSContext* aCx, mozilla::dom::SEResponse* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     254             : 
     255             :   template <class T>
     256           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
     257             :   {
     258           0 :     JS::Rooted<JSObject*> reflector(aCx);
     259           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
     260             :   }
     261             : 
     262             :   // We declare this as an array so that retrieving a pointer to this
     263             :   // binding's property hooks only requires compile/link-time resolvable
     264             :   // address arithmetic.  Declaring it as a pointer instead would require
     265             :   // doing a run-time load to fetch a pointer to this binding's property
     266             :   // hooks.  And then structures which embedded a pointer to this structure
     267             :   // would require a run-time load for proper initialization, which would
     268             :   // then induce static constructors.  Lots of static constructors.
     269             :   extern const NativePropertyHooks sNativePropertyHooks[];
     270             : 
     271             :   void
     272             :   ClearCachedDataValue(mozilla::dom::SEResponse* aObject);
     273             : 
     274             :   void
     275             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     276             : 
     277             :   JS::Handle<JSObject*>
     278             :   GetProtoObjectHandle(JSContext* aCx);
     279             : 
     280             :   JS::Handle<JSObject*>
     281             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
     282             : 
     283             :   JSObject*
     284             :   GetConstructorObject(JSContext* aCx);
     285             : 
     286             : } // namespace SEResponseBinding
     287             : 
     288             : 
     289             : 
     290             : namespace SESessionBinding {
     291             : 
     292             :   typedef mozilla::dom::SESession NativeType;
     293             : 
     294             :   bool
     295             :   ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
     296             : 
     297             :   JSObject*
     298             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
     299             : 
     300             :   const JSClass*
     301             :   GetJSClass();
     302             : 
     303             :   bool
     304             :   Wrap(JSContext* aCx, mozilla::dom::SESession* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     305             : 
     306             :   template <class T>
     307           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
     308             :   {
     309           0 :     JS::Rooted<JSObject*> reflector(aCx);
     310           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
     311             :   }
     312             : 
     313             :   // We declare this as an array so that retrieving a pointer to this
     314             :   // binding's property hooks only requires compile/link-time resolvable
     315             :   // address arithmetic.  Declaring it as a pointer instead would require
     316             :   // doing a run-time load to fetch a pointer to this binding's property
     317             :   // hooks.  And then structures which embedded a pointer to this structure
     318             :   // would require a run-time load for proper initialization, which would
     319             :   // then induce static constructors.  Lots of static constructors.
     320             :   extern const NativePropertyHooks sNativePropertyHooks[];
     321             : 
     322             :   void
     323             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     324             : 
     325             :   JS::Handle<JSObject*>
     326             :   GetProtoObjectHandle(JSContext* aCx);
     327             : 
     328             :   JS::Handle<JSObject*>
     329             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
     330             : 
     331             :   JSObject*
     332             :   GetConstructorObject(JSContext* aCx);
     333             : 
     334             : } // namespace SESessionBinding
     335             : 
     336             : 
     337             : 
     338           0 : class SEChannelJSImpl : public CallbackInterface
     339             : {
     340             : public:
     341           0 :   explicit inline SEChannelJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
     342           0 :     : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
     343             :   {
     344           0 :   }
     345             : 
     346             :   explicit inline SEChannelJSImpl(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
     347             :     : CallbackInterface(aCallback, FastCallbackConstructor())
     348             :   {
     349             :   }
     350             : 
     351             :   explicit inline SEChannelJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
     352             :     : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
     353             :   {
     354             :   }
     355             : 
     356             :   already_AddRefed<Promise> Transmit(const SECommand& command, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     357             : 
     358             :   already_AddRefed<Promise> Close(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     359             : 
     360             :   inline bool
     361             :   operator==(const SEChannelJSImpl& aOther) const
     362             :   {
     363             :     return CallbackInterface::operator==(aOther);
     364             :   }
     365             : 
     366             :   already_AddRefed<SESession> GetSession(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     367             : 
     368             :   void GetOpenResponse(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     369             : 
     370             :   bool GetIsClosed(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     371             : 
     372             :   SEChannelType GetType(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     373             : 
     374             : private:
     375             :   static bool
     376             :   InitIds(JSContext* cx, SEChannelAtoms* atomsCache);
     377             : };
     378             : 
     379             : 
     380             : class SEChannel final : public nsSupportsWeakReference,
     381             :                         public nsWrapperCache
     382             : {
     383             : public:
     384             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     385           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(SEChannel)
     386             : 
     387             : private:
     388             :   RefPtr<SEChannelJSImpl> mImpl;
     389             :   nsCOMPtr<nsISupports> mParent;
     390             : 
     391             : public:
     392             :   SEChannel(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);
     393             : 
     394             : private:
     395             :   ~SEChannel();
     396             : 
     397             : public:
     398             :   nsISupports* GetParentObject() const;
     399             : 
     400             :   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
     401             : 
     402             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
     403             :   already_AddRefed<SESession> GetSession(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
     404             : 
     405             :   void GetOpenResponse(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
     406             : 
     407             :   bool GetIsClosed(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
     408             : 
     409             :   SEChannelType GetType(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
     410             : 
     411             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
     412             :   already_AddRefed<Promise> Transmit(const SECommand& command, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     413             : 
     414             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
     415             :   already_AddRefed<Promise> Close(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     416             : 
     417             :   static bool
     418             :   _Create(JSContext* cx, unsigned argc, JS::Value* vp);
     419             : };
     420             : 
     421             : 
     422           0 : class SEReaderJSImpl : public CallbackInterface
     423             : {
     424             : public:
     425           0 :   explicit inline SEReaderJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
     426           0 :     : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
     427             :   {
     428           0 :   }
     429             : 
     430             :   explicit inline SEReaderJSImpl(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
     431             :     : CallbackInterface(aCallback, FastCallbackConstructor())
     432             :   {
     433             :   }
     434             : 
     435             :   explicit inline SEReaderJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
     436             :     : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
     437             :   {
     438             :   }
     439             : 
     440             :   already_AddRefed<Promise> OpenSession(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     441             : 
     442             :   already_AddRefed<Promise> CloseAll(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     443             : 
     444             :   inline bool
     445             :   operator==(const SEReaderJSImpl& aOther) const
     446             :   {
     447             :     return CallbackInterface::operator==(aOther);
     448             :   }
     449             : 
     450             :   bool GetIsSEPresent(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     451             : 
     452             :   SEType GetType(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     453             : 
     454             : private:
     455             :   static bool
     456             :   InitIds(JSContext* cx, SEReaderAtoms* atomsCache);
     457             : };
     458             : 
     459             : 
     460             : class SEReader final : public nsSupportsWeakReference,
     461             :                        public nsWrapperCache
     462             : {
     463             : public:
     464             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     465           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(SEReader)
     466             : 
     467             : private:
     468             :   RefPtr<SEReaderJSImpl> mImpl;
     469             :   nsCOMPtr<nsISupports> mParent;
     470             : 
     471             : public:
     472             :   SEReader(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);
     473             : 
     474             : private:
     475             :   ~SEReader();
     476             : 
     477             : public:
     478             :   nsISupports* GetParentObject() const;
     479             : 
     480             :   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
     481             : 
     482             :   bool GetIsSEPresent(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
     483             : 
     484             :   SEType GetType(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
     485             : 
     486             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
     487             :   already_AddRefed<Promise> OpenSession(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     488             : 
     489             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
     490             :   already_AddRefed<Promise> CloseAll(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     491             : 
     492             :   static bool
     493             :   _Create(JSContext* cx, unsigned argc, JS::Value* vp);
     494             : };
     495             : 
     496             : 
     497           0 : class SEResponseJSImpl : public CallbackInterface
     498             : {
     499             : public:
     500           0 :   explicit inline SEResponseJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
     501           0 :     : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
     502             :   {
     503           0 :   }
     504             : 
     505             :   explicit inline SEResponseJSImpl(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
     506             :     : CallbackInterface(aCallback, FastCallbackConstructor())
     507             :   {
     508             :   }
     509             : 
     510             :   explicit inline SEResponseJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
     511             :     : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
     512             :   {
     513             :   }
     514             : 
     515             :   inline bool
     516             :   operator==(const SEResponseJSImpl& aOther) const
     517             :   {
     518             :     return CallbackInterface::operator==(aOther);
     519             :   }
     520             : 
     521             :   already_AddRefed<SEChannel> GetChannel(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     522             : 
     523             :   uint8_t GetSw1(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     524             : 
     525             :   uint8_t GetSw2(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     526             : 
     527             :   void GetData(Nullable<nsTArray<uint8_t>>& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     528             : 
     529             : private:
     530             :   static bool
     531             :   InitIds(JSContext* cx, SEResponseAtoms* atomsCache);
     532             : };
     533             : 
     534             : 
     535             : class SEResponse final : public nsSupportsWeakReference,
     536             :                          public nsWrapperCache
     537             : {
     538             : public:
     539             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     540           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(SEResponse)
     541             : 
     542             : private:
     543             :   RefPtr<SEResponseJSImpl> mImpl;
     544             :   nsCOMPtr<nsISupports> mParent;
     545             : 
     546             : public:
     547             :   SEResponse(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);
     548             : 
     549             : private:
     550             :   ~SEResponse();
     551             : 
     552             : public:
     553             :   nsISupports* GetParentObject() const;
     554             : 
     555             :   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
     556             : 
     557             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
     558             :   already_AddRefed<SEChannel> GetChannel(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
     559             : 
     560             :   uint8_t GetSw1(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
     561             : 
     562             :   uint8_t GetSw2(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
     563             : 
     564             :   void GetData(Nullable<nsTArray<uint8_t>>& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
     565             : 
     566             :   static bool
     567             :   _Create(JSContext* cx, unsigned argc, JS::Value* vp);
     568             : };
     569             : 
     570             : 
     571           0 : class SESessionJSImpl : public CallbackInterface
     572             : {
     573             : public:
     574           0 :   explicit inline SESessionJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
     575           0 :     : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
     576             :   {
     577           0 :   }
     578             : 
     579             :   explicit inline SESessionJSImpl(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
     580             :     : CallbackInterface(aCallback, FastCallbackConstructor())
     581             :   {
     582             :   }
     583             : 
     584             :   explicit inline SESessionJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
     585             :     : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
     586             :   {
     587             :   }
     588             : 
     589             :   already_AddRefed<Promise> OpenLogicalChannel(const Nullable<Uint8Array>& aid, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     590             : 
     591             :   already_AddRefed<Promise> CloseAll(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     592             : 
     593             :   inline bool
     594             :   operator==(const SESessionJSImpl& aOther) const
     595             :   {
     596             :     return CallbackInterface::operator==(aOther);
     597             :   }
     598             : 
     599             :   already_AddRefed<SEReader> GetReader(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     600             : 
     601             :   bool GetIsClosed(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     602             : 
     603             : private:
     604             :   static bool
     605             :   InitIds(JSContext* cx, SESessionAtoms* atomsCache);
     606             : };
     607             : 
     608             : 
     609             : class SESession final : public nsSupportsWeakReference,
     610             :                         public nsWrapperCache
     611             : {
     612             : public:
     613             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     614           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(SESession)
     615             : 
     616             : private:
     617             :   RefPtr<SESessionJSImpl> mImpl;
     618             :   nsCOMPtr<nsISupports> mParent;
     619             : 
     620             : public:
     621             :   SESession(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);
     622             : 
     623             : private:
     624             :   ~SESession();
     625             : 
     626             : public:
     627             :   nsISupports* GetParentObject() const;
     628             : 
     629             :   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
     630             : 
     631             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
     632             :   already_AddRefed<SEReader> GetReader(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
     633             : 
     634             :   bool GetIsClosed(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
     635             : 
     636             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
     637             :   already_AddRefed<Promise> OpenLogicalChannel(const Nullable<Uint8Array>& aid, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     638             : 
     639             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
     640             :   already_AddRefed<Promise> CloseAll(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
     641             : 
     642             :   static bool
     643             :   _Create(JSContext* cx, unsigned argc, JS::Value* vp);
     644             : };
     645             : 
     646             : 
     647             : } // namespace dom
     648             : } // namespace mozilla
     649             : 
     650             : #endif // mozilla_dom_SecureElementBinding_h

Generated by: LCOV version 1.13