Bug 1771337 [wpt PR 34217] - Convert `popup=popup` to `popup=auto` or just `popup...
[gecko.git] / dom / workers / Principal.cpp
blobc1166e355904c1a3715b10d51861ebb826d63316
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 "Principal.h"
9 #include "JSSettings.h"
10 #include "jsapi.h"
11 #include "mozilla/Assertions.h"
12 #include "mozilla/dom/StructuredCloneTags.h"
13 #include "mozilla/dom/workerinternals/JSSettings.h"
15 namespace mozilla::dom {
17 WorkerPrincipal::WorkerPrincipal(bool aIsSystemOrAddonPrincipal)
18 : JSPrincipals(), mIsSystemOrAddonPrincipal(aIsSystemOrAddonPrincipal) {
19 setDebugToken(workerinternals::kJSPrincipalsDebugToken);
22 WorkerPrincipal::~WorkerPrincipal() = default;
24 bool WorkerPrincipal::write(JSContext* aCx, JSStructuredCloneWriter* aWriter) {
25 return JS_WriteUint32Pair(aWriter, SCTAG_DOM_WORKER_PRINCIPAL, 0);
28 bool WorkerPrincipal::isSystemOrAddonPrincipal() {
29 return mIsSystemOrAddonPrincipal;
32 void WorkerPrincipal::Destroy(JSPrincipals* aPrincipals) {
33 delete static_cast<WorkerPrincipal*>(aPrincipals);
36 } // namespace mozilla::dom