Bug 1706373 [wpt PR 28599] - Allow text fragments in same-document navigations, a...
commit4b789cc6d8ee8d12e65164085d9351aa3b4cd66c
authorDavid Bokan <bokan@chromium.org>
Sat, 24 Apr 2021 09:19:16 +0000 (24 09:19 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Sat, 24 Apr 2021 15:48:11 +0000 (24 15:48 +0000)
tree83868af5814cdb35fb31dc76d4044f6c2f2bbf83
parentff934bfa0a1c11ee2c175ed73165c47c2cf43f31
Bug 1706373 [wpt PR 28599] - Allow text fragments in same-document navigations, a=testonly

Automatic update from web-platform-tests
Allow text fragments in same-document navigations

This CL lifts the restriction on text fragments in the specific case of
a same-document navigation initiated by an origin that's same-origin
with the current document. In this case, the two documents already have
full access to each other's content so text fragments present no risk.
Enabling them allows using anchor links to text-fragments on the current
page as well as allowing coordinating origins to pass a text-fragment
into an iframe.

To do this, we update DocumentLoader's |is_same_origin_navigation_|
member on same-document navigations (and we rename it to be more
specific that the initiator is same-origin or browser).

We also make another small adjustment in allowing text fragments to be
invoked on replacement navigations (e.g. location.replace) which don't
create a new history entry. This was simply an unintentional omission in
the implementation.

Change-Id: Id82f46294b87d12d6a7355e0f7e4936e7fae75d6
Bug: 1198668
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2811999
Commit-Queue: David Bokan <bokan@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: Robert Flack <flackr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#875755}

--

wpt-commits: 6750e28408598c11106f58afc1a1e2574a9e4ea4
wpt-pr: 28599
testing/web-platform/tests/scroll-to-text-fragment/iframe-target.html [new file with mode: 0644]
testing/web-platform/tests/scroll-to-text-fragment/iframes.sub.html [new file with mode: 0644]
testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-same-doc.html