Aborted network requests should use protocol's "Failed" status (#215)

This patch starts using "Failed" command for request interception instead of
"Aborted".

The "Aborted" status also has a side-effect of cancelling the navigation, so
there will be no error on the page and form puppeteer's standpoint, the navigation
will never complete.
This commit is contained in:
Andrey Lushnikov 2017-08-07 15:13:17 -07:00 committed by GitHub
parent 4eedc10cfa
commit e1c5b8d244
2 changed files with 12 additions and 1 deletions

View File

@ -243,7 +243,7 @@ class InterceptedRequest {
this._handled = true;
this._client.send('Network.continueInterceptedRequest', {
interceptionId: this._interceptionId,
errorReason: 'Aborted'
errorReason: 'Failed'
});
}

View File

@ -770,6 +770,17 @@ describe('Page', function() {
]);
expect(request.headers['foo']).toBe('bar');
}));
it('should fail navigation when aborting main resource', SX(async function() {
page.setRequestInterceptor(request => request.abort());
let error = null;
try {
await page.navigate(EMPTY_PAGE);
} catch (e) {
error = e;
}
expect(error).toBeTruthy();
expect(error.message).toContain('Failed to navigate');
}));
});
describe('Page.Events.Dialog', function() {