Commit Graph

620 Commits

Author SHA1 Message Date
Andrey Lushnikov
ea28cccfe0 feat(page): introduce file chooser interception (#4653)
This patch introduces a page.waitForFileChooser() method
that adds a watchdog to wait for file chooser dialogs.

This lets Puppeteer users to capture file chooser requests
and fulfill/cancel them if necessary.

Fixes #2946
2019-07-22 21:30:49 -07:00
Yury Semikhatsky
2abaac10aa fix(launcher): make dumpio and pipe options work together (#4727)
Don't ignore stdout and stderr when using pipe for remote debugging and dumpio is true. In that case puppeteer process connects to the stdout/stderr streams of the child process and it will not hang.
2019-07-18 16:42:11 -07:00
Andrey Lushnikov
ad1802188d
fix(launcher): disable component extensions (#4704)
Chrome has a set of component extensions - e.g. CryptoTokenExtension
that helps with 2FA.

These extensions are loaded regardless of the `--disable-extensions`
flag we already pass. To disable these extensions, we need to pass additional
`--disable-component-extensions-with-background-pages` flag.

Fix #4300
2019-07-15 17:54:42 -07:00
Andrey Lushnikov
f8616ed54b
fix(pipe): handle 'error' events on pipes to avoid crashing (#4705)
Fix #4374
2019-07-15 17:53:27 -07:00
Andrey Lushnikov
c9977c8004
fix(page): properly create isolated worlds (#4707)
The following error:
```
Error: Protocol error (Page.createIsolatedWorld): No frame for given id found
```

was mentioned here:
https://github.com/FlowCrypt/flowcrypt-browser/pull/1799#issuecomment-508729602

This indeed seems to be a bug with our creation of isolated worlds.
2019-07-15 17:52:40 -07:00
Mohamed Akram
bafda9fbe7 fix(launcher): ensure PUPPETEER_EXECUTABLE_PATH is used if set (#4677)
Without this patch, Puppeteer exits with `Error: Unsupported platform: freebsd` on FreeBSD despite `PUPPETEER_EXECUTABLE_PATH` being set.
2019-07-14 16:37:57 -07:00
Yury Semikhatsky
715aad2d67 fix: proper parse Error message on Node 12 (#4698)
Check message prefix rather than strict equality when detecting circular JSON error. The message format has changed in Node 12 which broke the condition and failed a test.
2019-07-12 17:19:02 -07:00
Joel Einbinder
49b27956fe feat(keyboard): feature phone buttons (#4694)
I got a KaiOS phone with some awesome buttons on it I hadn't seen before on the web. This adds the following buttons to our default keyboard layout:

`SoftLeft`
`SoftRight`
`Camera`
`Call`
`EndCall`
`VolumeUp`
`VolumeDown`
2019-07-12 15:41:01 -07:00
Andrey Lushnikov
955e7cb6fc
feat(page): move page.pdf to protocol streams (#4587)
This lets transferring massive PDF files over the protocol.

Fix #4563
2019-06-14 22:36:06 -07:00
Andrey Lushnikov
62733a20d7
fix(connection): bump websocket max received message size to 256Mb (#4571)
This is the max message size that DevTools can emit over the DevTools
protocol: https://cs.chromium.org/chromium/src/content/browser/devtools/devtools_http_handler.cc?type=cs&q=kSendBufferSizeForDevTools&sq=package:chromium&g=0&l=83

Test is failing on firefox since Firefox crashes when allocating 100Mb string.

Fix #4543
2019-06-14 01:05:09 -07:00
Andrey Lushnikov
6860d73212
fix(network): align HTTP status codes with IANA (#4567)
Aline HTTP status texts with https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
2019-06-10 21:04:45 -07:00
Takahiro Nishino
792264122c fix(page): fix A2 and A3 format size (#4569)
16.5 inch ~ 419.1mm
16.54 inch ~ 420.1mm

Fix #4568
2019-06-10 20:59:12 -07:00
Andrey Lushnikov
8df0b3ec3b
fix(network): allow fulfilling requests with status code 422 (#4566)
Migration onto fetch domain (2265974ce5)
changed the way we generate status texts: instead of relying on build-in
list of statuses, we tried to rely upon the [Chromium implementation](https://cs.chromium.org/chromium/src/net/http/http_status_code_list.h?sq=package:chromium&g=0).

Puppeteer's list is much more exhaustive - let's keep it.

Fix #4454
2019-06-10 17:39:58 -07:00
Joel Einbinder
b2f94909a1 fix(eval): be able to throw protocol like errors (#4551) 2019-06-10 17:35:40 -07:00
Philip Bergqvist
dd6fcfe77b fix(page): fix missing awaits in mouse.click (#4541)
Lack of await causes dangling promises, which lead to unhandled rejections that cannot be caught if these calls fail (e.g. if the page is closed). 

References #4536
2019-06-10 01:42:19 -07:00
david weil
7faf1c9030 fix(BrowserFetcher): fix httpRequest when using proxy against http HOST (#4558)
This patch avoids https-proxy-agent usage when target host protocol is http and proxy is specified.
This is a valid scenario for installer but was failing.

Fixes #4556
2019-06-10 01:11:01 -07:00
Andrey Lushnikov
90df69cf77
fix(page): do evaluations with one roundtrip (#4539)
This patch teaches page.evaluate to do 1 hop instead of 2 hops.
As a result, things such as `page.select` will not throw an
unfortunate exception when they schedule a navigation.

Fix #4537
2019-06-07 13:46:43 -07:00
Andrey Lushnikov
f79d0a3be8
fix: try running without --disable-gpu on windows (#4523)
It looks like https://crbug.com/737678 and https://crbug.com/729961
are fixed - so we shouldn't need the `--disable-gpu` flag on windows
headless.

Reference #1260
2019-06-05 19:03:09 -07:00
Adriel Codeco
ac611bacac fix(helper): fix Helper.installAsyncStackHooks method (#4478)
Using Error.captureStackTrace instead of new Error () to avoid UnhandledPromiseRejectionWarning
2019-05-31 19:39:32 -07:00
Andrey Lushnikov
76b24e64e8
feat(chromium): roll Chromium to r662092 (#4462)
This roll includes:
- [inspector_protocol:8ec18cf](8ec18cf088) Support STRING16 in the template when converting CBOR map keys
to protocol::Value.
- [inspector_protocol:37518ac](37518ac421) fix parsing of the last ASCII character

This fixes protocol handling of UTF8 in both V8 and Chromium.

Fixes #4443.
2019-05-22 21:21:45 +03:00
Jake Causon
90a1032300 fix(network): stringify response headers for intercepted requests (#4436)
Stringifying the headers was the behaviour before v1.15

References #4379
2019-05-20 11:05:32 +03:00
Sergio M
60249e0bc2 fix: Page.setContent working with unicode strings (#4433)
Fix `page.setContent` with unicode strings that exceeds the range of a 8-bit byte.

This patch implements decoding part of the [MDN's solution #4 for the "unicode problem"](https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_4_%E2%80%93_escaping_the_string_before_encoding_it).

Since we rely on node.js buffer to encode into base64, we don't have troubles with base64 encoding, so it is left as-is.

Fixes #4424
2019-05-18 17:15:16 +03:00
Joel Einbinder
a3cb16308c feat: root option in page.accessibility.snapshot() (#4318)
Going from `AXNode` -> `ElementHandle` is turning out to be controversial.

This patch instead adds a way to go from `ElementHandle` -> `AXNode`. If the API looks good, I'll add it into Firefox as well.

References #3641
2019-05-09 23:39:42 -07:00
Joel Einbinder
1516e0df21 feat(workers): create workers from service workers and shared workers (#4397)
This allows users to easily evaluate javascript inside service workers and shared workers by creating a Worker object for them.
2019-05-09 17:29:18 -07:00
Andrey Lushnikov
ef24c69c62
fix(tracing): start without options (#4388) 2019-05-09 17:15:33 -07:00
Tony Brix
511dcf9d32 feat(browser): Add browser.isConnected() (#4403)
Add `browser.isConnected()` to the public api to be able to tell when the browser is connected

fixes https://github.com/smooth-code/jest-puppeteer/pull/237#issuecomment-490260041
2019-05-09 16:24:52 -07:00
Andrey Lushnikov
27c9f754b1
fix(page): teach page.setContent to work with tricky content (#4366)
Fix #4364
2019-04-30 00:35:05 -07:00
Andrey Lushnikov
e2e6b88934
feat(chromium): roll Chromium to r654752 (#4358)
This roll includes:
- https://crrev.com/653809 - FrameLoader: ignore failing provisional loads entirely
- https://crrev.com/654750 - DevTools: make sure Network.requestWillBeSent is emitted on time for sync xhrs

The FrameLoader patch is the reason behind the test change. It's
actually desirable to fail frame navigation if the frame detaches - and
that's consistent with Firefox.

Fixes #4337
2019-04-28 20:19:01 -07:00
Andrey Lushnikov
5e21ba3cbb
feat: update DeviceDescriptors (#4321)
Fetch new DeviceDescriptors from DevTools front-end.
2019-04-22 16:19:21 -07:00
Andrey Lushnikov
e3abb0aa32
feat(puppeteer): introduce puppeteer.errors and puppeteer.devices (#4312)
These getters are introduced as a more convenient substitute for
a `require('puppeteer/Errors')` and
`require('puppeteer/DeviceDescriptors')`.

This way we can make cross-browser story nicer - a single require
of `puppeteer` or `puppeteer-firefox` fully defines Puppeteer
environment.
2019-04-19 15:33:06 -07:00
asteinha
2b68c104aa fix: Removing a dead flag. (#4310)
The `--safebrowsing-disable-auto-update` was removed a while ago.

See ba49d00fdd
2019-04-18 12:51:16 -07:00
Andrey Lushnikov
5ee21d97e7
fix(page): intersect content quads with viewport (#4277)
In certain cases inline element children might be positioned
outside of viewport.

In this case, we should intersect all content quads with viewport
before we pick one to click into.

Fixes #4274.
2019-04-11 21:11:20 -04:00
Andrey Lushnikov
20988775bf
fix: gracefully handle multiple contexts for secondary DOM World (#4276)
In case of multiple sessions to the same target, there's a race between
sessions to create a secondary isolated world. As a result, we might
end up having 2 execution contexts created for the needs of the
secondary isolated world.

This patch starts handling this race gracefully: instead of crashing,
we can use either of the execution contexts and ignore the rest.

Notably, the same race condition might happen if page reloads itself
in-between the calls to `page.addEvaluateOnNewDocument` and
`page.createIsolatedWorld`.

Fixes #4197.
2019-04-11 16:26:18 -04:00
Andrey Lushnikov
2265974ce5
refactor: migrate onto Fetch domain (#4265)
Request interception in Network domain is deprecated.
Move on onto Fetch domain - the new bright future.
2019-04-11 15:02:06 -04:00
Travis Weidenbenner
a79b775430 fix: Allow PUPPETEER_EXECUTABLE_PATH to be set in npmrc and package.json (#4270)
This PR sets fixes the PUPPETEER_EXECUTABLE_PATH environment variable so that it can be set in the .npmrc or package.json like the documentation says.

The npm environment is initialized if puppeteer script is run from-inside `npm run` command.
2019-04-11 14:45:00 -04:00
Sergey Bekrin
08e9a4ddaa fix(launcher): support https for browserURL endpoint (#4268)
Certain setups expose remote browser through an HTTPS proxy. This patch
adds support for `https://` urls for `browserURL` option.
2019-04-11 13:46:55 -04:00
Andrey Lushnikov
19606a3b79
fix: cache disabling should stick when toggling request interception (#4260)
This patch:
- refactors `NetworkManager`/`FrameManager` so that they enable all the
relevant domains themselves. This is a preparation for OOPIF support and
migration onto fetch domain.
- moves `networkManager` ownership into `FrameManager`. This way it's clear who owns what.
- stops enabling Security domain: it saves quite some traffic over
websocket since it no longer sends annoying "SecurityStateChanged" events.
Instead, use `Security.setIgnoreCertificateErrors` method.
- consolidates network cache state in network manager. This even fixes a
bug with caching and request interception interop.
2019-04-10 00:42:42 -04:00
Andrey Lushnikov
2a7c3fe3e6
feat(chromium): roll Chromium to r649004 (#4259)
This roll includes:
- https://crrev.com/648988 - perfetto: Emit trace config in TraceEventMetadataSource
2019-04-08 22:37:11 -07:00
Joseph Arhar
fd0f58e9c2 fix: Use new requestId for interception request matching (#4248)
Fix #3471
2019-04-08 14:17:57 -07:00
Andrey Lushnikov
9d31068225
feat(chromium): roll Chromium to r648643 (#4256)
This roll includes:
- https://crrev.com/648335 -
[DevTools] Send DevTools request ID through URLLoader
- https://crrev.com/648360 -
[DevTools] Add renderer request ID to requestIntercepted

References #3471
2019-04-08 12:11:35 -07:00
Vse Mozhet Byt
854b1c0912 feat(executioncontext): support bigints transferring (#4016)
Refs: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-UnserializableValue
2019-03-15 10:20:48 -07:00
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