[IWA] Add presubmit to prevent direct use of IWA features
Both IsolatedWebAppDevMode and IsolatedWebAppUnmanagedInstall are complex features that rely on a number of preconditions. It's hence undesired & error-prone to allow these feature flags to be checked directly. Bug: 328095981 Change-Id: Ib21b0219f2cd99345fc9625a94ecfb3cfc7c8d0b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5372859 Commit-Queue: Andrew Rayskiy <greengrape@google.com> Reviewed-by: Christian Flach <cmfcmf@chromium.org> Reviewed-by: Dominic Battre <battre@chromium.org> Cr-Commit-Position: refs/heads/main@{#1275557}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
57290ddb61
commit
cdd45e7392
27
PRESUBMIT.py
27
PRESUBMIT.py
@ -1818,6 +1818,33 @@ _BANNED_CPP_FUNCTIONS : Sequence[BanRule] = (
|
||||
'^content/shell/browser/shell_content_browser_client.cc'
|
||||
)
|
||||
),
|
||||
BanRule(
|
||||
pattern = r'features::kIsolatedWebAppDevMode',
|
||||
explanation = (
|
||||
'Do not use `features::kIsolatedWebAppDevMode` directly to guard code ',
|
||||
'related to Isolated Web App Developer Mode. ',
|
||||
'Use `web_app::IsIwaDevModeEnabled()` instead.',
|
||||
),
|
||||
treat_as_error = True,
|
||||
excluded_paths = _TEST_CODE_EXCLUDED_PATHS + (
|
||||
'^chrome/browser/about_flags.cc',
|
||||
'^chrome/browser/web_applications/isolated_web_apps/isolated_web_app_features.cc',
|
||||
'^chrome/browser/ui/startup/bad_flags_prompt.cc',
|
||||
)
|
||||
),
|
||||
BanRule(
|
||||
pattern = r'features::kIsolatedWebAppUnmanagedInstall',
|
||||
explanation = (
|
||||
'Do not use `features::kIsolatedWebAppUnmanagedInstall` directly to ',
|
||||
'guard code related to unmanaged install flow for Isolated Web Apps. ',
|
||||
'Use `web_app::IsIwaUnmanagedInstallEnabled()` instead.',
|
||||
),
|
||||
treat_as_error = True,
|
||||
excluded_paths = _TEST_CODE_EXCLUDED_PATHS + (
|
||||
'^chrome/browser/about_flags.cc',
|
||||
'^chrome/browser/web_applications/isolated_web_apps/isolated_web_app_features.cc',
|
||||
)
|
||||
),
|
||||
BanRule(
|
||||
pattern = r'/\babsl::(optional|nullopt|make_optional|in_place|in_place_t)\b',
|
||||
explanation = (
|
||||
|
@ -506,9 +506,11 @@ COMPONENT_EXPORT(CHROME_FEATURES)
|
||||
BASE_DECLARE_FEATURE(kIsolatedWebAppAutomaticUpdates);
|
||||
#endif
|
||||
|
||||
// LINT.IfChange
|
||||
COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kIsolatedWebAppDevMode);
|
||||
COMPONENT_EXPORT(CHROME_FEATURES)
|
||||
BASE_DECLARE_FEATURE(kIsolatedWebAppUnmanagedInstall);
|
||||
// LINT.ThenChange(//PRESUBMIT.py)
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
COMPONENT_EXPORT(CHROME_FEATURES)
|
||||
|
Reference in New Issue
Block a user