[soft navs] Tweaks to WPT task-attribution.html
This is in preparation for https://chromium-review.googlesource.com/c/chromium/src/+/6542137 - setTimeoutForUrlUpdate was never wired up and no more useful. - withSchedulerYield: swap order of url and ui update. Change-Id: I85e8e13574e95de2aa22cf8216aa15996be4aa41 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6580641 Commit-Queue: Johannes Henkel <johannes@chromium.org> Reviewed-by: Michal Mocny <mmocny@chromium.org> Cr-Commit-Position: refs/heads/main@{#1464567}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
4deaee7946
commit
a53675a266
17
third_party/blink/web_tests/external/wpt/soft-navigation-heuristics/smoke/tentative/task-attribution.html
vendored
17
third_party/blink/web_tests/external/wpt/soft-navigation-heuristics/smoke/tentative/task-attribution.html
vendored
@@ -62,16 +62,6 @@
|
|||||||
history.pushState({}, "", "/set-timeout-and-sync-url-update");
|
history.pushState({}, "", "/set-timeout-and-sync-url-update");
|
||||||
}
|
}
|
||||||
|
|
||||||
// A soft navigation where the click handler synchronously updates its UI
|
|
||||||
// and schedules the URL update with a setTimeout.
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout
|
|
||||||
function setTimeoutForUrlUpdate() {
|
|
||||||
updateUI();
|
|
||||||
setTimeout(() => {
|
|
||||||
history.pushState({}, "", "/set-timeout-for-url-update");
|
|
||||||
}, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
// A soft navigation where the click handler schedules its work with
|
// A soft navigation where the click handler schedules its work with
|
||||||
// scheduler.postTask.
|
// scheduler.postTask.
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/postTask
|
// https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/postTask
|
||||||
@@ -83,11 +73,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A soft navigation where the click handler yields
|
// A soft navigation where the click handler yields
|
||||||
// (using scheduler.yield) between UI update and URL update.
|
// (using scheduler.yield) between URL and UI update.
|
||||||
async function withSchedulerYield() {
|
async function withSchedulerYield() {
|
||||||
updateUI();
|
|
||||||
await scheduler.yield();
|
|
||||||
history.pushState({}, "", "/with-scheduler-yield");
|
history.pushState({}, "", "/with-scheduler-yield");
|
||||||
|
await scheduler.yield();
|
||||||
|
updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
// A soft navigation where the click handler schedules its work with
|
// A soft navigation where the click handler schedules its work with
|
||||||
@@ -109,7 +99,6 @@
|
|||||||
<div id="set-timeout-and-sync-url-update" onclick="setTimeoutAndSyncUrlUpdate()">
|
<div id="set-timeout-and-sync-url-update" onclick="setTimeoutAndSyncUrlUpdate()">
|
||||||
Click here!
|
Click here!
|
||||||
</div>
|
</div>
|
||||||
<div id="set-timeout-for-url-update" onclick="setTimeoutForUrlUpdate()">Click here!</div>
|
|
||||||
<div id="with-scheduler-post-task" onclick="withSchedulerPostTask()">Click here!</div>
|
<div id="with-scheduler-post-task" onclick="withSchedulerPostTask()">Click here!</div>
|
||||||
<div id="with-scheduler-yield" onclick="withSchedulerYield()">Click here!</div>
|
<div id="with-scheduler-yield" onclick="withSchedulerYield()">Click here!</div>
|
||||||
<div id="with-request-animation-frame" onclick="withRequestAnimationFrame()">Click here!</div>
|
<div id="with-request-animation-frame" onclick="withRequestAnimationFrame()">Click here!</div>
|
||||||
|
Reference in New Issue
Block a user