You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RPP: Reland hiding irrelevant buttons in standalone usages
With a revised signal for `canRecord` we now hide the RPP Record button,
and others, in standalone scenarios.
Bug:432043754
Change-Id: I7d470474ec0e481a2e257f2b40519e47b2b999bf
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6943527
Reviewed-by: Connor Clark <cjamcl@chromium.org>
Commit-Queue: Paul Irish <paulirish@chromium.org>
Copy file name to clipboardExpand all lines: front_end/panels/timeline/TimelinePanel.ts
+18-5Lines changed: 18 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1053,13 +1053,26 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
1053
1053
}
1054
1054
1055
1055
/**
1056
-
* Returns false if this was loaded in a standalone context such that recording is
1057
-
* not possible, like an enhanced trace (which opens a new devtools window) or
1058
-
* trace.cafe.
1056
+
* Returns false if DevTools is in a standalone context where tracing/recording are NOT available.
1057
+
*
1058
+
* This includes scenarios like:
1059
+
* - viewing an enhanced trace
1060
+
* - viewing a trace in trace.cafe
1061
+
* - other devtools_app.html scenarios without valid `ws=` param.
1062
+
* - See also the `isHostedMode` comment in `InspectorFrontendHost.ts`
1063
+
*
1064
+
* Possible signals to find a no-record (NR) context:
1065
+
* - `primaryPageTarget()?.sessionId` is empty in NR, but populated when viewing an enhanced trace.
1066
+
* - `primaryPageTarget.#capabilitiesMask` There's a tracing capability but the advertised capabilities are quite unreliable.
1067
+
* - `primaryPageTarget.targets().length === 1` Mostly correct for NC but its 2 when viewing an enhanced trace.
1068
+
* - `primaryPageTarget.router().connection()` Perhaps StubConnection or RehydratingConnection but MainConnection is incorrectly used sometimes. (eg devtools://devtools/bundled/devtools_app.html)
1069
+
* - `resourceTreeModel?.mainFrame === null`. Correct for NR, HOWEVER Node.js canRecord despite no main frame.
1070
+
* - `rootTarget.type !== 'tab'` Has potential but it lies. (It's "browser" for Node despite a node type)
1071
+
*
1072
+
* The best signal, for now, is this combo (`isNode || hasMainFrame`), which is both well-maintained and correct in all known cases:
1059
1073
*/
1060
1074
privatecanRecord(): boolean{
1061
-
// TODO(paulirish) Determine a more robust method as checking `primaryPageTarget()?.sessionId` isn't accurate.
0 commit comments