Skip to content

Commit

Permalink
Bug 1428402 - Add legacy user stylesheet information to about:support…
Browse files Browse the repository at this point in the history
… r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D183526
  • Loading branch information
gregorypappas committed Jul 18, 2023
1 parent 84ec9eb commit a0ecba8
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
13 changes: 13 additions & 0 deletions toolkit/content/aboutSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,19 @@ var snapshotFormatters = {
formatHumanReadableBytes($("disk-available-box"), data.diskAvailableBytes);
},

async legacyUserStylesheets(legacyUserStylesheets) {
$("legacyUserStylesheets-enabled").textContent =
legacyUserStylesheets.active;
$("legacyUserStylesheets-types").textContent =
new Intl.ListFormat(undefined, { style: "short", type: "unit" }).format(
legacyUserStylesheets.types
) ||
document.l10n.setAttributes(
$("legacyUserStylesheets-types"),
"legacy-user-stylesheets-no-stylesheets-found"
);
},

crashes(data) {
if (!AppConstants.MOZ_CRASHREPORTER) {
return;
Expand Down
22 changes: 22 additions & 0 deletions toolkit/content/aboutSupport.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,28 @@

<!-- - - - - - - - - - - - - - - - - - - - - -->

<h2 class="major-section" id="legacyUserStylesheets" data-l10n-id="legacy-user-stylesheets-title"/>

<table>
<tbody id="legacyUserStylesheets-info-tbody">
<tr>
<th class="column" data-l10n-id="legacy-user-stylesheets-enabled"/>

<td id="legacyUserStylesheets-enabled">
</td>
</tr>

<tr>
<th class="column" data-l10n-id="legacy-user-stylesheets-stylesheet-types"/>

<td id="legacyUserStylesheets-types">
</td>
</tr>
</tbody>
</table>

<!-- - - - - - - - - - - - - - - - - - - - - -->

<h2 class="major-section" id="graphics" data-l10n-id="graphics-title"/>

<table>
Expand Down
4 changes: 4 additions & 0 deletions toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ support-addons-type = Type
support-addons-enabled = Enabled
support-addons-version = Version
support-addons-id = ID
legacy-user-stylesheets-title = Legacy User Stylesheets
legacy-user-stylesheets-enabled = Active
legacy-user-stylesheets-stylesheet-types = Stylesheets
legacy-user-stylesheets-no-stylesheets-found = No stylesheets found
security-software-title = Security Software
security-software-type = Type
security-software-name = Name
Expand Down
19 changes: 19 additions & 0 deletions toolkit/modules/Troubleshoot.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,25 @@ var dataProviders = {
);
},

async legacyUserStylesheets(done) {
if (AppConstants.platform == "android") {
done({ active: false, types: [] });
return;
}

let active = Services.prefs.getBoolPref(
"toolkit.legacyUserProfileCustomizations.stylesheets"
);
let types = [];
for (let name of ["userChrome.css", "userContent.css"]) {
let path = PathUtils.join(PathUtils.profileDir, "chrome", name);
if (await IOUtils.exists(path)) {
types.push(name);
}
}
done({ active, types });
},

async environmentVariables(done) {
let Subprocess;
try {
Expand Down
13 changes: 13 additions & 0 deletions toolkit/modules/tests/browser/browser_Troubleshoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,19 @@ const SNAPSHOT_SCHEMA = {
},
},
},
legacyUserStylesheets: {
type: "object",
properties: {
active: {
required: true,
type: "boolean",
},
types: {
required: true,
type: "array",
},
},
},
},
};

Expand Down

0 comments on commit a0ecba8

Please sign in to comment.