tor-browser

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

commit e70019a3f582fe0beaf597c1d40aff8242967f47
parent 5e3158587e14658e65365b1923dad638ecfd0330
Author: Henrik Skupin <mail@hskupin.info>
Date:   Thu,  2 Oct 2025 06:13:25 +0000

Bug 1991642 - [DevTools Release Tasks - Cycle 145] Remove backward compatibility code. r=devtools-backward-compat-reviewers,devtools-reviewers,jdescottes,julienw

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

Diffstat:
Mdevtools/client/fronts/perf.js | 77+++++++++++++++++------------------------------------------------------------
Mdevtools/client/performance-new/@types/perf.d.ts | 54+++++++++---------------------------------------------
Mdevtools/client/performance-new/store/actions.js | 3+--
Mdevtools/server/actors/perf.js | 11-----------
Mdevtools/server/actors/root.js | 3---
Mdevtools/shared/specs/perf.js | 9---------
6 files changed, 27 insertions(+), 130 deletions(-)

diff --git a/devtools/client/fronts/perf.js b/devtools/client/fronts/perf.js @@ -22,72 +22,29 @@ class PerfFront extends FrontClassWithSpec(perfSpec) { this.formAttributeName = "perfActor"; } - /* @backward-compat { version 143 } - * Version 140 introduced the bulk transfer of the profile date, as - * implemented by getProfileAndStopProfilerBulk below. - * This function uses a trait to decide between calling the old method and the - * new method. - * In the case of the old method, the shared libraries are computed from the - * profile data itself. But when using the new method, the profile data is a - * gzipped buffer, therefore an additional call to - * getPreviouslyRetrievedAdditionalInformation is made to retrieve this - * information from the server-side. - * - * When we'll want to remove the backwards compatible code (on ESR 128 EOL), - * we'll remove the second part of this function, but we'll likely keep the first part - * for simplicity. - * */ async getProfileAndStopProfiler() { - // Note: this.conn.traits exists sometimes, but isn't guaranteed to exist always. - // this.conn.mainRoot.traits always exists though. - const { useBulkTransferForPerformanceProfile } = this.conn.mainRoot.traits; - if (useBulkTransferForPerformanceProfile) { - const handle = await this.startCaptureAndStopProfiler(); - - // Start both calls in parallel - const profilePromise = this.getPreviouslyCapturedProfileDataBulk(handle); - const additionalInformationPromise = - this.getPreviouslyRetrievedAdditionalInformation(handle); - - // But make sure we wait until the end of both calls even in case of an error. - const [profileResult, additionalInformationResult] = - await Promise.allSettled([ - profilePromise, - additionalInformationPromise, - ]); - - if (profileResult.status === "rejected") { - throw profileResult.reason; - } - - if (additionalInformationResult.status === "rejected") { - throw additionalInformationResult.reason; - } - - return { - profile: profileResult.value, - additionalInformation: additionalInformationResult.value, - }; + const handle = await this.startCaptureAndStopProfiler(); + + // Start both calls in parallel + const profilePromise = this.getPreviouslyCapturedProfileDataBulk(handle); + const additionalInformationPromise = + this.getPreviouslyRetrievedAdditionalInformation(handle); + + // But make sure we wait until the end of both calls even in case of an error. + const [profileResult, additionalInformationResult] = + await Promise.allSettled([profilePromise, additionalInformationPromise]); + + if (profileResult.status === "rejected") { + throw profileResult.reason; } - /** - * Flatten all the sharedLibraries of the different processes in the profile - * into one list of libraries. - * @param {any} processProfile - The profile JSON object - * @returns {Library[]} - */ - function sharedLibrariesFromProfile(processProfile) { - return processProfile.libs.concat( - ...processProfile.processes.map(sharedLibrariesFromProfile) - ); + if (additionalInformationResult.status === "rejected") { + throw additionalInformationResult.reason; } - const profileAsJson = await super.getProfileAndStopProfiler(); return { - profile: profileAsJson, - additionalInformation: { - sharedLibraries: sharedLibrariesFromProfile(profileAsJson), - }, + profile: profileResult.value, + additionalInformation: additionalInformationResult.value, }; } diff --git a/devtools/client/performance-new/@types/perf.d.ts b/devtools/client/performance-new/@types/perf.d.ts @@ -46,39 +46,25 @@ export interface Commands { client: any; targetCommand: { targetFront: { - // @backward-compat { version 143 } This trait is used to support Firefox < 140 - // It should be removed when ESR 128 isn't supported anymore. - getTrait( - traitName: "useBulkTransferForPerformanceProfile" - ): boolean | undefined; getTrait(traitName: string): unknown; }; }; } -/* @backward-compat { version 143 } This interface is only useful for Firefox < - * 140. Starting Firefox 140 a gzipped ArrayBuffer is used in all cases, then - * this interface can be replaced by MockedExports.ProfileAndAdditionalInformation - * directly after we stop supporting older versions. - */ -export interface ProfileAndAdditionalInformation { - profile: ArrayBuffer | MinimallyTypedGeckoProfile; - additionalInformation?: MockedExports.ProfileGenerationAdditionalInformation; -} - /** * TS-TODO - Stub. */ export interface PerfFront { startProfiler: (options: RecordingSettings) => Promise<boolean>; - getProfileAndStopProfiler: () => Promise<ProfileAndAdditionalInformation>; + getProfileAndStopProfiler: () => Promise<MockedExports.ProfileAndAdditionalInformation>; - /* Note that this front also has getProfileAndStopProfilerBulk and + /* Note that this front also has startCaptureAndStopProfiler and * getPreviouslyRetrievedAdditionalInformation, but we don't * want to be able to call these functions directly, so they're commented out * in this interface, only specified for documentation purposes. */ - // getProfileAndStopProfilerBulk: () => Promise<ArrayBuffer> - // getPreviouslyRetrievedAdditionalInformation: () => Promise<MockedExports.ProfileGenerationAdditionalInformation>; + // startCaptureAndStopProfiler: () => Promise<number>; + // getPreviouslyCapturedProfileDataBulk: (handle: number) => Promise<ArrayBuffer>; + // getPreviouslyRetrievedAdditionalInformation: (handle: number) => Promise<MockedExports.ProfileGenerationAdditionalInformation>; stopProfilerAndDiscardProfile: () => Promise<void>; getSymbolTable: ( path: string, @@ -106,14 +92,7 @@ export interface PreferenceFront { } export interface RootTraits { - // @backward-compat { version 143 } - // In Firefox >= 140, this will be true, and will be missing in older - // versions. The functionality controlled by this property can be cleaned up - // once ESR 128 isn't supported anymore. - useBulkTransferForPerformanceProfile?: boolean; - - // There are other properties too, but we don't list them here as they're not - // related to the performance panel. + // There are no traits used by the performance front end at the moment. } export type RecordingState = @@ -190,17 +169,6 @@ export interface Library { arch: string; } -/** - * Only provide types for the GeckoProfile as much as we need it. There is no - * reason to maintain a full type definition here. - * @backward-compat { version 143 } This interface is only useful for Firefox < - * 140. Starting Firefox 140 a gzipped ArrayBuffer is used in all cases. - */ -export interface MinimallyTypedGeckoProfile { - libs: Library[]; - processes: MinimallyTypedGeckoProfile[]; -} - export type GetSymbolTableCallback = ( debugName: string, breakpadId: string @@ -216,7 +184,7 @@ export interface SymbolicationService { * profile has been obtained. */ export type OnProfileReceived = ( - profileAndAdditionalInformation: ProfileAndAdditionalInformation | null, + profileAndAdditionalInformation: MockedExports.ProfileAndAdditionalInformation | null, error?: Error | string ) => void; @@ -605,9 +573,7 @@ type StatusQueryResponse = { }; type EnableMenuButtonResponse = void; -/* @backward-compat { version 143 } When the target is < v140, this is a JS - * object. Starting v140 this is an ArrayBuffer containing a gzipped profile. */ -type GetProfileResponse = ArrayBuffer | MinimallyTypedGeckoProfile; +type GetProfileResponse = ArrayBuffer; type GetExternalMarkersResponse = Array<object>; type GetExternalPowerTracksResponse = Array<object>; type GetSymbolTableResponse = SymbolTableAsTuple; @@ -651,9 +617,7 @@ export type ProfilerBrowserInfo = { export type ProfileCaptureResult = | { type: "SUCCESS"; - /* @backward-compat { version 143 } When the target is < v140, this is a JS - * object. Starting v140 this is an ArrayBuffer containing a gzipped profile. */ - profile: MinimallyTypedGeckoProfile | ArrayBuffer; + profile: ArrayBuffer; } | { type: "ERROR"; diff --git a/devtools/client/performance-new/store/actions.js b/devtools/client/performance-new/store/actions.js @@ -16,7 +16,6 @@ const selectors = require("resource://devtools/client/performance-new/store/sele * @typedef {import("../@types/perf").RecordingSettings} RecordingSettings * @typedef {import("../@types/perf").Presets} Presets * @typedef {import("../@types/perf").PanelWindow} PanelWindow - * @typedef {import("perf").ProfileAndAdditionalInformation} ProfileAndAdditionalInformation */ /** @@ -178,7 +177,7 @@ exports.startRecording = perfFront => { /** * Stops the profiler, and opens the profile in a new window. * @param {PerfFront} perfFront - * @return {ThunkAction<Promise<ProfileAndAdditionalInformation>>} + * @return {ThunkAction<Promise<MockedExports.ProfileAndAdditionalInformation>>} */ exports.getProfileAndStopProfiler = perfFront => { return async ({ dispatch }) => { diff --git a/devtools/server/actors/perf.js b/devtools/server/actors/perf.js @@ -146,17 +146,6 @@ exports.PerfActor = class PerfActor extends Actor { return [Array.from(addr), Array.from(index), Array.from(buffer)]; } - /* @backward-compat { version 140 } - * Version 140 introduced getProfileAndStopProfilerBulk below, a more - * efficient version of getProfileAndStopProfiler. getProfileAndStopProfiler - * needs to stay in the spec to support older versions of Firefox, so it's - * also present here. */ - async getProfileAndStopProfiler() { - throw new Error( - "Unexpected getProfileAndStopProfiler function called in Firefox v140+. Most likely you're using an older version of Firefox to debug this application. Please use at least Firefox v140." - ); - } - async startCaptureAndStopProfiler() { if (!IS_SUPPORTED_PLATFORM) { throw new Error("Profiling is not supported on this platform."); diff --git a/devtools/server/actors/root.js b/devtools/server/actors/root.js @@ -146,9 +146,6 @@ class RootActor extends Actor { // updated (https://github.com/firefox-devtools/vscode-firefox-debug/issues/391). // Contact Holger Benl (hbenl) for topics related to the extension. supportsEnableWindowGlobalThreadActors: true, - // @backward-compat { version 143 } Use the bulk API to transfer the - // performance profile data. - useBulkTransferForPerformanceProfile: true, }; } diff --git a/devtools/shared/specs/perf.js b/devtools/shared/specs/perf.js @@ -46,15 +46,6 @@ const perfDescription = { response: { value: RetVal("boolean") }, }, - /* @backward-compat { version 143 } - * Version 140 introduced getProfileAndStopProfilerBulk below, a more - * efficient version of getProfileAndStopProfiler. getProfileAndStopProfiler - * needs to stay to support older versions of Firefox. */ - getProfileAndStopProfiler: { - request: {}, - response: RetVal("nullable:json"), - }, - startCaptureAndStopProfiler: { request: {}, response: { value: RetVal("number") },