gecko-dev/netwerk/test/unit/test_cookie_blacklist.js
Nicholas Hurley d37329060e Bug 1191423 - Disallow illegal characters in cookies set via HTTP. r=jduell
--HG--
extra : rebase_source : 5ba6edf42c123c50fe351a735a44fb2b5b93bb9c
2015-09-04 09:58:31 -07:00

17 lines
787 B
JavaScript

const GOOD_COOKIE = "GoodCookie=OMNOMNOM";
function run_test() {
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var cookieURI = ios.newURI("http://mozilla.org/test_cookie_blacklist.js",
null, null);
var cookieService = Cc["@mozilla.org/cookieService;1"]
.getService(Ci.nsICookieService);
cookieService.setCookieStringFromHttp(cookieURI, cookieURI, null, "BadCookie1=\x01", null, null);
cookieService.setCookieStringFromHttp(cookieURI, cookieURI, null, "BadCookie2=\v", null, null);
cookieService.setCookieStringFromHttp(cookieURI, cookieURI, null, GOOD_COOKIE, null, null);
var storedCookie = cookieService.getCookieString(cookieURI, null);
do_check_eq(storedCookie, GOOD_COOKIE);
}