2014-06-11 09:44:03 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-05-03 22:32:37 +03:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-06-11 09:44:03 +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 "nsIContentParent.h"
|
|
|
|
|
|
|
|
#include "mozilla/Preferences.h"
|
2014-10-08 20:15:23 +04:00
|
|
|
#include "mozilla/dom/File.h"
|
2014-06-11 09:44:03 +04:00
|
|
|
#include "mozilla/dom/ContentParent.h"
|
2015-08-31 08:53:00 +03:00
|
|
|
#include "mozilla/dom/ContentBridgeParent.h"
|
2017-04-05 13:42:00 +03:00
|
|
|
#include "mozilla/dom/ContentProcessManager.h"
|
2014-06-11 09:44:03 +04:00
|
|
|
#include "mozilla/dom/PTabContext.h"
|
|
|
|
#include "mozilla/dom/PermissionMessageUtils.h"
|
|
|
|
#include "mozilla/dom/TabParent.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"
|
2015-09-10 23:50:58 +03:00
|
|
|
#include "mozilla/dom/ipc/StructuredCloneData.h"
|
2015-01-27 00:32:18 +03:00
|
|
|
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
2016-09-21 13:27:26 +03:00
|
|
|
#include "mozilla/ipc/FileDescriptorSetParent.h"
|
|
|
|
#include "mozilla/ipc/PFileDescriptorSetParent.h"
|
2017-03-14 14:29:43 +03:00
|
|
|
#include "mozilla/ipc/IPCStreamAlloc.h"
|
|
|
|
#include "mozilla/ipc/IPCStreamDestination.h"
|
|
|
|
#include "mozilla/ipc/IPCStreamSource.h"
|
2016-08-23 07:09:32 +03:00
|
|
|
#include "mozilla/Unused.h"
|
2014-06-11 09:44:03 +04:00
|
|
|
|
|
|
|
#include "nsFrameMessageManager.h"
|
2015-10-23 00:10:14 +03:00
|
|
|
#include "nsIWebBrowserChrome.h"
|
2014-06-11 09:44:03 +04:00
|
|
|
#include "nsPrintfCString.h"
|
2015-06-27 04:44:14 +03:00
|
|
|
#include "xpcpublic.h"
|
2014-06-11 09:44:03 +04:00
|
|
|
|
|
|
|
using namespace mozilla::jsipc;
|
|
|
|
|
2014-10-29 21:11:00 +03:00
|
|
|
// XXX need another bug to move this to a common header.
|
|
|
|
#ifdef DISABLE_ASSERTS_FOR_FUZZING
|
2015-02-07 02:05:08 +03:00
|
|
|
#define ASSERT_UNLESS_FUZZING(...) do { } while (0)
|
2014-10-29 21:11:00 +03:00
|
|
|
#else
|
2015-02-07 02:05:08 +03:00
|
|
|
#define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false, __VA_ARGS__)
|
2014-10-29 21:11:00 +03:00
|
|
|
#endif
|
|
|
|
|
2014-06-11 09:44:03 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
nsIContentParent::nsIContentParent()
|
|
|
|
{
|
2015-03-06 04:03:25 +03:00
|
|
|
mMessageManager = nsFrameMessageManager::NewProcessMessageManager(true);
|
2014-06-11 09:44:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
ContentParent*
|
|
|
|
nsIContentParent::AsContentParent()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsContentParent());
|
|
|
|
return static_cast<ContentParent*>(this);
|
|
|
|
}
|
|
|
|
|
2015-08-31 08:53:00 +03:00
|
|
|
ContentBridgeParent*
|
|
|
|
nsIContentParent::AsContentBridgeParent()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsContentBridgeParent());
|
|
|
|
return static_cast<ContentBridgeParent*>(this);
|
|
|
|
}
|
|
|
|
|
2014-06-11 09:44:03 +04:00
|
|
|
PJavaScriptParent*
|
|
|
|
nsIContentParent::AllocPJavaScriptParent()
|
|
|
|
{
|
2016-08-11 15:39:23 +03:00
|
|
|
return NewJavaScriptParent();
|
2014-06-11 09:44:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsIContentParent::DeallocPJavaScriptParent(PJavaScriptParent* aParent)
|
|
|
|
{
|
2015-01-27 00:32:18 +03:00
|
|
|
ReleaseJavaScriptParent(aParent);
|
2014-06-11 09:44:03 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-06-11 09:44:13 +04:00
|
|
|
bool
|
|
|
|
nsIContentParent::CanOpenBrowser(const IPCTabContext& aContext)
|
2014-06-11 09:44:03 +04:00
|
|
|
{
|
|
|
|
// (PopupIPCTabContext lets the child process prove that it has access to
|
|
|
|
// the app it's trying to open.)
|
2015-10-30 02:30:57 +03:00
|
|
|
// On e10s we also allow UnsafeTabContext to allow service workers to open
|
|
|
|
// windows. This is enforced in MaybeInvalidTabContext.
|
|
|
|
if (aContext.type() != IPCTabContext::TPopupIPCTabContext &&
|
|
|
|
aContext.type() != IPCTabContext::TUnsafeIPCTabContext) {
|
2015-02-07 02:05:08 +03:00
|
|
|
ASSERT_UNLESS_FUZZING("Unexpected IPCTabContext type. Aborting AllocPBrowserParent.");
|
2014-06-11 09:44:13 +04:00
|
|
|
return false;
|
2014-06-11 09:44:03 +04:00
|
|
|
}
|
|
|
|
|
2015-10-30 02:30:57 +03:00
|
|
|
if (aContext.type() == IPCTabContext::TPopupIPCTabContext) {
|
|
|
|
const PopupIPCTabContext& popupContext = aContext.get_PopupIPCTabContext();
|
|
|
|
if (popupContext.opener().type() != PBrowserOrId::TPBrowserParent) {
|
|
|
|
ASSERT_UNLESS_FUZZING("Unexpected PopupIPCTabContext type. Aborting AllocPBrowserParent.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto opener = TabParent::GetFrom(popupContext.opener().get_PBrowserParent());
|
|
|
|
if (!opener) {
|
|
|
|
ASSERT_UNLESS_FUZZING("Got null opener from child; aborting AllocPBrowserParent.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-02-18 07:35:45 +03:00
|
|
|
// Popup windows of isMozBrowserElement frames must be isMozBrowserElement if
|
|
|
|
// the parent isMozBrowserElement. Allocating a !isMozBrowserElement frame with
|
|
|
|
// same app ID would allow the content to access data it's not supposed to.
|
|
|
|
if (!popupContext.isMozBrowserElement() && opener->IsMozBrowserElement()) {
|
2015-10-30 02:30:57 +03:00
|
|
|
ASSERT_UNLESS_FUZZING("Child trying to escalate privileges! Aborting AllocPBrowserParent.");
|
|
|
|
return false;
|
|
|
|
}
|
2014-06-11 09:44:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
MaybeInvalidTabContext tc(aContext);
|
|
|
|
if (!tc.IsValid()) {
|
|
|
|
NS_ERROR(nsPrintfCString("Child passed us an invalid TabContext. (%s) "
|
|
|
|
"Aborting AllocPBrowserParent.",
|
|
|
|
tc.GetInvalidReason()).get());
|
2014-06-11 09:44:13 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
PBrowserParent*
|
2014-10-29 21:11:00 +03:00
|
|
|
nsIContentParent::AllocPBrowserParent(const TabId& aTabId,
|
2017-04-07 02:46:18 +03:00
|
|
|
const TabId& aSameTabGroupAs,
|
2014-10-29 21:11:00 +03:00
|
|
|
const IPCTabContext& aContext,
|
2014-06-11 09:44:13 +04:00
|
|
|
const uint32_t& aChromeFlags,
|
2014-10-24 04:28:00 +04:00
|
|
|
const ContentParentId& aCpId,
|
2014-06-11 09:44:13 +04:00
|
|
|
const bool& aIsForBrowser)
|
|
|
|
{
|
2017-04-07 02:46:18 +03:00
|
|
|
MOZ_ASSERT(!aSameTabGroupAs);
|
|
|
|
|
2015-11-02 08:53:26 +03:00
|
|
|
Unused << aCpId;
|
|
|
|
Unused << aIsForBrowser;
|
2014-06-11 09:44:13 +04:00
|
|
|
|
|
|
|
if (!CanOpenBrowser(aContext)) {
|
2014-06-11 09:44:03 +04:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2015-09-17 22:15:33 +03:00
|
|
|
uint32_t chromeFlags = aChromeFlags;
|
2017-04-05 13:42:00 +03:00
|
|
|
TabId openerTabId(0);
|
2017-01-16 23:15:11 +03:00
|
|
|
ContentParentId openerCpId(0);
|
2015-10-30 02:30:57 +03:00
|
|
|
if (aContext.type() == IPCTabContext::TPopupIPCTabContext) {
|
|
|
|
// CanOpenBrowser has ensured that the IPCTabContext is of
|
|
|
|
// type PopupIPCTabContext, and that the opener TabParent is
|
|
|
|
// reachable.
|
|
|
|
const PopupIPCTabContext& popupContext = aContext.get_PopupIPCTabContext();
|
|
|
|
auto opener = TabParent::GetFrom(popupContext.opener().get_PBrowserParent());
|
2017-04-05 13:42:00 +03:00
|
|
|
openerTabId = opener->GetTabId();
|
2017-01-16 23:15:11 +03:00
|
|
|
openerCpId = opener->Manager()->ChildID();
|
2017-04-05 13:42:00 +03:00
|
|
|
|
2015-10-30 02:30:57 +03:00
|
|
|
// We must ensure that the private browsing and remoteness flags
|
|
|
|
// match those of the opener.
|
|
|
|
nsCOMPtr<nsILoadContext> loadContext = opener->GetLoadContext();
|
|
|
|
if (!loadContext) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isPrivate;
|
|
|
|
loadContext->GetUsePrivateBrowsing(&isPrivate);
|
|
|
|
if (isPrivate) {
|
|
|
|
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
|
|
|
|
}
|
2015-09-17 22:15:33 +03:00
|
|
|
}
|
|
|
|
|
2017-04-05 13:42:00 +03:00
|
|
|
if (openerTabId > 0 ||
|
|
|
|
aContext.type() == IPCTabContext::TUnsafeIPCTabContext) {
|
|
|
|
// Creation of PBrowser triggered from grandchild process is currently
|
|
|
|
// broken and not supported (i.e. this code path doesn't work in
|
|
|
|
// ContentBridgeParent).
|
|
|
|
//
|
|
|
|
// If you're working on fixing the code path for ContentBridgeParent,
|
|
|
|
// remember to handle the remote frame registration below carefully as it
|
|
|
|
// has to be registered in parent process.
|
|
|
|
MOZ_ASSERT(XRE_IsParentProcess());
|
|
|
|
if (!XRE_IsParentProcess()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The creation of PBrowser was triggered from content process through
|
|
|
|
// either window.open() or service worker's openWindow().
|
|
|
|
// We need to register remote frame with the child generated tab id.
|
|
|
|
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
2017-01-16 23:15:11 +03:00
|
|
|
if (!cpm->RegisterRemoteFrame(aTabId, openerCpId, openerTabId, aContext, aCpId)) {
|
2017-04-05 13:42:00 +03:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-17 22:15:33 +03:00
|
|
|
// And because we're allocating a remote browser, of course the
|
|
|
|
// window is remote.
|
|
|
|
chromeFlags |= nsIWebBrowserChrome::CHROME_REMOTE_WINDOW;
|
|
|
|
|
2014-06-11 09:44:13 +04:00
|
|
|
MaybeInvalidTabContext tc(aContext);
|
|
|
|
MOZ_ASSERT(tc.IsValid());
|
2015-09-17 22:15:33 +03:00
|
|
|
TabParent* parent = new TabParent(this, aTabId, tc.GetTabContext(), chromeFlags);
|
2014-06-11 09:44:03 +04:00
|
|
|
|
|
|
|
// We release this ref in DeallocPBrowserParent()
|
|
|
|
NS_ADDREF(parent);
|
|
|
|
return parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsIContentParent::DeallocPBrowserParent(PBrowserParent* aFrame)
|
|
|
|
{
|
2015-02-06 00:47:32 +03:00
|
|
|
TabParent* parent = TabParent::GetFrom(aFrame);
|
2014-06-11 09:44:03 +04:00
|
|
|
NS_RELEASE(parent);
|
|
|
|
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*
|
|
|
|
nsIContentParent::AllocPIPCBlobInputStreamParent(const nsID& aID,
|
|
|
|
const uint64_t& aSize)
|
|
|
|
{
|
|
|
|
MOZ_CRASH("PIPCBlobInputStreamParent actors should be manually constructed!");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsIContentParent::DeallocPIPCBlobInputStreamParent(PIPCBlobInputStreamParent* aActor)
|
|
|
|
{
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2014-06-11 09:44:03 +04:00
|
|
|
nsIContentParent::RecvSyncMessage(const nsString& aMsg,
|
|
|
|
const ClonedMessageData& aData,
|
2015-01-16 22:58:52 +03:00
|
|
|
InfallibleTArray<CpowEntry>&& aCpows,
|
2014-06-11 09:44:03 +04:00
|
|
|
const IPC::Principal& aPrincipal,
|
2015-09-10 23:50:58 +03:00
|
|
|
nsTArray<ipc::StructuredCloneData>* aRetvals)
|
2014-06-11 09:44:03 +04:00
|
|
|
{
|
2017-03-30 00:43:21 +03:00
|
|
|
NS_LossyConvertUTF16toASCII messageNameCStr(aMsg);
|
Bug 1375392 - Tweak the PROFILER_LABEL* macros. r=mstange.
This patch makes the following changes to the macros.
- Removes PROFILER_LABEL_FUNC. It's only suitable for use in functions outside
classes, due to PROFILER_FUNCTION_NAME not getting class names, and it was
mostly misused.
- Removes PROFILER_FUNCTION_NAME. It's no longer used, and __func__ is
universally available now anyway.
- Combines the first two string literal arguments of PROFILER_LABEL and
PROFILER_LABEL_DYNAMIC into a single argument. There was no good reason for
them to be separate, and it forced a '::' in the label, which isn't always
appropriate. Also, the meaning of the "name_space" argument was interpreted
in an interesting variety of ways.
- Adds an "AUTO_" prefix to PROFILER_LABEL and PROFILER_LABEL_DYNAMIC, to make
it clearer they construct RAII objects rather than just being function calls.
(I myself have screwed up the scoping because of this in the past.)
- Fills in the 'js::ProfileEntry::Category::' qualifier within the macro, so
the caller doesn't need to. This makes a *lot* more of the uses fit onto a
single line.
The patch also makes the following changes to the macro uses (beyond those
required by the changes described above).
- Fixes a bunch of labels that had gotten out of sync with the name of the
class and/or function that encloses them.
- Removes a useless PROFILER_LABEL use within a trivial scope in
EventStateManager::DispatchMouseOrPointerEvent(). It clearly wasn't serving
any useful purpose. It also serves as extra evidence that the AUTO_ prefix is
a good idea.
- Tweaks DecodePool::SyncRunIf{Preferred,Possible} so that the labelling is
done within them, instead of at their callsites, because that's a more
standard way of doing things.
--HG--
extra : rebase_source : 318d1bc6fc1425a94aacbf489dd46e4f83211de4
2017-06-22 10:08:53 +03:00
|
|
|
AUTO_PROFILER_LABEL_DYNAMIC("nsIContentParent::RecvSyncMessage", EVENTS,
|
|
|
|
messageNameCStr.get());
|
2017-03-30 00:43:21 +03:00
|
|
|
|
2017-01-17 22:00:38 +03:00
|
|
|
CrossProcessCpowHolder cpows(this, aCpows);
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsFrameMessageManager> ppm = mMessageManager;
|
2014-06-11 09:44:03 +04:00
|
|
|
if (ppm) {
|
2015-09-10 23:50:58 +03:00
|
|
|
ipc::StructuredCloneData data;
|
|
|
|
ipc::UnpackClonedMessageDataForParent(aData, data);
|
2015-09-02 19:20:30 +03:00
|
|
|
|
2015-04-16 18:17:54 +03:00
|
|
|
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()), nullptr,
|
2015-09-10 23:50:58 +03:00
|
|
|
aMsg, true, &data, &cpows, aPrincipal, aRetvals);
|
2014-06-11 09:44:03 +04:00
|
|
|
}
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2014-06-11 09:44:03 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2014-10-08 08:32:45 +04:00
|
|
|
nsIContentParent::RecvRpcMessage(const nsString& aMsg,
|
|
|
|
const ClonedMessageData& aData,
|
2015-01-16 22:58:52 +03:00
|
|
|
InfallibleTArray<CpowEntry>&& aCpows,
|
2014-10-08 08:32:45 +04:00
|
|
|
const IPC::Principal& aPrincipal,
|
2015-09-10 23:50:58 +03:00
|
|
|
nsTArray<ipc::StructuredCloneData>* aRetvals)
|
2014-06-11 09:44:03 +04:00
|
|
|
{
|
2017-03-30 00:43:21 +03:00
|
|
|
NS_LossyConvertUTF16toASCII messageNameCStr(aMsg);
|
Bug 1375392 - Tweak the PROFILER_LABEL* macros. r=mstange.
This patch makes the following changes to the macros.
- Removes PROFILER_LABEL_FUNC. It's only suitable for use in functions outside
classes, due to PROFILER_FUNCTION_NAME not getting class names, and it was
mostly misused.
- Removes PROFILER_FUNCTION_NAME. It's no longer used, and __func__ is
universally available now anyway.
- Combines the first two string literal arguments of PROFILER_LABEL and
PROFILER_LABEL_DYNAMIC into a single argument. There was no good reason for
them to be separate, and it forced a '::' in the label, which isn't always
appropriate. Also, the meaning of the "name_space" argument was interpreted
in an interesting variety of ways.
- Adds an "AUTO_" prefix to PROFILER_LABEL and PROFILER_LABEL_DYNAMIC, to make
it clearer they construct RAII objects rather than just being function calls.
(I myself have screwed up the scoping because of this in the past.)
- Fills in the 'js::ProfileEntry::Category::' qualifier within the macro, so
the caller doesn't need to. This makes a *lot* more of the uses fit onto a
single line.
The patch also makes the following changes to the macro uses (beyond those
required by the changes described above).
- Fixes a bunch of labels that had gotten out of sync with the name of the
class and/or function that encloses them.
- Removes a useless PROFILER_LABEL use within a trivial scope in
EventStateManager::DispatchMouseOrPointerEvent(). It clearly wasn't serving
any useful purpose. It also serves as extra evidence that the AUTO_ prefix is
a good idea.
- Tweaks DecodePool::SyncRunIf{Preferred,Possible} so that the labelling is
done within them, instead of at their callsites, because that's a more
standard way of doing things.
--HG--
extra : rebase_source : 318d1bc6fc1425a94aacbf489dd46e4f83211de4
2017-06-22 10:08:53 +03:00
|
|
|
AUTO_PROFILER_LABEL_DYNAMIC("nsIContentParent::RecvRpcMessage", EVENTS,
|
|
|
|
messageNameCStr.get());
|
2017-03-30 00:43:21 +03:00
|
|
|
|
2017-01-17 22:00:38 +03:00
|
|
|
CrossProcessCpowHolder cpows(this, aCpows);
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsFrameMessageManager> ppm = mMessageManager;
|
2014-06-11 09:44:03 +04:00
|
|
|
if (ppm) {
|
2015-09-10 23:50:58 +03:00
|
|
|
ipc::StructuredCloneData data;
|
|
|
|
ipc::UnpackClonedMessageDataForParent(aData, data);
|
2015-09-02 19:20:30 +03:00
|
|
|
|
2015-04-16 18:17:54 +03:00
|
|
|
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()), nullptr,
|
2015-09-10 23:50:58 +03:00
|
|
|
aMsg, true, &data, &cpows, aPrincipal, aRetvals);
|
2014-06-11 09:44:03 +04:00
|
|
|
}
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2014-06-11 09:44:03 +04:00
|
|
|
}
|
2016-09-21 13:27:26 +03:00
|
|
|
|
|
|
|
PFileDescriptorSetParent*
|
|
|
|
nsIContentParent::AllocPFileDescriptorSetParent(const FileDescriptor& aFD)
|
|
|
|
{
|
|
|
|
return new FileDescriptorSetParent(aFD);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsIContentParent::DeallocPFileDescriptorSetParent(PFileDescriptorSetParent* aActor)
|
|
|
|
{
|
|
|
|
delete static_cast<FileDescriptorSetParent*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-03-14 14:28:58 +03:00
|
|
|
PChildToParentStreamParent*
|
|
|
|
nsIContentParent::AllocPChildToParentStreamParent()
|
2016-09-21 13:27:26 +03:00
|
|
|
{
|
2017-03-14 14:28:58 +03:00
|
|
|
return mozilla::ipc::AllocPChildToParentStreamParent();
|
2016-09-21 13:27:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2017-03-14 14:28:58 +03:00
|
|
|
nsIContentParent::DeallocPChildToParentStreamParent(PChildToParentStreamParent* aActor)
|
2016-09-21 13:27:26 +03:00
|
|
|
{
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
2014-06-11 09:44:03 +04:00
|
|
|
|
2017-03-14 14:29:43 +03:00
|
|
|
PParentToChildStreamParent*
|
|
|
|
nsIContentParent::AllocPParentToChildStreamParent()
|
|
|
|
{
|
|
|
|
MOZ_CRASH("PParentToChildStreamChild actors should be manually constructed!");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsIContentParent::DeallocPParentToChildStreamParent(PParentToChildStreamParent* aActor)
|
|
|
|
{
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2014-06-11 09:44:03 +04:00
|
|
|
nsIContentParent::RecvAsyncMessage(const nsString& aMsg,
|
2015-01-16 22:58:52 +03:00
|
|
|
InfallibleTArray<CpowEntry>&& aCpows,
|
2016-04-09 16:50:59 +03:00
|
|
|
const IPC::Principal& aPrincipal,
|
|
|
|
const ClonedMessageData& aData)
|
2014-06-11 09:44:03 +04:00
|
|
|
{
|
2017-03-30 00:43:21 +03:00
|
|
|
NS_LossyConvertUTF16toASCII messageNameCStr(aMsg);
|
Bug 1375392 - Tweak the PROFILER_LABEL* macros. r=mstange.
This patch makes the following changes to the macros.
- Removes PROFILER_LABEL_FUNC. It's only suitable for use in functions outside
classes, due to PROFILER_FUNCTION_NAME not getting class names, and it was
mostly misused.
- Removes PROFILER_FUNCTION_NAME. It's no longer used, and __func__ is
universally available now anyway.
- Combines the first two string literal arguments of PROFILER_LABEL and
PROFILER_LABEL_DYNAMIC into a single argument. There was no good reason for
them to be separate, and it forced a '::' in the label, which isn't always
appropriate. Also, the meaning of the "name_space" argument was interpreted
in an interesting variety of ways.
- Adds an "AUTO_" prefix to PROFILER_LABEL and PROFILER_LABEL_DYNAMIC, to make
it clearer they construct RAII objects rather than just being function calls.
(I myself have screwed up the scoping because of this in the past.)
- Fills in the 'js::ProfileEntry::Category::' qualifier within the macro, so
the caller doesn't need to. This makes a *lot* more of the uses fit onto a
single line.
The patch also makes the following changes to the macro uses (beyond those
required by the changes described above).
- Fixes a bunch of labels that had gotten out of sync with the name of the
class and/or function that encloses them.
- Removes a useless PROFILER_LABEL use within a trivial scope in
EventStateManager::DispatchMouseOrPointerEvent(). It clearly wasn't serving
any useful purpose. It also serves as extra evidence that the AUTO_ prefix is
a good idea.
- Tweaks DecodePool::SyncRunIf{Preferred,Possible} so that the labelling is
done within them, instead of at their callsites, because that's a more
standard way of doing things.
--HG--
extra : rebase_source : 318d1bc6fc1425a94aacbf489dd46e4f83211de4
2017-06-22 10:08:53 +03:00
|
|
|
AUTO_PROFILER_LABEL_DYNAMIC("nsIContentParent::RecvAsyncMessage", EVENTS,
|
|
|
|
messageNameCStr.get());
|
2017-03-30 00:43:21 +03:00
|
|
|
|
2017-01-17 22:00:38 +03:00
|
|
|
CrossProcessCpowHolder cpows(this, aCpows);
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsFrameMessageManager> ppm = mMessageManager;
|
2014-06-11 09:44:03 +04:00
|
|
|
if (ppm) {
|
2015-09-10 23:50:58 +03:00
|
|
|
ipc::StructuredCloneData data;
|
|
|
|
ipc::UnpackClonedMessageDataForParent(aData, data);
|
2015-09-02 19:20:30 +03:00
|
|
|
|
2015-04-16 18:17:54 +03:00
|
|
|
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()), nullptr,
|
2015-09-10 23:50:58 +03:00
|
|
|
aMsg, false, &data, &cpows, aPrincipal, nullptr);
|
2014-06-11 09:44:03 +04:00
|
|
|
}
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2014-06-11 09:44:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|