Commit Graph

93 Commits

Author SHA1 Message Date
Tim van der Lippe
1ce4fe7169
chore(deps): update extract-zip to version 2 (#5610)
extract-zip removed support for callbacks and instead uses promises. Moreover, it has TypeScript support which allows us to remove the @types/extract-zip package.

This update allows downstream users to remove their installation of mkdirp, which uses a vulnerable version of minimist.

For more info, see https://github.com/maxogden/extract-zip/releases/tag/v2.0.0

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-04-09 21:13:25 +02:00
Maja Frydrychowicz
7f7887ed11
docs(puppeteer-firefox): add deprecation warning to README (#5502) 2020-04-03 13:23:30 +02:00
Changhao Han
807fbbdc20
chore: drop Node.js v8 support (#5365)
* chore: update relevant Node.js versions from 8 to 10

* chore: remove node6 and node8 folders from puppeteer-firefox ci

* fix: loosen definition for proc.stdio

* fix: update typescript version used in npm run test-types
2020-03-10 21:55:32 +01:00
Mathias Bynens
14b2369650
chore: mark puppeteer-firefox version v0.5.1 (#5294) 2020-01-09 16:07:21 +01:00
Mathias Bynens
3a49cfc9f8
chore: move to GitHub hosting for Juggler binaries (#5293) 2020-01-09 15:24:57 +01:00
Mathias Bynens
eddb23b521
chore: update URLs (#5185) 2019-11-26 13:12:25 +01:00
Maja Frydrychowicz
c5a72e9887 feat(launcher): add option to run Puppeteer with different browsers (#5137)
* feat: Set which browser to launch via PUPPETEER_PRODUCT

This change introduces a PUPPETEER_PRODUCT environment
variable as a first step toward using Puppeteer with
many different browsers. Setting PUPPETEER_PRODUCT=firefox, for
example, enables Firefox-specific Launcher settings.

The state is also exposed as `puppeteer.product` in the API
to support adding other product-specific behaviour as needed.

The bulk of the change is a refactoring in Launcher
to decouple generic browser start-up from product-specific
configuration.

Respecting the puppeteer-core restriction for PUPPETEER_
environment variables, lazily instantiate the Launcher
based on a `product` Puppeteer.launch option, if available.

* test: Distinguish Juggler unit tests from Firefox

The funit script is renamed to fjunit (j for Juggler, which is
used only by the experimental puppeteer-firefox package.

In contrast, the funit script now refers to running Puppeteer
unit tests against the main puppeteer package with Firefox.
To do so with Firefox Nightly, run:

`BINARY=path/to/firefox npm run funit`

A number of changes in this patch make it easier to run
Puppeteer unit tests in Mozilla's CI.
2019-11-26 10:23:19 +01:00
Mathias Bynens
a86363fda6
feat(api): add page.emulateMedia{Type,Features} (#5012) 2019-10-23 13:55:00 +02:00
Mathias Bynens
81d2600236 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).
2019-10-23 11:41:44 +02:00
Mathias Bynens
11ff374ca3
chore: drop Node.js v6 support (#5045)
Node.js v6 was end-of-life'd in April, 2019, with AWS Lambda prohibiting updaets to the Node.js v6 runtime since June 30, 2019.

This makes it quite safe for us to remove the Node 6 support from the repository.
2019-10-16 17:00:20 +02:00
Yury Semikhatsky
e0c8d46af1 fix: abort page.waitForRequest/Response when page closes (#4865)
We'd like to pass an abortion signal inside Helper.waitForEvent in order to interrupt it when browser/page closes. Several approaches have been considered:

1. Pass CDPSession instance as a another parameter to the helper method and listen to Disconnected event on it. It would introduce undesired dependency on the session object.
2. Listen to the CDPSession closure at the call sites (e.g. waitForRequest) and pass an abortion promise which would be fulfilled when such event is fired. The listeners would have to be removed from the session on successful completion of waitForEvent so we'd have to pass some kind of DisposablePromise which would be disposed during cleanup. Such parameter looked somewhat hairy.
3. Create DisconnectPromise on CDPSession. One potential risk with that is all chained promises would hang around until the event is fired which might inadvertently cause memory leaks. On the other hand, adding such promise to Promise.race will remove dependency as soon as the race is finished. So this is the approach we're taking with one tweak: the promise is created locally inside Page. 

Ideally the disconnectPromise would throw when the session is closed but it may lead to uncaught promise errors if all chained promises are resolved, to avoid that the promise is resolved with an Error and Helper.waitForEvent throws it later.

Fix #4733
2019-08-21 10:26:48 -07:00
Andrey Lushnikov
417981aafa
fix(firefox): fix cookies in default browser context (#4850)
This patch adds tests and fixes the nodejs part of the problem.
The issue will be fixed once we roll a new version of Firefox.

References #4470
2019-08-15 11:52:02 -07:00
Darío Kondratiuk
b9b6ca1825 fix(network): be able to remove headers using request.continue (#4797)
I think this was a regression caused here https://github.com/GoogleChrome/puppeteer/pull/4265/files#diff-d2ac7cb061b0c51644d0a5d6140e3a32R446

Fix #4743
2019-08-05 15:26:17 -07:00
Paul Irish
cc805e750c chore(readme): fix typo (#4749)
s/availabe/available
2019-07-29 14:24:48 -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
Andrey Sidorov
2d99d85976 fix(firefox): error message typo (#4623) 2019-06-26 10:58:05 -07:00
Andrey Lushnikov
6a50888d34
fix(firefox): fix missing awaits in mouse.click (#4561)
This applies the same fix we used on the Chrome-side and adds a test.

Fix #4536
2019-06-10 16:53:38 -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
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
Harald Kirschner
de18c0e26b docs(firefox): Adding bug reference & prototype clarification to juggler (#4402)
Given that the readme is the current source of truth for most users that are interested in Juggler, this tries to further clarify the experimental nature of the project and the follow up work happening on the Firefox side.
2019-05-09 16:27:10 -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
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
Andrey Lushnikov
e3a4f3411c
feat(firefox): roll Firefox to 765beffc (#4156)
This roll fixes flaky request interception in Firefox and moves
`Page.console` event to the Runtime domain.
2019-03-11 17:56:16 -07:00
Andrey Lushnikov
42351c7fe5
feat(firefox): Implement header overrides in request interception (#4142)
This patch makes sure header overrides in request interception are
functioning as expected.

Drive-by: teach test server to use utf-8 charset header for text files.
2019-03-08 14:26:13 -08:00
Joel Einbinder
02b2451db5 fix: check if async error has a stack (#4017) 2019-03-04 17:32:54 -08:00
Andrey Lushnikov
bc28f3b3dc
fix(firefox): fix executablePath() on OSX (#4105)
OSX might have case-sensitive partitions, so make sure we're precise.

Fix #4102
2019-03-04 14:19:28 -08:00
Andrey Lushnikov
c9f6a3d064
chore(firefox): bump version to v0.5.0 (#4089) 2019-02-28 16:43:52 -08:00
Joel Einbinder
a6d8ecce6f fix(firefox): keyboard tests (#4082) 2019-02-27 15:13:17 -08:00
Andrey Lushnikov
dae998ec06
fix(firefox): enable domains in a proper order (#4077)
Otherwise we might get console messages from Page domain before
we get execution contexts reported.
2019-02-26 16:52:50 -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
Joel Einbinder
03d06f54d6 feat(firefox): page.accessibility.snapshot() (#4071) 2019-02-25 21:57:33 -08:00
Andrey Lushnikov
f21486fa1b
feat(firefox): implement Page.touchscreen (#4070) 2019-02-25 15:36:38 -08:00
Andrey Lushnikov
77a4ea505e
test: split out fixture tests and make them work with FF (#4067)
Drive-By: give Puppeteer-Firefox its own copy of DeviceDescriptors.
2019-02-25 12:40:17 -08:00
Andrey Lushnikov
d04a8d55b4
refactor(firefox): split out DOMWorld (#4066) 2019-02-25 11:43:54 -08:00
Andrey Lushnikov
4ecbd91e4b
refactor(firefox): migrate onto ExecutionContext events (#4064)
Juggler now has Runtime domain that emits Execution Context events
"ExecutionContextCreated" and "ExecutionContextDestroyed".
2019-02-24 23:07:24 -08:00
Andrey Lushnikov
56dafd7424
feat: support Response.buffer(), Response.json() and Response.text() (#4063)
This patch:
- implements Response.buffer() and other methods
- splits out relevant tests into a separate test suites
- implements `testServer.enableGzip()` method to optionally gzip
  certain routes in tests
- adds tests to make sure `Response.text()` returns expected results
  for binary and compressed responses.
2019-02-24 19:31:35 -08:00
Andrey Lushnikov
3bea5d6017
feat(firefox): implement browserContext.overridePermissions (#4060) 2019-02-22 23:59:32 -08:00
Andrey Lushnikov
f1a14fec5b
feat(firefox): support elementHandle.uploadFile (#4058)
Fixes #3762
2019-02-22 17:22:46 -08:00
Andrey Lushnikov
1315dc8234
feat(firefox): support Page.emualteMedia (#4056) 2019-02-22 14:04:40 -08:00
Andrey Lushnikov
5c818368a5
feat(firefox): implement page.exposeFunction (#4052) 2019-02-22 00:04:25 -08:00
Andrey Lushnikov
ed984ac479
chore(firefox): kill original puppeteer-firefox tests (#4047)
When we started working on Puppeteer-Firefox, we forked original
Puppeteer testsuite.

This patch concludes the effort to merge testsuites back together.

Fixes #3889
2019-02-21 13:10:15 -08:00
Andrey Lushnikov
a0fd2ce3fd
fix(firefox): enable more tests (#4037)
Further align Puppeteer-Firefox implementation with Puppeteer to
pass more tests.
2019-02-19 22:36:02 -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
719ee5af3d
feat(firefox): support page.setExtraHTTPHeaders (#4035) 2019-02-19 15:22:12 -08:00
Andrey Lushnikov
c118b208fa
feat(firefox): basic request interception support (#4034)
This patch implements `page.setRequestInterception`, `page.continue`
and `page.abort` methods.
2019-02-19 14:51:56 -08:00
Andrey Lushnikov
3b180923a6
refactor(firefox): migrate onto Juggler flatten protocol (#4033)
Juggler now implements the same "flatten" protocol as CDP.
This patch:

* copies `Connection.js` from original Puppeteer (with a few renames, e.g. `CDPSesssion` -> `JugglerSession`).
* migrates code to support protocol-level sessions
2019-02-19 13:20:39 -08:00
Andrey Lushnikov
4a4793a5e1
feat(firefox): support Browser.target() (#4028)
Support browser target.

Drive-by: switch over to a more devtools'ish protocol:

- use `targetId` instead of `pageId` everywhere
- use target events instead of tab events
2019-02-17 10:23:48 -08:00
Andrey Lushnikov
ea482c4751
fix(firefox): properly cleanup networkmanager (#4024) 2019-02-15 23:34:01 -08:00