Closed Bug 1658724 Opened 5 years ago Closed 5 years ago

Don't start parser worker if it's not needed

Categories

(DevTools :: Console, defect)

defect

Tracking

(firefox81 fixed)

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

Details

Attachments

(1 file)

In https://searchfox.org/mozilla-central/rev/8df04ff073d0fa70f692935c5dcddc0e23cb0117/devtools/client/webconsole/webconsole.js#304 , we check if the expression contains await, and in such case, transform the input to handle top-level await expressions.

The catch is that we first check the existence of this.parserService.
The getter for parserService will start the parser worker if it wasn't the case yet (https://searchfox.org/mozilla-central/rev/8df04ff073d0fa70f692935c5dcddc0e23cb0117/devtools/client/webconsole/webconsole.js#320-335)

So doing the check first means we'll always spawn the parser worker, even if it's not going to be used, which consumes unnecessary resources.

In getMappedExpression, we check if the expression contains await, and in
such case, transform the input to handle top-level await expressions.

The catch is that we first check the existence of this.parserService, and the
getter for parserService will start the parser worker if it wasn't the case yet.
That means we were always spawning the parser worker, even if it wasn't going
to be used, consuming unnecessary resources.

This patch only reverts the conditions in the if.

Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f34e091a8e40 Don't start the parser worker if it's not needed when evaluating an expression in the console. r=jdescottes. DONTBUILD
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: