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

Unified Diff: LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php

Issue 399543002: [ServiceWorker] Make fetch() method better conformance with the spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated falken's comment Created 6 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php
diff --git a/LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php b/LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php
new file mode 100644
index 0000000000000000000000000000000000000000..ea70d086957da1bd20ddfb210206b0a88e43eb26
--- /dev/null
+++ b/LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php
@@ -0,0 +1,42 @@
+<?php
+header('X-ServiceWorker-ServerHeader: SetInTheServer');
+if (isset($_GET['ACAOrigin'])) {
+ $origins = explode(',', $_GET['ACAOrigin']);
+ for ($i = 0; $i < sizeof($origins); ++$i)
+ header("Access-Control-Allow-Origin: " . $origins[$i], false);
+}
+
+if (isset($_GET['ACAHeaders']))
+ header("Access-Control-Allow-Headers: {$_GET['ACAHeaders']}");
+if (isset($_GET['ACAMethods']))
+ header("Access-Control-Allow-Methods: {$_GET['ACAMethods']}");
+if (isset($_GET['ACACredentials']))
+ header("Access-Control-Allow-Credentials: {$_GET['ACACredentials']}");
+if (isset($_GET['ACEHeaders']))
+ header("Access-Control-Expose-Headers: {$_GET['ACEHeaders']}");
+
+if ((isset($_GET['Auth']) and !isset($_SERVER['PHP_AUTH_USER'])) || isset($_GET['AuthFail'])) {
+ header('WWW-Authenticate: Basic realm="Restricted"');
+ header('HTTP/1.0 401 Unauthorized');
+ echo 'Authentication canceled';
+ exit;
+}
+
+$username = 'undefined';
+$password = 'undefined';
+if (isset($_SERVER['PHP_AUTH_USER'])) {
+ $username = $_SERVER['PHP_AUTH_USER'];
+}
+if (isset($_SERVER['PHP_AUTH_PW'])) {
+ $password = $_SERVER['PHP_AUTH_PW'];
+}
+
+header('Content-Type: application/json');
+$arr = array('jsonpResult' => 'success',
+ 'method' => $_SERVER['REQUEST_METHOD'],
+ 'headers' => getallheaders(),
+ 'username' => $username,
+ 'password' => $password);
+$json = json_encode($arr);
+echo "report( $json );";
+?>

Powered by Google App Engine
This is Rietveld 408576698