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>> { #document(): Promise<ElementHandle<Document>> {
if (!this.#_document) { if (!this.#_document) {
this.#_document = this.isolatedRealm() this.#_document = this.mainRealm().evaluateHandle(() => {
.evaluateHandle(() => { return document;
return document; });
})
.then(handle => {
return this.mainRealm().transferHandle(handle);
});
} }
return this.#_document; return this.#_document;
} }