refactor: use page().mainFrame() instead of manually computing the ro… (#11166)

This commit is contained in:
Thiago Perrotta 2023-10-16 05:55:04 -04:00 committed by GitHub
parent bb9ef6ee8b
commit faea1d4791
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -292,11 +292,11 @@ export class CdpFrame extends Frame {
}
#deviceRequestPromptManager(): DeviceRequestPromptManager {
const parentFrame = this.parentFrame();
if (this.isOOPFrame() || parentFrame === null) {
const rootFrame = this.page().mainFrame();
if (this.isOOPFrame() || rootFrame === null) {
return this._frameManager._deviceRequestPromptManager(this.#client);
} else {
return parentFrame.#deviceRequestPromptManager();
return rootFrame._frameManager._deviceRequestPromptManager(this.#client);
}
}