Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 0fcdd36

Browse files
committed
Refactor frame.Evaluate to use EvaluateWithContext
1 parent 9b0423f commit 0fcdd36

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

common/frame.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -735,19 +735,11 @@ func (f *Frame) EvaluateWithContext(ctx context.Context, pageFunc goja.Value, ar
735735
func (f *Frame) Evaluate(pageFunc goja.Value, args ...goja.Value) any {
736736
f.log.Debugf("Frame:Evaluate", "fid:%s furl:%q", f.ID(), f.URL())
737737

738-
f.waitForExecutionContext(mainWorld)
739-
740-
opts := evalOptions{
741-
forceCallable: true,
742-
returnByValue: true,
743-
}
744-
result, err := f.evaluate(f.ctx, mainWorld, opts, pageFunc, args...)
738+
result, err := f.EvaluateWithContext(f.ctx, pageFunc, args...)
745739
if err != nil {
746-
k6ext.Panic(f.ctx, "evaluating JS: %v", err)
740+
k6ext.Panic(f.ctx, "%v", err)
747741
}
748742

749-
applySlowMo(f.ctx)
750-
751743
return result
752744
}
753745

0 commit comments

Comments
 (0)