mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-11-02 11:19:15 +08:00
[lighthouse] Remove deprecated internal flags
Lighthouse issue: https://github.com/GoogleChrome/lighthouse/issues/13980 Bug: None Change-Id: I290d56d1cbf9d61f0ef6b10ce5a5009eddec8460 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3965275 Reviewed-by: Connor Clark <cjamcl@chromium.org> Commit-Queue: Connor Clark <cjamcl@chromium.org>
This commit is contained in:
committed by
Devtools-frontend LUCI CQ
parent
3caf3035df
commit
c2246db2ba
@@ -125,7 +125,7 @@ async function invokeLH(action: string, args: any): Promise<unknown> {
|
||||
}
|
||||
|
||||
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
||||
const config = args.config || self.createConfig(args.categoryIDs, flags.emulatedFormFactor);
|
||||
const config = args.config || self.createConfig(args.categoryIDs, flags.formFactor);
|
||||
const url = args.url;
|
||||
|
||||
// Handle legacy Lighthouse runner path.
|
||||
|
||||
@@ -346,21 +346,16 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
|
||||
}
|
||||
|
||||
getFlags(): {
|
||||
internalDisableDeviceScreenEmulation: boolean,
|
||||
emulatedFormFactor: (string|undefined),
|
||||
formFactor: (string|undefined),
|
||||
legacyNavigation: boolean,
|
||||
mode: string,
|
||||
} {
|
||||
const flags = {
|
||||
// DevTools handles all the emulation. This tells Lighthouse to not bother with emulation.
|
||||
internalDisableDeviceScreenEmulation: true,
|
||||
};
|
||||
const flags = {};
|
||||
for (const runtimeSetting of RuntimeSettings) {
|
||||
runtimeSetting.setFlags(flags, runtimeSetting.setting.get());
|
||||
}
|
||||
return flags as {
|
||||
internalDisableDeviceScreenEmulation: boolean,
|
||||
emulatedFormFactor: (string | undefined),
|
||||
formFactor: (string | undefined),
|
||||
legacyNavigation: boolean,
|
||||
mode: string,
|
||||
};
|
||||
@@ -487,7 +482,7 @@ export const RuntimeSettings: RuntimeSetting[] = [
|
||||
description: i18nLazyString(UIStrings.applyMobileEmulationDuring),
|
||||
setFlags: (flags: Flags, value: string|boolean): void => {
|
||||
// See Audits.AuditsPanel._setupEmulationAndProtocolConnection()
|
||||
flags.emulatedFormFactor = value;
|
||||
flags.formFactor = value;
|
||||
},
|
||||
options: [
|
||||
{label: i18nLazyString(UIStrings.mobile), value: 'mobile'},
|
||||
|
||||
@@ -454,8 +454,6 @@ export class LighthousePanel extends UI.Panel.Panel {
|
||||
* We set the device emulation on the DevTools-side for two reasons:
|
||||
* 1. To workaround some odd device metrics emulation bugs like occuluding viewports
|
||||
* 2. To get the attractive device outline
|
||||
*
|
||||
* We also set flags.internalDisableDeviceScreenEmulation = true to let LH only apply UA emulation
|
||||
*/
|
||||
private async setupEmulationAndProtocolConnection(): Promise<void> {
|
||||
const flags = this.controller.getFlags();
|
||||
@@ -475,10 +473,10 @@ export class LighthousePanel extends UI.Panel.Panel {
|
||||
};
|
||||
|
||||
emulationModel.toolbarControlsEnabledSetting().set(false);
|
||||
if ('emulatedFormFactor' in flags && flags.emulatedFormFactor === 'desktop') {
|
||||
if ('formFactor' in flags && flags.formFactor === 'desktop') {
|
||||
emulationModel.enabledSetting().set(false);
|
||||
emulationModel.emulate(EmulationModel.DeviceModeModel.Type.None, null, null);
|
||||
} else if (flags.emulatedFormFactor === 'mobile') {
|
||||
} else if (flags.formFactor === 'mobile') {
|
||||
emulationModel.enabledSetting().set(true);
|
||||
emulationModel.deviceOutlineSetting().set(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user