Skip to content

Releases: sebastienros/jint

v4.1.0

27 Oct 13:23
04466d0
Compare
Choose a tag to compare

This release contains a breaking change for interop for static fields and properties. They are no longer exposed as part of interop wrapper by default. You read more about the reasoning here.

To access public static fields or properties you should use registered TypeReferences.

Following example shows the new behavior:

[Fact]
public void StaticFieldsShouldFollowJsSemantics()
{
    _engine.Evaluate("Number.MAX_SAFE_INTEGER").AsNumber().Should().Be(NumberConstructor.MaxSafeInteger);
    _engine.Evaluate("new Number().MAX_SAFE_INTEGER").Should().Be(JsValue.Undefined);

    _engine.Execute("class MyJsClass { static MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER; }");
    _engine.Evaluate("MyJsClass.MAX_SAFE_INTEGER").AsNumber().Should().Be(NumberConstructor.MaxSafeInteger);
    _engine.Evaluate("new MyJsClass().MAX_SAFE_INTEGER").Should().Be(JsValue.Undefined);

    _engine.SetValue("MyCsClass", typeof(MyClass));
    _engine.Evaluate("MyCsClass.MAX_SAFE_INTEGER").AsNumber().Should().Be(NumberConstructor.MaxSafeInteger);
    // NEW BEHAVIOR, NOW UNDEFINED
    _engine.Evaluate("new MyCsClass().MAX_SAFE_INTEGER").Should().Be(JsValue.Undefined);
}

private class MyClass
{
    public static JsNumber MAX_SAFE_INTEGER = new JsNumber(NumberConstructor.MaxSafeInteger);
}

If you want to expose static instance fields and properties as part of instance wrappers, you need to configure the engine to do so:

var engine = new Engine(options =>
{
    options.Interop.ObjectWrapperReportedFieldBindingFlags |= BindingFlags.Static;
    options.Interop.ObjectWrapperReportedPropertyBindingFlags |= BindingFlags.Static;
});

Static methods can still be accessed as before, but you could limit exposing them too if you wish to do so:

var engine = new Engine(options =>
{
    options.Interop.ObjectWrapperReportedMethodBindingFlags = BindingFlags.Instance | BindingFlags.Public;
});

What's Changed

  • Fix Array.prototype.toString() stackoverflow by @xBaank in #1976
  • Promise.withResolvers() returned object had resolve and reject functions swapped by @tomatosalat0 in #1983
  • Made test of cancellation of engine execution more robust by @tomatosalat0 in #1984
  • Early out in ObjectPool to avoid loop execution by @tomatosalat0 in #1985
  • Optimize some character checks and ValueStringBuilder by @lahma in #1986
  • Make JsSet public by @kenlyon in #1987
  • Make JsMap public by @lahma in #1988
  • Exclude static fields and properties from ObjectWrapper by default by @lahma in #1981
  • Add Options.InteropOptions.BuildCallStackHandler by @scgm0 in #1793
  • Revert back to favoring SearchValues<char> by @lahma in #1990

New Contributors

Full Changelog: v4.0.3...v4.1.0

v4.0.3

23 Sep 17:36
e67e58a
Compare
Choose a tag to compare

What's Changed

  • Update test262 test suite and fix issues by @lahma in #1958
  • Don't find hidden property instead of the hiding property by @mspertus in #1963
  • Implement Math.sumPrecise by @lahma in #1966
  • Address Interop having difficulty finding properties in derived types by @mspertus in #1969

New Contributors

Full Changelog: v4.0.2...v4.0.3

v4.0.2

26 Aug 18:03
eb091eb
Compare
Choose a tag to compare

With this release you will start to see CLR methods also reported as object members under interop when calling functions like Object.getOwnPropertyNames(x). You can revert back to old behavior by configuring an option options.Interop.ObjectWrapperReportedMemberTypes = MemberTypes.Field | MemberTypes.Property;.

