removeparam is sometimes not applied when clicking on links

Prerequisites

I tried to reproduce the issue when...

  • uBO is the only extension
  • uBO with default lists/settings
  • using a new, unmodified browser profile

Description

Sometime (if links are realized using JS events rather than <a>) removeparam does not remove query params.

Originally I discovered this on AMO search (https://addons.mozilla.org/en-US/firefox/search/?q=ublock+origin) with utm_* params. However the STR will use youtube with a custom removeparam rule because AMO is special (requires extensions.webextensions.restrictedDomains="" & privacy.resistFingerprinting.block_mozAddonManager=true) and youtube was the first site I could find where I could reproduce this behaviour.

This bug maybe relates to the "Prevents tracking injection over history API" option of ClearURLs.

  • uBO with default lists/settings

Default settings except for using Privacy>AdGuard URL Tracking Protection and $removeparam=v.

A specific URL where the issue occurs

https://youtube.com/

Steps to Reproduce

  1. Add $removeparam=v to your filters
  2. Open https://www.youtube.com/ (and agree to help G to improve their service, manipulate you and so on)
  3. Click on any video
  4. Look at urlbar and see https://www.youtube.com/watch?v=1234asdf
  5. Reload (Strg+R)
  6. Look at urlbar and see https://www.youtube.com/
  7. Look into the logger and see that only at step 5 (but not at step 3) v gets removed.

Expected behavior

Query parameters get removed in step 3 and 5.

Actual behavior

Query parameters are removed only in step 5.

uBlock Origin version

1.37.2

Browser name and version

Firefox 91.0.2

Operating System and version

Fedora 34