Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Safari not supported #12

Closed
mcollina opened this issue Jul 1, 2013 · 21 comments
Closed

Safari not supported #12

mcollina opened this issue Jul 1, 2013 · 21 comments

Comments

@mcollina
Copy link
Member

mcollina commented Jul 1, 2013

Seems that Safari is not supported here.

I am trying to run the tests and I got these kind of errors:

TypeError: 'undefined' is not an object (evaluating 'this.db.iterate')
TypeError: 'undefined' is not an object (evaluating 'this.idb.put')
@max-mapper
Copy link
Contributor

level.js requires indexeddb: http://caniuse.com/indexeddb

ways you can help: test out this http://nparashuram.com/IndexedDBShim/ and
report back if it works

or use https://github.com/No9/node-leveldown-gap but be warned that
localstorage is really slow

On Mon, Jul 1, 2013 at 3:29 PM, Matteo Collina notifications@git.luolix.topwrote:

Seems that Safari is not supported here.

I am trying to run the tests and I got these kind of errors:

TypeError: 'undefined' is not an object (evaluating 'this.db.iterate')

TypeError: 'undefined' is not an object (evaluating 'this.idb.put')


Reply to this email directly or view it on GitHubhttps://github.com//issues/12
.

@mcollina
Copy link
Member Author

mcollina commented Jul 1, 2013

Thanks for the quick reply!

You definitely need a testling badge #2 :).

Seems the best way is IndexedDBShim, I'll try to test it!
However, bad things happen with WebSQL :).

For the moment, I'll dropping the support for Safari on LevelGraph.

@max-mapper
Copy link
Contributor

I got safari to pass locally (by using IndexedDBShim) but it fails on testling

@max-mapper
Copy link
Contributor

oh wait sorry, I was wrong, safari doesn't pass locally.

now I'm using https://github.com/axemclion/IndexedDBShim in the level.js tests, which causes it to pass in Internet Explorer 10, but it seems like Safari's sorting implementation in WebSQL is maybe incorrect?

click on safari 6.0 here to see the test output https://ci.testling.com/maxogden/level.js

here's a sample of one of the failing tests:

    expected:
test.js:8356      [{"key":"00","value":"0.7377686495892704"},{"key":"01","value":"0.045514893252402544"},{"key":"02","value":"0.5488439304754138"},{"key":"03","value":"0.2694789886008948"},{"key":"04","value":"0.07812302582897246"},{"key":"05","value":"0.45186691102571785"},{"key":"06","value":"0.5829997789114714"},{"key":"07","value":"0.0896313195116818"},{"key":"08","value":"0.7838998863007873"},{"key":"09","value":"0.15260345698334277"},{"key":"10","value":"0.6624055332504213"},{"key":"11","value":"0.7136890846304595"},{"key":"12","value":"0.3462021939922124"},{"key":"13","value":"0.07153391232714057"},{"key":"14","value":"0.48255643155425787"},{"key":"15","value":"0.7369392029941082"},{"key":"16","value":"0.7031913697719574"},{"key":"17","value":"0.708384177647531"},{"key":"18","value":"0.7326253680512309"},{"key":"19","value":"0.13590540294535458"}]
test.js:8356    actual:
test.js:8356      [{"key":0,"value":0.7377686495892704},{"key":1,"value":0.045514893252402544},{"key":2,"value":0.5488439304754138},{"key":3,"value":0.2694789886008948},{"key":4,"value":0.07812302582897246},{"key":5,"value":0.45186691102571785},{"key":6,"value":0.5829997789114714},{"key":7,"value":0.0896313195116818},{"key":8,"value":0.7838998863007873},{"key":9,"value":0.15260345698334277},{"key":10,"value":0.6624055332504213},{"key":11,"value":0.7136890846304595},{"key":12,"value":0.3462021939922124},{"key":13,"value":0.07153391232714057},{"key":14,"value":0.48255643155425787},{"key":15,"value":0.7369392029941082},{"key":16,"value":0.7031913697719574},{"key":17,"value":0.708384177647531},{"key":18,"value":0.7326253680512309}]
test.js:8356  ...

