Skip to content

Commit 2130b58

Browse files
committed
An attempt was made to prevent occurrence of the access violation exception in the CallFunction method
1 parent c946b39 commit 2130b58

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

NuGet/MsieJavaScriptEngine.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1313
<description>This library is a .NET wrapper for working with the JavaScript engines of Internet Explorer and Edge (JsRT versions 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 library is a .NET wrapper for working with the JavaScript engines of Internet Explorer and Edge (JsRT versions of Chakra, ActiveScript version of Chakra and Classic JavaScript Engine).</summary>
15-
<releaseNotes>JSON2 library was updated to version of May 10, 2016.</releaseNotes>
15+
<releaseNotes>An attempt was made to prevent occurrence of the access violation exception in the `CallFunction` method.</releaseNotes>
1616
<copyright>Copyright (c) 2012-2016 Andrey Taritsyn - http://www.taritsyn.ru</copyright>
1717
<language>en-US</language>
1818
<tags>JavaScript ECMAScript MSIE IE Edge Chakra</tags>

NuGet/readme.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
=============
2222
RELEASE NOTES
2323
=============
24-
JSON2 library was updated to version of May 10, 2016.
24+
An attempt was made to prevent occurrence of the access violation
25+
exception in the `CallFunction` method.
2526

2627
============
2728
PROJECT SITE

src/MsieJavaScriptEngine/JsRt/Edge/ChakraEdgeJsRtJsEngine.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,12 +424,16 @@ public override object CallFunction(string functionName, params object[] args)
424424
string.Format(Strings.Runtime_FunctionNotExist, functionName));
425425
}
426426

427-
var processedArgs = MapToScriptType(args);
428-
var allProcessedArgs = new[] { globalObj }.Concat(processedArgs).ToArray();
429-
427+
EdgeJsValue[] processedArgs = MapToScriptType(args);
430428
EdgeJsValue functionValue = globalObj.GetProperty(functionId);
429+
430+
globalObj.AddRef();
431+
432+
EdgeJsValue[] allProcessedArgs = new[] { globalObj }.Concat(processedArgs).ToArray();
431433
EdgeJsValue resultValue = functionValue.CallFunction(allProcessedArgs);
432434

435+
globalObj.Release();
436+
433437
return MapToHostType(resultValue);
434438
});
435439

src/MsieJavaScriptEngine/JsRt/Ie/ChakraIeJsRtJsEngine.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,16 @@ public override object CallFunction(string functionName, params object[] args)
460460
string.Format(Strings.Runtime_FunctionNotExist, functionName));
461461
}
462462

463-
var processedArgs = MapToScriptType(args);
464-
var allProcessedArgs = new[] { globalObj }.Concat(processedArgs).ToArray();
465-
463+
IeJsValue[] processedArgs = MapToScriptType(args);
466464
IeJsValue functionValue = globalObj.GetProperty(functionId);
465+
466+
globalObj.AddRef();
467+
468+
IeJsValue[] allProcessedArgs = new[] { globalObj }.Concat(processedArgs).ToArray();
467469
IeJsValue resultValue = functionValue.CallFunction(allProcessedArgs);
468470

471+
globalObj.Release();
472+
469473
return MapToHostType(resultValue);
470474
});
471475

src/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.7.1.0")]
17-
[assembly: AssemblyFileVersion("1.7.1.0")]
16+
[assembly: AssemblyVersion("1.7.2.0")]
17+
[assembly: AssemblyFileVersion("1.7.2.0")]
1818

1919
[module: DefaultCharSet(CharSet.Unicode)]

0 commit comments

Comments
 (0)