This PR fixes the following edge case:
- `const oldPromise = world.puppeteerUtil`.
- setContext occurs but context is immediately destroyed, i.e.
`world.#puppeteerUtil === oldPromise` is not resolved.
- clearContext occurs due to destruction, i.e. `world.#puppeteerUtil` is
replaced (`world.#puppeteerUtil !== oldPromise`).
- `oldPromise` never resolves.
Since we moved to the central binaries cache it does not make sense to
clean up old binaries automatically because multiple installations can
use different versions. We expect the users to clean the cache from time
to time until we offer a CLI for managing the browsers.
Closes#9533
Issue: #9394
**What kind of change does this PR introduce?**
Feature - Added support of the `referrerPolicy` parameter (from CDP's
`Page.navigate`) to Puppeteer's `page.goto`.
**Did you add tests for your changes?**
No, currently it has no meaning that isn't browser implementation based,
which might get broken in the future. If there are suggestions to tests,
please let me know so I'll add them.
**If relevant, did you update the documentation?**
Yes, the documentation of the `goto` method has been updated.
**Summary**
I wanted to contribute to this project, which I used for testing on our
environment and saw issue #9394, so I decided to resolve it :)
**Does this PR introduce a breaking change?**
No. I added the `referrerPolicy` as an optional parameter, which will
use the HTTP header `Referrer-Policy` if not provided (much like the
`referer` parameter) so it will not interfere.
Co-authored-by: Ophir Back <ophir.back@broadcom.com>
The third_party folder is compiled with tsc and then rolled up in-place.
This means that the next build might try to compile the file that has
been rolled up leading to build errors. It seems the safest solution is
to always rebuild third_party folder as the size is relatively small.
The only drawback of adding overrides is that our documentation
generator would generate a page for each overload which might be hard to
read/find on the documentation website.
Closes#9512#9385
<!-- Thanks for submitting a pull request! Please provide enough
information so that others can review your pull request. -->
**What kind of change does this PR introduce?**
types fix
**Did you add tests for your changes?**
No
**If relevant, did you update the documentation?**
Not relevant
**Summary**
I am updating `import`s of `devtools-protocol` to always use named
import instead of the default.
For some reason, typescript doesn't understand when it is imported as
default.
```
node_modules/puppeteer-core/lib/esm/puppeteer/common/TargetManager.d.ts:23:59 - error TS2694: Namespace '"/Users/kyrylo/pacakge/node_modules/puppeteer-core/node_modules/devtools-protocol/types/protocol"' has no exported member 'Target'.
23 export declare type TargetFactory = (targetInfo: Protocol.Target.TargetInfo, session?: CDPSession) => Target;
~~~~~~
Found 1 error in node_modules/puppeteer-core/lib/esm/puppeteer/common/TargetManager.d.ts:23
```
**Does this PR introduce a breaking change?**
No
<!-- If this PR introduces a breaking change, please describe the impact
and a migration path for existing applications. -->
**Other information**
I am updating `import`s of `devtools-protocol` to always use named
import instead of the default.