From 0ca7a7d9e353ca67f239c9ebb66a05c94a692e04 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 12 Jul 2023 13:22:54 +0200 Subject: [PATCH] enable JsImportTaskTypes --- .../JavaScript/JSImportExportTest.cs | 20 +++++++++++-------- .../JavaScript/JavaScriptTestHelper.mjs | 4 ++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportExportTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportExportTest.cs index 5f16d507fa31e..96b5835a31a0f 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportExportTest.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportExportTest.cs @@ -1505,16 +1505,20 @@ public async Task JsImportSleep() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/77334")] public async Task JsImportTaskTypes() { - object a = new object(); - Exception e = new Exception(); - JSObject j = JSHost.GlobalThis; - Assert.Equal("test", await JavaScriptTestHelper.echopromise_String("test")); - Assert.Same(a, await JavaScriptTestHelper.echopromise_Object(a)); - Assert.Same(e, await JavaScriptTestHelper.echopromise_Exception(e)); - Assert.Same(j, await JavaScriptTestHelper.echopromise_JSObject(j)); + for(int i=0;i<100;i++) + { + object a = new object(); + Exception e = new Exception(); + JSObject j = JSHost.GlobalThis; + Assert.Equal("test", await JavaScriptTestHelper.echopromise_String("test")); + Assert.Same(a, await JavaScriptTestHelper.echopromise_Object(a)); + Assert.Same(e, await JavaScriptTestHelper.echopromise_Exception(e)); + Assert.Same(j, await JavaScriptTestHelper.echopromise_JSObject(j)); + GC.Collect(); + await Task.Delay(10); + } } [Fact] diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JavaScriptTestHelper.mjs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JavaScriptTestHelper.mjs index f6681f203b640..624af0df0fe9f 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JavaScriptTestHelper.mjs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JavaScriptTestHelper.mjs @@ -276,6 +276,10 @@ export function invokeStructClassRecords(arg1) { } export function echopromise(arg1) { + if (globalThis.gc) { + //console.log('globalThis.gc'); + globalThis.gc(); + } return new Promise(resolve => setTimeout(() => resolve(arg1), 0)); }