Commit Graph

6 Commits

Author SHA1 Message Date
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
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
Joel Einbinder
02b2451db5 fix: check if async error has a stack (#4017) 2019-03-04 17:32:54 -08:00
Andrey Lushnikov
1890dc04ba
feat(firefox): Page.waitForRequest/Page.waitForResponse (#3989)
Drive-by: refactor `Request.frame()` tests into a separate test suite.
2019-02-12 19:10:14 -08:00
Andrey Lushnikov
6b18e8cef5
feat(firefox): introduce async stacks for Puppeteer-Firefox (#3948)
This patch refactors Puppeteer-Firefox code to declare public
API in `/lib/api.js` and use it to setup async stack hooks
over the public API method calls.
2019-02-07 15:18:43 -08:00
Andrey Lushnikov
1676f9927c
chore(firefox): move sources from //lib/firefox to //lib (#3920) 2019-02-05 18:56:04 -08:00