diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 76ce3b5aed89..3d102c7ae8ba 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -4538,12 +4538,29 @@ ContentParent::CommonCreateWindow(PBrowserParent* aThisTab, return IPC_OK(); } - if (aSetOpener && thisTabParent) { - aResult = pwwatch->OpenWindowWithTabParent(thisTabParent, aFeatures, - aCalledFromJS, aFullZoom, - getter_AddRefs(aNewTabParent)); - } else { - aResult = pwwatch->OpenWindowWithoutParent(getter_AddRefs(aNewTabParent)); + aResult = pwwatch->OpenWindowWithTabParent(aSetOpener ? thisTabParent : nullptr, + aFeatures, aCalledFromJS, aFullZoom, + getter_AddRefs(aNewTabParent)); + if (NS_WARN_IF(NS_FAILED(aResult))) { + return IPC_OK(); + } + + if (aURIToLoad) { + nsCOMPtr openerWindow; + if (aSetOpener && thisTabParent) { + openerWindow = thisTabParent->GetParentWindowOuter(); + } + nsCOMPtr newBrowserDOMWin = + TabParent::GetFrom(aNewTabParent)->GetBrowserDOMWindow(); + if (NS_WARN_IF(!newBrowserDOMWin)) { + aResult = NS_ERROR_ABORT; + return IPC_OK(); + } + nsCOMPtr win; + aResult = newBrowserDOMWin->OpenURI(aURIToLoad, openerWindow, + nsIBrowserDOMWindow::OPEN_CURRENTWINDOW, + nsIBrowserDOMWindow::OPEN_NEW, + getter_AddRefs(win)); } return IPC_OK(); diff --git a/toolkit/components/windowwatcher/nsPIWindowWatcher.idl b/toolkit/components/windowwatcher/nsPIWindowWatcher.idl index 47b2433641d2..45623fad52a4 100644 --- a/toolkit/components/windowwatcher/nsPIWindowWatcher.idl +++ b/toolkit/components/windowwatcher/nsPIWindowWatcher.idl @@ -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 diff --git a/toolkit/components/windowwatcher/nsWindowWatcher.cpp b/toolkit/components/windowwatcher/nsWindowWatcher.cpp index c8092b5f585d..0dc7b578332b 100644 --- a/toolkit/components/windowwatcher/nsWindowWatcher.cpp +++ b/toolkit/components/windowwatcher/nsWindowWatcher.cpp @@ -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,