LCOV - code coverage report
Current view: top level - dom/workers - ServiceWorkerContainer.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 4 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_serviceworkercontainer_h__
       8             : #define mozilla_dom_serviceworkercontainer_h__
       9             : 
      10             : #include "mozilla/DOMEventTargetHelper.h"
      11             : 
      12             : class nsPIDOMWindowInner;
      13             : 
      14             : namespace mozilla {
      15             : namespace dom {
      16             : 
      17             : class Promise;
      18             : struct RegistrationOptions;
      19             : 
      20             : namespace workers {
      21             : class ServiceWorker;
      22             : } // namespace workers
      23             : 
      24             : // Lightweight serviceWorker APIs collection.
      25             : class ServiceWorkerContainer final : public DOMEventTargetHelper
      26             : {
      27             : public:
      28             :   NS_DECL_ISUPPORTS_INHERITED
      29           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServiceWorkerContainer, DOMEventTargetHelper)
      30             : 
      31           0 :   IMPL_EVENT_HANDLER(controllerchange)
      32           0 :   IMPL_EVENT_HANDLER(error)
      33           0 :   IMPL_EVENT_HANDLER(message)
      34             : 
      35             :   static bool IsEnabled(JSContext* aCx, JSObject* aGlobal);
      36             : 
      37             :   explicit ServiceWorkerContainer(nsPIDOMWindowInner* aWindow);
      38             : 
      39             :   virtual JSObject*
      40             :   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      41             : 
      42             :   already_AddRefed<Promise>
      43             :   Register(const nsAString& aScriptURL,
      44             :            const RegistrationOptions& aOptions,
      45             :            ErrorResult& aRv);
      46             : 
      47             :   already_AddRefed<workers::ServiceWorker>
      48             :   GetController();
      49             : 
      50             :   already_AddRefed<Promise>
      51             :   GetRegistration(const nsAString& aDocumentURL,
      52             :                   ErrorResult& aRv);
      53             : 
      54             :   already_AddRefed<Promise>
      55             :   GetRegistrations(ErrorResult& aRv);
      56             : 
      57             :   Promise*
      58             :   GetReady(ErrorResult& aRv);
      59             : 
      60             :   // Testing only.
      61             :   void
      62             :   GetScopeForUrl(const nsAString& aUrl, nsString& aScope, ErrorResult& aRv);
      63             : 
      64             :   // DOMEventTargetHelper
      65             :   void DisconnectFromOwner() override;
      66             : 
      67             :   // Invalidates |mControllerWorker| and dispatches a "controllerchange"
      68             :   // event.
      69             :   void
      70             :   ControllerChanged(ErrorResult& aRv);
      71             : 
      72             : private:
      73             :   ~ServiceWorkerContainer();
      74             : 
      75             :   void RemoveReadyPromise();
      76             : 
      77             :   // This only changes when a worker hijacks everything in its scope by calling
      78             :   // claim.
      79             :   RefPtr<workers::ServiceWorker> mControllerWorker;
      80             : 
      81             :   RefPtr<Promise> mReadyPromise;
      82             : };
      83             : 
      84             : } // namespace dom
      85             : } // namespace mozilla
      86             : 
      87             : #endif /* mozilla_dom_workers_serviceworkercontainer_h__ */

Generated by: LCOV version 1.13