@@ -7,6 +7,7 @@ import { getProfileFromTextSamples } from '../fixtures/profiles/processed-profil
77import {
88 completeSymbolTable ,
99 partialSymbolTable ,
10+ jitDumpSymbolTable ,
1011} from '../fixtures/example-symbol-table' ;
1112import type { ExampleSymbolTable } from '../fixtures/example-symbol-table' ;
1213import type { MarkerPayload } from 'firefox-profiler/types' ;
@@ -29,6 +30,7 @@ import { doSymbolicateProfile } from '../../actions/receive-profile';
2930import {
3031 changeSelectedCallNode ,
3132 changeExpandedCallNodes ,
33+ changeImplementationFilter ,
3234} from '../../actions/profile-view' ;
3335import { formatTree , formatStack } from '../fixtures/utils' ;
3436import { assertSetContainsOnly } from '../fixtures/custom-assertions' ;
@@ -44,18 +46,17 @@ import { SymbolsNotFoundError } from '../../profile-logic/errors';
4446 */
4547describe ( 'doSymbolicateProfile' , function ( ) {
4648 // Initialize a store, an unsymbolicated profile, and helper functions.
47- function init ( ) {
49+ function init ( profile = _createUnsymbolicatedProfile ( ) ) {
4850 // The rejection in `requestSymbolsFromServer` outputs an error log, let's
4951 // silence it here. The fact that we call it is tested in
5052 // symbol-store.test.js.
5153 jest . spyOn ( console , 'log' ) . mockImplementation ( ( ) => { } ) ;
5254
53- const profile = _createUnsymbolicatedProfile ( ) ;
5455 const store = storeWithProfile ( profile ) ;
5556
56- let symbolTable = completeSymbolTable ;
57+ let firefoxSymbolTable = completeSymbolTable ;
5758 function switchSymbolTable ( otherSymbolTable : ExampleSymbolTable ) {
58- symbolTable = otherSymbolTable ;
59+ firefoxSymbolTable = otherSymbolTable ;
5960 }
6061 let symbolicationProviderMode : 'from-server' | 'from-browser' =
6162 'from-browser' ;
@@ -67,12 +68,19 @@ describe('doSymbolicateProfile', function () {
6768 requestSymbolsFromServer : async ( requests : LibSymbolicationRequest [ ] ) =>
6869 requests . map < LibSymbolicationResponse > ( ( request ) => {
6970 const { lib, addresses } = request ;
70- if ( lib . debugName !== 'firefox.pdb' ) {
71+
72+ const symbolTables : Partial < Record < string , ExampleSymbolTable > > = {
73+ 'firefox.pdb' : firefoxSymbolTable ,
74+ 'jit-52344.dump' : jitDumpSymbolTable ,
75+ } ;
76+
77+ const symbolTable = symbolTables [ lib . debugName ] ;
78+ if ( symbolTable === undefined ) {
7179 return {
7280 type : 'ERROR' as const ,
7381 request,
7482 error : new SymbolsNotFoundError (
75- 'Should only have lib called firefox.pdb' ,
83+ `Lib name ${ lib . debugName } is not in the list of known names: ${ Object . keys ( symbolTables ) . join ( ', ' ) } ` ,
7684 lib
7785 ) ,
7886 } ;
@@ -123,7 +131,7 @@ describe('doSymbolicateProfile', function () {
123131 }
124132 return readSymbolsFromSymbolTable (
125133 addresses ,
126- symbolTable . asTuple ,
134+ firefoxSymbolTable . asTuple ,
127135 ( s : string ) => s
128136 ) ;
129137 } ,
@@ -478,6 +486,28 @@ describe('doSymbolicateProfile', function () {
478486 ] ) ;
479487 } ) ;
480488
489+ it ( 'inline frames for JS functions appear in the JS-only call tree after symbolication' , async ( ) => {
490+ const {
491+ store : { dispatch, getState } ,
492+ profile,
493+ symbolStore,
494+ switchSymbolProviderMode,
495+ } = init ( _createUnsymbolicatedJitProfile ( ) ) ;
496+
497+ switchSymbolProviderMode ( 'from-server' ) ;
498+
499+ await doSymbolicateProfile ( dispatch , profile , symbolStore ) ;
500+
501+ // Check that the `useState.js` node shows up in the JS-only call tree.
502+ // This function is an inline frame from the jitdump symbol info.
503+ dispatch ( changeImplementationFilter ( 'js' ) ) ;
504+ expect ( formatTree ( getCallTree ( getState ( ) ) ) ) . toEqual ( [
505+ '- renderButton.js (total: 1, self: —)' ,
506+ ' - useState.js (total: 1, self: 1)' ,
507+ '- runJobs.js (total: 1, self: 1)' ,
508+ ] ) ;
509+ } ) ;
510+
481511 it ( 'can re-symbolicate a partially-symbolicated profile even if it needs to add funcs to the funcTable' , async ( ) => {
482512 const {
483513 store : { dispatch, getState } ,
@@ -623,3 +653,11 @@ function _createUnsymbolicatedProfile() {
623653
624654 return profile ;
625655}
656+
657+ function _createUnsymbolicatedJitProfile ( ) {
658+ // See jitDumpSyms (in example-symbol-table.ts) for the corresponding symbols.
659+ const { profile } = getProfileFromTextSamples ( `
660+ renderButton.js[lib:jit-52344.dump][address:a] runJobs.js[lib:jit-52344.dump][address:2000]
661+ ` ) ;
662+ return profile ;
663+ }
0 commit comments