Skip to content

Fix private browsing issue #44

wants to merge 4 commits into from

4 participants

Sebastien P added some commits Oct 29, 2012

Nice but feels like this generalizes a bit to much.


How about calling options.error with the error when that error is caught?

Also, would you mind minifying it? I left instructions on how to do so here:

Ideally, you'd create a test for this, basically stubbing localStorage with something that throws the error (temporarily) and test if it's caught and sent back the right way. I can see how this might be a bit much though ;)


What's wrong with the solution proposed here: marcuswestin/store.js#42 (comment)?

I think the author's comments there apply in this case as well. It should not be the library's responsibility to detect this issue. Your fix hides the actual issue (localStorage isn't available) and so instead it appears as though it's just a regular error.


That was just a quick fix that we can improve for sure.

@jeromegn Yes, calling option.error passing the actual error is better. I'll try to complete this pull request when I have time.

@gsmaverick Correct me if I'm wrong but the original Backbone.sync implementation will call options.error whenever a model failed to save on the server. I think this pretty much emulates this kind of behavior.

Sebastien P added some commits Nov 4, 2012

@jeromegn I'm not sure how to write a test which would cover this edge case.


Are we letting this go? Is this still an issue in more recent browser versions?

Here's how a test would work: override window.localStorage temporarily to return the same value a browser in private browsing mode would return.

@jeromegn jeromegn added a commit that closed this pull request Jan 13, 2013
@jeromegn Fixes #44: Now catching private browsing and sending and error to the…
… error callback. Added a test with localStorage stubbing for this to work.
@jeromegn jeromegn closed this in 93ddfff Jan 13, 2013

@jeromegn thanks a lot! Now I see how I should have done this, sorry.


My pleasure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.