Disabling property in a rule empties out the stylesheet if the rule is not on the first line of the stylesheet, and right after another rule declaration (without whitespace)
Categories
(DevTools :: Inspector: Rules, defect, P1)
Tracking
(firefox-esr115 unaffected, firefox124 unaffected, firefox125 unaffected, firefox126 verified, firefox127 verified)
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox124 | --- | unaffected |
| firefox125 | --- | unaffected |
| firefox126 | --- | verified |
| firefox127 | --- | verified |
People
(Reporter: nchevobbe, Assigned: nchevobbe)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
Steps to reproduce
- Navigate to
data:text/html,<meta charset=utf8><style>%0Ahtml{}body{color:red;background:gold;}</style>Hello - Open the inspector and select the
bodynode - In the
bodyrule, unselect thecolorproperty
Expected results
The Hello text gets black, the background color stays gold
Actual results
The Hello text gets black, the background color gets white, and if you navigate to the style editor, you can see that the stylesheet is empty
The stylesheet has the following content:
html{}body{color:red;background:gold;}
When InspectorUtils.replaceBlockRuleBodyTextInStylesheet is called to replace the content of the second rule, get_byte_index_from_line_and_column (glue.rs) returns an erroneous index as it doesn't account for the line break character.
This means that Servo_ReplaceBlockRuleBodyTextInStylesheetText (glue.rs) includes the closing curly bracket of the previous rule when building the string it should parse (i.e. }body{color:red;background:gold;}).
This is a parsing error as the parser didn't encountered any opening bracket before, and the function will return null.
So we should fix the index computation, but also maybe avoid emptying the stylesheet when the function returns null.
| Assignee | ||
Comment 1•2 years ago
|
||
We were getting a line byte index for the
actual char matching the line we want, but
we actually need the index after that
new line char.
A test case is added to cover this fix.
Comment 2•2 years ago
|
||
Set release status flags based on info from the regressing bug 1882964
Comment 4•2 years ago
|
||
| bugherder | ||
Reproducible on a 2024-04-10 Nightly build on Windows 10.
Verified as fixed on Firefox Nightly 127.0a1 and Firefox 126.0b7 on Windows 10, Ubuntu 22, macOS 12.
Description
•