Closed Bug 282645 Opened 20 years ago Closed 20 years ago

address autocomplete doesn't work for replies (but works for new compose)

Categories

(Thunderbird :: Message Compose Window, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird1.1

People

(Reporter: sspitzer, Assigned: mscott)

References

Details

(Keywords: regression)

Attachments

(3 files, 1 obsolete file)

address autocomplete doesn't work for replies (but works for new compose)

I'm using a trunk tbird build from ftp.mozilla.org, "version 0.6+ (20050217)"

on win xp.

I'm pretty sure this is a recent regression.
i see this too... neil tells me seamonkey works fine. 
Status: NEW → ASSIGNED
Target Milestone: --- → Thunderbird1.1
the first autocomplete row for a reply works fine. It's all the subsequent rows
that have a dead widget
Keywords: regression
Version: 1.0 → Trunk
fwiw, I see this on my mac mozilla tbird build, too.
OS: Windows XP → All
Hardware: PC → All
I am seeing this in Seamonkey on XP( : Mozilla 1.8b2 Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050220), and I concur - the first
address line works fine, but all subsequent addresses fail.  I wonder if this is
related to the bug where you lose auto-complete after scrolling the address list?

If possible, please up the severity as this is a pretty high-profile bug.
FWIW, autocomplete works fine on both new email compositions and forwards.
Keeping Neil in the loop on this issue too as seamonkey's autocomplete widget is
also experiencing the problem.
it's interesting..only rows 2, 3 and 4 are dead for autocomplete on a reply.
The first row autocompletes and rows 5 and above also autocomplete correctly. 
It looks like autocomplete rows created by awAppendNewRow are still working.
But autocomplete rows created by awCreateOrRemoveDummyRows which trys to add a
widget for every visible row in the envelope aren't working anymore.
ignore my last comment. 
The problem is happening here:

http://lxr.mozilla.org/mozilla/source/mailnews/compose/resources/content/addressingWidgetOverlay.js#542

If we have an existing dummy row and we are calling listbox.replaceChild then we
end up with a dead auto complete instance. If we call listbox.appendChild, then
we end up with an autocomplete instance which behaves correctly.

Depends on: 272002
Backing out Bug #272002 makes the mail autocomplete widget start working again.


If that patch really caused the bug, maybe this will fix it.
Comment on attachment 175332 [details] [diff] [review]
Improve on bug 272002

Hey Brian, this patch by Neil fixes mail autocomplete which was broken by the
changes to nsTextControlFrame in Bug #272002
Attachment #175332 - Flags: superreview?(bryner)
(In reply to comment #13)
> (From update of attachment 175332 [details] [diff] [review] [edit])
> Hey Brian, this patch by Neil fixes mail autocomplete which was broken by the
> changes to nsTextControlFrame in Bug #272002
> 

I don't really understand how this helps. How is it that the text frame never
gets an initial reflow?  Or is the NS_FRAME_FIRST_REFLOW check bogus, or is it
that the box code does not propagate this state through to non-box frames?
Could there be notifications that need to get through before the first reflow?
Hmm...  So what could be happening here is the following:

1)  We get into the nsTextControlFrame::SetValue _before_ we saw a first reflow
2)  We store our old mNotifyOnInput value (false).
3)  We set mNotifyOnInput to false.
4)  We set the value on the editor.  Editor synchronously flushes out reflows
    and paints (see bug 259636).  This does our initial reflow and sets
    mNotifyOnInput to true.
5)  We unwind and restore the old mNotifyOnInput state (false).
6)  We never have an initial reflow again, so the state stays false.

