Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Jint.Tests.Test262/Test262Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ private static Engine BuildTestExecutor(Test262File file, Test262AgentManager? a
var delay = (int)TypeConverter.ToNumber(args.At(1));
if (callback is ICallable callable)
{
Task.Run(async () =>
_ = Task.Run(async () =>
{
await Task.Delay(delay);
callable.Call(JsValue.Undefined, Arguments.Empty);
// Queue callback to event loop instead of calling directly from background thread
// to avoid race conditions with concurrent JavaScript execution
engine.AddToEventLoop(() =>
{
callable.Call(JsValue.Undefined, Arguments.Empty);
});
});
}
return JsValue.Undefined;
Expand Down
4 changes: 2 additions & 2 deletions Jint.Tests/Runtime/ExecutionConstraintTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public void ShouldConsiderConstraintsWhenCallingInvoke()
{
var engine = new Engine(options =>
{
options.TimeoutInterval(TimeSpan.FromMilliseconds(100));
options.TimeoutInterval(TimeSpan.FromMilliseconds(1000));
});
var myApi = new MyApi();

Expand All @@ -337,7 +337,7 @@ public void ShouldConsiderConstraintsWhenCallingInvoke()
foreach (var callback in dataReceivedCallbacks)
{
engine.Invoke(callback.Value, "Data Received #1");
Thread.Sleep(101);
Thread.Sleep(200);
engine.Invoke(callback.Value, "Data Received #2");
}
}
Expand Down