commit | b0fcd1892e20f79fa8707891faae51b0e9cbfef3 | [log] [tgz] |
---|---|---|
author | Andrés Olivares <[email protected]> | Tue Feb 21 10:13:28 2023 |
committer | Devtools-frontend LUCI CQ <devtools-frontend-scoped@luci-project-accounts.iam.gserviceaccount.com> | Tue Feb 21 11:30:50 2023 |
tree | ac20dc9fc86820b4abf08c71e8f4b9aeab4f6e2d | |
parent | cac26355cd1d019c46fb819fe5f829af8be7c51d [diff] [blame] |
Add support to clear ActionRegistry and ActionRegistration in one call It's probable that when ActionRegistry.removeInstance is called, one would also like to remove all the registered actions at that point. This is specially probable in unit-test scenarios. For this reason, a new `reset` function is added to action registry that achieves both things. As a drive-by fix, the actions added in the action_registration test are removed so that they don't pollute other tests. Bug: none Change-Id: Iaf49c53e61b3f9159a48b369693e5a40fcef44f7 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4274349 Auto-Submit: Andres Olivares <[email protected]> Reviewed-by: Jack Franklin <[email protected]> Commit-Queue: Jack Franklin <[email protected]>
diff --git a/front_end/ui/legacy/ActionRegistration.ts b/front_end/ui/legacy/ActionRegistration.ts index da133b4..c7cb955 100644 --- a/front_end/ui/legacy/ActionRegistration.ts +++ b/front_end/ui/legacy/ActionRegistration.ts
@@ -151,6 +151,11 @@ registeredActionExtensions.push(new Action(registration)); } +export function reset(): void { + actionIdSet.clear(); + registeredActionExtensions.length = 0; +} + export function getRegisteredActionExtensions(): Array<Action> { return registeredActionExtensions .filter(