issue #1660: Adding debug support for js

Refers to https://github.com/cocos2d/cocos2d-x/pull/1832