From 9f1edadbff88e77ced3453e13cf83662a4b99321 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Tue, 18 Feb 2020 19:58:04 -0800 Subject: [PATCH] fix(navigation): do not count random failures as navigation cancel (#1055) --- src/frames.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/frames.ts b/src/frames.ts index adc5b17dc2..fee3c2e0e6 100644 --- a/src/frames.ts +++ b/src/frames.ts @@ -428,9 +428,10 @@ export class Frame { let resolve: (error: Error|void) => void; const promise = new Promise(x => resolve = x); const watch = (documentId: string, error?: Error) => { - if (documentId !== expectedDocumentId) - return resolve(new Error('Navigation interrupted by another one')); - resolve(error); + if (documentId === expectedDocumentId) + resolve(error); + else if (!error) + resolve(new Error('Navigation interrupted by another one')); }; const dispose = () => this._documentWatchers.delete(watch); this._documentWatchers.add(watch);