am 7885c30d: am de5dc9a5: am f51f30d7: remove cookie expiration and add max-age of 2 years. bug: 17781603

* commit '7885c30d761d5769d1e55742a762d5535b18894c':
  remove cookie expiration and add max-age of 2 years. bug: 17781603
This commit is contained in:
smain@google.com 2014-11-03 22:31:33 +00:00 committed by Android Git Automerger
commit 40ddbc9537

View file

@ -900,16 +900,14 @@ function readCookie(cookie) {
return 0;
}
function writeCookie(cookie, val, section, expiration) {
function writeCookie(cookie, val, section, age) {
if (val==undefined) return;
section = section == null ? "_" : "_"+section+"_";
if (expiration == null) {
var date = new Date();
date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
expiration = date.toGMTString();
if (age == null) {
var age = 2*365*24*60*60; // set max-age to 2 years
}
var cookieValue = cookie_namespace + section + cookie + "=" + val
+ "; expires=" + expiration+"; path=/";
+ "; max-age=" + age +"; path=/";
document.cookie = cookieValue;
}