From 2e7f0dc040a670581a871df37661e51905ad955f Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Wed, 12 Jul 2023 20:31:41 +0200 Subject: [PATCH] enable JsImportTaskTypes (#88728) --- .../InteropServices/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 5f16d50..96b5835 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 @@ namespace System.Runtime.InteropServices.JavaScript.Tests } [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 f6681f2..624af0d 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)); } -- 2.7.4