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

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

Issue 2054203002: service worker: Fix the type of an update promise reject value (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: FIXME => TODO Created 4 years, 5 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 if(!isset($_COOKIE['mode'])) 2 if(!isset($_COOKIE['mode']))
3 $mode = 'init'; // Set mode to 'init' for initial fetch. 3 $mode = 'init'; // Set mode to 'init' for initial fetch.
4 else 4 else
5 $mode = $_COOKIE['mode']; // $_COOKIE['mode'] is either 'normal' or 'error'. 5 $mode = $_COOKIE['mode']; // $_COOKIE['mode'] is either 'normal' or 'error'.
6 6
7 // no-cache itself to ensure the user agent finds a new version for each update. 7 // no-cache itself to ensure the user agent finds a new version for each update.
8 header("Cache-Control: no-cache, must-revalidate"); 8 header("Cache-Control: no-cache, must-revalidate");
9 header("Pragma: no-cache"); 9 header("Pragma: no-cache");
10 10
11 $extra_body = '';
12
11 if ($mode == 'init') { 13 if ($mode == 'init') {
12 // Set a normal mimetype. 14 // Set a normal mimetype.
13 // Set cookie value to 'normal' so the next fetch will work in 'normal' mode. 15 // Set cookie value to 'normal' so the next fetch will work in 'normal' mode.
14 header('Content-Type:application/javascript'); 16 header('Content-Type:application/javascript');
15 setcookie('mode', 'normal'); 17 setcookie('mode', 'normal');
16 } else if ($mode == 'normal') { 18 } else if ($mode == 'normal') {
17 // Set a normal mimetype. 19 // Set a normal mimetype.
18 // Set cookie value to 'error' so the next fetch will work in 'error' mode. 20 // Set cookie value to 'error' so the next fetch will work in 'error' mode.
19 header('Content-Type:application/javascript'); 21 header('Content-Type:application/javascript');
20 setcookie('mode', 'error'); 22 setcookie('mode', 'error');
21 } else if ($mode == 'error') { 23 } else if ($mode == 'error') {
22 // Set a disallowed mimetype. 24 // Set a disallowed mimetype.
25 // Set cookie value to 'syntax-error' so the next fetch will work in 'syntax-e rror' mode.
26 header('Content-Type:text/html');
27 setcookie('mode', 'syntax-error');
28 } else if ($mode == 'syntax-error') {
29 // Set cookie value to 'throw-install' so the next fetch will work in 'throw-i nstall' mode.
30 header('Content-Type:application/javascript');
31 setcookie('mode', 'throw-install');
32 $extra_body = 'badsyntax(isbad;';
33 } else if ($mode == 'throw-install') {
23 // Unset and delete cookie to clean up the test setting. 34 // Unset and delete cookie to clean up the test setting.
24 header('Content-Type:text/html'); 35 header('Content-Type:application/javascript');
25 unset($_COOKIE['mode']); 36 unset($_COOKIE['mode']);
26 setcookie('mode', '', time() - 3600); 37 setcookie('mode', '', time() - 3600);
38 $extra_body = "addEventListener('install', function(e) { throw new Error('boom '); });";
27 } 39 }
28 // Return a different script for each access. 40 // Return a different script for each access.
29 echo '// ' . microtime(); 41 echo '/* ', microtime(), ' */ ', $extra_body;
30 ?> 42 ?>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698