fix(webkit): fail the 204 navigations (#1260)

This commit is contained in:
Pavel Feldman 2020-03-09 11:42:56 -07:00 committed by GitHub
parent 3dc48f96c0
commit 2fa2421894
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -764,6 +764,14 @@ export class WKPage implements PageDelegate {
return;
const response = request.createResponse(event.response);
this._page._frameManager.requestReceivedResponse(response);
if (response.status() === 204) {
this._onLoadingFailed({
requestId: event.requestId,
errorText: 'Aborted: 204 No Content',
timestamp: event.timestamp
});
}
}
_onLoadingFinished(event: Protocol.Network.loadingFinishedPayload) {

View File

@ -121,7 +121,7 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
});
await page.goto(server.PREFIX + '/frames/one-frame.html');
});
it.fail(WEBKIT)('should fail when server returns 204', async({page, server}) => {
it('should fail when server returns 204', async({page, server}) => {
// Webkit just loads an empty page.
server.setRoute('/empty.html', (req, res) => {
res.statusCode = 204;
@ -132,6 +132,8 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
expect(error).not.toBe(null);
if (CHROMIUM)
expect(error.message).toContain('net::ERR_ABORTED');
else if (WEBKIT)
expect(error.message).toContain('Aborted: 204 No Content');
else
expect(error.message).toContain('NS_BINDING_ABORTED');
});