diff options
author | Jérémie Laval <jeremie.laval@gmail.com> | 2013-03-22 19:10:48 +0400 |
---|---|---|
committer | Jérémie Laval <jeremie.laval@gmail.com> | 2013-03-23 17:59:34 +0400 |
commit | e2b584c2af30cfdb03a9d108b24cb48d315420db (patch) | |
tree | 92a3911714ff2ae69f186b6e1e9714b26067ddc7 /mcs | |
parent | 71d027fb55bd8ddc4956265f82c88f97c60eef97 (diff) |
[monodoc] Parse correctly '{' and '}' as '<' and '>' (generic params) in ECMA url.
These characters are used in place of normal bracket in some part of the xsl generation code, mostly to prevent ASP.NET default code injection policy to kick in.
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/monodoc/Makefile | 9 | ||||
-rw-r--r-- | mcs/class/monodoc/Monodoc.Ecma/EcmaUrlTokenizer.cs | 2 | ||||
-rw-r--r-- | mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs | 26 |
3 files changed, 35 insertions, 2 deletions
diff --git a/mcs/class/monodoc/Makefile b/mcs/class/monodoc/Makefile index c61e7382c09..9436137d758 100644 --- a/mcs/class/monodoc/Makefile +++ b/mcs/class/monodoc/Makefile @@ -116,7 +116,7 @@ LIB_MCS_FLAGS = \ /r:System.Xml.Linq.dll \ /r:System.Configuration.dll -TEST_MCS_FLAGS = /r:System.Core.dll /r:System.Xml.dll +TEST_MCS_FLAGS = /r:System.dll /r:System.Core.dll /r:System.Xml.dll /r:AgilityPack.dll DOC_SOURCE_DIRS = \ ../../docs \ @@ -130,7 +130,9 @@ $(the_lib): Makefile $(RESOURCE_FILES) all-local: $(the_lib).config Monodoc.Ecma/EcmaUrlParser.cs -test-local: setup-doc-sources +run-test-local: AgilityPack.dll + +test-local: setup-doc-sources AgilityPack.dll dist-local: Monodoc.Ecma/EcmaUrlParser.cs @@ -146,3 +148,6 @@ parser.exe: Monodoc.Ecma/EcmaUrlParser.cs Monodoc.Ecma/EcmaUrlTokenizer.cs Monod setup-doc-sources: $(DOC_SOURCES) mkdir -p ./Test/monodoc_test/sources/ cp $(DOC_SOURCES) ./Test/monodoc_test/sources/ + +AgilityPack.dll: + cp $(topdir)/../docs/$(@) . diff --git a/mcs/class/monodoc/Monodoc.Ecma/EcmaUrlTokenizer.cs b/mcs/class/monodoc/Monodoc.Ecma/EcmaUrlTokenizer.cs index 151192096b1..a4cabd8a7de 100644 --- a/mcs/class/monodoc/Monodoc.Ecma/EcmaUrlTokenizer.cs +++ b/mcs/class/monodoc/Monodoc.Ecma/EcmaUrlTokenizer.cs @@ -80,8 +80,10 @@ namespace Monodoc.Ecma return Token.COMMA; case '.': return Token.DOT; + case '{': case '<': return Token.OP_GENERICS_LT; + case '}': case '>': return Token.OP_GENERICS_GT; case '`': diff --git a/mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs b/mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs index bcfeac51847..a16d7c59587 100644 --- a/mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs +++ b/mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs @@ -111,6 +111,7 @@ namespace MonoTests.Monodoc.Ecma AssertValidUrl ("C:Gendarme.Rules.Concurrency.DecorateThreadsRule.DecorateThreadsRule(System.String)"); AssertValidUrl ("C:Gendarme.Framework.Helpers.MethodSignature.MethodSignature(string,string,string[],System.Func<Mono.Cecil.MethodReference,System.Boolean>)"); AssertValidUrl ("C:System.Collections.Generic.Dictionary<TKey,TValue>+KeyCollection.KeyCollection(System.Collections.Generic.Dictionary<TKey,TValue>)"); + AssertValidUrl ("C:Microsoft.Build.Utilities.TaskItem(System.String,System.Collections.IDictionary)"); } [Test] @@ -176,6 +177,12 @@ namespace MonoTests.Monodoc.Ecma } [Test] + public void AspNetSafeUrlValidTest () + { + AssertValidUrl ("M:MonoTouch.UIKit.UICollectionViewLayoutAttributes.CreateForCell{T}"); + } + + [Test] public void MetaEtcNodeTest () { var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type, @@ -225,6 +232,25 @@ namespace MonoTests.Monodoc.Ecma } [Test] + public void TypeWithOneGenericUrlParseTestUsingAspNetStyleUrl () + { + var generics = new[] { + new EcmaDesc { + DescKind = EcmaDesc.Kind.Type, + Namespace = string.Empty, + TypeName = "T" + } + }; + var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type, + TypeName = "String", + Namespace = "System", + GenericTypeArguments = generics, + }; + + AssertUrlDesc (ast, "T:System.String{T}"); + } + + [Test] public void TypeWithNestedGenericUrlParseTest () { var generics = new[] { |