diff --git a/storage/partitioned-estimate-usage-details-caches.tentative.https.sub.html b/storage/partitioned-estimate-usage-details-caches.tentative.https.sub.html index 2eac826eb10d2e..dc2af7c213c549 100644 --- a/storage/partitioned-estimate-usage-details-caches.tentative.https.sub.html +++ b/storage/partitioned-estimate-usage-details-caches.tentative.https.sub.html @@ -28,19 +28,23 @@ `/resources/partitioned-estimate-usage-details-caches-helper-frame.html` document.body.appendChild(iframe); + async_test(test => { if (location.origin === alt_origin) return; + let cache, cache_url; - test.step(async () => { - details.init = await usageDetails(); - [cache, cache_url] = await createSomeUsage(test); - details.after = await usageDetails(); - assert_greater_than(details.after, details.init); + window.addEventListener("message", test.step_func(async event => { + if (event.data === "iframe-is-ready") { + details.init = await usageDetails(); + [cache, cache_url] = await createSomeUsage(test); + details.after = await usageDetails(); + assert_greater_than(details.after, details.init); - iframe.contentWindow.postMessage("get-details", iframe.origin); - }); + iframe.contentWindow.postMessage("get-details", iframe.origin); + } + })); window.addEventListener("message", test.step_func(event => { if (event.data.source === "same-site") { @@ -48,6 +52,7 @@ const cross_site_window = window .open(`${alt_origin}${location.pathname}`, "", "noopener=false"); + test.add_cleanup(() => cross_site_window.close()); } if (event.data.source === "cross-site") { diff --git a/storage/resources/partitioned-estimate-usage-details-caches-helper-frame.html b/storage/resources/partitioned-estimate-usage-details-caches-helper-frame.html index 13786d7ceafca7..0679c1decf5583 100644 --- a/storage/resources/partitioned-estimate-usage-details-caches-helper-frame.html +++ b/storage/resources/partitioned-estimate-usage-details-caches-helper-frame.html @@ -25,4 +25,6 @@ parent.opener.postMessage(details, parent.opener.origin); } }); + + window.parent.postMessage("iframe-is-ready", window.parent.origin);