LCOV - code coverage report
Current view: top level - dom/offline - nsDOMOfflineResourceList.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 46 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 31 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 nsDOMOfflineResourceList_h___
       8             : #define nsDOMOfflineResourceList_h___
       9             : 
      10             : #include "nscore.h"
      11             : #include "nsIDOMOfflineResourceList.h"
      12             : #include "nsIApplicationCache.h"
      13             : #include "nsIApplicationCacheContainer.h"
      14             : #include "nsIApplicationCacheService.h"
      15             : #include "nsIOfflineCacheUpdate.h"
      16             : #include "nsTArray.h"
      17             : #include "nsString.h"
      18             : #include "nsIURI.h"
      19             : #include "nsCOMPtr.h"
      20             : #include "nsWeakReference.h"
      21             : #include "nsCOMArray.h"
      22             : #include "nsIDOMEventListener.h"
      23             : #include "nsIObserver.h"
      24             : #include "nsIScriptContext.h"
      25             : #include "nsCycleCollectionParticipant.h"
      26             : #include "nsPIDOMWindow.h"
      27             : #include "mozilla/DOMEventTargetHelper.h"
      28             : #include "mozilla/ErrorResult.h"
      29             : 
      30             : namespace mozilla {
      31             : namespace dom {
      32             : class DOMStringList;
      33             : } // namespace dom
      34             : } // namespace mozilla
      35             : 
      36             : class nsDOMOfflineResourceList final : public mozilla::DOMEventTargetHelper,
      37             :                                        public nsIDOMOfflineResourceList,
      38             :                                        public nsIObserver,
      39             :                                        public nsIOfflineCacheUpdateObserver,
      40             :                                        public nsSupportsWeakReference
      41             : {
      42             :   typedef mozilla::ErrorResult ErrorResult;
      43             : 
      44             : public:
      45             :   NS_DECL_ISUPPORTS_INHERITED
      46             :   NS_DECL_NSIDOMOFFLINERESOURCELIST
      47             :   NS_DECL_NSIOBSERVER
      48             :   NS_DECL_NSIOFFLINECACHEUPDATEOBSERVER
      49             : 
      50           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMOfflineResourceList,
      51             :                                            mozilla::DOMEventTargetHelper)
      52             : 
      53             :   nsDOMOfflineResourceList(nsIURI* aManifestURI,
      54             :                            nsIURI* aDocumentURI,
      55             :                            nsIPrincipal* aLoadingPrincipal,
      56             :                            nsPIDOMWindowInner* aWindow);
      57             : 
      58             :   void FirePendingEvents();
      59             :   void Disconnect();
      60             : 
      61             :   nsresult Init();
      62             : 
      63           0 :   nsPIDOMWindowInner* GetParentObject() const
      64             :   {
      65           0 :     return GetOwner();
      66             :   }
      67             :   virtual JSObject*
      68             :   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      69             : 
      70           0 :   uint16_t GetStatus(ErrorResult& aRv)
      71             :   {
      72           0 :     uint16_t status = 0;
      73           0 :     aRv = GetStatus(&status);
      74           0 :     return status;
      75             :   }
      76           0 :   void Update(ErrorResult& aRv)
      77             :   {
      78           0 :     aRv = Update();
      79           0 :   }
      80           0 :   void SwapCache(ErrorResult& aRv)
      81             :   {
      82           0 :     aRv = SwapCache();
      83           0 :   }
      84             : 
      85           0 :   IMPL_EVENT_HANDLER(checking)
      86           0 :   IMPL_EVENT_HANDLER(error)
      87           0 :   IMPL_EVENT_HANDLER(noupdate)
      88           0 :   IMPL_EVENT_HANDLER(downloading)
      89           0 :   IMPL_EVENT_HANDLER(progress)
      90           0 :   IMPL_EVENT_HANDLER(cached)
      91           0 :   IMPL_EVENT_HANDLER(updateready)
      92           0 :   IMPL_EVENT_HANDLER(obsolete)
      93             : 
      94             :   already_AddRefed<mozilla::dom::DOMStringList> GetMozItems(ErrorResult& aRv);
      95           0 :   bool MozHasItem(const nsAString& aURI, ErrorResult& aRv)
      96             :   {
      97           0 :     bool hasItem = false;
      98           0 :     aRv = MozHasItem(aURI, &hasItem);
      99           0 :     return hasItem;
     100             :   }
     101           0 :   uint32_t GetMozLength(ErrorResult& aRv)
     102             :   {
     103           0 :     uint32_t length = 0;
     104           0 :     aRv = GetMozLength(&length);
     105           0 :     return length;
     106             :   }
     107           0 :   void MozItem(uint32_t aIndex, nsAString& aURI, ErrorResult& aRv)
     108             :   {
     109           0 :     aRv = MozItem(aIndex, aURI);
     110           0 :   }
     111           0 :   void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aURI,
     112             :                      ErrorResult& aRv)
     113             :   {
     114           0 :     MozItem(aIndex, aURI, aRv);
     115           0 :     aFound = !aURI.IsVoid();
     116           0 :   }
     117           0 :   uint32_t Length()
     118             :   {
     119           0 :     mozilla::IgnoredErrorResult rv;
     120           0 :     uint32_t length = GetMozLength(rv);
     121           0 :     return rv.Failed() ? 0 : length;
     122             :   }
     123           0 :   void MozAdd(const nsAString& aURI, ErrorResult& aRv)
     124             :   {
     125           0 :     aRv = MozAdd(aURI);
     126           0 :   }
     127           0 :   void MozRemove(const nsAString& aURI, ErrorResult& aRv)
     128             :   {
     129           0 :     aRv = MozRemove(aURI);
     130           0 :   }
     131             : 
     132             : protected:
     133             :   virtual ~nsDOMOfflineResourceList();
     134             : 
     135             : private:
     136             :   nsresult SendEvent(const nsAString &aEventName);
     137             : 
     138             :   nsresult UpdateAdded(nsIOfflineCacheUpdate *aUpdate);
     139             :   nsresult UpdateCompleted(nsIOfflineCacheUpdate *aUpdate);
     140             : 
     141             :   already_AddRefed<nsIApplicationCacheContainer> GetDocumentAppCacheContainer();
     142             :   already_AddRefed<nsIApplicationCache> GetDocumentAppCache();
     143             : 
     144             :   nsresult GetCacheKey(const nsAString &aURI, nsCString &aKey);
     145             :   nsresult GetCacheKey(nsIURI *aURI, nsCString &aKey);
     146             : 
     147             :   nsresult CacheKeys();
     148             :   void ClearCachedKeys();
     149             : 
     150             :   bool mInitialized;
     151             : 
     152             :   nsCOMPtr<nsIURI> mManifestURI;
     153             :   // AsciiSpec of mManifestURI
     154             :   nsCString mManifestSpec;
     155             : 
     156             :   nsCOMPtr<nsIURI> mDocumentURI;
     157             :   nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
     158             :   nsCOMPtr<nsIApplicationCacheService> mApplicationCacheService;
     159             :   nsCOMPtr<nsIApplicationCache> mAvailableApplicationCache;
     160             :   nsCOMPtr<nsIOfflineCacheUpdate> mCacheUpdate;
     161             :   bool mExposeCacheUpdateStatus;
     162             :   uint16_t mStatus;
     163             : 
     164             :   // The set of dynamic keys for this application cache object.
     165             :   char **mCachedKeys;
     166             :   uint32_t mCachedKeysCount;
     167             : 
     168             :   nsCOMArray<nsIDOMEvent> mPendingEvents;
     169             : };
     170             : 
     171             : #endif

Generated by: LCOV version 1.13