Closed Bug 1426269 Opened 7 years ago Closed 4 years ago

Strip comments out of default prefs files

Categories

(Core :: Preferences: Backend, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox59 --- wontfix
firefox82 --- fixed

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

Details

Attachments

(3 files)

On my Linux64 machine greprefs.js is about 220KB. With the comments stripped out, it's slightly less than half of that. We preprocess these files with preprocessor.py anyway, so when we do that we should strip out comments. This will reduce the size of the omnijar and reduce file loading & parsing time at process (chrome and content) startup.
Assignee: nobody → n.nethercote
Depends on: 1426270

It's not used, probably because it's pretty strange and hard to imagine using
safely. (Stripping leading and trailing space could be useful, but collapsing
sequences of spaces? Hmm.)

This commit does the following.

  • Renames slashslash as dumbComments. As a result, it now comes before
    emptyLines in alphabetical ordering, which means that if you apply both
    dumbComments and emptyLines, lines that contain only comments will be
    fully removed.

    (I contemplated changing the filter ordering to match the order specified,
    rather than using alphabetical ordering, but that was more invasive and not
    obviously better.)

  • Changes dumbComments so it only applies if the comment is at the start of
    the line (with optional leading whitespace). This is so it can be used with
    prefs files, which contain lines like pref("foo", "https://mozilla.org");
    where the // must not be treated as a comment.

Note that slashslash wasn't being used anywhere.

Depends on D88240

For a local build on my Linux64 box, this reduces greprefs.js from 174,906
bytes to 103,221 bytes, and firefox.js from 112,100 bytes to 68,656 bytes.

Depends on D88242

Pushed by nnethercote@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/76efaf59feb8
Remove the `spaces` filter from preprocessor.py. r=glandium
https://hg.mozilla.org/integration/autoland/rev/bcc9e11ca06b
Change the `slashslash` filter in preprocessor.py. r=glandium
https://hg.mozilla.org/integration/autoland/rev/328067bcffe8
Filter full-line comments and empty lines from prefs files. r=glandium,geckoview-reviewers,snorp
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: