Closed Bug 1608369 Opened 4 years ago Closed 4 years ago

console input is eager evaluated twice on each key stroke

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(firefox74 verified)

VERIFIED FIXED
Firefox 74
Tracking Status
firefox74 --- verified

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

Steps to reproduce

  1. Make sure the eager evaluation pref is set to true
  2. Open the console
  3. Type Math.random()
  4. Wait for a result to be shown
  5. Type an additional space so the input gets eagerly evaluated again

Expected results

The result is updated once

Actual results

The result is updated twice. It's very visible with Math.random as we're getting different results.

Before trying to reach the server, we check that the new
expression is different from the previous one.
If it's similar, we bail.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/23688b6ac3de
Don't trigger eager evaluation if the input was the same than for previous evaluation. r=bhackett.
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 74
Flags: qe-verify+
Attached video 2020-02-14_11h17_23.avi

I reproduced the initial issue on Nightly 74.0a1 (20200109094415).
I can confirm the issue is no longer reproducible when following the steps from the Description (verified on Ubuntu 18.04, Mac OS X 10.15 and Windows 10 x64 using the latest Firefox 74 beta 3 and the latest Nightly 75.0a1), but I came across 2 situations where the results are still updated several times:
-1. if space is added between the parenthesis, the number is updated with each made space
-2. after pressing enter, the number is updated.
Please see the video for more details.

Nicolas, are these results, expected?

Flags: needinfo?(nchevobbe)
Attached image Screencast

Sorry for that, added the video again since the previous format is not supported.

Hello Simona,

For 1. , that would be hard to not re-evaluate. We are already trimming the input and checking it's not the same as the previous one. But when the whitespace characters are not at the start and/or beginning of the input, that's more tricky to do
For 2. , yes, this is "expected". The eager evaluation is done at t time. If you evaluate (i.e., press Enter) at t + X time, the expression might not be the same (and we do want that, you can think of new Date() as a good example).

Flags: needinfo?(nchevobbe)

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #6)

Hello Simona,

For 1. , that would be hard to not re-evaluate. We are already trimming the input and checking it's not the same as the previous one. But when the whitespace characters are not at the start and/or beginning of the input, that's more tricky to do

Nicolas, should I log a new defect for issue 1?

Flags: needinfo?(nchevobbe)

(In reply to Simona Badau from comment #7)

Nicolas, should I log a new defect for issue 1?

No, I think that's fine.
The work (and perf impact) it would take to not have this would outweigh the benefits.

Flags: needinfo?(nchevobbe)

Based on Comment 5, Comment 6 and Comment 8, setting the tracking flag for firefox 74 and the tracking status to Verified.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: