mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
fix: properly detect function literals (#5296)
This commit is contained in:
parent
847bea2f83
commit
6ae2e576d8
@ -22,7 +22,7 @@ export default class UtilityScript {
|
||||
const handles = argsAndHandles.slice(argCount);
|
||||
const parameters = args.map(a => parseEvaluationResultValue(a, handles));
|
||||
expression = expression.trim();
|
||||
if (expression.startsWith('function ') || expression.startsWith('async function '))
|
||||
if (/^(async)?\s*function(\s|\()/.test(expression))
|
||||
expression = '(' + expression + ')';
|
||||
let result = global.eval(expression);
|
||||
if (isFunction === true) {
|
||||
|
Loading…
Reference in New Issue
Block a user