Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/Permissions.h
Line
Count
Source (jump to first uncovered line)
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 file,
5
 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef mozilla_dom_Permissions_h_
8
#define mozilla_dom_Permissions_h_
9
10
#include "nsISupports.h"
11
#include "nsPIDOMWindow.h"
12
#include "nsWrapperCache.h"
13
14
namespace mozilla {
15
16
class ErrorResult;
17
18
namespace dom {
19
20
class Promise;
21
22
class Permissions final
23
  : public nsISupports
24
  , public nsWrapperCache
25
{
26
public:
27
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
28
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Permissions)
29
30
  explicit Permissions(nsPIDOMWindowInner* aWindow);
31
32
0
  nsPIDOMWindowInner* GetParentObject() const { return mWindow; }
33
34
  JSObject* WrapObject(JSContext* aCx,
35
                       JS::Handle<JSObject*> aGivenProto) override;
36
37
  already_AddRefed<Promise> Query(JSContext* aCx,
38
                                  JS::Handle<JSObject*> aPermission,
39
                                  ErrorResult& aRv);
40
41
  static nsresult RemovePermission(nsIPrincipal* aPrincipal, const char* aPermissionType);
42
43
  already_AddRefed<Promise> Revoke(JSContext* aCx,
44
                                   JS::Handle<JSObject*> aPermission,
45
                                   ErrorResult& aRv);
46
47
private:
48
  ~Permissions();
49
50
  nsCOMPtr<nsPIDOMWindowInner> mWindow;
51
};
52
53
} // namespace dom
54
} // namespace mozilla
55
56
#endif // mozilla_dom_permissions_h_