Source code

Revision control

Other Tools

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
#ifndef _mozilla_dom_ServiceWorkerUtils_h
7
#define _mozilla_dom_ServiceWorkerUtils_h
8
9
#include "mozilla/MozPromise.h"
10
#include "mozilla/dom/ServiceWorkerRegistrationDescriptor.h"
11
#include "nsTArray.h"
12
13
class nsIURI;
14
15
namespace mozilla {
16
17
class CopyableErrorResult;
18
19
namespace dom {
20
21
class ClientInfo;
22
class ServiceWorkerRegistrationData;
23
class ServiceWorkerRegistrationDescriptor;
24
25
typedef MozPromise<ServiceWorkerRegistrationDescriptor, CopyableErrorResult,
26
false>
27
ServiceWorkerRegistrationPromise;
28
29
typedef MozPromise<nsTArray<ServiceWorkerRegistrationDescriptor>,
30
CopyableErrorResult, false>
31
ServiceWorkerRegistrationListPromise;
32
33
typedef std::function<void(const ServiceWorkerRegistrationDescriptor&)>
34
ServiceWorkerRegistrationCallback;
35
36
typedef std::function<void(
37
const nsTArray<ServiceWorkerRegistrationDescriptor>&)>
38
ServiceWorkerRegistrationListCallback;
39
40
typedef std::function<void(bool)> ServiceWorkerBoolCallback;
41
42
typedef std::function<void(ErrorResult&)> ServiceWorkerFailureCallback;
43
44
bool ServiceWorkerParentInterceptEnabled();
45
46
bool ServiceWorkerRegistrationDataIsValid(
47
const ServiceWorkerRegistrationData& aData);
48
49
nsresult ServiceWorkerScopeAndScriptAreValid(const ClientInfo& aClientInfo,
50
nsIURI* aScopeURI,
51
nsIURI* aScriptURI);
52
53
} // namespace dom
54
} // namespace mozilla
55
56
#endif // _mozilla_dom_ServiceWorkerUtils_h