[soft navs] Wait for history.back's effect in one more test.
Update interaction-with-paint-before-back.tentative.html so that we don't paint before the effect of history.back takes effect. We do this by waiting for the URL to change before mutating the DOM. In this way, we'll continue to detect a soft navigation once https://chromium-review.googlesource.com/c/chromium/src/+/6542137 lands. Change-Id: Ifad8a7761d10c52a90f25d9e31e3449041ac80f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6581578 Commit-Queue: Johannes Henkel <johannes@chromium.org> Reviewed-by: Michal Mocny <mmocny@chromium.org> Cr-Commit-Position: refs/heads/main@{#1464580}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
634905fb55
commit
4dc7802b02
@ -40,13 +40,17 @@
|
||||
const test_origin = new URL(location.href).origin;
|
||||
history.pushState({}, "", "/foo.html"); // We will observe this below.
|
||||
history.pushState({}, "", "/bar.html"); // Prep for history.back().
|
||||
document.getElementById("soft_nav_div").addEventListener("click", () => {
|
||||
document.getElementById("soft_nav_div").addEventListener("click", async () => {
|
||||
// URL change triggering the soft nav. Since history.back()'s
|
||||
// effect is potentially asynchronous, we wait for it to complete
|
||||
// before we mutate the DOM. This way we ensure that the paints
|
||||
// arrive only after the URL change.
|
||||
history.back();
|
||||
await t.step_wait(() => location.href.endsWith("/foo.html"));
|
||||
const img = new Image();
|
||||
img.src = "/images/lcp-133x106.png";
|
||||
document.getElementById("main").appendChild(img);
|
||||
history.back(); // URL change triggering the soft nav
|
||||
});
|
||||
|
||||
const helper = new SoftNavigationTestHelper(t);
|
||||
|
||||
// Now, click almost_soft_nav_div, and observe that time image
|
||||
|
Reference in New Issue
Block a user