fix(navigation): do not count random failures as navigation cancel (#1055)

This commit is contained in:
Dmitry Gozman 2020-02-18 19:58:04 -08:00 committed by GitHub
parent 223685ee7b
commit 9f1edadbff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -428,9 +428,10 @@ export class Frame {
let resolve: (error: Error|void) => void; let resolve: (error: Error|void) => void;
const promise = new Promise<Error|void>(x => resolve = x); const promise = new Promise<Error|void>(x => resolve = x);
const watch = (documentId: string, error?: Error) => { const watch = (documentId: string, error?: Error) => {
if (documentId !== expectedDocumentId) if (documentId === expectedDocumentId)
return resolve(new Error('Navigation interrupted by another one')); resolve(error);
resolve(error); else if (!error)
resolve(new Error('Navigation interrupted by another one'));
}; };
const dispose = () => this._documentWatchers.delete(watch); const dispose = () => this._documentWatchers.delete(watch);
this._documentWatchers.add(watch); this._documentWatchers.add(watch);