1[ 2 { "input": "test", "output": [["test", ""]] }, 3 { "input": "\uFEFFtest=\uFEFF", "output": [["\uFEFFtest", "\uFEFF"]] }, 4 { "input": "%EF%BB%BFtest=%EF%BB%BF", "output": [["\uFEFFtest", "\uFEFF"]] }, 5 { "input": "%FE%FF", "output": [["\uFFFD\uFFFD", ""]] }, 6 { "input": "%FF%FE", "output": [["\uFFFD\uFFFD", ""]] }, 7 { "input": "†&†=x", "output": [["†", ""], ["†", "x"]] }, 8 { "input": "%C2", "output": [["\uFFFD", ""]] }, 9 { "input": "%C2x", "output": [["\uFFFDx", ""]] }, 10 { "input": "_charset_=windows-1252&test=%C2x", "output": [["_charset_", "windows-1252"], ["test", "\uFFFDx"]] }, 11 { "input": '', "output": [] }, 12 { "input": 'a', "output": [['a', '']] }, 13 { "input": 'a=b', "output": [['a', 'b']] }, 14 { "input": 'a=', "output": [['a', '']] }, 15 { "input": '=b', "output": [['', 'b']] }, 16 { "input": '&', "output": [] }, 17 { "input": '&a', "output": [['a', '']] }, 18 { "input": 'a&', "output": [['a', '']] }, 19 { "input": 'a&a', "output": [['a', ''], ['a', '']] }, 20 { "input": 'a&b&c', "output": [['a', ''], ['b', ''], ['c', '']] }, 21 { "input": 'a=b&c=d', "output": [['a', 'b'], ['c', 'd']] }, 22 { "input": 'a=b&c=d&', "output": [['a', 'b'], ['c', 'd']] }, 23 { "input": '&&&a=b&&&&c=d&', "output": [['a', 'b'], ['c', 'd']] }, 24 { "input": 'a=a&a=b&a=c', "output": [['a', 'a'], ['a', 'b'], ['a', 'c']] }, 25 { "input": 'a==a', "output": [['a', '=a']] }, 26 { "input": 'a=a+b+c+d', "output": [['a', 'a b c d']] }, 27 { "input": '%=a', "output": [['%', 'a']] }, 28 { "input": '%a=a', "output": [['%a', 'a']] }, 29 { "input": '%a_=a', "output": [['%a_', 'a']] }, 30 { "input": '%61=a', "output": [['a', 'a']] }, 31 { "input": '%61+%4d%4D=', "output": [['a MM', '']] } 32].forEach((val) => { 33 test(() => { 34 let sp = new URLSearchParams(val.input), 35 i = 0 36 for (let item of sp) { 37 assert_array_equals(item, val.output[i]) 38 i++ 39 } 40 }, "URLSearchParams constructed with: " + val.input) 41 42 promise_test(() => { 43 let init = new Request("about:blank", { body: val.input, method: "LADIDA", headers: {"Content-Type": "application/x-www-form-urlencoded;charset=windows-1252"} }).formData() 44 return init.then((fd) => { 45 let i = 0 46 for (let item of fd) { 47 assert_array_equals(item, val.output[i]) 48 i++ 49 } 50 }) 51 }, "request.formData() with input: " + val.input) 52 53 promise_test(() => { 54 let init = new Response(val.input, { headers: {"Content-Type": "application/x-www-form-urlencoded;charset=shift_jis"} }).formData() 55 return init.then((fd) => { 56 let i = 0 57 for (let item of fd) { 58 assert_array_equals(item, val.output[i]) 59 i++ 60 } 61 }) 62 }, "response.formData() with input: " + val.input) 63}); 64