2009-08-15 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Sat, 15 Aug 2009 00:32:46 +0000 (00:32 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Sat, 15 Aug 2009 00:32:46 +0000 (00:32 -0000)
* AspGenerator.cs: CodeRenderParser.DoParseExpressions - match
newline characters inside expressions. Fixes bug #526449

2009-08-15  Marek Habersack  <mhabersack@novell.com>

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

svn path=/trunk/mcs/; revision=139989

mcs/class/System.Web/ChangeLog
mcs/class/System.Web/Makefile
mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
mcs/class/System.Web/System.Web.Compilation/ChangeLog
mcs/class/System.Web/Test/System.Web.Compilation/TemplateControlCompilerTest.cs
mcs/class/System.Web/Test/mainsoft/NunitWebResources/NewlineInCodeExpression.aspx [new file with mode: 0644]

index 54287ab63b2bec62d382f65a18c55105eda0419b..3254af03e2463c996e38a91d80df4dc348c684fb 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-15  Marek Habersack  <mhabersack@novell.com>
+
+       * Makefile (TEST_RESOURCE_FILES): added
+       Test/mainsoft/NunitWebResources/NewlineInCodeExpression.aspx
+
 2009-07-30  Raja R Harinath  <harinath@hurrynot.org>
 
        * Makefile ($(build_lib)): Move cyclic dependencies onto this.
index 10e2d8adff144133be267f9d0ba879fead053e21..1cc9d70493fc88d40e11bd4423e05e0754c488ec 100644 (file)
@@ -174,7 +174,8 @@ TEST_RESOURCE_FILES = \
        Test/mainsoft/NunitWebResources/PreprocessorDirectivesInMarkup.aspx \
        Test/mainsoft/NunitWebResources/UnquotedAngleBrackets.aspx \
        Test/mainsoft/NunitWebResources/FullTagsInText.aspx \
-       Test/mainsoft/NunitWebResources/TagsExpressionsAndCommentsInText.aspx
+       Test/mainsoft/NunitWebResources/TagsExpressionsAndCommentsInText.aspx \
+       Test/mainsoft/NunitWebResources/NewlineInCodeExpression.aspx
 
 RESX_DIST =  resources/TranslationResources.resx
 ifneq (1, $(FRAMEWORK_VERSION_MAJOR))
index 9a566676810a9c7c1e5546b6a1796dc4dabed307..8e5555bdffad390728006ad9d5342e152920c312 100644 (file)
@@ -1518,7 +1518,7 @@ namespace System.Web.Compilation
                        void DoParseExpressions (string str)
                        {
                                int startIndex = 0, index = 0;
-                               Regex codeDirective = new Regex ("(<%(?!@)(?<code>.*?)%>)|(<[\\w:\\.]+.*?runat=[\"']?server[\"']?.*?/>)",
+                               Regex codeDirective = new Regex ("(<%(?!@)(?<code>(.|\\s)*?)%>)|(<[\\w:\\.]+.*?runat=[\"']?server[\"']?.*?/>)",
                                                                 RegexOptions.Multiline | RegexOptions.Compiled | RegexOptions.CultureInvariant);
                                Match match;
                                int strLen = str.Length;
index 94c99e570d1cf69d2c97c1600bb3e525dacc2cce..662bf98f47eab29abaeef7fa55763e113c819766 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-15  Marek Habersack  <mhabersack@novell.com>
+
+       * AspGenerator.cs: CodeRenderParser.DoParseExpressions - match
+       newline characters inside expressions. Fixes bug #526449
+
 2009-08-14  Marek Habersack  <mhabersack@novell.com>
 
        * BuildManagerDirectoryBuilder.cs: when VirtualPathProvider
index 961dc780062e5ea3bfa97bf5c30300c9e6f7e44c..0c93fab2837d4bdaa2ad20a2b68ffcd9058568df 100644 (file)
@@ -58,6 +58,7 @@ namespace MonoTests.System.Web.Compilation {
                        WebTest.CopyResource (GetType (), "UnquotedAngleBrackets.aspx", "UnquotedAngleBrackets.aspx");
                        WebTest.CopyResource (GetType (), "FullTagsInText.aspx", "FullTagsInText.aspx");
                        WebTest.CopyResource (GetType (), "TagsExpressionsAndCommentsInText.aspx", "TagsExpressionsAndCommentsInText.aspx");
+                       WebTest.CopyResource (GetType (), "NewlineInCodeExpression.aspx", "NewlineInCodeExpression.aspx");
 #if NET_2_0
                        WebTest.CopyResource (GetType (), "InvalidPropertyBind1.aspx", "InvalidPropertyBind1.aspx");
                        WebTest.CopyResource (GetType (), "InvalidPropertyBind2.aspx", "InvalidPropertyBind2.aspx");
@@ -203,8 +204,17 @@ namespace MonoTests.System.Web.Compilation {
                        // Just test if it doesn't throw an exception
                        new WebTest ("PreprocessorDirectivesInMarkup.aspx").Run ();
                }
-#endif
 
+               [Test (Description="Bug #526449")]
+               public void NewlineInCodeExpression ()
+               {
+                       string pageHtml = new WebTest ("NewlineInCodeExpression.aspx").Run ();
+                       string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
+                       string originalHtml = "<a href=\"test\">bla</a>";
+                       HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
+               }
+#endif
+               
                [Test (Description="Bug #517656")]
                public void ServerControlInClientSideComment ()
                {
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWebResources/NewlineInCodeExpression.aspx b/mcs/class/System.Web/Test/mainsoft/NunitWebResources/NewlineInCodeExpression.aspx
new file mode 100644 (file)
index 0000000..12c8965
--- /dev/null
@@ -0,0 +1,17 @@
+<%@ Page Language="C#" AutoEventWireup="true" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+    <title></title>
+</head>
+<body>
+    <form id="form1" runat="server">
+    <div>
+    <%= MonoTests.stand_alone.WebHarness.HtmlDiff.BEGIN_TAG %><a href="<%= "test"
+        %>">bla</a><%= MonoTests.stand_alone.WebHarness.HtmlDiff.END_TAG %>
+    </div>
+    </form>
+</body>
+</html>