mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
refactor: query document on the main realm (#12546)
This commit is contained in:
parent
4d6298837f
commit
162540b178
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user