Commit Graph

87 Commits

Author SHA1 Message Date
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
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
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
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
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
7001042f79
fix(launcher): properly disable translate UI (#3863)
Fix #3858
2019-01-28 17:19:53 -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
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
Joel Einbinder
568734386d fix(types): fix parameters where they disagree with the api (#3525) 2018-11-12 12:59:21 -08: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
Joel Einbinder
cd54ce388e fix(types): upgrade node types to 8.10.34 (#3341) 2018-10-03 16:59:49 -07:00
Joel Einbinder
c237947b32 chore(types): upgrade to TypeScript 3.1.1 (#3331)
This upgrades  us to TypeScript 3.1.1, which fixes some build failures. Annoyingly TypeScript does a better job of checking `process.stdio`, which exposes that the DefinitelyTyped definition for it is wrong. See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11587. I'll look into submitting a patch for that later.
2018-10-02 13:38:06 -07:00
Andrey Lushnikov
4e48dfc7a1
feat(launcher): add experimental "transport" option to pptr.connect (#3265)
This patch:
- adds experimental "transport" option to pptr.connect
- uses "transport" option to make sure Puppeteer-Web works with
  Target.exposeDevToolsProtocol

Drive-by: add `browser.target()` to access browser target.
2018-09-20 11:55:23 -07:00
Andrey Lushnikov
1b2c8113ba
refactor: move Connection to use ConnectionTransport (#3217)
Currently connection assumes that transport is a websocket
and tries to handle websocket-related errors.

This patch:
- moves ConnectionTransport interface to use callbacks instead
  of events. This way it could be used in browser context as well.
- introduces WebSocketTransport that implements ConnectionTransport
  interface for ws.

This is a preparation step for 2 things:
- exposing `transport` option in the `puppeteer.connect` method
- better support for `browserify`

References #2119
2018-09-07 21:36:16 +01:00
Andrey Lushnikov
f230722ff0
refactor: avoid dynamic requires in lib/ folder (#3208)
This patch removes all dynamic requires in Puppeteer. This should
make it much simpler to bundle puppeteer/puppeteer-core packages.

We used dynamic requires in a few places in lib/:
- BrowserFetcher was choosing between `http` and `https` based on some
  runtime value. This was easy to fix with explicit `require`.
- BrowserFetcher and Launcher needed to know project root to store
  chromium revisions and to read package name and chromium revision from
  package.json. (projectRoot value would be different in node6).
  Instead of doing a backwards logic to infer these
  variables, we now pass them directly from `//index.js`.

With this patch, I was able to bundle Puppeteer using browserify and
the following config in `package.json`:

```json
  "browser": {
    "./lib/BrowserFetcher.js": false,
    "ws": "./lib/BrowserWebSocket",
    "fs": false,
    "child_process": false,
    "rimraf": false,
    "readline": false
  }
```

(where `lib/BrowserWebSocket.js` is a courtesy of @Janpot from
https://github.com/GoogleChrome/puppeteer/pull/2374/)

And command:

```sh
$ browserify -r puppeteer:./index.js > ppweb.js
```

References #2119
2018-09-06 20:33:41 +01:00
Andrey Lushnikov
28d92116b7
feat(puppeteer): support convenience env variables (#3190)
We had (and still have) a ton of pull requests to support
PUPPETEER_EXECUTABLE_PATH and PUPPETEER_CHROMIUM_REVISION in puppeteer launcher.

We were hesitant before since env variables are not scoped
and thus don't make a good interface for a library. Now, since we
determined `puppeteer-core` as a library and `puppeteer` as our end-user
product, it's safe to satisfy our user needs.

This patch:
- teaches PUPPETEER_EXECUTABLE_PATH and PUPPETEER_CHROMIUM_REVISION
  env variables to control how Puppeteer launches browser
- makes sure these variables play no role in `puppeteer-core` package.
2018-09-05 22:59:14 +01:00
Joel Einbinder
3d7ae2a259 fix: fix null-type bugs (#3137)
I ran TypeScript against our code with `strictNullChecks` on. Most of the errors generated are noise, because TypeScript doesn't understand how our `assert` method works. But some were legitimate bugs. They are fixed in this patch.
2018-08-24 15:17:36 -07:00
Andrey Lushnikov
204c7ec8c4
feat: introduce puppeteer/Errors (#3056)
This patch adds a new require, `puppeteer/Errors`, that
holds all the Puppeteer-specific error classes.

Currently, the only custom error class we use is `TimeoutError`. We'll
expand in future with `CrashError` and some others.

Fixes #1694.
2018-08-09 16:51:12 -07:00
Andrey Lushnikov
40466cb3a4
feat(launcher): ignoreDefaultArgs to accept array of options (#3049)
If `ignoreDefaultArgs` is given an array of options, than
these options will be excluded from the default command-line
flags.
2018-08-08 19:10:10 -07:00
Joel Einbinder
6825088644 feat(launcher): allow options to be passed into puppeteer.defaultArgs (#2950) 2018-08-07 13:22:04 -07:00
Joel Einbinder
25632133e2 feat: add option to specify the default viewport (#3005)
Fixes #1183.
2018-08-01 16:23:03 -07:00
Pavel Feldman
14e69d189c fix(pipe): make sure the pipe is not stuck (#2933)
When process is spawned with the 'pipe' set for stdout and stderr, Node expects these streams to be actually dispatched. If we don't, write into pipe becomes blocking and chrome stalls.

We work around that via setting 'ignore' to the stdin, stdout and stderr when the pipe communication channel is used.
2018-07-24 11:36:35 -07:00
Andrey Lushnikov
ca99a67aad
fix(launcher): always add about:blank to default arguments. (#2942)
Chrome Headless used to open about:blank by default; however, this
was recently changed.

We should open starting page no matter what to keep the environment
predictable.
2018-07-24 11:03:30 -07:00
Andrey Lushnikov
670b0c35e4
fix(launcher): do not add --disable-gpu on OSX and Linux (#2908)
This patch conditionally adds the `--disable-gpu` flag if only we
run headless on windows.

Fixes #1260.
2018-07-19 10:19:08 -07:00
Joel Einbinder
22fa00a7b3 fix: wait for the chromeProcess to exit, not close (#2838) 2018-07-05 02:36:49 +03:00
Andrey Lushnikov
d8023726c5
fix: disable OOPIF by default (#2661)
This patch disables OOPIF by default.

**NOTE**: this is a temporary bandaid for the time we're crafting
the full-fledged support for site isolation over DevTools protocol.

References #2548.
2018-06-01 15:20:37 -07:00
Andrey Lushnikov
9955a1e673
fix(browser): ensure first page is created when browser is launched (#2658)
It's impossible to launch chromium without initial page.
This patch makes sure that `puppeteer.launch()` always returns a browser
with at least one page user can connect to.
2018-06-01 13:57:50 -07:00
Andrey Lushnikov
0f8c7e76c2
feat(launcher): disable crash reporting by default (#2652)
This patch disables crash reporting since it's not needed for
automation purposes.

It also deals some troubles for us since crashpad is a separate
process on Windows which has a larger lifetime than chromium.
This, in turn, prevents us from cleaning up profile directory.
2018-05-31 18:17:50 -07:00
Andrey Lushnikov
0b94fa70eb
chore: stop using console.assert everywhere (#2646)
Since Node 10, `console.assert` no longer throws an AssertionError.
(This is generally good since it aligns Node.js with Browsers.)

This patch migrates all usages of `console.assert` in our codebase.
- All the `lib/` and testing code is migrated onto a handmade `assert`
function. This is to make Puppeteer transpilation / bundling easier.
- All the tooling is switched to use Node's `assert` module.

Fixes #2547.
2018-05-31 16:53:51 -07:00
Yaniv Efraim
b8df8bdf4a feat(launcher): launch browser with 'about:blank' by default (#2594)
fixes #2402
2018-05-25 17:26:40 -07:00
Andrey Lushnikov
51645932b7
refactor: do not pass user options to browser constructor (#2562)
This patch starts explicitly passing allowed options to the `Browser`
class. This, for example, makes it impossible to pass `appMode` as
an option to the `pptr.connect`.
2018-05-16 18:09:59 -07:00
Andrey Lushnikov
3b03ff65c7
feat(BrowserContext): introduce Browser Contexts. (#2523)
This patch introduces Browser Contexts and methods to manage them:
- `browser.createIncognitoBrowserContext()` - to create new incognito
  context
- `browser.browserContext()` - to get all existing contexts
- `browserContext.dispose()` - to dispose incognito context.

Fixes #85.
2018-05-10 13:26:08 -07:00
Ran Yitzhaki
8fce3195d6 fix(Launcher): exit the process after killing chrome on SIGINT (#2428)
This is a fix for this issue https://github.com/facebook/jest/issues/5748

In the issue, `puppeteer.launch` method is called from jest `globalSetup` script which [is running on the same process as jest](6a77ee37ec/packages/jest-cli/src/run_jest.js (L242)).

Puppeteer catches `SIGINT` in order to kill chrome, but it also replaces the default behaviour of `SIGINT`, [which is to exit with status code 130](https://nodejs.org/dist/latest-v9.x/docs/api/all.html#process_signal_events). In jest's case, the process does not exit, which keeps the process hanging in a weird way.

This PR makes sure that the process exits after killing chrome.
2018-04-25 15:29:14 -07:00
Andrey Lushnikov
18f2ecdffd
fix(Launcher): launch chrome with --disable-dev-shm-usage by default (#2351)
Fixes #1834.
2018-04-10 20:05:27 -07:00
Andrey Lushnikov
c86c12e605
fix(Launcher): consume protocol errors when initiating browser.close() (#2332)
Handle errors properly while sending Browser.close()

Fixes #1429.
2018-04-09 14:49:02 -07:00
JoelEinbinder
94c32e4bc8 feat(Launcher): introduce pipe option (#2288)
This patch introduces a new `pipe` option to the launcher to connect over a pipe.

In certain environments, exposing web socket for remote debugging is a security risk.
Pipe connection eliminates this risk.
2018-04-03 15:05:27 -07:00
Georgii Dolzhykov
4e1f2e2eb2 fix(Launcher): killing a process can throw (#2102)
In case chrome process was terminated manually, killing the process
might throw 'no process with such pid' exception.
2018-03-15 17:40:24 -07:00
Andrey Lushnikov
c082a82547
fix(Launcher): do not detach child process on windows (#2081)
Fixes #2053.
2018-03-15 11:50:16 -07:00
JoelEinbinder
ffe5b63dba chore: refactor Browser.js into seperate files (#2097)
This patch splits Browser.js into multiple separate files.
2018-02-26 12:10:06 -08:00
Yaniv Efraim
66887743ea fix(Launcher): fix dumpio bug (#2071)
This patch fixes `dumpio` launcher option.

Fixes #2046
2018-02-22 19:06:13 -08:00
Andrey Lushnikov
e8a085ccfb
feat(appMode): support pipes for appMode (#2032)
This patch starts using pipes as a transport to
the browser instance instead of websocket.
2018-02-14 17:51:29 -08:00
Andrey Lushnikov
a363a733b7
feat: Introduce BrowserFetcher class (#1983)
This patch introduces `BrowserFetcher` class that manages
downloaded versions of products.

This patch:
- shapes Downloader API to be minimal yet usable for our needs. This
  includes removing such methods as `Downloader.supportedPlatforms` and
  `Downloader.defaultRevision`.
- makes most of the fs-related methods in Downloader async. The only
  exception is the `Downloader.revisionInfo`: it has stay sync due to the
  `pptr.executablePath()` method being sync.
- updates `install.js` and `utils/check_availability.js` to use new API
- finally, renames `Downloader` into `BrowserFetcher`

Fixes #1748.
2018-02-07 12:31:53 -05:00
Alix Axel
bc6902623a fix: allow timeouts of be 0 (#1964)
This patch fixes timeouts for `puppeteer.launch` and `page.waitForFunction`
to be `0`.

Fixes #1960 .
2018-02-05 17:42:54 -05:00
JoelEinbinder
f2b6016354 chore: switch to npm from yarn (#1878)
This patch:
- migrates CI to use NPM
- drops lockfiles (`yarn.lock`). Lockfiles are ignored by package
  managers when the package is installed as a dependency, so this makes CI closer to the 
  installation our clients run.
2018-01-22 17:11:10 -08:00
Abel Toledano
b61e67d001 feat: add slowMo option to puppeteer.connect (#1864)
This patch introduces a `slowMo` option to the `puppeteer.connect` method. The option
is similar to the one in `puppeteer.launch` and is used to slow down the connection.
2018-01-22 16:45:46 -08:00
yujiosaka
f6b7c13316 chore(install): mention yarn along npm in the error message (#1759) 2018-01-09 21:56:04 -08:00
JoelEinbinder
8a40cd5eef feat(Launcher): allow the default arguments to be overridden (#1623)
This patch:
- adds `puppeteer.defaultArgs()` method to get default arguments that are used to launch chrome
- adds `ignoreDefaultArgs` option to `puppeteer.launch` to avoid using default puppeteer arguments

Fixes #872
2017-12-19 17:51:21 -08:00