I am not sure how you can determine that a new location has been assigned (or any other consistent stage for storing the state), sorry.
location.href should never show a different URL in your scenario. Only history.pushState or changing the hash can do something like this.
The Firefox behavior seems a bit weird to me, it suggests (though it is probably not what really happens) that code from the previous page keeps executing after the navigation. I guess it is simply a queue that gets emptied once the navigation occurred (if you add performance.now() and new Date() to the logs and sort it by them when reading them, the order might be different. Enable time stamps in the console, if Firefox has that option).
Anyway - this might be an interoperability issue (in Firefox, beforeunload seems to fire synchronously while in Chrome, it does not).
You can search
crbug.com for an existing issue and star it. If you cannot find one, file a new issue using the "New issue" link on the same page.
Please, do not add a "+1" or "Me too" or "Confirmed" (or similar) comment. It just wastes the time of Chrome engineers and sends unnecessary e-mails to all of the people who starred the issue.
You can reply with a link to the found or created issue and might get triaged (and fixed) faster.