Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1847 from cb1kenobi/timob-8255

[TIMOB-8281] Added checks around localstorage getItem() results.
  • Loading branch information...
commit a35af56ea44bec1119fe7e138f18b961ad332f0a 2 parents a3db1c2 + ab7f534
Bryan Hughes authored
View
5 mobileweb/titanium/Ti/App/Properties.js
@@ -39,7 +39,10 @@ define(["Ti/_/Evented", "Ti/_/lang"], function(Evented, lang) {
});
function getStorage(prop) {
- storage || (storage = JSON.parse(localStorage.getItem(storageKey)) || {});
+ if (!storage) {
+ var value = localStorage.getItem(storageKey);
+ storage = (require.is(value, "String") && JSON.parse(value)) || {};
+ }
if (prop) {
return storage[prop];
}
View
3  mobileweb/titanium/Ti/UI/Clipboard.js
@@ -3,7 +3,8 @@ define(["Ti/_/Evented", "Ti/_/lang"], function(Evented, lang) {
var storageKey = "ti:clipboard",
plainText = "text/plain",
error = 'Missing required argument "type"',
- cache = JSON.parse(localStorage.getItem(storageKey)) || {};
+ value = localStorage.getItem(storageKey),
+ cache = (require.is(value, "String") && JSON.parse(value)) || {};
function get(type) {
if (!type) {
Please sign in to comment.
Something went wrong with that request. Please try again.