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;
rejector = reject;
});
const timeoutId = setTimeout(() => {
const timeoutId =
timeout > 0
? setTimeout(() => {
isRejected = true;
rejector(new TimeoutError(timeoutMessage));
}, timeout);
}, timeout)
: undefined;
return Object.assign(taskPromise, {
resolved: () => {
return isResolved;