Last Comment Bug 524662 - Customize Headers window is prompted twice (Creating/adding customized filter header or removing it requires to click 'OK' twice)
: Customize Headers window is prompted twice (Creating/adding customized filter...
Status: RESOLVED FIXED
:
Product: MailNews Core
Classification: Components
Component: Filters (show other bugs)
: 1.9.1 Branch
: All All
: -- minor with 2 votes (vote)
: Thunderbird 22.0
Assigned To: Sebastian H. [:aryx][:archaeopteryx]
:
Mentors:
: 631798 776344 (view as bug list)
Depends on:
Blocks: 382404
  Show dependency treegraph
 
Reported: 2009-10-27 05:02 PDT by [:Aureliano Buendía]
Modified: 2013-03-11 07:44 PDT (History)
8 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
patch, v1 (1.34 KB, patch)
2013-03-05 07:59 PST, Sebastian H. [:aryx][:archaeopteryx]
rkent: review+
Details | Diff | Splinter Review
patch for SeaMonkey, v1 (1.34 KB, patch)
2013-03-07 15:49 PST, Sebastian H. [:aryx][:archaeopteryx]
neil: review+
Details | Diff | Splinter Review
patch for Thunderbird, v2, r=rkent (1.36 KB, patch)
2013-03-10 03:16 PDT, Sebastian H. [:aryx][:archaeopteryx]
no flags Details | Diff | Splinter Review
patch for SeaMonkey, v2, r=Neil (1.31 KB, patch)
2013-03-10 03:17 PDT, Sebastian H. [:aryx][:archaeopteryx]
no flags Details | Diff | Splinter Review

Description [:Aureliano Buendía] 2009-10-27 05:02:42 PDT
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
Comment 1 :aceman 2011-11-11 17:33:27 PST
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.
Comment 2 Tristan Miller 2011-12-20 02:30:03 PST
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.
Comment 3 :aceman 2012-01-05 14:58:14 PST
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.
Comment 4 Tristan Miller 2012-01-06 02:40:40 PST
Confirming bug still exists on Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1
Comment 5 :aceman 2012-07-22 05:36:37 PDT
*** Bug 776344 has been marked as a duplicate of this bug. ***
Comment 6 :aceman 2012-07-24 23:23:12 PDT
And after the customize dialog is closed, it should probably select one of the added headers (if it can be determined).
Comment 7 Sebastian H. [:aryx][:archaeopteryx] 2013-03-05 07:41:18 PST
*** Bug 631798 has been marked as a duplicate of this bug. ***
Comment 8 Sebastian H. [:aryx][:archaeopteryx] 2013-03-05 07:59:22 PST
Created attachment 721261 [details] [diff] [review]
patch, v1

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.
Comment 9 Kent James (:rkent) 2013-03-06 10:47:18 PST
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?
Comment 10 Sebastian H. [:aryx][:archaeopteryx] 2013-03-07 15:49:08 PST
Created attachment 722540 [details] [diff] [review]
patch for SeaMonkey, v1

(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.
Comment 11 neil@parkwaycc.co.uk 2013-03-08 08:38:44 PST
Comment on attachment 722540 [details] [diff] [review]
patch for SeaMonkey, v1

[What's left of onSelect could probably be inlined into the caller...]
Comment 12 Sebastian H. [:aryx][:archaeopteryx] 2013-03-10 03:16:49 PDT
Created attachment 723182 [details] [diff] [review]
patch for Thunderbird, v2, r=rkent
Comment 13 Sebastian H. [:aryx][:archaeopteryx] 2013-03-10 03:17:31 PDT
Created attachment 723183 [details] [diff] [review]
patch for SeaMonkey, v2, r=Neil

Note You need to log in before you can comment on or make changes to this bug.