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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/open-with-invalid-argument-is-noop.html

Issue 2297483002: Make XMLHttpRequest.open() throw for invalid URLs (Closed)
Patch Set: Test that invalid open() is no-op Created 4 years, 3 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 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script>
5 async_test(t => {
6 const xhr = new XMLHttpRequest();
7 xhr.open('GET', 'resources/get.txt');
8 xhr.onload = t.step_func(() => {
9 assert_equals(xhr.responseText, 'PASS');
10 t.done();
11 });
12
13 assert_throws('SyntaxError', () => {
14 xhr.open('FOO BAR', 'nonexistent');
15 }, 'open() should throw for a SyntaxError for an invalid method');
16
17 xhr.send();
18 }, 'open() with an invalid method is no-op');
19
20 async_test(t => {
21 const xhr = new XMLHttpRequest();
22 xhr.open('GET', 'resources/get.txt');
23 xhr.onload = t.step_func(() => {
24 assert_equals(xhr.responseText, 'PASS');
25 t.done();
26 });
27
28 assert_throws('SecurityError', () => {
29 xhr.open('CONNECT', 'nonexistent');
30 }, 'open() should throw for a SecurityError for a forbidden method');
31
32 xhr.send();
33 }, 'open() with a forbidden method is no-op');
34
35 async_test(t => {
36 const xhr = new XMLHttpRequest();
37 xhr.open('GET', 'resources/get.txt');
38 xhr.onload = t.step_func(() => {
39 assert_equals(xhr.responseText, 'PASS');
40 t.done();
41 });
42
43 assert_throws('SyntaxError', () => {
44 xhr.open('GET', 'http://localhost:foobar/');
45 }, 'open() should throw for a SyntaxError for an invalid method');
yhirano 2016/09/01 07:02:42 wrong description
tyoshino (SeeGerritForStatus) 2016/09/01 10:19:41 Good catches. Fixed
46
47 xhr.send();
48 }, 'open() with a forbidden method is no-op');
yhirano 2016/09/01 07:02:42 wrong name
tyoshino (SeeGerritForStatus) 2016/09/01 10:19:41 Done.
49 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698