2016-05-28 00:54:31 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-11-27 11:59:41 +04:00
|
|
|
/* 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 "BackgroundParentImpl.h"
|
|
|
|
|
2015-01-15 19:58:40 +03:00
|
|
|
#include "BroadcastChannelParent.h"
|
2014-09-27 03:21:57 +04:00
|
|
|
#include "FileDescriptorSetParent.h"
|
2015-09-18 09:29:14 +03:00
|
|
|
#ifdef MOZ_WEBRTC
|
2015-08-31 15:51:29 +03:00
|
|
|
# include "CamerasParent.h"
|
2015-09-18 09:29:14 +03:00
|
|
|
#endif
|
2013-11-27 11:59:41 +04:00
|
|
|
#include "mozilla/Assertions.h"
|
2020-10-21 02:32:54 +03:00
|
|
|
#include "mozilla/Preferences.h"
|
|
|
|
#include "mozilla/RDDProcessManager.h"
|
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "mozilla/RemoteLazyInputStreamParent.h"
|
|
|
|
#include "mozilla/StaticPrefs_dom.h"
|
2017-11-01 20:19:38 +03:00
|
|
|
#include "mozilla/dom/ClientManagerActors.h"
|
2015-01-15 19:58:40 +03:00
|
|
|
#include "mozilla/dom/ContentParent.h"
|
2015-11-28 13:48:28 +03:00
|
|
|
#include "mozilla/dom/DOMTypes.h"
|
2018-12-01 23:26:09 +03:00
|
|
|
#include "mozilla/dom/EndpointForReportParent.h"
|
2019-04-26 21:00:33 +03:00
|
|
|
#include "mozilla/dom/FileCreatorParent.h"
|
2016-04-09 21:17:02 +03:00
|
|
|
#include "mozilla/dom/FileSystemBase.h"
|
|
|
|
#include "mozilla/dom/FileSystemRequestParent.h"
|
2016-06-28 01:25:00 +03:00
|
|
|
#include "mozilla/dom/GamepadEventChannelParent.h"
|
2016-06-28 01:26:00 +03:00
|
|
|
#include "mozilla/dom/GamepadTestChannelParent.h"
|
2020-10-21 02:32:54 +03:00
|
|
|
#include "mozilla/dom/MIDIManagerParent.h"
|
|
|
|
#include "mozilla/dom/MIDIPlatformService.h"
|
|
|
|
#include "mozilla/dom/MIDIPortParent.h"
|
2019-07-15 18:49:30 +03:00
|
|
|
#include "mozilla/dom/MediaTransportParent.h"
|
2015-06-17 13:44:27 +03:00
|
|
|
#include "mozilla/dom/MessagePortParent.h"
|
2020-10-21 02:32:54 +03:00
|
|
|
#include "mozilla/dom/PGamepadEventChannelParent.h"
|
|
|
|
#include "mozilla/dom/PGamepadTestChannelParent.h"
|
|
|
|
#include "mozilla/dom/RemoteWorkerControllerParent.h"
|
|
|
|
#include "mozilla/dom/RemoteWorkerParent.h"
|
|
|
|
#include "mozilla/dom/RemoteWorkerServiceParent.h"
|
|
|
|
#include "mozilla/dom/ReportingHeader.h"
|
2018-07-10 02:02:39 +03:00
|
|
|
#include "mozilla/dom/ServiceWorkerActors.h"
|
2020-10-23 14:51:24 +03:00
|
|
|
#include "mozilla/dom/ServiceWorkerContainerParent.h"
|
2018-01-27 00:08:59 +03:00
|
|
|
#include "mozilla/dom/ServiceWorkerManagerParent.h"
|
2020-10-23 14:50:00 +03:00
|
|
|
#include "mozilla/dom/ServiceWorkerParent.h"
|
2015-02-11 14:53:00 +03:00
|
|
|
#include "mozilla/dom/ServiceWorkerRegistrar.h"
|
2020-10-23 14:52:49 +03:00
|
|
|
#include "mozilla/dom/ServiceWorkerRegistrationParent.h"
|
2020-10-21 02:32:54 +03:00
|
|
|
#include "mozilla/dom/SessionStorageManager.h"
|
|
|
|
#include "mozilla/dom/SharedWorkerParent.h"
|
2018-04-18 19:19:10 +03:00
|
|
|
#include "mozilla/dom/StorageActivityService.h"
|
2020-10-21 02:32:54 +03:00
|
|
|
#include "mozilla/dom/StorageIPC.h"
|
2019-04-26 21:01:53 +03:00
|
|
|
#include "mozilla/dom/TemporaryIPCBlobParent.h"
|
2020-10-21 02:32:54 +03:00
|
|
|
#include "mozilla/dom/WebAuthnTransactionParent.h"
|
2015-03-02 16:20:00 +03:00
|
|
|
#include "mozilla/dom/cache/ActorUtils.h"
|
2014-09-27 03:21:57 +04:00
|
|
|
#include "mozilla/dom/indexedDB/ActorsParent.h"
|
2018-11-29 23:47:20 +03:00
|
|
|
#include "mozilla/dom/localstorage/ActorsParent.h"
|
2020-10-21 02:32:54 +03:00
|
|
|
#include "mozilla/dom/network/UDPSocketParent.h"
|
2015-11-22 12:43:55 +03:00
|
|
|
#include "mozilla/dom/quota/ActorsParent.h"
|
2018-08-20 15:33:03 +03:00
|
|
|
#include "mozilla/dom/simpledb/ActorsParent.h"
|
2013-11-27 11:59:41 +04:00
|
|
|
#include "mozilla/ipc/BackgroundParent.h"
|
2015-01-15 19:58:40 +03:00
|
|
|
#include "mozilla/ipc/BackgroundUtils.h"
|
2017-03-14 14:29:43 +03:00
|
|
|
#include "mozilla/ipc/IPCStreamAlloc.h"
|
2020-10-21 02:32:54 +03:00
|
|
|
#include "mozilla/ipc/IdleSchedulerParent.h"
|
2015-02-11 14:53:00 +03:00
|
|
|
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
2013-11-27 11:59:41 +04:00
|
|
|
#include "mozilla/ipc/PBackgroundTestParent.h"
|
2017-03-14 14:28:58 +03:00
|
|
|
#include "mozilla/ipc/PChildToParentStreamParent.h"
|
2017-03-14 14:29:43 +03:00
|
|
|
#include "mozilla/ipc/PParentToChildStreamParent.h"
|
2015-01-14 02:37:00 +03:00
|
|
|
#include "mozilla/layout/VsyncParent.h"
|
2020-10-21 02:32:54 +03:00
|
|
|
#include "mozilla/media/MediaParent.h"
|
2020-05-07 17:39:21 +03:00
|
|
|
#include "mozilla/net/BackgroundDataBridgeParent.h"
|
2020-10-21 02:32:54 +03:00
|
|
|
#include "mozilla/net/HttpBackgroundChannelParent.h"
|
2020-02-28 13:58:56 +03:00
|
|
|
#include "mozilla/psm/VerifySSLServerCertParent.h"
|
2015-01-15 19:58:40 +03:00
|
|
|
#include "nsNetUtil.h"
|
2016-04-09 21:17:02 +03:00
|
|
|
#include "nsProxyRelease.h"
|
2013-11-27 11:59:41 +04:00
|
|
|
#include "nsThreadUtils.h"
|
|
|
|
#include "nsTraceRefcnt.h"
|
|
|
|
#include "nsXULAppAPI.h"
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
#ifdef DISABLE_ASSERTS_FOR_FUZZING
|
2015-02-07 02:05:08 +03:00
|
|
|
# define ASSERT_UNLESS_FUZZING(...) \
|
|
|
|
do { \
|
|
|
|
} while (0)
|
2014-09-27 03:21:57 +04:00
|
|
|
#else
|
2015-02-07 02:05:08 +03:00
|
|
|
# define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false)
|
2014-09-27 03:21:57 +04:00
|
|
|
#endif
|
|
|
|
|
2013-11-27 11:59:41 +04:00
|
|
|
using mozilla::AssertIsOnMainThread;
|
2016-04-09 21:17:02 +03:00
|
|
|
using mozilla::dom::FileSystemRequestParent;
|
2015-06-17 13:44:27 +03:00
|
|
|
using mozilla::dom::MessagePortParent;
|
2017-11-15 22:19:59 +03:00
|
|
|
using mozilla::dom::MIDIManagerParent;
|
|
|
|
using mozilla::dom::MIDIPlatformService;
|
|
|
|
using mozilla::dom::MIDIPortParent;
|
2015-06-17 13:44:27 +03:00
|
|
|
using mozilla::dom::PMessagePortParent;
|
2018-07-10 02:02:39 +03:00
|
|
|
using mozilla::dom::PMIDIManagerParent;
|
|
|
|
using mozilla::dom::PMIDIPortParent;
|
|
|
|
using mozilla::dom::PServiceWorkerContainerParent;
|
|
|
|
using mozilla::dom::PServiceWorkerParent;
|
|
|
|
using mozilla::dom::PServiceWorkerRegistrationParent;
|
2020-10-23 14:50:00 +03:00
|
|
|
using mozilla::dom::ServiceWorkerParent;
|
2015-05-29 17:14:14 +03:00
|
|
|
using mozilla::dom::UDPSocketParent;
|
2017-05-05 03:48:34 +03:00
|
|
|
using mozilla::dom::WebAuthnTransactionParent;
|
2015-03-02 16:20:00 +03:00
|
|
|
using mozilla::dom::cache::PCacheParent;
|
|
|
|
using mozilla::dom::cache::PCacheStorageParent;
|
|
|
|
using mozilla::dom::cache::PCacheStreamControlParent;
|
2018-02-05 21:55:07 +03:00
|
|
|
using mozilla::ipc::AssertIsOnBackgroundThread;
|
2013-11-27 11:59:41 +04:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class TestParent final : public mozilla::ipc::PBackgroundTestParent {
|
2013-11-27 11:59:41 +04:00
|
|
|
friend class mozilla::ipc::BackgroundParentImpl;
|
|
|
|
|
2020-02-20 14:40:14 +03:00
|
|
|
MOZ_COUNTED_DEFAULT_CTOR(TestParent)
|
2013-11-27 11:59:41 +04:00
|
|
|
|
2014-07-15 19:37:45 +04:00
|
|
|
protected:
|
|
|
|
~TestParent() override { MOZ_COUNT_DTOR(TestParent); }
|
2013-11-27 11:59:41 +04:00
|
|
|
|
2014-07-15 19:37:45 +04:00
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
void ActorDestroy(ActorDestroyReason aWhy) override;
|
2013-11-27 11:59:41 +04:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace
|
2013-11-27 11:59:41 +04:00
|
|
|
|
2020-01-18 16:48:34 +03:00
|
|
|
namespace mozilla::ipc {
|
2013-11-27 11:59:41 +04:00
|
|
|
|
2015-01-15 19:58:40 +03:00
|
|
|
using mozilla::dom::BroadcastChannelParent;
|
|
|
|
using mozilla::dom::ContentParent;
|
|
|
|
|
2013-11-27 11:59:41 +04:00
|
|
|
BackgroundParentImpl::BackgroundParentImpl() {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2013-11-27 11:59:41 +04:00
|
|
|
AssertIsOnMainThread();
|
|
|
|
|
|
|
|
MOZ_COUNT_CTOR(mozilla::ipc::BackgroundParentImpl);
|
|
|
|
}
|
|
|
|
|
|
|
|
BackgroundParentImpl::~BackgroundParentImpl() {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2013-11-27 11:59:41 +04:00
|
|
|
AssertIsOnMainThread();
|
|
|
|
|
|
|
|
MOZ_COUNT_DTOR(mozilla::ipc::BackgroundParentImpl);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BackgroundParentImpl::ActorDestroy(ActorDestroyReason aWhy) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2013-11-27 11:59:41 +04:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
}
|
|
|
|
|
2020-05-07 17:39:21 +03:00
|
|
|
already_AddRefed<net::PBackgroundDataBridgeParent>
|
|
|
|
BackgroundParentImpl::AllocPBackgroundDataBridgeParent(
|
|
|
|
const uint64_t& aChannelID) {
|
|
|
|
MOZ_ASSERT(XRE_IsSocketProcess(), "Should be in socket process");
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
RefPtr<net::BackgroundDataBridgeParent> actor =
|
|
|
|
new net::BackgroundDataBridgeParent(aChannelID);
|
|
|
|
return actor.forget();
|
|
|
|
}
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
BackgroundParentImpl::PBackgroundTestParent*
|
2013-11-27 11:59:41 +04:00
|
|
|
BackgroundParentImpl::AllocPBackgroundTestParent(const nsCString& aTestArg) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2013-11-27 11:59:41 +04:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return new TestParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvPBackgroundTestConstructor(
|
|
|
|
PBackgroundTestParent* aActor, const nsCString& aTestArg) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2013-11-27 11:59:41 +04:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!PBackgroundTestParent::Send__delete__(aActor, aTestArg)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2013-11-27 11:59:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPBackgroundTestParent(
|
|
|
|
PBackgroundTestParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2013-11-27 11:59:41 +04:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete static_cast<TestParent*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-10-16 08:56:52 +04:00
|
|
|
auto BackgroundParentImpl::AllocPBackgroundIDBFactoryParent(
|
2020-05-06 15:20:14 +03:00
|
|
|
const LoggingInfo& aLoggingInfo)
|
|
|
|
-> already_AddRefed<PBackgroundIDBFactoryParent> {
|
2014-09-27 03:21:57 +04:00
|
|
|
using mozilla::dom::indexedDB::AllocPBackgroundIDBFactoryParent;
|
|
|
|
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2014-09-27 03:21:57 +04:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2014-10-16 08:56:52 +04:00
|
|
|
return AllocPBackgroundIDBFactoryParent(aLoggingInfo);
|
2014-09-27 03:21:57 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2014-09-27 03:21:57 +04:00
|
|
|
BackgroundParentImpl::RecvPBackgroundIDBFactoryConstructor(
|
2014-10-16 08:56:52 +04:00
|
|
|
PBackgroundIDBFactoryParent* aActor, const LoggingInfo& aLoggingInfo) {
|
2014-09-27 03:21:57 +04:00
|
|
|
using mozilla::dom::indexedDB::RecvPBackgroundIDBFactoryConstructor;
|
|
|
|
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2014-09-27 03:21:57 +04:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!RecvPBackgroundIDBFactoryConstructor(aActor, aLoggingInfo)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2014-09-27 03:21:57 +04:00
|
|
|
}
|
|
|
|
|
2015-11-22 12:44:33 +03:00
|
|
|
auto BackgroundParentImpl::AllocPBackgroundIndexedDBUtilsParent()
|
|
|
|
-> PBackgroundIndexedDBUtilsParent* {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-11-22 12:44:33 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return mozilla::dom::indexedDB::AllocPBackgroundIndexedDBUtilsParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPBackgroundIndexedDBUtilsParent(
|
|
|
|
PBackgroundIndexedDBUtilsParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-11-22 12:44:33 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::indexedDB::DeallocPBackgroundIndexedDBUtilsParent(
|
|
|
|
aActor);
|
|
|
|
}
|
|
|
|
|
2016-02-10 18:11:25 +03:00
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvFlushPendingFileDeletions() {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2016-02-10 18:11:25 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!mozilla::dom::indexedDB::RecvFlushPendingFileDeletions()) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2016-02-10 18:11:25 +03:00
|
|
|
}
|
|
|
|
|
2018-08-20 15:33:03 +03:00
|
|
|
BackgroundParentImpl::PBackgroundSDBConnectionParent*
|
|
|
|
BackgroundParentImpl::AllocPBackgroundSDBConnectionParent(
|
2020-02-27 16:46:43 +03:00
|
|
|
const PersistenceType& aPersistenceType,
|
2018-08-20 15:33:03 +03:00
|
|
|
const PrincipalInfo& aPrincipalInfo) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-08-20 15:33:03 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2020-02-27 16:46:43 +03:00
|
|
|
return mozilla::dom::AllocPBackgroundSDBConnectionParent(aPersistenceType,
|
|
|
|
aPrincipalInfo);
|
2018-08-20 15:33:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPBackgroundSDBConnectionConstructor(
|
|
|
|
PBackgroundSDBConnectionParent* aActor,
|
2020-02-27 16:46:43 +03:00
|
|
|
const PersistenceType& aPersistenceType,
|
2018-08-20 15:33:03 +03:00
|
|
|
const PrincipalInfo& aPrincipalInfo) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-08-20 15:33:03 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
2020-02-27 16:46:43 +03:00
|
|
|
if (!mozilla::dom::RecvPBackgroundSDBConnectionConstructor(
|
|
|
|
aActor, aPersistenceType, aPrincipalInfo)) {
|
2018-08-20 15:33:03 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPBackgroundSDBConnectionParent(
|
|
|
|
PBackgroundSDBConnectionParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-08-20 15:33:03 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::DeallocPBackgroundSDBConnectionParent(aActor);
|
|
|
|
}
|
|
|
|
|
2018-11-29 23:48:41 +03:00
|
|
|
BackgroundParentImpl::PBackgroundLSDatabaseParent*
|
|
|
|
BackgroundParentImpl::AllocPBackgroundLSDatabaseParent(
|
2018-11-29 23:47:45 +03:00
|
|
|
const PrincipalInfo& aPrincipalInfo, const uint32_t& aPrivateBrowsingId,
|
2018-11-29 23:48:41 +03:00
|
|
|
const uint64_t& aDatastoreId) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-11-29 23:47:20 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2018-11-29 23:48:41 +03:00
|
|
|
return mozilla::dom::AllocPBackgroundLSDatabaseParent(
|
|
|
|
aPrincipalInfo, aPrivateBrowsingId, aDatastoreId);
|
2018-11-29 23:47:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
2018-11-29 23:48:41 +03:00
|
|
|
BackgroundParentImpl::RecvPBackgroundLSDatabaseConstructor(
|
2018-11-29 23:47:45 +03:00
|
|
|
PBackgroundLSDatabaseParent* aActor, const PrincipalInfo& aPrincipalInfo,
|
2018-11-29 23:48:41 +03:00
|
|
|
const uint32_t& aPrivateBrowsingId, const uint64_t& aDatastoreId) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-11-29 23:47:20 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
2018-11-29 23:48:41 +03:00
|
|
|
if (!mozilla::dom::RecvPBackgroundLSDatabaseConstructor(
|
|
|
|
aActor, aPrincipalInfo, aPrivateBrowsingId, aDatastoreId)) {
|
2018-11-29 23:47:20 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2018-11-29 23:48:41 +03:00
|
|
|
bool BackgroundParentImpl::DeallocPBackgroundLSDatabaseParent(
|
|
|
|
PBackgroundLSDatabaseParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-11-29 23:47:20 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
2018-11-29 23:48:41 +03:00
|
|
|
return mozilla::dom::DeallocPBackgroundLSDatabaseParent(aActor);
|
2018-11-29 23:47:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
BackgroundParentImpl::PBackgroundLSObserverParent*
|
|
|
|
BackgroundParentImpl::AllocPBackgroundLSObserverParent(
|
|
|
|
const uint64_t& aObserverId) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-11-29 23:47:45 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return mozilla::dom::AllocPBackgroundLSObserverParent(aObserverId);
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPBackgroundLSObserverConstructor(
|
|
|
|
PBackgroundLSObserverParent* aActor, const uint64_t& aObserverId) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-11-29 23:47:45 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
if (!mozilla::dom::RecvPBackgroundLSObserverConstructor(aActor,
|
|
|
|
aObserverId)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPBackgroundLSObserverParent(
|
|
|
|
PBackgroundLSObserverParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-11-29 23:47:45 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::DeallocPBackgroundLSObserverParent(aActor);
|
2018-11-29 23:47:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
BackgroundParentImpl::PBackgroundLSRequestParent*
|
|
|
|
BackgroundParentImpl::AllocPBackgroundLSRequestParent(
|
|
|
|
const LSRequestParams& aParams) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-11-29 23:47:20 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return mozilla::dom::AllocPBackgroundLSRequestParent(this, aParams);
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPBackgroundLSRequestConstructor(
|
|
|
|
PBackgroundLSRequestParent* aActor, const LSRequestParams& aParams) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-11-29 23:47:20 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
if (!mozilla::dom::RecvPBackgroundLSRequestConstructor(aActor, aParams)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPBackgroundLSRequestParent(
|
|
|
|
PBackgroundLSRequestParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-11-29 23:47:20 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::DeallocPBackgroundLSRequestParent(aActor);
|
|
|
|
}
|
|
|
|
|
2018-11-29 23:48:15 +03:00
|
|
|
BackgroundParentImpl::PBackgroundLSSimpleRequestParent*
|
|
|
|
BackgroundParentImpl::AllocPBackgroundLSSimpleRequestParent(
|
|
|
|
const LSSimpleRequestParams& aParams) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-11-29 23:48:15 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2019-02-08 23:02:03 +03:00
|
|
|
return mozilla::dom::AllocPBackgroundLSSimpleRequestParent(this, aParams);
|
2018-11-29 23:48:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPBackgroundLSSimpleRequestConstructor(
|
|
|
|
PBackgroundLSSimpleRequestParent* aActor,
|
|
|
|
const LSSimpleRequestParams& aParams) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-11-29 23:48:15 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
if (!mozilla::dom::RecvPBackgroundLSSimpleRequestConstructor(aActor,
|
|
|
|
aParams)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPBackgroundLSSimpleRequestParent(
|
|
|
|
PBackgroundLSSimpleRequestParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-11-29 23:48:15 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::DeallocPBackgroundLSSimpleRequestParent(aActor);
|
|
|
|
}
|
|
|
|
|
2019-02-07 21:51:16 +03:00
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvLSClearPrivateBrowsing() {
|
|
|
|
AssertIsInMainOrSocketProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
if (BackgroundParent::IsOtherProcessActor(this)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mozilla::dom::RecvLSClearPrivateBrowsing()) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2018-07-14 09:34:14 +03:00
|
|
|
BackgroundParentImpl::PBackgroundLocalStorageCacheParent*
|
|
|
|
BackgroundParentImpl::AllocPBackgroundLocalStorageCacheParent(
|
|
|
|
const PrincipalInfo& aPrincipalInfo, const nsCString& aOriginKey,
|
|
|
|
const uint32_t& aPrivateBrowsingId) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-07-14 09:34:14 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return mozilla::dom::AllocPBackgroundLocalStorageCacheParent(
|
|
|
|
aPrincipalInfo, aOriginKey, aPrivateBrowsingId);
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPBackgroundLocalStorageCacheConstructor(
|
|
|
|
PBackgroundLocalStorageCacheParent* aActor,
|
|
|
|
const PrincipalInfo& aPrincipalInfo, const nsCString& aOriginKey,
|
|
|
|
const uint32_t& aPrivateBrowsingId) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-07-14 09:34:14 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::RecvPBackgroundLocalStorageCacheConstructor(
|
|
|
|
this, aActor, aPrincipalInfo, aOriginKey, aPrivateBrowsingId);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPBackgroundLocalStorageCacheParent(
|
|
|
|
PBackgroundLocalStorageCacheParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2018-07-14 09:34:14 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::DeallocPBackgroundLocalStorageCacheParent(aActor);
|
|
|
|
}
|
|
|
|
|
2017-08-09 00:01:52 +03:00
|
|
|
auto BackgroundParentImpl::AllocPBackgroundStorageParent(
|
2020-11-11 16:12:57 +03:00
|
|
|
const nsString& aProfilePath, const uint32_t& aPrivateBrowsingId)
|
|
|
|
-> PBackgroundStorageParent* {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2017-08-08 23:56:49 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2020-11-11 16:12:57 +03:00
|
|
|
return mozilla::dom::AllocPBackgroundStorageParent(aProfilePath,
|
|
|
|
aPrivateBrowsingId);
|
2017-08-08 23:56:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvPBackgroundStorageConstructor(
|
2020-11-11 16:12:57 +03:00
|
|
|
PBackgroundStorageParent* aActor, const nsString& aProfilePath,
|
|
|
|
const uint32_t& aPrivateBrowsingId) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2017-08-08 23:56:49 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
2020-11-11 16:12:57 +03:00
|
|
|
return mozilla::dom::RecvPBackgroundStorageConstructor(aActor, aProfilePath,
|
|
|
|
aPrivateBrowsingId);
|
2017-08-08 23:56:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPBackgroundStorageParent(
|
|
|
|
PBackgroundStorageParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2017-08-08 23:56:49 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::DeallocPBackgroundStorageParent(aActor);
|
|
|
|
}
|
|
|
|
|
2020-10-14 03:19:33 +03:00
|
|
|
already_AddRefed<BackgroundParentImpl::PBackgroundSessionStorageManagerParent>
|
|
|
|
BackgroundParentImpl::AllocPBackgroundSessionStorageManagerParent(
|
|
|
|
const uint64_t& aTopContextId) {
|
|
|
|
AssertIsInMainOrSocketProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return dom::AllocPBackgroundSessionStorageManagerParent(aTopContextId);
|
|
|
|
}
|
|
|
|
|
2019-09-24 17:33:57 +03:00
|
|
|
already_AddRefed<PIdleSchedulerParent>
|
|
|
|
BackgroundParentImpl::AllocPIdleSchedulerParent() {
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
RefPtr<IdleSchedulerParent> actor = new IdleSchedulerParent();
|
|
|
|
return actor.forget();
|
|
|
|
}
|
|
|
|
|
2018-11-20 02:18:32 +03:00
|
|
|
mozilla::dom::PRemoteWorkerParent*
|
|
|
|
BackgroundParentImpl::AllocPRemoteWorkerParent(const RemoteWorkerData& aData) {
|
|
|
|
RefPtr<dom::RemoteWorkerParent> agent = new dom::RemoteWorkerParent();
|
|
|
|
return agent.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPRemoteWorkerParent(
|
|
|
|
mozilla::dom::PRemoteWorkerParent* aActor) {
|
|
|
|
RefPtr<mozilla::dom::RemoteWorkerParent> actor =
|
|
|
|
dont_AddRef(static_cast<mozilla::dom::RemoteWorkerParent*>(aActor));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-08-15 20:26:49 +03:00
|
|
|
dom::PRemoteWorkerControllerParent*
|
|
|
|
BackgroundParentImpl::AllocPRemoteWorkerControllerParent(
|
|
|
|
const dom::RemoteWorkerData& aRemoteWorkerData) {
|
|
|
|
RefPtr<dom::RemoteWorkerControllerParent> actor =
|
|
|
|
new dom::RemoteWorkerControllerParent(aRemoteWorkerData);
|
|
|
|
return actor.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
IPCResult BackgroundParentImpl::RecvPRemoteWorkerControllerConstructor(
|
|
|
|
dom::PRemoteWorkerControllerParent* aActor,
|
|
|
|
const dom::RemoteWorkerData& aRemoteWorkerData) {
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPRemoteWorkerControllerParent(
|
|
|
|
dom::PRemoteWorkerControllerParent* aActor) {
|
|
|
|
RefPtr<dom::RemoteWorkerControllerParent> actor =
|
|
|
|
dont_AddRef(static_cast<dom::RemoteWorkerControllerParent*>(aActor));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-11-20 02:18:32 +03:00
|
|
|
mozilla::dom::PRemoteWorkerServiceParent*
|
|
|
|
BackgroundParentImpl::AllocPRemoteWorkerServiceParent() {
|
|
|
|
return new mozilla::dom::RemoteWorkerServiceParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
IPCResult BackgroundParentImpl::RecvPRemoteWorkerServiceConstructor(
|
|
|
|
PRemoteWorkerServiceParent* aActor) {
|
|
|
|
mozilla::dom::RemoteWorkerServiceParent* actor =
|
|
|
|
static_cast<mozilla::dom::RemoteWorkerServiceParent*>(aActor);
|
2020-08-28 21:11:22 +03:00
|
|
|
|
|
|
|
RefPtr<ContentParent> parent = BackgroundParent::GetContentParent(this);
|
|
|
|
// If the ContentParent is null we are dealing with a same-process actor.
|
|
|
|
if (!parent) {
|
|
|
|
actor->Initialize(NOT_REMOTE_TYPE);
|
|
|
|
} else {
|
|
|
|
actor->Initialize(parent->GetRemoteType());
|
|
|
|
NS_ReleaseOnMainThread("ContentParent release", parent.forget());
|
|
|
|
}
|
2018-11-20 02:18:32 +03:00
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPRemoteWorkerServiceParent(
|
|
|
|
mozilla::dom::PRemoteWorkerServiceParent* aActor) {
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-11-20 02:18:20 +03:00
|
|
|
mozilla::dom::PSharedWorkerParent*
|
2018-11-20 02:18:33 +03:00
|
|
|
BackgroundParentImpl::AllocPSharedWorkerParent(
|
|
|
|
const mozilla::dom::RemoteWorkerData& aData, const uint64_t& aWindowID,
|
|
|
|
const mozilla::dom::MessagePortIdentifier& aPortIdentifier) {
|
2018-11-20 02:18:20 +03:00
|
|
|
RefPtr<dom::SharedWorkerParent> agent =
|
|
|
|
new mozilla::dom::SharedWorkerParent();
|
|
|
|
return agent.forget().take();
|
|
|
|
}
|
|
|
|
|
2018-11-20 02:18:21 +03:00
|
|
|
IPCResult BackgroundParentImpl::RecvPSharedWorkerConstructor(
|
2018-11-20 02:18:33 +03:00
|
|
|
PSharedWorkerParent* aActor, const mozilla::dom::RemoteWorkerData& aData,
|
|
|
|
const uint64_t& aWindowID,
|
|
|
|
const mozilla::dom::MessagePortIdentifier& aPortIdentifier) {
|
2018-11-20 02:18:21 +03:00
|
|
|
mozilla::dom::SharedWorkerParent* actor =
|
|
|
|
static_cast<mozilla::dom::SharedWorkerParent*>(aActor);
|
2018-11-20 02:18:33 +03:00
|
|
|
actor->Initialize(aData, aWindowID, aPortIdentifier);
|
2018-11-20 02:18:21 +03:00
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2018-11-20 02:18:20 +03:00
|
|
|
bool BackgroundParentImpl::DeallocPSharedWorkerParent(
|
|
|
|
mozilla::dom::PSharedWorkerParent* aActor) {
|
|
|
|
RefPtr<mozilla::dom::SharedWorkerParent> actor =
|
|
|
|
dont_AddRef(static_cast<mozilla::dom::SharedWorkerParent*>(aActor));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-04-26 21:00:33 +03:00
|
|
|
dom::PFileCreatorParent* BackgroundParentImpl::AllocPFileCreatorParent(
|
2019-04-26 20:53:07 +03:00
|
|
|
const nsString& aFullPath, const nsString& aType, const nsString& aName,
|
|
|
|
const Maybe<int64_t>& aLastModified, const bool& aExistenceCheck,
|
|
|
|
const bool& aIsFromNsIFile) {
|
2019-04-26 21:00:33 +03:00
|
|
|
RefPtr<dom::FileCreatorParent> actor = new dom::FileCreatorParent();
|
2019-04-26 20:53:07 +03:00
|
|
|
return actor.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvPFileCreatorConstructor(
|
2019-04-26 21:00:33 +03:00
|
|
|
dom::PFileCreatorParent* aActor, const nsString& aFullPath,
|
2019-04-26 20:53:07 +03:00
|
|
|
const nsString& aType, const nsString& aName,
|
|
|
|
const Maybe<int64_t>& aLastModified, const bool& aExistenceCheck,
|
|
|
|
const bool& aIsFromNsIFile) {
|
|
|
|
bool isFileRemoteType = false;
|
|
|
|
|
|
|
|
// If the ContentParent is null we are dealing with a same-process actor.
|
|
|
|
RefPtr<ContentParent> parent = BackgroundParent::GetContentParent(this);
|
|
|
|
if (!parent) {
|
|
|
|
isFileRemoteType = true;
|
|
|
|
} else {
|
2020-07-08 23:15:59 +03:00
|
|
|
isFileRemoteType = parent->GetRemoteType() == FILE_REMOTE_TYPE;
|
2020-04-07 18:16:23 +03:00
|
|
|
NS_ReleaseOnMainThread("ContentParent release", parent.forget());
|
2019-04-26 20:53:07 +03:00
|
|
|
}
|
|
|
|
|
2019-04-26 21:00:33 +03:00
|
|
|
dom::FileCreatorParent* actor = static_cast<dom::FileCreatorParent*>(aActor);
|
2019-04-26 20:53:07 +03:00
|
|
|
|
|
|
|
// We allow the creation of File via this IPC call only for the 'file' process
|
|
|
|
// or for testing.
|
|
|
|
if (!isFileRemoteType && !StaticPrefs::dom_file_createInChild()) {
|
2019-04-26 21:00:33 +03:00
|
|
|
Unused << dom::FileCreatorParent::Send__delete__(
|
|
|
|
actor, dom::FileCreationErrorResult(NS_ERROR_DOM_INVALID_STATE_ERR));
|
2019-04-26 20:53:07 +03:00
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
return actor->CreateAndShareFile(aFullPath, aType, aName, aLastModified,
|
|
|
|
aExistenceCheck, aIsFromNsIFile);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPFileCreatorParent(
|
2019-04-26 21:00:33 +03:00
|
|
|
dom::PFileCreatorParent* aActor) {
|
|
|
|
RefPtr<dom::FileCreatorParent> actor =
|
|
|
|
dont_AddRef(static_cast<dom::FileCreatorParent*>(aActor));
|
2019-04-26 20:53:07 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-04-26 21:01:53 +03:00
|
|
|
dom::PTemporaryIPCBlobParent*
|
|
|
|
BackgroundParentImpl::AllocPTemporaryIPCBlobParent() {
|
|
|
|
return new dom::TemporaryIPCBlobParent();
|
2017-10-05 08:41:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvPTemporaryIPCBlobConstructor(
|
2019-04-26 21:01:53 +03:00
|
|
|
dom::PTemporaryIPCBlobParent* aActor) {
|
|
|
|
dom::TemporaryIPCBlobParent* actor =
|
|
|
|
static_cast<dom::TemporaryIPCBlobParent*>(aActor);
|
2017-10-05 08:41:42 +03:00
|
|
|
return actor->CreateAndShareFile();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPTemporaryIPCBlobParent(
|
2019-04-26 21:01:53 +03:00
|
|
|
dom::PTemporaryIPCBlobParent* aActor) {
|
2017-10-05 08:41:42 +03:00
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-06-29 16:40:27 +03:00
|
|
|
already_AddRefed<PRemoteLazyInputStreamParent>
|
2020-06-29 14:03:04 +03:00
|
|
|
BackgroundParentImpl::AllocPRemoteLazyInputStreamParent(const nsID& aID,
|
|
|
|
const uint64_t& aSize) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2017-05-31 08:41:10 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2020-06-29 16:40:27 +03:00
|
|
|
RefPtr<RemoteLazyInputStreamParent> actor =
|
|
|
|
RemoteLazyInputStreamParent::Create(aID, aSize, this);
|
2019-08-08 19:46:46 +03:00
|
|
|
return actor.forget();
|
2017-05-31 08:41:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
2020-06-29 14:03:04 +03:00
|
|
|
BackgroundParentImpl::RecvPRemoteLazyInputStreamConstructor(
|
2020-06-29 16:40:27 +03:00
|
|
|
PRemoteLazyInputStreamParent* aActor, const nsID& aID,
|
2019-04-26 21:04:02 +03:00
|
|
|
const uint64_t& aSize) {
|
2020-06-29 16:40:27 +03:00
|
|
|
if (!static_cast<RemoteLazyInputStreamParent*>(aActor)->HasValidStream()) {
|
2017-05-31 08:41:10 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return IPC_OK();
|
Bug 1353629 - PBlob refactoring - part 4 - IPCBlobInputStream, r=smaug
IPCBlobInputStream is a new type of nsIInputStream that is used only in content
process when a Blob is sent from parent to child. This inputStream is for now,
just cloneable.
When the parent process sends a Blob to a content process, it has the Blob and
its inputStream. With its inputStream it creates a IPCBlobInputStreamParent
actor. This actor keeps the inputStream alive for following uses (not part of
this patch).
On the child side we will have, of course, a IPCBlobInputStreamChild actor.
This actor is able to create a IPCBlobInputStream when CreateStream() is
called. This means that 1 IPCBlobInputStreamChild can manage multiple
IPCBlobInputStreams each time one of them is cloned. When the last one of this
stream is released, the child actor sends a __delete__ request to the parent
side; the parent will be deleted, and the original inputStream, on the parent
side, will be released as well.
IPCBlobInputStream is a special inputStream because each method, except for
Available() fails. Basically, this inputStream cannot be used on the content
process for nothing else than knowing the size of the original stream.
In the following patches, I'll introduce an async way to use it.
2017-04-24 13:09:40 +03:00
|
|
|
}
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
PFileDescriptorSetParent* BackgroundParentImpl::AllocPFileDescriptorSetParent(
|
|
|
|
const FileDescriptor& aFileDescriptor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2014-09-27 03:21:57 +04:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return new FileDescriptorSetParent(aFileDescriptor);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPFileDescriptorSetParent(
|
|
|
|
PFileDescriptorSetParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2014-09-27 03:21:57 +04:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete static_cast<FileDescriptorSetParent*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-03-14 14:28:58 +03:00
|
|
|
PChildToParentStreamParent*
|
|
|
|
BackgroundParentImpl::AllocPChildToParentStreamParent() {
|
|
|
|
return mozilla::ipc::AllocPChildToParentStreamParent();
|
2016-05-15 20:32:09 +03:00
|
|
|
}
|
|
|
|
|
2017-03-14 14:28:58 +03:00
|
|
|
bool BackgroundParentImpl::DeallocPChildToParentStreamParent(
|
|
|
|
PChildToParentStreamParent* aActor) {
|
2016-05-15 20:32:09 +03:00
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-03-14 14:29:43 +03:00
|
|
|
PParentToChildStreamParent*
|
|
|
|
BackgroundParentImpl::AllocPParentToChildStreamParent() {
|
|
|
|
MOZ_CRASH(
|
|
|
|
"PParentToChildStreamParent actors should be manually constructed!");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPParentToChildStreamParent(
|
|
|
|
PParentToChildStreamParent* aActor) {
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-01-14 02:37:00 +03:00
|
|
|
BackgroundParentImpl::PVsyncParent* BackgroundParentImpl::AllocPVsyncParent() {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-01-14 02:37:00 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::layout::VsyncParent> actor =
|
2015-01-14 02:37:00 +03:00
|
|
|
mozilla::layout::VsyncParent::Create();
|
|
|
|
// There still has one ref-count after return, and it will be released in
|
|
|
|
// DeallocPVsyncParent().
|
|
|
|
return actor.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPVsyncParent(PVsyncParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-01-14 02:37:00 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
// This actor already has one ref-count. Please check AllocPVsyncParent().
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::layout::VsyncParent> actor =
|
2015-01-14 02:37:00 +03:00
|
|
|
dont_AddRef(static_cast<mozilla::layout::VsyncParent*>(aActor));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-08-31 15:51:29 +03:00
|
|
|
camera::PCamerasParent* BackgroundParentImpl::AllocPCamerasParent() {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-08-31 15:51:29 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2015-09-18 09:29:14 +03:00
|
|
|
#ifdef MOZ_WEBRTC
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::camera::CamerasParent> actor =
|
2015-08-31 15:51:29 +03:00
|
|
|
mozilla::camera::CamerasParent::Create();
|
|
|
|
return actor.forget().take();
|
2015-09-18 09:29:14 +03:00
|
|
|
#else
|
|
|
|
return nullptr;
|
|
|
|
#endif
|
2015-08-31 15:51:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPCamerasParent(
|
|
|
|
camera::PCamerasParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-08-31 15:51:29 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
2015-09-18 09:29:14 +03:00
|
|
|
#ifdef MOZ_WEBRTC
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::camera::CamerasParent> actor =
|
2015-08-31 15:51:29 +03:00
|
|
|
dont_AddRef(static_cast<mozilla::camera::CamerasParent*>(aActor));
|
2015-09-18 09:29:14 +03:00
|
|
|
#endif
|
2015-08-31 15:51:29 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-05-29 17:14:14 +03:00
|
|
|
auto BackgroundParentImpl::AllocPUDPSocketParent(
|
2019-03-05 17:41:42 +03:00
|
|
|
const Maybe<PrincipalInfo>& /* unused */, const nsCString & /* unused */)
|
2015-05-29 17:14:14 +03:00
|
|
|
-> PUDPSocketParent* {
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<UDPSocketParent> p = new UDPSocketParent(this);
|
2015-05-29 17:14:14 +03:00
|
|
|
|
|
|
|
return p.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvPUDPSocketConstructor(
|
2019-03-05 17:41:42 +03:00
|
|
|
PUDPSocketParent* aActor, const Maybe<PrincipalInfo>& aOptionalPrincipal,
|
2015-05-29 17:14:14 +03:00
|
|
|
const nsCString& aFilter) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-05-29 17:14:14 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2019-03-05 17:41:42 +03:00
|
|
|
if (aOptionalPrincipal.isSome()) {
|
2015-05-29 17:14:14 +03:00
|
|
|
// Support for checking principals (for non-mtransport use) will be handled
|
|
|
|
// in bug 1167039
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
2015-05-29 17:14:14 +03:00
|
|
|
}
|
|
|
|
// No principal - This must be from mtransport (WebRTC/ICE) - We'd want
|
|
|
|
// to DispatchToMainThread() here, but if we do we must block RecvBind()
|
|
|
|
// until Init() gets run. Since we don't have a principal, and we verify
|
|
|
|
// we have a filter, we can safely skip the Dispatch and just invoke Init()
|
|
|
|
// to install the filter.
|
|
|
|
|
2016-02-11 12:18:46 +03:00
|
|
|
// For mtransport, this will always be "stun", which doesn't allow outbound
|
|
|
|
// packets if they aren't STUN packets until a STUN response is seen.
|
|
|
|
if (!aFilter.EqualsASCII(NS_NETWORK_SOCKET_FILTER_HANDLER_STUN_SUFFIX)) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
2015-05-29 17:14:14 +03:00
|
|
|
}
|
|
|
|
|
2020-02-10 23:52:56 +03:00
|
|
|
if (!static_cast<UDPSocketParent*>(aActor)->Init(nullptr, aFilter)) {
|
2015-05-29 17:14:14 +03:00
|
|
|
MOZ_CRASH("UDPSocketCallback - failed init");
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-05-29 17:14:14 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPUDPSocketParent(PUDPSocketParent* actor) {
|
|
|
|
UDPSocketParent* p = static_cast<UDPSocketParent*>(actor);
|
|
|
|
p->Release();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-02-28 13:58:56 +03:00
|
|
|
already_AddRefed<mozilla::psm::PVerifySSLServerCertParent>
|
|
|
|
BackgroundParentImpl::AllocPVerifySSLServerCertParent(
|
|
|
|
const ByteArray& aServerCert, const nsTArray<ByteArray>& aPeerCertChain,
|
|
|
|
const nsCString& aHostName, const int32_t& aPort,
|
|
|
|
const OriginAttributes& aOriginAttributes,
|
|
|
|
const Maybe<ByteArray>& aStapledOCSPResponse,
|
|
|
|
const Maybe<ByteArray>& aSctsFromTLSExtension,
|
|
|
|
const Maybe<DelegatedCredentialInfoArg>& aDcInfo,
|
|
|
|
const uint32_t& aProviderFlags, const uint32_t& aCertVerifierFlags) {
|
|
|
|
RefPtr<mozilla::psm::VerifySSLServerCertParent> parent =
|
|
|
|
new mozilla::psm::VerifySSLServerCertParent();
|
|
|
|
return parent.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPVerifySSLServerCertConstructor(
|
|
|
|
PVerifySSLServerCertParent* aActor, const ByteArray& aServerCert,
|
|
|
|
nsTArray<ByteArray>&& aPeerCertChain, const nsCString& aHostName,
|
|
|
|
const int32_t& aPort, const OriginAttributes& aOriginAttributes,
|
|
|
|
const Maybe<ByteArray>& aStapledOCSPResponse,
|
|
|
|
const Maybe<ByteArray>& aSctsFromTLSExtension,
|
|
|
|
const Maybe<DelegatedCredentialInfoArg>& aDcInfo,
|
|
|
|
const uint32_t& aProviderFlags, const uint32_t& aCertVerifierFlags) {
|
|
|
|
mozilla::psm::VerifySSLServerCertParent* authCert =
|
|
|
|
static_cast<mozilla::psm::VerifySSLServerCertParent*>(aActor);
|
|
|
|
if (!authCert->Dispatch(aServerCert, std::move(aPeerCertChain), aHostName,
|
|
|
|
aPort, aOriginAttributes, aStapledOCSPResponse,
|
|
|
|
aSctsFromTLSExtension, aDcInfo, aProviderFlags,
|
|
|
|
aCertVerifierFlags)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2015-01-15 19:58:40 +03:00
|
|
|
mozilla::dom::PBroadcastChannelParent*
|
|
|
|
BackgroundParentImpl::AllocPBroadcastChannelParent(
|
|
|
|
const PrincipalInfo& aPrincipalInfo, const nsCString& aOrigin,
|
2016-06-07 14:50:00 +03:00
|
|
|
const nsString& aChannel) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-01-15 19:58:40 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2016-05-30 11:48:40 +03:00
|
|
|
nsString originChannelKey;
|
|
|
|
|
|
|
|
// The format of originChannelKey is:
|
2016-06-07 14:50:00 +03:00
|
|
|
// <channelName>|<origin+OriginAttributes>
|
2016-05-30 11:48:40 +03:00
|
|
|
|
|
|
|
originChannelKey.Assign(aChannel);
|
|
|
|
|
2016-06-07 14:50:00 +03:00
|
|
|
originChannelKey.AppendLiteral("|");
|
2016-05-30 11:48:40 +03:00
|
|
|
|
|
|
|
originChannelKey.Append(NS_ConvertUTF8toUTF16(aOrigin));
|
|
|
|
|
|
|
|
return new BroadcastChannelParent(originChannelKey);
|
2015-01-15 19:58:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2016-04-09 21:17:02 +03:00
|
|
|
struct MOZ_STACK_CLASS NullifyContentParentRAII {
|
|
|
|
explicit NullifyContentParentRAII(RefPtr<ContentParent>& aContentParent)
|
|
|
|
: mContentParent(aContentParent) {}
|
|
|
|
|
|
|
|
~NullifyContentParentRAII() { mContentParent = nullptr; }
|
|
|
|
|
|
|
|
RefPtr<ContentParent>& mContentParent;
|
|
|
|
};
|
|
|
|
|
2016-04-26 03:23:21 +03:00
|
|
|
class CheckPrincipalRunnable final : public Runnable {
|
2015-01-15 19:58:40 +03:00
|
|
|
public:
|
|
|
|
CheckPrincipalRunnable(already_AddRefed<ContentParent> aParent,
|
|
|
|
const PrincipalInfo& aPrincipalInfo,
|
2015-07-06 21:28:41 +03:00
|
|
|
const nsCString& aOrigin)
|
2017-06-12 22:34:10 +03:00
|
|
|
: Runnable("ipc::CheckPrincipalRunnable"),
|
|
|
|
mContentParent(aParent),
|
2015-01-15 19:58:40 +03:00
|
|
|
mPrincipalInfo(aPrincipalInfo),
|
|
|
|
mOrigin(aOrigin) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-01-15 19:58:40 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
MOZ_ASSERT(mContentParent);
|
|
|
|
}
|
|
|
|
|
2016-08-08 05:18:10 +03:00
|
|
|
NS_IMETHOD Run() override {
|
2015-01-15 19:58:40 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
|
2016-04-09 21:17:02 +03:00
|
|
|
NullifyContentParentRAII raii(mContentParent);
|
2015-04-08 11:27:31 +03:00
|
|
|
|
2020-05-12 22:02:05 +03:00
|
|
|
auto principalOrErr = PrincipalInfoToPrincipal(mPrincipalInfo);
|
|
|
|
if (NS_WARN_IF(principalOrErr.isErr())) {
|
|
|
|
mContentParent->KillHard(
|
|
|
|
"BroadcastChannel killed: PrincipalInfoToPrincipal failed.");
|
|
|
|
}
|
2015-01-15 19:58:40 +03:00
|
|
|
|
2015-07-06 21:28:41 +03:00
|
|
|
nsAutoCString origin;
|
2020-05-12 22:02:05 +03:00
|
|
|
nsresult rv = principalOrErr.unwrap()->GetOrigin(origin);
|
2015-07-06 21:28:41 +03:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
mContentParent->KillHard(
|
|
|
|
"BroadcastChannel killed: principal::GetOrigin failed.");
|
2015-01-15 19:58:40 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-07-06 21:28:41 +03:00
|
|
|
if (NS_WARN_IF(!mOrigin.Equals(origin))) {
|
|
|
|
mContentParent->KillHard(
|
|
|
|
"BroadcastChannel killed: origins do not match.");
|
2015-01-15 19:58:40 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<ContentParent> mContentParent;
|
2015-01-15 19:58:40 +03:00
|
|
|
PrincipalInfo mPrincipalInfo;
|
2015-07-06 21:28:41 +03:00
|
|
|
nsCString mOrigin;
|
2015-01-15 19:58:40 +03:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace
|
2015-01-15 19:58:40 +03:00
|
|
|
|
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvPBroadcastChannelConstructor(
|
|
|
|
PBroadcastChannelParent* actor, const PrincipalInfo& aPrincipalInfo,
|
2016-06-07 14:50:00 +03:00
|
|
|
const nsCString& aOrigin, const nsString& aChannel) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-01-15 19:58:40 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<ContentParent> parent = BackgroundParent::GetContentParent(this);
|
2015-01-15 19:58:40 +03:00
|
|
|
|
|
|
|
// If the ContentParent is null we are dealing with a same-process actor.
|
|
|
|
if (!parent) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-01-15 19:58:40 +03:00
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CheckPrincipalRunnable> runnable =
|
2015-01-15 19:58:40 +03:00
|
|
|
new CheckPrincipalRunnable(parent.forget(), aPrincipalInfo, aOrigin);
|
2016-03-28 20:28:15 +03:00
|
|
|
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
|
2015-01-15 19:58:40 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-01-15 19:58:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPBroadcastChannelParent(
|
|
|
|
PBroadcastChannelParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-01-15 19:58:40 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete static_cast<BroadcastChannelParent*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-06-04 21:51:57 +03:00
|
|
|
mozilla::dom::PServiceWorkerManagerParent*
|
|
|
|
BackgroundParentImpl::AllocPServiceWorkerManagerParent() {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-06-04 21:51:57 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
2015-03-03 17:51:05 +03:00
|
|
|
|
2018-01-27 00:08:59 +03:00
|
|
|
RefPtr<dom::ServiceWorkerManagerParent> agent =
|
|
|
|
new dom::ServiceWorkerManagerParent();
|
2015-11-24 21:38:48 +03:00
|
|
|
return agent.forget().take();
|
2015-03-03 17:51:05 +03:00
|
|
|
}
|
|
|
|
|
2015-06-04 21:51:57 +03:00
|
|
|
bool BackgroundParentImpl::DeallocPServiceWorkerManagerParent(
|
|
|
|
PServiceWorkerManagerParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-02-11 14:53:00 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
2015-06-04 21:51:57 +03:00
|
|
|
MOZ_ASSERT(aActor);
|
2015-02-11 14:53:00 +03:00
|
|
|
|
2018-01-27 00:08:59 +03:00
|
|
|
RefPtr<dom::ServiceWorkerManagerParent> parent =
|
|
|
|
dont_AddRef(static_cast<dom::ServiceWorkerManagerParent*>(aActor));
|
2015-11-24 21:38:48 +03:00
|
|
|
MOZ_ASSERT(parent);
|
2015-06-05 14:07:51 +03:00
|
|
|
return true;
|
2015-06-04 21:51:57 +03:00
|
|
|
}
|
2015-02-11 14:53:00 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-02-11 14:53:00 +03:00
|
|
|
BackgroundParentImpl::RecvShutdownServiceWorkerRegistrar() {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-02-11 14:53:00 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
if (BackgroundParent::IsOtherProcessActor(this)) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
2015-02-11 14:53:00 +03:00
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<dom::ServiceWorkerRegistrar> service =
|
2015-02-11 14:53:00 +03:00
|
|
|
dom::ServiceWorkerRegistrar::Get();
|
|
|
|
MOZ_ASSERT(service);
|
|
|
|
|
|
|
|
service->Shutdown();
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-02-11 14:53:00 +03:00
|
|
|
}
|
|
|
|
|
2015-03-02 16:20:00 +03:00
|
|
|
PCacheStorageParent* BackgroundParentImpl::AllocPCacheStorageParent(
|
|
|
|
const Namespace& aNamespace, const PrincipalInfo& aPrincipalInfo) {
|
|
|
|
return dom::cache::AllocPCacheStorageParent(this, aNamespace, aPrincipalInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPCacheStorageParent(
|
|
|
|
PCacheStorageParent* aActor) {
|
|
|
|
dom::cache::DeallocPCacheStorageParent(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
PCacheParent* BackgroundParentImpl::AllocPCacheParent() {
|
|
|
|
MOZ_CRASH("CacheParent actor must be provided to PBackground manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPCacheParent(PCacheParent* aActor) {
|
|
|
|
dom::cache::DeallocPCacheParent(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-06-09 15:58:44 +03:00
|
|
|
already_AddRefed<PCacheStreamControlParent>
|
2015-03-02 16:20:00 +03:00
|
|
|
BackgroundParentImpl::AllocPCacheStreamControlParent() {
|
|
|
|
MOZ_CRASH(
|
|
|
|
"CacheStreamControlParent actor must be provided to PBackground manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2015-06-17 13:44:27 +03:00
|
|
|
PMessagePortParent* BackgroundParentImpl::AllocPMessagePortParent(
|
|
|
|
const nsID& aUUID, const nsID& aDestinationUUID,
|
|
|
|
const uint32_t& aSequenceID) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-06-17 13:44:27 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return new MessagePortParent(aUUID);
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvPMessagePortConstructor(
|
|
|
|
PMessagePortParent* aActor, const nsID& aUUID, const nsID& aDestinationUUID,
|
|
|
|
const uint32_t& aSequenceID) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-06-17 13:44:27 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
MessagePortParent* mp = static_cast<MessagePortParent*>(aActor);
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!mp->Entangle(aDestinationUUID, aSequenceID)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2015-06-17 13:44:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPMessagePortParent(
|
|
|
|
PMessagePortParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-06-17 13:44:27 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete static_cast<MessagePortParent*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-06-24 01:50:00 +03:00
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvMessagePortForceClose(
|
|
|
|
const nsID& aUUID, const nsID& aDestinationUUID,
|
|
|
|
const uint32_t& aSequenceID) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-06-24 01:50:00 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!MessagePortParent::ForceClose(aUUID, aDestinationUUID, aSequenceID)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2015-06-24 01:50:00 +03:00
|
|
|
}
|
|
|
|
|
2015-11-22 12:43:55 +03:00
|
|
|
BackgroundParentImpl::PQuotaParent* BackgroundParentImpl::AllocPQuotaParent() {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-11-22 12:43:55 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return mozilla::dom::quota::AllocPQuotaParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPQuotaParent(PQuotaParent* aActor) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2015-11-22 12:43:55 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::quota::DeallocPQuotaParent(aActor);
|
|
|
|
}
|
|
|
|
|
2019-02-23 19:30:41 +03:00
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvShutdownQuotaManager() {
|
|
|
|
AssertIsInMainOrSocketProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
if (BackgroundParent::IsOtherProcessActor(this)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mozilla::dom::quota::RecvShutdownQuotaManager()) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2020-10-14 03:19:33 +03:00
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvShutdownBackgroundSessionStorageManagers() {
|
|
|
|
AssertIsInMainOrSocketProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
if (BackgroundParent::IsOtherProcessActor(this)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mozilla::dom::RecvShutdownBackgroundSessionStorageManagers()) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvRemoveBackgroundSessionStorageManager(
|
|
|
|
const uint64_t& aTopContextId) {
|
|
|
|
AssertIsInMainOrSocketProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
if (BackgroundParent::IsOtherProcessActor(this)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mozilla::dom::RecvRemoveBackgroundSessionStorageManager(aTopContextId)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2019-08-08 19:46:37 +03:00
|
|
|
already_AddRefed<dom::PFileSystemRequestParent>
|
2016-04-09 21:17:02 +03:00
|
|
|
BackgroundParentImpl::AllocPFileSystemRequestParent(
|
|
|
|
const FileSystemParams& aParams) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2016-04-09 21:17:02 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
RefPtr<FileSystemRequestParent> result = new FileSystemRequestParent();
|
|
|
|
|
|
|
|
if (NS_WARN_IF(!result->Initialize(aParams))) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-08-08 19:46:37 +03:00
|
|
|
return result.forget();
|
2016-04-09 21:17:02 +03:00
|
|
|
}
|
|
|
|
|
2017-03-16 10:53:49 +03:00
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvPFileSystemRequestConstructor(
|
|
|
|
PFileSystemRequestParent* aActor, const FileSystemParams& params) {
|
|
|
|
static_cast<FileSystemRequestParent*>(aActor)->Start();
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2016-06-28 01:25:00 +03:00
|
|
|
// Gamepad API Background IPC
|
2020-10-14 18:58:36 +03:00
|
|
|
already_AddRefed<dom::PGamepadEventChannelParent>
|
2016-06-28 01:25:00 +03:00
|
|
|
BackgroundParentImpl::AllocPGamepadEventChannelParent() {
|
2020-10-14 18:58:36 +03:00
|
|
|
return dom::GamepadEventChannelParent::Create();
|
2020-08-05 00:27:53 +03:00
|
|
|
}
|
|
|
|
|
2020-10-14 23:33:55 +03:00
|
|
|
already_AddRefed<dom::PGamepadTestChannelParent>
|
2016-06-28 01:26:00 +03:00
|
|
|
BackgroundParentImpl::AllocPGamepadTestChannelParent() {
|
2020-10-14 23:33:55 +03:00
|
|
|
return dom::GamepadTestChannelParent::Create();
|
2016-06-28 01:26:00 +03:00
|
|
|
}
|
|
|
|
|
2017-05-05 03:48:34 +03:00
|
|
|
dom::PWebAuthnTransactionParent*
|
|
|
|
BackgroundParentImpl::AllocPWebAuthnTransactionParent() {
|
|
|
|
return new dom::WebAuthnTransactionParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPWebAuthnTransactionParent(
|
|
|
|
dom::PWebAuthnTransactionParent* aActor) {
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-08-16 13:50:08 +03:00
|
|
|
already_AddRefed<net::PHttpBackgroundChannelParent>
|
2017-05-15 11:01:10 +03:00
|
|
|
BackgroundParentImpl::AllocPHttpBackgroundChannelParent(
|
|
|
|
const uint64_t& aChannelId) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2017-05-15 11:01:10 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2017-04-24 06:09:35 +03:00
|
|
|
RefPtr<net::HttpBackgroundChannelParent> actor =
|
|
|
|
new net::HttpBackgroundChannelParent();
|
2019-08-16 13:50:08 +03:00
|
|
|
return actor.forget();
|
2017-05-15 11:01:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPHttpBackgroundChannelConstructor(
|
|
|
|
net::PHttpBackgroundChannelParent* aActor, const uint64_t& aChannelId) {
|
|
|
|
MOZ_ASSERT(aActor);
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2017-05-15 11:01:10 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2017-04-24 06:09:35 +03:00
|
|
|
net::HttpBackgroundChannelParent* aParent =
|
|
|
|
static_cast<net::HttpBackgroundChannelParent*>(aActor);
|
|
|
|
|
|
|
|
if (NS_WARN_IF(NS_FAILED(aParent->Init(aChannelId)))) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
|
2017-05-15 11:01:10 +03:00
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2017-11-15 22:19:59 +03:00
|
|
|
PMIDIPortParent* BackgroundParentImpl::AllocPMIDIPortParent(
|
|
|
|
const MIDIPortInfo& aPortInfo, const bool& aSysexEnabled) {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2017-11-15 22:19:59 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
RefPtr<MIDIPortParent> result = new MIDIPortParent(aPortInfo, aSysexEnabled);
|
|
|
|
return result.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPMIDIPortParent(PMIDIPortParent* aActor) {
|
|
|
|
MOZ_ASSERT(aActor);
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2017-11-15 22:19:59 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
RefPtr<MIDIPortParent> parent =
|
|
|
|
dont_AddRef(static_cast<MIDIPortParent*>(aActor));
|
|
|
|
parent->Teardown();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
PMIDIManagerParent* BackgroundParentImpl::AllocPMIDIManagerParent() {
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2017-11-15 22:19:59 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
RefPtr<MIDIManagerParent> result = new MIDIManagerParent();
|
|
|
|
MIDIPlatformService::Get()->AddManager(result);
|
|
|
|
return result.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPMIDIManagerParent(
|
|
|
|
PMIDIManagerParent* aActor) {
|
|
|
|
MOZ_ASSERT(aActor);
|
2019-01-11 23:56:39 +03:00
|
|
|
AssertIsInMainOrSocketProcess();
|
2017-11-15 22:19:59 +03:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
RefPtr<MIDIManagerParent> parent =
|
|
|
|
dont_AddRef(static_cast<MIDIManagerParent*>(aActor));
|
|
|
|
parent->Teardown();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-11-01 20:19:38 +03:00
|
|
|
mozilla::dom::PClientManagerParent*
|
|
|
|
BackgroundParentImpl::AllocPClientManagerParent() {
|
|
|
|
return mozilla::dom::AllocClientManagerParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPClientManagerParent(
|
|
|
|
mozilla::dom::PClientManagerParent* aActor) {
|
|
|
|
return mozilla::dom::DeallocClientManagerParent(aActor);
|
|
|
|
}
|
|
|
|
|
2017-12-04 17:51:32 +03:00
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvPClientManagerConstructor(
|
|
|
|
mozilla::dom::PClientManagerParent* aActor) {
|
|
|
|
mozilla::dom::InitClientManagerParent(aActor);
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2018-04-18 19:19:10 +03:00
|
|
|
IPCResult BackgroundParentImpl::RecvStorageActivity(
|
|
|
|
const PrincipalInfo& aPrincipalInfo) {
|
|
|
|
dom::StorageActivityService::SendActivity(aPrincipalInfo);
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2020-10-23 14:50:00 +03:00
|
|
|
already_AddRefed<PServiceWorkerParent>
|
|
|
|
BackgroundParentImpl::AllocPServiceWorkerParent(
|
2018-07-10 02:02:39 +03:00
|
|
|
const IPCServiceWorkerDescriptor&) {
|
2020-10-23 14:50:00 +03:00
|
|
|
return MakeAndAddRef<ServiceWorkerParent>();
|
2018-07-10 02:02:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
IPCResult BackgroundParentImpl::RecvPServiceWorkerConstructor(
|
|
|
|
PServiceWorkerParent* aActor,
|
|
|
|
const IPCServiceWorkerDescriptor& aDescriptor) {
|
|
|
|
dom::InitServiceWorkerParent(aActor, aDescriptor);
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2020-10-23 14:51:24 +03:00
|
|
|
already_AddRefed<PServiceWorkerContainerParent>
|
2018-07-10 02:02:39 +03:00
|
|
|
BackgroundParentImpl::AllocPServiceWorkerContainerParent() {
|
2020-10-23 14:51:24 +03:00
|
|
|
return MakeAndAddRef<mozilla::dom::ServiceWorkerContainerParent>();
|
2018-07-10 02:02:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPServiceWorkerContainerConstructor(
|
|
|
|
PServiceWorkerContainerParent* aActor) {
|
|
|
|
dom::InitServiceWorkerContainerParent(aActor);
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2020-10-23 14:52:49 +03:00
|
|
|
already_AddRefed<PServiceWorkerRegistrationParent>
|
2018-07-10 02:02:39 +03:00
|
|
|
BackgroundParentImpl::AllocPServiceWorkerRegistrationParent(
|
|
|
|
const IPCServiceWorkerRegistrationDescriptor&) {
|
2020-10-23 14:52:49 +03:00
|
|
|
return MakeAndAddRef<mozilla::dom::ServiceWorkerRegistrationParent>();
|
2018-07-10 02:02:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPServiceWorkerRegistrationConstructor(
|
|
|
|
PServiceWorkerRegistrationParent* aActor,
|
|
|
|
const IPCServiceWorkerRegistrationDescriptor& aDescriptor) {
|
|
|
|
dom::InitServiceWorkerRegistrationParent(aActor, aDescriptor);
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2018-12-01 23:26:09 +03:00
|
|
|
dom::PEndpointForReportParent*
|
|
|
|
BackgroundParentImpl::AllocPEndpointForReportParent(
|
|
|
|
const nsString& aGroupName, const PrincipalInfo& aPrincipalInfo) {
|
|
|
|
RefPtr<dom::EndpointForReportParent> actor =
|
|
|
|
new dom::EndpointForReportParent();
|
|
|
|
return actor.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvPEndpointForReportConstructor(
|
|
|
|
PEndpointForReportParent* aActor, const nsString& aGroupName,
|
|
|
|
const PrincipalInfo& aPrincipalInfo) {
|
|
|
|
static_cast<dom::EndpointForReportParent*>(aActor)->Run(aGroupName,
|
|
|
|
aPrincipalInfo);
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2020-10-21 02:32:57 +03:00
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvEnsureRDDProcessAndCreateBridge(
|
2020-11-13 01:53:49 +03:00
|
|
|
EnsureRDDProcessAndCreateBridgeResolver&& aResolver) {
|
2020-10-21 02:32:57 +03:00
|
|
|
RDDProcessManager* rdd = RDDProcessManager::Get();
|
2020-11-13 01:53:49 +03:00
|
|
|
Endpoint<PRemoteDecoderManagerChild> endpoint;
|
|
|
|
nsresult rv =
|
|
|
|
rdd && rdd->EnsureRDDProcessAndCreateBridge(OtherPid(), &endpoint)
|
|
|
|
? NS_OK
|
|
|
|
: NS_ERROR_NOT_AVAILABLE;
|
|
|
|
aResolver(
|
|
|
|
Tuple<const nsresult&, Endpoint<mozilla::PRemoteDecoderManagerChild>&&>(
|
|
|
|
rv, std::move(endpoint)));
|
2020-10-21 02:32:54 +03:00
|
|
|
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2018-12-01 23:26:09 +03:00
|
|
|
bool BackgroundParentImpl::DeallocPEndpointForReportParent(
|
|
|
|
PEndpointForReportParent* aActor) {
|
|
|
|
RefPtr<dom::EndpointForReportParent> actor =
|
|
|
|
dont_AddRef(static_cast<dom::EndpointForReportParent*>(aActor));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-12-01 23:26:09 +03:00
|
|
|
mozilla::ipc::IPCResult BackgroundParentImpl::RecvRemoveEndpoint(
|
|
|
|
const nsString& aGroupName, const nsCString& aEndpointURL,
|
|
|
|
const PrincipalInfo& aPrincipalInfo) {
|
|
|
|
NS_DispatchToMainThread(
|
|
|
|
NS_NewRunnableFunction("BackgroundParentImpl::RecvRemoveEndpoint(",
|
|
|
|
[aGroupName, aEndpointURL, aPrincipalInfo]() {
|
|
|
|
dom::ReportingHeader::RemoveEndpoint(
|
|
|
|
aGroupName, aEndpointURL, aPrincipalInfo);
|
|
|
|
}));
|
|
|
|
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2019-07-15 18:49:30 +03:00
|
|
|
dom::PMediaTransportParent* BackgroundParentImpl::AllocPMediaTransportParent() {
|
|
|
|
#ifdef MOZ_WEBRTC
|
|
|
|
return new MediaTransportParent;
|
|
|
|
#else
|
|
|
|
return nullptr;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackgroundParentImpl::DeallocPMediaTransportParent(
|
|
|
|
dom::PMediaTransportParent* aActor) {
|
|
|
|
#ifdef MOZ_WEBRTC
|
|
|
|
delete aActor;
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-12-03 16:41:58 +03:00
|
|
|
PParentToChildStreamParent*
|
|
|
|
BackgroundParentImpl::SendPParentToChildStreamConstructor(
|
|
|
|
PParentToChildStreamParent* aActor) {
|
|
|
|
return PBackgroundParent::SendPParentToChildStreamConstructor(aActor);
|
|
|
|
}
|
|
|
|
|
|
|
|
PFileDescriptorSetParent*
|
|
|
|
BackgroundParentImpl::SendPFileDescriptorSetConstructor(
|
|
|
|
const FileDescriptor& aFD) {
|
|
|
|
return PBackgroundParent::SendPFileDescriptorSetConstructor(aFD);
|
|
|
|
}
|
|
|
|
|
2020-01-18 16:48:34 +03:00
|
|
|
} // namespace mozilla::ipc
|
2013-11-27 11:59:41 +04:00
|
|
|
|
|
|
|
void TestParent::ActorDestroy(ActorDestroyReason aWhy) {
|
2019-01-11 23:56:39 +03:00
|
|
|
mozilla::ipc::AssertIsInMainOrSocketProcess();
|
2013-11-27 11:59:41 +04:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
}
|