Bug 1749013 - Fix browser_jsonview_save_json.js checking disk data too early. r=Honza

Differential Revision: https://phabricator.services.mozilla.com/D135446
This commit is contained in:
Oriol Brufau 2022-01-10 10:14:55 +00:00
parent 8a196d598a
commit 1da3a93991

View File

@ -45,6 +45,10 @@ function awaitSavedFileContents(name, ext) {
ok(destFile.exists(), "The downloaded file should exist.");
const { path } = destFile;
await BrowserTestUtils.waitForCondition(() => IOUtils.exists(path));
await BrowserTestUtils.waitForCondition(async () => {
const { size } = await IOUtils.stat(path);
return size > 0;
});
const buffer = await IOUtils.read(path);
resolve(new TextDecoder().decode(buffer));
} catch (error) {