Closed Bug 1610402 Opened 4 years ago Closed 4 years ago

Migrate view_source.tab_size to static prefs

Categories

(Core :: DOM: HTML Parser, enhancement, P5)

72 Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla75
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.

(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.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: good-first-bug
Priority: -- → P5
Summary: TAB character width is not a configurable user preference → Migrate view_source.tab_size to static prefs

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:

- 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: nobody → jj5
Mentor: emilio
Status: NEW → ASSIGNED

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?

Attachment #9127821 - Attachment description: Bug 1610402 - static prefs for view_source.{wrap_long_lines,syntax_highlight,tab_size} → Bug 1610402 - Use static prefs for view_source.{wrap_long_lines,syntax_highlight,tab_size}
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
Attachment #9127821 - Attachment description: Bug 1610402 - Use static prefs for view_source.{wrap_long_lines,syntax_highlight,tab_size} → Bug 1610402 - static prefs for view_source.{wrap_long_lines,syntax_highlight,tab_size}
Attachment #9127821 - Attachment description: Bug 1610402 - static prefs for view_source.{wrap_long_lines,syntax_highlight,tab_size} → Bug 1610402 - static prefs for view_source.{wrap_long_lines,syntax_highlight,tab_size} r=emilio
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
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
QA Whiteboard: [qa-75b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: