This commit is contained in:
dwitte@stanford.edu 2007-12-04 18:45:40 -08:00
Родитель 88bdcd45e0
Коммит 00a26fac63
1 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@ -559,7 +559,27 @@ main(PRInt32 argc, char *argv[])
GetACookie(cookieService, "http://192.168.54.33/", "http://192.168.54.33/", getter_Copies(cookie));
rv[13] = CheckResult(cookie.get(), MUST_BE_NULL);
allTestsPassed = PrintResult(rv, 14) && allTestsPassed;
// test the case where the host is an eTLD, e.g. http://co.tv/ (a legitimate site)
SetACookie(cookieService, "http://co.uk/", "http://co.uk/", "test=foreign; domain=.co.uk", nsnull);
GetACookie(cookieService, "http://co.uk/", "http://co.uk/", getter_Copies(cookie));
// should be rejected, can't set a domain cookie for .co.uk
rv[14] = CheckResult(cookie.get(), MUST_BE_NULL);
SetACookie(cookieService, "http://co.uk/", "http://co.uk/", "test=foreign", nsnull);
GetACookie(cookieService, "http://co.uk/", "http://co.uk/", getter_Copies(cookie));
// should be allowed, hostURI == firstURI and it's not a domain cookie
rv[15] = CheckResult(cookie.get(), MUST_EQUAL, "test=foreign");
GetACookie(cookieService, "http://oblivious.co.uk/", nsnull, getter_Copies(cookie));
rv[16] = CheckResult(cookie.get(), MUST_BE_NULL);
// remove cookie
SetACookie(cookieService, "http://co.uk/", "http://co.uk/", "test=foreign; max-age=0", nsnull);
GetACookie(cookieService, "http://co.uk/", "http://co.uk/", getter_Copies(cookie));
rv[17] = CheckResult(cookie.get(), MUST_BE_NULL);
SetACookie(cookieService, "http://co.uk/", "http://evil.co.uk/", "test=foreign", nsnull);
GetACookie(cookieService, "http://co.uk/", "http://co.uk/", getter_Copies(cookie));
// should be rejected, hostURI != firstURI and hostURI is an eTLD
rv[18] = CheckResult(cookie.get(), MUST_BE_NULL);
allTestsPassed = PrintResult(rv, 19) && allTestsPassed;
// *** parser tests