Closed Bug 1634051 Opened 4 years ago Closed 4 years ago

Simplify all tabs menu code and only insert its DOM when it is opened

Categories

(Firefox :: Tabbed Browser, task, P3)

task

Tracking

()

RESOLVED FIXED
Firefox 78
Tracking Status
firefox78 --- fixed

People

(Reporter: Gijs, Assigned: Gijs)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

Attachments

(1 file)

When you open the all tabs view, it opens the panelview with the list of tabs in a temporarily created panel. However, it has its own panel, which AFAICT is never actually used - the panel is only shown with PanelUI.showSubView, which will use the temporary panel instead.

We should remove the unused panel code, and clarify how it loads.

It seems right now we call init from a lazy task after the window shows. It's not clear to me if/why that is necessary - could we avoid initializing the panel at all until the all tabs button is clicked?

It also seems gTabsPanel gets several tab views constructed, two of which (hidden audio tabs, hidden tabs) are never used. I'm assuming I'm misreading something or can't find the code that uses them, but I'm not sure. Mark, can you help clarify how this is supposed to work?

Flags: needinfo?(mstriemer)

Per Matrix discussion with Mark,

(In reply to :Gijs (he/him) from comment #0)

It seems right now we call init from a lazy task after the window shows. It's not clear to me if/why that is necessary - could we avoid initializing the panel at all until the all tabs button is clicked?

Probably yes; it looks like this is primarily a performance optimization to make opening the view quicker. We could potentially try tracking the tabs in a fragment rather than the real DOM and see if that works the same way.

It also seems gTabsPanel gets several tab views constructed, two of which (hidden audio tabs, hidden tabs) are never used. I'm assuming I'm misreading something or can't find the code that uses them, but I'm not sure. Mark, can you help clarify how this is supposed to work?

It turns out the constructors of these classes have side effects, and those are meaningful. The expando properties on gTabsPanel are indeed unused, but the TabsPanel objects are not.

Flags: needinfo?(mstriemer)
See Also: → 1384733
Severity: -- → N/A
Type: defect → task
Keywords: perf
Priority: -- → P3

The initialization costs of the TabList constructors is very small compared to
the cost of actually calling _populate, so instead of calling init() from an
idle task, we can just wait until the view actually needs to be shown.

Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/a3400287932b
don't eagerly initialize the all tabs menu, r=mstriemer
Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/a60e12838aff
don't eagerly initialize the all tabs menu, r=mstriemer
Flags: needinfo?(gijskruitbosch+bugs)
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 78
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: