From 2a43155bba764325c8d05b3ec00a827af194523c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan-Ru=20Chen=20=28=E9=99=B3=E4=BE=83=E5=A6=82=29?= Date: Tue, 9 Sep 2014 16:57:51 +0800 Subject: [PATCH] Bug 1040561 - Part 3. Return nullptr when CreateContentBridgeParent fails. r=khuey --- dom/ipc/ContentParent.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 23add3e1e29..181e0f72406 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -892,7 +892,10 @@ ContentParent::RecvCreateChildProcess(const IPCTabContext& aContext, } if (!cp) { - return false; + *aId = 0; + *aIsForApp = false; + *aIsForBrowser = false; + return true; } *aId = cp->ChildID(); @@ -942,13 +945,15 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext, nsRefPtr constructorSender; if (isInContentProcess) { MOZ_ASSERT(aContext.IsBrowserElement()); - constructorSender = CreateContentBridgeParent(aContext, initialPriority); + constructorSender = + CreateContentBridgeParent(aContext, initialPriority); } else { if (aOpenerContentParent) { constructorSender = aOpenerContentParent; } else { - constructorSender = GetNewOrUsedBrowserProcess(aContext.IsBrowserElement(), - initialPriority); + constructorSender = + GetNewOrUsedBrowserProcess(aContext.IsBrowserElement(), + initialPriority); } } if (constructorSender) { @@ -1143,6 +1148,9 @@ ContentParent::CreateContentBridgeParent(const TabContext& aContext, &isForBrowser)) { return nullptr; } + if (id == 0) { + return nullptr; + } if (!child->CallBridgeToChildProcess(id)) { return nullptr; }