Skip to content

Commit 64846b4

Browse files
committed
Merge branch 'develop' into eva/axComponents
2 parents 2adef8f + 12eabc3 commit 64846b4

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

src/backend/routers/linkFiber.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ export default function linkFiber(mode: Status): () => Promise<void> {
100100
},
101101
'*',
102102
);
103+
window.postMessage(
104+
{
105+
action: 'recordAXSnap',
106+
payload: 'recordAXSnap',
107+
},
108+
'*',
109+
);
103110
// --------------INITIATE EVENT LISTENER FOR VISIBILITY CHANGE--------------
104111
/**
105112
* Initiate an event listener for when there is a change to the visibility of the react target application (the browser tab)

src/extension/background.js

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,39 @@ let activeTab;
1313
const tabsObj = {};
1414
// Will store Chrome web vital metrics and their corresponding values.
1515
const 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.
1851
function 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

Comments
 (0)