Skip to content

Commit

Permalink
chore hide Download._cancel (#7282)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Jun 23, 2021
1 parent 0d36cec commit b3cc683
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 23 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ browser_patches/*/checkout/
browser_patches/chromium/output/
**/*.d.ts
output/
/test-results/
8 changes: 0 additions & 8 deletions docs/src/api/class-download.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]>
Expand Down
4 changes: 2 additions & 2 deletions tests/download.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
8 changes: 0 additions & 8 deletions types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
5 changes: 0 additions & 5 deletions utils/doclint/missingDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit b3cc683

Please sign in to comment.