From 81d26002361f2485d4ae8a9758be25e65d4c1c01 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Wed, 23 Oct 2019 11:41:01 +0200 Subject: [PATCH] feat(chromium): roll Chromium to r705776 (#5058) This corresponds to Chromium 79.0.3942.0. This roll includes: - Support CSS media feature emulation in CDP https://chromium-review.googlesource.com/c/chromium/src/+/1821608 - Implement timezone ID verification https://chromium-review.googlesource.com/c/chromium/src/+/1822557 - Allow aria-hidden objects into the browser-side ax tree https://chromium-review.googlesource.com/c/chromium/src/+/1760862 - Remove pre-BlinkGenPropertyTrees codepaths (affects screenshot clipping) https://chromium-review.googlesource.com/c/chromium/src/+/1752244 - Terminate some asynchronous waiting commands on cross-process navigation https://chromium-review.googlesource.com/c/chromium/src/+/1766001/21#message-a6a61261b97ffca6ecb180c0a2303b538f7a6476 Per upstream Chromium changes, `page.screenshot` now clips elements to the viewport. This matches the clipping behavior of elements in inner scrollers (i.e., document and overflow scroll clipping now work the same). --- .../puppeteer-firefox/lib/FrameManager.js | 4 ++-- experimental/puppeteer-firefox/lib/Page.js | 6 +++--- lib/Accessibility.js | 5 ++++- lib/ExecutionContext.js | 2 +- lib/LifecycleWatcher.js | 2 +- package.json | 2 +- .../screenshot-offscreen-clip.png | Bin 1513 -> 0 bytes .../golden-firefox/screenshot-offscreen-clip.png | Bin 1121 -> 0 bytes test/launcher.spec.js | 4 ++-- test/navigation.spec.js | 8 ++++---- test/page.spec.js | 9 +-------- test/requestinterception.spec.js | 2 +- test/screenshot.spec.js | 13 ------------- test/waittask.spec.js | 9 +-------- 14 files changed, 21 insertions(+), 45 deletions(-) delete mode 100644 test/golden-chromium/screenshot-offscreen-clip.png delete mode 100644 test/golden-firefox/screenshot-offscreen-clip.png diff --git a/experimental/puppeteer-firefox/lib/FrameManager.js b/experimental/puppeteer-firefox/lib/FrameManager.js index f5411809..39a2297a 100644 --- a/experimental/puppeteer-firefox/lib/FrameManager.js +++ b/experimental/puppeteer-firefox/lib/FrameManager.js @@ -171,7 +171,7 @@ class Frame { } = options; const normalizedWaitUntil = normalizeWaitUntil(waitUntil); - const timeoutError = new TimeoutError('Navigation Timeout Exceeded: ' + timeout + 'ms'); + const timeoutError = new TimeoutError('Navigation timeout of ' + timeout + ' ms exceeded'); let timeoutCallback; const timeoutPromise = new Promise(resolve => timeoutCallback = resolve.bind(null, timeoutError)); const timeoutId = timeout ? setTimeout(timeoutCallback, timeout) : null; @@ -228,7 +228,7 @@ class Frame { if (!navigationId) return; - const timeoutError = new TimeoutError('Navigation Timeout Exceeded: ' + timeout + 'ms'); + const timeoutError = new TimeoutError('Navigation timeout of ' + timeout + ' ms exceeded'); let timeoutCallback; const timeoutPromise = new Promise(resolve => timeoutCallback = resolve.bind(null, timeoutError)); const timeoutId = timeout ? setTimeout(timeoutCallback, timeout) : null; diff --git a/experimental/puppeteer-firefox/lib/Page.js b/experimental/puppeteer-firefox/lib/Page.js index de5c7b41..ad7019b0 100644 --- a/experimental/puppeteer-firefox/lib/Page.js +++ b/experimental/puppeteer-firefox/lib/Page.js @@ -446,7 +446,7 @@ class Page extends EventEmitter { if (!navigationId) return null; - const timeoutError = new TimeoutError('Navigation Timeout Exceeded: ' + timeout + 'ms'); + const timeoutError = new TimeoutError('Navigation timeout of ' + timeout + ' ms exceeded'); let timeoutCallback; const timeoutPromise = new Promise(resolve => timeoutCallback = resolve.bind(null, timeoutError)); const timeoutId = timeout ? setTimeout(timeoutCallback, timeout) : null; @@ -479,7 +479,7 @@ class Page extends EventEmitter { if (!navigationId) return null; - const timeoutError = new TimeoutError('Navigation Timeout Exceeded: ' + timeout + 'ms'); + const timeoutError = new TimeoutError('Navigation timeout of ' + timeout + ' ms exceeded'); let timeoutCallback; const timeoutPromise = new Promise(resolve => timeoutCallback = resolve.bind(null, timeoutError)); const timeoutId = timeout ? setTimeout(timeoutCallback, timeout) : null; @@ -512,7 +512,7 @@ class Page extends EventEmitter { if (!navigationId) return null; - const timeoutError = new TimeoutError('Navigation Timeout Exceeded: ' + timeout + 'ms'); + const timeoutError = new TimeoutError('Navigation timeout of ' + timeout + ' ms exceeded'); let timeoutCallback; const timeoutPromise = new Promise(resolve => timeoutCallback = resolve.bind(null, timeoutError)); const timeoutId = timeout ? setTimeout(timeoutCallback, timeout) : null; diff --git a/lib/Accessibility.js b/lib/Accessibility.js index 419e59fd..9f005a06 100644 --- a/lib/Accessibility.js +++ b/lib/Accessibility.js @@ -143,6 +143,7 @@ class AXNode { this._editable = false; this._focusable = false; this._expanded = false; + this._hidden = false; this._name = this._payload.name ? this._payload.name.value : ''; this._role = this._payload.role ? this._payload.role.value : 'Unknown'; this._cachedHasFocusableChild; @@ -156,6 +157,8 @@ class AXNode { this._focusable = property.value.value; if (property.name === 'expanded') this._expanded = property.value.value; + if (property.name === 'hidden') + this._hidden = property.value.value; } } @@ -289,7 +292,7 @@ class AXNode { */ isInteresting(insideControl) { const role = this._role; - if (role === 'Ignored') + if (role === 'Ignored' || this._hidden) return false; if (this._focusable || this._richlyEditable) diff --git a/lib/ExecutionContext.js b/lib/ExecutionContext.js index cda3899d..d66c0d76 100644 --- a/lib/ExecutionContext.js +++ b/lib/ExecutionContext.js @@ -163,7 +163,7 @@ class ExecutionContext { if (error.message.includes('Object couldn\'t be returned by value')) return {result: {type: 'undefined'}}; - if (error.message.endsWith('Cannot find context with specified id')) + if (error.message.endsWith('Cannot find context with specified id') || error.message.endsWith('Inspected target navigated or closed')) throw new Error('Execution context was destroyed, most likely because of a navigation.'); throw error; } diff --git a/lib/LifecycleWatcher.js b/lib/LifecycleWatcher.js index 3f1f86db..747675bc 100644 --- a/lib/LifecycleWatcher.js +++ b/lib/LifecycleWatcher.js @@ -137,7 +137,7 @@ class LifecycleWatcher { _createTimeoutPromise() { if (!this._timeout) return new Promise(() => {}); - const errorMessage = 'Navigation Timeout Exceeded: ' + this._timeout + 'ms exceeded'; + const errorMessage = 'Navigation timeout of ' + this._timeout + ' ms exceeded'; return new Promise(fulfill => this._maximumTimer = setTimeout(fulfill, this._timeout)) .then(() => new TimeoutError(errorMessage)); } diff --git a/package.json b/package.json index 66d31c2d..59dc40df 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "node": ">=8.16.0" }, "puppeteer": { - "chromium_revision": "686378" + "chromium_revision": "706915" }, "scripts": { "unit": "node test/test.js", diff --git a/test/golden-chromium/screenshot-offscreen-clip.png b/test/golden-chromium/screenshot-offscreen-clip.png deleted file mode 100644 index fac15c30e0b3c92ff2560ab1763eb95837fb4ae0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1513 zcmbVM{WsGK82{?+GA0@2Wt8%=d(*X)mx)}n3D;eQ@^Ysrc7B_=lM&N=rFxZQI;&-489c|PZJ&ht4B!yk7H3Ne8I z008yz#ssJ*xKWzh)IDM9Mi2mOt@6Qm1f{U&*+g$J(ukg6)3k$4#<2KdB5;=jff4{_ zgQI4_mZ45VF<)-`i!x_v@xoW2^#MZ@OY8kR1M?#pg;yXhQBQ9oXnW^_+TPLhW3u`M ze2bj1;m$eoK*6DDc7YvnGM%@iYQ8YOD2qsZLCIOxg8hE5$X z&kw>F0YpkZyjrCuKit-dP9^+^^e!t__218En^l}nNYML<>lj`k7JL*s2LuLAlIsr- z!CqvZ)$*b>yZ=FU{yFZc{|(v^jg9r4o#?sbBVw`GpFl86aCdPr(bCdFTwEP4QZzNW z5)_yc$73Ej@YwE0*lN8xNuFH`g;QRRn7CBrp!=t(?3@R~K_;$lz5_+w@`ykN5pv#a<5{vzZ1#EwQz!AFe&a-VC#~wJqjyp{T9b z81Xi_w?I@;u&87?9LW(}5cz}Fk}5twtE&qabgI*E#1}Ebhu<>Xa85;9Y(I*ELZQ!7 z*JJQ;)H5u(b7{Wke7(Qsj_d3Yo!_5lDl&e(g80&sD7`1E)I$vv1$wsAq|pUg-P4HBzLqmh|!z`1@bW5|cvH~`_ zld4iVT2Az_rsw%er80Sy?*LulJ9va>9{gHZnv=Y=FVXe(L4ZEyiagVO?G_vdUx3%G zUf=BYRboln_3kZsn`l1gh)z0t2=*2P`$?GUmk9OMU#~e{jD9Es(Pf|jN`rr- zR7OfB`%!q@CwKat&L~Su%PrDI_Nt4k`S!xXLOoN{t4d{RZf-8grPXMkg95`D_%yf& zRkkdD$~vi4IiyW*yUb!49CmaR#6CHllw{E1Thz1US~za8$g_H|-|uvzN@lIrYG`a+ z5GyFoDzBqaQBf0%t5q}W$0%<2wW%<48G1a858uVR*Jd2bJRiz*kA%s2HGk&^-k^Q! z3zJVRp6MAIW6p_d+|B}3wY6pSMF_OQK}lh=7E5G0eMXT%ls-4{n@dy;rHwdd-R$FoY@c%qY~F1)dkX-9 zAeCTu-IZ5T>50`vod~iKr_Zee)z#GqJ3D%Z%p+s5T$C(Wi6$~VXz*aQ$EovvEZF*Q zIlcOMuh;8Hj(2+d`}Z~6MVdds$nNT)x@;s!Cnvf(t?cGy4(}+Mn)}4hETlTbc33Jk z=*1byOvs?Gbwx!5DLPv7CQ@kZ6)vhAmuC0BZ5J+mcAJI4U^xs1Bk4%Q+UxGbV65)r z433mLinXMpx{y@2 ztj3gKm>ih+G>RSW`woxCYXC?i9V2sdFWH2lMSsWOMfD2@e6TnS4^7JY2XG&>`2YX_ diff --git a/test/golden-firefox/screenshot-offscreen-clip.png b/test/golden-firefox/screenshot-offscreen-clip.png deleted file mode 100644 index 791496e5da72ddc20aabbbbca900eeafab0e144b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1121 zcmeAS@N?(olHy`uVBq!ia0vp^DIm1g|}x z6=`k%O)cMU@6q55#xuXZNmf@p>Jcd7RWMX+HRIs+D=8vkT z@8zYhTZJCIdwuM!-JQe!mrGvmNpNy;;pgZ7`sB%x>W1~}*Wdg4_;K?336)=+I19g* zK3>LOe)r49oHzr;)W|UZLq_Zpt`oygtonM3OY`)mU597eImh_O$3EREmQ+zu5%GiJ z`?qf)E?@rs-8;D|mcwvHt@z2Uzh5ZjD?9!AyRWO`-km!oY8ApxZ|ruRxZN?qqA%3t z%eQaaF01F=g^CG$=6&|^PG52pIm-#o{Z)gF0?r7hnDQ@Y(EH8sae>)}3d2>+9-P zb-eid_wV|xFH3fn0FAj*dw0j(_T6T4{Z^Y+FPftbjNK1TcRX|U&AFKIq&9Zmb6|Q< zJaYH?bYrRBJ?l?@-t+6W&y?cNKwBR;o!WFo{%^g|ZKd@$@81s>e7Po094NNt-G^o8 z1*9(@SK67jD5gM>&3MaF&F2puEU1e1n6#vHuU@OfnSH*NdGepLZV5kK(DLVn&;EV; zzPxzh;p(z}-MVc-C*=L*ODn&*>`Yyss_Vq_w=Vv%#l0xSZ;i(b-}K%Tej2uOT7uIi zo!?u{WcZ}{Wdeb*xc{1u{JUMYfq7G3bEu`*$c4Y3|E+40O7z#38?`rHFXOL1>oX-f z)a8S^i_4bluU}T!T page.url()); expect(pages).toEqual(['about:blank']); await browser.close(); }); - it_fails_ffox('should have custom url when launching browser', async function({server}) { + it_fails_ffox('should have custom URL when launching browser', async function({server}) { const options = Object.assign({}, defaultBrowserOptions); options.args = [server.EMPTY_PAGE].concat(options.args || []); const browser = await puppeteer.launch(options); diff --git a/test/navigation.spec.js b/test/navigation.spec.js index fd212e59..5cf8d7b8 100644 --- a/test/navigation.spec.js +++ b/test/navigation.spec.js @@ -137,7 +137,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) { server.setRoute('/empty.html', (req, res) => { }); let error = null; await page.goto(server.PREFIX + '/empty.html', {timeout: 1}).catch(e => error = e); - expect(error.message).toContain('Navigation Timeout Exceeded: 1ms'); + expect(error.message).toContain('Navigation timeout of 1 ms exceeded'); expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError); }); it('should fail when exceeding default maximum navigation timeout', async({page, server}) => { @@ -146,7 +146,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) { let error = null; page.setDefaultNavigationTimeout(1); await page.goto(server.PREFIX + '/empty.html').catch(e => error = e); - expect(error.message).toContain('Navigation Timeout Exceeded: 1ms'); + expect(error.message).toContain('Navigation timeout of 1 ms exceeded'); expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError); }); it('should fail when exceeding default maximum timeout', async({page, server}) => { @@ -155,7 +155,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) { let error = null; page.setDefaultTimeout(1); await page.goto(server.PREFIX + '/empty.html').catch(e => error = e); - expect(error.message).toContain('Navigation Timeout Exceeded: 1ms'); + expect(error.message).toContain('Navigation timeout of 1 ms exceeded'); expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError); }); it('should prioritize default navigation timeout over default timeout', async({page, server}) => { @@ -165,7 +165,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) { page.setDefaultTimeout(0); page.setDefaultNavigationTimeout(1); await page.goto(server.PREFIX + '/empty.html').catch(e => error = e); - expect(error.message).toContain('Navigation Timeout Exceeded: 1ms'); + expect(error.message).toContain('Navigation timeout of 1 ms exceeded'); expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError); }); it('should disable timeout when its set to 0', async({page, server}) => { diff --git a/test/page.spec.js b/test/page.spec.js index a111cead..b7120c70 100644 --- a/test/page.spec.js +++ b/test/page.spec.js @@ -18,13 +18,6 @@ const path = require('path'); const utils = require('./utils'); const {waitEvent} = utils; -let asyncawait = true; -try { - new Function('async function foo() {await 1}'); -} catch (e) { - asyncawait = false; -} - module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHROME}) { const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner; const {it, fit, xit, it_fails_ffox} = testRunner; @@ -101,7 +94,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR }); }); - (asyncawait ? describe : xdescribe)('Async stacks', () => { + describe('Async stacks', () => { it('should work', async({page, server}) => { server.setRoute('/empty.html', (req, res) => { res.statusCode = 204; diff --git a/test/requestinterception.spec.js b/test/requestinterception.spec.js index e0c7d9b7..99124d8b 100644 --- a/test/requestinterception.spec.js +++ b/test/requestinterception.spec.js @@ -146,7 +146,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) { }); expect(status).toBe(200); }); - it('should works with customizing referer headers', async({page, server}) => { + it('should work with custom referer headers', async({page, server}) => { await page.setExtraHTTPHeaders({ 'referer': server.EMPTY_PAGE }); await page.setRequestInterception(true); page.on('request', request => { diff --git a/test/screenshot.spec.js b/test/screenshot.spec.js index a427abaf..701e208a 100644 --- a/test/screenshot.spec.js +++ b/test/screenshot.spec.js @@ -39,19 +39,6 @@ module.exports.addTests = function({testRunner, expect, product}) { }); expect(screenshot).toBeGolden('screenshot-clip-rect.png'); }); - it('should work for offscreen clip', async({page, server}) => { - await page.setViewport({width: 500, height: 500}); - await page.goto(server.PREFIX + '/grid.html'); - const screenshot = await page.screenshot({ - clip: { - x: 50, - y: 600, - width: 100, - height: 100 - } - }); - expect(screenshot).toBeGolden('screenshot-offscreen-clip.png'); - }); it('should run in parallel', async({page, server}) => { await page.setViewport({width: 500, height: 500}); await page.goto(server.PREFIX + '/grid.html'); diff --git a/test/waittask.spec.js b/test/waittask.spec.js index 69d44a74..3a0cba0b 100644 --- a/test/waittask.spec.js +++ b/test/waittask.spec.js @@ -16,13 +16,6 @@ const utils = require('./utils'); -let asyncawait = true; -try { - new Function('async function foo() {await 1}'); -} catch (e) { - asyncawait = false; -} - module.exports.addTests = function({testRunner, expect, product, puppeteer}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit, it_fails_ffox} = testRunner; @@ -378,7 +371,7 @@ module.exports.addTests = function({testRunner, expect, product, puppeteer}) { await page.setContent(`
anything
`); expect(await page.evaluate(x => x.textContent, await waitForSelector)).toBe('anything'); }); - (asyncawait ? it : xit)('should have correct stack trace for timeout', async({page, server}) => { + it('should have correct stack trace for timeout', async({page, server}) => { let error; await page.waitForSelector('.zombo', {timeout: 10}).catch(e => error = e); expect(error.stack).toContain('waittask.spec.js');