[MERGE] forward port of branch 7.0 up to revid 5270 chs@openerp.com-20140403084524...
[odoo/odoo.git] / addons / web / static / src / js / core.js
index 3e2b93a..066cccc 100644 (file)
@@ -296,7 +296,12 @@ instance.web.Session.include( /** @lends instance.web.Session# */{
         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) {
+                    // wrong cookie, delete it
+                    this.set_cookie(name, '', -1);
+                }
             }
         }
         return null;