Bug 1578624 - P11: Add a flag to ask the parent to not actually load the URI when opening a window, since we'll do it ourselves anyway. r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D47867

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-10-11 01:56:35 +00:00
Родитель a3e396d5bf
Коммит 4cefa2fdd3
5 изменённых файлов: 35 добавлений и 26 удалений

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

@ -6469,7 +6469,8 @@ nsBrowserAccess.prototype = {
aTriggeringPrincipal = null,
aNextRemoteTabId = 0,
aName = "",
aCsp = null
aCsp = null,
aSkipLoad = false
) {
let win, needToFocusWin;
@ -6508,6 +6509,7 @@ nsBrowserAccess.prototype = {
nextRemoteTabId: aNextRemoteTabId,
name: aName,
csp: aCsp,
skipLoad: aSkipLoad,
});
let browser = win.gBrowser.getBrowserForTab(tab);
@ -6532,7 +6534,8 @@ nsBrowserAccess.prototype = {
aWhere,
aFlags,
aTriggeringPrincipal,
aCsp
aCsp,
true
);
},
@ -6547,7 +6550,8 @@ nsBrowserAccess.prototype = {
aWhere,
aFlags,
aTriggeringPrincipal,
aCsp
aCsp,
false
);
},
@ -6557,7 +6561,8 @@ nsBrowserAccess.prototype = {
aWhere,
aFlags,
aTriggeringPrincipal,
aCsp
aCsp,
aSkipLoad
) {
// This function should only ever be called if we're opening a URI
// from a non-remote browser window (via nsContentTreeOwner).
@ -6687,7 +6692,8 @@ nsBrowserAccess.prototype = {
aTriggeringPrincipal,
0,
"",
aCsp
aCsp,
aSkipLoad
);
if (browser) {
browsingContext = browser.browsingContext;
@ -6725,14 +6731,17 @@ nsBrowserAccess.prototype = {
aNextRemoteTabId,
aName
) {
// Passing a null-URI to only create the content window.
// Passing a null-URI to only create the content window,
// and pass true for aSkipLoad to prevent loading of
// about:blank
return this.getContentWindowOrOpenURIInFrame(
null,
aParams,
aWhere,
aFlags,
aNextRemoteTabId,
aName
aName,
true
);
},
@ -6750,7 +6759,8 @@ nsBrowserAccess.prototype = {
aWhere,
aFlags,
aNextRemoteTabId,
aName
aName,
false
);
},
@ -6760,7 +6770,8 @@ nsBrowserAccess.prototype = {
aWhere,
aFlags,
aNextRemoteTabId,
aName
aName,
aSkipLoad
) {
if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
dump("Error: openURIInFrame can only open in new tabs");
@ -6787,7 +6798,8 @@ nsBrowserAccess.prototype = {
aParams.triggeringPrincipal,
aNextRemoteTabId,
aName,
aParams.csp
aParams.csp,
aSkipLoad
);
},

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

@ -1612,6 +1612,7 @@
var aFocusUrlBar;
var aName;
var aCsp;
var aSkipLoad;
if (
arguments.length == 2 &&
typeof arguments[1] == "object" &&
@ -1642,6 +1643,7 @@
aFocusUrlBar = params.focusUrlBar;
aName = params.name;
aCsp = params.csp;
aSkipLoad = params.skipLoad;
}
// all callers of loadOneTab need to pass a valid triggeringPrincipal.
@ -1682,6 +1684,7 @@
focusUrlBar: aFocusUrlBar,
name: aName,
csp: aCsp,
skipLoad: aSkipLoad,
});
if (!bgLoad) {
this.selectedTab = tab;
@ -2094,6 +2097,7 @@
sameProcessAsFrameLoader,
uriIsAboutBlank,
userContextId,
skipLoad,
} = {}) {
let b = document.createXULElement("browser");
// Use the JSM global to create the permanentKey, so that if the
@ -2210,7 +2214,7 @@
// Prevent the superfluous initial load of a blank document
// if we're going to load something other than about:blank.
if (!uriIsAboutBlank) {
if (!uriIsAboutBlank || skipLoad) {
b.setAttribute("nodefaultsrc", "true");
}
@ -2577,6 +2581,7 @@
recordExecution,
replayExecution,
csp,
skipLoad,
} = {}
) {
// all callers of addTab that pass a params object need to pass
@ -2810,6 +2815,7 @@
name,
recordExecution,
replayExecution,
skipLoad,
});
}
@ -2903,7 +2909,8 @@
// then let's just continue loading the page normally.
if (
!usingPreloadedContent &&
(!uriIsAboutBlank || !allowInheritPrincipal)
(!uriIsAboutBlank || !allowInheritPrincipal) &&
!skipLoad
) {
// pretend the user typed this so it'll be available till
// the document successfully loads

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

@ -1445,10 +1445,12 @@ mozilla::ipc::IPCResult BrowserChild::RecvActivate() {
// is definitely not going to work. GetPresShell should
// create a PresShell if one doesn't exist yet.
RefPtr<PresShell> presShell = GetTopLevelPresShell();
MOZ_ASSERT(presShell);
NS_ASSERTION(presShell, "Need a PresShell to activate!");
Unused << presShell;
mWebBrowser->FocusActivate();
if (presShell) {
mWebBrowser->FocusActivate();
}
return IPC_OK();
}

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

@ -1134,10 +1134,6 @@ nsresult ContentChild::ProvideWindowCommon(
}
}
if (!urlToLoad.IsEmpty()) {
newChild->RecvLoadURL(urlToLoad, showInfo);
}
if (xpc::IsInAutomation()) {
if (nsCOMPtr<nsPIDOMWindowOuter> outer =
do_GetInterface(newChild->WebNavigation())) {

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

@ -809,14 +809,6 @@ nsresult nsWindowWatcher::OpenWindowInternal(
if (NS_SUCCEEDED(rv) && newBC) {
nsCOMPtr<nsIDocShell> newDocShell = newBC->GetDocShell();
if (windowIsNew && newDocShell) {
// Make sure to stop any loads happening in this window that the
// window provider might have started. Otherwise if our caller
// manipulates the window it just opened and then the load
// completes their stuff will get blown away.
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(newDocShell);
webNav->Stop(nsIWebNavigation::STOP_NETWORK);
}
// If this is a new window, but it's incompatible with the current
// userContextId, we ignore it and we pretend that nothing has been