зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1394520 - [1.2] Extend nsIBrowserDOMWindow to support content window creation without URI loading with e10s. r=smaug
This commit is contained in:
Родитель
ecdd005bbd
Коммит
fbf9ec3f92
|
@ -5372,8 +5372,23 @@ nsBrowserAccess.prototype = {
|
|||
return newWindow;
|
||||
},
|
||||
|
||||
createContentWindowInFrame: function browser_createContentWindowInFrame(
|
||||
aURI, aParams, aWhere, aFlags, aNextTabParentId,
|
||||
aName) {
|
||||
// Passing a null-URI to only create the content window.
|
||||
return this.getContentWindowOrOpenURIInFrame(null, aParams, aWhere, aFlags,
|
||||
aNextTabParentId, aName);
|
||||
},
|
||||
|
||||
openURIInFrame: function browser_openURIInFrame(aURI, aParams, aWhere, aFlags,
|
||||
aNextTabParentId, aName) {
|
||||
return this.getContentWindowOrOpenURIInFrame(aURI, aParams, aWhere, aFlags,
|
||||
aNextTabParentId, aName);
|
||||
},
|
||||
|
||||
getContentWindowOrOpenURIInFrame: function browser_getContentWindowOrOpenURIInFrame(
|
||||
aURI, aParams, aWhere, aFlags,
|
||||
aNextTabParentId, aName) {
|
||||
if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
|
||||
dump("Error: openURIInFrame can only open in new tabs");
|
||||
return null;
|
||||
|
|
|
@ -111,6 +111,20 @@ interface nsIBrowserDOMWindow : nsISupports
|
|||
in short aWhere, in long aFlags,
|
||||
in nsIPrincipal aTriggeringPrincipal);
|
||||
|
||||
/**
|
||||
* As above, but return the nsIFrameLoaderOwner for the new window.
|
||||
*
|
||||
* Additional Parameters:
|
||||
* @param aNextTabParentId The TabParent to associate the window with.
|
||||
* @param aName The name to give the window opened in the new tab.
|
||||
* @return The nsIFrameLoaderOwner for the newly opened window.
|
||||
*/
|
||||
nsIFrameLoaderOwner
|
||||
createContentWindowInFrame(in nsIURI aURI, in nsIOpenURIInFrameParams params,
|
||||
in short aWhere, in long aFlags,
|
||||
in unsigned long long aNextTabParentId,
|
||||
in AString aName);
|
||||
|
||||
/**
|
||||
* Load a URI.
|
||||
|
||||
|
@ -132,16 +146,17 @@ interface nsIBrowserDOMWindow : nsISupports
|
|||
* As above, but return the nsIFrameLoaderOwner for the new window.
|
||||
*
|
||||
* Additional Parameters:
|
||||
* @param aNextTabParentId The TabParent to associate the window with
|
||||
* @param aNextTabParentId The TabParent to associate the window with.
|
||||
* @param aName The name to give the window opened in the new tab.
|
||||
* @return The nsIFrameLoaderOwner for the newly opened window.
|
||||
// XXXbz is this the right API?
|
||||
// See bug 537428
|
||||
*/
|
||||
nsIFrameLoaderOwner openURIInFrame(in nsIURI aURI, in nsIOpenURIInFrameParams params,
|
||||
in short aWhere, in long aFlags,
|
||||
in unsigned long long aNextTabParentId,
|
||||
in AString aName);
|
||||
nsIFrameLoaderOwner
|
||||
openURIInFrame(in nsIURI aURI, in nsIOpenURIInFrameParams params,
|
||||
in short aWhere, in long aFlags,
|
||||
in unsigned long long aNextTabParentId,
|
||||
in AString aName);
|
||||
|
||||
/**
|
||||
* @param aWindow the window to test.
|
||||
|
|
|
@ -954,10 +954,18 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
|
|||
return rv;
|
||||
}
|
||||
|
||||
OptionalURIParams uriToLoad;
|
||||
if (aURI) {
|
||||
SerializeURI(aURI, uriToLoad);
|
||||
} else {
|
||||
uriToLoad = mozilla::void_t();
|
||||
}
|
||||
|
||||
windowCreated =
|
||||
SendCreateWindow(aTabOpener, newChild, renderFrame,
|
||||
aChromeFlags, aCalledFromJS, aPositionSpecified,
|
||||
aSizeSpecified,
|
||||
uriToLoad,
|
||||
features,
|
||||
baseURIString,
|
||||
fullZoom,
|
||||
|
|
|
@ -4490,7 +4490,8 @@ ContentParent::CommonCreateWindow(PBrowserParent* aThisTab,
|
|||
nsresult& aResult,
|
||||
nsCOMPtr<nsITabParent>& aNewTabParent,
|
||||
bool* aWindowIsNew,
|
||||
nsIPrincipal* aTriggeringPrincipal)
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
bool aLoadURI)
|
||||
|
||||
{
|
||||
// The content process should never be in charge of computing whether or
|
||||
|
@ -4574,10 +4575,19 @@ ContentParent::CommonCreateWindow(PBrowserParent* aThisTab,
|
|||
params->SetTriggeringPrincipal(aTriggeringPrincipal);
|
||||
|
||||
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner;
|
||||
aResult = browserDOMWin->OpenURIInFrame(aURIToLoad, params, openLocation,
|
||||
nsIBrowserDOMWindow::OPEN_NEW,
|
||||
aNextTabParentId, aName,
|
||||
getter_AddRefs(frameLoaderOwner));
|
||||
if (aLoadURI) {
|
||||
aResult = browserDOMWin->OpenURIInFrame(aURIToLoad,
|
||||
params, openLocation,
|
||||
nsIBrowserDOMWindow::OPEN_NEW,
|
||||
aNextTabParentId, aName,
|
||||
getter_AddRefs(frameLoaderOwner));
|
||||
} else {
|
||||
aResult = browserDOMWin->CreateContentWindowInFrame(aURIToLoad,
|
||||
params, openLocation,
|
||||
nsIBrowserDOMWindow::OPEN_NEW,
|
||||
aNextTabParentId, aName,
|
||||
getter_AddRefs(frameLoaderOwner));
|
||||
}
|
||||
if (NS_SUCCEEDED(aResult) && frameLoaderOwner) {
|
||||
RefPtr<nsFrameLoader> frameLoader = frameLoaderOwner->GetFrameLoader();
|
||||
if (frameLoader) {
|
||||
|
@ -4622,7 +4632,7 @@ ContentParent::CommonCreateWindow(PBrowserParent* aThisTab,
|
|||
->SendSetOriginAttributes(openerOriginAttributes);
|
||||
}
|
||||
|
||||
if (aURIToLoad) {
|
||||
if (aURIToLoad && aLoadURI) {
|
||||
nsCOMPtr<mozIDOMWindowProxy> openerWindow;
|
||||
if (aSetOpener && thisTabParent) {
|
||||
openerWindow = thisTabParent->GetParentWindowOuter();
|
||||
|
@ -4652,6 +4662,7 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab,
|
|||
const bool& aCalledFromJS,
|
||||
const bool& aPositionSpecified,
|
||||
const bool& aSizeSpecified,
|
||||
const OptionalURIParams& aURIToLoad,
|
||||
const nsCString& aFeatures,
|
||||
const nsCString& aBaseURI,
|
||||
const float& aFullZoom,
|
||||
|
@ -4694,19 +4705,21 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab,
|
|||
const uint64_t nextTabParentId = ++sNextTabParentId;
|
||||
sNextTabParents.Put(nextTabParentId, newTab);
|
||||
|
||||
const nsCOMPtr<nsIURI> uriToLoad = DeserializeURI(aURIToLoad);
|
||||
|
||||
nsCOMPtr<nsITabParent> newRemoteTab;
|
||||
mozilla::ipc::IPCResult ipcResult =
|
||||
CommonCreateWindow(aThisTab, /* aSetOpener = */ true, aChromeFlags,
|
||||
aCalledFromJS, aPositionSpecified, aSizeSpecified,
|
||||
nullptr, aFeatures, aBaseURI, aFullZoom,
|
||||
uriToLoad, aFeatures, aBaseURI, aFullZoom,
|
||||
nextTabParentId, VoidString(), rv,
|
||||
newRemoteTab, &cwi.windowOpened(),
|
||||
aTriggeringPrincipal);
|
||||
aTriggeringPrincipal, /* aLoadUri = */ false);
|
||||
if (!ipcResult) {
|
||||
return ipcResult;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
if (NS_WARN_IF(NS_FAILED(rv)) || !newRemoteTab) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -4756,7 +4769,8 @@ ContentParent::RecvCreateWindowInDifferentProcess(
|
|||
aCalledFromJS, aPositionSpecified, aSizeSpecified,
|
||||
uriToLoad, aFeatures, aBaseURI, aFullZoom,
|
||||
/* aNextTabParentId = */ 0, aName, rv,
|
||||
newRemoteTab, &windowIsNew, aTriggeringPrincipal);
|
||||
newRemoteTab, &windowIsNew, aTriggeringPrincipal,
|
||||
/* aLoadUri = */ true);
|
||||
if (!ipcResult) {
|
||||
return ipcResult;
|
||||
}
|
||||
|
|
|
@ -532,6 +532,7 @@ public:
|
|||
const bool& aCalledFromJS,
|
||||
const bool& aPositionSpecified,
|
||||
const bool& aSizeSpecified,
|
||||
const OptionalURIParams& aURIToLoad,
|
||||
const nsCString& aFeatures,
|
||||
const nsCString& aBaseURI,
|
||||
const float& aFullZoom,
|
||||
|
@ -687,6 +688,9 @@ private:
|
|||
const bool& aIsForBrowser) override;
|
||||
using PContentParent::SendPTestShellConstructor;
|
||||
|
||||
// Set aLoadUri to true to load aURIToLoad and to false to only create the
|
||||
// window. aURIToLoad should always be provided, if available, to ensure
|
||||
// compatibility with GeckoView.
|
||||
mozilla::ipc::IPCResult
|
||||
CommonCreateWindow(PBrowserParent* aThisTab,
|
||||
bool aSetOpener,
|
||||
|
@ -703,7 +707,8 @@ private:
|
|||
nsresult& aResult,
|
||||
nsCOMPtr<nsITabParent>& aNewTabParent,
|
||||
bool* aWindowIsNew,
|
||||
nsIPrincipal* aTriggeringPrincipal);
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
bool aLoadUri);
|
||||
|
||||
FORWARD_SHMEM_ALLOCATOR_TO(PContentParent)
|
||||
|
||||
|
|
|
@ -990,6 +990,7 @@ parent:
|
|||
bool aCalledFromJS,
|
||||
bool aPositionSpecified,
|
||||
bool aSizeSpecified,
|
||||
OptionalURIParams aURIToLoad,
|
||||
nsCString aFeatures,
|
||||
nsCString aBaseURI,
|
||||
float aFullZoom,
|
||||
|
|
|
@ -3470,6 +3470,12 @@ nsBrowserAccess.prototype = {
|
|||
return this._getBrowser(aURI, null, aWhere, aFlags, null);
|
||||
},
|
||||
|
||||
createContentWindowInFrame: function browser_createContentWindowInFrame(
|
||||
aURI, aParams, aWhere, aFlags,
|
||||
aNextTabParentId, aName) {
|
||||
return this._getBrowser(null, null, aWhere, aFlags, null);
|
||||
},
|
||||
|
||||
isTabContentWindow: function(aWindow) {
|
||||
return BrowserApp.getBrowserForWindow(aWindow) != null;
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче