Bug 1163028 - URL: stop escaping [ and ] in path r=mcmanus

This commit is contained in:
Valentin Gosu 2015-11-02 13:54:10 +01:00
parent 7e19134192
commit e96a491a5d
2 changed files with 12 additions and 3 deletions

View File

@ -220,8 +220,9 @@ function test_clearedSpec()
symmetricEquality(true, url, ref);
}
function test_escapeQueryBrackets()
function test_escapeBrackets()
{
// Query
var url = stringToURL("http://example.com/?a[x]=1");
do_check_eq(url.spec, "http://example.com/?a[x]=1");
@ -233,6 +234,14 @@ function test_escapeQueryBrackets()
url = stringToURL("http://[2001::1]/?a%5Bx%5D=1");
do_check_eq(url.spec, "http://[2001::1]/?a%5Bx%5D=1");
// Path
url = stringToURL("http://example.com/brackets[x]/test");
do_check_eq(url.spec, "http://example.com/brackets[x]/test");
url = stringToURL("http://example.com/a%5Bx%5D/test");
do_check_eq(url.spec, "http://example.com/a%5Bx%5D/test");
}
function test_apostropheEncoding()
@ -251,6 +260,6 @@ function run_test()
test_ipv6();
test_ipv6_fail();
test_clearedSpec();
test_escapeQueryBrackets();
test_escapeBrackets();
test_apostropheEncoding();
}

View File

@ -360,7 +360,7 @@ static const uint32_t EscapeChars[256] =
0,1023, 0, 512,1023, 0,1023, 112,1023,1023,1023,1023,1023,1023, 953, 784, // 2x !"#$%&'()*+,-./
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1008,1008, 0,1008, 0, 768, // 3x 0123456789:;<=>?
1008,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, // 4x @ABCDEFGHIJKLMNO
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, 896, 896, 896, 896,1023, // 5x PQRSTUVWXYZ[\]^_
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1008, 896,1008, 896,1023, // 5x PQRSTUVWXYZ[\]^_
0,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, // 6x `abcdefghijklmno
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, 896,1012, 896,1023, 0, // 7x pqrstuvwxyz{|}~ DEL
0 // 80 to FF are zero