This commit is contained in:
Jonathan Kew 2011-04-08 20:30:27 -07:00
Родитель efffc0f64c f78ad42dc6
Коммит 27b549deaa
4 изменённых файлов: 1 добавлений и 70 удалений

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

@ -260,7 +260,6 @@ _TEST_FILES = \
test_bug610212.html \
test_bug633058.html \
test_bug641219.html \
test_bug643051.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -1,39 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=643051
-->
<head>
<title>Test for Bug 643051</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=643051">Mozilla Bug 643051</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 643051 **/
document.cookie = "foo=; expires=Thu, 01-Jan-1970 00:00:01 GMT"; // clear cookie
document.cookie = "foo2=; expires=Thu, 01-Jan-1970 00:00:01 GMT"; // clear cookie
document.cookie = "foo3=; expires=Thu, 01-Jan-1970 00:00:01 GMT"; // clear cookie
// single cookie, should work
document.cookie = "foo=bar";
is(document.cookie, "foo=bar", "Can't read stored cookie!");
document.cookie = "foo2=bar\nfoo3=bar";
is(document.cookie, "foo=bar; foo2=bar", "Wrong cookie value");
document.cookie = "foo2=baz; foo3=bar";
is(document.cookie, "foo=bar; foo2=baz", "Wrong cookie value");
</script>
</pre>
</body>
</html>

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

@ -1550,11 +1550,7 @@ nsCookieService::SetCookieStringInternal(nsIURI *aHostURI,
// process each cookie in the header
nsDependentCString cookieHeader(aCookieHeader);
while (SetCookieInternal(aHostURI, baseDomain, requireHostMatch,
cookieStatus, cookieHeader, serverTime, aFromHttp)) {
// document.cookie can only set one cookie at a time
if (!aFromHttp)
break;
}
cookieStatus, cookieHeader, serverTime, aFromHttp));
}
// notify observers that a cookie was rejected due to the users' prefs.

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

@ -1,25 +0,0 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/NetUtil.jsm");
function run_test() {
let cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
let uri = NetUtil.newURI("http://example.org/");
let set = "foo=bar\nbaz=foo";
let expected = "foo=bar; baz=foo";
cs.setCookieStringFromHttp(uri, null, null, set, null, null);
let actual = cs.getCookieStringFromHttp(uri, null, null);
do_check_eq(actual, expected);
uri = NetUtil.newURI("http://example.com/");
cs.setCookieString(uri, null, set, null);
expected = "foo=bar";
actual = cs.getCookieString(uri, null, null);
do_check_eq(actual, expected);
}