From-Origin: Support for 'same' and 'same-site' response header, nested frame origin...
[WebKit.git] / LayoutTests / http / tests / from-origin / resources / iframeLocalhostFetch.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script>
5         function fetchError() {
6             top.postMessage("fetchError", "http://127.0.0.1:8000");
7         }
8
9         function fetchSuccess() {
10             top.postMessage("fetchSuccess", "http://127.0.0.1:8000");
11         }
12
13         fetch("http://localhost:8000/from-origin/resources/fetch.php?fromOrigin=same").then(function(response) {
14             return response.json();
15         }).then(function(data) {
16             const parsedData = JSON.parse(data);
17             if (parsedData.Fetch)
18                 fetchSuccess();
19             else
20                 fetchError();
21         }).catch(function(error) {
22             fetchError();
23         });
24 </script>
25 </head>
26 <body>
27     <h3>The iframe making a localhost fetch call.</h3>
28 </body>
29 </html>