Skip to content

Commit

Permalink
Backport of r138280
Browse files Browse the repository at this point in the history
svn path=/branches/mono-2-4-2/mcs/; revision=138511
  • Loading branch information
grendello committed Jul 23, 2009
1 parent e862f1e commit 3f9ef21
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 6 deletions.
5 changes: 5 additions & 0 deletions mcs/class/System.Web/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2009-07-21 Marek Habersack <mhabersack@novell.com>

* Makefile (TEST_RESOURCE_FILES): added
Test/mainsoft/NunitWebResources/UnquotedAngleBrackets.aspx

2009-06-30 Marek Habersack <mhabersack@novell.com>

* Makefile (TEST_RESOURCE_FILES): added
Expand Down
3 changes: 2 additions & 1 deletion mcs/class/System.Web/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ TEST_RESOURCE_FILES = \
Test/mainsoft/NunitWebResources/LinkInHeadWithEmbeddedExpression.aspx \
Test/mainsoft/NunitWebResources/ExpressionInListControl.aspx \
Test/mainsoft/NunitWebResources/ServerSideControlsInScriptBlock.aspx \
Test/mainsoft/NunitWebResources/ServerControlInClientSideComment.aspx
Test/mainsoft/NunitWebResources/ServerControlInClientSideComment.aspx \
Test/mainsoft/NunitWebResources/UnquotedAngleBrackets.aspx

RESX_DIST = resources/TranslationResources.resx
ifeq (net_2_0, $(PROFILE))
Expand Down
24 changes: 21 additions & 3 deletions mcs/class/System.Web/System.Web.Compilation/AspParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
// Marek Habersack <mhabersack@novell.com>
//
// (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
// (C) 2004-2009 Novell, Inc (http://novell.com)
//

//
Expand Down Expand Up @@ -154,7 +156,8 @@ public string VerbatimID {

bool Eat (int expected_token)
{
if (tokenizer.get_token () != expected_token) {
int token = tokenizer.get_token ();
if (token != expected_token) {
tokenizer.put_back ();
return false;
}
Expand Down Expand Up @@ -227,7 +230,7 @@ public void Parse ()
continue;
}

if (tokenizer.Value.Trim () == "" && tagtype == TagType.Directive) {
if (tokenizer.Value.Trim ().Length == 0 && tagtype == TagType.Directive) {
continue;
}

Expand Down Expand Up @@ -381,9 +384,24 @@ void GetTag (out TagType tagtype, out string id, out TagAttributes attributes)

break;
default:
string idvalue = null;
// This is to handle code like:
//
// <asp:ListItem runat="server"> < </asp:ListItem>
//
if ((char)token == '<') {
string odds = tokenizer.Odds;
if (odds != null && odds.Length > 0 && Char.IsWhiteSpace (odds [0])) {
tokenizer.put_back ();
idvalue = odds;
} else
idvalue = tokenizer.Value;
} else
idvalue = tokenizer.Value;

tagtype = TagType.Text;
tokenizer.InTag = false;
id = "<" + tokenizer.Value;
id = "<" + idvalue;
break;
}
}
Expand Down
7 changes: 5 additions & 2 deletions mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ class PutBackItem
public readonly string Value;
public readonly int Position;
public readonly int CurrentToken;
public readonly bool InTag;

public PutBackItem (string value, int position, int currentToken)
public PutBackItem (string value, int position, int currentToken, bool inTag)
{
Value = value;
Position = position;
CurrentToken = currentToken;
InTag = inTag;
}
}

Expand Down Expand Up @@ -118,7 +120,7 @@ public void put_back ()
putBackBuffer = new Stack ();

string val = Value;
putBackBuffer.Push (new PutBackItem (val, position, current_token));
putBackBuffer.Push (new PutBackItem (val, position, current_token, inTag));
position -= val.Length;
}

Expand All @@ -132,6 +134,7 @@ public int get_token ()
val = null;
sb = new StringBuilder (pbi.Value);
current_token = pbi.CurrentToken;
inTag = pbi.InTag;
return current_token;
}

Expand Down
4 changes: 4 additions & 0 deletions mcs/class/System.Web/System.Web.Compilation/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

2009-07-21 Marek Habersack <mhabersack@novell.com>

* AspTokenizer.cs: in put_back, store inTag value as well.

* AspParser.cs: correctly parse code like "<asp:tag> < </asp:tag>"

* BuildManager.cs: GetReferencedAssemblies unconditionally
includes all assemblies from bin/ for precompiled sites. Fixes bug
#502016
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void TemplateControlCompiler_Init ()
WebTest.CopyResource (GetType (), "TemplateControlParsingTest.aspx", "TemplateControlParsingTest.aspx");
WebTest.CopyResource (GetType (), "ServerSideControlsInScriptBlock.aspx", "ServerSideControlsInScriptBlock.aspx");
WebTest.CopyResource (GetType (), "ServerControlInClientSideComment.aspx", "ServerControlInClientSideComment.aspx");
WebTest.CopyResource (GetType (), "UnquotedAngleBrackets.aspx", "UnquotedAngleBrackets.aspx");
#if NET_2_0
WebTest.CopyResource (GetType (), "InvalidPropertyBind1.aspx", "InvalidPropertyBind1.aspx");
WebTest.CopyResource (GetType (), "InvalidPropertyBind2.aspx", "InvalidPropertyBind2.aspx");
Expand Down Expand Up @@ -200,6 +201,13 @@ public void ServerControlInClientSideComment ()
// We just test if it doesn't throw an exception
new WebTest ("ServerControlInClientSideComment.aspx").Run ();
}

[Test]
public void UnquotedAngleBrackets ()
{
// We just test if it doesn't throw an exception
new WebTest ("UnquotedAngleBrackets.aspx").Run ();
}

[Test]
public void ChildTemplatesTest ()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<%@ Page Language="C#" %>
<html>
<head><title>unquoted angle brackets</title></head>
<body>
<form runat="server">
<asp:DropDownList runat="server">
<asp:ListItem Value="&gt;"> > </asp:ListItem>
<asp:ListItem Value="="> = </asp:ListItem>
<asp:ListItem Value="&lt;"> < </asp:ListItem>
</asp:DropDownList>
</form>
</body>
</html>

0 comments on commit 3f9ef21

Please sign in to comment.