-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix invalid cast with end script tag containing code (#193)
- Loading branch information
1 parent
26e8d86
commit 56fa17b
Showing
13 changed files
with
213 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
....Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@{ | ||
<script type="text/javascript" @{} ></script @foo > | ||
} | ||
<script></script @ |
38 changes: 38 additions & 0 deletions
38
....Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.codegen.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// <auto-generated/> | ||
#pragma warning disable 1591 | ||
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles | ||
{ | ||
#line hidden | ||
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags_DesignTime | ||
{ | ||
#pragma warning disable 219 | ||
private void __RazorDirectiveTokenHelpers__() { | ||
} | ||
#pragma warning restore 219 | ||
#pragma warning disable 0414 | ||
private static System.Object __o = null; | ||
#pragma warning restore 0414 | ||
#pragma warning disable 1998 | ||
public async System.Threading.Tasks.Task ExecuteAsync() | ||
{ | ||
#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml" | ||
|
||
|
||
|
||
#line default | ||
#line hidden | ||
#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml" | ||
|
||
|
||
#line default | ||
#line hidden | ||
#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml" | ||
|
||
|
||
#line default | ||
#line hidden | ||
} | ||
#pragma warning restore 1998 | ||
} | ||
} | ||
#pragma warning restore 1591 |
1 change: 1 addition & 0 deletions
1
.../TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.diagnostics.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml(5,11): Error RZ1024: End of file or an unexpected character was reached before the "script" tag could be parsed. Elements inside markup blocks must be complete. They must either be self-closing ("<br />") or have matching end tags ("<p>Hello</p>"). If you intended to display a "<" character, use the "<" HTML entity. |
30 changes: 30 additions & 0 deletions
30
...uage.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.ir.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Document - | ||
NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles | ||
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags_DesignTime - - | ||
DesignTimeDirective - | ||
CSharpCode - | ||
IntermediateToken - - CSharp - #pragma warning disable 0414 | ||
CSharpCode - | ||
IntermediateToken - - CSharp - private static System.Object __o = null; | ||
CSharpCode - | ||
IntermediateToken - - CSharp - #pragma warning restore 0414 | ||
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync | ||
CSharpCode - (2:0,2 [6] Tags.cshtml) | ||
IntermediateToken - (2:0,2 [6] Tags.cshtml) - CSharp - \n | ||
HtmlContent - (8:1,4 [31] Tags.cshtml) | ||
IntermediateToken - (8:1,4 [7] Tags.cshtml) - Html - <script | ||
IntermediateToken - (15:1,11 [23] Tags.cshtml) - Html - type="text/javascript" | ||
IntermediateToken - (38:1,34 [1] Tags.cshtml) - Html - | ||
CSharpCode - (41:1,37 [0] Tags.cshtml) | ||
IntermediateToken - (41:1,37 [0] Tags.cshtml) - CSharp - | ||
HtmlContent - (42:1,38 [17] Tags.cshtml) | ||
IntermediateToken - (42:1,38 [1] Tags.cshtml) - Html - | ||
IntermediateToken - (43:1,39 [1] Tags.cshtml) - Html - > | ||
IntermediateToken - (44:1,40 [15] Tags.cshtml) - Html - </script @foo > | ||
CSharpCode - (59:1,55 [2] Tags.cshtml) | ||
IntermediateToken - (59:1,55 [2] Tags.cshtml) - CSharp - \n | ||
HtmlContent - (64:3,0 [20] Tags.cshtml) | ||
IntermediateToken - (64:3,0 [2] Tags.cshtml) - Html - \n | ||
IntermediateToken - (66:4,0 [7] Tags.cshtml) - Html - <script | ||
IntermediateToken - (73:4,7 [1] Tags.cshtml) - Html - > | ||
IntermediateToken - (74:4,8 [10] Tags.cshtml) - Html - </script @ |
19 changes: 19 additions & 0 deletions
19
...est/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.mappings.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Source Location: (2:0,2 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml) | ||
| | ||
| | ||
Generated Location: (709:18,2 [6] ) | ||
| | ||
| | ||
|
||
Source Location: (41:1,37 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml) | ||
|| | ||
Generated Location: (865:24,37 [0] ) | ||
|| | ||
|
||
Source Location: (59:1,55 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml) | ||
| | ||
| | ||
Generated Location: (1033:29,55 [2] ) | ||
| | ||
| | ||
|
21 changes: 21 additions & 0 deletions
21
...age.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_Runtime.codegen.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "42fb758ed87c3709cfb3f3aeff7a9cf8d242b74c" | ||
// <auto-generated/> | ||
#pragma warning disable 1591 | ||
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags_Runtime), @"default", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml")] | ||
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles | ||
{ | ||
#line hidden | ||
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"42fb758ed87c3709cfb3f3aeff7a9cf8d242b74c", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml")] | ||
public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags_Runtime | ||
{ | ||
#pragma warning disable 1998 | ||
public async System.Threading.Tasks.Task ExecuteAsync() | ||
{ | ||
WriteLiteral(" <script type=\"text/javascript\" "); | ||
WriteLiteral(" ></script @foo >\r\n"); | ||
WriteLiteral("\r\n<script></script @"); | ||
} | ||
#pragma warning restore 1998 | ||
} | ||
} | ||
#pragma warning restore 1591 |
1 change: 1 addition & 0 deletions
1
...est/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_Runtime.diagnostics.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml(5,11): Error RZ1024: End of file or an unexpected character was reached before the "script" tag could be parsed. Elements inside markup blocks must be complete. They must either be self-closing ("<br />") or have matching end tags ("<p>Hello</p>"). If you intended to display a "<" character, use the "<" HTML entity. |
27 changes: 27 additions & 0 deletions
27
...anguage.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_Runtime.ir.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Document - | ||
RazorCompiledItemAttribute - | ||
NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles | ||
RazorSourceChecksumAttribute - | ||
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags_Runtime - - | ||
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync | ||
CSharpCode - (2:0,2 [2] Tags.cshtml) | ||
IntermediateToken - (2:0,2 [2] Tags.cshtml) - CSharp - \n | ||
HtmlContent - (4:1,0 [35] Tags.cshtml) | ||
IntermediateToken - (4:1,0 [4] Tags.cshtml) - Html - | ||
IntermediateToken - (8:1,4 [7] Tags.cshtml) - Html - <script | ||
IntermediateToken - (15:1,11 [23] Tags.cshtml) - Html - type="text/javascript" | ||
IntermediateToken - (38:1,34 [1] Tags.cshtml) - Html - | ||
CSharpCode - (41:1,37 [0] Tags.cshtml) | ||
IntermediateToken - (41:1,37 [0] Tags.cshtml) - CSharp - | ||
HtmlContent - (42:1,38 [19] Tags.cshtml) | ||
IntermediateToken - (42:1,38 [1] Tags.cshtml) - Html - | ||
IntermediateToken - (43:1,39 [1] Tags.cshtml) - Html - > | ||
IntermediateToken - (44:1,40 [15] Tags.cshtml) - Html - </script @foo > | ||
IntermediateToken - (59:1,55 [2] Tags.cshtml) - Html - \n | ||
CSharpCode - (61:2,0 [0] Tags.cshtml) | ||
IntermediateToken - (61:2,0 [0] Tags.cshtml) - CSharp - | ||
HtmlContent - (64:3,0 [20] Tags.cshtml) | ||
IntermediateToken - (64:3,0 [2] Tags.cshtml) - Html - \n | ||
IntermediateToken - (66:4,0 [7] Tags.cshtml) - Html - <script | ||
IntermediateToken - (73:4,7 [1] Tags.cshtml) - Html - > | ||
IntermediateToken - (74:4,8 [10] Tags.cshtml) - Html - </script @ |
10 changes: 10 additions & 0 deletions
10
...tCore.Razor.Language.Test/TestFiles/ParserTests/HtmlTagsTest/ScriptTag_Invalid.cspans.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [25] ) | ||
Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [25] ) | ||
MetaCode span at (1:0,1 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [25] ) | ||
Markup span at (2:0,2 [1] ) (Accepts:Any) - Parent: Markup block at (2:0,2 [22] ) | ||
Markup span at (3:0,3 [8] ) (Accepts:None) - Parent: Tag block at (3:0,3 [8] ) | ||
Markup span at (11:0,11 [12] ) (Accepts:None) - Parent: Tag block at (11:0,11 [12] ) | ||
Markup span at (23:0,23 [1] ) (Accepts:None) - Parent: Markup block at (2:0,2 [22] ) | ||
Code span at (24:0,24 [0] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [25] ) | ||
MetaCode span at (24:0,24 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [25] ) | ||
Markup span at (25:0,25 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [25] ) |
38 changes: 38 additions & 0 deletions
38
...etCore.Razor.Language.Test/TestFiles/ParserTests/HtmlTagsTest/ScriptTag_Invalid.stree.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
RazorDocument - [0..25)::25 - [@{ <script></script @ > }] | ||
MarkupBlock - [0..25)::25 | ||
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup> - SpanEditHandler;Accepts:Any | ||
Marker;[]; | ||
CSharpCodeBlock - [0..25)::25 | ||
CSharpStatement - [0..25)::25 | ||
CSharpTransition - [0..1)::1 - Gen<None> - SpanEditHandler;Accepts:None | ||
Transition;[@]; | ||
CSharpStatementBody - [1..25)::24 | ||
RazorMetaCode - [1..2)::1 - Gen<None> - SpanEditHandler;Accepts:None | ||
LeftBrace;[{]; | ||
CSharpCodeBlock - [2..24)::22 | ||
MarkupBlock - [2..24)::22 | ||
MarkupTextLiteral - [2..3)::1 - [ ] - Gen<Markup> - SpanEditHandler;Accepts:Any | ||
Whitespace;[ ]; | ||
MarkupElement - [3..23)::20 | ||
MarkupStartTag - [3..11)::8 - [<script>] - Gen<Markup> - SpanEditHandler;Accepts:None | ||
OpenAngle;[<]; | ||
Text;[script]; | ||
CloseAngle;[>]; | ||
MarkupEndTag - [11..23)::12 - [</script @ >] - Gen<Markup> - SpanEditHandler;Accepts:None | ||
OpenAngle;[<]; | ||
ForwardSlash;[/]; | ||
Text;[script]; | ||
MarkupMiscAttributeContent - [19..22)::3 | ||
MarkupTextLiteral - [19..22)::3 - [ @ ] - Gen<Markup> - SpanEditHandler;Accepts:Any | ||
Whitespace;[ ]; | ||
Transition;[@]; | ||
Whitespace;[ ]; | ||
CloseAngle;[>]; | ||
MarkupTextLiteral - [23..24)::1 - [ ] - Gen<Markup> - SpanEditHandler;Accepts:None | ||
Whitespace;[ ]; | ||
CSharpStatementLiteral - [24..24)::0 - [] - Gen<Stmt> - SpanEditHandler;Accepts:Any | ||
Marker;[]; | ||
RazorMetaCode - [24..25)::1 - Gen<None> - SpanEditHandler;Accepts:None | ||
RightBrace;[}]; | ||
MarkupTextLiteral - [25..25)::0 - [] - Gen<Markup> - SpanEditHandler;Accepts:Any | ||
Marker;[]; |