Closed Bug 1768529 Opened 7 months ago Closed 7 months ago

Exclude URLs with the AMP query parameter from appearing as tiles on the new tab page

Categories

(Firefox :: New Tab Page, task, P1)

task
Points:
3

Tracking

()

VERIFIED FIXED
102 Branch
Tracking Status
firefox101 + verified
firefox102 --- verified

People

(Reporter: adw, Assigned: adw)

References

Details

Attachments

(2 files)

We want to exclude URLs with the AMP query parameter from appearing as tiles on the new tab page. See https://mozilla-hub.atlassian.net/browse/SNT-130 for more info.

This work can begin before the query parameter is finalized. We can use a placeholder in the meantime. I'll file another bug for replacing the placeholder with the final parameter once it's decided.

Blocks: 1768533

This modifies ActivityStreamProvider.getTopFrecentSites() so it excludes URLs
with a given search param. There are two questions I considered when writing
this patch:

  • The top-sites code is a little complex and there are multiple places where
    this logic could be implemented. I chose the bottommost layer, where the top
    sites are fetched from Places and some other exclusion logic already exists,
    because we don't want these URLs to appear in any list of top sites in Firefox
    AFAIK -- not on the new-tab page and not in the urlbar.
  • How should we encode this new exclusion logic? We don't want to hardcode a
    specific search param. We may not even want to base it on search params at all
    but instead make it more general somehow. For now, I did the simple thing and
    went ahead and based it on a search param, and I added a new option to
    getTopFrecentSites() that specifies the param and that falls back to a new
    pref. Callers can override the pref fallback by passing in an option.
Pushed by dwillcoxon@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c884b25c2920
Exclude URLs with a particular search param from appearing as tiles on the new-tab page. r=nanj

STR for QA

This new feature will prevent URLs from becoming top sites on the new tab page depending on whether they have certain search parameters, e.g., ?test=foo. Verification involves loading pages with and without the search parameter and making sure they appear or don't appear as top sites.

For each case below, please clear your history or use a new profile so that previous cases don't affect the next one.

Case 1

  1. Type example.com/?test=foo in the urlbar and press enter
  2. Type https://www.mozilla.org/ in the urlbar and press enter. You can use the same tab.
  3. Restart Firefox
  4. Verify "mozilla" and "example" appear as top sites tiles on the new tab page
  5. Click the "example" tile
  6. Verify example.com/?test=foo loads

Case 2

  1. Set browser.newtabpage.activity-stream.hideTopSitesWithSearchParam to test=foo
  2. Type example.com/?test=foo in the urlbar and press enter
  3. Repeat the previous step 2 more times. You can use the same tab.
  4. Restart Firefox
  5. Verify "example" does not appear as a top sites tile on the new tab page
  6. Type example.com (without anything else at the end) in the urlbar and press enter
  7. Type https://www.mozilla.org/ in the urlbar and press enter. You can use the same tab.
  8. Restart Firefox
  9. Verify "mozilla" and "example" appear as top sites tiles on the new tab page
  10. Click the "example" tile
  11. Verify example.com (without anything else at the end) loads

Case 3

  1. Set browser.newtabpage.activity-stream.hideTopSitesWithSearchParam to test=foo
  2. Type example.com/?test=foo in the urlbar and press enter
  3. Repeat the previous step 2 more times. You can use the same tab.
  4. Restart Firefox
  5. Verify "example" does not appear as a top sites tile on the new tab page
  6. Type example.com/?test=bar in the urlbar and press enter
  7. Type https://www.mozilla.org/ in the urlbar and press enter. You can use the same tab.
  8. Restart Firefox
  9. Verify "mozilla" and "example" appear as top sites tiles on the new tab page
  10. Click the "example" tile
  11. Verify example.com/?test=bar (not example.com/?test=foo) loads

