From f863f4bfe015e57ea1f9fbb322f1cedee468b857 Mon Sep 17 00:00:00 2001 From: Jan Scheffler Date: Wed, 26 May 2021 18:44:29 +0200 Subject: [PATCH] feat(chromium): roll to Chromium 92.0.4512.0 (r884014) (#7288) --- docs/api.md | 1 + package.json | 2 +- src/common/Accessibility.ts | 5 ++-- src/common/AriaQueryHandler.ts | 2 +- src/common/Connection.ts | 8 +++++++ src/revisions.ts | 2 +- test/CDPSession.spec.ts | 7 ++++++ test/accessibility.spec.ts | 42 +++++++++------------------------- test/headful.spec.ts | 6 ++--- versions.js | 1 + 10 files changed, 37 insertions(+), 39 deletions(-) diff --git a/docs/api.md b/docs/api.md index 13ecbb1c..fabce135 100644 --- a/docs/api.md +++ b/docs/api.md @@ -10,6 +10,7 @@ - Releases per Chromium version: + * Chromium 92.0.4512.0 - [Puppeteer v9.1.1](https://github.com/puppeteer/puppeteer/blob/v9.1.1/docs/api.md) * Chromium 91.0.4469.0 - [Puppeteer v9.0.0](https://github.com/puppeteer/puppeteer/blob/v9.0.0/docs/api.md) * Chromium 90.0.4427.0 - [Puppeteer v8.0.0](https://github.com/puppeteer/puppeteer/blob/v8.0.0/docs/api.md) * Chromium 90.0.4403.0 - [Puppeteer v7.0.0](https://github.com/puppeteer/puppeteer/blob/v7.0.0/docs/api.md) diff --git a/package.json b/package.json index d8cc9be7..01fdd707 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "license": "Apache-2.0", "dependencies": { "debug": "4.3.1", - "devtools-protocol": "0.0.869402", + "devtools-protocol": "0.0.883894", "extract-zip": "2.0.1", "https-proxy-agent": "5.0.0", "node-fetch": "2.6.1", diff --git a/src/common/Accessibility.ts b/src/common/Accessibility.ts index 69684a47..cf9a37fc 100644 --- a/src/common/Accessibility.ts +++ b/src/common/Accessibility.ts @@ -437,10 +437,11 @@ class AXNode { properties.get(key) as boolean; for (const booleanProperty of booleanProperties) { - // WebArea's treat focus differently than other nodes. They report whether + // RootWebArea's treat focus differently than other nodes. They report whether // their frame has focus, not whether focus is specifically on the root // node. - if (booleanProperty === 'focused' && this._role === 'WebArea') continue; + if (booleanProperty === 'focused' && this._role === 'RootWebArea') + continue; const value = getBooleanPropertyValue(booleanProperty); if (!value) continue; node[booleanProperty] = getBooleanPropertyValue(booleanProperty); diff --git a/src/common/AriaQueryHandler.ts b/src/common/AriaQueryHandler.ts index a59090f2..8b2e4c92 100644 --- a/src/common/AriaQueryHandler.ts +++ b/src/common/AriaQueryHandler.ts @@ -32,7 +32,7 @@ async function queryAXTree( role, }); const filteredNodes: Protocol.Accessibility.AXNode[] = nodes.filter( - (node: Protocol.Accessibility.AXNode) => node.role.value !== 'text' + (node: Protocol.Accessibility.AXNode) => node.role.value !== 'StaticText' ); return filteredNodes; } diff --git a/src/common/Connection.ts b/src/common/Connection.ts index 9602a7f8..34aab7df 100644 --- a/src/common/Connection.ts +++ b/src/common/Connection.ts @@ -126,12 +126,20 @@ export class Connection extends EventEmitter { ); this._sessions.set(sessionId, session); this.emit('sessionattached', session); + const parentSession = this._sessions.get(object.sessionId); + if (parentSession) { + parentSession.emit('sessionattached', session); + } } else if (object.method === 'Target.detachedFromTarget') { const session = this._sessions.get(object.params.sessionId); if (session) { session._onClosed(); this._sessions.delete(object.params.sessionId); this.emit('sessiondetached', session); + const parentSession = this._sessions.get(object.sessionId); + if (parentSession) { + parentSession.emit('sessiondetached', session); + } } } if (object.sessionId) { diff --git a/src/revisions.ts b/src/revisions.ts index 521f35bd..3b86c4ea 100644 --- a/src/revisions.ts +++ b/src/revisions.ts @@ -20,6 +20,6 @@ type Revisions = Readonly<{ }>; export const PUPPETEER_REVISIONS: Revisions = { - chromium: '869685', + chromium: '884014', firefox: 'latest', }; diff --git a/test/CDPSession.spec.ts b/test/CDPSession.spec.ts index 2ebf10fd..d5999d3d 100644 --- a/test/CDPSession.spec.ts +++ b/test/CDPSession.spec.ts @@ -103,4 +103,11 @@ describeChromeOnly('Target.createCDPSession', function () { await client.send('ThisCommand.DoesNotExist'); } }); + + it('should expose the underlying connection', async () => { + const { page } = getTestState(); + + const client = await page.target().createCDPSession(); + expect(client.connection()).toBeTruthy(); + }); }); diff --git a/test/accessibility.spec.ts b/test/accessibility.spec.ts index 605915b8..5198e255 100644 --- a/test/accessibility.spec.ts +++ b/test/accessibility.spec.ts @@ -87,10 +87,10 @@ describeFailsFirefox('Accessibility', function () { ], } : { - role: 'WebArea', + role: 'RootWebArea', name: 'Accessibility Test', children: [ - { role: 'text', name: 'Hello World' }, + { role: 'StaticText', name: 'Hello World' }, { role: 'heading', name: 'Inputs', level: 1 }, { role: 'textbox', name: 'Empty input', focused: true }, { role: 'textbox', name: 'readonly input', readonly: true }, @@ -148,7 +148,7 @@ describeFailsFirefox('Accessibility', function () { name: '', children: [ { - role: 'text', + role: 'StaticText', name: 'hi', }, ], @@ -230,7 +230,7 @@ describeFailsFirefox('Accessibility', function () { ], } : { - role: 'WebArea', + role: 'RootWebArea', name: '', children: [ { @@ -263,7 +263,7 @@ describeFailsFirefox('Accessibility', function () { name: 'Edit this image: ', }, { - role: 'text', + role: 'StaticText', name: 'my fake image', }, ], @@ -274,7 +274,7 @@ describeFailsFirefox('Accessibility', function () { value: 'Edit this image: ', children: [ { - role: 'text', + role: 'StaticText', name: 'Edit this image:', }, { @@ -300,7 +300,7 @@ describeFailsFirefox('Accessibility', function () { value: 'Edit this image: my fake image', children: [ { - role: 'text', + role: 'StaticText', name: 'my fake image', }, ], @@ -309,9 +309,10 @@ describeFailsFirefox('Accessibility', function () { role: 'textbox', name: '', value: 'Edit this image: ', + multiline: true, children: [ { - role: 'text', + role: 'StaticText', name: 'Edit this image:', }, { @@ -336,28 +337,7 @@ describeFailsFirefox('Accessibility', function () { role: 'textbox', name: '', value: 'Edit this image:', - }); - }); - it('plain text field without role should not have content', async () => { - const { page } = getTestState(); - - await page.setContent(` -
Edit this image:my fake image
`); - const snapshot = await page.accessibility.snapshot(); - expect(snapshot.children[0]).toEqual({ - role: 'generic', - name: '', - }); - }); - it('plain text field with tabindex and without role should not have content', async () => { - const { page } = getTestState(); - - await page.setContent(` -
Edit this image:my fake image
`); - const snapshot = await page.accessibility.snapshot(); - expect(snapshot.children[0]).toEqual({ - role: 'generic', - name: '', + multiline: true, }); }); }); @@ -502,7 +482,7 @@ describeFailsFirefox('Accessibility', function () { { role: 'button', name: 'My Button', - children: [{ role: 'text', name: 'My Button' }], + children: [{ role: 'StaticText', name: 'My Button' }], }, ], }); diff --git a/test/headful.spec.ts b/test/headful.spec.ts index ac3097bf..62441450 100644 --- a/test/headful.spec.ts +++ b/test/headful.spec.ts @@ -200,13 +200,14 @@ describeChromeOnly('headful tests', function () { flatten: true, waitForDebuggerOnStart: true, }); - session.connection().on('sessionattached', async (session) => { + session.on('sessionattached', async (session) => { otherSessions.push(session); session.on('Network.requestWillBeSent', (params) => networkEvents.push(params) ); await session.send('Network.enable'); + await session.send('Runtime.runIfWaitingForDebugger'); }); // Navigate to the empty page and add an OOPIF iframe with at least one request. @@ -227,7 +228,6 @@ describeChromeOnly('headful tests', function () { // Resume the iframe and trigger another request. const iframeSession = otherSessions[0]; - await iframeSession.send('Runtime.runIfWaitingForDebugger'); await iframeSession.send('Runtime.evaluate', { expression: `fetch('/fetch')`, awaitPromise: true, @@ -258,7 +258,7 @@ describeChromeOnly('headful tests', function () { const context = await browser.createIncognitoBrowserContext(); await Promise.all([ context.newPage(), - context.waitForTarget((target) => target.url().includes('devtools://')), + browser.waitForTarget((target) => target.url().includes('devtools://')), ]); await browser.close(); }); diff --git a/versions.js b/versions.js index 716c4529..2924fbd2 100644 --- a/versions.js +++ b/versions.js @@ -17,6 +17,7 @@ const versionsPerRelease = new Map([ // This is a mapping from Chromium version => Puppeteer version. // In Chromium roll patches, use 'NEXT' for the Puppeteer version. + ['92.0.4512.0', 'v9.1.1'], ['91.0.4469.0', 'v9.0.0'], ['90.0.4427.0', 'v8.0.0'], ['90.0.4403.0', 'v7.0.0'],