Bug 1047603 - Make TabParent::AnswerCreateWindow force the initial browser to be remote in a new window. r=smaug.

--HG--
extra : rebase_source : 87551351dc763be7f5a8a47d02de21eb3f10c745
This commit is contained in:
Mike Conley 2015-01-13 17:24:52 -05:00
parent 1b41aa507d
commit 69a8aed6f6
8 changed files with 36 additions and 41 deletions

View File

@ -940,8 +940,6 @@ var gBrowserInit = {
Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService)
.addSystemEventListener(gBrowser, "click", contentAreaClick, true);
} else {
gBrowser.updateBrowserRemoteness(gBrowser.selectedBrowser, true);
}
// hook up UI through progress listener
@ -4098,6 +4096,13 @@ var XULBrowserWindow = {
// unsupported
},
forceInitialBrowserRemote: function() {
let initBrowser =
document.getAnonymousElementByAttribute(gBrowser, "anonid", "initialBrowser");
gBrowser.updateBrowserRemoteness(initBrowser, true);
return initBrowser.frameLoader.tabParent;
},
setDefaultStatus: function (status) {
this.defaultStatus = status;
this.updateStatusField();

View File

@ -13754,19 +13754,6 @@ nsDocShell::GetOpener()
return opener;
}
void
nsDocShell::SetOpenedRemote(nsITabParent* aOpenedRemote)
{
mOpenedRemote = do_GetWeakReference(aOpenedRemote);
}
nsITabParent*
nsDocShell::GetOpenedRemote()
{
nsCOMPtr<nsITabParent> openedRemote(do_QueryReferent(mOpenedRemote));
return openedRemote;
}
URLSearchParams*
nsDocShell::GetURLSearchParams()
{

View File

@ -963,7 +963,6 @@ private:
nsTObserverArray<nsWeakPtr> mScrollObservers;
nsCString mOriginalUriString;
nsWeakPtr mOpener;
nsWeakPtr mOpenedRemote;
// A depth count of how many times NotifyRunToCompletionStart
// has been called without a matching NotifyRunToCompletionStop.

View File

@ -54,7 +54,7 @@ interface nsITabParent;
typedef unsigned long nsLoadFlags;
[scriptable, builtinclass, uuid(888fcf04-a69b-11e4-8d33-6fbb72d2eb03)]
[scriptable, builtinclass, uuid(f84b1ae4-2f78-4bad-b36a-6a8516ee6e40)]
interface nsIDocShell : nsIDocShellTreeItem
{
/**
@ -1025,13 +1025,6 @@ interface nsIDocShell : nsIDocShellTreeItem
[noscript,notxpcom,nostdcall] void setOpener(in nsITabParent aOpener);
[noscript,notxpcom,nostdcall] nsITabParent getOpener();
/**
* See the documentation for setOpener and getOpener about why we
* don't use attribute here instead.
*/
[noscript,notxpcom,nostdcall] void setOpenedRemote(in nsITabParent aOpenedRemote);
[noscript,notxpcom,nostdcall] nsITabParent getOpenedRemote();
// URLSearchParams for the window.location is owned by the docShell.
[noscript,notxpcom] URLSearchParams getURLSearchParams();

View File

@ -2205,7 +2205,6 @@ nsFrameLoader::TryRemoteBrowser()
eCaseMatters)) {
unused << mRemoteBrowser->SendSetUpdateHitRegion(true);
}
parentDocShell->SetOpenedRemote(mRemoteBrowser);
}
return true;
}

View File

@ -647,11 +647,22 @@ TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
nsCOMPtr<nsPIDOMWindow> pwindow = do_QueryInterface(window);
NS_ENSURE_TRUE(pwindow, false);
nsRefPtr<nsIDocShell> newDocShell = pwindow->GetDocShell();
NS_ENSURE_TRUE(newDocShell, false);
nsCOMPtr<nsIDocShell> windowDocShell = pwindow->GetDocShell();
NS_ENSURE_TRUE(windowDocShell, false);
nsCOMPtr<nsITabParent> newRemoteTab = newDocShell->GetOpenedRemote();
NS_ENSURE_TRUE(newRemoteTab, false);
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
windowDocShell->GetTreeOwner(getter_AddRefs(treeOwner));
nsCOMPtr<nsIXULWindow> xulWin = do_GetInterface(treeOwner);
NS_ENSURE_TRUE(xulWin, false);
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWin;
xulWin->GetXULBrowserWindow(getter_AddRefs(xulBrowserWin));
NS_ENSURE_TRUE(xulBrowserWin, false);
nsCOMPtr<nsITabParent> newRemoteTab;
rv = xulBrowserWin->ForceInitialBrowserRemote(getter_AddRefs(newRemoteTab));
NS_ENSURE_SUCCESS(rv, false);
MOZ_ASSERT(TabParent::GetFrom(newRemoteTab) == newTab);

View File

@ -12,13 +12,14 @@ interface nsIRequest;
interface nsIDOMElement;
interface nsIInputStream;
interface nsIDocShell;
interface nsITabParent;
/**
* The nsIXULBrowserWindow supplies the methods that may be called from the
* internals of the browser area to tell the containing xul window to update
* its ui.
*/
[scriptable, uuid(162d3378-a7d5-410c-8635-fe80e32020fc)]
[scriptable, uuid(db89f748-9736-40b2-a172-3928aa1194b2)]
interface nsIXULBrowserWindow : nsISupports
{
/**
@ -40,6 +41,14 @@ interface nsIXULBrowserWindow : nsISupports
in nsIDOMNode linkNode,
in boolean isAppTab);
/**
* Find the initial browser of the window and set its remote attribute.
* This can be used to ensure that there is a remote browser in a new
* window when it first spawns.
*
*/
nsITabParent forceInitialBrowserRemote();
/**
* Determines whether a load should continue.
*

View File

@ -34,6 +34,7 @@
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIIOService.h"
#include "nsILoadContext.h"
#include "nsIObserverService.h"
#include "nsIWindowMediator.h"
#include "nsIScreenManager.h"
@ -1798,19 +1799,10 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(int32_t aChromeFlags,
if (!NS_ProcessNextEvent(thread))
break;
}
}
// If aOpeningTab is not null, it means that we're creating a new window
// with a remote browser, which doesn't have a primary docshell. In that
// case, we check for the chrome window docshell and make sure that a new
// remote tab was opened and stashed in that docshell.
if (aOpeningTab) {
NS_ENSURE_STATE(xulWin->mDocShell);
NS_ENSURE_STATE(xulWin->mDocShell->GetOpenedRemote());
} else {
NS_ENSURE_STATE(xulWin->mPrimaryContentShell);
}
NS_ENSURE_STATE(xulWin->mPrimaryContentShell);
*_retval = newWindow;
NS_ADDREF(*_retval);