Pier Angelo Vendrame pushed to branch tor-browser-152.0a1-16.0-2 at The Tor Project / Applications / Tor Browser Commits: b5af463c by Thomas Wisniewski at 2026-06-25T10:45:02+02:00 Bug 2040437 - part 3: remove no-longer-wanted code to randomize the reason selector options on Report Broken Site, and re-order the default choices a little; r=mossop Differential Revision: https://phabricator.services.mozilla.com/D302069 - - - - - 1 changed file: - browser/components/reportbrokensite/ReportBrokenSite.sys.mjs Changes: ===================================== browser/components/reportbrokensite/ReportBrokenSite.sys.mjs ===================================== @@ -8,7 +8,6 @@ const MINIMUM_DESCRIPTION_LENGTH = 10; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - ClientEnvironment: "resource://normandy/lib/ClientEnvironment.sys.mjs", SafeBrowsing: "resource://gre/modules/SafeBrowsing.sys.mjs", }); @@ -18,7 +17,6 @@ export class ViewState { #detailsView; #previewView; #reportSentView; - #reasonOptions; #reportURL; currentTabURL; @@ -43,10 +41,6 @@ export class ViewState { "report-broken-site-popup-reportSentView" ); ViewState.#cache.set(doc, this); - - this.#reasonOptions = Array.from( - this.#mainView.querySelectorAll(".reason-button") - ); } static #cache = new WeakMap(); @@ -289,46 +283,6 @@ export class ViewState { ); } - randomizeReasonsOrdering() { - // As with QuickActionsLoaderDefault, we use the Normandy - // randomizationId as our PRNG seed to ensure that the same - // user should always get the same sequence. - const seed = [...lazy.ClientEnvironment.randomizationId] - .map(x => x.charCodeAt(0)) - .reduce((sum, a) => sum + a, 0); - - const items = [...this.#reasonOptions]; - this.#shuffleArray(items, seed); - items[0].parentNode.append(...items); - } - - #shuffleArray(array, seed) { - // We use SplitMix as it is reputed to have a strong distribution of values. - const prng = this.#getSplitMix32PRNG(seed); - for (let i = array.length - 1; i > 0; i--) { - const j = Math.floor(prng() * (i + 1)); - [array[i], array[j]] = [array[j], array[i]]; - } - } - - // SplitMix32 is a splittable pseudorandom number generator (PRNG). - // License: MIT (https://github.com/attilabuti/SimplexNoise) - #getSplitMix32PRNG(a) { - return () => { - a |= 0; - a = (a + 0x9e3779b9) | 0; - var t = a ^ (a >>> 16); - t = Math.imul(t, 0x21f0aaad); - t = t ^ (t >>> 15); - t = Math.imul(t, 0x735a2d97); - return ((t = t ^ (t >>> 15)) >>> 0) / 4294967296; - }; - } - - restoreReasonsOrdering() { - this.#reasonOptions[0].parentNode.append(...this.#reasonOptions); - } - reset() { this.currentTabWebcompatDetailsPromise = undefined; this.lastBlurredURLInputSelection = undefined; @@ -445,8 +399,6 @@ export var ReportBrokenSite = new (class ReportBrokenSite { static SCREENSHOTS_ENABLED_PREF = "ui.new-webcompat-reporter.screenshots.enabled"; - static REASON_RANDOMIZED_PREF = - "ui.new-webcompat-reporter.reason-dropdown.randomized"; static SEND_MORE_INFO_PREF = "ui.new-webcompat-reporter.send-more-info-link"; static NEW_REPORT_ENDPOINT_PREF = "ui.new-webcompat-reporter.new-report-endpoint"; @@ -490,8 +442,6 @@ export var ReportBrokenSite = new (class ReportBrokenSite { } #OBSERVED_PREFS = { - [ReportBrokenSite.REASON_RANDOMIZED_PREF]: - "onReasonRandomizationPrefChanged", [ReportBrokenSite.SCREENSHOTS_ENABLED_PREF]: "onScreenshotsPrefChanged", [ReportBrokenSite.SEND_MORE_INFO_PREF]: "onSendMoreInfoPrefChanged", }; @@ -532,14 +482,6 @@ export var ReportBrokenSite = new (class ReportBrokenSite { } } - onReasonRandomizationPrefChanged(prefValue, state) { - if (prefValue) { - state.randomizeReasonsOrdering(); - } else { - state.restoreReasonsOrdering(); - } - } - onScreenshotsPrefChanged(prefValue, state) { state.screenshotsDisabled = !prefValue; } View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/b5af463c... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/b5af463c... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
Pier Angelo Vendrame (@pierov)