Bug 1286798 - Part 19: Implement a helper method for datastore preloading verification; r=asuth

A new type of request is introduced, PBackgroundLSSimpleRequest. This protocol is much simpler than PBackgroundLSRequest which needs to be cancelable.
This commit is contained in:
Jan Varga 2018-11-29 21:48:15 +01:00
parent b968ceb813
commit 81c542fbe6
18 changed files with 735 additions and 2 deletions

View File

@ -277,5 +277,42 @@ LSRequestChild::RecvReady()
return IPC_OK();
}
/*******************************************************************************
* LSSimpleRequestChild
******************************************************************************/
LSSimpleRequestChild::LSSimpleRequestChild(
LSSimpleRequestChildCallback* aCallback)
: mCallback(aCallback)
{
AssertIsOnOwningThread();
MOZ_ASSERT(aCallback);
MOZ_COUNT_CTOR(LSSimpleRequestChild);
}
LSSimpleRequestChild::~LSSimpleRequestChild()
{
AssertIsOnOwningThread();
MOZ_COUNT_DTOR(LSSimpleRequestChild);
}
void
LSSimpleRequestChild::ActorDestroy(ActorDestroyReason aWhy)
{
AssertIsOnOwningThread();
}
mozilla::ipc::IPCResult
LSSimpleRequestChild::Recv__delete__(const LSSimpleRequestResponse& aResponse)
{
AssertIsOnOwningThread();
mCallback->OnResponse(aResponse);
return IPC_OK();
}
} // namespace dom
} // namespace mozilla

View File

@ -11,6 +11,7 @@
#include "mozilla/dom/PBackgroundLSObjectChild.h"
#include "mozilla/dom/PBackgroundLSObserverChild.h"
#include "mozilla/dom/PBackgroundLSRequestChild.h"
#include "mozilla/dom/PBackgroundLSSimpleRequestChild.h"
namespace mozilla {
@ -22,10 +23,12 @@ class BackgroundChildImpl;
namespace dom {
class LocalStorageManager2;
class LSDatabase;
class LSObject;
class LSObserver;
class LSRequestChildCallback;
class LSSimpleRequestChildCallback;
class LSObjectChild final
: public PBackgroundLSObjectChild
@ -196,6 +199,50 @@ protected:
{ }
};
class LSSimpleRequestChild final
: public PBackgroundLSSimpleRequestChild
{
friend class LocalStorageManager2;
RefPtr<LSSimpleRequestChildCallback> mCallback;
NS_DECL_OWNINGTHREAD
public:
void
AssertIsOnOwningThread() const
{
NS_ASSERT_OWNINGTHREAD(LSSimpleReqeustChild);
}
private:
// Only created by LocalStorageManager2.
explicit LSSimpleRequestChild(LSSimpleRequestChildCallback* aCallback);
// Only destroyed by mozilla::ipc::BackgroundChildImpl.
~LSSimpleRequestChild();
// IPDL methods are only called by IPDL.
void
ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult
Recv__delete__(const LSSimpleRequestResponse& aResponse) override;
};
class NS_NO_VTABLE LSSimpleRequestChildCallback
{
public:
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
virtual void
OnResponse(const LSSimpleRequestResponse& aResponse) = 0;
protected:
virtual ~LSSimpleRequestChildCallback()
{ }
};
} // namespace dom
} // namespace mozilla

View File

