@@ -2883,34 +2883,32 @@ export function reserveFunctionsInThread(
28832883}
28842884
28852885/**
2886- * From a valid call node path, this function returns a list of information
2887- * about each function in this path: their names and their origins .
2886+ * Returns whether the given sample has a stack which is non-null and not just
2887+ * a single function with the name '(root)' .
28882888 */
2889- export function getFuncNamesAndOriginsForPath (
2890- path: CallNodeAndCategoryPath ,
2889+ export function isSampleWithNonEmptyStack (
2890+ sampleIndex: IndexIntoSamplesTable ,
28912891 thread: Thread
2892- ): Array<{
2893- funcName: string,
2894- category: IndexIntoCategoryList,
2895- isFrameLabel: boolean,
2896- origin: string,
2897- }> {
2898- const { funcTable, stringTable, resourceTable } = thread;
2892+ ): boolean {
2893+ const { samples, stackTable, frameTable, funcTable, stringTable } = thread;
28992894
2900- return path.map((frame) => {
2901- const { category, func } = frame;
2902- return {
2903- funcName: stringTable.getString(funcTable.name[func]),
2904- category: category,
2905- isFrameLabel: funcTable.resource[func] === -1,
2906- origin: getOriginAnnotationForFunc(
2907- func,
2908- funcTable,
2909- resourceTable,
2910- stringTable
2911- ),
2912- };
2913- });
2895+ const stackIndex = samples.stack[sampleIndex];
2896+ if (stackIndex === null) {
2897+ return false;
2898+ }
2899+
2900+ if (stackTable.prefix[stackIndex] !== null) {
2901+ // Stack contains at least two frames.
2902+ return true;
2903+ }
2904+
2905+ // Stack is only a single frame. Is it the '(root)' frame that Firefox puts
2906+ // in its profiles?
2907+ const frameIndex = stackTable.frame[stackIndex];
2908+ const funcIndex = frameTable.func[frameIndex];
2909+ const funcNameStringIndex = funcTable.name[funcIndex];
2910+ const funcName = stringTable.getString(funcNameStringIndex);
2911+ return funcName !== '(root)';
29142912}
29152913
29162914/**
0 commit comments