Closed Bug 494931 Opened 11 years ago Closed 9 years ago

Are you sure you wish to leave dialog is not given when tabs are teared off or moved to a different window


(Core :: DOM: Navigation, defect)

Not set





(Reporter: pino_sb, Unassigned)



User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; nl; rv:1.9.1pre) Gecko/20090525 Shiretoko/3.5pre
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; nl; rv:1.9.1pre) Gecko/20090525 Shiretoko/3.5pre

Firefox 3.5 brings the new easy moving around of tabs across windows and into new windows by tearing them off the tab bar. While this usually works fine, flash content is reloaded during this movement process (which is a different bug). Some websites have specially set up a warning dialog when trying to close a tab, to prevent the user from accidentally losing the content. This "Are you sure you wish to leave this page dialog?" is shown both when it is attempted to close the tab, as well as to refresh it. When a tab is moved to a different window however, which is essentially the same as refreshing it, the warning dialog is not given. In fact in the latter situation it is more important to give the warning message than in the case of manually refreshing it. If refreshing the page it could be argued the user should be aware progress can be lost. If moving a tab across windows, this is not expected behaviour. For that reason I highly suggest the close confirmation box is added whenever a user tries to move a tab to another window or to its own new window, to prevent loss of data.

Reproducible: Always

Steps to Reproduce:
1. Go to a website that uses a close confirmation dialog
2. Refresh the page using f5 or the refresh button
3. Confirm that the close dialog is given
4. Now move the tab to another window
5. Confirm that the close dialog is not given
6. Last; verify that in the latter situation exactly as much information was lost as in the first, only without any warning of this possibility.

Expected Results:  
The best solution would be to fix bug 449734, which tries to preserve plugin state during tab dragging, but as long as this is not the case; Show the very same dialog that pops up when trying to reload the page
Component: Tabbed Browser → Document Navigation
Depends on: 449734
Product: Firefox → Core
QA Contact: tabbed.browser → docshell
OS: Windows Vista → All
Hardware: x86 → All
Moving a tab is very definitely NOT like refreshing it.  What it _is_ like is setting an iframe to display:none and then unsetting that.  While that does lose plugin state (due to bug 449734) it doesn't lose any DOM state, which is the much more common case of beforeunload handlers (which is what this bug is about).  So the process is quite deliberately not visible to the page, except insofar as the layout objects are torn down and then reconstructed and plug-ins can currently detect that.

We could consider either warning or not doing the reparent when there is plug-in content on the page, but given the prevalence of flash ads that doesn't seem desirable.

So I think the right thing to do here is to just work on fixing bug 449734.
Oh, and for a trivial example of a site for which step 6 in comment 0 is false is somthing like the editing UI at  Moving that to a different window or tearing it off loses absolutely no information, and putting up the beforeunload dialog in that case would be very very wrong.
Hmm ok, I see the difference now indeed. When tearing off a text box the text is not lost, unlike when refreshed. So that makes these options different. I reckon the solution proposed by me thus wouldn't work.

The other bug (449734) says "It would be nice if the plugin state was kept when dragging a tab" however. The example of a YouTube video is technically correct but not where the real problem comes in. Resetting a YouTube video takes two seconds to slide the bar back to correct position, so simply a little inconvenience. When playing a flash game however you will loose all unsaved progress without possibility to get it back. Pretty bad for a feature promoted as making things even easier. That other bug that would fix it is set to trunk, so won't make it to 3.5 I think. 

I see your reasoning for not wanting that dialog, because in most cases it works as desired and thus would only hinder. I am afraid some people will become really frustrated though because they will loose things they couldn't expect to loose (because the tab moving feature is promoted as very simple and in a browser like Chrome it actually is). Sucks that there is no fix available :-(. 

Feel free to close this bug or something. I think the way it is right now is quite bad and not good for Firefox, but the only way to fix things is by fixing bug 449734 (or disabling the feature, which probably is even more unlikely), so in that sense this bug is dupe I guess.
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.