New tab opens in wrong window

RESOLVED WORKSFORME

Status

()

RESOLVED WORKSFORME
7 years ago
7 years ago

People

(Reporter: jrmuizel, Unassigned)

Tracking

({qawanted})

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
Probably not reproducible, but I currently have a browser where clicking the new tab button opens the tab in the wrong window. The window was probably originally created by dragging the tab to make a new window.
Keywords: qawanted

Comment 1

7 years ago
WFM on:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:12.0a1) Gecko/20120126 Firefox/12.0a1

Jeff, can you please try to reproduce this issue on a clean profile or in safe mode?
(Reporter)

Comment 2

7 years ago
(In reply to Ioana Budnar [QA] from comment #1) 
> Jeff, can you please try to reproduce this issue on a clean profile or in
> safe mode?

Nope. I can't reliably reproduce this at all. I expect this is the kind of bug that very rarely shows up and so needs to be solved by inspection or re-architecture. e.g. how does the new tab button decide which window the new tab should go in? Under what circumstances could it be wrong?
The new tab button calls openUILinkIn("about:blank", "tab") which determines the target window via getTopWin():

54 function getTopWin(skipPopups) {
55   // If this is called in a browser window, use that window regardless of
56   // whether it's the frontmost window, since commands can be executed in
57   // background windows (bug 626148).
58   if (top.document.documentElement.getAttribute("windowtype") == "navigator:browser" &&
59       (!skipPopups || top.toolbar.visible))
60     return top;
61 
62   if (skipPopups) {
63     return Components.classes["@mozilla.org/browser/browserglue;1"]
64                      .getService(Components.interfaces.nsIBrowserGlue)
65                      .getMostRecentBrowserWindow();
66   }
67   return Services.wm.getMostRecentWindow("navigator:browser");
68 }

If the window returned by getTopWin() is considered a popup (!window.toolbar.visible), getTopWin(true) will be called.
I think I saw this while testing nightly on 10.8 today and will see if I can reproduce. In my case I was clicking a Socorro link to report and bug and wondering why it was not opening, and instead finally found the link open in another window.

Comment 5

7 years ago
I found this very easy to reproduce on Firefox 11 with a new profile and no addons, on two separate machines (one windows, one linux):

From <script> or in web console, with a single window open:
window.open("about:blank","blah","toolbar=yes")

The toolbar=yes causes the window to have a tab bar (which I think is fine; it has always behaved that way).  That tab bar has a new tab button, and that new tab button will open a tab in the other window - as will control-t.

It would be great if this could be fixed, as the ticketing webapp I use at work opens windows in this way, and I prefer new tabs to open contextually - where I have told them to!
I can confirm this issue. 

For my Firefox profile this behaviour occurs for all window.open() calls. This is because to avoid bug #294940 I have configured 

  dom.disable_window_open_feature.toolbar == true

so Firefox always uses "toolbar=yes" in window.open() calls.

Comment 7

7 years ago
OK, update - this problem appears to have gone away in Firefox 12.  The steps in Comment #5 now gives the desired behaviour (opening in the popup window).
FF12 works for me, too. :-)
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.