Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

fix(hint): properly clean up when location is changed before DOM content has been loaded #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Mar 18, 2016

The beforeunload event was never fired is the location was changed before the DOM content had been loaded (e.g. directly inside a <script> tag. The unload event is fired more consistently.

Fixes angular/batarang#290

@gkalpak gkalpak force-pushed the fix-change-location-before-content-loaded branch from 61e135e to d6fe722 Compare March 18, 2016 18:06
Copy link

@Narretz Narretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really trust unload and beforeunload, (see e.g. this FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=681636), but I assume you've tested this and it works ;)

…ent has been loaded

The `beforeunload` event was never fired if the location was changed before the DOM content had
been loaded (e.g. directly inside a `<script>` tag). The `unload` event is fired more consistently.
This commit listens for both events to cover more potential browser bugs/edge-cases.

Fixes angular/batarang#290
@gkalpak gkalpak force-pushed the fix-change-location-before-content-loaded branch from d6fe722 to 97c16a2 Compare May 2, 2017 11:54
@gkalpak
Copy link
Member Author

gkalpak commented May 2, 2017

This mostly affects batarang (which runs on Chrome only), but I don't see any reason not to play it safe(r), by hooking into both events. At least, this way it will be at least as good as it was before this PR.

@Narretz, PTAL.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extension causes Angular pages to fail to load after javascript redirect
2 participants