12 Replies Latest reply on May 20, 2014 6:03 AM by Aman Kumar

    Rho 4 bug report - localStorage is broken in certain circumstances

    Dan McCabe

      Steps to reproduce:

       

      1. Install RhoElements 4.0.0 CE Runtime.cab on MC9190CE.

      2. Point it at the web page below, hosted on a server.

      3. You will get: line 21: hasStorage catch:Error: QUOTA_EXCEEDED_ERR: DOM Exception 22 in the log file.

      4. If the web page is stored locally on the device, you will not see the error.

       

      I believe the problem exists in all 4 versions of the shared runtime.

      This makes it impossible to deploy offline web apps using Rho 4.

      This works fine in Rho 2.

      It shouldn't matter, but the device is not licensed.

       

       

      <!DOCTYPE html>

      <html>

      <head>

      <meta charset="UTF-8" />

       

      <script type="text/javascript">

         

          function hasStorage(){

              try {

                  var nt = new Date().getTime();

                  localStorage.setItem('hscheck', nt);

                  var st = localStorage.getItem('hscheck');

                  if (nt == st){

                      console.log("hasStorage res: true");

                      return true;

                  }else{

                      console.log("hasStorage res: false");

                      return false;

                  }

              } catch(err) {

                  console.log("hasStorage catch:"+err);

                  return false;

              }

       

          }

         

          function go(){ 

              try{

                  if (!hasStorage()){

                      document.body.innerHTML += "Local Storage NO";

                  }else{

                      document.body.innerHTML += "Local Storage YES";

                  }

              }catch(err){

                  console.log(err);

              }

             

          };

         

      </script>

       

      </head>

       

      <body onload="go()">

      Version 2<br />

      Local storage test<br />

      </body>

       

      </html>