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

Side by Side Diff: LayoutTests/fast/xmlhttprequest/xmlhttprequest-open-exceptions.html

Issue 23041002: Improve 'XMLHttpRequest' exception messages. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ExceptionMessages. Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <meta http-equiv="Content-Security-Policy" content="connect-src http://examp le.com"> 4 <meta http-equiv="Content-Security-Policy" content="connect-src http://examp le.com">
5 </head> 5 </head>
6 <body> 6 <body>
7 <script src="../js/resources/js-test-pre.js"></script> 7 <script src="../js/resources/js-test-pre.js"></script>
8 <script> 8 <script>
9 description("This tests that exceptions thrown by XHR.open() have reason able messages."); 9 description("This tests that exceptions thrown by XHR.open() have reason able messages.");
10 10
11 var xhrException; 11 var xhrException;
12 try { 12 try {
13 var xhr = new XMLHttpRequest(); 13 var xhr = new XMLHttpRequest();
14 xhr.open("TRACE", "http://example.com/"); 14 xhr.open("TRACE", "http://example.com/");
15 testFailed("xhr.open should throw an exception with a forbidden meth od type."); 15 testFailed("xhr.open should throw an exception with a forbidden meth od type.");
16 } catch (e) { 16 } catch (e) {
17 xhrException = e; 17 xhrException = e;
18 shouldBeEqualToString("xhrException.message", "'XMLHttpRequest.open' does not support the 'TRACE' method."); 18 shouldBeEqualToString("xhrException.message", "Failed to execute 'op en' on 'XMLHttpRequest': 'TRACE' HTTP method is unsupported.");
19 } 19 }
20 20
21 try { 21 try {
22 var xhr = new XMLHttpRequest(); 22 var xhr = new XMLHttpRequest();
23 xhr.open("GET", "http://not.example.com/"); 23 xhr.open("GET", "http://not.example.com/");
24 testFailed("xhr.open to a URL blocked by CSP should throw an excepti on."); 24 testFailed("xhr.open to a URL blocked by CSP should throw an excepti on.");
25 } catch (e) { 25 } catch (e) {
26 xhrException = e; 26 xhrException = e;
27 shouldBeEqualToString("xhrException.message", "Refused to connect to 'http://not.example.com/' because it violates the document's Content Security P olicy."); 27 shouldBeEqualToString("xhrException.message", "Refused to connect to 'http://not.example.com/' because it violates the document's Content Security P olicy.");
28 } 28 }
29 </script> 29 </script>
30 <script src="../js/resources/js-test-post.js"></script> 30 <script src="../js/resources/js-test-post.js"></script>
31 </body> 31 </body>
32 </html> 32 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698