Skip to content

Commit b83270a

Browse files
Version 5.3.9: Fixed HostMethod and HostIndexedProperty arguments, added tests, V8update now fetches known-good versions of GYP, Python and Cygwin (Issue ClearFoundry#20). Tested with V8 3.22.23.
1 parent f96174f commit b83270a

File tree

10 files changed

+72
-23
lines changed

10 files changed

+72
-23
lines changed

ClearScript/Exports/VersionSymbols.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@
6363

6464
#pragma once
6565

66-
#define CLEARSCRIPT_VERSION_STRING "5.3.8.0"
67-
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 5,3,8,0
66+
#define CLEARSCRIPT_VERSION_STRING "5.3.9.0"
67+
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 5,3,9,0

ClearScript/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@
7373
[assembly: InternalsVisibleTo("ClearScriptTest")]
7474

7575
[assembly: ComVisible(false)]
76-
[assembly: AssemblyVersion("5.3.8.0")]
77-
[assembly: AssemblyFileVersion("5.3.8.0")]
76+
[assembly: AssemblyVersion("5.3.9.0")]
77+
[assembly: AssemblyFileVersion("5.3.9.0")]

ClearScript/Util/DynamicHelpers.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,15 @@ private static DynamicMetaObject CreateDynamicTarget(object target)
439439
return CreateDynamicMetaObject(target, Expression.Constant(target));
440440
}
441441

442-
return CreateDynamicMetaObject(target, Expression.Constant(target, hostTarget.Type));
442+
var type = hostTarget.Type;
443+
try
444+
{
445+
return CreateDynamicMetaObject(target, Expression.Constant(target, type));
446+
}
447+
catch (ArgumentException)
448+
{
449+
return CreateDynamicMetaObject(target, Expression.Constant(target));
450+
}
443451
}
444452

445453
private static DynamicMetaObject CreateDynamicArg(object arg)
@@ -462,7 +470,16 @@ private static DynamicMetaObject CreateDynamicArg(object arg)
462470
}
463471

464472
arg = hostTarget.Target;
465-
return CreateDynamicMetaObject(arg, Expression.Constant(arg, hostTarget.Type));
473+
474+
var type = hostTarget.Type;
475+
try
476+
{
477+
return CreateDynamicMetaObject(arg, Expression.Constant(arg, type));
478+
}
479+
catch (ArgumentException)
480+
{
481+
return CreateDynamicMetaObject(arg, Expression.Constant(arg));
482+
}
466483
}
467484

468485
private static DynamicMetaObject[] CreateDynamicArgs(object[] args)

ClearScript/V8/V8/V8Patch.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Index: src/utils.h
22
===================================================================
3-
--- src/utils.h (revision 17179)
3+
--- src/utils.h (revision 17421)
44
+++ src/utils.h (working copy)
55
@@ -109,7 +109,7 @@
66
// These are kind of 2's complement reciprocal of the divisors.
@@ -13,7 +13,7 @@ Index: src/utils.h
1313
// lithium-codegen-arm.cc : LCodeGen::TryEmitSignedIntegerDivisionByConstant().
1414
Index: tools/gyp/v8.gyp
1515
===================================================================
16-
--- tools/gyp/v8.gyp (revision 17179)
16+
--- tools/gyp/v8.gyp (revision 17421)
1717
+++ tools/gyp/v8.gyp (working copy)
1818
@@ -33,6 +33,7 @@
1919
'targets': [

ClearScriptBenchmarks/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@
6969
[assembly: AssemblyCopyright("(c) Microsoft Corporation")]
7070

7171
[assembly: ComVisible(false)]
72-
[assembly: AssemblyVersion("5.3.8.0")]
73-
[assembly: AssemblyFileVersion("5.3.8.0")]
72+
[assembly: AssemblyVersion("5.3.9.0")]
73+
[assembly: AssemblyFileVersion("5.3.9.0")]

ClearScriptConsole/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@
6969
[assembly: AssemblyCopyright("(c) Microsoft Corporation")]
7070

7171
[assembly: ComVisible(false)]
72-
[assembly: AssemblyVersion("5.3.8.0")]
73-
[assembly: AssemblyFileVersion("5.3.8.0")]
72+
[assembly: AssemblyVersion("5.3.9.0")]
73+
[assembly: AssemblyFileVersion("5.3.9.0")]

ClearScriptTest/BugFixTest.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
using System;
6363
using System.Collections.Generic;
6464
using System.Diagnostics.CodeAnalysis;
65+
using System.Dynamic;
6566
using System.Linq;
6667
using System.Reflection;
6768
using System.Threading;
@@ -265,6 +266,33 @@ public void BugFix_GenericDelegateConstructorWithArgument()
265266
Assert.AreEqual(testString.Length, func(testString));
266267
}
267268

