Open Bug 1864918 Opened 2 years ago Updated 2 years ago

Add improvements and a test for visibility that includes all pages

Categories

(Firefox :: Firefox View, task, P2)

task

Tracking

()

People

(Reporter: sclements, Unassigned)

References

Details

(Whiteboard: [fidefe-firefox-view])

Visibility handling of observers and event listeners was added in bug 1842602 as methods at the ViewPage level that any components extended from would have called. But open tabs was missed in that patch per bug 1863783 (also tabs from other devices which we could fix as part of this patch).

And in the future, if we add more sections, we'll need to ensure those also don't miss visibility handling.

So a potential safeguard is to throw an error within the viewTabVisibleCallback in Viewpage, since the expectation is that each section will override that function to handle removing their own event listeners and observers. But we might need to do more than that, and at the very least we could have a test that would check for all components to have its own viewTabVisibleCallback that doesn't throw an error or something similar.

There is visibility testing that was added in bug 1863783, that would make sense to consolidate if we create one test to handle visibility.

Also, I noticed that viewTabVisibleCallback is being called twice when switching to a tab, so this needs a boolean variable such as visibilityHandled like addObserversIfNeeded does to prevent the callback from being called multiple times.

You need to log in before you can comment on or make changes to this bug.