Skip to content

Commit 19bc076

Browse files
committed
Version 1.4.1 (Fixed minor bugs)
1 parent 048a794 commit 19bc076

File tree

7 files changed

+24
-46
lines changed

7 files changed

+24
-46
lines changed

MsieJavaScriptEngine.Tests/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
[assembly: ComVisible(false)]
1414
[assembly: Guid("37677738-d94d-4df9-b32d-61573ece8990")]
1515

16-
[assembly: AssemblyVersion("1.4.0.0")]
17-
[assembly: AssemblyFileVersion("1.4.0.0")]
16+
[assembly: AssemblyVersion("1.4.1.0")]
17+
[assembly: AssemblyFileVersion("1.4.1.0")]

MsieJavaScriptEngine/Helpers/ValidationHelpers.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ public static class ValidationHelpers
2020
/// <summary>
2121
/// Regular expression for working with JS-names
2222
/// </summary>
23-
private static readonly Regex _jsNameRegex = new Regex(@"^[A-Za-z_\$][0-9A-Za-z_\$]*$",
24-
RegexOptions.Compiled);
23+
private static readonly Regex _jsNameRegex = new Regex(@"^[A-Za-z_\$][0-9A-Za-z_\$]*$");
2524

2625

2726
/// <summary>

MsieJavaScriptEngine/JsRt/ChakraJsRtJsEngine.cs

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -137,31 +137,21 @@ private static JavaScriptValue MapToScriptType(object value)
137137
return JavaScriptValue.Undefined;
138138
}
139139

140-
if (value is bool)
141-
{
142-
var processedValue = (bool)value;
143-
return JavaScriptValue.FromBoolean(processedValue);
144-
}
145-
146-
if (value is int)
147-
{
148-
var processedValue = (int)value;
149-
return JavaScriptValue.FromInt32(processedValue);
150-
}
140+
var typeCode = Type.GetTypeCode(value.GetType());
151141

152-
if (value is double)
142+
switch (typeCode)
153143
{
154-
var processedValue = (double)value;
155-
return JavaScriptValue.FromDouble(processedValue);
156-
}
157-
158-
if (value is string)
159-
{
160-
var processedValue = (string)value;
161-
return JavaScriptValue.FromString(processedValue);
144+
case TypeCode.Boolean:
145+
return JavaScriptValue.FromBoolean((bool)value);
146+
case TypeCode.Int32:
147+
return JavaScriptValue.FromInt32((int)value);
148+
case TypeCode.Double:
149+
return JavaScriptValue.FromDouble((double)value);
150+
case TypeCode.String:
151+
return JavaScriptValue.FromString((string)value);
152+
default:
153+
return JavaScriptValue.FromObject(value);
162154
}
163-
164-
return JavaScriptValue.FromObject(value);
165155
}
166156

167157
/// <summary>
@@ -203,7 +193,7 @@ private static object MapToHostType(JavaScriptValue value)
203193
result = processedValue.ToObject();
204194
break;
205195
default:
206-
throw new Exception();
196+
throw new ArgumentOutOfRangeException();
207197
}
208198

209199
return result;
@@ -228,7 +218,7 @@ private JsRuntimeException ConvertJavaScriptExceptionToJsRuntimeException(
228218
JavaScriptPropertyId messagePropertyId = JavaScriptPropertyId.FromString("message");
229219
JavaScriptValue messagePropertyValue = errorValue.GetProperty(messagePropertyId);
230220
string scriptMessage = messagePropertyValue.ConvertToString().ToString();
231-
if (!string.IsNullOrWhiteSpace(message))
221+
if (!string.IsNullOrWhiteSpace(scriptMessage))
232222
{
233223
message = string.Format("{0}: {1}", message.TrimEnd('.'), scriptMessage);
234224
}

MsieJavaScriptEngine/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[assembly: ComVisible(false)]
1414
[assembly: Guid("ae6911c9-e2a9-4386-ab90-3722a9166564")]
1515

16-
[assembly: AssemblyVersion("1.4.0.0")]
17-
[assembly: AssemblyFileVersion("1.4.0.0")]
16+
[assembly: AssemblyVersion("1.4.1.0")]
17+
[assembly: AssemblyFileVersion("1.4.1.0")]
1818

1919
[module: DefaultCharSet(CharSet.Unicode)]

MsieJavaScriptEngine/Utilities/StringBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal static class StringBuilderExtensions
1212
/// Regular expression for format placeholder
1313
/// </summary>
1414
private static readonly Regex _formatPlaceholderRegExp =
15-
new Regex(@"\{[0-9]\}", RegexOptions.Multiline | RegexOptions.Compiled);
15+
new Regex(@"\{[0-9]+\}", RegexOptions.Multiline);
1616

1717
/// <summary>
1818
/// Appends the default line terminator to the end of the current System.Text.StringBuilder object

NuGet/MsieJavaScriptEngine.nuspec

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>MsieJavaScriptEngine</id>
5-
<version>1.4.0</version>
5+
<version>1.4.1</version>
66
<title>MSIE JavaScript Engine for .NET</title>
77
<authors>Andrey Taritsyn</authors>
88
<owners>Andrey Taritsyn</owners>
@@ -12,11 +12,7 @@
1212
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1313
<description>This project is a .NET wrapper for working with the Internet Explorer's JavaScript engines (JsRT version of Chakra, ActiveScript version of Chakra and Classic JavaScript Engine). Project was based on the code of SassAndCoffee.JavaScript (http://github.com/paulcbetts/SassAndCoffee) and Chakra Sample Hosts (http://github.com/panopticoncentral/chakra-host).</description>
1414
<summary>This project is a .NET wrapper for working with the Internet Explorer's JavaScript engines (JsRT version of Chakra, ActiveScript version of Chakra and Classic JavaScript Engine).</summary>
15-
<releaseNotes>1. Removed following methods: `HasProperty`, `GetPropertyValue`, `SetPropertyValue` and `RemoveProperty`;
16-
2. Fixed bug #3 "execute code from different threads";
17-
3. Now in the `ChakraJsRt` mode is available a more detailed information about errors;
18-
4. In ECMAScript 5 Polyfill improved a performance of the `String.prototype.trim` function;
19-
5. JSON2 library was updated to version of February 4, 2014.</releaseNotes>
15+
<releaseNotes>Fixed minor bugs.</releaseNotes>
2016
<copyright>Copyright 2014 Andrey Taritsyn - http://www.taritsyn.ru</copyright>
2117
<language>en-US</language>
2218
<tags>JavaScript ECMAScript MSIE IE Chakra</tags>

NuGet/readme.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
----------------------------------------------------------------------
4-
README file for MSIE JavaScript Engine for .NET 1.4.0
4+
README file for MSIE JavaScript Engine for .NET 1.4.1
55

66
----------------------------------------------------------------------
77

@@ -21,14 +21,7 @@
2121
=============
2222
RELEASE NOTES
2323
=============
24-
1. Removed following methods: `HasProperty`, `GetPropertyValue`,
25-
`SetPropertyValue` and `RemoveProperty`;
26-
2. Fixed bug #3 "execute code from different threads";
27-
3. Now in the `ChakraJsRt` mode is available a more detailed
28-
information about errors;
29-
4. In ECMAScript 5 Polyfill improved a performance of the
30-
`String.prototype.trim` function;
31-
5. JSON2 library was updated to version of February 4, 2014.
24+
Fixed minor bugs.
3225

3326
============
3427
PROJECT SITE

0 commit comments

Comments
 (0)