Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / serviceworker / resources / update-worker.php
blob1f2ebbbc180bf81c7f83f52baff6c511aa3f7b20
1 <?php
2 if(!isset($_COOKIE['mode']))
3 $mode = 'init'; // Set mode to 'init' for initial fetch.
4 else
5 $mode = $_COOKIE['mode']; // $_COOKIE['mode'] is either 'normal' or 'error'.
7 // no-cache itself to ensure the user agent finds a new version for each update.
8 header("Cache-Control: no-cache, must-revalidate");
9 header("Pragma: no-cache");
11 if ($mode == 'init') {
12 // Set a normal mimetype.
13 // Set cookie value to 'normal' so the next fetch will work in 'normal' mode.
14 header('Content-Type:application/javascript');
15 setcookie('mode', 'normal');
16 } else if ($mode == 'normal') {
17 // Set a normal mimetype.
18 // Set cookie value to 'error' so the next fetch will work in 'error' mode.
19 header('Content-Type:application/javascript');
20 setcookie('mode', 'error');
21 } else if ($mode == 'error') {
22 // Set a disallowed mimetype.
23 // Unset and delete cookie to clean up the test setting.
24 header('Content-Type:text/html');
25 unset($_COOKIE['mode']);
26 setcookie('mode', '', time() - 3600);
28 // Return a different script for each access.
29 echo '// ' . microtime();