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

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

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

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

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

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

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

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

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