Automatic update from web-platform-tests [WebLocks] Update BFCache WPTs to verify eviction on lock contention This CL adds WPTs to verify if pages are evicted from BFCache when a held Web Lock is contended, covering main thread, worker, nested worker, and shared worker contexts. To support .js tests, `web-locks/bfcache/helpers.js` is converted to a classic script, and existing tests for web-locks are updated to load it via `<script>` tags. This also removes an existing WPT: - performance-navigation-timing-lock.https.tentative.window.js which is superseded by these new tests, as evicting pages simply for holding locks is overly strict. Change-Id: Icb5f69659627451ebe0c1e7b54d7de082ae19115 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7248286 Reviewed-by: Fergal Daly <fergal@chromium.org> Commit-Queue: Anna Sato <annasato@chromium.org> Cr-Commit-Position: refs/heads/main@{#1572735} -- wpt-commits: 80992eaa0d04d53a40f076b2af182e3cc2cb3ac4 wpt-pr: 57271
49 lines
2.0 KiB
HTML
49 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset=utf-8>
|
|
<meta name="timeout" content="long">
|
|
<title>Web Locks API: bfcache</title>
|
|
<link rel=help href="https://w3c.github.io/web-locks/">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/common/utils.js"></script>
|
|
<script src="/common/dispatcher/dispatcher.js"></script>
|
|
<script src="/html/browsers/browsing-the-web/back-forward-cache/resources/helper.sub.js"></script>
|
|
<script src="helpers.js"></script>
|
|
<script>
|
|
|
|
runWebLocksBfcacheTest({
|
|
funcBeforeNavigation: async () => {
|
|
await navigator.locks.request(uniqueNameByQuery(), () => { });
|
|
},
|
|
shouldBeCached: true,
|
|
}, "A released lock on the main thread should not prevent bfcache");
|
|
|
|
runWebLocksBfcacheTest({
|
|
funcBeforeNavigation: async () => {
|
|
window.worker = new Worker("/web-locks/resources/worker.js");
|
|
const { lock_id } = await postToWorkerAndWait(worker, { op: "request", name: uniqueNameByQuery() });
|
|
await postToWorkerAndWait(worker, { op: "release", lock_id });
|
|
},
|
|
shouldBeCached: true,
|
|
}, "A released lock on a worker should not prevent bfcache");
|
|
|
|
runWebLocksBfcacheTest({
|
|
funcBeforeNavigation: async () => {
|
|
window.worker = new Worker("/web-locks/resources/parentworker.js");
|
|
const { lock_id } = await postToWorkerAndWait(worker, { op: "request", name: uniqueNameByQuery() });
|
|
await postToWorkerAndWait(worker, { op: "release", lock_id });
|
|
},
|
|
shouldBeCached: true,
|
|
}, "A released lock on a nested worker should not prevent bfcache");
|
|
|
|
runWebLocksBfcacheTest({
|
|
funcBeforeNavigation: async () => {
|
|
window.worker = new SharedWorker("/web-locks/resources/worker.js");
|
|
worker.port.start();
|
|
const { lock_id } = await postToWorkerAndWait(worker.port, { op: "request", name: uniqueNameByQuery() });
|
|
await postToWorkerAndWait(worker.port, { op: "release", lock_id });
|
|
},
|
|
shouldBeCached: true,
|
|
}, "A released lock on a shared worker should not prevent bfcache");
|
|
</script>
|