| Index: LayoutTests/http/tests/navigation/resources/check-beacon.php
|
| diff --git a/LayoutTests/http/tests/navigation/resources/check-beacon.php b/LayoutTests/http/tests/navigation/resources/check-beacon.php
|
| index 0fadda190d02741e4c97da04fa8cb3caaf6ffa90..9b42b96672311573eb3e85c40ae336a42c145479 100644
|
| --- a/LayoutTests/http/tests/navigation/resources/check-beacon.php
|
| +++ b/LayoutTests/http/tests/navigation/resources/check-beacon.php
|
| @@ -1,6 +1,10 @@
|
| <?php
|
| -$beaconFilename = "beacon" . (isset($_REQUEST['name']) ? $_REQUEST['name'] : "") . ".txt";
|
| -$retries = isset($_REQUEST['retries']) ? (int)$_REQUEST['retries'] : -1;
|
| +require_once '../../resources/portabilityLayer.php';
|
| +
|
| +$beaconFilename = sys_get_temp_dir() . "/beacon" . (isset($_REQUEST['name']) ? $_REQUEST['name'] : "") . ".txt";
|
| +
|
| +$max_attempts = 700;
|
| +$retries = isset($_REQUEST['retries']) ? (int)$_REQUEST['retries'] : $max_attempts;
|
| while (!file_exists($beaconFilename) && $retries != 0) {
|
| usleep(10000);
|
| # file_exists() caches results, we want to invalidate the cache.
|
| @@ -11,15 +15,22 @@ while (!file_exists($beaconFilename) && $retries != 0) {
|
| header('Content-Type: text/plain');
|
| header('Access-Control-Allow-Origin: *');
|
| if (file_exists($beaconFilename)) {
|
| - echo "Beacon sent successfully\n";
|
| - $beaconFile = fopen($beaconFilename, 'r');
|
| - while ($line = fgets($beaconFile)) {
|
| - $trimmed = trim($line);
|
| - if ($trimmed != "")
|
| - echo "$trimmed\n";
|
| + $beaconFile = false;
|
| + if (is_readable($beaconFilename)) {
|
| + $beaconFile = fopen($beaconFilename, 'r');
|
| + }
|
| + if ($beaconFile) {
|
| + echo "Beacon sent successfully\n";
|
| + while ($line = fgets($beaconFile)) {
|
| + $trimmed = trim($line);
|
| + if ($trimmed != "")
|
| + echo "$trimmed\n";
|
| + }
|
| + fclose($beaconFile);
|
| + unlink($beaconFilename);
|
| + } else {
|
| + echo "Beacon status not readable\n";
|
| }
|
| - fclose($beaconFile);
|
| - unlink($beaconFilename);
|
| } else {
|
| echo "Beacon not sent\n";
|
| }
|
|
|