Closed Bug 1841502 Opened 2 years ago Closed 2 years ago

Inspector’s CSS rule display broken with shorthand and custom property fallback

Categories

(DevTools :: Inspector: Rules, defect, P2)

defect

Tracking

(firefox-esr102 unaffected, firefox-esr115 unaffected, firefox115 unaffected, firefox116 verified, firefox117 verified)

VERIFIED FIXED
117 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox-esr115 --- unaffected
firefox115 --- unaffected
firefox116 --- verified
firefox117 --- verified

People

(Reporter: robin, Assigned: nchevobbe)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/116.0

Steps to reproduce:

Load a page with a rule that has a custom property and a fallback inside shorthand, for example:

body { border: 1px solid var(--test, red); }

Actual results:

CSS rule is display in devtools as:

var(--test,1px solid red)

That is, the initial part of the shorthand is pulled inside the fallback section of the custom property.

Expected results:

The rule should have been displayed as written:

1px solid var(--test, red)

Attached file Minimised tech case

Minimised test case attached. Load this into Firefox, open dev tools, and inspect body.

Comment on attachment 9342089 [details] Minimised tech case ><!doctype html> ><html lang="en"> ><head> ><meta charset="utf-8"> ><style> >body { border: 1px solid var(--test, red); } ></style> ></head> ><body></body> ></html>
Attachment #9342089 - Attachment mime type: text/plain → text/html

Thanks for the report and test case. Need to check if this is a recent regression or not.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(jdescottes)
Priority: -- → P2
See Also: → 1842314

It looks like we have an issue with the parser.
In https://searchfox.org/mozilla-central/rev/a3852ea8db25c759bc8b108aeec870d66c95452c/devtools/client/shared/output-parser.js#318-321

const saveParsed = this.#parsed;
this.parsed = [];
const rest = this.#doParse(text, subOptions, tokenStream, true);
this.parsed = saveParsed;

so, reading from this.#parsed but setting this.parsed. This was regressed in Bug 1836704

Flags: needinfo?(jdescottes)
Regressed by: 1836704
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

Set release status flags based on info from the regressing bug 1836704

Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e2ad28052361 [devtools] Fix erroneous use of this.parsed in OutputParser. r=devtools-reviewers,ochameau.
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch

Comment on attachment 9343495 [details]
Bug 1841502 - [devtools] Fix erroneous use of this.parsed in OutputParser. r=#devtools-reviewers.

Beta/Release Uplift Approval Request

  • User impact if declined: erroneous information is displayed in DevTools inspector rules view when using css custom properties
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: 1. Open https://bugzilla.mozilla.org/attachment.cgi?id=9342089
  1. Open the inspector
  2. Select the <body> in the markup view

In the rule view, the border property should be 1px solid var(--test, red)

  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Small, Devtools only patch, covered by automated test
  • String changes made/needed:
  • Is Android affected?: No
Attachment #9343495 - Flags: approval-mozilla-beta?
Flags: qe-verify+
QA Whiteboard: [qa-triaged]

Reproduced this issue on an affected Nightly build from 2023-07-03, on Ubuntu 22.
Verified as fixed on Firefox 117.0a1 (2023-07-13) across the following platforms: Ubuntu 22, macOS 10.15 and Windows 11.

Comment on attachment 9343495 [details]
Bug 1841502 - [devtools] Fix erroneous use of this.parsed in OutputParser. r=#devtools-reviewers.

Approved for 116.0b6

Attachment #9343495 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Pushed by dsmith@mozilla.com: https://hg.mozilla.org/releases/mozilla-beta/rev/b2bf039a3af6 [devtools] Fix erroneous use of this.parsed in OutputParser. r=devtools-reviewers,ochameau,a=dsmith

Verified as fixed with 116.0b6 on: Ubuntu 22, macOS 13 and Windows 10.

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: