| OLD | NEW |
| 1 <?php | 1 <?php |
| 2 while (!file_exists("csp-report.txt")) { | 2 while (!file_exists("csp-report." . $_GET["test"] . ".txt")) { |
| 3 usleep(10000); | 3 usleep(10000); |
| 4 // file_exists() caches results, we want to invalidate the cache. | 4 // file_exists() caches results, we want to invalidate the cache. |
| 5 clearstatcache(); | 5 clearstatcache(); |
| 6 } | 6 } |
| 7 | 7 |
| 8 echo "<html><body>\n"; | 8 echo "<html><body>\n"; |
| 9 echo "CSP report received:"; | 9 echo "CSP report received:"; |
| 10 $reportFile = fopen("csp-report.txt", 'r'); | 10 $reportFile = fopen("csp-report." . $_GET["test"] . ".txt", 'r'); |
| 11 while ($line = fgets($reportFile)) { | 11 while ($line = fgets($reportFile)) { |
| 12 echo "<br>"; | 12 echo "<br>"; |
| 13 echo trim($line); | 13 echo trim($line); |
| 14 } | 14 } |
| 15 fclose($reportFile); | 15 fclose($reportFile); |
| 16 unlink("csp-report.txt"); | 16 unlink("csp-report." . $_GET["test"] . ".txt"); |
| 17 echo "<script>"; | 17 echo "<script>"; |
| 18 echo "if (window.testRunner)"; | 18 echo "if (window.testRunner)"; |
| 19 echo " testRunner.notifyDone();"; | 19 echo " testRunner.notifyDone();"; |
| 20 echo "</script>"; | 20 echo "</script>"; |
| 21 echo "</body></html>"; | 21 echo "</body></html>"; |
| 22 ?> | 22 ?> |
| OLD | NEW |