Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / base / Crypto.h
blob75e3629b25c5d324ab777776c86b692b11dc3674
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/. */
7 #ifndef mozilla_dom_Crypto_h
8 #define mozilla_dom_Crypto_h
10 #include "mozilla/dom/SubtleCrypto.h"
11 #include "nsIGlobalObject.h"
12 #include "nsString.h"
13 #include "nsWrapperCache.h"
14 #include "mozilla/dom/TypedArray.h"
16 namespace mozilla {
18 class ErrorResult;
20 namespace dom {
22 class Crypto final : public nsISupports, public nsWrapperCache {
23 protected:
24 virtual ~Crypto();
26 public:
27 explicit Crypto(nsIGlobalObject* aParent);
29 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
30 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(Crypto)
32 void GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
33 JS::MutableHandle<JSObject*> aRetval, ErrorResult& aRv);
35 void RandomUUID(nsACString& aRetVal);
37 SubtleCrypto* Subtle();
39 nsIGlobalObject* GetParentObject() const { return mParent; }
41 virtual JSObject* WrapObject(JSContext* aCx,
42 JS::Handle<JSObject*> aGivenProto) override;
44 private:
45 nsCOMPtr<nsIGlobalObject> mParent;
46 RefPtr<SubtleCrypto> mSubtle;
49 } // namespace dom
50 } // namespace mozilla
52 #endif // mozilla_dom_Crypto_h