From 0b7f0216e9c6da12607a54b57b551fda9086645a Mon Sep 17 00:00:00 2001
From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
Date: Thu, 21 Sep 2023 11:09:27 +0200
Subject: [PATCH] chore: remove docs warnings (#10959)
---
docs/api/puppeteer.browser.md | 2 +-
docs/api/puppeteer.browser.pages.md | 2 +-
docs/api/puppeteer.page.bringtofront.md | 2 +-
docs/api/puppeteer.page.browser.md | 2 +-
docs/api/puppeteer.page.browsercontext.md | 2 +-
docs/api/puppeteer.page.close.md | 2 +-
.../puppeteer.page.evaluateonnewdocument.md | 2 +-
docs/api/puppeteer.page.frames.md | 2 +-
docs/api/puppeteer.page.getdefaulttimeout.md | 2 +-
docs/api/puppeteer.page.isclosed.md | 2 +-
docs/api/puppeteer.page.mainframe.md | 2 +-
docs/api/puppeteer.page.pdf.md | 2 +-
docs/api/puppeteer.page.reload.md | 2 +-
...age.removescripttoevaluateonnewdocument.md | 4 +-
docs/api/puppeteer.page.screenshot.md | 2 +-
docs/api/puppeteer.page.screenshot_1.md | 2 +-
docs/api/puppeteer.page.screenshot_2.md | 2 +-
...peteer.page.setdefaultnavigationtimeout.md | 2 +-
docs/api/puppeteer.page.setdefaulttimeout.md | 2 +-
docs/api/puppeteer.page.setviewport.md | 2 +-
docs/api/puppeteer.page.viewport.md | 2 +-
docs/api/puppeteer.page.waitfornetworkidle.md | 2 +-
docs/api/puppeteer.page.waitforrequest.md | 2 +-
docs/api/puppeteer.page.waitforresponse.md | 2 +-
packages/puppeteer-core/src/api/Browser.ts | 2 +-
packages/puppeteer-core/src/api/Page.ts | 118 +++++-------------
.../src/cdp/EmulationManager.ts | 10 +-
.../puppeteer-core/src/util/disposable.ts | 4 +-
packages/puppeteer-core/src/util/util.ts | 1 +
29 files changed, 67 insertions(+), 118 deletions(-)
diff --git a/docs/api/puppeteer.browser.md b/docs/api/puppeteer.browser.md
index c32ab0f0..f56a7335 100644
--- a/docs/api/puppeteer.browser.md
+++ b/docs/api/puppeteer.browser.md
@@ -71,7 +71,7 @@ await browser2.close();
| [disconnect()](./puppeteer.browser.disconnect.md) | | Disconnects Puppeteer from this [browser](./puppeteer.browser.md), but leaves the process running. |
| [isConnected()](./puppeteer.browser.isconnected.md) | | Whether Puppeteer is connected to this [browser](./puppeteer.browser.md). |
| [newPage()](./puppeteer.browser.newpage.md) | | Creates a new [page](./puppeteer.page.md) in the [default browser context](./puppeteer.browser.defaultbrowsercontext.md). |
-| [pages()](./puppeteer.browser.pages.md) | |
Gets a list of all open [pages](./puppeteer.page.md) inside this .
If there ar multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [pages](./puppeteer.page.md) in all [browser contexts](./puppeteer.browsercontext.md).
|
+| [pages()](./puppeteer.browser.pages.md) | | Gets a list of all open [pages](./puppeteer.page.md) inside this [Browser](./puppeteer.browser.md).
If there ar multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [pages](./puppeteer.page.md) in all [browser contexts](./puppeteer.browsercontext.md).
|
| [process()](./puppeteer.browser.process.md) | | Gets the associated [ChildProcess](https://nodejs.org/api/child_process.html#class-childprocess). |
| [target()](./puppeteer.browser.target.md) | | Gets the [target](./puppeteer.target.md) associated with the [default browser context](./puppeteer.browser.defaultbrowsercontext.md)). |
| [targets()](./puppeteer.browser.targets.md) | | Gets all active [targets](./puppeteer.target.md).
In case of multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [targets](./puppeteer.target.md) in all [browser contexts](./puppeteer.browsercontext.md).
|
diff --git a/docs/api/puppeteer.browser.pages.md b/docs/api/puppeteer.browser.pages.md
index 98cf276e..bdd10a03 100644
--- a/docs/api/puppeteer.browser.pages.md
+++ b/docs/api/puppeteer.browser.pages.md
@@ -4,7 +4,7 @@ sidebar_label: Browser.pages
# Browser.pages() method
-Gets a list of all open [pages](./puppeteer.page.md) inside this .
+Gets a list of all open [pages](./puppeteer.page.md) inside this [Browser](./puppeteer.browser.md).
If there ar multiple [browser contexts](./puppeteer.browsercontext.md), this returns all [pages](./puppeteer.page.md) in all [browser contexts](./puppeteer.browsercontext.md).
diff --git a/docs/api/puppeteer.page.bringtofront.md b/docs/api/puppeteer.page.bringtofront.md
index b926752b..c6f498e6 100644
--- a/docs/api/puppeteer.page.bringtofront.md
+++ b/docs/api/puppeteer.page.bringtofront.md
@@ -10,7 +10,7 @@ Brings page to front (activates tab).
```typescript
class Page {
- bringToFront(): Promise;
+ abstract bringToFront(): Promise;
}
```
diff --git a/docs/api/puppeteer.page.browser.md b/docs/api/puppeteer.page.browser.md
index 486fe01d..0a86bb6e 100644
--- a/docs/api/puppeteer.page.browser.md
+++ b/docs/api/puppeteer.page.browser.md
@@ -10,7 +10,7 @@ Get the browser the page belongs to.
```typescript
class Page {
- browser(): Browser;
+ abstract browser(): Browser;
}
```
diff --git a/docs/api/puppeteer.page.browsercontext.md b/docs/api/puppeteer.page.browsercontext.md
index 4072d57b..e7c01a96 100644
--- a/docs/api/puppeteer.page.browsercontext.md
+++ b/docs/api/puppeteer.page.browsercontext.md
@@ -10,7 +10,7 @@ Get the browser context that the page belongs to.
```typescript
class Page {
- browserContext(): BrowserContext;
+ abstract browserContext(): BrowserContext;
}
```
diff --git a/docs/api/puppeteer.page.close.md b/docs/api/puppeteer.page.close.md
index 38589745..2ff1c9ca 100644
--- a/docs/api/puppeteer.page.close.md
+++ b/docs/api/puppeteer.page.close.md
@@ -8,7 +8,7 @@ sidebar_label: Page.close
```typescript
class Page {
- close(options?: {runBeforeUnload?: boolean}): Promise;
+ abstract close(options?: {runBeforeUnload?: boolean}): Promise;
}
```
diff --git a/docs/api/puppeteer.page.evaluateonnewdocument.md b/docs/api/puppeteer.page.evaluateonnewdocument.md
index 36376fe1..9c46194d 100644
--- a/docs/api/puppeteer.page.evaluateonnewdocument.md
+++ b/docs/api/puppeteer.page.evaluateonnewdocument.md
@@ -16,7 +16,7 @@ The function is invoked after the document was created but before any of its scr
```typescript
class Page {
- evaluateOnNewDocument<
+ abstract evaluateOnNewDocument<
Params extends unknown[],
Func extends (...args: Params) => unknown = (...args: Params) => unknown,
>(
diff --git a/docs/api/puppeteer.page.frames.md b/docs/api/puppeteer.page.frames.md
index 385e465c..3c1d369e 100644
--- a/docs/api/puppeteer.page.frames.md
+++ b/docs/api/puppeteer.page.frames.md
@@ -10,7 +10,7 @@ An array of all frames attached to the page.
```typescript
class Page {
- frames(): Frame[];
+ abstract frames(): Frame[];
}
```
diff --git a/docs/api/puppeteer.page.getdefaulttimeout.md b/docs/api/puppeteer.page.getdefaulttimeout.md
index 3acaec3c..e9e13bb9 100644
--- a/docs/api/puppeteer.page.getdefaulttimeout.md
+++ b/docs/api/puppeteer.page.getdefaulttimeout.md
@@ -10,7 +10,7 @@ Maximum time in milliseconds.
```typescript
class Page {
- getDefaultTimeout(): number;
+ abstract getDefaultTimeout(): number;
}
```
diff --git a/docs/api/puppeteer.page.isclosed.md b/docs/api/puppeteer.page.isclosed.md
index 11af7cce..b34a477d 100644
--- a/docs/api/puppeteer.page.isclosed.md
+++ b/docs/api/puppeteer.page.isclosed.md
@@ -10,7 +10,7 @@ Indicates that the page has been closed.
```typescript
class Page {
- isClosed(): boolean;
+ abstract isClosed(): boolean;
}
```
diff --git a/docs/api/puppeteer.page.mainframe.md b/docs/api/puppeteer.page.mainframe.md
index 383bbe5f..a9a395ab 100644
--- a/docs/api/puppeteer.page.mainframe.md
+++ b/docs/api/puppeteer.page.mainframe.md
@@ -10,7 +10,7 @@ The page's main frame.
```typescript
class Page {
- mainFrame(): Frame;
+ abstract mainFrame(): Frame;
}
```
diff --git a/docs/api/puppeteer.page.pdf.md b/docs/api/puppeteer.page.pdf.md
index e96e341e..59a1a596 100644
--- a/docs/api/puppeteer.page.pdf.md
+++ b/docs/api/puppeteer.page.pdf.md
@@ -10,7 +10,7 @@ Generates a PDF of the page with the `print` CSS media type.
```typescript
class Page {
- pdf(options?: PDFOptions): Promise;
+ abstract pdf(options?: PDFOptions): Promise;
}
```
diff --git a/docs/api/puppeteer.page.reload.md b/docs/api/puppeteer.page.reload.md
index bb00e2a2..a4268d40 100644
--- a/docs/api/puppeteer.page.reload.md
+++ b/docs/api/puppeteer.page.reload.md
@@ -10,7 +10,7 @@ Reloads the page.
```typescript
class Page {
- reload(options?: WaitForOptions): Promise;
+ abstract reload(options?: WaitForOptions): Promise;
}
```
diff --git a/docs/api/puppeteer.page.removescripttoevaluateonnewdocument.md b/docs/api/puppeteer.page.removescripttoevaluateonnewdocument.md
index ca3d45d3..70a8d617 100644
--- a/docs/api/puppeteer.page.removescripttoevaluateonnewdocument.md
+++ b/docs/api/puppeteer.page.removescripttoevaluateonnewdocument.md
@@ -10,7 +10,9 @@ Removes script that injected into page by Page.evaluateOnNewDocument.
```typescript
class Page {
- removeScriptToEvaluateOnNewDocument(identifier: string): Promise;
+ abstract removeScriptToEvaluateOnNewDocument(
+ identifier: string
+ ): Promise;
}
```
diff --git a/docs/api/puppeteer.page.screenshot.md b/docs/api/puppeteer.page.screenshot.md
index 3ccd2d5c..30c780eb 100644
--- a/docs/api/puppeteer.page.screenshot.md
+++ b/docs/api/puppeteer.page.screenshot.md
@@ -10,7 +10,7 @@ Captures screenshot of the current page.
```typescript
class Page {
- screenshot(
+ abstract screenshot(
options: ScreenshotOptions & {
encoding: 'base64';
}
diff --git a/docs/api/puppeteer.page.screenshot_1.md b/docs/api/puppeteer.page.screenshot_1.md
index fa03a877..71b55355 100644
--- a/docs/api/puppeteer.page.screenshot_1.md
+++ b/docs/api/puppeteer.page.screenshot_1.md
@@ -8,7 +8,7 @@ sidebar_label: Page.screenshot_1
```typescript
class Page {
- screenshot(
+ abstract screenshot(
options?: ScreenshotOptions & {
encoding?: 'binary';
}
diff --git a/docs/api/puppeteer.page.screenshot_2.md b/docs/api/puppeteer.page.screenshot_2.md
index 75e566b9..6d1bb2b2 100644
--- a/docs/api/puppeteer.page.screenshot_2.md
+++ b/docs/api/puppeteer.page.screenshot_2.md
@@ -8,7 +8,7 @@ sidebar_label: Page.screenshot_2
```typescript
class Page {
- screenshot(options?: ScreenshotOptions): Promise;
+ abstract screenshot(options?: ScreenshotOptions): Promise;
}
```
diff --git a/docs/api/puppeteer.page.setdefaultnavigationtimeout.md b/docs/api/puppeteer.page.setdefaultnavigationtimeout.md
index da6f76ad..4e0da44c 100644
--- a/docs/api/puppeteer.page.setdefaultnavigationtimeout.md
+++ b/docs/api/puppeteer.page.setdefaultnavigationtimeout.md
@@ -22,7 +22,7 @@ This setting will change the default maximum navigation time for the following m
```typescript
class Page {
- setDefaultNavigationTimeout(timeout: number): void;
+ abstract setDefaultNavigationTimeout(timeout: number): void;
}
```
diff --git a/docs/api/puppeteer.page.setdefaulttimeout.md b/docs/api/puppeteer.page.setdefaulttimeout.md
index cc3f8757..80d24ffb 100644
--- a/docs/api/puppeteer.page.setdefaulttimeout.md
+++ b/docs/api/puppeteer.page.setdefaulttimeout.md
@@ -8,7 +8,7 @@ sidebar_label: Page.setDefaultTimeout
```typescript
class Page {
- setDefaultTimeout(timeout: number): void;
+ abstract setDefaultTimeout(timeout: number): void;
}
```
diff --git a/docs/api/puppeteer.page.setviewport.md b/docs/api/puppeteer.page.setviewport.md
index 6d8b85a3..f1da2844 100644
--- a/docs/api/puppeteer.page.setviewport.md
+++ b/docs/api/puppeteer.page.setviewport.md
@@ -12,7 +12,7 @@ In the case of multiple pages in a single browser, each page can have its own vi
```typescript
class Page {
- setViewport(viewport: Viewport): Promise;
+ abstract setViewport(viewport: Viewport): Promise;
}
```
diff --git a/docs/api/puppeteer.page.viewport.md b/docs/api/puppeteer.page.viewport.md
index 1162d99a..e860fd4d 100644
--- a/docs/api/puppeteer.page.viewport.md
+++ b/docs/api/puppeteer.page.viewport.md
@@ -10,7 +10,7 @@ Current page viewport settings.
```typescript
class Page {
- viewport(): Viewport | null;
+ abstract viewport(): Viewport | null;
}
```
diff --git a/docs/api/puppeteer.page.waitfornetworkidle.md b/docs/api/puppeteer.page.waitfornetworkidle.md
index 06218c35..42cbedb2 100644
--- a/docs/api/puppeteer.page.waitfornetworkidle.md
+++ b/docs/api/puppeteer.page.waitfornetworkidle.md
@@ -8,7 +8,7 @@ sidebar_label: Page.waitForNetworkIdle
```typescript
class Page {
- waitForNetworkIdle(options?: {
+ abstract waitForNetworkIdle(options?: {
idleTime?: number;
timeout?: number;
}): Promise;
diff --git a/docs/api/puppeteer.page.waitforrequest.md b/docs/api/puppeteer.page.waitforrequest.md
index 1ebb725b..f1c1df23 100644
--- a/docs/api/puppeteer.page.waitforrequest.md
+++ b/docs/api/puppeteer.page.waitforrequest.md
@@ -8,7 +8,7 @@ sidebar_label: Page.waitForRequest
```typescript
class Page {
- waitForRequest(
+ abstract waitForRequest(
urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise),
options?: {
timeout?: number;
diff --git a/docs/api/puppeteer.page.waitforresponse.md b/docs/api/puppeteer.page.waitforresponse.md
index 6ba36902..130a3204 100644
--- a/docs/api/puppeteer.page.waitforresponse.md
+++ b/docs/api/puppeteer.page.waitforresponse.md
@@ -8,7 +8,7 @@ sidebar_label: Page.waitForResponse
```typescript
class Page {
- waitForResponse(
+ abstract waitForResponse(
urlOrPredicate:
| string
| ((res: HTTPResponse) => boolean | Promise),
diff --git a/packages/puppeteer-core/src/api/Browser.ts b/packages/puppeteer-core/src/api/Browser.ts
index 214f950e..155e6027 100644
--- a/packages/puppeteer-core/src/api/Browser.ts
+++ b/packages/puppeteer-core/src/api/Browser.ts
@@ -415,7 +415,7 @@ export abstract class Browser extends EventEmitter {
}
/**
- * Gets a list of all open {@link Page | pages} inside this {@link browser}.
+ * Gets a list of all open {@link Page | pages} inside this {@link Browser}.
*
* If there ar multiple {@link BrowserContext | browser contexts}, this
* returns all {@link Page | pages} in all
diff --git a/packages/puppeteer-core/src/api/Page.ts b/packages/puppeteer-core/src/api/Page.ts
index 14768def..066d6cc5 100644
--- a/packages/puppeteer-core/src/api/Page.ts
+++ b/packages/puppeteer-core/src/api/Page.ts
@@ -682,16 +682,12 @@ export abstract class Page extends EventEmitter {
/**
* Get the browser the page belongs to.
*/
- browser(): Browser {
- throw new Error('Not implemented');
- }
+ abstract browser(): Browser;
/**
* Get the browser context that the page belongs to.
*/
- browserContext(): BrowserContext {
- throw new Error('Not implemented');
- }
+ abstract browserContext(): BrowserContext;
/**
* The page's main frame.
@@ -699,9 +695,7 @@ export abstract class Page extends EventEmitter {
* @remarks
* Page is guaranteed to have a main frame which persists during navigations.
*/
- mainFrame(): Frame {
- throw new Error('Not implemented');
- }
+ abstract mainFrame(): Frame;
/**
* Creates a Chrome Devtools Protocol session attached to the page.
@@ -713,9 +707,7 @@ export abstract class Page extends EventEmitter {
/**
* {@inheritDoc Keyboard}
*/
- get keyboard(): Keyboard {
- throw new Error('Not implemented');
- }
+ abstract get keyboard(): Keyboard;
/**
* {@inheritDoc Touchscreen}
@@ -727,30 +719,22 @@ export abstract class Page extends EventEmitter {
/**
* {@inheritDoc Coverage}
*/
- get coverage(): Coverage {
- throw new Error('Not implemented');
- }
+ abstract get coverage(): Coverage;
/**
* {@inheritDoc Tracing}
*/
- get tracing(): Tracing {
- throw new Error('Not implemented');
- }
+ abstract get tracing(): Tracing;
/**
* {@inheritDoc Accessibility}
*/
- get accessibility(): Accessibility {
- throw new Error('Not implemented');
- }
+ abstract get accessibility(): Accessibility;
/**
* An array of all frames attached to the page.
*/
- frames(): Frame[] {
- throw new Error('Not implemented');
- }
+ abstract frames(): Frame[];
/**
* All of the dedicated {@link
@@ -890,25 +874,17 @@ export abstract class Page extends EventEmitter {
* - {@link Page.waitForNavigation | page.waitForNavigation(options)}
* @param timeout - Maximum navigation time in milliseconds.
*/
- setDefaultNavigationTimeout(timeout: number): void;
- setDefaultNavigationTimeout(): void {
- throw new Error('Not implemented');
- }
+ abstract setDefaultNavigationTimeout(timeout: number): void;
/**
* @param timeout - Maximum time in milliseconds.
*/
- setDefaultTimeout(timeout: number): void;
- setDefaultTimeout(): void {
- throw new Error('Not implemented');
- }
+ abstract setDefaultTimeout(timeout: number): void;
/**
* Maximum time in milliseconds.
*/
- getDefaultTimeout(): number {
- throw new Error('Not implemented');
- }
+ abstract getDefaultTimeout(): number;
/**
* Creates a locator for the provided selector. See {@link Locator} for
@@ -1579,10 +1555,7 @@ export abstract class Page extends EventEmitter {
* multiple redirects, the navigation will resolve with the response of the
* last redirect.
*/
- async reload(options?: WaitForOptions): Promise;
- async reload(): Promise {
- throw new Error('Not implemented');
- }
+ abstract reload(options?: WaitForOptions): Promise;
/**
* Waits for the page to navigate to a new URL or to reload. It is useful when
@@ -1640,13 +1613,10 @@ export abstract class Page extends EventEmitter {
* `0` to disable the timeout. The default value can be changed by using the
* {@link Page.setDefaultTimeout} method.
*/
- async waitForRequest(
+ abstract waitForRequest(
urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise),
options?: {timeout?: number}
): Promise;
- async waitForRequest(): Promise {
- throw new Error('Not implemented');
- }
/**
* @param urlOrPredicate - A URL or predicate to wait for.
@@ -1675,27 +1645,21 @@ export abstract class Page extends EventEmitter {
* pass `0` to disable the timeout. The default value can be changed by using
* the {@link Page.setDefaultTimeout} method.
*/
- async waitForResponse(
+ abstract waitForResponse(
urlOrPredicate:
| string
| ((res: HTTPResponse) => boolean | Promise),
options?: {timeout?: number}
): Promise;
- async waitForResponse(): Promise {
- throw new Error('Not implemented');
- }
/**
* @param options - Optional waiting parameters
* @returns Promise which resolves when network is idle
*/
- async waitForNetworkIdle(options?: {
+ abstract waitForNetworkIdle(options?: {
idleTime?: number;
timeout?: number;
}): Promise;
- async waitForNetworkIdle(): Promise {
- throw new Error('Not implemented');
- }
/**
* @internal
@@ -1841,9 +1805,7 @@ export abstract class Page extends EventEmitter {
/**
* Brings page to front (activates tab).
*/
- async bringToFront(): Promise {
- throw new Error('Not implemented');
- }
+ abstract bringToFront(): Promise;
/**
* Emulates a given device's metrics and user agent.
@@ -2121,10 +2083,7 @@ export abstract class Page extends EventEmitter {
* NOTE: in certain cases, setting viewport will reload the page in order to
* set the isMobile or hasTouch properties.
*/
- async setViewport(viewport: Viewport): Promise;
- async setViewport(): Promise {
- throw new Error('Not implemented');
- }
+ abstract setViewport(viewport: Viewport): Promise;
/**
* Current page viewport settings.
@@ -2147,9 +2106,7 @@ export abstract class Page extends EventEmitter {
* - `isLandScape`: Specifies if viewport is in landscape mode. Defaults to
* `false`.
*/
- viewport(): Viewport | null {
- throw new Error('Not implemented');
- }
+ abstract viewport(): Viewport | null;
/**
* Evaluates a function in the page's context and returns the result.
@@ -2244,26 +2201,22 @@ export abstract class Page extends EventEmitter {
* await page.evaluateOnNewDocument(preloadFile);
* ```
*/
- async evaluateOnNewDocument<
+ abstract evaluateOnNewDocument<
Params extends unknown[],
Func extends (...args: Params) => unknown = (...args: Params) => unknown,
>(
pageFunction: Func | string,
...args: Params
): Promise;
- async evaluateOnNewDocument(): Promise {
- throw new Error('Not implemented');
- }
/**
* Removes script that injected into page by Page.evaluateOnNewDocument.
*
* @param identifier - script identifier
*/
- async removeScriptToEvaluateOnNewDocument(identifier: string): Promise;
- async removeScriptToEvaluateOnNewDocument(): Promise {
- throw new Error('Not implemented');
- }
+ abstract removeScriptToEvaluateOnNewDocument(
+ identifier: string
+ ): Promise;
/**
* Toggles ignoring cache for each request based on the enabled state. By
@@ -2338,16 +2291,13 @@ export abstract class Page extends EventEmitter {
* @returns Promise which resolves to buffer or a base64 string (depending on
* the value of `encoding`) with captured screenshot.
*/
- screenshot(
+ abstract screenshot(
options: ScreenshotOptions & {encoding: 'base64'}
): Promise;
- screenshot(
+ abstract screenshot(
options?: ScreenshotOptions & {encoding?: 'binary'}
): Promise;
- async screenshot(options?: ScreenshotOptions): Promise;
- async screenshot(): Promise {
- throw new Error('Not implemented');
- }
+ abstract screenshot(options?: ScreenshotOptions): Promise;
/**
* @internal
@@ -2427,10 +2377,7 @@ export abstract class Page extends EventEmitter {
/**
* {@inheritDoc Page.createPDFStream}
*/
- async pdf(options?: PDFOptions): Promise;
- async pdf(): Promise {
- throw new Error('Not implemented');
- }
+ abstract pdf(options?: PDFOptions): Promise;
/**
* The page's title
@@ -2442,25 +2389,18 @@ export abstract class Page extends EventEmitter {
return await this.mainFrame().title();
}
- async close(options?: {runBeforeUnload?: boolean}): Promise;
- async close(): Promise {
- throw new Error('Not implemented');
- }
+ abstract close(options?: {runBeforeUnload?: boolean}): Promise;
/**
* Indicates that the page has been closed.
* @returns
*/
- isClosed(): boolean {
- throw new Error('Not implemented');
- }
+ abstract isClosed(): boolean;
/**
* {@inheritDoc Mouse}
*/
- get mouse(): Mouse {
- throw new Error('Not implemented');
- }
+ abstract get mouse(): Mouse;
/**
* This method fetches an element with `selector`, scrolls it into view if
diff --git a/packages/puppeteer-core/src/cdp/EmulationManager.ts b/packages/puppeteer-core/src/cdp/EmulationManager.ts
index 34fef3c3..c0da7a22 100644
--- a/packages/puppeteer-core/src/cdp/EmulationManager.ts
+++ b/packages/puppeteer-core/src/cdp/EmulationManager.ts
@@ -76,12 +76,18 @@ interface JavascriptEnabledState {
active: boolean;
}
-interface ClientProvider {
+/**
+ * @internal
+ */
+export interface ClientProvider {
clients(): CDPSession[];
registerState(state: EmulatedState): void;
}
-class EmulatedState {
+/**
+ * @internal
+ */
+export class EmulatedState {
#state: T;
#clientProvider: ClientProvider;
#updater: (client: CDPSession, state: T) => Promise;
diff --git a/packages/puppeteer-core/src/util/disposable.ts b/packages/puppeteer-core/src/util/disposable.ts
index a0c0f2ad..94825900 100644
--- a/packages/puppeteer-core/src/util/disposable.ts
+++ b/packages/puppeteer-core/src/util/disposable.ts
@@ -84,7 +84,7 @@ export class DisposableStack {
*
* @param value - The resource to add. `null` and `undefined` will not be added,
* but will be returned.
- * @returns The provided {@link value}.
+ * @returns The provided `value`.
*/
use(value: T): T {
if (value) {
@@ -99,7 +99,7 @@ export class DisposableStack {
* @param value - The value to add.
* @param onDispose - The callback to use in place of a `[disposeSymbol]()`
* method. Will be invoked with `value` as the first parameter.
- * @returns The provided {@link value}.
+ * @returns The provided `value`.
*/
adopt(value: T, onDispose: (value: T) => void): T {
this.#stack.push({
diff --git a/packages/puppeteer-core/src/util/util.ts b/packages/puppeteer-core/src/util/util.ts
index a4ad8c75..3861d720 100644
--- a/packages/puppeteer-core/src/util/util.ts
+++ b/packages/puppeteer-core/src/util/util.ts
@@ -19,3 +19,4 @@ export * from './DebuggableDeferred.js';
export * from './Deferred.js';
export * from './ErrorLike.js';
export * from './AsyncIterableUtil.js';
+export * from './disposable.js';