Bug 1700051: part 46) Const-qualify `mozInlineSpellStatus::mAnchorRange`. r=smaug
[gecko.git] / dom / worklet / WorkletPrincipals.cpp
blobf86ec11a9cbb1b9a364dddd23d0ceb975c355707
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 #include "WorkletPrincipals.h"
9 #include "mozilla/dom/WorkletImpl.h"
10 #include "nsJSPrincipals.h"
12 namespace mozilla {
13 namespace dom {
15 WorkletPrincipals::WorkletPrincipals(WorkletImpl* aWorkletImpl)
16 : JSPrincipals(), mWorkletImpl(aWorkletImpl) {
17 setDebugToken(kJSPrincipalsDebugToken);
20 WorkletPrincipals::~WorkletPrincipals() = default;
22 bool WorkletPrincipals::write(JSContext* aCx,
23 JSStructuredCloneWriter* aWriter) {
24 // This is a serialization of the NullPrincipal corresponding to the worklet
25 // environment settings object for the WorkletGlobalScope.
26 // https://drafts.css-houdini.org/worklets/#set-up-a-worklet-environment-settings-object
27 return nsJSPrincipals::WritePrincipalInfo(aWriter,
28 mWorkletImpl->PrincipalInfo());
31 bool WorkletPrincipals::isSystemOrAddonPrincipal() {
32 // Per Bug 1578623 rev a83797ed249c - Worklets are always NullPrincipal
33 return false;
36 void WorkletPrincipals::Destroy(JSPrincipals* aPrincipals) {
37 delete static_cast<WorkletPrincipals*>(aPrincipals);
40 } // namespace dom
41 } // namespace mozilla