Re-land fix for unload/beforeunload events

The only 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.
 
IE 10/11 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?