Fixed JSDom crashing on invalid JS.