mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-02 23:27:28 +03:00
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/
|
||||
**/*.d.ts
|
||||
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.
|
||||
:::
|
||||
|
||||
## 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]>
|
||||
|
@ -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
8
types/types.d.ts
vendored
@ -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.
|
||||
*/
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user