Bug 1881040 - Make fetch-init.h2.html wait for all fetch requests to complete. r=zsun

runSingleTest() from mozilla/tests/fetch/fetchpriority/fetchpriority.js
waits for a ChildLoaded message for each test before verifying the
requests and priorities. However, the fetch-init.h2.html test sends
on ChildLoaded message for each request, which would make subsequent
tests (currently none) fail. This patch fixes that issue by waiting for
all the fetch requests to resolve/reject before sending a single message.

Differential Revision: https://phabricator.services.mozilla.com/D210142
This commit is contained in:
Frédéric Wang 2024-06-12 07:50:40 +00:00
Родитель 150b780bcb
Коммит 8a5c2b226e
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -71,10 +71,11 @@
request_init: {} request_init: {}
}, },
]; ];
let fetchResponses = [];
for (const data of kData) { for (const data of kData) {
const response = fetch(data.request_info, data.request_init); fetchResponses.push(fetch(data.request_info, data.request_init));
opener.postMessage("ChildLoaded", "*");
} }
Promise.all(fetchResponses).finally(() => opener.postMessage("ChildLoaded", "*"));
} }
</script> </script>
</body> </body>