Closed Bug 524662 Opened 15 years ago Closed 11 years ago

Customize Headers window is prompted twice (Creating/adding customized filter header or removing it requires to click 'OK' twice)

Categories

(MailNews Core :: Filters, defect)

1.9.1 Branch
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 22.0

People

(Reporter: Aureliano, Assigned: aryx)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 2 obsolete files)

STR:

1. open a new saved search window using context menu on specific folder;
2. in criterias area select "customize" for open "Customize Headers" window;
3. fill "new message header" with e.g X-Bugzilla-Status and then click Add button;
4. click OK button for unload window: the window is already prompted to user.

It seems to happens also the first time that this operation is raised from a specific folder.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5pre) Gecko/20091026 Lightning/1.0pre Shredder/3.0pre ID:20091026031601
Status: UNCONFIRMED → NEW
Ever confirmed: true
It also happens in Filter management (adding custom header). The window reappears twice regardless of button pressed (OK or Cancel).
Still a problem on TB11, linux.
Component: Mail Window Front End → Filters
OS: Windows XP → All
Product: Thunderbird → MailNews Core
QA Contact: front-end → filters
Hardware: x86 → All
Version: 3.0 → 1.9.1 Branch
I can reproduce this consistently on Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0:

Steps to reproduce:
1. Tools->Message Filters….  A "Message Filters" dialog appears.
2. New….  A "Filter Rules" dialog appears.
3. Subject->Customize….  A "Customize Headers" dialog appears.
4. If desired, add or remove a message header.  (This step is optional.)
5. Hit OK or Cancel.

Expected behaviour:
6. The "Customize Headers" dialog should disappear, and focus should return to the "Filter Rules" dialog.

Observed behaviour:
6. The "Customize Headers" dialog reappears.  This time, clicking OK or Cancel will close the dialog.  The bug will no longer occur if you repeat from step 3.  However, the bug will occur again if instead you hit OK or Cancel to close the "Filter Rules" dialog, and then repeat from Step 2.
For some reason, this code is executed twice in /mail/base/content/mailWidgets.xml:
     <property name="parentValue">
        <setter>
          <![CDATA[
            if (this.searchAttribute == val && val != Components.interfaces.nsMsgSearchAttrib.OtherHeader) return val;
            this.searchAttribute = val;
            this.refreshList(true); // don't restore the selection, since searchvalue nulls it
            if (val == Components.interfaces.nsMsgSearchAttrib.OtherHeader)
            {
              window.openDialog('chrome://messenger/content/CustomHeaders.xul', "", 'modal,centerscreen,resizable,titlebar,chrome', null);
              setTimeout(UpdateAfterCustomHeaderChange, 0); // XXX bug 212625
            }
            else if (val == Components.interfaces.nsMsgSearchAttrib.AgeInDays)
            {
              // We want "Age in Days" to default to "is less than".
              this.value = Components.interfaces.nsMsgSearchOp.IsLessThan;
            }
            return val;
          ]]>
        </setter>

I could not yet find out from where this is called.
Confirming bug still exists on Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1
Summary: Customize Headers window is prompted twice → Customize Headers window is prompted twice (Creating/adding customized filter header or removing it requires to click 'OK' twice)
Blocks: 382404
And after the customize dialog is closed, it should probably select one of the added headers (if it can be determined).
Attached patch patch, v1 (obsolete) — Splinter Review
What's going on here:

The callstacks for both windows:
#0: function set_parentValue() in <chrome://messenger/content/mailWidgets.xml> line 1703
#1: function set_value() in <chrome://messenger/content/mailWidgets.xml> line 1426
#2: function onSelect() in <chrome://messenger/content/mailWidgets.xml> line 1534
#3: function oncommand() in <chrome://messenger/content/FilterEditor.xul> line 1

#0: function set_parentValue() in <chrome://messenger/content/mailWidgets.xml> line 1703
#1: function onSelect() in <chrome://messenger/content/mailWidgets.xml> line 1539
#2: function oncommand() in <chrome://messenger/content/FilterEditor.xul> line 1

onSelect sets this.value, calling its setter which does the same targets and optargets updating like onSelect, resulting in two calls to parentValue which opens the window.
Assignee: nobody → archaeopteryx
Status: NEW → ASSIGNED
Attachment #721261 - Flags: review?(kent)
Comment on attachment 721261 [details] [diff] [review]
patch, v1

Yes that makes sense. Thanks for the patch.

Could you also submit a patch for the equivalent fix in the SeaMonkey version of this code?
Attachment #721261 - Flags: review?(kent) → review+
Attached patch patch for SeaMonkey, v1 (obsolete) — Splinter Review
(In reply to Kent James (:rkent) from comment #9)
> Could you also submit a patch for the equivalent fix in the SeaMonkey
> version of this code?

Here you go. Forward the review request if necessary.
Attachment #722540 - Flags: review?(kent)
Attachment #722540 - Flags: review?(kent) → review?(neil)
Comment on attachment 722540 [details] [diff] [review]
patch for SeaMonkey, v1

[What's left of onSelect could probably be inlined into the caller...]
Attachment #722540 - Flags: review?(neil) → review+
https://hg.mozilla.org/comm-central/rev/9737e2f98425
https://hg.mozilla.org/comm-central/rev/c164453b2b01
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 22.0
Attachment #723183 - Attachment is patch: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: