Index: LayoutTests/http/tests/serviceworker/resources/update-worker-error.php |
diff --git a/LayoutTests/http/tests/serviceworker/resources/update-worker-error.php b/LayoutTests/http/tests/serviceworker/resources/update-worker-error.php |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c8f43db36cfc9ca1d80d320c42c9dc0724a3fa3f |
--- /dev/null |
+++ b/LayoutTests/http/tests/serviceworker/resources/update-worker-error.php |
@@ -0,0 +1,25 @@ |
+<?php |
nhiroki
2015/08/06 09:57:28
Can you rename this file to "update-error-worker.p
jungkees
2015/08/06 10:53:12
Sure, I'll change it.
|
+if(!isset($_COOKIE['mode'])) |
+ $mode = 'plain'; // For the first fetch, set the mode to plain. |
+else |
+ $mode = 'error'; // For the second fetch, set the mode to error. |
+ |
+// Plain mode sets the normal mimetype. |
+if ($mode == 'plain') { |
+ echo '// Plain mode.'; |
+ header("Cache-Control: no-cache, must-revalidate"); |
+ header("Pragma: no-cache"); |
nhiroki
2015/08/06 09:57:28
Let me confirm my understanding... in the latest s
jungkees
2015/08/06 10:53:12
Yes, that's my understanding and intention. I noti
jungkees
2015/08/07 05:18:30
I've double-checked this with jakearchibald@. It's
|
+ header('Content-Type:application/javascript'); |
+ setcookie('mode', 'error'); // Set cookie for 2nd fetch to work in error mode. |
+} |
+// Error mode sets a disallowed mimetype. |
+else if ($mode == 'error') { |
+ echo '// Error mode.'; |
+ header("Cache-Control: no-cache, must-revalidate"); |
+ header("Pragma: no-cache"); |
+ header('Content-Type:text/html'); |
+ unset($_COOKIE['mode']); |
+ setcookie('mode', '', time() - 3600); // Delete cookie at the end of the test. |
+} |
+echo '// ' . microtime(); |
+?> |