From 4d3cb6ccf3bcca2dc0b148e614661e44aeb2b75f Mon Sep 17 00:00:00 2001 From: jrandolf <101637635+jrandolf@users.noreply.github.com> Date: Wed, 30 Aug 2023 13:09:27 +0200 Subject: [PATCH] chore: refactor Frame (#10808) --- docs/api/puppeteer.frame.__eval.md | 4 +- docs/api/puppeteer.frame._eval.md | 4 +- docs/api/puppeteer.frame.childframes.md | 2 +- docs/api/puppeteer.frame.goto.md | 2 +- docs/api/puppeteer.frame.isdetached.md | 2 +- docs/api/puppeteer.frame.md | 2 +- docs/api/puppeteer.frame.page.md | 2 +- docs/api/puppeteer.frame.parentframe.md | 2 +- docs/api/puppeteer.frame.setcontent.md | 2 +- docs/api/puppeteer.frame.url.md | 2 +- docs/api/puppeteer.frame.waitfornavigation.md | 2 +- packages/puppeteer-core/src/api/Frame.ts | 139 ++++++------------ packages/puppeteer-core/src/api/Realm.ts | 6 + packages/puppeteer-core/src/common/Frame.ts | 87 +---------- .../puppeteer-core/src/common/FrameManager.ts | 2 +- .../src/common/IsolatedWorld.ts | 6 - .../src/common/bidi/BrowsingContext.ts | 8 +- .../puppeteer-core/src/common/bidi/Frame.ts | 86 +---------- .../puppeteer-core/src/common/bidi/Page.ts | 2 +- 19 files changed, 78 insertions(+), 284 deletions(-) diff --git a/docs/api/puppeteer.frame.__eval.md b/docs/api/puppeteer.frame.__eval.md index a2ec8290e00..2d0034b7b10 100644 --- a/docs/api/puppeteer.frame.__eval.md +++ b/docs/api/puppeteer.frame.__eval.md @@ -21,7 +21,7 @@ class Frame { > = EvaluateFuncWith>, Params>, >( selector: Selector, - pageFunction: Func | string, + pageFunction: string | Func, ...args: Params ): Promise>>; } @@ -32,7 +32,7 @@ class Frame { | Parameter | Type | Description | | ------------ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | selector | Selector | The selector to query for. | -| pageFunction | Func \| string | The function to be evaluated in the frame's context. An array of elements matching the given selector will be passed to the function as its first argument. | +| pageFunction | string \| Func | The function to be evaluated in the frame's context. An array of elements matching the given selector will be passed to the function as its first argument. | | args | Params | Additional arguments to pass to pageFunction. | **Returns:** diff --git a/docs/api/puppeteer.frame._eval.md b/docs/api/puppeteer.frame._eval.md index f7322ceee33..9a528518e08 100644 --- a/docs/api/puppeteer.frame._eval.md +++ b/docs/api/puppeteer.frame._eval.md @@ -21,7 +21,7 @@ class Frame { >, >( selector: Selector, - pageFunction: Func | string, + pageFunction: string | Func, ...args: Params ): Promise>>; } @@ -32,7 +32,7 @@ class Frame { | Parameter | Type | Description | | ------------ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | | selector | Selector | The selector to query for. | -| pageFunction | Func \| string | The function to be evaluated in the frame's context. The first element matching the selector will be passed to the function as its first argument. | +| pageFunction | string \| Func | The function to be evaluated in the frame's context. The first element matching the selector will be passed to the function as its first argument. | | args | Params | Additional arguments to pass to pageFunction. | **Returns:** diff --git a/docs/api/puppeteer.frame.childframes.md b/docs/api/puppeteer.frame.childframes.md index e62165680f1..84fe5b86f88 100644 --- a/docs/api/puppeteer.frame.childframes.md +++ b/docs/api/puppeteer.frame.childframes.md @@ -10,7 +10,7 @@ An array of child frames. ```typescript class Frame { - childFrames(): Frame[]; + abstract childFrames(): Frame[]; } ``` diff --git a/docs/api/puppeteer.frame.goto.md b/docs/api/puppeteer.frame.goto.md index ff1cc00ca44..df5e6a40d11 100644 --- a/docs/api/puppeteer.frame.goto.md +++ b/docs/api/puppeteer.frame.goto.md @@ -10,7 +10,7 @@ Navigates a frame to the given url. ```typescript class Frame { - goto( + abstract goto( url: string, options?: { referer?: string; diff --git a/docs/api/puppeteer.frame.isdetached.md b/docs/api/puppeteer.frame.isdetached.md index a43bcb70e3a..579145d6e16 100644 --- a/docs/api/puppeteer.frame.isdetached.md +++ b/docs/api/puppeteer.frame.isdetached.md @@ -10,7 +10,7 @@ Is`true` if the frame has been detached. Otherwise, `false`. ```typescript class Frame { - isDetached(): boolean; + abstract isDetached(): boolean; } ``` diff --git a/docs/api/puppeteer.frame.md b/docs/api/puppeteer.frame.md index b01d1e4f800..a87cec0aa97 100644 --- a/docs/api/puppeteer.frame.md +++ b/docs/api/puppeteer.frame.md @@ -11,7 +11,7 @@ To understand frames, you can think of frames as `