You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Public get/set/remove methods will execute localStorage code if $cookieStore method cause exception #79
For the public get(), set() and remove() methods, if supported == false and any type of exception occurs, the code specific to localStorage will attempt to run, even though supported == false.
For example, this is the current set():
set: function(key,value){if(!supported){try{$cookieStore.put(key,value);returnvalue;}catch(e){$log.log('Local Storage not supported, make sure you have angular-cookies enabled.');}}// THE FOLLOWING LINES RUN WHEN THE CATCH(E) ABOVE IS TRIGGEREDvarsaver=angular.toJson(value);storage.setItem(key,saver);returnprivateMethods.parseValue(saver);},
Suggest doing the following:
set: function(key,value){if(!supported){try{$cookieStore.put(key,value);returnvalue;}catch(e){$log.log('Local Storage not supported, make sure you have angular-cookies enabled.');}}else{// THIS CODE WILL NOW ONLY EVER EXECUTE IF (supported)varsaver=angular.toJson(value);storage.setItem(key,saver);returnprivateMethods.parseValue(saver);}},
changed the title [-]Public get/set methods will execute localStorage code if $cookieStore method cause exception[/-][+]Public get/set/remove methods will execute localStorage code if $cookieStore method cause exception[/+]on Aug 6, 2015
Activity
[-]Public get/set methods will execute localStorage code if $cookieStore method cause exception[/-][+]Public get/set/remove methods will execute localStorage code if $cookieStore method cause exception[/+]