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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-data-saver.html

Issue 1698973002: Exempt Save-Data header from CORS preflight request check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added layout test Created 4 years, 10 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 <html> 1 <html>
2 <body> 2 <body>
3 <p>Test that preflight requests with invalid status code results in error. Shoul d print PASS.</p> 3 <p>Test that 'Save-Data' header is treated as a simple header and preflight requ est is not created. Should print PASS.</p>
4 <div id="log"></div> 4 <div id="log"></div>
5 <script> 5 <script>
6 window.internals.settings.setDataSaverEnabled(true);
7
6 function log(message) { 8 function log(message) {
7 document.getElementById("log").innerHTML += message + "<br>"; 9 document.getElementById("log").innerHTML += message + "<br>";
8 } 10 }
9 11
10 if (window.layoutTestController) { 12 if (window.layoutTestController) {
11 layoutTestController.dumpAsText(); 13 layoutTestController.dumpAsText();
12 layoutTestController.waitUntilDone(); 14 layoutTestController.waitUntilDone();
13 } 15 }
14 16
15 var xhr = new XMLHttpRequest(); 17 var xhr = new XMLHttpRequest();
16 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-p reflight-request-invalid-status.php?code=400"); 18 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-p reflight-request-invalid-status.php?code=400");
17 xhr.setRequestHeader("X-Custom-Header", "PASS");
18 xhr.onerror = function () { 19 xhr.onerror = function () {
19 log("PASS"); 20 log("FAIL");
20 if (window.layoutTestController) 21 if (window.layoutTestController)
21 layoutTestController.notifyDone(); 22 layoutTestController.notifyDone();
22 }; 23 };
23 xhr.onload = function () { 24 xhr.onload = function () {
24 log("FAIL"); 25 log("PASS");
25 if (window.layoutTestController) 26 if (window.layoutTestController)
26 layoutTestController.notifyDone(); 27 layoutTestController.notifyDone();
27 }; 28 };
28 xhr.send(); 29 xhr.send();
29 </script> 30 </script>
31 </body>
30 </html> 32 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698