[IMP] cookies: when retrieving session cookie, catch eventual errors and remove malformed cookie
bzr revid: mat@openerp.com-20140327113401-s3ee7fnexhre9mwb
This commit is contained in:
parent
649ef3ed21
commit
a04f73ee80
|
@ -125,7 +125,12 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
|
|||
for(var i=0; i<cookies.length; ++i) {
|
||||
var cookie = cookies[i].replace(/^\s*/, '');
|
||||
if(cookie.indexOf(nameEQ) === 0) {
|
||||
return JSON.parse(decodeURIComponent(cookie.substring(nameEQ.length)));
|
||||
try {
|
||||
return JSON.parse(decodeURIComponent(cookie.substring(nameEQ.length)));
|
||||
} catch (err) {
|
||||
// delete malformed cookie
|
||||
this.set_cookie(name, '', -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue