From 048ed6e9de8346b7838a1e7d72448db833fb1094 Mon Sep 17 00:00:00 2001 From: Geoff Lankow Date: Tue, 14 Jan 2020 21:32:56 +0000 Subject: [PATCH] Bug 1605674 - Stop using window.setTimeout in MockFilePickerInstance. r=kmag Using window.setTimeout is causing a Thunderbird test to stall for not entirely clear reasons. Use dispatchToMainThread instead. Differential Revision: https://phabricator.services.mozilla.com/D59276 --HG-- extra : moz-landing-system : lando --- testing/specialpowers/content/MockFilePicker.jsm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/specialpowers/content/MockFilePicker.jsm b/testing/specialpowers/content/MockFilePicker.jsm index 9f029b597556..719ab09dbaaf 100644 --- a/testing/specialpowers/content/MockFilePicker.jsm +++ b/testing/specialpowers/content/MockFilePicker.jsm @@ -244,7 +244,7 @@ MockFilePickerInstance.prototype = { }, open(aFilePickerShownCallback) { MockFilePicker.showing = true; - this.window.setTimeout(() => { + Services.tm.dispatchToMainThread(() => { // Maybe all the pending promises are already resolved, but we want to be sure. Promise.all(MockFilePicker.pendingPromises) .then( @@ -299,9 +299,9 @@ MockFilePickerInstance.prototype = { } if (typeof MockFilePicker.afterOpenCallback == "function") { - this.window.setTimeout(() => { + Services.tm.dispatchToMainThread(() => { MockFilePicker.afterOpenCallback(this); - }, 0); + }); } }); });