269+
[TestMethod, TestCategory("BugFix")]
270+
public void BugFix_HostMethodAsArgument()
271+
{
272+
var testObject = new TestObject();
273+
engine.Script.testObject = testObject;
274+
engine.Script.expando = new ExpandoObject();
275+
engine.AddHostType("DateTime", typeof(DateTime));
276+
engine.Execute("expando.method = testObject.Method");
277+
Assert.AreEqual(testObject.Method("foo", 123), engine.Evaluate("expando.method('foo', 123)"));
278+
Assert.AreEqual(testObject.Method<DateTime>(456), engine.Evaluate("expando.method(DateTime, 456)"));
279+
}
280+
281+
[TestMethod, TestCategory("BugFix")]
282+
public void BugFix_HostIndexedPropertyAsArgument()
283+
{
284+
var testObject = new TestObject();
285+
engine.Script.testObject = testObject;
286+
engine.Script.expando = new ExpandoObject();
287+
engine.Execute("expando.property = testObject.Item");
288+
Assert.AreEqual("foo", engine.Evaluate("expando.property.set(123, 'foo')"));
289+
Assert.AreEqual("foo", engine.Evaluate("expando.property.get(123)"));
290+
Assert.AreEqual("foo", engine.Evaluate("expando.property(123)"));
291+
Assert.AreEqual(456, engine.Evaluate("expando.property.set('bar', 456)"));
292+
Assert.AreEqual(456, engine.Evaluate("expando.property.get('bar')"));
293+
Assert.AreEqual(456, engine.Evaluate("expando.property('bar')"));
294+
}
295+
268296
// ReSharper restore InconsistentNaming
269297

270298
#endregion

ClearScriptTest/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@
6969
[assembly: AssemblyCopyright("(c) Microsoft Corporation")]
7070

7171
[assembly: ComVisible(false)]
72-
[assembly: AssemblyVersion("5.3.8.0")]
73-
[assembly: AssemblyFileVersion("5.3.8.0")]
72+
[assembly: AssemblyVersion("5.3.9.0")]
73+
[assembly: AssemblyFileVersion("5.3.9.0")]

V8Update.cmd

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ setlocal
55
:: process arguments
66
::-----------------------------------------------------------------------------
77

8-
set testedRevision=17179
9-
set testedVersion=3.22.11
8+
set testedRevision=17421
9+
set testedVersion=3.22.23
10+
11+
set gyprev=1685
12+
set pythonrev=89111
13+
set cygwinrev=66844
1014

1115
:ProcessArgs
1216

@@ -87,14 +91,14 @@ if "%v8rev%"=="" goto UseTestedRev
8791
if /i "%v8rev%"=="latest" goto UseLatestRev
8892
if /i "%v8rev%"=="tested" goto UseTestedRev
8993
if /i "%v8rev%"=="%testedRevision%" goto UseTestedRev
90-
echo V8 revision: %v8rev%
94+
echo V8 revision: r%v8rev%
9195
echo *** WARNING: THIS V8 REVISION MAY NOT BE COMPATIBLE WITH CLEARSCRIPT ***
9296
choice /m Continue
9397
if errorlevel 2 goto Exit
9498
goto ResolveRevDone
9599
:UseTestedRev
96100
set v8rev=%testedRevision%
97-
echo V8 revision: Tested (%v8rev%, Version %testedVersion%)
101+
echo V8 revision: Tested (r%v8rev%, Version %testedVersion%)
98102
goto ResolveRevDone
99103
:UseLatestRev
100104
set v8rev=HEAD
@@ -118,7 +122,7 @@ cd build
118122

119123
:DownloadV8
120124
echo Downloading V8 ...
121-
svn checkout http://v8.googlecode.com/svn/trunk/@%v8rev% v8 >getV8.log
125+
svn checkout http://v8.googlecode.com/svn/trunk@%v8rev% v8 >getV8.log
122126
if errorlevel 1 goto Error1
123127
:DownloadV8Done
124128

@@ -132,19 +136,19 @@ if errorlevel 1 goto Error2
132136

133137
:DownloadGYP
134138
echo Downloading GYP ...
135-
svn checkout http://gyp.googlecode.com/svn/trunk build/gyp >getGYP.log
139+
svn checkout http://gyp.googlecode.com/svn/trunk@%gyprev% build/gyp >getGYP.log
136140
if errorlevel 1 goto Error2
137141
:DownloadGYPDone
138142

139143
:DownloadPython
140144
echo Downloading Python ...
141-
svn checkout http://src.chromium.org/svn/trunk/tools/third_party/python_26 third_party/python_26 >getPython.log
145+
svn checkout http://src.chromium.org/svn/trunk/tools/third_party/python_26@%pythonrev% third_party/python_26 >getPython.log
142146
if errorlevel 1 goto Error2
143147
:DownloadPythonDone
144148

145149
:DownloadCygwin
146150
echo Downloading Cygwin ...
147-
svn checkout http://src.chromium.org/svn/trunk/deps/third_party/cygwin third_party/cygwin >getCygwin.log
151+
svn checkout http://src.chromium.org/svn/trunk/deps/third_party/cygwin@%cygwinrev% third_party/cygwin >getCygwin.log
148152
if errorlevel 1 goto Error2
149153
:DownloadCygwinDone
150154

Version.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<# var version = new Version(5, 3, 8, 0); #>
1+
<# var version = new Version(5, 3, 9, 0); #>

0 commit comments

Comments
 (0)