LCOV - code coverage report
Current view: top level - dom/workers - ServiceWorkerRegistration.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 4 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 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_ServiceWorkerRegistration_h
       8             : #define mozilla_dom_ServiceWorkerRegistration_h
       9             : 
      10             : #include "mozilla/DOMEventTargetHelper.h"
      11             : #include "mozilla/dom/ServiceWorkerBinding.h"
      12             : #include "mozilla/dom/ServiceWorkerCommon.h"
      13             : #include "mozilla/dom/workers/bindings/WorkerHolder.h"
      14             : #include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
      15             : 
      16             : // Support for Notification API extension.
      17             : #include "mozilla/dom/NotificationBinding.h"
      18             : 
      19             : class nsPIDOMWindowInner;
      20             : 
      21             : namespace mozilla {
      22             : namespace dom {
      23             : 
      24             : class Promise;
      25             : class PushManager;
      26             : class WorkerListener;
      27             : 
      28             : namespace workers {
      29             : class ServiceWorker;
      30             : class WorkerPrivate;
      31             : } // namespace workers
      32             : 
      33             : // Used by ServiceWorkerManager to notify ServiceWorkerRegistrations of
      34             : // updatefound event and invalidating ServiceWorker instances.
      35           0 : class ServiceWorkerRegistrationListener
      36             : {
      37             : public:
      38             :   NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
      39             : 
      40             :   virtual void
      41             :   UpdateFound() = 0;
      42             : 
      43             :   virtual void
      44             :   InvalidateWorkers(WhichServiceWorker aWhichOnes) = 0;
      45             : 
      46             :   virtual void
      47             :   TransitionWorker(WhichServiceWorker aWhichOne) = 0;
      48             : 
      49             :   virtual void
      50             :   RegistrationRemoved() = 0;
      51             : 
      52             :   virtual void
      53             :   GetScope(nsAString& aScope) const = 0;
      54             : };
      55             : 
      56             : class ServiceWorkerRegistration : public DOMEventTargetHelper
      57             : {
      58             : public:
      59             :   NS_DECL_ISUPPORTS_INHERITED
      60             : 
      61           0 :   IMPL_EVENT_HANDLER(updatefound)
      62             : 
      63             :   static bool
      64             :   Visible(JSContext* aCx, JSObject* aObj);
      65             : 
      66             :   static bool
      67             :   NotificationAPIVisible(JSContext* aCx, JSObject* aObj);
      68             : 
      69             : 
      70             :   static already_AddRefed<ServiceWorkerRegistration>
      71             :   CreateForMainThread(nsPIDOMWindowInner* aWindow,
      72             :                       const nsAString& aScope);
      73             : 
      74             :   static already_AddRefed<ServiceWorkerRegistration>
      75             :   CreateForWorker(workers::WorkerPrivate* aWorkerPrivate,
      76             :                   const nsAString& aScope);
      77             : 
      78             :   JSObject*
      79             :   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      80             : 
      81             :   virtual already_AddRefed<workers::ServiceWorker>
      82             :   GetInstalling() = 0;
      83             : 
      84             :   virtual already_AddRefed<workers::ServiceWorker>
      85             :   GetWaiting() = 0;
      86             : 
      87             :   virtual already_AddRefed<workers::ServiceWorker>
      88             :   GetActive() = 0;
      89             : 
      90             :   virtual void
      91             :   GetScope(nsAString& aScope) const = 0;
      92             : 
      93             :   virtual already_AddRefed<Promise>
      94             :   Update(ErrorResult& aRv) = 0;
      95             : 
      96             :   virtual already_AddRefed<Promise>
      97             :   Unregister(ErrorResult& aRv) = 0;
      98             : 
      99             :   virtual already_AddRefed<PushManager>
     100             :   GetPushManager(JSContext* aCx, ErrorResult& aRv) = 0;
     101             : 
     102             :   virtual already_AddRefed<Promise>
     103             :   ShowNotification(JSContext* aCx,
     104             :                    const nsAString& aTitle,
     105             :                    const NotificationOptions& aOptions,
     106             :                    ErrorResult& aRv) = 0;
     107             : 
     108             :   virtual already_AddRefed<Promise>
     109             :   GetNotifications(const GetNotificationOptions& aOptions,
     110             :                    ErrorResult& aRv) = 0;
     111             : 
     112             : protected:
     113             :   ServiceWorkerRegistration(nsPIDOMWindowInner* aWindow,
     114             :                             const nsAString& aScope);
     115             : 
     116           0 :   virtual ~ServiceWorkerRegistration()
     117           0 :   { }
     118             : 
     119             :   const nsString mScope;
     120             : };
     121             : 
     122             : 
     123             : } // namespace dom
     124             : } // namespace mozilla
     125             : 
     126             : #endif /* mozilla_dom_ServiceWorkerRegistration_h */

Generated by: LCOV version 1.13