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 { #deviceRequestPromptManager(): DeviceRequestPromptManager {
const parentFrame = this.parentFrame(); const rootFrame = this.page().mainFrame();
if (this.isOOPFrame() || parentFrame === null) { if (this.isOOPFrame() || rootFrame === null) {
return this._frameManager._deviceRequestPromptManager(this.#client); return this._frameManager._deviceRequestPromptManager(this.#client);
} else { } else {
return parentFrame.#deviceRequestPromptManager(); return rootFrame._frameManager._deviceRequestPromptManager(this.#client);
} }
} }