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

ReferenceErrors in browserless environment #34

Open
hanna-greaves opened this issue Jul 14, 2016 · 2 comments
Open

ReferenceErrors in browserless environment #34

hanna-greaves opened this issue Jul 14, 2016 · 2 comments

Comments

@hanna-greaves
Copy link

An issue occurs when L10N is being used in a browserless environment, such as being run directly using Node.

The issues largely come from the assumption that certain objects will exist, such as self, XMLHttpRequest and document, with the former two causing ReferenceErrors when they are reached in the code. This is particularly a problem when it comes to running Unit Tests on localization code inside environments like Mocha.

The errors in question are as follows:

ReferenceError: self is not defined at l10n.js:20:9

and

ReferenceError: XMLHttpRequest is not defined at l10n.js:196:11

I have a proposed set of changes to fix this issue for Node that I can create a PR for, if it is considered something that is in scope for the library to handle.

@eligrey
Copy link
Owner

eligrey commented Jul 14, 2016

Sure, I'm open to PRs.

@hanna-greaves
Copy link
Author

hanna-greaves commented Jul 15, 2016

Excellent, thanks Eli. I will make the PR and reference it here.

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

2 participants