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

Side by Side Diff: LayoutTests/fast/xmlhttprequest/xmlhttprequest-responsetype-before-open-sync-request.html

Issue 206223005: Forbid setting responseType on all sync XHRs. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix tests that set responseType on sync XHRs. Created 6 years, 9 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 <script> 5 <script>
6 description('This tests that XMLHttpRequest open() disallows synchronous HTTP(S) requests when a non-default responseType is set.'); 6 description('This tests that XMLHttpRequest open() disallows synchronous HTTP(S) requests when a non-default responseType is set.');
7 var xhr; 7 var xhr;
8 8
9 // HTTP 9 // HTTP
10 xhr = new XMLHttpRequest(); 10 xhr = new XMLHttpRequest();
11 evalAndLog("xhr.responseType = 'document';"); 11 evalAndLog("xhr.responseType = 'document';");
12 shouldThrow("xhr.open('GET', 'http://mydomain/', false);"); 12 shouldThrow("xhr.open('GET', 'http://mydomain/', false);");
13 13
14 // HTTPS 14 // HTTPS
15 xhr = new XMLHttpRequest(); 15 xhr = new XMLHttpRequest();
16 evalAndLog("xhr.responseType = 'document';"); 16 evalAndLog("xhr.responseType = 'document';");
17 shouldThrow("xhr.open('GET', 'https://mysecuredomain/', false);"); 17 shouldThrow("xhr.open('GET', 'https://mysecuredomain/', false);");
18 18
19 // FILE 19 // FILE
20 shouldBeEqualToString('window.location.protocol', 'file:'); 20 shouldBeEqualToString('window.location.protocol', 'file:');
21 xhr = new XMLHttpRequest(); 21 xhr = new XMLHttpRequest();
22 evalAndLog("xhr.responseType = 'document';"); 22 evalAndLog("xhr.responseType = 'document';");
23 evalAndLog("xhr.open('GET', window.location.href, false);"); 23 shouldThrow("xhr.open('GET', window.location.href, false);");
24 shouldBeEqualToString('xhr.responseType', 'document');
25 24
26 // DATA 25 // DATA
27 var dataUrl = 'data:text/html;charset=utf-8,%3C%21DOCTYPE%20' + 26 var dataUrl = 'data:text/html;charset=utf-8,%3C%21DOCTYPE%20' +
28 'html%3E%0D%0A%3Chtml%20lang%3D%22en%22%3E%0D%0A%3Chead%' + 27 'html%3E%0D%0A%3Chtml%20lang%3D%22en%22%3E%0D%0A%3Chead%' +
29 '3E%3Ctitle%3EEmbedded%20Window%3C%2Ftitle%3E%3C%2Fhead%' + 28 '3E%3Ctitle%3EEmbedded%20Window%3C%2Ftitle%3E%3C%2Fhead%' +
30 '3E%0D%0A%3Cbody%3E%3Ch1%3E42%3C%2Fh1%3E%3C%2Fbody%3E%0A' + 29 '3E%0D%0A%3Cbody%3E%3Ch1%3E42%3C%2Fh1%3E%3C%2Fbody%3E%0A' +
31 '%3C%2Fhtml%3E%0A%0D%0A'; 30 '%3C%2Fhtml%3E%0A%0D%0A';
32 xhr = new XMLHttpRequest(); 31 xhr = new XMLHttpRequest();
33 evalAndLog("xhr.responseType = 'document';"); 32 evalAndLog("xhr.responseType = 'document';");
34 evalAndLog("xhr.open('GET', dataUrl, false);"); 33 shouldThrow("xhr.open('GET', dataUrl, false);");
35 shouldBeEqualToString('xhr.responseType', 'document');
36 </script> 34 </script>
37 </head> 35 </head>
38 <body> 36 <body>
39 <div id="description"></div> 37 <div id="description"></div>
40 <div id="console"></div> 38 <div id="console"></div>
41 </body> 39 </body>
42 </html> 40 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698