Bug 1422033 - Support opening a new window when no windows are avaliable for a new tab, r=bz
MozReview-Commit-ID: DzSllBVdUhq
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -4586,21 +4586,28 @@ ContentParent::CommonCreateWindow(PBrows
aNextTabParentId, aName,
getter_AddRefs(frameLoaderOwner));
}
if (NS_SUCCEEDED(aResult) && frameLoaderOwner) {
RefPtr<nsFrameLoader> frameLoader = frameLoaderOwner->GetFrameLoader();
if (frameLoader) {
frameLoader->GetTabParent(getter_AddRefs(aNewTabParent));
}
+ } else if (NS_SUCCEEDED(aResult) && !frameLoaderOwner) {
+ // Fall through to the normal window opening code path when there is no
+ // window which we can open a new tab in.
+ openLocation = nsIBrowserDOMWindow::OPEN_NEWWINDOW;
} else {
*aWindowIsNew = false;
}
- return IPC_OK();
+ // If we didn't retarget our window open into a new window, we should return now.
+ if (openLocation != nsIBrowserDOMWindow::OPEN_NEWWINDOW) {
+ return IPC_OK();
+ }
}
nsCOMPtr<nsPIWindowWatcher> pwwatch =
do_GetService(NS_WINDOWWATCHER_CONTRACTID, &aResult);
if (NS_WARN_IF(NS_FAILED(aResult))) {
return IPC_OK();
}