Defensively check for prototype in calledWithNew

Fixes #395
Feature detect CustomEvent and ProgressEvent

Fixes #396
1.8.2