{"action":"created","issue":{"url":"https://api.github.com/repos/gsklee/ngStorage/issues/175","repository_url":"https://api.github.com/repos/gsklee/ngStorage","labels_url":"https://api.github.com/repos/gsklee/ngStorage/issues/175/labels{/name}","comments_url":"https://api.github.com/repos/gsklee/ngStorage/issues/175/comments","events_url":"https://api.github.com/repos/gsklee/ngStorage/issues/175/events","html_url":"https://github.com/gsklee/ngStorage/issues/175","id":109333810,"number":175,"title":"ngStorage seems to confuse $sessionStorage and $localStorage","user":{"login":"NitroInside","id":12461419,"avatar_url":"https://avatars.githubusercontent.com/u/12461419?v=3","gravatar_id":"","url":"https://api.github.com/users/NitroInside","html_url":"https://github.com/NitroInside","followers_url":"https://api.github.com/users/NitroInside/followers","following_url":"https://api.github.com/users/NitroInside/following{/other_user}","gists_url":"https://api.github.com/users/NitroInside/gists{/gist_id}","starred_url":"https://api.github.com/users/NitroInside/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NitroInside/subscriptions","organizations_url":"https://api.github.com/users/NitroInside/orgs","repos_url":"https://api.github.com/users/NitroInside/repos","events_url":"https://api.github.com/users/NitroInside/events{/privacy}","received_events_url":"https://api.github.com/users/NitroInside/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-01T16:16:19Z","updated_at":"2016-03-17T13:11:17Z","closed_at":null,"body":"ngStorage seems to confuse $sessionStorage and $localStorage, following this flow:\r\n\r\n * Existing data \"A: {B: 'localstorage-main'}\" in $localStorage\r\n * Existing data \"A: {C: 'sessionstorage-main'}\" in $sessionStorage\r\n * Application reads data A.C from $sessionStorage correctly\r\n * Application pop-up a new Window of the same App (in another route).\r\n * New window operates in $localStorage (to pass data to the first Window). Setting: $localStorage['A']['D'] = 'localstorage-second';\r\n * First window tries to read \"A.C\" from $sessionStorage (in code), but in debugging $sessionStorage contains \"{A: {B: 'localstorage-main', D: 'localstorage-second'}}\".\r\n\r\nAn execution screenshot can be seen here: http://prntscr.com/8ow3bh"},"comment":{"url":"https://api.github.com/repos/gsklee/ngStorage/issues/comments/197872638","html_url":"https://github.com/gsklee/ngStorage/issues/175#issuecomment-197872638","issue_url":"https://api.github.com/repos/gsklee/ngStorage/issues/175","id":197872638,"user":{"login":"makarenkodenis","id":7600865,"avatar_url":"https://avatars.githubusercontent.com/u/7600865?v=3","gravatar_id":"","url":"https://api.github.com/users/makarenkodenis","html_url":"https://github.com/makarenkodenis","followers_url":"https://api.github.com/users/makarenkodenis/followers","following_url":"https://api.github.com/users/makarenkodenis/following{/other_user}","gists_url":"https://api.github.com/users/makarenkodenis/gists{/gist_id}","starred_url":"https://api.github.com/users/makarenkodenis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makarenkodenis/subscriptions","organizations_url":"https://api.github.com/users/makarenkodenis/orgs","repos_url":"https://api.github.com/users/makarenkodenis/repos","events_url":"https://api.github.com/users/makarenkodenis/events{/privacy}","received_events_url":"https://api.github.com/users/makarenkodenis/received_events","type":"User","site_admin":false},"created_at":"2016-03-17T13:11:17Z","updated_at":"2016-03-17T13:11:17Z","body":"Hi, it seems like a bug by creating session storage. \r\nSession storage is subscribed to the 'storage' event:\r\n```javascript\r\n$window.addEventListener && $window.addEventListener('storage', function(event) {\r\n    ...\r\n});\r\n```\r\nbut events are coming in by changing the local storage. \r\nIf both storages contain the same key and the value in local storage was changed then the session storage becomes corrupted because it will be updated by the value from local storage."}}