Try to make some xssAuditor tests less flakey.
[webkit:qtwebkit.git] / LayoutTests / http / tests / security / xssAuditor / resources / echo-intertag.pl
1 #!/usr/bin/perl -wT
2 use strict;
3 use CGI;
4
5 my $cgi = new CGI;
6
7 if ($cgi->param('enable-full-block')) {
8     print "X-XSS-Protection: 1; mode=block\n";
9 }
10 if ($cgi->param('disable-protection')) {
11     print "X-XSS-Protection: 0\n";
12 }
13 if ($cgi->param('crazy-header')) {
14     print "X-XSS-Protection:   1  ;MoDe =  bLocK   \n";
15 }
16 if ($cgi->param('custom-header')) {
17     print $cgi->param('custom-header') . "\n";
18 }
19 print "Content-Type: text/html; charset=UTF-8\n\n";
20
21 print "<!DOCTYPE html>\n";
22 print "<html>\n";
23 if ($cgi->param('relay-target-ids-for-event')) {
24     print "<script>\n";
25     print "document.addEventListener('" . $cgi->param('relay-target-ids-for-event') . "', function(event) {\n";
26     print "    window.parent.postMessage(event.target.id, '*');\n";
27     print "}, true);\n";
28     print "</script>\n";
29 }
30 print "<body>\n";
31 print $cgi->param('q');
32 if ($cgi->param('notifyDone')) {
33     print "<script>\n";
34     print "if (window.layoutTestController)\n";
35     print "    layoutTestController.notifyDone();\n";
36     print "</script>\n";
37 }
38 if ($cgi->param('enable-full-block')) {
39     print "<p>If you see this message then the test FAILED.</p>\n";
40 }
41 print "</body>\n";
42 print "</html>\n";