Brian Silverman | 70325d6 | 2015-09-20 17:00:43 -0400 | [diff] [blame^] | 1 | <!-- Tests for CopyFrom() --> |
| 2 | <html> |
| 3 | <body> |
| 4 | <?state save_context=body?> |
| 5 | <?state tag=body?> |
| 6 | <h1> |
| 7 | <?state save_context=h1?> |
| 8 | <?state tag=h1?> |
| 9 | <?state load_context=body?> |
| 10 | <?state tag=body?> |
| 11 | |
| 12 | <a href="http://www.google.com<?state save_context=href?>"></a> |
| 13 | |
| 14 | <script> |
| 15 | <?state save_context=js?> |
| 16 | var x ='<?state save_context=js_str_literal?> |
| 17 | <?state load_context=href?><?state state=value, |
| 18 | tag=a, |
| 19 | attr=href, |
| 20 | in_js=false, |
| 21 | value=http://www.google.com?> |
| 22 | <?state load_context=js_str_literal?> |
| 23 | <?state state=text, |
| 24 | tag=script, |
| 25 | in_js=true, |
| 26 | js_quoted=true?>'; |
| 27 | |
| 28 | // Regexp handling |
| 29 | var expression = 10 / <?state save_context=js_expression?> / <?state save_context=js_regexp?> /; |
| 30 | |
| 31 | <?state load_context=js_expression?><?state js_state=text?> |
| 32 | <?state load_context=js_regexp?><?state js_state=regexp?> /; |
| 33 | <?state js_state=text?> |
| 34 | |
| 35 | </script> |
| 36 | <?state in_js=false?> |
| 37 | <?state load_context=js?> |
| 38 | <?state tag=script, js_state=text, in_js=true?> |
| 39 | </script> |
| 40 | |
| 41 | <!-- html encoded script attribute --> |
| 42 | <a onclick="alert('<?state save_context=onclick_str_literal?>'"></a> |
| 43 | <?state in_js=false?> |
| 44 | <?state load_context=onclick_str_literal?><?state state=value, |
| 45 | tag=a, |
| 46 | attr=onclick, |
| 47 | attr_type=js, |
| 48 | in_js=true, |
| 49 | js_quoted=true?>'"> |
| 50 | <?state state=text, tag=a?> |
| 51 | </a> |
| 52 | |
| 53 | <!-- ResetMode() tests --> |
| 54 | |
| 55 | <?state reset_mode=css?> |
| 56 | <?state in_css=true?> |
| 57 | <?state state=css_file?> |
| 58 | <?state save_context=mode_css?> |
| 59 | |
| 60 | <?state reset_mode=html?> |
| 61 | <?state state=text?> |
| 62 | <?state in_css=false?> |
| 63 | <?state load_context=mode_css?> |
| 64 | <?state in_css=true?> |
| 65 | <?state state=css_file?> |
| 66 | |
| 67 | <?state reset_mode=html_in_tag?>blah=<?state save_context=in_tag?> |
| 68 | <?state load_context=onclick_str_literal?><?state state=value, |
| 69 | tag=a, |
| 70 | attr=onclick, |
| 71 | attr_type=js, |
| 72 | in_js=true, |
| 73 | js_quoted=true?>'"> |
| 74 | <?state load_context=in_tag?> |
| 75 | <?state attr=blah?>xpto<?state value=xpto?> |
| 76 | |
| 77 | |
| 78 | </body> |
| 79 | </html> |