Skip to content

Commit f68bcfd

Browse files
Lightning00Bladedevtools-frontend-scoped@luci-project-accounts.iam.gserviceaccount.com
authored andcommitted
Expose which issue are supported
We need a way to know what is supported and what is not from the MCP to reduce some noise in the output. For that expose a new function to check things against. Bug: none Change-Id: I0a3ecad4df5c030b747f3712ed2839f3cc9c8bcf Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7761323 Reviewed-by: Alex Rudenko <alexrudenko@chromium.org> Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
1 parent f36d656 commit f68bcfd

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

front_end/models/issues_manager/IssuesManager.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,4 +357,15 @@ describeWithMockConnection('IssuesManager', () => {
357357
navigate(frame, {loaderId: 'loaderId2' as Protocol.Network.LoaderId});
358358
assert.strictEqual(issuesManager.numberOfIssues(), 0);
359359
});
360+
361+
describe('isIssueCodeSupported', () => {
362+
it('returns true for supported issue codes', () => {
363+
assert.isTrue(IssuesManager.IssuesManager.isIssueCodeSupported(Protocol.Audits.InspectorIssueCode.CookieIssue));
364+
});
365+
366+
it('returns false for unsupported issue codes', () => {
367+
assert.isFalse(IssuesManager.IssuesManager.isIssueCodeSupported(
368+
'NonExistentIssueCode' as Protocol.Audits.InspectorIssueCode));
369+
});
370+
});
360371
});

front_end/models/issues_manager/IssuesManager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ const issueCodeHandlers = new Map<
155155
],
156156
]);
157157

158+
export function isIssueCodeSupported(code: Protocol.Audits.InspectorIssueCode): boolean {
159+
return issueCodeHandlers.has(code);
160+
}
161+
158162
/**
159163
* Each issue reported by the backend can result in multiple `Issue` instances.
160164
* Handlers are simple functions hard-coded into a map.

0 commit comments

Comments
 (0)