Closed Bug 56447 Opened 24 years ago Closed 24 years ago

Cookie and Image UI sometimes has two tabs selected

Categories

(Core :: Graphics: Image Blocking, defect, P3)

defect

Tracking

()

VERIFIED DUPLICATE of bug 60210

People

(Reporter: jwbaker, Assigned: bugs)

References

Details

Attachments

(2 files)

On Linux 2000-10-12-21-MTrunk, the cookie and image UI sometimes comes up with
two tabs selected.

1) Pick Tasks->Privacy->Images->View Sites

Result: the dialog appears with both the first and third tabs selected.

Expected Result: only the third tab is selected.

My patch for this problem is attached.  I wonder if the selection is supposed to
automatically work when you set the index attribute of a tabcontrol?
Keywords: patch, review
morse needs to review this.
Very strange bug.  It's obviously a glitch in the underlaying xul processing 
that is allowing this double-tab selection.  This is simply a work-around to 
avoid the underlaying problem.

But I am in agreement with this work-around.

r=morse
a=morse (as module owner)
Alright, but once this gets checked in I won't mark it fixed, but rather
reassign to myself and mark future.  I'll investigate XUL tabcontrol handling on
the trunk.
This patch may fix the symptom, but the best fix for this is to use tabcontrol's
'selectedTab' property:

tabControl.selectedTab = document.getElementById("imagesTab");

where 'tabControl' is the <tabcontrol>'s DOM node. The <xul:tabcontrol>'s code
will sort everything else out for you.

I have attached a second patch which uses tabcontrol.selectedTab to set the
active tab panel.  Tested on Linux trunk build.  Please give the new patch a
quick review.

Note that there is *no* way I would have ever discovered the selectedTab trick
by myself.  The XUL reference at http://www.mozilla.org/xpfe/xulref/ makes no
mention of it.  Indeed, http://www.mozilla.org/xpfe/xptoolkit/tabs.html
specifically states that the correct way to make a tab active is by setting the
index attribute.  The string "selectedTab" does not appear on the mozilla.org
site anywhere.

I guess the only reference I can rely on are the XUL XML files themselves.(?)
r=morse for the second patch.
Yes, our <tabcontrol> implementation changed recently (in the past couple of 
months) to be completely defined in XBL, with an enhanced content node API. 

I'll send out a message to xpfe describing the new features...

As for the newest patch, they call me Dr Pedant... the cleanest way to do this 
is like so:

var tabID = !window.arguments[0] ? "cookiesTab" : "imagesTab";
element = document.getElementById("cookieViewerTabControl");
element.selectedTab = document.getElementById(tabID);

(I saw you doing a comparison of window.arguments[0] with string "0", js makes 
these be the same in a simple equality comparison, it's only if you do 
window.arguments[0] === "0" [identity comparison] that type matters), so 
!window.arguments[0] is the same as (window.arguments[0] == "0")

Status: NEW → ASSIGNED
I would argue that using
    !window.arguments[0]
instead of
     window.arguments[0] == "0"
is a bad idea.  It hides the intent of the code and so is much less readable.
 
The meaning of the parameter as a deck index is no longer really relevant, as 
the integer passed to the dialog is no longer used this way, rather it is now a 
boolean flag representing which tab to set as the selectedTab. 

If you wanted to make the meaning particularly explicit, you'd pass either 
"images" or "cookies" as the parameter to the dialog, and do a check for either 
of those, e.g. 

var tabID = window.arguments[0] == "cookies" ? "cookieTab" : "imagesTab";

My goal in making the patch was to change as few lines as possible, therefore
having the best chance of slipping the fix into the 6.0 product.  Therefore I
left the wanky parameter passing and if/else logic in there.
This won't be accepted for rtm.
Really, I don't much care either way. !foo is just as readable to me as anything 
else. 

alternately, the expression would just read

var tabID = window.arguments[0] == "0" ? "cookiesTab" : "imagesTab";

*** Bug 57258 has been marked as a duplicate of this bug. ***
*** Bug 58207 has been marked as a duplicate of this bug. ***
Hardware: PC → All
*** Bug 59633 has been marked as a duplicate of this bug. ***
*** Bug 60595 has been marked as a duplicate of this bug. ***
*** Bug 61089 has been marked as a duplicate of this bug. ***

*** This bug has been marked as a duplicate of 60210 ***
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
verified dup of now fixed bug 60210 "Image manager shows 2 "top" tabs"
(Linux SEA 2000121906)
Status: RESOLVED → VERIFIED
Component: Cookies → Image Blocking
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: