Bug 826798 - Network inspector does not correctly render cookie; r=past

This commit is contained in:
Mihai Sucan 2013-01-08 23:25:57 +02:00
Родитель 78d1ce6a1f
Коммит eeebd2339b
5 изменённых файлов: 16 добавлений и 9 удалений

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

@ -290,7 +290,9 @@ this.NetworkHelper =
let result = [];
cookies.forEach(function(aCookie) {
let [name, value] = aCookie.split("=");
let equal = aCookie.indexOf("=");
let name = aCookie.substr(0, equal);
let value = aCookie.substr(equal + 1);
result.push({name: unescape(name.trim()),
value: unescape(value.trim())});
});
@ -314,8 +316,9 @@ this.NetworkHelper =
let cookies = [];
rawCookies.forEach(function(aCookie) {
let name = unescape(aCookie.substr(0, aCookie.indexOf("=")).trim());
let parts = aCookie.substr(aCookie.indexOf("=") + 1).split(";");
let equal = aCookie.indexOf("=");
let name = unescape(aCookie.substr(0, equal).trim());
let parts = aCookie.substr(equal + 1).split(";");
let value = unescape(parts.shift().trim());
let cookie = {name: name, value: value};

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

@ -30,6 +30,7 @@
document.cookie = "foobar=fooval";
document.cookie = "omgfoo=bug768096";
document.cookie = "badcookie=bug826798=st3fan";
// --></script>
</head>
<body>

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

@ -74,7 +74,7 @@ function onNetworkEventUpdate(aState, aType, aPacket)
break;
case "requestCookies":
expectedPacket = {
cookies: 2,
cookies: 3,
};
break;
case "requestPostData":
@ -151,11 +151,12 @@ function onRequestCookies(aState, aResponse)
{
info("checking request cookies");
is(aResponse.cookies.length, 2, "request cookies length");
is(aResponse.cookies.length, 3, "request cookies length");
checkHeadersOrCookies(aResponse.cookies, {
foobar: "fooval",
omgfoo: "bug768096",
badcookie: "bug826798=st3fan",
});
onRequestPostData = onRequestPostData.bind(null, aState);

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

@ -96,7 +96,7 @@ function onNetworkEventUpdate(aState, aType, aPacket)
break;
case "requestCookies":
expectedPacket = {
cookies: 2,
cookies: 3,
};
break;
case "requestPostData":
@ -174,11 +174,12 @@ function onRequestCookies(aState, aResponse)
{
info("checking request cookies");
is(aResponse.cookies.length, 2, "request cookies length");
is(aResponse.cookies.length, 3, "request cookies length");
checkHeadersOrCookies(aResponse.cookies, {
foobar: "fooval",
omgfoo: "bug768096",
badcookie: "bug826798=st3fan",
});
onRequestPostData = onRequestPostData.bind(null, aState);

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

@ -89,7 +89,7 @@ function onNetworkEventUpdate(aState, aType, aPacket)
break;
case "requestCookies":
expectedPacket = {
cookies: 2,
cookies: 3,
};
break;
case "requestPostData":
@ -167,11 +167,12 @@ function onRequestCookies(aState, aResponse)
{
info("checking request cookies");
is(aResponse.cookies.length, 2, "request cookies length");
is(aResponse.cookies.length, 3, "request cookies length");
checkHeadersOrCookies(aResponse.cookies, {
foobar: "fooval",
omgfoo: "bug768096",
badcookie: "bug826798=st3fan",
});
onRequestPostData = onRequestPostData.bind(null, aState);