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

timer.setTimeout causes Illegal Invocation error in a limited execution environment #1519

Closed
schmuli opened this issue Jul 27, 2015 · 3 comments · May be fixed by Omrisnyk/npm-lockfiles#122 or Omrisnyk/npm-lockfiles#132

Comments

@schmuli
Copy link
Contributor

schmuli commented Jul 27, 2015

I am writing an Atom plugin for running Karma, which currently uses the Atom process to start the Karma server. I believe that Atom runs its plugins in a limited execution environment (I had a similar issue when loading the karma plugin, but found an Atom-specific workaround).

However, I keep getting an Illegal Invocation exception in lib/launchers/capture_timeout.js on line 15, when trying to set a timeout. It appears that the exception is caused by setTimeout being called as a method of the timer object.

Changing the timer definition in lib/server.js to delegate to the setTimeout/clearTimeout functions, rather than pass by reference, eliminates the exception.

Is this a valid use-case for making a change in Karma's code base?

@dignifiedquire
Copy link
Member

The main reason why those timers are injected is to be able to easily mock them during testing of Karma itself. If that turns out to be an issue in this scenario this is definitely a bug.
Would you be up to creating a PR?

@schmuli
Copy link
Contributor Author

schmuli commented Jul 28, 2015

I added a PR but one of the unit-tests are failing for some reason, which doesn't appear to have anything to do with the changes I made.

@dignifiedquire
Copy link
Member

@schmuli thanks I will check it out later

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

Successfully merging a pull request may close this issue.

2 participants