mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: remove Page.prototype.target
from WebDriver BiDi (#11873)
This commit is contained in:
parent
15c986c2bc
commit
8a9fb1051a
@ -144,7 +144,6 @@ export class BidiPage extends Page {
|
|||||||
#keyboard: BidiKeyboard;
|
#keyboard: BidiKeyboard;
|
||||||
#browsingContext: BrowsingContext;
|
#browsingContext: BrowsingContext;
|
||||||
#browserContext: BidiBrowserContext;
|
#browserContext: BidiBrowserContext;
|
||||||
#target: BiDiPageTarget;
|
|
||||||
|
|
||||||
_client(): CDPSession {
|
_client(): CDPSession {
|
||||||
return this.mainFrame().context().cdpSession;
|
return this.mainFrame().context().cdpSession;
|
||||||
@ -152,13 +151,11 @@ export class BidiPage extends Page {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
browsingContext: BrowsingContext,
|
browsingContext: BrowsingContext,
|
||||||
browserContext: BidiBrowserContext,
|
browserContext: BidiBrowserContext
|
||||||
target: BiDiPageTarget
|
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.#browsingContext = browsingContext;
|
this.#browsingContext = browsingContext;
|
||||||
this.#browserContext = browserContext;
|
this.#browserContext = browserContext;
|
||||||
this.#target = target;
|
|
||||||
this.#connection = browsingContext.connection;
|
this.#connection = browsingContext.connection;
|
||||||
|
|
||||||
for (const [event, subscriber] of this.#browsingContextEvents) {
|
for (const [event, subscriber] of this.#browsingContextEvents) {
|
||||||
@ -794,7 +791,7 @@ export class BidiPage extends Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override target(): BiDiPageTarget {
|
override target(): BiDiPageTarget {
|
||||||
return this.#target;
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override waitForFileChooser(): never {
|
override waitForFileChooser(): never {
|
||||||
|
@ -138,7 +138,7 @@ export class BiDiPageTarget extends BiDiBrowsingContextTarget {
|
|||||||
) {
|
) {
|
||||||
super(browserContext, browsingContext);
|
super(browserContext, browsingContext);
|
||||||
|
|
||||||
this.#page = new BidiPage(browsingContext, browserContext, this);
|
this.#page = new BidiPage(browsingContext, browserContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
override async page(): Promise<BidiPage> {
|
override async page(): Promise<BidiPage> {
|
||||||
|
@ -583,7 +583,7 @@ describe('Page', function () {
|
|||||||
// 3. After that, remove the iframe.
|
// 3. After that, remove the iframe.
|
||||||
frame.remove();
|
frame.remove();
|
||||||
});
|
});
|
||||||
// 4. The target should always be the last one.
|
// 4. The target will always be the last one.
|
||||||
const popupTarget = page.browserContext().targets().at(-1)!;
|
const popupTarget = page.browserContext().targets().at(-1)!;
|
||||||
// 5. Connect to the popup and make sure it doesn't throw and is not the same page.
|
// 5. Connect to the popup and make sure it doesn't throw and is not the same page.
|
||||||
expect(await popupTarget.page()).not.toBe(page);
|
expect(await popupTarget.page()).not.toBe(page);
|
||||||
|
Loading…
Reference in New Issue
Block a user