From b3cc683e6bb2553ff71222b5ab4e44812fc34f3b Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Wed, 23 Jun 2021 23:20:36 +0200 Subject: [PATCH] chore hide Download._cancel (#7282) --- .eslintignore | 1 + docs/src/api/class-download.md | 8 -------- tests/download.spec.ts | 4 ++-- types/types.d.ts | 8 -------- utils/doclint/missingDocs.js | 5 ----- 5 files changed, 3 insertions(+), 23 deletions(-) diff --git a/.eslintignore b/.eslintignore index 9c8e091091..f3e80fe66a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -15,3 +15,4 @@ browser_patches/*/checkout/ browser_patches/chromium/output/ **/*.d.ts output/ +/test-results/ diff --git a/docs/src/api/class-download.md b/docs/src/api/class-download.md index e4aee1c139..7464ebbb88 100644 --- a/docs/src/api/class-download.md +++ b/docs/src/api/class-download.md @@ -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]> diff --git a/tests/download.spec.ts b/tests/download.spec.ts index 0a17250f1d..c803be2a8c 100644 --- a/tests/download.spec.ts +++ b/tests/download.spec.ts @@ -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(); diff --git a/types/types.d.ts b/types/types.d.ts index 5cd0f36320..99ca05c285 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -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; - /** * Returns readable stream for current download or `null` if download failed. */ diff --git a/utils/doclint/missingDocs.js b/utils/doclint/missingDocs.js index ca56e5bf2c..9f209d0388 100644 --- a/utils/doclint/missingDocs.js +++ b/utils/doclint/missingDocs.js @@ -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))