Re-land fix for unload/beforeunload events, fixes https://github.com/Polymer/platform/issues/83