Skip to content

Commit c00be79

Browse files
Version 7.2.2: Added V8Settings.GlobalFlags and V8GlobalFlags.DisableJITCompilation; added IArrayBuffer.InvokeWithDirectAccess and IArrayBufferView.InvokeWithDirectAccess (GitHub Issue ClearFoundry#349); added disposal of enumerators created for JavaScript iteration (GitHub Issue ClearFoundry#348); fixed dynamic module import from host-invoked functions (GitHub Issue ClearFoundry#339); updated API documentation. Tested with V8 9.8.177.9.
1 parent b1fb84b commit c00be79

File tree

683 files changed

+2318
-1138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

683 files changed

+2318
-1138
lines changed

ClearScript.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ EndProject
150150
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClearScriptTest.NetStandard", "NetStandard\ClearScriptTest.NetStandard\ClearScriptTest.NetStandard.csproj", "{BF28C9F2-2935-4FDE-B812-977D601F9208}"
151151
ProjectSection(ProjectDependencies) = postProject
152152
{EDC7144E-FDA9-4CC7-B2CD-B5EBFD610A7D} = {EDC7144E-FDA9-4CC7-B2CD-B5EBFD610A7D}
153-
{497012BC-959C-43A0-90A6-156A35DF2F43} = {497012BC-959C-43A0-90A6-156A35DF2F43}
153+
{C0E7BCAD-B4B3-4291-A87A-384D5F99C413} = {C0E7BCAD-B4B3-4291-A87A-384D5F99C413}
154154
{6F6B59D0-6538-4D02-91D2-07D24DAFE39A} = {6F6B59D0-6538-4D02-91D2-07D24DAFE39A}
155155
EndProjectSection
156156
EndProject

ClearScript.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
<s:Boolean x:Key="/Default/UserDictionary/Words/=E_00F3in/@EntryIndexedValue">True</s:Boolean>
7474
<s:Boolean x:Key="/Default/UserDictionary/Words/=FILEEXISTS/@EntryIndexedValue">True</s:Boolean>
7575
<s:Boolean x:Key="/Default/UserDictionary/Words/=fine/@EntryIndexedValue">True</s:Boolean>
76+
<s:Boolean x:Key="/Default/UserDictionary/Words/=foobarbaz/@EntryIndexedValue">True</s:Boolean>
7677
<s:Boolean x:Key="/Default/UserDictionary/Words/=FUNCDESC/@EntryIndexedValue">True</s:Boolean>
7778
<s:Boolean x:Key="/Default/UserDictionary/Words/=FUNCFLAGS/@EntryIndexedValue">True</s:Boolean>
7879
<s:Boolean x:Key="/Default/UserDictionary/Words/=guids/@EntryIndexedValue">True</s:Boolean>

ClearScript/Exports/VersionSymbols.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#pragma once
77

8-
#define CLEARSCRIPT_VERSION_STRING "7.2.1"
9-
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 7,2,1
10-
#define CLEARSCRIPT_VERSION_STRING_INFORMATIONAL "7.2.1"
8+
#define CLEARSCRIPT_VERSION_STRING "7.2.2"
9+
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 7,2,2
10+
#define CLEARSCRIPT_VERSION_STRING_INFORMATIONAL "7.2.2"
1111
#define CLEARSCRIPT_FILE_FLAGS 0L

ClearScript/HostItem.NetFramework.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
// Licensed under the MIT license.
33

44
using System;
5+
using System.Collections;
56
using System.Collections.Generic;
7+
using Microsoft.ClearScript.Util;
68

79
namespace Microsoft.ClearScript
810
{
@@ -21,15 +23,23 @@ private static HostItem Create(ScriptEngine engine, HostTarget target, HostItemF
2123

2224
#region member invocation
2325

24-
// ReSharper disable once UnusedParameter.Local
25-
private static object CreateAsyncEnumerator<T>(IEnumerable<T> enumerable)
26+
private object CreateAsyncEnumerator<T>(IEnumerable<T> enumerable)
2627
{
27-
throw new PlatformNotSupportedException("Async enumerators are not supported on this platform");
28+
return HostObject.Wrap(enumerable.GetEnumerator().ToAsyncEnumerator(Engine), typeof(IAsyncEnumeratorPromise<T>));
2829
}
2930

3031
private object CreateAsyncEnumerator()
3132
{
32-
throw new PlatformNotSupportedException("Async enumerators are not supported on this platform");
33+
if (BindSpecialTarget(out IEnumerable _))
34+
{
35+
var enumerableHelpersHostItem = Wrap(Engine, EnumerableHelpers.HostType, HostItemFlags.PrivateAccess);
36+
if (MiscHelpers.Try(out var enumerator, () => ((IDynamic)enumerableHelpersHostItem).InvokeMethod("GetAsyncEnumerator", this, Engine)))
37+
{
38+
return enumerator;
39+
}
40+
}
41+
42+
throw new NotSupportedException("The object is not async-enumerable");
3343
}
3444

3545
#endregion

ClearScript/HostObject.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT license.
33

44
using System;
5-
using System.Collections;
65
using System.Reflection;
76
using System.Runtime.InteropServices.ComTypes;
87
using Microsoft.ClearScript.Util;
@@ -33,8 +32,8 @@ private HostObject(object target, Type type)
3332
{
3433
if (target is IEnumVARIANT enumVariant)
3534
{
36-
target = new EnumeratorWrapper(enumVariant);
37-
type = typeof(IEnumerator);
35+
target = new DisposableEnumeratorOnEnumVariant(enumVariant);
36+
type = typeof(IDisposableEnumerator);
3837
}
3938
}
4039

ClearScript/JavaScript/IArrayBuffer.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4+
using System;
5+
46
namespace Microsoft.ClearScript.JavaScript
57
{
68
/// <summary>
@@ -39,5 +41,29 @@ public interface IArrayBuffer
3941
/// <param name="offset">The offset within the <c>ArrayBuffer</c> at which to store the first copied byte.</param>
4042
/// <returns>The number of bytes copied.</returns>
4143
ulong WriteBytes(byte[] source, ulong sourceIndex, ulong count, ulong offset);
44+
45+
/// <summary>
46+
/// Invokes a delegate that returns no value, giving it direct access to the <c>ArrayBuffer</c>'s contents.
47+
/// </summary>
48+
/// <param name="action">The delegate to invoke.</param>
49+
/// <remarks>
50+
/// This method invokes the specified delegate, passing in the memory address of the
51+
/// <c>ArrayBuffer</c>'s contents. This memory address is valid only while the delegate is
52+
/// executing. The delegate must not access memory outside the <c>ArrayBuffer</c>'s range.
53+
/// </remarks>
54+
void InvokeWithDirectAccess(Action<IntPtr> action);
55+
56+
/// <summary>
57+
/// Invokes a delegate that returns a value, giving it direct access to the <c>ArrayBuffer</c>'s contents.
58+
/// </summary>
59+
/// <typeparam name="T">The delegate's return type.</typeparam>
60+
/// <param name="func">The delegate to invoke.</param>
61+
/// <returns>The delegate's return value.</returns>
62+
/// <remarks>
63+
/// This method invokes the specified delegate, passing in the memory address of the
64+
/// <c>ArrayBuffer</c>'s contents. This memory address is valid only while the delegate is
65+
/// executing. The delegate must not access memory outside the <c>ArrayBuffer</c>'s range.
66+
/// </remarks>
67+
T InvokeWithDirectAccess<T>(Func<IntPtr, T> func);
4268
}
4369
}

ClearScript/JavaScript/IArrayBufferView.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4+
using System;
5+
46
namespace Microsoft.ClearScript.JavaScript
57
{
68
/// <summary>
@@ -50,5 +52,29 @@ public interface IArrayBufferView
5052
/// <param name="offset">The offset within the view at which to store the first copied byte.</param>
5153
/// <returns>The number of bytes copied.</returns>
5254
ulong WriteBytes(byte[] source, ulong sourceIndex, ulong count, ulong offset);
55+
56+
/// <summary>
57+
/// Invokes a delegate that returns no value, giving it direct access to the view's contents.
58+
/// </summary>
59+
/// <param name="action">The delegate to invoke.</param>
60+
/// <remarks>
61+
/// This method invokes the specified delegate, passing in the memory address of the view's
62+
/// contents. This memory address is valid only while the delegate is executing. The
63+
/// delegate must not access memory outside the view's range.
64+
/// </remarks>
65+
void InvokeWithDirectAccess(Action<IntPtr> action);
66+
67+
/// <summary>
68+
/// Invokes a delegate that returns a value, giving it direct access to the view's contents.
69+
/// </summary>
70+
/// <typeparam name="T">The delegate's return type.</typeparam>
71+
/// <param name="func">The delegate to invoke.</param>
72+
/// <returns>The delegate's return value.</returns>
73+
/// <remarks>
74+
/// This method invokes the specified delegate, passing in the memory address of the view's
75+
/// contents. This memory address is valid only while the delegate is executing. The
76+
/// delegate must not access memory outside the view's range.
77+
/// </remarks>
78+
T InvokeWithDirectAccess<T>(Func<IntPtr, T> func);
5379
}
5480
}

ClearScript/Properties/AssemblyInfo.Core.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
[assembly: InternalsVisibleTo("ClearScriptTest")]
1919

2020
[assembly: ComVisible(false)]
21-
[assembly: AssemblyVersion("7.2.1")]
22-
[assembly: AssemblyFileVersion("7.2.1")]
23-
[assembly: AssemblyInformationalVersion("7.2.1")]
21+
[assembly: AssemblyVersion("7.2.2")]
22+
[assembly: AssemblyFileVersion("7.2.2")]
23+
[assembly: AssemblyInformationalVersion("7.2.2")]
2424

2525
namespace Microsoft.ClearScript.Properties
2626
{
2727
internal static class ClearScriptVersion
2828
{
29-
public const string Triad = "7.2.1";
30-
public const string Informational = "7.2.1";
29+
public const string Triad = "7.2.2";
30+
public const string Informational = "7.2.2";
3131
}
3232
}

ClearScript/Properties/AssemblyInfo.V8.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
[assembly: InternalsVisibleTo("ClearScriptTest")]
1616

1717
[assembly: ComVisible(false)]
18-
[assembly: AssemblyVersion("7.2.1")]
19-
[assembly: AssemblyFileVersion("7.2.1")]
20-
[assembly: AssemblyInformationalVersion("7.2.1")]
18+
[assembly: AssemblyVersion("7.2.2")]
19+
[assembly: AssemblyFileVersion("7.2.2")]
20+
[assembly: AssemblyInformationalVersion("7.2.2")]

0 commit comments

Comments
 (0)