fix: use the timeout setting in waitForFileChooser (#8856)

Co-authored-by: Randolf J <jrandolf@google.com>
This commit is contained in:
Alex Rudenko 2022-08-30 15:23:14 +02:00 committed by GitHub
parent 8d95a9bc92
commit f477b46f21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,10 +31,13 @@ export function createDeferredPromiseWithTimer<T>(
resolver = resolve; resolver = resolve;
rejector = reject; rejector = reject;
}); });
const timeoutId = setTimeout(() => { const timeoutId =
isRejected = true; timeout > 0
rejector(new TimeoutError(timeoutMessage)); ? setTimeout(() => {
}, timeout); isRejected = true;
rejector(new TimeoutError(timeoutMessage));
}, timeout)
: undefined;
return Object.assign(taskPromise, { return Object.assign(taskPromise, {
resolved: () => { resolved: () => {
return isResolved; return isResolved;