Support for PhantomJS debugging

Fixes #318