refactor: query document on the main realm (#12546)

This commit is contained in:
Alex Rudenko 2024-06-10 10:58:52 +02:00 committed by GitHub
parent 4d6298837f
commit 162540b178
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -394,13 +394,9 @@ export abstract class Frame extends EventEmitter<FrameEvents> {
*/
#document(): Promise<ElementHandle<Document>> {
if (!this.#_document) {
this.#_document = this.isolatedRealm()
.evaluateHandle(() => {
return document;
})
.then(handle => {
return this.mainRealm().transferHandle(handle);
});
this.#_document = this.mainRealm().evaluateHandle(() => {
return document;
});
}
return this.#_document;
}