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

Crash in sandboxed chrome app. #68

Closed
xquezme opened this issue Feb 17, 2014 · 5 comments
Closed

Crash in sandboxed chrome app. #68

xquezme opened this issue Feb 17, 2014 · 5 comments

Comments

@xquezme
Copy link

xquezme commented Feb 17, 2014

Just wrap

    // Initialize localStorage and create a variable to use throughout the code.
    var localStorage = window.localStorage;

into

   try{
     var localStorage = window.localStorage;
   }catch(e){ return; }
@lejenome
Copy link
Contributor

it works for me, isn't the next code enough for sandboxed chrome app?

if (window.chrome && window.chrome.runtime) {
        return;
}

// Initialize localStorage and create a variable to use throughout the code.
var localStorage = window.localStorage;

@lejenome
Copy link
Contributor

sorry, you're right. it was a bug in my chrome app building script

@xquezme
Copy link
Author

xquezme commented Feb 18, 2014

Closed without fix? O really?

@tofumatt
Copy link
Member

@xquezme Sorry, I misread the comments and thought things were working. Sometimes I miss context from reading GitHub emails.

That said, I thought https://github.com/mozilla/localForage/blob/master/src/drivers/localstorage.js#L10 fixed this already?

@tofumatt tofumatt reopened this Feb 18, 2014
@tofumatt
Copy link
Member

Either way, I'll push a fix, as I think I'd prefer the try/catch over the window.chrome check, as it's closer to feature detection.

@xquezme In the future, if you'd like to submit a pull request directly (given that you had the code ready in this issue) I would happily accept it. I'm usually faster to merge pull requests than anything else.

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

No branches or pull requests

3 participants