Bug 1750871 - run mochitest-remote on fission everywhere. r=releng-reviewers,aki
[gecko.git] / dom / base / Crypto.h
blobbc0d65bb8bcebeb21cf3fca98c9db000c15cbba2
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_SCRIPT_HOLDER_CLASS(Crypto)
32 void GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
33 JS::MutableHandle<JSObject*> aRetval, ErrorResult& aRv);
35 void RandomUUID(nsAString& 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