blob: 4663e4ec8f7137fc72f31c09b459fa49caedeed6 [file] [log] [blame]
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
</head>
<body>
<script>
var scope = "resources";
var activeWorker;
promise_test(async (test) => {
var registration = await navigator.serviceWorker.register("fetch-timeout-worker.js", { scope : scope });
activeWorker = registration.active;
if (activeWorker)
return;
activeWorker = registration.installing;
return new Promise(resolve => {
activeWorker.addEventListener('statechange', () => {
if (activeWorker.state === "activated")
resolve();
});
});
}, "Setup worker");
promise_test(async (test) => {
const iframe = await with_iframe(scope);
if (window.testRunner)
testRunner.setServiceWorkerFetchTimeout(1);
const response = await iframe.contentWindow.fetch("/WebKit/service-workers/resources/lengthy-pass.py?delay=0.5");
const text = await response.text();
assert_equals(text, "document.body.innerHTML = 'PASS'");
iframe.remove();
}, "Make sure a load that makes progress does not time out");
</script>
</body>
</html>