What's Changed

  • Bump the all-dependencies group with 2 updates by @dependabot in #1941
  • Update test262 test suite and fix issues by @lahma in #1944
  • Add ObjectWrapperReportedMemberTypes to Options by @lofcz in #1947
  • Make ObjectWrapper ClrType public by @lofcz in #1946
  • Fix throwing on accessing CLR FunctionDeclaration by @lofcz in #1949
  • Make own properties for declared only fields and properties configurable by @lahma in #1948
  • Bump the all-dependencies group with 3 updates by @dependabot in #1950
  • Don't overwrite default export from SourceTextModule by @viceice in #1952
  • Tweak object wrapper reported members logic by @lahma in #1956

New Contributors

Full Changelog: v4.0.1...v4.0.2

v4.0.1

10 Aug 07:31
a37f39c
Compare
Choose a tag to compare

What's Changed

  • Update benchmarks results and README.md against v4 by @lahma in #1928
  • Upgrade NUnit3TestAdapter to version 4.6.0 by @lahma in #1920
  • Implement Atomics.pause by @lahma in #1929
  • Bump Meziantou.Analyzer from 2.0.161 to 2.0.162 in the all-dependencies group by @dependabot in #1930
  • Convert to using file-scoped namespaces by @lahma in #1931
  • Add .git-blame-ignore-revs by @lahma in #1932
  • Bump Meziantou.Analyzer from 2.0.162 to 2.0.163 in the all-dependencies group by @dependabot in #1933
  • Update test262 test suite and fix TypedArray.set issues by @lahma in #1934
  • Fix dynamic object member access logic by @lahma in #1937
  • Fix custom reference resolver argument by @lahma in #1938

Full Changelog: v4.0.0...v4.0.1

v3.1.6

10 Aug 07:30
7e368a2
Compare
Choose a tag to compare

What's Changed

  • Backport make EsprimaExtensions.TryGetKey more resilient to missing execution context by @lahma in #1919
  • Improve invalid class private member access member errors by @lahma in #1922
  • Backport fix custom reference resolver argument by @lahma in #1939
  • Backport fix dynamic object member access logic by @lahma in #1940

Full Changelog: v3.1.5...v3.1.6

v4.0.0

24 Jul 10:48
3d5c872
Compare
Choose a tag to compare

This release changes internal JavaScript parser from Esprima to Acornima and adds some new ECMAScript features.

Relevant bug fixes below have been backported into 3.x and are already part of its releases.

