utilityScriptObjects
This commit is contained in:
parent
fdda58d738
commit
bad7da51c3
|
|
@ -256,11 +256,11 @@ export async function evaluateExpression(context: ExecutionContext, expression:
|
||||||
return { fallThrough: handle };
|
return { fallThrough: handle };
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const utilityScriptObjectIds: JSHandle[] = [];
|
const utilityScriptObjects: JSHandle[] = [];
|
||||||
for (const handle of await Promise.all(handles)) {
|
for (const handle of await Promise.all(handles)) {
|
||||||
if (handle._context !== context)
|
if (handle._context !== context)
|
||||||
throw new JavaScriptErrorInEvaluate('JSHandles can be evaluated only in the context they were created!');
|
throw new JavaScriptErrorInEvaluate('JSHandles can be evaluated only in the context they were created!');
|
||||||
utilityScriptObjectIds.push(handle);
|
utilityScriptObjects.push(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// See UtilityScript for arguments.
|
// See UtilityScript for arguments.
|
||||||
|
|
@ -268,7 +268,7 @@ export async function evaluateExpression(context: ExecutionContext, expression:
|
||||||
|
|
||||||
const script = `(utilityScript, ...args) => utilityScript.evaluate(...args)`;
|
const script = `(utilityScript, ...args) => utilityScript.evaluate(...args)`;
|
||||||
try {
|
try {
|
||||||
return await context.evaluateWithArguments(script, options.returnByValue || false, utilityScriptValues, utilityScriptObjectIds);
|
return await context.evaluateWithArguments(script, options.returnByValue || false, utilityScriptValues, utilityScriptObjects);
|
||||||
} finally {
|
} finally {
|
||||||
toDispose.map(handlePromise => handlePromise.then(handle => handle.dispose()));
|
toDispose.map(handlePromise => handlePromise.then(handle => handle.dispose()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue