Bug 1803960 - Fix "xperf: File '{profile}\credentialstate.sqlite' was accessed and we were not expecting it.", r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D163857
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#include "mozilla/ClearOnShutdown.h"
|
#include "mozilla/ClearOnShutdown.h"
|
||||||
#include "mozilla/OriginAttributes.h"
|
#include "mozilla/OriginAttributes.h"
|
||||||
#include "mozilla/Services.h"
|
#include "mozilla/Services.h"
|
||||||
|
#include "mozilla/StaticPrefs_dom.h"
|
||||||
#include "mozilla/StaticPtr.h"
|
#include "mozilla/StaticPtr.h"
|
||||||
#include "nsAppDirectoryServiceDefs.h"
|
#include "nsAppDirectoryServiceDefs.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
@@ -127,6 +128,10 @@ nsresult getDiskDatabaseConnection(mozIStorageConnection** aDatabase) {
|
|||||||
|
|
||||||
nsresult IdentityCredentialStorageService::Init() {
|
nsresult IdentityCredentialStorageService::Init() {
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
|
if (!StaticPrefs::dom_security_credentialmanagement_identity_enabled()) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
RefPtr<mozIStorageConnection> database;
|
RefPtr<mozIStorageConnection> database;
|
||||||
rv = getDiskDatabaseConnection(getter_AddRefs(database));
|
rv = getDiskDatabaseConnection(getter_AddRefs(database));
|
||||||
@@ -158,6 +163,9 @@ NS_IMETHODIMP IdentityCredentialStorageService::SetState(
|
|||||||
nsIPrincipal* aRPPrincipal, nsIPrincipal* aIDPPrincipal,
|
nsIPrincipal* aRPPrincipal, nsIPrincipal* aIDPPrincipal,
|
||||||
nsACString const& aCredentialID, bool aRegistered, bool aAllowLogout) {
|
nsACString const& aCredentialID, bool aRegistered, bool aAllowLogout) {
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
|
if (!StaticPrefs::dom_security_credentialmanagement_identity_enabled()) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
MOZ_ASSERT(XRE_IsParentProcess());
|
MOZ_ASSERT(XRE_IsParentProcess());
|
||||||
NS_ENSURE_ARG_POINTER(aRPPrincipal);
|
NS_ENSURE_ARG_POINTER(aRPPrincipal);
|
||||||
NS_ENSURE_ARG_POINTER(aIDPPrincipal);
|
NS_ENSURE_ARG_POINTER(aIDPPrincipal);
|
||||||
@@ -228,6 +236,11 @@ NS_IMETHODIMP IdentityCredentialStorageService::GetState(
|
|||||||
nsIPrincipal* aRPPrincipal, nsIPrincipal* aIDPPrincipal,
|
nsIPrincipal* aRPPrincipal, nsIPrincipal* aIDPPrincipal,
|
||||||
nsACString const& aCredentialID, bool* aRegistered, bool* aAllowLogout) {
|
nsACString const& aCredentialID, bool* aRegistered, bool* aAllowLogout) {
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
|
if (!StaticPrefs::dom_security_credentialmanagement_identity_enabled()) {
|
||||||
|
*aRegistered = false;
|
||||||
|
*aAllowLogout = false;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
rv = IdentityCredentialStorageService::ValidatePrincipal(aRPPrincipal);
|
rv = IdentityCredentialStorageService::ValidatePrincipal(aRPPrincipal);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
@@ -291,6 +304,9 @@ NS_IMETHODIMP IdentityCredentialStorageService::Delete(
|
|||||||
nsIPrincipal* aRPPrincipal, nsIPrincipal* aIDPPrincipal,
|
nsIPrincipal* aRPPrincipal, nsIPrincipal* aIDPPrincipal,
|
||||||
nsACString const& aCredentialID) {
|
nsACString const& aCredentialID) {
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
|
if (!StaticPrefs::dom_security_credentialmanagement_identity_enabled()) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
rv = IdentityCredentialStorageService::ValidatePrincipal(aRPPrincipal);
|
rv = IdentityCredentialStorageService::ValidatePrincipal(aRPPrincipal);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
@@ -338,6 +354,9 @@ NS_IMETHODIMP IdentityCredentialStorageService::Delete(
|
|||||||
|
|
||||||
NS_IMETHODIMP IdentityCredentialStorageService::Clear() {
|
NS_IMETHODIMP IdentityCredentialStorageService::Clear() {
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
|
if (!StaticPrefs::dom_security_credentialmanagement_identity_enabled()) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
RefPtr<mozIStorageConnection> database;
|
RefPtr<mozIStorageConnection> database;
|
||||||
nsresult rv = getDiskDatabaseConnection(getter_AddRefs(database));
|
nsresult rv = getDiskDatabaseConnection(getter_AddRefs(database));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
@@ -357,6 +376,9 @@ NS_IMETHODIMP IdentityCredentialStorageService::Clear() {
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
IdentityCredentialStorageService::DeleteFromOriginAttributesPattern(
|
IdentityCredentialStorageService::DeleteFromOriginAttributesPattern(
|
||||||
nsAString const& aOriginAttributesPattern) {
|
nsAString const& aOriginAttributesPattern) {
|
||||||
|
if (!StaticPrefs::dom_security_credentialmanagement_identity_enabled()) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
NS_ENSURE_FALSE(aOriginAttributesPattern.IsEmpty(), NS_ERROR_FAILURE);
|
NS_ENSURE_FALSE(aOriginAttributesPattern.IsEmpty(), NS_ERROR_FAILURE);
|
||||||
|
|
||||||
@@ -431,6 +453,9 @@ IdentityCredentialStorageService::DeleteFromOriginAttributesPattern(
|
|||||||
|
|
||||||
NS_IMETHODIMP IdentityCredentialStorageService::DeleteFromTimeRange(
|
NS_IMETHODIMP IdentityCredentialStorageService::DeleteFromTimeRange(
|
||||||
int64_t aStart, int64_t aEnd) {
|
int64_t aStart, int64_t aEnd) {
|
||||||
|
if (!StaticPrefs::dom_security_credentialmanagement_identity_enabled()) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
RefPtr<mozIStorageConnection> database;
|
RefPtr<mozIStorageConnection> database;
|
||||||
@@ -471,6 +496,9 @@ NS_IMETHODIMP IdentityCredentialStorageService::DeleteFromTimeRange(
|
|||||||
NS_IMETHODIMP IdentityCredentialStorageService::
|
NS_IMETHODIMP IdentityCredentialStorageService::
|
||||||
IdentityCredentialStorageService::DeleteFromPrincipal(
|
IdentityCredentialStorageService::DeleteFromPrincipal(
|
||||||
nsIPrincipal* aRPPrincipal) {
|
nsIPrincipal* aRPPrincipal) {
|
||||||
|
if (!StaticPrefs::dom_security_credentialmanagement_identity_enabled()) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
IdentityCredentialStorageService::ValidatePrincipal(aRPPrincipal);
|
IdentityCredentialStorageService::ValidatePrincipal(aRPPrincipal);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
@@ -509,6 +537,9 @@ NS_IMETHODIMP IdentityCredentialStorageService::
|
|||||||
|
|
||||||
NS_IMETHODIMP IdentityCredentialStorageService::DeleteFromBaseDomain(
|
NS_IMETHODIMP IdentityCredentialStorageService::DeleteFromBaseDomain(
|
||||||
nsACString const& aBaseDomain) {
|
nsACString const& aBaseDomain) {
|
||||||
|
if (!StaticPrefs::dom_security_credentialmanagement_identity_enabled()) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
RefPtr<mozIStorageConnection> database;
|
RefPtr<mozIStorageConnection> database;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
head = head.js
|
head = head.js
|
||||||
|
prefs =
|
||||||
|
dom.security.credentialmanagement.identity.enabled=true
|
||||||
|
|
||||||
[test_identity_credential_storage_service.js]
|
[test_identity_credential_storage_service.js]
|
||||||
|
|||||||
Reference in New Issue
Block a user