What's Changed

  • Acorn-based parsing by @adams85 in #1820
  • Remove obsolete members and bump version to 4 by @lahma in #1834
  • Remove NuGet.config configurations by @lahma in #1835
  • Fix dynamic importing of JSON modules by @adams85 in #1837
  • Update test262 suite and fix issues by @lahma in #1839
  • Add support for Float16Array by @lahma in #1840
  • Run GH Actions workflows for 3.x branch by @lahma in #1842
  • Improve System.Text.Json numeric type conversion under interop by @lahma in #1843
  • Improve environment handling performance and cleanup API by @lahma in #1845
  • Remove Enum.HasFlag usage by @lahma in #1850
  • Update README.md to fix comment of LimitMemory by @catcherwong in #1854
  • Improve localeCompare implementation by @sebastienros in #1853
  • edit ReadMe.md sample by @DHclly in #1855
  • Add dependabot configuration by @lahma in #1859
  • Bump Microsoft.Extensions.DependencyInjection from 7.0.0 to 8.0.0 by @dependabot in #1860
  • Bump Meziantou.Analyzer from 2.0.147 to 2.0.152 by @dependabot in #1863
  • Bump Microsoft.Extensions.TimeProvider.Testing from 8.0.0 to 8.5.0 by @dependabot in #1861
  • Cleanup csproj files by @lahma in #1865
  • Use global env definitions for GitHub Actions by @lahma in #1866
  • Bump Flurl.Http.Signed from 3.2.4 to 4.0.2 by @dependabot in #1862
  • Bump xunit from 2.7.1 to 2.8.0 by @dependabot in #1864
  • Bump xunit.runner.visualstudio from 2.5.8 to 2.8.0 by @dependabot in #1867
  • Make LazyPropertyDescriptor generic and some prototypes more lazy by @lahma in #1868
  • Fix string-indexing optimizations against custom strings by @lahma in #1871
  • Bump xunit.runner.visualstudio from 2.8.0 to 2.8.1 by @dependabot in #1873
  • Bump Meziantou.Analyzer from 2.0.152 to 2.0.153 by @dependabot in #1875
  • Bump Microsoft.NET.Test.Sdk from 17.9.0 to 17.10.0 by @dependabot in #1872
  • Upgrade to xUnit 2.8.1 by @lahma in #1876
  • Enable grouped version updates by @sebastienros in #1878
  • Bump the all-dependencies group with 2 updates by @dependabot in #1879
  • Fix BigInt arithmetic assignment by @lahma in #1887
  • Support creating NamespaceReference against empty namespace by @lahma in #1888
  • Expose construction capabilities with code for JsArrayBuffer by @lahma in #1890
  • Bump the all-dependencies group across 1 directory with 2 updates by @dependabot in #1894
  • Update test262 suite and implement Promise.try by @lahma in #1895
  • Bump NiL.JS from 2.5.1677 to 2.5.1684 in the all-dependencies group by @dependabot in #1896
  • Add Task async await check when evaluate await expression by @trannamtrung1st in #1882
  • Upgrade to Acornima v1.1.0 by @adams85 in #1898
  • Fix ArrayInstance.CopyValues to handle holes correctly by @lahma in #1900
  • Update test262 suite and fix typed array issues by @lahma in #1902
  • Add interop option ThrowOnUnresolvedMember by @lahma in #1904
  • Replace ReferenceEquals usage with is (not) null by @lahma in #1906
  • Bump Meziantou.Analyzer from 2.0.158 to 2.0.159 in the all-dependencies group by @dependabot in #1907
  • Upgrade test262 suite and fix issues by @lahma in #1910
  • Implement Uint8Array to/from base64 by @lahma in #1911
  • Fix issues found with latest test262 suite by @lahma in #1912
  • Avoid Array.sort infinite loops on full framework by @lahma in #1914
  • Update ECMAScript 2024 feature status to README.md by @lahma in #1916
  • Bump the all-dependencies group with 6 updates by @dependabot in #1918
  • get rid of 'reference not set to an instance of an object' error, which appears when context is null by @Thrasha in #1917
  • Bump Meziantou.Analyzer from 2.0.160 to 2.0.161 in the all-dependencies group by @dependabot in #1923
  • Ensure Acornima ParseErrorException is exposed as JavasScriptException by @lahma in #1924
  • Ensure script preparation exposes only Jint's exception type by @lahma in #1927

New Contributors

Full Changelog: v3.1.0...v4.0.0

v3.1.5

13 Jul 18:27
6cb4456
Compare
Choose a tag to compare

What's Changed

  • Backport typed array related fixes by @lahma in #1913
  • Backport avoid Array.sort infinite loops on full framework by @lahma in #1915

Full Changelog: v3.1.4...v3.1.5

v3.1.4

27 Jun 06:08
a2bd553
Compare
Choose a tag to compare

What's Changed

  • Backport fix ArrayInstance.CopyValues to handle holes correctly by @lahma in #1901
  • Backport update test262 suite and fix typed array issues by @lahma in #1903
  • Backport add interop option ThrowOnUnresolvedMember by @lahma in #1905

Full Changelog: v3.1.3...v3.1.4

v3.1.3

15 Jun 18:13
62b0243
Compare
Choose a tag to compare

What's Changed

  • Fix BigInt arithmetic assignments by @lahma in #1891
  • Support creating NamespaceReference against empty namespace by @lahma in #1892
  • Expose construction capabilities with code for JsArrayBuffer by @lahma in #1893

Full Changelog: v3.1.2...v3.1.3

v3.1.2

25 May 08:05
c42a63d
Compare
Choose a tag to compare

What's Changed

  • Backport improve environment handling performance and cleanup API by @lahma in #1846
  • Fix string-indexing optimizations against custom strings by @lahma in #1870

Full Changelog: v3.1.1...v3.1.2