Fix exceptions during JS Code Hint Unit Tests

This avoids exception, but I'm not sure about intent of code, and no unit tests are failing. Maybe this is a symptom of missing methods on some objects?