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

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/update-worker.php

Issue 1268663003: Service Worker: Make ServiceWorkerRegistration.update() return a promise. (Blink Layout 3/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove output set before setcookie. Created 5 years, 4 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
1 <?php 1 <?php
2 // Force the browser to cache this script. update() should always bypass this 2 if(!isset($_COOKIE['mode']))
3 // cache and fetch a new version. 3 $mode = 'init'; // For the first fetch, set the mode to 'init'.
4 header('Cache-Control: max-age=86400'); 4 else
5 $mode = $_COOKIE['mode']; // $_COOKIE['mode'] is either 'normal' or 'error'.
5 6
7 // 'init' or 'normal' mode sets the normal mimetype.
8 if ($mode == 'init' || $mode == 'normal') {
9 header("Cache-Control: no-cache, must-revalidate");
10 header("Pragma: no-cache");
nhiroki 2015/08/10 02:32:42 Can you move these cache-control headers to out of
11 header('Content-Type:application/javascript');
12 if ($mode == 'init')
13 setcookie('mode', 'normal'); // To make 2nd fetch to work in 'normal' mode.
14 else
15 setcookie('mode', 'error'); // To make 3rd fetch to work in 'error' mode.
16 }
nhiroki 2015/08/10 02:32:42 if ($mode == 'init') { // ... } else if ($mode =
jungkees 2015/08/10 03:20:41 Re-organized the blocks as you commented. Looks mu
17 // 'error' mode sets a disallowed mimetype.
18 else if ($mode == 'error') {
19 header("Cache-Control: no-cache, must-revalidate");
20 header("Pragma: no-cache");
21 header('Content-Type:text/html');
22 unset($_COOKIE['mode']);
23 setcookie('mode', '', time() - 3600); // Delete cookie at the end of the test.
24 }
6 // Return a different script for each access. 25 // Return a different script for each access.
7 header('Content-Type:application/javascript'); 26 echo '// ' . microtime();
8 echo '// ' . microtime()
9 ?> 27 ?>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/update.html » ('j') | LayoutTests/http/tests/serviceworker/update.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698