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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/internal-to-internal-xhr.html

Issue 1745083002: CORS-RFC1918: Force preflights for external requests in DocumentThreadableLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test. Created 4 years, 7 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
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <!-- No 'treat-as-public-address' CSP directive, so we count as internal. -- >
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <script src="./resources/preflight.js"></script>
8 </head>
9 <body>
10 <script>
11 async_test(function (t) {
12 var xhr = new XMLHttpRequest;
13 xhr.responseType = "json";
14 xhr.onload = t.step_func_done(function (e) {
15 assert_equals('success', xhr.response.jsonpResult);
16 });
17 xhr.onerror = t.unreached_func("The load should not fail.");
18
19 xhr.open("GET", preflightURL('fail-with-500', 'json'), true);
20 xhr.send();
21 }, "XHR should pass on failed preflight (because no preflight is sent)") ;
22
23 async_test(function (t) {
24 var xhr = new XMLHttpRequest;
25 xhr.responseType = "json";
26 xhr.onload = t.step_func_done(function (e) {
27 assert_equals('success', xhr.response.jsonpResult);
28 });
29 xhr.onerror = t.unreached_func("The load should not fail.");
30
31 xhr.open("GET", preflightURL('fail-without-allow', 'json'), true);
32 xhr.send();
33 }, "XHR should pass on failed preflight (because no preflight is sent)") ;
34
35
36 async_test(function (t) {
37 var xhr = new XMLHttpRequest;
38 xhr.responseType = "json";
39 xhr.onload = t.step_func_done(function (e) {
40 assert_equals('success', xhr.response.jsonpResult);
41 });
42 xhr.onerror = t.unreached_func("The load should not fail.");
43
44 xhr.open("GET", preflightURL('pass', 'json'), true);
45 xhr.send();
46 }, "XHR should pass on successful preflight");
47 </script>
48 </body>
49 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698