Files
ladybird/Tests/LibWeb/Text/input/ServiceWorker/service-worker-ready.html
Andreas Kling 99db474a84 LibWeb: Implement ServiceWorkerContainer.ready attribute
This patch implements the ready attribute on ServiceWorkerContainer,
a Promise that resolves when there's a ServiceWorkerRegistration
with an active worker for the current page. The promise never rejects
and stays pending if no active service worker exists.

This makes https://instagram.com/ load once again :^)
2026-01-09 23:16:36 +01:00

19 lines
659 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<script>
asyncTest(done => {
setTimeout(() => {
// We need to do this spoofing later in the event loop so that we don't end up
// telling the test runner the wrong URL in page_did_finish_loading.
spoofCurrentURL("https://example.com/service-worker-ready.html");
const ready = navigator.serviceWorker.ready;
println(`ready is a Promise: ${ready instanceof Promise}`);
println(`ready is the same object on second access: ${ready === navigator.serviceWorker.ready}`);
done();
}, 0);
});
</script>