Some websites use fragments to signal, that a certain "pop-up menu" is displayed and remove the fragment when the menu is hidden again.
Sometimes however, the number sign '#' remains at the end of the URL.
for example the original site would be
"https://www.example.com/testpage"
with the menu open, it becomes
"https://www.example.com/testpage#bookmarklist
and once the menu is closed, we're left with
"https://www.example.com/testpage#
This means that ff treats it as a different URL, e.g. in Terms of bookmarks, even though it is, in fact, the exact same page.
I suggest that firefox ignores a trailing number sign in the URL, since according to URL syntax it makes no difference, and treat both version of the URL as identical.
I think that, at least in terms of Bookmarks and history,
"https://www.example.com/testpage" and
"https://www.example.com/testpage#"
should be identical.
So a bookmark to one of them should be matched(the little star in the address bar), regardless of the presence of the number sign and loading either of them should push their common history-entry to the top.
I'm not sure what the implications would be if firefox were to drop the trailing number sign from the URL entirely (thus technically altering the URL, even if the alteration should be of no significance).
Might cause unexpected behaviour with scrolling or the website backend.
Now obviously this applies only to empty fragments, i.e. trailing number signs. If there is a valid fragment identifier is present, it obviously should remain untouched.
If this seems to risky or confusing to be enabled by default, i suggest at least adding a config option so advanced users can enable it if they understand the consequences and developers can disable it so it doesn't mask problems.