diff --git a/src/webkit/FrameManager.ts b/src/webkit/FrameManager.ts index 37815feaf9..b86458ebe4 100644 --- a/src/webkit/FrameManager.ts +++ b/src/webkit/FrameManager.ts @@ -413,7 +413,7 @@ export class FrameManager extends EventEmitter implements PageDelegate { } return context._createHandle(p); }); - this._page._addConsoleMessage(derivedType, handles, { url, lineNumber, columnNumber }, handles.length ? undefined : text); + this._page._addConsoleMessage(derivedType, handles, { url, lineNumber: lineNumber - 1, columnNumber: columnNumber - 1 }, handles.length ? undefined : text); } _onDialog(event: Protocol.Dialog.javascriptDialogOpeningPayload) { diff --git a/test/page.spec.js b/test/page.spec.js index 6330d7affd..1d3f628482 100644 --- a/test/page.spec.js +++ b/test/page.spec.js @@ -240,22 +240,7 @@ module.exports.addTests = function({testRunner, expect, headless, playwright, FF else expect(message.type()).toEqual('warn'); }); - it.skip(FFOX || WEBKIT)('should have location when fetch fails', async({page, server}) => { - // The point of this test is to make sure that we report console messages from - // Log domain: https://vanilla.aslushnikov.com/?Log.entryAdded - await page.goto(server.EMPTY_PAGE); - const [message] = await Promise.all([ - waitEvent(page, 'console'), - page.setContent(``), - ]); - expect(message.text()).toContain(`ERR_NAME_NOT_RESOLVED`); - expect(message.type()).toEqual('error'); - expect(message.location()).toEqual({ - url: 'http://wat/', - lineNumber: undefined - }); - }); - it.skip(WEBKIT)('should have location for console API calls', async({page, server}) => { + it('should have location for console API calls', async({page, server}) => { await page.goto(server.EMPTY_PAGE); const [message] = await Promise.all([ waitEvent(page, 'console'), @@ -263,10 +248,12 @@ module.exports.addTests = function({testRunner, expect, headless, playwright, FF ]); expect(message.text()).toBe('yellow'); expect(message.type()).toBe('log'); - expect(message.location()).toEqual({ + const location = message.location(); + // Engines have different column notion. + delete location.columnNumber; + expect(location).toEqual({ url: server.PREFIX + '/consolelog.html', lineNumber: 7, - columnNumber: 14, }); }); // @see https://github.com/GoogleChrome/puppeteer/issues/3865