fix(page): use secondary DOMWorld to drive page.select() (#3809)

This patch starts creating secondary DOMWorld for every connected
page and switches `page.select()` to run inside the secondary world.

Fix #3327.
This commit is contained in:
Andrey Lushnikov
2019-01-22 17:55:33 -05:00
committed by GitHub
parent c09835fd70
commit 678b8e85ad
6 changed files with 74 additions and 56 deletions

View File

@@ -24,20 +24,19 @@ class ExecutionContext {
/**
* @param {!Puppeteer.CDPSession} client
* @param {!Protocol.Runtime.ExecutionContextDescription} contextPayload
* @param {?Puppeteer.Frame} frame
* @param {?Puppeteer.DOMWorld} world
*/
constructor(client, contextPayload, frame) {
constructor(client, contextPayload, world) {
this._client = client;
this._frame = frame;
this._world = world;
this._contextId = contextPayload.id;
this._isDefault = contextPayload.auxData ? !!contextPayload.auxData['isDefault'] : false;
}
/**
* @return {?Puppeteer.Frame}
*/
frame() {
return this._frame;
return this._world ? this._world.frame() : null;
}
/**