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:
parent
1e9b6aaae8
commit
cbe3e2afbf
@ -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()));
|
||||
|
51
test/module/cookiejar/to-map.js
Normal file
51
test/module/cookiejar/to-map.js
Normal 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");
|
Loading…
Reference in New Issue
Block a user