Bug
1616842 [wpt PR 21899] - [text-fragment] Fix prefix matching edge case, a=testonly
Automatic update from web-platform-tests
[text-fragment] Fix prefix matching edge case
The current algorithm first finds a |prefix|, then checks if the
immediate following text is the |search_text|. If it is it'll advance
|search_start| to the end of the |search_text| so it can confirm it's
followed by the |suffix| text. However, this means that if the |suffix|
text doesn't match, the next iteration of the algorithm will start
searching for the |prefix| at the end of the |search_text|. This is a
problem if the |search_text| == |prefix| because we've now skipped the
|search_text| part of the range for prefix matching.
E.g. With prefix=foo search_text=foo suffix=bar we'll fail to match:
foo foo foo bar
Because the first iteration of the loop will use the first "foo" as
the prefix, and the next iteration will use the third "foo" as the
prefix; we skip the second.
Bug:
1054243
Change-Id: I62b8a32f89c987e5bed8ea439ae1b7d53d12436d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/
2065979
Reviewed-by: Nick Burris <nburris@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743108}
--
wpt-commits:
845ce4ccd97b2ff6b39e698ce2abe7d639111ede
wpt-pr: 21899