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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/external-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 <meta http-equiv="Content-Security-Policy" content="treat-as-public-address" >
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.onload = t.unreached_func("The load should fail.");
14 xhr.onerror = t.step_func_done(function (e) {
15 assert_equals(0, e.loaded);
16 });
17
18 xhr.open("GET", preflightURL('fail-with-500', 'json'), true);
19 xhr.send();
20 }, "XHR should fail on failed preflight: 500 status");
21
22 async_test(function (t) {
23 var xhr = new XMLHttpRequest;
24 xhr.onload = t.unreached_func("The load should fail.");
25 xhr.onerror = t.step_func_done(function (e) {
26 assert_equals(0, e.loaded);
27 });
28
29 xhr.open("GET", preflightURL('fail-without-allow', 'json'), true);
30 xhr.send();
31 }, "XHR should fail on failed preflight: no allow-external");
32
33
34 async_test(function (t) {
35 var xhr = new XMLHttpRequest;
36 xhr.responseType = "json";
37 xhr.onload = t.step_func_done(function (e) {
38 assert_equals('success', xhr.response.jsonpResult);
39 });
40 xhr.onerror = t.unreached_func("The load should not fail.");
41
42 xhr.open("GET", preflightURL('pass', 'json'), true);
43 xhr.send();
44 }, "XHR should pass on successful preflight");
45 </script>
46 </body>
47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698