mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1288482 - Backout bug 1042347. r=mcmanus
MozReview-Commit-ID: J3LmMfQ854V
This commit is contained in:
parent
af1323ff34
commit
c6165ca8ee
@ -239,7 +239,7 @@ net_CoalesceDirs(netCoalesceFlags flags, char* path)
|
||||
*/
|
||||
char *fwdPtr = path;
|
||||
char *urlPtr = path;
|
||||
char *endPath = path;
|
||||
char *lastslash = path;
|
||||
uint32_t traversal = 0;
|
||||
uint32_t special_ftp_len = 0;
|
||||
|
||||
@ -256,18 +256,34 @@ net_CoalesceDirs(netCoalesceFlags flags, char* path)
|
||||
special_ftp_len = 2;
|
||||
}
|
||||
|
||||
/* find the end of the path - places the cursor on \0, ? or # */
|
||||
for(; (*fwdPtr != '\0') &&
|
||||
(*fwdPtr != '?') &&
|
||||
/* find the last slash before # or ? */
|
||||
for(; (*fwdPtr != '\0') &&
|
||||
(*fwdPtr != '?') &&
|
||||
(*fwdPtr != '#'); ++fwdPtr)
|
||||
{
|
||||
}
|
||||
|
||||
endPath = fwdPtr;
|
||||
/* found nothing, but go back one only */
|
||||
/* if there is something to go back to */
|
||||
if (fwdPtr != path && *fwdPtr == '\0')
|
||||
{
|
||||
--fwdPtr;
|
||||
}
|
||||
|
||||
/* search the slash */
|
||||
for(; (fwdPtr != path) &&
|
||||
(*fwdPtr != '/'); --fwdPtr)
|
||||
{
|
||||
}
|
||||
lastslash = fwdPtr;
|
||||
fwdPtr = path;
|
||||
|
||||
/* replace all %2E or %2e with . in the path */
|
||||
for(; fwdPtr != endPath; ++fwdPtr)
|
||||
/* but stop at lastchar if non null */
|
||||
for(; (*fwdPtr != '\0') &&
|
||||
(*fwdPtr != '?') &&
|
||||
(*fwdPtr != '#') &&
|
||||
(*lastslash == '\0' || fwdPtr != lastslash); ++fwdPtr)
|
||||
{
|
||||
if (*fwdPtr == '%' && *(fwdPtr+1) == '2' &&
|
||||
(*(fwdPtr+2) == 'E' || *(fwdPtr+2) == 'e'))
|
||||
|
@ -301,32 +301,6 @@ add_test(function test_hugeStringThrows()
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_pathPercentEncodedDot()
|
||||
{
|
||||
var url = stringToURL("http://example.com/%2eX/X%2e/%2eX");
|
||||
do_check_eq(url.spec, "http://example.com/.X/X./.X");
|
||||
|
||||
url = stringToURL("http://example.com/hello/%2e%2E/%2e");
|
||||
do_check_eq(url.spec, "http://example.com/");
|
||||
|
||||
url = stringToURL("http://example.com/hello/%2e%2E/%");
|
||||
do_check_eq(url.spec, "http://example.com/%");
|
||||
|
||||
url = stringToURL("http://example.com/hello/%2e%2E/%2");
|
||||
do_check_eq(url.spec, "http://example.com/%2");
|
||||
|
||||
url = stringToURL("http://example.com/hello/%2e%2E/%#");
|
||||
do_check_eq(url.spec, "http://example.com/%#");
|
||||
|
||||
url = stringToURL("http://example.com/hello/%2e%2E/%2?");
|
||||
do_check_eq(url.spec, "http://example.com/%2?");
|
||||
|
||||
url = stringToURL("http://example.com/hello/%2e/");
|
||||
do_check_eq(url.spec, "http://example.com/hello/");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_filterWhitespace()
|
||||
{
|
||||
var url = stringToURL(" \r\n\th\nt\rt\tp://ex\r\n\tample.com/path\r\n\t/\r\n\tto the/fil\r\n\te.e\r\n\txt?que\r\n\try#ha\r\n\tsh \r\n\t ");
|
||||
|
@ -132,6 +132,9 @@
|
||||
[Parsing: <http://www.google.com/foo?bar=baz# »> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <data:test# »> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
@ -435,3 +438,8 @@
|
||||
[Parsing: <http:> against <https://example.org/foo/bar>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e%2> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
@ -123,6 +123,9 @@
|
||||
[Parsing: <file://test> against <file:///tmp/mock/path>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <data:test# »> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
@ -444,3 +447,8 @@
|
||||
[Parsing: <http:> against <https://example.org/foo/bar>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e%2> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
@ -75,6 +75,9 @@
|
||||
[Parsing: <http://www.google.com/foo?bar=baz# »> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <data:test# »> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
@ -279,3 +282,8 @@
|
||||
[Parsing: <http://www/foo%2Ehtml> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e%2> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
||||
[Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank>]
|
||||
expected: FAIL
|
||||
|
Loading…
Reference in New Issue
Block a user