diff --git a/toolkit/components/satchel/test/parent_utils.js b/toolkit/components/satchel/test/parent_utils.js index 513dc7103ff6..e8f841c1a50a 100644 --- a/toolkit/components/satchel/test/parent_utils.js +++ b/toolkit/components/satchel/test/parent_utils.js @@ -23,8 +23,10 @@ var ParentUtils = { return entries; }, - cleanUpFormHist() { - FormHistory.update({ op: "remove" }); + cleanUpFormHist(callback) { + FormHistory.update({ op: "remove" }, { + handleCompletion: callback, + }); }, updateFormHistory(changes) { @@ -116,7 +118,9 @@ var ParentUtils = { cleanup() { gAutocompletePopup.removeEventListener("popupshown", this._popupshownListener); - this.cleanUpFormHist(); + this.cleanUpFormHist(() => { + sendAsyncMessage("cleanup-done"); + }); }, }; diff --git a/toolkit/components/satchel/test/satchel_common.js b/toolkit/components/satchel/test/satchel_common.js index 623d46735700..ef621f3b6a81 100644 --- a/toolkit/components/satchel/test/satchel_common.js +++ b/toolkit/components/satchel/test/satchel_common.js @@ -281,7 +281,13 @@ function satchelCommonSetup() { SimpleTest.registerCleanupFunction(() => { gChromeScript.sendAsyncMessage("cleanup"); - gChromeScript.destroy(); + return new Promise(resolve => { + gChromeScript.addMessageListener("cleanup-done", function done() { + gChromeScript.removeMessageListener("cleanup-done", done); + gChromeScript.destroy(); + resolve(); + }); + }); }); }