Re-land fix for unload/beforeunload events

The implementation code change compared to last time is fixes a stack overflow in the BeforeUnloadEvent polyfill, which the new test is hitting. This affected Safari which doesn't have a native BeforeUnloadEvent yet.

The test has several fixes for IE 10/11. IE had two different problems: e.target is window vs document in others, and the unload event won't fire in an iframe unless we setTimeout(0) before adding the handler.

This fixes https://github.com/Polymer/platform/issues/83

@kegluneq @arv mind taking another look?

This could use a comment:

```js
// In browsers that do not correctly support BeforeUnloadEvent we get to the generic
// Event wrapper but we still want to ensure we create a BeforeUnloadEvent. Since
// BeforeUnloadEvent calls super we need to prevent reentrancty
```

I wonder if removing the super call would lead to cleaner code?