@@ -13,6 +13,39 @@ let activeTab;
1313const tabsObj = { } ;
1414// Will store Chrome web vital metrics and their corresponding values.
1515const metrics = { } ;
16+
17+ // function pruning the chrome ax tree and pulling the relevant properties
18+ const pruneAxTree = ( axTree ) => {
19+ const axArr = [ ] ;
20+ for ( const node of axTree ) {
21+ const {
22+ backendDOMNodeId,
23+ childIds,
24+ ignored,
25+ name,
26+ nodeId,
27+ ignoredReasons,
28+ parentId,
29+ properties } = node ;
30+
31+ const axNode = {
32+ "backendDOMNodeId" : backendDOMNodeId ,
33+ "childIds" : childIds ,
34+ "ignored" : ignored ,
35+ "name" : name ,
36+ "nodeId" : nodeId ,
37+ "ignoredReasons" : ignoredReasons ,
38+ "parentId" : parentId ,
39+ "properties" : properties
40+ } ;
41+
42+ axArr . push ( axNode ) ;
43+ }
44+
45+ return axArr ;
46+ } ;
47+
48+
1649// This function will create the first instance of the test app's tabs object
1750// which will hold test app's snapshots, link fiber tree info, chrome tab info, etc.
1851function createTabObj ( title ) {
@@ -26,6 +59,9 @@ function createTabObj(title) {
2659 // snapshots is an array of ALL state snapshots for stateful and stateless
2760 // components the Reactime tab working on a specific user application
2861 snapshots : [ ] ,
62+ // axSnapshots is an array of the chrome ax tree at different points for state and stateless applications
63+ // functionality to add snapshots is done later
64+ axSnapshots : [ ] ,
2965 // index here is the tab index that shows total amount of state changes
3066 index : 0 ,
3167 //* currLocation points to the current state the user is checking
@@ -308,7 +344,8 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
308344 'Accessibility.getFullAXTree' ,
309345 { } ,
310346 ( response ) => {
311- console . log ( response ) ;
347+ // function pruning the ax tree
348+ tabsObj [ tabId ] . axSnapshots = pruneAxTree ( response . nodes ) ;
312349 chrome . debugger . detach ( { tabId : tabId } ) ;
313350 } ,
314351 ) ;
0 commit comments