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);