summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorMartin Trigaux <mat@openerp.com>2014-03-27 13:08:26 +0100
committerMartin Trigaux <mat@openerp.com>2014-03-27 13:08:26 +0100
commit64ecfa40ec898bbfc5f4faa22eee4b98b024e524 (patch)
treee6b184c7d2f17369ecdbf9edc7165a656c75304f /addons/web/static/src
parent85805282b6994ad7a84e4cce24435332c1f664b5 (diff)
parenta04f73ee8051b68f5b95d6f71d3b637a8c9a8c92 (diff)
[IMP] cookies: when retrieving session cookie, catch eventual parsing errors and remove cookie if incorrect (opw 605648)
In case of unparsable cookie (modified, corrupted,...), openerp would not load and crash with white screen until expiration. With the fix goes back to login screen. bzr revid: mat@openerp.com-20140327120826-2p6ebnojtmdl1wpm
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/coresetup.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js
index 7d37dc2261d..1d6acf164d0 100644
--- a/addons/web/static/src/js/coresetup.js
+++ b/addons/web/static/src/js/coresetup.js
@@ -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) {
+ // wrong cookie, delete it
+ this.set_cookie(name, '', -1);
+ }
}
}
return null;