Closed Bug 1905035 Opened 1 year ago Closed 1 year ago

InspectorUtils.getCSSStyleRules only returns nested CSSStartingStyleRule rules of rules with selectors using children/descendent combinator in their selectors

Categories

(DevTools :: Inspector, defect, P2)

defect

Tracking

(firefox129 fixed, firefox130 fixed)

RESOLVED FIXED
130 Branch
Tracking Status
firefox129 --- fixed
firefox130 --- fixed

People

(Reporter: nchevobbe, Assigned: boris)

References

Details

Attachments

(4 files, 1 obsolete file)

On data:text/html,<meta charset=utf8><style> html body {background-color: tomato;@starting-style {background-color: gold;}}</style>Hello , InspectorUtils.getCSSStyleRules does not return the html body rule.

I'll add a patch extending https://searchfox.org/mozilla-central/rev/56dd89bcf4d3b85f66621e89eac6e2936ad382d9/layout/inspector/tests/test_getCSSStyleRules_starting_style.html to demonstrate the issue

From my testing, this only applies child and descendant combinators, rules with sibling combinators are returned fine.

Boris, would you know what's happening?

Flags: needinfo?(boris.chiou)

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

From my testing, this only applies child and descendant combinators, rules with sibling combinators are returned fine.

Boris, would you know what's happening?

So looks like this API failed when running something like this:

<style>
div {
  width: 100px;
  height: 100px;
  background-color: green;
  transition: background-color 2s linear;
}
@starting-style {
  body > div {
    background-color: blue;
  }
}
</style>
<body>
<div></div>
</body>

The transition works well, but Inspector didn't return the rules inside @starting-style as the above example. Obviously this is a bug of this API. Let me check the API for more details.

Flags: needinfo?(boris.chiou)
Flags: needinfo?(boris.chiou)

Boris, do you think we'll find the culprit before the soft freeze (which is this week, and Firday is wellness day) ?
If not, we should probably disable showing starting-style rules in the Inspector until we get a proper fix. My preference would be to enable this in the same release we ship starting-style in Firefox, but I'd understand if this is a complex bug to figure out.

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

Boris, do you think we'll find the culprit before the soft freeze (which is this week, and Firday is wellness day) ?
If not, we should probably disable showing starting-style rules in the Inspector until we get a proper fix. My preference would be to enable this in the same release we ship starting-style in Firefox, but I'd understand if this is a complex bug to figure out.

Per our slack talk, please feel free to disable showing starting-style rules in Inspector because it's unlikely to resolve this bug before the soft freeze.

Oh. I found the reason. I didn't use the correct bloom filter. The bloom filter in this API doesn't take the its ancestor into account, so we fast-rejected the rule with this children combinator.

Flags: needinfo?(boris.chiou)
Assignee: nobody → boris.chiou

Otherwise, we may fast-reject the descendant/child selectors.

Attachment #9409882 - Attachment is obsolete: true
Severity: -- → S3
Priority: -- → P2
Blocks: 1907049
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/17ccfaf01595 Make sure we build the bloom filter with the ancestors when resolving the starting-style for Insepctor. r=firefox-style-system-reviewers,nchevobbe,layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/77e9230da6a8 [devtools] Display @starting-style rules in the Inspector. r=devtools-reviewers,jdescottes.
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
Attachment #9412417 - Flags: approval-mozilla-beta?
Attachment #9412418 - Flags: approval-mozilla-beta?

beta Uplift Approval Request

  • User impact if declined: developers won't be able to debug @starting-style rules from their pages, which is unfortunate as we're shipping them in 129
  • Code covered by automated testing: yes
  • Fix verified in Nightly: no
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: -
  • Risk associated with taking this patch: low
  • Explanation of risk level: DevTools only change, covered by multiple mochitests
  • String changes made/needed: -
  • Is Android affected?: no

beta Uplift Approval Request

  • User impact if declined: developers won't be able to debug @starting-style rules from their pages, which is unfortunate as we're shipping them in 129
  • Code covered by automated testing: yes
  • Fix verified in Nightly: no
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: -
  • Risk associated with taking this patch: low
  • Explanation of risk level: one line change in DevTools utility, covered by a test
  • String changes made/needed: -
  • Is Android affected?: no
Attachment #9412418 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9412417 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: