Migrate view_source.tab_size to static prefs
Categories
(Core :: DOM: HTML Parser, enhancement, P5)
Tracking
()
Tracking | Status | |
---|---|---|
firefox75 | --- | fixed |
People
(Reporter: jj5, Assigned: jj5, Mentored)
Details
(Keywords: good-first-bug)
Attachments
(3 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0
Steps to reproduce:
When you view source for HTML content which uses TAB characters for indenting the default TAB character width is 4 characters.
Actual results:
There is no user preferences setting for TAB character width, the user is stuck with 4 character TABs or otherwise has to edit and enable userContent.css.
Expected results:
There should be a configurable user option for TAB character width.
Comment 1•4 years ago
•
|
||
(In reply to John Elliot V from comment #0)
There is no user preferences setting for TAB character width
There is. It's called view_source.tab_size
. However, about:config
doesn't let you know that it exists if it hasn't already been set. Leaving this bug open to remedy that.
Comment 2•4 years ago
|
||
I told the reporter that I'd mentor them with this bug. The fact that the pref already exists makes this much easier :)
So, basically, this is a matter of:
- Adding an entry to
StaticPrefList.yaml
, probably around the otherview_source.
prefs. It should probably look like:
- name: view_source.tab_size
type: int32_t
value: 4
mirror: always
-
Replace this line by something that reads the relevant static pref (via
StaticPrefs::view_source_tab_size()
). You probably need to#include "mozilla/StaticPrefs_view_source.h"
in that file. -
Verify that
./mach mochitest toolkit/components/viewsource/test/browser/browser_viewsourceprefs.js
keeps passing.
If while at it (or on top of it) you want to do the same refactoring for the other two prefs there (view_source.syntax_highlight
and view_source.wrap_long_lines
) that'd be great!
Let me know if you have any doubts on how to approach this :-)
Assignee | ||
Comment 3•4 years ago
|
||
Hi Emilio. So I finally got around to this. Sorry for the delay. I have added support for the three view_source static prefs. This required two files to be changed, being StaticPrefList.yaml and nsHtml5ViewSourceUtils.cpp. I ran the test script you indicated and the tests pass. Now how do I submit my code for review?
Comment 4•4 years ago
|
||
Assignee | ||
Comment 5•4 years ago
|
||
Updated•4 years ago
|
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2050d4e3c7e0 Use static prefs for view_source.{wrap_long_lines,syntax_highlight,tab_size} r=emilio
Comment 7•4 years ago
|
||
Backed out as per Emilio's request: https://hg.mozilla.org/integration/autoland/rev/97fecb0bf9a03350a4881b99149fe6a00ca9a8bc
Updated•4 years ago
|
Assignee | ||
Comment 8•4 years ago
|
||
Depends on D63470
Updated•4 years ago
|
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/82cb62a2f7b3 static prefs for view_source.{wrap_long_lines,syntax_highlight,tab_size} r=emilio
Comment 10•4 years ago
|
||
bugherder |
Updated•4 years ago
|
Description
•