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

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: Rebase. 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/update.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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'; // Set mode to 'init' for initial fetch.
4 header('Cache-Control: max-age=86400'); 4 else
5 $mode = $_COOKIE['mode']; // $_COOKIE['mode'] is either 'normal' or 'error'.
5 6
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");
10
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);
27 }
6 // Return a different script for each access. 28 // Return a different script for each access.
7 header('Content-Type:application/javascript'); 29 echo '// ' . microtime();
8 echo '// ' . microtime()
9 ?> 30 ?>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/update.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698