Bug 1040561 - Part 3. Return nullptr when CreateContentBridgeParent fails. r=khuey

This commit is contained in:
Kan-Ru Chen (陳侃如) 2014-09-09 16:57:51 +08:00
parent 6e04110b54
commit 2a43155bba

View File

@ -892,7 +892,10 @@ ContentParent::RecvCreateChildProcess(const IPCTabContext& aContext,
} }
if (!cp) { if (!cp) {
return false; *aId = 0;
*aIsForApp = false;
*aIsForBrowser = false;
return true;
} }
*aId = cp->ChildID(); *aId = cp->ChildID();
@ -942,13 +945,15 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
nsRefPtr<nsIContentParent> constructorSender; nsRefPtr<nsIContentParent> constructorSender;
if (isInContentProcess) { if (isInContentProcess) {
MOZ_ASSERT(aContext.IsBrowserElement()); MOZ_ASSERT(aContext.IsBrowserElement());
constructorSender = CreateContentBridgeParent(aContext, initialPriority); constructorSender =
CreateContentBridgeParent(aContext, initialPriority);
} else { } else {
if (aOpenerContentParent) { if (aOpenerContentParent) {
constructorSender = aOpenerContentParent; constructorSender = aOpenerContentParent;
} else { } else {
constructorSender = GetNewOrUsedBrowserProcess(aContext.IsBrowserElement(), constructorSender =
initialPriority); GetNewOrUsedBrowserProcess(aContext.IsBrowserElement(),
initialPriority);
} }
} }
if (constructorSender) { if (constructorSender) {
@ -1143,6 +1148,9 @@ ContentParent::CreateContentBridgeParent(const TabContext& aContext,
&isForBrowser)) { &isForBrowser)) {
return nullptr; return nullptr;
} }
if (id == 0) {
return nullptr;
}
if (!child->CallBridgeToChildProcess(id)) { if (!child->CallBridgeToChildProcess(id)) {
return nullptr; return nullptr;
} }