Closed Bug 1595068 Opened 3 years ago Closed 3 years ago

Race condition with autocompletion


(DevTools :: Console, defect)

Not set


(firefox-esr68 wontfix, firefox70 wontfix, firefox71 wontfix, firefox72 fixed)

Firefox 72
Tracking Status
firefox-esr68 --- wontfix
firefox70 --- wontfix
firefox71 --- wontfix
firefox72 --- fixed


(Reporter: julienw, Assigned: nchevobbe)




(Keywords: regression)


(1 file)


  1. open the console.
  2. Enter screen then press enter super quick.
    => scscreen is written most of the time.

This happens in other similar cases too, but this was the easiest way I found to reproduce the problem.

Another way:

  1. open the console.
  2. Enter var streams then press enter.
  3. Enter streams then press enter super quick.
    => streamss is written most of the time.

The same happens if at step 3 you enter stream => either streamms or ststreams is displayed.

Just happened to me again with simply Error => I get ErError or EError.

Thanks for the report Julien, I reproduce too.
I'm investigating what's going on.

Assignee: nobody → nchevobbe

Probably regressed by Bug 1541352.
What's happening is that we have a 75ms delay before we update the state of the autocomplete popup.
Since the popup is still displayed when hitting Enter, the last n wasn't registered in the autocomplete data, which sets the insert completion text at cursor off.

Having a special case to unselect the item in the popup when the word matches the item in the autocomplete popup seems to fix the issue.
I'll add a test and push the patch to review.

Keywords: regression
Regressed by: 1541352

The issue was that if a user typed a legitimate letter,
then, quickly after (i.e. before the autocompletion results
are here) hit Enter or Tab, the resulting input value would
be erroneous.
This is because we retrieve the value to insert from the
autocomplete popup, which at that time, is out-of-date, for
this brief moment.
The fix consists in updating the preLabel property of the
autocomplete popup selectedItem in order to get the proper
completion if the user ever hit enter, tab or arrow right.
We also take this as an opportunity to have a mechanism
to be able to cancel a registered update.

Pushed by
Fix issue with debounced autocompletion in JsTerm. r=Honza,julienw.
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 72
Blocks: 1600680
Blocks: 1624661
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.