fix(webkit): make go back/forard return null on error (#171)

This commit is contained in:
Yury Semikhatsky 2019-12-06 17:38:23 -07:00 committed by Pavel Feldman
parent 5ab0faab93
commit 02e29219fd
2 changed files with 8 additions and 6 deletions

View File

@ -266,12 +266,14 @@ export class Page extends EventEmitter {
}
async _go<T extends keyof Protocol.CommandParameters>(command: T): Promise<network.Response | null> {
const [response, error] = await Promise.all([
const [response] = await Promise.all([
this.waitForNavigation(),
this._session.send(command).then(() => null).catch(e => e),
]);
if (error)
return null;
this._session.send(command).then(() => null),
]).catch(error => {
if (error instanceof Error && error.message.includes(`Protocol error (${command}): Failed to go`))
return [null];
throw error;
});
return response;
}

View File

@ -451,7 +451,7 @@ module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME
});
describe('Page.goBack', function() {
it.skip(WEBKIT)('should work', async({page, server}) => {
it('should work', async({page, server}) => {
await page.goto(server.EMPTY_PAGE);
await page.goto(server.PREFIX + '/grid.html');