Skip to content

Commit 2f65044

Browse files
paulirishDevtools-frontend LUCI CQ
authored andcommitted
RPP: Restore toolbar buttons until standalone use is sniffable
This is a partial revert of https://crrev.com/c/6544870 The primaryPageTarget signal doesn't match our expectations in Some edge scenarios like remote-debugging and hosted mode. Bug: 432043754 Change-Id: Iccf224cdf7ab8be046d46af47592c883e2da5751 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6819861 Commit-Queue: Connor Clark <[email protected]> Reviewed-by: Connor Clark <[email protected]> Auto-Submit: Paul Irish <[email protected]>
1 parent 7d8e5d3 commit 2f65044

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

front_end/panels/timeline/TimelinePanel.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
509509
this.panelToolbar.wrappable = true;
510510
this.panelRightToolbar = timelineToolbarContainer.createChild('devtools-toolbar');
511511
this.panelRightToolbar.role = 'presentation';
512-
if (!isNode && this.hasPrimaryTarget()) {
512+
if (!isNode && this.canRecord()) {
513513
this.createSettingsPane();
514514
this.updateShowSettingsToolbarButton();
515515
}
@@ -1045,17 +1045,18 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
10451045
* not possible, like an enhanced trace (which opens a new devtools window) or
10461046
* trace.cafe.
10471047
*/
1048-
private hasPrimaryTarget(): boolean {
1049-
return Boolean(SDK.TargetManager.TargetManager.instance().primaryPageTarget()?.sessionId);
1048+
private canRecord(): boolean {
1049+
// TODO(paulirish) Determine a more robust method as checking `primaryPageTarget()?.sessionId` isn't accurate.
1050+
return true;
10501051
}
10511052

10521053
private populateToolbar(): void {
1053-
const hasPrimaryTarget = this.hasPrimaryTarget();
1054+
const canRecord = this.canRecord();
10541055

1055-
if (hasPrimaryTarget || isNode) {
1056+
if (canRecord || isNode) {
10561057
this.panelToolbar.appendToolbarItem(UI.Toolbar.Toolbar.createActionButton(this.toggleRecordAction));
10571058
}
1058-
if (hasPrimaryTarget) {
1059+
if (canRecord) {
10591060
this.panelToolbar.appendToolbarItem(UI.Toolbar.Toolbar.createActionButton(this.recordReloadAction));
10601061
}
10611062

@@ -1100,7 +1101,7 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
11001101
this.panelToolbar.appendToolbarItem(this.loadButton);
11011102
this.panelToolbar.appendToolbarItem(this.saveButton);
11021103

1103-
if (hasPrimaryTarget) {
1104+
if (canRecord) {
11041105
this.panelToolbar.appendSeparator();
11051106

11061107
if (!isNode) {
@@ -1129,7 +1130,7 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
11291130
this.showMemoryToolbarCheckbox =
11301131
this.createSettingCheckbox(this.showMemorySetting, i18nString(UIStrings.showMemoryTimeline));
11311132

1132-
if (hasPrimaryTarget) {
1133+
if (canRecord) {
11331134
// GC
11341135
this.panelToolbar.appendToolbarItem(this.showMemoryToolbarCheckbox);
11351136
this.panelToolbar.appendToolbarItem(UI.Toolbar.Toolbar.createActionButton('components.collect-garbage'));
@@ -1155,7 +1156,7 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
11551156
}
11561157

11571158
// Settings
1158-
if (!isNode && hasPrimaryTarget) {
1159+
if (!isNode && canRecord) {
11591160
this.panelRightToolbar.appendSeparator();
11601161
this.panelRightToolbar.appendToolbarItem(this.showSettingsPaneButton);
11611162
}
@@ -1659,7 +1660,7 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
16591660
}
16601661

16611662
private updateSettingsPaneVisibility(): void {
1662-
if (isNode || !this.hasPrimaryTarget()) {
1663+
if (isNode || !this.canRecord()) {
16631664
return;
16641665
}
16651666
if (this.showSettingsPaneSetting.get()) {
@@ -1945,7 +1946,7 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
19451946
this.toggleRecordAction.setToggled(this.state === State.RECORDING);
19461947
this.toggleRecordAction.setEnabled(this.state === State.RECORDING || this.state === State.IDLE);
19471948

1948-
if (!this.hasPrimaryTarget()) {
1949+
if (!this.canRecord()) {
19491950
return;
19501951
}
19511952

0 commit comments

Comments
 (0)