chore hide Download._cancel (#7282)

This commit is contained in:
Max Schmitt 2021-06-23 23:20:36 +02:00 committed by GitHub
parent 0d36cec600
commit b3cc683e6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 3 additions and 23 deletions

View File

@ -15,3 +15,4 @@ browser_patches/*/checkout/
browser_patches/chromium/output/
**/*.d.ts
output/
/test-results/

View File

@ -62,14 +62,6 @@ downloaded content. If [`option: acceptDownloads`] is not set, download events a
not performed and user has no access to the downloaded files.
:::
## async method: Download._cancel
**Chromium-only** Cancels a download.
Will not fail if the download is already finished or canceled.
Upon successful cancellations, `download.failure()` would resolve to `'canceled'`.
Currently **experimental** and may subject to further changes.
## async method: Download.createReadStream
* langs: java, js, csharp
- returns: <[null]|[Readable]>

View File

@ -481,7 +481,7 @@ it.describe('download event', () => {
page.waitForEvent('download'),
page.click('a')
]);
await download._cancel();
await (download as any)._cancel();
const failure = await download.failure();
expect(failure).toBe('canceled');
await page.close();
@ -500,7 +500,7 @@ it.describe('download event', () => {
const path = await download.path();
expect(fs.existsSync(path)).toBeTruthy();
expect(fs.readFileSync(path).toString()).toBe('Hello world');
await download._cancel();
await (download as any)._cancel();
const failure = await download.failure();
expect(failure).toBe(null);
await page.close();

8
types/types.d.ts vendored
View File

@ -9479,14 +9479,6 @@ export interface Dialog {
* performed and user has no access to the downloaded files.
*/
export interface Download {
/**
* **Chromium-only** Cancels a download. Will not fail if the download is already finished or canceled. Upon successful
* cancellations, `download.failure()` would resolve to `'canceled'`.
*
* Currently **experimental** and may subject to further changes.
*/
_cancel(): Promise<void>;
/**
* Returns readable stream for current download or `null` if download failed.
*/

View File

@ -78,9 +78,6 @@ function paramsForMember(member) {
return new Set(member.argsArray.map(a => a.alias));
}
// Including experimental method names (with a leading underscore) that would be otherwise skipped
const allowExperimentalMethods = new Set([ 'Download._cancel' ]);
/**
* @param {string[]} rootNames
*/
@ -117,8 +114,6 @@ function listMethods(rootNames, apiFileName) {
* @param {string} methodName
*/
function shouldSkipMethodByName(className, methodName) {
if (allowExperimentalMethods.has(`${className}.${methodName}`))
return false;
if (methodName.startsWith('_') || methodName === 'T' || methodName === 'toString')
return true;
if (/** @type {any} */(EventEmitter).prototype.hasOwnProperty(methodName))