File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,11 @@ import (
1010 "math/rand"
1111 "strings"
1212 "testing"
13- "time"
1413
1514 v8 "rogchap.com/v8go"
1615)
1716
18- func TestIsolateTermination (t * testing.T ) {
17+ func TestIsolateTerminateExecution (t * testing.T ) {
1918 t .Parallel ()
2019 iso := v8 .NewIsolate ()
2120 defer iso .Dispose ()
@@ -27,6 +26,9 @@ func TestIsolateTermination(t *testing.T) {
2726 var terminating bool
2827 fooFn := v8 .NewFunctionTemplate (iso , func (info * v8.FunctionCallbackInfo ) * v8.Value {
2928 loop , _ := info .Args ()[0 ].AsFunction ()
29+ go func () {
30+ iso .TerminateExecution ()
31+ }()
3032 loop .Call (v8 .Undefined (iso ))
3133
3234 terminating = iso .IsExecutionTerminating ()
@@ -39,12 +41,6 @@ func TestIsolateTermination(t *testing.T) {
3941 ctx := v8 .NewContext (iso , global )
4042 defer ctx .Close ()
4143
42- go func () {
43- // [RC] find a better way to know when a script has started execution
44- time .Sleep (time .Millisecond )
45- iso .TerminateExecution ()
46- }()
47-
4844 script := `function loop() { while (true) { } }; foo(loop);`
4945 _ , e := ctx .RunScript (script , "forever.js" )
5046 if e == nil || ! strings .HasPrefix (e .Error (), "ExecutionTerminated" ) {
You can’t perform that action at this time.
0 commit comments