LCOV - code coverage report
Current view: top level - dom/workers - ServiceWorker.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 10 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 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_workers_serviceworker_h__
       8             : #define mozilla_dom_workers_serviceworker_h__
       9             : 
      10             : #include "mozilla/DOMEventTargetHelper.h"
      11             : #include "mozilla/dom/BindingDeclarations.h"
      12             : #include "mozilla/dom/ServiceWorkerBinding.h" // For ServiceWorkerState.
      13             : 
      14             : class nsPIDOMWindowInner;
      15             : 
      16             : namespace mozilla {
      17             : namespace dom {
      18             : 
      19             : namespace workers {
      20             : 
      21             : class ServiceWorkerInfo;
      22             : class ServiceWorkerManager;
      23             : class SharedWorker;
      24             : 
      25             : bool
      26             : ServiceWorkerVisible(JSContext* aCx, JSObject* aObj);
      27             : 
      28             : class ServiceWorker final : public DOMEventTargetHelper
      29             : {
      30             :   friend class ServiceWorkerInfo;
      31             : public:
      32             :   NS_DECL_ISUPPORTS_INHERITED
      33             : 
      34           0 :   IMPL_EVENT_HANDLER(statechange)
      35           0 :   IMPL_EVENT_HANDLER(error)
      36             : 
      37             :   virtual JSObject*
      38             :   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      39             : 
      40             :   ServiceWorkerState
      41           0 :   State() const
      42             :   {
      43           0 :     return mState;
      44             :   }
      45             : 
      46             :   void
      47           0 :   SetState(ServiceWorkerState aState)
      48             :   {
      49           0 :     mState = aState;
      50           0 :   }
      51             : 
      52             :   void
      53             :   GetScriptURL(nsString& aURL) const;
      54             : 
      55             :   void
      56           0 :   DispatchStateChange(ServiceWorkerState aState)
      57             :   {
      58           0 :     DOMEventTargetHelper::DispatchTrustedEvent(NS_LITERAL_STRING("statechange"));
      59           0 :   }
      60             : 
      61             : #ifdef XP_WIN
      62             : #undef PostMessage
      63             : #endif
      64             : 
      65             :   void
      66             :   PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
      67             :               const Sequence<JSObject*>& aTransferable, ErrorResult& aRv);
      68             : 
      69             : private:
      70             :   // This class can only be created from ServiceWorkerInfo::GetOrCreateInstance().
      71             :   ServiceWorker(nsPIDOMWindowInner* aWindow, ServiceWorkerInfo* aInfo);
      72             : 
      73             :   // This class is reference-counted and will be destroyed from Release().
      74             :   ~ServiceWorker();
      75             : 
      76             :   ServiceWorkerState mState;
      77             :   const RefPtr<ServiceWorkerInfo> mInfo;
      78             : };
      79             : 
      80             : } // namespace workers
      81             : } // namespace dom
      82             : } // namespace mozilla
      83             : 
      84             : #endif // mozilla_dom_workers_serviceworker_h__

Generated by: LCOV version 1.13