This will overwrite any `onbeforeunload` event handler that has been assigned by the client. It could also easily *be* overwritten by another script on the client.

There's a utility method (available in this file as `Utils.addEventListener`) that will bind an event handler in a cross browser way without overwriting an existing handler. See [`addEventListener`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener) for more general details on event binding.