Bug 1415333 - Set correct userContextId at window creation r=Gijs

The container tab indicator should also be set on the tab, not just on
the browser. Otherwise it is possible for the indicator to be missing
when a new window is opened.

And previously, if the URL was an "about:blank" URL, the tab in the new
window would use the default container because of the early return in
_handleURIToLoad. This is fixed by accounting for window.arguments[6]
when initializing the default (about:blank) tab in the tabbrowser.

Unit tests for these code path will be added in bug 1393570.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Rob Wu 2018-09-05 09:39:56 +00:00
parent bfb302ba9e
commit e69ac92ea0
2 changed files with 12 additions and 1 deletions

View File

@ -1633,6 +1633,8 @@ var gBrowserInit = {
_handleURIToLoad() {
this._callWithURIToLoad(uriToLoad => {
if (!uriToLoad || uriToLoad == "about:blank") {
// We don't check whether window.arguments[6] (userContextId) is set
// because tabbrowser.js takes care of that for the initial tab.
return;
}

View File

@ -283,9 +283,12 @@ window._gBrowser = {
},
_setupInitialBrowserAndTab() {
// See browser.js for the meaning of window.arguments.
let userContextId = window.arguments && window.arguments[6];
// Bug 1362774 will adjust this to only set `uriIsAboutBlank` when
// necessary. For now, we always pass it.
let browser = this._createBrowser({uriIsAboutBlank: true});
let browser = this._createBrowser({uriIsAboutBlank: true, userContextId});
browser.setAttribute("primary", "true");
browser.setAttribute("blank", "true");
browser.droppedLinkHandler = handleDroppedLink;
@ -304,6 +307,12 @@ window._gBrowser = {
tab._tPos = 0;
tab._fullyOpen = true;
tab.linkedBrowser = browser;
if (userContextId) {
tab.setUserContextId(userContextId);
ContextualIdentityService.setTabStyle(tab);
}
this._tabForBrowser.set(browser, tab);
this._appendStatusPanel();