Open Bug 1575540 Opened 5 years ago Updated 2 years ago

[Protections Panel] Improve the way how we get the tracker counter

Categories

(Firefox :: Protections UI, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox70 --- affected

People

(Reporter: timhuang, Unassigned)

References

Details

(Whiteboard: [privacy-panel][skyline])

For the current protections panel, we pre-fetch the tracker counter while the user hovers or focus, by keyboard navigation, on the shield icon in order to present the counter as soon as the user opens the panel since getting the tracker counter is an async operation.

This approach works fine so far, however, it might have several edge cases that we need to handle, like Bug 1573431 and maybe more. So far, it is ok, but It could be a huge effort for us to maintain it if we add more workarounds for different edge cases.

So, I think it would be good if we can improve this. Here are some thoughts.

  • Just don't use pre-fetch at all. Since we already implemented a transition to the tracker counter for showing if the data comes really late, I think it is totally fine we start to fetch the counter while the panel is opened and then display the counter when the data is ready. The transition should do a good job on that.
  • Cache the tracker counter inside the TrackingDBService and turn TrackingDBService.sumAllEvents() to a sync operation. Given that the tracker counter only get update when a page is closing. We might be able to cache the value when updating the database at that moment. So, we can get the tracker counter through the cache directly instead of an async database operation.

I found another issue with the fetch-on-hover. The mouseover event can be triggered multiple times - I believe when the icon container is hovered as well as the image is hovered.... I observed multiple flickers of the counter text meaning we fetched/updated more than once. This is inefficient and unnecessary DB querying.

Priority: -- → P3
Assignee: nobody → tihuang
Status: NEW → ASSIGNED

Per offline discussion, we have an easier proposal for improving this. We can add an observer notifier for the tracking DB gets updated. And the protection panel can get the new count of the trackers when this observer happens and shows the new counter at the next time that it has been opened.

(In reply to Tim Huang[:timhuang] from comment #2)

Per offline discussion, we have an easier proposal for improving this. We can add an observer notifier for the tracking DB gets updated. And the protection panel can get the new count of the trackers when this observer happens and shows the new counter at the next time that it has been opened.

Nice! That sounds pretty elegant.

Component: Site Identity → Protections UI
Assignee: tihuang → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.