@ -18,6 +18,7 @@
#include "mozilla/dom/PBackgroundLSObserverParent.h"
#include "mozilla/dom/PBackgroundLSRequestParent.h"
#include "mozilla/dom/PBackgroundLSSharedTypes.h"
#include "mozilla/dom/PBackgroundLSSimpleRequestParent.h"
#include "mozilla/dom/quota/QuotaManager.h"
#include "mozilla/dom/quota/UsageInfo.h"
#include "mozilla/ipc/BackgroundParent.h"
@ -1494,6 +1495,74 @@ private:
GetResponse(LSRequestResponse& aResponse) override;
};
class LSSimpleRequestBase
: public DatastoreOperationBase
, public PBackgroundLSSimpleRequestParent
{
protected:
enum class State
{
// Just created on the PBackground thread. Next step is Opening.
Initial,
// Waiting to open/opening on the main thread. Next step is SendingResults.
Opening,
// Waiting to send/sending results on the PBackground thread. Next step is
// Completed.
SendingResults,
// All done.
Completed
};
State mState;
public:
LSSimpleRequestBase();
void
Dispatch();
protected:
~LSSimpleRequestBase() override;
virtual nsresult
Open() = 0;
virtual void
GetResponse(LSSimpleRequestResponse& aResponse) = 0;
private:
void
SendResults();
// Common nsIRunnable implementation that subclasses may not override.
NS_IMETHOD
Run() final;
// IPDL methods.
void
ActorDestroy(ActorDestroyReason aWhy) override;
};
class PreloadedOp
: public LSSimpleRequestBase
{
const LSSimpleRequestPreloadedParams mParams;
nsCString mOrigin;
public:
explicit PreloadedOp(const LSSimpleRequestParams& aParams);
private:
nsresult
Open() override;
void
GetResponse(LSSimpleRequestResponse& aResponse) override;
};
/*******************************************************************************
* Other class declarations
******************************************************************************/
@ -1877,6 +1946,67 @@ DeallocPBackgroundLSRequestParent(PBackgroundLSRequestParent* aActor)
return true;
}
PBackgroundLSSimpleRequestParent*
AllocPBackgroundLSSimpleRequestParent(const LSSimpleRequestParams& aParams)
{
AssertIsOnBackgroundThread();
if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread())) {
return nullptr;
}
RefPtr<LSSimpleRequestBase> actor;
switch (aParams.type()) {
case LSSimpleRequestParams::TLSSimpleRequestPreloadedParams: {
RefPtr<PreloadedOp> preloadedOp =
new PreloadedOp(aParams);
actor = std::move(preloadedOp);
break;
}
default:
MOZ_CRASH("Should never get here!");
}
// Transfer ownership to IPDL.
return actor.forget().take();
}
bool
RecvPBackgroundLSSimpleRequestConstructor(
PBackgroundLSSimpleRequestParent* aActor,
const LSSimpleRequestParams& aParams)
{
AssertIsOnBackgroundThread();
MOZ_ASSERT(aActor);
MOZ_ASSERT(aParams.type() != LSSimpleRequestParams::T__None);
MOZ_ASSERT(!QuotaClient::IsShuttingDownOnBackgroundThread());
// The actor is now completely built.
auto* op = static_cast<LSSimpleRequestBase*>(aActor);
op->Dispatch();
return true;
}
bool
DeallocPBackgroundLSSimpleRequestParent(
PBackgroundLSSimpleRequestParent* aActor)
{
AssertIsOnBackgroundThread();
// Transfer ownership back from IPDL.
RefPtr<LSSimpleRequestBase> actor =
dont_AddRef(static_cast<LSSimpleRequestBase*>(aActor));
return true;
}
namespace localstorage {
already_AddRefed<mozilla::dom::quota::Client>
@ -4227,6 +4357,173 @@ PrepareObserverOp::GetResponse(LSRequestResponse& aResponse)
aResponse = prepareObserverResponse;
}
/*******************************************************************************
+ * LSSimpleRequestBase
+ ******************************************************************************/
LSSimpleRequestBase::LSSimpleRequestBase()
: mState(State::Initial)
{
}
LSSimpleRequestBase::~LSSimpleRequestBase()
{
MOZ_ASSERT_IF(MayProceedOnNonOwningThread(),
mState == State::Initial || mState == State::Completed);
}
void
LSSimpleRequestBase::Dispatch()
{
AssertIsOnOwningThread();
mState = State::Opening;
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(this));
}
void
LSSimpleRequestBase::SendResults()
{
AssertIsOnOwningThread();
MOZ_ASSERT(mState == State::SendingResults);
if (!MayProceed()) {
MaybeSetFailureCode(NS_ERROR_FAILURE);
} else {
LSSimpleRequestResponse response;
if (NS_SUCCEEDED(ResultCode())) {
GetResponse(response);
} else {
response = ResultCode();
}
Unused <<
PBackgroundLSSimpleRequestParent::Send__delete__(this, response);
}
mState = State::Completed;
}
NS_IMETHODIMP
LSSimpleRequestBase::Run()
{
nsresult rv;
switch (mState) {
case State::Opening:
rv = Open();
break;
case State::SendingResults:
SendResults();
return NS_OK;
default:
MOZ_CRASH("Bad state!");
}
if (NS_WARN_IF(NS_FAILED(rv)) && mState != State::SendingResults) {
MaybeSetFailureCode(rv);
// Must set mState before dispatching otherwise we will race with the owning
// thread.
mState = State::SendingResults;
if (IsOnOwningThread()) {
SendResults();
} else {
MOZ_ALWAYS_SUCCEEDS(
OwningEventTarget()->Dispatch(this, NS_DISPATCH_NORMAL));
}
}
return NS_OK;
}
void
LSSimpleRequestBase::ActorDestroy(ActorDestroyReason aWhy)
{
AssertIsOnOwningThread();
NoteComplete();
}
/*******************************************************************************
* PreloadedOp
******************************************************************************/
PreloadedOp::PreloadedOp(const LSSimpleRequestParams& aParams)
: mParams(aParams.get_LSSimpleRequestPreloadedParams())
{
MOZ_ASSERT(aParams.type() ==
LSSimpleRequestParams::TLSSimpleRequestPreloadedParams);
}
nsresult
PreloadedOp::Open()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mState == State::Opening);
if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
!MayProceedOnNonOwningThread()) {
return NS_ERROR_FAILURE;
}
const PrincipalInfo& principalInfo = mParams.principalInfo();
if (principalInfo.type() == PrincipalInfo::TSystemPrincipalInfo) {
QuotaManager::GetInfoForChrome(nullptr, nullptr, &mOrigin);
} else {
MOZ_ASSERT(principalInfo.type() == PrincipalInfo::TContentPrincipalInfo);
nsresult rv;
nsCOMPtr<nsIPrincipal> principal =
PrincipalInfoToPrincipal(principalInfo, &rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
rv = QuotaManager::GetInfoFromPrincipal(principal,
nullptr,
nullptr,
&mOrigin);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
mState = State::SendingResults;
MOZ_ALWAYS_SUCCEEDS(OwningEventTarget()->Dispatch(this, NS_DISPATCH_NORMAL));
return NS_OK;
}
void
PreloadedOp::GetResponse(LSSimpleRequestResponse& aResponse)
{
AssertIsOnOwningThread();
MOZ_ASSERT(mState == State::SendingResults);
MOZ_ASSERT(NS_SUCCEEDED(ResultCode()));
bool preloaded;
RefPtr<Datastore> datastore;
if (gDatastores &&
(datastore = gDatastores->Get(mOrigin)) &&
!datastore->IsClosed()) {
preloaded = true;
} else {
preloaded = false;
}
LSSimpleRequestPreloadedResponse preloadedResponse;
preloadedResponse.preloaded() = preloaded;
aResponse = preloadedResponse;
}
/*******************************************************************************
* QuotaClient
******************************************************************************/

View File

@ -19,9 +19,11 @@ class PrincipalInfo;
namespace dom {
class LSRequestParams;
class LSSimpleRequestParams;
class PBackgroundLSObjectParent;
class PBackgroundLSObserverParent;
class PBackgroundLSRequestParent;
class PBackgroundLSSimpleRequestParent;
namespace quota {
@ -67,6 +69,18 @@ RecvPBackgroundLSRequestConstructor(PBackgroundLSRequestParent* aActor,
bool
DeallocPBackgroundLSRequestParent(PBackgroundLSRequestParent* aActor);
PBackgroundLSSimpleRequestParent*
AllocPBackgroundLSSimpleRequestParent(const LSSimpleRequestParams& aParams);
bool
RecvPBackgroundLSSimpleRequestConstructor(
PBackgroundLSSimpleRequestParent* aActor,
const LSSimpleRequestParams& aParams);
bool
DeallocPBackgroundLSSimpleRequestParent(
PBackgroundLSSimpleRequestParent* aActor);
namespace localstorage {
already_AddRefed<mozilla::dom::quota::Client>

View File

@ -7,10 +7,83 @@
#include "LocalStorageManager2.h"
#include "LSObject.h"
#include "mozilla/dom/Promise.h"
namespace mozilla {
namespace dom {
namespace {
class SimpleRequestResolver final
: public LSSimpleRequestChildCallback
{
RefPtr<Promise> mPromise;
public:
explicit SimpleRequestResolver(Promise* aPromise)
: mPromise(aPromise)
{ }
NS_INLINE_DECL_REFCOUNTING(SimpleRequestResolver, override);
private:
~SimpleRequestResolver() = default;
void
HandleResponse(nsresult aResponse);
void
HandleResponse(bool aResponse);
// LSRequestChildCallback
void
OnResponse(const LSSimpleRequestResponse& aResponse) override;
};
nsresult
CreatePromise(JSContext* aContext, Promise** aPromise)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aContext);
nsIGlobalObject* global =
xpc::NativeGlobal(JS::CurrentGlobalOrNull(aContext));
if (NS_WARN_IF(!global)) {
return NS_ERROR_FAILURE;
}
ErrorResult result;
RefPtr<Promise> promise = Promise::Create(global, result);
if (result.Failed()) {
return result.StealNSResult();
}
promise.forget(aPromise);
return NS_OK;
}
nsresult
CheckedPrincipalToPrincipalInfo(nsIPrincipal* aPrincipal,
PrincipalInfo& aPrincipalInfo)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aPrincipal);
nsresult rv = PrincipalToPrincipalInfo(aPrincipal, &aPrincipalInfo);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
if (aPrincipalInfo.type() != PrincipalInfo::TContentPrincipalInfo &&
aPrincipalInfo.type() != PrincipalInfo::TSystemPrincipalInfo) {
return NS_ERROR_UNEXPECTED;
}
return NS_OK;
}
} // namespace
LocalStorageManager2::LocalStorageManager2()
{
MOZ_ASSERT(NS_IsMainThread());
@ -109,5 +182,100 @@ LocalStorageManager2::GetNextGenLocalStorageEnabled(bool* aResult)
return NS_OK;
}
NS_IMETHODIMP
LocalStorageManager2::IsPreloaded(nsIPrincipal* aPrincipal,
JSContext* aContext,
nsISupports** _retval)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aPrincipal);
MOZ_ASSERT(_retval);
RefPtr<Promise> promise;
nsresult rv = CreatePromise(aContext, getter_AddRefs(promise));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
LSSimpleRequestPreloadedParams params;
rv = CheckedPrincipalToPrincipalInfo(aPrincipal,
params.principalInfo());
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
rv = StartSimpleRequest(promise, params);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
promise.forget(_retval);
return NS_OK;
}
nsresult
LocalStorageManager2::StartSimpleRequest(Promise* aPromise,
const LSSimpleRequestParams& aParams)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aPromise);
PBackgroundChild* backgroundActor =
BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!backgroundActor)) {
return NS_ERROR_FAILURE;
}
RefPtr<SimpleRequestResolver> resolver = new SimpleRequestResolver(aPromise);
auto actor = new LSSimpleRequestChild(resolver);
if (!backgroundActor->SendPBackgroundLSSimpleRequestConstructor(actor,
aParams)) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
void
SimpleRequestResolver::HandleResponse(nsresult aResponse)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mPromise);
mPromise->MaybeReject(aResponse);
}
void
SimpleRequestResolver::HandleResponse(bool aResponse)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mPromise);
mPromise->MaybeResolve(aResponse);
}
void
SimpleRequestResolver::OnResponse(const LSSimpleRequestResponse& aResponse)
{
MOZ_ASSERT(NS_IsMainThread());
switch (aResponse.type()) {
case LSSimpleRequestResponse::Tnsresult:
HandleResponse(aResponse.get_nsresult());
break;
case LSSimpleRequestResponse::TLSSimpleRequestPreloadedResponse:
HandleResponse(
aResponse.get_LSSimpleRequestPreloadedResponse().preloaded());
break;
default:
MOZ_CRASH("Unknown response type!");
}
}
} // namespace dom
} // namespace mozilla

