Multiple CSP tests complain about undefined strings in echo-object-data.pl and echo...
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Aug 2013 19:24:58 +0000 (19:24 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Aug 2013 19:24:58 +0000 (19:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=119692

Reviewed by Darin Adler.

* http/tests/security/contentSecurityPolicy/resources/echo-object-data.pl:
* http/tests/security/contentSecurityPolicy/resources/echo-script-src.pl:
Check whether optional CGI parameters are provided.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153953 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/security/contentSecurityPolicy/resources/echo-object-data.pl
LayoutTests/http/tests/security/contentSecurityPolicy/resources/echo-script-src.pl

index 0f4cf2d..c1e4ddd 100644 (file)
@@ -1,3 +1,14 @@
+2013-08-12  Alexey Proskuryakov  <ap@apple.com>
+
+        Multiple CSP tests complain about undefined strings in echo-object-data.pl and echo-script-src.pl
+        https://bugs.webkit.org/show_bug.cgi?id=119692
+
+        Reviewed by Darin Adler.
+
+        * http/tests/security/contentSecurityPolicy/resources/echo-object-data.pl:
+        * http/tests/security/contentSecurityPolicy/resources/echo-script-src.pl:
+        Check whether optional CGI parameters are provided.
+
 2013-08-12  Dean Jackson  <dino@apple.com>
 
         Shadows don't support viewport units
index d6e140b..44123f1 100755 (executable)
@@ -5,19 +5,20 @@ use CGI;
 my $cgi = new CGI;
 
 print "Content-Type: text/html; charset=UTF-8\n";
-if ($cgi->param('experimental') eq 'true') {
-    print "X-WebKit-CSP: ".$cgi->param('csp')."\n\n";
+my $experimental = $cgi->param('experimental') || "";
+if ($experimental eq 'true') {
+    print "X-WebKit-CSP: " . $cgi->param('csp') . "\n\n";
 } else {
-    print "Content-Security-Policy: ".$cgi->param('csp')."\n\n";
+    print "Content-Security-Policy: " . $cgi->param('csp') . "\n\n";
 }
 
 print "<!DOCTYPE html>\n";
 print "<html>\n";
 print "<body>\n";
 print "<script src=\"/plugins/resources/mock-plugin-logger.js\"></script>\n";
-print "<object data=\"".$cgi->param('plugin')."\"\n";
-print "        log=\"".$cgi->param('log')."\"\n" if $cgi->param('log');
-print "        type=\"".$cgi->param('type')."\"\n" if $cgi->param('type');
+print "<object data=\"" . $cgi->param('plugin') . "\"\n";
+print "        log=\"" . $cgi->param('log') . "\"\n" if $cgi->param('log');
+print "        type=\"" . $cgi->param('type') . "\"\n" if $cgi->param('type');
 print "></object>\n";
 print "</body>\n";
 print "</html>\n";
index 6b8bff3..15a5951 100755 (executable)
@@ -5,18 +5,19 @@ use CGI;
 my $cgi = new CGI;
 
 print "Content-Type: text/html; charset=UTF-8\n";
-if ($cgi->param('experimental') eq 'true') {
-    print "X-WebKit-CSP: ".$cgi->param('csp')."\n\n";
+my $experimental = $cgi->param('experimental') || "";
+if ($experimental eq 'true') {
+    print "X-WebKit-CSP: " . $cgi->param('csp') . "\n\n";
 } else {
-    print "Content-Security-Policy: ".$cgi->param('csp')."\n\n";
+    print "Content-Security-Policy: " . $cgi->param('csp') . "\n\n";
 }
 
 my ($text, $replacement) = ("FAIL", "PASS");
 ($text, $replacement) = ($replacement, $text) if $cgi->param('should_run') eq 'no';
 
-my $nonce = "";
-if ($cgi->param('nonce') ne '') {
-  $nonce = "nonce='".$cgi->param('nonce')."'";
+my $nonce = $cgi->param('nonce') || "";
+if ($nonce ne "") {
+    $nonce = "nonce='" . $nonce . "'";
 }
 
 
@@ -26,6 +27,6 @@ print "<body>\n";
 print "<div id=\"result\" text=\"$replacement\">\n";
 print "$text\n";
 print "</div>\n";
-print "<script $nonce src=\"".$cgi->param('q')."\"></script>\n";
+print "<script $nonce src=\"" . $cgi->param('q') . "\"></script>\n";
 print "</body>\n";
 print "</html>\n";