Closed Bug 1800060 Opened 2 years ago Closed 2 years ago

[CTW] LINKS_TO should return early if there's no hash and shouldn't strip subsequent hashes

Categories

(Core :: Disability Access APIs, defect)

defect

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: Jamie, Assigned: morgan)

References

Details

Attachments

(1 file)

I should have caught this in review, but I didn't. :(

The LINKS_TO code in RemoteAccessibleBase splits the href string at '#' and takes the last segment. There are two problems with this:

  1. If there is no '#' in the href, it will just use the entire href. It should instead return early, since there's no point in searching the tree if there's no hash. This should improve performance slightly for the majority of links.
  2. It's technically possible to have more than one '#' in the href. In that case, the code will only use the text between the two '#' characters instead of looking at everything after the first '#'. Consider this example (%23 is '#'):
    data:text/html,<a href="%23foo%23bar">Origin</a><br><a name="foo%23bar">Destination
    The current code will not find this target. I doubt this really happens in the wild, so it's not particularly important.

I think we might want to use FindChar instead of Split.

Assignee: nobody → mreschenberg
Pushed by mreschenberg@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2ae07702fe68
Avoid computing LINKS_TO for links with no anchor r=Jamie
Regressions: 1800182
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: