From 6e62e5083343731cfc8882af9e53557bc4b711f4 Mon Sep 17 00:00:00 2001 From: Greg Tatum Date: Tue, 30 Jul 2019 12:48:22 -0500 Subject: [PATCH] Fix a bug where all tracks were hidden (Resolves #1611) --- src/profile-logic/tracks.js | 8 ++++---- src/test/store/receive-profile.test.js | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/profile-logic/tracks.js b/src/profile-logic/tracks.js index d1cbefc4a9..ea9529f8ec 100644 --- a/src/profile-logic/tracks.js +++ b/src/profile-logic/tracks.js @@ -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( diff --git a/src/test/store/receive-profile.test.js b/src/test/store/receive-profile.test.js index 63497ee841..8141287155 100644 --- a/src/test/store/receive-profile.test.js +++ b/src/test/store/receive-profile.test.js @@ -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(