View File

@ -13,6 +13,9 @@
namespace mozilla {
namespace dom {
class LSSimpleRequestParams;
class Promise;
class LocalStorageManager2 final
: public nsIDOMStorageManager
, public nsILocalStorageManager
@ -26,6 +29,10 @@ public:
private:
~LocalStorageManager2();
nsresult
StartSimpleRequest(Promise* aPromise,
const LSSimpleRequestParams& aParams);
};
} // namespace dom

View File

@ -23,5 +23,15 @@ union LSRequestParams
LSRequestPrepareObserverParams;
};
struct LSSimpleRequestPreloadedParams
{
PrincipalInfo principalInfo;
};
union LSSimpleRequestParams
{
LSSimpleRequestPreloadedParams;
};
} // namespace dom
} // namespace mozilla

View File

@ -0,0 +1,30 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PBackground;
namespace mozilla {
namespace dom {
struct LSSimpleRequestPreloadedResponse
{
bool preloaded;
};
union LSSimpleRequestResponse
{
nsresult;
LSSimpleRequestPreloadedResponse;
};
protocol PBackgroundLSSimpleRequest
{
manager PBackground;
child:
async __delete__(LSSimpleRequestResponse response);
};
} // namespace dom
} // namespace mozilla

View File

@ -38,6 +38,7 @@ IPDL_SOURCES += [
'PBackgroundLSObserver.ipdl',
'PBackgroundLSRequest.ipdl',
'PBackgroundLSSharedTypes.ipdlh',
'PBackgroundLSSimpleRequest.ipdl',
]
include('/ipc/chromium/chromium-config.mozbuild')

View File

@ -12,4 +12,7 @@ interface nsIPrincipal;
interface nsILocalStorageManager : nsISupports
{
readonly attribute boolean nextGenLocalStorageEnabled;
[implicit_jscontext] nsISupports
isPreloaded(in nsIPrincipal aPrincipal);
};

View File

@ -381,6 +381,18 @@ LocalStorageManager::GetNextGenLocalStorageEnabled(bool* aResult)
return NS_OK;
}
NS_IMETHODIMP
LocalStorageManager::IsPreloaded(nsIPrincipal* aPrincipal,
JSContext* aContext,
nsISupports** _retval)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aPrincipal);
MOZ_ASSERT(_retval);
return NS_ERROR_NOT_IMPLEMENTED;
}
void
LocalStorageManager::ClearCaches(uint32_t aUnloadFlags,
const OriginAttributesPattern& aPattern,

View File

@ -53,8 +53,8 @@ run-if = e10s
skip-if = !e10s || os != "win" || processor != "x86" # Large-Allocation requires e10s
[browser_largeAllocation_non_win32.js]
skip-if = !e10s || (os == "win" && processor == "x86") || (verify && debug && (os == 'linux')) || (os == 'linux') || (os == 'mac' && debug) # Large-Allocation requires e10s # Bug 1336075
#[browser_localStorage_e10s.js]
#skip-if = !e10s || verify # This is a test of e10s functionality.
[browser_localStorage_e10s.js]
skip-if = !e10s || verify # This is a test of e10s functionality.
[browser_localStorage_privatestorageevent.js]
[browser_persist_cookies.js]
support-files =

View File

@ -79,6 +79,10 @@ async function cleanupTabs(knownTabs) {
* - Us generating a "domstorage-test-flush-force" observer notification.
*/
function waitForLocalStorageFlush() {
if (Services.lsm.nextGenLocalStorageEnabled) {
return new Promise(resolve => executeSoon(resolve));
}
return new Promise(function(resolve) {
let observer = {
observe: function() {
@ -101,6 +105,10 @@ function waitForLocalStorageFlush() {
* notifications, but correctness is guaranteed after the second notification.
*/
function triggerAndWaitForLocalStorageFlush() {
if (Services.lsm.nextGenLocalStorageEnabled) {
return new Promise(resolve => executeSoon(resolve));
}
SpecialPowers.notifyObservers(null, "domstorage-test-flush-force");
// This first wait is ambiguous...
return waitForLocalStorageFlush().then(function() {
@ -127,6 +135,18 @@ function clearOriginStorageEnsuringNoPreload() {
let principal =
Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
HELPER_PAGE_ORIGIN);
if (Services.lsm.nextGenLocalStorageEnabled) {
let request =
Services.qms.clearStoragesForPrincipal(principal, "default", "ls");
let promise = new Promise(resolve => {
request.callback = () => {
resolve();
};
});
return promise;
}
// We want to use createStorage to force the cache to be created so we can
// issue the clear. It's possible for getStorage to return false but for the
// origin preload hash to still have our origin in it.
@ -146,6 +166,9 @@ async function verifyTabPreload(knownTab, expectStorageExists) {
let principal =
Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
origin);
if (Services.lsm.nextGenLocalStorageEnabled) {
return Services.lsm.isPreloaded(principal);
}
return !!Services.domStorageManager.getStorage(null, principal);
});
is(storageExists, expectStorageExists, "Storage existence === preload");

View File

@ -19,6 +19,7 @@
#include "mozilla/dom/PBackgroundLSObjectChild.h"
#include "mozilla/dom/PBackgroundLSObserverChild.h"
#include "mozilla/dom/PBackgroundLSRequestChild.h"
#include "mozilla/dom/PBackgroundLSSimpleRequestChild.h"
#include "mozilla/dom/PBackgroundSDBConnectionChild.h"
#include "mozilla/dom/PFileSystemRequestChild.h"
#include "mozilla/dom/FileSystemTaskBase.h"
@ -317,6 +318,24 @@ BackgroundChildImpl::DeallocPBackgroundLocalStorageCacheChild(
return true;
}
BackgroundChildImpl::PBackgroundLSSimpleRequestChild*
BackgroundChildImpl::AllocPBackgroundLSSimpleRequestChild(
const LSSimpleRequestParams& aParams)
{
MOZ_CRASH("PBackgroundLSSimpleRequestChild actor should be manually "
"constructed!");
}
bool
BackgroundChildImpl::DeallocPBackgroundLSSimpleRequestChild(
PBackgroundLSSimpleRequestChild* aActor)
{
MOZ_ASSERT(aActor);
delete aActor;
return true;
}
BackgroundChildImpl::PBackgroundStorageChild*
BackgroundChildImpl::AllocPBackgroundStorageChild(const nsString& aProfilePath)
{

View File

@ -100,6 +100,15 @@ protected:
virtual bool
DeallocPBackgroundLSRequestChild(PBackgroundLSRequestChild* aActor) override;
virtual PBackgroundLSSimpleRequestChild*
AllocPBackgroundLSSimpleRequestChild(const LSSimpleRequestParams& aParams)
override;
virtual bool
DeallocPBackgroundLSSimpleRequestChild(
PBackgroundLSSimpleRequestChild* aActor)
override;
virtual PBackgroundLocalStorageCacheChild*
AllocPBackgroundLocalStorageCacheChild(const PrincipalInfo& aPrincipalInfo,
const nsCString& aOriginKey,

View File

@ -412,6 +412,43 @@ BackgroundParentImpl::DeallocPBackgroundLSRequestParent(
return mozilla::dom::DeallocPBackgroundLSRequestParent(aActor);
}
BackgroundParentImpl::PBackgroundLSSimpleRequestParent*
BackgroundParentImpl::AllocPBackgroundLSSimpleRequestParent(
const LSSimpleRequestParams& aParams)
{
AssertIsInMainProcess();
AssertIsOnBackgroundThread();
return mozilla::dom::AllocPBackgroundLSSimpleRequestParent(aParams);
}
mozilla::ipc::IPCResult
BackgroundParentImpl::RecvPBackgroundLSSimpleRequestConstructor(
PBackgroundLSSimpleRequestParent* aActor,
const LSSimpleRequestParams& aParams)
{
AssertIsInMainProcess();
AssertIsOnBackgroundThread();
MOZ_ASSERT(aActor);
if (!mozilla::dom::RecvPBackgroundLSSimpleRequestConstructor(aActor,
aParams)) {
return IPC_FAIL_NO_REASON(this);
}
return IPC_OK();
}
bool
BackgroundParentImpl::DeallocPBackgroundLSSimpleRequestParent(
PBackgroundLSSimpleRequestParent* aActor)
{
AssertIsInMainProcess();
AssertIsOnBackgroundThread();
MOZ_ASSERT(aActor);
return mozilla::dom::DeallocPBackgroundLSSimpleRequestParent(aActor);
}
BackgroundParentImpl::PBackgroundLocalStorageCacheParent*
BackgroundParentImpl::AllocPBackgroundLocalStorageCacheParent(
const PrincipalInfo& aPrincipalInfo,

View File

@ -115,6 +115,21 @@ protected:
DeallocPBackgroundLSRequestParent(PBackgroundLSRequestParent* aActor)
override;
virtual PBackgroundLSSimpleRequestParent*
AllocPBackgroundLSSimpleRequestParent(const LSSimpleRequestParams& aParams)
override;
virtual mozilla::ipc::IPCResult
RecvPBackgroundLSSimpleRequestConstructor(
PBackgroundLSSimpleRequestParent* aActor,
const LSSimpleRequestParams& aParams)
override;
virtual bool
DeallocPBackgroundLSSimpleRequestParent(
PBackgroundLSSimpleRequestParent* aActor)
override;
virtual PBackgroundLocalStorageCacheParent*
AllocPBackgroundLocalStorageCacheParent(const PrincipalInfo& aPrincipalInfo,
const nsCString& aOriginKey,

View File

@ -9,6 +9,7 @@ include protocol PBackgroundSDBConnection;
include protocol PBackgroundLSObject;
include protocol PBackgroundLSObserver;
include protocol PBackgroundLSRequest;
include protocol PBackgroundLSSimpleRequest;
include protocol PBackgroundLocalStorageCache;
include protocol PBackgroundStorage;
include protocol PBackgroundTest;
@ -79,6 +80,7 @@ sync protocol PBackground
manages PBackgroundLSObject;
manages PBackgroundLSObserver;
manages PBackgroundLSRequest;
manages PBackgroundLSSimpleRequest;
manages PBackgroundLocalStorageCache;
manages PBackgroundStorage;
manages PBackgroundTest;
@ -134,6 +136,8 @@ parent:
async PBackgroundLSRequest(LSRequestParams params);
async PBackgroundLSSimpleRequest(LSSimpleRequestParams params);
async PBackgroundLocalStorageCache(PrincipalInfo principalInfo,
nsCString originKey,
uint32_t privateBrowsingId);