You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Elvedin Hamzagic (JIRA)" <ji...@apache.org> on 2013/10/09 12:39:42 UTC

[jira] [Updated] (CB-5025) WP7 localStorage.getItem unexpected behaviour.

     [ https://issues.apache.org/jira/browse/CB-5025?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Elvedin Hamzagic updated CB-5025:
---------------------------------

    Description: 
Javascript for WP7 localStorage.getItem returns string 'undefined' when specified key exists and value is undefined. This scenario can be reproduced by adding some key/value to localStorage, then removing it.

The actual line in code in getItem function, which produce this behaviour, is:
retVal = window.unescape(decodeURIComponent(this._result));
The problem is that decodeURIComponent return string 'undefined' when input is undefined, and this should be fixed somehow like this:
retVal = this._result ? window.unescape(decodeURIComponent(this._result)) : this._result;



  was:
Javascript for WP7 localStorage.getItem returns string 'undefined' when specified key exists and value is undefined. This scenario can be triggered when adding some key/value to localStorage, then removing it.

The actual line in code in getItem function, which produce this behaviour, is:
retVal = window.unescape(decodeURIComponent(this._result));
The problem is that decodeURIComponent return string 'undefined' when input is undefined, and this should be fixed somehow like this:
retVal = this._result ? window.unescape(decodeURIComponent(this._result)) : this._result;




> WP7 localStorage.getItem unexpected behaviour.
> ----------------------------------------------
>
>                 Key: CB-5025
>                 URL: https://issues.apache.org/jira/browse/CB-5025
>             Project: Apache Cordova
>          Issue Type: Bug
>            Reporter: Elvedin Hamzagic
>            Priority: Minor
>              Labels: localStorage
>
> Javascript for WP7 localStorage.getItem returns string 'undefined' when specified key exists and value is undefined. This scenario can be reproduced by adding some key/value to localStorage, then removing it.
> The actual line in code in getItem function, which produce this behaviour, is:
> retVal = window.unescape(decodeURIComponent(this._result));
> The problem is that decodeURIComponent return string 'undefined' when input is undefined, and this should be fixed somehow like this:
> retVal = this._result ? window.unescape(decodeURIComponent(this._result)) : this._result;



--
This message was sent by Atlassian JIRA
(v6.1#6144)