Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1772)

Side by Side Diff: LayoutTests/http/tests/navigation/resources/check-beacon.php

Issue 232053005: Implement navigator.sendBeacon() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Revert CSP checking on redirects Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <?php
2 $beaconFilename = "beacon" . (isset($_REQUEST['name']) ? $_REQUEST['name'] : "") . ".txt";
3 $retries = isset($_REQUEST['retries']) ? (int)$_REQUEST['retries'] : -1;
4 while (!file_exists($beaconFilename) && $retries != 0) {
5 usleep(10000);
6 # file_exists() caches results, we want to invalidate the cache.
7 clearstatcache();
8 $retries--;
9 }
10
11 header('Content-Type: text/plain');
12 header('Access-Control-Allow-Origin: *');
13 if (file_exists($beaconFilename)) {
14 echo "Beacon sent successfully\n";
15 $beaconFile = fopen($beaconFilename, 'r');
16 while ($line = fgets($beaconFile)) {
17 $trimmed = trim($line);
18 if ($trimmed != "")
19 echo "$trimmed\n";
20 }
21 fclose($beaconFile);
22 unlink($beaconFilename);
23 } else {
24 echo "Beacon not sent\n";
25 }
26 ?>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698