Currently addToLocalStorage() catches exceptions from webStorage.setItem() and falls back to writing to cookies if an exception happened (code). This seems wrong:
- It doesn't check self.defaultToCookie before doing so.
- Since browserSupportsLocalStorage is true, there's no matching code in getFromLocalStorage() to read the saved value.
In practice this leads to the following problem: if the local storage limit is exceeded, the data starts being written to cookies, which quickly overflows the cookie size limits and causes 400.