Bug 1338375 Part 1: Fix window settings and navigation when creating a new window in a new process.

This commit is contained in:
Bob Owen 2017-02-28 07:28:36 +00:00
Родитель 93e2a0ae63
Коммит 19984fc539
3 изменённых файлов: 23 добавлений и 21 удалений

Просмотреть файл

@ -4538,12 +4538,29 @@ ContentParent::CommonCreateWindow(PBrowserParent* aThisTab,
return IPC_OK();
}
if (aSetOpener && thisTabParent) {
aResult = pwwatch->OpenWindowWithTabParent(thisTabParent, aFeatures,
aCalledFromJS, aFullZoom,
aResult = pwwatch->OpenWindowWithTabParent(aSetOpener ? thisTabParent : nullptr,
aFeatures, aCalledFromJS, aFullZoom,
getter_AddRefs(aNewTabParent));
} else {
aResult = pwwatch->OpenWindowWithoutParent(getter_AddRefs(aNewTabParent));
if (NS_WARN_IF(NS_FAILED(aResult))) {
return IPC_OK();
}
if (aURIToLoad) {
nsCOMPtr<mozIDOMWindowProxy> openerWindow;
if (aSetOpener && thisTabParent) {
openerWindow = thisTabParent->GetParentWindowOuter();
}
nsCOMPtr<nsIBrowserDOMWindow> newBrowserDOMWin =
TabParent::GetFrom(aNewTabParent)->GetBrowserDOMWindow();
if (NS_WARN_IF(!newBrowserDOMWin)) {
aResult = NS_ERROR_ABORT;
return IPC_OK();
}
nsCOMPtr<mozIDOMWindowProxy> win;
aResult = newBrowserDOMWin->OpenURI(aURIToLoad, openerWindow,
nsIBrowserDOMWindow::OPEN_CURRENTWINDOW,
nsIBrowserDOMWindow::OPEN_NEW,
getter_AddRefs(win));
}
return IPC_OK();

Просмотреть файл

@ -88,15 +88,6 @@ interface nsPIWindowWatcher : nsISupports
in boolean aForceNoOpener,
in nsIDocShellLoadInfo aLoadInfo);
/**
* Opens a new window using the most recent non-private browser
* window as its parent.
*
* @return the nsITabParent of the initial browser for the newly opened
* window.
*/
nsITabParent openWindowWithoutParent();
/**
* Opens a new window so that the window that aOpeningTab belongs to
* is set as the parent window. The newly opened window will also

Просмотреть файл

@ -474,12 +474,6 @@ CheckUserContextCompatibility(nsIDocShell* aDocShell)
return subjectPrincipal->GetUserContextId() == userContextId;
}
NS_IMETHODIMP
nsWindowWatcher::OpenWindowWithoutParent(nsITabParent** aResult)
{
return OpenWindowWithTabParent(nullptr, EmptyCString(), true, 1.0f, aResult);
}
nsresult
nsWindowWatcher::CreateChromeWindow(const nsACString& aFeatures,
nsIWebBrowserChrome* aParentChrome,