Files
palemoon27/dom/ipc/nsIContentChild.cpp
T
roytam1 538b35a4ee import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1147951, part 2 - Remove unused JAVASCRIPT definition from nsJSEnvironment.cpp. r=baku (607909217)
- Bug 1147951, part 1 - Remove uses of JAVASCRIPT2 from Console.cpp. r=baku (46cde7cfa)
- pointer style (5504c22d4)
- Bug 1165384 - Add a typedef for the statistics phase table; r=sfink (484a24237)
- Bug 1165385 - Remove the rarely used !fullFormat mode of MOZ_GCTIMER; r=sfink (ab8b17eb1)
- Bug 1165390 - Make the detailed statistics formatting methods have consistent names; r=sfink (55c5db543)
- Bug 1165410 - Reimplement GC statistics JSON output formatter; r=sfink (04c13c874)
- Bug 1166789 - Cleanup javascript.options.mem.log formatting; r=sfink, r=mccr8 (f23b455b4)
- Bug 1171451 - Use the correct type for the argv argument to NS_CreateJSArgv and the nsJSArgArray constructor; r=jst (edfa21a59)
- Bug 886459, part 1 - Remove unused includes of nsIJSRuntimeService.h. r=bholley (bbc277ac1)
- Bug 886459, part 2 - Remove context callbacks from XPCJSRuntime. r=bholley (2c3c8515a)
- Bug 886459, part 3 - Remove simple uses of nsIJSRuntimeService to get the JSRuntime. r=bholley (ff5bfe304)
- pointer style (2ea264afd)
- Bug 1169457 - Add null check in OnWrapperDestroy. r=jimm (741739513)
-  Bug 886459, part 4 - Remove nsIJSRuntimeService. r=bholley,aklotz (61563f53b)
- Bug 1176642 - Use absolute_import in mach_commands.py files; r=glandium (a9fcb3b3f)
- Bug 1176642 - Defer import of autotry and pprint; r=chmanchester (de40855cb)
- Bug 1178772 - Add check_macroassembler_style.py: Verify that each MacroAssembler declaration maps to all its definitions. r=h4writer (fd406593a)
- Bug 1152556 - Add moz.build bugzilla metadata in dom/media. r=kinetik (fa2ffa121)
- Bug 1152556 - Add moz.build bugzilla metadata in dom/media webrtc. r=abr (d208b839a)
- re-enable peerconnection (42e8c412b)
- Bug 1152538 - Enable WebRTC identity, r=jesup (13a47adcb)
- Bug 1231123 - Simplify LaunchApp on BSDs by dropping fork/exec version. r=jld (c35e6e36f)
- bug 1171120 - Fix mtransport+signalling to build on iOS. r=ekr (7034b20ab)
- Bug 1150609 Patch 1 WebRTC SDP - add tmmbr to offer. r=jesup (52ca72d09)
- Bug 1150609 Patch 2 - WebRTC enable tmmbr r=jesup (d59c6adb9)
- Bug 1150609 Patch 3 - WebRTC enable tmmbr unittest changes. r=jesup (eeffed826)
- Bug 1087161 - Upgrading B2G toolchain to gcc-4.9 (851194ca0)
2020-12-01 21:03:44 +08:00

130 lines
3.7 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "nsIContentChild.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/DOMTypes.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/StructuredCloneUtils.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/ipc/BlobChild.h"
#include "mozilla/ipc/InputStreamUtils.h"
#include "nsPrintfCString.h"
#include "xpcpublic.h"
using namespace mozilla::ipc;
using namespace mozilla::jsipc;
namespace mozilla {
namespace dom {
PJavaScriptChild*
nsIContentChild::AllocPJavaScriptChild()
{
return NewJavaScriptChild(xpc::GetJSRuntime());
}
bool
nsIContentChild::DeallocPJavaScriptChild(PJavaScriptChild* aChild)
{
ReleaseJavaScriptChild(aChild);
return true;
}
PBrowserChild*
nsIContentChild::AllocPBrowserChild(const TabId& aTabId,
const IPCTabContext& aContext,
const uint32_t& aChromeFlags,
const ContentParentId& aCpID,
const bool& aIsForApp,
const bool& aIsForBrowser)
{
// We'll happily accept any kind of IPCTabContext here; we don't need to
// check that it's of a certain type for security purposes, because we
// believe whatever the parent process tells us.
MaybeInvalidTabContext tc(aContext);
if (!tc.IsValid()) {
NS_ERROR(nsPrintfCString("Received an invalid TabContext from "
"the parent process. (%s) Crashing...",
tc.GetInvalidReason()).get());
MOZ_CRASH("Invalid TabContext received from the parent process.");
}
nsRefPtr<TabChild> child =
TabChild::Create(this, aTabId, tc.GetTabContext(), aChromeFlags);
// The ref here is released in DeallocPBrowserChild.
return child.forget().take();
}
bool
nsIContentChild::DeallocPBrowserChild(PBrowserChild* aIframe)
{
TabChild* child = static_cast<TabChild*>(aIframe);
NS_RELEASE(child);
return true;
}
PBlobChild*
nsIContentChild::AllocPBlobChild(const BlobConstructorParams& aParams)
{
return BlobChild::Create(this, aParams);
}
bool
nsIContentChild::DeallocPBlobChild(PBlobChild* aActor)
{
BlobChild::Destroy(aActor);
return true;
}
BlobChild*
nsIContentChild::GetOrCreateActorForBlob(Blob* aBlob)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aBlob);
nsRefPtr<BlobImpl> blobImpl = aBlob->Impl();
MOZ_ASSERT(blobImpl);
return GetOrCreateActorForBlobImpl(blobImpl);
}
BlobChild*
nsIContentChild::GetOrCreateActorForBlobImpl(BlobImpl* aImpl)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aImpl);
BlobChild* actor = BlobChild::GetOrCreate(this, aImpl);
NS_ENSURE_TRUE(actor, nullptr);
return actor;
}
bool
nsIContentChild::RecvAsyncMessage(const nsString& aMsg,
const ClonedMessageData& aData,
InfallibleTArray<CpowEntry>&& aCpows,
const IPC::Principal& aPrincipal)
{
nsRefPtr<nsFrameMessageManager> cpm = nsFrameMessageManager::GetChildProcessManager();
if (cpm) {
StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForChild(aData);
CrossProcessCpowHolder cpows(this, aCpows);
cpm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(cpm.get()), nullptr,
aMsg, false, &cloneData, &cpows, aPrincipal, nullptr);
}
return true;
}
} // namespace dom
} // namespace mozilla