mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
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).
This commit is contained in:
parent
3773229ac2
commit
81d2600236
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
"node": ">=8.16.0"
|
||||
},
|
||||
"puppeteer": {
|
||||
"chromium_revision": "686378"
|
||||
"chromium_revision": "706915"
|
||||
},
|
||||
"scripts": {
|
||||
"unit": "node test/test.js",
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
@ -221,13 +221,13 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
||||
expect(spawnargs.indexOf(defaultArgs[2])).toBe(-1);
|
||||
await browser.close();
|
||||
});
|
||||
it_fails_ffox('should have default url when launching browser', async function() {
|
||||
it_fails_ffox('should have default URL when launching browser', async function() {
|
||||
const browser = await puppeteer.launch(defaultBrowserOptions);
|
||||
const pages = (await browser.pages()).map(page => 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);
|
||||
|
@ -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}) => {
|
||||
|
@ -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;
|
||||
|
@ -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 => {
|
||||
|
@ -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');
|
||||
|
@ -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(`<div class='zombo'>anything</div>`);
|
||||
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');
|
||||
|
Loading…
Reference in New Issue
Block a user