Closed Bug 490166 Opened 16 years ago Closed 15 years ago

When closing the last tab, Tab close button is displayed on the blank tab momentarily (browser.tabs.closeWindowWithLastTab = false)

Categories

(Firefox :: Tabbed Browser, defect)

defect
Not set
trivial

Tracking

()

RESOLVED DUPLICATE of bug 501714

People

(Reporter: spitfire.kuden, Assigned: dao)

References

Details

Attachments

(1 obsolete file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.2a1pre) Gecko/20090425 Minefield/3.6a1pre

Steps to Reproduce:
1. Set browser.tabs.closeWindowWithLastTab to false
2. Open a webpage in one tab
3. Middle click the tab to close it
Actual Results:
Tab close button is displayed on the blank tab momentarily.

Expected Results:
Tab close button is not displayed on the blank tab.
Attached patch patch (obsolete) (deleted) β€” β€” Splinter Review
Assignee: nobody → dao
Attachment #377960 - Flags: review?(gavin.sharp)
Not only the 'close button' is temporarily shown, also the whole window flickers (in default theme), and also in some themes, momentarily another tab is displayed.

The problem is here that the close tab/window logic when trying to close the last tab, it first closes the tab and them immediately creates a new tab to keep one tab (and window) open. Instead the close operation on the last empty tab (with closeWindowWithLastTab=false) should just be a 'no-op' completely.

Basically, just like remove the close button on the last empty tab, the cmd_close command should also be disabled on the last empty tab (when closeWindowWithLastTab=false) to prevent the close operation performed on this last empty tab.
See http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#1878
for the place to add this check to not do a RemoveCurrentTab on the last empty tab...
This isn't about the "last empty tab", but the last tab in general.
Even so, the problem is larger that just the close button.
On a plain FF3.5, with default theme and CloseWindowWithLastTab, press CtrlW to try to close the last window. Notice the flicker of the whole window, not just the close button...
You're probably seeing bug 486280, and I suspect your build is not up-to-date.
With Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090525 Minefield/3.6a1pre (.NET CLR 3.5.30729) I still see flickering of the whole page when trying to close the last tab...
What is supposed to happen with the last tab is what happened with the beta builds. On default, when last tab is closed, firefox quits. If you change the options at the about:config, then it should close the tab and reopen a blank one. This is a big bug.
We should probably fix bug 501714 instead of this.
Depends on: 501714
Attachment #377960 - Flags: review?(gavin.sharp)
(In reply to comment #9)
> We should probably fix bug 501714 instead of this.

I also think so. 
Is this bug WONTFIX?
Let's first fix bug 501714, and then re-evaluate this one.
This particular bug is about 'flashing' of the interface, 
which possibly also happens with the close button present.
Attachment #377960 - Attachment is obsolete: true
Looks like this has been fixed by bug 501714.

Remaining trivial bugs are:
On some clicks on the close button of the last tab, which seems to depend somewhat on how long I press the mouse button, the close button disappears for a split-second and reappears. But that's really hard to notice.

More noticeable is the placeholder text of the location bar, which displays "Search Bookmarks and History" on mouse-down, and a blinking cursor instead on mouse-up. But that only happens when clicking the tab close button on the last tab, when that's already showing about:blank.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
re comment 12: actually when the last tab is empty, it should NOT have close button (when CloseWindowWIthLastTab=false), as it is actually a no-op.

A way to remove this close button in this case is:
/* With closeWindowWithLastTab=false, with only one tab, and empty, don't show close button */
.tabbrowser-tab[label="New Tab"]:first-of-type:last-of-type>.tab-close-button{
	display:none}
/* With closeWindowWithLastTab=true, with only one tab, and empty, do show close button */
.tabbrowser-tabs[closebuttons="noclose"]>.tabbrowser-tab:first-of-type:last-of-type>.tab-close-button{
	display:-moz-box}
Indeed, just like Ctrl+W, which does nothing in that case as well.

Mind filing a new bug?
[label="New Tab"] isn't localizable though.
And maybe you can replace :first-of-type:last-of-type by :only-child or so.
Only-child won't work, but only-of-type does.
[label="New Tab"] is not good enough indeed. I need something else to test for 'empty page' status.
Created bug 559005 for this.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: