Function to test whether an inline script variable is defined or not. testJam
authortvyas
Thu, 03 May 2012 15:13:33 -0700
branchtestJam
changeset 50 487ce3228e6e
parent 49 944dc5de5245
child 51 52bab77694f6
Function to test whether an inline script variable is defined or not.
tests/csp/submitted/mozilla/assertTrue.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/csp/submitted/mozilla/assertTrue.php	Thu May 03 15:13:33 2012 -0700
@@ -0,0 +1,18 @@
+<?php
+
+//Prevent Caching
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+header("Cache-Control: no-store, no-cache, must-revalidate");
+header("Cache-Control: post-check=0, pre-check=0", false);
+header("Pragma: no-cache");
+header("Content-Type: text/javascript");
+
+	print("(function () { if(typeof " . $_GET["varName"] . "=='undefined') {
+				 test(function() {assert_true(" . $_GET["varName"] . ")}, \"assert_true with unsafeScript\"); 
+		        	} else{
+				   test(function() {assert_true(" . $_GET["varName"] . ")}, \"assert_true with unsafeScript defined when it shouldn't be\"); 
+				}  })();");
+
+?>
+