Synchronous XMLHttpRequest call while compose window is loading messes up cursor placement in reply window

UNCONFIRMED
Unassigned

Status

Thunderbird
Message Compose Window
--
minor
UNCONFIRMED
7 years ago
2 years ago

People

(Reporter: Jonathan Kamens, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.10) Gecko/20100921 Fedora/3.6.10-1.fc14 Firefox/3.6.10
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100928 Fedora/3.1.4-1.fc14.jik.1 Thunderbird/3.1.4

I have some code running inside my add-on which makes a synchronous XMLHttpRequest call when a compose window is popped up. Something like this:

function foo() {
  var url = 'http://whatever/...';
  var req = new XMLHttpRequest();
  req.open('GET', url, false);
  req.send();
  ... do stuff with the results ...
}

When this code is deployed and I click the Reply button to reply to a message, instead of the text cursor being positioned at the beginning of the message, above the quoted text, as I've got it configured to do, the text cursor is invisible (i.e., it doesn't appear to be focused on anything) and I have to click in the message text area to edit it.

I've confirmed that the exact line of code that causes the issue is the req.send() line... when I modify my function to return a constant value immediately before that line, the problem does not occur.

This is annoying. :-/

Reproducible: Always
Do you get the same issue if you hack your extension to work on http://www.mozilla.org/editor/midasdemo/ ?
(Reporter)

Comment 2

7 years ago
(In reply to comment #1)
> Do you get the same issue if you hack your extension to work on
> http://www.mozilla.org/editor/midasdemo/ ?

I don't understand what you are asking me to do/try.
Reproduce the issue in Firefox at that given page - so we know If it's an editor bug or a very specific mailnews editor one.
(Reporter)

Comment 4

7 years ago
(In reply to comment #3)
> Reproduce the issue in Firefox at that given page - so we know If it's an
> editor bug or a very specific mailnews editor one.

Given that (a) it's almost certainly extremely timing related, (b) the bug relates specifically to where the text cursor is focused when the message reply pane is popped up, and (c) the page you referenced doesn't focus the text cursor in the entry area when you first bring up the page, what you are asking me to do seems neither possible nor relevant.
(Reporter)

Comment 5

4 years ago
I just checked and this is still an issue.

Comment 6

4 years ago
Does this also happen with async XHRs? If not, I wouldn't consider this to be particularly important, since I don't think sync XHRs should even be allowed to exist in the first place.
(Reporter)

Comment 7

4 years ago
(In reply to Jim Porter (:squib) from comment #6)
> Does this also happen with async XHRs?

I don't know.

> If not, I wouldn't consider this to
> be particularly important, since I don't think sync XHRs should even be
> allowed to exist in the first place.

It's certainly by far not the most important bug in the database. That doesn't mean it shouldn't be fixed at some point, especially given that what goes wrong in the compose window doesn't actually seem to have anything to do with HTTP Requests, which means the particular steps I found to reproduce the issue probably aren't the root cause and there are other ways it could happen as well.

It seems to me that you can't really evaluate how important it is to fix it until you understand the mechanics of why the synchronous HTTP request is causing the bug to manifest.
You need to log in before you can comment on or make changes to this bug.