Make ErrorEvent::new take cancelable and bubbling enums

Fixes #4174.