Closed Bug 783729 Opened 13 years ago Closed 13 years ago

Debugger: JS scripts can get HTML syntax highlighting

Categories

(DevTools :: Debugger, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 19

People

(Reporter: espadrine, Assigned: vporof)

References

Details

Attachments

(1 file)

When a JS script does not send the content type, the debugger gives it HTML syntax highlighting. (debugger-controller.js 962:19) This behaviour is suboptimal, and all other browsers I have tested correctly give it a JS syntax highlighting. I believe simply checking whether the first non-whitespace character is "<" is enough to determine whether the file is HTML or JS.
A missing content type should result in the decision being based on the file name extension. Do you have a test case to reproduce the problem?
What a <script> links to is always a script file, even if it doesn't have the extension. Firefox knows that, and Chrome, Safari and Opera show the correct highlighting. Also, Opera shows the name in unicode, not URL-escaped, although this is not directly related to this bug.
I agree that this is a legitimate issue, I only wanted a test case to pinpoint the right place for the fix. Unfortunately, when the script is transferred through the remote protocol it doesn't contain any indication that it was loaded from a script tag.
Test case: http://espadrine.github.com/%E2%9A%92/ Please note that this bug is of very low priority :)
Priority: -- → P3
When we decide on the content type, we always have the source text fetched, so it should be trivial to simply check if the first character is a "<" or not. I'll play with this a bit.
Assignee: nobody → vporof
Status: NEW → ASSIGNED
Attached patch v1Splinter Review
easy peasy
Attachment #675966 - Flags: review?(rcampbell)
Depends on: 793375
Comment on attachment 675966 [details] [diff] [review] v1 + // Use HTML mode for files in which the first non whitespace character is + // &lt;, regardless of extension. + this.editor.setMode(SourceEditor.MODES.HTML); yeah. ... banana.
Attachment #675966 - Flags: review?(rcampbell) → review+
(In reply to Rob Campbell [:rc] (:robcee) from comment #8) > Comment on attachment 675966 [details] [diff] [review] Thanks!
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 19
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: