From 2cfe733e30e0909678d28f71f350590c0c112b44 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Thu, 1 Aug 2024 21:03:45 +0200 Subject: [PATCH] cherry-pick(#31961): fix(trace-viewer): make 'hide route actions' work for .NET --- packages/trace-viewer/src/ui/modelUtil.ts | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/trace-viewer/src/ui/modelUtil.ts b/packages/trace-viewer/src/ui/modelUtil.ts index 5949f4406c..c82cbc99a6 100644 --- a/packages/trace-viewer/src/ui/modelUtil.ts +++ b/packages/trace-viewer/src/ui/modelUtil.ts @@ -411,9 +411,28 @@ function collectSources(actions: trace.ActionTraceEvent[], errorDescriptors: Err } const kRouteMethods = new Set([ - 'page.route', 'page.routefromhar', 'page.unroute', 'page.unrouteall', - 'browsercontext.route', 'browsercontext.routefromhar', 'browsercontext.unroute', 'browsercontext.unrouteall', + 'page.route', + 'page.routefromhar', + 'page.unroute', + 'page.unrouteall', + 'browsercontext.route', + 'browsercontext.routefromhar', + 'browsercontext.unroute', + 'browsercontext.unrouteall', ]); +{ + // .NET adds async suffix. + for (const method of [...kRouteMethods]) + kRouteMethods.add(method + 'async'); + // Python methods which contain underscores. + for (const method of [ + 'page.route_from_har', + 'page.unroute_all', + 'context.route_from_har', + 'context.unroute_all', + ]) + kRouteMethods.add(method); +} export function isRouteAction(action: ActionTraceEventInContext) { return action.class === 'Route' || kRouteMethods.has(action.apiName.toLowerCase()); }