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
|
2015-08-31 15:51:29 +03:00
|
|
|
#include "mozilla/media/MediaParent.h"
|
2013-11-27 11:59:41 +04:00
|
|
|
#include "mozilla/Assertions.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"
|
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"
|
2016-06-28 01:25:00 +03:00
|
|
|
#include "mozilla/dom/PGamepadEventChannelParent.h"
|
2016-06-28 01:26:00 +03:00
|
|
|
#include "mozilla/dom/PGamepadTestChannelParent.h"
|
2015-06-17 13:44:27 +03:00
|
|
|
#include "mozilla/dom/MessagePortParent.h"
|
2018-07-10 02:02:39 +03:00
|
|
|
#include "mozilla/dom/ServiceWorkerActors.h"
|
2018-01-27 00:08:59 +03:00
|
|
|
#include "mozilla/dom/ServiceWorkerManagerParent.h"
|
2015-02-11 14:53:00 +03:00
|
|
|
#include "mozilla/dom/ServiceWorkerRegistrar.h"
|
2018-04-18 19:19:10 +03:00
|
|
|
#include "mozilla/dom/StorageActivityService.h"
|
2015-08-29 08:45:04 +03:00
|
|
|
#include "mozilla/dom/asmjscache/AsmJSCache.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"
|
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
|
|
|
#include "mozilla/dom/ipc/IPCBlobInputStreamParent.h"
|
2017-05-09 23:35:27 +03:00
|
|
|
#include "mozilla/dom/ipc/PendingIPCBlobParent.h"
|
2017-10-05 08:41:42 +03:00
|
|
|
#include "mozilla/dom/ipc/TemporaryIPCBlobParent.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"
|
2018-11-20 02:18:32 +03:00
|
|
|
#include "mozilla/dom/RemoteWorkerParent.h"
|
|
|
|
#include "mozilla/dom/RemoteWorkerServiceParent.h"
|
2018-11-20 02:18:20 +03:00
|
|
|
#include "mozilla/dom/SharedWorkerParent.h"
|
2017-08-08 23:56:49 +03:00
|
|
|
#include "mozilla/dom/StorageIPC.h"
|
2017-11-15 22:19:59 +03:00
|
|
|
#include "mozilla/dom/MIDIManagerParent.h"
|
|
|
|
#include "mozilla/dom/MIDIPortParent.h"
|
|
|
|
#include "mozilla/dom/MIDIPlatformService.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"
|
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"
|
2017-05-15 11:01:10 +03:00
|
|
|
#include "mozilla/net/HttpBackgroundChannelParent.h"
|
2015-05-29 17:14:14 +03:00
|
|
|
#include "mozilla/dom/network/UDPSocketParent.h"
|
2017-05-05 03:48:34 +03:00
|
|
|
#include "mozilla/dom/WebAuthnTransactionParent.h"
|
2016-04-09 21:17:02 +03:00
|
|
|
#include "mozilla/Preferences.h"
|
2015-01-15 19:58:40 +03:00
|
|
|
#include "nsNetUtil.h"
|
2015-07-07 05:17:00 +03:00
|
|
|
#include "nsIScriptSecurityManager.h"
|
2016-04-09 21:17:02 +03:00
|
|
|
#include "nsProxyRelease.h"
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.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::ipc::AssertIsOnBackgroundThread;
|
2015-08-29 08:45:04 +03:00
|
|
|
using mozilla::dom::asmjscache::PAsmJSCacheEntryParent;
|
2015-03-02 16:20:00 +03:00
|
|
|
using mozilla::dom::cache::PCacheParent;
|
|
|
|
using mozilla::dom::cache::PCacheStorageParent;
|
|
|
|
using mozilla::dom::cache::PCacheStreamControlParent;
|
2016-04-09 21:17:02 +03:00
|
|
|
using mozilla::dom::FileSystemBase;
|
|
|
|
using mozilla::dom::FileSystemRequestParent;
|
2015-06-17 13:44:27 +03:00
|
|
|
using mozilla::dom::MessagePortParent;
|
|
|
|
using mozilla::dom::PMessagePortParent;
|
2018-07-10 02:02:39 +03:00
|
|
|
using mozilla::dom::PServiceWorkerParent;
|
|
|
|
using mozilla::dom::PServiceWorkerContainerParent;
|
|
|
|
using mozilla::dom::PServiceWorkerRegistrationParent;
|
2015-05-29 17:14:14 +03:00
|
|
|
using mozilla::dom::UDPSocketParent;
|
2017-05-05 03:48:34 +03:00
|
|
|
using mozilla::dom::WebAuthnTransactionParent;
|
2018-02-05 21:55:07 +03:00
|
|
|
using mozilla::AssertIsOnMainThread;
|
2017-11-15 22:19:59 +03:00
|
|
|
using mozilla::dom::PMIDIPortParent;
|
|
|
|
using mozilla::dom::PMIDIManagerParent;
|
|
|
|
using mozilla::dom::MIDIPortParent;
|
|
|
|
using mozilla::dom::MIDIManagerParent;
|
|
|
|
using mozilla::dom::MIDIPlatformService;
|
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;
|
|
|
|
|
|
|
|
TestParent()
|
|
|
|
{
|
2014-07-15 19:37:45 +04:00
|
|
|
MOZ_COUNT_CTOR(TestParent);
|
2013-11-27 11:59:41 +04:00
|
|
|
}
|
|
|
|
|
2014-07-15 19:37:45 +04:00
|
|
|
protected:
|
2016-11-17 16:12:09 +03:00
|
|
|
~TestParent() override
|
2013-11-27 11:59:41 +04:00
|
|
|
{
|
2014-07-15 19:37:45 +04:00
|
|
|
MOZ_COUNT_DTOR(TestParent);
|
2013-11-27 11:59:41 +04:00
|
|
|
}
|
|
|
|
|
2014-07-15 19:37:45 +04:00
|
|
|
public:
|
2016-11-17 16:12:09 +03:00
|
|
|
void
|
2015-03-21 19:28:04 +03:00
|
|
|
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
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace ipc {
|
|
|
|
|
2015-01-15 19:58:40 +03:00
|
|
|
using mozilla::dom::ContentParent;
|
|
|
|
using mozilla::dom::BroadcastChannelParent;
|
2015-02-11 14:53:00 +03:00
|
|
|
using mozilla::dom::ServiceWorkerRegistrationData;
|
2015-01-15 19:58:40 +03:00
|
|
|
|
2013-11-27 11:59:41 +04:00
|
|
|
BackgroundParentImpl::BackgroundParentImpl()
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnMainThread();
|
|
|
|
|
|
|
|
MOZ_COUNT_CTOR(mozilla::ipc::BackgroundParentImpl);
|
|
|
|
}
|
|
|
|
|
|
|
|
BackgroundParentImpl::~BackgroundParentImpl()
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnMainThread();
|
|
|
|
|
|
|
|
MOZ_COUNT_DTOR(mozilla::ipc::BackgroundParentImpl);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BackgroundParentImpl::ActorDestroy(ActorDestroyReason aWhy)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
}
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
BackgroundParentImpl::PBackgroundTestParent*
|
2013-11-27 11:59:41 +04:00
|
|
|
BackgroundParentImpl::AllocPBackgroundTestParent(const nsCString& aTestArg)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return new TestParent();
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2013-11-27 11:59:41 +04:00
|
|
|
BackgroundParentImpl::RecvPBackgroundTestConstructor(
|
|
|
|
PBackgroundTestParent* aActor,
|
|
|
|
const nsCString& aTestArg)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete static_cast<TestParent*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
auto
|
2014-10-16 08:56:52 +04:00
|
|
|
BackgroundParentImpl::AllocPBackgroundIDBFactoryParent(
|
|
|
|
const LoggingInfo& aLoggingInfo)
|
2014-09-27 03:21:57 +04:00
|
|
|
-> PBackgroundIDBFactoryParent*
|
|
|
|
{
|
|
|
|
using mozilla::dom::indexedDB::AllocPBackgroundIDBFactoryParent;
|
|
|
|
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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;
|
|
|
|
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPBackgroundIDBFactoryParent(
|
|
|
|
PBackgroundIDBFactoryParent* aActor)
|
|
|
|
{
|
2014-10-16 08:56:52 +04:00
|
|
|
using mozilla::dom::indexedDB::DeallocPBackgroundIDBFactoryParent;
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
2014-10-16 08:56:52 +04:00
|
|
|
return DeallocPBackgroundIDBFactoryParent(aActor);
|
2014-09-27 03:21:57 +04:00
|
|
|
}
|
|
|
|
|
2015-11-22 12:44:33 +03:00
|
|
|
auto
|
|
|
|
BackgroundParentImpl::AllocPBackgroundIndexedDBUtilsParent()
|
|
|
|
-> PBackgroundIndexedDBUtilsParent*
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return mozilla::dom::indexedDB::AllocPBackgroundIndexedDBUtilsParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPBackgroundIndexedDBUtilsParent(
|
|
|
|
PBackgroundIndexedDBUtilsParent* aActor)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return
|
|
|
|
mozilla::dom::indexedDB::DeallocPBackgroundIndexedDBUtilsParent(aActor);
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-02-10 18:11:25 +03:00
|
|
|
BackgroundParentImpl::RecvFlushPendingFileDeletions()
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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(
|
|
|
|
const PrincipalInfo& aPrincipalInfo)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return mozilla::dom::AllocPBackgroundSDBConnectionParent(aPrincipalInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPBackgroundSDBConnectionConstructor(
|
|
|
|
PBackgroundSDBConnectionParent* aActor,
|
|
|
|
const PrincipalInfo& aPrincipalInfo)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
if (!mozilla::dom::RecvPBackgroundSDBConnectionConstructor(aActor,
|
|
|
|
aPrincipalInfo)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPBackgroundSDBConnectionParent(
|
|
|
|
PBackgroundSDBConnectionParent* aActor)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::DeallocPBackgroundSDBConnectionParent(aActor);
|
|
|
|
}
|
|
|
|
|
2018-07-14 09:34:14 +03:00
|
|
|
BackgroundParentImpl::PBackgroundLocalStorageCacheParent*
|
|
|
|
BackgroundParentImpl::AllocPBackgroundLocalStorageCacheParent(
|
|
|
|
const PrincipalInfo& aPrincipalInfo,
|
|
|
|
const nsCString& aOriginKey,
|
|
|
|
const uint32_t& aPrivateBrowsingId)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return
|
|
|
|
mozilla::dom::RecvPBackgroundLocalStorageCacheConstructor(
|
|
|
|
this,
|
|
|
|
aActor,
|
|
|
|
aPrincipalInfo,
|
|
|
|
aOriginKey,
|
|
|
|
aPrivateBrowsingId);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPBackgroundLocalStorageCacheParent(
|
|
|
|
PBackgroundLocalStorageCacheParent* aActor)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::DeallocPBackgroundLocalStorageCacheParent(aActor);
|
|
|
|
}
|
|
|
|
|
2017-08-08 23:56:49 +03:00
|
|
|
auto
|
2017-08-09 00:01:52 +03:00
|
|
|
BackgroundParentImpl::AllocPBackgroundStorageParent(const nsString& aProfilePath)
|
2017-08-08 23:56:49 +03:00
|
|
|
-> PBackgroundStorageParent*
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2017-08-09 00:01:52 +03:00
|
|
|
return mozilla::dom::AllocPBackgroundStorageParent(aProfilePath);
|
2017-08-08 23:56:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPBackgroundStorageConstructor(
|
2017-08-09 00:01:52 +03:00
|
|
|
PBackgroundStorageParent* aActor,
|
|
|
|
const nsString& aProfilePath)
|
2017-08-08 23:56:49 +03:00
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
2017-08-09 00:01:52 +03:00
|
|
|
return mozilla::dom::RecvPBackgroundStorageConstructor(aActor, aProfilePath);
|
2017-08-08 23:56:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPBackgroundStorageParent(
|
|
|
|
PBackgroundStorageParent* aActor)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::DeallocPBackgroundStorageParent(aActor);
|
|
|
|
}
|
|
|
|
|
2017-05-09 23:35:27 +03:00
|
|
|
PPendingIPCBlobParent*
|
|
|
|
BackgroundParentImpl::AllocPPendingIPCBlobParent(const IPCBlob& aBlob)
|
|
|
|
{
|
|
|
|
MOZ_CRASH("PPendingIPCBlobParent actors should be manually constructed!");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPPendingIPCBlobParent(PPendingIPCBlobParent* aActor)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
actor->Initialize();
|
|
|
|
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(PSharedWorkerParent* aActor,
|
2018-11-20 02:18:33 +03:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-10-05 08:41:42 +03:00
|
|
|
PTemporaryIPCBlobParent*
|
|
|
|
BackgroundParentImpl::AllocPTemporaryIPCBlobParent()
|
|
|
|
{
|
|
|
|
return new mozilla::dom::TemporaryIPCBlobParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPTemporaryIPCBlobConstructor(PTemporaryIPCBlobParent* aActor)
|
|
|
|
{
|
|
|
|
mozilla::dom::TemporaryIPCBlobParent* actor =
|
|
|
|
static_cast<mozilla::dom::TemporaryIPCBlobParent*>(aActor);
|
|
|
|
return actor->CreateAndShareFile();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPTemporaryIPCBlobParent(PTemporaryIPCBlobParent* aActor)
|
|
|
|
{
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
PIPCBlobInputStreamParent*
|
|
|
|
BackgroundParentImpl::AllocPIPCBlobInputStreamParent(const nsID& aID,
|
|
|
|
const uint64_t& aSize)
|
|
|
|
{
|
2017-05-31 08:41:10 +03:00
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2018-05-23 08:12:35 +03:00
|
|
|
RefPtr<mozilla::dom::IPCBlobInputStreamParent> actor =
|
|
|
|
mozilla::dom::IPCBlobInputStreamParent::Create(aID, aSize, this);
|
|
|
|
return actor.forget().take();
|
2017-05-31 08:41:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPIPCBlobInputStreamConstructor(PIPCBlobInputStreamParent* aActor,
|
|
|
|
const nsID& aID,
|
|
|
|
const uint64_t& aSize)
|
|
|
|
{
|
|
|
|
if (!static_cast<mozilla::dom::IPCBlobInputStreamParent*>(aActor)->HasValidStream()) {
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPIPCBlobInputStreamParent(PIPCBlobInputStreamParent* aActor)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
2018-05-23 08:12:35 +03:00
|
|
|
RefPtr<mozilla::dom::IPCBlobInputStreamParent> actor =
|
|
|
|
dont_AddRef(static_cast<mozilla::dom::IPCBlobInputStreamParent*>(aActor));
|
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
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
PFileDescriptorSetParent*
|
|
|
|
BackgroundParentImpl::AllocPFileDescriptorSetParent(
|
|
|
|
const FileDescriptor& aFileDescriptor)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return new FileDescriptorSetParent(aFileDescriptor);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPFileDescriptorSetParent(
|
|
|
|
PFileDescriptorSetParent* aActor)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete static_cast<FileDescriptorSetParent*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-03-14 14:28:58 +03:00
|
|
|
PChildToParentStreamParent*
|
|
|
|
BackgroundParentImpl::AllocPChildToParentStreamParent()
|
2016-05-15 20:32:09 +03:00
|
|
|
{
|
2017-03-14 14:28:58 +03:00
|
|
|
return mozilla::ipc::AllocPChildToParentStreamParent();
|
2016-05-15 20:32:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2017-03-14 14:28:58 +03:00
|
|
|
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()
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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(const OptionalPrincipalInfo& /* unused */,
|
|
|
|
const nsCString& /* unused */)
|
|
|
|
-> 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();
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-05-29 17:14:14 +03:00
|
|
|
BackgroundParentImpl::RecvPUDPSocketConstructor(PUDPSocketParent* aActor,
|
|
|
|
const OptionalPrincipalInfo& aOptionalPrincipal,
|
|
|
|
const nsCString& aFilter)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
if (aOptionalPrincipal.type() == OptionalPrincipalInfo::TPrincipalInfo) {
|
|
|
|
// 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
|
|
|
}
|
|
|
|
|
|
|
|
IPC::Principal principal;
|
|
|
|
if (!static_cast<UDPSocketParent*>(aActor)->Init(principal, aFilter)) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-01-15 19:58:40 +03:00
|
|
|
mozilla::dom::PBroadcastChannelParent*
|
|
|
|
BackgroundParentImpl::AllocPBroadcastChannelParent(
|
|
|
|
const PrincipalInfo& aPrincipalInfo,
|
2015-07-06 21:28:41 +03:00
|
|
|
const nsCString& aOrigin,
|
2016-06-07 14:50:00 +03:00
|
|
|
const nsString& aChannel)
|
2015-01-15 19:58:40 +03:00
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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
|
|
|
|
2015-01-15 19:58:40 +03:00
|
|
|
nsCOMPtr<nsIPrincipal> principal = PrincipalInfoToPrincipal(mPrincipalInfo);
|
|
|
|
|
2015-07-06 21:28:41 +03:00
|
|
|
nsAutoCString origin;
|
2016-08-12 08:19:29 +03:00
|
|
|
nsresult rv = principal->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
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-01-15 19:58:40 +03:00
|
|
|
BackgroundParentImpl::RecvPBroadcastChannelConstructor(
|
|
|
|
PBroadcastChannelParent* actor,
|
|
|
|
const PrincipalInfo& aPrincipalInfo,
|
2015-07-06 21:28:41 +03:00
|
|
|
const nsCString& aOrigin,
|
2016-06-07 14:50:00 +03:00
|
|
|
const nsString& aChannel)
|
2015-01-15 19:58:40 +03:00
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete static_cast<BroadcastChannelParent*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-06-04 21:51:57 +03:00
|
|
|
mozilla::dom::PServiceWorkerManagerParent*
|
|
|
|
BackgroundParentImpl::AllocPServiceWorkerManagerParent()
|
2015-03-03 17:51:05 +03:00
|
|
|
{
|
2015-06-04 21:51:57 +03:00
|
|
|
AssertIsInMainProcess();
|
|
|
|
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-02-11 14:53:00 +03:00
|
|
|
bool
|
2015-06-04 21:51:57 +03:00
|
|
|
BackgroundParentImpl::DeallocPServiceWorkerManagerParent(
|
|
|
|
PServiceWorkerManagerParent* aActor)
|
2015-02-11 14:53:00 +03:00
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
PCacheStreamControlParent*
|
|
|
|
BackgroundParentImpl::AllocPCacheStreamControlParent()
|
|
|
|
{
|
|
|
|
MOZ_CRASH("CacheStreamControlParent actor must be provided to PBackground manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPCacheStreamControlParent(PCacheStreamControlParent* aActor)
|
|
|
|
{
|
|
|
|
dom::cache::DeallocPCacheStreamControlParent(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-06-17 13:44:27 +03:00
|
|
|
PMessagePortParent*
|
|
|
|
BackgroundParentImpl::AllocPMessagePortParent(const nsID& aUUID,
|
|
|
|
const nsID& aDestinationUUID,
|
|
|
|
const uint32_t& aSequenceID)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return new MessagePortParent(aUUID);
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-06-17 13:44:27 +03:00
|
|
|
BackgroundParentImpl::RecvPMessagePortConstructor(PMessagePortParent* aActor,
|
|
|
|
const nsID& aUUID,
|
|
|
|
const nsID& aDestinationUUID,
|
|
|
|
const uint32_t& aSequenceID)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete static_cast<MessagePortParent*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-06-24 01:50:00 +03:00
|
|
|
BackgroundParentImpl::RecvMessagePortForceClose(const nsID& aUUID,
|
|
|
|
const nsID& aDestinationUUID,
|
|
|
|
const uint32_t& aSequenceID)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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-08-29 08:45:04 +03:00
|
|
|
PAsmJSCacheEntryParent*
|
|
|
|
BackgroundParentImpl::AllocPAsmJSCacheEntryParent(
|
|
|
|
const dom::asmjscache::OpenMode& aOpenMode,
|
|
|
|
const dom::asmjscache::WriteParams& aWriteParams,
|
|
|
|
const PrincipalInfo& aPrincipalInfo)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return
|
|
|
|
dom::asmjscache::AllocEntryParent(aOpenMode, aWriteParams, aPrincipalInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPAsmJSCacheEntryParent(
|
|
|
|
PAsmJSCacheEntryParent* aActor)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
dom::asmjscache::DeallocEntryParent(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-11-22 12:43:55 +03:00
|
|
|
BackgroundParentImpl::PQuotaParent*
|
|
|
|
BackgroundParentImpl::AllocPQuotaParent()
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
return mozilla::dom::quota::AllocPQuotaParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPQuotaParent(PQuotaParent* aActor)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
return mozilla::dom::quota::DeallocPQuotaParent(aActor);
|
|
|
|
}
|
|
|
|
|
2016-04-09 21:17:02 +03:00
|
|
|
dom::PFileSystemRequestParent*
|
|
|
|
BackgroundParentImpl::AllocPFileSystemRequestParent(
|
|
|
|
const FileSystemParams& aParams)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
RefPtr<FileSystemRequestParent> result = new FileSystemRequestParent();
|
|
|
|
|
|
|
|
if (NS_WARN_IF(!result->Initialize(aParams))) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-03-08 22:15:45 +03:00
|
|
|
return result.forget().take();
|
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-04-09 21:17:02 +03:00
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPFileSystemRequestParent(
|
|
|
|
PFileSystemRequestParent* aDoomed)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
RefPtr<FileSystemRequestParent> parent =
|
|
|
|
dont_AddRef(static_cast<FileSystemRequestParent*>(aDoomed));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-06-28 01:25:00 +03:00
|
|
|
// Gamepad API Background IPC
|
|
|
|
dom::PGamepadEventChannelParent*
|
|
|
|
BackgroundParentImpl::AllocPGamepadEventChannelParent()
|
|
|
|
{
|
|
|
|
RefPtr<dom::GamepadEventChannelParent> parent =
|
|
|
|
new dom::GamepadEventChannelParent();
|
|
|
|
|
|
|
|
return parent.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPGamepadEventChannelParent(dom::PGamepadEventChannelParent *aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
RefPtr<dom::GamepadEventChannelParent> parent =
|
|
|
|
dont_AddRef(static_cast<dom::GamepadEventChannelParent*>(aActor));
|
|
|
|
return true;
|
|
|
|
}
|
2016-06-28 01:26:00 +03:00
|
|
|
|
|
|
|
dom::PGamepadTestChannelParent*
|
|
|
|
BackgroundParentImpl::AllocPGamepadTestChannelParent()
|
|
|
|
{
|
|
|
|
RefPtr<dom::GamepadTestChannelParent> parent =
|
|
|
|
new dom::GamepadTestChannelParent();
|
|
|
|
|
|
|
|
return parent.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPGamepadTestChannelParent(dom::PGamepadTestChannelParent *aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
RefPtr<dom::GamepadTestChannelParent> parent =
|
|
|
|
dont_AddRef(static_cast<dom::GamepadTestChannelParent*>(aActor));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-05-15 11:01:10 +03:00
|
|
|
net::PHttpBackgroundChannelParent*
|
|
|
|
BackgroundParentImpl::AllocPHttpBackgroundChannelParent(const uint64_t& aChannelId)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2017-04-24 06:09:35 +03:00
|
|
|
RefPtr<net::HttpBackgroundChannelParent> actor =
|
|
|
|
new net::HttpBackgroundChannelParent();
|
|
|
|
|
|
|
|
// hold extra refcount for IPDL
|
|
|
|
return actor.forget().take();
|
2017-05-15 11:01:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPHttpBackgroundChannelConstructor(
|
|
|
|
net::PHttpBackgroundChannelParent *aActor,
|
|
|
|
const uint64_t& aChannelId)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPHttpBackgroundChannelParent(
|
|
|
|
net::PHttpBackgroundChannelParent *aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
2017-04-24 06:09:35 +03:00
|
|
|
// release extra refcount hold by AllocPHttpBackgroundChannelParent
|
|
|
|
RefPtr<net::HttpBackgroundChannelParent> actor =
|
|
|
|
dont_AddRef(static_cast<net::HttpBackgroundChannelParent*>(aActor));
|
|
|
|
|
2017-05-15 11:01:10 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-11-15 22:19:59 +03:00
|
|
|
PMIDIPortParent*
|
|
|
|
BackgroundParentImpl::AllocPMIDIPortParent(const MIDIPortInfo& aPortInfo, const bool& aSysexEnabled)
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
RefPtr<MIDIPortParent> result = new MIDIPortParent(aPortInfo, aSysexEnabled);
|
|
|
|
return result.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPMIDIPortParent(PMIDIPortParent* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
RefPtr<MIDIPortParent> parent =
|
|
|
|
dont_AddRef(static_cast<MIDIPortParent*>(aActor));
|
|
|
|
parent->Teardown();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
PMIDIManagerParent*
|
|
|
|
BackgroundParentImpl::AllocPMIDIManagerParent()
|
|
|
|
{
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
RefPtr<MIDIManagerParent> result = new MIDIManagerParent();
|
|
|
|
MIDIPlatformService::Get()->AddManager(result);
|
|
|
|
return result.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPMIDIManagerParent(PMIDIManagerParent* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
AssertIsInMainProcess();
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2018-07-10 02:02:39 +03:00
|
|
|
PServiceWorkerParent*
|
|
|
|
BackgroundParentImpl::AllocPServiceWorkerParent(const IPCServiceWorkerDescriptor&)
|
|
|
|
{
|
|
|
|
return dom::AllocServiceWorkerParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPServiceWorkerParent(PServiceWorkerParent* aActor)
|
|
|
|
{
|
|
|
|
return dom::DeallocServiceWorkerParent(aActor);
|
|
|
|
}
|
|
|
|
|
|
|
|
IPCResult
|
|
|
|
BackgroundParentImpl::RecvPServiceWorkerConstructor(PServiceWorkerParent* aActor,
|
|
|
|
const IPCServiceWorkerDescriptor& aDescriptor)
|
|
|
|
{
|
|
|
|
dom::InitServiceWorkerParent(aActor, aDescriptor);
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
PServiceWorkerContainerParent*
|
|
|
|
BackgroundParentImpl::AllocPServiceWorkerContainerParent()
|
|
|
|
{
|
|
|
|
return dom::AllocServiceWorkerContainerParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPServiceWorkerContainerParent(PServiceWorkerContainerParent* aActor)
|
|
|
|
{
|
|
|
|
return dom::DeallocServiceWorkerContainerParent(aActor);
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPServiceWorkerContainerConstructor(PServiceWorkerContainerParent* aActor)
|
|
|
|
{
|
|
|
|
dom::InitServiceWorkerContainerParent(aActor);
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
|
|
|
PServiceWorkerRegistrationParent*
|
|
|
|
BackgroundParentImpl::AllocPServiceWorkerRegistrationParent(const IPCServiceWorkerRegistrationDescriptor&)
|
|
|
|
{
|
|
|
|
return dom::AllocServiceWorkerRegistrationParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundParentImpl::DeallocPServiceWorkerRegistrationParent(PServiceWorkerRegistrationParent* aActor)
|
|
|
|
{
|
|
|
|
return dom::DeallocServiceWorkerRegistrationParent(aActor);
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
BackgroundParentImpl::RecvPServiceWorkerRegistrationConstructor(PServiceWorkerRegistrationParent* aActor,
|
|
|
|
const IPCServiceWorkerRegistrationDescriptor& aDescriptor)
|
|
|
|
{
|
|
|
|
dom::InitServiceWorkerRegistrationParent(aActor, aDescriptor);
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2013-11-27 11:59:41 +04:00
|
|
|
} // namespace ipc
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
void
|
|
|
|
TestParent::ActorDestroy(ActorDestroyReason aWhy)
|
|
|
|
{
|
2016-03-16 21:51:11 +03:00
|
|
|
mozilla::ipc::AssertIsInMainProcess();
|
2013-11-27 11:59:41 +04:00
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
}
|