From 589e2fb9e90a312b7ef5e0ba2f1a578dedb5dc73 Mon Sep 17 00:00:00 2001 From: ClearScript Date: Thu, 2 May 2013 22:28:23 -0400 Subject: [PATCH] Version 5.2.1: Restored .NET 4.0 source compatibility, updated build and deployment info in Readme.txt. --- ClearScript/Properties/AssemblyInfo.cs | 4 +-- ClearScript/ScriptEngineException.cs | 8 +++++ ClearScript/ScriptInterruptedException.cs | 8 +++++ ClearScript/V8/V8/V8Patch.txt | 2 +- ClearScript/VersionSymbols.h | 4 +-- ClearScript/Windows/WindowsScriptEngine.cs | 7 ++-- ClearScript/Windows/WindowsScriptItem.cs | 22 ++++++------ .../Properties/AssemblyInfo.cs | 4 +-- ClearScriptConsole/Properties/AssemblyInfo.cs | 4 +-- ClearScriptTest/Properties/AssemblyInfo.cs | 4 +-- ClearScriptTest/ScriptAccessTest.cs | 2 +- ReadMe.txt | 34 +++++++++++++------ Version.tt | 2 +- 13 files changed, 69 insertions(+), 36 deletions(-) diff --git a/ClearScript/Properties/AssemblyInfo.cs b/ClearScript/Properties/AssemblyInfo.cs index acf66444..42e7b382 100644 --- a/ClearScript/Properties/AssemblyInfo.cs +++ b/ClearScript/Properties/AssemblyInfo.cs @@ -73,5 +73,5 @@ using System.Runtime.InteropServices; [assembly: InternalsVisibleTo("ClearScriptTest")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("5.2.0.0")] -[assembly: AssemblyFileVersion("5.2.0.0")] +[assembly: AssemblyVersion("5.2.1.0")] +[assembly: AssemblyFileVersion("5.2.1.0")] diff --git a/ClearScript/ScriptEngineException.cs b/ClearScript/ScriptEngineException.cs index d6f8307f..c2a563bb 100644 --- a/ClearScript/ScriptEngineException.cs +++ b/ClearScript/ScriptEngineException.cs @@ -132,6 +132,14 @@ namespace Microsoft.ClearScript #region IScriptEngineException implementation + /// + /// Gets an HRESULT error code if one is available, zero otherwise. + /// + int IScriptEngineException.HResult + { + get { return HResult; } + } + /// /// Gets the name associated with the script engine instance. /// diff --git a/ClearScript/ScriptInterruptedException.cs b/ClearScript/ScriptInterruptedException.cs index df8f05fa..62cfb028 100644 --- a/ClearScript/ScriptInterruptedException.cs +++ b/ClearScript/ScriptInterruptedException.cs @@ -132,6 +132,14 @@ namespace Microsoft.ClearScript #region IScriptEngineException implementation + /// + /// Gets an HRESULT error code if one is available, zero otherwise. + /// + int IScriptEngineException.HResult + { + get { return HResult; } + } + /// /// Gets the name associated with the script engine instance. /// diff --git a/ClearScript/V8/V8/V8Patch.txt b/ClearScript/V8/V8/V8Patch.txt index ed753ccb..72e23c4a 100644 --- a/ClearScript/V8/V8/V8Patch.txt +++ b/ClearScript/V8/V8/V8Patch.txt @@ -1,6 +1,6 @@ Index: tools/gyp/v8.gyp =================================================================== ---- tools/gyp/v8.gyp (revision 14077) +--- tools/gyp/v8.gyp (revision 14518) +++ tools/gyp/v8.gyp (working copy) @@ -32,6 +32,7 @@ 'targets': [ diff --git a/ClearScript/VersionSymbols.h b/ClearScript/VersionSymbols.h index d9210aa2..6da7f0ad 100644 --- a/ClearScript/VersionSymbols.h +++ b/ClearScript/VersionSymbols.h @@ -61,5 +61,5 @@ -#define CLEARSCRIPT_VERSION_STRING "5.2.0.0" -#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 5,2,0,0 +#define CLEARSCRIPT_VERSION_STRING "5.2.1.0" +#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 5,2,1,0 diff --git a/ClearScript/Windows/WindowsScriptEngine.cs b/ClearScript/Windows/WindowsScriptEngine.cs index c0bfbe9a..73e5513f 100644 --- a/ClearScript/Windows/WindowsScriptEngine.cs +++ b/ClearScript/Windows/WindowsScriptEngine.cs @@ -511,14 +511,15 @@ namespace Microsoft.ClearScript.Windows private void ThrowScriptError(Exception exception) { - if (exception is COMException) + var comException = exception as COMException; + if (comException != null) { - if (exception.HResult == RawCOMHelpers.HResult.SCRIPT_E_REPORTED) + if (comException.ErrorCode == RawCOMHelpers.HResult.SCRIPT_E_REPORTED) { // a script error was reported; the corresponding exception should be in the script frame ThrowScriptError(CurrentScriptFrame.ScriptError ?? CurrentScriptFrame.PendingScriptError); } - else if (exception.HResult == RawCOMHelpers.HResult.CLEARSCRIPT_E_HOSTEXCEPTION) + else if (comException.ErrorCode == RawCOMHelpers.HResult.CLEARSCRIPT_E_HOSTEXCEPTION) { // A host exception surrogate passed through the COM boundary; this happens // when some script engines are invoked via script item access rather than diff --git a/ClearScript/Windows/WindowsScriptItem.cs b/ClearScript/Windows/WindowsScriptItem.cs index c1fcfebe..fc4924dc 100644 --- a/ClearScript/Windows/WindowsScriptItem.cs +++ b/ClearScript/Windows/WindowsScriptItem.cs @@ -65,6 +65,7 @@ using System.Dynamic; using System.Globalization; using System.Linq; using System.Reflection; +using System.Runtime.InteropServices; using System.Runtime.InteropServices.Expando; using Microsoft.ClearScript.Util; @@ -127,9 +128,10 @@ namespace Microsoft.ClearScript.Windows return true; } - if (exception != null) + var comException = exception as COMException; + if (comException != null) { - var hr = exception.HResult; + var hr = comException.ErrorCode; if ((hr == RawCOMHelpers.HResult.SCRIPT_E_REPORTED) && (engine.CurrentScriptFrame != null)) { scriptError = engine.CurrentScriptFrame.ScriptError ?? engine.CurrentScriptFrame.PendingScriptError; @@ -156,15 +158,15 @@ namespace Microsoft.ClearScript.Windows scriptError = new ScriptEngineException(engine.Name, "Invalid object or property access", null, RawCOMHelpers.HResult.CLEARSCRIPT_E_SCRIPTITEMEXCEPTION, exception.InnerException); return true; } - else if (hr == RawCOMHelpers.HResult.E_INVALIDARG) + } + else + { + var argumentException = exception as ArgumentException; + if ((argumentException != null) && (argumentException.ParamName == null)) { - var argumentException = exception as ArgumentException; - if ((argumentException != null) && (argumentException.ParamName == null)) - { - // this usually indicates invalid object or property access in VBScript - scriptError = new ScriptEngineException(engine.Name, "Invalid object or property access", null, RawCOMHelpers.HResult.CLEARSCRIPT_E_SCRIPTITEMEXCEPTION, exception.InnerException); - return true; - } + // this usually indicates invalid object or property access in VBScript + scriptError = new ScriptEngineException(engine.Name, "Invalid object or property access", null, RawCOMHelpers.HResult.CLEARSCRIPT_E_SCRIPTITEMEXCEPTION, exception.InnerException); + return true; } } diff --git a/ClearScriptBenchmarks/Properties/AssemblyInfo.cs b/ClearScriptBenchmarks/Properties/AssemblyInfo.cs index 6ed0c286..5fc9e995 100644 --- a/ClearScriptBenchmarks/Properties/AssemblyInfo.cs +++ b/ClearScriptBenchmarks/Properties/AssemblyInfo.cs @@ -69,5 +69,5 @@ using System.Runtime.InteropServices; [assembly: AssemblyCopyright("© Microsoft Corporation")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("5.2.0.0")] -[assembly: AssemblyFileVersion("5.2.0.0")] +[assembly: AssemblyVersion("5.2.1.0")] +[assembly: AssemblyFileVersion("5.2.1.0")] diff --git a/ClearScriptConsole/Properties/AssemblyInfo.cs b/ClearScriptConsole/Properties/AssemblyInfo.cs index f67a7222..c1ac45af 100644 --- a/ClearScriptConsole/Properties/AssemblyInfo.cs +++ b/ClearScriptConsole/Properties/AssemblyInfo.cs @@ -69,5 +69,5 @@ using System.Runtime.InteropServices; [assembly: AssemblyCopyright("© Microsoft Corporation")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("5.2.0.0")] -[assembly: AssemblyFileVersion("5.2.0.0")] +[assembly: AssemblyVersion("5.2.1.0")] +[assembly: AssemblyFileVersion("5.2.1.0")] diff --git a/ClearScriptTest/Properties/AssemblyInfo.cs b/ClearScriptTest/Properties/AssemblyInfo.cs index 39ab8c73..1a57d6bf 100644 --- a/ClearScriptTest/Properties/AssemblyInfo.cs +++ b/ClearScriptTest/Properties/AssemblyInfo.cs @@ -69,5 +69,5 @@ using System.Runtime.InteropServices; [assembly: AssemblyCopyright("© Microsoft Corporation")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("5.2.0.0")] -[assembly: AssemblyFileVersion("5.2.0.0")] +[assembly: AssemblyVersion("5.2.1.0")] +[assembly: AssemblyFileVersion("5.2.1.0")] diff --git a/ClearScriptTest/ScriptAccessTest.cs b/ClearScriptTest/ScriptAccessTest.cs index e09fb107..450bf343 100644 --- a/ClearScriptTest/ScriptAccessTest.cs +++ b/ClearScriptTest/ScriptAccessTest.cs @@ -553,7 +553,7 @@ namespace Microsoft.ClearScript.Test var property = member as PropertyInfo; if (property != null) { - Assert.AreEqual(property.GetValue(target), engine.Evaluate(objectName + "." + scriptMemberName)); + Assert.AreEqual(property.GetValue(target, MiscHelpers.GetEmptyArray()), engine.Evaluate(objectName + "." + scriptMemberName)); return; } diff --git a/ReadMe.txt b/ReadMe.txt index fa6ba757..a0b6a1e7 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -44,7 +44,7 @@ build, and import V8: 3. Open a Visual Studio developer command prompt and run the V8Update script from your ClearScript root directory: - C:\ClearScript> V8Update [/N] [Debug|Release] + C:\ClearScript> V8Update [/N] [Debug|Release] This script downloads the latest versions of V8 and its prerequisites, builds 32-bit and 64-bit V8 shared libraries, and imports the results into @@ -65,14 +65,23 @@ build, and import V8: You are now ready to build the full ClearScript solution using Visual Studio. +OPTIONAL: If you'd like your copy of ClearScript to use .NET Framework 4.0 +instead of 4.5, you must change the Target Framework setting for all projects +in the solution. Note that the Visual Studio IDE does not allow you to change +this setting for C++ projects. Instead, you must open the following files in a +text editor and change the TargetFrameworkVersion element manually: + + ClearScript\V8\ClearScriptV8\32\ClearScriptV8-32.vcxproj + ClearScript\V8\ClearScriptV8\64\ClearScriptV8-64.vcxproj + OPTIONAL: The ClearScript distribution includes a copy of the ClearScript Library Reference in Compiled HTML (.CHM) format. If you'd like to rebuild this file, use Sandcastle Help File Builder (SHFB, http://shfb.codeplex.com) with the provided SHFB project file (ClearScript\doc\Reference.shfbproj). -------------------------------------------- -III. Adding ClearScript to your application -------------------------------------------- +---------------------------------------------------------------- +III. Integrating and deploying ClearScript with your application +---------------------------------------------------------------- Once you've built ClearScript, here's how to add it to your application: @@ -85,10 +94,15 @@ Once you've built ClearScript, here's how to add it to your application: 3. IMPORTANT: If you're using V8, you must also copy the following files from your ClearScript output directory to your application's directory: - ClearScriptV8-32.dll - ClearScriptV8-64.dll - v8-ia32.dll - v8-x64.dll + ClearScriptV8-32.dll + ClearScriptV8-64.dll + v8-ia32.dll + v8-x64.dll + + In addition, if Visual Studio is not installed on the deployment machine, + you must install 32-bit and 64-bit Visual C++ Redistributable packages: + + http://www.microsoft.com/en-us/download/details.aspx?id=30679 ------------------------------------- IV. Debugging with ClearScript and V8 @@ -100,14 +114,14 @@ code running in V8 is to use the open-source Eclipse IDE: 1. Install Eclipse: - http://www.eclipse.org/downloads/ + http://www.eclipse.org/downloads/ 2. Install Google Chrome Developer Tools for Java: a. Launch Eclipse and click "Help" -> "Install New Software...". b. Paste the following URL into the "Work with:" field: - http://chromedevtools.googlecode.com/svn/update/dev/ + http://chromedevtools.googlecode.com/svn/update/dev/ c. Select "Google Chrome Developer Tools" and complete the dialog. d. Restart Eclipse. diff --git a/Version.tt b/Version.tt index accbcd9c..6971528c 100644 --- a/Version.tt +++ b/Version.tt @@ -1 +1 @@ -<# var version = new Version(5, 2, 0, 0); #> +<# var version = new Version(5, 2, 1, 0); #>