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?

good call on the comment.

> I wonder if removing the super call would lead to cleaner code?

yeah, that's a really good point. It looks like the only line we'd need instead of the super call is `setWrapper(impl, this);`