chore hide Download._cancel (#7282)
This commit is contained in:
parent
0d36cec600
commit
b3cc683e6b
|
|
@ -15,3 +15,4 @@ browser_patches/*/checkout/
|
||||||
browser_patches/chromium/output/
|
browser_patches/chromium/output/
|
||||||
**/*.d.ts
|
**/*.d.ts
|
||||||
output/
|
output/
|
||||||
|
/test-results/
|
||||||
|
|
|
||||||
|
|
@ -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.
|
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
|
## async method: Download.createReadStream
|
||||||
* langs: java, js, csharp
|
* langs: java, js, csharp
|
||||||
- returns: <[null]|[Readable]>
|
- returns: <[null]|[Readable]>
|
||||||
|
|
|
||||||
|
|
@ -481,7 +481,7 @@ it.describe('download event', () => {
|
||||||
page.waitForEvent('download'),
|
page.waitForEvent('download'),
|
||||||
page.click('a')
|
page.click('a')
|
||||||
]);
|
]);
|
||||||
await download._cancel();
|
await (download as any)._cancel();
|
||||||
const failure = await download.failure();
|
const failure = await download.failure();
|
||||||
expect(failure).toBe('canceled');
|
expect(failure).toBe('canceled');
|
||||||
await page.close();
|
await page.close();
|
||||||
|
|
@ -500,7 +500,7 @@ it.describe('download event', () => {
|
||||||
const path = await download.path();
|
const path = await download.path();
|
||||||
expect(fs.existsSync(path)).toBeTruthy();
|
expect(fs.existsSync(path)).toBeTruthy();
|
||||||
expect(fs.readFileSync(path).toString()).toBe('Hello world');
|
expect(fs.readFileSync(path).toString()).toBe('Hello world');
|
||||||
await download._cancel();
|
await (download as any)._cancel();
|
||||||
const failure = await download.failure();
|
const failure = await download.failure();
|
||||||
expect(failure).toBe(null);
|
expect(failure).toBe(null);
|
||||||
await page.close();
|
await page.close();
|
||||||
|
|
|
||||||
8
types/types.d.ts
vendored
8
types/types.d.ts
vendored
|
|
@ -9479,14 +9479,6 @@ export interface Dialog {
|
||||||
* performed and user has no access to the downloaded files.
|
* performed and user has no access to the downloaded files.
|
||||||
*/
|
*/
|
||||||
export interface Download {
|
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.
|
* Returns readable stream for current download or `null` if download failed.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,6 @@ function paramsForMember(member) {
|
||||||
return new Set(member.argsArray.map(a => a.alias));
|
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
|
* @param {string[]} rootNames
|
||||||
*/
|
*/
|
||||||
|
|
@ -117,8 +114,6 @@ function listMethods(rootNames, apiFileName) {
|
||||||
* @param {string} methodName
|
* @param {string} methodName
|
||||||
*/
|
*/
|
||||||
function shouldSkipMethodByName(className, methodName) {
|
function shouldSkipMethodByName(className, methodName) {
|
||||||
if (allowExperimentalMethods.has(`${className}.${methodName}`))
|
|
||||||
return false;
|
|
||||||
if (methodName.startsWith('_') || methodName === 'T' || methodName === 'toString')
|
if (methodName.startsWith('_') || methodName === 'T' || methodName === 'toString')
|
||||||
return true;
|
return true;
|
||||||
if (/** @type {any} */(EventEmitter).prototype.hasOwnProperty(methodName))
|
if (/** @type {any} */(EventEmitter).prototype.hasOwnProperty(methodName))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue