From 09e2f76f6722ecb4c28d4aba0de95addf247a281 Mon Sep 17 00:00:00 2001 From: Austin King <shout@ozten.com> Date: Fri, 4 May 2012 05:22:13 -0700 Subject: [PATCH] Consolidating exception logging, removing delete which can cause problems in Chrome. [Partially?] Fixes Issue#1546 --- resources/static/shared/storage.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/static/shared/storage.js b/resources/static/shared/storage.js index ecd0b7d40..1d78cc848 100644 --- a/resources/static/shared/storage.js +++ b/resources/static/shared/storage.js @@ -25,6 +25,11 @@ BrowserID.Storage = (function() { }; } + // temporary, replace with helpers.log if storage uses elog long term... + function elog (msg) { + if (window.console && console.error) console.error(msg); + } + function prepareDeps() { if (!jwcrypto) { jwcrypto = require("./jwcrypto"); @@ -409,7 +414,7 @@ BrowserID.Storage = (function() { try { return storage.interactionData ? JSON.parse(storage.interactionData)[0] : {}; } catch(e) { - if (window.console && console.error) console.error(e); + elog(e); return {}; } } @@ -420,7 +425,7 @@ BrowserID.Storage = (function() { id = JSON.parse(storage.interactionData); id[0] = data; } catch(e) { - if (window.console && console.error) console.error(e); + elog(e); id = [ data ]; } storage.interactionData = JSON.stringify(id); @@ -439,8 +444,7 @@ BrowserID.Storage = (function() { try { storage.interactionData = JSON.stringify([]); } catch(e) { - delete storage.interactionData; - if (window.console && console.error) console.error(e); + elog(e); } } -- GitLab