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"
|
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"
|
2015-02-11 14:53:00 +03:00
|
|
|
#include "mozilla/dom/ServiceWorkerRegistrar.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"
|
2015-11-22 12:43:55 +03:00
|
|
|
#include "mozilla/dom/quota/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"
|
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"
|
2015-06-04 21:51:57 +03:00
|
|
|
#include "ServiceWorkerManagerParent.h"
|
2013-11-27 11:59:41 +04:00
|
|
|
|
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;
|
2015-05-29 17:14:14 +03:00
|
|
|
using mozilla::dom::UDPSocketParent;
|
2017-05-05 03:48:34 +03:00
|
|
|
using mozilla::dom::WebAuthnTransactionParent;
|
2013-11-27 11:59:41 +04:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
void
|
|
|
|
AssertIsOnMainThread()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
}
|
|
|
|
|
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-06-04 21:51:57 +03:00
|
|
|
using mozilla::dom::workers::ServiceWorkerManagerParent;
|
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
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
return mozilla::dom::IPCBlobInputStreamParent::Create(aID, aSize, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
delete aActor;
|
|
|
|
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
|
|
|
|
2015-11-24 21:38:48 +03:00
|
|
|
RefPtr<dom::workers::ServiceWorkerManagerParent> agent =
|
|
|
|
new dom::workers::ServiceWorkerManagerParent();
|
|
|
|
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
|
|
|
|
2015-11-24 21:38:48 +03:00
|
|
|
RefPtr<dom::workers::ServiceWorkerManagerParent> parent =
|
|
|
|
dont_AddRef(static_cast<dom::workers::ServiceWorkerManagerParent*>(aActor));
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
}
|