@max-mapper max-mapper reopened this Feb 24, 2014
@rvagg
Copy link
Member

rvagg commented Feb 24, 2014

@maxogden is it possible this browser is doing automatic numeric conversion? It's expecting strings for both key and value but getting number types for both of them!

@TehShrike
Copy link

I've been getting by by falling back on LevelDown (localstorage): https://github.com/TehShrike/noddity/blob/6f79c8029f3c386c47f2f12c01cfa3e2c7114cdb/noddity.js#L48 but if level.js would handle shimming in some other backend for me on Safari, that would be totally fine with me.

However, if it turns out that adding in some non-indexedDB support to this library would make it more complex than it needs to be, I would be just as happy with a module that would wrap up that feature-detection and return level.js/leveldown when appropriate. In fact, why didn't I just make that module? huh.

@max-mapper
Copy link
Contributor

it would be ideal to have websql where possible before falling back to localstorage, otherwise I agree.

@rvagg good call, i'll dig into it a bit more

@mcollina
Copy link
Member Author

@TehShrike we have a new level-browserify. Do you think it make sense to have fallbacks in there?

@TehShrike
Copy link

@mcollina oh cool, I hadn't seen that one! Falling back on level.js in that module makes sense to me. If it did that, I could switch right over.

@mcollina
Copy link
Member Author

level-browserify uses leveldown in node and level.js (this) in the browser. However, it suffers of the same issues of level.js. I think we might add in there also memdown, so if level.js errors we can switch to memdown. What do you think?

@TehShrike
Copy link

I could see that, though I feel like I'd want some sort of notification (console.log at least) so that when I was testing I could see that I'd fallen back on less-permanent storage in some browser.

In what environment would level.js fail but levelmem succeed?

@TehShrike
Copy link

A friend of mine testing OSX Yosemite reported that a site of mine using level.js doesn't work - the stack trace he pasted showed a "horrible error" event coming from the Iterator.

I don't have the Yosemite beta on any of my machines, so I haven't done any other testing yet.

It sounds like Safari in iOS 8 is going to behave pretty identically to Safari in OSX (including IndexedDB support), so maybe if this module gets working in desktop Safari in Yosemite it will work in mobile Safari for free as well.

@mcollina
Copy link
Member Author

mcollina commented Jun 4, 2014

@TehShrike if you can paste the error, we might help.

@juliangruber
Copy link
Member

"horrible error" sounds pretty cool though

@cellvia
Copy link

cellvia commented Oct 30, 2014

anyone attempt to use localstorage-down for this?

@TehShrike
Copy link

Yeah, that's what I'm using in Noddity at the moment.

@cellvia
Copy link

cellvia commented Oct 31, 2014

it looks like youre using it in place of level.js, but it would be nice to have level.js where possible, and polyfill to levelstorage-down in browsers without indexed.db ... are you using levelstorage-down until such a thing has been implemented?

@TehShrike
Copy link

I used to be checking for IndexedDB support to decide whether or not to use level.js or levelstorage-down,, but since I was getting reports from a Yosemite beta user that but level.js was erroring in Safari Yosemite, I just dropped it until I get around to upgrading to Yosemite and testing level.js on it myself. TehShrike/noddity@95b7019#diff-42f69825340f0b5fa628d80900a46daaL12

@cellvia
Copy link

cellvia commented Oct 31, 2014

hmm, yeah im putting off yosemite upgrade myself. surprised there is no issue posted here, as safari 8 is supposed to be fully idb compatible: https://github.com/jensarps/IDBWrapper/issues (at least according to http://caniuse.com/#feat=indexeddb)

@cellvia
Copy link

cellvia commented Oct 31, 2014

thanks for that diff, i might use somethine like that for now

@vweevers
Copy link
Member

Safari latest passes (Sauce Labs) tests now, without a shim. See #92.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants