From ed1318cf0a91f4c7cd88f5b977ba8280f59e187f Mon Sep 17 00:00:00 2001 From: Jan Varga Date: Tue, 13 Jul 2021 11:16:00 +0000 Subject: [PATCH] Bug 1591877 - Forbid creation of PBackgroundLSRequest/PBackgroundLSSimpleRequest actors in the parent process if LSNG is not enabled; r=dom-storage-reviewers,jstutte Differential Revision: https://phabricator.services.mozilla.com/D119710 --- dom/localstorage/ActorsParent.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dom/localstorage/ActorsParent.cpp b/dom/localstorage/ActorsParent.cpp index 77d9cd506282..351ec394cebb 100644 --- a/dom/localstorage/ActorsParent.cpp +++ b/dom/localstorage/ActorsParent.cpp @@ -3282,6 +3282,10 @@ PBackgroundLSRequestParent* AllocPBackgroundLSRequestParent( AssertIsOnBackgroundThread(); MOZ_ASSERT(aParams.type() != LSRequestParams::T__None); + if (NS_WARN_IF(!NextGenLocalStorageEnabled())) { + return nullptr; + } + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread())) { return nullptr; } @@ -3334,6 +3338,7 @@ bool RecvPBackgroundLSRequestConstructor(PBackgroundLSRequestParent* aActor, AssertIsOnBackgroundThread(); MOZ_ASSERT(aActor); MOZ_ASSERT(aParams.type() != LSRequestParams::T__None); + MOZ_ASSERT(NextGenLocalStorageEnabled()); MOZ_ASSERT(!QuotaClient::IsShuttingDownOnBackgroundThread()); // The actor is now completely built. @@ -3360,6 +3365,10 @@ PBackgroundLSSimpleRequestParent* AllocPBackgroundLSSimpleRequestParent( AssertIsOnBackgroundThread(); MOZ_ASSERT(aParams.type() != LSSimpleRequestParams::T__None); + if (NS_WARN_IF(!NextGenLocalStorageEnabled())) { + return nullptr; + } + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread())) { return nullptr; } @@ -3397,6 +3406,7 @@ bool RecvPBackgroundLSSimpleRequestConstructor( AssertIsOnBackgroundThread(); MOZ_ASSERT(aActor); MOZ_ASSERT(aParams.type() != LSSimpleRequestParams::T__None); + MOZ_ASSERT(NextGenLocalStorageEnabled()); MOZ_ASSERT(!QuotaClient::IsShuttingDownOnBackgroundThread()); // The actor is now completely built.