Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web worker Tests #147

Closed
wants to merge 2 commits into from
Closed

Web worker Tests #147

wants to merge 2 commits into from

Conversation

wmluke
Copy link
Contributor

@wmluke wmluke commented May 5, 2014

Hi @tofumatt,

Here are some unit tests to flush out worker support mentioned in #144.

I ran most of my testing manually in Chrome (v34.0.1847.131), Safari (v7.0.3), and Firefox (v29.0). Then I followed up with the casperjs/slimerjs tests.

Test Results:

  • Chrome:
    • asyncStorage: pass
    • webSQLStorage: pass
    • localStorageWrapper: fails but this is expected as localstorage is not available within a worker
  • Safari:
    • asyncStorage: fail but this is expected as Safari doesn't yet support IndexDB
    • webSQLStorage: pass
    • localStorageWrapper: fails but this is expected as localstorage is not available within a worker
  • Firefox/Casper:
    • asyncStorage: fail
    • webSQLStorage: fail
    • localStorageWrapper: fails but this is expected as localstorage is not available within a worker

I'm not exactly sure why but it seems that in Firefox localForage forces the driver to localStorageWrapper within a worker even when explicitly set to asyncStorage or webSQLStorage.

Also, I added two new grunt tasks: grunt serve and grunt test-webworker. The former just keeps the connect servers running for manual testing and the later just runs test/test.webworker.coffee.

Anyway, let me know if there is anything more to do.

Thanks again,
Luke

@tofumatt
Copy link
Member

tofumatt commented May 5, 2014

Interesting, so inside a web worker, localStorage backend is broken... I guess web workers are a bit of a special case... do any localStorage-only browsers support web workers? I'd think not.

@@ -1,7 +1,7 @@
/*global exports:true, require:true */
var path = require('path');

module.exports = exports = function(grunt) {
module.exports = exports = function (grunt) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh? ^_^

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, my auto code formatter can be a too aggressive sometimes...thought I had disabled.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No prob :-) I’ve added the Gruntfile to the jshint checker, though it doesn’t even seem to complain about that one, so maybe I need to make it more aggressive! ^_^

@tofumatt
Copy link
Member

tofumatt commented May 5, 2014

This is great; I'm going to check this out locally and go through this. Will try to merge today. 👍

@tofumatt
Copy link
Member

tofumatt commented May 5, 2014

Seems there's some bug with slimerjs and web workers, you're right. I can't seem to fix it easily, so I'm going to skip the tests in slimer (we do this already; it's a bit buggy). At some point I'd like to move to a more reliable (and also cross-platform) testing platform, so maybe we'll fix this then ( #148).

I've tweaked some of your code locally; I'll push it and merge it in soon.

@tofumatt tofumatt closed this May 5, 2014
@tofumatt
Copy link
Member

tofumatt commented May 6, 2014

Merged b23cc8b and cb39ee2.

See the release here: https://github.com/mozilla/localForage/releases/tag/0.8.0

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

Successfully merging this pull request may close these issues.

2 participants