Closed Bug 1489053 Opened 3 years ago Closed 3 years ago

The CFR "frecency" score value is inconsistent when accessing a website from different locations


(Firefox :: Messaging System, defect)

Not set



Tracking Status
firefox62 --- unaffected
firefox63 --- affected
firefox64 --- affected


(Reporter: mcoman, Unassigned)


(Blocks 1 open bug)



(1 file)

Attached image rec of the issue.gif
[Affected versions]:
- Firefox 63 and above

[Affected Platforms]:
- All Windows
- All Linux
- All Mac

- Have a Firefox profile with the following prefs in the "about:config" page:
	- "browser.newtabpage.activity-stream.asrouterExperimentEnabled" with "true" value;
	- "" with "US" value.
	-  "" on true.
- Have the "Browser Console" opened.

[Steps to reproduce]:
1. Open the browser with the profile from prerequisites.
2. Open a new tab and navigate to the "" website from the "Address Bar".
3. Repeat step 2 for another 4 times and focus the "Browser Console".
4. Enter the following string in the console: "NewTabUtils.activityStreamProvider.getTopFrecentSites({numItems: 25}).then(r => console.log(>`${s.url} [${s.frecency}]`).join('\n')))".
5. Observe the displayed "frecency".

[Expected result]:
- The "frecency" score is more or equal to "10000"

[Actual result]:
- The "frecency" score is "2350".

- The correct "frecency" score (10000) is generated when following the same steps as above, but instead opening the Facebook website from the "Top Sites" area.
- This issue is also reproducible with the other websites.
- Attached a screen recording of the issue.
This is a bit of a weird bug. It seems to stem from the fact that you're typing '' into the url bar which results in a (permanent) redirect to ''. Clicking through from the new tab page takes you straight to '' without being redirected.

The first few times you type '' into the awesome bar and hit enter you will visit '' and hit the redirect. In my testing, after several minutes/visits, the awesome bar registers that the permanent redirect exists and from then on when you type in '' and hit enter it will actually take you straight to '', without hitting the redirect.

This affected the frecency scores.

When you visit '' and get redirected to '' both urls get some added frecency. '' gets the "RedirectSourceVisit" bonus which is 25. '' gets the "PermRedirectVisit" bonus which is 50. If you visit a url directly from the awesome bar and there's no redirect, you get the "TypedVisit" bonus which is 2000. Unfortunately in this case the redirect overrides the "TypedVisit" [0]. A further complication is that 'activityStreamProvider.getTopFrecentSites' combines the frecency scores for '' and '' by default, and that's what you see printed to the console [1]. So the net effect is adding 75 frecency overall.

Once the permenant redirect is registered by the awesomebar (which happens pretty quickly) and it starts taking you straight to '' then the issue goes away because you get the correct 2000 "TypedVisit" frecency bonus.


[1] You can see them split up with "NewTabUtils.activityStreamProvider.getTopFrecentSites({numItems: 25, onePerDomain: false}).then(r => console.log(>`${s.url} [${s.frecency}]`).join('\n')))"
The frecency algorithm works in mysterious ways :-)

CFR is simply using the existing frecency algorithm as a proxy for sites that are 'important to the user'.  We aren't interested in improving/modifying/changing the frecency algorithm, we just want to use it to prevent adding additional placesdb queries.

Let's acknowledge that this makes it difficult to test and work on adding a history targeting mechanism to CFR that doesn't rely on frecency.
Closed: 3 years ago
Resolution: --- → WONTFIX
Component: Activity Streams: Newtab → Messaging System
You need to log in before you can comment on or make changes to this bug.