Backed out changeset f594e6f00208 (bug 1940883) for causing crashes in bug 1941164.
[gecko.git] / dom / push / PushSubscriptionOptions.h
blob9953a7bbbb574e90f1e248df01ce3727dd16bd6f
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/. */
7 #ifndef mozilla_dom_PushSubscriptionOptions_h
8 #define mozilla_dom_PushSubscriptionOptions_h
10 #include "js/RootingAPI.h"
11 #include "js/TypeDecls.h"
12 #include "mozilla/dom/ServiceWorkerUtils.h"
13 #include "nsCOMPtr.h"
14 #include "nsCycleCollectionParticipant.h"
15 #include "nsTArray.h"
16 #include "nsWrapperCache.h"
18 class nsIGlobalObject;
20 namespace mozilla {
22 class ErrorResult;
24 namespace dom {
26 class PushSubscriptionOptions final : public nsISupports,
27 public nsWrapperCache {
28 public:
29 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
30 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PushSubscriptionOptions)
32 PushSubscriptionOptions(nsIGlobalObject* aGlobal,
33 nsTArray<uint8_t>&& aRawAppServerKey);
35 nsIGlobalObject* GetParentObject() const { return mGlobal; }
37 JSObject* WrapObject(JSContext* aCx,
38 JS::Handle<JSObject*> aGivenProto) override;
40 void GetApplicationServerKey(JSContext* aCx,
41 JS::MutableHandle<JSObject*> aKey,
42 ErrorResult& aRv);
44 private:
45 ~PushSubscriptionOptions();
47 nsCOMPtr<nsIGlobalObject> mGlobal;
48 nsTArray<uint8_t> mRawAppServerKey;
49 JS::Heap<JSObject*> mAppServerKey;
52 } // namespace dom
53 } // namespace mozilla
55 #endif // mozilla_dom_PushSubscriptionOptions_h