Commit Graph

579 Commits

Author SHA1 Message Date
Joel Einbinder
0c8ace2fab fix(types): add jsdoc for the DOMWorld on frames (#4158) 2019-03-12 15:14:41 -07:00
Joel Einbinder
02b2451db5 fix: check if async error has a stack (#4017) 2019-03-04 17:32:54 -08:00
Andrey Lushnikov
02859c3c6d
feat(chromium): roll Chromium to r637110 (#4099)
This roll includes:
- https://crrev.com/636867 - devtools: bump max number of devtools isolated worlds

Fix #4011
2019-03-04 17:07:56 -08:00
Andrey Lushnikov
9ef23b1754
feat(firefox): implement cookies api (#4076)
This patch implements `page.setCookie()`, `page.deleteCookie()` and
`page.cookies()` and doubles the test coverage for cookies so that
we can feel safer on cross-browser compatibility.
2019-02-26 16:24:30 -08:00
Andrey Lushnikov
5c818368a5
feat(firefox): implement page.exposeFunction (#4052) 2019-02-22 00:04:25 -08:00
Andrey Lushnikov
03c542a6c1
feat(firefox): implement missing launcher options (#4036)
This patch implements `puppeteer.defaultArgs()` and also missing
options, such as `ignoreDefaultArgs`.
2019-02-19 22:08:09 -08:00
Andrey Lushnikov
e8f044c3be
fix(firefox): enable a bunch of evaluation tests (#4006) 2019-02-13 23:41:53 -08:00
Andrey Lushnikov
3c516f2114
chore: move static constructor to the top (#3873) 2019-01-31 17:33:38 -08:00
Andrey Lushnikov
a2f1e2774a
fix: ignore console messages from destroyed execution contexts (#3866)
Fix #3865
2019-01-30 16:19:02 -08:00
Andrey Lushnikov
7001042f79
fix(launcher): properly disable translate UI (#3863)
Fix #3858
2019-01-28 17:19:53 -08:00
Andrey Lushnikov
a064a6341b
feat(page): introduce page.setDefaultTimeout (#3854)
Method `page.setDefaultTimeout` overrides default 30 seconds timeout
for all `page.waitFor*` methods, including navigation and waiting
for selectors.

Fix #3319.
2019-01-28 17:16:12 -08:00
Joel Einbinder
f2c968fdb8 chore(types): generate our own d.ts file from api.md (#3744)
Generate `//index.d.ts` file with precise typescript definitions for all of the
Puppeteer API.
2019-01-28 15:12:45 -08:00
Andrey Lushnikov
63d9ac4df8
fix(executioncontext): follow up to properly adopt element handles (#3857)
The `executionContextId` argument was missing, which made all
element handles to resolve in the main world. All our tests pass
atm, but this would've fired back when we exposed extension
execution contexts.
2019-01-28 14:20:28 -08:00
Andrey Lushnikov
55432f88e9
fix(page): execute frame.waitFor{Selector,XPath} in secondary world (#3856)
This patch starts executing frame.waitForSelector and frame.waitForXPath
in secondary world. As a result, websites that mutate page global
context (e.g. removing global MutationObserver) don't break Puppeteer's
behavior.

Fixes #609
2019-01-28 12:24:27 -08:00
Andrey Lushnikov
2061dd4718
fix(page): teach waitForSelector to return null (#3846)
`page.waitForSelector` should return `null` if waiting for `hidden:
true` and there's no matching node in DOM.

Before this patch, `page.waitForSelector` would return some JSHandle
pointing to boolean value.
2019-01-28 14:24:53 -05:00
Andrey Lushnikov
62da2366c6
chore: introduce //lib/api.js (#3835)
Introduce `//lib/api.js` that declares a list of publicly exposed
classes.

The `//lib/api.js` list superceedes dynamic `helper.tracePublicAPI()` calls
and is used in the following places:
- [ASYNC STACKS]: generate "async stacks" for publicy exposed API in `//index.js`
- [COVERAGE]: move coverage support from `//lib/helper` to `//test/utils`
- [DOCLINT]: get rid of 'exluded classes' hardcoded list

This will help us to re-use our coverage and doclint infrastructure
for Puppeteer-Firefox.

Drive-By: it turns out we didn't run coverage for `SecurityDetails`
class, so we lack coverage for a few methods there. These are excluded
for now, sanity tests will be added in a follow-up.
2019-01-25 23:21:14 -05:00
Andrey Lushnikov
fb710120e9
feat(page): use secondary world to drive clicks (#3828)
References #2671
2019-01-22 23:24:14 -05:00
Andrey Lushnikov
89a5c396bf
refactor: move to flatten protocol (#3827)
DevTools protocol is dropping nested targets and switching to
flatten protocol. This patch adopts the new scheme.

Once this change lands, tip-of-tree Puppeteer will be incompatible
with Chromium below 72.0.3606.0. Chromium 72 goes stable on [Jan, 29](https://www.chromestatus.com/features/schedule) - the same time we release the
next version of Puppeteer, so this change won't hurt those clients who try using
tip-of-tree Puppeteer with stable chrome. 

For the record: the previous attempt to land this was https://github.com/GoogleChrome/puppeteer/pull/3524.
2019-01-22 18:10:11 -05:00
Andrey Lushnikov
678b8e85ad
fix(page): use secondary DOMWorld to drive page.select() (#3809)
This patch starts creating secondary DOMWorld for every connected
page and switches `page.select()` to run inside the secondary world.

Fix #3327.
2019-01-22 17:55:33 -05:00
Andrey Lushnikov
9fd4b67d0c
fix(requestinterception): filter out "intervention" header (#3814)
Fixes #3798
2019-01-20 00:02:13 -05:00
Andrey Lushnikov
4ac00caf9d
refactor: split out DOMWorld from Frame (#3780)
This patch splits out `IsolatedWorld` class from Frame.
The `IsolatedWorld` abstraction is an execution context
with a designated set of DOM wrappers.

References #2671
2019-01-15 17:21:23 -08:00
Joel Einbinder
4e1e2fb701 fix(screenshot): round the clip dimensions (#3778) 2019-01-15 14:34:31 -08:00
Andrey Lushnikov
04fbbd7cf0
fix(network): relax request matching heuristic (#3775)
Drop requirement for matching "origin" and "content-type" headers
in requests and request interceptions. This way javascript redirects
that use form submission start working.

Fix #3684.
2019-01-15 11:37:53 -08:00
Andrey Lushnikov
e8bb26eb95
refactor: split out classes into files (#3773)
New files:
- LifecycleWatcher
- JSHandle
2019-01-14 20:34:50 -08:00
Andrey Lushnikov
4e9e3bc614
refactor: consolidate all events in Events.js (#3772)
This will allow us to break all dependency cycles that were forcing
us to put many things in a single file (e.g. ExecutionContext and
ElementHandle).
2019-01-14 19:57:05 -08:00
Andrey Lushnikov
9083c111ca
fix(frames): make sure evaluation does not hang in detached iframes (#3770)
Fix #3261
2019-01-14 17:23:53 -08:00
Brian Schiller
7fabf32172 feat(executioncontext): warn on nested js handle (#3591)
ExecutionContext.evaluateHandle accepts arguments that are either
serializable, or JSHandles. A potential confusion is that it *does not*
accept arguments that *contain* JSHandles.

This patch adds a log message warning when it encounters that situation.

Fixes #3562
2019-01-14 14:30:50 -08:00
Andrey Lushnikov
d346cb57b4
chore: cleanup puppeteer.connect({browserURL}) (#3766)
This patch:
- renames `browserUrl` into `browserURL`
- cleans up some code
- adds tests for error handling

References #3537
2019-01-14 14:30:03 -08:00
Łukasz Fiszer
15af75f9a2 feat(launcher): add browserUrl option to puppeteer.connect (#3558)
The `browserURL` option allows to connect to a browser that exposed it's remote debugging protocol on a known port.

Fixes #3537
2019-01-14 13:23:34 -08:00
Joel Einbinder
96adedf54f fix(screenshots): throw on 0x0 screenshots (#3756)
Fix #2672
2019-01-11 15:24:43 -08:00
Joel Einbinder
29a2438534 chore(types): Upgrade TypeScript to 3.2.2 (#3754) 2019-01-10 22:56:39 -08:00
Ram Dobson
f73197385a fix(page): page.waitForFunction should work with multiline strings (#3727)
Fixes #3723
2019-01-10 18:18:28 -08:00
Andrey Lushnikov
89fc2adff5
fix(page): consoleMessage.location() should work with workers (#3752)
This patch:
- refactors consoleMessage.location() implementation to
make it work for workers
- re-writes tests to avoid 5 second delay
2019-01-10 18:05:28 -08:00
Tom P
0c867631b0 feat(page): introduce consoleMessage.location() (#3365)
This patch adds a new consoleMessage.location() method that returns console message origins.

Fixes #3029
2019-01-10 16:51:13 -08:00
Andrey Lushnikov
1899e7931c
feat: enable Network Service by default (#3738)
References #3471.
2019-01-09 15:47:08 -08:00
Andrey Lushnikov
c86bc0fa9f
feat(chromium): roll Chromium to r620317 (#3732)
This roll includes:
- https://crrev.com/619087 - DevTools: support interception for file: schema
- https://crrev.com/616936 - Complete the screen capture color space plumbing

This should allow us to switch to network service by default.

Note: We now have to force a specific color space since https://crrev.com/616936
tries to pick the system one.
2019-01-08 12:55:40 -08:00
Andrey Lushnikov
3d82465f66
fix(page): fix repetitative setContent calls (#3666)
Fix #3665.
2018-12-13 13:33:42 -08:00
Andrey Lushnikov
8aaca4eb1e
feat(page): introduce "Popup" event (#3661)
This patch adds a new "popup" event for page.
"Popup" event is fired whenever page opens another page with
given opener.
2018-12-12 17:09:42 -08:00
Andrey Lushnikov
c90392bdf5
feat: introduce page.browserContext() (#3655) 2018-12-12 15:08:31 -08:00
Andrey Lushnikov
927d0f443b
feat(page): support waitUntil option for page.setContent (#3557)
This patch teaches `page.setContent` to await resources in
the new document.

**NOTE**: This patch changes behavior: currently, `page.setContent`
awaits the `"domcontentloaded"` event; with this patch, we can now await
other lifecycle events, and switched default to the `"load"` event.

The change is justified since current behavior made `page.setContent`
unusable for its main designated usecases, pushing our client
to use [dataURL workaround](https://github.com/GoogleChrome/puppeteer/issues/728#issuecomment-334301491).

Fixes #728
2018-11-20 15:32:46 -08:00
Andrey Lushnikov
e2e43bc23d
fix(page): navigating 11 pages simultaneously should not throw warning (#3560)
NavigatorWatcher subscribes to Connection to get a `Disconnected` event,
causing us to hit the default max of 10 listeners constraint.

Technically we don't leak anything here and can safely bump
the maxListenersCount to Infinity.

However, we conveniently have `CDPSession`, and
can re-dispatch the event on it and keep the safety check in place.
2018-11-20 14:21:13 -08:00
Andrey Lushnikov
95a19c74bc
fix(page): dispatch errors into page (#3550)
Errors thrown on the node side of the `page.exposeFunction` callback
should be dispatched into the page.

Fixes #3549
2018-11-15 14:51:34 -08:00
Joel Einbinder
568734386d fix(types): fix parameters where they disagree with the api (#3525) 2018-11-12 12:59:21 -08:00
Joel Einbinder
79ec7a3fe5 fix(types): fix return types where JSDoc and api.md disagree (#3512) 2018-11-07 22:48:43 -08:00
Joel Einbinder
9ba3261571 feat(accessibility): snapshot the accessibility tree (#3470)
This adds `page.accessibility.snapshot()`. It serializes and returns the accessibility tree for the page. By default, uninteresting nodes are filtered out of the snapshot.

fixes #2033
2018-11-01 18:54:51 -07:00
Andrey Lushnikov
3596c5f7e2
fix(page.evaluate): better function serialization (#3480)
References #1665
2018-11-01 16:43:21 -07:00
Andrey Lushnikov
2a88690582
fix(launcher): add flags to improve reliability (#3474)
- The "IPC flooding protection" was added in https://crrev.com/604305
and should be disabled for our automation usescases.
- The other two flags are coming from https://github.com/smooth-code/jest-puppeteer/issues/137
2018-11-01 15:41:08 -07:00
Andrey Lushnikov
3dd5c28f90
fix(pipe): dispatch "disconnected" event when browser is terminated (#3472) 2018-10-31 16:31:29 -07:00
Zeev Rosental
81edbbb58e fix(clicking): handle negative area results in computeQuadArea (#3413)
This patch fixes a case in which computeQuadArea calculates the area size correctly, but returns the area as a negative number.
This occurs when DOM.getContentQuads returns quads in a specific order.

E.g. the array: [ { x: 463, y: 68.5 },{ x: 437, y: 68.5 },{ x: 437, y: 94.5 },{ x: 463, y: 94.5 } ] will receive area size of -676.
2018-10-25 11:41:37 -07:00
Joel Einbinder
d025d1f959 fix(csscoverage): don't prematurely disable the CSS domain (#3418)
CSS stylesheets can still be parsed and added events emitted during the CSS.stopRuleUsageTracking call. It needs to be awaited before calling CSS.disable, otherwise the text content of those style sheets will be unavailable.
2018-10-16 16:55:17 -07:00