Commit Graph

15 Commits

Author SHA1 Message Date
Andrey Lushnikov
0bea42bd8c Do not leave dangling promises when sending messages over protocol ()
It's very bad to have 'unhandled promise rejection' that can't be
handled in user code. These errors will exit node process in a near
future.

This patch avoids 'unhandled promise rejection' while sending protocol
messages.

This patch:
- introduces `puppeteer:error` debug scope and starts using it for all
  swalloed errors.
- makes sure that every `client.send` method is either awaited or its
  errors are handled.
- starts return promises from Request.continue() and Request.abort().
- starts swallow errors from Request.contine() and Request.abort().

The last is the most important part of the patch. Since
`Request.continue()` might try to continue canceled request, we should
disregard the error.

Fixes .
2017-09-11 16:21:51 -07:00
JoelEinbinder
64124df62f [api] add touchScreen.tap ()
This patch:
- adds `page.touchscreen` namespace, similar to `page.mouse` and `page.keyboard`.
- adds tapping to multiple layers:
  - `page.touchscreen.tap`
  - `page.tap` - convenience method which accepts selector
  - `elementHandle.tap`

Fixes  and .
2017-09-01 19:03:51 -07:00
JoelEinbinder
42fa3af659 Remove promise jsdoc ()
This patch removes unnecessary "promise" return types in jsdoc for async functions.
2017-08-31 17:58:07 -07:00
JoelEinbinder
8f74cc8a90 [api] Add "step" option to mouse.move method ()
This patch adds "step" option to the mouse.move method, that optionally tweens mouse movement over multiple steps.

References .
2017-08-29 14:13:38 -07:00
Eric Bidelman
1f9b4fb4c8 Change let into const ()
This patch:
- changes `let` into `const` throughout codebase
- adds eslint check to prefer const over let
2017-08-21 16:39:04 -07:00
Eric Bidelman
5d6d3e0a81 cleanup: Use ES6 default params () 2017-08-21 16:32:39 -07:00
JoelEinbinder
497baf0198 Roll chromium to r493673 ()
Mouse events are no longer racy. Enabling touch no longer converts all mouse events into touches. Promises in destroyed execution contexts are rejected immediately.
2017-08-11 01:21:02 -07:00
Andrey Lushnikov
fe06c896eb Roll chromium to 492629 ()
This patch
- rolls chromium to 492629
- migrates connection establishing to use browser target. This migration means
  that now we have a single websocket connection to browser (implemented
  in Connection class). A connection to a particular target is
  incapsulated in a new Session class.
2017-08-09 16:14:00 -07:00
JoelEinbinder
fc70ab8f21 Add delay option to input methods ()
Add delay option to input methods for the keyboard and mouse.

Closes 
2017-07-31 18:18:15 -07:00
JoelEinbinder
bfc40b2ee6 Specify repeat property on repeated keypresses ()
This patch implements 'autoRepeat' functionality for `keyboard.down`.
With this patch, the subsequent calls to `keyboard.down` would generate
an event with 'autoRepeat` flag set to true.

Closes 
2017-07-31 12:05:46 -07:00
JoelEinbinder
b474a2d0d9 Mark options objects as optional () 2017-07-30 13:46:56 -07:00
JoelEinbinder
3c75767288 Fix media keys to use new key strings and codes ()
VolumeUp, VolumeDown, and VolumeMute were changed to AudioVolumeUp, AudioVolumeDown, and AudioVolumeMute

The media keys like MediaTrackNext were also missing, so I added them.
2017-07-28 11:38:30 -07:00
JoelEinbinder
aa28eb80f0 Wait for double raf after all mouse events. ()
This patch starts waiting for double raf after every mouse event.
It looks like a good enough workaround to make sure mouse events
are delivered.

The single raf might not be enough because browser might 'return' an already-prepared
frame for us without actually dispatching events.

Closes 
2017-07-25 17:03:13 -07:00
JoelEinbinder
64968862db Implement mouse.click(x,y) ()
Closes 
2017-07-25 16:05:23 -07:00
Pavel Feldman
eca0d7fe53 Simplify keyboard modifiers handling () 2017-07-25 14:35:03 -07:00