tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit a11a8ea598842e487e7279b146abbc7842dbb506
parent dd5917dee54219b497c5f7d5c766b7f6a7ab5faa
Author: Rob Wu <rob@robwu.nl>
Date:   Wed,  1 Oct 2025 17:20:04 +0000

Bug 1066141 - Consistently hide about:support sections r=desktop-theme-reviewers,emilio

Some elements were shown when they should not be on Android,
because these elements rely on the hidden class name introduced in bug
948883, but that declaration is missing for the mobile-specific
aboutSupport.css style sheet.

This patch fixes the visibility by relying on the hidden attribute
instead, and for consistency replaces all uses of `display:none` with
the `hidden` boolean. I verified that there are no `display` rules in
either aboutSupport.css file that would supersede the `display:none`
declaration of the `[hidden]` attribute.

Moreover, to avoid errors about "content-analysis-active" element that
is non-existent on Android due to ifndef in the XHTML file, an early
return is added to its usage.
I also audited all uses of ifndef in the aboutSupport.xhtml file and
added/changed the condition in the aboutSupport.js file for consistency.

Differential Revision: https://phabricator.services.mozilla.com/D265345

Diffstat:
Mbrowser/base/content/test/about/browser_aboutSupport_places.js | 6+++---
Mtoolkit/content/aboutSupport.js | 67++++++++++++++++++++++++++++++++++++-------------------------------
Mtoolkit/content/aboutSupport.xhtml | 18++++++++++--------
Mtoolkit/themes/mobile/global/aboutSupport.css | 8--------
Mtoolkit/themes/shared/aboutSupport.css | 9---------
5 files changed, 49 insertions(+), 59 deletions(-)

