isSelectedFrameVisible.js (951B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ 4 5 import { getSelectedLocation } from "./sources"; 6 import { getSelectedFrame } from "./pause"; 7 8 function getGeneratedId(source) { 9 if (source.isOriginal) { 10 return source.generatedSource.id; 11 } 12 13 return source.id; 14 } 15 16 /* 17 * Checks to if the selected frame's source is currently 18 * selected. 19 */ 20 export function isSelectedFrameVisible(state) { 21 const selectedLocation = getSelectedLocation(state); 22 const selectedFrame = getSelectedFrame(state); 23 24 if (!selectedFrame || !selectedLocation) { 25 return false; 26 } 27 28 if (selectedLocation.source.isOriginal) { 29 return selectedLocation.source.id === selectedFrame.location.source.id; 30 } 31 32 return ( 33 selectedLocation.source.id === getGeneratedId(selectedFrame.location.source) 34 ); 35 }