Skip to content

Commit

Permalink
fix: properly detect function literals (#5296)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s committed Feb 4, 2021
1 parent 847bea2 commit 6ae2e57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/injected/utilityScript.ts
Expand Up @@ -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) {
Expand Down

0 comments on commit 6ae2e57

Please sign in to comment.