I see what you describe occasionally and think its a site problem.
When it happens I stay on page and copy the entire reply.
Then cancel post or refresh search and go back to the thread.
Like as not your post is there. -- If not you've got the copy to post.
You can "delete" a post in friendly politics by editing the unwanted content to any 5 character alternate message.
Agree. When it occurs to me that this is happening, and I think before taking action, I do as you described. Copy the text, peek at the thread from a different tab, kill the initial tab if the thread contains my new post.
As smstonypoint also said, delete the content of the second post and replace it with the word 'deleted'. I did that here a couple of days ago. (That's in Friendly Politics, if you aren't subscribed that link will fail).
My internet connection is going from bad to worse so a failure to upload a post is more often a lost connection than this Firefox glitch, where [set 'dom.disable_beforeunload' to true] seems to have ended the issue.
I have ATT FTTN which is 20mbps when it works , but it's also is last-mile copper and I'm beginning to believe what I've read that ATT is trying to drive its customers out of copper to sell fiber to everyone. It goes down for moments many times per week. In addition to many tech callouts I've replaced everything clear out to the outdoor interface - no improvement. Possibly the posting itself triggers the connection to fail so Firefox doesn't get an acknowledgement, doesn't know to update the screen that I see.
At any rate Moss's suggestion to change Firefox's default configuration seems to have ended the 'leave this page?' instances.
Thanks everybody for the wise counsel.