LCOV - code coverage report
Current view: top level - dom/media/webrtc - RTCCertificate.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 5 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef mozilla_dom_RTCCertificate_h
       8             : #define mozilla_dom_RTCCertificate_h
       9             : 
      10             : #include "nsCycleCollectionParticipant.h"
      11             : #include "nsWrapperCache.h"
      12             : #include "nsIGlobalObject.h"
      13             : #include "nsNSSShutDown.h"
      14             : #include "prtime.h"
      15             : #include "sslt.h"
      16             : #include "ScopedNSSTypes.h"
      17             : 
      18             : #include "mozilla/ErrorResult.h"
      19             : #include "mozilla/UniquePtr.h"
      20             : #include "mozilla/RefPtr.h"
      21             : #include "mozilla/dom/CryptoKey.h"
      22             : #include "mozilla/dom/RTCCertificateBinding.h"
      23             : #include "mtransport/dtlsidentity.h"
      24             : #include "js/StructuredClone.h"
      25             : #include "js/TypeDecls.h"
      26             : 
      27             : namespace mozilla {
      28             : namespace dom {
      29             : 
      30             : class ObjectOrString;
      31             : 
      32             : class RTCCertificate final
      33             :     : public nsISupports,
      34             :       public nsWrapperCache,
      35             :       public nsNSSShutDownObject
      36             : {
      37             : public:
      38             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      39           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(RTCCertificate)
      40             : 
      41             :   // WebIDL method that implements RTCPeerConnection.generateCertificate.
      42             :   static already_AddRefed<Promise> GenerateCertificate(
      43             :       const GlobalObject& aGlobal, const ObjectOrString& aOptions,
      44             :       ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
      45             : 
      46             :   explicit RTCCertificate(nsIGlobalObject* aGlobal);
      47             :   RTCCertificate(nsIGlobalObject* aGlobal, SECKEYPrivateKey* aPrivateKey,
      48             :                  CERTCertificate* aCertificate, SSLKEAType aAuthType,
      49             :                  PRTime aExpires);
      50             : 
      51           0 :   nsIGlobalObject* GetParentObject() const { return mGlobal; }
      52             :   virtual JSObject* WrapObject(JSContext* aCx,
      53             :                                JS::Handle<JSObject*> aGivenProto) override;
      54             : 
      55             :   // WebIDL expires attribute.  Note: JS dates are milliseconds since epoch;
      56             :   // NSPR PRTime is in microseconds since the same epoch.
      57           0 :   uint64_t Expires() const
      58             :   {
      59           0 :     return mExpires / PR_USEC_PER_MSEC;
      60             :   }
      61             : 
      62             :   // Accessors for use by PeerConnectionImpl.
      63             :   RefPtr<DtlsIdentity> CreateDtlsIdentity() const;
      64           0 :   const UniqueCERTCertificate& Certificate() const { return mCertificate; }
      65             : 
      66             :   // For nsNSSShutDownObject
      67             :   virtual void virtualDestroyNSSReference() override;
      68             :   void destructorSafeDestroyNSSReference();
      69             : 
      70             :   // Structured clone methods
      71             :   bool WriteStructuredClone(JSStructuredCloneWriter* aWriter) const;
      72             :   bool ReadStructuredClone(JSStructuredCloneReader* aReader);
      73             : 
      74             : private:
      75             :   ~RTCCertificate();
      76             :   void operator=(const RTCCertificate&) = delete;
      77             :   RTCCertificate(const RTCCertificate&) = delete;
      78             : 
      79             :   bool ReadCertificate(JSStructuredCloneReader* aReader,
      80             :                        const nsNSSShutDownPreventionLock& /*lockproof*/);
      81             :   bool ReadPrivateKey(JSStructuredCloneReader* aReader,
      82             :                       const nsNSSShutDownPreventionLock& aLockProof);
      83             :   bool WriteCertificate(JSStructuredCloneWriter* aWriter,
      84             :                         const nsNSSShutDownPreventionLock& /*lockproof*/) const;
      85             :   bool WritePrivateKey(JSStructuredCloneWriter* aWriter,
      86             :                        const nsNSSShutDownPreventionLock& aLockProof) const;
      87             : 
      88             :   RefPtr<nsIGlobalObject> mGlobal;
      89             :   UniqueSECKEYPrivateKey mPrivateKey;
      90             :   UniqueCERTCertificate mCertificate;
      91             :   SSLKEAType mAuthType;
      92             :   PRTime mExpires;
      93             : };
      94             : 
      95             : } // namespace dom
      96             : } // namespace mozilla
      97             : 
      98             : #endif // mozilla_dom_RTCCertificate_h

Generated by: LCOV version 1.13