Bug 1698238 return default dictionary from GetUserMediaRequest#getConstraints() if...
[gecko.git] / dom / worklet / WorkletPrincipals.h
bloba5132c04cb325b35e74fb96d1d553fc532465abf
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 DOM_WORKLET_WORKLETPRINCIPALS_H_
8 #define DOM_WORKLET_WORKLETPRINCIPALS_H_
10 #include "js/Principals.h"
11 #include "mozilla/RefPtr.h"
13 namespace mozilla {
15 class WorkletImpl;
17 namespace dom {
19 struct MOZ_HEAP_CLASS WorkletPrincipals final : public JSPrincipals {
20 // A new WorkletPrincipals has refcount zero.
21 explicit WorkletPrincipals(WorkletImpl* aWorkletImpl);
23 bool write(JSContext* aCx, JSStructuredCloneWriter* aWriter) override;
25 bool isSystemOrAddonPrincipal() override;
27 // Callback for JS_InitDestroyPrincipalsCallback()
28 static void Destroy(JSPrincipals* aPrincipals);
30 static const uint32_t kJSPrincipalsDebugToken = 0x7e2df9f4;
32 private:
33 ~WorkletPrincipals();
34 RefPtr<WorkletImpl> mWorkletImpl;
37 } // namespace dom
38 } // namespace mozilla
40 #endif // DOM_WORKLET_WORKLETPRINCIPALS_H_