Re:Apple introduces macOS Mojave
by erichurkman on Monday June 04, 2018 @03:44PM
(#17231508)
I wonder if they'll ever fix `localStorage` in private Safari windows. It breaks countless sites and Safari is the only browser to block it.
[ Parent
| on HN ]
Re:Apple introduces macOS Mojave
by madeofpalk on Monday June 04, 2018 @03:51PM
(#17231595)
Any site that is broken by Private Browsing causing storage quota exceptions in localStorage is going to be broken by quota exceptions under "normal" operation.
It's in the spec, maybe developers should make their websites a bit more resilient to the very real errors that can happen? Did they just forget about error handling?
spec? localstorage errors are not standardized, every browser gives quota exceeded error different name and number, you have to use something like
'' e.name.toLowerCase().includes("quota")
Re:Apple introduces macOS Mojave
by madeofpalk on Monday June 04, 2018 @04:52PM
(#17232326)
But localStorage.setItem() throwing an error definitely is in the spec, so if someone isn't handling Safari's localStorage behaviour in Private Browsing Mode (that is, throwing exceptions) then they aren't handling the parts of the spec.
Re:Apple introduces macOS Mojave
by strictnein on Monday June 04, 2018 @07:56PM
(#17233771)
The web isn't built on specs, it's built on conventions. Safari breaks the convention.
Re:Apple introduces macOS Mojave
by madeofpalk on Monday June 04, 2018 @08:31PM
(#17233972)
the convention is that localStorage throws exceptions. it does in every browser. if a site breaks because it doesn't do error handling, then that's the site's problem.
You and many of the commenters miss an important point: Any apparent behaviour difference between private and non-private mode should be considered a bug, because sites can and do abuse it to detect private mode.
Re:Apple introduces macOS Mojave
by madeofpalk on Tuesday June 05, 2018 @06:05AM
(#17236271)
I disagree. You might be able to use it to _guess_ but all browsers can throw a quota exceeded exception under normal behaviour. I see this every now and then on mobile devices where the phone is so full the browser refuses to store more localStorage items.
This is exactly what I want to prevent though - I want to prevent dodgy sites from using the quota exceeded exceptions from localStorage to (100% accurately in my experience) guess that I'm browsing in private mode.
Re:Apple introduces macOS Mojave
by TheAceOfHearts on Monday June 04, 2018 @05:57PM
(#17232976)
I too wish they provided an ephemeral localStorage in private browsing.
But in any case, your application should be interacting with localStorage through an in-memory facade, otherwise it's still going to break with lots of other edge-cases. All operations should be treated as volatile, and probably silently suppressed on failures.
Using a facade also makes testing easier, and if you avoid global side-effects it becomes easier to parallelize test-cases.
I love Safari, it's my main browser - but there are so many small annoying things that take ages to fix it's just sad.
Chrome with certain privacy-conscious settings disallows access to localStorage as well. It broke something we built too.