Skip to content

Commit

Permalink
Refactor frame.Evaluate to use EvaluateWithContext
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur22 committed Jul 26, 2023
1 parent 9b0423f commit 0fcdd36
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions common/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,19 +735,11 @@ func (f *Frame) EvaluateWithContext(ctx context.Context, pageFunc goja.Value, ar
func (f *Frame) Evaluate(pageFunc goja.Value, args ...goja.Value) any {
f.log.Debugf("Frame:Evaluate", "fid:%s furl:%q", f.ID(), f.URL())

f.waitForExecutionContext(mainWorld)

opts := evalOptions{
forceCallable: true,
returnByValue: true,
}
result, err := f.evaluate(f.ctx, mainWorld, opts, pageFunc, args...)
result, err := f.EvaluateWithContext(f.ctx, pageFunc, args...)
if err != nil {
k6ext.Panic(f.ctx, "evaluating JS: %v", err)
k6ext.Panic(f.ctx, "%v", err)
}

applySlowMo(f.ctx)

return result
}

Expand Down

0 comments on commit 0fcdd36

Please sign in to comment.