1
1
mirror of https://github.com/ariya/phantomjs.git synced 2024-09-11 12:55:33 +03:00

Issue #13638: optional cookie properties should not leak.

This commit is contained in:
tmallery 2015-12-21 09:36:55 -05:00 committed by Zack Weinberg
parent 1e9b6aaae8
commit cbe3e2afbf
2 changed files with 52 additions and 0 deletions

View File

@ -254,6 +254,7 @@ QVariantList CookieJar::cookiesToMap(const QString& url) const
for (int i = cookiesList.length() - 1; i >= 0; --i) {
c = cookiesList.at(i);
cookie.clear();
cookie["domain"] = QVariant(c.domain());
cookie["name"] = QVariant(QString(c.name()));
cookie["value"] = QVariant(QString(c.value()));

View File

@ -0,0 +1,51 @@
var cookies = {
'beforeExpires': {
'name': 'beforeExpires',
'value': 'expireValue',
'domain': '.abc.com',
'path': '/',
'httponly': false,
'secure': false,
'expires': 'Tue, 10 Jun 2025 12:28:29 GMT'
},
'noExpiresDate': {
'name': 'noExpiresDate',
'value': 'value',
'domain': '.abc.com',
'path': '/',
'httponly': false,
'secure': false,
'expires': null
},
'afterExpires': {
'name': 'afterExpires',
'value': 'value',
'domain': '.abc.com',
'path': '/',
'httponly': false,
'secure': false,
'expires': 'Mon, 10 Jun 2024 12:28:29 GMT'
}
};
test(function () {
var i, c, d, prop;
for (i in cookies) {
if (!cookiesWithExpires.hasOwnProperty(i)) continue;
phantom.addCookie(cookiesWithExpires[i]);
}
for (i in phantom.cookies) {
d = phantom.cookies[i];
c = cookies[d.name];
for (prop in c) {
if (!c.hasOwnProperty(prop)) continue;
if (c[prop] === null) {
assert_no_property(d, prop);
} else {
assert_own_property(d, prop);
assert_equals(c[prop], d[prop]);
}
}
}
}, "optional cookie properties should not leak");