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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/xmlhttprequest/invalid-method.html

Issue 2297483002: Make XMLHttpRequest.open() throw for invalid URLs (Closed)
Patch Set: Addressed #12 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/xmlhttprequest/invalid-url.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script>
5 test(() => {
6 const NON_TOKEN_METHODS = [
7 '',
8 'test\r\nfoobar',
9 ' ',
10 'A A',
11 '"',
12 '(',
13 ')',
14 ',',
15 '/',
16 ':',
17 ';',
18 '<',
19 '=',
20 '>',
21 '?',
22 '@',
23 '[',
24 '\\',
25 ']',
26 '{',
27 '}'
28 ];
29
30 for (let method of NON_TOKEN_METHODS) {
31 const xhr = new XMLHttpRequest();
32 assert_throws('SyntaxError', () => {
33 xhr.open(method, '/');
34 }, 'open() should throw for a SyntaxError for method "' + method +
35 '" which does not conform to the token ABNF');
36 }
37 }, 'Method strings that are not token');
38
39 test(() => {
40 const FORBIDDEN_METHODS = [
41 'CONNECT',
42 'connect',
43 'Connect',
44 'TRACE',
45 'TRACK'
46 ];
47
48 for (let method of FORBIDDEN_METHODS) {
49 const xhr = new XMLHttpRequest();
50 assert_throws('SecurityError', () => {
51 xhr.open(method, '/');
52 }, 'open() should throw a SecurityError for a forbidden method "' + method + '"');
53 }
54 }, 'Forbidden methods');
55 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/xmlhttprequest/invalid-url.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698