1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "gfxFontSrcPrincipal.h"
8 #include "nsURIHashKey.h"
9 #include "mozilla/BasePrincipal.h"
10 #include "mozilla/HashFunctions.h"
12 using mozilla::BasePrincipal
;
14 gfxFontSrcPrincipal::gfxFontSrcPrincipal(nsIPrincipal
* aNodePrincipal
,
15 nsIPrincipal
* aStoragePrincipal
)
16 : mNodePrincipal(aNodePrincipal
),
17 mStoragePrincipal(mozilla::StaticPrefs::privacy_partition_network_state()
20 MOZ_ASSERT(NS_IsMainThread());
21 MOZ_ASSERT(aNodePrincipal
);
22 MOZ_ASSERT(aStoragePrincipal
);
25 mStoragePrincipal
->GetOriginSuffix(suffix
);
27 mHash
= mozilla::AddToHash(mStoragePrincipal
->GetHashValue(),
28 mozilla::HashString(suffix
));
31 gfxFontSrcPrincipal::~gfxFontSrcPrincipal() = default;
33 bool gfxFontSrcPrincipal::Equals(gfxFontSrcPrincipal
* aOther
) {
34 return BasePrincipal::Cast(mStoragePrincipal
)
35 ->FastEquals(BasePrincipal::Cast(aOther
->mStoragePrincipal
));