From 1da3a93991e102c30ec1394e0e811d9f74e81014 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Mon, 10 Jan 2022 10:14:55 +0000 Subject: [PATCH] Bug 1749013 - Fix browser_jsonview_save_json.js checking disk data too early. r=Honza Differential Revision: https://phabricator.services.mozilla.com/D135446 --- devtools/client/jsonview/test/browser_jsonview_save_json.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devtools/client/jsonview/test/browser_jsonview_save_json.js b/devtools/client/jsonview/test/browser_jsonview_save_json.js index 8073b5223d5f..10f4a46a98c3 100644 --- a/devtools/client/jsonview/test/browser_jsonview_save_json.js +++ b/devtools/client/jsonview/test/browser_jsonview_save_json.js @@ -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) {