diff --git a/browser/base/content/test/about/browser_aboutSupport_places.js b/browser/base/content/test/about/browser_aboutSupport_places.js @@ -19,19 +19,19 @@ add_task(async function test_places_db_stats_table() { "place-database-stats-tbody" ); await ContentTaskUtils.waitForCondition( - () => table.style.display === "none", + () => ContentTaskUtils.isHidden(table), "Stats table is hidden initially" ); toggleTexts.push(getToggleText()); toggleButton.click(); await ContentTaskUtils.waitForCondition( - () => table.style.display === "", + () => ContentTaskUtils.isVisible(table), "Stats table is shown after first toggle" ); toggleTexts.push(getToggleText()); toggleButton.click(); await ContentTaskUtils.waitForCondition( - () => table.style.display === "none", + () => ContentTaskUtils.isHidden(table), "Stats table is hidden after second toggle" ); toggleTexts.push(getToggleText()); diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js @@ -125,10 +125,12 @@ var snapshotFormatters = { Ci.nsIFile ).path; } - $("profile-dir-box").textContent = Services.dirsvc.get( - "ProfD", - Ci.nsIFile - ).path; + if (AppConstants.platform != "android") { + $("profile-dir-box").textContent = Services.dirsvc.get( + "ProfD", + Ci.nsIFile + ).path; + } try { let launcherStatusTextId = "launcher-process-status-unknown"; @@ -274,11 +276,11 @@ var snapshotFormatters = { } } catch (e) {} if (!reportURL) { - $("crashes-noConfig").style.display = "block"; + $("crashes-noConfig").hidden = false; $("crashes-noConfig").classList.remove("no-copy"); return; } - $("crashes-allReports").style.display = "block"; + $("crashes-allReports").hidden = false; if (data.pending > 0) { document.l10n.setAttributes( @@ -422,22 +424,22 @@ var snapshotFormatters = { ]); }) ); - statsBody.style.display = "none"; + statsBody.hidden = true; $("place-database-stats-toggle").addEventListener( "click", function (event) { - if (statsBody.style.display === "none") { + if (statsBody.hidden) { document.l10n.setAttributes( event.target, "place-database-stats-hide" ); - statsBody.style.display = ""; + statsBody.hidden = false; } else { document.l10n.setAttributes( event.target, "place-database-stats-show" ); - statsBody.style.display = "none"; + statsBody.hidden = true; } } ); @@ -629,7 +631,7 @@ var snapshotFormatters = { } delete data.failures; } else { - $("graphics-failures-tbody").style.display = "none"; + $("graphics-failures-tbody").hidden = true; } // Add a new row to the table, and take the key (or keys) out of data. @@ -772,7 +774,7 @@ var snapshotFormatters = { } if (!trs.length) { - $("graphics-" + id + "-tbody").style.display = "none"; + $("graphics-" + id + "-tbody").hidden = true; return; } @@ -854,7 +856,7 @@ var snapshotFormatters = { addRow("decisions", "#" + feature.name, [$.new("table", trs)]); } } else { - $("graphics-decisions-tbody").style.display = "none"; + $("graphics-decisions-tbody").hidden = true; } if (featureLog.fallbacks.length) { @@ -864,7 +866,7 @@ var snapshotFormatters = { ]); } } else { - $("graphics-workarounds-tbody").style.display = "none"; + $("graphics-workarounds-tbody").hidden = true; } let crashGuards = data.crashGuards; @@ -885,7 +887,7 @@ var snapshotFormatters = { addRow("crashguards", guard.type + "CrashGuard", [resetButton]); } } else { - $("graphics-crashguards-tbody").style.display = "none"; + $("graphics-crashguards-tbody").hidden = true; } // Now that we're done, grab any remaining keys in data and drop them into @@ -1004,7 +1006,7 @@ var snapshotFormatters = { if ( !Services.prefs.getBoolPref("media.mediacapabilities.from-database") ) { - $("media-capabilities-tbody").style.display = "none"; + $("media-capabilities-tbody").hidden = true; return; } let button = $("enumerate-database-button"); @@ -1037,7 +1039,7 @@ var snapshotFormatters = { }); } - $("enumerate-database-result").style.display = "block"; + $("enumerate-database-result").hidden = false; $("enumerate-database-result").classList.remove("no-copy"); $("enumerate-database-result").textContent = ""; @@ -1402,6 +1404,9 @@ var snapshotFormatters = { }, contentAnalysis(data) { + if (AppConstants.platform == "android") { + return; + } $("content-analysis-active").textContent = data.active; if (data.active) { $("content-analysis-connected-to-agent").textContent = data.connected; @@ -1457,9 +1462,8 @@ var snapshotFormatters = { let userJSFile = Services.dirsvc.get("PrefD", Ci.nsIFile); userJSFile.append("user.js"); $("prefs-user-js-link").href = Services.io.newFileURI(userJSFile).spec; - $("prefs-user-js-section").style.display = ""; - // Clear the no-copy class - $("prefs-user-js-section").className = ""; + $("prefs-user-js-section").hidden = false; + $("prefs-user-js-section").classList.remove("no-copy"); }, sandbox(data) { @@ -1570,10 +1574,9 @@ var snapshotFormatters = { const { isSynchronizationBroken, lastCheck, localTimestamp, history } = data; - $("support-remote-settings-status-ok").style.display = - isSynchronizationBroken ? "none" : "block"; - $("support-remote-settings-status-broken").style.display = - isSynchronizationBroken ? "block" : "none"; + $("support-remote-settings-status-ok").hidden = isSynchronizationBroken; + $("support-remote-settings-status-broken").hidden = + !isSynchronizationBroken; $("support-remote-settings-last-check").textContent = lastCheck; $("support-remote-settings-local-timestamp").textContent = localTimestamp; $.append( @@ -1869,7 +1872,7 @@ Serializer.prototype = { }, _isHiddenSubHeading(th) { - return th.parentNode.parentNode.style.display == "none"; + return th.parentNode.parentNode.hidden; }, _serializeTable(table) { @@ -1988,10 +1991,10 @@ function openProfileDirectory() { */ function populateActionBox() { if (ResetProfile.resetSupported()) { - $("reset-box").style.display = "block"; + $("reset-box").hidden = false; } if (!Services.appinfo.inSafeMode && AppConstants.platform !== "android") { - $("safe-mode-box").style.display = "block"; + $("safe-mode-box").hidden = false; if (Services.policies && !Services.policies.isAllowed("safeMode")) { $("restart-in-safe-mode-button").setAttribute("disabled", "true"); @@ -2114,7 +2117,7 @@ function setupEventListeners() { let prefix = value.succeeded ? "+ " : "- "; logs = logs.concat(value.logs.map(m => `${prefix}${m}`)); } - $("verify-place-result").style.display = "block"; + $("verify-place-result").hidden = false; $("verify-place-result").classList.remove("no-copy"); $("verify-place-result").textContent = logs.join("\n"); }); @@ -2127,9 +2130,11 @@ function setupEventListeners() { $("copy-to-clipboard").addEventListener("click", function () { copyContentsToClipboard(); }); - $("profile-dir-button").addEventListener("click", function () { - openProfileDirectory(); - }); + if (AppConstants.platform != "android") { + $("profile-dir-button").addEventListener("click", function () { + openProfileDirectory(); + }); + } } /** diff --git a/toolkit/content/aboutSupport.xhtml b/toolkit/content/aboutSupport.xhtml @@ -45,11 +45,11 @@ #ifndef ANDROID <div class="action-box"> - <div id="reset-box"> + <div id="reset-box" hidden="hidden"> <h3 data-l10n-id="refresh-profile"/> <button id="reset-box-button" data-l10n-id="refresh-profile-button"/> </div> - <div id="safe-mode-box"> + <div id="safe-mode-box" hidden="hidden"> <h3 data-l10n-id="troubleshoot-mode-title"/> <button id="restart-in-safe-mode-button" data-l10n-id="restart-in-troubleshoot-mode-label"/> </div> @@ -158,6 +158,7 @@ </td> </tr> +#ifndef ANDROID <tr id="profile-row" class="no-copy"> <th class="column" data-l10n-id="app-basics-profile-dir"/> @@ -167,6 +168,7 @@ </span> </td> </tr> +#endif <tr class="no-copy"> <th class="column" data-l10n-id="app-basics-build-config"/> @@ -330,11 +332,11 @@ <tbody id="crashes-tbody"> </tbody> </table> - <p id="crashes-allReports" class="hidden no-copy"> + <p id="crashes-allReports" class="no-copy" hidden="hidden"> <a href="about:crashes" id="crashes-allReportsWithPending" class="block" data-l10n-id="crashes-all-reports"/> </p> - <p id="crashes-noConfig" class="hidden no-copy" data-l10n-id="crashes-no-config"/> + <p id="crashes-noConfig" class="no-copy" hidden="hidden" data-l10n-id="crashes-no-config"/> #endif @@ -547,7 +549,7 @@ <tr> <td colspan="9"> <button id="enumerate-database-button" data-l10n-id="media-capabilities-enumerate"/> - <pre id="enumerate-database-result" class="hidden no-copy"></pre> + <pre id="enumerate-database-result" class="no-copy" hidden="hidden"></pre> </td> </tr> </tbody> @@ -664,7 +666,7 @@ </tbody> </table> - <section id="prefs-user-js-section" class="hidden no-copy"> + <section id="prefs-user-js-section" class="no-copy" hidden="hidden"> <h3 data-l10n-id="user-js-title"/> <p data-l10n-id="user-js-description"> <a id="prefs-user-js-link" data-l10n-name="user-js-link"></a> @@ -686,7 +688,7 @@ </tbody> </table> -#ifndef ANDROID +#ifdef MOZ_PLACES <!-- - - - - - - - - - - - - - - - - - - - - --> <h2 class="major-section" id="place-database" data-l10n-id="place-database-title"/> @@ -698,7 +700,7 @@ <td colspan="5"> <button id="verify-place-integrity-button" data-l10n-id="place-database-verify-integrity"/> - <pre id="verify-place-result" class="hidden no-copy"></pre> + <pre id="verify-place-result" class="no-copy" hidden="hidden"></pre> </td> </tr> <tr class="no-copy"> diff --git a/toolkit/themes/mobile/global/aboutSupport.css b/toolkit/themes/mobile/global/aboutSupport.css @@ -84,11 +84,3 @@ td { white-space: nowrap; overflow: hidden; } - -#profile-row { - display: none; -} - -#reset-box { - display: none; -} diff --git a/toolkit/themes/shared/aboutSupport.css b/toolkit/themes/shared/aboutSupport.css @@ -150,11 +150,6 @@ td.integer { width: 20%; } -#reset-box, -#safe-mode-box { - display: none; -} - #reset-box > h3 { margin-top: 0; } @@ -171,10 +166,6 @@ td.integer { direction: ltr; } -.hidden { - display: none; -} - #sandbox-tbody tr > td.feature-unavailable { background-color: var(--background-color-critical); }