зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1611815 - Fix thrown error about presetName om the performance-new devtools panel; r=canaltinova
The reducer errors in the implementation of the DevTools panel, as the presetName was not being fetched from the preferences in the debuggee. This fixes that. TypeScript caught this, but I guess I forgot to check it. Differential Revision: https://phabricator.services.mozilla.com/D61128 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
32056c5b6e
Коммит
1c15092dfe
|
@ -63,7 +63,8 @@ const INTERVAL_PREF = "devtools.performance.recording.interval";
|
|||
const FEATURES_PREF = "devtools.performance.recording.features";
|
||||
/** @type {PerformancePref["Threads"]} */
|
||||
const THREADS_PREF = "devtools.performance.recording.threads";
|
||||
|
||||
/** @type {PerformancePref["Preset"]} */
|
||||
const PRESET_PREF = "devtools.performance.recording.preset";
|
||||
/** @type {PerformancePref["ObjDirs"]} */
|
||||
const OBJDIRS_PREF = "devtools.performance.recording.objdirs";
|
||||
/** @type {PerformancePref["UIBaseUrl"]} */
|
||||
|
@ -230,6 +231,23 @@ async function _getIntPref(preferenceFront, prefName, defaultValue) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to get a char preference value from the debuggee.
|
||||
*
|
||||
* @param {PreferenceFront} preferenceFront
|
||||
* @param {string} prefName
|
||||
* @param {string} defaultValue Default value of the preference. We don't need
|
||||
* this value since Firefox 72, but we keep it to support older Firefox versions.
|
||||
* @returns Promise<string>
|
||||
*/
|
||||
async function _getCharPref(preferenceFront, prefName, defaultValue) {
|
||||
try {
|
||||
return await preferenceFront.getCharPref(prefName);
|
||||
} catch (error) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the recording settings from the preferences. These settings are stored once
|
||||
* for local debug targets, and another set of settings for remote targets. This
|
||||
|
@ -240,12 +258,21 @@ async function _getIntPref(preferenceFront, prefName, defaultValue) {
|
|||
* @param {RecordingStateFromPreferences} defaultPrefs Default preference values.
|
||||
* We don't need this value since Firefox 72, but we keep it to support older
|
||||
* Firefox versions.
|
||||
* @returns {Promise<RecordingStateFromPreferences>}
|
||||
*/
|
||||
async function getRecordingPreferencesFromDebuggee(
|
||||
preferenceFront,
|
||||
defaultPrefs
|
||||
) {
|
||||
const [entries, interval, features, threads, objdirs] = await Promise.all([
|
||||
const [
|
||||
presetName,
|
||||
entries,
|
||||
interval,
|
||||
features,
|
||||
threads,
|
||||
objdirs,
|
||||
] = await Promise.all([
|
||||
_getCharPref(preferenceFront, PRESET_PREF, defaultPrefs.presetName),
|
||||
_getIntPref(preferenceFront, ENTRIES_PREF, defaultPrefs.entries),
|
||||
_getIntPref(preferenceFront, INTERVAL_PREF, defaultPrefs.interval),
|
||||
_getArrayOfStringsPref(
|
||||
|
@ -257,7 +284,7 @@ async function getRecordingPreferencesFromDebuggee(
|
|||
_getArrayOfStringsHostPref(OBJDIRS_PREF, defaultPrefs.objdirs),
|
||||
]);
|
||||
|
||||
return { entries, interval, features, threads, objdirs };
|
||||
return { presetName, entries, interval, features, threads, objdirs };
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче