Skip to content

Commit

Permalink
Fix a bug where all tracks were hidden (Resolves firefox-devtools#1611)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregtatum committed Jul 30, 2019
1 parent 361f18b commit 6e62e50
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/profile-logic/tracks.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,13 @@ export function getVisibleThreads(
globalTrackIndex < globalTracks.length;
globalTrackIndex++
) {
if (hiddenGlobalTracks.has(globalTrackIndex)) {
continue;
}
const globalTrack = globalTracks[globalTrackIndex];
if (globalTrack.type === 'process') {
const { mainThreadIndex, pid } = globalTrack;
if (
mainThreadIndex !== null &&
!hiddenGlobalTracks.has(globalTrackIndex)
) {
if (mainThreadIndex !== null) {
visibleThreads.push(mainThreadIndex);
}
const tracks = ensureExists(
Expand Down
21 changes: 21 additions & 0 deletions src/test/store/receive-profile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,27 @@ describe('actions/receive-profile', function() {
]);
});

it('will not hide the only global track', function() {
const store = blankStore();
const { profile } = getProfileFromTextSamples(
`A[cat:Idle] A[cat:Idle] A[cat:Idle] A[cat:Idle] A[cat:Idle]`,
`work work work work work`
);
const [threadA, threadB] = profile.threads;
threadA.name = 'GeckoMain';
threadA.processType = 'tab';
threadA.pid = 111;
threadB.name = 'Other';
threadB.processType = 'default';
threadB.pid = 111;

store.dispatch(viewProfile(profile));
expect(getHumanReadableTracks(store.getState())).toEqual([
'show [thread GeckoMain tab] SELECTED',
' - show [thread Other]',
]);
});

it('will hide idle content threads with no RefreshDriverTick markers', function() {
const store = blankStore();
const { profile } = getProfileFromTextSamples(
Expand Down

0 comments on commit 6e62e50

Please sign in to comment.