Case 4

  1. Set browser.newtabpage.activity-stream.hideTopSitesWithSearchParam to test
  2. Type example.com/?test=foo in the urlbar and press enter
  3. Repeat the previous step 2 more times. You can use the same tab.
  4. Type example.com/?test in the urlbar and press enter
  5. Repeat the previous step 2 more times. You can use the same tab.
  6. Restart Firefox
  7. Verify "example" does not appear as a top sites tile on the new tab page
  8. Type example.com (without anything else at the end) in the urlbar and press enter
  9. Type https://www.mozilla.org/ in the urlbar and press enter. You can use the same tab.
  10. Restart Firefox
  11. Verify "mozilla" and "example" appear as top sites tiles on the new tab page
  12. Click the "example" tile
  13. Verify example.com (without anything else at the end) loads
Flags: qe-verify+
Flags: in-testsuite+
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch
Pushed by dwillcoxon@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/373262dddf80
use default param value for hideTopSitesWithSearchParam. r=adw

I‘ve verified this task using the latest Firefox Nightly 102.0a1 (Build ID: 20220515214519) on Windows 10 x64, macOS 12.3.1, and Ubuntu 20.04 x64.

  • Case 1:

    • The "mozilla" and "example" appear as top sites tiles on the new tab page after navigating to the “example.com/?test=foo” and “https://www.mozilla.org/” pages.
    • The “example.com/?test=foo” page loads after clicking on the “example” top site tile.
  • Case 2:

    • After navigating to the “example.com/?test=foo” page several times, the "example" does not appear as a top sites tile on the new tab page if the “browser.newtabpage.activity-stream.hideTopSitesWithSearchParam” pref is set to the “test=foo” value.
    • The "mozilla" and "example" appear as top sites tiles on the new tab page after navigating to the “example.com” and “https://www.mozilla.org/” pages. Also, the “example.com” page loads after clicking the “example” top site tile.
  • Case 3:

    • After navigating to the “example.com/?test=foo” page several times, the "example" does not appear as a top sites tile on the new tab page if the “browser.newtabpage.activity-stream.hideTopSitesWithSearchParam” pref is set to the “test=foo” value.
    • The "mozilla" and "example" appear as top sites tiles on the new tab page after navigating to the “example.com/?test=bar” and “https://www.mozilla.org/” pages. Also, the “example.com/?test=bar” page loads after clicking the “example” top site tile.
  • Case 4:

    • After navigating to the “example.com/?test=foo” and “example.com/?test” pages several times, the "example" does not appear as a top sites tile on the new tab page if the “browser.newtabpage.activity-stream.hideTopSitesWithSearchParam” pref is set to the “test” value.
    • The "mozilla" and "example" appear as top sites tiles on the new tab page after navigating to the “example.com” and “https://www.mozilla.org/” pages. Also, the “example.com” page loads after clicking the “example” top site tile.
Status: RESOLVED → VERIFIED
See Also: → 1770870

[Tracking Requested - why for this release]: This patch implements a feature request for our tiles partner, and we'd like it to be released in Fx 101 if possible.

Comment on attachment 9276180 [details]
Bug 1768529 - Exclude URLs with a particular search param from appearing as tiles on the new-tab page.

Beta/Release Uplift Approval Request

  • User impact if declined: There is little impact on Firefox users, rather it's a feature request from our partner of sponsored tiles. If declined, Firefox would show previous sponsored tiles as organic tiles which could de-value the sponsored tiles for both our partner and Mozilla.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: Bug 1768533
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Not a user-facing change, it only changes how previous sponsored tiles will be treated for Top Sites on the newtab page.
  • String changes made/needed: None
  • Is Android affected?: No
Attachment #9276180 - Flags: approval-mozilla-beta?
Attachment #9276497 - Flags: approval-mozilla-beta?
QA Whiteboard: [qa-triaged]

Comment on attachment 9276180 [details]
Bug 1768529 - Exclude URLs with a particular search param from appearing as tiles on the new-tab page.

Approved for 101.0rc2.

Attachment #9276180 - Flags: approval-mozilla-beta? → approval-mozilla-release+
Attachment #9276497 - Flags: approval-mozilla-beta? → approval-mozilla-release+

We have verified this issue on Firefox 101.0 RC2 build (Build ID: 20220525210143) downloaded from treeherder on Windows 10 x64, macOS 10.15.7 and Ubuntu 20.04.

  • In order to verify this issue we have used the STR described in comment 3. During testing, we haven't found any new issues.
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.