domains: fix handling of uncaught exceptions
requested to merge github/fork/misterdjules/fix-uncaught-exceptions-domains-v0.12 into v0.12-staging
Fix node exiting due to an exception being thrown rather than emitting an 'uncaughtException' event on the process object when:
- no error handler is set on the domain within which an error is thrown
- an 'uncaughtException' event listener is set on the process
Also fix an issue where the process would not abort in the proper function call if an error is thrown within a domain with no error handler and --abort-on-uncaught-exception is used.
Fixes #3607 (closed) and #3653 (closed).