Closed Bug 1616721 Opened 4 years ago Closed 4 years ago

Eager evaluation shouldn't log warnings to the console

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(firefox75 verified)

VERIFIED FIXED
Firefox 75
Tracking Status
firefox75 --- verified

People

(Reporter: Oriol, Assigned: nchevobbe)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

Open the console with eager evaluation and type

document.getElementById("")

It will eagerly evaluate to null, as expected.

But the problem is that this warning will also appear:

Empty string passed to getElementById().

Eager evaluation is supposed to not have observable side effects.
But logging warnings to the console is an observable side-effect.
This shouldn't be happening.

Priority: -- → P2

I wonder if we could set a different "URL" (see https://searchfox.org/mozilla-central/rev/5a10be606f2d76ef22f1f44565749490de991d35/devtools/server/actors/webconsole/eval-with-debugger.js#99-100) for eager evaluations, and then not show messages from this URL we would set.
I'm going to try to do this and see where it leads me to.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

This patch is in 2 folds:

  • The first one sets a specific url option in evalWithDebugger
    when a eager evaluation is requested.
  • Then in console-service, we block any message that has this
    specific sourceName, as it indicates it was triggered by the
    eager evaluation.

A test is added to ensure this works as expected.

Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1ca704f44008
Block messages triggered by eager evaluation. r=loganfsmyth.
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 75
Blocks: 1619660

Verified with the scenario from comment 0; using 75.0a1 (2020-03-08) on Windows 10, macOS 10.15, Ubuntu 19.04.

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

Attachment

General

Created:
Updated:
Size: