Storing JS in localStorage introduces a security risk as discussed here: http://lists.w3.org/Archives/Public/public-webcrypto-comments/2012Aug/0076.html . It would be better to encrypt the JS before storing.