Closed Bug 1415333 Opened 7 years ago Closed 6 years ago

Container-tab styling (in tab & urlbar) is missing, for the first new-window opened from a container tab

Categories

(Firefox :: Security, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 64
Tracking Status
firefox64 --- fixed

People

(Reporter: dholbert, Assigned: robwu)

References

Details

Attachments

(2 files)

STR:
 0. (Start with a fresh profile, for good measure)
 1. Click and hold the "+" on toolbar and choose "Personal"
 2. In this new Personal tab, visit https://www.wikipedia.org/ (for example)
 3. Shift-Click some link in the page.

EXPECTED RESULTS:
 The new window that appears should have its tab styled as a container tab.

ACTUAL RESULTS:
The new window is missing container-tab styling -- there's no stripe on the tab, and the "Personal" label in the URLbar is missing.
(In practice, it actually *is* a container tab, AFAICT based on login-state / cookies / etc., but it's not displayed as one.)

I can only reliably trigger this on the first attempt in a new profile.  After that, it's not as reliable.  So I think there's some race condition involved, probably (and we lose the race the first time, but sometimes/often pass later on.)
I'm using latest Nightly on Linux, version 58.0a1 (2017-11-07) (64-bit).

(though I'm pretty sure this bug has been around for quite a while)
I've found this bug while trying to write unit tests for bug 1393570, and will fix this in that bug.

The fix is to add the missing "userContextId," to this loadURI invocation:

https://searchfox.org/mozilla-central/rev/721842eed881c7fcdccb9ec0fe79e4e6d4e46604/browser/base/content/tabbrowser.js#1479-1482
Assignee: nobody → rob
Status: NEW → ASSIGNED
Depends on: 1393570
Actually the above assessment is not the full story; It was just a coincidence.

In any case, I'll try to figure out why the tab's container indicator is off.

Interestingly, "about:blank" never gets the UI indicator, whereas "about:blank?" does, occasionally.

My test case is:
1. Start Firefox, Open new container tab (Personal).
2. Load data:text/html,<a href="about:blank">blank</a> <a href="about:blank?">blank?</a> <a href="https://example.com" target="_blank">example</a>
3. Shift-click on any of the links.
Other way around.
Blocks: 1393570
No longer depends on: 1393570
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.
Comment on attachment 9006207 [details]
Bug 1415333 - Set correct userContextId at window creation

:Gijs (he/him) has approved the revision.
Attachment #9006207 - Flags: review+
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/08a3433e191d
Set correct userContextId at window creation r=Gijs
Use tab.setAttribute instead of tab.setUserContextId, in case the XBL
bindings are not ready yet.
Comment on attachment 9006483 [details]
Bug 1415333 - Use tab.setAttribute instead of tab.setUserContextId

:Gijs (he/him) has approved the revision.
Attachment #9006483 - Flags: review+
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/244f34cffbc1
Use tab.setAttribute instead of tab.setUserContextId r=Gijs
https://hg.mozilla.org/mozilla-central/rev/08a3433e191d
https://hg.mozilla.org/mozilla-central/rev/244f34cffbc1
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 64
See Also: → 1501244
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: