gecko-dev/browser/modules
Drew Willcoxon 996a2cafe4 Bug 1747973 - Cache the top-sites query context like we cache other contexts. r=harry
This caches the top-sites context like we cache other contexts. The cache is
cleared when the top sites change or are enabled/disabled.

Unlike other contexts, which are evicted from the cache once too many newer
contexts are cached, the top-sites context is never evicted due to space reasons
because showing the top sites is a frequent action.

I wanted to keep the logic around when/whether the top sites have changed or
been enabled/disabled isolated to the top-sites provider, since it's the class
concerned with top sites in the first place, instead of spreading it out to
`QueryContextCache`. However, by the same token I didn't want to cache contexts
directly in the provider in order to keep all context caching in
`QueryContextCache`. (Contexts are also per window/urlbar, not global, so if we
were to cache contexts in the provider, we'd need to store them in map from
windows to contexts or something similar.)

So I added a more general listener system to the provider. Listeners are called
when the top sites change or they are enabled/disabled. `QueryContextCache` adds
a listener function so it can evict its cached top-sites context. The provider
keeps weak references to the listener functions because currently `UrlbarView`
doesn't have a way to tell when it's destroyed, so it doesn't know when it
should remove listeners.

Finally, there doesn't seem to be a way to observe the `TopSitesFeed` from the
outside, and I don't think it's the role of `TopSitesFeed` to broadcast an
observer message to the entire browser or something like that, so I modified
`AboutNewTab` to subscribe to changes in its activity stream object and then
compare the new top sites to the last seen top sites, and if they're different,
then broadcast a new "newtab-top-sites-changed" notification.

Differential Revision: https://phabricator.services.mozilla.com/D134863
2022-01-03 19:18:54 +00:00
..
test Bug 1745272, remove soon to expire subframe crash telemetry, r=mconley 2021-12-18 11:05:21 +00:00
AboutNewTab.jsm Bug 1747973 - Cache the top-sites query context like we cache other contexts. r=harry 2022-01-03 19:18:54 +00:00
AppUpdater.jsm Bug 1718444 - Convert nsIUpdateCheckListener to async r=nalexander,application-update-reviewers 2021-09-21 23:57:22 +00:00
AsanReporter.jsm
AsyncTabSwitcher.jsm Bug 1745267 - Add new TabSwitched event to AsyncTabSwitcher. r=dthayer 2021-12-14 14:33:11 +00:00
BrowserUIUtils.jsm
BrowserUsageTelemetry.jsm Bug 1715542 - Give Glean and GleanPings a BackstagePass r=janerik,application-update-reviewers,nalexander 2021-12-14 20:51:03 +00:00
BrowserWindowTracker.jsm
ContentCrashHandlers.jsm Bug 1745272, remove soon to expire subframe crash telemetry, r=mconley 2021-12-18 11:05:21 +00:00
Discovery.jsm
EveryWindow.jsm
ExtensionsUI.jsm Bug 1714336 - Removes the disableHighlight option for doorhangers. r=Gijs 2021-08-03 16:26:28 +00:00
FaviconLoader.jsm
HomePage.jsm Bug 1711508 - remove protonToolbarEnabled property from CustomizableUI, r=mconley 2021-07-07 22:15:50 +00:00
LaterRun.jsm
metrics.yaml Bug 1741674 - Record active_ticks and uri_count in Glean as well as Telemetry r=TravisLong 2021-11-22 20:07:38 +00:00
moz.build Bug 1733345 - Move theme modules into browser/themes/. r=harry 2021-10-04 15:05:54 +00:00
NewTabPagePreloading.jsm Bug 1715773 - Remove preloaded newtab process selection logic, r=mconley 2021-08-03 15:17:07 +00:00
OpenInTabsUtils.jsm
PageActions.jsm Bug 1711523 - remove private proton tracking flags in frontend modules, r=mak,emalysz,desktop-theme-reviewers,harry 2021-05-28 19:33:38 +00:00
PartnerLinkAttribution.jsm Bug 1729460 - Change users of defineLazyServiceGetter(s) to use Services.* where appropriate. r=mossop,webdriver-reviewers,extension-reviewers,whimboo,robwu 2021-09-10 12:09:49 +00:00
PermissionUI.jsm Bug 1733073 - Update StorageAccessPermissionPrompt to use 3rdPartyStorage permission. r=johannh 2021-10-12 17:48:14 +00:00
PingCentre.jsm Bug 1736438 - Fix import for sendStandalonePing. r=nanj 2021-10-18 19:52:59 +00:00
ProcessHangMonitor.jsm Bug 1690390, change appendNotification to take a smaller number of arguments: the string type value, a dictionary containing the notification details, and the button list, r=mstriemer 2021-09-17 09:04:59 +00:00
Sanitizer.jsm Bug 1718435 - follow-up: clean up callsite of clear recent history window that passes nsISupports-y arguments, r=mconley 2021-08-09 19:26:18 +00:00
SelectionChangedMenulist.jsm
SiteDataManager.jsm Bug 1715535 - Add the functionality for fetching sites data by container. r=prathiksha 2021-07-21 13:54:25 +00:00
SitePermissions.jsm
TabsList.jsm
TabUnloader.jsm Bug 1743663 - Remove windowContext.hasActivePeerConnections. r=peterv 2021-12-16 16:14:13 +00:00
TransientPrefs.jsm
webrtcUI.jsm Bug 1632476 changed hostname for media permissions to include the port r=johannh 2021-10-21 11:56:35 +00:00
WindowsJumpLists.jsm
WindowsPreviewPerTab.jsm Bug 1729460 - Change users of defineLazyServiceGetter(s) to use Services.* where appropriate. r=mossop,webdriver-reviewers,extension-reviewers,whimboo,robwu 2021-09-10 12:09:49 +00:00
ZoomUI.jsm Bug 1711508 - remove PanelUI.protonAppMenuEnabled property, r=mconley 2021-07-07 22:15:50 +00:00