I'd forgotten about step 4, since I'm used to the way the code looks in my tree.  :(

Does the patch in bug 272002 keep us from firing oninput for the initial setting
of the value?  If so, I suspect that Neil's patch is the right way to go.
Yeah, the steps Boris gave seem to be what's happening, in the case where an
input is inserted into the document dynamically.  One thing that concerns me
about the patch is that it basically gets rid of whatever the original intent of
mNotifyOnInput was.  What do you think about this instead; when restoring
mNotifyOnInput from oldNotify, do:

mNotifyOnInput |= oldNotify;

That will handle the case where the editor insertion enables notifications.
That could work, as long as we never reenter SetValue.  But again, I suspect the
initial purpose of mNotifyOnInput was to not fire oninput handlers when setting
the default value of the input (at frame init time).  Or something like that. 
The checkin comment says it was for bug 42045 and bug 42675, neither of which
has useful information on why the check was put in place...
How would reentering SetValue cause that not to work?
I guess you're thinking of the case where a nested call to SetValue causes
oninput notiifcation to be unsuppressed for the outer call?
Right.
Yet another possibility here would be to put the editor into async update mode
from SetValue().  (InitEditor() does this).  This would prevent the synchronous
reflow condition that's causing us to clobber mNotifyOnInput.  I can't think of
any real drawbacks to this.
See bug 259636 for exactly that proposal, along with kin's listing of the
drawbacks...
guys, I'm hearing lots of great debate here on how you want to fix it which is
great. But I'd really like to get this regression fixed ASAP. It really makes
mail composition extremely hard to use right now. Can we back out the bug that
caused this until everyone agrees on the right way to fix it or have we reached
consensus and can fix it ASAP? Thanks!
Attached patch proposed solution (obsolete) — Splinter Review
This patch makes it so that we don't unsuppress oninput notifications until
we've fully unwound from processing transactions.  I tested the mail compose
autocomplete case and the firefox username autocomplete that was the original
problem, and both seem to work.
Attachment #175770 - Flags: superreview?(bzbarsky)
Attachment #175770 - Flags: review?(bzbarsky)
Comment on attachment 175770 [details] [diff] [review]
proposed solution

This is ok, but I do think that Neil's proposal is cleaner, and should work as
well....
Attachment #175770 - Flags: superreview?(bzbarsky)
Attachment #175770 - Flags: superreview+
Attachment #175770 - Flags: review?(bzbarsky)
Attachment #175770 - Flags: review+
FYI my patch has the added advantage of fixing bug 276882.
Comment on attachment 175770 [details] [diff] [review]
proposed solution

Yeah... let's use Neil's patch instead.  As long as we supress oninput for all
scripted editor transactions, it shouldn't be possible to fire oninput until
we've had a reflow, because the user won't be able to interact with the editor.
Attachment #175770 - Attachment is obsolete: true
Attachment #175332 - Flags: superreview?(bryner)
Attachment #175332 - Flags: superreview+
Attachment #175332 - Flags: review+
(In reply to comment #26)
> (From update of attachment 175770 [details] [diff] [review] [edit])
> This is ok, but I do think that Neil's proposal is cleaner, and should work as
> well....
> 

Though doesn't this patch also have the problem where a reentrant call to
SetValue could set mNotifyOnInput = PR_TRUE before the outer call completes?
Yes, it does (should be simpler to fix the issue there, though).
Attachment #175796 - Flags: superreview?(bzbarsky)
Attachment #175796 - Flags: review?(neil.parkwaycc.co.uk)
Personally I can't actually figure out what we're protecting against; surely
suppressing the oninput should prevent a recursive notification?

Is there any mileage in using PRUint8 mSuppressInput?
Attachment #175805 - Flags: superreview?(bzbarsky)
Attachment #175805 - Flags: review?(bryner)
Comment on attachment 175796 [details] [diff] [review]
neil's patch w/ recursion protection

sr=bzbarsky.  I think I prefer this to adding several extra bytes to every
textframe...

As for how this could happen, editor listeners (attached by someone with
sufficient privileges) could catch the change even in the absence of an input
event....
Attachment #175796 - Flags: superreview?(bzbarsky) → superreview+
(In reply to comment #32)
> Created an attachment (id=175805) [edit]
> Even simpler recursion protection?
> 
> Personally I can't actually figure out what we're protecting against; surely
> suppressing the oninput should prevent a recursive notification?
> 
> Is there any mileage in using PRUint8 mSuppressInput?

This patch will add 4 bytes per TextControlFrame, which I'd like to avoid.
Comment on attachment 175805 [details] [diff] [review]
Even simpler recursion protection?

minusing per above comment
Attachment #175805 - Flags: review?(bryner) → review-
Blocks: 284066
Blocks: 284222
No longer blocks: 284222
Blocks: 284222
I see the latest patch for this regression fix got minused. Brian, maybe we
should be looking at backing out the change that broke autocomplete if we think
fixing the regression is going to take more time to figure out the right thing.
This is a pretty serious mail regression that's been broken since the 15th of
February. I think we've been pretty patient but we really need to get this
figured out one way or the other. 
Comment on attachment 175796 [details] [diff] [review]
neil's patch w/ recursion protection

It looks as if mInTransaction == !mNotifyOnInput; if you agree then please make
the necessary optimization.
Attachment #175796 - Flags: review?(neil.parkwaycc.co.uk) → review+
checked in attachment 175796 [details] [diff] [review] with the optimization neil suggested
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
*** Bug 284720 has been marked as a duplicate of this bug. ***
Attachment #175805 - Flags: superreview?(bzbarsky) → superreview-
*** Bug 285599 has been marked as a duplicate of this bug. ***
*** Bug 285716 has been marked as a duplicate of this bug. ***
*** Bug 286092 has been marked as a duplicate of this bug. ***
*** Bug 286880 has been marked as a duplicate of this bug. ***
*** Bug 287419 has been marked as a duplicate of this bug. ***
*** Bug 290942 has been marked as a duplicate of this bug. ***
*** Bug 291298 has been marked as a duplicate of this bug. ***
*** Bug 318211 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: