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:
parent
4eedc10cfa
commit
e1c5b8d244
@ -243,7 +243,7 @@ class InterceptedRequest {
|
||||
this._handled = true;
|
||||
this._client.send('Network.continueInterceptedRequest', {
|
||||
interceptionId: this._interceptionId,
|
||||
errorReason: 'Aborted'
|
||||
errorReason: 'Failed'
|
||||
});
|
||||
}
|
||||
|
||||
|
11
test/test.js
11
test/test.js
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user