Imported Upstream version 4.2.0.179

Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent aa7da660d6
commit c042cd0c52
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -55,22 +55,12 @@ ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
OTHER_LIB_MCS_FLAGS += -r:System.Web.ApplicationServices.dll
endif
LIB_REFS = System System.Core System.Drawing System.Data System.Data.Linq System.Xml System.Web System.Web.Services System.Configuration System.EnterpriseServices System.ServiceModel
LIB_MCS_FLAGS = \
-unsafe \
-define:NET_3_5 \
-define:SYSTEM_WEB_EXTENSIONS \
-r:$(corlib) \
-r:System.dll \
-r:System.Core.dll \
-r:System.Drawing.dll \
-r:System.Data.dll \
-r:System.Data.Linq.dll \
-r:System.Xml.dll \
-r:System.Web.dll \
-r:System.Web.Services.dll \
-r:System.Configuration.dll \
-r:System.EnterpriseServices.dll \
-r:System.ServiceModel.dll \
$(OTHER_LIB_MCS_FLAGS) \
$(RESOURCE_FILES:%=/resource:%)

View File

@@ -226,7 +226,7 @@ namespace System.Web.Script.Serialization
/*colon CO*/ {CO,CO,__,__,__,__,CA,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__},
/*value VA*/ {VA,VA,OS,__,AB,__,__,__,SB,__,__,PX,MX,__,ZX,IX,__,__,__,__,__,FA,__,NU,__,__,TR,__,__,__,__,__,I1,__,__,V1},
/*array AR*/ {AR,AR,OS,__,AB,AE,__,__,SB,__,__,PX,MX,__,ZX,IX,__,__,__,__,__,FA,__,NU,__,__,TR,__,__,__,__,__,I1,__,__,V1},
/*string ST*/ {ST,__,ST,ST,ST,ST,ST,ST,SE,EX,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST},
/*string ST*/ {ST,ST,ST,ST,ST,ST,ST,ST,SE,EX,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST},
/*escape ES*/ {__,__,__,__,__,__,__,__,ST,ST,ST,__,__,__,__,__,__,ST,__,__,__,ST,__,ST,ST,__,ST,U1,__,__,__,__,__,__,__,__},
/*u1 U1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,U2,U2,U2,U2,U2,U2,U2,U2,__,__,__,__,__,__,U2,U2,__,__,__,__,__,__},
/*u2 U2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,U3,U3,U3,U3,U3,U3,U3,U3,__,__,__,__,__,__,U3,U3,__,__,__,__,__,__},
@@ -495,21 +495,21 @@ namespace System.Web.Script.Serialization
break;
case JsonType.TRUE:
if (String.Compare (s, "true", StringComparison.Ordinal) == 0)
if (String.Compare (s.Trim (), "true", StringComparison.Ordinal) == 0)
result = true;
else
converted = false;
break;
case JsonType.FALSE:
if (String.Compare (s, "false", StringComparison.Ordinal) == 0)
if (String.Compare (s.Trim (), "false", StringComparison.Ordinal) == 0)
result = false;
else
converted = false;
break;
case JsonType.NULL:
if (String.Compare (s, "null", StringComparison.Ordinal) != 0)
if (String.Compare (s.Trim (), "null", StringComparison.Ordinal) != 0)
converted = false;
break;

View File

@@ -1400,5 +1400,46 @@ namespace MonoTests.System.Web.Script.Serialization
Assert.AreEqual (kv.Value, obj.Value);
}
}
[Test]
public void DeserializeStringWithNewline ()
{
JavaScriptSerializer serializer = new JavaScriptSerializer ();
string json_with_newline = @"
[
{
content:""
<div id=\""calendar\""><div>
""
}
]
";
serializer.DeserializeObject (json_with_newline);
}
class Dummy
{
public bool t;
public bool f;
public string s;
public int i;
public double d;
public object o;
}
[Test]
public void DeserializeWhiteSpaces ()
{
string json = "{\"t\" : true , \"f\" : false , \"s\" : \"s\" , \"i\" : 1337 , \"d\" : 1337.0 , \"o\" : null }";
var obj = (new JavaScriptSerializer ()).Deserialize<Dummy>(json);
Assert.IsTrue (obj.t);
Assert.IsFalse (obj.f);
Assert.AreEqual ("s", obj.s);
Assert.AreEqual (1337, obj.i);
Assert.AreEqual (1337.0, obj.d);
Assert.AreEqual (null, obj.o);
}
}
}