Closed Bug 1829801 Opened 1 year ago Closed 1 year ago

Rule#getCompatibilityIssues guard isn't efficient

Categories

(DevTools :: Inspector: Compatibility, task)

task

Tracking

(firefox114 fixed)

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

Details

Attachments

(1 file)

https://searchfox.org/mozilla-central/rev/26790fecfcda622dab234b28859da721b80f3a35/devtools/client/inspector/rules/models/rule.js#216-230

async getCompatibilityIssues() {
  if (!this.compatibilityIssues) {
    const [targetBrowsers, compatibility] = await Promise.all([
      getTargetBrowsers(),
      this.inspector.inspectorFront.getCompatibilityFront(),
    ]);

    this.compatibilityIssues = await compatibility.getCSSDeclarationBlockIssues(
      this.domRule.declarations,
      targetBrowsers
    );
  }

  return this.compatibilityIssues;
}

This function is called for each property in a rule.
The intent is to only retrieve the browsers, the compatibility front, and then the compat issues if it wasn't done before
But here, since we set this.compatibilityIssues after retrieving the browsers and the front, multiple "concurrent" call will probably end up calling getCSSDeclarationBlockIssues

This patch sets this.compatibilityIssues earlier so we effectively guard on
multiple "concurrent" calls.

Depends on D176395

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f5fd7e54df34
[devtools] Fix Rule#getCompatibilityIssues guard. r=jdescottes,devtools-reviewers.
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: