Bug
1839508 [wpt PR 40654] - Reland "[text-fragment] Attempt search for dynamic content", a=testonly
Automatic update from web-platform-tests
Reland "[text-fragment] Attempt search for dynamic content"
Reland note: iframes.sub.html was timing out because it contains several
sub-tests, each of which now wait 2s which, in total, exhausted the 6s
timeout. Reland marks this test as timeout=long to use the extended
timeout. Previously landed CL is first patchset.
Text fragments currently perform up to two searches, one when document
parsing completes and a second attempt when document load completes (if
load wasn't completed at parse complete time). However, pages, often
load content after document load, when content is "dynamically loaded".
One popular example is Mobile Wikipedia, which adds `hidden=until-found`
on collapsed sections in idle tasks after load. This meant
text-fragments couldn't target pages like these.
This CL attempts to make text fragments work on dynamically loaded pages
by performing a third attempt, if needed. If all directives haven't
matched at load time, a delayed task is scheduled for 500ms that will
request attachment on unmatched directives. TextFragmentAnchor listens
for relevant changes in the DOM and reschedules this task each time a
change is made. At 3000ms it gives up and performs the search to avoid
waiting forever.
At a high level, this CL tries to separate the state tracking of actions
performed for the first matching directive from the state tracking for
running multiple searches. This is done by introducing a new iteration_
enum tracking the latter.
Bug: 963045
Change-Id: Ied3f9c610c348eeeca23ace50864f0cc2ff2b233
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/
4629864
Commit-Queue: Vladimir Levin <vmpstr@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Auto-Submit: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#
1160827}
--
wpt-commits:
95d67cd661417e9c44440cba14dcce147e2768bf
wpt-pr: 40654