Closed Bug 1939619 Opened 1 month ago Closed 1 month ago

Syntax highlighting of HTML source code is broken

Categories

(Toolkit :: View Source, defect)

Firefox 135
defect

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox133 --- unaffected
firefox134 --- wontfix
firefox135 --- verified
firefox136 --- verified

People

(Reporter: gildas.lormeau, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(6 files)

Attached file demo.png.zip.html

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

Steps to reproduce:

1 - Open the attached page in Firefox (Nightly) 135.0a1
2 - Right-click on the page and select "View page source"

Actual results:

The syntax highlighting of the source code is broken, e.g. HTML comments are partially highlighted (in green).

Expected results:

The syntax highlighting should not be broken. It's a regression. The same test works fine in Firefox 133.0.3. It also works as expected in Chrome and Safari.

The Bugbug bot thinks this bug should belong to the 'DevTools::Debugger' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Debugger
Product: Firefox → DevTools

Bonjour Gildas!

It looks like the attachment has a pretty weird encoding, I'm seeing similar results between 133 and 135. Can you check that the file content is what you expect to be ? If so, a screenshot would help us investigating further

If you have some time (and a good bandwidth), you can use https://mozilla.github.io/mozregression/ to provide the pushlog where this started malfunctioning

Merci!

Flags: needinfo?(gildas.lormeau)
Attached image Firefox-stable.png
Flags: needinfo?(gildas.lormeau)
Attached image Firefox-nightly-1.png
Attached image Firefox-nightly-2.png

Bonjour Nicolas!

I confirm that the weird encoding is "normal". It's a file which is also compatible with ZIP and PNG.

I used the "View page source" a lot while debugging the code which generates this page. That's how I noticed the regression. I've attached some screenshots to illustrate the regression.

I did the test with mozregression. Here is below the commit which introduced the issue.

Bug 1926824 - Fix crash with speculated and discarded <pre> hanging around.

Note that I had to skip some tests because they crashed when I approached the problematic commit. Here are the details of the commit message:

Move the <pre> to a speculation now that its siblings can potentially
get discarded.

MANUAL PUSH: Trivial-ish crash fix CLOSED TREE

Thanks for the information and running mozregression, that's super helpful

Component: Debugger → View Source
Keywords: regression
Product: DevTools → Toolkit
Regressed by: 1926824

:emilio, since you are the author of the regressor, bug 1926824, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)
Attached file Reduced test-case.

A carriage return is confusing us, see above... It's weird because IIRC they get normalized by the HTML parser. Will look.

The regressing bug splits the span per line, so if there's no data state
within the comment, then we'd only add the class to the last comment
line.

Assignee: nobody → emilio
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

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

Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fbe2f934d240 Add comment class at comment start unconditionally. r=hsivonen
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch

The patch landed in nightly and beta is affected.
:emilio, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox135 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)

Comment on attachment 9445661 [details]
Bug 1939619 - Add comment class at comment start unconditionally. r=hsivonen

Beta/Release Uplift Approval Request

  • User impact if declined/Reason for urgency: Relatively low risk regression fix.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: comment 0
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Trivial-ish change specific to view-source.
  • String changes made/needed: none
  • Is Android affected?: Yes
Flags: needinfo?(emilio)
Attachment #9445661 - Flags: approval-mozilla-beta?
Flags: qe-verify+

Comment on attachment 9445661 [details]
Bug 1939619 - Add comment class at comment start unconditionally. r=hsivonen

Approved for 135.0b3.

Attachment #9445661 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [qa-triaged]

Reproduced this issue on an affected Nightly build from 2024-12-31 on Windows 10.
Verified as fixed on latest Nightly 136.0a1 (20250109183505) and Firefox 135.0b3 (20250108173941) across the following platforms: Windows 10, macOS 10.15, macOS 11 and Ubuntu 22.04.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: